@shivaedev/contract 0.26.0 → 0.28.0

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 (97) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/README.md +140 -20
  3. package/dist/LiveServer.d.ts +30 -0
  4. package/dist/LiveServer.d.ts.map +1 -0
  5. package/dist/LiveServer.js +16 -0
  6. package/dist/LiveServer.js.map +1 -0
  7. package/dist/bind.d.ts +1 -2
  8. package/dist/bind.d.ts.map +1 -1
  9. package/dist/bind.js.map +1 -1
  10. package/dist/clientActivity.d.ts +17 -0
  11. package/dist/clientActivity.d.ts.map +1 -0
  12. package/dist/clientActivity.js +8 -0
  13. package/dist/clientActivity.js.map +1 -0
  14. package/dist/clientOptions.d.ts +3 -1
  15. package/dist/clientOptions.d.ts.map +1 -1
  16. package/dist/internal/clientActivity.d.ts +23 -0
  17. package/dist/internal/clientActivity.d.ts.map +1 -0
  18. package/dist/internal/clientActivity.js +68 -0
  19. package/dist/internal/clientActivity.js.map +1 -0
  20. package/dist/internal/clientOperations.d.ts.map +1 -1
  21. package/dist/internal/clientOperations.js +5 -7
  22. package/dist/internal/clientOperations.js.map +1 -1
  23. package/dist/internal/livePending.d.ts +7 -0
  24. package/dist/internal/livePending.d.ts.map +1 -0
  25. package/dist/internal/livePending.js +27 -0
  26. package/dist/internal/livePending.js.map +1 -0
  27. package/dist/internal/policyContext.d.ts +4 -0
  28. package/dist/internal/policyContext.d.ts.map +1 -0
  29. package/dist/internal/policyContext.js +7 -0
  30. package/dist/internal/policyContext.js.map +1 -0
  31. package/dist/internal/queryReactivity.d.ts +1 -1
  32. package/dist/internal/queryReactivity.d.ts.map +1 -1
  33. package/dist/internal/queryReactivity.js +24 -9
  34. package/dist/internal/queryReactivity.js.map +1 -1
  35. package/dist/internal/rpcClient.d.ts +6 -7
  36. package/dist/internal/rpcClient.d.ts.map +1 -1
  37. package/dist/internal/rpcClient.js +35 -5
  38. package/dist/internal/rpcClient.js.map +1 -1
  39. package/dist/live.d.ts.map +1 -1
  40. package/dist/live.js +12 -18
  41. package/dist/live.js.map +1 -1
  42. package/dist/makeLiveServer.d.ts.map +1 -1
  43. package/dist/makeLiveServer.js +2 -2
  44. package/dist/makeLiveServer.js.map +1 -1
  45. package/dist/operation.d.ts +3 -3
  46. package/dist/operation.d.ts.map +1 -1
  47. package/dist/operation.js +1 -1
  48. package/dist/operation.js.map +1 -1
  49. package/dist/querySubscription.d.ts +1 -1
  50. package/dist/querySubscription.d.ts.map +1 -1
  51. package/dist/querySubscription.js +12 -2
  52. package/dist/querySubscription.js.map +1 -1
  53. package/dist/readPolicy.d.ts +1 -0
  54. package/dist/readPolicy.d.ts.map +1 -1
  55. package/dist/readPolicy.js +6 -3
  56. package/dist/readPolicy.js.map +1 -1
  57. package/dist/readPolicyErrors.d.ts +6 -0
  58. package/dist/readPolicyErrors.d.ts.map +1 -1
  59. package/dist/readPolicyErrors.js +5 -0
  60. package/dist/readPolicyErrors.js.map +1 -1
  61. package/dist/serverMetadata.d.ts +1 -0
  62. package/dist/serverMetadata.d.ts.map +1 -1
  63. package/dist/serverMetadata.js +1 -1
  64. package/dist/serverMetadata.js.map +1 -1
  65. package/dist/socketAuthentication.d.ts +18 -0
  66. package/dist/socketAuthentication.d.ts.map +1 -0
  67. package/dist/socketAuthentication.js +27 -0
  68. package/dist/socketAuthentication.js.map +1 -0
  69. package/dist/testing.d.ts +4 -2
  70. package/dist/testing.d.ts.map +1 -1
  71. package/dist/testing.js +35 -1
  72. package/dist/testing.js.map +1 -1
  73. package/dist/validateReadPolicies.d.ts +5 -0
  74. package/dist/validateReadPolicies.d.ts.map +1 -0
  75. package/dist/validateReadPolicies.js +25 -0
  76. package/dist/validateReadPolicies.js.map +1 -0
  77. package/package.json +7 -3
  78. package/src/LiveServer.ts +20 -0
  79. package/src/bind.ts +1 -5
  80. package/src/clientActivity.ts +24 -0
  81. package/src/clientOptions.ts +9 -6
  82. package/src/internal/clientActivity.ts +78 -0
  83. package/src/internal/clientOperations.ts +5 -9
  84. package/src/internal/livePending.ts +28 -0
  85. package/src/internal/policyContext.ts +8 -0
  86. package/src/internal/queryReactivity.ts +29 -9
  87. package/src/internal/rpcClient.ts +47 -9
  88. package/src/live.ts +15 -18
  89. package/src/makeLiveServer.ts +2 -2
  90. package/src/operation.ts +5 -5
  91. package/src/querySubscription.ts +15 -3
  92. package/src/readPolicy.ts +7 -3
  93. package/src/readPolicyErrors.ts +5 -0
  94. package/src/serverMetadata.ts +2 -1
  95. package/src/socketAuthentication.ts +28 -0
  96. package/src/testing.ts +42 -2
  97. package/src/validateReadPolicies.ts +26 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,41 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.28.0 - 2026-10-31
4
+
5
+ ### Added
6
+
7
+ - `layerMemoryProtocol(group)` in `testing.ts` connects `makeClient` to native RPC handlers and middleware in process, including live hints and query refreshes, without a socket or a separate `AtomRpc.Service` per contract.
8
+ - Native clients can pass `bearerToken` to `makeClient` to authenticate the shared RPC WebSocket in its first frame, without upgrade headers or credentials in URLs. The server applies its existing session and read policies, closes invalid or expired authentication with code 1008, and closes authenticated bearer sockets when their session is revoked. Native resume reconciles live query values.
9
+ - Contract exports the `signedIn` read policy and `validateReadPolicies(group)` for native hosts to validate their RPC group during Layer construction.
10
+ - Contract exposes `LiveServer` through `defineService`, with a native `.layer` requiring Reactivity. Its `stream` and `subscribe` methods return Effects containing native Streams, retaining subscription failures and caller requirements.
11
+
12
+ ### Fixed
13
+
14
+ - Live subscriptions use policy services provided inside the owning query's handlers layer, just as RPC reads do. Request-local session context takes precedence when the policy checks access to live hints.
15
+ - Admin's built-in Users and Jobs queries and Work Board's daemon diagnostics queries explicitly declare read policies; existing permission and loopback boundaries continue to own access.
16
+
17
+ ### Breaking
18
+
19
+ - Every contract query requires a `readPolicy`, including plain RPC reads. Add `readPolicy: signedIn` for any signed-in viewer, an explicit `() => Effect.succeed(true)` for public reads, or an application policy for restricted reads. Plain calls without a policy now fail closed with `MissingReadPolicy` even on native servers that bypass startup validation.
20
+ - The application server Layer fails with typed `MissingReadPolicies` before listening when untyped queries omit policies. Handle this boot error if your application narrows startup failures; its `queries` field lists every affected RPC. Query atom error types now follow their native RPC errors without an extra client-side `MissingReadPolicy` branch. Custom `ChangesQueries` annotations must now include their query definitions in `queries` alongside `resolve`.
21
+ - Server's `AppChanges` is replaced by `LiveServer` from `@shivaedev/contract/LiveServer.ts`. Replace `AppChanges` imports and requirements with `LiveServer` (use `Context.Service.Identifier<typeof LiveServer>` for its identifier type). PostgreSQL `appHost` and `appDatabase` provide it automatically; HTTP-only apps provide `LiveServer.layer` with Reactivity instead of `Layer.effect(AppChanges, makeLiveServer)`. Call `resync()` instead of reading `resync`, and use `Stream.unwrap` around the Effects returned by `stream` and `subscribe`.
22
+ - Server composition helpers (`appHostHttp`, `migratedHost`, `deferredHost`, `hostRpcRoutes` and `hostChanges`) resolve the contract service directly. Remove their live-service tag argument; calls to the former `databaseLayer(options, tag)` become `appDatabase(options)`.
23
+ - Work Board's `publishChanges` and Work Fleet's `daemonSnapshots` now require contract's `LiveServer` instead of server's `AppChanges`. Custom compositions must provide `LiveServer.layer` with Reactivity; their standard hosts already do so.
24
+ - Import server's `appDatabase` and `DatabaseConfig` directly from `@shivaedev/server/appDatabase.ts`; `appHost.ts` no longer forwards `appDatabase`, and `databaseLayer.ts` is removed.
25
+
26
+ ## 0.27.0 - 2026-10-31
27
+
28
+ ### Added
29
+
30
+ - Contract clients expose `clientActivity(client)`, a native Effect `Stream` with a `current` Effect reporting finite RPC calls, queued live invalidations, refreshing query atoms and received live hints.
31
+ - Screen drivers accept that activity as `pending`, wait for idle activity with their renderer before screen assertions, and expose `nextLiveHint()` for the next client delivery. Stories keep live coalescing enabled.
32
+
33
+ ### Fixed
34
+
35
+ - Live hint and query coalescing delays use the atom runtime's Clock, so TestClock can drive their windows without waiting in real time. Resyncs and registry disposal cancel pending delays.
36
+ - Live server resync identities use Effect's Random service, allowing a seeded runtime to reproduce them.
37
+ - Shared RPC WebSockets measure opening, heartbeat and reconnect delays on live time, so advancing an application's TestClock does not time out a real connection. Application timers keep their own clock.
38
+
3
39
  ## 0.26.0 - 2026-10-31
4
40
 
5
41
  ### Added
package/README.md CHANGED
@@ -225,6 +225,8 @@ const rename = runtime.fn(api.rename.run);
225
225
 
226
226
  Browsers send the session cookie at upgrade. Mounting a query opens its subscription before running its first authorized read; unmounting cancels that subscription without restarting the socket or another query. Changed keys rerun only their readers, and equal results retain the bound atom's value. Connection failures use Effect RPC's reconnect backoff; subscriptions resume and mounted queries read again because there is no retained key history. `LiveConnection.status` reports `connecting`, `live` or `reconnecting`.
227
227
 
228
+ For a native WebView, pass the signed session credential as `bearerToken` to `makeClient`. The browser WebSocket constructor needs no upgrade headers. The client adds `auth=frame` to the RPC URL and sends `{"_tag":"Authenticate","token":"<credential>"}` as its first text frame on every connection, before native RPC traffic. The bearer never enters the URL. Use a host session provider that admits bearer sessions and configure the WebView's Origin on the host. Authentication failures close the socket with code 1008 and reason `Authentication required`; an unavailable session provider closes it with code 1011 and reason `Authentication unavailable`. Sign-out or session expiry also closes an established bearer socket. Bind the client's service with a native `resume` source as shown below to reconcile live reads when the shell resumes.
229
+
228
230
  `group` supplies a larger native RPC group containing the contract, such as an admin registry. The result is a native client Layer for `ManagedRuntime.make`, plus the native `Client` service, atom `runtime` and scoped `client` Effect. Session-scoped contracts require `registry`. For Node clients, supply upgrade `headers` and `webSocketConstructor: NodeSocket.layerWebSocketConstructorWS` from `@effect/platform-node`. A native `protocol` Layer selects another transport explicitly. A `protocol: (identity) => layer` factory follows the live session identity instead: the client rebuilds its transport when that identity changes. The scoped `client` Effect uses `undefined` as the factory identity. Return a shared Layer for clients that should share a socket within one session. Use `live: false` for ordinary clients without subscriptions.
229
231
 
230
232
  ### 3. Every day: read and change
@@ -271,6 +273,10 @@ The dependency rule is deliberately asymmetric:
271
273
 
272
274
  Client invalidation follows RPC success. Database hosts from `@shivaedev/server` also publish declared command invalidations automatically after the handler succeeds, excluding keys already announced by repository commits, using `transact` from [`sql`](https://github.com/ShivaeDev/platform/tree/main/packages/sql); commit-bound changes belong to [`changes`](https://github.com/ShivaeDev/platform/tree/main/packages/changes).
273
275
 
276
+ ### Client activity
277
+
278
+ `clientActivity(client)` from `@shivaedev/contract/clientActivity.ts` returns a native Effect `Stream` with a `current` Effect for a client made by `makeClient`. Its state reports `rpcCalls` for finite calls, `liveInvalidations` for queued live refreshes, `refreshingAtoms` for mounted query atoms awaiting values, and a `liveHints` sequence for received subscription updates. Long-lived streams do not count as finite calls. `isClientIdle(state)` is true when all three work counts are zero. Observe its stream or pass it to a test-story screen driver's `pending` option and call `settle()` before screen assertions. Coalesced work stays pending until its refresh completes.
279
+
274
280
  ### Session-owned keys
275
281
 
276
282
  A self-only feature, such as a user's preferences, reads and changes only the signed-in account's records. Declare its contract with `keyScope: "session"`. The server chooses the account from request-local identity, so payloads carry no owner field, and reads and invalidations name a logical item key for the record:
@@ -281,6 +287,7 @@ const Preferences = contract("preferences", {
281
287
  keyScope: "session",
282
288
  queries: [
283
289
  query("self", {
290
+ readPolicy: signedIn,
284
291
  reads: () => [preferences.item("self")],
285
292
  success: Schema.String,
286
293
  }),
@@ -415,7 +422,7 @@ const releaseConnection = registry.mount(updates.connection);
415
422
  | `Resync` | The exact `resyncKeys` read scope. |
416
423
  | First hint on a new or reconnected stream | The full explicit scope, even if the hint is targeted. |
417
424
 
418
- Changed hints share a fixed 20 ms window by default. Their keys merge, and each affected bound query refetches once per window. A bound query already fetching keeps its request and refetches once more after it settles if further hints arrive. Set `coalesceWindow` in `live()` to a native Duration, or set `SessionBoundary`'s `liveCoalesceWindow` for automatic session connections. Zero restores immediate per-hint invalidation, including interruption of in-flight reads. Full reconciliation on first hint, reconnect, resume and unpause stays immediate. Registry teardown cancels a pending window.
425
+ Changed hints share a fixed 20 ms window by default. Their keys merge, and each affected bound query refetches once per window. A bound query already fetching keeps its request and refetches once more after it settles if further hints arrive. Set `coalesceWindow` in `live()` to a native Duration, or set `SessionBoundary`'s `liveCoalesceWindow` for automatic session connections. Zero restores immediate per-hint invalidation, including interruption of in-flight reads. Full reconciliation on first hint, reconnect, resume and unpause stays immediate. Registry teardown and resyncs cancel a pending window. Windows sleep on the atom runtime's Clock, so `TestClock` drives them.
419
426
 
420
427
  `queryCoalesceWindow(query)` from `@shivaedev/contract/queryCoalesceWindow.ts` returns a writable native atom for that bound query's live changed-hint window. Set it through the query's registry to a Duration, or `undefined` to use the live connection's default. Changing it does not refetch or reconnect; the next window uses the new value. React consumers can set it with `useQuery(query, { coalesceWindow: "2 seconds" })`.
421
428
 
@@ -443,34 +450,144 @@ Call the release functions and dispose the registry when the application's root
443
450
 
444
451
  ### Server hint streams
445
452
 
453
+ Import `LiveServer` from `@shivaedev/contract/LiveServer.ts`. Provide `LiveServer.layer` with the server's `Reactivity` Layer; PostgreSQL `appHost` apps already provide it. Yield `LiveServer` to obtain the shared service. Its methods return Effects: unwrap `hints.stream(keys, context)` or `hints.subscribe(subscription, context, read?)` with `Stream.unwrap`, and call `hints.resync()` to reconcile its active streams. Subscription policy failures and caller requirements remain on the returned Stream.
454
+
446
455
  Import `makeLiveServer` from `@shivaedev/contract/makeLiveServer.ts` and create it once with the server's `Reactivity` service. After application authorization, return `hints.stream([orders.item(id)])` from the native streaming RPC handler. Each subscription starts with `Resync`; invalidating its read keys produces `Changed` with those declared keys. `hints.resync` sends `Resync` to every live stream owned by that helper, including streams for otherwise unrelated keys. Independent helpers keep their resync scopes separate even when they share Reactivity. The native stream owns registration and interruption. Keep this server helper separate from the browser's `live` coordinator.
447
456
 
448
457
  Each stream queues at most 256 hints. Overflow discards the pending hints and retains one `Resync`; further hints are absorbed until that reconciliation hint is pulled. A stalled consumer can then read current query results without replaying the write backlog. This bounds the helper's queue by hint count, not by bytes: each hint's keys depend on the subscription. Transport buffers remain the transport's responsibility.
449
458
 
450
459
  ### Query policies, record keys and buckets
451
460
 
452
- A query declares its decoded input, result, `readPolicy` and `reads` together. `readPolicy(payload, viewer)` returns an Effect boolean. `viewer` is the session's `Option<{ id: string }>`; the browser does not send the identity. `QueryReadPolicy<Payload, E, R>` preserves typed failures and required services. Declare policy errors in the query's `rejections` and provide its services when building the handler Layer; those requirements also apply to the generated change subscription. Policies may use browser-safe Effect service tags whose implementations the server supplies. A failing access check reaches the client as its declared error, including during live reads; only a successful `false` denies access.
461
+ A query declares its decoded input, result, `readPolicy` and `reads` together. `readPolicy(payload, viewer)` returns an Effect boolean. `viewer` is the session's `Option<{ id: string }>`; the browser does not send the identity. `signedIn` from `readPolicy.ts` allows any signed-in viewer and refuses a signed-out viewer. `QueryReadPolicy<Payload, E, R>` preserves typed failures and required services. Declare policy errors in the query's `rejections`; a failing access check reaches the client as its declared error, including during live reads. Only a successful `false` denies access. [Policy services](#policy-services) explains richer session requirements and where to provide implementations.
453
462
 
454
463
  ```ts
455
- import { Effect, Option, Schema } from "effect";
464
+ import { Option, Schema } from "effect";
456
465
  import { collection } from "@shivaedev/changes/keys.ts";
457
466
  import { query } from "@shivaedev/contract/operation.ts";
467
+ import { signedIn } from "@shivaedev/contract/readPolicy.ts";
458
468
 
459
469
  const notes = collection("notes", Schema.Number, { userId: Schema.String });
460
470
  const Mine = query("mine", {
461
471
  payload: { title: Schema.String },
462
472
  success: Schema.Array(Schema.String),
463
- readPolicy: (_input, viewer) => Effect.succeed(Option.isSome(viewer)),
473
+ readPolicy: signedIn,
464
474
  reads: (_input, viewer) => (Option.isSome(viewer) ? [notes.bucket.userId(viewer.value.id)] : []),
465
475
  });
466
476
  ```
467
477
 
478
+ Return `false` when denial may be disclosed; the caller receives `QueryReadDenied`. For a private item whose existence the viewer must not learn, fail with a declared `NotFound` for both an absent item and an item owned by someone else:
479
+
480
+ ```ts
481
+ import { Context, Effect, Option, Schema } from "effect";
482
+ import { query } from "@shivaedev/contract/operation.ts";
483
+ import { NotFound } from "@shivaedev/errors/taxonomy.ts";
484
+
485
+ class NoteOwner extends Context.Service<NoteOwner, (id: number) => Effect.Effect<Option.Option<string>>>()("app/NoteOwner") {}
486
+ const PrivateNote = query("privateNote", {
487
+ payload: { id: Schema.Number },
488
+ readPolicy: ({ id }, viewer) =>
489
+ Effect.gen(function* () {
490
+ if (Option.isNone(viewer)) {
491
+ return false;
492
+ }
493
+ const owner = yield* (yield* NoteOwner)(id);
494
+ if (Option.isNone(owner) || owner.value !== viewer.value.id) {
495
+ return yield* new NotFound({ message: "Note not found" });
496
+ }
497
+ return true;
498
+ }),
499
+ reads: () => [],
500
+ rejections: { NotFound },
501
+ success: Schema.String,
502
+ });
503
+ ```
504
+
505
+ The server provides `NoteOwner`; the shared declaration holds only its browser-safe service tag. The same typed rejection reaches ordinary reads and live subscriptions.
506
+
468
507
  A record key, `notes.item(id)`, names one record. A bucket, `notes.bucket.userId(id)`, names every row with that field value. Declare bucket fields on the collection model with their schemas. A list may add title, state or other filters to its input and handler, but those filters never narrow its bucket. It reruns whenever any row in that bucket changes, including a row excluded by the filter. Writers explicitly announce the record and affected buckets with the same constructors from `@shivaedev/changes/keys.ts`.
469
508
 
470
- The same query policy guards running the query and subscribing to it. A subscription names query references, never arbitrary record or bucket keys. The entire subscription is refused with `QueryReadDenied` if any referenced query is denied. Without `readPolicy`, a query has no authorized live subscription: `MissingReadPolicy` tells its author to declare one. Bound query atoms also refuse a missing policy before their first read. Ordinary one-off `run` calls remain available. Reads outside a declared query acquire no automatic subscription.
509
+ The same query policy guards running the query and subscribing to it. A subscription is meant to carry one query. It names query references, never arbitrary record or bucket keys. If a subscription mixes queries the viewer may and may not read, the entire subscription is refused with `QueryReadDenied`; it delivers no partial set of hints. Every query requires `readPolicy` at declaration, including queries used only through one-off `run` calls. TypeScript rejects a policy-less declaration before handlers or a live server can be built. Platform’s application host validates the complete RPC group while building its Layer, before listening; untyped declarations missing policies fail with `MissingReadPolicies`, whose `queries` and `message` name every affected RPC. Native hosts can run `validateReadPolicies(group)` during their own Layer construction. `MissingReadPolicy` remains a request-time refusal for untyped declarations served through native servers that bypass that boot check, on plain calls and subscriptions alike. Reads outside a declared query acquire no automatic subscription.
471
510
 
472
511
  The session middleware supplies the viewer and runs `authorizeReads(effect, request, viewer)`. Custom middleware calls that function after resolving its session and declares `MissingReadPolicy` and `QueryReadDenied` in its error schema. Before delivering changed keys, the stream rechecks the owning query's policy without memoization. In a session-backed host, a signed-out, revoked or expired session ends the subscription with `Unauthorized`; a signed-in viewer whose policy refuses ends it with `QueryReadDenied`. This distinction is the same whether a change hint or the session revalidation interval detects session removal. A client refresh runs the same authorized query that produced its first value; hints carry no row values.
473
512
 
513
+ ### Policy services
514
+
515
+ Use the policy's `viewer` argument for the viewer ID. Read richer session context from Effect requirements. For example, a policy service can require `SessionUserWithProviderAccounts` from `@shivaedev/identity/identity.ts` and yield its `providerAccounts` Effect. Apply `AuthenticatedUserWithProviderAccounts` middleware to the contract and supply `authenticatedUserWithProviderAccountsLayer(sessionPolicy)` from `@shivaedev/identity/server/session.ts` alongside its handlers. The middleware provides this request-local context for both RPC calls and live change hints, including each policy recheck before a hint is delivered.
516
+
517
+ Keep the policy service tag and query declaration browser-safe; put its implementation on the server. Its method retains the session service in its requirements so the session is read when the policy runs:
518
+
519
+ ```ts
520
+ import { Context, Effect, Option, Schema } from "effect";
521
+ import { contract } from "@shivaedev/contract/contract.ts";
522
+ import { query } from "@shivaedev/contract/operation.ts";
523
+ import type { Viewer } from "@shivaedev/contract/readPolicy.ts";
524
+ import { AuthUnavailable, Unauthorized } from "@shivaedev/errors/taxonomy.ts";
525
+ import { SessionUserWithProviderAccounts } from "@shivaedev/identity/identity.ts";
526
+ import { AuthenticatedUserWithProviderAccounts } from "@shivaedev/identity/middleware.ts";
527
+
528
+ class ReadAccess extends Context.Service<
529
+ ReadAccess,
530
+ {
531
+ readonly allows: (
532
+ accountId: string,
533
+ viewer: Option.Option<Viewer>,
534
+ ) => Effect.Effect<boolean, AuthUnavailable | Unauthorized, SessionUserWithProviderAccounts>;
535
+ }
536
+ >()("app/ReadAccess") {}
537
+
538
+ const Get = query("get", {
539
+ payload: { accountId: Schema.String },
540
+ readPolicy: ({ accountId }, viewer) => Effect.flatMap(ReadAccess, (access) => access.allows(accountId, viewer)),
541
+ reads: () => [],
542
+ rejections: { AuthUnavailable, Unauthorized },
543
+ success: Schema.String,
544
+ });
545
+ const Documents = contract("documents", { queries: [Get] }).middleware(AuthenticatedUserWithProviderAccounts);
546
+ ```
547
+
548
+ Provide the implementation from the query's handlers layer with native `Layer.provide`:
549
+
550
+ ```ts
551
+ import { Effect, Layer, Option } from "effect";
552
+
553
+ const ReadAccessLive = Layer.succeed(ReadAccess, {
554
+ allows: (accountId, viewer) =>
555
+ Effect.gen(function* () {
556
+ const user = yield* SessionUserWithProviderAccounts;
557
+ const accounts = yield* user.providerAccounts;
558
+ return (
559
+ Option.isSome(viewer)
560
+ && viewer.value.id === user.id
561
+ && accounts.some((account) => account.providerId === "github" && account.accountId === accountId)
562
+ );
563
+ }),
564
+ });
565
+ const DocumentHandlers = Documents.application
566
+ .toLayer({
567
+ "documents.get": ({ accountId }) => Effect.succeed(`Document for ${accountId}`),
568
+ })
569
+ .pipe(Layer.provide(ReadAccessLive));
570
+ ```
571
+
572
+ The generated subscription uses the owning query handler's captured services too, so this handler-only provision serves subscriptions as well as RPC calls. Request-local services take precedence over captured services; a session value installed while building handlers cannot replace the current viewer's session. The policy runs again for live hints; its allow or deny result is not cached.
573
+
574
+ ### In-memory clients in story kits
575
+
576
+ `layerMemoryProtocol(group)` from `@shivaedev/contract/testing.ts` connects the native RPC client and server in the same process. Provide the group's handlers and middleware with `Layer.provide`, then pass the protocol to the application's client factory:
577
+
578
+ ```ts
579
+ import { Layer } from "effect";
580
+ import { makeClient } from "@shivaedev/contract/bind.ts";
581
+ import { layerMemoryProtocol } from "@shivaedev/contract/testing.ts";
582
+
583
+ const client = makeClient(Notes, {
584
+ protocol: layerMemoryProtocol(Notes).pipe(Layer.provide(handlers)),
585
+ url: "memory://notes",
586
+ });
587
+ ```
588
+
589
+ The URL identifies the client configuration; the in-memory protocol opens no socket. The client's direct calls and bound query atoms use the real handlers, schema decoding and middleware. Live subscriptions deliver the server's initial resync and changed hints, and mounted queries refresh from those hints. Closing a subscription interrupts its server stream. The protocol does not add handlers or publish changes: provide the same live handlers and change source that the application serves over WebSocket.
590
+
474
591
  ### Live hints in stories
475
592
 
476
593
  Use `watchHints` and `heard` from `@shivaedev/contract/testing.ts` in an application's story kit. Pass each viewer's authenticated live stream to `watchHints`; it starts a scoped subscription and waits for its first hint before returning the viewer handle.
@@ -489,21 +606,24 @@ expect(yield* heard(bob, [notes.item(1)], { within: "50 millis" })).toBe(false);
489
606
 
490
607
  Import the module that defines the name; the package has no root entry.
491
608
 
492
- | Module | Functions and schemas |
493
- | ------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
494
- | `operation.ts` | `query(name, { payload?, success?, rejections?, readPolicy?, reads })`; `command(name, { payload?, success?, rejections?, invalidates })`; `stream(name, { payload?, success, rejections?, reads })`. |
495
- | `contract.ts` | `contract(name, { queries?, commands?, streams?, keyScope? })`, returning a native RPC group with `declaration: { name, queries, commands, streams, keyScope }`. |
496
- | `rejection.ts` | `fieldRejection(struct, fields?)`; lower-level `rejectionSet(specs)`, which constructs the rejection classes, union schema and failure helpers used by operations. |
497
- | `bind.ts` | `bind(contract, atomRpcService, { registry?, live?, resume?, resumeWindow? }?)`, requiring the registry for session-scoped contracts and exposing `{ query, run }` for queries, `{ run }` Effects for commands and `{ run }` native Streams for streams; `makeClient(contract, { url, protocol?, headers?, webSocketConstructor?, group?, registry?, live? })`, which builds the shared WebSocket client and binds it. |
498
- | `queryCoalesceWindow.ts` | `queryCoalesceWindow(query)`, a writable atom for a bound query's live changed-hint window. |
499
- | `live.ts` | `LiveHint` schema; `live(runtime, { stream, resyncKeys, coalesceWindow?, initialResync?, keyContext?, resume?, retryDelay?, retryKeys? })`, exposing `connection`, `coalesceWindow`, `paused` and `status`. |
500
- | `querySubscription.ts` | `querySubscription(rpc, references, viewer)` checks each referenced query and captures its scopes and ongoing authorization. |
501
- | `makeLiveServer.ts` | `makeLiveServer`, an Effect requiring `Reactivity` that creates scoped server hint streams and a `resync` Effect. |
502
- | `readPolicy.ts` | `QueryReadPolicy`, `Viewer`, `authorizeReads(effect, request, viewer)`, `CurrentViewer`. |
503
- | `readPolicyErrors.ts` | `MissingReadPolicy` and `QueryReadDenied`. |
504
- | `serverMetadata.ts` | `KeyScope`, `QueryDefinition.definition`, `CommandInvalidation.invalidates`, `ChangesQueries.resolve(references)`, the Effect `queryKeys(queries, references)` and `changesRpc(name, queries)` for server adapters. |
505
- | `resume.ts` | `resumeSignal({ window?, native? })`, returning a native numeric signal atom. |
506
- | `testing.ts` | `watchHints(stream)` starts a scoped viewer subscription; `heard(viewer, keys, { within? }?)` waits for matching changed keys. |
609
+ | Module | Functions and schemas |
610
+ | ------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
611
+ | `operation.ts` | `query(name, { payload?, success?, rejections?, readPolicy, reads })`; `command(name, { payload?, success?, rejections?, invalidates })`; `stream(name, { payload?, success, rejections?, reads })`. |
612
+ | `contract.ts` | `contract(name, { queries?, commands?, streams?, keyScope? })`, returning a native RPC group with `declaration: { name, queries, commands, streams, keyScope }`. |
613
+ | `rejection.ts` | `fieldRejection(struct, fields?)`; lower-level `rejectionSet(specs)`, which constructs the rejection classes, union schema and failure helpers used by operations. |
614
+ | `bind.ts` | `bind(contract, atomRpcService, { registry?, live?, resume?, resumeWindow? }?)`, requiring the registry for session-scoped contracts and exposing `{ query, run }` for queries, `{ run }` Effects for commands and `{ run }` native Streams for streams; `makeClient(contract, { url, protocol?, headers?, webSocketConstructor?, group?, registry?, live? })`, which builds the shared WebSocket client and binds it. |
615
+ | `queryCoalesceWindow.ts` | `queryCoalesceWindow(query)`, a writable atom for a bound query's live changed-hint window. |
616
+ | `live.ts` | `LiveHint` schema; `live(runtime, { stream, resyncKeys, coalesceWindow?, initialResync?, keyContext?, resume?, retryDelay?, retryKeys? })`, exposing `connection`, `coalesceWindow`, `paused` and `status`. |
617
+ | `querySubscription.ts` | `querySubscription(rpc, references, viewer)` checks each referenced query and captures its scopes and ongoing authorization. |
618
+ | `LiveServer.ts` | `LiveServer`, the shared live server service and its `.layer`, requiring `Reactivity`. |
619
+ | `makeLiveServer.ts` | `makeLiveServer`, an Effect requiring `Reactivity` that creates scoped server hint streams and a `resync` Effect. |
620
+ | `readPolicy.ts` | `QueryReadPolicy`, `Viewer`, `signedIn`, `authorizeReads(effect, request, viewer)`, `CurrentViewer`. |
621
+ | `validateReadPolicies.ts` | `validateReadPolicies(group)`, an Effect that fails with `MissingReadPolicies` when any served or subscribable query omits its policy. |
622
+ | `readPolicyErrors.ts` | `MissingReadPolicies` (boot), `MissingReadPolicy` (native-server request fallback) and `QueryReadDenied`. |
623
+ | `serverMetadata.ts` | `KeyScope`, `QueryDefinition.definition`, `CommandInvalidation.invalidates`, `ChangesQueries.queries`, `ChangesQueries.resolve(references)`, the Effect `queryKeys(queries, references)` and `changesRpc(name, queries)` for server adapters. |
624
+ | `resume.ts` | `resumeSignal({ window?, native? })`, returning a native numeric signal atom. |
625
+ | `clientActivity.ts` | `clientActivity(client)` exposes a native activity Stream with a `current` Effect; `isClientIdle(state)` checks finite work. |
626
+ | `testing.ts` | `layerMemoryProtocol(group)` supplies an in-memory native RPC protocol backed by the group’s handlers and middleware; `watchHints(stream)` starts a scoped viewer subscription; `heard(viewer, keys, { within? }?)` waits for matching changed keys. |
507
627
 
508
628
  A query atom takes native query options as its optional second argument, for example `api.get.query({ id: 1 }, { timeToLive: "1 minute" })`. A native resume source receives a callback and returns a cleanup function.
509
629
 
@@ -0,0 +1,30 @@
1
+ import { Effect } from "effect";
2
+ import * as Reactivity from "effect/reactivity/Reactivity";
3
+ import type { Key, KeyContext } from "@shivaedev/changes/keys.ts";
4
+ import type { QueryRerun, QuerySubscription } from "#querySubscription.ts";
5
+ export declare const LiveServer: import("effect/Context").Service<"@shivaedev/contract/LiveServer", Readonly<{
6
+ readonly resync: () => Effect.Effect<number, never, never>;
7
+ readonly stream: (keys: readonly Key[], context?: KeyContext | undefined) => Effect.Effect<import("effect/Stream").Stream<{
8
+ readonly _tag: "Changed";
9
+ readonly keys: readonly ({
10
+ readonly _tag: "Bucket";
11
+ readonly collection: string;
12
+ readonly field: string;
13
+ readonly value: string | number;
14
+ } | {
15
+ readonly _tag: "List";
16
+ readonly collection: string;
17
+ } | {
18
+ readonly _tag: "Item";
19
+ readonly collection: string;
20
+ readonly id: string | number;
21
+ })[];
22
+ readonly queryIndexes?: readonly number[] | undefined;
23
+ } | {
24
+ readonly _tag: "Resync";
25
+ }, never, never>, never, never>;
26
+ readonly subscribe: <E, R>(subscription: QuerySubscription<E, R>, context?: KeyContext, read?: QueryRerun<E, R>) => Effect.Effect<import("effect/Stream").Stream<import("./queryUpdate.ts").QueryUpdate, E | import("./readPolicyErrors.ts").QueryReadDenied, R>, never, never>;
27
+ }>> & {
28
+ readonly layer: import("effect/Layer").Layer<"@shivaedev/contract/LiveServer", never, Reactivity.Reactivity>;
29
+ };
30
+ //# sourceMappingURL=LiveServer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LiveServer.d.ts","sourceRoot":"","sources":["../src/LiveServer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,KAAK,UAAU,MAAM,8BAA8B,CAAC;AAC3D,OAAO,KAAK,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAIlE,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE3E,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;yBAMK,CAAC,EAAE,CAAC,gBAAgB,iBAAiB,CAAC,CAAC,EAAE,CAAC,CAAC,YAAY,UAAU,SAAS,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC;;;CAKpH,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { Effect } from "effect";
2
+ import * as Reactivity from "effect/reactivity/Reactivity";
3
+ import { defineService } from "@shivaedev/service/defineService.ts";
4
+ import { genericMethod } from "@shivaedev/service/genericMethod.ts";
5
+ import { makeLiveServer } from "#makeLiveServer.ts";
6
+ export const LiveServer = defineService({
7
+ id: "@shivaedev/contract/LiveServer",
8
+ initialize: makeLiveServer,
9
+ methods: (server) => ({
10
+ resync: () => server.resync,
11
+ stream: (keys, context) => Effect.succeed(server.stream(keys, context)),
12
+ subscribe: genericMethod((subscription, context, read) => Effect.succeed(read === undefined ? server.subscribe(subscription, context) : server.subscribe(subscription, context, read))),
13
+ }),
14
+ requires: [Reactivity.Reactivity],
15
+ });
16
+ //# sourceMappingURL=LiveServer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LiveServer.js","sourceRoot":"","sources":["../src/LiveServer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,KAAK,UAAU,MAAM,8BAA8B,CAAC;AAE3D,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGpD,MAAM,CAAC,MAAM,UAAU,GAAG,aAAa,CAAC;IACvC,EAAE,EAAE,gCAAgC;IACpC,UAAU,EAAE,cAAc;IAC1B,OAAO,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QACrB,MAAM,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM;QAC3B,MAAM,EAAE,CAAC,IAAoB,EAAE,OAAoB,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACpG,SAAS,EAAE,aAAa,CAAC,CAAO,YAAqC,EAAE,OAAoB,EAAE,IAAuB,EAAE,EAAE,CACvH,MAAM,CAAC,OAAO,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,YAAY,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC,CAC5H;KACD,CAAC;IACF,QAAQ,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC;CACjC,CAAC,CAAC"}
package/dist/bind.d.ts CHANGED
@@ -11,7 +11,6 @@ import { type LiveBound } from "#automaticLive.ts";
11
11
  import type { ClientOptions, MadeClient } from "#clientOptions.ts";
12
12
  import type { Contract, Tag } from "#contract.ts";
13
13
  import type { CommandShape, QueryShape, StreamShape } from "#operation.ts";
14
- import type { MissingReadPolicy } from "#readPolicyErrors.ts";
15
14
  import type { ResumeSource, ResumeWindow } from "#resume.ts";
16
15
  export type Failure<R extends Rpc.Any> = R extends Rpc.Rpc<infer _Tag, infer _Payload, infer _Success, infer _Error, infer TMiddleware, infer _Requires> ? Rpc.ErrorExit<R> | TMiddleware["error"]["Type"] | RpcClientError : never;
17
16
  export type RunFailure<R extends Rpc.Any> = R extends Rpc.Rpc<infer _Tag, infer _Payload, infer _Success, infer _Error, infer TMiddleware, infer _Requires> ? Failure<R> | TMiddleware["~ClientError"] : never;
@@ -21,7 +20,7 @@ export interface QueryOptions {
21
20
  readonly timeToLive?: Duration.Input;
22
21
  }
23
22
  export interface BoundQuery<R extends Rpc.Any, TSelf> {
24
- readonly query: (payload: Rpc.Payload<R>, options?: QueryOptions) => Atom.Atom<AsyncResult.AsyncResult<Rpc.Success<R>, Failure<R> | MissingReadPolicy>>;
23
+ readonly query: (payload: Rpc.Payload<R>, options?: QueryOptions) => Atom.Atom<AsyncResult.AsyncResult<Rpc.Success<R>, Failure<R>>>;
25
24
  readonly run: (payload: Rpc.Payload<R>) => Effect.Effect<Rpc.Success<R>, RunFailure<R>, TSelf>;
26
25
  }
27
26
  export interface BoundCommand<R extends Rpc.Any, TSelf> {
@@ -1 +1 @@
1
- {"version":3,"file":"bind.d.ts","sourceRoot":"","sources":["../src/bind.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAS,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,KAAK,KAAK,WAAW,MAAM,+BAA+B,CAAC;AAClE,OAAO,KAAK,KAAK,IAAI,MAAM,wBAAwB,CAAC;AACpD,OAAO,KAAK,KAAK,YAAY,MAAM,gCAAgC,CAAC;AACpE,OAAO,KAAK,KAAK,OAAO,MAAM,2BAA2B,CAAC;AAC1D,OAAO,KAAK,KAAK,UAAU,MAAM,8BAA8B,CAAC;AAChE,OAAO,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAiB,KAAK,SAAS,EAAkB,MAAM,mBAAmB,CAAC;AAClF,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,KAAK,EAAE,QAAQ,EAAY,GAAG,EAAE,MAAM,cAAc,CAAC;AAI5D,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC3E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE7D,MAAM,MAAM,OAAO,CAAC,CAAC,SAAS,GAAG,CAAC,GAAG,IACpC,CAAC,SAAS,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AAI,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC,CAAU,CAAC;KAClG,CAAC,EACF,EAAE,CAAC,cAAc,CAAC,EAAE,SAAS,CAAC,YAAY,EAAE,CAC5C,CAAC;AACH,CAAC;AAgBD,MAAM,UAAU,UAAU,CACzB,QAEC,EACD,OAGC;IAED,MAAM,UAAU,GAAG,SAAS,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,KAAK,IAAI,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC5F,MAAM,GAAG,GAAG,OAAO,CAAC,QAAQ,EAAE,UAAU,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC1D,OAAO,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;AAC3C,CAAC"}
@@ -0,0 +1,17 @@
1
+ import type { Effect, Stream } from "effect";
2
+ export interface ClientActivityState {
3
+ readonly liveHints: number;
4
+ readonly liveInvalidations: number;
5
+ readonly refreshingAtoms: number;
6
+ readonly rpcCalls: number;
7
+ }
8
+ export type ClientActivity = Stream.Stream<ClientActivityState> & {
9
+ readonly current: Effect.Effect<ClientActivityState>;
10
+ };
11
+ export declare const Activity: unique symbol;
12
+ export interface ActiveClient {
13
+ readonly [Activity]: ClientActivity;
14
+ }
15
+ export declare function clientActivity(client: ActiveClient): ClientActivity;
16
+ export declare function isClientIdle(state: ClientActivityState): boolean;
17
+ //# sourceMappingURL=clientActivity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clientActivity.d.ts","sourceRoot":"","sources":["../src/clientActivity.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAE7C,MAAM,WAAW,mBAAmB;IACnC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC,mBAAmB,CAAC,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAA;CAAE,CAAC;AAE3H,eAAO,MAAM,QAAQ,eAAmD,CAAC;AAEzE,MAAM,WAAW,YAAY;IAC5B,QAAQ,CAAC,CAAC,QAAQ,CAAC,EAAE,cAAc,CAAC;CACpC;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,YAAY,GAAG,cAAc,CAEnE;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAEhE"}
@@ -0,0 +1,8 @@
1
+ export const Activity = Symbol.for("@shivaedev/contract/ClientActivity");
2
+ export function clientActivity(client) {
3
+ return client[Activity];
4
+ }
5
+ export function isClientIdle(state) {
6
+ return state.rpcCalls === 0 && state.liveInvalidations === 0 && state.refreshingAtoms === 0;
7
+ }
8
+ //# sourceMappingURL=clientActivity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clientActivity.js","sourceRoot":"","sources":["../src/clientActivity.ts"],"names":[],"mappings":"AAWA,MAAM,CAAC,MAAM,QAAQ,GAAG,MAAM,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAAC;AAMzE,MAAM,UAAU,cAAc,CAAC,MAAoB;IAClD,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC;AACzB,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,KAA0B;IACtD,OAAO,KAAK,CAAC,QAAQ,KAAK,CAAC,IAAI,KAAK,CAAC,iBAAiB,KAAK,CAAC,IAAI,KAAK,CAAC,eAAe,KAAK,CAAC,CAAC;AAC7F,CAAC"}
@@ -6,8 +6,10 @@ import type { RpcClientError } from "effect/rpc/RpcClientError";
6
6
  import type * as Socket from "effect/socket/Socket";
7
7
  import type { LiveBound } from "#automaticLive.ts";
8
8
  import type { Bound } from "#bind.ts";
9
+ import type { ActiveClient } from "#clientActivity.ts";
9
10
  import type { CommandShape, QueryShape, StreamShape } from "#operation.ts";
10
11
  export interface ClientOptions {
12
+ readonly bearerToken?: string;
11
13
  readonly headers?: Readonly<Record<string, string>>;
12
14
  readonly live?: boolean;
13
15
  readonly protocol?: Layer.Layer<RpcClient.Protocol> | ((identity: string | undefined) => Layer.Layer<RpcClient.Protocol>);
@@ -15,7 +17,7 @@ export interface ClientOptions {
15
17
  readonly webSocketConstructor?: Layer.Layer<Socket.WebSocketConstructor>;
16
18
  }
17
19
  export type ClientService<TName extends string, TRpcs extends Rpc.Any> = Context.ServiceClass.Shape<`${TName}/Client`, RpcClient.RpcClient.Flat<TRpcs, RpcClientError>>;
18
- export type MadeClient<TName extends string, TQueries extends readonly QueryShape[], TCommands extends readonly CommandShape[], TRpcs extends Rpc.Any, TStreams extends readonly StreamShape[], TExtra extends Rpc.Any> = Layer.Layer<ClientService<TName, TRpcs | TExtra>> & {
20
+ export type MadeClient<TName extends string, TQueries extends readonly QueryShape[], TCommands extends readonly CommandShape[], TRpcs extends Rpc.Any, TStreams extends readonly StreamShape[], TExtra extends Rpc.Any> = Layer.Layer<ClientService<TName, TRpcs | TExtra>> & ActiveClient & {
19
21
  readonly api: Bound<TName, TQueries, TCommands, TRpcs, ClientService<TName, TRpcs | TExtra>, TStreams> & LiveBound;
20
22
  readonly Client: AtomRpc.AtomRpcClient<ClientService<TName, TRpcs | TExtra>, `${TName}/Client`, TRpcs | TExtra>;
21
23
  readonly client: Effect.Effect<RpcClient.RpcClient<TRpcs | TExtra, RpcClientError>, never, Scope.Scope | Rpc.MiddlewareClient<TRpcs | TExtra>>;
@@ -1 +1 @@
1
- {"version":3,"file":"clientOptions.d.ts","sourceRoot":"","sources":["../src/clientOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EA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AAC,KAAK,EAAE,cAAc,CAAC,CAC/C,CAAC;AAEF,MAAM,MAAM,UAAU,CACrB,KAAK,SAAS,MAAM,EACpB,QAAQ,SAAS,SAAS,UAAU,EAAE,EACtC,SAAS,SAAS,SAAS,YAAY,EAAE,EACzC,KAAK,SAAS,GAAG,CAAC,GAAG,EACrB,QAAQ,SAAS,SAAS,WAAW,EAAE,EACvC,MAAM,SAAS,GAAG,CAAC,GAAG,IACnB,KAAK,CAAC,KAAK,CAAC,aAAa,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,CAAC,CAAC,GACpD,YAAY,GAAG;IACd,QAAQ,CAAC,GAAG,EAAE,KAAK,CAAC,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,aAAa,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,CAAC,EAAE,QAAQ,CAAC,GAAG,SAAS,CAAC;IACnH,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,aAAa,CAAC,aAAa,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,CAAC,EAAE,GAAG,KAAK,SAAS,EAAE,KAAK,GAAG,MAAM,CAAC,CAAC;IAChH,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,KAAK,GAAG,MAAM,EAAE,cAAc,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,GAAG,GAAG,CAAC,gBAAgB,CAAC,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC;IAC/I,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC;CACzE,CAAC"}
@@ -0,0 +1,23 @@
1
+ import { Effect } from "effect";
2
+ import * as AsyncResult from "effect/reactivity/AsyncResult";
3
+ import * as Atom from "effect/reactivity/Atom";
4
+ import type { ClientActivityState } from "#clientActivity.ts";
5
+ export declare const clientActivities: WeakMap<object, {
6
+ activity: import("effect/Stream").Stream<ClientActivityState, never, never> & {
7
+ current: Effect.Effect<ClientActivityState, never, never>;
8
+ };
9
+ hint: () => void;
10
+ queued: () => () => void;
11
+ track: <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>;
12
+ watch: <A, E>(atom: Atom.Atom<AsyncResult.AsyncResult<A, E>>) => Atom.Atom<AsyncResult.AsyncResult<A, E>>;
13
+ }>;
14
+ export declare function makeActivity(): {
15
+ activity: import("effect/Stream").Stream<ClientActivityState, never, never> & {
16
+ current: Effect.Effect<ClientActivityState, never, never>;
17
+ };
18
+ hint: () => void;
19
+ queued: () => () => void;
20
+ track: <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>;
21
+ watch: <A, E>(atom: Atom.Atom<AsyncResult.AsyncResult<A, E>>) => Atom.Atom<AsyncResult.AsyncResult<A, E>>;
22
+ };
23
+ //# sourceMappingURL=clientActivity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clientActivity.d.ts","sourceRoot":"","sources":["../../src/internal/clientActivity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAmB,MAAM,QAAQ,CAAC;AACjD,OAAO,KAAK,WAAW,MAAM,+BAA+B,CAAC;AAC7D,OAAO,KAAK,IAAI,MAAM,wBAAwB,CAAC;AAC/C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAI9D,eAAO,MAAM,gBAAgB;;;;;;YAYb,CAAC,EAAE,CAAC,EAAE,CAAC,UAAU,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;YAOvC,CAAC,EAAE,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;EAnBE,CAAC;AAEvE,wBAAgB,YAAY;;;;;;YAUZ,CAAC,EAAE,CAAC,EAAE,CAAC,UAAU,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;YAOvC,CAAC,EAAE,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;EAmDnE"}
@@ -0,0 +1,68 @@
1
+ import { Effect, SubscriptionRef } from "effect";
2
+ import * as AsyncResult from "effect/reactivity/AsyncResult";
3
+ import * as Atom from "effect/reactivity/Atom";
4
+ import { queryCoalesceWindow } from "#queryCoalesceWindow.ts";
5
+ export const clientActivities = new WeakMap();
6
+ export function makeActivity() {
7
+ const state = Effect.runSync(SubscriptionRef.make({ liveHints: 0, liveInvalidations: 0, refreshingAtoms: 0, rpcCalls: 0 }));
8
+ const activity = Object.assign(SubscriptionRef.changes(state), { current: SubscriptionRef.get(state) });
9
+ function change(key, delta) {
10
+ Effect.runSync(SubscriptionRef.update(state, (current) => ({ ...current, [key]: current[key] + delta })));
11
+ }
12
+ function begin(key) {
13
+ change(key, 1);
14
+ return () => change(key, -1);
15
+ }
16
+ function track(effect) {
17
+ return Effect.acquireUseRelease(Effect.sync(() => begin("rpcCalls")), () => effect, (end) => Effect.sync(end));
18
+ }
19
+ function watch(atom) {
20
+ let watched = Atom.transform(atom, (get) => {
21
+ get.once(queryCoalesceWindow(watched));
22
+ get.subscribe(queryCoalesceWindow(watched), (duration) => get.set(queryCoalesceWindow(atom), duration), { immediate: true });
23
+ let busy = false;
24
+ let active = true;
25
+ let published = false;
26
+ function observe(result) {
27
+ if (!active) {
28
+ return;
29
+ }
30
+ const next = result.waiting || AsyncResult.isInitial(result);
31
+ if (busy !== next) {
32
+ busy = next;
33
+ change("refreshingAtoms", next ? 1 : -1);
34
+ }
35
+ }
36
+ get.addFinalizer(() => {
37
+ active = false;
38
+ if (busy) {
39
+ change("refreshingAtoms", -1);
40
+ }
41
+ });
42
+ function publish(result) {
43
+ published = true;
44
+ observe(result);
45
+ get.setSelf(result);
46
+ }
47
+ // An extra query listener would make abandoned screen work look observed.
48
+ const context = new Proxy(get, { get: (target, key, receiver) => (key === "setSelf" ? publish : Reflect.get(target, key, receiver)) });
49
+ const value = atom.read(context);
50
+ if (!published) {
51
+ observe(value);
52
+ }
53
+ return value;
54
+ }, { initialValueTarget: atom });
55
+ if (atom.keepAlive) {
56
+ watched = Atom.keepAlive(watched);
57
+ }
58
+ else if (atom.idleTTL !== undefined) {
59
+ watched = Atom.setIdleTTL(watched, atom.idleTTL);
60
+ }
61
+ if (Atom.isSerializable(atom)) {
62
+ Object.assign(watched, { [Atom.SerializableTypeId]: atom[Atom.SerializableTypeId] });
63
+ }
64
+ return watched;
65
+ }
66
+ return { activity, hint: () => change("liveHints", 1), queued: () => begin("liveInvalidations"), track, watch };
67
+ }
68
+ //# sourceMappingURL=clientActivity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clientActivity.js","sourceRoot":"","sources":["../../src/internal/clientActivity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AACjD,OAAO,KAAK,WAAW,MAAM,+BAA+B,CAAC;AAC7D,OAAO,KAAK,IAAI,MAAM,wBAAwB,CAAC;AAE/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAG9D,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,OAAO,EAA2B,CAAC;AAEvE,MAAM,UAAU,YAAY;IAC3B,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC,IAAI,CAAsB,EAAE,SAAS,EAAE,CAAC,EAAE,iBAAiB,EAAE,CAAC,EAAE,eAAe,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IACjJ,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,EAAE,OAAO,EAAE,eAAe,CAAC,GAAG,CAAC,KAAK,C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