@shivaedev/contract 0.50.0 → 0.51.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.51.0 - 2026-11-20
4
+
5
+ ### Added
6
+
7
+ - a stale versioned write that reaches the end of an operation's `run` answers the caller with the shared `Conflict` from `@shivaedev/errors/taxonomy.ts`, whose message tells the person to refresh and try again. The generated wire lists `Conflict` for that operation, so its client sees a typed rejection and the default notice shows the message.
8
+
9
+ ### Breaking
10
+
11
+ - an operation's `run` now fails with `Conflict` where its body lets an `OptimisticConcurrencyError` from an `@shivaedev/sql` repository through, so code that calls `Operation.run` and catches `OptimisticConcurrencyError` after it catches `Conflict` instead. Delete each `Effect.catchTag("OptimisticConcurrencyError", …)` in `run` that only returned a `Conflict`; keep one that answers something else.
12
+
3
13
  ## 0.50.0 - 2026-11-20
4
14
 
5
15
  ### Added
package/README.md CHANGED
@@ -41,7 +41,7 @@ export const Notes = defineModule({ name: "notes", operations: [List, Rename], w
41
41
 
42
42
  An **operation** is a query or a command written as its `payload` schema and a generator `*run`. Everything else about its boundary is derived from `run`: what it returns, the tagged failures it raises, and the services it needs. A **query** listens on the keys its repository reads name, or on the keys it declares in `reads`; a **command** announces the keys its repository writes name, plus any it declares in `invalidates`. A **rejection** is an expected typed failure that `run` raises, such as a missing note or an invalid title. Middleware failures and RPC client failures remain separate parts of the native client's error type.
43
43
 
44
- A **module** lists its operations with the services they may use and serves them without hand-written handlers. Types are erased, so the schemas the server encodes with and the browser decodes with must exist as values: the module's **wire** holds them, generated from `run`'s types, and the browser imports a **browser contract** generated beside it, which carries no `run`. A module is a native `RpcGroup`. Its RPC tags are the module name and operation name joined by a dot. A **binding** connects a module or contract to an existing `AtomRpc.Service`: queries get native query atoms and call Effects, while commands get call Effects that invalidate after success.
44
+ A **module** lists its operations and serves them without hand-written handlers; its type carries the services they yield. Types are erased, so the schemas the server encodes with and the browser decodes with must exist as values: the module's **wire** holds them, generated from `run`'s types, and the browser imports a **browser contract** generated beside it, which carries no `run`. A module is a native `RpcGroup`. Its RPC tags are the module name and operation name joined by a dot. A **binding** connects a module or contract to an existing `AtomRpc.Service`: queries get native query atoms and call Effects, while commands get call Effects that invalidate after success.
45
45
 
46
46
  A **collection key** names a dependency. Its item key identifies one item; its list key identifies a list in that collection. Keys do not hold data. Native query atoms hold results, and native Reactivity asks matching queries to run again. Live subscriptions use those same keys to rerun each subscriber’s authorized query on the server and push its changed result.
47
47
 
@@ -89,7 +89,7 @@ Here `NotesRepository` is a `@shivaedev/sql` repository whose model marks `userI
89
89
 
90
90
  A command without `invalidates` announces no keys of its own. Its `invalidates` takes the decoded payload and returns keys; object keys are sorted, so `invalidates` is checked before `run` and cannot see `run`'s result. A command that must announce keys computed from what it did, such as the note it found by title or the people a move affected, contributes them from inside `run` with [`commandResult`](#server-only-command-keys).
91
91
 
92
- An operation written this way states no `success` or `rejections`: its module's wire supplies both. On its own, outside a module, it is served with `Schema.Void` and only `InternalServerError` and `ServiceUnavailable`. Every operation written this way carries those two in its type and its rejection set. Nothing adds `Conflict`: an operation that answers a constraint violation as a domain failure maps it by constraint name in `run`, and inference carries the result. A failure that states `isRetryable` (such as `SqlError`), `SchemaError` and `QueryReadDenied` are never rejections. Rejections are exported classes keyed by their `_tag`.
92
+ An operation written this way states no `success` or `rejections`: its module's wire supplies both. On its own, outside a module, it is served with `Schema.Void` and only `InternalServerError` and `ServiceUnavailable`. Every operation written this way carries those two in its type and its rejection set. A stale versioned write is the one failure `run` answers for the operation: an `OptimisticConcurrencyError` from an `@shivaedev/sql` repository that reaches the end of `run` becomes the shared `Conflict`, with a message telling the person to refresh, so the operation's type, its generated wire and its client list `Conflict`. An operation that wants another answer catches `OptimisticConcurrencyError` itself, and inference carries what it raises instead. Nothing else adds `Conflict`: an operation that answers a constraint violation as a domain failure maps it by constraint name in `run`, and inference carries the result. A failure that states `isRetryable` (such as `SqlError`), `SchemaError` and `QueryReadDenied` are never rejections. Rejections are exported classes keyed by their `_tag`.
93
93
 
94
94
  `run` must not return `any`, such as the result of `JSON.parse`, which would otherwise pass every check: such an operation is a compile error that names it and `RunReturnsAny` (decode the value with a schema, or type it). While the declaration form is still accepted, that error starts with "No overload matches this call" and its last line names the problem. Biome's `useYield` refuses a `*run` that yields nothing, so a `run` that needs no service still yields an Effect.
95
95
 
@@ -99,7 +99,7 @@ A field failure is an exported tagged class built from the payload's fields with
99
99
 
100
100
  #### A module defined from its operations
101
101
 
102
- A module lists its operations once, with the services they may use, and serves them without hand-written handlers:
102
+ A module lists its operations once and serves them without hand-written handlers:
103
103
 
104
104
  ```ts
105
105
  import { Effect, Option, Schema } from "effect";
@@ -109,7 +109,7 @@ import { defineModule } from "@shivaedev/contract/defineModule.ts";
109
109
  import { command, query } from "@shivaedev/contract/operation.ts";
110
110
  import { CurrentViewer } from "@shivaedev/contract/readPolicy.ts";
111
111
  import { fieldRejection } from "@shivaedev/contract/rejection.ts";
112
- import { notesWire } from "#generated/modules/notes/notes.ts";
112
+ import { notesWire } from "#generated/modules/notes/Notes.ts";
113
113
  import { Caller, NotesStore, type StoredNote } from "./services.ts";
114
114
 
115
115
  const notes = collection("notes", Schema.Number);
@@ -188,7 +188,7 @@ src/test-support/fixtures/invalid/moduleRepeatedName.ts(15,2): error TS2322: Typ
188
188
  ```ts
189
189
  import { Layer } from "effect";
190
190
  import { moduleHandlers } from "@shivaedev/contract/moduleHandlers.ts";
191
- import { Notes } from "./notes.ts";
191
+ import { Notes } from "./Notes.ts";
192
192
  import { NotesStoreLive } from "./store.ts";
193
193
 
194
194
  export const NotesHandlers = moduleHandlers(Notes).pipe(Layer.provide(NotesStoreLive));
@@ -209,7 +209,7 @@ import { Schema } from "effect";
209
209
  import { Unauthorized } from "@shivaedev/errors/taxonomy.ts";
210
210
  import { clientContract } from "@shivaedev/contract/clientContract.ts";
211
211
  import type { ClientMatchesModule } from "@shivaedev/contract/clientMatchesModule.ts";
212
- import type { Notes as NotesModule } from "#modules/notes/notes.ts";
212
+ import type { Notes as NotesModule } from "#modules/notes/Notes.ts";
213
213
  import { Caller, NoteFields, notes, TitleTaken } from "#modules/notes/model.ts";
214
214
 
215
215
  const Note = Schema.Struct({ createdAt: Schema.Date, id: Schema.Number, title: Schema.String });
@@ -303,22 +303,31 @@ The native RPC mapping types `OperationRpc` and `Tag` are exported from `@shivae
303
303
 
304
304
  ### Whose account a request acts on
305
305
 
306
- Set `subject` on a contract to a browser-safe declaration from `@shivaedev/identity/subject.ts`: `selfSubject` selects the session account; `accountSubject({ permission, refusal, deny })` permits another account only with the permission's `any` grant. `delegatedSubject({ service, refusal, deny })` asks the application's rule per call, with a `kind` of `read` for queries and streams or `write` for commands. A contract's `declaration.subject` records the declaration it names. The declaration applies to the application RPCs and their changes stream. Native middleware carries its typed failures and supplies the branded `Subject` service to handlers and the application services they call. Business payloads need no owner id.
306
+ Set `subject` on a module or contract to a browser-safe declaration from `@shivaedev/identity/subject.ts`: `selfSubject` selects the session account; `accountSubject({ permission, refusal, deny })` permits another account only with the permission's `any` grant. `delegatedSubject({ service, refusal, deny })` asks the application's rule per call, with a `kind` of `read` for queries and streams or `write` for commands. A contract's `declaration.subject` records the declaration it names. The declaration applies to the application RPCs and their changes stream. Native middleware carries its typed failures and supplies the branded `Subject` service to each operation's `run` and the application services it calls. Business payloads need no owner id.
307
307
 
308
308
  ```ts
309
- import { contract } from "@shivaedev/contract/contract.ts";
309
+ import { defineModule } from "@shivaedev/contract/defineModule.ts";
310
310
  import { command } from "@shivaedev/contract/operation.ts";
311
- import { selfSubject } from "@shivaedev/identity/subject.ts";
311
+ import { selfSubject, Subject } from "@shivaedev/identity/subject.ts";
312
+ import { accountWire } from "#generated/modules/account/Account.ts";
313
+ import { PreferenceFields } from "#modules/account/model.ts";
314
+ import { Profiles } from "./services.ts";
312
315
 
313
- const Save = command("save", { invalidates: () => [] });
314
- export const Account = contract("account", { commands: [Save], subject: selfSubject });
316
+ const Save = command("save", {
317
+ payload: PreferenceFields,
318
+ *run({ title }) {
319
+ const { id } = yield* Subject;
320
+ yield* (yield* Profiles).rename(id, title);
321
+ },
322
+ });
323
+ export const Account = defineModule({ name: "account", operations: [Save], subject: selfSubject, wire: accountWire });
315
324
  ```
316
325
 
317
- Contracts with declared subjects can be exported from published packages with TypeScript declaration output. The client calls `account.save` without an account id. For a delegated subject, the client names the account per call: a bound query takes `subject` in its options and a query's, command's or stream's `run` takes `{ subject }` as its second argument, as in `api.title.query(undefined, { subject: "bob" })` and `api.rename.run({ title }, { subject: "bob" })`. The option sets the call's `x-platform-subject` message header, so one client and its one socket serve the actor's own data and any number of subjects, each live query keeping its own subject on its changes stream. Queries with different subjects are different atoms, keep separate retained results, and serialize under separate keys when they share a `serializationKey`. The session host installs the resolver; handlers read `Subject` from the request environment. See [identity's subject guide](https://github.com/ShivaeDev/platform/tree/main/packages/identity#declared-request-subjects) for delegated selection and refusal declarations.
326
+ `PreferenceFields` is `Schema.Struct({ title: Schema.String })` and `Profiles` an application service whose `rename` takes the account's `SubjectId`. Contracts with declared subjects can be exported from published packages with TypeScript declaration output. The client calls `account.save` with only its title. For a delegated subject, the client names the account per call: a bound query takes `subject` in its options and a query's, command's or stream's `run` takes `{ subject }` as its second argument, as in `api.title.query(undefined, { subject: "bob" })` and `api.rename.run({ title }, { subject: "bob" })`. The option sets the call's `x-platform-subject` message header, so one client and its one socket serve the actor's own data and any number of subjects, each live query keeping its own subject on its changes stream. Queries with different subjects are different atoms, keep separate retained results, and serialize under separate keys when they share a `serializationKey`. The session host installs the resolver; operations read `Subject` from the request environment. See [identity's subject guide](https://github.com/ShivaeDev/platform/tree/main/packages/identity#declared-request-subjects) for delegated selection and refusal declarations.
318
327
 
319
328
  ### Expected failures
320
329
 
321
- Import the shared expected failures from `@shivaedev/errors/taxonomy.ts`: `NotFound`, `Unauthorized`, `Forbidden`, `BadRequest`, `Conflict`, `PreconditionFailed`, `TooManyRequests`, `AuthUnavailable`, `InternalServerError` and `ServiceUnavailable`. Each class is a tagged error schema with a string `message`; `BadRequest` and `Conflict` also accept an optional string `field`. Declare only the failures an operation can return:
330
+ Import the shared expected failures from `@shivaedev/errors/taxonomy.ts`: `NotFound`, `Unauthorized`, `Forbidden`, `BadRequest`, `Conflict`, `PreconditionFailed`, `TooManyRequests`, `AuthUnavailable`, `InternalServerError` and `ServiceUnavailable`. Each class is a tagged error schema with a string `message`; `BadRequest` and `Conflict` also accept an optional string `field`. An operation written with `run` raises them and its wire lists them; the rest of this section is about RPCs that state their failures by hand, as native `Rpc` definitions and operations declared without run do. Declare only the failures an operation can return:
322
331
 
323
332
  ```ts
324
333
  import { Effect, Schema } from "effect";
@@ -350,7 +359,7 @@ const missing = Get.reject.NoteMissing({ id: 9 });
350
359
 
351
360
  ### 2. Once per host: native handlers and transport
352
361
 
353
- Implement the contract with native `of` and `toLayer`:
362
+ An application registers its defined modules with the [server's host](https://github.com/ShivaeDev/platform/tree/main/packages/server#host-the-application), which builds their handlers with `moduleHandlers`, and writes no handlers. A boundary of operations declared without run is implemented with native `of` and `toLayer`:
354
363
 
355
364
  ```ts
356
365
  import { Effect, Ref, Stream } from "effect";
@@ -438,7 +447,7 @@ export class NotesClient extends AtomRpc.Service<NotesClient>()("app/NotesClient
438
447
  export const api = bind(Notes, NotesClient, { live: false });
439
448
  ```
440
449
 
441
- Save the client module as `client.ts`. The [native RPC guide](https://github.com/ShivaeDev/platform/blob/main/docs/framework/native-rpc.md) covers hosting; the [reference composition](https://github.com/ShivaeDev/platform/blob/main/docs/framework/composed-example.md) composes handlers, request identity, SQL and a rendered client.
450
+ Save the client module as `client.ts`. The [native RPC guide](https://github.com/ShivaeDev/platform/blob/main/docs/framework/native-rpc.md) covers hosting; the [feature guide](https://github.com/ShivaeDev/platform/blob/main/docs/framework/add-a-feature.md) composes a defined module, request identity, SQL and a rendered client in the starter.
442
451
 
443
452
  ### Build a shared WebSocket client
444
453
 
@@ -543,7 +552,7 @@ const move = ({ id, household }) =>
543
552
  result: pot,
544
553
  invalidates: [...before, ...after].map((viewerId) => pots.bucket.viewerId(viewerId)),
545
554
  });
546
- }).pipe(transact({ onSqlError: (error) => error }));
555
+ }).pipe(transact());
547
556
  ```
548
557
 
549
558
  Here `audienceFor` reads household members and people who ate from the pot from the application's database, `movePot` performs the write, and `pots` declares a `viewerId` bucket. Read the audience after the write to include new readers, and retain the old audience when the write removes access. Each viewer's list reads its own bucket. Keep these reads and the write in the same transaction when they must describe one change.
@@ -612,45 +621,57 @@ Mount the query to start it. Wait on `completions` for `completed > before` afte
612
621
 
613
622
  ### Session-owned keys
614
623
 
615
- 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"` and let its handlers read the account from request-local identity, so payloads carry no owner field, and reads and invalidations name a logical item key for the record:
624
+ A self-only feature, such as a user's preferences, reads and changes only the signed-in account's records. Define its module with `keyScope: "session"` and let its operations read the account from request-local `Identity`, so payloads carry no owner field, and reads and invalidations name a logical item key for the record:
616
625
 
617
626
  ```ts
618
- const preferences = collection("preferences", Schema.String);
619
- const Preferences = contract("preferences", {
627
+ import { collection } from "@shivaedev/changes/keys.ts";
628
+ import { defineModule } from "@shivaedev/contract/defineModule.ts";
629
+ import { command, query } from "@shivaedev/contract/operation.ts";
630
+ import { Identity } from "@shivaedev/identity/identity.ts";
631
+ import { Authenticated } from "@shivaedev/identity/middleware.ts";
632
+ import { preferencesWire } from "#generated/modules/preferences/Preferences.ts";
633
+ import { PreferenceFields, preferences } from "#modules/preferences/model.ts";
634
+ import { PreferencesStore } from "./services.ts";
635
+
636
+ const Self = query("self", {
637
+ reads: () => [preferences.item("self")],
638
+ *run() {
639
+ const { id } = yield* Identity;
640
+ return yield* (yield* PreferencesStore).read(id);
641
+ },
642
+ });
643
+ const Save = command("save", {
644
+ invalidates: () => [preferences.item("self")],
645
+ payload: PreferenceFields,
646
+ *run({ title }) {
647
+ const { id } = yield* Identity;
648
+ return yield* (yield* PreferencesStore).save(id, title);
649
+ },
650
+ });
651
+
652
+ export const Preferences = defineModule({
620
653
  keyScope: "session",
621
- queries: [
622
- query("self", {
623
- readPolicy: signedIn,
624
- reads: () => [preferences.item("self")],
625
- success: Schema.String,
626
- }),
627
- ],
628
- commands: [
629
- command("save", {
630
- payload: { title: Schema.String },
631
- invalidates: () => [preferences.item("self")],
632
- success: Schema.String,
633
- }),
634
- ],
635
- }).middleware(Authenticated);
654
+ middleware: Authenticated,
655
+ name: "preferences",
656
+ operations: [Self, Save],
657
+ wire: preferencesWire,
658
+ });
659
+ ```
660
+
661
+ `model.ts` declares `preferences` as `collection("preferences", Schema.String)` and `PreferenceFields` as `Schema.Struct({ title: Schema.String })`, and `PreferencesStore` is the application's persistence service. The browser binds the generated contract with the session's registry:
662
+
663
+ ```ts
664
+ import { bind } from "@shivaedev/contract/bind.ts";
665
+ import { Preferences } from "#generated/modules/preferences/Preferences.ts";
636
666
 
637
667
  const api = bind(Preferences, Client, { registry });
638
668
  const self = api.self.query(undefined);
639
669
  const save = api.save.run({ title: "My preferences" });
640
670
  ```
641
671
 
642
- The examples use `Schema` and `Effect` from `effect`, `contract`, `query`, `command` and `bind` from contract's defining modules, `collection` from `@shivaedev/changes/keys.ts`, and `Authenticated` from `@shivaedev/identity/middleware.ts`. `Client` is the application's native AtomRpc service, and `registry` is the atom registry that owns the session's queries. In React, `SessionBoundary` supplies that registry to `connect`, as [react's session-scoped bindings](https://github.com/ShivaeDev/platform/blob/main/packages/react/README.md#session-scoped-bindings) show.
643
-
644
- Handlers read the account from request-local `Identity`, imported from `@shivaedev/identity/identity.ts`:
672
+ `Client` is the application's native AtomRpc service, and `registry` is the atom registry that owns the session's queries. In React, `SessionBoundary` supplies that registry to `connect`, as [react's session-scoped bindings](https://github.com/ShivaeDev/platform/blob/main/packages/react/README.md#session-scoped-bindings) show.
645
673
 
646
- ```ts
647
- Preferences.application.toLayer({
648
- "preferences.self": () => Effect.flatMap(Identity, ({ id }) => store.read(id)),
649
- "preferences.save": ({ title }) => Effect.flatMap(Identity, ({ id }) => store.save(id, title)),
650
- });
651
- ```
652
-
653
- `store` is the application's persistence service. No owner or client key scope is accepted from a request. The database app host uses plain repository keys for every subscriber and rechecks each subscriber’s read policy before delivery.
674
+ No owner or client key scope is accepted from a request. The database app host uses plain repository keys for every subscriber and rechecks each subscriber’s read policy before delivery.
654
675
 
655
676
  The registry is required for session-scoped bindings. Query atoms and live connections belong in it; command and one-off query Effects execute through it. Explicit streams also run through its client, preserving the session transport and headers; disposing the registry ends those streams. Streams on ordinary contracts use the caller's client. A successful command invalidates its registry's prefixed keys, while a rejected command declares no invalidation. Ordinary contracts keep unscoped keys and the two-argument `bind` call.
656
677
 
@@ -708,21 +729,22 @@ Server adapters import `LiveServer` from `@shivaedev/contract/live-server/servic
708
729
 
709
730
  Contract groups carry their read-policy guard into native `RpcServer` hosts and Platform’s application host. An ordinary query evaluates its policy once per request, after identity middleware supplies `CurrentViewer` from its validated session. A false policy returns `QueryReadDenied` without running the handler. Native hosts need no policy middleware or guard Layer. Real HTTP stories exercise both hosts with allowed and denied counted policies; they prove this RPC boundary, not an application’s session or deployment policy. Platform’s application host refuses HTTP `$changes` calls with `WebSocketRequired`; subscriptions use its WebSocket protocol. Subscription delivery and pushed reruns continue to check current access.
710
731
 
711
- A query declares its decoded input, result and `readPolicy` together, and declares `reads` when its handler's reads do not name its keys, as described below. `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.
732
+ A query's `readPolicy(payload, viewer)` returns an Effect boolean, and a query declares `reads` only when its reads do not name its keys, as described below. `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, and a query written with `run` that states no policy gets it. `QueryReadPolicy<Payload, E, R>` preserves typed failures and required services. A policy's typed failures join the query's rejections, so a failing access check reaches the client as that failure, including during live reads. Only a successful `false` denies access. [Policy services](#policy-services) explains richer session requirements and where to provide implementations.
712
733
 
713
734
  ```ts
714
- import { Schema } from "effect";
715
735
  import { query } from "@shivaedev/contract/operation.ts";
716
- import { signedIn } from "@shivaedev/contract/readPolicy.ts";
736
+ import { NotesRepository, SessionUser } from "./services.ts";
717
737
 
718
738
  const Mine = query("mine", {
719
- payload: { title: Schema.String },
720
- success: Schema.Array(Schema.String),
721
- readPolicy: signedIn,
739
+ *run() {
740
+ const repository = yield* NotesRepository;
741
+ const { id: userId } = yield* SessionUser;
742
+ return yield* repository.findMany({ select: ["title"], where: { userId } });
743
+ },
722
744
  });
723
745
  ```
724
746
 
725
- `Mine` declares no `reads`. Its handler reads `findMany({ where: { userId } })` through a `@shivaedev/sql` repository, which names the viewer's `userId` bucket, so the live query listens on that bucket. On a repository model, annotate tenant fields with `bucket()` from `@shivaedev/changes/buckets.ts` so writes announce the affected buckets. For an admin page spanning every tenant, declare `readsCollections` beside a permission read policy:
747
+ `Mine` declares no policy and no `reads`. Its `run` reads `findMany({ where: { userId } })` through a `@shivaedev/sql` repository, which names the viewer's `userId` bucket, so the live query listens on that bucket. On a repository model, annotate tenant fields with `bucket()` from `@shivaedev/changes/buckets.ts` so writes announce the affected buckets. For an admin page spanning every tenant, declare `readsCollections` beside a permission read policy:
726
748
 
727
749
  ```ts
728
750
  import { Effect, Schema } from "effect";
@@ -732,14 +754,16 @@ import { query } from "@shivaedev/contract/operation.ts";
732
754
  import { permissionReadPolicy } from "@shivaedev/contract/permissionReadPolicy.ts";
733
755
  import { SessionUser } from "@shivaedev/identity/identity.ts";
734
756
  import { hasPermission } from "@shivaedev/identity/permission.ts";
757
+ import { NotesRepository } from "./services.ts";
735
758
 
736
759
  const notes = collection("notes", Schema.Number);
737
760
  const ManageNotes = permission("notes.manage").any;
738
761
  const AllNotes = query("allNotes", {
739
- success: Schema.Array(Schema.String),
740
762
  readPolicy: permissionReadPolicy(ManageNotes, (required) => Effect.map(SessionUser, (user) => hasPermission(user, required))),
741
- reads: () => [],
742
763
  readsCollections: [notes],
764
+ *run() {
765
+ return yield* (yield* NotesRepository).findMany({ select: ["title"] });
766
+ },
743
767
  });
744
768
  ```
745
769
 
@@ -753,25 +777,26 @@ For dependencies that need server data, add `serverReads(payload, viewer)`, an E
753
777
  import { Context, Effect, Schema } from "effect";
754
778
  import type { Key } from "@shivaedev/changes/keys.ts";
755
779
  import { query } from "@shivaedev/contract/operation.ts";
756
- import { signedIn } from "@shivaedev/contract/readPolicy.ts";
757
780
 
758
781
  class TimelineData extends Context.Service<
759
782
  TimelineData,
760
783
  {
784
+ readonly entries: (workspaceId: string) => Effect.Effect<readonly string[]>;
761
785
  readonly readKeys: (workspaceId: string) => Effect.Effect<readonly Key[]>;
762
786
  }
763
787
  >()("app/TimelineData") {}
764
788
 
765
789
  const Timeline = query("timeline", {
766
790
  payload: { workspaceId: Schema.String },
767
- success: Schema.Array(Schema.String),
768
- readPolicy: signedIn,
769
791
  reads: () => [],
770
792
  serverReads: ({ workspaceId }) => Effect.flatMap(TimelineData, (data) => data.readKeys(workspaceId)),
793
+ *run({ workspaceId }) {
794
+ return yield* (yield* TimelineData).entries(workspaceId);
795
+ },
771
796
  });
772
797
  ```
773
798
 
774
- Provide `TimelineData` on the server to load the workspace's lists and return their keys. Use an application policy that checks workspace access; derived keys are refresh dependencies and grant no read access. Each write must publish the same keys. After every rerun the server evaluates `reads` and `serverReads` again and replaces the subscription's registrations, so the keys follow the workspace while the subscription stays open. A list that joins is watched once a rerun has seen it, so the write that adds a list must publish a key the query already reads, such as a workspace bucket that `serverReads` also returns. Once a rerun has seen a list leave, that list's writes no longer rerun the query. The browser never runs `serverReads`; matching changes rerun the affected query on the server.
799
+ Provide `TimelineData` on the server to read the workspace's entries, and to load its lists and return their keys. Use an application policy that checks workspace access; derived keys are refresh dependencies and grant no read access. Each write must publish the same keys. After every rerun the server evaluates `reads` and `serverReads` again and replaces the subscription's registrations, so the keys follow the workspace while the subscription stays open. A list that joins is watched once a rerun has seen it, so the write that adds a list must publish a key the query already reads, such as a workspace bucket that `serverReads` also returns. Once a rerun has seen a list leave, that list's writes no longer rerun the query. The browser never runs `serverReads`; matching changes rerun the affected query on the server.
775
800
 
776
801
  A handler can also name keys while it runs, with `recordRead(keys)` from `@shivaedev/changes/readRecorder.ts`, before the statement that reads by them. The live subscription registers each recorded key with the host the moment it is recorded, before that statement is sent, and matches it alongside the keys from `reads`, `serverReads` and `readsCollections`. A key recorded on a rerun is therefore watched before its read, where a `serverReads` key is watched only once the rerun has finished. A key that is already registered is not registered again, so a handler that reads the same row many times registers its key once. Nothing the query's read policy records counts, whether through repository reads or its own `recordRead` calls: permission changes refresh nothing live, so a write to a row only the policy reads does not rerun the query.
777
802
 
@@ -786,7 +811,13 @@ import { Context, Effect, Option, Schema } from "effect";
786
811
  import { query } from "@shivaedev/contract/operation.ts";
787
812
  import { NotFound } from "@shivaedev/errors/taxonomy.ts";
788
813
 
789
- class NoteOwner extends Context.Service<NoteOwner, (id: number) => Effect.Effect<Option.Option<string>>>()("app/NoteOwner") {}
814
+ class PrivateNotes extends Context.Service<
815
+ PrivateNotes,
816
+ {
817
+ readonly owner: (id: number) => Effect.Effect<Option.Option<string>>;
818
+ readonly title: (id: number) => Effect.Effect<string>;
819
+ }
820
+ >()("app/PrivateNotes") {}
790
821
  const PrivateNote = query("privateNote", {
791
822
  payload: { id: Schema.Number },
792
823
  readPolicy: ({ id }, viewer) =>
@@ -794,40 +825,41 @@ const PrivateNote = query("privateNote", {
794
825
  if (Option.isNone(viewer)) {
795
826
  return false;
796
827
  }
797
- const owner = yield* (yield* NoteOwner)(id);
828
+ const owner = yield* (yield* PrivateNotes).owner(id);
798
829
  if (Option.isNone(owner) || owner.value !== viewer.value.id) {
799
830
  return yield* new NotFound({ message: "Note not found" });
800
831
  }
801
832
  return true;
802
833
  }),
803
- reads: () => [],
804
- rejections: { NotFound },
805
- success: Schema.String,
834
+ *run({ id }) {
835
+ return yield* (yield* PrivateNotes).title(id);
836
+ },
806
837
  });
807
838
  ```
808
839
 
809
- The server provides `NoteOwner`; the shared declaration holds only its browser-safe service tag. The same typed rejection reaches ordinary reads and live subscriptions.
840
+ The module's registration provides `PrivateNotes`; the browser's generated contract carries no read policy. The generator lists the policy's `NotFound` among the query's rejections, and the same typed rejection reaches ordinary reads and live subscriptions.
810
841
 
811
842
  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`.
812
843
 
813
- 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 results. 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 enforce read policies automatically at request time. `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.
844
+ 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 results. Every query has a policy: one written with `run` gets `signedIn` when it states none, and one declared without run requires `readPolicy`, including queries used only through one-off `run` calls, so 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 enforce read policies automatically at request time. `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.
814
845
 
815
846
  Session middleware supplies `CurrentViewer` after validating the session. Each rerun uses a freshly loaded session and the same authorized handler as an ordinary read. A removed session ends the subscription with `Unauthorized`; a current session denied by the read policy receives `QueryReadDenied`, with no query SQL and its stored hash cleared. The established subscription stays open for later authorized changes. Raw consumers handle `Result`, `Unchanged` and `QueryReadDenied`.
816
847
 
817
848
  ### Policy services
818
849
 
819
- 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()` from `@shivaedev/identity/server/session.ts` alongside its handlers, with the shared `SessionPolicy` Layer provided once by the application host. The middleware provides this request-local context for both RPC calls and live reruns, including each policy recheck before a result is delivered. Session-backed hosts reload that context before each rerun, and use the same snapshot for its policy and query rerun.
850
+ 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 module and merge `authenticatedUserWithProviderAccountsLayer()` from `@shivaedev/identity/server/session.ts` into the handlers the host serves, with the shared `SessionPolicy` Layer provided once by the application host. The middleware provides this request-local context for both RPC calls and live reruns, including each policy recheck before a result is delivered. Session-backed hosts reload that context before each rerun, and use the same snapshot for its policy and query rerun.
820
851
 
821
- 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:
852
+ Keep the policy service's tag beside the query and its implementation in server code. Its method retains the session service in its requirements so the session is read when the policy runs:
822
853
 
823
854
  ```ts
824
855
  import { Context, Effect, Option, Schema } from "effect";
825
- import { contract } from "@shivaedev/contract/contract.ts";
856
+ import { defineModule } from "@shivaedev/contract/defineModule.ts";
826
857
  import { query } from "@shivaedev/contract/operation.ts";
827
858
  import type { Viewer } from "@shivaedev/contract/readPolicy.ts";
828
859
  import { AuthUnavailable, Unauthorized } from "@shivaedev/errors/taxonomy.ts";
829
860
  import { SessionUserWithProviderAccounts } from "@shivaedev/identity/identity.ts";
830
861
  import { AuthenticatedUserWithProviderAccounts } from "@shivaedev/identity/middleware.ts";
862
+ import { documentsWire } from "#generated/modules/documents/Documents.ts";
831
863
 
832
864
  class ReadAccess extends Context.Service<
833
865
  ReadAccess,
@@ -842,17 +874,23 @@ class ReadAccess extends Context.Service<
842
874
  const Get = query("get", {
843
875
  payload: { accountId: Schema.String },
844
876
  readPolicy: ({ accountId }, viewer) => Effect.flatMap(ReadAccess, (access) => access.allows(accountId, viewer)),
845
- reads: () => [],
846
- rejections: { AuthUnavailable, Unauthorized },
847
- success: Schema.String,
877
+ *run({ accountId }) {
878
+ return yield* Effect.succeed(`Document for ${accountId}`);
879
+ },
880
+ });
881
+ export const Documents = defineModule({
882
+ middleware: AuthenticatedUserWithProviderAccounts,
883
+ name: "documents",
884
+ operations: [Get],
885
+ wire: documentsWire,
848
886
  });
849
- const Documents = contract("documents", { queries: [Get] }).middleware(AuthenticatedUserWithProviderAccounts);
850
887
  ```
851
888
 
852
- Provide the implementation from the query's handlers layer with native `Layer.provide`:
889
+ The generator lists the policy's `AuthUnavailable` and `Unauthorized` among the query's rejections. Provide the implementation from the module's registration:
853
890
 
854
891
  ```ts
855
892
  import { Effect, Layer, Option } from "effect";
893
+ import type { AppModule } from "@shivaedev/server/AppModule.ts";
856
894
 
857
895
  const ReadAccessLive = Layer.succeed(ReadAccess, {
858
896
  allows: (accountId, viewer) =>
@@ -866,14 +904,10 @@ const ReadAccessLive = Layer.succeed(ReadAccess, {
866
904
  );
867
905
  }),
868
906
  });
869
- const DocumentHandlers = Documents.application
870
- .toLayer({
871
- "documents.get": ({ accountId }) => Effect.succeed(`Document for ${accountId}`),
872
- })
873
- .pipe(Layer.provide(ReadAccessLive));
907
+ export const documents = { module: Documents, services: ReadAccessLive } satisfies AppModule;
874
908
  ```
875
909
 
876
- 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 reruns; its allow or deny result is not cached.
910
+ The module's handlers check the policy with the services the registration provides, for RPC calls and subscriptions alike. Request-local services take precedence over those services; a session value installed while building the handlers cannot replace the current viewer's session. The policy runs again for live reruns; its allow or deny result is not cached.
877
911
 
878
912
  ### In-memory clients in story kits
879
913
 
@@ -1 +1 @@
1
- {"version":3,"file":"commandSignal.d.ts","sourceRoot":"","sources":["../src/commandSignal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAS,MAAM,QAAQ,CAAC;AAEhD,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,UAAU,GAAG,WAAW,CAAC;AAE7D,eAAO,MAAM,aAAa,4BAA6B,YAAY,KAAK,IAAI,CAE1E,CAAC;AAEH,eAAO,MAAM,cAAc,GAAgC,CAAC,EAAE,CAAC,EAAE,CAAC,4EAkBhE,CAAC"}
1
+ {"version":3,"file":"commandSignal.d.ts","sourceRoot":"","sources":["../src/commandSignal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAS,MAAM,QAAQ,CAAC;AAEhD,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,UAAU,GAAG,WAAW,CAAC;AAE7D,eAAO,MAAM,aAAa,4BAA6B,YAAY,KAAK,IAAI,CAE1E,CAAC;AAEH,eAAO,MAAM,cAAc,GAAgC,CAAC,EAAE,CAAC,EAAE,CAAC,4EAsBhE,CAAC"}
@@ -4,21 +4,25 @@ export const CommandSignal = Context.Reference("@shivaedev/contract/CommandSigna
4
4
  });
5
5
  export const untilReflected = Effect.fnUntraced(function* (command) {
6
6
  const outer = yield* CommandSignal;
7
- const reflected = Latch.makeUnsafe(true);
8
- let accepted = 0;
9
- const result = yield* Effect.provideService(command, CommandSignal, (state) => {
10
- outer(state);
11
- if (state === "accepted") {
12
- accepted += 1;
13
- reflected.closeUnsafe();
14
- }
15
- else if (state === "reflected") {
16
- accepted -= 1;
17
- if (accepted === 0) {
18
- reflected.openUnsafe();
7
+ const reflected = yield* Latch.make(true);
8
+ // The command reports its states synchronously, so the signal that counts them is built as a side effect.
9
+ const signal = Effect.sync(() => {
10
+ let accepted = 0;
11
+ return (state) => {
12
+ outer(state);
13
+ if (state === "accepted") {
14
+ accepted += 1;
15
+ reflected.closeUnsafe();
19
16
  }
20
- }
17
+ else if (state === "reflected") {
18
+ accepted -= 1;
19
+ if (accepted === 0) {
20
+ reflected.openUnsafe();
21
+ }
22
+ }
23
+ };
21
24
  });
25
+ const result = yield* Effect.provideServiceEffect(command, CommandSignal, signal);
22
26
  yield* reflected.await;
23
27
  return result;
24
28
  });
@@ -1 +1 @@
1
- {"version":3,"file":"commandSignal.js","sourceRoot":"","sources":["../src/commandSignal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAIhD,MAAM,CAAC,MAAM,aAAa,GAAG,OAAO,CAAC,SAAS,CAAgC,mCAAmC,EAAE;IAClH,YAAY,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,SAAS;CACnC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAW,OAA+B;IAClG,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,aAAa,CAAC;IACnC,MAAM,SAAS,GAAG,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IACzC,IAAI,QAAQ,GAAG,CAAC,CAAC;IACjB,MAAM,MAAM,GAA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AK,CAAC,KAAK,CAAC,CAAC;YACb,IAAI,KAAK,KAAK,UAAU,EAAE,CAAC;gBAC1B,QAAQ,IAAI,CAAC,CAAC;gBACd,SAAS,CAAC,WAAW,EAAE,CAAC;YACzB,CAAC;iBAAM,IAAI,KAAK,KAAK,WAAW,EAAE,CAAC;gBAClC,QAAQ,IAAI,CAAC,CAAC;gBACd,IAAI,QAAQ,KAAK,CAAC,EAAE,CAAC;oBACpB,SAAS,CAAC,UAAU,EAAE,CAAC;gBACxB,CAAC;YACF,CAAC;QACF,CAAC,CAAC;IACH,CAAC,CAAC,CAAC;IACH,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,MAAM,CAAC,oBAAoB,CAAC,OAAO,EAAE,aAAa,EAAE,MAAM,CAAC,CAAC;IAClF,KAAK,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC;IACvB,OAAO,MAAM,CAAC;AACf,CAAC,CAAC,CAAC"}
@@ -3,7 +3,7 @@ import { RpcClientError } from "effect/rpc/RpcClientError";
3
3
  import { SocketOpenError } from "effect/socket/Socket";
4
4
  export const connectionReadiness = Effect.gen(function* () {
5
5
  const clock = yield* Clock.Clock;
6
- const ready = Latch.makeUnsafe(true);
6
+ const ready = yield* Latch.make(true);
7
7
  return {
8
8
  close: Effect.asVoid(ready.close),
9
9
  isReady: () => ready.isOpen(),
@@ -1 +1 @@
1
- {"version":3,"file":"connectionReadiness.js","sourceRoot":"","sources":["../src/connectionReadiness.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IACtD,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,KAAK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AC,WAAW,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CACzB;AACD,MAAM,WAAW,WAAW,CAAC,CAAC,EAAE,CAAC;IAChC,QAAQ,CAAC,UAAU,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;IAC7C,QAAQ,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACrC,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,QAAQ,EAAE,QAAQ,CAAC,KAAK,CAAC;IACtD,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,CAAC,OAAO,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;IAClD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,iBAAiB,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;CACxD;AAID,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,OAAO,CAElE;AAaD,wBAAgB,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,aAAa,EAAE,OAAO,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC,EAAE,aAAa,CAAC,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC;;;;EA8ChH"}
package/dist/live.js CHANGED
@@ -13,6 +13,14 @@ const connections = new WeakSet();
13
13
  export function isLiveConnection(atom) {
14
14
  return connections.has(atom);
15
15
  }
16
+ // The registry calls its subscribers synchronously, so subscribing is a side effect.
17
+ function wakeOnChange(get, atom, wakes, woken) {
18
+ return Effect.sync(() => get.subscribe(atom, () => {
19
+ if (wakes()) {
20
+ Queue.offerUnsafe(woken, undefined);
21
+ }
22
+ }));
23
+ }
16
24
  export function live(runtime, options) {
17
25
  const paused = Atom.make(false);
18
26
  const status = Atom.make({ connection: "connecting", failure: Option.none(), needsResync: true, pending: 0 });
@@ -30,14 +38,16 @@ export function live(runtime, options) {
30
38
  update({ connection: "connecting", failure: Option.none(), needsResync: true, pending: 0 });
31
39
  }
32
40
  });
41
+ function resyncsOnResume() {
42
+ if (get.once(paused) || get.once(status).connection === "failed") {
43
+ return false;
44
+ }
45
+ update({ needsResync: true });
46
+ return true;
47
+ }
33
48
  if (options.resume !== undefined) {
34
49
  get.once(options.resume);
35
- get.subscribe(options.resume, () => {
36
- if (!get.once(paused) && get.once(status).connection !== "failed") {
37
- update({ needsResync: true });
38
- Queue.offerUnsafe(resumed, undefined);
39
- }
40
- });
50
+ yield* wakeOnChange(get, options.resume, resyncsOnResume, resumed);
41
51
  }
42
52
  const attempt = liveAttempt(options.stream, {
43
53
  delivered: () => update({ connection: "live", failure: Option.none(), needsResync: false, pending: 0 }),
package/dist/live.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"live.js","sourceRoot":"","sources":["../src/live.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAe,MAAM,QAAQ,CAAC;AAC3E,OAAO,KAAK,IAAI,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAAE,GAAG,EAAE,MAAM,4BAA4B,CAAC;AACjD,OAAO,EAAE,cAAc,EAAmB,MAAM,gBAAgB,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAG1C,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,MAAM,CAAC,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC;IACpC,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;IAC3E,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC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AC,CAAC;IAC3B,WAAW,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AACvC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"liveHintQueue.d.ts","sourceRoot":"","sources":["../src/liveHintQueue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAGzC,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG;IAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,CAAC;AAElF,eAAO,MAAM,aAAa;kBAGJ,gBAAgB;;gBAcpC,CAAC"}
1
+ {"version":3,"file":"liveHintQueue.d.ts","sourceRoot":"","sources":["../src/liveHintQueue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAGzC,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG;IAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,CAAC;AAYlF,eAAO,MAAM,aAAa;kBAKV,gBAAgB;;gBAQ9B,CAAC"}