@clivly/sdk 0.9.0 → 0.9.1

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.
Files changed (2) hide show
  1. package/README.md +24 -2
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -394,7 +394,7 @@ is honoured. Other `4xx` responses return immediately.
394
394
  | `apiKey` | `string` | — | **Required.** `sk_live_…` |
395
395
  | `apiUrl` | `string` | `https://api.clivly.com` | Non-default backend |
396
396
  | `entities` | `ClivlyEntitiesConfig` | — | From `defineClivlyConfig({ entities })` |
397
- | `schema` | `DiscoveredTable[]` | — | Use `discoverFromDrizzle(schema)` |
397
+ | `schema` | `DiscoveredTable[]` | — | Use `discoverFromDrizzle(schema)`. It reports keys, types, nullability and FK edges alongside column names; [derived objects](#derived-objects) cannot be authored without them, so prefer it over a hand-written array |
398
398
  | `source` | `{ contacts, companies?, deals?, custom? }` | — | Keyed by CRM concept. `contacts` is required when `source` is present |
399
399
  | `cursorStore` | `CursorStore` | in-memory | Persist on serverless |
400
400
  | `heartbeatIntervalMs` | `number` | `60000` | |
@@ -436,10 +436,32 @@ response).
436
436
  | From `clivly` | From `@clivly/sdk` | Contents |
437
437
  | --- | --- | --- |
438
438
  | `clivly/sdk` | `@clivly/sdk` | `createClivlySDK`, `defineClivlyConfig`, `createChatSessionHandler`, error classes, all types |
439
- | `clivly/drizzle` | `@clivly/sdk/drizzle` | `fromDrizzle`, `discoverFromDrizzle`, `drizzleIntrospector` |
439
+ | `clivly/drizzle` | `@clivly/sdk/drizzle` | `fromDrizzle`, `discoverFromDrizzle`, `drizzleIntrospector`, `buildUniqueConstraints` |
440
440
  | `clivly/vite` | `@clivly/sdk/vite` | `clivlyVite` |
441
441
  | — | `@clivly/sdk/chat-session` | `createChatSessionHandler` (also on the root) |
442
442
 
443
+ ## Derived objects
444
+
445
+ A custom object can be derived from a base table plus explicit joins, instead of
446
+ mapping exactly one table — an `Enrollment` built from `enrollments` joined to
447
+ `students` and `courses`. You build one in the Clivly dashboard, not in code.
448
+
449
+ The SDK's only job is to report enough schema for it: `discoverFromDrizzle`
450
+ sends primary keys, unique constraints, nullability, column types and
451
+ foreign-key edges. Validation is fail-closed, so if your config hand-writes
452
+ `schema` as `{ name, columns }` pairs, the dashboard will refuse to author a
453
+ projection against those tables with *"has no key/column metadata — upgrade
454
+ `@clivly/sdk` and re-run discovery"*.
455
+
456
+ The fix is to pass `discoverFromDrizzle(schema)` and redeploy, so a fresh
457
+ heartbeat carries the richer payload. Re-run it after schema changes too:
458
+ projections validate against the last reported snapshot.
459
+
460
+ > Requires `clivly@0.9.0` / `@clivly/sdk@0.9.0` or later. Earlier versions
461
+ > reported names only, so no host app could author a derived object.
462
+
463
+ Full guide: [`docs/guides/derived-objects.md`](../../docs/guides/derived-objects.md).
464
+
443
465
  ## Known limitations
444
466
 
445
467
  - `start()` is for long-lived runtimes only. On serverless/edge, use
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clivly/sdk",
3
- "version": "0.9.0",
3
+ "version": "0.9.1",
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.0"
58
+ "@clivly/core": "0.9.1"
59
59
  },
60
60
  "peerDependencies": {
61
61
  "drizzle-orm": ">=0.30 || >=1.0.0-rc.0",