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.
@@ -1,11 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NowityClient = exports.ConnectionLostError = exports.StrictOptimisticError = void 0;
3
+ exports.NowityClient = exports.DEFAULT_CLOCK_BURST = exports.DEFAULT_CLOCK_INTERVAL_MS = exports.ConnectionLostError = exports.StrictOptimisticError = void 0;
4
4
  exports.subscriptionKey = subscriptionKey;
5
5
  const mobx_1 = require("mobx");
6
6
  const derived_1 = require("../core/derived");
7
7
  const protocol_1 = require("../core/protocol");
8
+ const clock_1 = require("./clock");
8
9
  const confirmed_store_1 = require("./confirmed-store");
10
+ const devtools_1 = require("./devtools");
9
11
  const live_query_1 = require("./live-query");
10
12
  const overlay_1 = require("./overlay");
11
13
  /** Thrown in strict mode by a mutation the client has no answer for. */
@@ -34,6 +36,8 @@ class ConnectionLostError extends Error {
34
36
  }
35
37
  }
36
38
  exports.ConnectionLostError = ConnectionLostError;
39
+ exports.DEFAULT_CLOCK_INTERVAL_MS = 30000;
40
+ exports.DEFAULT_CLOCK_BURST = 3;
37
41
  /** Shared empty result, so a query with no local inserts allocates nothing. */
38
42
  const EMPTY_IDS = [];
39
43
  /**
@@ -114,6 +118,15 @@ class NowityClient {
114
118
  this.everWelcomed = false;
115
119
  /** What this connection says it is looking at; resent after every reconnect. */
116
120
  this.context = null;
121
+ /** See {@link enableDevtools}. `null` = nothing is measured. */
122
+ this.recorder = null;
123
+ /** When the current hello left, on {@link clock}'s clock. */
124
+ this.helloSentAt = null;
125
+ /** The ping waiting for its pong: id and when it left. One at a time. */
126
+ this.ping = null;
127
+ this.pingSeq = 0;
128
+ this.burstLeft = 0;
129
+ this.pingTimer = null;
117
130
  /** Rebuild the overlay from confirmed state plus pending mutations. */
118
131
  this.rebase = (0, mobx_1.action)(() => {
119
132
  this.pendingBox.set(this.pending.length > 0);
@@ -159,12 +172,46 @@ class NowityClient {
159
172
  this.context = opts.context ?? null;
160
173
  this.strictOptimistic = opts.strictOptimistic ?? strictFromEnv();
161
174
  this.optimisticOn = opts.optimistic ?? true;
175
+ const clockOpts = opts.clock === false ? {} : (opts.clock ?? {});
176
+ this.clock = new clock_1.ServerClock(clockOpts);
177
+ this.clockSync =
178
+ opts.clock === false
179
+ ? null
180
+ : {
181
+ intervalMs: clockOpts.intervalMs ?? exports.DEFAULT_CLOCK_INTERVAL_MS,
182
+ burst: Math.max(1, clockOpts.burst ?? exports.DEFAULT_CLOCK_BURST),
183
+ };
162
184
  for (const mutator of opts.mutators ?? []) {
163
185
  if (mutator.local === undefined && !mutator.pessimistic?.trim()) {
164
186
  throw new Error(`Client mutator "${mutator.name}" has neither local() nor a pessimistic reason.`);
165
187
  }
166
188
  this.mutators.set(mutator.name, mutator);
167
189
  }
190
+ if (opts.devtools)
191
+ this.enableDevtools(opts.devtools === true ? {} : opts.devtools);
192
+ }
193
+ // -------------------------------------------------------------------- devtools
194
+ /**
195
+ * Start recording subscribes, mutations and connection events for a
196
+ * developer panel (`nowity/devtools`). Idempotent: a second call returns the
197
+ * recorder already running, whatever its options.
198
+ *
199
+ * Turned on before the client connects (the `devtools` option), it sees the
200
+ * page's startup; turned on later, it sees what happens from then on —
201
+ * subscriptions already open are not in it.
202
+ */
203
+ enableDevtools(options = {}) {
204
+ this.recorder ?? (this.recorder = new devtools_1.NowityDevtools({ clock: this.clock, ...options }));
205
+ return this.recorder;
206
+ }
207
+ /** Stop recording and drop what was recorded. */
208
+ disableDevtools() {
209
+ this.recorder?.dispose();
210
+ this.recorder = null;
211
+ }
212
+ /** The running recorder, or `null` when devtools are off. */
213
+ get devtools() {
214
+ return this.recorder;
168
215
  }
169
216
  // ------------------------------------------------------------------ connection
170
217
  connect() {
@@ -176,11 +223,15 @@ class NowityClient {
176
223
  return;
177
224
  this.intentionalClose = false;
178
225
  (0, mobx_1.runInAction)(() => this.status.set("connecting"));
226
+ this.recorder?.onConnect();
179
227
  this.opts.transport.connect({
180
228
  onOpen: () => this.handleOpen(),
181
- onMessage: (message) => this.handleMessage(message),
229
+ onMessage: (message, raw) => this.handleMessage(message, raw),
182
230
  onClose: () => this.handleClose(),
183
- onError: (err) => this.onError(err),
231
+ onError: (err) => {
232
+ this.recorder?.onTransportError(err.message);
233
+ this.onError(err);
234
+ },
184
235
  });
185
236
  }
186
237
  close() {
@@ -189,6 +240,7 @@ class NowityClient {
189
240
  clearTimeout(this.reconnectTimer);
190
241
  this.reconnectTimer = null;
191
242
  this.opts.transport.close();
243
+ this.stopClockSync();
192
244
  (0, mobx_1.runInAction)(() => this.status.set("idle"));
193
245
  }
194
246
  /** Drop the connection as if the network died. For tests and for retry UX. */
@@ -199,7 +251,9 @@ class NowityClient {
199
251
  handleOpen() {
200
252
  this.connected = true;
201
253
  this.reconnectAttempt = 0;
254
+ this.recorder?.onOpen();
202
255
  (0, mobx_1.runInAction)(() => this.status.set("connected"));
256
+ this.helloSentAt = this.clock.now();
203
257
  // The context rides on the hello: the server forgets it with the old
204
258
  // socket, and a new socket has to be told before it is recorded.
205
259
  this.send({
@@ -228,8 +282,10 @@ class NowityClient {
228
282
  this.send({ t: "context", context });
229
283
  }
230
284
  handleClose() {
285
+ this.recorder?.onClose(this.intentionalClose);
231
286
  this.connected = false;
232
287
  this.welcomed = false;
288
+ this.stopClockSync();
233
289
  (0, mobx_1.runInAction)(() => this.status.set(this.intentionalClose ? "idle" : "disconnected"));
234
290
  if (this.opts.onDisconnect === "drop")
235
291
  this.dropPending();
@@ -248,13 +304,67 @@ class NowityClient {
248
304
  const max = this.opts.reconnect?.maxDelayMs ?? 5000;
249
305
  const delay = Math.min(max, min * 2 ** this.reconnectAttempt);
250
306
  this.reconnectAttempt += 1;
307
+ this.recorder?.onReconnectScheduled(delay);
251
308
  this.reconnectTimer = setTimeout(() => {
252
309
  this.reconnectTimer = null;
253
310
  this.connect();
254
311
  }, delay);
255
312
  }
313
+ // ------------------------------------------------------------------ clock sync
314
+ /** After a welcome: a burst of pings one after another, then one per interval. */
315
+ startClockSync() {
316
+ this.stopClockSync();
317
+ if (!this.clockSync)
318
+ return;
319
+ this.burstLeft = this.clockSync.burst;
320
+ this.sendPing();
321
+ }
322
+ stopClockSync() {
323
+ if (this.pingTimer)
324
+ clearTimeout(this.pingTimer);
325
+ this.pingTimer = null;
326
+ this.ping = null;
327
+ this.burstLeft = 0;
328
+ this.helloSentAt = null;
329
+ }
330
+ sendPing() {
331
+ if (!this.clockSync || !this.welcomed)
332
+ return;
333
+ if (this.pingTimer)
334
+ clearTimeout(this.pingTimer);
335
+ this.pingTimer = null;
336
+ // A ping whose pong never came (an older server, a lost frame) is
337
+ // given up: one outstanding at a time keeps the bookkeeping trivial.
338
+ const ping = { id: ++this.pingSeq, t0: this.clock.now() };
339
+ this.ping = ping;
340
+ this.opts.transport.send({ t: "ping", id: ping.id, t0: ping.t0 });
341
+ this.schedulePing(this.clockSync.intervalMs);
342
+ }
343
+ schedulePing(delayMs) {
344
+ if (this.pingTimer)
345
+ clearTimeout(this.pingTimer);
346
+ this.pingTimer = setTimeout(() => {
347
+ this.pingTimer = null;
348
+ this.sendPing();
349
+ }, delayMs);
350
+ // The clock must never hold a process open.
351
+ this.pingTimer.unref?.();
352
+ }
353
+ handlePong(message, receivedAt) {
354
+ const ping = this.ping;
355
+ if (!ping || ping.id !== message.id)
356
+ return;
357
+ this.ping = null;
358
+ this.clock.addSample(ping.t0, message.t1, message.t2, receivedAt);
359
+ if (this.burstLeft > 0)
360
+ this.burstLeft -= 1;
361
+ if (this.burstLeft > 0)
362
+ this.sendPing();
363
+ }
256
364
  send(message) {
257
365
  this.opts.transport.send(message);
366
+ if (this.recorder && message.t === "hello")
367
+ this.recorder.onHello((0, devtools_1.jsonBytes)(message));
258
368
  }
259
369
  /**
260
370
  * Forget every unconfirmed mutation: the connection they were bound to is
@@ -264,6 +374,8 @@ class NowityClient {
264
374
  dropPending() {
265
375
  const callers = [...this.callers];
266
376
  this.callers.clear();
377
+ for (const [mutationId] of callers)
378
+ this.recorder?.onMutationLost(mutationId);
267
379
  (0, mobx_1.runInAction)(() => {
268
380
  this.pending = [];
269
381
  this.rebase();
@@ -313,6 +425,7 @@ class NowityClient {
313
425
  });
314
426
  const hydrationKey = subscriptionKey(query, args);
315
427
  const payload = this.hydrationByKey.get(hydrationKey);
428
+ this.recorder?.onSubscribe(subId, query, args, payload !== undefined);
316
429
  if (payload) {
317
430
  // Server-rendered data is used once. Keeping it would resurrect stale
318
431
  // rows on a later subscription to the same query.
@@ -336,6 +449,7 @@ class NowityClient {
336
449
  return;
337
450
  this.subs.delete(subId);
338
451
  this.derivedBySub.delete(subId);
452
+ this.recorder?.onUnsubscribe(subId);
339
453
  this.send({ t: "unsubscribe", subId });
340
454
  this.resolveResync(subId);
341
455
  (0, mobx_1.runInAction)(() => {
@@ -393,8 +507,12 @@ class NowityClient {
393
507
  caller.promise = promise;
394
508
  this.callers.set(mutationId, caller);
395
509
  this.pending.push({ mutationId, name, args });
510
+ const recorder = this.recorder;
511
+ const startedAt = recorder ? now() : 0;
396
512
  (0, mobx_1.runInAction)(() => this.rebase());
397
- this.send({ t: "mutate", mutationId, name, args });
513
+ const message = { t: "mutate", mutationId, name, args };
514
+ recorder?.onMutate(mutationId, name, args, (0, devtools_1.jsonBytes)(message), now() - startedAt);
515
+ this.send(message);
398
516
  return promise;
399
517
  }
400
518
  /** See {@link NowityClientOptions.optimistic}. Takes effect immediately. */
@@ -419,12 +537,28 @@ class NowityClient {
419
537
  return [...(this.derivedBySub.get(subId)?.values() ?? [])];
420
538
  }
421
539
  // -------------------------------------------------------------------- messages
422
- handleMessage(message) {
540
+ handleMessage(message, raw) {
541
+ // First: the clock sample ends when the message arrives, not when it is applied.
542
+ const receivedAt = this.clock.now();
423
543
  try {
544
+ if (message.t === "pong") {
545
+ this.handlePong(message, receivedAt);
546
+ return;
547
+ }
424
548
  this.opts.onServerMessage?.(message);
549
+ if (message.t === "welcome" && message.clock && this.helloSentAt !== null) {
550
+ // The welcome is the first sample. A reconnect may follow a
551
+ // suspend, after which the old relation of the clocks proves
552
+ // nothing — the new samples replace whatever contradicts them.
553
+ this.clock.addSample(this.helloSentAt, message.clock.receivedAt, message.clock.sentAt, receivedAt);
554
+ }
555
+ if (this.recorder)
556
+ this.record(this.recorder, message, raw);
425
557
  switch (message.t) {
426
558
  case "welcome":
427
559
  this.handleWelcome(message);
560
+ if (message.clock)
561
+ this.startClockSync();
428
562
  break;
429
563
  case "snapshot":
430
564
  this.handleSnapshotMessage(message);
@@ -463,6 +597,43 @@ class NowityClient {
463
597
  this.onError(err);
464
598
  }
465
599
  }
600
+ /**
601
+ * Note a message for the devtools recorder, before it is applied.
602
+ *
603
+ * Sizes come from the raw frame when the transport has it; a transaction
604
+ * spread over several subscriptions is measured per subscription, by its
605
+ * own part of the message.
606
+ */
607
+ record(recorder, message, raw) {
608
+ const size = () => (raw !== undefined ? (0, devtools_1.byteSize)(raw) : (0, devtools_1.jsonBytes)(message));
609
+ switch (message.t) {
610
+ case "welcome":
611
+ recorder.onWelcome(size());
612
+ break;
613
+ case "snapshot":
614
+ recorder.onSnapshot(message.subId, size(), message.reason === "permission-change");
615
+ recorder.onData(message.lastMutationId, undefined);
616
+ break;
617
+ case "tx":
618
+ for (const revoked of message.revoked ?? []) {
619
+ recorder.onSubscriptionRefused(revoked.subId, "rejected", revoked.reason);
620
+ }
621
+ for (const snapshot of message.snapshots ?? []) {
622
+ recorder.onSnapshot(snapshot.subId, (0, devtools_1.jsonBytes)(snapshot), snapshot.reason === "permission-change");
623
+ }
624
+ for (const patch of message.patches)
625
+ recorder.onPatch(patch.subId, (0, devtools_1.jsonBytes)(patch));
626
+ recorder.onData(message.lastMutationId, message.timing);
627
+ break;
628
+ case "mutation-result":
629
+ recorder.onMutationResult(message.mutationId, message.ok, message.error, message.timing);
630
+ break;
631
+ case "error":
632
+ if (message.subId)
633
+ recorder.onSubscriptionRefused(message.subId, "error", message.code);
634
+ break;
635
+ }
636
+ }
466
637
  handleWelcome(message) {
467
638
  const serverLastMutationId = message.lastMutationId;
468
639
  this.welcomed = true;
@@ -496,6 +667,7 @@ class NowityClient {
496
667
  if (queued.has(mutationId))
497
668
  continue;
498
669
  this.callers.delete(mutationId);
670
+ this.recorder?.onMutationSettled(mutationId);
499
671
  caller.resolve(undefined);
500
672
  }
501
673
  // Re-send everything the server has not seen, then re-establish the
@@ -503,6 +675,7 @@ class NowityClient {
503
675
  // contain these mutations; whichever way, the reported lastMutationId says
504
676
  // which of them may leave the pending queue.
505
677
  for (const mutation of this.pending) {
678
+ this.recorder?.onMutationResent(mutation.mutationId);
506
679
  this.send({
507
680
  t: "mutate",
508
681
  mutationId: mutation.mutationId,
@@ -515,6 +688,7 @@ class NowityClient {
515
688
  // already sent (queued by the transport if the socket was not open yet),
516
689
  // and re-sending them would cost a second snapshot of everything.
517
690
  for (const sub of this.subs.values()) {
691
+ this.recorder?.onResubscribe(sub.subId);
518
692
  this.send({ t: "subscribe", subId: sub.subId, query: sub.query, args: sub.args });
519
693
  }
520
694
  }
@@ -840,7 +1014,7 @@ class NowityClient {
840
1014
  }
841
1015
  /** Test seam: feed a server message in as if it arrived over the wire. */
842
1016
  injectMessage(message) {
843
- this.handleMessage(message);
1017
+ this.handleMessage(message, undefined);
844
1018
  }
845
1019
  }
846
1020
  exports.NowityClient = NowityClient;
@@ -868,3 +1042,7 @@ function strictFromEnv() {
868
1042
  const env = globalThis.process?.env;
869
1043
  return env?.NOWITY_STRICT_OPTIMISTIC === "1";
870
1044
  }
1045
+ function now() {
1046
+ const perf = globalThis.performance;
1047
+ return perf ? perf.now() : Date.now();
1048
+ }
@@ -1,7 +1,8 @@
1
1
  import type { ClientMessage, ServerMessage } from "../core/protocol";
2
2
  export interface TransportHandlers {
3
3
  onOpen(): void;
4
- onMessage(message: ServerMessage): void;
4
+ /** `raw` = the frame as received, when the transport has it (for sizes in devtools). */
5
+ onMessage(message: ServerMessage, raw?: string): void;
5
6
  onClose(): void;
6
7
  onError(error: Error): void;
7
8
  }
@@ -1 +1 @@
1
- {"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../src/client/transport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAErE,MAAM,WAAW,iBAAiB;IAC9B,MAAM,IAAI,IAAI,CAAC;IACf,SAAS,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI,CAAC;IACxC,OAAO,IAAI,IAAI,CAAC;IAChB,OAAO,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;CAC/B;AAED;;;;;GAKG;AACH,MAAM,WAAW,SAAS;IACtB,OAAO,CAAC,QAAQ,EAAE,iBAAiB,GAAG,IAAI,CAAC;IAC3C,IAAI,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI,CAAC;IACnC,KAAK,IAAI,IAAI,CAAC;CACjB"}
1
+ {"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../src/client/transport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAErE,MAAM,WAAW,iBAAiB;IAC9B,MAAM,IAAI,IAAI,CAAC;IACf,wFAAwF;IACxF,SAAS,CAAC,OAAO,EAAE,aAAa,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtD,OAAO,IAAI,IAAI,CAAC;IAChB,OAAO,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;CAC/B;AAED;;;;;GAKG;AACH,MAAM,WAAW,SAAS;IACtB,OAAO,CAAC,QAAQ,EAAE,iBAAiB,GAAG,IAAI,CAAC;IAC3C,IAAI,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI,CAAC;IACnC,KAAK,IAAI,IAAI,CAAC;CACjB"}
@@ -1 +1 @@
1
- {"version":3,"file":"ws-transport.d.ts","sourceRoot":"","sources":["../../src/client/ws-transport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAiB,MAAM,kBAAkB,CAAC;AACrE,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAUhE,MAAM,WAAW,yBAAyB;IACtC,GAAG,EAAE,MAAM,CAAC;IACZ;;;OAGG;IACH,aAAa,CAAC,EAAE,GAAG,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CACjC;AAED;;;;;;;GAOG;AACH,qBAAa,kBAAmB,YAAW,SAAS;IAKpC,OAAO,CAAC,QAAQ,CAAC,IAAI;IAJjC,OAAO,CAAC,MAAM,CAA2B;IACzC,OAAO,CAAC,QAAQ,CAAkC;IAClD,OAAO,CAAC,KAAK,CAAuB;gBAEP,IAAI,EAAE,yBAAyB;IAE5D,OAAO,CAAC,QAAQ,EAAE,iBAAiB,GAAG,IAAI;IAmD1C,IAAI,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI;IAUlC,KAAK,IAAI,IAAI;CAShB"}
1
+ {"version":3,"file":"ws-transport.d.ts","sourceRoot":"","sources":["../../src/client/ws-transport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAiB,MAAM,kBAAkB,CAAC;AACrE,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAUhE,MAAM,WAAW,yBAAyB;IACtC,GAAG,EAAE,MAAM,CAAC;IACZ;;;OAGG;IACH,aAAa,CAAC,EAAE,GAAG,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CACjC;AAED;;;;;;;GAOG;AACH,qBAAa,kBAAmB,YAAW,SAAS;IAKpC,OAAO,CAAC,QAAQ,CAAC,IAAI;IAJjC,OAAO,CAAC,MAAM,CAA2B;IACzC,OAAO,CAAC,QAAQ,CAAkC;IAClD,OAAO,CAAC,KAAK,CAAuB;gBAEP,IAAI,EAAE,yBAAyB;IAE5D,OAAO,CAAC,QAAQ,EAAE,iBAAiB,GAAG,IAAI;IAoD1C,IAAI,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI;IAUlC,KAAK,IAAI,IAAI;CAShB"}
@@ -49,7 +49,8 @@ class WebSocketTransport {
49
49
  return;
50
50
  const raw = typeof payload === "string" ? payload : (payload?.data ?? payload);
51
51
  try {
52
- handlers.onMessage(JSON.parse(String(raw)));
52
+ const text = String(raw);
53
+ handlers.onMessage(JSON.parse(text), text);
53
54
  }
54
55
  catch (err) {
55
56
  handlers.onError(err);
package/dist/client.d.ts CHANGED
@@ -40,6 +40,14 @@ export type { QueryEntry, QueryError, QuerySource } from "./client/query-source"
40
40
  export { ConnectionLostError, StrictOptimisticError, type ClientMutatorDef, type OptimisticMutatorDef, type PessimisticMutatorDef, } from "./client/nowity-client";
41
41
  export type { Draft, EntityTx, LocalEntities, LocalTx } from "./client/overlay";
42
42
  export { WebSocketTransport, type WebSocketTransportOptions } from "./client/ws-transport";
43
+ export { ServerClock, clockSample, type ClockSample, type ClockState, type ServerClockOptions, } from "./client/clock";
44
+ export type { ClockSyncOptions } from "./client/nowity-client";
45
+ export type { MutationTiming, TxTiming } from "./core/protocol";
46
+ /**
47
+ * The recorder behind `client.enableDevtools()`; the panel that shows it is a
48
+ * separate entry, `nowity/devtools`, loaded only where it is wanted.
49
+ */
50
+ export type { NowityDevtools, DevtoolsOptions, DevtoolsRecord, DevtoolsSummary } from "./client/devtools";
43
51
  export { configureNowityClient, type NowityClientContainerConfig } from "./ironbean/client";
44
52
  export { NowityClientToken } from "./ironbean/tokens";
45
53
  export type { EntityId, Row } from "./core/types";
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAGH,OAAO,EACH,GAAG,EACH,QAAQ,EACR,KAAK,EACL,IAAI,EACJ,QAA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,uBAAuB,GAC/B,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACjF;;;;;GAKG;AACH,OAAO,EACH,mBAAmB,EACnB,qBAAqB,EACrB,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,GAC7B,MAAM,wBAAwB,CAAC;AAChC,YAAY,EAAE,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAChF,OAAO,EAAE,kBAAkB,EAAE,KAAK,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAC3F,OAAO,EACH,WAAW,EACX,WAAW,EACX,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,kBAAkB,GAC1B,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,YAAY,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChE;;;GAGG;AACH,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC1G,OAAO,EAAE,qBAAqB,EAAE,KAAK,2BAA2B,EAAE,MAAM,mBAAmB,CAAC;AAC5F,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAGtD,YAAY,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAClD,YAAY,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACxD,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC"}
package/dist/client.js CHANGED
@@ -21,7 +21,7 @@
21
21
  * load this module at all.
22
22
  */
23
23
  Object.defineProperty(exports, "__esModule", { value: true });
24
- exports.NowityClientToken = exports.configureNowityClient = exports.WebSocketTransport = exports.StrictOptimisticError = exports.ConnectionLostError = exports.currentConnection = exports.activeConnection = exports.NowityConnection = exports.Restricted = exports.useQuerySource = exports.SourceScope = exports.NowityProvider = exports.useService = exports.DEFAULT_PAGE_SIZE = exports.LiveList = exports.List = exports.GridList = exports.useList = exports.useQuerySuspense = exports.observer = exports.isRejected = exports.isForbidden = exports.Rejected = exports.Forbidden = exports.buildManifest = exports.countQuery = exports.pageQuery = exports.endpointName = exports.resetContracts = exports.resolveContracts = exports.contractOf = exports.knownContracts = exports.mutation = exports.list = exports.query = exports.contract = exports.api = void 0;
24
+ exports.NowityClientToken = exports.configureNowityClient = exports.clockSample = exports.ServerClock = exports.WebSocketTransport = exports.StrictOptimisticError = exports.ConnectionLostError = exports.currentConnection = exports.activeConnection = exports.NowityConnection = exports.Restricted = exports.useQuerySource = exports.SourceScope = exports.NowityProvider = exports.useService = exports.DEFAULT_PAGE_SIZE = exports.LiveList = exports.List = exports.GridList = exports.useList = exports.useQuerySuspense = exports.observer = exports.isRejected = exports.isForbidden = exports.Rejected = exports.Forbidden = exports.buildManifest = exports.countQuery = exports.pageQuery = exports.endpointName = exports.resetContracts = exports.resolveContracts = exports.contractOf = exports.knownContracts = exports.mutation = exports.list = exports.query = exports.contract = exports.api = void 0;
25
25
  // ------------------------------------------------------------------- contracts
26
26
  var contract_1 = require("./api/contract");
27
27
  Object.defineProperty(exports, "api", { enumerable: true, get: function () { return contract_1.api; } });
@@ -83,6 +83,9 @@ Object.defineProperty(exports, "ConnectionLostError", { enumerable: true, get: f
83
83
  Object.defineProperty(exports, "StrictOptimisticError", { enumerable: true, get: function () { return nowity_client_1.StrictOptimisticError; } });
84
84
  var ws_transport_1 = require("./client/ws-transport");
85
85
  Object.defineProperty(exports, "WebSocketTransport", { enumerable: true, get: function () { return ws_transport_1.WebSocketTransport; } });
86
+ var clock_1 = require("./client/clock");
87
+ Object.defineProperty(exports, "ServerClock", { enumerable: true, get: function () { return clock_1.ServerClock; } });
88
+ Object.defineProperty(exports, "clockSample", { enumerable: true, get: function () { return clock_1.clockSample; } });
86
89
  var client_1 = require("./ironbean/client");
87
90
  Object.defineProperty(exports, "configureNowityClient", { enumerable: true, get: function () { return client_1.configureNowityClient; } });
88
91
  var tokens_1 = require("./ironbean/tokens");
@@ -51,7 +51,20 @@ export interface ClientContext {
51
51
  t: "context";
52
52
  context: Record<string, unknown> | null;
53
53
  }
54
- export type ClientMessage = ClientHello | ClientSubscribe | ClientUnsubscribe | ClientMutate | ClientContext;
54
+ /**
55
+ * One exchange of the clock sync (see `client/clock`). `t0` is the client's
56
+ * `performance.now()` at sending; the server only echoes it.
57
+ *
58
+ * Answered the moment it arrives, ahead of whatever this socket has queued: a
59
+ * ping that waited behind a slow mutation would measure the mutation. A server
60
+ * older than it ignores it, and the client then simply has no estimate.
61
+ */
62
+ export interface ClientPing {
63
+ t: "ping";
64
+ id: number;
65
+ t0: number;
66
+ }
67
+ export type ClientMessage = ClientHello | ClientSubscribe | ClientUnsubscribe | ClientMutate | ClientContext | ClientPing;
55
68
  /**
56
69
  * A query result rendered on the server for the first paint.
57
70
  *
@@ -150,6 +163,17 @@ export interface ServerWelcome {
150
163
  }>;
151
164
  entities?: Record<string, WireEntity>;
152
165
  };
166
+ /**
167
+ * The server's clock around the hello — when it arrived on the socket and
168
+ * when this answer left, epoch ms — so the welcome is already the first
169
+ * clock sample. Absent from a server older than it.
170
+ */
171
+ clock?: {
172
+ receivedAt: number;
173
+ sentAt: number;
174
+ };
175
+ /** This connection gets {@link MutationTiming} / {@link TxTiming} (the server's `timing` option). */
176
+ timing?: boolean;
153
177
  }
154
178
  /** Full result of a live query. Replaces whatever the client held for `subId`. */
155
179
  export interface SubSnapshot {
@@ -218,8 +242,42 @@ export interface SubPatch {
218
242
  * permissions and data therefore cannot be observed half-applied: the
219
243
  * re-snapshotted subscription and the patched one land together.
220
244
  */
245
+ /**
246
+ * Where one mutation spent its time on the server, epoch ms of the server's
247
+ * clock. Only on a connection the server sends timing to.
248
+ */
249
+ export interface MutationTiming {
250
+ /** The message arrived on the socket. */
251
+ receivedAt: number;
252
+ /** Its turn came: the mutations before it on this connection were done. */
253
+ startedAt: number;
254
+ /** The transaction committed (the outbox row is written inside it). Absent when it was rolled back. */
255
+ committedAt?: number;
256
+ /** This answer left. */
257
+ sentAt: number;
258
+ }
259
+ /**
260
+ * Where the push of one change spent its time, epoch ms of the server's clock.
261
+ * Only on a connection the server sends timing to.
262
+ */
263
+ export interface TxTiming {
264
+ /**
265
+ * The earliest outbox row of this connection's own mutations in it — the
266
+ * database's clock, not the sync server's. Absent when the batch carries
267
+ * none, or the change source does not know (logical replication).
268
+ */
269
+ writtenAt?: number;
270
+ /** The change source handed the batch over. */
271
+ readAt: number;
272
+ /** The fan-out of the batch started (after whatever was queued before it). */
273
+ fanOutAt: number;
274
+ /** This message left. */
275
+ sentAt: number;
276
+ }
221
277
  export interface ServerTx {
222
278
  t: "tx";
279
+ /** See {@link TxTiming}. */
280
+ timing?: TxTiming;
223
281
  position: string;
224
282
  /**
225
283
  * Mutations up to (and including) this id are reflected in the data carried
@@ -255,6 +313,16 @@ export interface ServerMutationResult {
255
313
  /** What the endpoint returned, when it returned something. */
256
314
  value?: unknown;
257
315
  lastMutationId: number;
316
+ /** See {@link MutationTiming}. */
317
+ timing?: MutationTiming;
318
+ }
319
+ /** The answer to a {@link ClientPing}: when it arrived and left, epoch ms of the server's clock. */
320
+ export interface ServerPong {
321
+ t: "pong";
322
+ id: number;
323
+ t0: number;
324
+ t1: number;
325
+ t2: number;
258
326
  }
259
327
  export interface ServerError {
260
328
  t: "error";
@@ -262,5 +330,5 @@ export interface ServerError {
262
330
  code: string;
263
331
  message: string;
264
332
  }
265
- export type ServerMessage = ServerWelcome | ServerSnapshot | ServerTx | ServerMutationResult | ServerMutators | ServerError;
333
+ export type ServerMessage = ServerWelcome | ServerSnapshot | ServerTx | ServerMutationResult | ServerMutators | ServerPong | ServerError;
266
334
  //# sourceMappingURL=protocol.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"protoc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8D;IAC9D,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;IACvB,kCAAkC;IAClC,MAAM,CAAC,EAAE,cAAc,CAAC;CAC3B;AAED,oGAAoG;AACpG,MAAM,WAAW,UAAU;IACvB,CAAC,EAAE,MAAM,CAAC;IACV,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,WAAW;IACxB,CAAC,EAAE,OAAO,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,MAAM,aAAa,GACnB,aAAa,GACb,cAAc,GACd,QAAQ,GACR,oBAAoB,GACpB,cAAc,GACd,UAAU,GACV,WAAW,CAAC"}
@@ -63,6 +63,12 @@ export interface ChangeEvent {
63
63
  * to missing changes.
64
64
  */
65
65
  beforeComplete?: boolean;
66
+ /**
67
+ * When the change was written, epoch ms of the database's clock — the
68
+ * outbox row's `created_at`. For timing only; absent from a source that
69
+ * does not know it.
70
+ */
71
+ writtenAt?: number;
66
72
  }
67
73
  /**
68
74
  * All changes of one database transaction, in commit order.
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,6EAA6E;AAC7E,MAAM,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE1C,4EAA4E;AAC5E,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC;AAE9B,MAAM,MAAM,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAEtD,yEAAyE;AACzE,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;AA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AAO,CAAC;IACzB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAC7B;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,WAAW,EAAE,CAAC;CACzB;AAED,uDAAuD;AACvD,MAAM,WAAW,QAAQ;IACrB,EAAE,EAAE,QAAQ,CAAC;IACb,sEAAsE;IACtE,MAAM,EAAE,GAAG,CAAC;IACZ,oCAAoC;IACpC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,yEAAyE;AACzE,MAAM,WAAW,OAAO;IACpB,MAAM,EAAE,QAAQ,EAAE,CAAC;IACnB,MAAM,EAAE,QAAQ,EAAE,CAAC;CACtB;AAED,kEAAkE;AAClE,wBAAgB,WAAW,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAElD"}
@@ -0,0 +1,38 @@
1
+ import type { DevtoolsRecord, DevtoolsRecordType, NowityDevtools } from "./client/devtools";
2
+ export { NowityDevtools, maskArgs, mutationPhases, byteSize, MASKED, DEFAULT_ALLOWED_KEYS, type DevtoolsMeta, type DevtoolsOptions, type DevtoolsPhase, type DevtoolsRecord, type DevtoolsRecordType, type DevtoolsStatus, type DevtoolsSummary, type DevtoolsUpdate, type DevtoolsUpdateCause, } from "./client/devtools";
3
+ export interface NowityDevtoolsPanelProps {
4
+ /** The client's recorder: `connection.client.devtools`. */
5
+ recorder: NowityDevtools;
6
+ /** Shows a close button when given. */
7
+ onClose?: () => void;
8
+ /** Fixed to the bottom of the viewport instead of inline. */
9
+ floating?: boolean;
10
+ /** Height of the floating panel (CSS). Default `40vh`. */
11
+ height?: string;
12
+ title?: string;
13
+ }
14
+ type Filter = "all" | DevtoolsRecordType;
15
+ type SortKey = "start" | "name" | "status" | "latency" | "size" | "updates";
16
+ export declare function formatMs(ms: number | null | undefined): string;
17
+ export declare function formatBytes(bytes: number | null | undefined): string;
18
+ /** Format of a server time: wall clock with milliseconds, UTC. */
19
+ export declare function formatServerTime(serverTs: number | null | undefined): string;
20
+ /**
21
+ * Where a record starts on the common axis: the server's clock, through ONE
22
+ * offset — the current estimate — for every record.
23
+ *
24
+ * Not `record.serverTs`: each record is stamped with the estimate of its own
25
+ * moment, and two estimates may differ by up to their uncertainty, which would
26
+ * swap records a few ms apart. All `ts` come from one monotonic clock, so one
27
+ * offset keeps their order exact and puts them on the server's axis at once.
28
+ * Without an estimate (`offsetMs` null) the page's own clock is the axis.
29
+ */
30
+ export declare function axisTs(record: DevtoolsRecord, offsetMs: number | null): number;
31
+ /** Rows for the table: filtered, searched and sorted. Pure, for tests. */
32
+ export declare function visibleRecords(records: readonly DevtoolsRecord[], filter: Filter, search: string, sort: SortKey, desc: boolean): DevtoolsRecord[];
33
+ /**
34
+ * The panel: page-startup summary, a table of every subscribe / mutation / socket
35
+ * event with a waterfall, filter, search, sort, details, copy as JSON and clear.
36
+ */
37
+ export declare function NowityDevtoolsPanel({ recorder, onClose, floating, height, title }: NowityDevtoolsPanelProps): import("react").JSX.Element;
38
+ //# sourceMappingURL=devtools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"devtools.d.ts","sourceRoot":"","sources":["../src/devtools.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAER,cAAc,EACd,kBAAkB,EAGlB,cAAc,EACjB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACH,cAAc,EACd,QAAQ,EACR,cAAc,EACd,QAAQ,EACR,MAAM,EACN,oBAAoB,EACpB,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,mBAAmB,GAC3B,MAAM,mBA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