clivly 0.17.1 → 0.19.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.
- package/README.md +15 -6
- package/{adapter-C63F9VZL.d.mts → adapter-BXykDFyG.d.mts} +1 -1
- package/{adapter-OO5g17qF.d.cts → adapter-BiUN_I3u.d.cts} +1 -1
- package/{auth-adapter-COMP0Fud.d.cts → auth-adapter-BNvri2gX.d.mts} +1 -1
- package/{auth-adapter-ZlhllVpm.d.mts → auth-adapter-D2MUT1Hk.d.cts} +1 -1
- package/auth-better-auth.d.cts +1 -1
- package/auth-better-auth.d.mts +1 -1
- package/auth-clerk.d.cts +1 -1
- package/auth-clerk.d.mts +1 -1
- package/auth-workos.d.cts +1 -1
- package/auth-workos.d.mts +1 -1
- package/core-adapter.d.cts +1 -1
- package/core-adapter.d.mts +1 -1
- package/core-auth-adapter.d.cts +1 -1
- package/core-auth-adapter.d.mts +1 -1
- package/core-types.d.cts +2 -2
- package/core-types.d.mts +2 -2
- package/core.d.cts +4 -4
- package/core.d.mts +4 -4
- package/drizzle.cjs +51 -2
- package/drizzle.d.cts +34 -2
- package/drizzle.d.mts +34 -2
- package/drizzle.mjs +50 -3
- package/index.cjs +64 -8
- package/index.mjs +64 -8
- package/internal-adapter.d.cts +1 -1
- package/internal-adapter.d.mts +1 -1
- package/internal-auth-adapter.d.cts +1 -1
- package/internal-auth-adapter.d.mts +1 -1
- package/internal-types.d.cts +2 -2
- package/internal-types.d.mts +2 -2
- package/internal.d.cts +4 -4
- package/internal.d.mts +4 -4
- package/{namespace-probe-BHk3NcyI.d.cts → namespace-probe-C1tm5rGh.d.cts} +92 -4
- package/{namespace-probe-Dt_HXcI-.d.mts → namespace-probe-ah2awcHO.d.mts} +92 -4
- package/package.json +1 -1
- package/{sdk-BZSTXPyK.cjs → sdk-BEHVvB18.cjs} +261 -31
- package/{sdk-KzHpSf7F.mjs → sdk-ChyrSl32.mjs} +261 -31
- package/sdk.cjs +1 -1
- package/sdk.d.cts +2 -2
- package/sdk.d.mts +2 -2
- package/sdk.mjs +1 -1
- package/{types-CQ2DgEH7.d.cts → types-C08UluBS.d.cts} +22 -1
- package/{types-C9_2vW5a.d.mts → types-CZsSYbeC.d.mts} +22 -1
- package/vite.d.cts +1 -1
- package/vite.d.mts +1 -1
package/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { t as CANONICAL_FIELDS } from "./entity-config-g_oMPXlN.mjs";
|
|
3
|
-
import "./mapping-score-CS-MTDL9.mjs";
|
|
4
3
|
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
|
|
4
|
+
import "./mapping-score-CS-MTDL9.mjs";
|
|
5
|
+
import { n as createClivlySDK, u as isPlaceholderUrl } from "./sdk-ChyrSl32.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;
|
|
@@ -2332,6 +2341,14 @@ ${sources.join(",\n")},
|
|
|
2332
2341
|
url: process.env.CLIVLY_SYNC_TRIGGER_URL,
|
|
2333
2342
|
secret: process.env.CLIVLY_SYNC_TRIGGER_SECRET,
|
|
2334
2343
|
},
|
|
2344
|
+
// Push a changed row to Clivly the moment your app writes it, so a new
|
|
2345
|
+
// signup shows in the CRM within a second instead of at the next sync.
|
|
2346
|
+
// Write through the helpers from "clivly/drizzle" to use it:
|
|
2347
|
+
// insertAndPush(clivly, db, table, { entity }) // creates
|
|
2348
|
+
// updateAndPush(clivly, db, table, { entity }) // edits
|
|
2349
|
+
// deleteAndPush(clivly, db, table, { entity }) // deletes (archived in Clivly)
|
|
2350
|
+
// Writes made any other way still arrive with Clivly's scheduled sync.
|
|
2351
|
+
sync: { instant: true },
|
|
2335
2352
|
// verifyToken is optional and only needed once a Clivly Cloud consumer calls
|
|
2336
2353
|
// your /clivly/auth/verify endpoint; leave it unset otherwise.
|
|
2337
2354
|
});
|
|
@@ -3394,7 +3411,7 @@ const CURSOR_STORE_HINT = "Pass `cursorStore: kvCursorStore(env.MY_KV)` (exporte
|
|
|
3394
3411
|
function cursorStoreDetail(verdict) {
|
|
3395
3412
|
if (verdict.configured) return "delta syncs resume from a persisted cursor";
|
|
3396
3413
|
if (verdict.edgeRuntime === null) return "in-memory (fine on a long-lived host)";
|
|
3397
|
-
return `No \`cursorStore\` on ${verdict.edgeRuntime}
|
|
3414
|
+
return `No \`cursorStore\` on ${verdict.edgeRuntime}. Syncs Clivly starts resume from the position Clivly keeps for you; a sync this app starts itself re-reads your entire source tables.`;
|
|
3398
3415
|
}
|
|
3399
3416
|
// src/edge-safety.ts
|
|
3400
3417
|
const NODE_BUILTINS = /* @__PURE__ */ new Set([
|
|
@@ -3694,6 +3711,41 @@ const triggerUrlStage = {
|
|
|
3694
3711
|
});
|
|
3695
3712
|
}
|
|
3696
3713
|
};
|
|
3714
|
+
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.";
|
|
3715
|
+
/**
|
|
3716
|
+
* Whether the trigger route can verify Clivly's requests.
|
|
3717
|
+
*
|
|
3718
|
+
* A `fail`, not a `warn`, since 0.18.0 (audit F-01): with no secret the route
|
|
3719
|
+
* refuses every request with a body, which is every request Clivly sends, so
|
|
3720
|
+
* "Run sync" cannot work at all. `allowUnsigned` without a secret is a warn —
|
|
3721
|
+
* the host chose to let its own cron in unsigned, but Clivly still cannot.
|
|
3722
|
+
*/
|
|
3723
|
+
const triggerSecretStage = {
|
|
3724
|
+
id: "trigger-secret",
|
|
3725
|
+
label: "Sync trigger secret",
|
|
3726
|
+
needs: [configStage.id],
|
|
3727
|
+
run(ctx) {
|
|
3728
|
+
const trigger = ctx.sdk?.describeSyncTrigger?.();
|
|
3729
|
+
if (trigger?.hasSecret === void 0) return Promise.resolve({
|
|
3730
|
+
state: "skip",
|
|
3731
|
+
detail: "This app's clivly is too old to report it — upgrade to 0.18."
|
|
3732
|
+
});
|
|
3733
|
+
if (trigger.hasSecret) return Promise.resolve({
|
|
3734
|
+
state: "pass",
|
|
3735
|
+
detail: "Secret is set — the route verifies every request."
|
|
3736
|
+
});
|
|
3737
|
+
if (trigger.allowUnsigned) return Promise.resolve({
|
|
3738
|
+
state: "warn",
|
|
3739
|
+
detail: "Not set, and `allowUnsigned` is on — anyone who finds the URL can start a sync, and Clivly cannot.",
|
|
3740
|
+
hint: TRIGGER_SECRET_HINT
|
|
3741
|
+
});
|
|
3742
|
+
return Promise.resolve({
|
|
3743
|
+
state: "fail",
|
|
3744
|
+
detail: "CLIVLY_SYNC_TRIGGER_SECRET is not set — the sync route refuses every request, Clivly's included.",
|
|
3745
|
+
hint: TRIGGER_SECRET_HINT
|
|
3746
|
+
});
|
|
3747
|
+
}
|
|
3748
|
+
};
|
|
3697
3749
|
/** The full ladder, in the order a developer completes setup. */
|
|
3698
3750
|
const STATUS_STAGES = [
|
|
3699
3751
|
apiKeyStage,
|
|
@@ -3803,7 +3855,8 @@ const STATUS_STAGES = [
|
|
|
3803
3855
|
});
|
|
3804
3856
|
}
|
|
3805
3857
|
},
|
|
3806
|
-
triggerUrlStage
|
|
3858
|
+
triggerUrlStage,
|
|
3859
|
+
triggerSecretStage
|
|
3807
3860
|
];
|
|
3808
3861
|
function defaultLoadSdk(path) {
|
|
3809
3862
|
return loadConfigSdk(path, "doctor");
|
|
@@ -3855,13 +3908,15 @@ const ALIAS_STAGE_IDS = {
|
|
|
3855
3908
|
"runtime",
|
|
3856
3909
|
"boot-hook",
|
|
3857
3910
|
"setup-checks",
|
|
3858
|
-
"derived-objects"
|
|
3911
|
+
"derived-objects",
|
|
3912
|
+
"trigger-secret"
|
|
3859
3913
|
],
|
|
3860
3914
|
connect: [
|
|
3861
3915
|
"api-key",
|
|
3862
3916
|
"reachable",
|
|
3863
3917
|
"config",
|
|
3864
|
-
"trigger-url"
|
|
3918
|
+
"trigger-url",
|
|
3919
|
+
"trigger-secret"
|
|
3865
3920
|
]
|
|
3866
3921
|
};
|
|
3867
3922
|
const MARK = {
|
|
@@ -4338,7 +4393,8 @@ function previewMutations(deps, mutations, options) {
|
|
|
4338
4393
|
}
|
|
4339
4394
|
function printNextSteps(out, authComplete, loginRan, envFile, needsViteDotenv = false) {
|
|
4340
4395
|
out("\nNext steps:\n");
|
|
4341
|
-
out(loginRan ? " 1. Credentials written by `clivly login`\n" : ` 1.
|
|
4396
|
+
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`);
|
|
4397
|
+
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
4398
|
out(" 2. Local dev: run `clivly dev` for dashboard-triggered sync\n");
|
|
4343
4399
|
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
4400
|
let step = authComplete ? 3 : 4;
|
package/internal-adapter.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as CRMAdapter } from "./adapter-
|
|
1
|
+
import { t as CRMAdapter } from "./adapter-BiUN_I3u.cjs";
|
|
2
2
|
export { CRMAdapter };
|
package/internal-adapter.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as CRMAdapter } from "./adapter-
|
|
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-
|
|
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-
|
|
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/internal-types.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as
|
|
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/internal-types.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as
|
|
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
|
|
2
|
-
import { a as authCustom, i as MembershipResolver, n as ClivlyUser, r as CrmMembership, t as ClivlyAuthAdapter } from "./auth-adapter-
|
|
3
|
-
import { t as CRMAdapter } from "./adapter-
|
|
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
|
|
2
|
-
import { a as authCustom, i as MembershipResolver, n as ClivlyUser, r as CrmMembership, t as ClivlyAuthAdapter } from "./auth-adapter-
|
|
3
|
-
import { t as CRMAdapter } from "./adapter-
|
|
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.
|
|
232
|
-
*
|
|
233
|
-
*
|
|
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
|
|
@@ -359,6 +367,12 @@ interface SyncCursor {
|
|
|
359
367
|
time: Date;
|
|
360
368
|
}
|
|
361
369
|
interface SyncSource {
|
|
370
|
+
/**
|
|
371
|
+
* The column holding when a row was created (a user's signup time), so
|
|
372
|
+
* Clivly's growth charts show real history. Detected from common names
|
|
373
|
+
* (`created_at`, `createdAt`, `inserted_at`, …) when omitted.
|
|
374
|
+
*/
|
|
375
|
+
createdAtField?: string;
|
|
362
376
|
cursorField: string;
|
|
363
377
|
entity: string;
|
|
364
378
|
fetchPage(args: {
|
|
@@ -401,12 +415,19 @@ interface CursorStore {
|
|
|
401
415
|
}
|
|
402
416
|
/** @see ClivlySDK.describeSyncTrigger */
|
|
403
417
|
interface SyncTriggerDescription {
|
|
418
|
+
/** Is `syncTrigger.allowUnsigned` set? Meaningless when `hasSecret` is. */
|
|
419
|
+
allowUnsigned?: boolean;
|
|
404
420
|
/**
|
|
405
421
|
* `syncTrigger.url` exactly as configured, placeholder and all. The raw
|
|
406
422
|
* value, so a caller can say what is in the file rather than what survived
|
|
407
423
|
* resolution.
|
|
408
424
|
*/
|
|
409
425
|
configured?: string;
|
|
426
|
+
/**
|
|
427
|
+
* Is `syncTrigger.secret` set in this process? Optional only because an
|
|
428
|
+
* older SDK never reported it.
|
|
429
|
+
*/
|
|
430
|
+
hasSecret?: boolean;
|
|
410
431
|
/**
|
|
411
432
|
* The URL that would be reported to Clivly on the next heartbeat, or
|
|
412
433
|
* `undefined` when nothing resolves. An unedited placeholder never resolves.
|
|
@@ -424,6 +445,49 @@ interface RemoteProjectionsDescription {
|
|
|
424
445
|
ran: boolean;
|
|
425
446
|
skipped: number;
|
|
426
447
|
}
|
|
448
|
+
/** A consent capture for `recordConsent`. Only `email` and `granted` are required. */
|
|
449
|
+
interface ClivlyConsentInput {
|
|
450
|
+
/** Ask the person to confirm by email before the opt-in counts. */
|
|
451
|
+
doubleOptIn?: boolean;
|
|
452
|
+
email: string;
|
|
453
|
+
/** True for an opt-in, false for an opt-out. */
|
|
454
|
+
granted: boolean;
|
|
455
|
+
/** Names this capture so a retry records once, e.g. your user id + version. */
|
|
456
|
+
idempotencyKey?: string;
|
|
457
|
+
/** The visitor's IP; Clivly stores only its network (/24 or /48). */
|
|
458
|
+
ip?: string;
|
|
459
|
+
/** Where it was captured, in your words: "signup_form", "settings". */
|
|
460
|
+
label?: string;
|
|
461
|
+
/** When it happened. Defaults to when Clivly receives it. */
|
|
462
|
+
occurredAt?: Date | string;
|
|
463
|
+
/** The page the form was on. */
|
|
464
|
+
pageUrl?: string;
|
|
465
|
+
userAgent?: string;
|
|
466
|
+
/** The exact consent text the person saw, e.g. the checkbox label. */
|
|
467
|
+
wording?: string;
|
|
468
|
+
/** Your version label for that text, e.g. "2026-11 signup v3". */
|
|
469
|
+
wordingVersion?: string;
|
|
470
|
+
}
|
|
471
|
+
type ClivlyConsentResult = {
|
|
472
|
+
action: "granted" | "withdrawn";
|
|
473
|
+
ok: true;
|
|
474
|
+
status: "recorded";
|
|
475
|
+
/** An earlier unsubscribe stands; only a double opt-in lifts it. */
|
|
476
|
+
unsubscribed?: boolean;
|
|
477
|
+
} | {
|
|
478
|
+
confirmationId: string;
|
|
479
|
+
ok: true;
|
|
480
|
+
status: "pending_confirmation";
|
|
481
|
+
} | {
|
|
482
|
+
ok: true;
|
|
483
|
+
status: "rate_limited";
|
|
484
|
+
} | {
|
|
485
|
+
/** The server's explanation, when it gave one. */
|
|
486
|
+
error: string;
|
|
487
|
+
ok: false;
|
|
488
|
+
/** HTTP status; null when Clivly could not be reached. */
|
|
489
|
+
status: number | null;
|
|
490
|
+
};
|
|
427
491
|
interface ClivlySDK {
|
|
428
492
|
/**
|
|
429
493
|
* Send a single heartbeat and report the outcome richly: `ok`, the HTTP
|
|
@@ -520,6 +584,14 @@ interface ClivlySDK {
|
|
|
520
584
|
* own state.
|
|
521
585
|
*/
|
|
522
586
|
ping(): Promise<ClivlyConnectResult>;
|
|
587
|
+
/**
|
|
588
|
+
* Tell Clivly that rows of `entityKey` were deleted, by id, so their CRM
|
|
589
|
+
* records are archived within a second instead of at the daily delete
|
|
590
|
+
* check. Clivly archives, never deletes. Same contract as `pushOne`:
|
|
591
|
+
* requires `sync.instant`, never throws, never moves the delta cursor.
|
|
592
|
+
* `deleteAndPush` (from `clivly/drizzle`) does the delete and this together.
|
|
593
|
+
*/
|
|
594
|
+
pushDelete(entityKey: string, ids: readonly (string | number)[]): Promise<void>;
|
|
523
595
|
/**
|
|
524
596
|
* Push one row to Clivly immediately, instead of waiting for the next delta
|
|
525
597
|
* sync — the "instant" half of near-real-time sync (see
|
|
@@ -545,6 +617,22 @@ interface ClivlySDK {
|
|
|
545
617
|
* here blocks or awaits the caller's own write.
|
|
546
618
|
*/
|
|
547
619
|
pushOne(entityKey: string, row: Record<string, unknown>): Promise<void>;
|
|
620
|
+
/**
|
|
621
|
+
* Record a marketing opt-in or opt-out at the moment your app captures it —
|
|
622
|
+
* the sign-up checkbox, a preferences toggle. This is the strongest proof
|
|
623
|
+
* Clivly holds short of a double opt-in: what the person was shown, where,
|
|
624
|
+
* and when. Pass the exact `wording` of the checkbox; the visitor's `ip` is
|
|
625
|
+
* cut to its network before it is stored.
|
|
626
|
+
*
|
|
627
|
+
* With `doubleOptIn: true` (or the workspace's double opt-in setting on),
|
|
628
|
+
* an opt-in waits for the person to click a link Clivly emails them, and the
|
|
629
|
+
* result is `pending_confirmation`. An opt-out always applies at once and
|
|
630
|
+
* stops bulk email to that address.
|
|
631
|
+
*
|
|
632
|
+
* Never throws: inspect `ok`. Call it after your own write succeeds, and on
|
|
633
|
+
* serverless wrap it in `ctx.waitUntil(...)`.
|
|
634
|
+
*/
|
|
635
|
+
recordConsent(input: ClivlyConsentInput): Promise<ClivlyConsentResult>;
|
|
548
636
|
/**
|
|
549
637
|
* One-shot heartbeat + a single sync, with no keep-alive timers. The correct
|
|
550
638
|
* entry point on serverless/edge (Workers, Vercel, Lambda), where `start()`'s
|
|
@@ -619,4 +707,4 @@ interface NamespaceIntrospector {
|
|
|
619
707
|
/** Prove a table is genuinely selectable (SELECT ... LIMIT 1). Throws if unreachable/denied. */
|
|
620
708
|
sampleSelect(table: string): Promise<void>;
|
|
621
709
|
}
|
|
622
|
-
export {
|
|
710
|
+
export { ExposurePolicy as S, EnsuredMappingResult as _, ClivlyConnectResult as a, SyncSource as b, ClivlySDK as c, CreateChatSessionHandlerOptions as d, CursorStore as f, EnsureSchemaResult as g, DoctorReport as h, ClivlyConnectReason as i, ClivlySDKConfig as l, DoctorCheck as m, ChatSessionRequestBody as n, ClivlyConsentInput as o, DiscoveredTable as p, ChatWidgetVisitor as r, ClivlyConsentResult as s, NamespaceIntrospector as t, ClivlyUser as u, EnsuredObjectTypeResult as v, SyncTriggerDescription as x, RemoteProjectionsDescription as y };
|
|
@@ -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.
|
|
232
|
-
*
|
|
233
|
-
*
|
|
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
|
|
@@ -359,6 +367,12 @@ interface SyncCursor {
|
|
|
359
367
|
time: Date;
|
|
360
368
|
}
|
|
361
369
|
interface SyncSource {
|
|
370
|
+
/**
|
|
371
|
+
* The column holding when a row was created (a user's signup time), so
|
|
372
|
+
* Clivly's growth charts show real history. Detected from common names
|
|
373
|
+
* (`created_at`, `createdAt`, `inserted_at`, …) when omitted.
|
|
374
|
+
*/
|
|
375
|
+
createdAtField?: string;
|
|
362
376
|
cursorField: string;
|
|
363
377
|
entity: string;
|
|
364
378
|
fetchPage(args: {
|
|
@@ -401,12 +415,19 @@ interface CursorStore {
|
|
|
401
415
|
}
|
|
402
416
|
/** @see ClivlySDK.describeSyncTrigger */
|
|
403
417
|
interface SyncTriggerDescription {
|
|
418
|
+
/** Is `syncTrigger.allowUnsigned` set? Meaningless when `hasSecret` is. */
|
|
419
|
+
allowUnsigned?: boolean;
|
|
404
420
|
/**
|
|
405
421
|
* `syncTrigger.url` exactly as configured, placeholder and all. The raw
|
|
406
422
|
* value, so a caller can say what is in the file rather than what survived
|
|
407
423
|
* resolution.
|
|
408
424
|
*/
|
|
409
425
|
configured?: string;
|
|
426
|
+
/**
|
|
427
|
+
* Is `syncTrigger.secret` set in this process? Optional only because an
|
|
428
|
+
* older SDK never reported it.
|
|
429
|
+
*/
|
|
430
|
+
hasSecret?: boolean;
|
|
410
431
|
/**
|
|
411
432
|
* The URL that would be reported to Clivly on the next heartbeat, or
|
|
412
433
|
* `undefined` when nothing resolves. An unedited placeholder never resolves.
|
|
@@ -424,6 +445,49 @@ interface RemoteProjectionsDescription {
|
|
|
424
445
|
ran: boolean;
|
|
425
446
|
skipped: number;
|
|
426
447
|
}
|
|
448
|
+
/** A consent capture for `recordConsent`. Only `email` and `granted` are required. */
|
|
449
|
+
interface ClivlyConsentInput {
|
|
450
|
+
/** Ask the person to confirm by email before the opt-in counts. */
|
|
451
|
+
doubleOptIn?: boolean;
|
|
452
|
+
email: string;
|
|
453
|
+
/** True for an opt-in, false for an opt-out. */
|
|
454
|
+
granted: boolean;
|
|
455
|
+
/** Names this capture so a retry records once, e.g. your user id + version. */
|
|
456
|
+
idempotencyKey?: string;
|
|
457
|
+
/** The visitor's IP; Clivly stores only its network (/24 or /48). */
|
|
458
|
+
ip?: string;
|
|
459
|
+
/** Where it was captured, in your words: "signup_form", "settings". */
|
|
460
|
+
label?: string;
|
|
461
|
+
/** When it happened. Defaults to when Clivly receives it. */
|
|
462
|
+
occurredAt?: Date | string;
|
|
463
|
+
/** The page the form was on. */
|
|
464
|
+
pageUrl?: string;
|
|
465
|
+
userAgent?: string;
|
|
466
|
+
/** The exact consent text the person saw, e.g. the checkbox label. */
|
|
467
|
+
wording?: string;
|
|
468
|
+
/** Your version label for that text, e.g. "2026-11 signup v3". */
|
|
469
|
+
wordingVersion?: string;
|
|
470
|
+
}
|
|
471
|
+
type ClivlyConsentResult = {
|
|
472
|
+
action: "granted" | "withdrawn";
|
|
473
|
+
ok: true;
|
|
474
|
+
status: "recorded";
|
|
475
|
+
/** An earlier unsubscribe stands; only a double opt-in lifts it. */
|
|
476
|
+
unsubscribed?: boolean;
|
|
477
|
+
} | {
|
|
478
|
+
confirmationId: string;
|
|
479
|
+
ok: true;
|
|
480
|
+
status: "pending_confirmation";
|
|
481
|
+
} | {
|
|
482
|
+
ok: true;
|
|
483
|
+
status: "rate_limited";
|
|
484
|
+
} | {
|
|
485
|
+
/** The server's explanation, when it gave one. */
|
|
486
|
+
error: string;
|
|
487
|
+
ok: false;
|
|
488
|
+
/** HTTP status; null when Clivly could not be reached. */
|
|
489
|
+
status: number | null;
|
|
490
|
+
};
|
|
427
491
|
interface ClivlySDK {
|
|
428
492
|
/**
|
|
429
493
|
* Send a single heartbeat and report the outcome richly: `ok`, the HTTP
|
|
@@ -520,6 +584,14 @@ interface ClivlySDK {
|
|
|
520
584
|
* own state.
|
|
521
585
|
*/
|
|
522
586
|
ping(): Promise<ClivlyConnectResult>;
|
|
587
|
+
/**
|
|
588
|
+
* Tell Clivly that rows of `entityKey` were deleted, by id, so their CRM
|
|
589
|
+
* records are archived within a second instead of at the daily delete
|
|
590
|
+
* check. Clivly archives, never deletes. Same contract as `pushOne`:
|
|
591
|
+
* requires `sync.instant`, never throws, never moves the delta cursor.
|
|
592
|
+
* `deleteAndPush` (from `clivly/drizzle`) does the delete and this together.
|
|
593
|
+
*/
|
|
594
|
+
pushDelete(entityKey: string, ids: readonly (string | number)[]): Promise<void>;
|
|
523
595
|
/**
|
|
524
596
|
* Push one row to Clivly immediately, instead of waiting for the next delta
|
|
525
597
|
* sync — the "instant" half of near-real-time sync (see
|
|
@@ -545,6 +617,22 @@ interface ClivlySDK {
|
|
|
545
617
|
* here blocks or awaits the caller's own write.
|
|
546
618
|
*/
|
|
547
619
|
pushOne(entityKey: string, row: Record<string, unknown>): Promise<void>;
|
|
620
|
+
/**
|
|
621
|
+
* Record a marketing opt-in or opt-out at the moment your app captures it —
|
|
622
|
+
* the sign-up checkbox, a preferences toggle. This is the strongest proof
|
|
623
|
+
* Clivly holds short of a double opt-in: what the person was shown, where,
|
|
624
|
+
* and when. Pass the exact `wording` of the checkbox; the visitor's `ip` is
|
|
625
|
+
* cut to its network before it is stored.
|
|
626
|
+
*
|
|
627
|
+
* With `doubleOptIn: true` (or the workspace's double opt-in setting on),
|
|
628
|
+
* an opt-in waits for the person to click a link Clivly emails them, and the
|
|
629
|
+
* result is `pending_confirmation`. An opt-out always applies at once and
|
|
630
|
+
* stops bulk email to that address.
|
|
631
|
+
*
|
|
632
|
+
* Never throws: inspect `ok`. Call it after your own write succeeds, and on
|
|
633
|
+
* serverless wrap it in `ctx.waitUntil(...)`.
|
|
634
|
+
*/
|
|
635
|
+
recordConsent(input: ClivlyConsentInput): Promise<ClivlyConsentResult>;
|
|
548
636
|
/**
|
|
549
637
|
* One-shot heartbeat + a single sync, with no keep-alive timers. The correct
|
|
550
638
|
* entry point on serverless/edge (Workers, Vercel, Lambda), where `start()`'s
|
|
@@ -619,4 +707,4 @@ interface NamespaceIntrospector {
|
|
|
619
707
|
/** Prove a table is genuinely selectable (SELECT ... LIMIT 1). Throws if unreachable/denied. */
|
|
620
708
|
sampleSelect(table: string): Promise<void>;
|
|
621
709
|
}
|
|
622
|
-
export {
|
|
710
|
+
export { ExposurePolicy as S, EnsuredMappingResult as _, ClivlyConnectResult as a, SyncSource as b, ClivlySDK as c, CreateChatSessionHandlerOptions as d, CursorStore as f, EnsureSchemaResult as g, DoctorReport as h, ClivlyConnectReason as i, ClivlySDKConfig as l, DoctorCheck as m, ChatSessionRequestBody as n, ClivlyConsentInput as o, DiscoveredTable as p, ChatWidgetVisitor as r, ClivlyConsentResult as s, NamespaceIntrospector as t, ClivlyUser as u, EnsuredObjectTypeResult as v, SyncTriggerDescription as x, RemoteProjectionsDescription as y };
|