clivly 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.
Files changed (98) hide show
  1. package/README.md +19 -7
  2. package/core-drizzle.d.cts +1 -1
  3. package/core-drizzle.d.mts +1 -1
  4. package/core-entity-config.cjs +3 -1
  5. package/core-entity-config.d.cts +2 -2
  6. package/core-entity-config.d.mts +2 -2
  7. package/core-entity-config.mjs +2 -2
  8. package/core-entity-heuristics.d.cts +1 -1
  9. package/core-entity-heuristics.d.mts +1 -1
  10. package/core-mapping-form.d.cts +1 -1
  11. package/core-mapping-form.d.mts +1 -1
  12. package/core-mappings-config.cjs +2 -1
  13. package/core-mappings-config.d.cts +2 -2
  14. package/core-mappings-config.d.mts +2 -2
  15. package/core-mappings-config.mjs +2 -2
  16. package/core-sync-engine.cjs +1 -1
  17. package/core-sync-engine.d.cts +1 -1
  18. package/core-sync-engine.d.mts +1 -1
  19. package/core-sync-engine.mjs +1 -1
  20. package/core-view-compiler.cjs +2 -1
  21. package/core-view-compiler.d.cts +2 -2
  22. package/core-view-compiler.d.mts +2 -2
  23. package/core-view-compiler.mjs +2 -2
  24. package/core.cjs +5 -5
  25. package/core.d.cts +6 -6
  26. package/core.d.mts +6 -6
  27. package/core.mjs +5 -5
  28. package/{drizzle-BhN5M9zt.d.cts → drizzle-CiK8MMEZ.d.mts} +1 -1
  29. package/{drizzle-kBULBAOa.d.mts → drizzle-DEtRrqtc.d.cts} +1 -1
  30. package/drizzle.d.cts +2 -2
  31. package/drizzle.d.mts +2 -2
  32. package/{entity-config-C4Yf_fPj.d.cts → entity-config-B2RA53nw.d.cts} +168 -2
  33. package/{entity-config-C4Yf_fPj.d.mts → entity-config-B2RA53nw.d.mts} +168 -2
  34. package/{entity-config-CsLl-ftC.cjs → entity-config-DtBsl2MQ.cjs} +88 -13
  35. package/{entity-config-D3LmzgLb.mjs → entity-config-kUHri9yA.mjs} +77 -14
  36. package/index.cjs +375 -29
  37. package/index.d.cts +1 -0
  38. package/index.d.mts +1 -0
  39. package/index.mjs +375 -29
  40. package/{internal-MBkNo3bw.d.mts → internal-CDY8g9Ic.d.mts} +1 -2
  41. package/{internal-BARjyN4n.cjs → internal-CwnEG6Wl.cjs} +1 -1
  42. package/{internal-B8ydhsKd.d.cts → internal-Da_dlcQ_.d.cts} +1 -2
  43. package/{internal-DMySVbM0.mjs → internal-Df-PtOH_.mjs} +1 -1
  44. package/internal-drizzle.d.cts +1 -1
  45. package/internal-drizzle.d.mts +1 -1
  46. package/internal-entity-config.cjs +3 -1
  47. package/internal-entity-config.d.cts +2 -2
  48. package/internal-entity-config.d.mts +2 -2
  49. package/internal-entity-config.mjs +2 -2
  50. package/internal-entity-heuristics.cjs +1 -1
  51. package/internal-entity-heuristics.d.cts +1 -1
  52. package/internal-entity-heuristics.d.mts +1 -1
  53. package/internal-entity-heuristics.mjs +1 -1
  54. package/internal-mapping-form.d.cts +1 -1
  55. package/internal-mapping-form.d.mts +1 -1
  56. package/internal-mappings-config.cjs +2 -1
  57. package/internal-mappings-config.d.cts +2 -2
  58. package/internal-mappings-config.d.mts +2 -2
  59. package/internal-mappings-config.mjs +2 -2
  60. package/internal-sync-engine.cjs +1 -1
  61. package/internal-sync-engine.d.cts +1 -1
  62. package/internal-sync-engine.d.mts +1 -1
  63. package/internal-sync-engine.mjs +1 -1
  64. package/internal-view-compiler.cjs +2 -1
  65. package/internal-view-compiler.d.cts +2 -2
  66. package/internal-view-compiler.d.mts +2 -2
  67. package/internal-view-compiler.mjs +2 -2
  68. package/internal.cjs +5 -5
  69. package/internal.d.cts +6 -6
  70. package/internal.d.mts +6 -6
  71. package/internal.mjs +5 -5
  72. package/{mapping-form-43bwOTat.d.cts → mapping-form-DH77BXLv.d.mts} +1 -1
  73. package/{mapping-form-DUvWUYCo.d.mts → mapping-form-J0aU6O7l.d.cts} +1 -1
  74. package/{mappings-config-BSSwdHiq.cjs → mappings-config-B0RqFLxu.cjs} +30 -1
  75. package/{mappings-config-bJQT_gSa.mjs → mappings-config-B1b1HVBg.mjs} +25 -2
  76. package/mappings-config-D9dsonoi.d.mts +85 -0
  77. package/mappings-config-RQLGx8ub.d.cts +85 -0
  78. package/{namespace-probe-BSH_p9TK.d.cts → namespace-probe-C6aHjedO.d.cts} +65 -3
  79. package/{namespace-probe-Dsp5uNkS.d.mts → namespace-probe-Dj-0Q3Hb.d.mts} +65 -3
  80. package/package.json +1 -1
  81. package/{sdk-Bj-ZDf4u.cjs → sdk-D4Wp_uxb.cjs} +754 -44
  82. package/{sdk-BvRD2jAp.mjs → sdk-DXV8M_Io.mjs} +754 -44
  83. package/sdk.cjs +4 -2
  84. package/sdk.d.cts +3 -3
  85. package/sdk.d.mts +3 -3
  86. package/sdk.mjs +3 -3
  87. package/{sync-engine-GNqRB8eS.d.cts → sync-engine-BG2O1an2.d.cts} +2 -2
  88. package/{sync-engine-ZsusW-q_.d.mts → sync-engine-DgQbrJON.d.mts} +2 -2
  89. package/{sync-engine-Bg6-SznL.mjs → sync-engine-SuxSzbZ4.mjs} +1 -1
  90. package/{sync-engine-DEJvKw6E.cjs → sync-engine-abE94g6X.cjs} +1 -1
  91. package/{view-compiler-DplczSjF.cjs → view-compiler-Blu4OXJ7.cjs} +22 -0
  92. package/{view-compiler-Cin0neDO.d.mts → view-compiler-Bo7pqXW3.d.mts} +12 -2
  93. package/{view-compiler-DlTpOfZi.mjs → view-compiler-CQx8TRrW.mjs} +17 -1
  94. package/{view-compiler-Ll9cbIJz.d.cts → view-compiler-CmEdAMwj.d.cts} +12 -2
  95. package/vite.d.cts +1 -1
  96. package/vite.d.mts +1 -1
  97. package/mappings-config-BpcR8bBo.d.mts +0 -167
  98. package/mappings-config-xsLMn3I-.d.cts +0 -167
@@ -1,4 +1,4 @@
1
- import { a as ClivlyEntitiesConfig } from "./entity-config-C4Yf_fPj.mjs";
1
+ import { a as ClivlyEntitiesConfig } from "./entity-config-B2RA53nw.mjs";
2
2
  //#region ../sdk/src/drizzle-meta.d.ts
3
3
  declare const DRIZZLE_META: "__clivly_drizzle_source_meta__";
4
4
  interface DrizzleSourceMeta {
@@ -78,6 +78,12 @@ interface ClivlySDKConfig {
78
78
  * runtimes can supply their own.
79
79
  */
80
80
  env?: Record<string, string | undefined>;
81
+ /**
82
+ * Where this app is running: `local_dev`, `preview` or `production`. Reported
83
+ * on each heartbeat so the dashboard can name the environment it is watching.
84
+ * Inferred from platform variables and `NODE_ENV` when omitted.
85
+ */
86
+ environment?: "local_dev" | "preview" | "production";
81
87
  /**
82
88
  * 🚧 Not implemented in 0.1.x. Reserved options for tunnel mode and CRM
83
89
  * write-back — they have NO effect yet and land with the Cloudflare
@@ -112,6 +118,17 @@ interface ClivlySDKConfig {
112
118
  */
113
119
  namespaceReady?: boolean;
114
120
  orm?: string;
121
+ /**
122
+ * Presence transport override. HTTP remains the default until the recorded
123
+ * production rollout gate permits a WebSocket default; set `http` explicitly
124
+ * to keep the legacy transport after that rollout. Operators may also set
125
+ * `CLIVLY_PRESENCE_TRANSPORT` without changing application code.
126
+ */
127
+ presence?: {
128
+ /** Explicit release identity; platform deployment ids and commit SHAs follow. */
129
+ deploymentId?: string;
130
+ transport?: "http" | "websocket";
131
+ };
115
132
  /**
116
133
  * Network retry policy for outbound calls (heartbeat + sync push). Transient
117
134
  * failures (network errors, HTTP 429, HTTP 5xx) are retried with exponential
@@ -217,6 +234,26 @@ interface CreateChatSessionHandlerOptions {
217
234
  */
218
235
  resolveUser?: (req: Request) => Promise<ClivlyUser | null> | ClivlyUser | null;
219
236
  }
237
+ /** One object type ensured by `ensureSchema`. */
238
+ interface EnsuredObjectTypeResult {
239
+ /** True when this call created it, false when it already existed. */
240
+ created: boolean;
241
+ id: string;
242
+ slug: string;
243
+ }
244
+ /** One mapping ensured by `ensureSchema`. */
245
+ interface EnsuredMappingResult {
246
+ created: boolean;
247
+ /** The config entity key this mapping came from. */
248
+ entityKey: string;
249
+ id: string;
250
+ /** True when an existing config-owned mapping's definition changed. */
251
+ updated: boolean;
252
+ }
253
+ interface EnsureSchemaResult {
254
+ mappings: EnsuredMappingResult[];
255
+ objectTypes: EnsuredObjectTypeResult[];
256
+ }
220
257
  interface DoctorCheck {
221
258
  /** Human-readable outcome — what passed, or why it failed. */
222
259
  detail: string;
@@ -325,6 +362,31 @@ interface ClivlySDK {
325
362
  createClivlyHandler(): (req: Request) => Promise<Response>;
326
363
  /** Validate this setup end-to-end (read-only) before the first sync. */
327
364
  doctor(): Promise<DoctorReport>;
365
+ /**
366
+ * Create any custom object types the config declares that this workspace does
367
+ * not have yet, keyed by entity slug — so `clivly.config.ts` needs no
368
+ * dashboard-generated id. Create-only and idempotent.
369
+ *
370
+ * Resolves to the ensured objects (empty when the config declares none), or
371
+ * `null` when the request could not be delivered.
372
+ */
373
+ ensureCustomObjects(): Promise<{
374
+ slug: string;
375
+ id: string;
376
+ created: boolean;
377
+ }[] | null>;
378
+ /**
379
+ * Declare the whole schema this config describes — custom object types AND
380
+ * the mappings that make them receive rows. The superset of
381
+ * `ensureCustomObjects`, which creates the object container and nothing else.
382
+ *
383
+ * Resolves to `null` when the request could not be delivered (including
384
+ * against a server too old to have the route), and REJECTS when Clivly
385
+ * refuses the config — e.g. an entity that would overwrite a mapping managed
386
+ * in the dashboard. That distinction matters: unreachable is worth a retry,
387
+ * refused is worth reading.
388
+ */
389
+ ensureSchema(): Promise<EnsureSchemaResult | null>;
328
390
  /**
329
391
  * Send a single heartbeat now. Returns true on success. Kept for the keep-alive
330
392
  * loop and back-compat; use `connect()` when you need the failure reason.
@@ -357,7 +419,7 @@ interface ClivlySDK {
357
419
  */
358
420
  start(): Promise<void>;
359
421
  /** Stop the keep-alive loop. */
360
- stop(): void;
422
+ stop(): Promise<void>;
361
423
  /**
362
424
  * Sync all configured sources now. `delta` (default) pages changed rows since
363
425
  * the last cursor; `full` pushes each complete entity so the server can
@@ -378,4 +440,4 @@ interface NamespaceIntrospector {
378
440
  sampleSelect(table: string): Promise<void>;
379
441
  }
380
442
  //#endregion
381
- export { ClivlyConnectResult as a, ClivlyUser as c, DiscoveredTable as d, DoctorCheck as f, ClivlyConnectReason as i, CreateChatSessionHandlerOptions as l, SyncSource as m, ChatSessionRequestBody as n, ClivlySDK as o, DoctorReport as p, ChatWidgetVisitor as r, ClivlySDKConfig as s, NamespaceIntrospector as t, CursorStore as u };
443
+ export { SyncSource as _, ClivlyConnectResult as a, ClivlyUser as c, DiscoveredTable as d, DoctorCheck as f, EnsuredObjectTypeResult as g, EnsuredMappingResult as h, ClivlyConnectReason as i, CreateChatSessionHandlerOptions as l, EnsureSchemaResult as m, ChatSessionRequestBody as n, ClivlySDK as o, DoctorReport as p, ChatWidgetVisitor as r, ClivlySDKConfig as s, NamespaceIntrospector as t, CursorStore as u };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clivly",
3
- "version": "0.9.0",
3
+ "version": "0.9.2",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Clivly CLI — scaffold a CRM into your app (clivly init).",