@clivly/sdk 0.9.5 → 0.9.7
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 +40 -12
- package/dist/chat-session.d.cts +1 -1
- package/dist/chat-session.d.mts +1 -1
- package/dist/drizzle.cjs +59 -8
- package/dist/drizzle.d.cts +8 -2
- package/dist/drizzle.d.mts +9 -3
- package/dist/drizzle.mjs +59 -8
- package/dist/index.cjs +352 -18
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +352 -18
- package/dist/{types-Dz1LQYvQ.d.cts → types-B7HKG2Ph.d.cts} +85 -2
- package/dist/{types-Dz1LQYvQ.d.mts → types-B7HKG2Ph.d.mts} +85 -2
- package/dist/vite.d.cts +1 -1
- package/dist/vite.d.mts +1 -1
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ClivlyEntitiesConfig, IntegrationState } from "@clivly/core";
|
|
1
|
+
import { ClivlyEntitiesConfig, IntegrationState, ProjectionMapping } from "@clivly/core";
|
|
2
2
|
//#region src/drizzle-meta.d.ts
|
|
3
3
|
declare const DRIZZLE_META: "__clivly_drizzle_source_meta__";
|
|
4
4
|
interface DrizzleSourceMeta {
|
|
@@ -18,6 +18,43 @@ interface DrizzleSourceMeta {
|
|
|
18
18
|
interface NamespaceIntrospector {
|
|
19
19
|
/** All base table names in the reachable schema. */
|
|
20
20
|
listTables(): Promise<string[]>;
|
|
21
|
+
/**
|
|
22
|
+
* Build a runnable sync source from a projection, for derived objects
|
|
23
|
+
* authored in the dashboard rather than in `clivly.config.ts`.
|
|
24
|
+
*
|
|
25
|
+
* Optional for the same reason `runProjection` is: an introspector may be
|
|
26
|
+
* hand-written. Absent, remote projections report `skipped` with a reason
|
|
27
|
+
* naming this method, rather than failing the run.
|
|
28
|
+
*
|
|
29
|
+
* This is deliberately the only route to a database handle for remote
|
|
30
|
+
* projections. `drizzleIntrospector(db)` already closes over the
|
|
31
|
+
* connection, so `introspector:` is the single config line that turns
|
|
32
|
+
* dashboard-authored objects on — and the SDK core never holds a raw
|
|
33
|
+
* client.
|
|
34
|
+
*/
|
|
35
|
+
projectionSource?(projection: ProjectionMapping, opts: {
|
|
36
|
+
basePkColumn?: string;
|
|
37
|
+
objectType: string;
|
|
38
|
+
}): SyncSource & {
|
|
39
|
+
objectType: string;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Read a few rows through an unsaved projection, for the dashboard's derived
|
|
43
|
+
* object preview. Rows are keyed by field name.
|
|
44
|
+
*
|
|
45
|
+
* Optional because it is the only capability here that needs more than a
|
|
46
|
+
* table name, and because an introspector may be hand-written. Absent, the
|
|
47
|
+
* dashboard says preview is unavailable rather than failing — see
|
|
48
|
+
* `previewProjection`.
|
|
49
|
+
*
|
|
50
|
+
* This is what makes preview cost the host an SDK upgrade and nothing else:
|
|
51
|
+
* `drizzleIntrospector(db)` already closes over the connection, so a config
|
|
52
|
+
* that set `introspector` for the "Namespace reachable" check gains preview
|
|
53
|
+
* without touching a line.
|
|
54
|
+
*/
|
|
55
|
+
runProjection?(projection: ProjectionMapping, opts: {
|
|
56
|
+
limit: number;
|
|
57
|
+
}): Promise<Record<string, unknown>[]>;
|
|
21
58
|
/** Prove a table is genuinely selectable (SELECT ... LIMIT 1). Throws if unreachable/denied. */
|
|
22
59
|
sampleSelect(table: string): Promise<void>;
|
|
23
60
|
}
|
|
@@ -347,6 +384,31 @@ interface CursorStore {
|
|
|
347
384
|
get(entity: string): Promise<SyncCursor | null> | SyncCursor | null;
|
|
348
385
|
set(entity: string, cursor: SyncCursor | null): Promise<void> | void;
|
|
349
386
|
}
|
|
387
|
+
/** @see ClivlySDK.describeSyncTrigger */
|
|
388
|
+
interface SyncTriggerDescription {
|
|
389
|
+
/**
|
|
390
|
+
* `syncTrigger.url` exactly as configured, placeholder and all. The raw
|
|
391
|
+
* value, so a caller can say what is in the file rather than what survived
|
|
392
|
+
* resolution.
|
|
393
|
+
*/
|
|
394
|
+
configured?: string;
|
|
395
|
+
/**
|
|
396
|
+
* The URL that would be reported to Clivly on the next heartbeat, or
|
|
397
|
+
* `undefined` when nothing resolves. An unedited placeholder never resolves.
|
|
398
|
+
*/
|
|
399
|
+
resolved?: string;
|
|
400
|
+
}
|
|
401
|
+
/** @see ClivlySDK.describeRemoteProjections */
|
|
402
|
+
interface RemoteProjectionsDescription {
|
|
403
|
+
/** False when no `introspector` is configured — nothing can run. */
|
|
404
|
+
capable: boolean;
|
|
405
|
+
failed: number;
|
|
406
|
+
invalid: number;
|
|
407
|
+
ok: number;
|
|
408
|
+
/** False until a sync has run in this process. */
|
|
409
|
+
ran: boolean;
|
|
410
|
+
skipped: number;
|
|
411
|
+
}
|
|
350
412
|
interface ClivlySDK {
|
|
351
413
|
/**
|
|
352
414
|
* Send a single heartbeat and report the outcome richly: `ok`, the HTTP
|
|
@@ -382,6 +444,27 @@ interface ClivlySDK {
|
|
|
382
444
|
* anyone who can reach it — set a secret if it's publicly routable.
|
|
383
445
|
*/
|
|
384
446
|
createClivlyHandler(): (req: Request) => Promise<Response>;
|
|
447
|
+
/**
|
|
448
|
+
* What this app would tell Clivly about dashboard-authored derived objects,
|
|
449
|
+
* right now. Counts rather than the outcomes themselves: this reports
|
|
450
|
+
* health, and the per-object reasons already travel to the dashboard, which
|
|
451
|
+
* is where an author fixes them.
|
|
452
|
+
*
|
|
453
|
+
* Read by `clivly status`.
|
|
454
|
+
*/
|
|
455
|
+
describeRemoteProjections(): RemoteProjectionsDescription;
|
|
456
|
+
/**
|
|
457
|
+
* What this app would tell Clivly about its sync trigger route, right now.
|
|
458
|
+
*
|
|
459
|
+
* Computed per call rather than frozen at creation: `resolved` can start as
|
|
460
|
+
* `undefined` and become a real URL once the mounted route has served its
|
|
461
|
+
* first request and observed its own origin.
|
|
462
|
+
*
|
|
463
|
+
* Exists for `clivly status`, which has to tell "no trigger configured"
|
|
464
|
+
* apart from "configured, but still the scaffolded placeholder" — a
|
|
465
|
+
* distinction `resolved` alone erases, since it skips placeholders by design.
|
|
466
|
+
*/
|
|
467
|
+
describeSyncTrigger(): SyncTriggerDescription;
|
|
385
468
|
/** Validate this setup end-to-end (read-only) before the first sync. */
|
|
386
469
|
doctor(): Promise<DoctorReport>;
|
|
387
470
|
/**
|
|
@@ -454,4 +537,4 @@ interface ClivlySDK {
|
|
|
454
537
|
}): Promise<void>;
|
|
455
538
|
}
|
|
456
539
|
//#endregion
|
|
457
|
-
export {
|
|
540
|
+
export { SyncSource as _, ClivlySDK as a, CreateChatSessionHandlerOptions as c, DoctorCheck as d, DoctorReport as f, RemoteProjectionsDescription as g, EnsuredObjectTypeResult as h, ClivlyConnectResult as i, CursorStore as l, EnsuredMappingResult as m, ChatWidgetVisitor as n, ClivlySDKConfig as o, EnsureSchemaResult as p, ClivlyConnectReason as r, ClivlyUser as s, ChatSessionRequestBody as t, DiscoveredTable as u, SyncTriggerDescription as v, NamespaceIntrospector as y };
|
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.9.
|
|
3
|
+
"version": "0.9.7",
|
|
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.9.
|
|
58
|
+
"@clivly/core": "0.9.7"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
61
61
|
"drizzle-orm": ">=0.30 || >=1.0.0-rc.0",
|