@livequery/rpc 2.0.100 → 2.0.101

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 +11 -22
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  Lightweight RxJS-based RPC utilities for exposing services from a `SharedWorker` and consuming them from the main thread with typed proxies.
4
4
 
5
+ ## AI Agent Notes
6
+
7
+ Repository-specific guidance for coding agents lives in `AGENTS.md`.
8
+
5
9
  This package is built for a simple model:
6
10
 
7
11
  - Expose plain classes as worker services.
@@ -157,7 +161,7 @@ In practice:
157
161
 
158
162
  ## BehaviorSubject Mirroring
159
163
 
160
- If your service exposes a property with a `getValue()` method, `WorkerManager` will include its initial value during service initialization.
164
+ If your service exposes a `BehaviorSubject` property, the client can treat it like remote reactive state.
161
165
 
162
166
  This is what allows a worker-side `BehaviorSubject` to feel usable on the client:
163
167
 
@@ -177,24 +181,12 @@ settings.theme.subscribe((theme) => {
177
181
 
178
182
  Notes:
179
183
 
180
- - the initial snapshot is fetched through an internal `____initialize____` call
181
- - later updates are streamed by subscribing to the remote property
184
+ - `ServiceLinker` special-cases only `subscribe()`, `pipe()`, and `getValue()` on remote properties
185
+ - updates are fetched by subscribing to the remote property path, not through a separate initialization API
186
+ - `getValue()` reads the locally cached value, so subscribe first if you need the current worker value to be populated locally
182
187
  - this pattern is designed around `BehaviorSubject`-like objects
183
188
 
184
- ## Waiting For Multiple Services To Initialize
185
-
186
- `ServiceLinker` exposes a helper for waiting until all linked services have loaded their initial state.
187
-
188
- ```ts
189
- const counter = linker.linkService<WorkerService<CounterService>>("counter")
190
- const settings = linker.linkService<WorkerService<SettingsService>>("settings")
191
-
192
- ServiceLinker.ready$({ counter, settings }).subscribe((ready) => {
193
- if (ready) {
194
- console.log("all services initialized")
195
- }
196
- })
197
- ```
189
+ There is currently no built-in readiness helper in `ServiceLinker`.
198
190
 
199
191
  ## Nested Access
200
192
 
@@ -310,7 +302,6 @@ Creates and caches client-side proxies.
310
302
  class ServiceLinker {
311
303
  constructor(channel: RpcChannel)
312
304
  linkService<T>(name: string): WorkerService<T>
313
- static ready$(services: Record<string, any>): Observable<boolean>
314
305
  }
315
306
  ```
316
307
 
@@ -320,7 +311,7 @@ Behavior:
320
311
  - assigns incrementing request ids
321
312
  - returns an `Observable` that is also `PromiseLike`
322
313
  - sends cancellation when a request is unsubscribed early
323
- - initializes `BehaviorSubject`-style values via `____initialize____`
314
+ - special-cases `subscribe`, `pipe`, and `getValue` for remote observable-like properties
324
315
 
325
316
  ### `WorkerService<T>`
326
317
 
@@ -330,7 +321,7 @@ Rules:
330
321
 
331
322
  - `BehaviorSubject<T>` stays `BehaviorSubject<T>`
332
323
  - `Observable<T>` stays `Observable<T>`
333
- - methods become async call signatures
324
+ - methods become async call signatures unless their awaited return type is already an `Observable`
334
325
 
335
326
  Example:
336
327
 
@@ -422,8 +413,6 @@ bun run build
422
413
  Other scripts:
423
414
 
424
415
  - `bun run clean`
425
- - `bun run build:js`
426
- - `bun run build:types`
427
416
  - `bun run build:watch`
428
417
 
429
418
  ## Package Output
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@livequery/rpc",
3
- "version": "2.0.100",
3
+ "version": "2.0.101",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",