@steve31415/baselib 3.54.0 → 3.54.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/rum.d.ts CHANGED
@@ -11,7 +11,11 @@ export interface RumOptions {
11
11
  * The same-origin resource of one initiator type (`script`, `fetch`) that
12
12
  * finished last before `before` (ms since navigation start) — for a single-page
13
13
  * app, the entry script and the first data fetch that first paint waited on.
14
- * Times are ms since navigation start; `bytes` 0 means served from cache.
14
+ * `start_ms`, `sent_ms`, `first_byte_ms` and `end_ms` are ms since navigation
15
+ * start; `dns_ms` and `connect_ms` are durations. A request the browser (or an
16
+ * extension in it) held before sending shows as `sent_ms - start_ms` well over
17
+ * `dns_ms + connect_ms`; a cold network shows in those two; `bytes` 0 means
18
+ * served from cache.
15
19
  */
16
20
  export declare function lastResourceBefore(entries: readonly PerformanceResourceTiming[], initiatorType: string, before: number): Record<string, string | number | undefined> | undefined;
17
21
  /**
package/dist/rum.js CHANGED
@@ -35,7 +35,11 @@ function resourcePath(url) {
35
35
  * The same-origin resource of one initiator type (`script`, `fetch`) that
36
36
  * finished last before `before` (ms since navigation start) — for a single-page
37
37
  * app, the entry script and the first data fetch that first paint waited on.
38
- * Times are ms since navigation start; `bytes` 0 means served from cache.
38
+ * `start_ms`, `sent_ms`, `first_byte_ms` and `end_ms` are ms since navigation
39
+ * start; `dns_ms` and `connect_ms` are durations. A request the browser (or an
40
+ * extension in it) held before sending shows as `sent_ms - start_ms` well over
41
+ * `dns_ms + connect_ms`; a cold network shows in those two; `bytes` 0 means
42
+ * served from cache.
39
43
  */
40
44
  export function lastResourceBefore(entries, initiatorType, before) {
41
45
  let pick;
@@ -56,10 +60,15 @@ export function lastResourceBefore(entries, initiatorType, before) {
56
60
  }
57
61
  if (!pick)
58
62
  return undefined;
63
+ const positive = (n) => (n > 0 ? n : undefined);
64
+ const span = (from, to) => (from > 0 && to >= from ? to - from : undefined);
59
65
  return {
60
66
  path: resourcePath(pick.name),
61
67
  start_ms: ms(pick.startTime),
62
- first_byte_ms: ms(pick.responseStart > 0 ? pick.responseStart : undefined),
68
+ sent_ms: ms(positive(pick.requestStart)),
69
+ dns_ms: ms(span(pick.domainLookupStart, pick.domainLookupEnd)),
70
+ connect_ms: ms(span(pick.connectStart, pick.connectEnd)),
71
+ first_byte_ms: ms(positive(pick.responseStart)),
63
72
  end_ms: ms(pick.responseEnd),
64
73
  bytes: pick.transferSize,
65
74
  protocol: pick.nextHopProtocol || undefined,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steve31415/baselib",
3
- "version": "3.54.0",
3
+ "version": "3.54.1",
4
4
  "description": "Plasticine new-world shared platform library: logging, auth, service-to-service auth, db, HTTP, sync, app updates",
5
5
  "type": "module",
6
6
  "license": "MIT",