foldkit-remote 0.13.0 → 0.14.1
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 +263 -11
- package/dist/{index-Dh4qdXfE.d.mts → index-CXAGo7Dz.d.mts} +479 -50
- package/dist/index-CXAGo7Dz.d.mts.map +1 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +2 -2
- package/dist/port.d.mts +1 -1
- package/dist/port.mjs +1 -1
- package/dist/{src-C53_fLA2.mjs → src-CcPPtNuH.mjs} +1109 -131
- package/dist/src-CcPPtNuH.mjs.map +1 -0
- package/package.json +4 -4
- package/dist/index-Dh4qdXfE.d.mts.map +0 -1
- package/dist/src-C53_fLA2.mjs.map +0 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Context, Duration, Effect, Layer, Option, Result, Schema, Stream } from "effect";
|
|
1
|
+
import { Context, Data, Duration, Effect, Layer, Option, Result, Schema, Stream } from "effect";
|
|
2
|
+
import { KeyValueStore } from "effect/persistence";
|
|
2
3
|
import * as Domain from "foldkit-entity";
|
|
3
|
-
import { AnyEntity, AnyQuery, Dependencies, InputExpr, Query } from "foldkit-entity";
|
|
4
|
+
import { AnyEntity, AnyQuery, AnyWrite, BoundWrite, Dependencies, InputExpr, Query, Write } from "foldkit-entity";
|
|
4
5
|
import { Command } from "foldkit/command";
|
|
5
6
|
import { EntryWithoutKeepAlive } from "foldkit/subscription";
|
|
6
|
-
import { ActiveSurface, Contract, Invalid, Metadata, ModelRef, Projection, Surface, Wiring } from "foldkit-surface";
|
|
7
|
+
import { ActiveSurface, Contract, Invalid, Metadata, ModelRef, Projection, Surface, SurfaceSource, Wiring } from "foldkit-surface";
|
|
7
8
|
import { Rpc, RpcClientError, RpcGroup } from "effect/rpc";
|
|
8
|
-
import { KeyValueStore } from "effect/persistence";
|
|
9
9
|
import * as Update from "foldkit/update";
|
|
10
10
|
//#region ../metadata/src/index.d.ts
|
|
11
11
|
/** Marks a `Metadata` value. Its entries are private to this module. */
|
|
@@ -108,6 +108,13 @@ declare const isGapped: (connection: Connection) => boolean;
|
|
|
108
108
|
interface RemoteError {
|
|
109
109
|
readonly _tag: string;
|
|
110
110
|
readonly message: string;
|
|
111
|
+
/**
|
|
112
|
+
* A refused mutation's refusal, encoded as the server sent it. Read it
|
|
113
|
+
* decoded, by its mutation, with `Data.refusal`.
|
|
114
|
+
*/
|
|
115
|
+
readonly refusal?: unknown;
|
|
116
|
+
/** Why the server refused who is asking (`_tag: 'Forbidden'`), when it said. */
|
|
117
|
+
readonly reason?: string;
|
|
111
118
|
}
|
|
112
119
|
type RemoteData<A> = {
|
|
113
120
|
readonly _tag: 'Initial';
|
|
@@ -144,6 +151,8 @@ type Freshness = {
|
|
|
144
151
|
declare const remoteErrorSchema: Schema.Struct<{
|
|
145
152
|
readonly _tag: Schema.String;
|
|
146
153
|
readonly message: Schema.String;
|
|
154
|
+
readonly refusal: Schema.optional<Schema.Unknown>;
|
|
155
|
+
readonly reason: Schema.optional<Schema.String>;
|
|
147
156
|
}>;
|
|
148
157
|
declare const remoteDataSchema: <A>(value: Schema.Schema<A>) => Schema.Codec<RemoteData<A>, unknown>;
|
|
149
158
|
declare const RemoteData: {
|
|
@@ -343,26 +352,81 @@ interface MutationAnswer {
|
|
|
343
352
|
*/
|
|
344
353
|
declare const reconcileMutation: (store: EntityStore, state: MutationState, requestId: string, answer: MutationAnswer) => Reconciled;
|
|
345
354
|
/** A mutation an application declares: its name and input/output codecs. */
|
|
346
|
-
interface MutationDescriptor<Name extends string, Input, Output> {
|
|
355
|
+
interface MutationDescriptor<Name extends string, Input, Output, Refused = unknown> {
|
|
347
356
|
readonly name: Name;
|
|
348
357
|
readonly Input: Schema.Codec<Input>;
|
|
349
358
|
readonly Output: Schema.Codec<Output>;
|
|
359
|
+
/**
|
|
360
|
+
* What the server may refuse the mutation with, as a value a client can
|
|
361
|
+
* match on rather than a message to parse: `Schema.Never` when it declares
|
|
362
|
+
* none.
|
|
363
|
+
*/
|
|
364
|
+
readonly Refusal: Schema.Codec<Refused, unknown>;
|
|
365
|
+
/**
|
|
366
|
+
* What the mutation writes, when it was declared as a `Write`: the optimistic
|
|
367
|
+
* patch a client shows, and what a server can run without a handler.
|
|
368
|
+
*/
|
|
369
|
+
readonly write?: AnyWrite | undefined;
|
|
350
370
|
}
|
|
371
|
+
/** Refusals a form or an editor knows how to show. */
|
|
372
|
+
declare const Refusal: {
|
|
373
|
+
/** One input key was refused, for `reason`, which a form shows beside that key. */
|
|
374
|
+
field: <const Key extends string, Reason extends Schema.Top>(key: Key, reason: Reason) => Schema.TaggedStruct<"Field", {
|
|
375
|
+
readonly key: Schema.Literal<Key>;
|
|
376
|
+
readonly reason: Reason;
|
|
377
|
+
}>;
|
|
378
|
+
/** The row moved on since the client read it; the author decides what wins. */
|
|
379
|
+
conflict: Schema.TaggedStruct<"Conflict", {}>;
|
|
380
|
+
/** Whether a refusal, of whatever mutation, is a `Refusal.field`. */
|
|
381
|
+
isField: <I>(input: I) => input is I & {
|
|
382
|
+
readonly _tag: "Field";
|
|
383
|
+
readonly key: string;
|
|
384
|
+
readonly reason: unknown;
|
|
385
|
+
};
|
|
386
|
+
/** Whether a refusal, of whatever mutation, is `Refusal.conflict`. */
|
|
387
|
+
isConflict: <I>(input: I) => input is I & {
|
|
388
|
+
readonly _tag: "Conflict";
|
|
389
|
+
};
|
|
390
|
+
};
|
|
351
391
|
/** A codec, or the fields of a `Schema.Struct` where one is expected. */
|
|
352
392
|
type SchemaOrFields = Schema.Codec<any, any, any, any> | Schema.Struct.Fields;
|
|
353
393
|
/** The decoded type of a codec, or of the Struct the fields describe. */
|
|
354
394
|
type TypeOf<S extends SchemaOrFields> = S extends Schema.Codec<infer T, any, any, any> ? T : S extends Schema.Struct.Fields ? Schema.Struct.Type<S> : never;
|
|
355
395
|
/** The codec itself, or a `Schema.Struct` over the fields. */
|
|
356
396
|
declare const schemaOf: <S extends SchemaOrFields>(shape: S) => Schema.Codec<TypeOf<S>>;
|
|
397
|
+
/**
|
|
398
|
+
* A bound write as the store patches it: its fields as they are, and each
|
|
399
|
+
* relation it points as the ref key the store holds (`'User:u1'`), or null.
|
|
400
|
+
*/
|
|
401
|
+
declare const patchOfWrite: (bound: BoundWrite) => NormalizedPatch;
|
|
402
|
+
/**
|
|
403
|
+
* What a declared write shows before the server answers: an update's or an
|
|
404
|
+
* insert's row as a patch (an update's only for the keys named, when some
|
|
405
|
+
* are). A delete shows nothing, since no operation removes a row from every
|
|
406
|
+
* list it is in; its answer does.
|
|
407
|
+
*/
|
|
408
|
+
declare const optimisticOfWrite: (write: AnyWrite, input: unknown, keys: ReadonlyArray<string> | undefined) => ReadonlyArray<NormalizedPatch>;
|
|
357
409
|
declare const Mutation: {
|
|
358
410
|
/**
|
|
359
411
|
* Declares a mutation. `Input` and `Output` are codecs, or the fields of the
|
|
360
412
|
* `Schema.Struct` they would be (`{ id: ProjectId, name: Schema.String }`).
|
|
413
|
+
* `Refusal`, when given, is what the server may refuse with: a codec, usually
|
|
414
|
+
* a union of `Refusal.field(...)` and `Refusal.conflict`.
|
|
361
415
|
*/
|
|
362
|
-
|
|
416
|
+
/**
|
|
417
|
+
* A mutation that is a declared `Write` (`update`, `insert` or `delete`): its
|
|
418
|
+
* input is the write's, and it answers nothing but the row it changed, as a
|
|
419
|
+
* patch, or its deletion. It may be refused as a conflict, for a write that
|
|
420
|
+
* `expect`s a revision the row has moved past.
|
|
421
|
+
*/
|
|
422
|
+
write: <const Name extends string, Fields extends Schema.Struct.Fields>(name: Name, write: Write<any, Fields>) => MutationDescriptor<Name, Schema.Struct.Type<Fields>, {}, typeof Refusal.conflict.Type> & {
|
|
423
|
+
readonly write: Write<any, Fields>;
|
|
424
|
+
};
|
|
425
|
+
make: <const Name extends string, Input extends SchemaOrFields, Output extends SchemaOrFields, Refused = never>(name: Name, config: {
|
|
363
426
|
readonly Input: Input;
|
|
364
427
|
readonly Output: Output;
|
|
365
|
-
|
|
428
|
+
readonly Refusal?: Schema.Codec<Refused, any>;
|
|
429
|
+
}) => MutationDescriptor<Name, TypeOf<Input>, TypeOf<Output>, Refused>;
|
|
366
430
|
};
|
|
367
431
|
//#endregion
|
|
368
432
|
//#region src/query.d.ts
|
|
@@ -485,8 +549,10 @@ declare const Query$1: {
|
|
|
485
549
|
before: (cursor: Cursor) => <R extends QueryRef<string, unknown>>(ref: R) => R;
|
|
486
550
|
from: <E extends AnyEntity>(entity: E) => Query<E>;
|
|
487
551
|
where: (...predicates: ReadonlyArray<import("foldkit-entity").Predicate>) => <E extends AnyEntity>(self: Query<E>) => Query<E>;
|
|
488
|
-
orderBy: (...terms: ReadonlyArray<import("foldkit-entity").
|
|
489
|
-
|
|
552
|
+
orderBy: (...terms: ReadonlyArray<import("foldkit-entity").Ordering>) => <E extends AnyEntity>(self: Query<E>) => Query<E>;
|
|
553
|
+
orderFor: (self: AnyQuery, input: Readonly<Record<string, unknown>>) => ReadonlyArray<import("foldkit-entity").OrderTerm>;
|
|
554
|
+
placement: (self: AnyQuery, input: Readonly<Record<string, unknown>>) => import("foldkit-entity").Placement;
|
|
555
|
+
dependencies: (self: AnyQuery) => import("foldkit-entity").QueryDependencies;
|
|
490
556
|
unsupported: (self: AnyQuery, supported: ReadonlyArray<import("foldkit-entity").Operation>) => ReadonlyArray<import("foldkit-entity").Operation>;
|
|
491
557
|
show: (self: AnyQuery) => string;
|
|
492
558
|
};
|
|
@@ -868,8 +934,20 @@ declare const RemoteReadError_base: Schema.Class<RemoteReadError, Schema.TaggedS
|
|
|
868
934
|
declare class RemoteReadError extends RemoteReadError_base {}
|
|
869
935
|
declare const RemoteMutationError_base: Schema.Class<RemoteMutationError, Schema.TaggedStruct<"RemoteMutationError", {
|
|
870
936
|
readonly message: Schema.String;
|
|
937
|
+
/** The mutation's own `Refusal`, encoded, when the server refused it as one. */
|
|
938
|
+
readonly refusal: Schema.optional<Schema.Unknown>;
|
|
871
939
|
}>, import("effect/Cause").YieldableError>;
|
|
872
940
|
declare class RemoteMutationError extends RemoteMutationError_base {}
|
|
941
|
+
declare const RemoteForbidden_base: Schema.Class<RemoteForbidden, Schema.TaggedStruct<"Forbidden", {
|
|
942
|
+
readonly message: Schema.String;
|
|
943
|
+
readonly reason: Schema.optional<Schema.String>;
|
|
944
|
+
}>, import("effect/Cause").YieldableError>;
|
|
945
|
+
/**
|
|
946
|
+
* The server refused who is asking: they may not do this, and asking again
|
|
947
|
+
* as the same principal is refused again. `reason` is the application's own
|
|
948
|
+
* words for the person who asked; without it the refusal says nothing of why.
|
|
949
|
+
*/
|
|
950
|
+
declare class RemoteForbidden extends RemoteForbidden_base {}
|
|
873
951
|
declare const RemoteLiveError_base: Schema.Class<RemoteLiveError, Schema.TaggedStruct<"RemoteLiveError", {
|
|
874
952
|
readonly message: Schema.String;
|
|
875
953
|
}>, import("effect/Cause").YieldableError>;
|
|
@@ -931,6 +1009,8 @@ declare const MutationRequest: Schema.Struct<{
|
|
|
931
1009
|
readonly requestId: Schema.String;
|
|
932
1010
|
readonly mutation: Schema.String;
|
|
933
1011
|
readonly input: Schema.Unknown;
|
|
1012
|
+
/** For a mutation that is a `Write`: the input keys to write, when not all of them. */
|
|
1013
|
+
readonly keys: Schema.optional<Schema.$Array<Schema.String>>;
|
|
934
1014
|
}>;
|
|
935
1015
|
declare const LiveEdge: Schema.Struct<{
|
|
936
1016
|
readonly entity: Schema.String;
|
|
@@ -1054,6 +1134,8 @@ declare const Mutate: Rpc.Rpc<"FoldkitRemoteMutate", Schema.Struct<{
|
|
|
1054
1134
|
readonly requestId: Schema.String;
|
|
1055
1135
|
readonly mutation: Schema.String;
|
|
1056
1136
|
readonly input: Schema.Unknown;
|
|
1137
|
+
/** For a mutation that is a `Write`: the input keys to write, when not all of them. */
|
|
1138
|
+
readonly keys: Schema.optional<Schema.$Array<Schema.String>>;
|
|
1057
1139
|
}>, Schema.Struct<{
|
|
1058
1140
|
readonly output: Schema.Unknown;
|
|
1059
1141
|
readonly entities: Schema.$Array<Schema.Struct<{
|
|
@@ -1085,7 +1167,7 @@ declare const Mutate: Rpc.Rpc<"FoldkitRemoteMutate", Schema.Struct<{
|
|
|
1085
1167
|
readonly entity: Schema.String;
|
|
1086
1168
|
readonly id: Schema.String;
|
|
1087
1169
|
}>>>;
|
|
1088
|
-
}>, typeof RemoteMutationError, never, never>;
|
|
1170
|
+
}>, Schema.Union<readonly [typeof RemoteMutationError, typeof RemoteForbidden]>, never, never>;
|
|
1089
1171
|
declare const Live: Rpc.Rpc<"FoldkitRemoteLive", Schema.Struct<{
|
|
1090
1172
|
readonly version: Schema.Number;
|
|
1091
1173
|
readonly requirements: Schema.$Array<Schema.Codec<Requirement, Requirement, never, never>>;
|
|
@@ -1270,6 +1352,8 @@ declare const RemoteRpc: RpcGroup.RpcGroup<Rpc.Rpc<"FoldkitRemoteRead", Schema.S
|
|
|
1270
1352
|
readonly requestId: Schema.String;
|
|
1271
1353
|
readonly mutation: Schema.String;
|
|
1272
1354
|
readonly input: Schema.Unknown;
|
|
1355
|
+
/** For a mutation that is a `Write`: the input keys to write, when not all of them. */
|
|
1356
|
+
readonly keys: Schema.optional<Schema.$Array<Schema.String>>;
|
|
1273
1357
|
}>, Schema.Struct<{
|
|
1274
1358
|
readonly output: Schema.Unknown;
|
|
1275
1359
|
readonly entities: Schema.$Array<Schema.Struct<{
|
|
@@ -1301,7 +1385,7 @@ declare const RemoteRpc: RpcGroup.RpcGroup<Rpc.Rpc<"FoldkitRemoteRead", Schema.S
|
|
|
1301
1385
|
readonly entity: Schema.String;
|
|
1302
1386
|
readonly id: Schema.String;
|
|
1303
1387
|
}>>>;
|
|
1304
|
-
}>, typeof RemoteMutationError, never, never> | Rpc.Rpc<"FoldkitRemoteLive", Schema.Struct<{
|
|
1388
|
+
}>, Schema.Union<readonly [typeof RemoteMutationError, typeof RemoteForbidden]>, never, never> | Rpc.Rpc<"FoldkitRemoteLive", Schema.Struct<{
|
|
1305
1389
|
readonly version: Schema.Number;
|
|
1306
1390
|
readonly requirements: Schema.$Array<Schema.Codec<Requirement, Requirement, never, never>>;
|
|
1307
1391
|
/** Resume cursor; events at or before it are duplicates. */
|
|
@@ -1417,8 +1501,14 @@ interface RemoteModel {
|
|
|
1417
1501
|
readonly live: Readonly<Record<string, LiveState>>;
|
|
1418
1502
|
/** Mutation pending/applied/failed ledger. */
|
|
1419
1503
|
readonly mutations: MutationState;
|
|
1420
|
-
/**
|
|
1504
|
+
/**
|
|
1505
|
+
* Streams that broke, by an error or by an event ahead of their cursor, and
|
|
1506
|
+
* have not resubscribed since: changes after the break are missed until the
|
|
1507
|
+
* live entry restarts them and refetches what they cover.
|
|
1508
|
+
*/
|
|
1421
1509
|
readonly gaps: ReadonlySet<string>;
|
|
1510
|
+
/** Each live stream that has ever broken, by stream key. One that never broke is absent. */
|
|
1511
|
+
readonly streams: Readonly<Record<string, StreamHealth>>;
|
|
1422
1512
|
/**
|
|
1423
1513
|
* The `entity\0id\0field` marks a read is currently fetching. A field absent
|
|
1424
1514
|
* from the store reads as `Loading` while its mark is here and `Initial`
|
|
@@ -1445,6 +1535,42 @@ interface RemoteModel {
|
|
|
1445
1535
|
* is how a view retries.
|
|
1446
1536
|
*/
|
|
1447
1537
|
readonly failures: Failures;
|
|
1538
|
+
/**
|
|
1539
|
+
* The storage key the cache was last restored from, through `Hydrated`'s
|
|
1540
|
+
* `from`. `Data.persistence` saves under a key only once its own snapshot is
|
|
1541
|
+
* in, so a save at startup cannot write the empty store over it.
|
|
1542
|
+
*/
|
|
1543
|
+
readonly restoredFrom: Option.Option<string>;
|
|
1544
|
+
/**
|
|
1545
|
+
* Under `verifyPlacement`, the order each list was placed in, by edge key,
|
|
1546
|
+
* and the rows placing took out of its first page, until the server's page
|
|
1547
|
+
* for it arrives to be compared with them.
|
|
1548
|
+
*/
|
|
1549
|
+
readonly placed: Readonly<Record<string, PlacedOrder>>;
|
|
1550
|
+
/** Under `verifyPlacement`, each placement the server's page disagreed with. */
|
|
1551
|
+
readonly placementMismatches: ReadonlyArray<PlacementMismatch>;
|
|
1552
|
+
}
|
|
1553
|
+
/** A list's first page as the client placed it: its keys in order, and those it took out. */
|
|
1554
|
+
interface PlacedOrder {
|
|
1555
|
+
readonly order: ReadonlyArray<string>;
|
|
1556
|
+
readonly dropped: ReadonlyArray<string>;
|
|
1557
|
+
}
|
|
1558
|
+
/** A list the client placed rows in one order and the server then listed in another. */
|
|
1559
|
+
interface PlacementMismatch {
|
|
1560
|
+
readonly connection: string;
|
|
1561
|
+
/** The keys as placed, as far as the server's page reached. */
|
|
1562
|
+
readonly placed: ReadonlyArray<string>;
|
|
1563
|
+
/** The keys of the server's first page. */
|
|
1564
|
+
readonly served: ReadonlyArray<string>;
|
|
1565
|
+
}
|
|
1566
|
+
/** How a live stream has fared, as its live entry restarts it. */
|
|
1567
|
+
interface StreamHealth {
|
|
1568
|
+
/** How many times it broke. The live entry restarts on each, so it only grows. */
|
|
1569
|
+
readonly restarts: number;
|
|
1570
|
+
/** Breaks since its last applied event: what the restart's backoff grows with. */
|
|
1571
|
+
readonly failures: number;
|
|
1572
|
+
/** Why it last broke; none for a gap, which is not an error. */
|
|
1573
|
+
readonly error: Option.Option<RemoteError>;
|
|
1448
1574
|
}
|
|
1449
1575
|
/**
|
|
1450
1576
|
* Failed reads, as the errors they failed with.
|
|
@@ -1502,8 +1628,8 @@ type RemoteMessage = {
|
|
|
1502
1628
|
/**
|
|
1503
1629
|
* The live stream whose subscription broke, when this is that rather
|
|
1504
1630
|
* than a read. Nothing was being read, so no field failed: the stream is
|
|
1505
|
-
* recorded as a gap, since changes after it are missed until the
|
|
1506
|
-
*
|
|
1631
|
+
* recorded as a gap, since changes after it are missed until the live
|
|
1632
|
+
* entry restarts it.
|
|
1507
1633
|
*/
|
|
1508
1634
|
readonly stream?: string | undefined;
|
|
1509
1635
|
} |
|
|
@@ -1545,6 +1671,8 @@ type RemoteMessage = {
|
|
|
1545
1671
|
*/
|
|
1546
1672
|
readonly connections?: Readonly<Record<string, ReadonlyArray<ReadonlyArray<Edge>>>> | undefined;
|
|
1547
1673
|
readonly merge: MergePolicy;
|
|
1674
|
+
/** The storage key the snapshot was read from, when it was: `restoredFrom`. */
|
|
1675
|
+
readonly from?: string | undefined;
|
|
1548
1676
|
} |
|
|
1549
1677
|
/** A mutation began; its optimistic operations show until it settles. */
|
|
1550
1678
|
{
|
|
@@ -1672,6 +1800,8 @@ declare const remoteMessageCases: {
|
|
|
1672
1800
|
error: Schema.Struct<{
|
|
1673
1801
|
readonly _tag: Schema.String;
|
|
1674
1802
|
readonly message: Schema.String;
|
|
1803
|
+
readonly refusal: Schema.optional<Schema.Unknown>;
|
|
1804
|
+
readonly reason: Schema.optional<Schema.String>;
|
|
1675
1805
|
}>;
|
|
1676
1806
|
stream: Schema.optional<Schema.String>;
|
|
1677
1807
|
};
|
|
@@ -1696,6 +1826,7 @@ declare const remoteMessageCases: {
|
|
|
1696
1826
|
};
|
|
1697
1827
|
Hydrated: {
|
|
1698
1828
|
connections: Schema.optional<Schema.Unknown>;
|
|
1829
|
+
from: Schema.optional<Schema.String>;
|
|
1699
1830
|
entities: Schema.Unknown;
|
|
1700
1831
|
merge: Schema.Union<readonly [Schema.Literal<"replace">, Schema.Literal<"preserve-existing">]>;
|
|
1701
1832
|
};
|
|
@@ -1722,6 +1853,8 @@ declare const remoteMessageCases: {
|
|
|
1722
1853
|
error: Schema.Struct<{
|
|
1723
1854
|
readonly _tag: Schema.String;
|
|
1724
1855
|
readonly message: Schema.String;
|
|
1856
|
+
readonly refusal: Schema.optional<Schema.Unknown>;
|
|
1857
|
+
readonly reason: Schema.optional<Schema.String>;
|
|
1725
1858
|
}>;
|
|
1726
1859
|
};
|
|
1727
1860
|
OverlayShown: {
|
|
@@ -1772,6 +1905,8 @@ declare const remoteMessageCases: {
|
|
|
1772
1905
|
error: Schema.Struct<{
|
|
1773
1906
|
readonly _tag: Schema.String;
|
|
1774
1907
|
readonly message: Schema.String;
|
|
1908
|
+
readonly refusal: Schema.optional<Schema.Unknown>;
|
|
1909
|
+
readonly reason: Schema.optional<Schema.String>;
|
|
1775
1910
|
}>;
|
|
1776
1911
|
};
|
|
1777
1912
|
};
|
|
@@ -1794,6 +1929,8 @@ declare const isRemoteMessage: <M extends {
|
|
|
1794
1929
|
readonly _tag: RemoteMessageTag;
|
|
1795
1930
|
}>;
|
|
1796
1931
|
declare const remoteMessageSchema: Schema.Schema<RemoteMessage>;
|
|
1932
|
+
/** The ids `OverlayShown` shows now, each once, in the order they are drawn. */
|
|
1933
|
+
declare const overlaysOf: (model: RemoteModel) => ReadonlyArray<string>;
|
|
1797
1934
|
/** The key a grown window is kept under: its connection and the window first asked for. */
|
|
1798
1935
|
declare const windowGrowthKey: (identity: string, window: string) => string;
|
|
1799
1936
|
/**
|
|
@@ -1816,6 +1953,12 @@ declare const refreshedAt: (refresh: RefreshState, requests: ReadonlyArray<Requi
|
|
|
1816
1953
|
* refreshed at the next generation.
|
|
1817
1954
|
*/
|
|
1818
1955
|
declare const withRefreshRequested: (refresh: RefreshState, requests: ReadonlyArray<Requirement>, connections?: ReadonlyArray<string>) => RefreshState;
|
|
1956
|
+
/**
|
|
1957
|
+
* Marks connections as needing to be asked again, and restarts a read of them
|
|
1958
|
+
* already in flight: a page requested before what invalidated it could land
|
|
1959
|
+
* after it, saying what is no longer true. `Remote.refresh` marks the same way.
|
|
1960
|
+
*/
|
|
1961
|
+
declare const invalidateConnections: (model: RemoteModel, connections: ReadonlyArray<string>) => RemoteModel;
|
|
1819
1962
|
/**
|
|
1820
1963
|
* Whether one field's read already began under the generation that field was
|
|
1821
1964
|
* last refreshed at. Such a read is in flight and would otherwise outlive the
|
|
@@ -1831,8 +1974,8 @@ declare const refreshIsInFlight: (refresh: RefreshState, request: Requirement, f
|
|
|
1831
1974
|
declare const isLoading: (model: RemoteModel, entity: string, id: string, fields: ReadonlyArray<string>) => boolean;
|
|
1832
1975
|
/**
|
|
1833
1976
|
* The pure reducer all four producers share. A live event that arrives ahead of
|
|
1834
|
-
* its cursor is a gap: it is not applied, and the stream is recorded so
|
|
1835
|
-
*
|
|
1977
|
+
* its cursor is a gap: it is not applied, and the stream is recorded so its
|
|
1978
|
+
* live entry restarts it rather than silently missing facts. When every field a Message
|
|
1836
1979
|
* touches keeps its identity, `model` itself is returned, so the application's
|
|
1837
1980
|
* root keeps its identity and Foldkit does not render. The common no-ops do (a
|
|
1838
1981
|
* duplicate live event, a repeated `ReadStarted`); a repeated failure, or a
|
|
@@ -1915,7 +2058,7 @@ declare const coalesceReads: (read: BatchRead, options?: CoalesceOptions) => Eff
|
|
|
1915
2058
|
declare const RemoteClient_base: Context.ServiceClass<RemoteClient, "foldkit-remote/RemoteClient", {
|
|
1916
2059
|
readonly read: (batch: Schema.Schema.Type<typeof ReadBatch>) => Effect.Effect<Schema.Schema.Type<typeof ReadBatchResult>, RemoteReadError | RemoteProtocolError>;
|
|
1917
2060
|
readonly query: (request: Schema.Schema.Type<typeof QueryRequest>) => Effect.Effect<Schema.Schema.Type<typeof QueryResult>, RemoteQueryError>;
|
|
1918
|
-
readonly mutate: (request: Schema.Schema.Type<typeof MutationRequest>) => Effect.Effect<Schema.Schema.Type<typeof MutationResult>, RemoteMutationError>;
|
|
2061
|
+
readonly mutate: (request: Schema.Schema.Type<typeof MutationRequest>) => Effect.Effect<Schema.Schema.Type<typeof MutationResult>, RemoteMutationError | RemoteForbidden>;
|
|
1919
2062
|
readonly live: (request: {
|
|
1920
2063
|
readonly requirements: ReadonlyArray<Requirement>;
|
|
1921
2064
|
readonly after: LiveCursor;
|
|
@@ -1939,7 +2082,7 @@ declare class RemoteClient extends RemoteClient_base {}
|
|
|
1939
2082
|
interface RemoteRpcClient<R = never, TransportError = never> {
|
|
1940
2083
|
readonly FoldkitRemoteRead: (payload: Schema.Schema.Type<typeof ReadBatch>) => Effect.Effect<Schema.Schema.Type<typeof ReadBatchResult>, RemoteReadError | RemoteProtocolError | TransportError, R>;
|
|
1941
2084
|
readonly FoldkitRemoteQuery: (payload: Schema.Schema.Type<typeof QueryRequest>) => Effect.Effect<Schema.Schema.Type<typeof QueryResult>, RemoteQueryError | TransportError, R>;
|
|
1942
|
-
readonly FoldkitRemoteMutate: (payload: Schema.Schema.Type<typeof MutationRequest>) => Effect.Effect<Schema.Schema.Type<typeof MutationResult>, RemoteMutationError | TransportError, R>;
|
|
2085
|
+
readonly FoldkitRemoteMutate: (payload: Schema.Schema.Type<typeof MutationRequest>) => Effect.Effect<Schema.Schema.Type<typeof MutationResult>, RemoteMutationError | RemoteForbidden | TransportError, R>;
|
|
1943
2086
|
readonly FoldkitRemoteLive: (payload: Schema.Schema.Type<typeof LiveRequirement>) => Stream.Stream<Schema.Schema.Type<typeof LiveChange>, RemoteLiveError | RemoteProtocolError | TransportError, R>;
|
|
1944
2087
|
}
|
|
1945
2088
|
/** Reconstructs the client's `ConnectionChange` from the wire's flattened edge. */
|
|
@@ -1949,13 +2092,15 @@ declare const liveEventOf: (change: Schema.Schema.Type<typeof LiveChange>) => Li
|
|
|
1949
2092
|
declare const remoteError: (error: {
|
|
1950
2093
|
readonly _tag: string;
|
|
1951
2094
|
readonly message: string;
|
|
2095
|
+
readonly refusal?: unknown;
|
|
2096
|
+
readonly reason?: string | undefined;
|
|
1952
2097
|
}) => RemoteError;
|
|
1953
2098
|
declare const coalescedLayer: <E, R>(layer: Layer.Layer<RemoteClient, E, R>, options?: CoalesceOptions) => Layer.Layer<RemoteClient, E, R>;
|
|
1954
2099
|
/**
|
|
1955
2100
|
* `Remote.mutate` as a standalone effect, so `Remote.mutateInto` can reuse it
|
|
1956
2101
|
* without the object literal referencing itself.
|
|
1957
2102
|
*/
|
|
1958
|
-
declare const mutateRemote: <Name extends string, Input, Output>(mutation: MutationDescriptor<Name, Input, Output>, input: Input, requestId: string) => Effect.Effect<{
|
|
2103
|
+
declare const mutateRemote: <Name extends string, Input, Output>(mutation: MutationDescriptor<Name, Input, Output, unknown>, input: Input, requestId: string, keys?: readonly string[] | undefined) => Effect.Effect<{
|
|
1959
2104
|
output: Output;
|
|
1960
2105
|
entities: readonly {
|
|
1961
2106
|
readonly entity: string;
|
|
@@ -1969,7 +2114,7 @@ declare const mutateRemote: <Name extends string, Input, Output>(mutation: Mutat
|
|
|
1969
2114
|
readonly entity: string;
|
|
1970
2115
|
readonly id: string;
|
|
1971
2116
|
}[];
|
|
1972
|
-
}, RemoteMutationError, RemoteClient>;
|
|
2117
|
+
}, RemoteMutationError | RemoteForbidden, RemoteClient>;
|
|
1973
2118
|
//#endregion
|
|
1974
2119
|
//#region src/json.d.ts
|
|
1975
2120
|
/** A request: which of Remote's calls, and its payload as the RPC protocol encodes it. */
|
|
@@ -1983,6 +2128,11 @@ declare const RemoteJsonAnswer: Schema.Union<readonly [Schema.Struct<{
|
|
|
1983
2128
|
readonly result: Schema.Unknown;
|
|
1984
2129
|
}>, Schema.Struct<{
|
|
1985
2130
|
readonly error: Schema.String;
|
|
2131
|
+
readonly refusal: Schema.optional<Schema.Unknown>;
|
|
2132
|
+
/** Who is asking was refused, with the application's reason when it gave one. */
|
|
2133
|
+
readonly forbidden: Schema.optional<Schema.Struct<{
|
|
2134
|
+
readonly reason: Schema.optional<Schema.String>;
|
|
2135
|
+
}>>;
|
|
1986
2136
|
}>]>;
|
|
1987
2137
|
type RemoteJsonAnswer = typeof RemoteJsonAnswer.Type;
|
|
1988
2138
|
/**
|
|
@@ -1991,6 +2141,22 @@ type RemoteJsonAnswer = typeof RemoteJsonAnswer.Type;
|
|
|
1991
2141
|
*/
|
|
1992
2142
|
type RemoteJsonSend = (request: string) => Promise<unknown>;
|
|
1993
2143
|
//#endregion
|
|
2144
|
+
//#region src/sse.d.ts
|
|
2145
|
+
/** What `httpWithLive` needs besides the URL. Mirrors `http`, plus the fetch itself. */
|
|
2146
|
+
interface LiveFetchOptions {
|
|
2147
|
+
/** Read per request, so a token that changes reaches the next call. */
|
|
2148
|
+
readonly headers?: (() => Readonly<Record<string, string>>) | undefined;
|
|
2149
|
+
/** Defaults to the global one; pass it to route calls elsewhere in tests. */
|
|
2150
|
+
readonly fetch?: typeof fetch | undefined;
|
|
2151
|
+
}
|
|
2152
|
+
/** Remote's live stream over fetch: `serveFetch`'s live open as a `Stream`. */
|
|
2153
|
+
declare const liveFetch: (url: string, options?: LiveFetchOptions) => RemoteRpcClient["FoldkitRemoteLive"];
|
|
2154
|
+
/**
|
|
2155
|
+
* Remote's client over HTTP with live: reads, queries, and mutations as
|
|
2156
|
+
* `http` sends them, live as `liveFetch` streams it, for `clientLayer`.
|
|
2157
|
+
*/
|
|
2158
|
+
declare const httpWithLive: (url: string, options?: LiveFetchOptions) => RemoteRpcClient;
|
|
2159
|
+
//#endregion
|
|
1994
2160
|
//#region src/relation.d.ts
|
|
1995
2161
|
interface RefParts {
|
|
1996
2162
|
readonly entity: string;
|
|
@@ -2342,6 +2508,8 @@ interface RemoteInspection {
|
|
|
2342
2508
|
readonly connections: ReadonlyArray<string>;
|
|
2343
2509
|
readonly live: ReadonlyArray<string>;
|
|
2344
2510
|
readonly gaps: ReadonlyArray<string>;
|
|
2511
|
+
/** Under `verifyPlacement`, each placement the server's page disagreed with. */
|
|
2512
|
+
readonly placementMismatches: ReadonlyArray<PlacementMismatch>;
|
|
2345
2513
|
/**
|
|
2346
2514
|
* The `entity\0id\0field` marks of reads in flight, and a
|
|
2347
2515
|
* `\0connection\0identity` mark for each query in flight. This is what "Remote is
|
|
@@ -2536,6 +2704,134 @@ declare const RemotePolicy: {
|
|
|
2536
2704
|
refreshes: (policy: RemotePolicy) => boolean;
|
|
2537
2705
|
};
|
|
2538
2706
|
//#endregion
|
|
2707
|
+
//#region src/placement.d.ts
|
|
2708
|
+
/** Where a row falls in a loaded list. */
|
|
2709
|
+
type RowPlace = Data.TaggedEnum<{
|
|
2710
|
+
/** Just before this edge, in this segment. */
|
|
2711
|
+
Before: {
|
|
2712
|
+
readonly segment: number;
|
|
2713
|
+
readonly edge: string;
|
|
2714
|
+
};
|
|
2715
|
+
/** After every edge of this segment, which ends the list. */
|
|
2716
|
+
End: {
|
|
2717
|
+
readonly segment: number;
|
|
2718
|
+
};
|
|
2719
|
+
/** In rows the list has not loaded: past a `Cursor` boundary, or in a gap. */
|
|
2720
|
+
Outside: {};
|
|
2721
|
+
/** Not judged exactly, and why. */
|
|
2722
|
+
Unknown: {
|
|
2723
|
+
readonly reason: string;
|
|
2724
|
+
};
|
|
2725
|
+
}>;
|
|
2726
|
+
declare const RowPlace: {
|
|
2727
|
+
readonly Unknown: Data.TaggedEnum.ConstructorFrom<{
|
|
2728
|
+
readonly _tag: "Unknown";
|
|
2729
|
+
readonly reason: string;
|
|
2730
|
+
}, "_tag">;
|
|
2731
|
+
readonly Before: Data.TaggedEnum.ConstructorFrom<{
|
|
2732
|
+
readonly _tag: "Before";
|
|
2733
|
+
readonly segment: number;
|
|
2734
|
+
readonly edge: string;
|
|
2735
|
+
}, "_tag">;
|
|
2736
|
+
readonly End: Data.TaggedEnum.ConstructorFrom<{
|
|
2737
|
+
readonly _tag: "End";
|
|
2738
|
+
readonly segment: number;
|
|
2739
|
+
}, "_tag">;
|
|
2740
|
+
readonly Outside: Data.TaggedEnum.ConstructorFrom<{
|
|
2741
|
+
readonly _tag: "Outside";
|
|
2742
|
+
}, "_tag">;
|
|
2743
|
+
readonly $is: <Tag extends "Unknown" | "Before" | "End" | "Outside">(tag: Tag) => (u: unknown) => u is Extract<{
|
|
2744
|
+
readonly _tag: "Unknown";
|
|
2745
|
+
readonly reason: string;
|
|
2746
|
+
}, {
|
|
2747
|
+
readonly _tag: Tag;
|
|
2748
|
+
}> | Extract<{
|
|
2749
|
+
readonly _tag: "Before";
|
|
2750
|
+
readonly segment: number;
|
|
2751
|
+
readonly edge: string;
|
|
2752
|
+
}, {
|
|
2753
|
+
readonly _tag: Tag;
|
|
2754
|
+
}> | Extract<{
|
|
2755
|
+
readonly _tag: "End";
|
|
2756
|
+
readonly segment: number;
|
|
2757
|
+
}, {
|
|
2758
|
+
readonly _tag: Tag;
|
|
2759
|
+
}> | Extract<{
|
|
2760
|
+
readonly _tag: "Outside";
|
|
2761
|
+
}, {
|
|
2762
|
+
readonly _tag: Tag;
|
|
2763
|
+
}>;
|
|
2764
|
+
readonly $match: {
|
|
2765
|
+
<Cases extends {
|
|
2766
|
+
readonly Unknown: (args: {
|
|
2767
|
+
readonly _tag: "Unknown";
|
|
2768
|
+
readonly reason: string;
|
|
2769
|
+
}) => any;
|
|
2770
|
+
readonly Before: (args: {
|
|
2771
|
+
readonly _tag: "Before";
|
|
2772
|
+
readonly segment: number;
|
|
2773
|
+
readonly edge: string;
|
|
2774
|
+
}) => any;
|
|
2775
|
+
readonly End: (args: {
|
|
2776
|
+
readonly _tag: "End";
|
|
2777
|
+
readonly segment: number;
|
|
2778
|
+
}) => any;
|
|
2779
|
+
readonly Outside: (args: {
|
|
2780
|
+
readonly _tag: "Outside";
|
|
2781
|
+
}) => any;
|
|
2782
|
+
}>(cases: Cases): (value: {
|
|
2783
|
+
readonly _tag: "Unknown";
|
|
2784
|
+
readonly reason: string;
|
|
2785
|
+
} | {
|
|
2786
|
+
readonly _tag: "Before";
|
|
2787
|
+
readonly segment: number;
|
|
2788
|
+
readonly edge: string;
|
|
2789
|
+
} | {
|
|
2790
|
+
readonly _tag: "End";
|
|
2791
|
+
readonly segment: number;
|
|
2792
|
+
} | {
|
|
2793
|
+
readonly _tag: "Outside";
|
|
2794
|
+
}) => import("effect/Unify").Unify<ReturnType<Cases["Unknown" | "Before" | "End" | "Outside"]>>;
|
|
2795
|
+
<Cases extends {
|
|
2796
|
+
readonly Unknown: (args: {
|
|
2797
|
+
readonly _tag: "Unknown";
|
|
2798
|
+
readonly reason: string;
|
|
2799
|
+
}) => any;
|
|
2800
|
+
readonly Before: (args: {
|
|
2801
|
+
readonly _tag: "Before";
|
|
2802
|
+
readonly segment: number;
|
|
2803
|
+
readonly edge: string;
|
|
2804
|
+
}) => any;
|
|
2805
|
+
readonly End: (args: {
|
|
2806
|
+
readonly _tag: "End";
|
|
2807
|
+
readonly segment: number;
|
|
2808
|
+
}) => any;
|
|
2809
|
+
readonly Outside: (args: {
|
|
2810
|
+
readonly _tag: "Outside";
|
|
2811
|
+
}) => any;
|
|
2812
|
+
}>(value: {
|
|
2813
|
+
readonly _tag: "Unknown";
|
|
2814
|
+
readonly reason: string;
|
|
2815
|
+
} | {
|
|
2816
|
+
readonly _tag: "Before";
|
|
2817
|
+
readonly segment: number;
|
|
2818
|
+
readonly edge: string;
|
|
2819
|
+
} | {
|
|
2820
|
+
readonly _tag: "End";
|
|
2821
|
+
readonly segment: number;
|
|
2822
|
+
} | {
|
|
2823
|
+
readonly _tag: "Outside";
|
|
2824
|
+
}, cases: Cases): import("effect/Unify").Unify<ReturnType<Cases["Unknown" | "Before" | "End" | "Outside"]>>;
|
|
2825
|
+
};
|
|
2826
|
+
};
|
|
2827
|
+
/**
|
|
2828
|
+
* Where the row stored under `key` falls in `connection`, by `body`'s order
|
|
2829
|
+
* for `input` (encoded, as a connection's identity carries it). The row's own
|
|
2830
|
+
* edge, if the list holds it, is left out: placing a row that moved asks
|
|
2831
|
+
* where it goes now.
|
|
2832
|
+
*/
|
|
2833
|
+
declare const placeIn: (store: EntityStore, connection: Connection, body: AnyQuery, input: Readonly<Record<string, unknown>>, key: string) => RowPlace;
|
|
2834
|
+
//#endregion
|
|
2539
2835
|
//#region src/index.d.ts
|
|
2540
2836
|
/** What a domain registers: a Remote descriptor, or a `foldkit-entity` Entity (read through `Entity.from`). */
|
|
2541
2837
|
type EntityLike = EntityDescriptor<any, any> | Domain.AnyEntity;
|
|
@@ -2577,6 +2873,12 @@ interface RemoteDescriptor<Entities extends readonly EntityLike[] = readonly Ent
|
|
|
2577
2873
|
readonly entities: ReadonlyMap<string, EntityDescriptor<any, any>>;
|
|
2578
2874
|
readonly queries: ReadonlyMap<string, QueryDescriptor<any, any, any>>;
|
|
2579
2875
|
readonly mutations: ReadonlyMap<string, MutationDescriptor<any, any, any>>;
|
|
2876
|
+
/**
|
|
2877
|
+
* Per entity name, the members its server filters rows by under a rule
|
|
2878
|
+
* the client does not run (`ReadFilter`), so a change to one is fetched,
|
|
2879
|
+
* not placed.
|
|
2880
|
+
*/
|
|
2881
|
+
readonly filtered: ReadonlyMap<string, ReadonlyArray<string>>;
|
|
2580
2882
|
};
|
|
2581
2883
|
}
|
|
2582
2884
|
declare const boundRemoteNames: unique symbol;
|
|
@@ -2589,6 +2891,24 @@ interface BoundRemote<AppModel, Store extends RemoteModel, Names extends string
|
|
|
2589
2891
|
readonly [boundRemoteNames]?: Names;
|
|
2590
2892
|
}
|
|
2591
2893
|
type MutationInput<M> = M extends MutationDescriptor<any, infer Input, any> ? Input : never;
|
|
2894
|
+
/** How `Data.persistence` keeps the cache across a reload. */
|
|
2895
|
+
interface PersistenceOptions<AppModel> {
|
|
2896
|
+
/**
|
|
2897
|
+
* Where the snapshot is stored, from the Model: one key per principal, so a
|
|
2898
|
+
* change of principal reads and writes another snapshot.
|
|
2899
|
+
*/
|
|
2900
|
+
readonly key: (model: AppModel) => string;
|
|
2901
|
+
/** Who the snapshot is for; one taken under another scope is discarded. */
|
|
2902
|
+
readonly scope: (model: AppModel) => string;
|
|
2903
|
+
/** The query connections whose rows survive a reload; none by default. */
|
|
2904
|
+
readonly connections?: ReadonlyArray<ConnectionIdentity> | undefined;
|
|
2905
|
+
/** What to keep, when it is not `snapshotOf` the `connections`. */
|
|
2906
|
+
readonly snapshot?: ((remote: RemoteModel) => Snapshot) | undefined;
|
|
2907
|
+
/** A snapshot larger than this is neither written nor read. */
|
|
2908
|
+
readonly maxBytes?: number | undefined;
|
|
2909
|
+
/** How long the cache must be unchanged before it is written; default 250 milliseconds. */
|
|
2910
|
+
readonly debounce?: Duration.Input | undefined;
|
|
2911
|
+
}
|
|
2592
2912
|
interface DomainMutateOptions {
|
|
2593
2913
|
/** Overrides the generated id, for a retry, a durable bridge, or a test. */
|
|
2594
2914
|
readonly requestId?: string | undefined;
|
|
@@ -2603,7 +2923,21 @@ interface DomainMutateOptions {
|
|
|
2603
2923
|
}) => ReadonlyArray<OptimisticOperation>) | undefined;
|
|
2604
2924
|
/** The clock `MutationSucceeded` stamps the answer with; default `Date.now`, read at each use. */
|
|
2605
2925
|
readonly now?: (() => number) | undefined;
|
|
2926
|
+
/**
|
|
2927
|
+
* For a mutation that is a `Write`: the input keys to write, when only some
|
|
2928
|
+
* changed (what an author edited). The rest of the input is still sent, whole.
|
|
2929
|
+
*/
|
|
2930
|
+
readonly keys?: ReadonlyArray<string> | undefined;
|
|
2606
2931
|
}
|
|
2932
|
+
/**
|
|
2933
|
+
* One entry of the active record `subscriptions`, `wiring` and `satisfy`
|
|
2934
|
+
* take: a Surface as the Model activates it (`Surface.at`/`Surface.when`),
|
|
2935
|
+
* a source of keyed instances (`Surface.each`, or any `SurfaceSource`), or a
|
|
2936
|
+
* Surface without params read whole. A family joins its parent's
|
|
2937
|
+
* requirements with its instances', so passing the family alone fetches both
|
|
2938
|
+
* the page and what the page reveals.
|
|
2939
|
+
*/
|
|
2940
|
+
type ActiveEntry<AppModel> = ActiveSurface<AppModel> | Surface<AppModel, any, any, void> | SurfaceSource<AppModel>;
|
|
2607
2941
|
/** A Foldkit Subscription entry of the Remote domain, emitting its Messages through `RemoteClient`. */
|
|
2608
2942
|
type RemoteEntry<AppModel, Dependencies> = EntryWithoutKeepAlive<AppModel, RemoteMessage, Dependencies, RemoteClient>;
|
|
2609
2943
|
/**
|
|
@@ -2619,7 +2953,31 @@ interface LiveDependencies {
|
|
|
2619
2953
|
readonly requirements: ReadonlyArray<Requirement>;
|
|
2620
2954
|
readonly cursor: LiveCursor;
|
|
2621
2955
|
readonly floor: number;
|
|
2956
|
+
/** How many times the stream broke; each break restarts it. */
|
|
2957
|
+
readonly restarts: number;
|
|
2958
|
+
/** Breaks since its last applied event, which the restart's backoff grows with. */
|
|
2959
|
+
readonly failures: number;
|
|
2622
2960
|
}
|
|
2961
|
+
/**
|
|
2962
|
+
* Whether what an active entry reads live is arriving. `Reconnecting` is a
|
|
2963
|
+
* stream that broke and waits to resubscribe; until it has, changes are
|
|
2964
|
+
* missed, and its rows may be out of date.
|
|
2965
|
+
*/
|
|
2966
|
+
type LiveStatus =
|
|
2967
|
+
/** It reads nothing live. */
|
|
2968
|
+
{
|
|
2969
|
+
readonly _tag: 'Idle';
|
|
2970
|
+
} |
|
|
2971
|
+
/** Subscribed, and not broken since. */
|
|
2972
|
+
{
|
|
2973
|
+
readonly _tag: 'Live';
|
|
2974
|
+
} | {
|
|
2975
|
+
readonly _tag: 'Reconnecting';
|
|
2976
|
+
/** Breaks in a row, the first being 1. */
|
|
2977
|
+
readonly attempt: number;
|
|
2978
|
+
/** Why it broke; none for a gap in its events. */
|
|
2979
|
+
readonly error: Option.Option<RemoteError>;
|
|
2980
|
+
};
|
|
2623
2981
|
interface SubscriptionsOptions extends ObserveOptions, LiveOptions, RetainOptions {}
|
|
2624
2982
|
/** A Remote domain's wiring for an assembly: it routes Remote's Messages into `reduce`, brings its Subscriptions and contract, and requires `RemoteClient` from the runtime's resources Layer. */
|
|
2625
2983
|
type RemoteWiring<AppModel> = Wiring<AppModel, RemoteMessage | RemoteMessageInput, RemoteClient>;
|
|
@@ -2677,7 +3035,7 @@ interface RemoteDomain<AppModel, Store extends RemoteModel, Entities extends rea
|
|
|
2677
3035
|
* read one connection, so it is not a property of the read.
|
|
2678
3036
|
*/
|
|
2679
3037
|
explain<Name extends string, Input>(model: AppModel, projection: QueryProjection<AppModel, any, Name, Input>, options?: {
|
|
2680
|
-
readonly surfaces?: Readonly<Record<string, ActiveSurface<AppModel>>> | undefined;
|
|
3038
|
+
readonly surfaces?: Readonly<Record<string, ActiveSurface<AppModel> | SurfaceSource<AppModel>>> | undefined;
|
|
2681
3039
|
}): QueryExplanation;
|
|
2682
3040
|
/**
|
|
2683
3041
|
* Why a read shows what it shows, in words. Any Remote read: `Data.get`,
|
|
@@ -2689,7 +3047,7 @@ interface RemoteDomain<AppModel, Store extends RemoteModel, Entities extends rea
|
|
|
2689
3047
|
* does and Remote's Subscriptions are not running. Pure, like `explain`.
|
|
2690
3048
|
*/
|
|
2691
3049
|
why(model: AppModel, projection: Projection<AppModel, RemoteData<unknown>>, options?: {
|
|
2692
|
-
readonly surfaces?: Readonly<Record<string, ActiveSurface<AppModel>>> | undefined;
|
|
3050
|
+
readonly surfaces?: Readonly<Record<string, ActiveSurface<AppModel> | SurfaceSource<AppModel>>> | undefined;
|
|
2693
3051
|
}): ReadDiagnosis;
|
|
2694
3052
|
/**
|
|
2695
3053
|
* The rows of a loaded list that a body matches, decoded as the list decodes
|
|
@@ -2722,6 +3080,20 @@ interface RemoteDomain<AppModel, Store extends RemoteModel, Entities extends rea
|
|
|
2722
3080
|
overlay(model: AppModel, id: string, optimistic: ReadonlyArray<OptimisticOperation>): AppModel;
|
|
2723
3081
|
/** Lifts what `overlay` showed under this id. Lifting nothing returns the same Model. */
|
|
2724
3082
|
lift(model: AppModel, id: string): AppModel;
|
|
3083
|
+
/**
|
|
3084
|
+
* The ids `overlay` shows now, in the order they are drawn, a later one over
|
|
3085
|
+
* an earlier: what a caller that overlays from its own state reconciles
|
|
3086
|
+
* against.
|
|
3087
|
+
*/
|
|
3088
|
+
overlays(model: AppModel): ReadonlyArray<string>;
|
|
3089
|
+
/**
|
|
3090
|
+
* The edges a connection shows, as its reads draw them: the server's pages
|
|
3091
|
+
* with pending edits placed, each inserted row where the body's order puts
|
|
3092
|
+
* it (or at the end its overlay names, when it cannot be placed), minus
|
|
3093
|
+
* removed edges and tombstones. Takes the `RemoteModel`, so a persistence
|
|
3094
|
+
* `snapshot` can store a list as it is shown.
|
|
3095
|
+
*/
|
|
3096
|
+
visibleItems(remote: RemoteModel, connection: ConnectionIdentity): ReadonlyArray<Edge>;
|
|
2725
3097
|
/** `Remote.refresh`: marks what a projection or a Surface requires as due, for its read entry to refetch. */
|
|
2726
3098
|
refresh(model: AppModel, target: Projection<AppModel, unknown> | Surface<AppModel, any, any, void>): AppModel;
|
|
2727
3099
|
/** `Remote.forget`: the Model with every server-derived fact gone, for a change of principal. */
|
|
@@ -2735,16 +3107,18 @@ interface RemoteDomain<AppModel, Store extends RemoteModel, Entities extends rea
|
|
|
2735
3107
|
*/
|
|
2736
3108
|
active<Value>(name: string, projectionOf: (model: AppModel) => Option.Option<Projection<AppModel, Value>>): ActiveSurface<AppModel>;
|
|
2737
3109
|
/**
|
|
2738
|
-
* The Foldkit Subscription entries for the active
|
|
2739
|
-
* `Subscription.make`: a read entry per
|
|
2740
|
-
* entry per
|
|
2741
|
-
* retain entry (`Remote.retain`).
|
|
2742
|
-
* entry
|
|
2743
|
-
*
|
|
2744
|
-
*
|
|
2745
|
-
*
|
|
2746
|
-
|
|
2747
|
-
|
|
3110
|
+
* The Foldkit Subscription entries for the active record, keyed for
|
|
3111
|
+
* `Subscription.make`: a read entry per record entry (`Remote.observe`), a
|
|
3112
|
+
* live entry per record entry that reads through `live` (`Remote.live`), and
|
|
3113
|
+
* one retain entry (`Remote.retain`). A `Surface.each` family is one record
|
|
3114
|
+
* entry whose read unions its parent's requirements with its instances'.
|
|
3115
|
+
* Retention is the domain's: the retain entry of every call roots the active
|
|
3116
|
+
* Surfaces of every call, so reads split over calls (one per policy) do not
|
|
3117
|
+
* collect each other's data. A Surface's params are a function of the Model
|
|
3118
|
+
* (`Surface.at`), so what is fetched, subscribed, and retained follows the
|
|
3119
|
+
* Model.
|
|
3120
|
+
*/
|
|
3121
|
+
subscriptions<const Active extends Readonly<Record<string, ActiveEntry<AppModel>>>>(active: Active, options?: SubscriptionsOptions): SubscriptionEntries<AppModel, Active>;
|
|
2748
3122
|
/** `Remote.plan`: the requirements the store does not satisfy. */
|
|
2749
3123
|
plan<Value>(model: AppModel, projection: Projection<AppModel, Value>, options?: PlanOptions): ReadonlyArray<Requirement>;
|
|
2750
3124
|
/** `Remote.meta`: when what a projection shows was last received, and whether it is stale or loading. */
|
|
@@ -2791,7 +3165,7 @@ interface RemoteDomain<AppModel, Store extends RemoteModel, Entities extends rea
|
|
|
2791
3165
|
* `options.passes` run out first. Reads are cache-first: a field already
|
|
2792
3166
|
* held is not asked again.
|
|
2793
3167
|
*/
|
|
2794
|
-
satisfy(model: AppModel, active: Readonly<Record<string,
|
|
3168
|
+
satisfy(model: AppModel, active: Readonly<Record<string, ActiveEntry<AppModel>>>, options?: SatisfyOptions): Effect.Effect<AppModel, RemoteReadError | RemoteProtocolError | RemoteQueryError | RemoteUnsatisfied, RemoteClient>;
|
|
2795
3169
|
/**
|
|
2796
3170
|
* Starts a registered mutation from `update`: applies `MutationStarted` (with
|
|
2797
3171
|
* the optimistic operations) to the Model and returns the Command that runs
|
|
@@ -2804,6 +3178,18 @@ interface RemoteDomain<AppModel, Store extends RemoteModel, Entities extends rea
|
|
|
2804
3178
|
* pending, applied, or failed with the error the server or transport gave.
|
|
2805
3179
|
*/
|
|
2806
3180
|
mutation(model: AppModel, requestId: string): MutationStatus;
|
|
3181
|
+
/**
|
|
3182
|
+
* Why the server refused a mutation, as the value its `Refusal` declares:
|
|
3183
|
+
* none while it is pending or applied, when it failed for another reason,
|
|
3184
|
+
* or when the refusal does not decode as `mutation`'s.
|
|
3185
|
+
*/
|
|
3186
|
+
refusal<Refused>(model: AppModel, requestId: string, mutation: MutationDescriptor<string, any, any, Refused>): Option.Option<Refused>;
|
|
3187
|
+
/**
|
|
3188
|
+
* Whether what `active` reads live is arriving: `Reconnecting` from the
|
|
3189
|
+
* moment its stream breaks until it resubscribes, which its live entry does
|
|
3190
|
+
* on its own, with backoff.
|
|
3191
|
+
*/
|
|
3192
|
+
liveStatus(model: AppModel, active: ActiveEntry<AppModel>): LiveStatus;
|
|
2807
3193
|
/** `updateRemote` on the bound slice: reduces one of Remote's Messages, as `RemoteMessage` or as the application's union constructs it. */
|
|
2808
3194
|
reduce(model: AppModel, message: RemoteMessage | RemoteMessageInput): AppModel;
|
|
2809
3195
|
/**
|
|
@@ -2813,7 +3199,17 @@ interface RemoteDomain<AppModel, Store extends RemoteModel, Entities extends rea
|
|
|
2813
3199
|
* most one Remote wiring: every domain claims the same tags, and routing
|
|
2814
3200
|
* takes the first claimant.
|
|
2815
3201
|
*/
|
|
2816
|
-
wiring: <const Active extends Readonly<Record<string,
|
|
3202
|
+
wiring: <const Active extends Readonly<Record<string, ActiveEntry<AppModel>>>>(active: Active, options?: SubscriptionsOptions) => RemoteWiring<AppModel>;
|
|
3203
|
+
/**
|
|
3204
|
+
* Keeps the cache across a reload, as a wiring beside `wiring`: at start and
|
|
3205
|
+
* whenever `key` changes, the stored snapshot is restored (`Hydrated`, with
|
|
3206
|
+
* what the store already holds kept over it, so a page resumed from the
|
|
3207
|
+
* server wins); and the cache is written back when it changes, once its own
|
|
3208
|
+
* snapshot is in. Overlays, optimistic layers, the mutation ledger, live
|
|
3209
|
+
* cursors and gaps are never stored. A change of principal should `forget`
|
|
3210
|
+
* in `update`, and name another `key`.
|
|
3211
|
+
*/
|
|
3212
|
+
persistence(options: PersistenceOptions<AppModel>): Wiring<AppModel, RemoteMessage, KeyValueStore.KeyValueStore>;
|
|
2817
3213
|
/** `Remote.inspect` of the bound slice. */
|
|
2818
3214
|
inspect(model: AppModel): RemoteInspection;
|
|
2819
3215
|
}
|
|
@@ -2835,7 +3231,7 @@ interface RemoteFold<AppModel, ParentMessage, Domain extends RemoteDomain<AppMod
|
|
|
2835
3231
|
/** `Data.mutate`, its Command lifted. */
|
|
2836
3232
|
readonly mutate: (...args: Parameters<Domain['mutate']>) => FoldedMutationStarted<AppModel, ParentMessage>;
|
|
2837
3233
|
/** `Data.subscriptions`, every entry lifted to the wrapper Message. */
|
|
2838
|
-
readonly subscriptions: <const Active extends Readonly<Record<string,
|
|
3234
|
+
readonly subscriptions: <const Active extends Readonly<Record<string, ActiveEntry<AppModel>>>>(active: Active, options?: SubscriptionsOptions) => SubscriptionEntries<AppModel, Active, ParentMessage>;
|
|
2839
3235
|
}
|
|
2840
3236
|
/** The application Model a bound domain is over. */
|
|
2841
3237
|
type ModelOfDomain<Domain> = Domain extends RemoteDomain<infer AppModel, any, any, any, any> ? AppModel : never;
|
|
@@ -2921,6 +3317,13 @@ declare class RemoteUnsatisfied extends RemoteUnsatisfied_base {}
|
|
|
2921
3317
|
interface LiveOptions {
|
|
2922
3318
|
/** The clock `LiveReceived` stamps events with; default `Date.now`, read at each use. */
|
|
2923
3319
|
readonly now?: (() => number) | undefined;
|
|
3320
|
+
/**
|
|
3321
|
+
* The first restart's delay after a stream breaks, doubled for each break in
|
|
3322
|
+
* a row, with ±20% jitter: Sync's transport policy. Default `50 millis`.
|
|
3323
|
+
*/
|
|
3324
|
+
readonly retryBase?: Duration.Input | undefined;
|
|
3325
|
+
/** The longest a restart waits. Default `5 seconds`. */
|
|
3326
|
+
readonly maxRetryDelay?: Duration.Input | undefined;
|
|
2924
3327
|
}
|
|
2925
3328
|
/** A query the read entry runs, as its dependencies carry it: plain data Foldkit compares. */
|
|
2926
3329
|
declare const PlannedQuery: Schema.Struct<{
|
|
@@ -2984,6 +3387,8 @@ declare const Remote: {
|
|
|
2984
3387
|
error: Schema.Struct<{
|
|
2985
3388
|
readonly _tag: Schema.String;
|
|
2986
3389
|
readonly message: Schema.String;
|
|
3390
|
+
readonly refusal: Schema.optional<Schema.Unknown>;
|
|
3391
|
+
readonly reason: Schema.optional<Schema.String>;
|
|
2987
3392
|
}>;
|
|
2988
3393
|
stream: Schema.optional<Schema.String>;
|
|
2989
3394
|
};
|
|
@@ -3008,6 +3413,7 @@ declare const Remote: {
|
|
|
3008
3413
|
};
|
|
3009
3414
|
Hydrated: {
|
|
3010
3415
|
connections: Schema.optional<Schema.Unknown>;
|
|
3416
|
+
from: Schema.optional<Schema.String>;
|
|
3011
3417
|
entities: Schema.Unknown;
|
|
3012
3418
|
merge: Schema.Union<readonly [Schema.Literal<"replace">, Schema.Literal<"preserve-existing">]>;
|
|
3013
3419
|
};
|
|
@@ -3034,6 +3440,8 @@ declare const Remote: {
|
|
|
3034
3440
|
error: Schema.Struct<{
|
|
3035
3441
|
readonly _tag: Schema.String;
|
|
3036
3442
|
readonly message: Schema.String;
|
|
3443
|
+
readonly refusal: Schema.optional<Schema.Unknown>;
|
|
3444
|
+
readonly reason: Schema.optional<Schema.String>;
|
|
3037
3445
|
}>;
|
|
3038
3446
|
};
|
|
3039
3447
|
OverlayShown: {
|
|
@@ -3084,6 +3492,8 @@ declare const Remote: {
|
|
|
3084
3492
|
error: Schema.Struct<{
|
|
3085
3493
|
readonly _tag: Schema.String;
|
|
3086
3494
|
readonly message: Schema.String;
|
|
3495
|
+
readonly refusal: Schema.optional<Schema.Unknown>;
|
|
3496
|
+
readonly reason: Schema.optional<Schema.String>;
|
|
3087
3497
|
}>;
|
|
3088
3498
|
};
|
|
3089
3499
|
};
|
|
@@ -3121,6 +3531,8 @@ declare const Remote: {
|
|
|
3121
3531
|
error: Schema.Struct<{
|
|
3122
3532
|
readonly _tag: Schema.String;
|
|
3123
3533
|
readonly message: Schema.String;
|
|
3534
|
+
readonly refusal: Schema.optional<Schema.Unknown>;
|
|
3535
|
+
readonly reason: Schema.optional<Schema.String>;
|
|
3124
3536
|
}>;
|
|
3125
3537
|
stream: Schema.optional<Schema.String>;
|
|
3126
3538
|
};
|
|
@@ -3145,6 +3557,7 @@ declare const Remote: {
|
|
|
3145
3557
|
};
|
|
3146
3558
|
Hydrated: {
|
|
3147
3559
|
connections: Schema.optional<Schema.Unknown>;
|
|
3560
|
+
from: Schema.optional<Schema.String>;
|
|
3148
3561
|
entities: Schema.Unknown;
|
|
3149
3562
|
merge: Schema.Union<readonly [Schema.Literal<"replace">, Schema.Literal<"preserve-existing">]>;
|
|
3150
3563
|
};
|
|
@@ -3171,6 +3584,8 @@ declare const Remote: {
|
|
|
3171
3584
|
error: Schema.Struct<{
|
|
3172
3585
|
readonly _tag: Schema.String;
|
|
3173
3586
|
readonly message: Schema.String;
|
|
3587
|
+
readonly refusal: Schema.optional<Schema.Unknown>;
|
|
3588
|
+
readonly reason: Schema.optional<Schema.String>;
|
|
3174
3589
|
}>;
|
|
3175
3590
|
};
|
|
3176
3591
|
OverlayShown: {
|
|
@@ -3221,6 +3636,8 @@ declare const Remote: {
|
|
|
3221
3636
|
error: Schema.Struct<{
|
|
3222
3637
|
readonly _tag: Schema.String;
|
|
3223
3638
|
readonly message: Schema.String;
|
|
3639
|
+
readonly refusal: Schema.optional<Schema.Unknown>;
|
|
3640
|
+
readonly reason: Schema.optional<Schema.String>;
|
|
3224
3641
|
}>;
|
|
3225
3642
|
};
|
|
3226
3643
|
}>;
|
|
@@ -3272,13 +3689,22 @@ declare const Remote: {
|
|
|
3272
3689
|
readonly entities: Entities;
|
|
3273
3690
|
readonly queries?: Queries;
|
|
3274
3691
|
readonly mutations?: Mutations;
|
|
3692
|
+
/**
|
|
3693
|
+
* Places what the server said (a mutation's answer, a read, a live
|
|
3694
|
+
* patch) as usual, and also fetches each list it placed in, comparing the
|
|
3695
|
+
* server's first page with the order it placed: a disagreement is kept in
|
|
3696
|
+
* `placementMismatches` (`Data.inspect`). A pending edit is not checked,
|
|
3697
|
+
* since the server does not have it yet. For development and tests, where
|
|
3698
|
+
* a collation that drifts should be found.
|
|
3699
|
+
*/
|
|
3700
|
+
readonly verifyPlacement?: boolean | undefined;
|
|
3275
3701
|
}) => RemoteDomain<AppModel, Store, Entities, Queries, Mutations>;
|
|
3276
3702
|
/**
|
|
3277
3703
|
* Declares a Remote domain without binding it: its entities, queries, and
|
|
3278
3704
|
* mutations, plus the submodel. For a domain reused across applications or
|
|
3279
3705
|
* bound in a test; `Remote.make` is the one-step form.
|
|
3280
3706
|
*/
|
|
3281
|
-
define: <const Entities extends readonly EntityLike[], const Queries extends readonly QueryDescriptor<any, any, any>[] = readonly QueryDescriptor<any, any, any>[], const Mutations extends readonly MutationDescriptor<any, any, any>[] = readonly MutationDescriptor<any, any, any>[]>(config: {
|
|
3707
|
+
define: <const Entities extends readonly EntityLike[], const Queries extends readonly QueryDescriptor<any, any, any>[] = readonly QueryDescriptor<any, any, any>[], const Mutations extends readonly MutationDescriptor<any, any, any>[] = readonly MutationDescriptor<any, any, any, unknown>[]>(config: {
|
|
3282
3708
|
readonly entities: Entities;
|
|
3283
3709
|
readonly queries?: Queries;
|
|
3284
3710
|
readonly mutations?: Mutations;
|
|
@@ -3406,8 +3832,16 @@ declare const Remote: {
|
|
|
3406
3832
|
* request to `url`. `headers` is read per request (a session token, say).
|
|
3407
3833
|
*/
|
|
3408
3834
|
http: (url: string, options?: {
|
|
3409
|
-
readonly headers?: () => Readonly<Record<string, string
|
|
3835
|
+
readonly headers?: (() => Readonly<Record<string, string>>) | undefined;
|
|
3836
|
+
readonly fetch?: typeof fetch | undefined;
|
|
3410
3837
|
}) => RemoteRpcClient;
|
|
3838
|
+
/**
|
|
3839
|
+
* Remote's client over HTTP with live, for `clientLayer`: reads, queries,
|
|
3840
|
+
* and mutations as `http` sends them, live requirements as one `POST`
|
|
3841
|
+
* answered with a `text/event-stream` of changes.
|
|
3842
|
+
* `foldkit-remote-server/fetch` is the other end.
|
|
3843
|
+
*/
|
|
3844
|
+
httpWithLive: (url: string, options?: LiveFetchOptions) => RemoteRpcClient;
|
|
3411
3845
|
clientLayer: <R = never>(client: RemoteRpcClient<R, RpcClientError.RpcClientError>, options?: CoalesceOptions) => Layer.Layer<RemoteClient, never, R>;
|
|
3412
3846
|
/**
|
|
3413
3847
|
* Wraps a `RemoteClient` layer so its reads coalesce: requirements issued
|
|
@@ -3466,12 +3900,6 @@ declare const Remote: {
|
|
|
3466
3900
|
}, RemoteQueryError, RemoteClient>;
|
|
3467
3901
|
/** The `RemoteMessage` that merges a query page into its connection. */
|
|
3468
3902
|
queryMessage: <Name extends string, Input>(ref: QueryRef<Name, Input>, result: Schema.Schema.Type<typeof QueryResult>, select?: RelationRequirement | undefined, now?: number | undefined) => RemoteMessage;
|
|
3469
|
-
/**
|
|
3470
|
-
* The edges a connection shows: its server-known region with pending and
|
|
3471
|
-
* confirmed overlays placed around it, minus removed edges and edges whose
|
|
3472
|
-
* target is a tombstone.
|
|
3473
|
-
*/
|
|
3474
|
-
visibleItems: (model: RemoteModel, connection: ConnectionIdentity) => ReadonlyArray<Edge>;
|
|
3475
3903
|
/** A pure, serializable view of the whole cache. */
|
|
3476
3904
|
inspect: (model: RemoteModel) => RemoteInspection;
|
|
3477
3905
|
/** A pure, serializable view of one entity, or `undefined` if unknown. */
|
|
@@ -3481,7 +3909,7 @@ declare const Remote: {
|
|
|
3481
3909
|
* returning the result's normalized patches so the caller can reconcile them
|
|
3482
3910
|
* through `updateRemote`'s `MutationSucceeded` (or `Remote.mutateInto`).
|
|
3483
3911
|
*/
|
|
3484
|
-
mutate: <Name extends string, Input, Output>(mutation: MutationDescriptor<Name, Input, Output>, input: Input, requestId: string) => Effect.Effect<{
|
|
3912
|
+
mutate: <Name extends string, Input, Output>(mutation: MutationDescriptor<Name, Input, Output, unknown>, input: Input, requestId: string, keys?: readonly string[] | undefined) => Effect.Effect<{
|
|
3485
3913
|
output: Output;
|
|
3486
3914
|
entities: readonly {
|
|
3487
3915
|
readonly entity: string;
|
|
@@ -3495,7 +3923,7 @@ declare const Remote: {
|
|
|
3495
3923
|
readonly entity: string;
|
|
3496
3924
|
readonly id: string;
|
|
3497
3925
|
}[];
|
|
3498
|
-
}, RemoteMutationError, RemoteClient>;
|
|
3926
|
+
}, RemoteMutationError | RemoteForbidden, RemoteClient>;
|
|
3499
3927
|
/**
|
|
3500
3928
|
* Runs a mutation and reconciles its patches into a `RemoteModel` in one step,
|
|
3501
3929
|
* returning the new model alongside the typed Output. The model-level form of
|
|
@@ -3503,10 +3931,10 @@ declare const Remote: {
|
|
|
3503
3931
|
* application the three are `update` (with `optimistic`), a Command, and the
|
|
3504
3932
|
* Message the Command returns, so the optimistic operations show meanwhile.
|
|
3505
3933
|
*/
|
|
3506
|
-
mutateInto: <Name extends string, Input, Output, AppModel, Store extends RemoteModel>(bound: BoundRemote<AppModel, Store, string>, model: AppModel, mutation: MutationDescriptor<Name, Input, Output>, input: Input, requestId: string, options?: MutateOptions | undefined) => Effect.Effect<{
|
|
3934
|
+
mutateInto: <Name extends string, Input, Output, AppModel, Store extends RemoteModel>(bound: BoundRemote<AppModel, Store, string>, model: AppModel, mutation: MutationDescriptor<Name, Input, Output, unknown>, input: Input, requestId: string, options?: MutateOptions | undefined) => Effect.Effect<{
|
|
3507
3935
|
output: Output;
|
|
3508
3936
|
model: AppModel;
|
|
3509
|
-
}, RemoteMutationError, RemoteClient>;
|
|
3937
|
+
}, RemoteMutationError | RemoteForbidden, RemoteClient>;
|
|
3510
3938
|
/**
|
|
3511
3939
|
* A Foldkit Subscription entry that plans a Surface's missing fields from the
|
|
3512
3940
|
* Model and fetches them through `RemoteClient`, emitting a `RemoteMessage`
|
|
@@ -3521,11 +3949,12 @@ declare const Remote: {
|
|
|
3521
3949
|
* requirements, emitting a `LiveReceived` per event and a `ReadFailed`
|
|
3522
3950
|
* carrying its `stream` when the stream breaks (including
|
|
3523
3951
|
* `ResumeUnavailable`). That records a gap on the stream rather than a failed
|
|
3524
|
-
* read, since nothing was being read
|
|
3952
|
+
* read, since nothing was being read, and restarts the entry after a
|
|
3953
|
+
* backoff; the restart refetches what it covers. The resume cursor is read
|
|
3525
3954
|
* from `RemoteModel.live`, so the application tracks no cursor of its own.
|
|
3526
3955
|
*/
|
|
3527
3956
|
live: <AppModel, Store extends RemoteModel, Names extends string, Model, SurfaceMessage, Params, Message = RemoteMessage>(bound: BoundRemote<AppModel, Store, Names>, surface: Surface<AppModel, Model, SurfaceMessage, Params>, params: Params, toMessage?: (message: RemoteMessage) => Message, options?: LiveOptions) => EntryWithoutKeepAlive<AppModel, Message, LiveDependencies, RemoteClient>;
|
|
3528
3957
|
};
|
|
3529
3958
|
//#endregion
|
|
3530
|
-
export {
|
|
3531
|
-
//# sourceMappingURL=index-
|
|
3959
|
+
export { Matched as $, writeEntity as $i, RelationRequest as $n, RemoteConnections as $r, RemoteResumePart as $t, RemoteWiring as A, patchOfWrite as Ai, withRefreshRequested as An, emptyLiveState as Ar, refsIn as At, PlanFreshness as B, entry as Bi, MutationRequest as Bn, addOverlay as Br, RemoteClient as Bt, Registered as C, SchemaOrFields as Ci, refreshedAt as Cn, LiveCursor as Cr, RelationAnnotation as Ct, RemoteEntry as D, failMutation as Di, retentionRootsSchema as Dn, applyConnectionEvent as Dr, aliasedField as Dt, RemoteDomain as E, emptyMutationState as Ei, remoteModelSchema as En, LiveState as Er, RelationShape as Et, SubscriptionsOptions as F, EntityStore as Fi, LiveEdge as Fn, ConnectionOverlay as Fr, httpWithLive as Ft, ExplainedDependencies as G, markStale as Gi, QueryRequest as Gn, removeLayer as Gr, mutateRemote as Gt, deadlineOf as H, isFieldStale as Hi, NormalizedEntity as Hn, connectionIdentity as Hr, coalescedLayer as Ht, RowPlace as I, EntityWrite as Ii, LiveRequirement as In, EntityLayer as Ir, liveFetch as It, RemoteInspection as J, remove as Ji, REMOTE_PROTOCOL_VERSION as Jn, settleSuccess as Jr, CoalesceOptions as Jt, QueryExplanation as K, missingFields as Ki, QueryResult as Kn, removeOverlay as Kr, remoteError as Kt, placeIn as L, clearStale as Li, MAX_FIELDS_PER_REQUEST as Ln, OptimisticOperation as Lr, RemoteJsonAnswer as Lt, SatisfyOptions as M, schemaOf as Mi, ConnectionChangeSchema as Mn, liveHasPrevious as Mr, relationShape as Mt, SelectsEntity as N, EntityEntry as Ni, Live as Nn, ConnectionChange as Nr, targetsOf as Nt, RemoteFold as O, mutationStatus as Oi, updateRemote as On, applyEntityEvent as Or, isRefPage as Ot, SubscriptionEntries as P, EntityKey as Pi, LiveChange as Pn, ConnectionIdentity as Pr, LiveFetchOptions as Pt, Judged as Q, writeEntities as Qi, ReadRequest as Qn, RelationRequirement as Qr, requirementKey as Qt, RemotePolicy as R, emptyStore as Ri, MAX_RELATION_DEPTH as Rn, OptimisticState as Rr, RemoteJsonRequest as Rt, ReadMeta as S, Refusal as Si, refreshIsInFlight as Sn, EntityApplied as Sr, RefParts as St, RemoteDescriptor as T, beginMutation as Ti, remoteMessageSchema as Tn, LiveOutcome as Tr, RelationKind as Tt, plan as U, isFieldUnavailable as Ui, PageSize as Un, emptyOptimistic as Ur, connectionChangeOf as Ut, PlanOptions as V, hasField as Vi, MutationResult as Vn, beginOptimistic as Vr, RemoteRpcClient as Vt, windowKey as W, isTombstone as Wi, QueryEdge as Wn, pruneOverlays as Wr, liveEventOf as Wt, inspectRemote as X, setUnavailable as Xi, ReadBatch as Xn, visibleStore as Xr, coalesceQueries as Xt, inspectEntity as Y, setStale as Yi, Read as Yn, visibleItems as Yr, QueryRun as Yt, Belongs as Z, tombstone as Zi, ReadBatchResult as Zn, ConnectionRequirement as Zr, coalesceReads as Zt, QueryOptions as _, items as _a, MutationDescriptor as _i, isQueryLoading as _n, RetentionRoots as _r, pageSchema as _t, EntitySelection as a, Boundary as aa, IDENTITY_SEPARATOR as ai, RemoteMessageInput as an, RemoteReadError as ar, EntityDescriptor as at, QueryWindowOptions as b, terminal as ba, NormalizedPatch as bi, onlyOverlaid as bn, BoundaryCounts as br, RELATION_ALIAS as bt, LiveOptions as c, Edge as ca, Query$1 as ci, StreamHealth as cn, WindowSchema as cr, FieldsFrom as ct, MutateOptions as d, cursor as da, QueryRef as di, forgetRemote as dn, REMOTE_CACHE_VERSION as dr, Page as dt, Freshness as ea, RemoteRequirements as ei, Failures as en, RemoteForbidden as er, MatchingOptions as et, MutationStarted as f, edge as fa, QueryWindow as fi, initialRemoteModel as fn, RemotePersistence as fr, Selection as ft, QueryInput as g, isGapped as ga, MutationAnswer as gi, isLoadingThrough as gn, Retained as gr, assemble as gt, QueryEntity as h, hasPrevious as ha, Mutation as hi, isLoading as hn, ConnectionRoot as hr, SelectionValueOf as ht, EntityLike as i, remoteErrorSchema as ia, ConnectionSpec as ii, RemoteMessage as in, RemoteQueryError as ir, Entity$2 as it, RetainOptions as j, reconcileMutation as ji, writeRead as jn, liveHasNext as jr, relationAlias as jt, RemoteUnsatisfied as k, optimisticOfWrite as ki, windowGrowthKey as kn, classifyLive as kr, refParts as kt, LiveStatus as l, EdgeRef as la, QueryDescriptor as li, emptyRefresh as ln, WireBoundary as lr, RefKey as lt, PersistenceOptions as m, hasNext as ma, stableStringify as mi, isFieldFailed as mn, SnapshotOptions as mr, SelectionValue as mt, BoundRemote as n, RemoteError as na, connectionsOf as ni, PlacementMismatch as nn, RemoteMutationError as nr, matching as nt, FoldedMutationStarted as o, Connection as oa, LiveInsertion as oi, RemoteMessageTag as on, RemoteRpc as or, EntityPatch as ot, ObserveOptions as p, emptyConnection as pa, ResultOf as pi, invalidateConnections as pn, Snapshot as pr, SelectionOf as pt, ReadDiagnosis as q, readField as qi, QueryRpc as qn, settleFailure as qr, BatchRead as qt, DomainMutateOptions as r, remoteDataSchema as ra, requirementsOf as ri, RefreshState as rn, RemoteProtocolError as rr, AnySchema as rt, LiveDependencies as s, Cursor as sa, LivePolicy as si, RemoteModel as sn, SettledFields as sr, EntityRef as st, ActiveEntry as t, RemoteData as ta, Requirement as ti, PlacedOrder as tn, RemoteLiveError as tr, belongsEncoded as tt, ModelOfDomain as u, Segment as ua, QueryInputs as ui, failureOf as un, MergePolicy as ur, RefPage as ut, QueryProjection as v, merge as va, MutationState as vi, isRemoteMessage as vn, gc as vr, relationOf as vt, Remote as w, TypeOf as wi, remoteMessageCases as wn, LiveEvent as wr, RelationEntityAnnotation as wt, ReadDependencies as x, unknown as xa, Reconciled as xi, overlaysOf as xn, ConnectionApplied as xr, RefPageValue as xt, QueryRequirement as y, segment as ya, MutationStatus as yi, noFailures as yn, reachable as yr, unavailableOf as yt, Deadline as z, entityKey as zi, Mutate as zn, addLayer as zr, RemoteJsonSend as zt };
|
|
3960
|
+
//# sourceMappingURL=index-CXAGo7Dz.d.mts.map
|