@clivly/sdk 0.9.2 → 0.9.3

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 CHANGED
@@ -453,6 +453,7 @@ is honoured. Other `4xx` responses return immediately.
453
453
  | Method | Returns | Notes |
454
454
  | --- | --- | --- |
455
455
  | `connect()` | `Promise<ClivlyConnectResult>` | One heartbeat, structured. Never throws |
456
+ | `ping()` | `Promise<ClivlyConnectResult>` | Zero-write reachability probe. Same shape as `connect()`, but records no heartbeat — and it alone returns `workspace` |
456
457
  | `heartbeat()` | `Promise<boolean>` | One heartbeat, boolean |
457
458
  | `start()` | `Promise<void>` | Heartbeat + boot sync + timers. Long-lived hosts only; opens opt-in WebSocket presence |
458
459
  | `stop()` | `void` | Clears the timers |
@@ -461,6 +462,19 @@ is honoured. Other `4xx` responses return immediately.
461
462
  | `createClivlyHandler()` | `(Request) => Promise<Response>` | Mount at a route |
462
463
  | `createAuthVerifyHandler(resolveUser)` | `(Request) => Promise<Response>` | `503` unless `verifyToken` is set |
463
464
  | `doctor()` | `Promise<DoctorReport>` | `{ ok, checks }` |
465
+ | `ensureSchema()` | `Promise<EnsureSchemaResult \| null>` | Declares your custom object types **and** the mappings that make them receive rows. `null` = could not deliver; **rejects** if Clivly refuses the config |
466
+ | `ensureCustomObjects()` | `Promise<{ slug, id, created }[] \| null>` | Object types only, no mappings. Superseded by `ensureSchema()` |
467
+
468
+ `clivly push-schema` calls `ensureSchema()` for you, so you rarely need it
469
+ directly — reach for it when you want config-as-code to run from your own
470
+ deploy script or a CI step.
471
+
472
+ The `null`-vs-throw split is deliberate. `null` means the request never landed
473
+ (network, or a Clivly older than the route), which is worth a retry. A rejection
474
+ means Clivly understood the config and declined it — most often because an
475
+ entity would overwrite a mapping someone edited in the dashboard — which is
476
+ worth reading, not retrying. A config-declared mapping is owned by your config;
477
+ a dashboard-edited one is never silently overwritten.
464
478
 
465
479
  ### `ClivlyConnectResult.reason`
466
480
 
@@ -468,6 +482,17 @@ is honoured. Other `4xx` responses return immediately.
468
482
  `server_error` (5xx) · `client_error` (other 4xx) · `network_error` (no
469
483
  response).
470
484
 
485
+ ### `ClivlyConnectResult.workspace`
486
+
487
+ `ping()` also returns `workspace` — the setup ladder for the org behind your key
488
+ (`IntegrationState` from `@clivly/core`), computed by the server so the CLI and
489
+ the dashboard cannot disagree about how far setup has got. This is what
490
+ `clivly status` prints under **Workspace**.
491
+
492
+ It is `undefined` or `null` when the server predates the field or could not read
493
+ it. Treat that as *unknown*, never as *nothing is set up* — an old server, a
494
+ rejected key and a dead network all mean the question went unanswered.
495
+
471
496
  ### Subpath exports
472
497
 
473
498
  | From `clivly` | From `@clivly/sdk` | Contents |
@@ -1,4 +1,4 @@
1
- import { c as CreateChatSessionHandlerOptions } from "./types-DxG4rHyo.cjs";
1
+ import { c as CreateChatSessionHandlerOptions } from "./types-Cgwxd4h_.cjs";
2
2
  //#region src/chat-session.d.ts
3
3
  declare function createChatSessionHandler({ allowedOrigins, apiKey, apiUrl, fetchImpl, resolveUser }: CreateChatSessionHandlerOptions): (request: Request) => Promise<Response>;
4
4
  //#endregion
@@ -1,4 +1,4 @@
1
- import { c as CreateChatSessionHandlerOptions } from "./types-DxG4rHyo.mjs";
1
+ import { c as CreateChatSessionHandlerOptions } from "./types-Cgwxd4h_.mjs";
2
2
  //#region src/chat-session.d.ts
3
3
  declare function createChatSessionHandler({ allowedOrigins, apiKey, apiUrl, fetchImpl, resolveUser }: CreateChatSessionHandlerOptions): (request: Request) => Promise<Response>;
4
4
  //#endregion
@@ -1,4 +1,4 @@
1
- import { _ as NamespaceIntrospector, g as SyncSource } from "./types-DxG4rHyo.cjs";
1
+ import { _ as NamespaceIntrospector, g as SyncSource } from "./types-Cgwxd4h_.cjs";
2
2
  import { Table } from "drizzle-orm";
3
3
  import { buildUniqueConstraints, discoverFromDrizzle } from "@clivly/core/drizzle";
4
4
  //#region src/drizzle.d.ts
@@ -1,4 +1,4 @@
1
- import { _ as NamespaceIntrospector, g as SyncSource } from "./types-DxG4rHyo.mjs";
1
+ import { _ as NamespaceIntrospector, g as SyncSource } from "./types-Cgwxd4h_.mjs";
2
2
  import { buildUniqueConstraints, discoverFromDrizzle } from "@clivly/core/drizzle";
3
3
  import { Table } from "drizzle-orm";
4
4
  //#region src/drizzle.d.ts
package/dist/index.cjs CHANGED
@@ -1702,6 +1702,7 @@ function createClivlySDK(config) {
1702
1702
  reason: "ok",
1703
1703
  retryable: false,
1704
1704
  org: body?.org,
1705
+ workspace: body?.workspace ?? null,
1705
1706
  ..."appLastSeenAt" in body ? { appLastSeenAt: body.appLastSeenAt ?? null } : {}
1706
1707
  };
1707
1708
  }
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { a as ClivlySDK, c as CreateChatSessionHandlerOptions, d as DoctorCheck, f as DoctorReport, h as EnsuredObjectTypeResult, i as ClivlyConnectResult, l as CursorStore, m as EnsuredMappingResult, n as ChatWidgetVisitor, o as ClivlySDKConfig, p as EnsureSchemaResult, r as ClivlyConnectReason, s as ClivlyUser, t as ChatSessionRequestBody, u as DiscoveredTable } from "./types-DxG4rHyo.cjs";
1
+ import { a as ClivlySDK, c as CreateChatSessionHandlerOptions, d as DoctorCheck, f as DoctorReport, h as EnsuredObjectTypeResult, i as ClivlyConnectResult, l as CursorStore, m as EnsuredMappingResult, n as ChatWidgetVisitor, o as ClivlySDKConfig, p as EnsureSchemaResult, r as ClivlyConnectReason, s as ClivlyUser, t as ChatSessionRequestBody, u as DiscoveredTable } from "./types-Cgwxd4h_.cjs";
2
2
  import { createChatSessionHandler } from "./chat-session.cjs";
3
3
  import { ClivlyEntitiesConfig, ConfigValidationError, ConfigValidationResult, CustomObjectDeclaration, DiscoveredSchemaTable, customObjectDeclarations, defineClivlyConfig, validateEntitiesConfig } from "@clivly/core/entity-config";
4
4
  //#region src/errors.d.ts
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { a as ClivlySDK, c as CreateChatSessionHandlerOptions, d as DoctorCheck, f as DoctorReport, h as EnsuredObjectTypeResult, i as ClivlyConnectResult, l as CursorStore, m as EnsuredMappingResult, n as ChatWidgetVisitor, o as ClivlySDKConfig, p as EnsureSchemaResult, r as ClivlyConnectReason, s as ClivlyUser, t as ChatSessionRequestBody, u as DiscoveredTable } from "./types-DxG4rHyo.mjs";
1
+ import { a as ClivlySDK, c as CreateChatSessionHandlerOptions, d as DoctorCheck, f as DoctorReport, h as EnsuredObjectTypeResult, i as ClivlyConnectResult, l as CursorStore, m as EnsuredMappingResult, n as ChatWidgetVisitor, o as ClivlySDKConfig, p as EnsureSchemaResult, r as ClivlyConnectReason, s as ClivlyUser, t as ChatSessionRequestBody, u as DiscoveredTable } from "./types-Cgwxd4h_.mjs";
2
2
  import { createChatSessionHandler } from "./chat-session.mjs";
3
3
  import { ClivlyEntitiesConfig, ConfigValidationError, ConfigValidationResult, CustomObjectDeclaration, DiscoveredSchemaTable, customObjectDeclarations, defineClivlyConfig, validateEntitiesConfig } from "@clivly/core/entity-config";
4
4
  //#region src/errors.d.ts
package/dist/index.mjs CHANGED
@@ -1701,6 +1701,7 @@ function createClivlySDK(config) {
1701
1701
  reason: "ok",
1702
1702
  retryable: false,
1703
1703
  org: body?.org,
1704
+ workspace: body?.workspace ?? null,
1704
1705
  ..."appLastSeenAt" in body ? { appLastSeenAt: body.appLastSeenAt ?? null } : {}
1705
1706
  };
1706
1707
  }
@@ -1,4 +1,4 @@
1
- import { ClivlyEntitiesConfig } from "@clivly/core";
1
+ import { ClivlyEntitiesConfig, IntegrationState } 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 {
@@ -309,6 +309,12 @@ interface ClivlyConnectResult {
309
309
  retryable: boolean;
310
310
  /** HTTP status, or null when the request never completed (network error). */
311
311
  status: number | null;
312
+ /**
313
+ * The workspace's setup ladder, computed by the server. Present only on
314
+ * `ping()`, and null when the server is older than this field or could not
315
+ * read it — which the CLI renders as "unavailable", never as "not set up".
316
+ */
317
+ workspace?: IntegrationState | null;
312
318
  }
313
319
  interface SyncCursor {
314
320
  /** The row's id, breaking ties when timestamps collide. */
@@ -1,4 +1,4 @@
1
- import { ClivlyEntitiesConfig } from "@clivly/core";
1
+ import { ClivlyEntitiesConfig, IntegrationState } 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 {
@@ -309,6 +309,12 @@ interface ClivlyConnectResult {
309
309
  retryable: boolean;
310
310
  /** HTTP status, or null when the request never completed (network error). */
311
311
  status: number | null;
312
+ /**
313
+ * The workspace's setup ladder, computed by the server. Present only on
314
+ * `ping()`, and null when the server is older than this field or could not
315
+ * read it — which the CLI renders as "unavailable", never as "not set up".
316
+ */
317
+ workspace?: IntegrationState | null;
312
318
  }
313
319
  interface SyncCursor {
314
320
  /** The row's id, breaking ties when timestamps collide. */
package/dist/vite.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { a as ClivlySDK } from "./types-DxG4rHyo.cjs";
1
+ import { a as ClivlySDK } from "./types-Cgwxd4h_.cjs";
2
2
  import { Plugin } from "vite";
3
3
  //#region src/vite.d.ts
4
4
  interface ClivlyViteOptions {
package/dist/vite.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { a as ClivlySDK } from "./types-DxG4rHyo.mjs";
1
+ import { a as ClivlySDK } from "./types-Cgwxd4h_.mjs";
2
2
  import { Plugin } from "vite";
3
3
  //#region src/vite.d.ts
4
4
  interface ClivlyViteOptions {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clivly/sdk",
3
- "version": "0.9.2",
3
+ "version": "0.9.3",
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.2"
58
+ "@clivly/core": "0.9.3"
59
59
  },
60
60
  "peerDependencies": {
61
61
  "drizzle-orm": ">=0.30 || >=1.0.0-rc.0",