@clivly/core 0.11.0-next.0 → 0.12.0

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 (43) hide show
  1. package/dist/adapter.d.cts +62 -7
  2. package/dist/adapter.d.mts +62 -7
  3. package/dist/auth-adapter.d.cts +6 -7
  4. package/dist/auth-adapter.d.mts +6 -7
  5. package/dist/builder.d.cts +12 -12
  6. package/dist/builder.d.mts +12 -12
  7. package/dist/drizzle.d.cts +5 -6
  8. package/dist/drizzle.d.mts +5 -6
  9. package/dist/{entity-config-BTAJe1Zj.mjs → entity-config-C0rtu-K_.mjs} +19 -2
  10. package/dist/{entity-config-CqJknGOn.cjs → entity-config-C2sKAti2.cjs} +19 -2
  11. package/dist/{entity-config-Ddgukq_E.d.cts → entity-config-OhC4Otkz.d.cts} +3 -1
  12. package/dist/{entity-config-Ddgukq_E.d.mts → entity-config-OhC4Otkz.d.mts} +3 -1
  13. package/dist/entity-config.cjs +1 -1
  14. package/dist/entity-config.d.cts +1 -1
  15. package/dist/entity-config.d.mts +1 -1
  16. package/dist/entity-config.mjs +1 -1
  17. package/dist/entity-heuristics.cjs +9 -7
  18. package/dist/entity-heuristics.d.cts +21 -21
  19. package/dist/entity-heuristics.d.mts +21 -21
  20. package/dist/entity-heuristics.mjs +9 -7
  21. package/dist/env-file.d.cts +6 -7
  22. package/dist/env-file.d.mts +6 -7
  23. package/dist/index.cjs +112 -1
  24. package/dist/index.d.cts +124 -22
  25. package/dist/index.d.mts +124 -22
  26. package/dist/index.mjs +108 -2
  27. package/dist/integration-state.d.cts +30 -31
  28. package/dist/integration-state.d.mts +30 -31
  29. package/dist/mapping-form.d.cts +6 -7
  30. package/dist/mapping-form.d.mts +6 -7
  31. package/dist/mapping-score.d.cts +14 -15
  32. package/dist/mapping-score.d.mts +14 -15
  33. package/dist/mappings-config.cjs +2 -1
  34. package/dist/mappings-config.d.cts +8 -7
  35. package/dist/mappings-config.d.mts +8 -7
  36. package/dist/mappings-config.mjs +2 -1
  37. package/dist/sync-engine.d.cts +15 -16
  38. package/dist/sync-engine.d.mts +15 -16
  39. package/dist/types.d.cts +132 -33
  40. package/dist/types.d.mts +132 -33
  41. package/dist/view-compiler.d.cts +10 -11
  42. package/dist/view-compiler.d.mts +10 -11
  43. package/package.json +1 -1
package/dist/index.d.cts CHANGED
@@ -1,16 +1,118 @@
1
- import { Activity, ActivityType, Company, Contact, ContactFilters, ContactStatus, CreateActivityInput, CreateCompanyInput, CreateContactInput, CreateDealInput, CreateTaskInput, CrmRole, Deal, DealStage, Note, OPEN_STAGE_TYPE, PipelineConfig, PipelineKind, PipelineStageConfig, RecordSource, StageType, Task, TaskEntityType, TaskFilters, TaskPriority, TaskStatus, UpdateContactInput, UpdateDealInput, UpdateTaskInput, ValueInterval, isClosedStageType } from "./types.cjs";
1
+ import { Activity, ActivityType, Company, CompanyFilters, Contact, ContactFilters, ContactStatus, CreateActivityInput, CreateCompanyInput, CreateContactInput, CreateDealInput, CreateTaskInput, CrmRole, Deal, DealStage, Note, OPEN_STAGE_TYPE, Page, PageRequest, PipelineConfig, PipelineKind, PipelineStageConfig, RecordSource, StageType, Task, TaskEntityType, TaskFilters, TaskPriority, TaskStatus, UpdateCompanyInput, UpdateContactInput, UpdateDealInput, UpdateTaskInput, ValueInterval, isClosedStageType } from "./types.cjs";
2
2
  import { CRMAdapter } from "./adapter.cjs";
3
3
  import { ClivlyAuthAdapter, ClivlyUser, CrmMembership, MembershipResolver, authCustom } from "./auth-adapter.cjs";
4
- import { A as relationshipsSchema, B as identityRefs, D as missingRequiredFields, E as filterSchema, F as ProjectionFieldBinding, I as ProjectionIdentity, L as ProjectionJoin, M as validateEntitiesConfig, N as BASE_REF, O as projectionFields, P as PROJECTION_KEY_PATTERN, R as ProjectionMapping, S as RelationshipsMap, T as entitiesConfigSchema, V as projectionSchema, _ as MATERIALIZING_CONCEPTS, a as ClivlyEntitiesConfig, b as RelationshipSpec, d as CrmConcept, g as FilterValue, h as FilterExpr, i as ClivlyConfigError, j as requiredFieldsFor, k as relationshipSchema, 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 defineClivlyConfig, x as RelationshipVia, y as REQUIRED_FIELDS, z as ProjectionRef } from "./entity-config-Ddgukq_E.cjs";
4
+ import { A as relationshipsSchema, B as identityRefs, D as missingRequiredFields, E as filterSchema, F as ProjectionFieldBinding, I as ProjectionIdentity, L as ProjectionJoin, M as validateEntitiesConfig, N as BASE_REF, O as projectionFields, P as PROJECTION_KEY_PATTERN, R as ProjectionMapping, S as RelationshipsMap, T as entitiesConfigSchema, V as projectionSchema, _ as MATERIALIZING_CONCEPTS, a as ClivlyEntitiesConfig, b as RelationshipSpec, d as CrmConcept, g as FilterValue, h as FilterExpr, i as ClivlyConfigError, j as requiredFieldsFor, k as relationshipSchema, 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 defineClivlyConfig, x as RelationshipVia, y as REQUIRED_FIELDS, z as ProjectionRef } from "./entity-config-OhC4Otkz.cjs";
5
5
  import { ConnectionLiveness, IntegrationFacts, IntegrationState, IntegrationStatus, IntegrationStep, NextAction, StepId, StepProblem, StepState } from "./integration-state.cjs";
6
6
  import { RelationshipCandidate, buildFilterFromDiscriminator, buildRelationships, relationshipViaSignature } from "./mapping-form.cjs";
7
7
  import { EntityMappingRow, mappingsToEntitiesConfig } from "./mappings-config.cjs";
8
8
  import { CompileOptions, CompiledView, DEFAULT_VIEW_PREFIX, ExplainResult, compileEntityView, compileEntityViews, explainEntitiesConfig } from "./view-compiler.cjs";
9
9
  import { EntitySyncResult, MirrorRecord, PersistAction, SourceRow, SyncAction, SyncResult, SyncStore, reconcile, runSync } from "./sync-engine.cjs";
10
+ //#region src/deal-value.d.ts
11
+ /**
12
+ * Value derived as a flat fee plus a per-seat price that depends on the plan.
13
+ *
14
+ * Every field name is configuration and every plan key is data, so a second
15
+ * subscription business configures this without a code change. The formula is
16
+ * fixed with named slots rather than an expression language — the same choice
17
+ * D8 made for stage-rule conditions.
18
+ */
19
+ interface PerSeatValueSource {
20
+ /** Flat monthly fee in cents, added before the interval is normalised. */
21
+ baseFeeCents?: number;
22
+ /** Mapped column holding "month" or "year". Absent means always monthly. */
23
+ intervalField?: string;
24
+ kind: "per_seat";
25
+ /** Mapped column holding the plan key. */
26
+ planField: string;
27
+ /** Unit price in cents, keyed by the value found in `planField`. */
28
+ plans: Record<string, number>;
29
+ /** Mapped column holding the seat count. */
30
+ seatField: string;
31
+ /** Stage types whose deals are worth nothing (usually `["lost"]`). */
32
+ zeroInStageTypes?: string[];
33
+ }
34
+ /**
35
+ * The value one deal should have, in cents, or null to leave it alone.
36
+ *
37
+ * Returning null rather than 0 for unusable input is deliberate (D33). A
38
+ * renamed column would otherwise zero an entire pipeline silently, and a zeroed
39
+ * board reads as a business problem rather than a configuration problem. The
40
+ * unmapped case is surfaced through the rule-health warning surface instead of
41
+ * being written into the data — the same fail-safe `matchesCondition` applies.
42
+ */
43
+ export declare function computeDealValue(source: PerSeatValueSource, fields: Record<string, string | null>, mappedFields: Set<string>, stageType: string): number | null;
44
+ //#endregion
45
+ //#region src/host-owned-fields.d.ts
46
+ /**
47
+ * Which fields a CRM record lets a user edit.
48
+ *
49
+ * A record synced from the host app carries a `sourceRef`. Its identity fields
50
+ * are rewritten from the host view on every sync run, so an edit to one would
51
+ * be silently reverted minutes later — the user sees their change accepted,
52
+ * then gone, with nothing explaining why. That is worse than refusing it.
53
+ *
54
+ * So host-owned fields are rejected at the API, not merely disabled in the UI:
55
+ * the UI is not the security boundary, and the SDK and any future public API
56
+ * reach the same routers.
57
+ *
58
+ * Records created inside the CRM have no `sourceRef` and are fully editable —
59
+ * nothing else owns them.
60
+ *
61
+ * This is the cheap half of a capability matrix. It answers "may a user write
62
+ * this?" but not "may the sync engine write this?", which stays implicit
63
+ * because sync bypasses these routers entirely. An override model (the
64
+ * `stageOverrideAt` pattern on `crm_deals`) can replace this later without
65
+ * changing callers.
66
+ */
67
+ /** Contact fields the host view owns when the row is synced. */
68
+ declare const HOST_OWNED_CONTACT_FIELDS: readonly ["email", "name"];
69
+ /**
70
+ * Company fields the host view owns when the row is synced.
71
+ *
72
+ * `email` and `phone` joined this list in the same change that made them
73
+ * mappable (migration 0048). They are not identity fields, but ownership here
74
+ * follows what sync rewrites, not what feels identity-like: both flow from the
75
+ * host view on every run, exactly as `email` does for contacts above. Widening
76
+ * `CANONICAL_FIELDS.company` without widening this list is the specific bug
77
+ * this module's doc comment calls worse than refusing the edit.
78
+ *
79
+ * `primaryContactId` is deliberately absent: it is a CRM-side judgement about
80
+ * who to talk to, never sourced from the host, so it stays editable on synced
81
+ * rows.
82
+ */
83
+ declare const HOST_OWNED_COMPANY_FIELDS: readonly ["domain", "name", "email", "phone"];
84
+ type HostOwnedContactField = (typeof HOST_OWNED_CONTACT_FIELDS)[number];
85
+ type HostOwnedCompanyField = (typeof HOST_OWNED_COMPANY_FIELDS)[number];
86
+ /** The subset of a record this module needs to make its decision. */
87
+ interface SourcedRecord {
88
+ sourceRef?: string | null;
89
+ }
90
+ /**
91
+ * True when the record is owned by a host view rather than by the CRM.
92
+ *
93
+ * Deliberately keyed on `sourceRef` and not `entityRole`: `entityRole` is a
94
+ * mapping label that can be absent on a synced row, while `sourceRef` is the
95
+ * identity the sync engine reconciles against and is set for exactly the rows
96
+ * sync will rewrite.
97
+ */
98
+ export declare function isHostOwned(record: SourcedRecord): boolean;
99
+ /**
100
+ * Host-owned contact fields this patch would change, or `[]` when the patch is
101
+ * allowed. Callers turn a non-empty result into a 400 naming the fields.
102
+ */
103
+ export declare function rejectedContactFields(contact: SourcedRecord, patch: Readonly<Record<string, unknown>>): HostOwnedContactField[];
104
+ /** Host-owned company fields this patch would change, or `[]`. */
105
+ export declare function rejectedCompanyFields(company: SourcedRecord, patch: Readonly<Record<string, unknown>>): HostOwnedCompanyField[];
106
+ /**
107
+ * The message shown when a write is refused. Names the fields and says where
108
+ * they come from, so the reason is actionable rather than a bare "forbidden".
109
+ */
110
+ export declare function hostOwnedFieldMessage(fields: readonly string[]): string;
111
+ //#endregion
10
112
  //#region src/projection-cardinality.d.ts
11
- declare function joinFansOut(join: ProjectionJoin, joinTable: DiscoveredSchemaTable): boolean;
113
+ export declare function joinFansOut(join: ProjectionJoin, joinTable: DiscoveredSchemaTable): boolean;
12
114
  /** Every join in the projection that can multiply rows. */
13
- declare function fanOutJoins(projection: ProjectionMapping, tablesByName: Map<string, DiscoveredSchemaTable>): ProjectionJoin[];
115
+ export declare function fanOutJoins(projection: ProjectionMapping, tablesByName: Map<string, DiscoveredSchemaTable>): ProjectionJoin[];
14
116
  //#endregion
15
117
  //#region src/projection-sql.d.ts
16
118
  /**
@@ -24,7 +126,7 @@ declare function fanOutJoins(projection: ProjectionMapping, tablesByName: Map<st
24
126
  * deterministic and injection-safe.
25
127
  */
26
128
  /** Quote a single identifier part, escaping embedded double-quotes. */
27
- declare function quoteIdent(name: string): string;
129
+ export declare function quoteIdent(name: string): string;
28
130
  /**
29
131
  * The identity expression. Composite identities concatenate their parts with
30
132
  * `::`; validation guarantees every part is NOT NULL and non-text, which is
@@ -35,14 +137,14 @@ declare function quoteIdent(name: string): string;
35
137
  * also orders and keyset-paginates by it. Sharing one definition is what keeps
36
138
  * a pushed row's `id` identical to the one the view would have produced.
37
139
  */
38
- declare function compileProjectionIdentity(projection: ProjectionMapping, basePkColumn: string): string;
39
- declare function compileProjectionSelect(projection: ProjectionMapping, basePkColumn: string): {
140
+ export declare function compileProjectionIdentity(projection: ProjectionMapping, basePkColumn: string): string;
141
+ export declare function compileProjectionSelect(projection: ProjectionMapping, basePkColumn: string): {
40
142
  columns: string[];
41
143
  selectItems: string[];
42
144
  };
43
- declare function compileProjectionJoins(projection: ProjectionMapping): string[];
145
+ export declare function compileProjectionJoins(projection: ProjectionMapping): string[];
44
146
  /** `FROM <baseTable> AS "base"` — the alias every ref resolves against. */
45
- declare function compileProjectionFrom(projection: ProjectionMapping): string;
147
+ export declare function compileProjectionFrom(projection: ProjectionMapping): string;
46
148
  /**
47
149
  * Hard ceiling on preview rows, regardless of what a caller asks for.
48
150
  *
@@ -50,7 +152,7 @@ declare function compileProjectionFrom(projection: ProjectionMapping): string;
50
152
  * as often as they like, so the cap belongs beside the query rather than in
51
153
  * whichever caller happens to be passing a limit today.
52
154
  */
53
- declare const PREVIEW_MAX_ROWS = 50;
155
+ export declare const PREVIEW_MAX_ROWS = 50;
54
156
  /**
55
157
  * One SELECT reading a few rows through an UNSAVED projection, for the derived
56
158
  * object builder's preview.
@@ -66,7 +168,7 @@ declare const PREVIEW_MAX_ROWS = 50;
66
168
  * reads `row[token]`; a preview is read by a person, in a table whose headers
67
169
  * are the field names they just typed.
68
170
  */
69
- declare function compileProjectionPreview(projection: ProjectionMapping, limit: number): string;
171
+ export declare function compileProjectionPreview(projection: ProjectionMapping, limit: number): string;
70
172
  //#endregion
71
173
  //#region src/projection-validate.d.ts
72
174
  /**
@@ -89,12 +191,12 @@ declare function compileProjectionPreview(projection: ProjectionMapping, limit:
89
191
  *
90
192
  * Rejecting an unresolvable column closes the last two together.
91
193
  */
92
- declare function validateProjectionFilter(filter: FilterExpr | undefined, projection: ProjectionMapping, schema: DiscoveredSchemaTable[], base: string): ConfigValidationError[];
194
+ export declare function validateProjectionFilter(filter: FilterExpr | undefined, projection: ProjectionMapping, schema: DiscoveredSchemaTable[], base: string): ConfigValidationError[];
93
195
  /**
94
196
  * Validate a projection against the discovered schema. Returns every error
95
197
  * found (not just the first) so a builder UI can show them all at once.
96
198
  */
97
- declare function validateProjection(projection: ProjectionMapping, schema: DiscoveredSchemaTable[], base: string): ConfigValidationError[];
199
+ export declare function validateProjection(projection: ProjectionMapping, schema: DiscoveredSchemaTable[], base: string): ConfigValidationError[];
98
200
  //#endregion
99
201
  //#region src/schema-meta.d.ts
100
202
  /**
@@ -105,12 +207,12 @@ declare function validateProjection(projection: ProjectionMapping, schema: Disco
105
207
  * projection validation fail closed: we cannot prove a join is many-to-one, so
106
208
  * we refuse to compile it rather than guess.
107
209
  */
108
- declare function columnMetaFor(table: DiscoveredSchemaTable, column: string): DiscoveredColumnMeta | undefined;
210
+ export declare function columnMetaFor(table: DiscoveredSchemaTable, column: string): DiscoveredColumnMeta | undefined;
109
211
  /**
110
212
  * Every primary-key column. More than one entry means a composite PK, which is
111
213
  * why `base_pk` identity is rejected for such tables.
112
214
  */
113
- declare function primaryKeyColumns(table: DiscoveredSchemaTable): string[];
215
+ export declare function primaryKeyColumns(table: DiscoveredSchemaTable): string[];
114
216
  /**
115
217
  * Do `columns` contain every column of at least one unique key on `table`?
116
218
  *
@@ -118,7 +220,7 @@ declare function primaryKeyColumns(table: DiscoveredSchemaTable): string[];
118
220
  * joined table matches at most one row per base row; one that does not can
119
221
  * match many.
120
222
  */
121
- declare function coversUniqueKey(table: DiscoveredSchemaTable, columns: string[]): boolean;
223
+ export declare function coversUniqueKey(table: DiscoveredSchemaTable, columns: string[]): boolean;
122
224
  /**
123
225
  * A discovered table whose enrichment metadata is known to be present.
124
226
  *
@@ -142,7 +244,7 @@ type RichMetaTable = DiscoveredSchemaTable & {
142
244
  * The invariant is unchanged: this reports whether the metadata is *known*,
143
245
  * never whether the table has keys. Absent metadata stays UNKNOWN.
144
246
  */
145
- declare function hasRichMeta(table: DiscoveredSchemaTable): table is RichMetaTable;
247
+ export declare function hasRichMeta(table: DiscoveredSchemaTable): table is RichMetaTable;
146
248
  //#endregion
147
249
  //#region src/slug.d.ts
148
250
  /**
@@ -171,7 +273,7 @@ declare function hasRichMeta(table: DiscoveredSchemaTable): table is RichMetaTab
171
273
  * `"2024-invoices"` for `"2024 Invoices"`. Callers that need an
172
274
  * acceptance-guaranteed identifier want `toObjectTypeSlug`.
173
275
  */
174
- declare function slugify(value: string): string;
276
+ export declare function slugify(value: string): string;
175
277
  /**
176
278
  * A slug the server will accept, derived from a display name.
177
279
  *
@@ -193,7 +295,7 @@ declare function slugify(value: string): string;
193
295
  * decides whether that is "keep typing" or an error, since only it knows
194
296
  * whether the field is still being edited.
195
297
  */
196
- declare function toObjectTypeSlug(displayName: string): string;
298
+ export declare function toObjectTypeSlug(displayName: string): string;
197
299
  //#endregion
198
300
  //#region src/stage-rules.d.ts
199
301
  type ConditionOp = "is_empty" | "is_not_empty" | "equals" | "not_equals" | "greater_than" | "less_than" | "before" | "after";
@@ -214,7 +316,7 @@ interface EvaluableRule {
214
316
  * rule referencing a dropped column must fail safe, because treating the field
215
317
  * as null would make `is_empty` match every deal.
216
318
  */
217
- declare function matchesCondition(condition: Condition, fields: Record<string, string | null>, mappedFields: Set<string>): boolean;
319
+ export declare function matchesCondition(condition: Condition, fields: Record<string, string | null>, mappedFields: Set<string>): boolean;
218
320
  /**
219
321
  * The id of the first rule whose conditions all hold, or null when none do.
220
322
  *
@@ -229,6 +331,6 @@ declare function matchesCondition(condition: Condition, fields: Record<string, s
229
331
  * vacuously AND to true and capture every deal, which is the opposite of what
230
332
  * a half-written rule should do.
231
333
  */
232
- declare function evaluateStage(rules: EvaluableRule[], fields: Record<string, string | null>, mappedFields: Set<string>): string | null;
334
+ export declare function evaluateStage(rules: EvaluableRule[], fields: Record<string, string | null>, mappedFields: Set<string>): string | null;
233
335
  //#endregion
234
- 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, REQUIRED_FIELDS, 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, missingRequiredFields, primaryKeyColumns, projectionFields, projectionSchema, quoteIdent, reconcile, relationshipSchema, relationshipViaSignature, relationshipsSchema, requiredFieldsFor, runSync, slugify, toObjectTypeSlug, validateEntitiesConfig, validateProjection, validateProjectionFilter };
336
+ 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 CompanyFilters, 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 HostOwnedCompanyField, type HostOwnedContactField, type IntegrationFacts, type IntegrationState, type IntegrationStatus, type IntegrationStep, MATERIALIZING_CONCEPTS, type MaterializingConcept, type MembershipResolver, type MirrorRecord, type NextAction, type Note, OPEN_STAGE_TYPE, PROJECTION_KEY_PATTERN, type Page, type PageRequest, type PerSeatValueSource, type PersistAction, type PipelineConfig, type PipelineKind, type PipelineStageConfig, type ProjectionFieldBinding, type ProjectionIdentity, type ProjectionJoin, type ProjectionMapping, type ProjectionRef, REQUIRED_FIELDS, type RecordSource, type RelationshipCandidate, type RelationshipSpec, type RelationshipVia, type RelationshipsMap, type SourceRow, type SourcedRecord, 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 UpdateCompanyInput, type UpdateContactInput, type UpdateDealInput, type UpdateTaskInput, type ValueInterval, authCustom, buildFilterFromDiscriminator, buildRelationships, compileEntityView, compileEntityViews, defineClivlyConfig, entitiesConfigSchema, explainEntitiesConfig, filterSchema, identityRefs, isClosedStageType, mappingsToEntitiesConfig, missingRequiredFields, projectionFields, projectionSchema, reconcile, relationshipSchema, relationshipViaSignature, relationshipsSchema, requiredFieldsFor, runSync, validateEntitiesConfig };
package/dist/index.d.mts CHANGED
@@ -1,16 +1,118 @@
1
- import { Activity, ActivityType, Company, Contact, ContactFilters, ContactStatus, CreateActivityInput, CreateCompanyInput, CreateContactInput, CreateDealInput, CreateTaskInput, CrmRole, Deal, DealStage, Note, OPEN_STAGE_TYPE, PipelineConfig, PipelineKind, PipelineStageConfig, RecordSource, StageType, Task, TaskEntityType, TaskFilters, TaskPriority, TaskStatus, UpdateContactInput, UpdateDealInput, UpdateTaskInput, ValueInterval, isClosedStageType } from "./types.mjs";
1
+ import { Activity, ActivityType, Company, CompanyFilters, Contact, ContactFilters, ContactStatus, CreateActivityInput, CreateCompanyInput, CreateContactInput, CreateDealInput, CreateTaskInput, CrmRole, Deal, DealStage, Note, OPEN_STAGE_TYPE, Page, PageRequest, PipelineConfig, PipelineKind, PipelineStageConfig, RecordSource, StageType, Task, TaskEntityType, TaskFilters, TaskPriority, TaskStatus, UpdateCompanyInput, UpdateContactInput, UpdateDealInput, UpdateTaskInput, ValueInterval, isClosedStageType } from "./types.mjs";
2
2
  import { CRMAdapter } from "./adapter.mjs";
3
3
  import { ClivlyAuthAdapter, ClivlyUser, CrmMembership, MembershipResolver, authCustom } from "./auth-adapter.mjs";
4
- import { A as relationshipsSchema, B as identityRefs, D as missingRequiredFields, E as filterSchema, F as ProjectionFieldBinding, I as ProjectionIdentity, L as ProjectionJoin, M as validateEntitiesConfig, N as BASE_REF, O as projectionFields, P as PROJECTION_KEY_PATTERN, R as ProjectionMapping, S as RelationshipsMap, T as entitiesConfigSchema, V as projectionSchema, _ as MATERIALIZING_CONCEPTS, a as ClivlyEntitiesConfig, b as RelationshipSpec, d as CrmConcept, g as FilterValue, h as FilterExpr, i as ClivlyConfigError, j as requiredFieldsFor, k as relationshipSchema, 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 defineClivlyConfig, x as RelationshipVia, y as REQUIRED_FIELDS, z as ProjectionRef } from "./entity-config-Ddgukq_E.mjs";
4
+ import { A as relationshipsSchema, B as identityRefs, D as missingRequiredFields, E as filterSchema, F as ProjectionFieldBinding, I as ProjectionIdentity, L as ProjectionJoin, M as validateEntitiesConfig, N as BASE_REF, O as projectionFields, P as PROJECTION_KEY_PATTERN, R as ProjectionMapping, S as RelationshipsMap, T as entitiesConfigSchema, V as projectionSchema, _ as MATERIALIZING_CONCEPTS, a as ClivlyEntitiesConfig, b as RelationshipSpec, d as CrmConcept, g as FilterValue, h as FilterExpr, i as ClivlyConfigError, j as requiredFieldsFor, k as relationshipSchema, 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 defineClivlyConfig, x as RelationshipVia, y as REQUIRED_FIELDS, z as ProjectionRef } from "./entity-config-OhC4Otkz.mjs";
5
5
  import { ConnectionLiveness, IntegrationFacts, IntegrationState, IntegrationStatus, IntegrationStep, NextAction, StepId, StepProblem, StepState } from "./integration-state.mjs";
6
6
  import { RelationshipCandidate, buildFilterFromDiscriminator, buildRelationships, relationshipViaSignature } from "./mapping-form.mjs";
7
7
  import { EntityMappingRow, mappingsToEntitiesConfig } from "./mappings-config.mjs";
8
8
  import { CompileOptions, CompiledView, DEFAULT_VIEW_PREFIX, ExplainResult, compileEntityView, compileEntityViews, explainEntitiesConfig } from "./view-compiler.mjs";
9
9
  import { EntitySyncResult, MirrorRecord, PersistAction, SourceRow, SyncAction, SyncResult, SyncStore, reconcile, runSync } from "./sync-engine.mjs";
10
+ //#region src/deal-value.d.ts
11
+ /**
12
+ * Value derived as a flat fee plus a per-seat price that depends on the plan.
13
+ *
14
+ * Every field name is configuration and every plan key is data, so a second
15
+ * subscription business configures this without a code change. The formula is
16
+ * fixed with named slots rather than an expression language — the same choice
17
+ * D8 made for stage-rule conditions.
18
+ */
19
+ interface PerSeatValueSource {
20
+ /** Flat monthly fee in cents, added before the interval is normalised. */
21
+ baseFeeCents?: number;
22
+ /** Mapped column holding "month" or "year". Absent means always monthly. */
23
+ intervalField?: string;
24
+ kind: "per_seat";
25
+ /** Mapped column holding the plan key. */
26
+ planField: string;
27
+ /** Unit price in cents, keyed by the value found in `planField`. */
28
+ plans: Record<string, number>;
29
+ /** Mapped column holding the seat count. */
30
+ seatField: string;
31
+ /** Stage types whose deals are worth nothing (usually `["lost"]`). */
32
+ zeroInStageTypes?: string[];
33
+ }
34
+ /**
35
+ * The value one deal should have, in cents, or null to leave it alone.
36
+ *
37
+ * Returning null rather than 0 for unusable input is deliberate (D33). A
38
+ * renamed column would otherwise zero an entire pipeline silently, and a zeroed
39
+ * board reads as a business problem rather than a configuration problem. The
40
+ * unmapped case is surfaced through the rule-health warning surface instead of
41
+ * being written into the data — the same fail-safe `matchesCondition` applies.
42
+ */
43
+ export declare function computeDealValue(source: PerSeatValueSource, fields: Record<string, string | null>, mappedFields: Set<string>, stageType: string): number | null;
44
+ //#endregion
45
+ //#region src/host-owned-fields.d.ts
46
+ /**
47
+ * Which fields a CRM record lets a user edit.
48
+ *
49
+ * A record synced from the host app carries a `sourceRef`. Its identity fields
50
+ * are rewritten from the host view on every sync run, so an edit to one would
51
+ * be silently reverted minutes later — the user sees their change accepted,
52
+ * then gone, with nothing explaining why. That is worse than refusing it.
53
+ *
54
+ * So host-owned fields are rejected at the API, not merely disabled in the UI:
55
+ * the UI is not the security boundary, and the SDK and any future public API
56
+ * reach the same routers.
57
+ *
58
+ * Records created inside the CRM have no `sourceRef` and are fully editable —
59
+ * nothing else owns them.
60
+ *
61
+ * This is the cheap half of a capability matrix. It answers "may a user write
62
+ * this?" but not "may the sync engine write this?", which stays implicit
63
+ * because sync bypasses these routers entirely. An override model (the
64
+ * `stageOverrideAt` pattern on `crm_deals`) can replace this later without
65
+ * changing callers.
66
+ */
67
+ /** Contact fields the host view owns when the row is synced. */
68
+ declare const HOST_OWNED_CONTACT_FIELDS: readonly ["email", "name"];
69
+ /**
70
+ * Company fields the host view owns when the row is synced.
71
+ *
72
+ * `email` and `phone` joined this list in the same change that made them
73
+ * mappable (migration 0048). They are not identity fields, but ownership here
74
+ * follows what sync rewrites, not what feels identity-like: both flow from the
75
+ * host view on every run, exactly as `email` does for contacts above. Widening
76
+ * `CANONICAL_FIELDS.company` without widening this list is the specific bug
77
+ * this module's doc comment calls worse than refusing the edit.
78
+ *
79
+ * `primaryContactId` is deliberately absent: it is a CRM-side judgement about
80
+ * who to talk to, never sourced from the host, so it stays editable on synced
81
+ * rows.
82
+ */
83
+ declare const HOST_OWNED_COMPANY_FIELDS: readonly ["domain", "name", "email", "phone"];
84
+ type HostOwnedContactField = (typeof HOST_OWNED_CONTACT_FIELDS)[number];
85
+ type HostOwnedCompanyField = (typeof HOST_OWNED_COMPANY_FIELDS)[number];
86
+ /** The subset of a record this module needs to make its decision. */
87
+ interface SourcedRecord {
88
+ sourceRef?: string | null;
89
+ }
90
+ /**
91
+ * True when the record is owned by a host view rather than by the CRM.
92
+ *
93
+ * Deliberately keyed on `sourceRef` and not `entityRole`: `entityRole` is a
94
+ * mapping label that can be absent on a synced row, while `sourceRef` is the
95
+ * identity the sync engine reconciles against and is set for exactly the rows
96
+ * sync will rewrite.
97
+ */
98
+ export declare function isHostOwned(record: SourcedRecord): boolean;
99
+ /**
100
+ * Host-owned contact fields this patch would change, or `[]` when the patch is
101
+ * allowed. Callers turn a non-empty result into a 400 naming the fields.
102
+ */
103
+ export declare function rejectedContactFields(contact: SourcedRecord, patch: Readonly<Record<string, unknown>>): HostOwnedContactField[];
104
+ /** Host-owned company fields this patch would change, or `[]`. */
105
+ export declare function rejectedCompanyFields(company: SourcedRecord, patch: Readonly<Record<string, unknown>>): HostOwnedCompanyField[];
106
+ /**
107
+ * The message shown when a write is refused. Names the fields and says where
108
+ * they come from, so the reason is actionable rather than a bare "forbidden".
109
+ */
110
+ export declare function hostOwnedFieldMessage(fields: readonly string[]): string;
111
+ //#endregion
10
112
  //#region src/projection-cardinality.d.ts
11
- declare function joinFansOut(join: ProjectionJoin, joinTable: DiscoveredSchemaTable): boolean;
113
+ export declare function joinFansOut(join: ProjectionJoin, joinTable: DiscoveredSchemaTable): boolean;
12
114
  /** Every join in the projection that can multiply rows. */
13
- declare function fanOutJoins(projection: ProjectionMapping, tablesByName: Map<string, DiscoveredSchemaTable>): ProjectionJoin[];
115
+ export declare function fanOutJoins(projection: ProjectionMapping, tablesByName: Map<string, DiscoveredSchemaTable>): ProjectionJoin[];
14
116
  //#endregion
15
117
  //#region src/projection-sql.d.ts
16
118
  /**
@@ -24,7 +126,7 @@ declare function fanOutJoins(projection: ProjectionMapping, tablesByName: Map<st
24
126
  * deterministic and injection-safe.
25
127
  */
26
128
  /** Quote a single identifier part, escaping embedded double-quotes. */
27
- declare function quoteIdent(name: string): string;
129
+ export declare function quoteIdent(name: string): string;
28
130
  /**
29
131
  * The identity expression. Composite identities concatenate their parts with
30
132
  * `::`; validation guarantees every part is NOT NULL and non-text, which is
@@ -35,14 +137,14 @@ declare function quoteIdent(name: string): string;
35
137
  * also orders and keyset-paginates by it. Sharing one definition is what keeps
36
138
  * a pushed row's `id` identical to the one the view would have produced.
37
139
  */
38
- declare function compileProjectionIdentity(projection: ProjectionMapping, basePkColumn: string): string;
39
- declare function compileProjectionSelect(projection: ProjectionMapping, basePkColumn: string): {
140
+ export declare function compileProjectionIdentity(projection: ProjectionMapping, basePkColumn: string): string;
141
+ export declare function compileProjectionSelect(projection: ProjectionMapping, basePkColumn: string): {
40
142
  columns: string[];
41
143
  selectItems: string[];
42
144
  };
43
- declare function compileProjectionJoins(projection: ProjectionMapping): string[];
145
+ export declare function compileProjectionJoins(projection: ProjectionMapping): string[];
44
146
  /** `FROM <baseTable> AS "base"` — the alias every ref resolves against. */
45
- declare function compileProjectionFrom(projection: ProjectionMapping): string;
147
+ export declare function compileProjectionFrom(projection: ProjectionMapping): string;
46
148
  /**
47
149
  * Hard ceiling on preview rows, regardless of what a caller asks for.
48
150
  *
@@ -50,7 +152,7 @@ declare function compileProjectionFrom(projection: ProjectionMapping): string;
50
152
  * as often as they like, so the cap belongs beside the query rather than in
51
153
  * whichever caller happens to be passing a limit today.
52
154
  */
53
- declare const PREVIEW_MAX_ROWS = 50;
155
+ export declare const PREVIEW_MAX_ROWS = 50;
54
156
  /**
55
157
  * One SELECT reading a few rows through an UNSAVED projection, for the derived
56
158
  * object builder's preview.
@@ -66,7 +168,7 @@ declare const PREVIEW_MAX_ROWS = 50;
66
168
  * reads `row[token]`; a preview is read by a person, in a table whose headers
67
169
  * are the field names they just typed.
68
170
  */
69
- declare function compileProjectionPreview(projection: ProjectionMapping, limit: number): string;
171
+ export declare function compileProjectionPreview(projection: ProjectionMapping, limit: number): string;
70
172
  //#endregion
71
173
  //#region src/projection-validate.d.ts
72
174
  /**
@@ -89,12 +191,12 @@ declare function compileProjectionPreview(projection: ProjectionMapping, limit:
89
191
  *
90
192
  * Rejecting an unresolvable column closes the last two together.
91
193
  */
92
- declare function validateProjectionFilter(filter: FilterExpr | undefined, projection: ProjectionMapping, schema: DiscoveredSchemaTable[], base: string): ConfigValidationError[];
194
+ export declare function validateProjectionFilter(filter: FilterExpr | undefined, projection: ProjectionMapping, schema: DiscoveredSchemaTable[], base: string): ConfigValidationError[];
93
195
  /**
94
196
  * Validate a projection against the discovered schema. Returns every error
95
197
  * found (not just the first) so a builder UI can show them all at once.
96
198
  */
97
- declare function validateProjection(projection: ProjectionMapping, schema: DiscoveredSchemaTable[], base: string): ConfigValidationError[];
199
+ export declare function validateProjection(projection: ProjectionMapping, schema: DiscoveredSchemaTable[], base: string): ConfigValidationError[];
98
200
  //#endregion
99
201
  //#region src/schema-meta.d.ts
100
202
  /**
@@ -105,12 +207,12 @@ declare function validateProjection(projection: ProjectionMapping, schema: Disco
105
207
  * projection validation fail closed: we cannot prove a join is many-to-one, so
106
208
  * we refuse to compile it rather than guess.
107
209
  */
108
- declare function columnMetaFor(table: DiscoveredSchemaTable, column: string): DiscoveredColumnMeta | undefined;
210
+ export declare function columnMetaFor(table: DiscoveredSchemaTable, column: string): DiscoveredColumnMeta | undefined;
109
211
  /**
110
212
  * Every primary-key column. More than one entry means a composite PK, which is
111
213
  * why `base_pk` identity is rejected for such tables.
112
214
  */
113
- declare function primaryKeyColumns(table: DiscoveredSchemaTable): string[];
215
+ export declare function primaryKeyColumns(table: DiscoveredSchemaTable): string[];
114
216
  /**
115
217
  * Do `columns` contain every column of at least one unique key on `table`?
116
218
  *
@@ -118,7 +220,7 @@ declare function primaryKeyColumns(table: DiscoveredSchemaTable): string[];
118
220
  * joined table matches at most one row per base row; one that does not can
119
221
  * match many.
120
222
  */
121
- declare function coversUniqueKey(table: DiscoveredSchemaTable, columns: string[]): boolean;
223
+ export declare function coversUniqueKey(table: DiscoveredSchemaTable, columns: string[]): boolean;
122
224
  /**
123
225
  * A discovered table whose enrichment metadata is known to be present.
124
226
  *
@@ -142,7 +244,7 @@ type RichMetaTable = DiscoveredSchemaTable & {
142
244
  * The invariant is unchanged: this reports whether the metadata is *known*,
143
245
  * never whether the table has keys. Absent metadata stays UNKNOWN.
144
246
  */
145
- declare function hasRichMeta(table: DiscoveredSchemaTable): table is RichMetaTable;
247
+ export declare function hasRichMeta(table: DiscoveredSchemaTable): table is RichMetaTable;
146
248
  //#endregion
147
249
  //#region src/slug.d.ts
148
250
  /**
@@ -171,7 +273,7 @@ declare function hasRichMeta(table: DiscoveredSchemaTable): table is RichMetaTab
171
273
  * `"2024-invoices"` for `"2024 Invoices"`. Callers that need an
172
274
  * acceptance-guaranteed identifier want `toObjectTypeSlug`.
173
275
  */
174
- declare function slugify(value: string): string;
276
+ export declare function slugify(value: string): string;
175
277
  /**
176
278
  * A slug the server will accept, derived from a display name.
177
279
  *
@@ -193,7 +295,7 @@ declare function slugify(value: string): string;
193
295
  * decides whether that is "keep typing" or an error, since only it knows
194
296
  * whether the field is still being edited.
195
297
  */
196
- declare function toObjectTypeSlug(displayName: string): string;
298
+ export declare function toObjectTypeSlug(displayName: string): string;
197
299
  //#endregion
198
300
  //#region src/stage-rules.d.ts
199
301
  type ConditionOp = "is_empty" | "is_not_empty" | "equals" | "not_equals" | "greater_than" | "less_than" | "before" | "after";
@@ -214,7 +316,7 @@ interface EvaluableRule {
214
316
  * rule referencing a dropped column must fail safe, because treating the field
215
317
  * as null would make `is_empty` match every deal.
216
318
  */
217
- declare function matchesCondition(condition: Condition, fields: Record<string, string | null>, mappedFields: Set<string>): boolean;
319
+ export declare function matchesCondition(condition: Condition, fields: Record<string, string | null>, mappedFields: Set<string>): boolean;
218
320
  /**
219
321
  * The id of the first rule whose conditions all hold, or null when none do.
220
322
  *
@@ -229,6 +331,6 @@ declare function matchesCondition(condition: Condition, fields: Record<string, s
229
331
  * vacuously AND to true and capture every deal, which is the opposite of what
230
332
  * a half-written rule should do.
231
333
  */
232
- declare function evaluateStage(rules: EvaluableRule[], fields: Record<string, string | null>, mappedFields: Set<string>): string | null;
334
+ export declare function evaluateStage(rules: EvaluableRule[], fields: Record<string, string | null>, mappedFields: Set<string>): string | null;
233
335
  //#endregion
234
- 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, REQUIRED_FIELDS, 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, missingRequiredFields, primaryKeyColumns, projectionFields, projectionSchema, quoteIdent, reconcile, relationshipSchema, relationshipViaSignature, relationshipsSchema, requiredFieldsFor, runSync, slugify, toObjectTypeSlug, validateEntitiesConfig, validateProjection, validateProjectionFilter };
336
+ 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 CompanyFilters, 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 HostOwnedCompanyField, type HostOwnedContactField, type IntegrationFacts, type IntegrationState, type IntegrationStatus, type IntegrationStep, MATERIALIZING_CONCEPTS, type MaterializingConcept, type MembershipResolver, type MirrorRecord, type NextAction, type Note, OPEN_STAGE_TYPE, PROJECTION_KEY_PATTERN, type Page, type PageRequest, type PerSeatValueSource, type PersistAction, type PipelineConfig, type PipelineKind, type PipelineStageConfig, type ProjectionFieldBinding, type ProjectionIdentity, type ProjectionJoin, type ProjectionMapping, type ProjectionRef, REQUIRED_FIELDS, type RecordSource, type RelationshipCandidate, type RelationshipSpec, type RelationshipVia, type RelationshipsMap, type SourceRow, type SourcedRecord, 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 UpdateCompanyInput, type UpdateContactInput, type UpdateDealInput, type UpdateTaskInput, type ValueInterval, authCustom, buildFilterFromDiscriminator, buildRelationships, compileEntityView, compileEntityViews, defineClivlyConfig, entitiesConfigSchema, explainEntitiesConfig, filterSchema, identityRefs, isClosedStageType, mappingsToEntitiesConfig, missingRequiredFields, projectionFields, projectionSchema, reconcile, relationshipSchema, relationshipViaSignature, relationshipsSchema, requiredFieldsFor, runSync, validateEntitiesConfig };