clivly 0.17.1 → 0.18.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 (44) hide show
  1. package/README.md +15 -6
  2. package/{adapter-C63F9VZL.d.mts → adapter-BXykDFyG.d.mts} +1 -1
  3. package/{adapter-OO5g17qF.d.cts → adapter-BiUN_I3u.d.cts} +1 -1
  4. package/{auth-adapter-COMP0Fud.d.cts → auth-adapter-BNvri2gX.d.mts} +1 -1
  5. package/{auth-adapter-ZlhllVpm.d.mts → auth-adapter-D2MUT1Hk.d.cts} +1 -1
  6. package/auth-better-auth.d.cts +1 -1
  7. package/auth-better-auth.d.mts +1 -1
  8. package/auth-clerk.d.cts +1 -1
  9. package/auth-clerk.d.mts +1 -1
  10. package/auth-workos.d.cts +1 -1
  11. package/auth-workos.d.mts +1 -1
  12. package/core-adapter.d.cts +1 -1
  13. package/core-adapter.d.mts +1 -1
  14. package/core-auth-adapter.d.cts +1 -1
  15. package/core-auth-adapter.d.mts +1 -1
  16. package/core-types.d.cts +2 -2
  17. package/core-types.d.mts +2 -2
  18. package/core.d.cts +4 -4
  19. package/core.d.mts +4 -4
  20. package/drizzle.d.cts +1 -1
  21. package/drizzle.d.mts +1 -1
  22. package/index.cjs +54 -6
  23. package/index.mjs +54 -6
  24. package/internal-adapter.d.cts +1 -1
  25. package/internal-adapter.d.mts +1 -1
  26. package/internal-auth-adapter.d.cts +1 -1
  27. package/internal-auth-adapter.d.mts +1 -1
  28. package/internal-types.d.cts +2 -2
  29. package/internal-types.d.mts +2 -2
  30. package/internal.d.cts +4 -4
  31. package/internal.d.mts +4 -4
  32. package/{namespace-probe-Dt_HXcI-.d.mts → namespace-probe-BAXprXQh.d.mts} +18 -3
  33. package/{namespace-probe-BHk3NcyI.d.cts → namespace-probe-qgjiudCo.d.cts} +18 -3
  34. package/package.json +1 -1
  35. package/{sdk-BZSTXPyK.cjs → sdk-D53fH4uu.cjs} +10 -8
  36. package/{sdk-KzHpSf7F.mjs → sdk-D5J7kRQm.mjs} +10 -8
  37. package/sdk.cjs +1 -1
  38. package/sdk.d.cts +1 -1
  39. package/sdk.d.mts +1 -1
  40. package/sdk.mjs +1 -1
  41. package/{types-CQ2DgEH7.d.cts → types-C08UluBS.d.cts} +22 -1
  42. package/{types-C9_2vW5a.d.mts → types-CZsSYbeC.d.mts} +22 -1
  43. package/vite.d.cts +1 -1
  44. package/vite.d.mts +1 -1
package/README.md CHANGED
@@ -286,7 +286,7 @@ It answers two questions under two headings:
286
286
  - **This project** — the local ladder, run here on your machine: credential →
287
287
  Clivly reachable → `clivly.config` loads → `clivly.config` is edge-safe →
288
288
  sync cursor persists → boot hook wired → setup checks → dashboard-authored
289
- objects → sync trigger URL.
289
+ objects → sync trigger URL → sync trigger secret.
290
290
 
291
291
  ```text
292
292
  Clivly status
@@ -299,8 +299,8 @@ Workspace
299
299
  🔒 Let Clivly start a sync
300
300
 
301
301
  This project
302
- ✅ Step 1 of 9 · API key present
303
- ✅ Step 2 of 9 · Clivly reachable — Acme
302
+ ✅ Step 1 of 10 · API key present
303
+ ✅ Step 2 of 10 · Clivly reachable — Acme
304
304
  ...
305
305
  ```
306
306
 
@@ -334,6 +334,14 @@ reported as unusable. Fresh `init`/`login` env files leave the variable empty an
334
334
  show the URL shape only in a comment, so the setup check agrees with the SDK's
335
335
  platform discovery instead of treating documentation as configuration.
336
336
 
337
+ **Sync trigger secret** is new in `0.18.0`, and it **fails** when
338
+ `CLIVLY_SYNC_TRIGGER_SECRET` is not set. From 0.18.0 a route with no secret
339
+ refuses every request with `403 signature_required`, Clivly's "Run sync"
340
+ included, so a missing secret is a broken setup, not a risk. It warns instead
341
+ when `syncTrigger.allowUnsigned` is on, and is skipped against a host app whose
342
+ installed `clivly` is older than 0.18. `init` and `login` always name both
343
+ credentials together, so a deploy does not copy the key without the secret.
344
+
337
345
  If the Workspace section reads
338
346
  `⚠️ This Clivly server does not report setup progress`, or names a rejected key
339
347
  or an unreachable host, that means the question could not be asked — not that
@@ -452,7 +460,8 @@ logs nothing, and the dashboard reports "Host app rejected the preview (500)"
452
460
  against an app that never saw the request.
453
461
 
454
462
  `clivly dev` checks for this before claiming the tunnel works: it sends an
455
- unsigned request to the trigger path, which a Clivly route refuses with `401`.
463
+ unsigned request to the trigger path, which a Clivly route refuses with `401`
464
+ (or `403 signature_required` when the app has no signing secret yet).
456
465
  Anything else means the tunnel reaches something that is not your app, and the
457
466
  command warns instead of confirming:
458
467
 
@@ -503,8 +512,8 @@ work, and are kept because output and docs have recommended them — but prefer
503
512
  | Alias | Equivalent scope |
504
513
  | --- | --- |
505
514
  | `clivly ping` | Credential + reachability |
506
- | `clivly connect` | The above, plus config and trigger URL |
507
- | `clivly doctor` | Config, edge safety, boot hook and setup checks |
515
+ | `clivly connect` | The above, plus config, trigger URL and trigger secret |
516
+ | `clivly doctor` | Config, edge safety, boot hook, setup checks and trigger secret |
508
517
 
509
518
  Each prints a deprecation notice, then the steps it covers, renumbered to its own
510
519
  scope:
@@ -1,4 +1,4 @@
1
- import { A as UpdateCompanyInput, C as RecordSource, D as TaskFilters, M as UpdateDealInput, N as UpdateTaskInput, T as Task, a as Contact, c as CreateActivityInput, d as CreateDealInput, f as CreateTaskInput, i as CompanyFilters, j as UpdateContactInput, l as CreateCompanyInput, m as Deal, o as ContactFilters, r as Company, t as Activity, u as CreateContactInput, v as Page, y as PageRequest } from "./types-C9_2vW5a.mjs";
1
+ import { E as Task, M as UpdateContactInput, N as UpdateDealInput, O as TaskFilters, P as UpdateTaskInput, a as Contact, b as PageRequest, d as CreateContactInput, f as CreateDealInput, h as Deal, i as CompanyFilters, j as UpdateCompanyInput, l as CreateActivityInput, o as ContactFilters, p as CreateTaskInput, r as Company, t as Activity, u as CreateCompanyInput, w as RecordSource, y as Page } from "./types-CZsSYbeC.mjs";
2
2
  /**
3
3
  * The contract every ORM implementation fulfils. `packages/drizzle` is the first
4
4
  * implementation; Prisma/Kysely/TypeORM can follow without changes to consumers.
@@ -1,4 +1,4 @@
1
- import { A as UpdateCompanyInput, C as RecordSource, D as TaskFilters, M as UpdateDealInput, N as UpdateTaskInput, T as Task, a as Contact, c as CreateActivityInput, d as CreateDealInput, f as CreateTaskInput, i as CompanyFilters, j as UpdateContactInput, l as CreateCompanyInput, m as Deal, o as ContactFilters, r as Company, t as Activity, u as CreateContactInput, v as Page, y as PageRequest } from "./types-CQ2DgEH7.cjs";
1
+ import { E as Task, M as UpdateContactInput, N as UpdateDealInput, O as TaskFilters, P as UpdateTaskInput, a as Contact, b as PageRequest, d as CreateContactInput, f as CreateDealInput, h as Deal, i as CompanyFilters, j as UpdateCompanyInput, l as CreateActivityInput, o as ContactFilters, p as CreateTaskInput, r as Company, t as Activity, u as CreateCompanyInput, w as RecordSource, y as Page } from "./types-C08UluBS.cjs";
2
2
  /**
3
3
  * The contract every ORM implementation fulfils. `packages/drizzle` is the first
4
4
  * implementation; Prisma/Kysely/TypeORM can follow without changes to consumers.
@@ -1,4 +1,4 @@
1
- import { p as CrmRole } from "./types-CQ2DgEH7.cjs";
1
+ import { m as CrmRole } from "./types-CZsSYbeC.mjs";
2
2
  interface ClivlyUser {
3
3
  email: string;
4
4
  id: string;
@@ -1,4 +1,4 @@
1
- import { p as CrmRole } from "./types-C9_2vW5a.mjs";
1
+ import { m as CrmRole } from "./types-C08UluBS.cjs";
2
2
  interface ClivlyUser {
3
3
  email: string;
4
4
  id: string;
@@ -1,4 +1,4 @@
1
- import { n as ClivlyUser, t as ClivlyAuthAdapter } from "./auth-adapter-COMP0Fud.cjs";
1
+ import { n as ClivlyUser, t as ClivlyAuthAdapter } from "./auth-adapter-D2MUT1Hk.cjs";
2
2
  interface BetterAuthLikeUser {
3
3
  email?: string | null;
4
4
  id: string;
@@ -1,4 +1,4 @@
1
- import { n as ClivlyUser, t as ClivlyAuthAdapter } from "./auth-adapter-ZlhllVpm.mjs";
1
+ import { n as ClivlyUser, t as ClivlyAuthAdapter } from "./auth-adapter-BNvri2gX.mjs";
2
2
  interface BetterAuthLikeUser {
3
3
  email?: string | null;
4
4
  id: string;
package/auth-clerk.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { n as ClivlyUser, t as ClivlyAuthAdapter } from "./auth-adapter-COMP0Fud.cjs";
1
+ import { n as ClivlyUser, t as ClivlyAuthAdapter } from "./auth-adapter-D2MUT1Hk.cjs";
2
2
  interface ClerkLikeUser {
3
3
  emailAddresses?: Array<{
4
4
  id: string;
package/auth-clerk.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { n as ClivlyUser, t as ClivlyAuthAdapter } from "./auth-adapter-ZlhllVpm.mjs";
1
+ import { n as ClivlyUser, t as ClivlyAuthAdapter } from "./auth-adapter-BNvri2gX.mjs";
2
2
  interface ClerkLikeUser {
3
3
  emailAddresses?: Array<{
4
4
  id: string;
package/auth-workos.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { n as ClivlyUser, t as ClivlyAuthAdapter } from "./auth-adapter-COMP0Fud.cjs";
1
+ import { n as ClivlyUser, t as ClivlyAuthAdapter } from "./auth-adapter-D2MUT1Hk.cjs";
2
2
  interface WorkOSLikeUser {
3
3
  email: string;
4
4
  firstName?: string | null;
package/auth-workos.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { n as ClivlyUser, t as ClivlyAuthAdapter } from "./auth-adapter-ZlhllVpm.mjs";
1
+ import { n as ClivlyUser, t as ClivlyAuthAdapter } from "./auth-adapter-BNvri2gX.mjs";
2
2
  interface WorkOSLikeUser {
3
3
  email: string;
4
4
  firstName?: string | null;
@@ -1,2 +1,2 @@
1
- import { t as CRMAdapter } from "./adapter-OO5g17qF.cjs";
1
+ import { t as CRMAdapter } from "./adapter-BiUN_I3u.cjs";
2
2
  export { CRMAdapter };
@@ -1,2 +1,2 @@
1
- import { t as CRMAdapter } from "./adapter-C63F9VZL.mjs";
1
+ import { t as CRMAdapter } from "./adapter-BXykDFyG.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-COMP0Fud.cjs";
1
+ import { a as authCustom, i as MembershipResolver, n as ClivlyUser, r as CrmMembership, t as ClivlyAuthAdapter } from "./auth-adapter-D2MUT1Hk.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-ZlhllVpm.mjs";
1
+ import { a as authCustom, i as MembershipResolver, n as ClivlyUser, r as CrmMembership, t as ClivlyAuthAdapter } from "./auth-adapter-BNvri2gX.mjs";
2
2
  export { ClivlyAuthAdapter, ClivlyUser, CrmMembership, MembershipResolver, authCustom };
package/core-types.d.cts CHANGED
@@ -1,2 +1,2 @@
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-CQ2DgEH7.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
+ import { A as TaskStatus, C as PipelineStageConfig, D as TaskEntityType, E as Task, F as ValueInterval, I as isClosedStageType, M as UpdateContactInput, N as UpdateDealInput, O as TaskFilters, P as UpdateTaskInput, S as PipelineKind, T as StageType, _ as Note, a as Contact, b as PageRequest, c as ContactStatus, d as CreateContactInput, f as CreateDealInput, g as DealStage, h as Deal, i as CompanyFilters, j as UpdateCompanyInput, k as TaskPriority, l as CreateActivityInput, m as CrmRole, n as ActivityType, o as ContactFilters, p as CreateTaskInput, r as Company, s as ContactSource, t as Activity, u as CreateCompanyInput, v as OPEN_STAGE_TYPE, w as RecordSource, x as PipelineConfig, y as Page } from "./types-C08UluBS.cjs";
2
+ export { Activity, ActivityType, Company, CompanyFilters, Contact, ContactFilters, ContactSource, 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 };
package/core-types.d.mts CHANGED
@@ -1,2 +1,2 @@
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-C9_2vW5a.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
+ import { A as TaskStatus, C as PipelineStageConfig, D as TaskEntityType, E as Task, F as ValueInterval, I as isClosedStageType, M as UpdateContactInput, N as UpdateDealInput, O as TaskFilters, P as UpdateTaskInput, S as PipelineKind, T as StageType, _ as Note, a as Contact, b as PageRequest, c as ContactStatus, d as CreateContactInput, f as CreateDealInput, g as DealStage, h as Deal, i as CompanyFilters, j as UpdateCompanyInput, k as TaskPriority, l as CreateActivityInput, m as CrmRole, n as ActivityType, o as ContactFilters, p as CreateTaskInput, r as Company, s as ContactSource, t as Activity, u as CreateCompanyInput, v as OPEN_STAGE_TYPE, w as RecordSource, x as PipelineConfig, y as Page } from "./types-CZsSYbeC.mjs";
2
+ export { Activity, ActivityType, Company, CompanyFilters, Contact, ContactFilters, ContactSource, 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 };
package/core.d.cts CHANGED
@@ -1,6 +1,6 @@
1
- import { A as UpdateCompanyInput, C as RecordSource, D as TaskFilters, E as TaskEntityType, F as isClosedStageType, I as ContactSegment, L as contactSegmentSchema, 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-CQ2DgEH7.cjs";
2
- import { a as authCustom, i as MembershipResolver, n as ClivlyUser, r as CrmMembership, t as ClivlyAuthAdapter } from "./auth-adapter-COMP0Fud.cjs";
3
- import { t as CRMAdapter } from "./adapter-OO5g17qF.cjs";
1
+ import { A as TaskStatus, C as PipelineStageConfig, D as TaskEntityType, E as Task, F as ValueInterval, I as isClosedStageType, L as ContactSegment, M as UpdateContactInput, N as UpdateDealInput, O as TaskFilters, P as UpdateTaskInput, R as contactSegmentSchema, S as PipelineKind, T as StageType, _ as Note, a as Contact, b as PageRequest, c as ContactStatus, d as CreateContactInput, f as CreateDealInput, g as DealStage, h as Deal, i as CompanyFilters, j as UpdateCompanyInput, k as TaskPriority, l as CreateActivityInput, m as CrmRole, n as ActivityType, o as ContactFilters, p as CreateTaskInput, r as Company, s as ContactSource, t as Activity, u as CreateCompanyInput, v as OPEN_STAGE_TYPE, w as RecordSource, x as PipelineConfig, y as Page } from "./types-C08UluBS.cjs";
2
+ import { a as authCustom, i as MembershipResolver, n as ClivlyUser, r as CrmMembership, t as ClivlyAuthAdapter } from "./auth-adapter-D2MUT1Hk.cjs";
3
+ import { t as CRMAdapter } from "./adapter-BiUN_I3u.cjs";
4
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-dNclLyBM.cjs";
5
5
  import { i as relationshipViaSignature, n as buildFilterFromDiscriminator, r as buildRelationships, t as RelationshipCandidate } from "./mapping-form-CV7y6qox.cjs";
6
6
  import { i as mappingsToEntitiesConfig, t as EntityMappingRow } from "./mappings-config-BBppW9fp.cjs";
@@ -8,4 +8,4 @@ import { a as compileEntityView, i as ExplainResult, n as CompiledView, o as com
8
8
  import { c as SyncAction, f as isRemovalAction, g as runSync, h as resolveActions, l as SyncResult, m as reconcile, n as MirrorRecord, o as ResolvedMembership, r as PersistAction, s as SourceRow, t as EntitySyncResult, u as SyncStore } from "./sync-engine-C7W0Gkq0.cjs";
9
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-COALpgov.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-xK4PLm5T.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 ContactSegment, 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 ResolvedMembership, 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, contactSegmentSchema, coversUniqueKey, defineClivlyConfig, entitiesConfigSchema, evaluateStage, explainEntitiesConfig, fanOutJoins, filterSchema, hasRichMeta, hostOwnedFieldMessage, identityRefs, isClosedStageType, isHostOwned, isRemovalAction, joinFansOut, mappingsToEntitiesConfig, matchesCondition, missingRequiredFields, primaryKeyColumns, projectionFields, projectionSchema, quoteIdent, reconcile, rejectedCompanyFields, rejectedContactFields, relationshipSchema, relationshipViaSignature, relationshipsSchema, requiredFieldsFor, resolveActions, 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 ContactSegment, type ContactSource, 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 ResolvedMembership, 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, contactSegmentSchema, coversUniqueKey, defineClivlyConfig, entitiesConfigSchema, evaluateStage, explainEntitiesConfig, fanOutJoins, filterSchema, hasRichMeta, hostOwnedFieldMessage, identityRefs, isClosedStageType, isHostOwned, isRemovalAction, joinFansOut, mappingsToEntitiesConfig, matchesCondition, missingRequiredFields, primaryKeyColumns, projectionFields, projectionSchema, quoteIdent, reconcile, rejectedCompanyFields, rejectedContactFields, relationshipSchema, relationshipViaSignature, relationshipsSchema, requiredFieldsFor, resolveActions, runSync, slugify, toObjectTypeSlug, validateEntitiesConfig, validateProjection, validateProjectionFilter };
package/core.d.mts CHANGED
@@ -1,6 +1,6 @@
1
- import { A as UpdateCompanyInput, C as RecordSource, D as TaskFilters, E as TaskEntityType, F as isClosedStageType, I as ContactSegment, L as contactSegmentSchema, 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-C9_2vW5a.mjs";
2
- import { a as authCustom, i as MembershipResolver, n as ClivlyUser, r as CrmMembership, t as ClivlyAuthAdapter } from "./auth-adapter-ZlhllVpm.mjs";
3
- import { t as CRMAdapter } from "./adapter-C63F9VZL.mjs";
1
+ import { A as TaskStatus, C as PipelineStageConfig, D as TaskEntityType, E as Task, F as ValueInterval, I as isClosedStageType, L as ContactSegment, M as UpdateContactInput, N as UpdateDealInput, O as TaskFilters, P as UpdateTaskInput, R as contactSegmentSchema, S as PipelineKind, T as StageType, _ as Note, a as Contact, b as PageRequest, c as ContactStatus, d as CreateContactInput, f as CreateDealInput, g as DealStage, h as Deal, i as CompanyFilters, j as UpdateCompanyInput, k as TaskPriority, l as CreateActivityInput, m as CrmRole, n as ActivityType, o as ContactFilters, p as CreateTaskInput, r as Company, s as ContactSource, t as Activity, u as CreateCompanyInput, v as OPEN_STAGE_TYPE, w as RecordSource, x as PipelineConfig, y as Page } from "./types-CZsSYbeC.mjs";
2
+ import { a as authCustom, i as MembershipResolver, n as ClivlyUser, r as CrmMembership, t as ClivlyAuthAdapter } from "./auth-adapter-BNvri2gX.mjs";
3
+ import { t as CRMAdapter } from "./adapter-BXykDFyG.mjs";
4
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-X-KlnYXX.mjs";
5
5
  import { i as relationshipViaSignature, n as buildFilterFromDiscriminator, r as buildRelationships, t as RelationshipCandidate } from "./mapping-form-Bpvgf5b8.mjs";
6
6
  import { i as mappingsToEntitiesConfig, t as EntityMappingRow } from "./mappings-config-Dmm0H6p_.mjs";
@@ -8,4 +8,4 @@ import { a as compileEntityView, i as ExplainResult, n as CompiledView, o as com
8
8
  import { c as SyncAction, f as isRemovalAction, g as runSync, h as resolveActions, l as SyncResult, m as reconcile, n as MirrorRecord, o as ResolvedMembership, r as PersistAction, s as SourceRow, t as EntitySyncResult, u as SyncStore } from "./sync-engine-C9Q2FkR9.mjs";
9
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-D3q4FPcA.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-xK4PLm5T.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 ContactSegment, 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 ResolvedMembership, 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, contactSegmentSchema, coversUniqueKey, defineClivlyConfig, entitiesConfigSchema, evaluateStage, explainEntitiesConfig, fanOutJoins, filterSchema, hasRichMeta, hostOwnedFieldMessage, identityRefs, isClosedStageType, isHostOwned, isRemovalAction, joinFansOut, mappingsToEntitiesConfig, matchesCondition, missingRequiredFields, primaryKeyColumns, projectionFields, projectionSchema, quoteIdent, reconcile, rejectedCompanyFields, rejectedContactFields, relationshipSchema, relationshipViaSignature, relationshipsSchema, requiredFieldsFor, resolveActions, 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 ContactSegment, type ContactSource, 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 ResolvedMembership, 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, contactSegmentSchema, coversUniqueKey, defineClivlyConfig, entitiesConfigSchema, evaluateStage, explainEntitiesConfig, fanOutJoins, filterSchema, hasRichMeta, hostOwnedFieldMessage, identityRefs, isClosedStageType, isHostOwned, isRemovalAction, joinFansOut, mappingsToEntitiesConfig, matchesCondition, missingRequiredFields, primaryKeyColumns, projectionFields, projectionSchema, quoteIdent, reconcile, rejectedCompanyFields, rejectedContactFields, relationshipSchema, relationshipViaSignature, relationshipsSchema, requiredFieldsFor, resolveActions, runSync, slugify, toObjectTypeSlug, validateEntitiesConfig, validateProjection, validateProjectionFilter };
package/drizzle.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { R as ProjectionMapping, z as ProjectionRef } from "./entity-config-dNclLyBM.cjs";
2
2
  import { n as buildUniqueConstraints, r as discoverFromDrizzle } from "./drizzle-B9cjBavj.cjs";
3
- import { t as NamespaceIntrospector, v as SyncSource } from "./namespace-probe-BHk3NcyI.cjs";
3
+ import { t as NamespaceIntrospector, v as SyncSource } from "./namespace-probe-qgjiudCo.cjs";
4
4
  import { Table } from "drizzle-orm";
5
5
  /**
6
6
  * Build a `SyncSource` that actually executes a projection's joins.
package/drizzle.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { R as ProjectionMapping, z as ProjectionRef } from "./entity-config-X-KlnYXX.mjs";
2
2
  import { n as buildUniqueConstraints, r as discoverFromDrizzle } from "./drizzle-L5FOGe_-.mjs";
3
- import { t as NamespaceIntrospector, v as SyncSource } from "./namespace-probe-Dt_HXcI-.mjs";
3
+ import { t as NamespaceIntrospector, v as SyncSource } from "./namespace-probe-BAXprXQh.mjs";
4
4
  import { Table } from "drizzle-orm";
5
5
  /**
6
6
  * Build a `SyncSource` that actually executes a projection's joins.
package/index.cjs CHANGED
@@ -3,7 +3,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const require_entity_config = require("./entity-config-DiCJ6mhI.cjs");
4
4
  require("./mapping-score-D2TCQiOr.cjs");
5
5
  const require_entity_heuristics = require("./entity-heuristics-CIParuQe.cjs");
6
- const require_sdk = require("./sdk-BZSTXPyK.cjs");
6
+ const require_sdk = require("./sdk-D53fH4uu.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");
@@ -606,6 +606,14 @@ const IDENTITY_RETRY_DELAY_MS = 2e3;
606
606
  const sleep = (ms) => new Promise((resolve) => {
607
607
  setTimeout(resolve, ms);
608
608
  });
609
+ async function isSignatureRequired(response) {
610
+ try {
611
+ const body = await response.json();
612
+ return typeof body === "object" && body !== null && body.error === "signature_required";
613
+ } catch {
614
+ return false;
615
+ }
616
+ }
609
617
  /** One attempt. Separated so the retry loop stays readable. */
610
618
  async function attempt(triggerUrl, fetchImpl) {
611
619
  const controller = new AbortController();
@@ -618,7 +626,7 @@ async function attempt(triggerUrl, fetchImpl) {
618
626
  signal: controller.signal
619
627
  });
620
628
  if (response.status === 401) return "clivly";
621
- if (response.status === 403) return "host-rejected";
629
+ if (response.status === 403) return await isSignatureRequired(response) ? "clivly" : "host-rejected";
622
630
  if (response.status === 404 || response.status >= 500) return "unknown";
623
631
  return "mismatch";
624
632
  } catch {
@@ -1765,6 +1773,7 @@ function writeCredentials(options, credentials) {
1765
1773
  };
1766
1774
  for (const entry of entries) if (result.skipped.includes(entry.key)) deps.out(` • ${entry.key} already set — skipped (pass --force to overwrite)`);
1767
1775
  else deps.out(` ✓ ${entry.key}=${maskSecret(valuesByKey[entry.key] ?? "")} written to ${envFile}`);
1776
+ deps.out(`\nDeploying? Copy ${SECRET_KEY_ENV} and CLIVLY_SYNC_TRIGGER_SECRET together into every environment your app runs in — without the second, its sync route refuses every request.`);
1768
1777
  }
1769
1778
  async function runLogin(options) {
1770
1779
  const { deps } = options;
@@ -3695,6 +3704,41 @@ const triggerUrlStage = {
3695
3704
  });
3696
3705
  }
3697
3706
  };
3707
+ const TRIGGER_SECRET_HINT = "Run `clivly login` to write CLIVLY_SECRET_KEY and CLIVLY_SYNC_TRIGGER_SECRET together, or copy the signing secret from Integrations → Remote sync. Every environment the app runs in needs both.";
3708
+ /**
3709
+ * Whether the trigger route can verify Clivly's requests.
3710
+ *
3711
+ * A `fail`, not a `warn`, since 0.18.0 (audit F-01): with no secret the route
3712
+ * refuses every request with a body, which is every request Clivly sends, so
3713
+ * "Run sync" cannot work at all. `allowUnsigned` without a secret is a warn —
3714
+ * the host chose to let its own cron in unsigned, but Clivly still cannot.
3715
+ */
3716
+ const triggerSecretStage = {
3717
+ id: "trigger-secret",
3718
+ label: "Sync trigger secret",
3719
+ needs: [configStage.id],
3720
+ run(ctx) {
3721
+ const trigger = ctx.sdk?.describeSyncTrigger?.();
3722
+ if (trigger?.hasSecret === void 0) return Promise.resolve({
3723
+ state: "skip",
3724
+ detail: "This app's clivly is too old to report it — upgrade to 0.18."
3725
+ });
3726
+ if (trigger.hasSecret) return Promise.resolve({
3727
+ state: "pass",
3728
+ detail: "Secret is set — the route verifies every request."
3729
+ });
3730
+ if (trigger.allowUnsigned) return Promise.resolve({
3731
+ state: "warn",
3732
+ detail: "Not set, and `allowUnsigned` is on — anyone who finds the URL can start a sync, and Clivly cannot.",
3733
+ hint: TRIGGER_SECRET_HINT
3734
+ });
3735
+ return Promise.resolve({
3736
+ state: "fail",
3737
+ detail: "CLIVLY_SYNC_TRIGGER_SECRET is not set — the sync route refuses every request, Clivly's included.",
3738
+ hint: TRIGGER_SECRET_HINT
3739
+ });
3740
+ }
3741
+ };
3698
3742
  /** The full ladder, in the order a developer completes setup. */
3699
3743
  const STATUS_STAGES = [
3700
3744
  apiKeyStage,
@@ -3804,7 +3848,8 @@ const STATUS_STAGES = [
3804
3848
  });
3805
3849
  }
3806
3850
  },
3807
- triggerUrlStage
3851
+ triggerUrlStage,
3852
+ triggerSecretStage
3808
3853
  ];
3809
3854
  function defaultLoadSdk(path) {
3810
3855
  return loadConfigSdk(path, "doctor");
@@ -3856,13 +3901,15 @@ const ALIAS_STAGE_IDS = {
3856
3901
  "runtime",
3857
3902
  "boot-hook",
3858
3903
  "setup-checks",
3859
- "derived-objects"
3904
+ "derived-objects",
3905
+ "trigger-secret"
3860
3906
  ],
3861
3907
  connect: [
3862
3908
  "api-key",
3863
3909
  "reachable",
3864
3910
  "config",
3865
- "trigger-url"
3911
+ "trigger-url",
3912
+ "trigger-secret"
3866
3913
  ]
3867
3914
  };
3868
3915
  const MARK = {
@@ -4339,7 +4386,8 @@ function previewMutations(deps, mutations, options) {
4339
4386
  }
4340
4387
  function printNextSteps(out, authComplete, loginRan, envFile, needsViteDotenv = false) {
4341
4388
  out("\nNext steps:\n");
4342
- out(loginRan ? " 1. Credentials written by `clivly login`\n" : ` 1. Add CLIVLY_SECRET_KEY to ${envFile} — create one at\n ${CREDENTIALS_LOCATION}\n (the legacy CLIVLY_API_KEY is still accepted)\n`);
4389
+ out(loginRan ? " 1. Credentials written by `clivly login`\n" : ` 1. Run \`clivly login\`, or add both of these to ${envFile}:\n CLIVLY_SECRET_KEY ${CREDENTIALS_LOCATION}\n CLIVLY_SYNC_TRIGGER_SECRET ${SYNC_SECRET_LOCATION}\n (the legacy CLIVLY_API_KEY is still accepted)\n`);
4390
+ out(" Deploying? Set CLIVLY_SECRET_KEY and CLIVLY_SYNC_TRIGGER_SECRET together\n in every environment the app runs in — without the second, its sync\n route refuses every request.\n");
4343
4391
  out(" 2. Local dev: run `clivly dev` for dashboard-triggered sync\n");
4344
4392
  out(" It tunnels your app and registers the URL for you — remote sync is\n deploy-only otherwise, so nothing is broken if you skip it. Once deployed\n to Vercel/Cloudflare/Railway/Render/Fly the URL is detected automatically;\n set CLIVLY_SYNC_TRIGGER_URL by hand only for a custom domain.\n");
4345
4393
  let step = authComplete ? 3 : 4;
package/index.mjs CHANGED
@@ -2,7 +2,7 @@
2
2
  import { t as CANONICAL_FIELDS } from "./entity-config-g_oMPXlN.mjs";
3
3
  import "./mapping-score-CS-MTDL9.mjs";
4
4
  import { d as suggestCursorField, i as isFrameworkTable, l as scoreFieldMap, n as hasDefiningColumn, o as matchesConcept, p as toFieldMap, s as requiredFieldsFor, u as scoreRelationships } from "./entity-heuristics-DE5ujoHw.mjs";
5
- import { n as createClivlySDK, u as isPlaceholderUrl } from "./sdk-KzHpSf7F.mjs";
5
+ import { n as createClivlySDK, u as isPlaceholderUrl } from "./sdk-D5J7kRQm.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";
@@ -605,6 +605,14 @@ const IDENTITY_RETRY_DELAY_MS = 2e3;
605
605
  const sleep = (ms) => new Promise((resolve) => {
606
606
  setTimeout(resolve, ms);
607
607
  });
608
+ async function isSignatureRequired(response) {
609
+ try {
610
+ const body = await response.json();
611
+ return typeof body === "object" && body !== null && body.error === "signature_required";
612
+ } catch {
613
+ return false;
614
+ }
615
+ }
608
616
  /** One attempt. Separated so the retry loop stays readable. */
609
617
  async function attempt(triggerUrl, fetchImpl) {
610
618
  const controller = new AbortController();
@@ -617,7 +625,7 @@ async function attempt(triggerUrl, fetchImpl) {
617
625
  signal: controller.signal
618
626
  });
619
627
  if (response.status === 401) return "clivly";
620
- if (response.status === 403) return "host-rejected";
628
+ if (response.status === 403) return await isSignatureRequired(response) ? "clivly" : "host-rejected";
621
629
  if (response.status === 404 || response.status >= 500) return "unknown";
622
630
  return "mismatch";
623
631
  } catch {
@@ -1764,6 +1772,7 @@ function writeCredentials(options, credentials) {
1764
1772
  };
1765
1773
  for (const entry of entries) if (result.skipped.includes(entry.key)) deps.out(` • ${entry.key} already set — skipped (pass --force to overwrite)`);
1766
1774
  else deps.out(` ✓ ${entry.key}=${maskSecret(valuesByKey[entry.key] ?? "")} written to ${envFile}`);
1775
+ deps.out(`\nDeploying? Copy ${SECRET_KEY_ENV} and CLIVLY_SYNC_TRIGGER_SECRET together into every environment your app runs in — without the second, its sync route refuses every request.`);
1767
1776
  }
1768
1777
  async function runLogin(options) {
1769
1778
  const { deps } = options;
@@ -3694,6 +3703,41 @@ const triggerUrlStage = {
3694
3703
  });
3695
3704
  }
3696
3705
  };
3706
+ const TRIGGER_SECRET_HINT = "Run `clivly login` to write CLIVLY_SECRET_KEY and CLIVLY_SYNC_TRIGGER_SECRET together, or copy the signing secret from Integrations → Remote sync. Every environment the app runs in needs both.";
3707
+ /**
3708
+ * Whether the trigger route can verify Clivly's requests.
3709
+ *
3710
+ * A `fail`, not a `warn`, since 0.18.0 (audit F-01): with no secret the route
3711
+ * refuses every request with a body, which is every request Clivly sends, so
3712
+ * "Run sync" cannot work at all. `allowUnsigned` without a secret is a warn —
3713
+ * the host chose to let its own cron in unsigned, but Clivly still cannot.
3714
+ */
3715
+ const triggerSecretStage = {
3716
+ id: "trigger-secret",
3717
+ label: "Sync trigger secret",
3718
+ needs: [configStage.id],
3719
+ run(ctx) {
3720
+ const trigger = ctx.sdk?.describeSyncTrigger?.();
3721
+ if (trigger?.hasSecret === void 0) return Promise.resolve({
3722
+ state: "skip",
3723
+ detail: "This app's clivly is too old to report it — upgrade to 0.18."
3724
+ });
3725
+ if (trigger.hasSecret) return Promise.resolve({
3726
+ state: "pass",
3727
+ detail: "Secret is set — the route verifies every request."
3728
+ });
3729
+ if (trigger.allowUnsigned) return Promise.resolve({
3730
+ state: "warn",
3731
+ detail: "Not set, and `allowUnsigned` is on — anyone who finds the URL can start a sync, and Clivly cannot.",
3732
+ hint: TRIGGER_SECRET_HINT
3733
+ });
3734
+ return Promise.resolve({
3735
+ state: "fail",
3736
+ detail: "CLIVLY_SYNC_TRIGGER_SECRET is not set — the sync route refuses every request, Clivly's included.",
3737
+ hint: TRIGGER_SECRET_HINT
3738
+ });
3739
+ }
3740
+ };
3697
3741
  /** The full ladder, in the order a developer completes setup. */
3698
3742
  const STATUS_STAGES = [
3699
3743
  apiKeyStage,
@@ -3803,7 +3847,8 @@ const STATUS_STAGES = [
3803
3847
  });
3804
3848
  }
3805
3849
  },
3806
- triggerUrlStage
3850
+ triggerUrlStage,
3851
+ triggerSecretStage
3807
3852
  ];
3808
3853
  function defaultLoadSdk(path) {
3809
3854
  return loadConfigSdk(path, "doctor");
@@ -3855,13 +3900,15 @@ const ALIAS_STAGE_IDS = {
3855
3900
  "runtime",
3856
3901
  "boot-hook",
3857
3902
  "setup-checks",
3858
- "derived-objects"
3903
+ "derived-objects",
3904
+ "trigger-secret"
3859
3905
  ],
3860
3906
  connect: [
3861
3907
  "api-key",
3862
3908
  "reachable",
3863
3909
  "config",
3864
- "trigger-url"
3910
+ "trigger-url",
3911
+ "trigger-secret"
3865
3912
  ]
3866
3913
  };
3867
3914
  const MARK = {
@@ -4338,7 +4385,8 @@ function previewMutations(deps, mutations, options) {
4338
4385
  }
4339
4386
  function printNextSteps(out, authComplete, loginRan, envFile, needsViteDotenv = false) {
4340
4387
  out("\nNext steps:\n");
4341
- out(loginRan ? " 1. Credentials written by `clivly login`\n" : ` 1. Add CLIVLY_SECRET_KEY to ${envFile} — create one at\n ${CREDENTIALS_LOCATION}\n (the legacy CLIVLY_API_KEY is still accepted)\n`);
4388
+ out(loginRan ? " 1. Credentials written by `clivly login`\n" : ` 1. Run \`clivly login\`, or add both of these to ${envFile}:\n CLIVLY_SECRET_KEY ${CREDENTIALS_LOCATION}\n CLIVLY_SYNC_TRIGGER_SECRET ${SYNC_SECRET_LOCATION}\n (the legacy CLIVLY_API_KEY is still accepted)\n`);
4389
+ out(" Deploying? Set CLIVLY_SECRET_KEY and CLIVLY_SYNC_TRIGGER_SECRET together\n in every environment the app runs in — without the second, its sync\n route refuses every request.\n");
4342
4390
  out(" 2. Local dev: run `clivly dev` for dashboard-triggered sync\n");
4343
4391
  out(" It tunnels your app and registers the URL for you — remote sync is\n deploy-only otherwise, so nothing is broken if you skip it. Once deployed\n to Vercel/Cloudflare/Railway/Render/Fly the URL is detected automatically;\n set CLIVLY_SYNC_TRIGGER_URL by hand only for a custom domain.\n");
4344
4392
  let step = authComplete ? 3 : 4;
@@ -1,2 +1,2 @@
1
- import { t as CRMAdapter } from "./adapter-OO5g17qF.cjs";
1
+ import { t as CRMAdapter } from "./adapter-BiUN_I3u.cjs";
2
2
  export { CRMAdapter };
@@ -1,2 +1,2 @@
1
- import { t as CRMAdapter } from "./adapter-C63F9VZL.mjs";
1
+ import { t as CRMAdapter } from "./adapter-BXykDFyG.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-COMP0Fud.cjs";
1
+ import { a as authCustom, i as MembershipResolver, n as ClivlyUser, r as CrmMembership, t as ClivlyAuthAdapter } from "./auth-adapter-D2MUT1Hk.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-ZlhllVpm.mjs";
1
+ import { a as authCustom, i as MembershipResolver, n as ClivlyUser, r as CrmMembership, t as ClivlyAuthAdapter } from "./auth-adapter-BNvri2gX.mjs";
2
2
  export { ClivlyAuthAdapter, ClivlyUser, CrmMembership, MembershipResolver, authCustom };
@@ -1,2 +1,2 @@
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-CQ2DgEH7.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
+ import { A as TaskStatus, C as PipelineStageConfig, D as TaskEntityType, E as Task, F as ValueInterval, I as isClosedStageType, M as UpdateContactInput, N as UpdateDealInput, O as TaskFilters, P as UpdateTaskInput, S as PipelineKind, T as StageType, _ as Note, a as Contact, b as PageRequest, c as ContactStatus, d as CreateContactInput, f as CreateDealInput, g as DealStage, h as Deal, i as CompanyFilters, j as UpdateCompanyInput, k as TaskPriority, l as CreateActivityInput, m as CrmRole, n as ActivityType, o as ContactFilters, p as CreateTaskInput, r as Company, s as ContactSource, t as Activity, u as CreateCompanyInput, v as OPEN_STAGE_TYPE, w as RecordSource, x as PipelineConfig, y as Page } from "./types-C08UluBS.cjs";
2
+ export { Activity, ActivityType, Company, CompanyFilters, Contact, ContactFilters, ContactSource, 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 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-C9_2vW5a.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
+ import { A as TaskStatus, C as PipelineStageConfig, D as TaskEntityType, E as Task, F as ValueInterval, I as isClosedStageType, M as UpdateContactInput, N as UpdateDealInput, O as TaskFilters, P as UpdateTaskInput, S as PipelineKind, T as StageType, _ as Note, a as Contact, b as PageRequest, c as ContactStatus, d as CreateContactInput, f as CreateDealInput, g as DealStage, h as Deal, i as CompanyFilters, j as UpdateCompanyInput, k as TaskPriority, l as CreateActivityInput, m as CrmRole, n as ActivityType, o as ContactFilters, p as CreateTaskInput, r as Company, s as ContactSource, t as Activity, u as CreateCompanyInput, v as OPEN_STAGE_TYPE, w as RecordSource, x as PipelineConfig, y as Page } from "./types-CZsSYbeC.mjs";
2
+ export { Activity, ActivityType, Company, CompanyFilters, Contact, ContactFilters, ContactSource, 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 };
package/internal.d.cts CHANGED
@@ -1,6 +1,6 @@
1
- import { A as UpdateCompanyInput, C as RecordSource, D as TaskFilters, E as TaskEntityType, F as isClosedStageType, I as ContactSegment, L as contactSegmentSchema, 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-CQ2DgEH7.cjs";
2
- import { a as authCustom, i as MembershipResolver, n as ClivlyUser, r as CrmMembership, t as ClivlyAuthAdapter } from "./auth-adapter-COMP0Fud.cjs";
3
- import { t as CRMAdapter } from "./adapter-OO5g17qF.cjs";
1
+ import { A as TaskStatus, C as PipelineStageConfig, D as TaskEntityType, E as Task, F as ValueInterval, I as isClosedStageType, L as ContactSegment, M as UpdateContactInput, N as UpdateDealInput, O as TaskFilters, P as UpdateTaskInput, R as contactSegmentSchema, S as PipelineKind, T as StageType, _ as Note, a as Contact, b as PageRequest, c as ContactStatus, d as CreateContactInput, f as CreateDealInput, g as DealStage, h as Deal, i as CompanyFilters, j as UpdateCompanyInput, k as TaskPriority, l as CreateActivityInput, m as CrmRole, n as ActivityType, o as ContactFilters, p as CreateTaskInput, r as Company, s as ContactSource, t as Activity, u as CreateCompanyInput, v as OPEN_STAGE_TYPE, w as RecordSource, x as PipelineConfig, y as Page } from "./types-C08UluBS.cjs";
2
+ import { a as authCustom, i as MembershipResolver, n as ClivlyUser, r as CrmMembership, t as ClivlyAuthAdapter } from "./auth-adapter-D2MUT1Hk.cjs";
3
+ import { t as CRMAdapter } from "./adapter-BiUN_I3u.cjs";
4
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-dNclLyBM.cjs";
5
5
  import { i as relationshipViaSignature, n as buildFilterFromDiscriminator, r as buildRelationships, t as RelationshipCandidate } from "./mapping-form-CV7y6qox.cjs";
6
6
  import { i as mappingsToEntitiesConfig, t as EntityMappingRow } from "./mappings-config-BBppW9fp.cjs";
@@ -8,4 +8,4 @@ import { a as compileEntityView, i as ExplainResult, n as CompiledView, o as com
8
8
  import { c as SyncAction, f as isRemovalAction, g as runSync, h as resolveActions, l as SyncResult, m as reconcile, n as MirrorRecord, o as ResolvedMembership, r as PersistAction, s as SourceRow, t as EntitySyncResult, u as SyncStore } from "./sync-engine-C7W0Gkq0.cjs";
9
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-COALpgov.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-xK4PLm5T.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 ContactSegment, 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 ResolvedMembership, 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, contactSegmentSchema, coversUniqueKey, defineClivlyConfig, entitiesConfigSchema, evaluateStage, explainEntitiesConfig, fanOutJoins, filterSchema, hasRichMeta, hostOwnedFieldMessage, identityRefs, isClosedStageType, isHostOwned, isRemovalAction, joinFansOut, mappingsToEntitiesConfig, matchesCondition, missingRequiredFields, primaryKeyColumns, projectionFields, projectionSchema, quoteIdent, reconcile, rejectedCompanyFields, rejectedContactFields, relationshipSchema, relationshipViaSignature, relationshipsSchema, requiredFieldsFor, resolveActions, 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 ContactSegment, type ContactSource, 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 ResolvedMembership, 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, contactSegmentSchema, coversUniqueKey, defineClivlyConfig, entitiesConfigSchema, evaluateStage, explainEntitiesConfig, fanOutJoins, filterSchema, hasRichMeta, hostOwnedFieldMessage, identityRefs, isClosedStageType, isHostOwned, isRemovalAction, joinFansOut, mappingsToEntitiesConfig, matchesCondition, missingRequiredFields, primaryKeyColumns, projectionFields, projectionSchema, quoteIdent, reconcile, rejectedCompanyFields, rejectedContactFields, relationshipSchema, relationshipViaSignature, relationshipsSchema, requiredFieldsFor, resolveActions, runSync, slugify, toObjectTypeSlug, validateEntitiesConfig, validateProjection, validateProjectionFilter };
package/internal.d.mts CHANGED
@@ -1,6 +1,6 @@
1
- import { A as UpdateCompanyInput, C as RecordSource, D as TaskFilters, E as TaskEntityType, F as isClosedStageType, I as ContactSegment, L as contactSegmentSchema, 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-C9_2vW5a.mjs";
2
- import { a as authCustom, i as MembershipResolver, n as ClivlyUser, r as CrmMembership, t as ClivlyAuthAdapter } from "./auth-adapter-ZlhllVpm.mjs";
3
- import { t as CRMAdapter } from "./adapter-C63F9VZL.mjs";
1
+ import { A as TaskStatus, C as PipelineStageConfig, D as TaskEntityType, E as Task, F as ValueInterval, I as isClosedStageType, L as ContactSegment, M as UpdateContactInput, N as UpdateDealInput, O as TaskFilters, P as UpdateTaskInput, R as contactSegmentSchema, S as PipelineKind, T as StageType, _ as Note, a as Contact, b as PageRequest, c as ContactStatus, d as CreateContactInput, f as CreateDealInput, g as DealStage, h as Deal, i as CompanyFilters, j as UpdateCompanyInput, k as TaskPriority, l as CreateActivityInput, m as CrmRole, n as ActivityType, o as ContactFilters, p as CreateTaskInput, r as Company, s as ContactSource, t as Activity, u as CreateCompanyInput, v as OPEN_STAGE_TYPE, w as RecordSource, x as PipelineConfig, y as Page } from "./types-CZsSYbeC.mjs";
2
+ import { a as authCustom, i as MembershipResolver, n as ClivlyUser, r as CrmMembership, t as ClivlyAuthAdapter } from "./auth-adapter-BNvri2gX.mjs";
3
+ import { t as CRMAdapter } from "./adapter-BXykDFyG.mjs";
4
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-X-KlnYXX.mjs";
5
5
  import { i as relationshipViaSignature, n as buildFilterFromDiscriminator, r as buildRelationships, t as RelationshipCandidate } from "./mapping-form-Bpvgf5b8.mjs";
6
6
  import { i as mappingsToEntitiesConfig, t as EntityMappingRow } from "./mappings-config-Dmm0H6p_.mjs";
@@ -8,4 +8,4 @@ import { a as compileEntityView, i as ExplainResult, n as CompiledView, o as com
8
8
  import { c as SyncAction, f as isRemovalAction, g as runSync, h as resolveActions, l as SyncResult, m as reconcile, n as MirrorRecord, o as ResolvedMembership, r as PersistAction, s as SourceRow, t as EntitySyncResult, u as SyncStore } from "./sync-engine-C9Q2FkR9.mjs";
9
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-D3q4FPcA.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-xK4PLm5T.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 ContactSegment, 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 ResolvedMembership, 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, contactSegmentSchema, coversUniqueKey, defineClivlyConfig, entitiesConfigSchema, evaluateStage, explainEntitiesConfig, fanOutJoins, filterSchema, hasRichMeta, hostOwnedFieldMessage, identityRefs, isClosedStageType, isHostOwned, isRemovalAction, joinFansOut, mappingsToEntitiesConfig, matchesCondition, missingRequiredFields, primaryKeyColumns, projectionFields, projectionSchema, quoteIdent, reconcile, rejectedCompanyFields, rejectedContactFields, relationshipSchema, relationshipViaSignature, relationshipsSchema, requiredFieldsFor, resolveActions, 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 ContactSegment, type ContactSource, 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 ResolvedMembership, 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, contactSegmentSchema, coversUniqueKey, defineClivlyConfig, entitiesConfigSchema, evaluateStage, explainEntitiesConfig, fanOutJoins, filterSchema, hasRichMeta, hostOwnedFieldMessage, identityRefs, isClosedStageType, isHostOwned, isRemovalAction, joinFansOut, mappingsToEntitiesConfig, matchesCondition, missingRequiredFields, primaryKeyColumns, projectionFields, projectionSchema, quoteIdent, reconcile, rejectedCompanyFields, rejectedContactFields, relationshipSchema, relationshipViaSignature, relationshipsSchema, requiredFieldsFor, resolveActions, runSync, slugify, toObjectTypeSlug, validateEntitiesConfig, validateProjection, validateProjectionFilter };
@@ -228,11 +228,19 @@ interface ClivlySDKConfig {
228
228
  path?: string;
229
229
  /**
230
230
  * Signing secret (`whsec_…`) issued by Clivly under Integrations → Remote
231
- * sync. When set, `createClivlyHandler()` rejects any request that isn't
232
- * validly signed. Leave unset only if the route is already unreachable from
233
- * the public internet.
231
+ * sync. Required: without it `createClivlyHandler()` refuses every request
232
+ * (403 `signature_required`), including Clivly's own "Run sync". With it,
233
+ * any request that isn't validly signed is rejected.
234
234
  */
235
235
  secret?: string;
236
+ /**
237
+ * Let an empty-body request run a tick without a signature when no
238
+ * `secret` is set — the shape a host's own cron or uptime ping sends.
239
+ * Off by default: an unsigned route lets anyone who finds the URL make
240
+ * this app scan its database. Requests with a body (everything Clivly
241
+ * sends) still need a signature. Ignored when `secret` is set.
242
+ */
243
+ allowUnsigned?: boolean;
236
244
  };
237
245
  /**
238
246
  * Shared secret Clivly Cloud presents (as `Authorization: Bearer <token>`) when
@@ -401,12 +409,19 @@ interface CursorStore {
401
409
  }
402
410
  /** @see ClivlySDK.describeSyncTrigger */
403
411
  interface SyncTriggerDescription {
412
+ /** Is `syncTrigger.allowUnsigned` set? Meaningless when `hasSecret` is. */
413
+ allowUnsigned?: boolean;
404
414
  /**
405
415
  * `syncTrigger.url` exactly as configured, placeholder and all. The raw
406
416
  * value, so a caller can say what is in the file rather than what survived
407
417
  * resolution.
408
418
  */
409
419
  configured?: string;
420
+ /**
421
+ * Is `syncTrigger.secret` set in this process? Optional only because an
422
+ * older SDK never reported it.
423
+ */
424
+ hasSecret?: boolean;
410
425
  /**
411
426
  * The URL that would be reported to Clivly on the next heartbeat, or
412
427
  * `undefined` when nothing resolves. An unedited placeholder never resolves.
@@ -228,11 +228,19 @@ interface ClivlySDKConfig {
228
228
  path?: string;
229
229
  /**
230
230
  * Signing secret (`whsec_…`) issued by Clivly under Integrations → Remote
231
- * sync. When set, `createClivlyHandler()` rejects any request that isn't
232
- * validly signed. Leave unset only if the route is already unreachable from
233
- * the public internet.
231
+ * sync. Required: without it `createClivlyHandler()` refuses every request
232
+ * (403 `signature_required`), including Clivly's own "Run sync". With it,
233
+ * any request that isn't validly signed is rejected.
234
234
  */
235
235
  secret?: string;
236
+ /**
237
+ * Let an empty-body request run a tick without a signature when no
238
+ * `secret` is set — the shape a host's own cron or uptime ping sends.
239
+ * Off by default: an unsigned route lets anyone who finds the URL make
240
+ * this app scan its database. Requests with a body (everything Clivly
241
+ * sends) still need a signature. Ignored when `secret` is set.
242
+ */
243
+ allowUnsigned?: boolean;
236
244
  };
237
245
  /**
238
246
  * Shared secret Clivly Cloud presents (as `Authorization: Bearer <token>`) when
@@ -401,12 +409,19 @@ interface CursorStore {
401
409
  }
402
410
  /** @see ClivlySDK.describeSyncTrigger */
403
411
  interface SyncTriggerDescription {
412
+ /** Is `syncTrigger.allowUnsigned` set? Meaningless when `hasSecret` is. */
413
+ allowUnsigned?: boolean;
404
414
  /**
405
415
  * `syncTrigger.url` exactly as configured, placeholder and all. The raw
406
416
  * value, so a caller can say what is in the file rather than what survived
407
417
  * resolution.
408
418
  */
409
419
  configured?: string;
420
+ /**
421
+ * Is `syncTrigger.secret` set in this process? Optional only because an
422
+ * older SDK never reported it.
423
+ */
424
+ hasSecret?: boolean;
410
425
  /**
411
426
  * The URL that would be reported to Clivly on the next heartbeat, or
412
427
  * `undefined` when nothing resolves. An unedited placeholder never resolves.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clivly",
3
- "version": "0.17.1",
3
+ "version": "0.18.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Clivly CLI — scaffold a CRM into your app (clivly init).",
@@ -1347,7 +1347,7 @@ function selfCheck(input) {
1347
1347
  const issues = [];
1348
1348
  if (input.reportsTriggerUrl && !input.hasTriggerSecret) issues.push({
1349
1349
  code: "trigger_route_unauthenticated",
1350
- message: "Your app's sync route is reachable but is not checking signatures.",
1350
+ message: "Your app's sync route has no signing secret, so it refuses every sync Clivly starts.",
1351
1351
  fix: "Set CLIVLY_SYNC_TRIGGER_SECRET in the environment your app runs in, then restart it."
1352
1352
  });
1353
1353
  if (input.lastPushFailed) issues.push({
@@ -2313,7 +2313,9 @@ function createClivlySDK(config) {
2313
2313
  }
2314
2314
  };
2315
2315
  const describeSyncTrigger = () => ({
2316
+ allowUnsigned: config.syncTrigger?.allowUnsigned === true,
2316
2317
  configured: config.syncTrigger?.url,
2318
+ hasSecret: Boolean(config.syncTrigger?.secret),
2317
2319
  resolved: resolveTriggerUrl({
2318
2320
  configuredUrl: config.syncTrigger?.url,
2319
2321
  configuredPath: config.syncTrigger?.path,
@@ -2542,11 +2544,12 @@ function createClivlySDK(config) {
2542
2544
  if (!(await verifyTriggerSignature(header, rawBody, secret) && header)) return "refused";
2543
2545
  return claimSignature(header) ? "signed" : "refused";
2544
2546
  }
2547
+ const allowUnsigned = config.syncTrigger?.allowUnsigned === true;
2545
2548
  if (!warnedUnsignedTrigger) {
2546
2549
  warnedUnsignedTrigger = true;
2547
- console.warn("Clivly: the sync trigger route is mounted without `syncTrigger.secret`, so anyone who can reach the URL can start a sync. Set CLIVLY_SYNC_TRIGGER_SECRET to require signed requests; until then, previews and sample runs from Clivly are refused.");
2550
+ console.error(allowUnsigned ? "Clivly: the sync trigger route is mounted without `syncTrigger.secret` and with `allowUnsigned`, so anyone who can reach the URL can start a sync. Set CLIVLY_SYNC_TRIGGER_SECRET; requests from Clivly are refused until you do." : "Clivly: the sync trigger route is mounted without `syncTrigger.secret`, so it refuses every request, including Clivly's. Set CLIVLY_SYNC_TRIGGER_SECRET in this app's environment.");
2548
2551
  }
2549
- return "unsigned";
2552
+ return allowUnsigned && rawBody === "" ? "unsigned" : "unsigned_refused";
2550
2553
  };
2551
2554
  const claimSignature = (header) => {
2552
2555
  const now = Date.now();
@@ -2555,7 +2558,6 @@ function createClivlySDK(config) {
2555
2558
  acceptedSignatures.set(header, now + SIGNATURE_TOLERANCE_SECONDS * SECONDS_PER_MS * 2);
2556
2559
  return true;
2557
2560
  };
2558
- const requiresSignature = (payload) => Boolean(payload.preview || payload.previewProjection || payload.sample);
2559
2561
  const parseTriggerBody = (rawBody) => {
2560
2562
  if (!rawBody) return {};
2561
2563
  try {
@@ -2601,15 +2603,15 @@ function createClivlySDK(config) {
2601
2603
  if (payload.previewProjection) return await handleProjectionPreviewRequest(config, payload.previewProjection);
2602
2604
  return null;
2603
2605
  };
2604
- const refuseUnauthorized = (auth, payload) => {
2606
+ const refuseUnauthorized = (auth) => {
2605
2607
  if (auth === "refused") return jsonResponse({
2606
2608
  ok: false,
2607
2609
  error: "unauthorized"
2608
2610
  }, UNAUTHORIZED_STATUS);
2609
- if (auth === "unsigned" && requiresSignature(payload)) return jsonResponse({
2611
+ if (auth === "unsigned_refused") return jsonResponse({
2610
2612
  ok: false,
2611
2613
  error: "signature_required",
2612
- message: "Previews and sample runs need a signed request. Set CLIVLY_SYNC_TRIGGER_SECRET in this app's environment."
2614
+ message: "This route needs a signed request. Set CLIVLY_SYNC_TRIGGER_SECRET in this app's environment."
2613
2615
  }, FORBIDDEN_STATUS);
2614
2616
  return null;
2615
2617
  };
@@ -2620,7 +2622,7 @@ function createClivlySDK(config) {
2620
2622
  const rawBody = await req.text().catch(() => "");
2621
2623
  const auth = await triggerRequestAuth(req, rawBody);
2622
2624
  const payload = parseTriggerBody(rawBody);
2623
- const denied = refuseUnauthorized(auth, payload);
2625
+ const denied = refuseUnauthorized(auth);
2624
2626
  if (denied) return denied;
2625
2627
  const runId = payload.runId ?? null;
2626
2628
  const startedAt = Date.now();
@@ -1347,7 +1347,7 @@ function selfCheck(input) {
1347
1347
  const issues = [];
1348
1348
  if (input.reportsTriggerUrl && !input.hasTriggerSecret) issues.push({
1349
1349
  code: "trigger_route_unauthenticated",
1350
- message: "Your app's sync route is reachable but is not checking signatures.",
1350
+ message: "Your app's sync route has no signing secret, so it refuses every sync Clivly starts.",
1351
1351
  fix: "Set CLIVLY_SYNC_TRIGGER_SECRET in the environment your app runs in, then restart it."
1352
1352
  });
1353
1353
  if (input.lastPushFailed) issues.push({
@@ -2313,7 +2313,9 @@ function createClivlySDK(config) {
2313
2313
  }
2314
2314
  };
2315
2315
  const describeSyncTrigger = () => ({
2316
+ allowUnsigned: config.syncTrigger?.allowUnsigned === true,
2316
2317
  configured: config.syncTrigger?.url,
2318
+ hasSecret: Boolean(config.syncTrigger?.secret),
2317
2319
  resolved: resolveTriggerUrl({
2318
2320
  configuredUrl: config.syncTrigger?.url,
2319
2321
  configuredPath: config.syncTrigger?.path,
@@ -2542,11 +2544,12 @@ function createClivlySDK(config) {
2542
2544
  if (!(await verifyTriggerSignature(header, rawBody, secret) && header)) return "refused";
2543
2545
  return claimSignature(header) ? "signed" : "refused";
2544
2546
  }
2547
+ const allowUnsigned = config.syncTrigger?.allowUnsigned === true;
2545
2548
  if (!warnedUnsignedTrigger) {
2546
2549
  warnedUnsignedTrigger = true;
2547
- console.warn("Clivly: the sync trigger route is mounted without `syncTrigger.secret`, so anyone who can reach the URL can start a sync. Set CLIVLY_SYNC_TRIGGER_SECRET to require signed requests; until then, previews and sample runs from Clivly are refused.");
2550
+ console.error(allowUnsigned ? "Clivly: the sync trigger route is mounted without `syncTrigger.secret` and with `allowUnsigned`, so anyone who can reach the URL can start a sync. Set CLIVLY_SYNC_TRIGGER_SECRET; requests from Clivly are refused until you do." : "Clivly: the sync trigger route is mounted without `syncTrigger.secret`, so it refuses every request, including Clivly's. Set CLIVLY_SYNC_TRIGGER_SECRET in this app's environment.");
2548
2551
  }
2549
- return "unsigned";
2552
+ return allowUnsigned && rawBody === "" ? "unsigned" : "unsigned_refused";
2550
2553
  };
2551
2554
  const claimSignature = (header) => {
2552
2555
  const now = Date.now();
@@ -2555,7 +2558,6 @@ function createClivlySDK(config) {
2555
2558
  acceptedSignatures.set(header, now + SIGNATURE_TOLERANCE_SECONDS * SECONDS_PER_MS * 2);
2556
2559
  return true;
2557
2560
  };
2558
- const requiresSignature = (payload) => Boolean(payload.preview || payload.previewProjection || payload.sample);
2559
2561
  const parseTriggerBody = (rawBody) => {
2560
2562
  if (!rawBody) return {};
2561
2563
  try {
@@ -2601,15 +2603,15 @@ function createClivlySDK(config) {
2601
2603
  if (payload.previewProjection) return await handleProjectionPreviewRequest(config, payload.previewProjection);
2602
2604
  return null;
2603
2605
  };
2604
- const refuseUnauthorized = (auth, payload) => {
2606
+ const refuseUnauthorized = (auth) => {
2605
2607
  if (auth === "refused") return jsonResponse({
2606
2608
  ok: false,
2607
2609
  error: "unauthorized"
2608
2610
  }, UNAUTHORIZED_STATUS);
2609
- if (auth === "unsigned" && requiresSignature(payload)) return jsonResponse({
2611
+ if (auth === "unsigned_refused") return jsonResponse({
2610
2612
  ok: false,
2611
2613
  error: "signature_required",
2612
- message: "Previews and sample runs need a signed request. Set CLIVLY_SYNC_TRIGGER_SECRET in this app's environment."
2614
+ message: "This route needs a signed request. Set CLIVLY_SYNC_TRIGGER_SECRET in this app's environment."
2613
2615
  }, FORBIDDEN_STATUS);
2614
2616
  return null;
2615
2617
  };
@@ -2620,7 +2622,7 @@ function createClivlySDK(config) {
2620
2622
  const rawBody = await req.text().catch(() => "");
2621
2623
  const auth = await triggerRequestAuth(req, rawBody);
2622
2624
  const payload = parseTriggerBody(rawBody);
2623
- const denied = refuseUnauthorized(auth, payload);
2625
+ const denied = refuseUnauthorized(auth);
2624
2626
  if (denied) return denied;
2625
2627
  const runId = payload.runId ?? null;
2626
2628
  const startedAt = Date.now();
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-DiCJ6mhI.cjs");
3
- const require_sdk = require("./sdk-BZSTXPyK.cjs");
3
+ const require_sdk = require("./sdk-D53fH4uu.cjs");
4
4
  exports.CURSOR_KEY_PREFIX = require_sdk.CURSOR_KEY_PREFIX;
5
5
  exports.ClivlyAuthError = require_sdk.ClivlyAuthError;
6
6
  exports.ClivlyError = require_sdk.ClivlyError;
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-dNclLyBM.cjs";
2
- import { _ as RemoteProjectionsDescription, a as ClivlyConnectResult, b as ExposurePolicy, 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-BHk3NcyI.cjs";
2
+ import { _ as RemoteProjectionsDescription, a as ClivlyConnectResult, b as ExposurePolicy, 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-qgjiudCo.cjs";
3
3
  export declare function isPlaceholderUrl(value: string): boolean;
4
4
  export declare function createChatSessionHandler({ allowedOrigins, apiKey, apiUrl, fetchImpl, resolveUser, resolveVisitorIp }: CreateChatSessionHandlerOptions): (request: Request) => Promise<Response>;
5
5
  export declare class ClivlyError extends Error {
package/sdk.d.mts 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-X-KlnYXX.mjs";
2
- import { _ as RemoteProjectionsDescription, a as ClivlyConnectResult, b as ExposurePolicy, 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-Dt_HXcI-.mjs";
2
+ import { _ as RemoteProjectionsDescription, a as ClivlyConnectResult, b as ExposurePolicy, 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-BAXprXQh.mjs";
3
3
  export declare function isPlaceholderUrl(value: string): boolean;
4
4
  export declare function createChatSessionHandler({ allowedOrigins, apiKey, apiUrl, fetchImpl, resolveUser, resolveVisitorIp }: CreateChatSessionHandlerOptions): (request: Request) => Promise<Response>;
5
5
  export declare class ClivlyError extends Error {
package/sdk.mjs CHANGED
@@ -1,3 +1,3 @@
1
1
  import { c as defineClivlyConfig, g as validateEntitiesConfig, s as customObjectDeclarations } from "./entity-config-g_oMPXlN.mjs";
2
- import { a as ClivlyAuthError, c as ClivlyRateLimitError, i as memoryCursorStore, l as createChatSessionHandler, n as createClivlySDK, o as ClivlyError, r as kvCursorStore, s as ClivlyNetworkError, t as CURSOR_KEY_PREFIX, u as isPlaceholderUrl } from "./sdk-KzHpSf7F.mjs";
2
+ import { a as ClivlyAuthError, c as ClivlyRateLimitError, i as memoryCursorStore, l as createChatSessionHandler, n as createClivlySDK, o as ClivlyError, r as kvCursorStore, s as ClivlyNetworkError, t as CURSOR_KEY_PREFIX, u as isPlaceholderUrl } from "./sdk-D5J7kRQm.mjs";
3
3
  export { CURSOR_KEY_PREFIX, ClivlyAuthError, ClivlyError, ClivlyNetworkError, ClivlyRateLimitError, createChatSessionHandler, createClivlySDK, customObjectDeclarations, defineClivlyConfig, isPlaceholderUrl, kvCursorStore, memoryCursorStore, validateEntitiesConfig };
@@ -57,6 +57,8 @@ interface Contact {
57
57
  name: string;
58
58
  orgId: string;
59
59
  phone: string | null;
60
+ /** Where the contact came from, set once at creation; null if not recorded. */
61
+ source?: ContactSource | null;
60
62
  /**
61
63
  * The host row this contact mirrors, or null when it was created in the CRM.
62
64
  *
@@ -156,6 +158,11 @@ interface Task {
156
158
  */
157
159
  dueAllDay?: boolean | null;
158
160
  dueAt: Date | null;
161
+ /**
162
+ * How long a timed task runs from `dueAt`, in minutes. Null: a point in
163
+ * time. Always null for an all-day or undated task.
164
+ */
165
+ durationMinutes?: number | null;
159
166
  entityId: string | null;
160
167
  entityType: TaskEntityType | null;
161
168
  id: string;
@@ -188,11 +195,15 @@ interface Activity {
188
195
  summary: string;
189
196
  type: ActivityType;
190
197
  }
198
+ /** Where a contact came from; null when it was not recorded. */
199
+ type ContactSource = "agent" | "app_sync" | "chat" | "import" | "inbound_email" | "manual" | "outbound_email";
191
200
  interface CreateContactInput {
192
201
  companyId?: string;
193
202
  email: string;
194
203
  name: string;
195
204
  phone?: string;
205
+ /** Defaults to `manual`: a person created it. */
206
+ source?: ContactSource;
196
207
  status?: ContactStatus;
197
208
  title?: string;
198
209
  }
@@ -250,6 +261,11 @@ interface CreateTaskInput {
250
261
  */
251
262
  dueAllDay?: boolean | null;
252
263
  dueAt?: Date;
264
+ /**
265
+ * How long a timed task runs from `dueAt`, in minutes. Null: a point in
266
+ * time. Always null for an all-day or undated task.
267
+ */
268
+ durationMinutes?: number | null;
253
269
  entityId?: string;
254
270
  entityType?: TaskEntityType;
255
271
  priority?: TaskPriority;
@@ -264,6 +280,11 @@ interface UpdateTaskInput {
264
280
  */
265
281
  dueAllDay?: boolean | null;
266
282
  dueAt?: Date | null;
283
+ /**
284
+ * How long a timed task runs from `dueAt`, in minutes. Null: a point in
285
+ * time. Always null for an all-day or undated task.
286
+ */
287
+ durationMinutes?: number | null;
267
288
  entityId?: string | null;
268
289
  entityType?: TaskEntityType | null;
269
290
  priority?: TaskPriority;
@@ -347,4 +368,4 @@ interface TaskFilters {
347
368
  priority?: TaskPriority;
348
369
  status?: TaskStatus;
349
370
  }
350
- export { UpdateCompanyInput as A, RecordSource as C, TaskFilters as D, TaskEntityType as E, isClosedStageType as F, ContactSegment as I, contactSegmentSchema as L, UpdateDealInput as M, UpdateTaskInput as N, TaskPriority as O, ValueInterval as P, PipelineStageConfig as S, Task as T, OPEN_STAGE_TYPE as _, Contact as a, PipelineConfig as b, CreateActivityInput as c, CreateDealInput as d, CreateTaskInput as f, Note as g, DealStage as h, CompanyFilters as i, UpdateContactInput as j, TaskStatus as k, CreateCompanyInput as l, Deal as m, ActivityType as n, ContactFilters as o, CrmRole as p, Company as r, ContactStatus as s, Activity as t, CreateContactInput as u, Page as v, StageType as w, PipelineKind as x, PageRequest as y };
371
+ export { TaskStatus as A, PipelineStageConfig as C, TaskEntityType as D, Task as E, ValueInterval as F, isClosedStageType as I, ContactSegment as L, UpdateContactInput as M, UpdateDealInput as N, TaskFilters as O, UpdateTaskInput as P, contactSegmentSchema as R, PipelineKind as S, StageType as T, Note as _, Contact as a, PageRequest as b, ContactStatus as c, CreateContactInput as d, CreateDealInput as f, DealStage as g, Deal as h, CompanyFilters as i, UpdateCompanyInput as j, TaskPriority as k, CreateActivityInput as l, CrmRole as m, ActivityType as n, ContactFilters as o, CreateTaskInput as p, Company as r, ContactSource as s, Activity as t, CreateCompanyInput as u, OPEN_STAGE_TYPE as v, RecordSource as w, PipelineConfig as x, Page as y };
@@ -57,6 +57,8 @@ interface Contact {
57
57
  name: string;
58
58
  orgId: string;
59
59
  phone: string | null;
60
+ /** Where the contact came from, set once at creation; null if not recorded. */
61
+ source?: ContactSource | null;
60
62
  /**
61
63
  * The host row this contact mirrors, or null when it was created in the CRM.
62
64
  *
@@ -156,6 +158,11 @@ interface Task {
156
158
  */
157
159
  dueAllDay?: boolean | null;
158
160
  dueAt: Date | null;
161
+ /**
162
+ * How long a timed task runs from `dueAt`, in minutes. Null: a point in
163
+ * time. Always null for an all-day or undated task.
164
+ */
165
+ durationMinutes?: number | null;
159
166
  entityId: string | null;
160
167
  entityType: TaskEntityType | null;
161
168
  id: string;
@@ -188,11 +195,15 @@ interface Activity {
188
195
  summary: string;
189
196
  type: ActivityType;
190
197
  }
198
+ /** Where a contact came from; null when it was not recorded. */
199
+ type ContactSource = "agent" | "app_sync" | "chat" | "import" | "inbound_email" | "manual" | "outbound_email";
191
200
  interface CreateContactInput {
192
201
  companyId?: string;
193
202
  email: string;
194
203
  name: string;
195
204
  phone?: string;
205
+ /** Defaults to `manual`: a person created it. */
206
+ source?: ContactSource;
196
207
  status?: ContactStatus;
197
208
  title?: string;
198
209
  }
@@ -250,6 +261,11 @@ interface CreateTaskInput {
250
261
  */
251
262
  dueAllDay?: boolean | null;
252
263
  dueAt?: Date;
264
+ /**
265
+ * How long a timed task runs from `dueAt`, in minutes. Null: a point in
266
+ * time. Always null for an all-day or undated task.
267
+ */
268
+ durationMinutes?: number | null;
253
269
  entityId?: string;
254
270
  entityType?: TaskEntityType;
255
271
  priority?: TaskPriority;
@@ -264,6 +280,11 @@ interface UpdateTaskInput {
264
280
  */
265
281
  dueAllDay?: boolean | null;
266
282
  dueAt?: Date | null;
283
+ /**
284
+ * How long a timed task runs from `dueAt`, in minutes. Null: a point in
285
+ * time. Always null for an all-day or undated task.
286
+ */
287
+ durationMinutes?: number | null;
267
288
  entityId?: string | null;
268
289
  entityType?: TaskEntityType | null;
269
290
  priority?: TaskPriority;
@@ -347,4 +368,4 @@ interface TaskFilters {
347
368
  priority?: TaskPriority;
348
369
  status?: TaskStatus;
349
370
  }
350
- export { UpdateCompanyInput as A, RecordSource as C, TaskFilters as D, TaskEntityType as E, isClosedStageType as F, ContactSegment as I, contactSegmentSchema as L, UpdateDealInput as M, UpdateTaskInput as N, TaskPriority as O, ValueInterval as P, PipelineStageConfig as S, Task as T, OPEN_STAGE_TYPE as _, Contact as a, PipelineConfig as b, CreateActivityInput as c, CreateDealInput as d, CreateTaskInput as f, Note as g, DealStage as h, CompanyFilters as i, UpdateContactInput as j, TaskStatus as k, CreateCompanyInput as l, Deal as m, ActivityType as n, ContactFilters as o, CrmRole as p, Company as r, ContactStatus as s, Activity as t, CreateContactInput as u, Page as v, StageType as w, PipelineKind as x, PageRequest as y };
371
+ export { TaskStatus as A, PipelineStageConfig as C, TaskEntityType as D, Task as E, ValueInterval as F, isClosedStageType as I, ContactSegment as L, UpdateContactInput as M, UpdateDealInput as N, TaskFilters as O, UpdateTaskInput as P, contactSegmentSchema as R, PipelineKind as S, StageType as T, Note as _, Contact as a, PageRequest as b, ContactStatus as c, CreateContactInput as d, CreateDealInput as f, DealStage as g, Deal as h, CompanyFilters as i, UpdateCompanyInput as j, TaskPriority as k, CreateActivityInput as l, CrmRole as m, ActivityType as n, ContactFilters as o, CreateTaskInput as p, Company as r, ContactSource as s, Activity as t, CreateCompanyInput as u, OPEN_STAGE_TYPE as v, RecordSource as w, PipelineConfig as x, Page as y };
package/vite.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { o as ClivlySDK } from "./namespace-probe-BHk3NcyI.cjs";
1
+ import { o as ClivlySDK } from "./namespace-probe-qgjiudCo.cjs";
2
2
  import { Plugin } from "vite";
3
3
  export interface ClivlyViteOptions {
4
4
  /** Log prefix for Clivly's boot lines. Defaults to "clivly". */
package/vite.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { o as ClivlySDK } from "./namespace-probe-Dt_HXcI-.mjs";
1
+ import { o as ClivlySDK } from "./namespace-probe-BAXprXQh.mjs";
2
2
  import { Plugin } from "vite";
3
3
  export interface ClivlyViteOptions {
4
4
  /** Log prefix for Clivly's boot lines. Defaults to "clivly". */