clivly 0.9.7 → 0.10.1

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 (136) hide show
  1. package/README.md +9 -9
  2. package/{adapter-C2eRbBfo.d.cts → adapter-1TN0zohk.d.cts} +1 -1
  3. package/{adapter-D5LRa-NA.d.mts → adapter-uxirB88i.d.mts} +1 -1
  4. package/{auth-adapter-Bjgo8LhN.d.mts → auth-adapter-CXTiW3Mb.d.cts} +1 -1
  5. package/{auth-adapter-DWzgl5Yq.d.cts → auth-adapter-DSuYwv1c.d.mts} +1 -1
  6. package/auth-better-auth.d.cts +1 -1
  7. package/auth-better-auth.d.mts +1 -1
  8. package/auth-clerk.d.cts +1 -1
  9. package/auth-clerk.d.mts +1 -1
  10. package/auth-workos.d.cts +1 -1
  11. package/auth-workos.d.mts +1 -1
  12. package/core-adapter.d.cts +1 -1
  13. package/core-adapter.d.mts +1 -1
  14. package/core-auth-adapter.d.cts +1 -1
  15. package/core-auth-adapter.d.mts +1 -1
  16. package/core-drizzle.d.cts +1 -1
  17. package/core-drizzle.d.mts +1 -1
  18. package/core-entity-config.cjs +1 -1
  19. package/core-entity-config.d.cts +1 -1
  20. package/core-entity-config.d.mts +1 -1
  21. package/core-entity-config.mjs +1 -1
  22. package/core-entity-heuristics.cjs +1 -0
  23. package/core-entity-heuristics.d.cts +3 -3
  24. package/core-entity-heuristics.d.mts +3 -3
  25. package/core-entity-heuristics.mjs +2 -2
  26. package/core-mapping-form.d.cts +1 -1
  27. package/core-mapping-form.d.mts +1 -1
  28. package/core-mappings-config.cjs +1 -1
  29. package/core-mappings-config.d.cts +1 -1
  30. package/core-mappings-config.d.mts +1 -1
  31. package/core-mappings-config.mjs +1 -1
  32. package/core-sync-engine.cjs +1 -1
  33. package/core-sync-engine.d.cts +1 -1
  34. package/core-sync-engine.d.mts +1 -1
  35. package/core-sync-engine.mjs +1 -1
  36. package/core-types.cjs +4 -0
  37. package/core-types.d.cts +2 -2
  38. package/core-types.d.mts +2 -2
  39. package/core-types.mjs +2 -1
  40. package/core-view-compiler.cjs +1 -1
  41. package/core-view-compiler.d.cts +1 -1
  42. package/core-view-compiler.d.mts +1 -1
  43. package/core-view-compiler.mjs +1 -1
  44. package/core.cjs +17 -15
  45. package/core.d.cts +10 -10
  46. package/core.d.mts +10 -10
  47. package/core.mjs +9 -8
  48. package/{drizzle-BmDDgAIF.d.mts → drizzle-DTOuGXEn.d.cts} +1 -1
  49. package/{drizzle-ixVV4pPN.d.cts → drizzle-SGapoly2.d.mts} +1 -1
  50. package/drizzle.cjs +2 -2
  51. package/drizzle.d.cts +3 -3
  52. package/drizzle.d.mts +3 -3
  53. package/drizzle.mjs +2 -2
  54. package/{entity-config-C8IIkrmX.mjs → entity-config-C4d3K9CP.mjs} +81 -4
  55. package/{entity-config-B2RA53nw.d.cts → entity-config-DNQAMbMS.d.cts} +27 -1
  56. package/{entity-config-B2RA53nw.d.mts → entity-config-DNQAMbMS.d.mts} +27 -1
  57. package/{entity-config-CPM-Tp-d.cjs → entity-config-DgAe0_YD.cjs} +86 -3
  58. package/index.cjs +24 -14
  59. package/index.mjs +24 -14
  60. package/internal-BAOG5eE4.d.mts +226 -0
  61. package/internal-BHJ0X3fC.d.cts +226 -0
  62. package/internal-Bgiimp5D.mjs +144 -0
  63. package/internal-Cz59xMj8.cjs +167 -0
  64. package/internal-adapter.d.cts +1 -1
  65. package/internal-adapter.d.mts +1 -1
  66. package/internal-auth-adapter.d.cts +1 -1
  67. package/internal-auth-adapter.d.mts +1 -1
  68. package/internal-drizzle.d.cts +1 -1
  69. package/internal-drizzle.d.mts +1 -1
  70. package/internal-entity-config.cjs +1 -1
  71. package/internal-entity-config.d.cts +1 -1
  72. package/internal-entity-config.d.mts +1 -1
  73. package/internal-entity-config.mjs +1 -1
  74. package/internal-entity-heuristics.cjs +34 -1
  75. package/internal-entity-heuristics.d.cts +8 -2
  76. package/internal-entity-heuristics.d.mts +8 -2
  77. package/internal-entity-heuristics.mjs +34 -2
  78. package/internal-mapping-form.d.cts +1 -1
  79. package/internal-mapping-form.d.mts +1 -1
  80. package/internal-mappings-config.cjs +1 -1
  81. package/internal-mappings-config.d.cts +1 -1
  82. package/internal-mappings-config.d.mts +1 -1
  83. package/internal-mappings-config.mjs +1 -1
  84. package/internal-sync-engine.cjs +1 -1
  85. package/internal-sync-engine.d.cts +1 -1
  86. package/internal-sync-engine.d.mts +1 -1
  87. package/internal-sync-engine.mjs +1 -1
  88. package/internal-types.cjs +4 -0
  89. package/internal-types.d.cts +2 -2
  90. package/internal-types.d.mts +2 -2
  91. package/internal-types.mjs +2 -1
  92. package/internal-view-compiler.cjs +1 -1
  93. package/internal-view-compiler.d.cts +1 -1
  94. package/internal-view-compiler.d.mts +1 -1
  95. package/internal-view-compiler.mjs +1 -1
  96. package/internal.cjs +17 -15
  97. package/internal.d.cts +10 -10
  98. package/internal.d.mts +10 -10
  99. package/internal.mjs +9 -8
  100. package/{mapping-form-DH77BXLv.d.mts → mapping-form-Cc7Ewv8c.d.mts} +1 -1
  101. package/{mapping-form-J0aU6O7l.d.cts → mapping-form-DwdbYAfR.d.cts} +1 -1
  102. package/{mappings-config-D9dsonoi.d.mts → mappings-config-Be9D43Np.d.mts} +1 -1
  103. package/{mappings-config-RQLGx8ub.d.cts → mappings-config-DUt4-9iO.d.cts} +1 -1
  104. package/{mappings-config-CBwL3FVh.cjs → mappings-config-Dx9ldgdf.cjs} +2 -16
  105. package/{mappings-config-DUKBe6OS.mjs → mappings-config-MoXBeI8p.mjs} +1 -15
  106. package/{namespace-probe-BQ4imnV7.d.mts → namespace-probe-9ScMDR0t.d.mts} +1 -1
  107. package/{namespace-probe-DZIGdvlm.d.cts → namespace-probe-DC4tbmLj.d.cts} +1 -1
  108. package/package.json +1 -1
  109. package/{projection-hnPSgH6G.mjs → projection-CSGJbZlZ.mjs} +1 -1
  110. package/{projection-DEwL-D8R.cjs → projection-Dz6_i1-w.cjs} +0 -6
  111. package/{projection-sql-iHy-Cx6V.cjs → projection-sql-CbXCKt3s.cjs} +1 -1
  112. package/{projection-sql-9zzTVGvf.mjs → projection-sql-iHoiYr1R.mjs} +1 -1
  113. package/{sdk-BL9BCzyD.cjs → sdk-B1vX4kUJ.cjs} +26 -6
  114. package/{sdk-CubnsyD9.mjs → sdk-D6gX0TXS.mjs} +26 -6
  115. package/sdk.cjs +2 -2
  116. package/sdk.d.cts +2 -2
  117. package/sdk.d.mts +2 -2
  118. package/sdk.mjs +2 -2
  119. package/{sync-engine-BLgwLpR6.cjs → sync-engine-B0FT1ax6.cjs} +1 -1
  120. package/{sync-engine-B_IzoUSx.mjs → sync-engine-CTSIcLlZ.mjs} +1 -1
  121. package/{sync-engine-BG2O1an2.d.cts → sync-engine-Df0kHAoJ.d.cts} +2 -2
  122. package/{sync-engine-DgQbrJON.d.mts → sync-engine-ugFacJ6G.d.mts} +2 -2
  123. package/{types-B1oRXdNP.d.mts → types-Cq1uHUKp.d.cts} +28 -2
  124. package/{types-B1oRXdNP.d.cts → types-Cq1uHUKp.d.mts} +28 -2
  125. package/types-Cq5gHCTq.cjs +20 -0
  126. package/types-YJTkXKzU.mjs +9 -0
  127. package/{view-compiler-D_6gfXFr.mjs → view-compiler-BzKk8nY3.mjs} +2 -2
  128. package/{view-compiler-Bo7pqXW3.d.mts → view-compiler-D3zp9S3K.d.cts} +1 -1
  129. package/{view-compiler-CmEdAMwj.d.cts → view-compiler-TpzDTu7z.d.mts} +1 -1
  130. package/{view-compiler-BHI5E4QI.cjs → view-compiler-ZKZbd3SK.cjs} +2 -2
  131. package/vite.d.cts +1 -1
  132. package/vite.d.mts +1 -1
  133. package/internal-BLKMnIIZ.cjs +0 -259
  134. package/internal-BpVh_J77.mjs +0 -212
  135. package/internal-CvlFk3KC.d.mts +0 -180
  136. package/internal-DGUOLQAq.d.cts +0 -180
package/internal.d.mts CHANGED
@@ -1,11 +1,11 @@
1
- import { C as UpdateDealInput, S as UpdateContactInput, _ as Task, a as ContactFilters, b as TaskPriority, c as CreateCompanyInput, d as CreateTaskInput, f as CrmRole, g as RecordSource, h as Note, i as Contact, l as CreateContactInput, m as DealStage, n as ActivityType, o as ContactStatus, p as Deal, r as Company, s as CreateActivityInput, t as Activity, u as CreateDealInput, v as TaskEntityType, w as UpdateTaskInput, x as TaskStatus, y as TaskFilters } from "./types-B1oRXdNP.mjs";
2
- import { a as authCustom, i as MembershipResolver, n as ClivlyUser, r as CrmMembership, t as ClivlyAuthAdapter } from "./auth-adapter-Bjgo8LhN.mjs";
3
- import { t as CRMAdapter } from "./adapter-D5LRa-NA.mjs";
4
- import { A as BASE_REF, C as defineClivlyConfig, D as relationshipSchema, F as ProjectionRef, I as identityRefs, L as projectionSchema, M as ProjectionIdentity, N as ProjectionJoin, O as relationshipsSchema, P as ProjectionMapping, T as filterSchema, _ as MATERIALIZING_CONCEPTS, a as ClivlyEntitiesConfig, b as RelationshipVia, d as CrmConcept, g as FilterValue, h as FilterExpr, i as ClivlyConfigError, j as ProjectionFieldBinding, k as validateEntitiesConfig, l as ConfigValidationError, m as DiscoveredSchemaTable, n as CRM_CONCEPTS, p as DiscoveredColumnMeta, s as ClivlyEntityConfig, t as CANONICAL_FIELDS, u as ConfigValidationResult, v as MaterializingConcept, w as entitiesConfigSchema, x as RelationshipsMap, y as RelationshipSpec } from "./entity-config-B2RA53nw.mjs";
5
- import { i as relationshipViaSignature, n as buildFilterFromDiscriminator, r as buildRelationships, t as RelationshipCandidate } from "./mapping-form-DH77BXLv.mjs";
6
- import { i as mappingsToEntitiesConfig, t as EntityMappingRow } from "./mappings-config-D9dsonoi.mjs";
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
- 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";
1
+ import { A as ValueInterval, C as TaskEntityType, D as UpdateContactInput, E as TaskStatus, O as UpdateDealInput, S as Task, T as TaskPriority, _ as PipelineConfig, a as ContactFilters, b as RecordSource, c as CreateCompanyInput, d as CreateTaskInput, f as CrmRole, g as OPEN_STAGE_TYPE, h as Note, i as Contact, j as isClosedStageType, k as UpdateTaskInput, l as CreateContactInput, m as DealStage, n as ActivityType, o as ContactStatus, p as Deal, r as Company, s as CreateActivityInput, t as Activity, u as CreateDealInput, v as PipelineKind, w as TaskFilters, x as StageType, y as PipelineStageConfig } from "./types-Cq1uHUKp.mjs";
2
+ import { a as authCustom, i as MembershipResolver, n as ClivlyUser, r as CrmMembership, t as ClivlyAuthAdapter } from "./auth-adapter-DSuYwv1c.mjs";
3
+ import { t as CRMAdapter } from "./adapter-uxirB88i.mjs";
4
+ import { A as BASE_REF, C as defineClivlyConfig, D as relationshipSchema, E as projectionFields, F as ProjectionMapping, I as ProjectionRef, L as identityRefs, M as ProjectionFieldBinding, N as ProjectionIdentity, O as relationshipsSchema, P as ProjectionJoin, R as projectionSchema, T as filterSchema, _ as MATERIALIZING_CONCEPTS, a as ClivlyEntitiesConfig, b as RelationshipVia, d as CrmConcept, g as FilterValue, h as FilterExpr, i as ClivlyConfigError, j as PROJECTION_KEY_PATTERN, k as validateEntitiesConfig, l as ConfigValidationError, m as DiscoveredSchemaTable, n as CRM_CONCEPTS, p as DiscoveredColumnMeta, s as ClivlyEntityConfig, t as CANONICAL_FIELDS, u as ConfigValidationResult, v as MaterializingConcept, w as entitiesConfigSchema, x as RelationshipsMap, y as RelationshipSpec } from "./entity-config-DNQAMbMS.mjs";
5
+ import { i as relationshipViaSignature, n as buildFilterFromDiscriminator, r as buildRelationships, t as RelationshipCandidate } from "./mapping-form-Cc7Ewv8c.mjs";
6
+ import { i as mappingsToEntitiesConfig, t as EntityMappingRow } from "./mappings-config-Be9D43Np.mjs";
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-TpzDTu7z.mjs";
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-ugFacJ6G.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 { 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 };
10
+ import { S as joinFansOut, _ as compileProjectionJoins, a as matchesCondition, b as quoteIdent, c as columnMetaFor, d as primaryKeyColumns, f as validateProjection, g as compileProjectionIdentity, h as compileProjectionFrom, i as evaluateStage, l as coversUniqueKey, m as PREVIEW_MAX_ROWS, n as ConditionOp, o as slugify, p as validateProjectionFilter, r as EvaluableRule, s as toObjectTypeSlug, t as Condition, u as hasRichMeta, v as compileProjectionPreview, x as fanOutJoins, y as compileProjectionSelect } from "./internal-BAOG5eE4.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 Condition, type ConditionOp, 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 EvaluableRule, 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, OPEN_STAGE_TYPE, PREVIEW_MAX_ROWS, PROJECTION_KEY_PATTERN, type PersistAction, type PipelineConfig, type PipelineKind, type PipelineStageConfig, type ProjectionFieldBinding, type ProjectionIdentity, type ProjectionJoin, type ProjectionMapping, type ProjectionRef, type RecordSource, type RelationshipCandidate, type RelationshipSpec, type RelationshipVia, type RelationshipsMap, type SourceRow, type StageType, 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, type ValueInterval, authCustom, buildFilterFromDiscriminator, buildRelationships, columnMetaFor, compileEntityView, compileEntityViews, compileProjectionFrom, compileProjectionIdentity, compileProjectionJoins, compileProjectionPreview, compileProjectionSelect, coversUniqueKey, defineClivlyConfig, entitiesConfigSchema, evaluateStage, explainEntitiesConfig, fanOutJoins, filterSchema, hasRichMeta, identityRefs, isClosedStageType, joinFansOut, mappingsToEntitiesConfig, matchesCondition, primaryKeyColumns, projectionFields, projectionSchema, quoteIdent, reconcile, relationshipSchema, relationshipViaSignature, relationshipsSchema, runSync, slugify, toObjectTypeSlug, validateEntitiesConfig, validateProjection, validateProjectionFilter };
package/internal.mjs CHANGED
@@ -1,10 +1,11 @@
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";
1
+ import { i as projectionSchema, n as PROJECTION_KEY_PATTERN, r as identityRefs, t as BASE_REF } from "./projection-CSGJbZlZ.mjs";
2
+ import { _ as joinFansOut, a as MATERIALIZING_CONCEPTS, b as hasRichMeta, c as entitiesConfigSchema, d as relationshipSchema, f as relationshipsSchema, g as fanOutJoins, h as validateProjectionFilter, i as ClivlyConfigError, l as filterSchema, m as validateProjection, n as CRM_CONCEPTS, p as validateEntitiesConfig, s as defineClivlyConfig, t as CANONICAL_FIELDS, u as projectionFields, v as columnMetaFor, x as primaryKeyColumns, y as coversUniqueKey } from "./entity-config-C4d3K9CP.mjs";
3
+ import { n as mappingsToEntitiesConfig } from "./mappings-config-MoXBeI8p.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 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 };
6
+ 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-iHoiYr1R.mjs";
7
+ import { i as toObjectTypeSlug, n as matchesCondition, r as slugify, t as evaluateStage } from "./internal-Bgiimp5D.mjs";
8
+ import { i as explainEntitiesConfig, n as compileEntityView, r as compileEntityViews, t as DEFAULT_VIEW_PREFIX } from "./view-compiler-BzKk8nY3.mjs";
9
+ import { i as runSync, r as reconcile } from "./sync-engine-CTSIcLlZ.mjs";
10
+ import { n as isClosedStageType, t as OPEN_STAGE_TYPE } from "./types-YJTkXKzU.mjs";
11
+ export { BASE_REF, CANONICAL_FIELDS, CRM_CONCEPTS, ClivlyConfigError, DEFAULT_VIEW_PREFIX, MATERIALIZING_CONCEPTS, OPEN_STAGE_TYPE, PREVIEW_MAX_ROWS, PROJECTION_KEY_PATTERN, authCustom, buildFilterFromDiscriminator, buildRelationships, columnMetaFor, compileEntityView, compileEntityViews, compileProjectionFrom, compileProjectionIdentity, compileProjectionJoins, compileProjectionPreview, compileProjectionSelect, coversUniqueKey, defineClivlyConfig, entitiesConfigSchema, evaluateStage, explainEntitiesConfig, fanOutJoins, filterSchema, hasRichMeta, identityRefs, isClosedStageType, joinFansOut, mappingsToEntitiesConfig, matchesCondition, primaryKeyColumns, projectionFields, projectionSchema, quoteIdent, reconcile, relationshipSchema, relationshipViaSignature, relationshipsSchema, runSync, slugify, toObjectTypeSlug, validateEntitiesConfig, validateProjection, validateProjectionFilter };
@@ -1,4 +1,4 @@
1
- import { b as RelationshipVia, h as FilterExpr, x as RelationshipsMap } from "./entity-config-B2RA53nw.mjs";
1
+ import { b as RelationshipVia, h as FilterExpr, x as RelationshipsMap } from "./entity-config-DNQAMbMS.mjs";
2
2
  //#region ../core/src/mapping-form.d.ts
3
3
  /**
4
4
  * A relationship the mapping UI can offer or has configured, in the shape the
@@ -1,4 +1,4 @@
1
- import { b as RelationshipVia, h as FilterExpr, x as RelationshipsMap } from "./entity-config-B2RA53nw.cjs";
1
+ import { b as RelationshipVia, h as FilterExpr, x as RelationshipsMap } from "./entity-config-DNQAMbMS.cjs";
2
2
  //#region ../core/src/mapping-form.d.ts
3
3
  /**
4
4
  * A relationship the mapping UI can offer or has configured, in the shape the
@@ -1,4 +1,4 @@
1
- import { P as ProjectionMapping, a as ClivlyEntitiesConfig, h as FilterExpr, x as RelationshipsMap } from "./entity-config-B2RA53nw.mjs";
1
+ import { F as ProjectionMapping, a as ClivlyEntitiesConfig, h as FilterExpr, x as RelationshipsMap } from "./entity-config-DNQAMbMS.mjs";
2
2
  //#region ../core/src/mappings-config.d.ts
3
3
  /**
4
4
  * Mappings → Entity Config bridge.
@@ -1,4 +1,4 @@
1
- import { P as ProjectionMapping, a as ClivlyEntitiesConfig, h as FilterExpr, x as RelationshipsMap } from "./entity-config-B2RA53nw.cjs";
1
+ import { F as ProjectionMapping, a as ClivlyEntitiesConfig, h as FilterExpr, x as RelationshipsMap } from "./entity-config-DNQAMbMS.cjs";
2
2
  //#region ../core/src/mappings-config.d.ts
3
3
  /**
4
4
  * Mappings → Entity Config bridge.
@@ -1,4 +1,4 @@
1
- const require_entity_config = require("./entity-config-CPM-Tp-d.cjs");
1
+ const require_entity_config = require("./entity-config-DgAe0_YD.cjs");
2
2
  //#region ../core/src/mappings-config.ts
3
3
  const RESERVED_FIELD = "id";
4
4
  /**
@@ -47,26 +47,12 @@ function uniquify(base, used) {
47
47
  used.add(key);
48
48
  return key;
49
49
  }
50
- /**
51
- * A projection's `fields` map, derived mechanically from its bindings.
52
- *
53
- * `ClivlyEntityConfig.fields` is required and read by existing consumers, so a
54
- * projection entity must populate it. The values are ref *tokens*
55
- * (`"base.full_name"`), never host column names — the compiler reads
56
- * `projection.fieldBindings`, and `validateEntitiesConfig` skips the legacy
57
- * column check for projection entities precisely because of this.
58
- */
59
- function projectionFields(projection) {
60
- const fields = {};
61
- for (const [field, binding] of Object.entries(projection.fieldBindings)) fields[field] = `${binding.from.table}.${binding.from.column}`;
62
- return fields;
63
- }
64
50
  function buildEntity(row, refIndex) {
65
51
  const entity = {
66
52
  concept: row.targetConcept,
67
53
  source: row.projection?.baseTable ?? row.sourceTable,
68
54
  role: row.role ?? DEFAULT_ROLE,
69
- fields: row.projection ? projectionFields(row.projection) : canonicalFields(row.targetConcept, row.fieldMap)
55
+ fields: row.projection ? require_entity_config.projectionFields(row.projection) : canonicalFields(row.targetConcept, row.fieldMap)
70
56
  };
71
57
  if (row.projection) entity.projection = row.projection;
72
58
  if (row.targetConcept === "custom" && row.targetObjectTypeId) entity.targetObjectTypeId = row.targetObjectTypeId;
@@ -1,4 +1,4 @@
1
- import { t as CANONICAL_FIELDS } from "./entity-config-C8IIkrmX.mjs";
1
+ import { t as CANONICAL_FIELDS, u as projectionFields } from "./entity-config-C4d3K9CP.mjs";
2
2
  //#region ../core/src/mappings-config.ts
3
3
  const RESERVED_FIELD = "id";
4
4
  /**
@@ -47,20 +47,6 @@ function uniquify(base, used) {
47
47
  used.add(key);
48
48
  return key;
49
49
  }
50
- /**
51
- * A projection's `fields` map, derived mechanically from its bindings.
52
- *
53
- * `ClivlyEntityConfig.fields` is required and read by existing consumers, so a
54
- * projection entity must populate it. The values are ref *tokens*
55
- * (`"base.full_name"`), never host column names — the compiler reads
56
- * `projection.fieldBindings`, and `validateEntitiesConfig` skips the legacy
57
- * column check for projection entities precisely because of this.
58
- */
59
- function projectionFields(projection) {
60
- const fields = {};
61
- for (const [field, binding] of Object.entries(projection.fieldBindings)) fields[field] = `${binding.from.table}.${binding.from.column}`;
62
- return fields;
63
- }
64
50
  function buildEntity(row, refIndex) {
65
51
  const entity = {
66
52
  concept: row.targetConcept,
@@ -1,4 +1,4 @@
1
- import { P as ProjectionMapping, a as ClivlyEntitiesConfig } from "./entity-config-B2RA53nw.mjs";
1
+ import { F as ProjectionMapping, a as ClivlyEntitiesConfig } from "./entity-config-DNQAMbMS.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__";
@@ -1,4 +1,4 @@
1
- import { P as ProjectionMapping, a as ClivlyEntitiesConfig } from "./entity-config-B2RA53nw.cjs";
1
+ import { F as ProjectionMapping, a as ClivlyEntitiesConfig } from "./entity-config-DNQAMbMS.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__";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clivly",
3
- "version": "0.9.7",
3
+ "version": "0.10.1",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Clivly CLI — scaffold a CRM into your app (clivly init).",
@@ -4297,4 +4297,4 @@ function identityRefs(identity, basePkColumn) {
4297
4297
  return identity.parts;
4298
4298
  }
4299
4299
  //#endregion
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 };
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 };
@@ -4303,12 +4303,6 @@ 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
- });
4312
4306
  Object.defineProperty(exports, "PROJECTION_KEY_PATTERN", {
4313
4307
  enumerable: true,
4314
4308
  get: function() {
@@ -1,4 +1,4 @@
1
- const require_projection = require("./projection-DEwL-D8R.cjs");
1
+ const require_projection = require("./projection-Dz6_i1-w.cjs");
2
2
  //#region ../core/src/projection-sql.ts
3
3
  /**
4
4
  * SQL generation for projection-backed entities.
@@ -1,4 +1,4 @@
1
- import { i as identityRefs, t as BASE_REF } from "./projection-hnPSgH6G.mjs";
1
+ import { r as identityRefs, t as BASE_REF } from "./projection-CSGJbZlZ.mjs";
2
2
  //#region ../core/src/projection-sql.ts
3
3
  /**
4
4
  * SQL generation for projection-backed entities.
@@ -1,6 +1,6 @@
1
- const require_projection = require("./projection-DEwL-D8R.cjs");
2
- const require_entity_config = require("./entity-config-CPM-Tp-d.cjs");
3
- const require_mappings_config = require("./mappings-config-CBwL3FVh.cjs");
1
+ const require_projection = require("./projection-Dz6_i1-w.cjs");
2
+ const require_entity_config = require("./entity-config-DgAe0_YD.cjs");
3
+ const require_mappings_config = require("./mappings-config-Dx9ldgdf.cjs");
4
4
  const require_drizzle_meta = require("./drizzle-meta-Bb1JWYqf.cjs");
5
5
  //#region ../sdk/src/deployment-identity.ts
6
6
  const MAX_DEPLOYMENT_ID_LENGTH = 128;
@@ -1646,6 +1646,24 @@ function timingSafeEqual(a, b) {
1646
1646
  }
1647
1647
  const RUN_ID_HEADER = "x-clivly-run-id";
1648
1648
  const SIGNATURE_HEADER = "x-clivly-signature";
1649
+ /**
1650
+ * An error the mounted trigger route should answer with a specific HTTP
1651
+ * status, rather than the generic 500 it uses for a genuinely unhandled
1652
+ * error. A fail-safe rejection (e.g. an unresolvable sample `entityKey`) is a
1653
+ * configuration mismatch the caller can fix — surfacing it as "your app
1654
+ * crashed" sends a developer hunting through their own sync handler instead.
1655
+ */
1656
+ var TriggerRequestError = class extends Error {
1657
+ status;
1658
+ constructor(status, message) {
1659
+ super(message);
1660
+ this.name = new.target.name;
1661
+ this.status = status;
1662
+ }
1663
+ };
1664
+ function triggerErrorStatus(error) {
1665
+ return error instanceof TriggerRequestError ? error.status : 500;
1666
+ }
1649
1667
  const SIGNATURE_TOLERANCE_SECONDS = 300;
1650
1668
  const SIGNATURE_HEADER_RE = /^t=(\d+),v1=([0-9a-f]+)$/;
1651
1669
  const SECONDS_PER_MS = 1e3;
@@ -1971,7 +1989,7 @@ function createClivlySDK(config) {
1971
1989
  };
1972
1990
  const runSampleSync = async (entityKey, runId) => {
1973
1991
  const resolved = resolveSampleSource(config, entityKey);
1974
- if (!resolved) throw new Error(`Clivly sync: sample entityKey "${entityKey}" did not resolve to a configured source`);
1992
+ if (!resolved) throw new TriggerRequestError(400, `Clivly sync: no source is configured for entity "${entityKey}". The dashboard maps this table, but clivly.config declares no matching entity — add it to \`entities\`, or remove the mapping in Integrations → Mapping.`);
1975
1993
  lastPushFailure = null;
1976
1994
  if (!await syncOne(resolved.source, resolved.path, "delta", resolved.objectType, runId, SAMPLE_BATCH_SIZE, SAMPLE_BATCH_SIZE, false)) throw new Error(describePushFailure([resolved.source.entity]));
1977
1995
  };
@@ -2210,7 +2228,9 @@ function createClivlySDK(config) {
2210
2228
  const parseTriggerBody = (rawBody) => {
2211
2229
  if (!rawBody) return {};
2212
2230
  try {
2213
- return JSON.parse(rawBody);
2231
+ const parsed = JSON.parse(rawBody);
2232
+ if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) return {};
2233
+ return parsed;
2214
2234
  } catch {
2215
2235
  return {};
2216
2236
  }
@@ -2243,7 +2263,7 @@ function createClivlySDK(config) {
2243
2263
  ok: false,
2244
2264
  runId,
2245
2265
  error: error instanceof Error ? error.message : String(error)
2246
- }, 500);
2266
+ }, triggerErrorStatus(error));
2247
2267
  }
2248
2268
  };
2249
2269
  const start = async () => {
@@ -1,6 +1,6 @@
1
- import { a as projectionSchema } from "./projection-hnPSgH6G.mjs";
2
- import { b as primaryKeyColumns, m as validateProjection, o as customObjectDeclarations } from "./entity-config-C8IIkrmX.mjs";
3
- import { t as entitiesToMappings } from "./mappings-config-DUKBe6OS.mjs";
1
+ import { i as projectionSchema } from "./projection-CSGJbZlZ.mjs";
2
+ import { m as validateProjection, o as customObjectDeclarations, x as primaryKeyColumns } from "./entity-config-C4d3K9CP.mjs";
3
+ import { t as entitiesToMappings } from "./mappings-config-MoXBeI8p.mjs";
4
4
  import { t as DRIZZLE_META } from "./drizzle-meta-D-5k3n0i.mjs";
5
5
  //#region ../sdk/src/deployment-identity.ts
6
6
  const MAX_DEPLOYMENT_ID_LENGTH = 128;
@@ -1646,6 +1646,24 @@ function timingSafeEqual(a, b) {
1646
1646
  }
1647
1647
  const RUN_ID_HEADER = "x-clivly-run-id";
1648
1648
  const SIGNATURE_HEADER = "x-clivly-signature";
1649
+ /**
1650
+ * An error the mounted trigger route should answer with a specific HTTP
1651
+ * status, rather than the generic 500 it uses for a genuinely unhandled
1652
+ * error. A fail-safe rejection (e.g. an unresolvable sample `entityKey`) is a
1653
+ * configuration mismatch the caller can fix — surfacing it as "your app
1654
+ * crashed" sends a developer hunting through their own sync handler instead.
1655
+ */
1656
+ var TriggerRequestError = class extends Error {
1657
+ status;
1658
+ constructor(status, message) {
1659
+ super(message);
1660
+ this.name = new.target.name;
1661
+ this.status = status;
1662
+ }
1663
+ };
1664
+ function triggerErrorStatus(error) {
1665
+ return error instanceof TriggerRequestError ? error.status : 500;
1666
+ }
1649
1667
  const SIGNATURE_TOLERANCE_SECONDS = 300;
1650
1668
  const SIGNATURE_HEADER_RE = /^t=(\d+),v1=([0-9a-f]+)$/;
1651
1669
  const SECONDS_PER_MS = 1e3;
@@ -1971,7 +1989,7 @@ function createClivlySDK(config) {
1971
1989
  };
1972
1990
  const runSampleSync = async (entityKey, runId) => {
1973
1991
  const resolved = resolveSampleSource(config, entityKey);
1974
- if (!resolved) throw new Error(`Clivly sync: sample entityKey "${entityKey}" did not resolve to a configured source`);
1992
+ if (!resolved) throw new TriggerRequestError(400, `Clivly sync: no source is configured for entity "${entityKey}". The dashboard maps this table, but clivly.config declares no matching entity — add it to \`entities\`, or remove the mapping in Integrations → Mapping.`);
1975
1993
  lastPushFailure = null;
1976
1994
  if (!await syncOne(resolved.source, resolved.path, "delta", resolved.objectType, runId, SAMPLE_BATCH_SIZE, SAMPLE_BATCH_SIZE, false)) throw new Error(describePushFailure([resolved.source.entity]));
1977
1995
  };
@@ -2210,7 +2228,9 @@ function createClivlySDK(config) {
2210
2228
  const parseTriggerBody = (rawBody) => {
2211
2229
  if (!rawBody) return {};
2212
2230
  try {
2213
- return JSON.parse(rawBody);
2231
+ const parsed = JSON.parse(rawBody);
2232
+ if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) return {};
2233
+ return parsed;
2214
2234
  } catch {
2215
2235
  return {};
2216
2236
  }
@@ -2243,7 +2263,7 @@ function createClivlySDK(config) {
2243
2263
  ok: false,
2244
2264
  runId,
2245
2265
  error: error instanceof Error ? error.message : String(error)
2246
- }, 500);
2266
+ }, triggerErrorStatus(error));
2247
2267
  }
2248
2268
  };
2249
2269
  const start = async () => {
package/sdk.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_entity_config = require("./entity-config-CPM-Tp-d.cjs");
3
- const require_sdk = require("./sdk-BL9BCzyD.cjs");
2
+ const require_entity_config = require("./entity-config-DgAe0_YD.cjs");
3
+ const require_sdk = require("./sdk-B1vX4kUJ.cjs");
4
4
  exports.ClivlyAuthError = require_sdk.ClivlyAuthError;
5
5
  exports.ClivlyError = require_sdk.ClivlyError;
6
6
  exports.ClivlyNetworkError = require_sdk.ClivlyNetworkError;
package/sdk.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { C as defineClivlyConfig, S as customObjectDeclarations, a as ClivlyEntitiesConfig, f as CustomObjectDeclaration, k as validateEntitiesConfig, l as ConfigValidationError, m as DiscoveredSchemaTable, u as ConfigValidationResult } from "./entity-config-B2RA53nw.cjs";
2
- import { _ as RemoteProjectionsDescription, a as ClivlyConnectResult, c as ClivlyUser, d as DiscoveredTable, f as DoctorCheck, g as EnsuredObjectTypeResult, h as EnsuredMappingResult, i as ClivlyConnectReason, l as CreateChatSessionHandlerOptions, m as EnsureSchemaResult, n as ChatSessionRequestBody, o as ClivlySDK, p as DoctorReport, r as ChatWidgetVisitor, s as ClivlySDKConfig, u as CursorStore, y as SyncTriggerDescription } from "./namespace-probe-DZIGdvlm.cjs";
1
+ import { C as defineClivlyConfig, S as customObjectDeclarations, a as ClivlyEntitiesConfig, f as CustomObjectDeclaration, k as validateEntitiesConfig, l as ConfigValidationError, m as DiscoveredSchemaTable, u as ConfigValidationResult } from "./entity-config-DNQAMbMS.cjs";
2
+ import { _ as RemoteProjectionsDescription, a as ClivlyConnectResult, c as ClivlyUser, d as DiscoveredTable, f as DoctorCheck, g as EnsuredObjectTypeResult, h as EnsuredMappingResult, i as ClivlyConnectReason, l as CreateChatSessionHandlerOptions, m as EnsureSchemaResult, n as ChatSessionRequestBody, o as ClivlySDK, p as DoctorReport, r as ChatWidgetVisitor, s as ClivlySDKConfig, u as CursorStore, y as SyncTriggerDescription } from "./namespace-probe-DC4tbmLj.cjs";
3
3
  //#region ../sdk/src/trigger-url.d.ts
4
4
  declare function isPlaceholderUrl(value: string): boolean;
5
5
  //#endregion
package/sdk.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { C as defineClivlyConfig, S as customObjectDeclarations, a as ClivlyEntitiesConfig, f as CustomObjectDeclaration, k as validateEntitiesConfig, l as ConfigValidationError, m as DiscoveredSchemaTable, u as ConfigValidationResult } from "./entity-config-B2RA53nw.mjs";
2
- import { _ as RemoteProjectionsDescription, a as ClivlyConnectResult, c as ClivlyUser, d as DiscoveredTable, f as DoctorCheck, g as EnsuredObjectTypeResult, h as EnsuredMappingResult, i as ClivlyConnectReason, l as CreateChatSessionHandlerOptions, m as EnsureSchemaResult, n as ChatSessionRequestBody, o as ClivlySDK, p as DoctorReport, r as ChatWidgetVisitor, s as ClivlySDKConfig, u as CursorStore, y as SyncTriggerDescription } from "./namespace-probe-BQ4imnV7.mjs";
1
+ import { C as defineClivlyConfig, S as customObjectDeclarations, a as ClivlyEntitiesConfig, f as CustomObjectDeclaration, k as validateEntitiesConfig, l as ConfigValidationError, m as DiscoveredSchemaTable, u as ConfigValidationResult } from "./entity-config-DNQAMbMS.mjs";
2
+ import { _ as RemoteProjectionsDescription, a as ClivlyConnectResult, c as ClivlyUser, d as DiscoveredTable, f as DoctorCheck, g as EnsuredObjectTypeResult, h as EnsuredMappingResult, i as ClivlyConnectReason, l as CreateChatSessionHandlerOptions, m as EnsureSchemaResult, n as ChatSessionRequestBody, o as ClivlySDK, p as DoctorReport, r as ChatWidgetVisitor, s as ClivlySDKConfig, u as CursorStore, y as SyncTriggerDescription } from "./namespace-probe-9ScMDR0t.mjs";
3
3
  //#region ../sdk/src/trigger-url.d.ts
4
4
  declare function isPlaceholderUrl(value: string): boolean;
5
5
  //#endregion
package/sdk.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { o as customObjectDeclarations, p as validateEntitiesConfig, s as defineClivlyConfig } from "./entity-config-C8IIkrmX.mjs";
2
- import { a as ClivlyRateLimitError, i as ClivlyNetworkError, n as ClivlyAuthError, o as createChatSessionHandler, r as ClivlyError, s as isPlaceholderUrl, t as createClivlySDK } from "./sdk-CubnsyD9.mjs";
1
+ import { o as customObjectDeclarations, p as validateEntitiesConfig, s as defineClivlyConfig } from "./entity-config-C4d3K9CP.mjs";
2
+ import { a as ClivlyRateLimitError, i as ClivlyNetworkError, n as ClivlyAuthError, o as createChatSessionHandler, r as ClivlyError, s as isPlaceholderUrl, t as createClivlySDK } from "./sdk-D6gX0TXS.mjs";
3
3
  export { ClivlyAuthError, ClivlyError, ClivlyNetworkError, ClivlyRateLimitError, createChatSessionHandler, createClivlySDK, customObjectDeclarations, defineClivlyConfig, isPlaceholderUrl, validateEntitiesConfig };
@@ -1,4 +1,4 @@
1
- const require_view_compiler = require("./view-compiler-BHI5E4QI.cjs");
1
+ const require_view_compiler = require("./view-compiler-ZKZbd3SK.cjs");
2
2
  //#region ../core/src/sync-engine.ts
3
3
  /**
4
4
  * Diff a view's rows against the current mirror population for one entity.
@@ -1,4 +1,4 @@
1
- import { r as compileEntityViews } from "./view-compiler-D_6gfXFr.mjs";
1
+ import { r as compileEntityViews } from "./view-compiler-BzKk8nY3.mjs";
2
2
  //#region ../core/src/sync-engine.ts
3
3
  /**
4
4
  * Diff a view's rows against the current mirror population for one entity.
@@ -1,5 +1,5 @@
1
- import { a as ClivlyEntitiesConfig } from "./entity-config-B2RA53nw.cjs";
2
- import { n as CompiledView, t as CompileOptions } from "./view-compiler-CmEdAMwj.cjs";
1
+ import { a as ClivlyEntitiesConfig } from "./entity-config-DNQAMbMS.cjs";
2
+ import { n as CompiledView, t as CompileOptions } from "./view-compiler-D3zp9S3K.cjs";
3
3
  //#region ../core/src/sync-engine.d.ts
4
4
  /**
5
5
  * Sync engine (Phase 3) — materializes the read-only entity views into Clivly's
@@ -1,5 +1,5 @@
1
- import { a as ClivlyEntitiesConfig } from "./entity-config-B2RA53nw.mjs";
2
- import { n as CompiledView, t as CompileOptions } from "./view-compiler-Bo7pqXW3.mjs";
1
+ import { a as ClivlyEntitiesConfig } from "./entity-config-DNQAMbMS.mjs";
2
+ import { n as CompiledView, t as CompileOptions } from "./view-compiler-TpzDTu7z.mjs";
3
3
  //#region ../core/src/sync-engine.d.ts
4
4
  /**
5
5
  * Sync engine (Phase 3) — materializes the read-only entity views into Clivly's
@@ -1,6 +1,31 @@
1
1
  //#region ../core/src/types.d.ts
2
2
  type ContactStatus = "lead" | "active" | "customer" | "churned";
3
- type DealStage = "lead" | "qualified" | "proposal" | "negotiation" | "won" | "lost";
3
+ type DealStage = string;
4
+ type StageType = "open" | "won" | "lost";
5
+ type PipelineKind = "standard" | "recurring";
6
+ type ValueInterval = "one_time" | "monthly" | "annual";
7
+ /** Named once so SQL predicates and UI fallbacks cannot drift apart. */
8
+ declare const OPEN_STAGE_TYPE: "open";
9
+ /** A closed deal is a historical fact: automation never reopens one. */
10
+ declare function isClosedStageType(type: StageType): boolean;
11
+ interface PipelineStageConfig {
12
+ color: string | null;
13
+ id: string;
14
+ key: DealStage;
15
+ label: string;
16
+ position: number;
17
+ type: StageType;
18
+ valueFixed: number | null;
19
+ }
20
+ interface PipelineConfig {
21
+ id: string;
22
+ isDefault: boolean;
23
+ kind: PipelineKind;
24
+ name: string;
25
+ slug: string;
26
+ sourceMappingId: string | null;
27
+ stages: PipelineStageConfig[];
28
+ }
4
29
  type TaskStatus = "todo" | "in_progress" | "done" | "cancelled";
5
30
  type TaskPriority = "low" | "medium" | "high";
6
31
  type TaskEntityType = "contact" | "company" | "deal";
@@ -103,6 +128,7 @@ interface CreateDealInput {
103
128
  contactId?: string;
104
129
  name: string;
105
130
  owner?: string;
131
+ pipelineId?: string;
106
132
  stage?: DealStage;
107
133
  value?: number;
108
134
  }
@@ -156,4 +182,4 @@ interface TaskFilters {
156
182
  status?: TaskStatus;
157
183
  }
158
184
  //#endregion
159
- export { UpdateDealInput as C, UpdateContactInput as S, Task as _, ContactFilters as a, TaskPriority as b, CreateCompanyInput as c, CreateTaskInput as d, CrmRole as f, RecordSource as g, Note as h, Contact as i, CreateContactInput as l, DealStage as m, ActivityType as n, ContactStatus as o, Deal as p, Company as r, CreateActivityInput as s, Activity as t, CreateDealInput as u, TaskEntityType as v, UpdateTaskInput as w, TaskStatus as x, TaskFilters as y };
185
+ export { ValueInterval as A, TaskEntityType as C, UpdateContactInput as D, TaskStatus as E, UpdateDealInput as O, Task as S, TaskPriority as T, PipelineConfig as _, ContactFilters as a, RecordSource as b, CreateCompanyInput as c, CreateTaskInput as d, CrmRole as f, OPEN_STAGE_TYPE as g, Note as h, Contact as i, isClosedStageType as j, UpdateTaskInput as k, CreateContactInput as l, DealStage as m, ActivityType as n, ContactStatus as o, Deal as p, Company as r, CreateActivityInput as s, Activity as t, CreateDealInput as u, PipelineKind as v, TaskFilters as w, StageType as x, PipelineStageConfig as y };
@@ -1,6 +1,31 @@
1
1
  //#region ../core/src/types.d.ts
2
2
  type ContactStatus = "lead" | "active" | "customer" | "churned";
3
- type DealStage = "lead" | "qualified" | "proposal" | "negotiation" | "won" | "lost";
3
+ type DealStage = string;
4
+ type StageType = "open" | "won" | "lost";
5
+ type PipelineKind = "standard" | "recurring";
6
+ type ValueInterval = "one_time" | "monthly" | "annual";
7
+ /** Named once so SQL predicates and UI fallbacks cannot drift apart. */
8
+ declare const OPEN_STAGE_TYPE: "open";
9
+ /** A closed deal is a historical fact: automation never reopens one. */
10
+ declare function isClosedStageType(type: StageType): boolean;
11
+ interface PipelineStageConfig {
12
+ color: string | null;
13
+ id: string;
14
+ key: DealStage;
15
+ label: string;
16
+ position: number;
17
+ type: StageType;
18
+ valueFixed: number | null;
19
+ }
20
+ interface PipelineConfig {
21
+ id: string;
22
+ isDefault: boolean;
23
+ kind: PipelineKind;
24
+ name: string;
25
+ slug: string;
26
+ sourceMappingId: string | null;
27
+ stages: PipelineStageConfig[];
28
+ }
4
29
  type TaskStatus = "todo" | "in_progress" | "done" | "cancelled";
5
30
  type TaskPriority = "low" | "medium" | "high";
6
31
  type TaskEntityType = "contact" | "company" | "deal";
@@ -103,6 +128,7 @@ interface CreateDealInput {
103
128
  contactId?: string;
104
129
  name: string;
105
130
  owner?: string;
131
+ pipelineId?: string;
106
132
  stage?: DealStage;
107
133
  value?: number;
108
134
  }
@@ -156,4 +182,4 @@ interface TaskFilters {
156
182
  status?: TaskStatus;
157
183
  }
158
184
  //#endregion
159
- export { UpdateDealInput as C, UpdateContactInput as S, Task as _, ContactFilters as a, TaskPriority as b, CreateCompanyInput as c, CreateTaskInput as d, CrmRole as f, RecordSource as g, Note as h, Contact as i, CreateContactInput as l, DealStage as m, ActivityType as n, ContactStatus as o, Deal as p, Company as r, CreateActivityInput as s, Activity as t, CreateDealInput as u, TaskEntityType as v, UpdateTaskInput as w, TaskStatus as x, TaskFilters as y };
185
+ export { ValueInterval as A, TaskEntityType as C, UpdateContactInput as D, TaskStatus as E, UpdateDealInput as O, Task as S, TaskPriority as T, PipelineConfig as _, ContactFilters as a, RecordSource as b, CreateCompanyInput as c, CreateTaskInput as d, CrmRole as f, OPEN_STAGE_TYPE as g, Note as h, Contact as i, isClosedStageType as j, UpdateTaskInput as k, CreateContactInput as l, DealStage as m, ActivityType as n, ContactStatus as o, Deal as p, Company as r, CreateActivityInput as s, Activity as t, CreateDealInput as u, PipelineKind as v, TaskFilters as w, StageType as x, PipelineStageConfig as y };
@@ -0,0 +1,20 @@
1
+ //#region ../core/src/types.ts
2
+ /** Named once so SQL predicates and UI fallbacks cannot drift apart. */
3
+ const OPEN_STAGE_TYPE = "open";
4
+ /** A closed deal is a historical fact: automation never reopens one. */
5
+ function isClosedStageType(type) {
6
+ return type === "won" || type === "lost";
7
+ }
8
+ //#endregion
9
+ Object.defineProperty(exports, "OPEN_STAGE_TYPE", {
10
+ enumerable: true,
11
+ get: function() {
12
+ return OPEN_STAGE_TYPE;
13
+ }
14
+ });
15
+ Object.defineProperty(exports, "isClosedStageType", {
16
+ enumerable: true,
17
+ get: function() {
18
+ return isClosedStageType;
19
+ }
20
+ });
@@ -0,0 +1,9 @@
1
+ //#region ../core/src/types.ts
2
+ /** Named once so SQL predicates and UI fallbacks cannot drift apart. */
3
+ const OPEN_STAGE_TYPE = "open";
4
+ /** A closed deal is a historical fact: automation never reopens one. */
5
+ function isClosedStageType(type) {
6
+ return type === "won" || type === "lost";
7
+ }
8
+ //#endregion
9
+ export { isClosedStageType as n, OPEN_STAGE_TYPE as t };
@@ -1,5 +1,5 @@
1
- import { t as BASE_REF } from "./projection-hnPSgH6G.mjs";
2
- import { i as compileProjectionJoins, n as compileProjectionFrom, o as compileProjectionSelect, s as quoteIdent } from "./projection-sql-9zzTVGvf.mjs";
1
+ import { t as BASE_REF } from "./projection-CSGJbZlZ.mjs";
2
+ import { i as compileProjectionJoins, n as compileProjectionFrom, o as compileProjectionSelect, s as quoteIdent } from "./projection-sql-iHoiYr1R.mjs";
3
3
  //#region ../core/src/view-compiler.ts
4
4
  /**
5
5
  * View compiler (Phase 2) — turns a validated entity config into read-only
@@ -1,4 +1,4 @@
1
- import { a as ClivlyEntitiesConfig } from "./entity-config-B2RA53nw.mjs";
1
+ import { a as ClivlyEntitiesConfig } from "./entity-config-DNQAMbMS.cjs";
2
2
  //#region ../core/src/view-compiler.d.ts
3
3
  declare const DEFAULT_VIEW_PREFIX = "crm_src_";
4
4
  interface CompileOptions {
@@ -1,4 +1,4 @@
1
- import { a as ClivlyEntitiesConfig } from "./entity-config-B2RA53nw.cjs";
1
+ import { a as ClivlyEntitiesConfig } from "./entity-config-DNQAMbMS.mjs";
2
2
  //#region ../core/src/view-compiler.d.ts
3
3
  declare const DEFAULT_VIEW_PREFIX = "crm_src_";
4
4
  interface CompileOptions {
@@ -1,5 +1,5 @@
1
- const require_projection = require("./projection-DEwL-D8R.cjs");
2
- const require_projection_sql = require("./projection-sql-iHy-Cx6V.cjs");
1
+ const require_projection = require("./projection-Dz6_i1-w.cjs");
2
+ const require_projection_sql = require("./projection-sql-CbXCKt3s.cjs");
3
3
  //#region ../core/src/view-compiler.ts
4
4
  /**
5
5
  * View compiler (Phase 2) — turns a validated entity config into read-only
package/vite.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { o as ClivlySDK } from "./namespace-probe-DZIGdvlm.cjs";
1
+ import { o as ClivlySDK } from "./namespace-probe-DC4tbmLj.cjs";
2
2
  import { Plugin } from "vite";
3
3
  //#region ../sdk/src/vite.d.ts
4
4
  interface ClivlyViteOptions {
package/vite.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { o as ClivlySDK } from "./namespace-probe-BQ4imnV7.mjs";
1
+ import { o as ClivlySDK } from "./namespace-probe-9ScMDR0t.mjs";
2
2
  import { Plugin } from "vite";
3
3
  //#region ../sdk/src/vite.d.ts
4
4
  interface ClivlyViteOptions {