clivly 0.20.0 → 0.21.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/{adapter-BXykDFyG.d.mts → adapter-B4v4dwgD.d.mts} +1 -1
- package/{adapter-BiUN_I3u.d.cts → adapter-BK3gsby5.d.cts} +1 -1
- package/{auth-adapter-BNvri2gX.d.mts → auth-adapter-BIa-ZyVV.d.mts} +1 -1
- package/{auth-adapter-D2MUT1Hk.d.cts → auth-adapter-DwtMJb7D.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 +2 -1
- package/core-adapter.d.mts +2 -1
- package/core-auth-adapter.d.cts +2 -1
- package/core-auth-adapter.d.mts +2 -1
- package/core-drizzle.d.cts +1 -1
- package/core-drizzle.d.mts +1 -1
- package/core-entity-config.cjs +1 -1
- package/core-entity-config.d.cts +2 -1
- package/core-entity-config.d.mts +2 -1
- package/core-entity-config.mjs +1 -1
- package/core-entity-heuristics.cjs +1 -1
- package/core-entity-heuristics.d.cts +1 -1
- package/core-entity-heuristics.d.mts +1 -1
- package/core-entity-heuristics.mjs +1 -1
- package/core-mapping-form.d.cts +2 -1
- package/core-mapping-form.d.mts +2 -1
- package/core-mappings-config.cjs +1 -1
- package/core-mappings-config.d.cts +2 -1
- package/core-mappings-config.d.mts +2 -1
- package/core-mappings-config.mjs +1 -1
- package/core-sync-engine.cjs +1 -1
- package/core-sync-engine.d.cts +2 -1
- package/core-sync-engine.d.mts +2 -1
- package/core-sync-engine.mjs +1 -1
- package/core-types.d.cts +2 -1
- package/core-types.d.mts +2 -1
- package/core-view-compiler.cjs +1 -1
- package/core-view-compiler.d.cts +2 -1
- package/core-view-compiler.d.mts +2 -1
- package/core-view-compiler.mjs +1 -1
- package/core.cjs +7 -7
- package/core.d.cts +10 -10
- package/core.d.mts +10 -10
- package/core.mjs +7 -7
- package/{drizzle-B9cjBavj.d.cts → drizzle-BNHGQXiY.d.cts} +1 -1
- package/{drizzle-L5FOGe_-.d.mts → drizzle-DFe7ILmd.d.mts} +1 -1
- package/drizzle.cjs +2 -2
- package/drizzle.d.cts +4 -3
- package/drizzle.d.mts +4 -3
- package/drizzle.mjs +2 -2
- package/{entity-config-DiCJ6mhI.cjs → entity-config-BP8Cc_nC.cjs} +54 -53
- package/{entity-config-g_oMPXlN.mjs → entity-config-CI5CGfaN.mjs} +54 -53
- package/{entity-config-X-KlnYXX.d.mts → entity-config-CXpGowQa.d.cts} +339 -339
- package/{entity-config-dNclLyBM.d.cts → entity-config-CXpGowQa.d.mts} +339 -339
- package/{entity-heuristics-DE5ujoHw.mjs → entity-heuristics-DAxqagJA.mjs} +1 -1
- package/{entity-heuristics-CIParuQe.cjs → entity-heuristics-DNmrcd0b.cjs} +1 -1
- package/index-Bh7o2J7K.d.mts +308 -0
- package/index-DRRTE5IJ.d.cts +308 -0
- package/index.cjs +3 -3
- package/index.mjs +3 -3
- package/{internal-COALpgov.d.cts → internal-C8TGcv_X.d.mts} +2 -131
- package/{internal-9oDwwbNg.mjs → internal-DWpLw0t5.mjs} +5 -5
- package/{internal-BKYt5j0l.cjs → internal-G5tXjqwl.cjs} +5 -5
- package/{internal-D3q4FPcA.d.mts → internal-Nrhf76Jn.d.cts} +2 -131
- 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-drizzle.d.cts +1 -1
- package/internal-drizzle.d.mts +1 -1
- package/internal-entity-config.cjs +1 -1
- package/internal-entity-config.d.cts +1 -1
- package/internal-entity-config.d.mts +1 -1
- package/internal-entity-config.mjs +1 -1
- package/internal-entity-heuristics.cjs +1 -1
- package/internal-entity-heuristics.d.cts +1 -1
- package/internal-entity-heuristics.d.mts +1 -1
- package/internal-entity-heuristics.mjs +1 -1
- package/internal-mapping-form.d.cts +1 -1
- package/internal-mapping-form.d.mts +1 -1
- package/internal-mappings-config.cjs +1 -1
- package/internal-mappings-config.d.cts +1 -1
- package/internal-mappings-config.d.mts +1 -1
- package/internal-mappings-config.mjs +1 -1
- package/internal-sync-engine.cjs +1 -1
- package/internal-sync-engine.d.cts +1 -1
- package/internal-sync-engine.d.mts +1 -1
- package/internal-sync-engine.mjs +1 -1
- package/internal-types.d.cts +1 -1
- package/internal-types.d.mts +1 -1
- package/internal-view-compiler.cjs +1 -1
- package/internal-view-compiler.d.cts +1 -1
- package/internal-view-compiler.d.mts +1 -1
- package/internal-view-compiler.mjs +1 -1
- package/internal.cjs +7 -7
- package/internal.d.cts +10 -10
- package/internal.d.mts +10 -10
- package/internal.mjs +7 -7
- package/{mapping-form-Bpvgf5b8.d.mts → mapping-form-Bg_hgNoL.d.cts} +1 -1
- package/{mapping-form-CV7y6qox.d.cts → mapping-form-KHUlnC7A.d.mts} +1 -1
- package/{mappings-config-CNxBrbt9.cjs → mappings-config-CC-vltWb.cjs} +1 -1
- package/{mappings-config-BBppW9fp.d.cts → mappings-config-DNo_Cum_.d.cts} +1 -1
- package/{mappings-config-D_g20PyS.mjs → mappings-config-Opw7ZM6Y.mjs} +1 -1
- package/{mappings-config-Dmm0H6p_.d.mts → mappings-config-wAe-p1rG.d.mts} +1 -1
- package/{namespace-probe-C1tm5rGh.d.cts → namespace-probe-Dh6LFwfo.d.cts} +9 -2
- package/{namespace-probe-ah2awcHO.d.mts → namespace-probe-xESu83KG.d.mts} +9 -2
- package/package.json +6 -4
- package/projection-CzBI2NL8.mjs +95 -0
- package/{projection-sql-CHz7KzNS.cjs → projection-sql-BkrHR2ea.cjs} +1 -1
- package/{projection-sql-C3gZE3GS.mjs → projection-sql-DQQdjw9I.mjs} +1 -1
- package/projection-w4Z6vSL2.cjs +118 -0
- package/{sdk-ChyrSl32.mjs → sdk-DfdHv-S9.mjs} +154 -13
- package/{sdk-BEHVvB18.cjs → sdk-oUjl5HNU.cjs} +154 -13
- package/sdk.cjs +2 -2
- package/sdk.d.cts +2 -2
- package/sdk.d.mts +2 -2
- package/sdk.mjs +2 -2
- package/{sync-engine-C7W0Gkq0.d.cts → sync-engine-DCjTr2XQ.d.cts} +2 -2
- package/{sync-engine-Di-vF26b.cjs → sync-engine-DNSoZeo0.cjs} +1 -1
- package/{sync-engine-C9Q2FkR9.d.mts → sync-engine-UNORma7f.d.mts} +2 -2
- package/{sync-engine-CwdLkmch.mjs → sync-engine-yFLEyId3.mjs} +1 -1
- package/{types-C08UluBS.d.cts → types-BBfwsDxe.d.cts} +13 -7
- package/{types-CZsSYbeC.d.mts → types-BBfwsDxe.d.mts} +13 -7
- package/{view-compiler-M23WiVGG.d.mts → view-compiler-BDD93Luw.d.cts} +1 -1
- package/{view-compiler-CLTi1VL-.mjs → view-compiler-CSHSqZl7.mjs} +2 -2
- package/{view-compiler-cXqt4X-c.d.cts → view-compiler-CSNhmCY2.d.mts} +1 -1
- package/{view-compiler-DaOz5QVl.cjs → view-compiler-NqiortOA.cjs} +2 -2
- package/vite.d.cts +1 -1
- package/vite.d.mts +1 -1
- package/integration-state-xK4PLm5T.d.cts +0 -171
- package/integration-state-xK4PLm5T.d.mts +0 -171
- package/projection-BkYXvjTr.mjs +0 -5587
- package/projection-By63gMC-.cjs +0 -5670
- package/schemas-BSuo_eZQ.d.cts +0 -2160
- package/schemas-BSuo_eZQ.d.mts +0 -2160
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
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
|
-
},
|
|
18
|
-
type ContactSegment =
|
|
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,5 +1,5 @@
|
|
|
1
|
-
import { t as BASE_REF } from "./projection-
|
|
2
|
-
import { i as compileProjectionJoins, n as compileProjectionFrom, o as compileProjectionSelect, s as quoteIdent } from "./projection-sql-
|
|
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,5 +1,5 @@
|
|
|
1
|
-
const require_projection = require("./projection-
|
|
2
|
-
const require_projection_sql = require("./projection-sql-
|
|
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
package/vite.d.mts
CHANGED
|
@@ -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 };
|