clivly 0.11.0 → 0.13.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 (53) hide show
  1. package/{adapter-BWrOtOw5.d.mts → adapter-DTMeGGsl.d.cts} +19 -1
  2. package/{adapter-Bd5HjLYa.d.cts → adapter-DhPBRNpi.d.mts} +19 -1
  3. package/{auth-adapter-C3BQpc-q.d.cts → auth-adapter-C6rDx3XH.d.mts} +1 -1
  4. package/{auth-adapter-D54ajbl7.d.mts → auth-adapter-Csk9KkvI.d.cts} +1 -1
  5. package/auth-better-auth.d.cts +1 -1
  6. package/auth-better-auth.d.mts +1 -1
  7. package/auth-clerk.d.cts +1 -1
  8. package/auth-clerk.d.mts +1 -1
  9. package/auth-workos.d.cts +1 -1
  10. package/auth-workos.d.mts +1 -1
  11. package/core-adapter.d.cts +1 -1
  12. package/core-adapter.d.mts +1 -1
  13. package/core-auth-adapter.d.cts +1 -1
  14. package/core-auth-adapter.d.mts +1 -1
  15. package/core-types.d.cts +2 -2
  16. package/core-types.d.mts +2 -2
  17. package/core.cjs +2 -1
  18. package/core.d.cts +5 -5
  19. package/core.d.mts +5 -5
  20. package/core.mjs +2 -2
  21. package/drizzle.cjs +66 -0
  22. package/drizzle.d.cts +66 -1
  23. package/drizzle.d.mts +66 -1
  24. package/drizzle.mjs +65 -1
  25. package/index.cjs +1 -1
  26. package/index.mjs +1 -1
  27. package/{internal-CRIgf9jS.cjs → internal-BxtvxF7Z.cjs} +34 -0
  28. package/{internal-Bjpq7S2G.d.mts → internal-Cmx7Zevf.d.mts} +36 -1
  29. package/internal-adapter.d.cts +1 -1
  30. package/internal-adapter.d.mts +1 -1
  31. package/internal-auth-adapter.d.cts +1 -1
  32. package/internal-auth-adapter.d.mts +1 -1
  33. package/internal-types.d.cts +2 -2
  34. package/internal-types.d.mts +2 -2
  35. package/{internal-v6P9MZY1.mjs → internal-u0Bks5Gr.mjs} +29 -1
  36. package/{internal-D9kqkhPs.d.cts → internal-vH5Rlg6Q.d.cts} +36 -1
  37. package/internal.cjs +2 -1
  38. package/internal.d.cts +5 -5
  39. package/internal.d.mts +5 -5
  40. package/internal.mjs +2 -2
  41. package/{namespace-probe-CNQKSmxz.d.mts → namespace-probe-DykR0kgh.d.mts} +42 -0
  42. package/{namespace-probe-C5RLl74M.d.cts → namespace-probe-H7yWc0JV.d.cts} +42 -0
  43. package/package.json +1 -1
  44. package/{sdk-C-Pjxj2y.mjs → sdk-B-dp1tZN.mjs} +38 -1
  45. package/{sdk-BvGSxBQc.cjs → sdk-DKfKhJD_.cjs} +38 -1
  46. package/sdk.cjs +1 -1
  47. package/sdk.d.cts +1 -1
  48. package/sdk.d.mts +1 -1
  49. package/sdk.mjs +1 -1
  50. package/{types-D08UzDqe.d.mts → types-B17TWEOL.d.cts} +37 -1
  51. package/{types-D08UzDqe.d.cts → types-B17TWEOL.d.mts} +37 -1
  52. package/vite.d.cts +1 -1
  53. package/vite.d.mts +1 -1
package/index.cjs CHANGED
@@ -3,7 +3,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const require_entity_config = require("./entity-config-BI4RYNKL.cjs");
4
4
  require("./mapping-score-CaB3F4Uu.cjs");
5
5
  const require_internal_entity_heuristics = require("./internal-entity-heuristics.cjs");
6
- const require_sdk = require("./sdk-BvGSxBQc.cjs");
6
+ const require_sdk = require("./sdk-DKfKhJD_.cjs");
7
7
  let node_child_process = require("node:child_process");
8
8
  let node_fs = require("node:fs");
9
9
  let node_module = require("node:module");
package/index.mjs CHANGED
@@ -2,7 +2,7 @@
2
2
  import { t as CANONICAL_FIELDS } from "./entity-config-Ccfb2IL9.mjs";
3
3
  import "./mapping-score-C68uAqGB.mjs";
4
4
  import { hasDefiningColumn, isFrameworkTable, matchesConcept, requiredFieldsFor, scoreFieldMap, scoreRelationships, suggestCursorField, toFieldMap } from "./internal-entity-heuristics.mjs";
5
- import { s as isPlaceholderUrl, t as createClivlySDK } from "./sdk-C-Pjxj2y.mjs";
5
+ import { s as isPlaceholderUrl, t as createClivlySDK } from "./sdk-B-dp1tZN.mjs";
6
6
  import { createRequire } from "node:module";
7
7
  import { spawn } from "node:child_process";
8
8
  import { accessSync, constants, existsSync, mkdirSync, readFileSync, readdirSync, realpathSync, statSync, watch, writeFileSync } from "node:fs";
@@ -1,3 +1,31 @@
1
+ //#region ../core/src/deal-value.ts
2
+ const MONTHS_PER_YEAR = 12;
3
+ /** Only two decimal-free seat counts make sense; anything else is bad data. */
4
+ const SEAT_COUNT_REGEX = /^\d+$/;
5
+ /**
6
+ * The value one deal should have, in cents, or null to leave it alone.
7
+ *
8
+ * Returning null rather than 0 for unusable input is deliberate (D33). A
9
+ * renamed column would otherwise zero an entire pipeline silently, and a zeroed
10
+ * board reads as a business problem rather than a configuration problem. The
11
+ * unmapped case is surfaced through the rule-health warning surface instead of
12
+ * being written into the data — the same fail-safe `matchesCondition` applies.
13
+ */
14
+ function computeDealValue(source, fields, mappedFields, stageType) {
15
+ if (source.zeroInStageTypes?.includes(stageType)) return 0;
16
+ if (!(mappedFields.has(source.seatField) && mappedFields.has(source.planField))) return null;
17
+ const planKey = fields[source.planField];
18
+ if (planKey == null || planKey === "") return null;
19
+ const unitPriceCents = source.plans[planKey];
20
+ if (unitPriceCents === void 0) return null;
21
+ const rawSeats = fields[source.seatField];
22
+ if (rawSeats == null || !SEAT_COUNT_REGEX.test(rawSeats)) return null;
23
+ const seats = Number(rawSeats);
24
+ if (!Number.isSafeInteger(seats)) return null;
25
+ const monthly = (source.baseFeeCents ?? 0) + seats * unitPriceCents;
26
+ return source.intervalField !== void 0 && mappedFields.has(source.intervalField) && fields[source.intervalField] === "year" ? Math.round(monthly / MONTHS_PER_YEAR) : monthly;
27
+ }
28
+ //#endregion
1
29
  //#region ../core/src/host-owned-fields.ts
2
30
  /**
3
31
  * Which fields a CRM record lets a user edit.
@@ -219,6 +247,12 @@ function evaluateStage(rules, fields, mappedFields) {
219
247
  return null;
220
248
  }
221
249
  //#endregion
250
+ Object.defineProperty(exports, "computeDealValue", {
251
+ enumerable: true,
252
+ get: function() {
253
+ return computeDealValue;
254
+ }
255
+ });
222
256
  Object.defineProperty(exports, "evaluateStage", {
223
257
  enumerable: true,
224
258
  get: function() {
@@ -1,4 +1,39 @@
1
1
  import { L as ProjectionJoin, R as ProjectionMapping, h as FilterExpr, l as ConfigValidationError, m as DiscoveredSchemaTable, p as DiscoveredColumnMeta } from "./entity-config-CKcj4-M_.mjs";
2
+ //#region ../core/src/deal-value.d.ts
3
+ /**
4
+ * Value derived as a flat fee plus a per-seat price that depends on the plan.
5
+ *
6
+ * Every field name is configuration and every plan key is data, so a second
7
+ * subscription business configures this without a code change. The formula is
8
+ * fixed with named slots rather than an expression language — the same choice
9
+ * D8 made for stage-rule conditions.
10
+ */
11
+ interface PerSeatValueSource {
12
+ /** Flat monthly fee in cents, added before the interval is normalised. */
13
+ baseFeeCents?: number;
14
+ /** Mapped column holding "month" or "year". Absent means always monthly. */
15
+ intervalField?: string;
16
+ kind: "per_seat";
17
+ /** Mapped column holding the plan key. */
18
+ planField: string;
19
+ /** Unit price in cents, keyed by the value found in `planField`. */
20
+ plans: Record<string, number>;
21
+ /** Mapped column holding the seat count. */
22
+ seatField: string;
23
+ /** Stage types whose deals are worth nothing (usually `["lost"]`). */
24
+ zeroInStageTypes?: string[];
25
+ }
26
+ /**
27
+ * The value one deal should have, in cents, or null to leave it alone.
28
+ *
29
+ * Returning null rather than 0 for unusable input is deliberate (D33). A
30
+ * renamed column would otherwise zero an entire pipeline silently, and a zeroed
31
+ * board reads as a business problem rather than a configuration problem. The
32
+ * unmapped case is surfaced through the rule-health warning surface instead of
33
+ * being written into the data — the same fail-safe `matchesCondition` applies.
34
+ */
35
+ declare function computeDealValue(source: PerSeatValueSource, fields: Record<string, string | null>, mappedFields: Set<string>, stageType: string): number | null;
36
+ //#endregion
2
37
  //#region ../core/src/host-owned-fields.d.ts
3
38
  /**
4
39
  * Which fields a CRM record lets a user edit.
@@ -290,4 +325,4 @@ declare function matchesCondition(condition: Condition, fields: Record<string, s
290
325
  */
291
326
  declare function evaluateStage(rules: EvaluableRule[], fields: Record<string, string | null>, mappedFields: Set<string>): string | null;
292
327
  //#endregion
293
- export { HostOwnedCompanyField as C, isHostOwned as D, hostOwnedFieldMessage as E, rejectedCompanyFields as O, joinFansOut as S, SourcedRecord as T, compileProjectionJoins as _, matchesCondition as a, quoteIdent as b, columnMetaFor as c, primaryKeyColumns as d, validateProjection as f, compileProjectionIdentity as g, compileProjectionFrom as h, evaluateStage as i, rejectedContactFields as k, coversUniqueKey as l, PREVIEW_MAX_ROWS as m, ConditionOp as n, slugify as o, validateProjectionFilter as p, EvaluableRule as r, toObjectTypeSlug as s, Condition as t, hasRichMeta as u, compileProjectionPreview as v, HostOwnedContactField as w, fanOutJoins as x, compileProjectionSelect as y };
328
+ export { PerSeatValueSource as A, HostOwnedCompanyField as C, isHostOwned as D, hostOwnedFieldMessage as E, rejectedCompanyFields as O, joinFansOut as S, SourcedRecord as T, compileProjectionJoins as _, matchesCondition as a, quoteIdent as b, columnMetaFor as c, primaryKeyColumns as d, validateProjection as f, compileProjectionIdentity as g, compileProjectionFrom as h, evaluateStage as i, computeDealValue as j, rejectedContactFields as k, coversUniqueKey as l, PREVIEW_MAX_ROWS as m, ConditionOp as n, slugify as o, validateProjectionFilter as p, EvaluableRule as r, toObjectTypeSlug as s, Condition as t, hasRichMeta as u, compileProjectionPreview as v, HostOwnedContactField as w, fanOutJoins as x, compileProjectionSelect as y };
@@ -1,2 +1,2 @@
1
- import { t as CRMAdapter } from "./adapter-Bd5HjLYa.cjs";
1
+ import { t as CRMAdapter } from "./adapter-DTMeGGsl.cjs";
2
2
  export { CRMAdapter };
@@ -1,2 +1,2 @@
1
- import { t as CRMAdapter } from "./adapter-BWrOtOw5.mjs";
1
+ import { t as CRMAdapter } from "./adapter-DhPBRNpi.mjs";
2
2
  export { CRMAdapter };
@@ -1,2 +1,2 @@
1
- import { a as authCustom, i as MembershipResolver, n as ClivlyUser, r as CrmMembership, t as ClivlyAuthAdapter } from "./auth-adapter-C3BQpc-q.cjs";
1
+ import { a as authCustom, i as MembershipResolver, n as ClivlyUser, r as CrmMembership, t as ClivlyAuthAdapter } from "./auth-adapter-Csk9KkvI.cjs";
2
2
  export { ClivlyAuthAdapter, ClivlyUser, CrmMembership, MembershipResolver, authCustom };
@@ -1,2 +1,2 @@
1
- import { a as authCustom, i as MembershipResolver, n as ClivlyUser, r as CrmMembership, t as ClivlyAuthAdapter } from "./auth-adapter-D54ajbl7.mjs";
1
+ import { a as authCustom, i as MembershipResolver, n as ClivlyUser, r as CrmMembership, t as ClivlyAuthAdapter } from "./auth-adapter-C6rDx3XH.mjs";
2
2
  export { ClivlyAuthAdapter, ClivlyUser, CrmMembership, MembershipResolver, authCustom };
@@ -1,2 +1,2 @@
1
- import { A as UpdateDealInput, C as Task, D as TaskStatus, E as TaskPriority, M as ValueInterval, N as isClosedStageType, O as UpdateCompanyInput, S as StageType, T as TaskFilters, _ as OPEN_STAGE_TYPE, a as Contact, b as PipelineStageConfig, c as CreateActivityInput, d as CreateDealInput, f as CreateTaskInput, g as Note, h as DealStage, i as CompanyFilters, j as UpdateTaskInput, k as UpdateContactInput, l as CreateCompanyInput, m as Deal, n as ActivityType, o as ContactFilters, p as CrmRole, r as Company, s as ContactStatus, t as Activity, u as CreateContactInput, v as PipelineConfig, w as TaskEntityType, x as RecordSource, y as PipelineKind } from "./types-D08UzDqe.cjs";
2
- export { Activity, ActivityType, Company, CompanyFilters, 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, UpdateCompanyInput, UpdateContactInput, UpdateDealInput, UpdateTaskInput, ValueInterval, isClosedStageType };
1
+ import { A as UpdateCompanyInput, C as RecordSource, D as TaskFilters, E as TaskEntityType, F as isClosedStageType, M as UpdateDealInput, N as UpdateTaskInput, O as TaskPriority, P as ValueInterval, S as PipelineStageConfig, T as Task, _ as OPEN_STAGE_TYPE, a as Contact, b as PipelineConfig, c as CreateActivityInput, d as CreateDealInput, f as CreateTaskInput, g as Note, h as DealStage, i as CompanyFilters, j as UpdateContactInput, k as TaskStatus, l as CreateCompanyInput, m as Deal, n as ActivityType, o as ContactFilters, p as CrmRole, r as Company, s as ContactStatus, t as Activity, u as CreateContactInput, v as Page, w as StageType, x as PipelineKind, y as PageRequest } from "./types-B17TWEOL.cjs";
2
+ export { 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 };
@@ -1,2 +1,2 @@
1
- import { A as UpdateDealInput, C as Task, D as TaskStatus, E as TaskPriority, M as ValueInterval, N as isClosedStageType, O as UpdateCompanyInput, S as StageType, T as TaskFilters, _ as OPEN_STAGE_TYPE, a as Contact, b as PipelineStageConfig, c as CreateActivityInput, d as CreateDealInput, f as CreateTaskInput, g as Note, h as DealStage, i as CompanyFilters, j as UpdateTaskInput, k as UpdateContactInput, l as CreateCompanyInput, m as Deal, n as ActivityType, o as ContactFilters, p as CrmRole, r as Company, s as ContactStatus, t as Activity, u as CreateContactInput, v as PipelineConfig, w as TaskEntityType, x as RecordSource, y as PipelineKind } from "./types-D08UzDqe.mjs";
2
- export { Activity, ActivityType, Company, CompanyFilters, 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, UpdateCompanyInput, UpdateContactInput, UpdateDealInput, UpdateTaskInput, ValueInterval, isClosedStageType };
1
+ import { A as UpdateCompanyInput, C as RecordSource, D as TaskFilters, E as TaskEntityType, F as isClosedStageType, M as UpdateDealInput, N as UpdateTaskInput, O as TaskPriority, P as ValueInterval, S as PipelineStageConfig, T as Task, _ as OPEN_STAGE_TYPE, a as Contact, b as PipelineConfig, c as CreateActivityInput, d as CreateDealInput, f as CreateTaskInput, g as Note, h as DealStage, i as CompanyFilters, j as UpdateContactInput, k as TaskStatus, l as CreateCompanyInput, m as Deal, n as ActivityType, o as ContactFilters, p as CrmRole, r as Company, s as ContactStatus, t as Activity, u as CreateContactInput, v as Page, w as StageType, x as PipelineKind, y as PageRequest } from "./types-B17TWEOL.mjs";
2
+ export { 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 };
@@ -1,3 +1,31 @@
1
+ //#region ../core/src/deal-value.ts
2
+ const MONTHS_PER_YEAR = 12;
3
+ /** Only two decimal-free seat counts make sense; anything else is bad data. */
4
+ const SEAT_COUNT_REGEX = /^\d+$/;
5
+ /**
6
+ * The value one deal should have, in cents, or null to leave it alone.
7
+ *
8
+ * Returning null rather than 0 for unusable input is deliberate (D33). A
9
+ * renamed column would otherwise zero an entire pipeline silently, and a zeroed
10
+ * board reads as a business problem rather than a configuration problem. The
11
+ * unmapped case is surfaced through the rule-health warning surface instead of
12
+ * being written into the data — the same fail-safe `matchesCondition` applies.
13
+ */
14
+ function computeDealValue(source, fields, mappedFields, stageType) {
15
+ if (source.zeroInStageTypes?.includes(stageType)) return 0;
16
+ if (!(mappedFields.has(source.seatField) && mappedFields.has(source.planField))) return null;
17
+ const planKey = fields[source.planField];
18
+ if (planKey == null || planKey === "") return null;
19
+ const unitPriceCents = source.plans[planKey];
20
+ if (unitPriceCents === void 0) return null;
21
+ const rawSeats = fields[source.seatField];
22
+ if (rawSeats == null || !SEAT_COUNT_REGEX.test(rawSeats)) return null;
23
+ const seats = Number(rawSeats);
24
+ if (!Number.isSafeInteger(seats)) return null;
25
+ const monthly = (source.baseFeeCents ?? 0) + seats * unitPriceCents;
26
+ return source.intervalField !== void 0 && mappedFields.has(source.intervalField) && fields[source.intervalField] === "year" ? Math.round(monthly / MONTHS_PER_YEAR) : monthly;
27
+ }
28
+ //#endregion
1
29
  //#region ../core/src/host-owned-fields.ts
2
30
  /**
3
31
  * Which fields a CRM record lets a user edit.
@@ -219,4 +247,4 @@ function evaluateStage(rules, fields, mappedFields) {
219
247
  return null;
220
248
  }
221
249
  //#endregion
222
- export { hostOwnedFieldMessage as a, rejectedContactFields as c, toObjectTypeSlug as i, matchesCondition as n, isHostOwned as o, slugify as r, rejectedCompanyFields as s, evaluateStage as t };
250
+ export { hostOwnedFieldMessage as a, rejectedContactFields as c, toObjectTypeSlug as i, computeDealValue as l, matchesCondition as n, isHostOwned as o, slugify as r, rejectedCompanyFields as s, evaluateStage as t };
@@ -1,4 +1,39 @@
1
1
  import { L as ProjectionJoin, R as ProjectionMapping, h as FilterExpr, l as ConfigValidationError, m as DiscoveredSchemaTable, p as DiscoveredColumnMeta } from "./entity-config-ApnT5j3X.cjs";
2
+ //#region ../core/src/deal-value.d.ts
3
+ /**
4
+ * Value derived as a flat fee plus a per-seat price that depends on the plan.
5
+ *
6
+ * Every field name is configuration and every plan key is data, so a second
7
+ * subscription business configures this without a code change. The formula is
8
+ * fixed with named slots rather than an expression language — the same choice
9
+ * D8 made for stage-rule conditions.
10
+ */
11
+ interface PerSeatValueSource {
12
+ /** Flat monthly fee in cents, added before the interval is normalised. */
13
+ baseFeeCents?: number;
14
+ /** Mapped column holding "month" or "year". Absent means always monthly. */
15
+ intervalField?: string;
16
+ kind: "per_seat";
17
+ /** Mapped column holding the plan key. */
18
+ planField: string;
19
+ /** Unit price in cents, keyed by the value found in `planField`. */
20
+ plans: Record<string, number>;
21
+ /** Mapped column holding the seat count. */
22
+ seatField: string;
23
+ /** Stage types whose deals are worth nothing (usually `["lost"]`). */
24
+ zeroInStageTypes?: string[];
25
+ }
26
+ /**
27
+ * The value one deal should have, in cents, or null to leave it alone.
28
+ *
29
+ * Returning null rather than 0 for unusable input is deliberate (D33). A
30
+ * renamed column would otherwise zero an entire pipeline silently, and a zeroed
31
+ * board reads as a business problem rather than a configuration problem. The
32
+ * unmapped case is surfaced through the rule-health warning surface instead of
33
+ * being written into the data — the same fail-safe `matchesCondition` applies.
34
+ */
35
+ declare function computeDealValue(source: PerSeatValueSource, fields: Record<string, string | null>, mappedFields: Set<string>, stageType: string): number | null;
36
+ //#endregion
2
37
  //#region ../core/src/host-owned-fields.d.ts
3
38
  /**
4
39
  * Which fields a CRM record lets a user edit.
@@ -290,4 +325,4 @@ declare function matchesCondition(condition: Condition, fields: Record<string, s
290
325
  */
291
326
  declare function evaluateStage(rules: EvaluableRule[], fields: Record<string, string | null>, mappedFields: Set<string>): string | null;
292
327
  //#endregion
293
- export { HostOwnedCompanyField as C, isHostOwned as D, hostOwnedFieldMessage as E, rejectedCompanyFields as O, joinFansOut as S, SourcedRecord as T, compileProjectionJoins as _, matchesCondition as a, quoteIdent as b, columnMetaFor as c, primaryKeyColumns as d, validateProjection as f, compileProjectionIdentity as g, compileProjectionFrom as h, evaluateStage as i, rejectedContactFields as k, coversUniqueKey as l, PREVIEW_MAX_ROWS as m, ConditionOp as n, slugify as o, validateProjectionFilter as p, EvaluableRule as r, toObjectTypeSlug as s, Condition as t, hasRichMeta as u, compileProjectionPreview as v, HostOwnedContactField as w, fanOutJoins as x, compileProjectionSelect as y };
328
+ export { PerSeatValueSource as A, HostOwnedCompanyField as C, isHostOwned as D, hostOwnedFieldMessage as E, rejectedCompanyFields as O, joinFansOut as S, SourcedRecord as T, compileProjectionJoins as _, matchesCondition as a, quoteIdent as b, columnMetaFor as c, primaryKeyColumns as d, validateProjection as f, compileProjectionIdentity as g, compileProjectionFrom as h, evaluateStage as i, computeDealValue as j, rejectedContactFields as k, coversUniqueKey as l, PREVIEW_MAX_ROWS as m, ConditionOp as n, slugify as o, validateProjectionFilter as p, EvaluableRule as r, toObjectTypeSlug as s, Condition as t, hasRichMeta as u, compileProjectionPreview as v, HostOwnedContactField as w, fanOutJoins as x, compileProjectionSelect as y };
package/internal.cjs CHANGED
@@ -3,7 +3,7 @@ const require_projection = require("./projection-BELgANG2.cjs");
3
3
  const require_entity_config = require("./entity-config-BI4RYNKL.cjs");
4
4
  const require_mappings_config = require("./mappings-config-BCsRLohT.cjs");
5
5
  const require_auth_adapter = require("./auth-adapter-CiEXcweZ.cjs");
6
- const require_internal = require("./internal-CRIgf9jS.cjs");
6
+ const require_internal = require("./internal-BxtvxF7Z.cjs");
7
7
  const require_mapping_form = require("./mapping-form-BpfON_ME.cjs");
8
8
  const require_projection_sql = require("./projection-sql-DuCtFE9t.cjs");
9
9
  const require_view_compiler = require("./view-compiler-xiwm5iar.cjs");
@@ -30,6 +30,7 @@ exports.compileProjectionIdentity = require_projection_sql.compileProjectionIden
30
30
  exports.compileProjectionJoins = require_projection_sql.compileProjectionJoins;
31
31
  exports.compileProjectionPreview = require_projection_sql.compileProjectionPreview;
32
32
  exports.compileProjectionSelect = require_projection_sql.compileProjectionSelect;
33
+ exports.computeDealValue = require_internal.computeDealValue;
33
34
  exports.coversUniqueKey = require_entity_config.coversUniqueKey;
34
35
  exports.defineClivlyConfig = require_entity_config.defineClivlyConfig;
35
36
  exports.entitiesConfigSchema = require_entity_config.entitiesConfigSchema;
package/internal.d.cts CHANGED
@@ -1,11 +1,11 @@
1
1
  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-ApnT5j3X.cjs";
2
- import { A as UpdateDealInput, C as Task, D as TaskStatus, E as TaskPriority, M as ValueInterval, N as isClosedStageType, O as UpdateCompanyInput, S as StageType, T as TaskFilters, _ as OPEN_STAGE_TYPE, a as Contact, b as PipelineStageConfig, c as CreateActivityInput, d as CreateDealInput, f as CreateTaskInput, g as Note, h as DealStage, i as CompanyFilters, j as UpdateTaskInput, k as UpdateContactInput, l as CreateCompanyInput, m as Deal, n as ActivityType, o as ContactFilters, p as CrmRole, r as Company, s as ContactStatus, t as Activity, u as CreateContactInput, v as PipelineConfig, w as TaskEntityType, x as RecordSource, y as PipelineKind } from "./types-D08UzDqe.cjs";
3
- import { a as authCustom, i as MembershipResolver, n as ClivlyUser, r as CrmMembership, t as ClivlyAuthAdapter } from "./auth-adapter-C3BQpc-q.cjs";
4
- import { t as CRMAdapter } from "./adapter-Bd5HjLYa.cjs";
2
+ import { A as UpdateCompanyInput, C as RecordSource, D as TaskFilters, E as TaskEntityType, F as isClosedStageType, M as UpdateDealInput, N as UpdateTaskInput, O as TaskPriority, P as ValueInterval, S as PipelineStageConfig, T as Task, _ as OPEN_STAGE_TYPE, a as Contact, b as PipelineConfig, c as CreateActivityInput, d as CreateDealInput, f as CreateTaskInput, g as Note, h as DealStage, i as CompanyFilters, j as UpdateContactInput, k as TaskStatus, l as CreateCompanyInput, m as Deal, n as ActivityType, o as ContactFilters, p as CrmRole, r as Company, s as ContactStatus, t as Activity, u as CreateContactInput, v as Page, w as StageType, x as PipelineKind, y as PageRequest } from "./types-B17TWEOL.cjs";
3
+ import { a as authCustom, i as MembershipResolver, n as ClivlyUser, r as CrmMembership, t as ClivlyAuthAdapter } from "./auth-adapter-Csk9KkvI.cjs";
4
+ import { t as CRMAdapter } from "./adapter-DTMeGGsl.cjs";
5
5
  import { i as relationshipViaSignature, n as buildFilterFromDiscriminator, r as buildRelationships, t as RelationshipCandidate } from "./mapping-form-XsLLCqW_.cjs";
6
6
  import { i as mappingsToEntitiesConfig, t as EntityMappingRow } from "./mappings-config-iJzbcUMp.cjs";
7
7
  import { a as compileEntityView, i as ExplainResult, n as CompiledView, o as compileEntityViews, r as DEFAULT_VIEW_PREFIX, s as explainEntitiesConfig, t as CompileOptions } from "./view-compiler-Cq8apvZ4.cjs";
8
8
  import { c as SyncResult, f as reconcile, l as SyncStore, n as MirrorRecord, o as SourceRow, p as runSync, r as PersistAction, s as SyncAction, t as EntitySyncResult } from "./sync-engine-V3_UutGv.cjs";
9
- import { C as HostOwnedCompanyField, D as isHostOwned, E as hostOwnedFieldMessage, O as rejectedCompanyFields, S as joinFansOut, T as SourcedRecord, _ 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, k as rejectedContactFields, 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, w as HostOwnedContactField, x as fanOutJoins, y as compileProjectionSelect } from "./internal-D9kqkhPs.cjs";
9
+ import { A as PerSeatValueSource, C as HostOwnedCompanyField, D as isHostOwned, E as hostOwnedFieldMessage, O as rejectedCompanyFields, S as joinFansOut, T as SourcedRecord, _ 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, j as computeDealValue, k as rejectedContactFields, 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, w as HostOwnedContactField, x as fanOutJoins, y as compileProjectionSelect } from "./internal-vH5Rlg6Q.cjs";
10
10
  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-BA4c0RbD.cjs";
11
- export { type Activity, type ActivityType, BASE_REF, CANONICAL_FIELDS, type CRMAdapter, CRM_CONCEPTS, type ClivlyAuthAdapter, ClivlyConfigError, type ClivlyEntitiesConfig, type ClivlyEntityConfig, type ClivlyUser, type Company, type 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, 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 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, columnMetaFor, compileEntityView, compileEntityViews, compileProjectionFrom, compileProjectionIdentity, compileProjectionJoins, compileProjectionPreview, compileProjectionSelect, coversUniqueKey, defineClivlyConfig, entitiesConfigSchema, evaluateStage, explainEntitiesConfig, fanOutJoins, filterSchema, hasRichMeta, hostOwnedFieldMessage, identityRefs, isClosedStageType, isHostOwned, joinFansOut, mappingsToEntitiesConfig, matchesCondition, missingRequiredFields, primaryKeyColumns, projectionFields, projectionSchema, quoteIdent, reconcile, rejectedCompanyFields, rejectedContactFields, relationshipSchema, relationshipViaSignature, relationshipsSchema, requiredFieldsFor, runSync, slugify, toObjectTypeSlug, validateEntitiesConfig, validateProjection, validateProjectionFilter };
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 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, PREVIEW_MAX_ROWS, 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, columnMetaFor, compileEntityView, compileEntityViews, compileProjectionFrom, compileProjectionIdentity, compileProjectionJoins, compileProjectionPreview, compileProjectionSelect, computeDealValue, coversUniqueKey, defineClivlyConfig, entitiesConfigSchema, evaluateStage, explainEntitiesConfig, fanOutJoins, filterSchema, hasRichMeta, hostOwnedFieldMessage, identityRefs, isClosedStageType, isHostOwned, joinFansOut, mappingsToEntitiesConfig, matchesCondition, missingRequiredFields, primaryKeyColumns, projectionFields, projectionSchema, quoteIdent, reconcile, rejectedCompanyFields, rejectedContactFields, relationshipSchema, relationshipViaSignature, relationshipsSchema, requiredFieldsFor, runSync, slugify, toObjectTypeSlug, validateEntitiesConfig, validateProjection, validateProjectionFilter };
package/internal.d.mts CHANGED
@@ -1,11 +1,11 @@
1
1
  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-CKcj4-M_.mjs";
2
- import { A as UpdateDealInput, C as Task, D as TaskStatus, E as TaskPriority, M as ValueInterval, N as isClosedStageType, O as UpdateCompanyInput, S as StageType, T as TaskFilters, _ as OPEN_STAGE_TYPE, a as Contact, b as PipelineStageConfig, c as CreateActivityInput, d as CreateDealInput, f as CreateTaskInput, g as Note, h as DealStage, i as CompanyFilters, j as UpdateTaskInput, k as UpdateContactInput, l as CreateCompanyInput, m as Deal, n as ActivityType, o as ContactFilters, p as CrmRole, r as Company, s as ContactStatus, t as Activity, u as CreateContactInput, v as PipelineConfig, w as TaskEntityType, x as RecordSource, y as PipelineKind } from "./types-D08UzDqe.mjs";
3
- import { a as authCustom, i as MembershipResolver, n as ClivlyUser, r as CrmMembership, t as ClivlyAuthAdapter } from "./auth-adapter-D54ajbl7.mjs";
4
- import { t as CRMAdapter } from "./adapter-BWrOtOw5.mjs";
2
+ import { A as UpdateCompanyInput, C as RecordSource, D as TaskFilters, E as TaskEntityType, F as isClosedStageType, M as UpdateDealInput, N as UpdateTaskInput, O as TaskPriority, P as ValueInterval, S as PipelineStageConfig, T as Task, _ as OPEN_STAGE_TYPE, a as Contact, b as PipelineConfig, c as CreateActivityInput, d as CreateDealInput, f as CreateTaskInput, g as Note, h as DealStage, i as CompanyFilters, j as UpdateContactInput, k as TaskStatus, l as CreateCompanyInput, m as Deal, n as ActivityType, o as ContactFilters, p as CrmRole, r as Company, s as ContactStatus, t as Activity, u as CreateContactInput, v as Page, w as StageType, x as PipelineKind, y as PageRequest } from "./types-B17TWEOL.mjs";
3
+ import { a as authCustom, i as MembershipResolver, n as ClivlyUser, r as CrmMembership, t as ClivlyAuthAdapter } from "./auth-adapter-C6rDx3XH.mjs";
4
+ import { t as CRMAdapter } from "./adapter-DhPBRNpi.mjs";
5
5
  import { i as relationshipViaSignature, n as buildFilterFromDiscriminator, r as buildRelationships, t as RelationshipCandidate } from "./mapping-form-Btn-7gzv.mjs";
6
6
  import { i as mappingsToEntitiesConfig, t as EntityMappingRow } from "./mappings-config-D6_oCi2Q.mjs";
7
7
  import { a as compileEntityView, i as ExplainResult, n as CompiledView, o as compileEntityViews, r as DEFAULT_VIEW_PREFIX, s as explainEntitiesConfig, t as CompileOptions } from "./view-compiler-CwKVoK1w.mjs";
8
8
  import { c as SyncResult, f as reconcile, l as SyncStore, n as MirrorRecord, o as SourceRow, p as runSync, r as PersistAction, s as SyncAction, t as EntitySyncResult } from "./sync-engine--M9EaONC.mjs";
9
- import { C as HostOwnedCompanyField, D as isHostOwned, E as hostOwnedFieldMessage, O as rejectedCompanyFields, S as joinFansOut, T as SourcedRecord, _ 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, k as rejectedContactFields, 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, w as HostOwnedContactField, x as fanOutJoins, y as compileProjectionSelect } from "./internal-Bjpq7S2G.mjs";
9
+ import { A as PerSeatValueSource, C as HostOwnedCompanyField, D as isHostOwned, E as hostOwnedFieldMessage, O as rejectedCompanyFields, S as joinFansOut, T as SourcedRecord, _ 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, j as computeDealValue, k as rejectedContactFields, 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, w as HostOwnedContactField, x as fanOutJoins, y as compileProjectionSelect } from "./internal-Cmx7Zevf.mjs";
10
10
  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-BA4c0RbD.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 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, 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 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, columnMetaFor, compileEntityView, compileEntityViews, compileProjectionFrom, compileProjectionIdentity, compileProjectionJoins, compileProjectionPreview, compileProjectionSelect, coversUniqueKey, defineClivlyConfig, entitiesConfigSchema, evaluateStage, explainEntitiesConfig, fanOutJoins, filterSchema, hasRichMeta, hostOwnedFieldMessage, identityRefs, isClosedStageType, isHostOwned, joinFansOut, mappingsToEntitiesConfig, matchesCondition, missingRequiredFields, primaryKeyColumns, projectionFields, projectionSchema, quoteIdent, reconcile, rejectedCompanyFields, rejectedContactFields, relationshipSchema, relationshipViaSignature, relationshipsSchema, requiredFieldsFor, runSync, slugify, toObjectTypeSlug, validateEntitiesConfig, validateProjection, validateProjectionFilter };
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 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, PREVIEW_MAX_ROWS, 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, columnMetaFor, compileEntityView, compileEntityViews, compileProjectionFrom, compileProjectionIdentity, compileProjectionJoins, compileProjectionPreview, compileProjectionSelect, computeDealValue, coversUniqueKey, defineClivlyConfig, entitiesConfigSchema, evaluateStage, explainEntitiesConfig, fanOutJoins, filterSchema, hasRichMeta, hostOwnedFieldMessage, identityRefs, isClosedStageType, isHostOwned, joinFansOut, mappingsToEntitiesConfig, matchesCondition, missingRequiredFields, primaryKeyColumns, projectionFields, projectionSchema, quoteIdent, reconcile, rejectedCompanyFields, rejectedContactFields, relationshipSchema, relationshipViaSignature, relationshipsSchema, requiredFieldsFor, runSync, slugify, toObjectTypeSlug, validateEntitiesConfig, validateProjection, validateProjectionFilter };
package/internal.mjs CHANGED
@@ -2,10 +2,10 @@ import { i as projectionSchema, n as PROJECTION_KEY_PATTERN, r as identityRefs,
2
2
  import { C as hasRichMeta, S as coversUniqueKey, _ as validateProjection, a as MATERIALIZING_CONCEPTS, b as joinFansOut, c as defineClivlyConfig, d as missingRequiredFields, f as projectionFields, g as validateEntitiesConfig, h as requiredFieldsFor, i as ClivlyConfigError, l as entitiesConfigSchema, m as relationshipsSchema, n as CRM_CONCEPTS, o as REQUIRED_FIELDS, p as relationshipSchema, t as CANONICAL_FIELDS, u as filterSchema, v as validateProjectionFilter, w as primaryKeyColumns, x as columnMetaFor, y as fanOutJoins } from "./entity-config-Ccfb2IL9.mjs";
3
3
  import { n as mappingsToEntitiesConfig } from "./mappings-config-CwQNQ6bA.mjs";
4
4
  import { t as authCustom } from "./auth-adapter-gfVDxf3d.mjs";
5
- import { a as hostOwnedFieldMessage, c as rejectedContactFields, i as toObjectTypeSlug, n as matchesCondition, o as isHostOwned, r as slugify, s as rejectedCompanyFields, t as evaluateStage } from "./internal-v6P9MZY1.mjs";
5
+ import { a as hostOwnedFieldMessage, c as rejectedContactFields, i as toObjectTypeSlug, l as computeDealValue, n as matchesCondition, o as isHostOwned, r as slugify, s as rejectedCompanyFields, t as evaluateStage } from "./internal-u0Bks5Gr.mjs";
6
6
  import { n as buildRelationships, r as relationshipViaSignature, t as buildFilterFromDiscriminator } from "./mapping-form-DigkuvFc.mjs";
7
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-DweUaWRc.mjs";
8
8
  import { i as explainEntitiesConfig, n as compileEntityView, r as compileEntityViews, t as DEFAULT_VIEW_PREFIX } from "./view-compiler-C-6RydKK.mjs";
9
9
  import { i as runSync, r as reconcile } from "./sync-engine-Df2MCs_n.mjs";
10
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, REQUIRED_FIELDS, authCustom, buildFilterFromDiscriminator, buildRelationships, columnMetaFor, compileEntityView, compileEntityViews, compileProjectionFrom, compileProjectionIdentity, compileProjectionJoins, compileProjectionPreview, compileProjectionSelect, coversUniqueKey, defineClivlyConfig, entitiesConfigSchema, evaluateStage, explainEntitiesConfig, fanOutJoins, filterSchema, hasRichMeta, hostOwnedFieldMessage, identityRefs, isClosedStageType, isHostOwned, joinFansOut, mappingsToEntitiesConfig, matchesCondition, missingRequiredFields, primaryKeyColumns, projectionFields, projectionSchema, quoteIdent, reconcile, rejectedCompanyFields, rejectedContactFields, relationshipSchema, relationshipViaSignature, relationshipsSchema, requiredFieldsFor, runSync, slugify, toObjectTypeSlug, validateEntitiesConfig, validateProjection, validateProjectionFilter };
11
+ export { BASE_REF, CANONICAL_FIELDS, CRM_CONCEPTS, ClivlyConfigError, DEFAULT_VIEW_PREFIX, MATERIALIZING_CONCEPTS, OPEN_STAGE_TYPE, PREVIEW_MAX_ROWS, PROJECTION_KEY_PATTERN, REQUIRED_FIELDS, authCustom, buildFilterFromDiscriminator, buildRelationships, columnMetaFor, compileEntityView, compileEntityViews, compileProjectionFrom, compileProjectionIdentity, compileProjectionJoins, compileProjectionPreview, compileProjectionSelect, computeDealValue, coversUniqueKey, defineClivlyConfig, entitiesConfigSchema, evaluateStage, explainEntitiesConfig, fanOutJoins, filterSchema, hasRichMeta, hostOwnedFieldMessage, identityRefs, isClosedStageType, isHostOwned, joinFansOut, mappingsToEntitiesConfig, matchesCondition, missingRequiredFields, primaryKeyColumns, projectionFields, projectionSchema, quoteIdent, reconcile, rejectedCompanyFields, rejectedContactFields, relationshipSchema, relationshipViaSignature, relationshipsSchema, requiredFieldsFor, runSync, slugify, toObjectTypeSlug, validateEntitiesConfig, validateProjection, validateProjectionFilter };
@@ -164,6 +164,23 @@ interface ClivlySDKConfig {
164
164
  */
165
165
  intervalMs?: number;
166
166
  batchSize?: number;
167
+ /**
168
+ * Opt into `pushOne()`/`insertAndPush()` pushing a single changed row to
169
+ * Clivly immediately, instead of waiting for the next delta sync. Off by
170
+ * default: turning it on changes a write's async failure surface (a push
171
+ * can fail independently of the write that triggered it, swallowed and
172
+ * left for the next delta sync to catch), which an existing install
173
+ * upgrading to a newer `clivly` should opt into deliberately rather than
174
+ * inherit silently. Requires a real scheduled delta sync running
175
+ * underneath as the safety net for anything the instant push misses (a
176
+ * failed push, a raw SQL write, a bulk import) — see
177
+ * docs/reviews/2026-09-19-near-real-time-sync-plan.md.
178
+ *
179
+ * Can also be disabled at runtime without a redeploy via the
180
+ * `CLIVLY_INSTANT_PUSH_DISABLED=true` environment variable — the fast
181
+ * rollback switch if this misbehaves in production.
182
+ */
183
+ instant?: boolean;
167
184
  };
168
185
  /**
169
186
  * The remote sync trigger: how Clivly Cloud asks this app to run a sync.
@@ -477,6 +494,31 @@ interface ClivlySDK {
477
494
  * own state.
478
495
  */
479
496
  ping(): Promise<ClivlyConnectResult>;
497
+ /**
498
+ * Push one row to Clivly immediately, instead of waiting for the next delta
499
+ * sync — the "instant" half of near-real-time sync (see
500
+ * docs/reviews/2026-09-19-near-real-time-sync-plan.md). No-ops unless
501
+ * `sync.instant` is set and `CLIVLY_INSTANT_PUSH_DISABLED` is unset.
502
+ *
503
+ * `entityKey` is a key of `config.entities.entities` (the same key
504
+ * `clivly.config.ts` declares the entity under), not a table name — an
505
+ * unresolvable key logs a warning and returns without throwing, the same
506
+ * fail-safe as every other call site here: a config mismatch never syncs
507
+ * the wrong thing, it just doesn't sync this row instantly (the safety-net
508
+ * delta sync still will).
509
+ *
510
+ * `row` must be keyed by the source table's real database column names
511
+ * (`full_name`, not `fullName`) — the same contract `fetchPage` rows
512
+ * satisfy. `insertAndPush` (from `clivly/drizzle`) performs this
513
+ * translation for you from a Drizzle table; calling `pushOne` directly with
514
+ * a raw Drizzle `.returning()` row will silently push empty fields.
515
+ *
516
+ * Never throws and never advances the delta cursor. Fire-and-forget by
517
+ * design: on Cloudflare Workers and similar runtimes, wrap the call in
518
+ * `ctx.waitUntil(...)` so it survives past the response, since nothing
519
+ * here blocks or awaits the caller's own write.
520
+ */
521
+ pushOne(entityKey: string, row: Record<string, unknown>): Promise<void>;
480
522
  /**
481
523
  * One-shot heartbeat + a single sync, with no keep-alive timers. The correct
482
524
  * entry point on serverless/edge (Workers, Vercel, Lambda), where `start()`'s
@@ -164,6 +164,23 @@ interface ClivlySDKConfig {
164
164
  */
165
165
  intervalMs?: number;
166
166
  batchSize?: number;
167
+ /**
168
+ * Opt into `pushOne()`/`insertAndPush()` pushing a single changed row to
169
+ * Clivly immediately, instead of waiting for the next delta sync. Off by
170
+ * default: turning it on changes a write's async failure surface (a push
171
+ * can fail independently of the write that triggered it, swallowed and
172
+ * left for the next delta sync to catch), which an existing install
173
+ * upgrading to a newer `clivly` should opt into deliberately rather than
174
+ * inherit silently. Requires a real scheduled delta sync running
175
+ * underneath as the safety net for anything the instant push misses (a
176
+ * failed push, a raw SQL write, a bulk import) — see
177
+ * docs/reviews/2026-09-19-near-real-time-sync-plan.md.
178
+ *
179
+ * Can also be disabled at runtime without a redeploy via the
180
+ * `CLIVLY_INSTANT_PUSH_DISABLED=true` environment variable — the fast
181
+ * rollback switch if this misbehaves in production.
182
+ */
183
+ instant?: boolean;
167
184
  };
168
185
  /**
169
186
  * The remote sync trigger: how Clivly Cloud asks this app to run a sync.
@@ -477,6 +494,31 @@ interface ClivlySDK {
477
494
  * own state.
478
495
  */
479
496
  ping(): Promise<ClivlyConnectResult>;
497
+ /**
498
+ * Push one row to Clivly immediately, instead of waiting for the next delta
499
+ * sync — the "instant" half of near-real-time sync (see
500
+ * docs/reviews/2026-09-19-near-real-time-sync-plan.md). No-ops unless
501
+ * `sync.instant` is set and `CLIVLY_INSTANT_PUSH_DISABLED` is unset.
502
+ *
503
+ * `entityKey` is a key of `config.entities.entities` (the same key
504
+ * `clivly.config.ts` declares the entity under), not a table name — an
505
+ * unresolvable key logs a warning and returns without throwing, the same
506
+ * fail-safe as every other call site here: a config mismatch never syncs
507
+ * the wrong thing, it just doesn't sync this row instantly (the safety-net
508
+ * delta sync still will).
509
+ *
510
+ * `row` must be keyed by the source table's real database column names
511
+ * (`full_name`, not `fullName`) — the same contract `fetchPage` rows
512
+ * satisfy. `insertAndPush` (from `clivly/drizzle`) performs this
513
+ * translation for you from a Drizzle table; calling `pushOne` directly with
514
+ * a raw Drizzle `.returning()` row will silently push empty fields.
515
+ *
516
+ * Never throws and never advances the delta cursor. Fire-and-forget by
517
+ * design: on Cloudflare Workers and similar runtimes, wrap the call in
518
+ * `ctx.waitUntil(...)` so it survives past the response, since nothing
519
+ * here blocks or awaits the caller's own write.
520
+ */
521
+ pushOne(entityKey: string, row: Record<string, unknown>): Promise<void>;
480
522
  /**
481
523
  * One-shot heartbeat + a single sync, with no keep-alive timers. The correct
482
524
  * entry point on serverless/edge (Workers, Vercel, Lambda), where `start()`'s
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clivly",
3
- "version": "0.11.0",
3
+ "version": "0.13.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Clivly CLI — scaffold a CRM into your app (clivly init).",
@@ -699,6 +699,20 @@ function detectHostEnvironment(env, configured) {
699
699
  return fromNodeEnv(env.NODE_ENV?.trim());
700
700
  }
701
701
  //#endregion
702
+ //#region ../sdk/src/instant-push-support.ts
703
+ /**
704
+ * The fast rollback switch for instant push (see
705
+ * docs/reviews/2026-09-19-near-real-time-sync-plan.md, question 5).
706
+ *
707
+ * A host-side env var, not a Clivly-Cloud-side toggle: it must keep working
708
+ * even when Clivly Cloud is the thing misbehaving (e.g. its ingest endpoint
709
+ * is what instant push is flooding), and it must take effect without a
710
+ * redeploy — just an env var change and the next cold start.
711
+ */
712
+ function isInstantPushDisabled(env) {
713
+ return env.CLIVLY_INSTANT_PUSH_DISABLED === "true";
714
+ }
715
+ //#endregion
702
716
  //#region ../sdk/src/presence-machine.ts
703
717
  const PRESENCE_BACKOFF_BASE_MS = 1e3;
704
718
  const PRESENCE_BACKOFF_MAX_MS = 3e4;
@@ -2090,6 +2104,28 @@ function createClivlySDK(config) {
2090
2104
  lastPushFailure = null;
2091
2105
  if (!await syncOne(resolved.source, resolved.path, "delta", resolved.objectType, runId, SAMPLE_BATCH_SIZE, SAMPLE_BATCH_SIZE, false)) throw pushFailureError(describePushFailure([resolved.source.entity]));
2092
2106
  };
2107
+ const pushOne = async (entityKey, row) => {
2108
+ if (config.sync?.instant !== true) return;
2109
+ if (isInstantPushDisabled(config.env ?? process.env)) return;
2110
+ const resolved = resolveEntitySource(config, entityKey);
2111
+ if (!resolved) {
2112
+ console.warn(`Clivly instant push: no source is configured for entity "${entityKey}" — this row was not pushed. It will still sync on the next delta run once \`entities\` declares it.`);
2113
+ return;
2114
+ }
2115
+ const path = CONCEPT_PATHS[resolved.expectedKey];
2116
+ if (!path) return;
2117
+ const push = createPush();
2118
+ try {
2119
+ if (!await push(path, {
2120
+ source: pushSourceOf(resolved.source),
2121
+ rows: [row],
2122
+ mode: "delta",
2123
+ ...resolved.expectedKey === "custom" ? { objectType: resolved.source.objectType } : {}
2124
+ })) console.warn(`Clivly instant push failed for "${entityKey}". This row will still sync on the next delta run.`);
2125
+ } catch (error) {
2126
+ console.warn(`Clivly instant push failed for "${entityKey}": ${error instanceof Error ? error.message : String(error)}. This row will still sync on the next delta run.`);
2127
+ }
2128
+ };
2093
2129
  const describeSyncTrigger = () => ({
2094
2130
  configured: config.syncTrigger?.url,
2095
2131
  resolved: resolveTriggerUrl({
@@ -2445,7 +2481,8 @@ function createClivlySDK(config) {
2445
2481
  runScheduled,
2446
2482
  createClivlyHandler,
2447
2483
  sync: runSync,
2448
- createAuthVerifyHandler
2484
+ createAuthVerifyHandler,
2485
+ pushOne
2449
2486
  };
2450
2487
  }
2451
2488
  //#endregion
@@ -699,6 +699,20 @@ function detectHostEnvironment(env, configured) {
699
699
  return fromNodeEnv(env.NODE_ENV?.trim());
700
700
  }
701
701
  //#endregion
702
+ //#region ../sdk/src/instant-push-support.ts
703
+ /**
704
+ * The fast rollback switch for instant push (see
705
+ * docs/reviews/2026-09-19-near-real-time-sync-plan.md, question 5).
706
+ *
707
+ * A host-side env var, not a Clivly-Cloud-side toggle: it must keep working
708
+ * even when Clivly Cloud is the thing misbehaving (e.g. its ingest endpoint
709
+ * is what instant push is flooding), and it must take effect without a
710
+ * redeploy — just an env var change and the next cold start.
711
+ */
712
+ function isInstantPushDisabled(env) {
713
+ return env.CLIVLY_INSTANT_PUSH_DISABLED === "true";
714
+ }
715
+ //#endregion
702
716
  //#region ../sdk/src/presence-machine.ts
703
717
  const PRESENCE_BACKOFF_BASE_MS = 1e3;
704
718
  const PRESENCE_BACKOFF_MAX_MS = 3e4;
@@ -2090,6 +2104,28 @@ function createClivlySDK(config) {
2090
2104
  lastPushFailure = null;
2091
2105
  if (!await syncOne(resolved.source, resolved.path, "delta", resolved.objectType, runId, SAMPLE_BATCH_SIZE, SAMPLE_BATCH_SIZE, false)) throw pushFailureError(describePushFailure([resolved.source.entity]));
2092
2106
  };
2107
+ const pushOne = async (entityKey, row) => {
2108
+ if (config.sync?.instant !== true) return;
2109
+ if (isInstantPushDisabled(config.env ?? process.env)) return;
2110
+ const resolved = resolveEntitySource(config, entityKey);
2111
+ if (!resolved) {
2112
+ console.warn(`Clivly instant push: no source is configured for entity "${entityKey}" — this row was not pushed. It will still sync on the next delta run once \`entities\` declares it.`);
2113
+ return;
2114
+ }
2115
+ const path = CONCEPT_PATHS[resolved.expectedKey];
2116
+ if (!path) return;
2117
+ const push = createPush();
2118
+ try {
2119
+ if (!await push(path, {
2120
+ source: pushSourceOf(resolved.source),
2121
+ rows: [row],
2122
+ mode: "delta",
2123
+ ...resolved.expectedKey === "custom" ? { objectType: resolved.source.objectType } : {}
2124
+ })) console.warn(`Clivly instant push failed for "${entityKey}". This row will still sync on the next delta run.`);
2125
+ } catch (error) {
2126
+ console.warn(`Clivly instant push failed for "${entityKey}": ${error instanceof Error ? error.message : String(error)}. This row will still sync on the next delta run.`);
2127
+ }
2128
+ };
2093
2129
  const describeSyncTrigger = () => ({
2094
2130
  configured: config.syncTrigger?.url,
2095
2131
  resolved: resolveTriggerUrl({
@@ -2445,7 +2481,8 @@ function createClivlySDK(config) {
2445
2481
  runScheduled,
2446
2482
  createClivlyHandler,
2447
2483
  sync: runSync,
2448
- createAuthVerifyHandler
2484
+ createAuthVerifyHandler,
2485
+ pushOne
2449
2486
  };
2450
2487
  }
2451
2488
  //#endregion
package/sdk.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_entity_config = require("./entity-config-BI4RYNKL.cjs");
3
- const require_sdk = require("./sdk-BvGSxBQc.cjs");
3
+ const require_sdk = require("./sdk-DKfKhJD_.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
1
  import { C as customObjectDeclarations, M as validateEntitiesConfig, a as ClivlyEntitiesConfig, f as CustomObjectDeclaration, l as ConfigValidationError, m as DiscoveredSchemaTable, u as ConfigValidationResult, w as defineClivlyConfig } from "./entity-config-ApnT5j3X.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-C5RLl74M.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-H7yWc0JV.cjs";
3
3
  //#region ../sdk/src/trigger-url.d.ts
4
4
  export declare function isPlaceholderUrl(value: string): boolean;
5
5
  //#endregion