nowity 1.8.0 → 1.10.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 +101 -0
- package/dist/client/clock.d.ts +98 -0
- package/dist/client/clock.d.ts.map +1 -0
- package/dist/client/clock.js +154 -0
- package/dist/client/devtools.d.ts +281 -0
- package/dist/client/devtools.d.ts.map +1 -0
- package/dist/client/devtools.js +556 -0
- package/dist/client/nowity-client.d.ts +69 -0
- package/dist/client/nowity-client.d.ts.map +1 -1
- package/dist/client/nowity-client.js +184 -6
- package/dist/client/transport.d.ts +2 -1
- package/dist/client/transport.d.ts.map +1 -1
- package/dist/client/ws-transport.d.ts.map +1 -1
- package/dist/client/ws-transport.js +2 -1
- package/dist/client.d.ts +8 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +4 -1
- package/dist/core/protocol.d.ts +70 -2
- package/dist/core/protocol.d.ts.map +1 -1
- package/dist/core/types.d.ts +6 -0
- package/dist/core/types.d.ts.map +1 -1
- package/dist/devtools.d.ts +38 -0
- package/dist/devtools.d.ts.map +1 -0
- package/dist/devtools.js +274 -0
- package/dist/server/change-source/outbox-change-source.d.ts +1 -0
- package/dist/server/change-source/outbox-change-source.d.ts.map +1 -1
- package/dist/server/change-source/outbox-change-source.js +2 -1
- package/dist/server/sync-engine.d.ts +9 -0
- package/dist/server/sync-engine.d.ts.map +1 -1
- package/dist/server/sync-engine.js +37 -7
- package/dist/server/ws-server.d.ts +20 -0
- package/dist/server/ws-server.d.ts.map +1 -1
- package/dist/server/ws-server.js +81 -2
- package/package.json +5 -1
package/README.md
CHANGED
|
@@ -944,6 +944,107 @@ cancel, an attempt racing a new schedule of its key, retries and `failed`, three
|
|
|
944
944
|
processes and racing claims, a leader killed mid-job, a restart of every
|
|
945
945
|
process, periodic jobs, and scheduling in a Prisma transaction and in a mutation.
|
|
946
946
|
|
|
947
|
+
### Devtools
|
|
948
|
+
|
|
949
|
+
A Network tab for the socket: what a page subscribed to, how long the server
|
|
950
|
+
took to answer, how big the answers were, what was written and when the socket
|
|
951
|
+
came and went. Off by default — a client without it measures nothing.
|
|
952
|
+
|
|
953
|
+
```ts
|
|
954
|
+
// switched on before the socket opens, so the page's startup is in it
|
|
955
|
+
<NowityProvider devtools={{ allowArgs: { "games.view": [0] } }}>…</NowityProvider>
|
|
956
|
+
|
|
957
|
+
// or later, from anywhere
|
|
958
|
+
const recorder = activeConnection().client.enableDevtools();
|
|
959
|
+
```
|
|
960
|
+
|
|
961
|
+
`client.devtools` is the recorder (`null` when off): a ring buffer of the last
|
|
962
|
+
`limit` (500) records, one shape for all of them — `type` (`subscribe`,
|
|
963
|
+
`mutation`, `ws`), `name`, `ts` (`performance.now()`), `durationMs` (subscribe →
|
|
964
|
+
first data, mutate → answer, connect → open, open → welcome), `bytes`, `status`
|
|
965
|
+
and `meta` (masked arguments, updates with their cause — `patch`, `snapshot`,
|
|
966
|
+
`resubscribe`, `permission-change` — refusal code, optimistic run time, resends).
|
|
967
|
+
`summary()` is the page's startup as the socket saw it: first connect, open,
|
|
968
|
+
welcome, subscribe and data. `export()` is all of it as JSON.
|
|
969
|
+
|
|
970
|
+
Arguments are masked when they are recorded, so nothing unmasked is ever kept:
|
|
971
|
+
numbers, booleans and `null` stay, a string only under an allowed key (`id`,
|
|
972
|
+
`…Id`, paging; extend with `allowKeys`) or at an allowed position of an
|
|
973
|
+
endpoint's argument list (`allowArgs`); keys that look sensitive (`email`,
|
|
974
|
+
`token`, `name`, `text`…) are masked even then unless listed explicitly. Rows
|
|
975
|
+
and returned values are not kept at all, only their size. Nothing leaves the
|
|
976
|
+
page.
|
|
977
|
+
|
|
978
|
+
The panel is a separate entry so it never lands in a bundle by accident — load
|
|
979
|
+
it behind your own access check:
|
|
980
|
+
|
|
981
|
+
```tsx
|
|
982
|
+
const { NowityDevtoolsPanel } = await import("nowity/devtools");
|
|
983
|
+
<NowityDevtoolsPanel recorder={client.devtools!} floating onClose={…} />
|
|
984
|
+
```
|
|
985
|
+
|
|
986
|
+
Table with a waterfall, filter by type, search, sort by any column, details of a
|
|
987
|
+
row, copy as JSON, clear. Snapshot timing (queue, snapshot, database) of a
|
|
988
|
+
subscription is not in it yet.
|
|
989
|
+
|
|
990
|
+
#### The server's clock
|
|
991
|
+
|
|
992
|
+
Client and server times come from different clocks, so the client keeps an
|
|
993
|
+
estimate of the server's, NTP-style. The welcome is the first sample (the
|
|
994
|
+
server stamps when the hello arrived and when the welcome left), then a burst
|
|
995
|
+
of three `ping`s, then one every 30 s:
|
|
996
|
+
|
|
997
|
+
```
|
|
998
|
+
offset = ((t1 − t0) + (t2 − t3)) / 2 server time = client time + offset
|
|
999
|
+
rtt = (t3 − t0) − (t2 − t1) the true offset is within ± rtt / 2
|
|
1000
|
+
```
|
|
1001
|
+
|
|
1002
|
+
The estimate is the sample with the smallest round trip of the last 8 (none
|
|
1003
|
+
older than 5 min), so one slow exchange does not move it. Client times are
|
|
1004
|
+
`performance.now()`, which the system clock being set does not touch; a sample
|
|
1005
|
+
whose bound contradicts older ones (a suspended laptop, a stepped server clock)
|
|
1006
|
+
drops them, so the estimate corrects itself on the next exchange. Pings are
|
|
1007
|
+
answered on arrival, ahead of whatever the socket has queued.
|
|
1008
|
+
|
|
1009
|
+
```ts
|
|
1010
|
+
client.clock.offsetMs; // null until synced
|
|
1011
|
+
client.clock.rttMs; // of the sample the offset comes from
|
|
1012
|
+
client.clock.uncertaintyMs; // rttMs / 2
|
|
1013
|
+
client.clock.sampleCount;
|
|
1014
|
+
client.clock.syncedAt; // performance.now() of the newest sample
|
|
1015
|
+
client.clock.toServerTime(performance.now());
|
|
1016
|
+
```
|
|
1017
|
+
|
|
1018
|
+
`clock: { intervalMs, burst, samples, maxAgeMs }` tunes it, `clock: false` sends
|
|
1019
|
+
no pings. A server older than this gets none either way and the clock stays
|
|
1020
|
+
unsynced.
|
|
1021
|
+
|
|
1022
|
+
Every devtools record carries `serverTs` (its `ts` on the server's clock) and
|
|
1023
|
+
`uncertaintyMs`; records from before the first sample get them with it. The
|
|
1024
|
+
panel draws its axis on the server's clock through one offset, the current
|
|
1025
|
+
estimate, for every row — each record's own stamp may come from an older
|
|
1026
|
+
estimate, and mixing them could swap records a few ms apart.
|
|
1027
|
+
|
|
1028
|
+
#### Server timing of a write
|
|
1029
|
+
|
|
1030
|
+
```ts
|
|
1031
|
+
createNowityServer({
|
|
1032
|
+
syncServer: { timing: (session) => isAdmin(session.userId) },
|
|
1033
|
+
});
|
|
1034
|
+
```
|
|
1035
|
+
|
|
1036
|
+
Off by default. `true`, or a function decided once per connection at its hello
|
|
1037
|
+
(a failure means off). A connection with timing gets, on the server's clock,
|
|
1038
|
+
`timing` on every `mutation-result` — `receivedAt` (on the socket), `startedAt`
|
|
1039
|
+
(its turn in the connection's queue), `committedAt`, `sentAt` — and on every
|
|
1040
|
+
`tx` — `writtenAt` (its own earliest outbox row, the *database's* clock),
|
|
1041
|
+
`readAt` (handed over by the change source), `fanOutAt`, `sentAt`. The recorder
|
|
1042
|
+
keeps them on the mutation (`meta.server`, and `meta.push` with `meta.dataAt`
|
|
1043
|
+
from the first data that included it), and `mutationPhases(record)` lays the
|
|
1044
|
+
whole round on one axis: sent → received → started → written → committed →
|
|
1045
|
+
answered → read → fan-out → pushed → data, client times with their ± uncertainty.
|
|
1046
|
+
The detail of a mutation in the panel shows exactly that.
|
|
1047
|
+
|
|
947
1048
|
### Escape hatches
|
|
948
1049
|
|
|
949
1050
|
`@query({ tables: [...] })` for a query that reads through something the tracker
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The server's clock, as seen from this page.
|
|
3
|
+
*
|
|
4
|
+
* Client and server times come from different clocks, so the moment a mutation
|
|
5
|
+
* left the browser and the moment the server committed it cannot be put on one
|
|
6
|
+
* axis by subtraction. This estimates the difference NTP-style from exchanges
|
|
7
|
+
* the client starts itself (the hello, then `ping`s):
|
|
8
|
+
*
|
|
9
|
+
* t0 client sends t1 server receives
|
|
10
|
+
* t3 client receives t2 server answers
|
|
11
|
+
*
|
|
12
|
+
* offset = ((t1 - t0) + (t2 - t3)) / 2 server = client + offset
|
|
13
|
+
* rtt = (t3 - t0) - (t2 - t1) the time spent on the wire
|
|
14
|
+
*
|
|
15
|
+
* The true offset lies within `offset ± rtt / 2` of every sample, whatever the
|
|
16
|
+
* asymmetry of the path. A sample with a small round trip is therefore a tight
|
|
17
|
+
* bound, and the estimate is the one with the smallest RTT of the recent ones —
|
|
18
|
+
* a single slow exchange (a busy socket, a radio waking up) does not move it.
|
|
19
|
+
*
|
|
20
|
+
* Client times are `performance.now()`, never `Date.now()`: the page's own
|
|
21
|
+
* monotonic clock, which a user changing the system time — or NTP stepping it
|
|
22
|
+
* — does not move. What can still move is the relation between the two clocks
|
|
23
|
+
* (a suspended laptop, a server whose clock was stepped). A new sample whose
|
|
24
|
+
* bound does not overlap an older one's proves that older one stale, and it is
|
|
25
|
+
* dropped — so the estimate corrects itself on the next exchange instead of
|
|
26
|
+
* clinging to a tight but outdated sample.
|
|
27
|
+
*/
|
|
28
|
+
export interface ClockSample {
|
|
29
|
+
/** Client send / receive, `performance.now()`. */
|
|
30
|
+
t0: number;
|
|
31
|
+
t3: number;
|
|
32
|
+
/** Server receive / send, the server's epoch milliseconds. */
|
|
33
|
+
t1: number;
|
|
34
|
+
t2: number;
|
|
35
|
+
offsetMs: number;
|
|
36
|
+
rttMs: number;
|
|
37
|
+
}
|
|
38
|
+
/** What the estimate stands on, for a panel and for an export. */
|
|
39
|
+
export interface ClockState {
|
|
40
|
+
/** server time = client time + `offsetMs`; `null` until the first sample. */
|
|
41
|
+
offsetMs: number | null;
|
|
42
|
+
/** Round trip of the sample the offset comes from. */
|
|
43
|
+
rttMs: number | null;
|
|
44
|
+
/** How far off the offset may be: `rttMs / 2`. */
|
|
45
|
+
uncertaintyMs: number | null;
|
|
46
|
+
/** Samples the estimate is chosen from now. */
|
|
47
|
+
sampleCount: number;
|
|
48
|
+
/** Samples taken in this page, including those dropped since. */
|
|
49
|
+
totalSamples: number;
|
|
50
|
+
/** Client time (`performance.now()`) of the newest sample. */
|
|
51
|
+
syncedAt: number | null;
|
|
52
|
+
}
|
|
53
|
+
export interface ServerClockOptions {
|
|
54
|
+
/** Recent samples the estimate is chosen from. Default 8. */
|
|
55
|
+
samples?: number;
|
|
56
|
+
/**
|
|
57
|
+
* Oldest sample still used, in ms. Two quartz clocks drift apart by tens of
|
|
58
|
+
* ppm, so a tight sample from long ago is no longer tight. Default 5 min.
|
|
59
|
+
*/
|
|
60
|
+
maxAgeMs?: number;
|
|
61
|
+
/** Client clock. Default `performance.now()`. */
|
|
62
|
+
now?: () => number;
|
|
63
|
+
}
|
|
64
|
+
export declare const DEFAULT_CLOCK_SAMPLES = 8;
|
|
65
|
+
export declare const DEFAULT_CLOCK_MAX_AGE_MS: number;
|
|
66
|
+
/** One exchange, or `null` when it cannot be one (an answer received before it was asked). */
|
|
67
|
+
export declare function clockSample(t0: number, t1: number, t2: number, t3: number): ClockSample | null;
|
|
68
|
+
export declare class ServerClock {
|
|
69
|
+
private readonly limit;
|
|
70
|
+
private readonly maxAgeMs;
|
|
71
|
+
readonly now: () => number;
|
|
72
|
+
private samples;
|
|
73
|
+
private best;
|
|
74
|
+
private total;
|
|
75
|
+
private readonly listeners;
|
|
76
|
+
constructor(opts?: ServerClockOptions);
|
|
77
|
+
/** Take one exchange into the estimate; returns it, or `null` when it was not usable. */
|
|
78
|
+
addSample(t0: number, t1: number, t2: number, t3: number): ClockSample | null;
|
|
79
|
+
/** Forget every sample — the estimate starts again with the next one. */
|
|
80
|
+
reset(): void;
|
|
81
|
+
get synced(): boolean;
|
|
82
|
+
get offsetMs(): number | null;
|
|
83
|
+
get rttMs(): number | null;
|
|
84
|
+
get uncertaintyMs(): number | null;
|
|
85
|
+
get sampleCount(): number;
|
|
86
|
+
get syncedAt(): number | null;
|
|
87
|
+
state(): ClockState;
|
|
88
|
+
/** A client time (`performance.now()`) on the server's clock, or `null` before the first sample. */
|
|
89
|
+
toServerTime(clientTs: number): number | null;
|
|
90
|
+
/** A server time on this page's `performance.now()` clock, or `null` before the first sample. */
|
|
91
|
+
toClientTime(serverTs: number): number | null;
|
|
92
|
+
/** The server's clock now, as well as it is known. */
|
|
93
|
+
serverNow(): number | null;
|
|
94
|
+
/** Told after every change of the estimate. Returns the unsubscribe. */
|
|
95
|
+
subscribe(listener: () => void): () => void;
|
|
96
|
+
private changed;
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=clock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clock.d.ts","sourceRoot":"","sources":["../../src/client/clock.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,MAAM,WAAW,WAAW;IACxB,kDAAkD;IAClD,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,8DAA8D;IAC9D,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACjB;AAED,kEAAkE;AAClE,MAAM,WAAW,UAAU;IACvB,6EAA6E;IAC7E,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,sDAAsD;IACtD,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,kDAAkD;IAClD,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,+CAA+C;IAC/C,WAAW,EAAE,MAAM,CAAC;IACpB,iEAAiE;IACjE,YAAY,EAAE,MAAM,CAAC;IACrB,8DAA8D;IAC9D,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAED,MAAM,WAAW,kBAAkB;IAC/B,6DAA6D;IAC7D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iDAAiD;IACjD,GAAG,CAAC,EAAE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sDAAsD;IACtD,SAAS,IAAI,MAAM,GAAG,IAAI;IAI1B,wEAAwE;IACxE,SAAS,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI;IAO3C,OAAO,CAAC,OAAO;CASlB"}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* The server's clock, as seen from this page.
|
|
4
|
+
*
|
|
5
|
+
* Client and server times come from different clocks, so the moment a mutation
|
|
6
|
+
* left the browser and the moment the server committed it cannot be put on one
|
|
7
|
+
* axis by subtraction. This estimates the difference NTP-style from exchanges
|
|
8
|
+
* the client starts itself (the hello, then `ping`s):
|
|
9
|
+
*
|
|
10
|
+
* t0 client sends t1 server receives
|
|
11
|
+
* t3 client receives t2 server answers
|
|
12
|
+
*
|
|
13
|
+
* offset = ((t1 - t0) + (t2 - t3)) / 2 server = client + offset
|
|
14
|
+
* rtt = (t3 - t0) - (t2 - t1) the time spent on the wire
|
|
15
|
+
*
|
|
16
|
+
* The true offset lies within `offset ± rtt / 2` of every sample, whatever the
|
|
17
|
+
* asymmetry of the path. A sample with a small round trip is therefore a tight
|
|
18
|
+
* bound, and the estimate is the one with the smallest RTT of the recent ones —
|
|
19
|
+
* a single slow exchange (a busy socket, a radio waking up) does not move it.
|
|
20
|
+
*
|
|
21
|
+
* Client times are `performance.now()`, never `Date.now()`: the page's own
|
|
22
|
+
* monotonic clock, which a user changing the system time — or NTP stepping it
|
|
23
|
+
* — does not move. What can still move is the relation between the two clocks
|
|
24
|
+
* (a suspended laptop, a server whose clock was stepped). A new sample whose
|
|
25
|
+
* bound does not overlap an older one's proves that older one stale, and it is
|
|
26
|
+
* dropped — so the estimate corrects itself on the next exchange instead of
|
|
27
|
+
* clinging to a tight but outdated sample.
|
|
28
|
+
*/
|
|
29
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
+
exports.ServerClock = exports.DEFAULT_CLOCK_MAX_AGE_MS = exports.DEFAULT_CLOCK_SAMPLES = void 0;
|
|
31
|
+
exports.clockSample = clockSample;
|
|
32
|
+
exports.DEFAULT_CLOCK_SAMPLES = 8;
|
|
33
|
+
exports.DEFAULT_CLOCK_MAX_AGE_MS = 5 * 60000;
|
|
34
|
+
/** Bounds of two samples may miss each other by this much and still agree (rounding of whole-ms server times). */
|
|
35
|
+
const AGREEMENT_SLACK_MS = 2;
|
|
36
|
+
function defaultNow() {
|
|
37
|
+
const perf = globalThis.performance;
|
|
38
|
+
return perf ? perf.now() : Date.now();
|
|
39
|
+
}
|
|
40
|
+
/** One exchange, or `null` when it cannot be one (an answer received before it was asked). */
|
|
41
|
+
function clockSample(t0, t1, t2, t3) {
|
|
42
|
+
if (![t0, t1, t2, t3].every(Number.isFinite) || t3 < t0)
|
|
43
|
+
return null;
|
|
44
|
+
// A server that says it answered before it received is taken at its first
|
|
45
|
+
// word: zero time spent there, so the whole interval is the wire's.
|
|
46
|
+
const serverMs = Math.max(0, t2 - t1);
|
|
47
|
+
const rttMs = Math.max(0, t3 - t0 - serverMs);
|
|
48
|
+
const offsetMs = (t1 - t0 + (t1 + serverMs - t3)) / 2;
|
|
49
|
+
return { t0, t1, t2: t1 + serverMs, t3, offsetMs, rttMs };
|
|
50
|
+
}
|
|
51
|
+
function agree(a, b) {
|
|
52
|
+
return Math.abs(a.offsetMs - b.offsetMs) <= (a.rttMs + b.rttMs) / 2 + AGREEMENT_SLACK_MS;
|
|
53
|
+
}
|
|
54
|
+
class ServerClock {
|
|
55
|
+
constructor(opts = {}) {
|
|
56
|
+
this.samples = [];
|
|
57
|
+
this.best = null;
|
|
58
|
+
this.total = 0;
|
|
59
|
+
this.listeners = new Set();
|
|
60
|
+
this.limit = Math.max(1, opts.samples ?? exports.DEFAULT_CLOCK_SAMPLES);
|
|
61
|
+
this.maxAgeMs = opts.maxAgeMs ?? exports.DEFAULT_CLOCK_MAX_AGE_MS;
|
|
62
|
+
this.now = opts.now ?? defaultNow;
|
|
63
|
+
}
|
|
64
|
+
/** Take one exchange into the estimate; returns it, or `null` when it was not usable. */
|
|
65
|
+
addSample(t0, t1, t2, t3) {
|
|
66
|
+
const sample = clockSample(t0, t1, t2, t3);
|
|
67
|
+
if (!sample)
|
|
68
|
+
return null;
|
|
69
|
+
this.total += 1;
|
|
70
|
+
const oldest = sample.t3 - this.maxAgeMs;
|
|
71
|
+
// Newest last. An older sample that contradicts this one belongs to a
|
|
72
|
+
// relation between the clocks that no longer holds.
|
|
73
|
+
this.samples = this.samples.filter((older) => older.t3 >= oldest && agree(older, sample));
|
|
74
|
+
this.samples.push(sample);
|
|
75
|
+
if (this.samples.length > this.limit)
|
|
76
|
+
this.samples.splice(0, this.samples.length - this.limit);
|
|
77
|
+
let best = this.samples[0];
|
|
78
|
+
for (const candidate of this.samples) {
|
|
79
|
+
// Ties go to the newer one: same bound, less drift since.
|
|
80
|
+
if (candidate.rttMs <= best.rttMs)
|
|
81
|
+
best = candidate;
|
|
82
|
+
}
|
|
83
|
+
this.best = best;
|
|
84
|
+
this.changed();
|
|
85
|
+
return sample;
|
|
86
|
+
}
|
|
87
|
+
/** Forget every sample — the estimate starts again with the next one. */
|
|
88
|
+
reset() {
|
|
89
|
+
if (this.samples.length === 0 && this.best === null)
|
|
90
|
+
return;
|
|
91
|
+
this.samples = [];
|
|
92
|
+
this.best = null;
|
|
93
|
+
this.changed();
|
|
94
|
+
}
|
|
95
|
+
get synced() {
|
|
96
|
+
return this.best !== null;
|
|
97
|
+
}
|
|
98
|
+
get offsetMs() {
|
|
99
|
+
return this.best ? this.best.offsetMs : null;
|
|
100
|
+
}
|
|
101
|
+
get rttMs() {
|
|
102
|
+
return this.best ? this.best.rttMs : null;
|
|
103
|
+
}
|
|
104
|
+
get uncertaintyMs() {
|
|
105
|
+
return this.best ? this.best.rttMs / 2 : null;
|
|
106
|
+
}
|
|
107
|
+
get sampleCount() {
|
|
108
|
+
return this.samples.length;
|
|
109
|
+
}
|
|
110
|
+
get syncedAt() {
|
|
111
|
+
const newest = this.samples[this.samples.length - 1];
|
|
112
|
+
return newest ? newest.t3 : null;
|
|
113
|
+
}
|
|
114
|
+
state() {
|
|
115
|
+
return {
|
|
116
|
+
offsetMs: this.offsetMs,
|
|
117
|
+
rttMs: this.rttMs,
|
|
118
|
+
uncertaintyMs: this.uncertaintyMs,
|
|
119
|
+
sampleCount: this.sampleCount,
|
|
120
|
+
totalSamples: this.total,
|
|
121
|
+
syncedAt: this.syncedAt,
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
/** A client time (`performance.now()`) on the server's clock, or `null` before the first sample. */
|
|
125
|
+
toServerTime(clientTs) {
|
|
126
|
+
return this.best ? clientTs + this.best.offsetMs : null;
|
|
127
|
+
}
|
|
128
|
+
/** A server time on this page's `performance.now()` clock, or `null` before the first sample. */
|
|
129
|
+
toClientTime(serverTs) {
|
|
130
|
+
return this.best ? serverTs - this.best.offsetMs : null;
|
|
131
|
+
}
|
|
132
|
+
/** The server's clock now, as well as it is known. */
|
|
133
|
+
serverNow() {
|
|
134
|
+
return this.toServerTime(this.now());
|
|
135
|
+
}
|
|
136
|
+
/** Told after every change of the estimate. Returns the unsubscribe. */
|
|
137
|
+
subscribe(listener) {
|
|
138
|
+
this.listeners.add(listener);
|
|
139
|
+
return () => {
|
|
140
|
+
this.listeners.delete(listener);
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
changed() {
|
|
144
|
+
for (const listener of [...this.listeners]) {
|
|
145
|
+
try {
|
|
146
|
+
listener();
|
|
147
|
+
}
|
|
148
|
+
catch {
|
|
149
|
+
// A listener's failure is not the clock's.
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
exports.ServerClock = ServerClock;
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a browser's Nowity client did, for a developer to look at — the Network
|
|
3
|
+
* tab of the socket.
|
|
4
|
+
*
|
|
5
|
+
* Off unless asked for (`devtools` option or {@link NowityClient.enableDevtools}):
|
|
6
|
+
* a client without a recorder does not measure, serialise or allocate anything
|
|
7
|
+
* for it. With one, every subscribe, mutation and connection event becomes a
|
|
8
|
+
* record in a ring buffer of the last `limit` entries, kept only in this page's
|
|
9
|
+
* memory. Nothing here is sent anywhere.
|
|
10
|
+
*
|
|
11
|
+
* Arguments are masked on the way in, not on the way out: a record never holds a
|
|
12
|
+
* value the allowlist did not let through, so neither the panel nor an export can
|
|
13
|
+
* leak what the recorder never kept. Payloads (rows, mutation results) are not
|
|
14
|
+
* kept at all — only their size.
|
|
15
|
+
*
|
|
16
|
+
* Times are `performance.now()` — milliseconds since the page's navigation
|
|
17
|
+
* started — so the summary reads as the page's own startup: when the socket
|
|
18
|
+
* opened, when the server welcomed it, when the first data arrived.
|
|
19
|
+
*
|
|
20
|
+
* Every record carries the same moment on the server's clock as well
|
|
21
|
+
* (`serverTs`, from the client's {@link ServerClock}), with how far off that may
|
|
22
|
+
* be (`uncertaintyMs`, half the round trip of the sample it rests on). Server
|
|
23
|
+
* phases of a mutation (`meta.server`, `meta.push`) are on the server's clock
|
|
24
|
+
* already, so a click, the commit and the data that came back sit on one axis.
|
|
25
|
+
*/
|
|
26
|
+
import type { MutationTiming, TxTiming } from "../core/protocol";
|
|
27
|
+
import type { ClockState, ServerClock } from "./clock";
|
|
28
|
+
export type DevtoolsRecordType = "ws" | "subscribe" | "mutation";
|
|
29
|
+
export type DevtoolsStatus =
|
|
30
|
+
/** Waiting for the server. */
|
|
31
|
+
"pending" | "ok"
|
|
32
|
+
/** The server refused it (revoked subscription, rejected mutation). */
|
|
33
|
+
| "rejected" | "error"
|
|
34
|
+
/** Unsubscribed. */
|
|
35
|
+
| "closed"
|
|
36
|
+
/** The connection went down before the mutation was answered (`onDisconnect: "drop"`). */
|
|
37
|
+
| "lost";
|
|
38
|
+
/** Why a subscription received data after its first answer. */
|
|
39
|
+
export type DevtoolsUpdateCause = "patch" | "snapshot" | "resubscribe" | "permission-change";
|
|
40
|
+
export interface DevtoolsUpdate {
|
|
41
|
+
ts: number;
|
|
42
|
+
/** `ts` on the server's clock, when it was known. */
|
|
43
|
+
serverTs?: number;
|
|
44
|
+
bytes: number | null;
|
|
45
|
+
cause: DevtoolsUpdateCause;
|
|
46
|
+
/** Resubscribe only: time from the re-sent subscribe to its snapshot. */
|
|
47
|
+
latencyMs?: number;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* One row of the panel. One shape for every type — `type`, `name`, `ts`,
|
|
51
|
+
* `durationMs`, `bytes`, `status` — with what is specific to the type in `meta`.
|
|
52
|
+
*
|
|
53
|
+
* A record is updated in place while it is open (a subscription's first data, a
|
|
54
|
+
* mutation's answer); {@link NowityDevtools.version} moves when it is.
|
|
55
|
+
*/
|
|
56
|
+
export interface DevtoolsRecord {
|
|
57
|
+
/** Sequence number within this recorder. */
|
|
58
|
+
id: number;
|
|
59
|
+
type: DevtoolsRecordType;
|
|
60
|
+
/** `contract.method` for subscribe / mutation, the phase for ws (`open`, `welcome`…). */
|
|
61
|
+
name: string;
|
|
62
|
+
/** When it started, `performance.now()`. */
|
|
63
|
+
ts: number;
|
|
64
|
+
/** `ts` on the server's clock (epoch ms), `null` while the clock is not synced. */
|
|
65
|
+
serverTs: number | null;
|
|
66
|
+
/** How far `serverTs` may be off: ± half the round trip of the clock sample. */
|
|
67
|
+
uncertaintyMs: number | null;
|
|
68
|
+
/** Subscribe → first data, mutate → answer, connect → open… `null` while pending. */
|
|
69
|
+
durationMs: number | null;
|
|
70
|
+
/** Size on the wire in bytes (UTF-8): the first answer, or the message itself. */
|
|
71
|
+
bytes: number | null;
|
|
72
|
+
status: DevtoolsStatus;
|
|
73
|
+
meta: DevtoolsMeta;
|
|
74
|
+
}
|
|
75
|
+
export interface DevtoolsMeta {
|
|
76
|
+
/** Masked arguments (subscribe / mutation). */
|
|
77
|
+
args?: unknown;
|
|
78
|
+
subId?: string;
|
|
79
|
+
mutationId?: number;
|
|
80
|
+
/** Code of a refusal: revoke reason, server error code, rejection message (shortened). */
|
|
81
|
+
code?: string;
|
|
82
|
+
/** The subscription was seeded with server-rendered data before the socket answered. */
|
|
83
|
+
hydrated?: boolean;
|
|
84
|
+
/** Data that arrived after the first answer, newest last (at most {@link UPDATE_LIMIT}). */
|
|
85
|
+
updates?: DevtoolsUpdate[];
|
|
86
|
+
/** All updates, including those dropped from `updates`. */
|
|
87
|
+
updateCount?: number;
|
|
88
|
+
/** Bytes of all updates together. */
|
|
89
|
+
updateBytes?: number;
|
|
90
|
+
unsubscribedAt?: number;
|
|
91
|
+
/** Mutation: time its optimistic half took to run (the rebase on `mutate`). */
|
|
92
|
+
optimisticMs?: number;
|
|
93
|
+
/** Mutation: sent again after a reconnect. */
|
|
94
|
+
resent?: number;
|
|
95
|
+
/** ws: number of the connection this event belongs to (1 = the first socket). */
|
|
96
|
+
connection?: number;
|
|
97
|
+
/** ws `close`: how long the previous connection was up. ws `open` after a drop: how long it was down. */
|
|
98
|
+
upMs?: number;
|
|
99
|
+
downMs?: number;
|
|
100
|
+
/** ws `reconnect`: the delay before the next attempt. */
|
|
101
|
+
delayMs?: number;
|
|
102
|
+
/** ws `error`: the message. */
|
|
103
|
+
message?: string;
|
|
104
|
+
/** Mutation: where it spent its time on the server, the server's clock (only from a server sending timing). */
|
|
105
|
+
server?: MutationTiming;
|
|
106
|
+
/** Mutation: first data that included it arrived, `performance.now()`. */
|
|
107
|
+
dataAt?: number;
|
|
108
|
+
/** Mutation: where that data spent its time on the server, the server's clock. */
|
|
109
|
+
push?: TxTiming;
|
|
110
|
+
}
|
|
111
|
+
/** The page's startup, as the socket saw it. All `performance.now()`, `null` = not yet. */
|
|
112
|
+
export interface DevtoolsSummary {
|
|
113
|
+
/** First `connect()`. */
|
|
114
|
+
connectAt: number | null;
|
|
115
|
+
/** First socket open. */
|
|
116
|
+
openAt: number | null;
|
|
117
|
+
/** First welcome. */
|
|
118
|
+
welcomeAt: number | null;
|
|
119
|
+
/** First subscribe. */
|
|
120
|
+
firstSubscribeAt: number | null;
|
|
121
|
+
/** First data from the server (snapshot of any subscription). */
|
|
122
|
+
firstDataAt: number | null;
|
|
123
|
+
/** Sockets opened in this page. */
|
|
124
|
+
connections: number;
|
|
125
|
+
/** Reconnect attempts scheduled. */
|
|
126
|
+
reconnects: number;
|
|
127
|
+
/** Subscriptions still open / waiting for their first answer. */
|
|
128
|
+
openSubscriptions: number;
|
|
129
|
+
pendingSubscriptions: number;
|
|
130
|
+
pendingMutations: number;
|
|
131
|
+
/** The client's estimate of the server's clock; `null` without one. */
|
|
132
|
+
clock: ClockState | null;
|
|
133
|
+
}
|
|
134
|
+
export interface DevtoolsOptions {
|
|
135
|
+
/** Records kept; the oldest go first. Default 500. */
|
|
136
|
+
limit?: number;
|
|
137
|
+
/**
|
|
138
|
+
* Argument keys whose values are shown as they are, on top of
|
|
139
|
+
* {@link DEFAULT_ALLOWED_KEYS}. Any other string is masked.
|
|
140
|
+
*/
|
|
141
|
+
allowKeys?: string[];
|
|
142
|
+
/**
|
|
143
|
+
* Positional arguments shown as they are, per endpoint: `{ "games.view": [0] }`
|
|
144
|
+
* lets the first argument of `games.view` through. A class-based endpoint's
|
|
145
|
+
* arguments are a list, so this is how its plain id argument is allowed.
|
|
146
|
+
*/
|
|
147
|
+
allowArgs?: Record<string, number[]>;
|
|
148
|
+
/** Replace the masking altogether. Its result is stored as it is — mask in it. */
|
|
149
|
+
mask?: (endpoint: string, args: unknown) => unknown;
|
|
150
|
+
/** Clock, for tests. Default `performance.now()`. */
|
|
151
|
+
now?: () => number;
|
|
152
|
+
/**
|
|
153
|
+
* The server's clock, to stamp `serverTs` with. The client passes its own
|
|
154
|
+
* ({@link NowityClient.clock}); a recorder without one has `serverTs: null`.
|
|
155
|
+
*/
|
|
156
|
+
clock?: ServerClock;
|
|
157
|
+
}
|
|
158
|
+
/** One step of a mutation, on the server's clock. */
|
|
159
|
+
export interface DevtoolsPhase {
|
|
160
|
+
name: "sent" | "received" | "started" | "committed" | "answered" | "written" | "read" | "fanOut" | "pushed" | "data";
|
|
161
|
+
/** Where it was measured: here, on the sync server, or in the database. */
|
|
162
|
+
clock: "client" | "server" | "database";
|
|
163
|
+
/** Epoch ms, the server's clock (a client time converted, `± uncertaintyMs`). */
|
|
164
|
+
serverTs: number;
|
|
165
|
+
/** From `sent`, on that axis. */
|
|
166
|
+
offsetMs: number;
|
|
167
|
+
/** Client times only: how far the conversion may be off. */
|
|
168
|
+
uncertaintyMs: number | null;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* The steps of one mutation on one axis, the server's clock: sent → received →
|
|
172
|
+
* started → committed → answered, then written → read → fan-out → pushed →
|
|
173
|
+
* data. A client time is converted with the offset the record was stamped
|
|
174
|
+
* with, so a later change of the estimate does not tear one record apart.
|
|
175
|
+
* Sorted by time; empty before the clock is synced. Pure, for tests and panel.
|
|
176
|
+
*/
|
|
177
|
+
export declare function mutationPhases(record: DevtoolsRecord): DevtoolsPhase[];
|
|
178
|
+
export declare const DEFAULT_LIMIT = 500;
|
|
179
|
+
/** Updates kept per subscription; the count goes on. */
|
|
180
|
+
export declare const UPDATE_LIMIT = 50;
|
|
181
|
+
/**
|
|
182
|
+
* Keys a value is shown under by default: identifiers and paging, never content.
|
|
183
|
+
* A key that ends in `Id` / `Ids` counts too. A string under any other key is
|
|
184
|
+
* masked — names, e-mails, tokens and message text all arrive as strings.
|
|
185
|
+
*/
|
|
186
|
+
export declare const DEFAULT_ALLOWED_KEYS: readonly string[];
|
|
187
|
+
/** What a masked string becomes. Its length is not kept either. */
|
|
188
|
+
export declare const MASKED = "\u2022\u2022\u2022";
|
|
189
|
+
/**
|
|
190
|
+
* Mask arguments for the record.
|
|
191
|
+
*
|
|
192
|
+
* Numbers, booleans and `null` stay — they are counts, flags and paging. A
|
|
193
|
+
* string stays only under an allowed key (or at an allowed position of the
|
|
194
|
+
* top-level list); every other string becomes {@link MASKED}. Deep structures
|
|
195
|
+
* are cut off rather than walked, and a key that looks sensitive (`email`,
|
|
196
|
+
* `token`…) is masked even when it ends in `Id`, unless the application listed
|
|
197
|
+
* it explicitly.
|
|
198
|
+
*/
|
|
199
|
+
export declare function maskArgs(endpoint: string, args: unknown, opts?: Pick<DevtoolsOptions, "allowKeys" | "allowArgs">): unknown;
|
|
200
|
+
/** UTF-8 size of a string, without allocating an encoded copy. */
|
|
201
|
+
export declare function byteSize(text: string): number;
|
|
202
|
+
/** Size of a value as JSON on the wire. */
|
|
203
|
+
export declare function jsonBytes(value: unknown): number;
|
|
204
|
+
/**
|
|
205
|
+
* The recorder. The client calls the `on*` methods; a panel reads
|
|
206
|
+
* {@link records}, {@link summary} and listens with {@link subscribe}.
|
|
207
|
+
*/
|
|
208
|
+
export declare class NowityDevtools {
|
|
209
|
+
private readonly limit;
|
|
210
|
+
private readonly now;
|
|
211
|
+
private readonly opts;
|
|
212
|
+
private list;
|
|
213
|
+
private seq;
|
|
214
|
+
private rev;
|
|
215
|
+
private readonly listeners;
|
|
216
|
+
private notifyQueued;
|
|
217
|
+
private readonly subs;
|
|
218
|
+
/** Re-sent subscribes waiting for their snapshot: subId → when. */
|
|
219
|
+
private readonly resubscribedAt;
|
|
220
|
+
private readonly mutations;
|
|
221
|
+
/** Answered mutations whose data has not arrived yet. */
|
|
222
|
+
private readonly awaitingData;
|
|
223
|
+
private readonly clock;
|
|
224
|
+
private readonly stopClock;
|
|
225
|
+
private connection;
|
|
226
|
+
private connectAt;
|
|
227
|
+
private openedAt;
|
|
228
|
+
private closedAt;
|
|
229
|
+
private readonly startup;
|
|
230
|
+
constructor(opts?: DevtoolsOptions);
|
|
231
|
+
/** Stop following the clock. The records stay. */
|
|
232
|
+
dispose(): void;
|
|
233
|
+
/** Records, oldest first. A new array whenever {@link version} moves. */
|
|
234
|
+
get records(): readonly DevtoolsRecord[];
|
|
235
|
+
/** Moves on every change — the snapshot for `useSyncExternalStore`. */
|
|
236
|
+
get version(): number;
|
|
237
|
+
summary(): DevtoolsSummary;
|
|
238
|
+
/** Listen for changes; batched to one call per microtask. Returns the unsubscribe. */
|
|
239
|
+
subscribe(listener: () => void): () => void;
|
|
240
|
+
/** Forget the records. Open subscriptions and mutations keep being tracked, as new rows. */
|
|
241
|
+
clear(): void;
|
|
242
|
+
/** Everything as JSON — masked already, ready to paste into an issue. */
|
|
243
|
+
export(): string;
|
|
244
|
+
onConnect(): void;
|
|
245
|
+
onOpen(): void;
|
|
246
|
+
onHello(bytes: number | null): void;
|
|
247
|
+
onWelcome(bytes: number | null): void;
|
|
248
|
+
onClose(intentional: boolean): void;
|
|
249
|
+
onReconnectScheduled(delayMs: number): void;
|
|
250
|
+
onTransportError(message: string): void;
|
|
251
|
+
onSubscribe(subId: string, query: string, args: unknown, hydrated: boolean): void;
|
|
252
|
+
/** All subscriptions were sent again after a reconnect. */
|
|
253
|
+
onResubscribe(subId: string): void;
|
|
254
|
+
/** A snapshot for `subId` — the first answer, a resubscribe, or a permission change. */
|
|
255
|
+
onSnapshot(subId: string, bytes: number | null, permissionChange: boolean): void;
|
|
256
|
+
onPatch(subId: string, bytes: number | null): void;
|
|
257
|
+
/** Revoked (`rejected`) or failed (`error`). */
|
|
258
|
+
onSubscriptionRefused(subId: string, status: "rejected" | "error", code: string): void;
|
|
259
|
+
onUnsubscribe(subId: string): void;
|
|
260
|
+
onMutate(mutationId: number, name: string, args: unknown, bytes: number | null, optimisticMs: number | null): void;
|
|
261
|
+
onMutationResent(mutationId: number): void;
|
|
262
|
+
onMutationResult(mutationId: number, ok: boolean, error: string | undefined, timing?: MutationTiming): void;
|
|
263
|
+
/**
|
|
264
|
+
* Data arrived that includes every mutation up to `lastMutationId` — the
|
|
265
|
+
* first such data is where a mutation's round ends. `timing` is the
|
|
266
|
+
* server's side of it, when the server sends timing.
|
|
267
|
+
*/
|
|
268
|
+
onData(lastMutationId: number, timing: TxTiming | undefined): void;
|
|
269
|
+
/** Acknowledged by data after a reconnect, its own result lost with the old socket. */
|
|
270
|
+
onMutationSettled(mutationId: number): void;
|
|
271
|
+
onMutationLost(mutationId: number): void;
|
|
272
|
+
private mask;
|
|
273
|
+
private update;
|
|
274
|
+
private add;
|
|
275
|
+
/** `serverTs` / `uncertaintyMs` from the clock as it is now. */
|
|
276
|
+
private stamp;
|
|
277
|
+
/** Give records from before the first clock sample their server time. */
|
|
278
|
+
private backfill;
|
|
279
|
+
private changed;
|
|
280
|
+
}
|
|
281
|
+
//# sourceMappingURL=devtools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"devtools.d.ts","sourceRoot":"","sources":["../../src/client/devtools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAGvD,MAAM,MAAM,kBAAkB,GAAG,IAAI,GAAG,WAAW,GAAG,UAAU,CAAC;AAEjE,MAAM,MAAM,cAAc;AACtB,8BAA8B;AAC5B,SAAS,GACT,IAAI;AACN,uEAAuE;GACrE,UAAU,GACV,OAAO;AACT,oBAAoB;GAClB,QAAQ;AACV,0FAA0F;GACxF,MAAM,CAAC;AAEb,+DAA+D;AAC/D,MAAM,MAAM,mBAAmB,GAAG,OAAO,GAAG,UAAU,GAAG,aAAa,GAAG,mBAAmB,CAAC;AAE7F,MAAM,WAAW,cAAc;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,qDAAqD;IACrD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,KAAK,EAAE,mBAAmB,CAAC;IAC3B,yEAAyE;IACzE,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,cAAc;IAC3B,4CAA4C;IAC5C,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,kBAAkB,CAAC;IACzB,yFAAyF;IACzF,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