@clivly/core 0.11.0-next.0 → 0.11.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 +44 -7
  2. package/dist/adapter.d.mts +44 -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 +83 -1
  24. package/dist/index.d.cts +89 -22
  25. package/dist/index.d.mts +89 -22
  26. package/dist/index.mjs +80 -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 +96 -33
  40. package/dist/types.d.mts +96 -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/types.d.cts CHANGED
@@ -1,14 +1,14 @@
1
1
  //#region src/types.d.ts
2
- type ContactStatus = "lead" | "active" | "customer" | "churned";
3
- type DealStage = string;
4
- type StageType = "open" | "won" | "lost";
5
- type PipelineKind = "standard" | "recurring";
6
- type ValueInterval = "one_time" | "monthly" | "annual";
2
+ export type ContactStatus = "lead" | "active" | "customer" | "churned";
3
+ export type DealStage = string;
4
+ export type StageType = "open" | "won" | "lost";
5
+ export type PipelineKind = "standard" | "recurring";
6
+ export type ValueInterval = "one_time" | "monthly" | "annual";
7
7
  /** Named once so SQL predicates and UI fallbacks cannot drift apart. */
8
- declare const OPEN_STAGE_TYPE: "open";
8
+ export declare const OPEN_STAGE_TYPE: "open";
9
9
  /** A closed deal is a historical fact: automation never reopens one. */
10
- declare function isClosedStageType(type: StageType): boolean;
11
- interface PipelineStageConfig {
10
+ export declare function isClosedStageType(type: StageType): boolean;
11
+ export interface PipelineStageConfig {
12
12
  color: string | null;
13
13
  id: string;
14
14
  key: DealStage;
@@ -17,7 +17,7 @@ interface PipelineStageConfig {
17
17
  type: StageType;
18
18
  valueFixed: number | null;
19
19
  }
20
- interface PipelineConfig {
20
+ export interface PipelineConfig {
21
21
  id: string;
22
22
  isDefault: boolean;
23
23
  kind: PipelineKind;
@@ -26,12 +26,12 @@ interface PipelineConfig {
26
26
  sourceMappingId: string | null;
27
27
  stages: PipelineStageConfig[];
28
28
  }
29
- type TaskStatus = "todo" | "in_progress" | "done" | "cancelled";
30
- type TaskPriority = "low" | "medium" | "high";
31
- type TaskEntityType = "contact" | "company" | "deal";
32
- type ActivityType = "note" | "email" | "task" | "deal" | "call";
33
- type CrmRole = "owner" | "admin" | "member" | "developer" | "support_agent";
34
- interface Contact {
29
+ export type TaskStatus = "todo" | "in_progress" | "done" | "cancelled";
30
+ export type TaskPriority = "low" | "medium" | "high";
31
+ export type TaskEntityType = "contact" | "company" | "custom" | "deal";
32
+ export type ActivityType = "note" | "email" | "task" | "deal" | "call";
33
+ export type CrmRole = "owner" | "admin" | "member" | "developer" | "support_agent";
34
+ export interface Contact {
35
35
  companyId: string | null;
36
36
  createdAt: Date;
37
37
  email: string;
@@ -40,19 +40,49 @@ interface Contact {
40
40
  name: string;
41
41
  orgId: string;
42
42
  phone: string | null;
43
+ /**
44
+ * The host row this contact mirrors, or null when it was created in the CRM.
45
+ *
46
+ * Carried on the domain type because it decides whether a user may edit the
47
+ * identity fields: sync rewrites them from the host view on every run, so an
48
+ * edit to a sourced row would be silently reverted. See `host-owned-fields`.
49
+ */
50
+ sourceRef: string | null;
43
51
  status: ContactStatus;
44
52
  title: string | null;
45
53
  }
46
- interface Company {
54
+ export interface Company {
55
+ /**
56
+ * How many non-archived contacts are attached to this company.
57
+ *
58
+ * Derived per read, never stored — distinct from {@link Company.size}, which
59
+ * is the mappable headcount of the business itself. A provider with 400 staff
60
+ * and 4 CRM contacts has `size: "400"` and `contactCount: 4`; conflating them
61
+ * would state a falsehood in the authoritative-looking direction.
62
+ */
63
+ contactCount: number;
47
64
  createdAt: Date;
48
65
  domain: string | null;
66
+ email: string | null;
49
67
  id: string;
50
68
  industry: string | null;
51
69
  name: string;
52
70
  orgId: string;
71
+ phone: string | null;
72
+ /**
73
+ * The one contact to talk to at this company, if chosen.
74
+ *
75
+ * Constrained to a contact of this same company, and cleared when that
76
+ * contact is archived — so a non-null value always names someone live and
77
+ * attached here. Unlike the other fields it is never host-owned: it is a CRM
78
+ * judgement, so it stays editable on synced rows.
79
+ */
80
+ primaryContactId: string | null;
53
81
  size: string | null;
82
+ /** See {@link Contact.sourceRef}. */
83
+ sourceRef: string | null;
54
84
  }
55
- interface Deal {
85
+ export interface Deal {
56
86
  closeDate: Date | null;
57
87
  contactId: string | null;
58
88
  createdAt: Date;
@@ -64,7 +94,7 @@ interface Deal {
64
94
  stage: DealStage;
65
95
  value: number;
66
96
  }
67
- interface Task {
97
+ export interface Task {
68
98
  archivedAt: Date | null;
69
99
  assignee: string | null;
70
100
  completedAt: Date | null;
@@ -81,7 +111,7 @@ interface Task {
81
111
  status: TaskStatus;
82
112
  title: string;
83
113
  }
84
- interface Note {
114
+ export interface Note {
85
115
  archivedAt: Date | null;
86
116
  author: string | null;
87
117
  body: string;
@@ -96,7 +126,7 @@ interface Note {
96
126
  title: string;
97
127
  updatedAt: Date;
98
128
  }
99
- interface Activity {
129
+ export interface Activity {
100
130
  actor: string | null;
101
131
  contactId: string | null;
102
132
  createdAt: Date;
@@ -105,7 +135,7 @@ interface Activity {
105
135
  summary: string;
106
136
  type: ActivityType;
107
137
  }
108
- interface CreateContactInput {
138
+ export interface CreateContactInput {
109
139
  companyId?: string;
110
140
  email: string;
111
141
  name: string;
@@ -113,7 +143,7 @@ interface CreateContactInput {
113
143
  status?: ContactStatus;
114
144
  title?: string;
115
145
  }
116
- interface UpdateContactInput {
146
+ export interface UpdateContactInput {
117
147
  companyId?: string | null;
118
148
  email?: string;
119
149
  name?: string;
@@ -121,13 +151,25 @@ interface UpdateContactInput {
121
151
  status?: ContactStatus;
122
152
  title?: string | null;
123
153
  }
124
- interface CreateCompanyInput {
154
+ export interface CreateCompanyInput {
125
155
  domain?: string;
156
+ email?: string;
126
157
  industry?: string;
127
158
  name: string;
159
+ phone?: string;
128
160
  size?: string;
129
161
  }
130
- interface CreateDealInput {
162
+ export interface UpdateCompanyInput {
163
+ domain?: string | null;
164
+ email?: string | null;
165
+ industry?: string | null;
166
+ name?: string;
167
+ phone?: string | null;
168
+ /** Null clears the point of contact; see {@link Company.primaryContactId}. */
169
+ primaryContactId?: string | null;
170
+ size?: string | null;
171
+ }
172
+ export interface CreateDealInput {
131
173
  contactId?: string;
132
174
  name: string;
133
175
  owner?: string;
@@ -135,7 +177,7 @@ interface CreateDealInput {
135
177
  stage?: DealStage;
136
178
  value?: number;
137
179
  }
138
- interface UpdateDealInput {
180
+ export interface UpdateDealInput {
139
181
  closeDate?: Date | null;
140
182
  contactId?: string | null;
141
183
  name?: string;
@@ -143,7 +185,7 @@ interface UpdateDealInput {
143
185
  stage?: DealStage;
144
186
  value?: number;
145
187
  }
146
- interface CreateTaskInput {
188
+ export interface CreateTaskInput {
147
189
  assignee?: string;
148
190
  createdBy?: string;
149
191
  description?: string;
@@ -153,7 +195,7 @@ interface CreateTaskInput {
153
195
  priority?: TaskPriority;
154
196
  title: string;
155
197
  }
156
- interface UpdateTaskInput {
198
+ export interface UpdateTaskInput {
157
199
  assignee?: string | null;
158
200
  description?: string | null;
159
201
  dueAt?: Date | null;
@@ -162,20 +204,42 @@ interface UpdateTaskInput {
162
204
  priority?: TaskPriority;
163
205
  title?: string;
164
206
  }
165
- interface CreateActivityInput {
207
+ export interface CreateActivityInput {
166
208
  actor?: string;
167
209
  contactId?: string;
168
210
  summary: string;
169
211
  type: ActivityType;
170
212
  }
171
- type RecordSource = "all" | "synced";
172
- interface ContactFilters {
213
+ export type RecordSource = "all" | "synced";
214
+ export interface ContactFilters {
173
215
  companyId?: string;
216
+ /**
217
+ * Exclude archived rows. Defaults to false — the adapter returns everything
218
+ * — because most callers are lookup maps, not user-facing lists:
219
+ * `importContacts` builds its dedup set from this (hiding archived rows
220
+ * would resurrect a contact the user archived as a duplicate) and
221
+ * `deals.list` builds its contact-name map from it (an archived contact on
222
+ * a live deal would render blank).
223
+ *
224
+ * The user-facing `contacts.list` / `companies.list` routes opt in, because
225
+ * there `archiveContact` is the delete affordance and a row still visible
226
+ * after archiving reads as a failed delete.
227
+ *
228
+ * Independent of `source`: `source: "synced"` already excludes archived
229
+ * rows, since sync archives a row when it leaves the host view and such a
230
+ * row is no longer sync-provenanced.
231
+ */
232
+ excludeArchived?: boolean;
174
233
  search?: string;
175
234
  source?: RecordSource;
176
235
  status?: ContactStatus;
177
236
  }
178
- interface TaskFilters {
237
+ export interface CompanyFilters {
238
+ /** See {@link ContactFilters.excludeArchived}. */
239
+ excludeArchived?: boolean;
240
+ source?: RecordSource;
241
+ }
242
+ export interface TaskFilters {
179
243
  assignee?: string;
180
244
  entityId?: string;
181
245
  entityType?: TaskEntityType;
@@ -184,5 +248,4 @@ interface TaskFilters {
184
248
  priority?: TaskPriority;
185
249
  status?: TaskStatus;
186
250
  }
187
- //#endregion
188
- export { 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 };
251
+ //#endregion
package/dist/types.d.mts CHANGED
@@ -1,14 +1,14 @@
1
1
  //#region src/types.d.ts
2
- type ContactStatus = "lead" | "active" | "customer" | "churned";
3
- type DealStage = string;
4
- type StageType = "open" | "won" | "lost";
5
- type PipelineKind = "standard" | "recurring";
6
- type ValueInterval = "one_time" | "monthly" | "annual";
2
+ export type ContactStatus = "lead" | "active" | "customer" | "churned";
3
+ export type DealStage = string;
4
+ export type StageType = "open" | "won" | "lost";
5
+ export type PipelineKind = "standard" | "recurring";
6
+ export type ValueInterval = "one_time" | "monthly" | "annual";
7
7
  /** Named once so SQL predicates and UI fallbacks cannot drift apart. */
8
- declare const OPEN_STAGE_TYPE: "open";
8
+ export declare const OPEN_STAGE_TYPE: "open";
9
9
  /** A closed deal is a historical fact: automation never reopens one. */
10
- declare function isClosedStageType(type: StageType): boolean;
11
- interface PipelineStageConfig {
10
+ export declare function isClosedStageType(type: StageType): boolean;
11
+ export interface PipelineStageConfig {
12
12
  color: string | null;
13
13
  id: string;
14
14
  key: DealStage;
@@ -17,7 +17,7 @@ interface PipelineStageConfig {
17
17
  type: StageType;
18
18
  valueFixed: number | null;
19
19
  }
20
- interface PipelineConfig {
20
+ export interface PipelineConfig {
21
21
  id: string;
22
22
  isDefault: boolean;
23
23
  kind: PipelineKind;
@@ -26,12 +26,12 @@ interface PipelineConfig {
26
26
  sourceMappingId: string | null;
27
27
  stages: PipelineStageConfig[];
28
28
  }
29
- type TaskStatus = "todo" | "in_progress" | "done" | "cancelled";
30
- type TaskPriority = "low" | "medium" | "high";
31
- type TaskEntityType = "contact" | "company" | "deal";
32
- type ActivityType = "note" | "email" | "task" | "deal" | "call";
33
- type CrmRole = "owner" | "admin" | "member" | "developer" | "support_agent";
34
- interface Contact {
29
+ export type TaskStatus = "todo" | "in_progress" | "done" | "cancelled";
30
+ export type TaskPriority = "low" | "medium" | "high";
31
+ export type TaskEntityType = "contact" | "company" | "custom" | "deal";
32
+ export type ActivityType = "note" | "email" | "task" | "deal" | "call";
33
+ export type CrmRole = "owner" | "admin" | "member" | "developer" | "support_agent";
34
+ export interface Contact {
35
35
  companyId: string | null;
36
36
  createdAt: Date;
37
37
  email: string;
@@ -40,19 +40,49 @@ interface Contact {
40
40
  name: string;
41
41
  orgId: string;
42
42
  phone: string | null;
43
+ /**
44
+ * The host row this contact mirrors, or null when it was created in the CRM.
45
+ *
46
+ * Carried on the domain type because it decides whether a user may edit the
47
+ * identity fields: sync rewrites them from the host view on every run, so an
48
+ * edit to a sourced row would be silently reverted. See `host-owned-fields`.
49
+ */
50
+ sourceRef: string | null;
43
51
  status: ContactStatus;
44
52
  title: string | null;
45
53
  }
46
- interface Company {
54
+ export interface Company {
55
+ /**
56
+ * How many non-archived contacts are attached to this company.
57
+ *
58
+ * Derived per read, never stored — distinct from {@link Company.size}, which
59
+ * is the mappable headcount of the business itself. A provider with 400 staff
60
+ * and 4 CRM contacts has `size: "400"` and `contactCount: 4`; conflating them
61
+ * would state a falsehood in the authoritative-looking direction.
62
+ */
63
+ contactCount: number;
47
64
  createdAt: Date;
48
65
  domain: string | null;
66
+ email: string | null;
49
67
  id: string;
50
68
  industry: string | null;
51
69
  name: string;
52
70
  orgId: string;
71
+ phone: string | null;
72
+ /**
73
+ * The one contact to talk to at this company, if chosen.
74
+ *
75
+ * Constrained to a contact of this same company, and cleared when that
76
+ * contact is archived — so a non-null value always names someone live and
77
+ * attached here. Unlike the other fields it is never host-owned: it is a CRM
78
+ * judgement, so it stays editable on synced rows.
79
+ */
80
+ primaryContactId: string | null;
53
81
  size: string | null;
82
+ /** See {@link Contact.sourceRef}. */
83
+ sourceRef: string | null;
54
84
  }
55
- interface Deal {
85
+ export interface Deal {
56
86
  closeDate: Date | null;
57
87
  contactId: string | null;
58
88
  createdAt: Date;
@@ -64,7 +94,7 @@ interface Deal {
64
94
  stage: DealStage;
65
95
  value: number;
66
96
  }
67
- interface Task {
97
+ export interface Task {
68
98
  archivedAt: Date | null;
69
99
  assignee: string | null;
70
100
  completedAt: Date | null;
@@ -81,7 +111,7 @@ interface Task {
81
111
  status: TaskStatus;
82
112
  title: string;
83
113
  }
84
- interface Note {
114
+ export interface Note {
85
115
  archivedAt: Date | null;
86
116
  author: string | null;
87
117
  body: string;
@@ -96,7 +126,7 @@ interface Note {
96
126
  title: string;
97
127
  updatedAt: Date;
98
128
  }
99
- interface Activity {
129
+ export interface Activity {
100
130
  actor: string | null;
101
131
  contactId: string | null;
102
132
  createdAt: Date;
@@ -105,7 +135,7 @@ interface Activity {
105
135
  summary: string;
106
136
  type: ActivityType;
107
137
  }
108
- interface CreateContactInput {
138
+ export interface CreateContactInput {
109
139
  companyId?: string;
110
140
  email: string;
111
141
  name: string;
@@ -113,7 +143,7 @@ interface CreateContactInput {
113
143
  status?: ContactStatus;
114
144
  title?: string;
115
145
  }
116
- interface UpdateContactInput {
146
+ export interface UpdateContactInput {
117
147
  companyId?: string | null;
118
148
  email?: string;
119
149
  name?: string;
@@ -121,13 +151,25 @@ interface UpdateContactInput {
121
151
  status?: ContactStatus;
122
152
  title?: string | null;
123
153
  }
124
- interface CreateCompanyInput {
154
+ export interface CreateCompanyInput {
125
155
  domain?: string;
156
+ email?: string;
126
157
  industry?: string;
127
158
  name: string;
159
+ phone?: string;
128
160
  size?: string;
129
161
  }
130
- interface CreateDealInput {
162
+ export interface UpdateCompanyInput {
163
+ domain?: string | null;
164
+ email?: string | null;
165
+ industry?: string | null;
166
+ name?: string;
167
+ phone?: string | null;
168
+ /** Null clears the point of contact; see {@link Company.primaryContactId}. */
169
+ primaryContactId?: string | null;
170
+ size?: string | null;
171
+ }
172
+ export interface CreateDealInput {
131
173
  contactId?: string;
132
174
  name: string;
133
175
  owner?: string;
@@ -135,7 +177,7 @@ interface CreateDealInput {
135
177
  stage?: DealStage;
136
178
  value?: number;
137
179
  }
138
- interface UpdateDealInput {
180
+ export interface UpdateDealInput {
139
181
  closeDate?: Date | null;
140
182
  contactId?: string | null;
141
183
  name?: string;
@@ -143,7 +185,7 @@ interface UpdateDealInput {
143
185
  stage?: DealStage;
144
186
  value?: number;
145
187
  }
146
- interface CreateTaskInput {
188
+ export interface CreateTaskInput {
147
189
  assignee?: string;
148
190
  createdBy?: string;
149
191
  description?: string;
@@ -153,7 +195,7 @@ interface CreateTaskInput {
153
195
  priority?: TaskPriority;
154
196
  title: string;
155
197
  }
156
- interface UpdateTaskInput {
198
+ export interface UpdateTaskInput {
157
199
  assignee?: string | null;
158
200
  description?: string | null;
159
201
  dueAt?: Date | null;
@@ -162,20 +204,42 @@ interface UpdateTaskInput {
162
204
  priority?: TaskPriority;
163
205
  title?: string;
164
206
  }
165
- interface CreateActivityInput {
207
+ export interface CreateActivityInput {
166
208
  actor?: string;
167
209
  contactId?: string;
168
210
  summary: string;
169
211
  type: ActivityType;
170
212
  }
171
- type RecordSource = "all" | "synced";
172
- interface ContactFilters {
213
+ export type RecordSource = "all" | "synced";
214
+ export interface ContactFilters {
173
215
  companyId?: string;
216
+ /**
217
+ * Exclude archived rows. Defaults to false — the adapter returns everything
218
+ * — because most callers are lookup maps, not user-facing lists:
219
+ * `importContacts` builds its dedup set from this (hiding archived rows
220
+ * would resurrect a contact the user archived as a duplicate) and
221
+ * `deals.list` builds its contact-name map from it (an archived contact on
222
+ * a live deal would render blank).
223
+ *
224
+ * The user-facing `contacts.list` / `companies.list` routes opt in, because
225
+ * there `archiveContact` is the delete affordance and a row still visible
226
+ * after archiving reads as a failed delete.
227
+ *
228
+ * Independent of `source`: `source: "synced"` already excludes archived
229
+ * rows, since sync archives a row when it leaves the host view and such a
230
+ * row is no longer sync-provenanced.
231
+ */
232
+ excludeArchived?: boolean;
174
233
  search?: string;
175
234
  source?: RecordSource;
176
235
  status?: ContactStatus;
177
236
  }
178
- interface TaskFilters {
237
+ export interface CompanyFilters {
238
+ /** See {@link ContactFilters.excludeArchived}. */
239
+ excludeArchived?: boolean;
240
+ source?: RecordSource;
241
+ }
242
+ export interface TaskFilters {
179
243
  assignee?: string;
180
244
  entityId?: string;
181
245
  entityType?: TaskEntityType;
@@ -184,5 +248,4 @@ interface TaskFilters {
184
248
  priority?: TaskPriority;
185
249
  status?: TaskStatus;
186
250
  }
187
- //#endregion
188
- export { 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 };
251
+ //#endregion
@@ -1,7 +1,7 @@
1
- import { a as ClivlyEntitiesConfig } from "./entity-config-Ddgukq_E.cjs";
1
+ import { a as ClivlyEntitiesConfig } from "./entity-config-OhC4Otkz.cjs";
2
2
  //#region src/view-compiler.d.ts
3
- declare const DEFAULT_VIEW_PREFIX = "crm_src_";
4
- interface CompileOptions {
3
+ export declare const DEFAULT_VIEW_PREFIX = "crm_src_";
4
+ export interface CompileOptions {
5
5
  /**
6
6
  * Optional tenant-scoping predicate ANDed into every view's WHERE, e.g.
7
7
  * `{ column: "workspace_id", value: "ws_123" }`. Column must exist on the
@@ -29,7 +29,7 @@ interface CompileOptions {
29
29
  /** View name prefix. Defaults to `crm_src_`. */
30
30
  viewPrefix?: string;
31
31
  }
32
- interface CompiledView {
32
+ export interface CompiledView {
33
33
  /** Output column names in SELECT order (`id`, mapped fields, then `<rel>_ref`s). */
34
34
  columns: string[];
35
35
  concept: string;
@@ -52,12 +52,12 @@ interface CompiledView {
52
52
  * (`reloptions.c`) — no mention of Clivly, the option, or the version. The
53
53
  * compiler cannot catch this itself because the host executes the SQL.
54
54
  */
55
- declare function explainViewExecutionError(error: unknown): string | undefined;
56
- declare function compileEntityView(config: ClivlyEntitiesConfig, entityKey: string, options?: CompileOptions): CompiledView;
55
+ export declare function explainViewExecutionError(error: unknown): string | undefined;
56
+ export declare function compileEntityView(config: ClivlyEntitiesConfig, entityKey: string, options?: CompileOptions): CompiledView;
57
57
  /** Compile every entity in the config into its view, in declaration order. */
58
- declare function compileEntityViews(config: ClivlyEntitiesConfig, options?: CompileOptions): CompiledView[];
58
+ export declare function compileEntityViews(config: ClivlyEntitiesConfig, options?: CompileOptions): CompiledView[];
59
59
  /** The outcome of dry-running one entity's compiled view against the host. */
60
- interface ExplainResult {
60
+ export interface ExplainResult {
61
61
  entityKey: string;
62
62
  /** The runner's error message when `ok` is false. */
63
63
  error?: string;
@@ -76,6 +76,5 @@ interface ExplainResult {
76
76
  * transaction it rolls back, or by `EXPLAIN`-ing the statement — since the
77
77
  * compiled SQL is a `CREATE OR REPLACE VIEW`.
78
78
  */
79
- declare function explainEntitiesConfig(config: ClivlyEntitiesConfig, run: (sql: string) => Promise<unknown>, options?: CompileOptions): Promise<ExplainResult[]>;
80
- //#endregion
81
- export { CompileOptions, CompiledView, DEFAULT_VIEW_PREFIX, ExplainResult, compileEntityView, compileEntityViews, explainEntitiesConfig, explainViewExecutionError };
79
+ export declare function explainEntitiesConfig(config: ClivlyEntitiesConfig, run: (sql: string) => Promise<unknown>, options?: CompileOptions): Promise<ExplainResult[]>;
80
+ //#endregion
@@ -1,7 +1,7 @@
1
- import { a as ClivlyEntitiesConfig } from "./entity-config-Ddgukq_E.mjs";
1
+ import { a as ClivlyEntitiesConfig } from "./entity-config-OhC4Otkz.mjs";
2
2
  //#region src/view-compiler.d.ts
3
- declare const DEFAULT_VIEW_PREFIX = "crm_src_";
4
- interface CompileOptions {
3
+ export declare const DEFAULT_VIEW_PREFIX = "crm_src_";
4
+ export interface CompileOptions {
5
5
  /**
6
6
  * Optional tenant-scoping predicate ANDed into every view's WHERE, e.g.
7
7
  * `{ column: "workspace_id", value: "ws_123" }`. Column must exist on the
@@ -29,7 +29,7 @@ interface CompileOptions {
29
29
  /** View name prefix. Defaults to `crm_src_`. */
30
30
  viewPrefix?: string;
31
31
  }
32
- interface CompiledView {
32
+ export interface CompiledView {
33
33
  /** Output column names in SELECT order (`id`, mapped fields, then `<rel>_ref`s). */
34
34
  columns: string[];
35
35
  concept: string;
@@ -52,12 +52,12 @@ interface CompiledView {
52
52
  * (`reloptions.c`) — no mention of Clivly, the option, or the version. The
53
53
  * compiler cannot catch this itself because the host executes the SQL.
54
54
  */
55
- declare function explainViewExecutionError(error: unknown): string | undefined;
56
- declare function compileEntityView(config: ClivlyEntitiesConfig, entityKey: string, options?: CompileOptions): CompiledView;
55
+ export declare function explainViewExecutionError(error: unknown): string | undefined;
56
+ export declare function compileEntityView(config: ClivlyEntitiesConfig, entityKey: string, options?: CompileOptions): CompiledView;
57
57
  /** Compile every entity in the config into its view, in declaration order. */
58
- declare function compileEntityViews(config: ClivlyEntitiesConfig, options?: CompileOptions): CompiledView[];
58
+ export declare function compileEntityViews(config: ClivlyEntitiesConfig, options?: CompileOptions): CompiledView[];
59
59
  /** The outcome of dry-running one entity's compiled view against the host. */
60
- interface ExplainResult {
60
+ export interface ExplainResult {
61
61
  entityKey: string;
62
62
  /** The runner's error message when `ok` is false. */
63
63
  error?: string;
@@ -76,6 +76,5 @@ interface ExplainResult {
76
76
  * transaction it rolls back, or by `EXPLAIN`-ing the statement — since the
77
77
  * compiled SQL is a `CREATE OR REPLACE VIEW`.
78
78
  */
79
- declare function explainEntitiesConfig(config: ClivlyEntitiesConfig, run: (sql: string) => Promise<unknown>, options?: CompileOptions): Promise<ExplainResult[]>;
80
- //#endregion
81
- export { CompileOptions, CompiledView, DEFAULT_VIEW_PREFIX, ExplainResult, compileEntityView, compileEntityViews, explainEntitiesConfig, explainViewExecutionError };
79
+ export declare function explainEntitiesConfig(config: ClivlyEntitiesConfig, run: (sql: string) => Promise<unknown>, options?: CompileOptions): Promise<ExplainResult[]>;
80
+ //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clivly/core",
3
- "version": "0.11.0-next.0",
3
+ "version": "0.11.0",
4
4
  "private": false,
5
5
  "description": "ORM/auth-agnostic CRM adapter contracts and shared domain types for Clivly.",
6
6
  "license": "MIT",