@freema/drobek-sdk 0.7.3 → 0.7.6

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 CHANGED
@@ -2,7 +2,8 @@
2
2
 
3
3
  The browser SDK core of [drobek](https://github.com/freema/drobek): the
4
4
  `SdkCore` a platform module's SDK entry receives (`core.request(method,
5
- path, { body, query })`), `DrobekError` and the error beacon. The drobek
5
+ path, { body, query })`), `DrobekError` and the beacon (page loads, browser
6
+ errors, failed resource loads and CSP blocks, with the page's version). The drobek
6
7
  server bundles it with the SDK entries of its modules into
7
8
  `/__drobek/sdk.js`, which apps import as `drobek`.
8
9
 
package/dist/beacon.d.ts CHANGED
@@ -1,18 +1,31 @@
1
1
  /**
2
- * The browser error beacon — runs in the BROWSER on the app's
3
- * own origin. The compiler adds `import "/__drobek/beacon.js?v=<hash>"` at the
4
- * top of every JS entry of an app (unless its drobek.json says
5
- * `"beacon": false`), so every app reports its uncaught errors and unhandled
6
- * promise rejections without configuration; the agent reads them with MCP
7
- * `get_logs({ kind: 'runtime' })`.
2
+ * The browser beacon — runs in the BROWSER on the app's own origin. The
3
+ * compiler adds `import "/__drobek/beacon.js?v=<hash>"` at the top of every JS
4
+ * entry of an app (unless its drobek.json says `"beacon": false`), so every
5
+ * app reports without configuration:
6
+ *
7
+ * - that the page loaded (once per page load — a count only, nothing about
8
+ * the visitor),
9
+ * - its uncaught errors and unhandled promise rejections,
10
+ * - a script, stylesheet, image or media file that failed to load (the
11
+ * `error` event of the element, seen in the capture phase),
12
+ * - a request the Content-Security-Policy blocked (`securitypolicyviolation`).
13
+ *
14
+ * The agent reads them with MCP `get_logs({ kind: 'runtime' })` and the
15
+ * per-version counts in `get_app` (`render`).
8
16
  *
9
17
  * Contract with the server (`POST /__drobek/v1/_beacon`, @drobek/insights):
10
- * same-origin, JSON `{ events: [{ type, message, stack, url, ua, ts }] }`,
11
- * ≤ 20 events and ≤ 8 KiB per POST (over-cap → 413). The server redacts
18
+ * same-origin, JSON `{ version, load?, events: [{ type, message, stack, url,
19
+ * ua, ts }] }`, ≤ 20 events and ≤ 8 KiB per POST (over-cap → 413).
20
+ * `version` is the app version the page was served from — the app host
21
+ * names it in the document's `Server-Timing: drobek-version;desc="<N>"`
22
+ * (null when the browser does not expose it: the server then files the
23
+ * report under the version the host serves now). The server redacts
12
24
  * e-mails / tokens and truncates again — the client caps are only there so a
13
- * POST fits. The page `url` is only its origin + path: a query
14
- * string or fragment can carry one-time codes, tokens or PII the redaction
15
- * cannot recognise (`?code=123456`), so it never leaves the browser.
25
+ * POST fits. The page `url` and every resource address are only origin +
26
+ * path: a query string or fragment can carry one-time codes, tokens or PII
27
+ * the redaction cannot recognise (`?code=123456`), so it never leaves the
28
+ * browser.
16
29
  *
17
30
  * Never throws, never recurses (an error while reporting is dropped), sends
18
31
  * at most 100 events per page load and at most 3 copies of the same error.
@@ -28,18 +41,28 @@ export declare const BEACON_MAX_PER_PAGE = 100;
28
41
  export declare const BEACON_MAX_REPEATS = 3;
29
42
  /** Queued events are sent this long after the first one (and on pagehide). */
30
43
  export declare const BEACON_FLUSH_MS = 1000;
44
+ /** The `Server-Timing` metric whose description is the version the page was served from. */
45
+ export declare const VERSION_TIMING_METRIC = "drobek-version";
46
+ export type BeaconEventType = 'error' | 'unhandledrejection' | 'resource' | 'csp';
31
47
  export interface BeaconEvent {
32
- type: 'error' | 'unhandledrejection';
48
+ type: BeaconEventType;
33
49
  message: string;
34
50
  stack: string | null;
35
51
  url: string;
36
52
  ua: string | null;
37
53
  ts: number;
38
54
  }
55
+ /** What every POST of a page says besides its events. */
56
+ export interface BeaconMeta {
57
+ /** The app version the page was served from (null = unknown). */
58
+ version: number | null;
59
+ /** The first POST of a page load says so (`load: true`). */
60
+ load?: boolean;
61
+ }
39
62
  type Listener = (event: unknown) => void;
40
63
  /** The slice of `window` the beacon uses (injectable for tests). */
41
64
  export interface BeaconEnv {
42
- addEventListener(type: string, listener: Listener): void;
65
+ addEventListener(type: string, listener: Listener, capture?: boolean): void;
43
66
  location?: {
44
67
  href?: string;
45
68
  };
@@ -51,6 +74,9 @@ export interface BeaconEnv {
51
74
  visibilityState?: string;
52
75
  addEventListener?(type: string, listener: Listener): void;
53
76
  };
77
+ performance?: {
78
+ getEntriesByType?(type: string): unknown[];
79
+ };
54
80
  fetch?: (url: string, init: RequestInit) => Promise<unknown>;
55
81
  setTimeout(fn: () => void, ms: number): unknown;
56
82
  Date?: {
@@ -68,8 +94,20 @@ export interface BeaconHandle {
68
94
  * no fragment, no credentials. Anything unparsable is cut at the first `?`/`#`.
69
95
  */
70
96
  export declare function pageUrl(href: unknown): string;
97
+ /**
98
+ * A resource address as reported: an http(s) URL as origin + path, another
99
+ * URL only by its scheme (`data:`, `blob:` — their contents never leave the
100
+ * browser), a CSP keyword (`inline`, `eval`) as it is.
101
+ */
102
+ export declare function resourceAddress(raw: unknown): string;
103
+ /**
104
+ * The version the page was served from: the app host's
105
+ * `Server-Timing: drobek-version;desc="<N>"` on the document. null when the
106
+ * browser does not expose server timing (or the page was not served by drobek).
107
+ */
108
+ export declare function pageVersion(env: Pick<BeaconEnv, 'performance'>): number | null;
71
109
  /** An ErrorEvent / a rejection reason → the event the server stores. */
72
- export declare function describeError(type: BeaconEvent['type'], raw: {
110
+ export declare function describeError(type: 'error' | 'unhandledrejection', raw: {
73
111
  message?: unknown;
74
112
  error?: unknown;
75
113
  reason?: unknown;
@@ -77,14 +115,35 @@ export declare function describeError(type: BeaconEvent['type'], raw: {
77
115
  lineno?: unknown;
78
116
  colno?: unknown;
79
117
  }, url: string, ua: string | null, ts: number): BeaconEvent;
118
+ /** The element whose load failed (an `error` event that did not come from the window) → the stored event. */
119
+ export declare function describeResource(el: {
120
+ tagName?: unknown;
121
+ rel?: unknown;
122
+ currentSrc?: unknown;
123
+ src?: unknown;
124
+ href?: unknown;
125
+ }, url: string, ua: string | null, ts: number): BeaconEvent;
126
+ /** A `securitypolicyviolation` event → the stored event; null for a report-only policy (nothing was blocked). */
127
+ export declare function describeViolation(raw: {
128
+ blockedURI?: unknown;
129
+ effectiveDirective?: unknown;
130
+ violatedDirective?: unknown;
131
+ sourceFile?: unknown;
132
+ lineNumber?: unknown;
133
+ columnNumber?: unknown;
134
+ disposition?: unknown;
135
+ }, url: string, ua: string | null, ts: number): BeaconEvent | null;
80
136
  /**
81
137
  * Split events into POST bodies that each fit the server cap (≤ 20 events,
82
138
  * ≤ 8 KiB); an event too big on its own loses its stack, then its message tail.
139
+ * Every body carries `version`; only the first says `load: true`. A page load
140
+ * with no events is one body with an empty list.
83
141
  */
84
- export declare function packBatches(events: BeaconEvent[]): string[];
142
+ export declare function packBatches(events: BeaconEvent[], meta?: BeaconMeta): string[];
85
143
  /**
86
- * Register `error` + `unhandledrejection` listeners that report to the app's
87
- * beacon. Idempotent per window (a second call returns null).
144
+ * Report this page's load, then listen for uncaught errors, unhandled
145
+ * rejections, failed resource loads (capture phase — they do not bubble) and
146
+ * CSP violations. Idempotent per window (a second call returns null).
88
147
  */
89
148
  export declare function installBeacon(env?: BeaconEnv): BeaconHandle | null;
90
149
  export {};
package/dist/beacon.js CHANGED
@@ -1,18 +1,31 @@
1
1
  /**
2
- * The browser error beacon — runs in the BROWSER on the app's
3
- * own origin. The compiler adds `import "/__drobek/beacon.js?v=<hash>"` at the
4
- * top of every JS entry of an app (unless its drobek.json says
5
- * `"beacon": false`), so every app reports its uncaught errors and unhandled
6
- * promise rejections without configuration; the agent reads them with MCP
7
- * `get_logs({ kind: 'runtime' })`.
2
+ * The browser beacon — runs in the BROWSER on the app's own origin. The
3
+ * compiler adds `import "/__drobek/beacon.js?v=<hash>"` at the top of every JS
4
+ * entry of an app (unless its drobek.json says `"beacon": false`), so every
5
+ * app reports without configuration:
6
+ *
7
+ * - that the page loaded (once per page load — a count only, nothing about
8
+ * the visitor),
9
+ * - its uncaught errors and unhandled promise rejections,
10
+ * - a script, stylesheet, image or media file that failed to load (the
11
+ * `error` event of the element, seen in the capture phase),
12
+ * - a request the Content-Security-Policy blocked (`securitypolicyviolation`).
13
+ *
14
+ * The agent reads them with MCP `get_logs({ kind: 'runtime' })` and the
15
+ * per-version counts in `get_app` (`render`).
8
16
  *
9
17
  * Contract with the server (`POST /__drobek/v1/_beacon`, @drobek/insights):
10
- * same-origin, JSON `{ events: [{ type, message, stack, url, ua, ts }] }`,
11
- * ≤ 20 events and ≤ 8 KiB per POST (over-cap → 413). The server redacts
18
+ * same-origin, JSON `{ version, load?, events: [{ type, message, stack, url,
19
+ * ua, ts }] }`, ≤ 20 events and ≤ 8 KiB per POST (over-cap → 413).
20
+ * `version` is the app version the page was served from — the app host
21
+ * names it in the document's `Server-Timing: drobek-version;desc="<N>"`
22
+ * (null when the browser does not expose it: the server then files the
23
+ * report under the version the host serves now). The server redacts
12
24
  * e-mails / tokens and truncates again — the client caps are only there so a
13
- * POST fits. The page `url` is only its origin + path: a query
14
- * string or fragment can carry one-time codes, tokens or PII the redaction
15
- * cannot recognise (`?code=123456`), so it never leaves the browser.
25
+ * POST fits. The page `url` and every resource address are only origin +
26
+ * path: a query string or fragment can carry one-time codes, tokens or PII
27
+ * the redaction cannot recognise (`?code=123456`), so it never leaves the
28
+ * browser.
16
29
  *
17
30
  * Never throws, never recurses (an error while reporting is dropped), sends
18
31
  * at most 100 events per page load and at most 3 copies of the same error.
@@ -28,6 +41,8 @@ export const BEACON_MAX_PER_PAGE = 100;
28
41
  export const BEACON_MAX_REPEATS = 3;
29
42
  /** Queued events are sent this long after the first one (and on pagehide). */
30
43
  export const BEACON_FLUSH_MS = 1000;
44
+ /** The `Server-Timing` metric whose description is the version the page was served from. */
45
+ export const VERSION_TIMING_METRIC = 'drobek-version';
31
46
  const MAX_MESSAGE = 1000;
32
47
  const MAX_STACK = 4000;
33
48
  const MAX_URL = 1024;
@@ -69,6 +84,51 @@ export function pageUrl(href) {
69
84
  const cut = raw.search(/[?#]/);
70
85
  return cut === -1 ? raw : raw.slice(0, cut);
71
86
  }
87
+ /**
88
+ * A resource address as reported: an http(s) URL as origin + path, another
89
+ * URL only by its scheme (`data:`, `blob:` — their contents never leave the
90
+ * browser), a CSP keyword (`inline`, `eval`) as it is.
91
+ */
92
+ export function resourceAddress(raw) {
93
+ const value = typeof raw === 'string' ? raw.trim() : '';
94
+ if (/^https?:/i.test(value))
95
+ return pageUrl(value);
96
+ const scheme = /^([a-z][a-z0-9+.-]*):/i.exec(value);
97
+ if (scheme)
98
+ return `${scheme[1].toLowerCase()}:`;
99
+ return /^[a-z-]+$/i.test(value) ? value : '';
100
+ }
101
+ /**
102
+ * The version the page was served from: the app host's
103
+ * `Server-Timing: drobek-version;desc="<N>"` on the document. null when the
104
+ * browser does not expose server timing (or the page was not served by drobek).
105
+ */
106
+ export function pageVersion(env) {
107
+ try {
108
+ const [nav] = env.performance?.getEntriesByType?.('navigation') ?? [];
109
+ const timings = nav?.serverTiming ?? [];
110
+ for (const t of timings) {
111
+ if (t?.name !== VERSION_TIMING_METRIC)
112
+ continue;
113
+ const n = Number(t.description);
114
+ return Number.isInteger(n) && n > 0 ? n : null;
115
+ }
116
+ }
117
+ catch {
118
+ /* no navigation timing → unknown */
119
+ }
120
+ return null;
121
+ }
122
+ function event(type, message, stack, url, ua, ts) {
123
+ return {
124
+ type,
125
+ message: cap(message || '(no message)', MAX_MESSAGE),
126
+ stack: stack ? cap(stack, MAX_STACK) : null,
127
+ url: cap(url, MAX_URL),
128
+ ua: ua ? cap(ua, MAX_UA) : null,
129
+ ts,
130
+ };
131
+ }
72
132
  /** An ErrorEvent / a rejection reason → the event the server stores. */
73
133
  export function describeError(type, raw, url, ua, ts) {
74
134
  const err = type === 'unhandledrejection' ? raw.reason : raw.error;
@@ -87,23 +147,50 @@ export function describeError(type, raw, url, ua, ts) {
87
147
  if (!stack && typeof raw.filename === 'string' && raw.filename) {
88
148
  stack = ` at ${raw.filename}:${Number(raw.lineno) || 0}:${Number(raw.colno) || 0}`;
89
149
  }
90
- return {
91
- type,
92
- message: cap(message || '(no message)', MAX_MESSAGE),
93
- stack: stack ? cap(stack, MAX_STACK) : null,
94
- url: cap(url, MAX_URL),
95
- ua: ua ? cap(ua, MAX_UA) : null,
96
- ts,
97
- };
150
+ return event(type, message, stack, url, ua, ts);
151
+ }
152
+ const RESOURCE_KINDS = {
153
+ SCRIPT: 'script',
154
+ IMG: 'image',
155
+ IMAGE: 'image',
156
+ VIDEO: 'video',
157
+ AUDIO: 'audio',
158
+ SOURCE: 'media source',
159
+ TRACK: 'text track',
160
+ EMBED: 'embed',
161
+ OBJECT: 'object',
162
+ };
163
+ /** The element whose load failed (an `error` event that did not come from the window) → the stored event. */
164
+ export function describeResource(el, url, ua, ts) {
165
+ const tag = typeof el.tagName === 'string' ? el.tagName.toUpperCase() : '';
166
+ const kind = tag === 'LINK'
167
+ ? String(el.rel ?? '').toLowerCase().split(/\s+/).includes('stylesheet')
168
+ ? 'stylesheet'
169
+ : 'link'
170
+ : (RESOURCE_KINDS[tag] ?? (tag.toLowerCase() || 'resource'));
171
+ const address = resourceAddress([el.currentSrc, el.src, el.href].find((v) => typeof v === 'string' && v !== '') ?? '');
172
+ return event('resource', `Failed to load ${kind}${address ? `: ${address}` : ''}`, null, url, ua, ts);
173
+ }
174
+ /** A `securitypolicyviolation` event → the stored event; null for a report-only policy (nothing was blocked). */
175
+ export function describeViolation(raw, url, ua, ts) {
176
+ if (raw.disposition === 'report')
177
+ return null;
178
+ const directive = [raw.effectiveDirective, raw.violatedDirective].find((v) => typeof v === 'string' && v !== '') ?? 'a directive';
179
+ const blocked = resourceAddress(raw.blockedURI) || 'a request';
180
+ const source = resourceAddress(raw.sourceFile);
181
+ const stack = /^https?:/i.test(source) ? ` at ${source}:${Number(raw.lineNumber) || 0}:${Number(raw.columnNumber) || 0}` : null;
182
+ return event('csp', `Content-Security-Policy blocked ${blocked} (${String(directive)})`, stack, url, ua, ts);
98
183
  }
99
184
  /**
100
185
  * Split events into POST bodies that each fit the server cap (≤ 20 events,
101
186
  * ≤ 8 KiB); an event too big on its own loses its stack, then its message tail.
187
+ * Every body carries `version`; only the first says `load: true`. A page load
188
+ * with no events is one body with an empty list.
102
189
  */
103
- export function packBatches(events) {
190
+ export function packBatches(events, meta = { version: null }) {
104
191
  const bodies = [];
105
192
  let batch = [];
106
- const body = (list) => JSON.stringify({ events: list });
193
+ const body = (list) => JSON.stringify({ version: meta.version, ...(meta.load && bodies.length === 0 ? { load: true } : {}), events: list });
107
194
  for (let e of events) {
108
195
  if (utf8Length(body([e])) > BATCH_BUDGET)
109
196
  e = { ...e, stack: null };
@@ -118,13 +205,21 @@ export function packBatches(events) {
118
205
  batch = next;
119
206
  }
120
207
  }
121
- if (batch.length > 0)
208
+ if (batch.length > 0 || (meta.load && bodies.length === 0))
122
209
  bodies.push(body(batch));
123
210
  return bodies;
124
211
  }
212
+ /** Is this `error` event about an element (a failed load) rather than the window (an uncaught error)? */
213
+ function failedElement(e, env) {
214
+ const target = e?.target;
215
+ if (!target || target === env || typeof target !== 'object')
216
+ return null;
217
+ return typeof target.tagName === 'string' ? target : null;
218
+ }
125
219
  /**
126
- * Register `error` + `unhandledrejection` listeners that report to the app's
127
- * beacon. Idempotent per window (a second call returns null).
220
+ * Report this page's load, then listen for uncaught errors, unhandled
221
+ * rejections, failed resource loads (capture phase — they do not bubble) and
222
+ * CSP violations. Idempotent per window (a second call returns null).
128
223
  */
129
224
  export function installBeacon(env = globalThis) {
130
225
  const holder = env;
@@ -133,6 +228,8 @@ export function installBeacon(env = globalThis) {
133
228
  holder[INSTALLED] = true;
134
229
  const queue = [];
135
230
  const seen = new Map();
231
+ const version = pageVersion(env);
232
+ let loadPending = true;
136
233
  let sent = 0;
137
234
  let timer = false;
138
235
  let busy = false;
@@ -160,20 +257,40 @@ export function installBeacon(env = globalThis) {
160
257
  }
161
258
  function flush() {
162
259
  timer = false;
163
- if (queue.length === 0)
260
+ if (queue.length === 0 && !loadPending)
164
261
  return;
165
262
  const events = queue.splice(0, queue.length);
166
- for (const b of packBatches(events))
167
- send(b);
263
+ const load = loadPending;
264
+ loadPending = false;
265
+ try {
266
+ for (const b of packBatches(events, { version, load }))
267
+ send(b);
268
+ }
269
+ catch {
270
+ /* reporting must never break the app */
271
+ }
272
+ }
273
+ function schedule() {
274
+ if (timer)
275
+ return;
276
+ timer = true;
277
+ try {
278
+ env.setTimeout(flush, BEACON_FLUSH_MS);
279
+ }
280
+ catch {
281
+ timer = false;
282
+ }
168
283
  }
169
- function report(type, raw) {
284
+ function report(make) {
170
285
  if (busy)
171
286
  return;
172
287
  busy = true;
173
288
  try {
174
289
  if (sent >= BEACON_MAX_PER_PAGE)
175
290
  return;
176
- const ev = describeError(type, raw, pageUrl(env.location?.href), env.navigator?.userAgent ?? null, now());
291
+ const ev = make(pageUrl(env.location?.href), env.navigator?.userAgent ?? null, now());
292
+ if (!ev)
293
+ return;
177
294
  const key = `${ev.type}\n${ev.message}\n${(ev.stack ?? '').split('\n').slice(0, 2).join('\n')}`;
178
295
  const n = (seen.get(key) ?? 0) + 1;
179
296
  seen.set(key, n);
@@ -181,10 +298,7 @@ export function installBeacon(env = globalThis) {
181
298
  return;
182
299
  sent += 1;
183
300
  queue.push(ev);
184
- if (!timer) {
185
- timer = true;
186
- env.setTimeout(flush, BEACON_FLUSH_MS);
187
- }
301
+ schedule();
188
302
  }
189
303
  catch {
190
304
  /* never recurse into the error handler */
@@ -193,12 +307,20 @@ export function installBeacon(env = globalThis) {
193
307
  busy = false;
194
308
  }
195
309
  }
196
- env.addEventListener('error', (e) => report('error', (e ?? {})));
197
- env.addEventListener('unhandledrejection', (e) => report('unhandledrejection', (e ?? {})));
310
+ env.addEventListener('error', (e) => {
311
+ const el = failedElement(e, env);
312
+ if (el)
313
+ report((url, ua, ts) => describeResource(el, url, ua, ts));
314
+ else
315
+ report((url, ua, ts) => describeError('error', (e ?? {}), url, ua, ts));
316
+ }, true);
317
+ env.addEventListener('unhandledrejection', (e) => report((url, ua, ts) => describeError('unhandledrejection', (e ?? {}), url, ua, ts)));
318
+ env.addEventListener('securitypolicyviolation', (e) => report((url, ua, ts) => describeViolation((e ?? {}), url, ua, ts)));
198
319
  env.addEventListener('pagehide', () => flush());
199
320
  env.document?.addEventListener?.('visibilitychange', () => {
200
321
  if (env.document?.visibilityState === 'hidden')
201
322
  flush();
202
323
  });
324
+ schedule();
203
325
  return { flush, pending: () => queue.length };
204
326
  }
package/dist/index.d.ts CHANGED
@@ -3,9 +3,10 @@
3
3
  * into `/__drobek/sdk.js` with the SDK entry of every active platform module;
4
4
  * module SDK entries type their argument with `SdkCore` from here.
5
5
  * `beacon.ts` is bundled into `/__drobek/beacon.js`, which the
6
- * compiler imports into every app: uncaught browser errors → the app's beacon.
6
+ * compiler imports into every app: the page load, uncaught browser errors,
7
+ * failed resource loads and CSP blocks → the app's beacon.
7
8
  */
8
9
  export declare const SDK_VERSION = "1.0.0";
9
10
  export { DrobekError, MODULE_API_BASE, SDK_HEADER, createCore, type QueryValue, type RequestOptions, type SdkCore, } from './core.js';
10
11
  export { CORE_SDK_TYPES } from './types.js';
11
- export { BEACON_ENDPOINT, BEACON_FLUSH_MS, BEACON_MAX_BATCH, BEACON_MAX_BYTES, BEACON_MAX_PER_PAGE, BEACON_MAX_REPEATS, describeError, installBeacon, packBatches, type BeaconEnv, type BeaconEvent, type BeaconHandle, } from './beacon.js';
12
+ export { BEACON_ENDPOINT, BEACON_FLUSH_MS, BEACON_MAX_BATCH, BEACON_MAX_BYTES, BEACON_MAX_PER_PAGE, BEACON_MAX_REPEATS, VERSION_TIMING_METRIC, describeError, describeResource, describeViolation, installBeacon, packBatches, pageVersion, type BeaconEnv, type BeaconEvent, type BeaconEventType, type BeaconHandle, type BeaconMeta, } from './beacon.js';
package/dist/index.js CHANGED
@@ -3,9 +3,10 @@
3
3
  * into `/__drobek/sdk.js` with the SDK entry of every active platform module;
4
4
  * module SDK entries type their argument with `SdkCore` from here.
5
5
  * `beacon.ts` is bundled into `/__drobek/beacon.js`, which the
6
- * compiler imports into every app: uncaught browser errors → the app's beacon.
6
+ * compiler imports into every app: the page load, uncaught browser errors,
7
+ * failed resource loads and CSP blocks → the app's beacon.
7
8
  */
8
9
  export const SDK_VERSION = '1.0.0';
9
10
  export { DrobekError, MODULE_API_BASE, SDK_HEADER, createCore, } from './core.js';
10
11
  export { CORE_SDK_TYPES } from './types.js';
11
- export { BEACON_ENDPOINT, BEACON_FLUSH_MS, BEACON_MAX_BATCH, BEACON_MAX_BYTES, BEACON_MAX_PER_PAGE, BEACON_MAX_REPEATS, describeError, installBeacon, packBatches, } from './beacon.js';
12
+ export { BEACON_ENDPOINT, BEACON_FLUSH_MS, BEACON_MAX_BATCH, BEACON_MAX_BYTES, BEACON_MAX_PER_PAGE, BEACON_MAX_REPEATS, VERSION_TIMING_METRIC, describeError, describeResource, describeViolation, installBeacon, packBatches, pageVersion, } from './beacon.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@freema/drobek-sdk",
3
- "version": "0.7.3",
3
+ "version": "0.7.6",
4
4
  "description": "The drobek browser SDK core: the SdkCore a platform module's SDK entry receives, DrobekError, the error beacon.",
5
5
  "license": "AGPL-3.0-only",
6
6
  "type": "module",