clivly 0.9.5 → 0.9.7

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 (78) hide show
  1. package/README.md +22 -3
  2. package/core-auth-adapter.cjs +1 -1
  3. package/core-auth-adapter.mjs +1 -1
  4. package/core-drizzle.cjs +1 -1
  5. package/core-drizzle.d.cts +1 -1
  6. package/core-drizzle.d.mts +1 -1
  7. package/core-drizzle.mjs +1 -1
  8. package/core-entity-config.cjs +1 -1
  9. package/core-entity-config.mjs +1 -1
  10. package/core-mapping-form.cjs +1 -1
  11. package/core-mapping-form.mjs +1 -1
  12. package/core-mappings-config.cjs +1 -1
  13. package/core-mappings-config.mjs +1 -1
  14. package/core-sync-engine.cjs +1 -1
  15. package/core-sync-engine.mjs +1 -1
  16. package/core-view-compiler.cjs +1 -1
  17. package/core-view-compiler.mjs +1 -1
  18. package/core.cjs +14 -9
  19. package/core.d.cts +2 -2
  20. package/core.d.mts +2 -2
  21. package/core.mjs +9 -9
  22. package/{drizzle-CiK8MMEZ.d.mts → drizzle-BmDDgAIF.d.mts} +3 -1
  23. package/{drizzle-bfjVzYR6.cjs → drizzle-DcB7OfBp.cjs} +9 -1
  24. package/{drizzle-DEtRrqtc.d.cts → drizzle-ixVV4pPN.d.cts} +3 -1
  25. package/{drizzle-3kvhkwO7.mjs → drizzle-wbcuG-cy.mjs} +9 -1
  26. package/drizzle.cjs +61 -10
  27. package/drizzle.d.cts +9 -3
  28. package/drizzle.d.mts +9 -3
  29. package/drizzle.mjs +61 -10
  30. package/{entity-config-B74SPOUZ.mjs → entity-config-C8IIkrmX.mjs} +34 -5
  31. package/{entity-config-7sGCk_nw.cjs → entity-config-CPM-Tp-d.cjs} +34 -5
  32. package/index.cjs +41 -9
  33. package/index.mjs +41 -9
  34. package/internal-BLKMnIIZ.cjs +259 -0
  35. package/internal-BpVh_J77.mjs +212 -0
  36. package/{internal-o2M7FGlR.d.mts → internal-CvlFk3KC.d.mts} +82 -2
  37. package/{internal-wCXSELDN.d.cts → internal-DGUOLQAq.d.cts} +82 -2
  38. package/internal-drizzle.cjs +1 -1
  39. package/internal-drizzle.d.cts +1 -1
  40. package/internal-drizzle.d.mts +1 -1
  41. package/internal-drizzle.mjs +1 -1
  42. package/internal-entity-config.cjs +1 -1
  43. package/internal-entity-config.mjs +1 -1
  44. package/internal-entity-heuristics.cjs +1 -1
  45. package/internal-entity-heuristics.mjs +1 -1
  46. package/internal-mappings-config.cjs +1 -1
  47. package/internal-mappings-config.mjs +1 -1
  48. package/internal-sync-engine.cjs +1 -1
  49. package/internal-sync-engine.mjs +1 -1
  50. package/internal-view-compiler.cjs +1 -1
  51. package/internal-view-compiler.mjs +1 -1
  52. package/internal.cjs +13 -7
  53. package/internal.d.cts +2 -2
  54. package/internal.d.mts +2 -2
  55. package/internal.mjs +8 -8
  56. package/{mappings-config-CLyEg0sf.cjs → mappings-config-CBwL3FVh.cjs} +1 -1
  57. package/{mappings-config-DQS_s4dg.mjs → mappings-config-DUKBe6OS.mjs} +1 -1
  58. package/{namespace-probe-Cn7voAd0.d.mts → namespace-probe-BQ4imnV7.d.mts} +85 -2
  59. package/{namespace-probe-BoGI18dQ.d.cts → namespace-probe-DZIGdvlm.d.cts} +85 -2
  60. package/package.json +1 -1
  61. package/{projection-Dz6_i1-w.cjs → projection-DEwL-D8R.cjs} +6 -0
  62. package/{projection-CSGJbZlZ.mjs → projection-hnPSgH6G.mjs} +1 -1
  63. package/{projection-sql-BgnfiGqF.mjs → projection-sql-9zzTVGvf.mjs} +34 -2
  64. package/{projection-sql-Cl1qIn8m.cjs → projection-sql-iHy-Cx6V.cjs} +45 -1
  65. package/{sdk-CM1UO-I7.cjs → sdk-BL9BCzyD.cjs} +354 -20
  66. package/{sdk-DYBDR939.mjs → sdk-CubnsyD9.mjs} +354 -20
  67. package/sdk.cjs +2 -2
  68. package/sdk.d.cts +2 -2
  69. package/sdk.d.mts +2 -2
  70. package/sdk.mjs +2 -2
  71. package/{sync-engine-C4A5jgA4.cjs → sync-engine-BLgwLpR6.cjs} +1 -1
  72. package/{sync-engine-Dt5QQSKO.mjs → sync-engine-B_IzoUSx.mjs} +1 -1
  73. package/{view-compiler-B5nDal14.cjs → view-compiler-BHI5E4QI.cjs} +2 -2
  74. package/{view-compiler-CSYwEWf5.mjs → view-compiler-D_6gfXFr.mjs} +2 -2
  75. package/vite.d.cts +1 -1
  76. package/vite.d.mts +1 -1
  77. package/internal-CykXpEGk.mjs +0 -68
  78. package/internal-DqduZU3l.cjs +0 -97
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_drizzle = require("./drizzle-bfjVzYR6.cjs");
2
+ const require_drizzle = require("./drizzle-DcB7OfBp.cjs");
3
3
  exports.buildColumnsMeta = require_drizzle.buildColumnsMeta;
4
4
  exports.buildUniqueConstraints = require_drizzle.buildUniqueConstraints;
5
5
  exports.discoverFromDrizzle = require_drizzle.discoverFromDrizzle;
@@ -1,2 +1,2 @@
1
- import { n as buildUniqueConstraints, r as discoverFromDrizzle, t as buildColumnsMeta } from "./drizzle-DEtRrqtc.cjs";
1
+ import { n as buildUniqueConstraints, r as discoverFromDrizzle, t as buildColumnsMeta } from "./drizzle-ixVV4pPN.cjs";
2
2
  export { buildColumnsMeta, buildUniqueConstraints, discoverFromDrizzle };
@@ -1,2 +1,2 @@
1
- import { n as buildUniqueConstraints, r as discoverFromDrizzle, t as buildColumnsMeta } from "./drizzle-CiK8MMEZ.mjs";
1
+ import { n as buildUniqueConstraints, r as discoverFromDrizzle, t as buildColumnsMeta } from "./drizzle-BmDDgAIF.mjs";
2
2
  export { buildColumnsMeta, buildUniqueConstraints, discoverFromDrizzle };
@@ -1,2 +1,2 @@
1
- import { n as buildUniqueConstraints, r as discoverFromDrizzle, t as buildColumnsMeta } from "./drizzle-3kvhkwO7.mjs";
1
+ import { n as buildUniqueConstraints, r as discoverFromDrizzle, t as buildColumnsMeta } from "./drizzle-wbcuG-cy.mjs";
2
2
  export { buildColumnsMeta, buildUniqueConstraints, discoverFromDrizzle };
@@ -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-CPM-Tp-d.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-C8IIkrmX.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-CPM-Tp-d.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-C8IIkrmX.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-CBwL3FVh.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-DUKBe6OS.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-CPM-Tp-d.cjs");
4
+ const require_mappings_config = require("./mappings-config-CBwL3FVh.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-BLKMnIIZ.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-C8IIkrmX.mjs";
3
+ import { n as mappingsToEntitiesConfig } from "./mappings-config-DUKBe6OS.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-BpVh_J77.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
- const require_entity_config = require("./entity-config-7sGCk_nw.cjs");
1
+ const require_entity_config = require("./entity-config-CPM-Tp-d.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-B74SPOUZ.mjs";
1
+ import { t as CANONICAL_FIELDS } from "./entity-config-C8IIkrmX.mjs";
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,31 @@ 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
+ }
357
+ /** @see ClivlySDK.describeRemoteProjections */
358
+ interface RemoteProjectionsDescription {
359
+ /** False when no `introspector` is configured — nothing can run. */
360
+ capable: boolean;
361
+ failed: number;
362
+ invalid: number;
363
+ ok: number;
364
+ /** False until a sync has run in this process. */
365
+ ran: boolean;
366
+ skipped: number;
367
+ }
343
368
  interface ClivlySDK {
344
369
  /**
345
370
  * Send a single heartbeat and report the outcome richly: `ok`, the HTTP
@@ -375,6 +400,27 @@ interface ClivlySDK {
375
400
  * anyone who can reach it — set a secret if it's publicly routable.
376
401
  */
377
402
  createClivlyHandler(): (req: Request) => Promise<Response>;
403
+ /**
404
+ * What this app would tell Clivly about dashboard-authored derived objects,
405
+ * right now. Counts rather than the outcomes themselves: this reports
406
+ * health, and the per-object reasons already travel to the dashboard, which
407
+ * is where an author fixes them.
408
+ *
409
+ * Read by `clivly status`.
410
+ */
411
+ describeRemoteProjections(): RemoteProjectionsDescription;
412
+ /**
413
+ * What this app would tell Clivly about its sync trigger route, right now.
414
+ *
415
+ * Computed per call rather than frozen at creation: `resolved` can start as
416
+ * `undefined` and become a real URL once the mounted route has served its
417
+ * first request and observed its own origin.
418
+ *
419
+ * Exists for `clivly status`, which has to tell "no trigger configured"
420
+ * apart from "configured, but still the scaffolded placeholder" — a
421
+ * distinction `resolved` alone erases, since it skips placeholders by design.
422
+ */
423
+ describeSyncTrigger(): SyncTriggerDescription;
378
424
  /** Validate this setup end-to-end (read-only) before the first sync. */
379
425
  doctor(): Promise<DoctorReport>;
380
426
  /**
@@ -451,8 +497,45 @@ interface ClivlySDK {
451
497
  interface NamespaceIntrospector {
452
498
  /** All base table names in the reachable schema. */
453
499
  listTables(): Promise<string[]>;
500
+ /**
501
+ * Build a runnable sync source from a projection, for derived objects
502
+ * authored in the dashboard rather than in `clivly.config.ts`.
503
+ *
504
+ * Optional for the same reason `runProjection` is: an introspector may be
505
+ * hand-written. Absent, remote projections report `skipped` with a reason
506
+ * naming this method, rather than failing the run.
507
+ *
508
+ * This is deliberately the only route to a database handle for remote
509
+ * projections. `drizzleIntrospector(db)` already closes over the
510
+ * connection, so `introspector:` is the single config line that turns
511
+ * dashboard-authored objects on — and the SDK core never holds a raw
512
+ * client.
513
+ */
514
+ projectionSource?(projection: ProjectionMapping, opts: {
515
+ basePkColumn?: string;
516
+ objectType: string;
517
+ }): SyncSource & {
518
+ objectType: string;
519
+ };
520
+ /**
521
+ * Read a few rows through an unsaved projection, for the dashboard's derived
522
+ * object preview. Rows are keyed by field name.
523
+ *
524
+ * Optional because it is the only capability here that needs more than a
525
+ * table name, and because an introspector may be hand-written. Absent, the
526
+ * dashboard says preview is unavailable rather than failing — see
527
+ * `previewProjection`.
528
+ *
529
+ * This is what makes preview cost the host an SDK upgrade and nothing else:
530
+ * `drizzleIntrospector(db)` already closes over the connection, so a config
531
+ * that set `introspector` for the "Namespace reachable" check gains preview
532
+ * without touching a line.
533
+ */
534
+ runProjection?(projection: ProjectionMapping, opts: {
535
+ limit: number;
536
+ }): Promise<Record<string, unknown>[]>;
454
537
  /** Prove a table is genuinely selectable (SELECT ... LIMIT 1). Throws if unreachable/denied. */
455
538
  sampleSelect(table: string): Promise<void>;
456
539
  }
457
540
  //#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 };
541
+ export { RemoteProjectionsDescription 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, SyncSource as v, SyncTriggerDescription as y };
@@ -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,31 @@ 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
+ }
357
+ /** @see ClivlySDK.describeRemoteProjections */
358
+ interface RemoteProjectionsDescription {
359
+ /** False when no `introspector` is configured — nothing can run. */
360
+ capable: boolean;
361
+ failed: number;
362
+ invalid: number;
363
+ ok: number;
364
+ /** False until a sync has run in this process. */
365
+ ran: boolean;
366
+ skipped: number;
367
+ }
343
368
  interface ClivlySDK {
344
369
  /**
345
370
  * Send a single heartbeat and report the outcome richly: `ok`, the HTTP
@@ -375,6 +400,27 @@ interface ClivlySDK {
375
400
  * anyone who can reach it — set a secret if it's publicly routable.
376
401
  */
377
402
  createClivlyHandler(): (req: Request) => Promise<Response>;
403
+ /**
404
+ * What this app would tell Clivly about dashboard-authored derived objects,
405
+ * right now. Counts rather than the outcomes themselves: this reports
406
+ * health, and the per-object reasons already travel to the dashboard, which
407
+ * is where an author fixes them.
408
+ *
409
+ * Read by `clivly status`.
410
+ */
411
+ describeRemoteProjections(): RemoteProjectionsDescription;
412
+ /**
413
+ * What this app would tell Clivly about its sync trigger route, right now.
414
+ *
415
+ * Computed per call rather than frozen at creation: `resolved` can start as
416
+ * `undefined` and become a real URL once the mounted route has served its
417
+ * first request and observed its own origin.
418
+ *
419
+ * Exists for `clivly status`, which has to tell "no trigger configured"
420
+ * apart from "configured, but still the scaffolded placeholder" — a
421
+ * distinction `resolved` alone erases, since it skips placeholders by design.
422
+ */
423
+ describeSyncTrigger(): SyncTriggerDescription;
378
424
  /** Validate this setup end-to-end (read-only) before the first sync. */
379
425
  doctor(): Promise<DoctorReport>;
380
426
  /**
@@ -451,8 +497,45 @@ interface ClivlySDK {
451
497
  interface NamespaceIntrospector {
452
498
  /** All base table names in the reachable schema. */
453
499
  listTables(): Promise<string[]>;
500
+ /**
501
+ * Build a runnable sync source from a projection, for derived objects
502
+ * authored in the dashboard rather than in `clivly.config.ts`.
503
+ *
504
+ * Optional for the same reason `runProjection` is: an introspector may be
505
+ * hand-written. Absent, remote projections report `skipped` with a reason
506
+ * naming this method, rather than failing the run.
507
+ *
508
+ * This is deliberately the only route to a database handle for remote
509
+ * projections. `drizzleIntrospector(db)` already closes over the
510
+ * connection, so `introspector:` is the single config line that turns
511
+ * dashboard-authored objects on — and the SDK core never holds a raw
512
+ * client.
513
+ */
514
+ projectionSource?(projection: ProjectionMapping, opts: {
515
+ basePkColumn?: string;
516
+ objectType: string;
517
+ }): SyncSource & {
518
+ objectType: string;
519
+ };
520
+ /**
521
+ * Read a few rows through an unsaved projection, for the dashboard's derived
522
+ * object preview. Rows are keyed by field name.
523
+ *
524
+ * Optional because it is the only capability here that needs more than a
525
+ * table name, and because an introspector may be hand-written. Absent, the
526
+ * dashboard says preview is unavailable rather than failing — see
527
+ * `previewProjection`.
528
+ *
529
+ * This is what makes preview cost the host an SDK upgrade and nothing else:
530
+ * `drizzleIntrospector(db)` already closes over the connection, so a config
531
+ * that set `introspector` for the "Namespace reachable" check gains preview
532
+ * without touching a line.
533
+ */
534
+ runProjection?(projection: ProjectionMapping, opts: {
535
+ limit: number;
536
+ }): Promise<Record<string, unknown>[]>;
454
537
  /** Prove a table is genuinely selectable (SELECT ... LIMIT 1). Throws if unreachable/denied. */
455
538
  sampleSelect(table: string): Promise<void>;
456
539
  }
457
540
  //#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 };
541
+ export { RemoteProjectionsDescription 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, SyncSource as v, SyncTriggerDescription as y };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clivly",
3
- "version": "0.9.5",
3
+ "version": "0.9.7",
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 };
@@ -1,4 +1,4 @@
1
- import { r as identityRefs, t as BASE_REF } from "./projection-CSGJbZlZ.mjs";
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 { quoteIdent as a, compileProjectionSelect as i, compileProjectionIdentity as n, compileProjectionJoins as r, compileProjectionFrom as t };
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-Dz6_i1-w.cjs");
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() {