foldkit-remote 0.1.0 → 0.2.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/README.md CHANGED
@@ -1,19 +1,30 @@
1
1
  # `foldkit-remote`
2
2
 
3
- Normalized application-facing server state for Foldkit. Entities, field
4
- selections, queries, connections, mutations, and live patches reconcile into one
5
- store that is part of the Model. There is no hidden mutable cache: the same
6
- `update` that moves the application moves remote data.
7
-
8
- `foldkit-remote` owns semantic data modeling; Effect owns the infrastructure
9
- below it. The wire is Effect RPC (`RemoteRpc`), so the transport is whatever
10
- Effect layer the application chooses — HTTP, WebSocket, worker, in-process.
11
- The server half is
12
- [`foldkit-remote-server`](https://github.com/doeixd/foldkit-plus/tree/main/packages/remote-server).
13
- The worked end-to-end trace is
14
- [`examples/remote`](https://github.com/doeixd/foldkit-plus/tree/main/examples/remote).
15
- The full design rationale is in
16
- [Revision Plan §8](https://github.com/doeixd/foldkit-plus/blob/main/docs/design/REVISION_PLAN.md#8-remote).
3
+ Server data in a Foldkit application, kept in the Model instead of in a cache
4
+ beside it. You declare your entities and the fields each screen reads;
5
+ `foldkit-remote` works out what is missing, fetches it in one batched request,
6
+ stores it normalized so two screens share one copy, and gives each screen its
7
+ own slice as a plain value. Reading is pure — a view never starts a fetch.
8
+
9
+ There is no hidden mutable cache. Every new fact — a read result, a page, a
10
+ mutation result, a live event — arrives as a Message and goes through the same
11
+ `update` that moves the rest of the application, so replay, time travel, and
12
+ tests see remote data like any other state.
13
+
14
+ Reach for it when the server owns the data, several screens read overlapping
15
+ slices of it, and you would rather have fetching, caching, pagination,
16
+ optimistic updates, and live patches be one mechanism than five. It is not where
17
+ edits that must survive the process or the network belong — that is
18
+ [`foldkit-durable`](https://github.com/doeixd/foldkit-plus/tree/main/packages/durable)
19
+ and [`foldkit-sync`](https://github.com/doeixd/foldkit-plus/tree/main/packages/sync)
20
+ — and it is not a transport: the wire is Effect RPC (`RemoteRpc`) and the
21
+ application supplies the client and server layers (HTTP, WebSocket, worker,
22
+ in-process). The server half is
23
+ [`foldkit-remote-server`](https://github.com/doeixd/foldkit-plus/tree/main/packages/remote-server);
24
+ [`examples/remote`](https://github.com/doeixd/foldkit-plus/tree/main/examples/remote)
25
+ is the worked end-to-end trace and
26
+ [Revision Plan §8](https://github.com/doeixd/foldkit-plus/blob/main/docs/design/REVISION_PLAN.md#8-remote)
27
+ the design rationale.
17
28
 
18
29
  The package has two faces. The **application API** is the bound domain `Data`:
19
30
  `Data.get`, `Data.live`, `Data.query`, `Data.mutate`, `Data.subscriptions`, and
@@ -23,6 +34,15 @@ the transport seam — stays exported for tooling, SSR, tests, and package
23
34
  authors, and is documented under [Advanced](#advanced-the-kernel). Ordinary
24
35
  application code needs only the first.
25
36
 
37
+ ## Install
38
+
39
+ ```bash
40
+ pnpm add foldkit-remote
41
+ ```
42
+
43
+ `foldkit` and `effect` are peer dependencies; `foldkit-surface` comes with it.
44
+ The server half is `foldkit-remote-server`.
45
+
26
46
  ## Quick start
27
47
 
28
48
  One feature, end to end: a project page that reads a project live, lists the
@@ -74,6 +94,12 @@ import type * as Update from 'foldkit/update'
74
94
  import { Remote } from 'foldkit-remote'
75
95
  import { Surface } from 'foldkit-surface'
76
96
 
97
+ // Your own routes; this one has a project route carrying the id the page reads.
98
+ const Route = Schema.Union([
99
+ Schema.Struct({ _tag: Schema.Literal('home') }),
100
+ Schema.Struct({ _tag: Schema.Literal('project'), projectId: Schema.String }),
101
+ ])
102
+
77
103
  const Model = Schema.Struct({ route: Route, remote: Remote.Model })
78
104
  type Model = typeof Model.Type
79
105
  const Message = defineMessageUnion({
@@ -86,7 +112,7 @@ type Message = typeof Message.Type
86
112
  const App = Surface.application({
87
113
  Model,
88
114
  Message,
89
- initial: { route: Route.home(), remote: Remote.initial },
115
+ initial: { route: { _tag: 'home' }, remote: Remote.initial },
90
116
  update, // step 5: a function declaration, so it may follow Data
91
117
  })
92
118
 
@@ -122,16 +148,22 @@ The Surface's Model is `{ project: RemoteData<ProjectSummary>; projects:
122
148
  RemoteData<Page<ProjectSummary>> }`, read purely from the Model, no I/O. Every
123
149
  remote value is a `RemoteData`:
124
150
 
125
- - `Initial` — some selected field is not present yet,
151
+ - `Initial` — a selected field is not present, and **nothing is fetching it**,
152
+ - `Loading` — not present, and a read is in flight,
126
153
  - `Ready` — present,
127
154
  - `Refreshing` — present, and being refetched (the value stays visible),
128
155
  - `Failed` — the stored value did not decode against the selection,
129
156
  - `NotFound` — the entity is a tombstone.
130
157
 
131
- `RemoteData.match` is exhaustive. `Data.get` reads once and refreshes by policy;
132
- `Data.live` also follows the entity's changes; `Data.query` reads a connection
133
- as a `Page` of selected items, `Initial` until the page and every item's fields
134
- are present.
158
+ `Loading` is the absent-value twin of `Refreshing`: both mean a read is in
159
+ flight. The distinction from `Initial` is worth rendering differently, because
160
+ nothing fetches a projection no active Surface observes. Such a projection reads
161
+ `Initial` forever, and showing a spinner for it hides the wiring mistake, while
162
+ `Loading` is the state where waiting is the right thing to do.
163
+
164
+ `RemoteData.match` is exhaustive — omitting a case is a compile error. `Data.get` reads once and refreshes by policy; `Data.live` also
165
+ follows the entity's changes; `Data.query` reads a connection as a `Page` of
166
+ selected items, `Initial` until the page and every item's fields are present.
135
167
 
136
168
  ### 4. Fetch, subscribe, and retain from the active Surfaces
137
169
 
@@ -200,8 +232,8 @@ const clientLayer = Remote.clientLayer(rpcClient) // an Effect RPC client for Re
200
232
  `Remote.clientLayer` adapts an Effect RPC client for `RemoteRpc` to the
201
233
  `RemoteClient` service the subscriptions and Commands run through, and coalesces
202
234
  its reads and queries. The server side is
203
- [`foldkit-remote-server`](../remote-server) with sources compiled by
204
- [`foldkit-remote-drizzle`](../remote-drizzle) or written by hand.
235
+ [`foldkit-remote-server`](https://github.com/doeixd/foldkit-plus/tree/main/packages/remote-server) with sources compiled by
236
+ [`foldkit-remote-drizzle`](https://github.com/doeixd/foldkit-plus/tree/main/packages/remote-drizzle) or written by hand.
205
237
 
206
238
  ## Reading
207
239
 
@@ -229,6 +261,8 @@ returns the Model with the results reduced in, for SSR, route or hover
229
261
  prefetch, and tests. It never runs during render.
230
262
 
231
263
  ```ts
264
+ import { Effect } from 'effect'
265
+
232
266
  const loaded = await Effect.runPromise(
233
267
  Data.prefetch(model, ProjectPage.projection({ projectId }), {
234
268
  policy: RemotePolicy.staleWhileRevalidate({ maxAge: 30_000 }),
@@ -270,6 +304,8 @@ the union of their fields.
270
304
  ## Mutations
271
305
 
272
306
  ```ts
307
+ import { ConnectionChange } from 'foldkit-remote'
308
+
273
309
  const { model: started, requestId, tempId, command } = Data.mutate(model, AddComment, input, {
274
310
  optimistic: ({ tempId }) => [
275
311
  Comment.patch(tempId, { id: tempId, body: input.body }),
@@ -326,11 +362,13 @@ optimistic layers, the mutation ledger, gaps, and retention roots belong to the
326
362
  session and never appear in one.
327
363
 
328
364
  ```ts
329
- // SSR: the server prefetches, dehydrates for the page, the client hydrates.
330
- const html = RemotePersistence.dehydrate(Data.storeOf(loaded), { scope: userId })
365
+ import { emptyStore, RemotePersistence } from 'foldkit-remote'
366
+
367
+ // SSR: the server prefetches, dehydrates into the page, the client hydrates.
368
+ const snapshot = RemotePersistence.dehydrate(Data.storeOf(loaded), { scope: userId })
331
369
  Data.reduce(model, {
332
370
  _tag: 'Hydrated',
333
- entities: RemotePersistence.hydrate(html, { scope: userId }) ?? emptyStore,
371
+ entities: RemotePersistence.hydrate(snapshot, { scope: userId }) ?? emptyStore,
334
372
  merge: 'preserve-existing',
335
373
  })
336
374
 
@@ -355,10 +393,10 @@ the same as once.
355
393
 
356
394
  `Data.inspect(model)` returns a serializable summary of the cache — entities
357
395
  with their present/stale fields, connection keys, live streams, gaps, and the
358
- mutation ledger — and `Remote.inspectEntity(model, key)` returns one entity. Both
359
- are pure, so DevTools never reach into the private layout. `Data.plan(model,
360
- projection)` is the plan the read entry would run, and `Remote.planQueries`
361
- the queries; both are plain data.
396
+ mutation ledger — and `Remote.inspectEntity(remote, key)` returns one entity of
397
+ the store slice. Both are pure, so DevTools never reach into the private layout.
398
+ `Data.plan(model, projection)` is the plan the read entry would run, and
399
+ `Remote.planQueries` the queries; both are plain data.
362
400
 
363
401
  ## Advanced: the kernel
364
402
 
@@ -402,8 +440,9 @@ returns the new store.
402
440
 
403
441
  ### The reducer and its Messages
404
442
 
405
- `Remote.update(remote, message)` (`Data.reduce` on the bound slice) is the one
406
- pure reducer over `ReadReceived`/`ReadFailed`/`RefreshStarted`,
443
+ `updateRemote(remote, message)` — `Data.update` on a bound domain, `Data.reduce`
444
+ on the application Model — is the one pure reducer over
445
+ `ReadReceived`/`ReadFailed`/`RefreshStarted`,
407
446
  `MutationStarted`/`Succeeded`/`Failed`, `LiveReceived`/`GapCleared`,
408
447
  `ConnectionMerged`/`Invalidated`/`Refreshed`/`QueryFailed`,
409
448
  `RetentionChanged`, and `Hydrated`. `Remote.messages` is the case record for
@@ -417,10 +456,10 @@ store write a `ReadReceived` performs, for a caller that manages its own store.
417
456
  with fixed params and a `toMessage` that wraps the `RemoteMessage` in an
418
457
  application union that does not spread `Remote.messages`:
419
458
 
420
- ```ts
421
- Remote.observe(bound, surface, params, toMessage?, options?) // plan + read + queries
422
- Remote.live(bound, surface, params, toMessage?, options?) // the live stream, from the Model's cursor
423
- Remote.retain(projections, toMessage?, { connections?, grace? }) // roots → RetentionChanged
459
+ ```text
460
+ Remote.observe(bound, surface, params, toMessage?, options?) plan + read + queries
461
+ Remote.live(bound, surface, params, toMessage?, options?) the live stream, from the Model's cursor
462
+ Remote.retain(projections, toMessage?, { connections?, grace? }) roots → RetentionChanged
424
463
  ```
425
464
 
426
465
  The read entry's dependencies are the plan (`{ requirements, queries }`); it
@@ -434,7 +473,7 @@ second Message could be lost to the restart. The retain entry's dependencies
434
473
  are the roots (the projections' requirements, their connections with what
435
474
  each page selects of its items, plus any `connections` listed by identity); it
436
475
  emits `RetentionChanged` once the roots have been stable for `grace`, and
437
- `Remote.update` applies the pure `gc(state, roots)`: a root entity, the targets
476
+ the reducer applies the pure `gc(state, roots)`: a root entity, the targets
438
477
  its retained fields refer to, the targets a nested relation selects, a retained
439
478
  connection's edges and what its `select` reaches through them, and anything a
440
479
  pending request touches survive; everything else is dropped, settled overlays
@@ -451,9 +490,10 @@ window), so `first(25)` and `after(cursor).first(25)` merge into one
451
490
  connection.
452
491
 
453
492
  ```ts
493
+ // Inside an `Effect.gen`, with `RemoteClient` provided.
454
494
  const ref = Query.first(25)(ProjectsByOwner.ref({ ownerId }))
455
495
  const page = yield* Remote.query(ref) // Effect<QueryResult, RemoteQueryError, RemoteClient>
456
- Remote.update(remote, Remote.queryMessage(ref, page)) // ConnectionMerged
496
+ updateRemote(remote, Remote.queryMessage(ref, page)) // ConnectionMerged
457
497
  Remote.visibleItems(remote, ref) // edges a view shows: overlays placed, removals and tombstones hidden
458
498
  ```
459
499
 
@@ -471,7 +511,7 @@ keeps showing its items; a `ConnectionMerged` with `refreshes: true`,
471
511
  the one-step imperative form (start, run, settle) for SSR and tests.
472
512
  `Remote.mutate(mutation, input, requestId)` is the call itself: it decodes the
473
513
  typed `Output` and returns the result's normalized `entities` and confirmed
474
- `connections`, for a caller that reduces them through `Remote.update`. A
514
+ `connections`, for a caller that reduces them through `updateRemote`. A
475
515
  `MutationSucceeded` reconciles at most once per `requestId`; an unknown or
476
516
  already-applied result is a no-op.
477
517
 
@@ -510,7 +550,7 @@ beyond "issued concurrently".
510
550
  `query`, `next`, `previous`, `fetch`, `subscriptions`, `plan`, `storeOf`,
511
551
  `prefetch`, `mutate`, `reduce`, and `inspect`, each rejecting a descriptor
512
552
  the domain never declared at compile time (a branded error naming it) and at
513
- runtime. `Remote.update` is the single reducer over reads, mutation results,
553
+ runtime. `updateRemote` is the single reducer over reads, mutation results,
514
554
  live events, connections, and optimistic layers.
515
555
  - **Mutation reconciliation.** Idempotent per `requestId`, with a bounded
516
556
  settled-request ledger.
@@ -562,3 +602,12 @@ beyond "issued concurrently".
562
602
  - `RemoteData` is a closed union.
563
603
  - A selection picks at least one field: `Selection.make(User, {})` throws,
564
604
  since it would require nothing and read `Ready` for any id.
605
+
606
+ ## See also
607
+
608
+ - [Server-derived state](https://github.com/doeixd/foldkit-plus/blob/main/docs/remote.md) — the mental model, and
609
+ when to reach for something else.
610
+ - [`foldkit-remote-server`](https://github.com/doeixd/foldkit-plus/tree/main/packages/remote-server) — the server half; [`foldkit-remote-drizzle`](https://github.com/doeixd/foldkit-plus/tree/main/packages/remote-drizzle) compiles its
611
+ selections and queries to SQL.
612
+ - [`examples/remote`](https://github.com/doeixd/foldkit-plus/tree/main/examples/remote) — a worked plan, prefetch, render, mutate, retain trace;
613
+ [`examples/kitchen-sink`](https://github.com/doeixd/foldkit-plus/tree/main/examples/kitchen-sink) runs the same path over the real server packages.
package/dist/index.d.mts CHANGED
@@ -977,8 +977,8 @@ export declare const RemoteData: {
977
977
  //#endregion
978
978
  //#region src/model.d.ts
979
979
  /**
980
- * The normalized cache as a Foldkit Submodel. `Remote.make` returns a schema and
981
- * an `update` for this shape; `Remote.update` reconciles every producer.
980
+ * The normalized cache as a Foldkit Submodel. `Remote.define` returns a schema
981
+ * and an `update` for this shape; `updateRemote` reconciles every producer.
982
982
  */
983
983
  export interface RemoteModel {
984
984
  /** Entity values, presence, staleness, tombstones, and applied windows. */
@@ -993,10 +993,17 @@ export interface RemoteModel {
993
993
  readonly mutations: MutationState;
994
994
  /** Streams whose live cursor fell behind; the caller should resync or refetch. */
995
995
  readonly gaps: ReadonlySet<string>;
996
+ /**
997
+ * The `entity\0id\0field` marks a read is currently fetching. A field absent
998
+ * from the store reads as `Loading` while its mark is here and `Initial`
999
+ * otherwise, which is what separates "being fetched" from "nothing is
1000
+ * fetching this".
1001
+ */
1002
+ readonly loading: ReadonlySet<string>;
996
1003
  }
997
1004
  export declare const initialRemoteModel: RemoteModel;
998
1005
  export declare const remoteModelSchema: () => Schema.Schema<RemoteModel>;
999
- /** The submodel's Messages; each reduces to `RemoteModel` through `Remote.update`. */
1006
+ /** The submodel's Messages; each reduces to `RemoteModel` through `updateRemote`. */
1000
1007
  export type RemoteMessage = {
1001
1008
  readonly _tag: 'ReadReceived';
1002
1009
  readonly requests: readonly Requirement$1[];
@@ -1012,6 +1019,11 @@ export type RemoteMessage = {
1012
1019
  readonly _tag: 'RefreshStarted';
1013
1020
  readonly requests: readonly Requirement$1[];
1014
1021
  } |
1022
+ /** A read began; the fields it asks for that the store lacks read as `Loading`. */
1023
+ {
1024
+ readonly _tag: 'ReadStarted';
1025
+ readonly requests: readonly Requirement$1[];
1026
+ } |
1015
1027
  /** The active Surfaces' roots changed; everything they do not reach is collected. */
1016
1028
  {
1017
1029
  readonly _tag: 'RetentionChanged';
@@ -1099,6 +1111,9 @@ export declare const remoteMessageCases: {
1099
1111
  RefreshStarted: {
1100
1112
  requests: Schema.$Array<Schema.Codec<Requirement$1, Requirement$1, never, never>>;
1101
1113
  };
1114
+ ReadStarted: {
1115
+ requests: Schema.$Array<Schema.Codec<Requirement$1, Requirement$1, never, never>>;
1116
+ };
1102
1117
  RetentionChanged: {
1103
1118
  roots: Schema.Struct<{
1104
1119
  readonly requirements: Schema.$Array<Schema.Codec<Requirement$1, Requirement$1, never, never>>;
@@ -1179,6 +1194,12 @@ export declare const isRemoteMessage: <M extends {
1179
1194
  readonly _tag: RemoteMessageTag;
1180
1195
  }>;
1181
1196
  export declare const remoteMessageSchema: Schema.Schema<RemoteMessage>;
1197
+ /**
1198
+ * Whether a read is fetching any of `fields` for this entity. Consulted only
1199
+ * when the store lacks the value, which is what separates `Loading` from
1200
+ * `Initial`.
1201
+ */
1202
+ export declare const isLoading: (model: RemoteModel, entity: string, id: string, fields: ReadonlyArray<string>) => boolean;
1182
1203
  /**
1183
1204
  * The pure reducer all four producers share. A live event that arrives ahead of
1184
1205
  * its cursor is a gap: it is not applied, and the stream is recorded so the host
@@ -1656,7 +1677,7 @@ export interface RemoteDomain<AppModel, Store extends RemoteModel, Entities exte
1656
1677
  * mutation sequence unless `options.requestId` is given.
1657
1678
  */
1658
1679
  mutate<M extends MutationDescriptor<any, any, any>>(model: AppModel, mutation: M & Registered<M['name'], MutationName<Mutations[number]>, 'Mutation'>, input: MutationInput<M>, options?: DomainMutateOptions): MutationStarted<AppModel>;
1659
- /** `Remote.update` on the bound slice: reduces one of Remote's Messages, as `RemoteMessage` or as the application's union constructs it. */
1680
+ /** `updateRemote` on the bound slice: reduces one of Remote's Messages, as `RemoteMessage` or as the application's union constructs it. */
1660
1681
  reduce(model: AppModel, message: RemoteMessage | RemoteMessageInput): AppModel;
1661
1682
  /** `Remote.inspect` of the bound slice. */
1662
1683
  inspect(model: AppModel): RemoteInspection;
@@ -1758,6 +1779,9 @@ export declare const Remote: {
1758
1779
  RefreshStarted: {
1759
1780
  requests: Schema.$Array<Schema.Codec<Requirement$1, Requirement$1, never, never>>;
1760
1781
  };
1782
+ ReadStarted: {
1783
+ requests: Schema.$Array<Schema.Codec<Requirement$1, Requirement$1, never, never>>;
1784
+ };
1761
1785
  RetentionChanged: {
1762
1786
  roots: Schema.Struct<{
1763
1787
  readonly requirements: Schema.$Array<Schema.Codec<Requirement$1, Requirement$1, never, never>>;
@@ -1951,7 +1975,7 @@ export declare const Remote: {
1951
1975
  /**
1952
1976
  * Runs a mutation through `RemoteClient`, decoding its typed Output and
1953
1977
  * returning the result's normalized patches so the caller can reconcile them
1954
- * through `Remote.update`'s `MutationSucceeded` (or `Remote.mutateInto`).
1978
+ * through `updateRemote`'s `MutationSucceeded` (or `Remote.mutateInto`).
1955
1979
  */
1956
1980
  mutate: <Name extends string, Input, Output>(mutation: MutationDescriptor<Name, Input, Output>, input: Input, requestId: string) => Effect.Effect<{
1957
1981
  output: Output;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/connection.ts","../src/store.ts","../src/mutation.ts","../src/optimistic.ts","../src/query.ts","../src/live.ts","../src/retain.ts","../src/persistence.ts","../src/wire.ts","../src/remoteData.ts","../src/model.ts","../src/coalesce.ts","../src/client.ts","../src/relation.ts","../src/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;;;;;;EA4B9E,cAAA,WAAC,QACL,gBAAgB,IAAE,UACjB,oBACR,MAAM,MAAM,qBAAqB;;;;;;;;;;;;;;EAsC3B,SAAA,UAAU,UAAO,eAAA,aACX,cAAc,WAAW,qBAAmB,aAC7C,SAAS,kBAAkB,SAAO,UACrC,kBACR,sBAAsB,UAAU,SAAS;;;;;EAkBA,QAAA,qBAAqB,OAAK,KAAA,SAAA,MAAA,WAAA,OAAA;;;;;;;;;;;;;;;;;;;;;;;;EAavD,eAAA,qBAAqB,OAAK,KAClC,SAAS,MAAM,QAAM,QAClB,OAAO,OAAO,YAAY,iBACjC;;;;;;EAOmB,eAAA,OAAA,aAAW,YAAc,uBAAqB,cAAc;;;;EA9+BxD,gBAAA,OAAA,aAAA,gBAAA;;;;;;;;;;;;;;;;;;;;;;;;EA6gCxB,aAAA,qBACA,OACA,QACA,UACA,cAAc,aAAW,OAAA,YAAA,UAAA,gBAAA,OAAA,UAAA,UAAA,mBAAA,MAAA,OAAA,SAAA,OAAA,OAAA,mBAAA,UAAA,8BAAA,OAAA;;;;;;;;;;;;EAoCzB,UAAA,UACA,cAAc,aACd,sBACA,OACA,gBACA,QACA,UAAO,eAAA,OAEA,YAAY,UAAU,OAAO,QAAM,SACjC,QAAQ,UAAU,OAAO,gBAAgB,SAAO,QACjD,QAAM,aACF,SAAS,kBAAkB,SAAO,UACrC,mBACR,sBAAsB,UAAU,SAAS,kBAAkB;;;;;;;EAU5D,OAAA,UACA,cAAc,aACd,sBACA,OACA,gBACA,QACA,UAAO,eAAA,OAEA,YAAY,UAAU,OAAO,QAAM,SACjC,QAAQ,UAAU,OAAO,gBAAgB,SAAO,QACjD,QAAM,aACF,SAAS,kBAAkB,SAAO,UACrC,gBACR,sBACD,UACA;aACW,cAAc,cAAc;aAAuB,QAAQ;KACtE"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/connection.ts","../src/store.ts","../src/mutation.ts","../src/optimistic.ts","../src/query.ts","../src/live.ts","../src/retain.ts","../src/persistence.ts","../src/wire.ts","../src/remoteData.ts","../src/model.ts","../src/coalesce.ts","../src/client.ts","../src/relation.ts","../src/selection.ts","../src/entity.ts","../src/inspect.ts","../src/plan.ts","../src/policy.ts","../src/index.ts"],"mappings":";;;;;;;iBAUiB;WACN;WACA;;;iBAIM;WACN;WACA,KAAK;;qBAGH,OAAQ,KAAK,SAAS,iBAA8C;YAKrE;YAEA;WACG;;WACA;WAAyB,QAAQ;;WACjC;;qBAEF,UAAU;qBACV,SAAS;qBACT,SAAU,OAAO,WAAS;iBAEtB;WACN,gBAAgB;WAChB,OAAO;WACP,KAAK;;iBAGC;WACN,mBAAmB;WACnB;;qBAGE,iBAAiB;qBAEjB,UAAW,gBAAgB,QAAQ,OAAO,UAAU,KAAK,aAAW;;qBA+FpE,QAAS,SAAS,YAAY,MAAM,YAAU;;qBAsC9C,QAAS,YAAY,eAAa,cAAc;;qBAIhD,cAAe,YAAY;;qBAM3B,UAAW,YAAY;;qBAMvB,WAAY,YAAY;;;YC7LzB;iBAEK;WACN,QAAQ,SAAS;WACjB,SAAS;;WAET,OAAO;;WAEP;;WAEA;;;;;WAKA,SAAS,SAAS;;YAGjB,cAAc,SAAS,OAAO,WAAW;;qBAGxC,YAAa,gBAAgB,eAAa;qBAW1C,YAAY;iBAkCR;WACN,KAAK;WACL,QAAQ,SAAS;;WAEjB,UAAU,SAAS;;;;;;;qBAQjB,gBACX,OAAO,aACP,QAAQ,cAAc,cACtB,iBACC;;qBAUU,cACX,OAAO,aACP,KAAK,WACL,QAAQ,SAAS,0BACjB,cACA,UAAU,SAAS,4BAClB;;;;;;qBAOU,WACX,OAAO,aACP,OAAO,wBAAwB,KAAK,WAAW,QAAQ,oBACvD,mBACC;;qBAkBU,YACX,OAAO,aACP,KAAK,WACL,QAAQ,qBACP;;qBAGU,aACX,OAAO,aACP,KAAK,WACL,QAAQ,qBACP;;qBAGU,YAAa,OAAO,aAAa,KAAK,cAAY;;qBAWlD,SAAU,OAAO,aAAa,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AAkB,SAAO,UACrC,gBACR,sBACD,UACA;aACW,cAAc,cAAc;aAAuB,QAAQ;KACtE"}
package/dist/index.mjs CHANGED
@@ -1641,7 +1641,8 @@ const initialRemoteModel = {
1641
1641
  optimistic: emptyOptimistic,
1642
1642
  live: {},
1643
1643
  mutations: emptyMutationState,
1644
- gaps: /* @__PURE__ */ new Set()
1644
+ gaps: /* @__PURE__ */ new Set(),
1645
+ loading: /* @__PURE__ */ new Set()
1645
1646
  };
1646
1647
  /** The entity store and the mutation ledger are runtime values, not wire shapes. */
1647
1648
  const runtimeSchema = Schema.Unknown;
@@ -1651,7 +1652,8 @@ const remoteModelSchema = () => Schema.Struct({
1651
1652
  optimistic: runtimeSchema,
1652
1653
  live: Schema.Record(Schema.String, runtimeSchema),
1653
1654
  mutations: runtimeSchema,
1654
- gaps: runtimeSchema
1655
+ gaps: runtimeSchema,
1656
+ loading: runtimeSchema
1655
1657
  });
1656
1658
  const retentionRootsSchema = Schema.Struct({
1657
1659
  requirements: Schema.Array(ReadRequest),
@@ -1675,6 +1677,7 @@ const remoteMessageCases = {
1675
1677
  error: remoteErrorSchema
1676
1678
  },
1677
1679
  RefreshStarted: { requests: Schema.Array(ReadRequest) },
1680
+ ReadStarted: { requests: Schema.Array(ReadRequest) },
1678
1681
  RetentionChanged: { roots: retentionRootsSchema },
1679
1682
  Hydrated: {
1680
1683
  entities: runtimeSchema,
@@ -1722,6 +1725,39 @@ const remoteMessageSchema = Schema.Union(Object.entries(remoteMessageCases).map(
1722
1725
  ...fields
1723
1726
  })));
1724
1727
  const marksOf = (requests) => requests.map((request) => [entityKey(request.entity, request.id), request.fields]);
1728
+ /**
1729
+ * One mark per requested field. A read is identified by what it asks for, not by
1730
+ * a request id: two reads asking for one field share its mark, so the first
1731
+ * answer clears it. Over-clearing shows `Initial` rather than a spinner, which
1732
+ * is the safer way to be wrong.
1733
+ */
1734
+ const loadingMarks = function* (requests) {
1735
+ for (const request of requests) {
1736
+ const key = entityKey(request.entity, request.id);
1737
+ for (const field of request.fields) yield `${key}\u0000${field}`;
1738
+ }
1739
+ };
1740
+ const withLoading = (loading, requests) => {
1741
+ const next = new Set(loading);
1742
+ for (const mark of loadingMarks(requests)) next.add(mark);
1743
+ return next;
1744
+ };
1745
+ const withoutLoading = (loading, requests) => {
1746
+ if (loading.size === 0) return loading;
1747
+ const next = new Set(loading);
1748
+ for (const mark of loadingMarks(requests)) next.delete(mark);
1749
+ return next;
1750
+ };
1751
+ /**
1752
+ * Whether a read is fetching any of `fields` for this entity. Consulted only
1753
+ * when the store lacks the value, which is what separates `Loading` from
1754
+ * `Initial`.
1755
+ */
1756
+ const isLoading = (model, entity, id, fields) => {
1757
+ if (model.loading.size === 0) return false;
1758
+ const key = entityKey(entity, id);
1759
+ return fields.some((field) => model.loading.has(`${key}\u0000${field}`));
1760
+ };
1725
1761
  const setConnectionStale = (connections, connection, stale) => {
1726
1762
  const current = connections[connection] ?? emptyConnection;
1727
1763
  return {
@@ -1749,11 +1785,13 @@ const updateRemote = (model, message) => {
1749
1785
  switch (message._tag) {
1750
1786
  case "ReadReceived": return {
1751
1787
  ...model,
1752
- entities: writeRead(model.entities, message.requests, message.result, message.now)
1788
+ entities: writeRead(model.entities, message.requests, message.result, message.now),
1789
+ loading: withoutLoading(model.loading, message.requests)
1753
1790
  };
1754
1791
  case "ReadFailed": return {
1755
1792
  ...model,
1756
- entities: setStale(model.entities, marksOf(message.requests), false)
1793
+ entities: setStale(model.entities, marksOf(message.requests), false),
1794
+ loading: withoutLoading(model.loading, message.requests)
1757
1795
  };
1758
1796
  case "RetentionChanged": return {
1759
1797
  ...model,
@@ -1767,6 +1805,10 @@ const updateRemote = (model, message) => {
1767
1805
  ...model,
1768
1806
  entities: setStale(model.entities, marksOf(message.requests), true)
1769
1807
  };
1808
+ case "ReadStarted": return {
1809
+ ...model,
1810
+ loading: withLoading(model.loading, message.requests)
1811
+ };
1770
1812
  case "MutationStarted": return {
1771
1813
  ...model,
1772
1814
  mutations: beginMutation(model.mutations, message.requestId),
@@ -2405,10 +2447,13 @@ const observeEntry = (bound, askedOf, toMessage, options) => {
2405
2447
  }))
2406
2448
  };
2407
2449
  },
2408
- dependenciesToStream: ({ requirements, queries }) => Stream.concat(RemotePolicy.refreshes(policy) && requirements.length > 0 ? Stream.succeed(toMessage({
2450
+ dependenciesToStream: ({ requirements, queries }) => Stream.concat(requirements.length === 0 ? Stream.empty : Stream.fromIterable([toMessage({
2451
+ _tag: "ReadStarted",
2452
+ requests: requirements
2453
+ }), ...RemotePolicy.refreshes(policy) ? [toMessage({
2409
2454
  _tag: "RefreshStarted",
2410
2455
  requests: requirements
2411
- })) : Stream.empty, Stream.mergeAll([...requirements.length === 0 ? [] : [Stream.fromEffect(read(requirements))], ...queries.map((query) => Stream.fromEffect(run(query)))], { concurrency: "unbounded" }))
2456
+ })] : []]), Stream.mergeAll([...requirements.length === 0 ? [] : [Stream.fromEffect(read(requirements))], ...queries.map((query) => Stream.fromEffect(run(query)))], { concurrency: "unbounded" }))
2412
2457
  };
2413
2458
  };
2414
2459
  /** The live entry: subscribes to `requirementsOf(model)` from the Model's resume cursor. */
@@ -2512,10 +2557,10 @@ const Remote = {
2512
2557
  read: (root) => {
2513
2558
  const store = storeOf(bound, root);
2514
2559
  const key = entityKey(selection.entity, id);
2515
- return memoRead(store, store, `${key}\u0000${stableStringify(relation)}`, () => {
2560
+ const present = memoRead(store, store, `${key}\u0000${stableStringify(relation)}`, () => {
2516
2561
  if (isTombstone(store, key)) return { _tag: "NotFound" };
2517
2562
  const assembled = assemble(store, key, relation);
2518
- if (assembled === void 0) return { _tag: "Initial" };
2563
+ if (assembled === void 0) return void 0;
2519
2564
  const decoded = Schema.decodeUnknownResult(selection.schema)(assembled.values);
2520
2565
  return Result.isFailure(decoded) ? {
2521
2566
  _tag: "Failed",
@@ -2531,6 +2576,8 @@ const Remote = {
2531
2576
  value: decoded.success
2532
2577
  };
2533
2578
  });
2579
+ if (present !== void 0) return present;
2580
+ return isLoading(bound.store.get(root), selection.entity, id, relation.fields) ? { _tag: "Loading" } : { _tag: "Initial" };
2534
2581
  }
2535
2582
  });
2536
2583
  },
@@ -2648,7 +2695,7 @@ const Remote = {
2648
2695
  /**
2649
2696
  * Runs a mutation through `RemoteClient`, decoding its typed Output and
2650
2697
  * returning the result's normalized patches so the caller can reconcile them
2651
- * through `Remote.update`'s `MutationSucceeded` (or `Remote.mutateInto`).
2698
+ * through `updateRemote`'s `MutationSucceeded` (or `Remote.mutateInto`).
2652
2699
  */
2653
2700
  mutate: mutateRemote,
2654
2701
  /**
@@ -2914,6 +2961,6 @@ const pageSize = (window, key) => {
2914
2961
  return size === void 0 ? {} : { [key]: size };
2915
2962
  };
2916
2963
  //#endregion
2917
- export { ConnectionChange, ConnectionChangeSchema, Entity, Live, LiveChange, LiveEdge, LiveRequirement, MAX_FIELDS_PER_REQUEST, MAX_RELATION_DEPTH, Mutate, Mutation, MutationRequest, MutationResult, NormalizedEntity, PageSize, Query, QueryEdge, QueryRequest, QueryResult, QueryRpc, REMOTE_CACHE_VERSION, REMOTE_PROTOCOL_VERSION, Read, ReadBatch, ReadBatchResult, ReadRequest, RelationAnnotation, RelationEntityAnnotation, RelationRequest, Remote, RemoteClient, RemoteData, RemoteLiveError, RemoteMutationError, RemotePersistence, RemotePolicy, RemoteProtocolError, RemoteQueryError, RemoteReadError, RemoteRpc, Selection, WindowSchema, WireBoundary, addLayer, addOverlay, applyConnectionEvent, applyEntityEvent, assemble, beginMutation, beginOptimistic, classifyLive, clearStale, coalesceQueries, coalesceReads, coalescedLayer, connectionChangeOf, connectionIdentity, cursor, edge, emptyConnection, emptyLiveState, emptyMutationState, emptyOptimistic, emptyStore, entityKey, entry, failMutation, gc, hasField, hasNext, hasPrevious, initialRemoteModel, inspectEntity, inspectRemote, invalidateConnection, isFieldStale, isGapped, isRefPage, isRemoteMessage, isStale, isTombstone, items, liveEventOf, liveHasNext, liveHasPrevious, markStale, merge, missingFields, mutateRemote, pageSchema, plan, pruneOverlays, reachable, readField, reconcileMutation, refParts, refreshConnection, refsIn, relationOf, relationShape, remoteDataSchema, remoteError, remoteErrorSchema, remoteMessageCases, remoteMessageSchema, remoteModelSchema, remove, removeLayer, removeOverlay, requirementKey, retentionRootsSchema, schemaOf, segment, setStale, settleFailure, settleSuccess, shouldWake, stableStringify, targetsOf, terminal, tombstone, unknown, updateRemote, visibleItems, visibleStore, windowKey, writeEntities, writeEntity, writeRead };
2964
+ export { ConnectionChange, ConnectionChangeSchema, Entity, Live, LiveChange, LiveEdge, LiveRequirement, MAX_FIELDS_PER_REQUEST, MAX_RELATION_DEPTH, Mutate, Mutation, MutationRequest, MutationResult, NormalizedEntity, PageSize, Query, QueryEdge, QueryRequest, QueryResult, QueryRpc, REMOTE_CACHE_VERSION, REMOTE_PROTOCOL_VERSION, Read, ReadBatch, ReadBatchResult, ReadRequest, RelationAnnotation, RelationEntityAnnotation, RelationRequest, Remote, RemoteClient, RemoteData, RemoteLiveError, RemoteMutationError, RemotePersistence, RemotePolicy, RemoteProtocolError, RemoteQueryError, RemoteReadError, RemoteRpc, Selection, WindowSchema, WireBoundary, addLayer, addOverlay, applyConnectionEvent, applyEntityEvent, assemble, beginMutation, beginOptimistic, classifyLive, clearStale, coalesceQueries, coalesceReads, coalescedLayer, connectionChangeOf, connectionIdentity, cursor, edge, emptyConnection, emptyLiveState, emptyMutationState, emptyOptimistic, emptyStore, entityKey, entry, failMutation, gc, hasField, hasNext, hasPrevious, initialRemoteModel, inspectEntity, inspectRemote, invalidateConnection, isFieldStale, isGapped, isLoading, isRefPage, isRemoteMessage, isStale, isTombstone, items, liveEventOf, liveHasNext, liveHasPrevious, markStale, merge, missingFields, mutateRemote, pageSchema, plan, pruneOverlays, reachable, readField, reconcileMutation, refParts, refreshConnection, refsIn, relationOf, relationShape, remoteDataSchema, remoteError, remoteErrorSchema, remoteMessageCases, remoteMessageSchema, remoteModelSchema, remove, removeLayer, removeOverlay, requirementKey, retentionRootsSchema, schemaOf, segment, setStale, settleFailure, settleSuccess, shouldWake, stableStringify, targetsOf, terminal, tombstone, unknown, updateRemote, visibleItems, visibleStore, windowKey, writeEntities, writeEntity, writeRead };
2918
2965
 
2919
2966
  //# sourceMappingURL=index.mjs.map