@clivly/sdk 0.8.0 → 0.9.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 +354 -113
- package/dist/chat-session.d.cts +1 -1
- package/dist/chat-session.d.mts +1 -1
- package/dist/drizzle.cjs +17 -40
- package/dist/drizzle.d.cts +3 -3
- package/dist/drizzle.d.mts +3 -3
- package/dist/drizzle.mjs +12 -41
- package/dist/index.cjs +126 -28
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +126 -28
- package/dist/{types-DTaz5mLi.d.cts → types-QPbki8ur.d.cts} +37 -1
- package/dist/{types-DTaz5mLi.d.mts → types-QPbki8ur.d.mts} +37 -1
- package/dist/vite.d.cts +1 -1
- package/dist/vite.d.mts +1 -1
- package/package.json +2 -2
|
@@ -10,6 +10,8 @@ interface DrizzleSourceMeta {
|
|
|
10
10
|
idField: string;
|
|
11
11
|
/** The backing table's real name, so discovery can key metadata by table. */
|
|
12
12
|
tableName?: string;
|
|
13
|
+
/** Every unique key on the table, each as its DB column names. */
|
|
14
|
+
uniqueConstraints?: string[][];
|
|
13
15
|
}
|
|
14
16
|
//#endregion
|
|
15
17
|
//#region src/namespace-probe.d.ts
|
|
@@ -41,6 +43,13 @@ interface DiscoveredTable {
|
|
|
41
43
|
name: string;
|
|
42
44
|
/** Approximate source row count, when cheaply derivable. */
|
|
43
45
|
rowCount?: number;
|
|
46
|
+
/**
|
|
47
|
+
* Every unique key on the table, each as its DB column names. Primary keys
|
|
48
|
+
* are included (a PK is a unique key). Absent on v1 hosts and for
|
|
49
|
+
* hand-declared tables — consumers must treat absence as "unknown", never
|
|
50
|
+
* as "no unique keys".
|
|
51
|
+
*/
|
|
52
|
+
uniqueConstraints?: string[][];
|
|
44
53
|
}
|
|
45
54
|
interface ClivlySDKConfig {
|
|
46
55
|
/** Org-scoped API token (sk_live_…) from Settings → API keys. */
|
|
@@ -225,14 +234,33 @@ interface DoctorCheck {
|
|
|
225
234
|
ok: boolean;
|
|
226
235
|
/** True when the check could not run (e.g. a hand-written source). */
|
|
227
236
|
skipped?: boolean;
|
|
237
|
+
/**
|
|
238
|
+
* True when the setup works but carries a risk worth stating.
|
|
239
|
+
*
|
|
240
|
+
* Distinct from `ok: false`, which means "this is broken, fix it before you
|
|
241
|
+
* rely on it". A warning is for a configuration that will run and sync, yet
|
|
242
|
+
* behaves in a way the developer probably did not intend — the cursor check
|
|
243
|
+
* below is the motivating case: syncing from an `id` column succeeds, mirrors
|
|
244
|
+
* every insert, and silently never re-syncs an edited row.
|
|
245
|
+
*
|
|
246
|
+
* Warnings do not fail `doctor`. Reporting them as failures would train
|
|
247
|
+
* people to ignore a red ladder on a working setup, which is worse than not
|
|
248
|
+
* reporting them at all.
|
|
249
|
+
*/
|
|
250
|
+
warn?: boolean;
|
|
228
251
|
}
|
|
229
252
|
interface DoctorReport {
|
|
230
253
|
checks: DoctorCheck[];
|
|
231
254
|
/** AND of every non-skipped check's `ok`. */
|
|
232
255
|
ok: boolean;
|
|
233
256
|
}
|
|
234
|
-
type ClivlyConnectReason = "ok" | "invalid_api_key" | "forbidden" | "rate_limited" | "server_error" | "client_error" | "network_error";
|
|
257
|
+
type ClivlyConnectReason = "ok" | "invalid_api_key" | "forbidden" | "rate_limited" | "server_error" | "client_error" | "server_too_old" | "network_error";
|
|
235
258
|
interface ClivlyConnectResult {
|
|
259
|
+
/**
|
|
260
|
+
* When the org's app last heartbeated, or null if it never has. Set only by
|
|
261
|
+
* `ping()` — `connect()` IS a heartbeat, so the question is meaningless there.
|
|
262
|
+
*/
|
|
263
|
+
appLastSeenAt?: string | null;
|
|
236
264
|
ok: boolean;
|
|
237
265
|
/** Org resolved from a successful heartbeat, when the server returns it. */
|
|
238
266
|
org?: {
|
|
@@ -310,6 +338,14 @@ interface ClivlySDK {
|
|
|
310
338
|
* loop and back-compat; use `connect()` when you need the failure reason.
|
|
311
339
|
*/
|
|
312
340
|
heartbeat(): Promise<boolean>;
|
|
341
|
+
/**
|
|
342
|
+
* Read-only diagnostic probe. Proves the API key is valid and Clivly is
|
|
343
|
+
* reachable, and resolves the org — without reporting anything about the
|
|
344
|
+
* host app. Use this for `clivly status` and other diagnostics; use
|
|
345
|
+
* `connect()` only from the running app, which is entitled to report its
|
|
346
|
+
* own state.
|
|
347
|
+
*/
|
|
348
|
+
ping(): Promise<ClivlyConnectResult>;
|
|
313
349
|
/**
|
|
314
350
|
* One-shot heartbeat + a single sync, with no keep-alive timers. The correct
|
|
315
351
|
* entry point on serverless/edge (Workers, Vercel, Lambda), where `start()`'s
|
|
@@ -10,6 +10,8 @@ interface DrizzleSourceMeta {
|
|
|
10
10
|
idField: string;
|
|
11
11
|
/** The backing table's real name, so discovery can key metadata by table. */
|
|
12
12
|
tableName?: string;
|
|
13
|
+
/** Every unique key on the table, each as its DB column names. */
|
|
14
|
+
uniqueConstraints?: string[][];
|
|
13
15
|
}
|
|
14
16
|
//#endregion
|
|
15
17
|
//#region src/namespace-probe.d.ts
|
|
@@ -41,6 +43,13 @@ interface DiscoveredTable {
|
|
|
41
43
|
name: string;
|
|
42
44
|
/** Approximate source row count, when cheaply derivable. */
|
|
43
45
|
rowCount?: number;
|
|
46
|
+
/**
|
|
47
|
+
* Every unique key on the table, each as its DB column names. Primary keys
|
|
48
|
+
* are included (a PK is a unique key). Absent on v1 hosts and for
|
|
49
|
+
* hand-declared tables — consumers must treat absence as "unknown", never
|
|
50
|
+
* as "no unique keys".
|
|
51
|
+
*/
|
|
52
|
+
uniqueConstraints?: string[][];
|
|
44
53
|
}
|
|
45
54
|
interface ClivlySDKConfig {
|
|
46
55
|
/** Org-scoped API token (sk_live_…) from Settings → API keys. */
|
|
@@ -225,14 +234,33 @@ interface DoctorCheck {
|
|
|
225
234
|
ok: boolean;
|
|
226
235
|
/** True when the check could not run (e.g. a hand-written source). */
|
|
227
236
|
skipped?: boolean;
|
|
237
|
+
/**
|
|
238
|
+
* True when the setup works but carries a risk worth stating.
|
|
239
|
+
*
|
|
240
|
+
* Distinct from `ok: false`, which means "this is broken, fix it before you
|
|
241
|
+
* rely on it". A warning is for a configuration that will run and sync, yet
|
|
242
|
+
* behaves in a way the developer probably did not intend — the cursor check
|
|
243
|
+
* below is the motivating case: syncing from an `id` column succeeds, mirrors
|
|
244
|
+
* every insert, and silently never re-syncs an edited row.
|
|
245
|
+
*
|
|
246
|
+
* Warnings do not fail `doctor`. Reporting them as failures would train
|
|
247
|
+
* people to ignore a red ladder on a working setup, which is worse than not
|
|
248
|
+
* reporting them at all.
|
|
249
|
+
*/
|
|
250
|
+
warn?: boolean;
|
|
228
251
|
}
|
|
229
252
|
interface DoctorReport {
|
|
230
253
|
checks: DoctorCheck[];
|
|
231
254
|
/** AND of every non-skipped check's `ok`. */
|
|
232
255
|
ok: boolean;
|
|
233
256
|
}
|
|
234
|
-
type ClivlyConnectReason = "ok" | "invalid_api_key" | "forbidden" | "rate_limited" | "server_error" | "client_error" | "network_error";
|
|
257
|
+
type ClivlyConnectReason = "ok" | "invalid_api_key" | "forbidden" | "rate_limited" | "server_error" | "client_error" | "server_too_old" | "network_error";
|
|
235
258
|
interface ClivlyConnectResult {
|
|
259
|
+
/**
|
|
260
|
+
* When the org's app last heartbeated, or null if it never has. Set only by
|
|
261
|
+
* `ping()` — `connect()` IS a heartbeat, so the question is meaningless there.
|
|
262
|
+
*/
|
|
263
|
+
appLastSeenAt?: string | null;
|
|
236
264
|
ok: boolean;
|
|
237
265
|
/** Org resolved from a successful heartbeat, when the server returns it. */
|
|
238
266
|
org?: {
|
|
@@ -310,6 +338,14 @@ interface ClivlySDK {
|
|
|
310
338
|
* loop and back-compat; use `connect()` when you need the failure reason.
|
|
311
339
|
*/
|
|
312
340
|
heartbeat(): Promise<boolean>;
|
|
341
|
+
/**
|
|
342
|
+
* Read-only diagnostic probe. Proves the API key is valid and Clivly is
|
|
343
|
+
* reachable, and resolves the org — without reporting anything about the
|
|
344
|
+
* host app. Use this for `clivly status` and other diagnostics; use
|
|
345
|
+
* `connect()` only from the running app, which is entitled to report its
|
|
346
|
+
* own state.
|
|
347
|
+
*/
|
|
348
|
+
ping(): Promise<ClivlyConnectResult>;
|
|
313
349
|
/**
|
|
314
350
|
* One-shot heartbeat + a single sync, with no keep-alive timers. The correct
|
|
315
351
|
* entry point on serverless/edge (Workers, Vercel, Lambda), where `start()`'s
|
package/dist/vite.d.cts
CHANGED
package/dist/vite.d.mts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@clivly/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Clivly SDK — connect your app to Clivly Cloud (heartbeat, discovery, auth bridge).",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"access": "public"
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"@clivly/core": "0.
|
|
58
|
+
"@clivly/core": "0.9.0"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
61
61
|
"drizzle-orm": ">=0.30 || >=1.0.0-rc.0",
|