@hullop/tlm 0.0.0-stage → 0.2.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.
@@ -0,0 +1,58 @@
1
+ import { B as Breadcrumb, C as CaptureContext, L as Level, T as TlmOptions, a as TestResult } from './types-BluGo23D.cjs';
2
+ export { b as BreadcrumbKind, F as Frame, R as RequestTiming, c as RumContext, d as RumHandle, e as RumPlugin, f as TlmEvent } from './types-BluGo23D.cjs';
3
+
4
+ /** The version of this SDK, as sent in every event's `sdk.version`. */
5
+ declare const SDK_VERSION: string;
6
+ /**
7
+ * Starts reporting errors to Tlm. Call it once, as early as possible in
8
+ * your app's entry point:
9
+ *
10
+ * ```ts
11
+ * import * as Tlm from "@hullop/tlm";
12
+ *
13
+ * Tlm.init({ dsn: "https://tlm_…@tlm.hullop.com" });
14
+ * ```
15
+ *
16
+ * Options not given are read from the page's meta tags (`tlm-dsn`,
17
+ * `tlm-environment`, `tlm-release`), so a server-rendered page can call a
18
+ * bare `Tlm.init()`. Without a DSN, nothing is captured or sent. Calling it
19
+ * again replaces the options. Safe to import during server-side rendering:
20
+ * it does nothing there.
21
+ */
22
+ declare function init(options?: TlmOptions): void;
23
+ /**
24
+ * Sends one test error, to check your setup end to end. Resolves to
25
+ * `{ ok: true, id }` once Tlm accepts it, or `{ ok: false, reason }`,
26
+ * and logs one line to the console either way. With `debug: true` it's also
27
+ * `window.__tlm.test()`, for the browser console.
28
+ */
29
+ declare function test(): Promise<TestResult>;
30
+ /**
31
+ * Reports an error you caught. Returns the event id, or `undefined` if it
32
+ * wasn't sent (no DSN, ignored, duplicate, dropped by `beforeSend`).
33
+ */
34
+ declare function captureException(error: unknown, context?: CaptureContext): string | undefined;
35
+ /** Reports something that isn't an error: `captureMessage("Payment slow", "warning")`. */
36
+ declare function captureMessage(message: string, context?: CaptureContext | Level): string | undefined;
37
+ /** Attaches your user's id to the following events. An id, not personal data. `null` clears it. */
38
+ declare function setUser(user: {
39
+ id: string | number;
40
+ } | null): void;
41
+ /** Adds a tag to the following events, e.g. `setTag("plan", "pro")`. */
42
+ declare function setTag(key: string, value: string): void;
43
+ /** Adds several tags to the following events. */
44
+ declare function setTags(tags: Record<string, string>): void;
45
+ /** Records something that happened, to be sent with the next events. */
46
+ declare function addBreadcrumb(crumb: Breadcrumb): void;
47
+ /** Waits until queued events are sent. Resolves `false` if `timeoutMs` (default 2000) passes first. */
48
+ declare function flush(timeoutMs?: number): Promise<boolean>;
49
+ /**
50
+ * Names the current page for RUM, e.g. `setRoute("/products/:id")`, so
51
+ * pages group by route instead of by Tlm's guess. Call it after the
52
+ * URL changes; it names that page view only. Does nothing without RUM.
53
+ */
54
+ declare function setRoute(name: string | undefined): void;
55
+ /** Stops capturing and removes everything the SDK installed. */
56
+ declare function close(): void;
57
+
58
+ export { Breadcrumb, CaptureContext, Level, SDK_VERSION, TestResult, TlmOptions, addBreadcrumb, captureException, captureMessage, close, flush, init, setRoute, setTag, setTags, setUser, test };
@@ -0,0 +1,58 @@
1
+ import { B as Breadcrumb, C as CaptureContext, L as Level, T as TlmOptions, a as TestResult } from './types-BluGo23D.js';
2
+ export { b as BreadcrumbKind, F as Frame, R as RequestTiming, c as RumContext, d as RumHandle, e as RumPlugin, f as TlmEvent } from './types-BluGo23D.js';
3
+
4
+ /** The version of this SDK, as sent in every event's `sdk.version`. */
5
+ declare const SDK_VERSION: string;
6
+ /**
7
+ * Starts reporting errors to Tlm. Call it once, as early as possible in
8
+ * your app's entry point:
9
+ *
10
+ * ```ts
11
+ * import * as Tlm from "@hullop/tlm";
12
+ *
13
+ * Tlm.init({ dsn: "https://tlm_…@tlm.hullop.com" });
14
+ * ```
15
+ *
16
+ * Options not given are read from the page's meta tags (`tlm-dsn`,
17
+ * `tlm-environment`, `tlm-release`), so a server-rendered page can call a
18
+ * bare `Tlm.init()`. Without a DSN, nothing is captured or sent. Calling it
19
+ * again replaces the options. Safe to import during server-side rendering:
20
+ * it does nothing there.
21
+ */
22
+ declare function init(options?: TlmOptions): void;
23
+ /**
24
+ * Sends one test error, to check your setup end to end. Resolves to
25
+ * `{ ok: true, id }` once Tlm accepts it, or `{ ok: false, reason }`,
26
+ * and logs one line to the console either way. With `debug: true` it's also
27
+ * `window.__tlm.test()`, for the browser console.
28
+ */
29
+ declare function test(): Promise<TestResult>;
30
+ /**
31
+ * Reports an error you caught. Returns the event id, or `undefined` if it
32
+ * wasn't sent (no DSN, ignored, duplicate, dropped by `beforeSend`).
33
+ */
34
+ declare function captureException(error: unknown, context?: CaptureContext): string | undefined;
35
+ /** Reports something that isn't an error: `captureMessage("Payment slow", "warning")`. */
36
+ declare function captureMessage(message: string, context?: CaptureContext | Level): string | undefined;
37
+ /** Attaches your user's id to the following events. An id, not personal data. `null` clears it. */
38
+ declare function setUser(user: {
39
+ id: string | number;
40
+ } | null): void;
41
+ /** Adds a tag to the following events, e.g. `setTag("plan", "pro")`. */
42
+ declare function setTag(key: string, value: string): void;
43
+ /** Adds several tags to the following events. */
44
+ declare function setTags(tags: Record<string, string>): void;
45
+ /** Records something that happened, to be sent with the next events. */
46
+ declare function addBreadcrumb(crumb: Breadcrumb): void;
47
+ /** Waits until queued events are sent. Resolves `false` if `timeoutMs` (default 2000) passes first. */
48
+ declare function flush(timeoutMs?: number): Promise<boolean>;
49
+ /**
50
+ * Names the current page for RUM, e.g. `setRoute("/products/:id")`, so
51
+ * pages group by route instead of by Tlm's guess. Call it after the
52
+ * URL changes; it names that page view only. Does nothing without RUM.
53
+ */
54
+ declare function setRoute(name: string | undefined): void;
55
+ /** Stops capturing and removes everything the SDK installed. */
56
+ declare function close(): void;
57
+
58
+ export { Breadcrumb, CaptureContext, Level, SDK_VERSION, TestResult, TlmOptions, addBreadcrumb, captureException, captureMessage, close, flush, init, setRoute, setTag, setTags, setUser, test };