@lunora/client 1.0.0-alpha.28 → 1.0.0-alpha.280

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 (106) hide show
  1. package/README.md +19 -4
  2. package/dist/admin/index.d.mts +647 -0
  3. package/dist/admin/index.d.ts +647 -0
  4. package/dist/admin/index.mjs +1 -0
  5. package/dist/auth/index.d.mts +138 -5
  6. package/dist/auth/index.d.ts +138 -5
  7. package/dist/auth/index.mjs +1 -60
  8. package/dist/index.d.mts +756 -186
  9. package/dist/index.d.ts +756 -186
  10. package/dist/index.mjs +1 -21
  11. package/dist/packem_shared/ADMIN_AUTH_DEFAULT_PAGE_SIZE-V9c3bHU1.mjs +1 -0
  12. package/dist/packem_shared/CONFLICT_ERROR_CODE-B7qNZMMk.mjs +1 -0
  13. package/dist/packem_shared/DEFAULT_MAX_BUFFER-Bd-_iyiV.mjs +1 -0
  14. package/dist/packem_shared/LunoraAdminClient-1KWk7JkZ.mjs +1 -0
  15. package/dist/packem_shared/LunoraClient-DKPUPbuv.mjs +1 -0
  16. package/dist/packem_shared/OfflineQueue-Ba2qgZK1.mjs +1 -0
  17. package/dist/packem_shared/RETIRE_AFTER_DURABLE_SEQ_ADVANCE-DoEHtuR8.mjs +1 -0
  18. package/dist/packem_shared/SKIP-d7LeP-sY.mjs +1 -0
  19. package/dist/packem_shared/SubscriptionRegistry-BKgQtuh9.mjs +1 -0
  20. package/dist/packem_shared/TabCoordinator-IUCwjnqX.mjs +1 -0
  21. package/dist/packem_shared/applyDelta-CaudNj2C.mjs +1 -0
  22. package/dist/packem_shared/base64-849R7V-V.mjs +1 -0
  23. package/dist/packem_shared/client-tuning-C10B2KCO.mjs +1 -0
  24. package/dist/packem_shared/client-urls-BHLUjjcG.mjs +1 -0
  25. package/dist/packem_shared/connectLiveStream-BdjsWP1-.mjs +1 -0
  26. package/dist/packem_shared/createAsyncStoragePersistence-BgfdvLwe.mjs +1 -0
  27. package/dist/packem_shared/createAsyncStorageQueryCache-6Y94ocbQ.mjs +1 -0
  28. package/dist/packem_shared/createCallRunner-Bwcrfh76.mjs +1 -0
  29. package/dist/packem_shared/createClientQuery-B8Nfj-7o.mjs +1 -0
  30. package/dist/packem_shared/createInMemoryBookmarkStorage-BooZhW0n.mjs +1 -0
  31. package/dist/packem_shared/createInMemoryPersistence-C-IzNVbg.mjs +1 -0
  32. package/dist/packem_shared/createInMemoryQueryCache-DR6AorA2.mjs +1 -0
  33. package/dist/packem_shared/createLocalStore-D38o4O8Z.mjs +1 -0
  34. package/dist/packem_shared/createMutatorRunner-CuMRJpUx.mjs +1 -0
  35. package/dist/packem_shared/createReconnect-CjTmjJDH.mjs +1 -0
  36. package/dist/packem_shared/createServerClient-97d5uFpA.mjs +1 -0
  37. package/dist/packem_shared/createSnapshotPrecondition-BXP1NPBW.mjs +1 -0
  38. package/dist/packem_shared/delta-merge-C6OqMEPH.mjs +1 -0
  39. package/dist/packem_shared/deserializePreloaded-DxozvweR.mjs +1 -0
  40. package/dist/packem_shared/frame-hint-D-NK691z.mjs +1 -0
  41. package/dist/packem_shared/function-reference.d-Br_hsKje.d.mts +45 -0
  42. package/dist/packem_shared/function-reference.d-Br_hsKje.d.ts +45 -0
  43. package/dist/packem_shared/getServerSession-BaOoo1p6.mjs +1 -0
  44. package/dist/packem_shared/httpStream-DN3D9WqW.mjs +7 -0
  45. package/dist/packem_shared/idb-utility-BS7xvou1.mjs +1 -0
  46. package/dist/packem_shared/live-stream-DBKgZlnb.mjs +10 -0
  47. package/dist/packem_shared/liveTopicSubscription-DQtKMFKw.mjs +1 -0
  48. package/dist/packem_shared/lunora-client-CNUU3FU7.mjs +1 -0
  49. package/dist/packem_shared/lunora-client.d-C8zXKzbE.d.mts +4966 -0
  50. package/dist/packem_shared/lunora-client.d-CAIGiEHg.d.ts +4966 -0
  51. package/dist/packem_shared/lunoraQueryKey-CucWmxnx.mjs +1 -0
  52. package/dist/packem_shared/offline-queue-BEqCPDmw.mjs +1 -0
  53. package/dist/packem_shared/optimistic-layers-D-7D3yeJ.mjs +1 -0
  54. package/dist/packem_shared/{preload.d-Cqb4Kh2I.d.ts → preload.d-CLx5oM3f.d.mts} +2 -1
  55. package/dist/packem_shared/{preload.d-CLwoXl3R.d.mts → preload.d-DTHQlBVJ.d.ts} +2 -1
  56. package/dist/packem_shared/preloadQuery-uFy24PCR.mjs +1 -0
  57. package/dist/packem_shared/setAuthTokenProvider-DhBppDiZ.mjs +1 -0
  58. package/dist/packem_shared/single-blob-store-DeaYPBSS.mjs +1 -0
  59. package/dist/packem_shared/snapshot-precondition-BEtcSbWr.mjs +1 -0
  60. package/dist/packem_shared/stream-idle-C7CsIT_m.mjs +1 -0
  61. package/dist/packem_shared/wire-errors-BDckSTKZ.mjs +1 -0
  62. package/dist/pagination/index.mjs +1 -61
  63. package/dist/query/index.d.mts +143 -4
  64. package/dist/query/index.d.ts +143 -4
  65. package/dist/query/index.mjs +1 -1
  66. package/dist/service.d.mts +49 -0
  67. package/dist/service.d.ts +49 -0
  68. package/dist/service.mjs +1 -0
  69. package/dist/ssr/index.d.mts +45 -16
  70. package/dist/ssr/index.d.ts +45 -16
  71. package/dist/ssr/index.mjs +1 -4
  72. package/dist/upload.d.mts +14 -0
  73. package/dist/upload.d.ts +14 -0
  74. package/dist/upload.mjs +1 -24
  75. package/package.json +15 -3
  76. package/dist/packem_shared/CONFLICT_ERROR_CODE-B8gQ8tyU.mjs +0 -33
  77. package/dist/packem_shared/ClientServiceWorker-C3PAFwy0.mjs +0 -100
  78. package/dist/packem_shared/DEFAULT_MAX_BUFFER-7hFnzNk9.mjs +0 -110
  79. package/dist/packem_shared/LunoraClient-DKATLGHY.mjs +0 -3631
  80. package/dist/packem_shared/OfflineQueue-BgarnAub.mjs +0 -1
  81. package/dist/packem_shared/SKIP-vItZChkw.mjs +0 -50
  82. package/dist/packem_shared/SubscriptionRegistry-CxS_Inha.mjs +0 -31
  83. package/dist/packem_shared/TabCoordinator-D_5oNTTt.mjs +0 -258
  84. package/dist/packem_shared/applyDelta-CRKZ1PBt.mjs +0 -81
  85. package/dist/packem_shared/createAsyncStoragePersistence-1Z5BZ8RC.mjs +0 -45
  86. package/dist/packem_shared/createClientQuery-dJZg1ohm.mjs +0 -80
  87. package/dist/packem_shared/createInMemoryBookmarkStorage-BoN7a7TH.mjs +0 -11
  88. package/dist/packem_shared/createInMemoryPersistence-DZ2VHWgm.mjs +0 -79
  89. package/dist/packem_shared/createInMemoryQueryCache-DiaGZkA2.mjs +0 -112
  90. package/dist/packem_shared/createLocalStore-BtqUmOQA.mjs +0 -2
  91. package/dist/packem_shared/createMutationRunner-BqsavzvG.mjs +0 -21
  92. package/dist/packem_shared/createMutatorRunner-BETvCd0p.mjs +0 -31
  93. package/dist/packem_shared/createReconnect-Di_-oHH7.mjs +0 -22
  94. package/dist/packem_shared/createReply-lI4tVS2w.mjs +0 -36
  95. package/dist/packem_shared/createServerClient-Bp2r9tcB.mjs +0 -11
  96. package/dist/packem_shared/createSnapshotPrecondition-CxQ1T4ZP.mjs +0 -18
  97. package/dist/packem_shared/deserializePreloaded-C0eJTY_W.mjs +0 -4
  98. package/dist/packem_shared/getServerSession-8jXewqxd.mjs +0 -13
  99. package/dist/packem_shared/httpStream-DIdL8NEw.mjs +0 -168
  100. package/dist/packem_shared/idb-utility-DrSVX43Q.mjs +0 -48
  101. package/dist/packem_shared/local-store-DIq-UWfD.mjs +0 -106
  102. package/dist/packem_shared/lunora-client.d-B1iZb2Ph.d.mts +0 -2845
  103. package/dist/packem_shared/lunora-client.d-B1iZb2Ph.d.ts +0 -2845
  104. package/dist/packem_shared/offline-queue-N-1JvYb4.mjs +0 -211
  105. package/dist/packem_shared/preloadQuery-lobFkD2Z.mjs +0 -13
  106. package/dist/packem_shared/wire-key-Djie6aaR.mjs +0 -266
package/README.md CHANGED
@@ -34,7 +34,7 @@
34
34
 
35
35
  ---
36
36
 
37
- The framework-agnostic browser/edge SDK for Lunora. It runs RPC over HTTP and real-time deltas over a single multiplexed WebSocket, with optimistic updates, an offline mutation queue, and decorrelated-jitter reconnect built in. It is the lowest-level user-facing entry point that every framework adapter (React, Vue, Svelte, Solid) layers on top of.
37
+ The framework-agnostic browser/edge SDK for Lunora. It runs RPC over HTTP and real-time deltas over a single multiplexed WebSocket, with optimistic updates, an offline mutation queue, and exponential-backoff-with-jitter reconnect built in. It is the lowest-level user-facing entry point that every framework adapter (React, Vue, Svelte, Solid) layers on top of.
38
38
 
39
39
  Part of the [Lunora](https://github.com/anolilab/lunora) framework — a type-safe, real-time backend on Cloudflare Workers + Durable Objects with a Vite-first DX.
40
40
 
@@ -63,8 +63,21 @@ const client = new LunoraClient({ url: "https://app.acme.test" });
63
63
  // One-shot query (HTTP, carries the D1 bookmark for read-your-writes).
64
64
  const messages = await client.query(api.messages.list, { room: "general" });
65
65
 
66
- // Mutation with an optimistic update applied to matching subscribers.
67
- await client.mutation(api.messages.send, { body: "hi" }, { optimistic: (current = []) => [...current, { body: "hi", pending: true }] });
66
+ // Mutation with an optimistic update. `optimisticUpdate` names the query it
67
+ // patches — a write and the queries it affects are different functions, and only
68
+ // you know which. (The per-call `optimistic` shortcut patches the subscription
69
+ // registered under the mutation's OWN reference and args, nothing else.)
70
+ await client.mutation(
71
+ api.messages.send,
72
+ { room: "general", body: "hi" },
73
+ {
74
+ optimisticUpdate: (store, args) => {
75
+ const current = store.getQuery(api.messages.list, { room: args.room }) ?? [];
76
+
77
+ store.setQuery(api.messages.list, { room: args.room }, [...current, { body: args.body, pending: true }]);
78
+ },
79
+ },
80
+ );
68
81
 
69
82
  // Live subscription over WS — returns an unsubscribe function.
70
83
  const unsubscribe = client.subscribe(api.messages.list, { room: "general" }, (next) => {
@@ -81,8 +94,10 @@ client.close();
81
94
  ## Related
82
95
 
83
96
  - [`@lunora/react`](https://www.npmjs.com/package/@lunora/react) — React hooks built on this client.
84
- - `@lunora/client/query` — the shared live-query state machine every UI adapter builds on (subpath of this package).
97
+ - `@lunora/client/query` — the shared live-query state machine every UI adapter builds on, plus the TanStack Query key contract and `lunoraQueryOptions` factory (subpath of this package).
98
+ - `@lunora/client/auth` — the identity store and auth-gate contract, plus the framework-neutral core of the admin/organization list hooks (subpath of this package).
85
99
  - `@lunora/client/ssr` — server-side preloading over this client's HTTP transport (subpath of this package).
100
+ - `@lunora/client/admin` — `LunoraAdminClient`, a `LunoraClient` with the deployment-admin surface (functions, scheduler, storage, KV, vectors, logs, better-auth admin) the Studio uses. Kept off `LunoraClient` so apps don't ship it.
86
101
 
87
102
  ## Supported Node.js Versions
88
103