@lunora/cli 1.0.0-alpha.403 → 1.0.0-alpha.404

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/cli",
3
- "version": "1.0.0-alpha.403",
3
+ "version": "1.0.0-alpha.404",
4
4
  "description": "The Lunora CLI: init, dev, deploy, codegen, migrate, seed, doctor, insights, logs, registry, and the rest of the project commands",
5
5
  "keywords": [
6
6
  "agent-skills",
@@ -52,16 +52,16 @@
52
52
  },
53
53
  "dependencies": {
54
54
  "@bomb.sh/tab": "0.0.22",
55
- "@lunora/advisor": "1.0.0-alpha.237",
56
- "@lunora/bindings": "1.0.0-alpha.123",
57
- "@lunora/codegen": "1.0.0-alpha.329",
58
- "@lunora/config": "1.0.0-alpha.379",
59
- "@lunora/container": "1.0.0-alpha.82",
60
- "@lunora/d1": "1.0.0-alpha.190",
55
+ "@lunora/advisor": "1.0.0-alpha.238",
56
+ "@lunora/bindings": "1.0.0-alpha.124",
57
+ "@lunora/codegen": "1.0.0-alpha.330",
58
+ "@lunora/config": "1.0.0-alpha.380",
59
+ "@lunora/container": "1.0.0-alpha.83",
60
+ "@lunora/d1": "1.0.0-alpha.191",
61
61
  "@lunora/errors": ">=1.0.0-alpha.51 <2.0.0-0",
62
- "@lunora/mcp": "1.0.0-alpha.243",
63
- "@lunora/runtime": "1.0.0-alpha.219",
64
- "@lunora/seed": "1.0.0-alpha.238",
62
+ "@lunora/mcp": "1.0.0-alpha.244",
63
+ "@lunora/runtime": "1.0.0-alpha.220",
64
+ "@lunora/seed": "1.0.0-alpha.239",
65
65
  "@visulima/cerebro": "3.1.2",
66
66
  "@visulima/error": "6.1.0",
67
67
  "@visulima/fs": "6.0.29",
@@ -28,8 +28,9 @@ shards. Reach past it only for the rest.
28
28
  | A dedicated socket at your own path | `defineWebSocket` + `client.connectWebSocket(path)` |
29
29
  | Who is online | `usePresence` |
30
30
 
31
- Live topics are the untyped one: the topic is a string and the payload is
32
- `unknown`. Full guide: the "Choosing a data channel" docs page.
31
+ Live topics are typed from their declaration: each topic's key and payload are
32
+ validators on the stream, and codegen emits `_generated/live.ts` with a typed
33
+ reference per topic. Full guide: the "Choosing a data channel" docs page.
33
34
 
34
35
  ## When Not to Use
35
36
 
@@ -194,9 +195,14 @@ TanStack-style alternative.
194
195
  ## Live Topics
195
196
 
196
197
  For an event with no query behind it ("a comment was posted"), the server
197
- publishes to a named topic and the browser follows topics over one shared SSE
198
- connection (shared when the connection options match). Declare the stream once, mount its two handlers on the HTTP router,
199
- and follow topics with the adapter's hook (all return `{ lastEvent, error }`):
198
+ publishes to a declared topic and the browser follows topics over one shared SSE
199
+ connection (shared when the connection options match). Declare the stream and its
200
+ topics once (`defineLiveStream({ id, topics: { post: { key: { postId: v.id("posts") },
201
+ payload: v.object({...}) } }, onSubscribe })`), mount its two handlers on the HTTP
202
+ router, and follow topics with the adapter's hook (all return `{ lastEvent, error }`).
203
+ `onSubscribe` receives the parsed `{ ctx, topic, key, raw }`; do not split a string.
204
+ A subscribe for an undeclared name, wrong arity or a non-canonical spelling is denied
205
+ before `onSubscribe` runs. Codegen writes `_generated/live.ts`:
200
206
 
201
207
  | Package | Primitive |
202
208
  | ---------------------- | ------------------------- |
@@ -207,14 +213,24 @@ and follow topics with the adapter's hook (all return `{ lastEvent, error }`):
207
213
  | `@lunora/react-native` | re-exports `useLiveTopic` |
208
214
 
209
215
  ```tsx
210
- const { lastEvent, error } = useLiveTopic({ url: "/live/posts/connect", topic: `post:${postId}`, onEvent: (payload) => refresh(payload) });
216
+ import { live } from "../lunora/_generated/live";
217
+
218
+ // the route comes from the client in <LunoraProvider>; lastEvent / onEvent are typed by the payload
219
+ const { lastEvent, error } = useLiveTopic(live.posts.post({ postId }), { onEvent: (payload) => refresh(payload) });
211
220
  ```
212
221
 
222
+ Svelte's `liveTopic` and Angular's `liveTopic` read the client when called: call
223
+ them during component init (Angular: or pass `client` and `destroyRef`). Pass
224
+ `shardKey` in the options to follow a `.shardBy` shard.
225
+
213
226
  - Several hooks with the same URL, credentials, headers, `retryDelay`, `maxDelayMs` and
214
227
  `sessionKey` share a single connection; the last to unmount closes it. On a
215
228
  cookie-authenticated stream pass `sessionKey` (the user id), or the connection
216
229
  outlives a sign-out and keeps the previous user's topics.
217
- - Publish from server code with `ctx.live.publish(topic, payload, { stream })`.
230
+ - Publish from server code with `ctx.live.publish(live.posts.post({ postId }), payload)`:
231
+ the ref names the stream, the payload is typed, and the shard refuses a payload the
232
+ topic's validator rejects (`BAD_REQUEST`). Topic names and key fields are plain
233
+ identifiers, key validators are string-valued, and a topic named `room` is refused.
218
234
  `ctx.live` exists only on actions, HTTP actions, queue consumers and scheduled
219
235
  actions, NOT on a query or mutation. It is always present on an HTTP action
220
236
  but typed optional on an `action` and a queue consumer, so write