nowity 1.5.0 → 1.7.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 +81 -0
- package/dist/api/contract.d.ts +11 -0
- package/dist/api/contract.d.ts.map +1 -1
- package/dist/api/contract.js +5 -1
- package/dist/client/confirmed-store.d.ts +2 -11
- package/dist/client/confirmed-store.d.ts.map +1 -1
- package/dist/client/confirmed-store.js +5 -0
- package/dist/client/connection.d.ts.map +1 -1
- package/dist/client/connection.js +3 -1
- package/dist/client/nowity-client.d.ts +125 -2
- package/dist/client/nowity-client.d.ts.map +1 -1
- package/dist/client/nowity-client.js +252 -16
- package/dist/client/overlay.d.ts +2 -0
- package/dist/client/overlay.d.ts.map +1 -1
- package/dist/client/overlay.js +4 -0
- package/dist/client.d.ts +2 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +10 -1
- package/dist/core/derived.d.ts +96 -0
- package/dist/core/derived.d.ts.map +1 -0
- package/dist/core/derived.js +127 -0
- package/dist/core/protocol.d.ts +23 -1
- package/dist/core/protocol.d.ts.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/server/api/bridge.d.ts +8 -0
- package/dist/server/api/bridge.d.ts.map +1 -1
- package/dist/server/api/bridge.js +20 -1
- package/dist/server/api/configure.d.ts.map +1 -1
- package/dist/server/api/configure.js +1 -0
- package/dist/server/api/derived.d.ts +143 -0
- package/dist/server/api/derived.d.ts.map +1 -0
- package/dist/server/api/derived.js +377 -0
- package/dist/server/api/execution.d.ts +6 -0
- package/dist/server/api/execution.d.ts.map +1 -1
- package/dist/server/api/execution.js +1 -0
- package/dist/server/api/read-keys.d.ts +20 -0
- package/dist/server/api/read-keys.d.ts.map +1 -1
- package/dist/server/api/read-keys.js +103 -0
- package/dist/server/api/runtime.d.ts +10 -0
- package/dist/server/api/runtime.d.ts.map +1 -1
- package/dist/server/api/runtime.js +1 -0
- package/dist/server/api/tracked-client.d.ts.map +1 -1
- package/dist/server/api/tracked-client.js +9 -0
- package/dist/server/evaluate.d.ts +2 -0
- package/dist/server/evaluate.d.ts.map +1 -1
- package/dist/server/evaluate.js +1 -0
- package/dist/server/mutator.d.ts +2 -0
- package/dist/server/mutator.d.ts.map +1 -1
- package/dist/server/query.d.ts +6 -0
- package/dist/server/query.d.ts.map +1 -1
- package/dist/server/sync-engine.d.ts +21 -0
- package/dist/server/sync-engine.d.ts.map +1 -1
- package/dist/server/sync-engine.js +74 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -214,6 +214,87 @@ Acquisition is asynchronous, so the two things a `status` field would carry are
|
|
|
214
214
|
not in the result at all: "not there yet" is a pending promise, "not allowed" is
|
|
215
215
|
a rejected one.
|
|
216
216
|
|
|
217
|
+
#### Strict optimistic mode (tests)
|
|
218
|
+
|
|
219
|
+
A mutation without a client mutator is legal — it just waits for the server, and
|
|
220
|
+
nobody notices the lag until a user does. `strictOptimistic: true` (on
|
|
221
|
+
`NowityProvider`, `NowityConnection` or `NowityClient`; default from
|
|
222
|
+
`NOWITY_STRICT_OPTIMISTIC=1` where there is a `process.env`) turns that into an
|
|
223
|
+
error: every mutation needs either a mutator with `local()` or an explicit
|
|
224
|
+
declaration that it waits on purpose.
|
|
225
|
+
|
|
226
|
+
```ts
|
|
227
|
+
const mutators: ClientMutatorDef[] = [
|
|
228
|
+
{ name: "documents.rename", local: ([id, title], tx) => { tx.of("Document").get(id)!.title = title; } },
|
|
229
|
+
{ name: "billing.pay", pessimistic: "the charge is the server's to decide" },
|
|
230
|
+
];
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
Anything else rejects with `StrictOptimisticError` (naming the mutation, with the
|
|
234
|
+
caller's stack), is not sent, and is reported through `reportError` so that a
|
|
235
|
+
swallowed rejection still shows up as an uncaught page error. A mutator that
|
|
236
|
+
runs but stages nothing for some arguments (an illegal move) is fine — the rule
|
|
237
|
+
is that somebody wrote the optimistic half, not that it always changes
|
|
238
|
+
something. Meant for test runs; leave it off in production.
|
|
239
|
+
|
|
240
|
+
#### Derived client mutators
|
|
241
|
+
|
|
242
|
+
For the plainest writes the optimistic half is a restatement of the server
|
|
243
|
+
code: `update Document set title = $2 where id = $1`. So the server can derive
|
|
244
|
+
it — opt in with `createNowityServer({ derivedMutators: true })`. Every
|
|
245
|
+
`@mutation` runs over the tracking client, which records each model write;
|
|
246
|
+
after a committed call the writes are matched against the call's arguments and
|
|
247
|
+
the result is the mutation's *write fingerprint* — which model rows it writes
|
|
248
|
+
(by id), which fields, and whether each value is an argument, the caller's own
|
|
249
|
+
user id, a constant, or an increment. It is sent to nobody before two calls
|
|
250
|
+
agree on it (one call cannot tell an argument or a constant from a value that
|
|
251
|
+
happened to equal it); any later call that disagrees demotes the mutation to
|
|
252
|
+
the fallback for good. Writes Nowity itself makes inside a mutation (the
|
|
253
|
+
scheduler, presence) are not part of the fingerprint.
|
|
254
|
+
|
|
255
|
+
Each live query is sent the fingerprints that can change it, per instance (query
|
|
256
|
+
and arguments): the query holds rows of the written model, and none of the
|
|
257
|
+
written fields is a column its `where` or `orderBy` mentioned — otherwise the
|
|
258
|
+
row could leave, arrive or move, and that is the server's to say — including
|
|
259
|
+
columns of other tables it filters by through a relation, and the `where` and
|
|
260
|
+
`orderBy` of nested `include`s. Only the
|
|
261
|
+
template travels (`{ arg: [1] }`), never code. The browser then runs it over the
|
|
262
|
+
overlay when the mutation is called; a hand-written `local()` or a declared
|
|
263
|
+
`pessimistic` reason always wins over it, and a row shared with a query that was
|
|
264
|
+
not sent it is left alone (and then so is the rest of that mutator: all of it
|
|
265
|
+
or nothing).
|
|
266
|
+
|
|
267
|
+
The fallback — send the mutation, wait for the server's data — is everything
|
|
268
|
+
else: inserts and upserts (ids, defaults), writes to many rows, rows not named by
|
|
269
|
+
their id, values read or computed (the clock, `title + "!"`), conditions over
|
|
270
|
+
data the fingerprint never saw, nested and JSON writes, raw SQL, views of the
|
|
271
|
+
endpoint's own shape (`@query({ idField })`), and anything outside the database.
|
|
272
|
+
|
|
273
|
+
Once the server's data includes a mutation (`lastMutationId`), the browser
|
|
274
|
+
compares every value a derived mutator replaced with the confirmed row; a
|
|
275
|
+
difference (`onDerivedMismatch`) stops that browser predicting the mutation.
|
|
276
|
+
Only that browser: the row may carry someone else's later write, and the
|
|
277
|
+
server already checks every call against the fingerprint. Fingerprints live in
|
|
278
|
+
the memory of each sync process and are learned again after a restart;
|
|
279
|
+
`nowity.api.derived.report()` says where every mutation seen so far stands.
|
|
280
|
+
|
|
281
|
+
Switches, for comparing the two behaviours:
|
|
282
|
+
|
|
283
|
+
- `createNowityServer({ derivedMutators })` — off by default: learn nothing,
|
|
284
|
+
send nothing.
|
|
285
|
+
- `optimistic: false` on `NowityProvider` / `NowityConnection` / `NowityClient`,
|
|
286
|
+
or `client.setOptimistic(false)` at run time — no overlay at all, derived or
|
|
287
|
+
hand-written: the mutation is sent and the UI changes when the data arrives.
|
|
288
|
+
The confirmed data is the same either way.
|
|
289
|
+
|
|
290
|
+
Two related client options: `onDisconnect: "drop"` binds unconfirmed mutations to
|
|
291
|
+
the connection — a drop forgets them, rejects their callers with
|
|
292
|
+
`ConnectionLostError`, and nothing is resent (the default `"resend"` replays them
|
|
293
|
+
with the same numbers) — and `@mutation({ dedupe: true })` makes a second call
|
|
294
|
+
with the same arguments, while the first is unanswered, return the first call's
|
|
295
|
+
promise (off by default: `+1` twice is two increments). `client.hasPendingMutations`
|
|
296
|
+
is observable, for marking an action that is not confirmed yet.
|
|
297
|
+
|
|
217
298
|
### React
|
|
218
299
|
|
|
219
300
|
```tsx
|
package/dist/api/contract.d.ts
CHANGED
|
@@ -48,6 +48,15 @@ export type ListOptions = QueryOptions;
|
|
|
48
48
|
export interface MutationOptions {
|
|
49
49
|
/** Purely descriptive; mutations declare no read dependencies. */
|
|
50
50
|
description?: string;
|
|
51
|
+
/**
|
|
52
|
+
* A second call with the same arguments while the first is still waiting
|
|
53
|
+
* for its answer is the same call — the double click, not a second intent.
|
|
54
|
+
* The browser hands back the first call's promise and sends nothing.
|
|
55
|
+
*
|
|
56
|
+
* Off unless set: `+1` twice is two increments, and only the endpoint knows
|
|
57
|
+
* whether repeating it means anything.
|
|
58
|
+
*/
|
|
59
|
+
dedupe?: boolean;
|
|
51
60
|
}
|
|
52
61
|
export interface EndpointMeta {
|
|
53
62
|
method: string;
|
|
@@ -68,6 +77,8 @@ export interface ContractMeta {
|
|
|
68
77
|
export interface ManifestEndpoint {
|
|
69
78
|
method: string;
|
|
70
79
|
kind: EndpointKind;
|
|
80
|
+
/** See {@link MutationOptions.dedupe}. */
|
|
81
|
+
dedupe?: true;
|
|
71
82
|
}
|
|
72
83
|
export interface ManifestContract {
|
|
73
84
|
name: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../src/api/contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,kBAAkB,CAAC;AAG1B,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,UAAU,GAAG,MAAM,CAAC;AAEzD,6EAA6E;AAC7E,MAAM,WAAW,YAAY;IACzB;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,mEAAmE;IACnE,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;GAMG;AACH,MAAM,MAAM,WAAW,GAAG,YAAY,CAAC;AAEvC,MAAM,WAAW,eAAe;IAC5B,kEAAkE;IAClE,WAAW,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../src/api/contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,kBAAkB,CAAC;AAG1B,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,UAAU,GAAG,MAAM,CAAC;AAEz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({
|
|
241
241
|
name: meta.name,
|
|
242
|
-
endpoints: [...meta.endpoints.values()].map(({ method, kind }) => ({
|
|
242
|
+
endpoints: [...meta.endpoints.values()].map(({ method, kind, mutation }) => ({
|
|
243
|
+
method,
|
|
244
|
+
kind,
|
|
245
|
+
...(mutation?.dedupe ? { dedupe: true } : {}),
|
|
246
|
+
})),
|
|
243
247
|
})),
|
|
244
248
|
};
|
|
245
249
|
}
|
|
@@ -1,15 +1,4 @@
|
|
|
1
1
|
import type { EntityId, Row, RowPatch } from "../core/types";
|
|
2
|
-
/**
|
|
3
|
-
* The server-authoritative state of the client, as plain data.
|
|
4
|
-
*
|
|
5
|
-
* This is deliberately *not* the MobX layer. Optimistic mutations are replayed on
|
|
6
|
-
* top of this on every rebase, so it has to stay untouched by local writes —
|
|
7
|
-
* otherwise a rejected mutation could never be undone.
|
|
8
|
-
*
|
|
9
|
-
* Rows are shared between subscriptions and reference-counted: two live queries
|
|
10
|
-
* returning the same document hold one row, and the row survives until the last
|
|
11
|
-
* of them stops referencing it.
|
|
12
|
-
*/
|
|
13
2
|
export declare class ConfirmedStore {
|
|
14
3
|
private readonly rows;
|
|
15
4
|
private readonly refs;
|
|
@@ -18,6 +7,8 @@ export declare class ConfirmedStore {
|
|
|
18
7
|
entities(): string[];
|
|
19
8
|
rowsOf(entity: string): Map<EntityId, Row>;
|
|
20
9
|
get(entity: string, id: EntityId): Row | undefined;
|
|
10
|
+
/** Subscriptions holding a row; empty when nobody does. */
|
|
11
|
+
holders(entity: string, id: EntityId): ReadonlySet<string>;
|
|
21
12
|
/** Replace everything `subId` holds for `entity`. */
|
|
22
13
|
setSnapshot(subId: string, entity: string, rows: Row[], idField: string): void;
|
|
23
14
|
applyUpsert(subId: string, entity: string, patches: RowPatch[]): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"confirmed-store.d.ts","sourceRoot":"","sources":["../../src/client/confirmed-store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,Q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C,OAAO;CAUlB"}
|
|
@@ -12,6 +12,7 @@ exports.ConfirmedStore = void 0;
|
|
|
12
12
|
* returning the same document hold one row, and the row survives until the last
|
|
13
13
|
* of them stops referencing it.
|
|
14
14
|
*/
|
|
15
|
+
const EMPTY_HOLDERS = new Set();
|
|
15
16
|
class ConfirmedStore {
|
|
16
17
|
constructor() {
|
|
17
18
|
this.rows = new Map();
|
|
@@ -28,6 +29,10 @@ class ConfirmedStore {
|
|
|
28
29
|
get(entity, id) {
|
|
29
30
|
return this.rows.get(entity)?.get(id);
|
|
30
31
|
}
|
|
32
|
+
/** Subscriptions holding a row; empty when nobody does. */
|
|
33
|
+
holders(entity, id) {
|
|
34
|
+
return this.refs.get(entity)?.get(id) ?? EMPTY_HOLDERS;
|
|
35
|
+
}
|
|
31
36
|
/** Replace everything `subId` holds for `entity`. */
|
|
32
37
|
setSnapshot(subId, entity, rows, idField) {
|
|
33
38
|
const nextIds = new Set();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../../src/client/connection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAA0C,KAAK,gBAAgB,EAAE,MAAM,MAAM,CAAC;AACrF,OAAO,KAAK,EAAE,gBAAgB,EAAiB,MAAM,kBAAkB,CAAC;AAExE,OAAO,EAAmB,YAAY,EAAE,KAAK,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAC1F,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAsB,KAAK,UAAU,EAAE,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAEvF,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,UAAU,GAAG,MAAM,CAAC;AACzD,YAAY,EAAE,UAAU,EAAE,CAAC;AAE3B,MAAM,WAAW,uBAAwB,SAAQ,IAAI,CAAC,mBAAmB,EAAE,WAAW,CAAC;IACnF;;;;;;;OAOG;IACH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,EAAE,OAAO,EAAE,GAAG,SAAS;IAehD,MAAM,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI;IAK9B,OAAO,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI;IAK/B,OAAO,CAAC,eAAe;IAsBvB,OAAO,CAAC,UAAU;CAMrB"}
|
|
@@ -211,9 +211,11 @@ class NowityConnection {
|
|
|
211
211
|
return fn;
|
|
212
212
|
}
|
|
213
213
|
async call(name, args) {
|
|
214
|
+
// Taken before the first await, where the caller is still on the stack.
|
|
215
|
+
const callSite = this.client.strictOptimistic ? new Error() : undefined;
|
|
214
216
|
const kind = await this.kindOf(name);
|
|
215
217
|
if (kind === "mutation") {
|
|
216
|
-
return this.client.mutate(name, args);
|
|
218
|
+
return this.client.mutate(name, args, callSite);
|
|
217
219
|
}
|
|
218
220
|
if (kind === "list") {
|
|
219
221
|
throw new Error(`"${name}" is a @list endpoint, so it has no single result to hand ` +
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { observable } from "mobx";
|
|
2
|
+
import { type DerivedMutator } from "../core/derived";
|
|
2
3
|
import type { HydrationPayload, ServerMessage, ServerWelcome } from "../core/protocol";
|
|
3
4
|
import type { EntityId } from "../core/types";
|
|
4
5
|
import { LiveQuery, type QueryDescriptor } from "./live-query";
|
|
@@ -15,7 +16,8 @@ export interface EntityDescriptor {
|
|
|
15
16
|
idField?: string;
|
|
16
17
|
relations?: Record<string, RelationDescriptor>;
|
|
17
18
|
}
|
|
18
|
-
export
|
|
19
|
+
export type ClientMutatorDef<A = any> = OptimisticMutatorDef<A> | PessimisticMutatorDef;
|
|
20
|
+
export interface OptimisticMutatorDef<A = any> {
|
|
19
21
|
name: string;
|
|
20
22
|
/**
|
|
21
23
|
* Optimistic implementation. Runs immediately when the mutation is issued and
|
|
@@ -23,6 +25,35 @@ export interface ClientMutatorDef<A = any> {
|
|
|
23
25
|
* no randomness, no `Date.now()`, no network.
|
|
24
26
|
*/
|
|
25
27
|
local(args: A, tx: LocalTx): void;
|
|
28
|
+
pessimistic?: never;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* A write that waits for the server on purpose.
|
|
32
|
+
*
|
|
33
|
+
* Some writes have nothing to show before the server decides — a payment, a
|
|
34
|
+
* sign-in, anything whose result only the server can know. Declaring them is
|
|
35
|
+
* what {@link NowityClientOptions.strictOptimistic} asks for: the reason is
|
|
36
|
+
* the record that somebody decided, rather than forgot.
|
|
37
|
+
*/
|
|
38
|
+
export interface PessimisticMutatorDef {
|
|
39
|
+
name: string;
|
|
40
|
+
/** Why this write has no optimistic effect. Must not be empty. */
|
|
41
|
+
pessimistic: string;
|
|
42
|
+
local?: never;
|
|
43
|
+
}
|
|
44
|
+
/** Thrown in strict mode by a mutation the client has no answer for. */
|
|
45
|
+
export declare class StrictOptimisticError extends Error {
|
|
46
|
+
readonly mutation: string;
|
|
47
|
+
constructor(mutation: string);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* A mutation that was waiting when the connection dropped, in `onDisconnect:
|
|
51
|
+
* "drop"` mode. It may or may not have reached the server; the data that
|
|
52
|
+
* arrives after the reconnect says which, and nothing resends it.
|
|
53
|
+
*/
|
|
54
|
+
export declare class ConnectionLostError extends Error {
|
|
55
|
+
readonly mutation: string;
|
|
56
|
+
constructor(mutation: string);
|
|
26
57
|
}
|
|
27
58
|
export interface NowityClientOptions {
|
|
28
59
|
transport: Transport;
|
|
@@ -40,6 +71,51 @@ export interface NowityClientOptions {
|
|
|
40
71
|
entities?: Record<string, EntityDescriptor>;
|
|
41
72
|
queries?: Record<string, QueryDescriptor>;
|
|
42
73
|
mutators?: ClientMutatorDef[];
|
|
74
|
+
/**
|
|
75
|
+
* Refuse a mutation that has neither a client mutator nor a declared
|
|
76
|
+
* `pessimistic` reason.
|
|
77
|
+
*
|
|
78
|
+
* A testing aid. Off, a mutation without a mutator simply lands when the
|
|
79
|
+
* server confirms it — legal, and invisible until somebody notices the lag.
|
|
80
|
+
* On, the same call rejects with {@link StrictOptimisticError} and is also
|
|
81
|
+
* reported as an uncaught error (`reportError`), so a caller that swallows
|
|
82
|
+
* the rejection cannot hide it from a test watching for page errors. Nothing
|
|
83
|
+
* is sent. Leave it off in production.
|
|
84
|
+
*
|
|
85
|
+
* Default: `NOWITY_STRICT_OPTIMISTIC=1` in the environment, where there is
|
|
86
|
+
* one; otherwise off.
|
|
87
|
+
*/
|
|
88
|
+
strictOptimistic?: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Show writes before the server confirms them.
|
|
91
|
+
*
|
|
92
|
+
* On (the default), a mutation runs its client mutator over the overlay
|
|
93
|
+
* the moment it is called — a hand-written `local()`, or failing that the
|
|
94
|
+
* mutator the server derived for the live queries it affects. Off, nothing
|
|
95
|
+
* is predicted: the mutation is sent and the UI changes when the server's
|
|
96
|
+
* data arrives. The confirmed data is the same either way; the switch is
|
|
97
|
+
* there to compare the two (see also {@link NowityClient.setOptimistic}).
|
|
98
|
+
*/
|
|
99
|
+
optimistic?: boolean;
|
|
100
|
+
/**
|
|
101
|
+
* What happens to unconfirmed mutations when the connection drops.
|
|
102
|
+
*
|
|
103
|
+
* `"resend"` (the default) keeps them queued and sends them again with the
|
|
104
|
+
* same numbers after the reconnect; the server applies each number once.
|
|
105
|
+
* `"drop"` binds them to the connection: they are forgotten, their callers
|
|
106
|
+
* reject with {@link ConnectionLostError}, and the data the server sends
|
|
107
|
+
* after the reconnect says what actually happened. Nothing is repeated
|
|
108
|
+
* behind the user's back — the UI shows that the action was not confirmed.
|
|
109
|
+
*/
|
|
110
|
+
onDisconnect?: "resend" | "drop";
|
|
111
|
+
/**
|
|
112
|
+
* A derived mutator predicted a value the server's data then contradicted.
|
|
113
|
+
* This client stops using it. Local on purpose: the confirmed row may
|
|
114
|
+
* already carry someone else's later write, so a contradiction here is a
|
|
115
|
+
* reason for caution, not proof — the server checks every call of a
|
|
116
|
+
* mutation against its fingerprint itself.
|
|
117
|
+
*/
|
|
118
|
+
onDerivedMismatch?: (mutation: string) => void;
|
|
43
119
|
/**
|
|
44
120
|
* Called once the server has announced its API shape.
|
|
45
121
|
*
|
|
@@ -103,6 +179,16 @@ export declare class NowityClient {
|
|
|
103
179
|
*/
|
|
104
180
|
private readonly sentIdFields;
|
|
105
181
|
private readonly onError;
|
|
182
|
+
/** See {@link NowityClientOptions.strictOptimistic}. */
|
|
183
|
+
readonly strictOptimistic: boolean;
|
|
184
|
+
/** See {@link NowityClientOptions.optimistic}. */
|
|
185
|
+
private optimisticOn;
|
|
186
|
+
/** Derived mutators per subscription, by mutation name. */
|
|
187
|
+
private readonly derivedBySub;
|
|
188
|
+
/** Derived mutators the server's data contradicted; never used again here. */
|
|
189
|
+
private readonly derivedFallback;
|
|
190
|
+
/** Mutations the server declared `dedupe`. */
|
|
191
|
+
private dedupe;
|
|
106
192
|
private pending;
|
|
107
193
|
/**
|
|
108
194
|
* Who is waiting for each mutation's answer. Separate from {@link pending}:
|
|
@@ -133,6 +219,8 @@ export declare class NowityClient {
|
|
|
133
219
|
private reconnectTimer;
|
|
134
220
|
private intentionalClose;
|
|
135
221
|
private connected;
|
|
222
|
+
/** The current connection has been welcomed (its numbering is known). */
|
|
223
|
+
private welcomed;
|
|
136
224
|
private everWelcomed;
|
|
137
225
|
/** What this connection says it is looking at; resent after every reconnect. */
|
|
138
226
|
private context;
|
|
@@ -156,6 +244,12 @@ export declare class NowityClient {
|
|
|
156
244
|
setContext(context: Record<string, unknown> | null): void;
|
|
157
245
|
private handleClose;
|
|
158
246
|
private send;
|
|
247
|
+
/**
|
|
248
|
+
* Forget every unconfirmed mutation: the connection they were bound to is
|
|
249
|
+
* gone. Their effect leaves the overlay now; whatever of it the server did
|
|
250
|
+
* apply comes back with the data after the reconnect.
|
|
251
|
+
*/
|
|
252
|
+
private dropPending;
|
|
159
253
|
/**
|
|
160
254
|
* Seed the store with data rendered on the server (`readInitialData`).
|
|
161
255
|
*
|
|
@@ -173,11 +267,23 @@ export declare class NowityClient {
|
|
|
173
267
|
* endpoint returned. It rejects if the mutation was refused — by then the
|
|
174
268
|
* optimistic effect is already undone.
|
|
175
269
|
*/
|
|
176
|
-
mutate<A, R = unknown>(name: string, args: A): Promise<R>;
|
|
270
|
+
mutate<A, R = unknown>(name: string, args: A, callSite?: Error): Promise<R>;
|
|
271
|
+
/** See {@link NowityClientOptions.optimistic}. Takes effect immediately. */
|
|
272
|
+
get optimistic(): boolean;
|
|
273
|
+
setOptimistic(on: boolean): void;
|
|
274
|
+
/**
|
|
275
|
+
* Whether something called here is not confirmed yet — observable, for a
|
|
276
|
+
* UI that marks an action as still in flight.
|
|
277
|
+
*/
|
|
278
|
+
get hasPendingMutations(): boolean;
|
|
279
|
+
/** The derived mutators a subscription holds, for diagnostics and tests. */
|
|
280
|
+
derivedMutatorsOf(subId: string): DerivedMutator[];
|
|
177
281
|
private handleMessage;
|
|
178
282
|
private handleWelcome;
|
|
179
283
|
private handleSnapshotMessage;
|
|
180
284
|
private applySnapshot;
|
|
285
|
+
private applyMutators;
|
|
286
|
+
private setDerived;
|
|
181
287
|
private applyPatch;
|
|
182
288
|
private applyRevoked;
|
|
183
289
|
private handleMutationResult;
|
|
@@ -193,6 +299,23 @@ export declare class NowityClient {
|
|
|
193
299
|
* arrives — the same flicker the whole rebase mechanism exists to prevent.
|
|
194
300
|
*/
|
|
195
301
|
private ackThrough;
|
|
302
|
+
/**
|
|
303
|
+
* Compare what derived mutators predicted with what the server confirmed.
|
|
304
|
+
*
|
|
305
|
+
* The confirmed store already holds data that includes these mutations, so
|
|
306
|
+
* every value a derived mutator replaced must be there — unless a later
|
|
307
|
+
* mutation, still pending, writes the same field. A difference means the
|
|
308
|
+
* fingerprint was wrong (a value it took for a constant was computed, a
|
|
309
|
+
* write it took for unconditional was not), or that someone else wrote the
|
|
310
|
+
* same field in between: either way this client stops predicting it.
|
|
311
|
+
*/
|
|
312
|
+
private checkDerived;
|
|
313
|
+
/**
|
|
314
|
+
* The derived mutator for a mutation, unless a hand-written one exists —
|
|
315
|
+
* `local()` and a declared `pessimistic` reason both win — or the server's
|
|
316
|
+
* data has contradicted it.
|
|
317
|
+
*/
|
|
318
|
+
private derivedOf;
|
|
196
319
|
/** Observable identity map of an entity: id → live object. */
|
|
197
320
|
mapFor(entity: string): ReturnType<typeof observable.map<EntityId, any>>;
|
|
198
321
|
/** A single live entity instance, or undefined if it is not loaded. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nowity-client.d.ts","sourceRoot":"","sources":["../../src/client/nowity-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,UAAU,EAAqD,MAAM,MAAM,CAAC;AAC7F,OAAO,KAAK,EAER,gBAAgB,EAGhB,aAAa,EAEb,aAAa,
|
|
1
|
+
{"version":3,"file":"nowity-client.d.ts","sourceRoot":"","sources":["../../src/client/nowity-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,UAAU,EAAqD,MAAM,MAAM,CAAC;AAC7F,OAAO,EAIH,KAAK,cAAc,EACtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAER,gBAAgB,EAGhB,aAAa,EAEb,aAAa,EAIhB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EAAE,QAAQ,EAAO,MAAM,eAAe,CAAC;AAEnD,OAAO,EACH,SAAS,EAET,KAAK,eAAe,EAEvB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAW,KAAK,OAAO,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,MAAM,WAAW,kBAAkB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,gEAAgE;IAChE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,mEAAmE;IACnE,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,gBAAgB;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,C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