clivly 0.20.0 → 0.22.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 (135) hide show
  1. package/{adapter-BXykDFyG.d.mts → adapter-B4v4dwgD.d.mts} +1 -1
  2. package/{adapter-BiUN_I3u.d.cts → adapter-BK3gsby5.d.cts} +1 -1
  3. package/{auth-adapter-BNvri2gX.d.mts → auth-adapter-BIa-ZyVV.d.mts} +1 -1
  4. package/{auth-adapter-D2MUT1Hk.d.cts → auth-adapter-DwtMJb7D.d.cts} +1 -1
  5. package/auth-better-auth.d.cts +1 -1
  6. package/auth-better-auth.d.mts +1 -1
  7. package/auth-clerk.d.cts +1 -1
  8. package/auth-clerk.d.mts +1 -1
  9. package/auth-workos.d.cts +1 -1
  10. package/auth-workos.d.mts +1 -1
  11. package/core-adapter.d.cts +2 -1
  12. package/core-adapter.d.mts +2 -1
  13. package/core-auth-adapter.d.cts +2 -1
  14. package/core-auth-adapter.d.mts +2 -1
  15. package/core-drizzle.d.cts +1 -1
  16. package/core-drizzle.d.mts +1 -1
  17. package/core-entity-config.cjs +1 -1
  18. package/core-entity-config.d.cts +2 -1
  19. package/core-entity-config.d.mts +2 -1
  20. package/core-entity-config.mjs +1 -1
  21. package/core-entity-heuristics.cjs +1 -1
  22. package/core-entity-heuristics.d.cts +1 -1
  23. package/core-entity-heuristics.d.mts +1 -1
  24. package/core-entity-heuristics.mjs +1 -1
  25. package/core-mapping-form.d.cts +2 -1
  26. package/core-mapping-form.d.mts +2 -1
  27. package/core-mappings-config.cjs +1 -1
  28. package/core-mappings-config.d.cts +2 -1
  29. package/core-mappings-config.d.mts +2 -1
  30. package/core-mappings-config.mjs +1 -1
  31. package/core-sync-engine.cjs +1 -1
  32. package/core-sync-engine.d.cts +2 -1
  33. package/core-sync-engine.d.mts +2 -1
  34. package/core-sync-engine.mjs +1 -1
  35. package/core-types.d.cts +2 -1
  36. package/core-types.d.mts +2 -1
  37. package/core-view-compiler.cjs +1 -1
  38. package/core-view-compiler.d.cts +2 -1
  39. package/core-view-compiler.d.mts +2 -1
  40. package/core-view-compiler.mjs +1 -1
  41. package/core.cjs +7 -7
  42. package/core.d.cts +11 -11
  43. package/core.d.mts +11 -11
  44. package/core.mjs +7 -7
  45. package/{drizzle-B9cjBavj.d.cts → drizzle-BNHGQXiY.d.cts} +1 -1
  46. package/{drizzle-L5FOGe_-.d.mts → drizzle-DFe7ILmd.d.mts} +1 -1
  47. package/drizzle.cjs +2 -2
  48. package/drizzle.d.cts +4 -3
  49. package/drizzle.d.mts +4 -3
  50. package/drizzle.mjs +2 -2
  51. package/{entity-config-DiCJ6mhI.cjs → entity-config-BP8Cc_nC.cjs} +54 -53
  52. package/{entity-config-g_oMPXlN.mjs → entity-config-CI5CGfaN.mjs} +54 -53
  53. package/{entity-config-X-KlnYXX.d.mts → entity-config-CXpGowQa.d.cts} +339 -339
  54. package/{entity-config-dNclLyBM.d.cts → entity-config-CXpGowQa.d.mts} +339 -339
  55. package/{entity-heuristics-DE5ujoHw.mjs → entity-heuristics-DAxqagJA.mjs} +1 -1
  56. package/{entity-heuristics-CIParuQe.cjs → entity-heuristics-DNmrcd0b.cjs} +1 -1
  57. package/index-Bh7o2J7K.d.mts +308 -0
  58. package/index-DRRTE5IJ.d.cts +308 -0
  59. package/index.cjs +53 -8
  60. package/index.mjs +53 -8
  61. package/{internal-9oDwwbNg.mjs → internal-BAw1MCMV.mjs} +99 -10
  62. package/{internal-COALpgov.d.cts → internal-CdfVkh4O.d.mts} +46 -132
  63. package/{internal-D3q4FPcA.d.mts → internal-D7qVRIFb.d.cts} +46 -132
  64. package/{internal-BKYt5j0l.cjs → internal-D88LTRlu.cjs} +99 -10
  65. package/internal-adapter.d.cts +1 -1
  66. package/internal-adapter.d.mts +1 -1
  67. package/internal-auth-adapter.d.cts +1 -1
  68. package/internal-auth-adapter.d.mts +1 -1
  69. package/internal-drizzle.d.cts +1 -1
  70. package/internal-drizzle.d.mts +1 -1
  71. package/internal-entity-config.cjs +1 -1
  72. package/internal-entity-config.d.cts +1 -1
  73. package/internal-entity-config.d.mts +1 -1
  74. package/internal-entity-config.mjs +1 -1
  75. package/internal-entity-heuristics.cjs +1 -1
  76. package/internal-entity-heuristics.d.cts +1 -1
  77. package/internal-entity-heuristics.d.mts +1 -1
  78. package/internal-entity-heuristics.mjs +1 -1
  79. package/internal-mapping-form.d.cts +1 -1
  80. package/internal-mapping-form.d.mts +1 -1
  81. package/internal-mappings-config.cjs +1 -1
  82. package/internal-mappings-config.d.cts +1 -1
  83. package/internal-mappings-config.d.mts +1 -1
  84. package/internal-mappings-config.mjs +1 -1
  85. package/internal-sync-engine.cjs +1 -1
  86. package/internal-sync-engine.d.cts +1 -1
  87. package/internal-sync-engine.d.mts +1 -1
  88. package/internal-sync-engine.mjs +1 -1
  89. package/internal-types.d.cts +1 -1
  90. package/internal-types.d.mts +1 -1
  91. package/internal-view-compiler.cjs +1 -1
  92. package/internal-view-compiler.d.cts +1 -1
  93. package/internal-view-compiler.d.mts +1 -1
  94. package/internal-view-compiler.mjs +1 -1
  95. package/internal.cjs +7 -7
  96. package/internal.d.cts +11 -11
  97. package/internal.d.mts +11 -11
  98. package/internal.mjs +7 -7
  99. package/{mapping-form-Bpvgf5b8.d.mts → mapping-form-Bg_hgNoL.d.cts} +1 -1
  100. package/{mapping-form-CV7y6qox.d.cts → mapping-form-KHUlnC7A.d.mts} +1 -1
  101. package/{mappings-config-CNxBrbt9.cjs → mappings-config-CC-vltWb.cjs} +1 -1
  102. package/{mappings-config-BBppW9fp.d.cts → mappings-config-DNo_Cum_.d.cts} +1 -1
  103. package/{mappings-config-D_g20PyS.mjs → mappings-config-Opw7ZM6Y.mjs} +1 -1
  104. package/{mappings-config-Dmm0H6p_.d.mts → mappings-config-wAe-p1rG.d.mts} +1 -1
  105. package/{namespace-probe-C1tm5rGh.d.cts → namespace-probe-Dh6LFwfo.d.cts} +9 -2
  106. package/{namespace-probe-ah2awcHO.d.mts → namespace-probe-xESu83KG.d.mts} +9 -2
  107. package/package.json +6 -4
  108. package/projection-CzBI2NL8.mjs +95 -0
  109. package/{projection-sql-CHz7KzNS.cjs → projection-sql-BkrHR2ea.cjs} +1 -1
  110. package/{projection-sql-C3gZE3GS.mjs → projection-sql-DQQdjw9I.mjs} +1 -1
  111. package/projection-w4Z6vSL2.cjs +118 -0
  112. package/{sdk-ChyrSl32.mjs → sdk-DfdHv-S9.mjs} +154 -13
  113. package/{sdk-BEHVvB18.cjs → sdk-oUjl5HNU.cjs} +154 -13
  114. package/sdk.cjs +2 -2
  115. package/sdk.d.cts +2 -2
  116. package/sdk.d.mts +2 -2
  117. package/sdk.mjs +2 -2
  118. package/{sync-engine-C7W0Gkq0.d.cts → sync-engine-DCjTr2XQ.d.cts} +2 -2
  119. package/{sync-engine-Di-vF26b.cjs → sync-engine-DNSoZeo0.cjs} +1 -1
  120. package/{sync-engine-C9Q2FkR9.d.mts → sync-engine-UNORma7f.d.mts} +2 -2
  121. package/{sync-engine-CwdLkmch.mjs → sync-engine-yFLEyId3.mjs} +1 -1
  122. package/{types-C08UluBS.d.cts → types-BBfwsDxe.d.cts} +13 -7
  123. package/{types-CZsSYbeC.d.mts → types-BBfwsDxe.d.mts} +13 -7
  124. package/{view-compiler-M23WiVGG.d.mts → view-compiler-BDD93Luw.d.cts} +1 -1
  125. package/{view-compiler-CLTi1VL-.mjs → view-compiler-CSHSqZl7.mjs} +2 -2
  126. package/{view-compiler-cXqt4X-c.d.cts → view-compiler-CSNhmCY2.d.mts} +1 -1
  127. package/{view-compiler-DaOz5QVl.cjs → view-compiler-NqiortOA.cjs} +2 -2
  128. package/vite.d.cts +1 -1
  129. package/vite.d.mts +1 -1
  130. package/integration-state-xK4PLm5T.d.cts +0 -171
  131. package/integration-state-xK4PLm5T.d.mts +0 -171
  132. package/projection-BkYXvjTr.mjs +0 -5587
  133. package/projection-By63gMC-.cjs +0 -5670
  134. package/schemas-BSuo_eZQ.d.cts +0 -2160
  135. package/schemas-BSuo_eZQ.d.mts +0 -2160
@@ -1,8 +1,8 @@
1
- import { d as output, f as $strict, l as ZodString, o as ZodObject, r as ZodEnum, s as ZodOptional, t as ZodArray } from "./schemas-BSuo_eZQ.mjs";
1
+ import { z } from "zod";
2
2
  /** AND conditions over deliberately mapped host fields, never SQL identifiers. */
3
- declare const contactSegmentSchema: ZodArray<ZodObject<{
4
- field: ZodString;
5
- operator: ZodEnum<{
3
+ declare const contactSegmentSchema: z.ZodArray<z.ZodObject<{
4
+ field: z.ZodString;
5
+ operator: z.ZodEnum<{
6
6
  equals: "equals";
7
7
  not_equals: "not_equals";
8
8
  contains: "contains";
@@ -13,9 +13,9 @@ declare const contactSegmentSchema: ZodArray<ZodObject<{
13
13
  is_set: "is_set";
14
14
  is_not_set: "is_not_set";
15
15
  }>;
16
- value: ZodOptional<ZodString>;
17
- }, $strict>>;
18
- type ContactSegment = output<typeof contactSegmentSchema>;
16
+ value: z.ZodOptional<z.ZodString>;
17
+ }, z.core.$strict>>;
18
+ type ContactSegment = z.infer<typeof contactSegmentSchema>;
19
19
  type ContactStatus = "lead" | "active" | "customer" | "churned";
20
20
  type DealStage = string;
21
21
  type StageType = "open" | "won" | "lost";
@@ -299,6 +299,12 @@ interface CreateActivityInput {
299
299
  type RecordSource = "all" | "synced";
300
300
  interface ContactFilters {
301
301
  companyId?: string;
302
+ /**
303
+ * Only these contacts (an explicit recipient list, e.g. a sequence step's
304
+ * due enrolments). Combined with every other filter; an empty list matches
305
+ * nobody.
306
+ */
307
+ contactIds?: readonly string[];
302
308
  /**
303
309
  * Exclude archived rows. Defaults to false — the adapter returns everything
304
310
  * — because most callers are lookup maps, not user-facing lists:
@@ -1,4 +1,4 @@
1
- import { a as ClivlyEntitiesConfig } from "./entity-config-X-KlnYXX.mjs";
1
+ import { a as ClivlyEntitiesConfig } from "./entity-config-CXpGowQa.cjs";
2
2
  declare const DEFAULT_VIEW_PREFIX = "crm_src_";
3
3
  interface CompileOptions {
4
4
  /**
@@ -1,5 +1,5 @@
1
- import { t as BASE_REF } from "./projection-BkYXvjTr.mjs";
2
- import { i as compileProjectionJoins, n as compileProjectionFrom, o as compileProjectionSelect, s as quoteIdent } from "./projection-sql-C3gZE3GS.mjs";
1
+ import { t as BASE_REF } from "./projection-CzBI2NL8.mjs";
2
+ import { i as compileProjectionJoins, n as compileProjectionFrom, o as compileProjectionSelect, s as quoteIdent } from "./projection-sql-DQQdjw9I.mjs";
3
3
  // ../core/src/view-compiler.ts
4
4
  /**
5
5
  * View compiler (Phase 2) — turns a validated entity config into read-only
@@ -1,4 +1,4 @@
1
- import { a as ClivlyEntitiesConfig } from "./entity-config-dNclLyBM.cjs";
1
+ import { a as ClivlyEntitiesConfig } from "./entity-config-CXpGowQa.mjs";
2
2
  declare const DEFAULT_VIEW_PREFIX = "crm_src_";
3
3
  interface CompileOptions {
4
4
  /**
@@ -1,5 +1,5 @@
1
- const require_projection = require("./projection-By63gMC-.cjs");
2
- const require_projection_sql = require("./projection-sql-CHz7KzNS.cjs");
1
+ const require_projection = require("./projection-w4Z6vSL2.cjs");
2
+ const require_projection_sql = require("./projection-sql-BkrHR2ea.cjs");
3
3
  // ../core/src/view-compiler.ts
4
4
  /**
5
5
  * View compiler (Phase 2) — turns a validated entity config into read-only
package/vite.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { c as ClivlySDK } from "./namespace-probe-C1tm5rGh.cjs";
1
+ import { c as ClivlySDK } from "./namespace-probe-Dh6LFwfo.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 { c as ClivlySDK } from "./namespace-probe-ah2awcHO.mjs";
1
+ import { c as ClivlySDK } from "./namespace-probe-xESu83KG.mjs";
2
2
  import { Plugin } from "vite";
3
3
  export interface ClivlyViteOptions {
4
4
  /** Log prefix for Clivly's boot lines. Defaults to "clivly". */
@@ -1,171 +0,0 @@
1
- declare const INTEGRATION_STEPS: readonly ["credential", "application", "schema", "mapping", "trigger", "sync", "widget"];
2
- type StepId = (typeof INTEGRATION_STEPS)[number];
3
- /** `blocked` means "prerequisite unmet", never "broken" — see C-19. */
4
- type StepState = "done" | "active" | "blocked" | "failed" | "skipped";
5
- type IntegrationStatus = "not_configured" | "sdk_installed" | "awaiting_connection" | "connected" | "schema_discovered" | "mapping_required" | "trigger_required" | "ready_to_sync" | "syncing" | "healthy" | "warning" | "error" |
6
- /**
7
- * @deprecated No longer derived. Liveness is its own dimension — read
8
- * `ConnectionHealth` from `deriveLiveness`. Setup progress does not move
9
- * backwards just because an app stopped running.
10
- */
11
- "disconnected";
12
- interface RunFact {
13
- at: number;
14
- message?: string;
15
- ok: boolean;
16
- /**
17
- * The HTTP status the host answered with, when there was one.
18
- *
19
- * Absent for a run that failed before any response existed, and for callers
20
- * that do not track it — so every read must treat `undefined` as "unknown",
21
- * never as "fine".
22
- */
23
- status?: number;
24
- }
25
- /**
26
- * Where the reporting app is running, as the app itself understands it.
27
- *
28
- * `unknown` is a real value, not an absence: `detectHostEnvironment` refuses to
29
- * guess when nothing places the app, and a bare `node server.js` with no
30
- * NODE_ENV must still be able to connect and be shown as itself. Defaulting
31
- * such a host to `local_dev` would file a production box's faults under local
32
- * development, where nobody would look for them.
33
- */
34
- type HostEnvironment = "local_dev" | "preview" | "production" | "unknown";
35
- interface IntegrationFacts {
36
- discoveredTableCount: number;
37
- /** The environment the app reported on its last heartbeat. */
38
- environment?: HostEnvironment | null;
39
- /**
40
- * Has this app ever checked in? Distinguishes "never installed" from "was
41
- * working, now silent" — the same absent heartbeat means different things,
42
- * and only one of them is diagnosed rather than set up.
43
- */
44
- everConnected: boolean;
45
- hasCredential: boolean;
46
- /**
47
- * The cadence the app said it heartbeats at. Liveness windows are multiples
48
- * of this rather than a fixed constant, so an app that deliberately reports
49
- * slowly is not called dead for obeying its own configuration.
50
- */
51
- heartbeatIntervalMs?: number | null;
52
- lastHeartbeatAt: number | null;
53
- lastRun: RunFact | null;
54
- /**
55
- * Whether any entity is mapped, expressed as a number for historical
56
- * reasons — every producer sets it to 0 or 1, never a real total. Read it as
57
- * a flag (`> 0`) and never render it as a quantity: doing so reported "1
58
- * entity mapped" to a workspace with three. The true count lives on the
59
- * mappings list, which the What syncs tab reads directly.
60
- */
61
- mappedEntityCount: number;
62
- now: number;
63
- /**
64
- * Deployment presence, when this deployment has one. Absent or `http`
65
- * transport keeps the cadence-derived behaviour every SDK in the field uses.
66
- */
67
- presence?: DeploymentPresence | null;
68
- /**
69
- * The result of Clivly asking the app directly whether it is up.
70
- *
71
- * Every other signal here is *pushed* by the app. On a serverless host there
72
- * is no process between requests to push anything: the SDK's heartbeat timer
73
- * fires once at boot and is then frozen, so cadence alone reports a perfectly
74
- * healthy deployment as offline forever. A probe inverts that — Clivly asks,
75
- * and a host that answers is up by definition.
76
- *
77
- * Absent keeps the pure cadence behaviour, so nothing changes for apps that
78
- * do hold a long-lived process.
79
- */
80
- reachabilityProbe?: ReachabilityProbe | null;
81
- /**
82
- * Faults the running app diagnosed about itself on its last heartbeat — an
83
- * unreadable database, a secret missing from the process environment. These
84
- * are what make a reachable app `live_with_issues`; unfinished setup is not.
85
- */
86
- reportedIssues?: StepProblem[];
87
- syncInFlight: boolean;
88
- /** A trigger URL and secret both exist, so Clivly can ask the app to sync. */
89
- triggerConfigured: boolean;
90
- warnings: string[];
91
- widgetInstalled: boolean;
92
- }
93
- interface StepProblem {
94
- code: string;
95
- fix: string;
96
- message: string;
97
- }
98
- interface IntegrationStep {
99
- blockedBy: StepId | null;
100
- evidence: string | null;
101
- id: StepId;
102
- label: string;
103
- problem: StepProblem | null;
104
- state: StepState;
105
- }
106
- type ConnectionHealth = "live" | "live_with_issues" | "stale" | "offline";
107
- /**
108
- * Clivly's own answer to "is this app up", obtained by asking it rather than
109
- * waiting to be told.
110
- *
111
- * `reachable` is deliberately about the *connection*, not the response body: an
112
- * app that answers `401` has proved it is running just as conclusively as one
113
- * that answers `200`. Only silence — a timeout, a refused connection, DNS that
114
- * does not resolve — means offline.
115
- */
116
- interface ReachabilityProbe {
117
- /** When Clivly performed the check. Probe results are cached, so this ages. */
118
- checkedAt: number;
119
- /** Did anything answer at the other end? */
120
- reachable: boolean;
121
- }
122
- /** Which algorithm decides whether this deployment is up. */
123
- type PresenceTransport = "websocket" | "http";
124
- type PresenceConnectionState = "connected" | "reconnecting" | "disconnected";
125
- /**
126
- * A deployment's connection state as its `PresenceRoom` last persisted it.
127
- *
128
- * This exists because a socket has an explicit state and a timestamp does not.
129
- * Deriving WebSocket liveness from heartbeat age would leave a disconnected app
130
- * shown as live for 150 seconds and offline only after ten minutes, which is
131
- * the whole reason this transport exists.
132
- */
133
- interface DeploymentPresence {
134
- /** Sockets currently accepted in the room. */
135
- activeInstanceCount: number;
136
- connectionState: PresenceConnectionState;
137
- transport: PresenceTransport;
138
- }
139
- interface ConnectionLiveness {
140
- /** `"8s ago"`, or `"No heartbeat yet"` when the app has never reported. */
141
- ageLabel: string;
142
- ageMs: number | null;
143
- environment: HostEnvironment | null;
144
- health: ConnectionHealth;
145
- /**
146
- * Faults on a reachable app. Empty unless `health` is `live_with_issues`.
147
- */
148
- issues: StepProblem[];
149
- /** Present when a deployment-presence record supplied this liveness result. */
150
- presence?: Pick<DeploymentPresence, "connectionState" | "transport">;
151
- /** Is a heartbeat recent enough to speak for the app as it is right now? */
152
- reachable: boolean;
153
- }
154
- interface NextAction {
155
- command: string | null;
156
- envFile: string | null;
157
- label: string;
158
- }
159
- interface IntegrationState {
160
- /**
161
- * Is the app running right now. Deliberately alongside `status` rather than
162
- * folded into it: a surface must be able to say "setup reached mapping" and
163
- * "the app is offline" in the same breath without either overwriting the
164
- * other.
165
- */
166
- liveness: ConnectionLiveness;
167
- next: NextAction | null;
168
- status: IntegrationStatus;
169
- steps: IntegrationStep[];
170
- }
171
- export { IntegrationStep as a, StepProblem as c, IntegrationStatus as i, StepState as l, IntegrationFacts as n, NextAction as o, IntegrationState as r, StepId as s, ConnectionLiveness as t };
@@ -1,171 +0,0 @@
1
- declare const INTEGRATION_STEPS: readonly ["credential", "application", "schema", "mapping", "trigger", "sync", "widget"];
2
- type StepId = (typeof INTEGRATION_STEPS)[number];
3
- /** `blocked` means "prerequisite unmet", never "broken" — see C-19. */
4
- type StepState = "done" | "active" | "blocked" | "failed" | "skipped";
5
- type IntegrationStatus = "not_configured" | "sdk_installed" | "awaiting_connection" | "connected" | "schema_discovered" | "mapping_required" | "trigger_required" | "ready_to_sync" | "syncing" | "healthy" | "warning" | "error" |
6
- /**
7
- * @deprecated No longer derived. Liveness is its own dimension — read
8
- * `ConnectionHealth` from `deriveLiveness`. Setup progress does not move
9
- * backwards just because an app stopped running.
10
- */
11
- "disconnected";
12
- interface RunFact {
13
- at: number;
14
- message?: string;
15
- ok: boolean;
16
- /**
17
- * The HTTP status the host answered with, when there was one.
18
- *
19
- * Absent for a run that failed before any response existed, and for callers
20
- * that do not track it — so every read must treat `undefined` as "unknown",
21
- * never as "fine".
22
- */
23
- status?: number;
24
- }
25
- /**
26
- * Where the reporting app is running, as the app itself understands it.
27
- *
28
- * `unknown` is a real value, not an absence: `detectHostEnvironment` refuses to
29
- * guess when nothing places the app, and a bare `node server.js` with no
30
- * NODE_ENV must still be able to connect and be shown as itself. Defaulting
31
- * such a host to `local_dev` would file a production box's faults under local
32
- * development, where nobody would look for them.
33
- */
34
- type HostEnvironment = "local_dev" | "preview" | "production" | "unknown";
35
- interface IntegrationFacts {
36
- discoveredTableCount: number;
37
- /** The environment the app reported on its last heartbeat. */
38
- environment?: HostEnvironment | null;
39
- /**
40
- * Has this app ever checked in? Distinguishes "never installed" from "was
41
- * working, now silent" — the same absent heartbeat means different things,
42
- * and only one of them is diagnosed rather than set up.
43
- */
44
- everConnected: boolean;
45
- hasCredential: boolean;
46
- /**
47
- * The cadence the app said it heartbeats at. Liveness windows are multiples
48
- * of this rather than a fixed constant, so an app that deliberately reports
49
- * slowly is not called dead for obeying its own configuration.
50
- */
51
- heartbeatIntervalMs?: number | null;
52
- lastHeartbeatAt: number | null;
53
- lastRun: RunFact | null;
54
- /**
55
- * Whether any entity is mapped, expressed as a number for historical
56
- * reasons — every producer sets it to 0 or 1, never a real total. Read it as
57
- * a flag (`> 0`) and never render it as a quantity: doing so reported "1
58
- * entity mapped" to a workspace with three. The true count lives on the
59
- * mappings list, which the What syncs tab reads directly.
60
- */
61
- mappedEntityCount: number;
62
- now: number;
63
- /**
64
- * Deployment presence, when this deployment has one. Absent or `http`
65
- * transport keeps the cadence-derived behaviour every SDK in the field uses.
66
- */
67
- presence?: DeploymentPresence | null;
68
- /**
69
- * The result of Clivly asking the app directly whether it is up.
70
- *
71
- * Every other signal here is *pushed* by the app. On a serverless host there
72
- * is no process between requests to push anything: the SDK's heartbeat timer
73
- * fires once at boot and is then frozen, so cadence alone reports a perfectly
74
- * healthy deployment as offline forever. A probe inverts that — Clivly asks,
75
- * and a host that answers is up by definition.
76
- *
77
- * Absent keeps the pure cadence behaviour, so nothing changes for apps that
78
- * do hold a long-lived process.
79
- */
80
- reachabilityProbe?: ReachabilityProbe | null;
81
- /**
82
- * Faults the running app diagnosed about itself on its last heartbeat — an
83
- * unreadable database, a secret missing from the process environment. These
84
- * are what make a reachable app `live_with_issues`; unfinished setup is not.
85
- */
86
- reportedIssues?: StepProblem[];
87
- syncInFlight: boolean;
88
- /** A trigger URL and secret both exist, so Clivly can ask the app to sync. */
89
- triggerConfigured: boolean;
90
- warnings: string[];
91
- widgetInstalled: boolean;
92
- }
93
- interface StepProblem {
94
- code: string;
95
- fix: string;
96
- message: string;
97
- }
98
- interface IntegrationStep {
99
- blockedBy: StepId | null;
100
- evidence: string | null;
101
- id: StepId;
102
- label: string;
103
- problem: StepProblem | null;
104
- state: StepState;
105
- }
106
- type ConnectionHealth = "live" | "live_with_issues" | "stale" | "offline";
107
- /**
108
- * Clivly's own answer to "is this app up", obtained by asking it rather than
109
- * waiting to be told.
110
- *
111
- * `reachable` is deliberately about the *connection*, not the response body: an
112
- * app that answers `401` has proved it is running just as conclusively as one
113
- * that answers `200`. Only silence — a timeout, a refused connection, DNS that
114
- * does not resolve — means offline.
115
- */
116
- interface ReachabilityProbe {
117
- /** When Clivly performed the check. Probe results are cached, so this ages. */
118
- checkedAt: number;
119
- /** Did anything answer at the other end? */
120
- reachable: boolean;
121
- }
122
- /** Which algorithm decides whether this deployment is up. */
123
- type PresenceTransport = "websocket" | "http";
124
- type PresenceConnectionState = "connected" | "reconnecting" | "disconnected";
125
- /**
126
- * A deployment's connection state as its `PresenceRoom` last persisted it.
127
- *
128
- * This exists because a socket has an explicit state and a timestamp does not.
129
- * Deriving WebSocket liveness from heartbeat age would leave a disconnected app
130
- * shown as live for 150 seconds and offline only after ten minutes, which is
131
- * the whole reason this transport exists.
132
- */
133
- interface DeploymentPresence {
134
- /** Sockets currently accepted in the room. */
135
- activeInstanceCount: number;
136
- connectionState: PresenceConnectionState;
137
- transport: PresenceTransport;
138
- }
139
- interface ConnectionLiveness {
140
- /** `"8s ago"`, or `"No heartbeat yet"` when the app has never reported. */
141
- ageLabel: string;
142
- ageMs: number | null;
143
- environment: HostEnvironment | null;
144
- health: ConnectionHealth;
145
- /**
146
- * Faults on a reachable app. Empty unless `health` is `live_with_issues`.
147
- */
148
- issues: StepProblem[];
149
- /** Present when a deployment-presence record supplied this liveness result. */
150
- presence?: Pick<DeploymentPresence, "connectionState" | "transport">;
151
- /** Is a heartbeat recent enough to speak for the app as it is right now? */
152
- reachable: boolean;
153
- }
154
- interface NextAction {
155
- command: string | null;
156
- envFile: string | null;
157
- label: string;
158
- }
159
- interface IntegrationState {
160
- /**
161
- * Is the app running right now. Deliberately alongside `status` rather than
162
- * folded into it: a surface must be able to say "setup reached mapping" and
163
- * "the app is offline" in the same breath without either overwriting the
164
- * other.
165
- */
166
- liveness: ConnectionLiveness;
167
- next: NextAction | null;
168
- status: IntegrationStatus;
169
- steps: IntegrationStep[];
170
- }
171
- export { IntegrationStep as a, StepProblem as c, IntegrationStatus as i, StepState as l, IntegrationFacts as n, NextAction as o, IntegrationState as r, StepId as s, ConnectionLiveness as t };