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
|
@@ -0,0 +1,556 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NowityDevtools = exports.MASKED = exports.DEFAULT_ALLOWED_KEYS = exports.UPDATE_LIMIT = exports.DEFAULT_LIMIT = void 0;
|
|
4
|
+
exports.mutationPhases = mutationPhases;
|
|
5
|
+
exports.maskArgs = maskArgs;
|
|
6
|
+
exports.byteSize = byteSize;
|
|
7
|
+
exports.jsonBytes = jsonBytes;
|
|
8
|
+
/** Records waiting for the data that includes them, at most. */
|
|
9
|
+
const AWAITING_DATA_LIMIT = 100;
|
|
10
|
+
/**
|
|
11
|
+
* How long after its answer a mutation still waits for its data. A mutation
|
|
12
|
+
* that wrote nothing tracked gets no push of its own, and without a limit the
|
|
13
|
+
* next unrelated one — whose `lastMutationId` covers it too — would be shown as
|
|
14
|
+
* its push.
|
|
15
|
+
*/
|
|
16
|
+
const AWAITING_DATA_MS = 10000;
|
|
17
|
+
/**
|
|
18
|
+
* The steps of one mutation on one axis, the server's clock: sent → received →
|
|
19
|
+
* started → committed → answered, then written → read → fan-out → pushed →
|
|
20
|
+
* data. A client time is converted with the offset the record was stamped
|
|
21
|
+
* with, so a later change of the estimate does not tear one record apart.
|
|
22
|
+
* Sorted by time; empty before the clock is synced. Pure, for tests and panel.
|
|
23
|
+
*/
|
|
24
|
+
function mutationPhases(record) {
|
|
25
|
+
if (record.type !== "mutation" || record.serverTs === null)
|
|
26
|
+
return [];
|
|
27
|
+
const offset = record.serverTs - record.ts;
|
|
28
|
+
const sent = record.serverTs;
|
|
29
|
+
const uncertainty = record.uncertaintyMs;
|
|
30
|
+
const out = [];
|
|
31
|
+
const client = (name, ts) => {
|
|
32
|
+
if (ts === null || ts === undefined)
|
|
33
|
+
return;
|
|
34
|
+
out.push({ name, clock: "client", serverTs: ts + offset, offsetMs: round(ts + offset - sent), uncertaintyMs: uncertainty });
|
|
35
|
+
};
|
|
36
|
+
const server = (name, ts, clock = "server") => {
|
|
37
|
+
if (ts === undefined || !Number.isFinite(ts))
|
|
38
|
+
return;
|
|
39
|
+
out.push({ name, clock, serverTs: ts, offsetMs: round(ts - sent), uncertaintyMs: null });
|
|
40
|
+
};
|
|
41
|
+
client("sent", record.ts);
|
|
42
|
+
const timing = record.meta.server;
|
|
43
|
+
server("received", timing?.receivedAt);
|
|
44
|
+
server("started", timing?.startedAt);
|
|
45
|
+
server("committed", timing?.committedAt);
|
|
46
|
+
client("answered", record.durationMs === null ? null : record.ts + record.durationMs);
|
|
47
|
+
const push = record.meta.push;
|
|
48
|
+
server("written", push?.writtenAt, "database");
|
|
49
|
+
server("read", push?.readAt);
|
|
50
|
+
server("fanOut", push?.fanOutAt);
|
|
51
|
+
server("pushed", push?.sentAt);
|
|
52
|
+
client("data", record.meta.dataAt);
|
|
53
|
+
return out.sort((a, b) => a.serverTs - b.serverTs);
|
|
54
|
+
}
|
|
55
|
+
exports.DEFAULT_LIMIT = 500;
|
|
56
|
+
/** Updates kept per subscription; the count goes on. */
|
|
57
|
+
exports.UPDATE_LIMIT = 50;
|
|
58
|
+
/**
|
|
59
|
+
* Keys a value is shown under by default: identifiers and paging, never content.
|
|
60
|
+
* A key that ends in `Id` / `Ids` counts too. A string under any other key is
|
|
61
|
+
* masked — names, e-mails, tokens and message text all arrive as strings.
|
|
62
|
+
*/
|
|
63
|
+
exports.DEFAULT_ALLOWED_KEYS = [
|
|
64
|
+
"id",
|
|
65
|
+
"ids",
|
|
66
|
+
"page",
|
|
67
|
+
"limit",
|
|
68
|
+
"offset",
|
|
69
|
+
"cursor",
|
|
70
|
+
"take",
|
|
71
|
+
"skip",
|
|
72
|
+
"kind",
|
|
73
|
+
"type",
|
|
74
|
+
"status",
|
|
75
|
+
"mode",
|
|
76
|
+
"period",
|
|
77
|
+
];
|
|
78
|
+
/** What a masked string becomes. Its length is not kept either. */
|
|
79
|
+
exports.MASKED = "•••";
|
|
80
|
+
const MAX_DEPTH = 4;
|
|
81
|
+
const MAX_ITEMS = 20;
|
|
82
|
+
const SENSITIVE_KEY = /pass|secret|token|cookie|auth|session|email|e-mail|mail|phone|name|text|message|body|content|note/i;
|
|
83
|
+
function allowedKey(key, extra) {
|
|
84
|
+
if (SENSITIVE_KEY.test(key) && !extra.has(key))
|
|
85
|
+
return false;
|
|
86
|
+
return exports.DEFAULT_ALLOWED_KEYS.includes(key) || extra.has(key) || /(^|[a-z])Ids?$/.test(key);
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Mask arguments for the record.
|
|
90
|
+
*
|
|
91
|
+
* Numbers, booleans and `null` stay — they are counts, flags and paging. A
|
|
92
|
+
* string stays only under an allowed key (or at an allowed position of the
|
|
93
|
+
* top-level list); every other string becomes {@link MASKED}. Deep structures
|
|
94
|
+
* are cut off rather than walked, and a key that looks sensitive (`email`,
|
|
95
|
+
* `token`…) is masked even when it ends in `Id`, unless the application listed
|
|
96
|
+
* it explicitly.
|
|
97
|
+
*/
|
|
98
|
+
function maskArgs(endpoint, args, opts = {}) {
|
|
99
|
+
const extra = new Set(opts.allowKeys ?? []);
|
|
100
|
+
const positions = new Set(opts.allowArgs?.[endpoint] ?? []);
|
|
101
|
+
const walk = (value, allowed, depth) => {
|
|
102
|
+
if (value === null || value === undefined)
|
|
103
|
+
return value ?? null;
|
|
104
|
+
switch (typeof value) {
|
|
105
|
+
case "number":
|
|
106
|
+
case "boolean":
|
|
107
|
+
return value;
|
|
108
|
+
case "string":
|
|
109
|
+
return allowed ? value : exports.MASKED;
|
|
110
|
+
case "bigint":
|
|
111
|
+
return allowed ? String(value) : exports.MASKED;
|
|
112
|
+
case "object":
|
|
113
|
+
break;
|
|
114
|
+
default:
|
|
115
|
+
return exports.MASKED;
|
|
116
|
+
}
|
|
117
|
+
if (depth >= MAX_DEPTH)
|
|
118
|
+
return "…";
|
|
119
|
+
if (Array.isArray(value)) {
|
|
120
|
+
const items = value.slice(0, MAX_ITEMS).map((item) => walk(item, allowed, depth + 1));
|
|
121
|
+
if (value.length > MAX_ITEMS)
|
|
122
|
+
items.push(`… +${value.length - MAX_ITEMS}`);
|
|
123
|
+
return items;
|
|
124
|
+
}
|
|
125
|
+
if (value instanceof Date)
|
|
126
|
+
return allowed ? value.toISOString() : exports.MASKED;
|
|
127
|
+
const out = {};
|
|
128
|
+
let count = 0;
|
|
129
|
+
for (const [key, item] of Object.entries(value)) {
|
|
130
|
+
if (count++ >= MAX_ITEMS) {
|
|
131
|
+
out["…"] = `+${Object.keys(value).length - MAX_ITEMS}`;
|
|
132
|
+
break;
|
|
133
|
+
}
|
|
134
|
+
out[key] = walk(item, allowedKey(key, extra), depth + 1);
|
|
135
|
+
}
|
|
136
|
+
return out;
|
|
137
|
+
};
|
|
138
|
+
if (Array.isArray(args)) {
|
|
139
|
+
return args.slice(0, MAX_ITEMS).map((item, index) => walk(item, positions.has(index), 1));
|
|
140
|
+
}
|
|
141
|
+
return walk(args, false, 0);
|
|
142
|
+
}
|
|
143
|
+
/** UTF-8 size of a string, without allocating an encoded copy. */
|
|
144
|
+
function byteSize(text) {
|
|
145
|
+
let bytes = 0;
|
|
146
|
+
for (let i = 0; i < text.length; i++) {
|
|
147
|
+
const code = text.charCodeAt(i);
|
|
148
|
+
if (code < 0x80)
|
|
149
|
+
bytes += 1;
|
|
150
|
+
else if (code < 0x800)
|
|
151
|
+
bytes += 2;
|
|
152
|
+
else if (code >= 0xd800 && code <= 0xdbff) {
|
|
153
|
+
bytes += 4;
|
|
154
|
+
i++;
|
|
155
|
+
}
|
|
156
|
+
else
|
|
157
|
+
bytes += 3;
|
|
158
|
+
}
|
|
159
|
+
return bytes;
|
|
160
|
+
}
|
|
161
|
+
/** Size of a value as JSON on the wire. */
|
|
162
|
+
function jsonBytes(value) {
|
|
163
|
+
return byteSize(JSON.stringify(value) ?? "");
|
|
164
|
+
}
|
|
165
|
+
function defaultNow() {
|
|
166
|
+
const perf = globalThis.performance;
|
|
167
|
+
return perf ? perf.now() : Date.now();
|
|
168
|
+
}
|
|
169
|
+
function round(ms) {
|
|
170
|
+
return Math.round(ms * 10) / 10;
|
|
171
|
+
}
|
|
172
|
+
function shorten(text) {
|
|
173
|
+
return text.length > 120 ? `${text.slice(0, 117)}…` : text;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* The recorder. The client calls the `on*` methods; a panel reads
|
|
177
|
+
* {@link records}, {@link summary} and listens with {@link subscribe}.
|
|
178
|
+
*/
|
|
179
|
+
class NowityDevtools {
|
|
180
|
+
constructor(opts = {}) {
|
|
181
|
+
this.list = [];
|
|
182
|
+
this.seq = 0;
|
|
183
|
+
this.rev = 0;
|
|
184
|
+
this.listeners = new Set();
|
|
185
|
+
this.notifyQueued = false;
|
|
186
|
+
this.subs = new Map();
|
|
187
|
+
/** Re-sent subscribes waiting for their snapshot: subId → when. */
|
|
188
|
+
this.resubscribedAt = new Map();
|
|
189
|
+
this.mutations = new Map();
|
|
190
|
+
/** Answered mutations whose data has not arrived yet. */
|
|
191
|
+
this.awaitingData = new Map();
|
|
192
|
+
this.connection = 0;
|
|
193
|
+
this.connectAt = null;
|
|
194
|
+
this.openedAt = null;
|
|
195
|
+
this.closedAt = null;
|
|
196
|
+
this.startup = {
|
|
197
|
+
connectAt: null,
|
|
198
|
+
openAt: null,
|
|
199
|
+
welcomeAt: null,
|
|
200
|
+
firstSubscribeAt: null,
|
|
201
|
+
firstDataAt: null,
|
|
202
|
+
connections: 0,
|
|
203
|
+
reconnects: 0,
|
|
204
|
+
};
|
|
205
|
+
this.opts = opts;
|
|
206
|
+
this.limit = Math.max(1, opts.limit ?? exports.DEFAULT_LIMIT);
|
|
207
|
+
this.now = opts.now ?? defaultNow;
|
|
208
|
+
this.clock = opts.clock ?? null;
|
|
209
|
+
// Records made before the first sample get their server time with it.
|
|
210
|
+
this.stopClock = this.clock ? this.clock.subscribe(() => this.backfill()) : null;
|
|
211
|
+
}
|
|
212
|
+
/** Stop following the clock. The records stay. */
|
|
213
|
+
dispose() {
|
|
214
|
+
this.stopClock?.();
|
|
215
|
+
}
|
|
216
|
+
// ------------------------------------------------------------------- reading
|
|
217
|
+
/** Records, oldest first. A new array whenever {@link version} moves. */
|
|
218
|
+
get records() {
|
|
219
|
+
return this.list;
|
|
220
|
+
}
|
|
221
|
+
/** Moves on every change — the snapshot for `useSyncExternalStore`. */
|
|
222
|
+
get version() {
|
|
223
|
+
return this.rev;
|
|
224
|
+
}
|
|
225
|
+
summary() {
|
|
226
|
+
let open = 0;
|
|
227
|
+
let pending = 0;
|
|
228
|
+
for (const record of this.subs.values()) {
|
|
229
|
+
open++;
|
|
230
|
+
if (record.status === "pending")
|
|
231
|
+
pending++;
|
|
232
|
+
}
|
|
233
|
+
return {
|
|
234
|
+
...this.startup,
|
|
235
|
+
openSubscriptions: open,
|
|
236
|
+
pendingSubscriptions: pending,
|
|
237
|
+
pendingMutations: this.mutations.size,
|
|
238
|
+
clock: this.clock ? this.clock.state() : null,
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
/** Listen for changes; batched to one call per microtask. Returns the unsubscribe. */
|
|
242
|
+
subscribe(listener) {
|
|
243
|
+
this.listeners.add(listener);
|
|
244
|
+
return () => {
|
|
245
|
+
this.listeners.delete(listener);
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
/** Forget the records. Open subscriptions and mutations keep being tracked, as new rows. */
|
|
249
|
+
clear() {
|
|
250
|
+
this.list = [];
|
|
251
|
+
this.subs.clear();
|
|
252
|
+
this.mutations.clear();
|
|
253
|
+
this.awaitingData.clear();
|
|
254
|
+
this.resubscribedAt.clear();
|
|
255
|
+
this.changed();
|
|
256
|
+
}
|
|
257
|
+
/** Everything as JSON — masked already, ready to paste into an issue. */
|
|
258
|
+
export() {
|
|
259
|
+
return JSON.stringify({ summary: this.summary(), records: this.list }, null, 2);
|
|
260
|
+
}
|
|
261
|
+
// -------------------------------------------------------------- connection
|
|
262
|
+
onConnect() {
|
|
263
|
+
var _a;
|
|
264
|
+
const ts = this.now();
|
|
265
|
+
this.connectAt = ts;
|
|
266
|
+
(_a = this.startup).connectAt ?? (_a.connectAt = ts);
|
|
267
|
+
this.add({ type: "ws", name: "connect", ts, durationMs: null, bytes: null, status: "pending", meta: {} });
|
|
268
|
+
}
|
|
269
|
+
onOpen() {
|
|
270
|
+
var _a;
|
|
271
|
+
const ts = this.now();
|
|
272
|
+
this.connection += 1;
|
|
273
|
+
this.startup.connections = this.connection;
|
|
274
|
+
(_a = this.startup).openAt ?? (_a.openAt = ts);
|
|
275
|
+
const meta = { connection: this.connection };
|
|
276
|
+
if (this.closedAt !== null)
|
|
277
|
+
meta.downMs = round(ts - this.closedAt);
|
|
278
|
+
this.openedAt = ts;
|
|
279
|
+
this.closedAt = null;
|
|
280
|
+
const since = this.connectAt ?? ts;
|
|
281
|
+
this.add({ type: "ws", name: "open", ts: since, durationMs: round(ts - since), bytes: null, status: "ok", meta });
|
|
282
|
+
}
|
|
283
|
+
onHello(bytes) {
|
|
284
|
+
this.add({
|
|
285
|
+
type: "ws",
|
|
286
|
+
name: "hello",
|
|
287
|
+
ts: this.now(),
|
|
288
|
+
durationMs: null,
|
|
289
|
+
bytes,
|
|
290
|
+
status: "ok",
|
|
291
|
+
meta: { connection: this.connection },
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
onWelcome(bytes) {
|
|
295
|
+
var _a;
|
|
296
|
+
const ts = this.now();
|
|
297
|
+
(_a = this.startup).welcomeAt ?? (_a.welcomeAt = ts);
|
|
298
|
+
const since = this.openedAt ?? ts;
|
|
299
|
+
this.add({
|
|
300
|
+
type: "ws",
|
|
301
|
+
name: "welcome",
|
|
302
|
+
ts: since,
|
|
303
|
+
durationMs: round(ts - since),
|
|
304
|
+
bytes,
|
|
305
|
+
status: "ok",
|
|
306
|
+
meta: { connection: this.connection },
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
onClose(intentional) {
|
|
310
|
+
const ts = this.now();
|
|
311
|
+
const meta = { connection: this.connection };
|
|
312
|
+
if (this.openedAt !== null)
|
|
313
|
+
meta.upMs = round(ts - this.openedAt);
|
|
314
|
+
this.openedAt = null;
|
|
315
|
+
this.closedAt = ts;
|
|
316
|
+
this.add({ type: "ws", name: intentional ? "close" : "disconnect", ts, durationMs: null, bytes: null, status: intentional ? "closed" : "error", meta });
|
|
317
|
+
}
|
|
318
|
+
onReconnectScheduled(delayMs) {
|
|
319
|
+
this.startup.reconnects += 1;
|
|
320
|
+
this.add({ type: "ws", name: "reconnect", ts: this.now(), durationMs: null, bytes: null, status: "pending", meta: { delayMs } });
|
|
321
|
+
}
|
|
322
|
+
onTransportError(message) {
|
|
323
|
+
this.add({ type: "ws", name: "error", ts: this.now(), durationMs: null, bytes: null, status: "error", meta: { message: shorten(message) } });
|
|
324
|
+
}
|
|
325
|
+
// ------------------------------------------------------------ subscriptions
|
|
326
|
+
onSubscribe(subId, query, args, hydrated) {
|
|
327
|
+
var _a;
|
|
328
|
+
const ts = this.now();
|
|
329
|
+
(_a = this.startup).firstSubscribeAt ?? (_a.firstSubscribeAt = ts);
|
|
330
|
+
const meta = { subId, args: this.mask(query, args), updateCount: 0, updateBytes: 0, updates: [] };
|
|
331
|
+
if (hydrated)
|
|
332
|
+
meta.hydrated = true;
|
|
333
|
+
const record = { id: 0, type: "subscribe", name: query, ts, serverTs: null, uncertaintyMs: null, durationMs: null, bytes: null, status: "pending", meta };
|
|
334
|
+
this.subs.set(subId, record);
|
|
335
|
+
this.add(record);
|
|
336
|
+
}
|
|
337
|
+
/** All subscriptions were sent again after a reconnect. */
|
|
338
|
+
onResubscribe(subId) {
|
|
339
|
+
if (this.subs.has(subId))
|
|
340
|
+
this.resubscribedAt.set(subId, this.now());
|
|
341
|
+
}
|
|
342
|
+
/** A snapshot for `subId` — the first answer, a resubscribe, or a permission change. */
|
|
343
|
+
onSnapshot(subId, bytes, permissionChange) {
|
|
344
|
+
var _a;
|
|
345
|
+
const record = this.subs.get(subId);
|
|
346
|
+
if (!record)
|
|
347
|
+
return;
|
|
348
|
+
const ts = this.now();
|
|
349
|
+
if (record.durationMs === null) {
|
|
350
|
+
(_a = this.startup).firstDataAt ?? (_a.firstDataAt = ts);
|
|
351
|
+
record.durationMs = round(ts - record.ts);
|
|
352
|
+
record.bytes = bytes;
|
|
353
|
+
record.status = "ok";
|
|
354
|
+
this.resubscribedAt.delete(subId);
|
|
355
|
+
this.changed();
|
|
356
|
+
return;
|
|
357
|
+
}
|
|
358
|
+
const resubscribed = this.resubscribedAt.get(subId);
|
|
359
|
+
if (resubscribed !== undefined) {
|
|
360
|
+
this.resubscribedAt.delete(subId);
|
|
361
|
+
if (record.status !== "closed")
|
|
362
|
+
record.status = "ok";
|
|
363
|
+
this.update(record, { ts, bytes, cause: "resubscribe", latencyMs: round(ts - resubscribed) });
|
|
364
|
+
return;
|
|
365
|
+
}
|
|
366
|
+
if (permissionChange && record.status === "rejected")
|
|
367
|
+
record.status = "ok";
|
|
368
|
+
this.update(record, { ts, bytes, cause: permissionChange ? "permission-change" : "snapshot" });
|
|
369
|
+
}
|
|
370
|
+
onPatch(subId, bytes) {
|
|
371
|
+
const record = this.subs.get(subId);
|
|
372
|
+
if (!record)
|
|
373
|
+
return;
|
|
374
|
+
this.update(record, { ts: this.now(), bytes, cause: "patch" });
|
|
375
|
+
}
|
|
376
|
+
/** Revoked (`rejected`) or failed (`error`). */
|
|
377
|
+
onSubscriptionRefused(subId, status, code) {
|
|
378
|
+
var _a;
|
|
379
|
+
const record = this.subs.get(subId);
|
|
380
|
+
if (!record)
|
|
381
|
+
return;
|
|
382
|
+
const ts = this.now();
|
|
383
|
+
if (record.durationMs === null) {
|
|
384
|
+
(_a = this.startup).firstDataAt ?? (_a.firstDataAt = ts);
|
|
385
|
+
record.durationMs = round(ts - record.ts);
|
|
386
|
+
}
|
|
387
|
+
record.status = status;
|
|
388
|
+
record.meta.code = shorten(code);
|
|
389
|
+
this.resubscribedAt.delete(subId);
|
|
390
|
+
this.changed();
|
|
391
|
+
}
|
|
392
|
+
onUnsubscribe(subId) {
|
|
393
|
+
const record = this.subs.get(subId);
|
|
394
|
+
if (!record)
|
|
395
|
+
return;
|
|
396
|
+
this.subs.delete(subId);
|
|
397
|
+
this.resubscribedAt.delete(subId);
|
|
398
|
+
record.meta.unsubscribedAt = this.now();
|
|
399
|
+
if (record.status === "pending" || record.status === "ok")
|
|
400
|
+
record.status = "closed";
|
|
401
|
+
this.changed();
|
|
402
|
+
}
|
|
403
|
+
// ---------------------------------------------------------------- mutations
|
|
404
|
+
onMutate(mutationId, name, args, bytes, optimisticMs) {
|
|
405
|
+
const meta = { mutationId, args: this.mask(name, args) };
|
|
406
|
+
if (optimisticMs !== null)
|
|
407
|
+
meta.optimisticMs = round(optimisticMs);
|
|
408
|
+
const record = { id: 0, type: "mutation", name, ts: this.now(), serverTs: null, uncertaintyMs: null, durationMs: null, bytes, status: "pending", meta };
|
|
409
|
+
this.mutations.set(mutationId, record);
|
|
410
|
+
this.add(record);
|
|
411
|
+
}
|
|
412
|
+
onMutationResent(mutationId) {
|
|
413
|
+
const record = this.mutations.get(mutationId);
|
|
414
|
+
if (!record)
|
|
415
|
+
return;
|
|
416
|
+
record.meta.resent = (record.meta.resent ?? 0) + 1;
|
|
417
|
+
this.changed();
|
|
418
|
+
}
|
|
419
|
+
onMutationResult(mutationId, ok, error, timing) {
|
|
420
|
+
const record = this.mutations.get(mutationId);
|
|
421
|
+
if (!record)
|
|
422
|
+
return;
|
|
423
|
+
this.mutations.delete(mutationId);
|
|
424
|
+
record.durationMs = round(this.now() - record.ts);
|
|
425
|
+
record.status = ok ? "ok" : "rejected";
|
|
426
|
+
if (!ok && error)
|
|
427
|
+
record.meta.code = shorten(error);
|
|
428
|
+
if (timing)
|
|
429
|
+
record.meta.server = { ...timing };
|
|
430
|
+
if (ok && record.meta.dataAt === undefined && record.meta.resent === undefined) {
|
|
431
|
+
this.awaitingData.set(mutationId, record);
|
|
432
|
+
if (this.awaitingData.size > AWAITING_DATA_LIMIT) {
|
|
433
|
+
const oldest = this.awaitingData.keys().next().value;
|
|
434
|
+
this.awaitingData.delete(oldest);
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
this.changed();
|
|
438
|
+
}
|
|
439
|
+
/**
|
|
440
|
+
* Data arrived that includes every mutation up to `lastMutationId` — the
|
|
441
|
+
* first such data is where a mutation's round ends. `timing` is the
|
|
442
|
+
* server's side of it, when the server sends timing.
|
|
443
|
+
*/
|
|
444
|
+
onData(lastMutationId, timing) {
|
|
445
|
+
let touched = false;
|
|
446
|
+
const ts = round(this.now());
|
|
447
|
+
const reach = (record) => {
|
|
448
|
+
record.meta.dataAt = ts;
|
|
449
|
+
if (timing)
|
|
450
|
+
record.meta.push = { ...timing };
|
|
451
|
+
touched = true;
|
|
452
|
+
};
|
|
453
|
+
for (const [mutationId, record] of this.awaitingData) {
|
|
454
|
+
const answeredAt = record.ts + (record.durationMs ?? 0);
|
|
455
|
+
if (ts - answeredAt > AWAITING_DATA_MS) {
|
|
456
|
+
this.awaitingData.delete(mutationId);
|
|
457
|
+
continue;
|
|
458
|
+
}
|
|
459
|
+
if (mutationId > lastMutationId)
|
|
460
|
+
continue;
|
|
461
|
+
this.awaitingData.delete(mutationId);
|
|
462
|
+
reach(record);
|
|
463
|
+
}
|
|
464
|
+
// The data may overtake the answer; the answer then finds it there.
|
|
465
|
+
for (const [mutationId, record] of this.mutations) {
|
|
466
|
+
if (mutationId <= lastMutationId && record.meta.dataAt === undefined)
|
|
467
|
+
reach(record);
|
|
468
|
+
}
|
|
469
|
+
if (touched)
|
|
470
|
+
this.changed();
|
|
471
|
+
}
|
|
472
|
+
/** Acknowledged by data after a reconnect, its own result lost with the old socket. */
|
|
473
|
+
onMutationSettled(mutationId) {
|
|
474
|
+
this.onMutationResult(mutationId, true, undefined);
|
|
475
|
+
}
|
|
476
|
+
onMutationLost(mutationId) {
|
|
477
|
+
const record = this.mutations.get(mutationId);
|
|
478
|
+
if (!record)
|
|
479
|
+
return;
|
|
480
|
+
this.mutations.delete(mutationId);
|
|
481
|
+
this.awaitingData.delete(mutationId);
|
|
482
|
+
record.status = "lost";
|
|
483
|
+
this.changed();
|
|
484
|
+
}
|
|
485
|
+
// ------------------------------------------------------------------ internal
|
|
486
|
+
mask(endpoint, args) {
|
|
487
|
+
try {
|
|
488
|
+
return this.opts.mask ? this.opts.mask(endpoint, args) : maskArgs(endpoint, args, this.opts);
|
|
489
|
+
}
|
|
490
|
+
catch {
|
|
491
|
+
return exports.MASKED;
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
update(record, update) {
|
|
495
|
+
const serverTs = this.clock?.toServerTime(update.ts);
|
|
496
|
+
if (serverTs !== null && serverTs !== undefined)
|
|
497
|
+
update.serverTs = serverTs;
|
|
498
|
+
const meta = record.meta;
|
|
499
|
+
meta.updateCount = (meta.updateCount ?? 0) + 1;
|
|
500
|
+
meta.updateBytes = (meta.updateBytes ?? 0) + (update.bytes ?? 0);
|
|
501
|
+
const updates = meta.updates ?? (meta.updates = []);
|
|
502
|
+
updates.push(update);
|
|
503
|
+
if (updates.length > exports.UPDATE_LIMIT)
|
|
504
|
+
updates.splice(0, updates.length - exports.UPDATE_LIMIT);
|
|
505
|
+
this.changed();
|
|
506
|
+
}
|
|
507
|
+
add(fields) {
|
|
508
|
+
const record = fields;
|
|
509
|
+
record.id = ++this.seq;
|
|
510
|
+
this.stamp(record);
|
|
511
|
+
this.list.push(record);
|
|
512
|
+
if (this.list.length > this.limit)
|
|
513
|
+
this.list.splice(0, this.list.length - this.limit);
|
|
514
|
+
this.changed();
|
|
515
|
+
}
|
|
516
|
+
/** `serverTs` / `uncertaintyMs` from the clock as it is now. */
|
|
517
|
+
stamp(record) {
|
|
518
|
+
const serverTs = this.clock?.toServerTime(record.ts) ?? null;
|
|
519
|
+
record.serverTs = serverTs;
|
|
520
|
+
record.uncertaintyMs = serverTs === null ? null : round(this.clock.uncertaintyMs ?? 0);
|
|
521
|
+
}
|
|
522
|
+
/** Give records from before the first clock sample their server time. */
|
|
523
|
+
backfill() {
|
|
524
|
+
const clock = this.clock;
|
|
525
|
+
if (!clock?.synced)
|
|
526
|
+
return;
|
|
527
|
+
for (const record of this.list) {
|
|
528
|
+
if (record.serverTs === null)
|
|
529
|
+
this.stamp(record);
|
|
530
|
+
for (const update of record.meta.updates ?? []) {
|
|
531
|
+
if (update.serverTs !== undefined)
|
|
532
|
+
continue;
|
|
533
|
+
const serverTs = clock.toServerTime(update.ts);
|
|
534
|
+
if (serverTs !== null)
|
|
535
|
+
update.serverTs = serverTs;
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
// The summary shows the clock, so a new sample is a change either way.
|
|
539
|
+
this.changed();
|
|
540
|
+
}
|
|
541
|
+
changed() {
|
|
542
|
+
this.rev += 1;
|
|
543
|
+
// A record changed in place still has to look new to a reader comparing
|
|
544
|
+
// arrays; a fresh array per change is cheap next to the message that caused it.
|
|
545
|
+
this.list = this.list.slice();
|
|
546
|
+
if (this.notifyQueued || this.listeners.size === 0)
|
|
547
|
+
return;
|
|
548
|
+
this.notifyQueued = true;
|
|
549
|
+
queueMicrotask(() => {
|
|
550
|
+
this.notifyQueued = false;
|
|
551
|
+
for (const listener of [...this.listeners])
|
|
552
|
+
listener();
|
|
553
|
+
});
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
exports.NowityDevtools = NowityDevtools;
|
|
@@ -2,6 +2,8 @@ import { observable } from "mobx";
|
|
|
2
2
|
import { type DerivedMutator } from "../core/derived";
|
|
3
3
|
import type { HydrationPayload, ServerMessage, ServerWelcome } from "../core/protocol";
|
|
4
4
|
import type { EntityId } from "../core/types";
|
|
5
|
+
import { ServerClock, type ServerClockOptions } from "./clock";
|
|
6
|
+
import { NowityDevtools, type DevtoolsOptions } from "./devtools";
|
|
5
7
|
import { LiveQuery, type QueryDescriptor } from "./live-query";
|
|
6
8
|
import { type LocalTx } from "./overlay";
|
|
7
9
|
import type { Transport } from "./transport";
|
|
@@ -139,7 +141,30 @@ export interface NowityClientOptions {
|
|
|
139
141
|
onError?: (error: Error) => void;
|
|
140
142
|
/** Observability hook: every message received, before it is applied. */
|
|
141
143
|
onServerMessage?: (message: ServerMessage) => void;
|
|
144
|
+
/**
|
|
145
|
+
* Record what this client does for a developer panel (`nowity/devtools`).
|
|
146
|
+
* Off by default; see {@link NowityClient.enableDevtools}, which also
|
|
147
|
+
* switches it on later.
|
|
148
|
+
*/
|
|
149
|
+
devtools?: boolean | DevtoolsOptions;
|
|
150
|
+
/**
|
|
151
|
+
* Keep an estimate of the server's clock ({@link NowityClient.clock}).
|
|
152
|
+
*
|
|
153
|
+
* On by default: the welcome is the first sample, then a short burst of
|
|
154
|
+
* pings, then one every `intervalMs` (30 s) — a few dozen bytes. `false`
|
|
155
|
+
* turns the pings off; a server older than the clock sync gets none either
|
|
156
|
+
* way, and the clock then simply stays unsynced.
|
|
157
|
+
*/
|
|
158
|
+
clock?: false | ClockSyncOptions;
|
|
159
|
+
}
|
|
160
|
+
export interface ClockSyncOptions extends ServerClockOptions {
|
|
161
|
+
/** Between two pings once synced. Default 30 s. */
|
|
162
|
+
intervalMs?: number;
|
|
163
|
+
/** Pings right after each welcome, one after another. Default 3. */
|
|
164
|
+
burst?: number;
|
|
142
165
|
}
|
|
166
|
+
export declare const DEFAULT_CLOCK_INTERVAL_MS = 30000;
|
|
167
|
+
export declare const DEFAULT_CLOCK_BURST = 3;
|
|
143
168
|
export type ConnectionStatus = "idle" | "connecting" | "connected" | "disconnected";
|
|
144
169
|
/**
|
|
145
170
|
* The client half of Nowity: a MobX object graph kept in sync with Postgres.
|
|
@@ -224,7 +249,37 @@ export declare class NowityClient {
|
|
|
224
249
|
private everWelcomed;
|
|
225
250
|
/** What this connection says it is looking at; resent after every reconnect. */
|
|
226
251
|
private context;
|
|
252
|
+
/** See {@link enableDevtools}. `null` = nothing is measured. */
|
|
253
|
+
private recorder;
|
|
254
|
+
/**
|
|
255
|
+
* The server's clock as this page estimates it: `offsetMs`, `rttMs`,
|
|
256
|
+
* `sampleCount`, `syncedAt` and `toServerTime(performance.now())`. Unsynced
|
|
257
|
+
* (`null`s) until the first welcome of a server that supports it.
|
|
258
|
+
*/
|
|
259
|
+
readonly clock: ServerClock;
|
|
260
|
+
private readonly clockSync;
|
|
261
|
+
/** When the current hello left, on {@link clock}'s clock. */
|
|
262
|
+
private helloSentAt;
|
|
263
|
+
/** The ping waiting for its pong: id and when it left. One at a time. */
|
|
264
|
+
private ping;
|
|
265
|
+
private pingSeq;
|
|
266
|
+
private burstLeft;
|
|
267
|
+
private pingTimer;
|
|
227
268
|
constructor(opts: NowityClientOptions);
|
|
269
|
+
/**
|
|
270
|
+
* Start recording subscribes, mutations and connection events for a
|
|
271
|
+
* developer panel (`nowity/devtools`). Idempotent: a second call returns the
|
|
272
|
+
* recorder already running, whatever its options.
|
|
273
|
+
*
|
|
274
|
+
* Turned on before the client connects (the `devtools` option), it sees the
|
|
275
|
+
* page's startup; turned on later, it sees what happens from then on —
|
|
276
|
+
* subscriptions already open are not in it.
|
|
277
|
+
*/
|
|
278
|
+
enableDevtools(options?: DevtoolsOptions): NowityDevtools;
|
|
279
|
+
/** Stop recording and drop what was recorded. */
|
|
280
|
+
disableDevtools(): void;
|
|
281
|
+
/** The running recorder, or `null` when devtools are off. */
|
|
282
|
+
get devtools(): NowityDevtools | null;
|
|
228
283
|
connect(): void;
|
|
229
284
|
close(): void;
|
|
230
285
|
/** Drop the connection as if the network died. For tests and for retry UX. */
|
|
@@ -243,6 +298,12 @@ export declare class NowityClient {
|
|
|
243
298
|
*/
|
|
244
299
|
setContext(context: Record<string, unknown> | null): void;
|
|
245
300
|
private handleClose;
|
|
301
|
+
/** After a welcome: a burst of pings one after another, then one per interval. */
|
|
302
|
+
private startClockSync;
|
|
303
|
+
private stopClockSync;
|
|
304
|
+
private sendPing;
|
|
305
|
+
private schedulePing;
|
|
306
|
+
private handlePong;
|
|
246
307
|
private send;
|
|
247
308
|
/**
|
|
248
309
|
* Forget every unconfirmed mutation: the connection they were bound to is
|
|
@@ -279,6 +340,14 @@ export declare class NowityClient {
|
|
|
279
340
|
/** The derived mutators a subscription holds, for diagnostics and tests. */
|
|
280
341
|
derivedMutatorsOf(subId: string): DerivedMutator[];
|
|
281
342
|
private handleMessage;
|
|
343
|
+
/**
|
|
344
|
+
* Note a message for the devtools recorder, before it is applied.
|
|
345
|
+
*
|
|
346
|
+
* Sizes come from the raw frame when the transport has it; a transaction
|
|
347
|
+
* spread over several subscriptions is measured per subscription, by its
|
|
348
|
+
* own part of the message.
|
|
349
|
+
*/
|
|
350
|
+
private record;
|
|
282
351
|
private handleWelcome;
|
|
283
352
|
private handleSnapshotMessage;
|
|
284
353
|
private applySnapshot;
|
|
@@ -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,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;
|
|
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;AACnD,OAAO,EAAE,WAAW,EAAE,KAAK,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAE/D,OAAO,EAAE,cAAc,EAAuB,KAAK,eAAe,EAAE,MAAM,YAAY,CAAC;AACvF,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,gEAA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