@clivly/sdk 0.9.0 → 0.9.2
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 +76 -9
- package/dist/chat-session.d.cts +1 -1
- package/dist/chat-session.d.mts +1 -1
- package/dist/drizzle.d.cts +1 -1
- package/dist/drizzle.d.mts +1 -1
- package/dist/index.cjs +765 -44
- package/dist/index.d.cts +3 -3
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +755 -46
- package/dist/{types-QPbki8ur.d.cts → types-DxG4rHyo.d.cts} +64 -2
- package/dist/{types-QPbki8ur.d.mts → types-DxG4rHyo.d.mts} +64 -2
- package/dist/vite.d.cts +1 -1
- package/dist/vite.d.mts +1 -1
- package/package.json +2 -2
|
@@ -86,6 +86,12 @@ interface ClivlySDKConfig {
|
|
|
86
86
|
* runtimes can supply their own.
|
|
87
87
|
*/
|
|
88
88
|
env?: Record<string, string | undefined>;
|
|
89
|
+
/**
|
|
90
|
+
* Where this app is running: `local_dev`, `preview` or `production`. Reported
|
|
91
|
+
* on each heartbeat so the dashboard can name the environment it is watching.
|
|
92
|
+
* Inferred from platform variables and `NODE_ENV` when omitted.
|
|
93
|
+
*/
|
|
94
|
+
environment?: "local_dev" | "preview" | "production";
|
|
89
95
|
/**
|
|
90
96
|
* 🚧 Not implemented in 0.1.x. Reserved options for tunnel mode and CRM
|
|
91
97
|
* write-back — they have NO effect yet and land with the Cloudflare
|
|
@@ -120,6 +126,17 @@ interface ClivlySDKConfig {
|
|
|
120
126
|
*/
|
|
121
127
|
namespaceReady?: boolean;
|
|
122
128
|
orm?: string;
|
|
129
|
+
/**
|
|
130
|
+
* Presence transport override. HTTP remains the default until the recorded
|
|
131
|
+
* production rollout gate permits a WebSocket default; set `http` explicitly
|
|
132
|
+
* to keep the legacy transport after that rollout. Operators may also set
|
|
133
|
+
* `CLIVLY_PRESENCE_TRANSPORT` without changing application code.
|
|
134
|
+
*/
|
|
135
|
+
presence?: {
|
|
136
|
+
/** Explicit release identity; platform deployment ids and commit SHAs follow. */
|
|
137
|
+
deploymentId?: string;
|
|
138
|
+
transport?: "http" | "websocket";
|
|
139
|
+
};
|
|
123
140
|
/**
|
|
124
141
|
* Network retry policy for outbound calls (heartbeat + sync push). Transient
|
|
125
142
|
* failures (network errors, HTTP 429, HTTP 5xx) are retried with exponential
|
|
@@ -225,6 +242,26 @@ interface CreateChatSessionHandlerOptions {
|
|
|
225
242
|
*/
|
|
226
243
|
resolveUser?: (req: Request) => Promise<ClivlyUser | null> | ClivlyUser | null;
|
|
227
244
|
}
|
|
245
|
+
/** One object type ensured by `ensureSchema`. */
|
|
246
|
+
interface EnsuredObjectTypeResult {
|
|
247
|
+
/** True when this call created it, false when it already existed. */
|
|
248
|
+
created: boolean;
|
|
249
|
+
id: string;
|
|
250
|
+
slug: string;
|
|
251
|
+
}
|
|
252
|
+
/** One mapping ensured by `ensureSchema`. */
|
|
253
|
+
interface EnsuredMappingResult {
|
|
254
|
+
created: boolean;
|
|
255
|
+
/** The config entity key this mapping came from. */
|
|
256
|
+
entityKey: string;
|
|
257
|
+
id: string;
|
|
258
|
+
/** True when an existing config-owned mapping's definition changed. */
|
|
259
|
+
updated: boolean;
|
|
260
|
+
}
|
|
261
|
+
interface EnsureSchemaResult {
|
|
262
|
+
mappings: EnsuredMappingResult[];
|
|
263
|
+
objectTypes: EnsuredObjectTypeResult[];
|
|
264
|
+
}
|
|
228
265
|
interface DoctorCheck {
|
|
229
266
|
/** Human-readable outcome — what passed, or why it failed. */
|
|
230
267
|
detail: string;
|
|
@@ -333,6 +370,31 @@ interface ClivlySDK {
|
|
|
333
370
|
createClivlyHandler(): (req: Request) => Promise<Response>;
|
|
334
371
|
/** Validate this setup end-to-end (read-only) before the first sync. */
|
|
335
372
|
doctor(): Promise<DoctorReport>;
|
|
373
|
+
/**
|
|
374
|
+
* Create any custom object types the config declares that this workspace does
|
|
375
|
+
* not have yet, keyed by entity slug — so `clivly.config.ts` needs no
|
|
376
|
+
* dashboard-generated id. Create-only and idempotent.
|
|
377
|
+
*
|
|
378
|
+
* Resolves to the ensured objects (empty when the config declares none), or
|
|
379
|
+
* `null` when the request could not be delivered.
|
|
380
|
+
*/
|
|
381
|
+
ensureCustomObjects(): Promise<{
|
|
382
|
+
slug: string;
|
|
383
|
+
id: string;
|
|
384
|
+
created: boolean;
|
|
385
|
+
}[] | null>;
|
|
386
|
+
/**
|
|
387
|
+
* Declare the whole schema this config describes — custom object types AND
|
|
388
|
+
* the mappings that make them receive rows. The superset of
|
|
389
|
+
* `ensureCustomObjects`, which creates the object container and nothing else.
|
|
390
|
+
*
|
|
391
|
+
* Resolves to `null` when the request could not be delivered (including
|
|
392
|
+
* against a server too old to have the route), and REJECTS when Clivly
|
|
393
|
+
* refuses the config — e.g. an entity that would overwrite a mapping managed
|
|
394
|
+
* in the dashboard. That distinction matters: unreachable is worth a retry,
|
|
395
|
+
* refused is worth reading.
|
|
396
|
+
*/
|
|
397
|
+
ensureSchema(): Promise<EnsureSchemaResult | null>;
|
|
336
398
|
/**
|
|
337
399
|
* Send a single heartbeat now. Returns true on success. Kept for the keep-alive
|
|
338
400
|
* loop and back-compat; use `connect()` when you need the failure reason.
|
|
@@ -365,7 +427,7 @@ interface ClivlySDK {
|
|
|
365
427
|
*/
|
|
366
428
|
start(): Promise<void>;
|
|
367
429
|
/** Stop the keep-alive loop. */
|
|
368
|
-
stop(): void
|
|
430
|
+
stop(): Promise<void>;
|
|
369
431
|
/**
|
|
370
432
|
* Sync all configured sources now. `delta` (default) pages changed rows since
|
|
371
433
|
* the last cursor; `full` pushes each complete entity so the server can
|
|
@@ -378,4 +440,4 @@ interface ClivlySDK {
|
|
|
378
440
|
}): Promise<void>;
|
|
379
441
|
}
|
|
380
442
|
//#endregion
|
|
381
|
-
export { ClivlySDK as a, CreateChatSessionHandlerOptions as c, DoctorCheck as d, DoctorReport as f, ClivlyConnectResult as i, CursorStore as l,
|
|
443
|
+
export { NamespaceIntrospector as _, ClivlySDK as a, CreateChatSessionHandlerOptions as c, DoctorCheck as d, DoctorReport as f, SyncSource 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 };
|
|
@@ -86,6 +86,12 @@ interface ClivlySDKConfig {
|
|
|
86
86
|
* runtimes can supply their own.
|
|
87
87
|
*/
|
|
88
88
|
env?: Record<string, string | undefined>;
|
|
89
|
+
/**
|
|
90
|
+
* Where this app is running: `local_dev`, `preview` or `production`. Reported
|
|
91
|
+
* on each heartbeat so the dashboard can name the environment it is watching.
|
|
92
|
+
* Inferred from platform variables and `NODE_ENV` when omitted.
|
|
93
|
+
*/
|
|
94
|
+
environment?: "local_dev" | "preview" | "production";
|
|
89
95
|
/**
|
|
90
96
|
* 🚧 Not implemented in 0.1.x. Reserved options for tunnel mode and CRM
|
|
91
97
|
* write-back — they have NO effect yet and land with the Cloudflare
|
|
@@ -120,6 +126,17 @@ interface ClivlySDKConfig {
|
|
|
120
126
|
*/
|
|
121
127
|
namespaceReady?: boolean;
|
|
122
128
|
orm?: string;
|
|
129
|
+
/**
|
|
130
|
+
* Presence transport override. HTTP remains the default until the recorded
|
|
131
|
+
* production rollout gate permits a WebSocket default; set `http` explicitly
|
|
132
|
+
* to keep the legacy transport after that rollout. Operators may also set
|
|
133
|
+
* `CLIVLY_PRESENCE_TRANSPORT` without changing application code.
|
|
134
|
+
*/
|
|
135
|
+
presence?: {
|
|
136
|
+
/** Explicit release identity; platform deployment ids and commit SHAs follow. */
|
|
137
|
+
deploymentId?: string;
|
|
138
|
+
transport?: "http" | "websocket";
|
|
139
|
+
};
|
|
123
140
|
/**
|
|
124
141
|
* Network retry policy for outbound calls (heartbeat + sync push). Transient
|
|
125
142
|
* failures (network errors, HTTP 429, HTTP 5xx) are retried with exponential
|
|
@@ -225,6 +242,26 @@ interface CreateChatSessionHandlerOptions {
|
|
|
225
242
|
*/
|
|
226
243
|
resolveUser?: (req: Request) => Promise<ClivlyUser | null> | ClivlyUser | null;
|
|
227
244
|
}
|
|
245
|
+
/** One object type ensured by `ensureSchema`. */
|
|
246
|
+
interface EnsuredObjectTypeResult {
|
|
247
|
+
/** True when this call created it, false when it already existed. */
|
|
248
|
+
created: boolean;
|
|
249
|
+
id: string;
|
|
250
|
+
slug: string;
|
|
251
|
+
}
|
|
252
|
+
/** One mapping ensured by `ensureSchema`. */
|
|
253
|
+
interface EnsuredMappingResult {
|
|
254
|
+
created: boolean;
|
|
255
|
+
/** The config entity key this mapping came from. */
|
|
256
|
+
entityKey: string;
|
|
257
|
+
id: string;
|
|
258
|
+
/** True when an existing config-owned mapping's definition changed. */
|
|
259
|
+
updated: boolean;
|
|
260
|
+
}
|
|
261
|
+
interface EnsureSchemaResult {
|
|
262
|
+
mappings: EnsuredMappingResult[];
|
|
263
|
+
objectTypes: EnsuredObjectTypeResult[];
|
|
264
|
+
}
|
|
228
265
|
interface DoctorCheck {
|
|
229
266
|
/** Human-readable outcome — what passed, or why it failed. */
|
|
230
267
|
detail: string;
|
|
@@ -333,6 +370,31 @@ interface ClivlySDK {
|
|
|
333
370
|
createClivlyHandler(): (req: Request) => Promise<Response>;
|
|
334
371
|
/** Validate this setup end-to-end (read-only) before the first sync. */
|
|
335
372
|
doctor(): Promise<DoctorReport>;
|
|
373
|
+
/**
|
|
374
|
+
* Create any custom object types the config declares that this workspace does
|
|
375
|
+
* not have yet, keyed by entity slug — so `clivly.config.ts` needs no
|
|
376
|
+
* dashboard-generated id. Create-only and idempotent.
|
|
377
|
+
*
|
|
378
|
+
* Resolves to the ensured objects (empty when the config declares none), or
|
|
379
|
+
* `null` when the request could not be delivered.
|
|
380
|
+
*/
|
|
381
|
+
ensureCustomObjects(): Promise<{
|
|
382
|
+
slug: string;
|
|
383
|
+
id: string;
|
|
384
|
+
created: boolean;
|
|
385
|
+
}[] | null>;
|
|
386
|
+
/**
|
|
387
|
+
* Declare the whole schema this config describes — custom object types AND
|
|
388
|
+
* the mappings that make them receive rows. The superset of
|
|
389
|
+
* `ensureCustomObjects`, which creates the object container and nothing else.
|
|
390
|
+
*
|
|
391
|
+
* Resolves to `null` when the request could not be delivered (including
|
|
392
|
+
* against a server too old to have the route), and REJECTS when Clivly
|
|
393
|
+
* refuses the config — e.g. an entity that would overwrite a mapping managed
|
|
394
|
+
* in the dashboard. That distinction matters: unreachable is worth a retry,
|
|
395
|
+
* refused is worth reading.
|
|
396
|
+
*/
|
|
397
|
+
ensureSchema(): Promise<EnsureSchemaResult | null>;
|
|
336
398
|
/**
|
|
337
399
|
* Send a single heartbeat now. Returns true on success. Kept for the keep-alive
|
|
338
400
|
* loop and back-compat; use `connect()` when you need the failure reason.
|
|
@@ -365,7 +427,7 @@ interface ClivlySDK {
|
|
|
365
427
|
*/
|
|
366
428
|
start(): Promise<void>;
|
|
367
429
|
/** Stop the keep-alive loop. */
|
|
368
|
-
stop(): void
|
|
430
|
+
stop(): Promise<void>;
|
|
369
431
|
/**
|
|
370
432
|
* Sync all configured sources now. `delta` (default) pages changed rows since
|
|
371
433
|
* the last cursor; `full` pushes each complete entity so the server can
|
|
@@ -378,4 +440,4 @@ interface ClivlySDK {
|
|
|
378
440
|
}): Promise<void>;
|
|
379
441
|
}
|
|
380
442
|
//#endregion
|
|
381
|
-
export { ClivlySDK as a, CreateChatSessionHandlerOptions as c, DoctorCheck as d, DoctorReport as f, ClivlyConnectResult as i, CursorStore as l,
|
|
443
|
+
export { NamespaceIntrospector as _, ClivlySDK as a, CreateChatSessionHandlerOptions as c, DoctorCheck as d, DoctorReport as f, SyncSource 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 };
|
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.2",
|
|
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.2"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
61
61
|
"drizzle-orm": ">=0.30 || >=1.0.0-rc.0",
|