@starko-one/sdk 0.0.0-stage → 0.1.0-beta.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/CHANGELOG.md +124 -0
- package/LICENSE +17 -0
- package/NOTICE +58 -0
- package/README.md +81 -2
- package/dist/api-B5IHeINe.d.ts +558 -0
- package/dist/api-DR4HazCu.d.cts +558 -0
- package/dist/browser/index.cjs +168 -0
- package/dist/browser/index.d.cts +131 -0
- package/dist/browser/index.d.ts +131 -0
- package/dist/browser/index.js +7 -0
- package/dist/build/rollup.cjs +22 -0
- package/dist/build/rollup.d.cts +34 -0
- package/dist/build/rollup.d.ts +34 -0
- package/dist/build/rollup.js +3 -0
- package/dist/build/vite.cjs +51 -0
- package/dist/build/vite.d.cts +23 -0
- package/dist/build/vite.d.ts +23 -0
- package/dist/build/vite.js +46 -0
- package/dist/build/webpack.cjs +18 -0
- package/dist/build/webpack.d.cts +39 -0
- package/dist/build/webpack.d.ts +39 -0
- package/dist/build/webpack.js +3 -0
- package/dist/chunk-7HYGODU6.cjs +583 -0
- package/dist/chunk-A5M4NOVT.js +413 -0
- package/dist/chunk-A7MYYWMP.cjs +15 -0
- package/dist/chunk-BAQA47FM.js +1113 -0
- package/dist/chunk-CM7HM6CC.js +563 -0
- package/dist/chunk-DFYNIWUN.js +608 -0
- package/dist/chunk-DMVVCGKO.cjs +96 -0
- package/dist/chunk-FARGXYJ4.cjs +56 -0
- package/dist/chunk-G3MYIAX2.js +1226 -0
- package/dist/chunk-G4NAVZQ4.js +249 -0
- package/dist/chunk-GH7RYPKS.js +96 -0
- package/dist/chunk-HADYYQNL.cjs +134 -0
- package/dist/chunk-HOQPAB4X.js +178 -0
- package/dist/chunk-J5RU73SW.js +214 -0
- package/dist/chunk-JNAJ3YZB.cjs +223 -0
- package/dist/chunk-KN7H22EQ.cjs +659 -0
- package/dist/chunk-LDQ4I7FZ.cjs +1151 -0
- package/dist/chunk-NPGESRVQ.js +1212 -0
- package/dist/chunk-OPWM5V7A.cjs +258 -0
- package/dist/chunk-PYYWPIFL.cjs +1230 -0
- package/dist/chunk-R7JLZ4WO.cjs +115 -0
- package/dist/chunk-SC6VQSES.js +213 -0
- package/dist/chunk-TPSJGLR3.cjs +220 -0
- package/dist/chunk-UKBY6HPC.js +131 -0
- package/dist/chunk-VRSEHRBX.cjs +185 -0
- package/dist/chunk-X74AONZA.js +90 -0
- package/dist/chunk-XW3I5CJN.js +12 -0
- package/dist/chunk-XW56FKKJ.js +53 -0
- package/dist/chunk-Z3G5SW7R.cjs +1251 -0
- package/dist/chunk-ZVMAN7OO.cjs +431 -0
- package/dist/cli/index.cjs +1487 -0
- package/dist/common-ARWXbeS3.d.ts +36 -0
- package/dist/common-CwIFh2hK.d.cts +36 -0
- package/dist/dedupe-eHBIfUUD.d.cts +13 -0
- package/dist/dedupe-fw8aNtt4.d.ts +13 -0
- package/dist/handler-DTZ4Rzcf.d.ts +82 -0
- package/dist/handler-_00lctTI.d.cts +82 -0
- package/dist/index.cjs +277 -0
- package/dist/index.d.cts +187 -0
- package/dist/index.d.ts +187 -0
- package/dist/index.js +4 -0
- package/dist/next/client.cjs +113 -0
- package/dist/next/client.d.cts +26 -0
- package/dist/next/client.d.ts +26 -0
- package/dist/next/client.js +41 -0
- package/dist/next/config.cjs +275 -0
- package/dist/next/config.d.cts +193 -0
- package/dist/next/config.d.ts +193 -0
- package/dist/next/config.js +261 -0
- package/dist/next/index.cjs +148 -0
- package/dist/next/index.d.cts +32 -0
- package/dist/next/index.d.ts +32 -0
- package/dist/next/index.js +59 -0
- package/dist/node/index.cjs +257 -0
- package/dist/node/index.d.cts +145 -0
- package/dist/node/index.d.ts +145 -0
- package/dist/node/index.js +83 -0
- package/dist/options-0BhybO54.d.cts +47 -0
- package/dist/options-0BhybO54.d.ts +47 -0
- package/dist/react/index.cjs +107 -0
- package/dist/react/index.d.cts +84 -0
- package/dist/react/index.d.ts +84 -0
- package/dist/react/index.js +103 -0
- package/dist/scope-Bvh45bOf.d.cts +404 -0
- package/dist/scope-Bvh45bOf.d.ts +404 -0
- package/dist/server-edge-BPOGA3GH.cjs +51 -0
- package/dist/server-edge-GYKAJREU.js +48 -0
- package/dist/server-node-HYK2OB2J.js +24 -0
- package/dist/server-node-J2DBAHDV.cjs +27 -0
- package/dist/session-C_WzbEN2.d.cts +4 -0
- package/dist/session-C_WzbEN2.d.ts +4 -0
- package/dist/session-propagation-B7REA7uy.d.cts +30 -0
- package/dist/session-propagation-BnJjKJbR.d.ts +30 -0
- package/dist/starko.min.js +6 -0
- package/docs/browser.md +381 -0
- package/docs/configuration.md +269 -0
- package/docs/nextjs.md +312 -0
- package/docs/node.md +376 -0
- package/docs/other-backends.md +232 -0
- package/docs/privacy.md +112 -0
- package/docs/react.md +187 -0
- package/docs/source-maps.md +332 -0
- package/docs/troubleshooting.md +171 -0
- package/docs/widget.md +84 -0
- package/docs/wire-format.md +367 -0
- package/package.json +98 -4
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { F as FramePlatform, M as Mechanism, b as WireException, c as StackFrame, B as Breadcrumb, W as WireEvent, R as RemoteConfig, d as SuppressionRule } from './scope-Bvh45bOf.cjs';
|
|
2
|
+
export { e as BreadcrumbBuffer, D as DEBUG_ID_COMMENT, f as DEBUG_ID_GLOBAL, g as DEBUG_ID_NAMESPACE, h as DEFAULT_HOST, I as IngestRejectReason, i as IngestResponse, j as LIMITS, L as Level, N as NATIVE_DEBUG_ID_GLOBAL, P as PATHS, k as Platform, l as REDACTED, m as RELEASE_GLOBAL, n as SENSITIVE_QUERY_PARAMS, o as SESSION_ID_PATTERN, p as SOURCEMAP_MAX_BYTES, q as SOURCEMAP_MAX_CHUNKS_PER_CHECK, r as SOURCEMAP_MAX_PARTS, s as SOURCEMAP_PART_BYTES, S as Scope, t as SourcemapCheckRequest, u as SourcemapCheckResponse, v as SourcemapCompleteRequest, w as SourcemapCompleteResponse, x as SourcemapUploadResponse, y as WIRE_VERSION, z as WireEnvelope, a as WireUser } from './scope-Bvh45bOf.cjs';
|
|
3
|
+
import { q as StackParser, P as ParsedFrame, r as StackLineParser } from './api-DR4HazCu.cjs';
|
|
4
|
+
export { C as Client, t as ClientOptions, E as EventHint, u as EventQueue, I as Integration, L as Logger, O as Options, v as PlatformOptions, Q as QueueOptions, S as SDK_VERSION, x as ScopeManager, a as Transport, T as TransportOptions, b as TransportResult, y as TransportSendOptions, c as addBreadcrumb, d as captureException, e as captureMessage, f as close, z as createLogger, A as eventUrl, g as flush, h as getClient, i as getCurrentScope, j as getGlobalScope, k as identify, B as safely, s as setContext, D as setCurrentClient, l as setExtra, m as setExtras, F as setScopeManager, n as setTag, o as setTags, p as setUser, G as uuid4, w as withScope } from './api-DR4HazCu.cjs';
|
|
5
|
+
export { d as dedupeIntegration } from './dedupe-eHBIfUUD.cjs';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Client-side rate limits, so a render loop or a crash loop never becomes a
|
|
9
|
+
* firehose:
|
|
10
|
+
* - a token bucket per key (`rateKey`: the first exception's type and its
|
|
11
|
+
* message with numbers and ids masked, so one noisy error never uses up
|
|
12
|
+
* the allowance of a different bug of the same type): `burst` events at
|
|
13
|
+
* once, then one more every `refillMs`. At most `MAX_BUCKETS` keys are
|
|
14
|
+
* kept, the least recently used dropped first (a noisy key in use is
|
|
15
|
+
* never reset by a stream of new ones);
|
|
16
|
+
* - a budget of events per rolling minute, all keys together (servers: a
|
|
17
|
+
* loop throwing many different errors);
|
|
18
|
+
* - a cap on events for the lifetime of the page (browsers). Servers have
|
|
19
|
+
* none: a process that runs for weeks must keep reporting.
|
|
20
|
+
*/
|
|
21
|
+
interface RateLimiterOptions {
|
|
22
|
+
/** Bucket size. Default 10. */
|
|
23
|
+
burst?: number;
|
|
24
|
+
/** One token back every this many ms. Default 10 000. */
|
|
25
|
+
refillMs?: number;
|
|
26
|
+
/** Events allowed for the lifetime of the page or process. Default: no cap. */
|
|
27
|
+
lifetimeCap?: number;
|
|
28
|
+
/** Events allowed in any 60 s window, all types together. Default: no budget. */
|
|
29
|
+
perMinute?: number;
|
|
30
|
+
}
|
|
31
|
+
type LimitReason = "lifetime cap" | "per-minute budget" | "rate limited";
|
|
32
|
+
declare class RateLimiter {
|
|
33
|
+
private buckets;
|
|
34
|
+
private sent;
|
|
35
|
+
/** Send times within the last minute (only kept when there is a per-minute budget). */
|
|
36
|
+
private recent;
|
|
37
|
+
readonly burst: number;
|
|
38
|
+
readonly refillMs: number;
|
|
39
|
+
readonly lifetimeCap: number;
|
|
40
|
+
readonly perMinute: number;
|
|
41
|
+
constructor(opts?: RateLimiterOptions);
|
|
42
|
+
/** `null` when the event may go; otherwise why it may not. Consumes a token when allowed. */
|
|
43
|
+
check(key: string, now?: number): LimitReason | null;
|
|
44
|
+
/** What `check` would answer, without consuming anything. */
|
|
45
|
+
peek(key: string, now?: number): LimitReason | null;
|
|
46
|
+
private test;
|
|
47
|
+
get count(): number;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Any thrown value → `exception_list`.
|
|
52
|
+
*
|
|
53
|
+
* Coercers (first match wins): ErrorEvent, PromiseRejectionEvent (and the
|
|
54
|
+
* CustomEvent some extensions turn it into), Error and DOMException,
|
|
55
|
+
* other DOM Events, plain objects, strings, primitives. `cause` and
|
|
56
|
+
* `AggregateError.errors` become chained exceptions linked by
|
|
57
|
+
* `mechanism.exception_id / parent_id`, depth-first, at most
|
|
58
|
+
* `LIMITS.MAX_EXCEPTIONS`, cycles cut.
|
|
59
|
+
*/
|
|
60
|
+
|
|
61
|
+
/** Intermediate form of one exception. */
|
|
62
|
+
interface ExceptionLike {
|
|
63
|
+
type: string;
|
|
64
|
+
value: string;
|
|
65
|
+
stack?: string;
|
|
66
|
+
/** Frames to drop from the top of `stack`. */
|
|
67
|
+
skip?: number;
|
|
68
|
+
synthetic?: boolean;
|
|
69
|
+
/** Values to chain after this one, with their `mechanism.source`. */
|
|
70
|
+
children?: Array<[source: string, value: unknown]>;
|
|
71
|
+
}
|
|
72
|
+
interface BuildContext {
|
|
73
|
+
parser: StackParser;
|
|
74
|
+
framePlatform: FramePlatform;
|
|
75
|
+
isInApp?: (filename: string | undefined) => boolean | undefined;
|
|
76
|
+
/** Stack of an Error made at the capture site, for values that carry none. */
|
|
77
|
+
synthetic?: {
|
|
78
|
+
stack?: string;
|
|
79
|
+
skip: number;
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
interface BuiltExceptions {
|
|
83
|
+
exceptions: WireException[];
|
|
84
|
+
/** A plain object thrown as an error, serialised: goes to `extra.__serialized__`. */
|
|
85
|
+
serialized?: unknown;
|
|
86
|
+
}
|
|
87
|
+
/** Turns one value into an ExceptionLike (no chaining yet). */
|
|
88
|
+
declare function coerce(value: unknown, ctx: BuildContext, serialized?: {
|
|
89
|
+
value?: unknown;
|
|
90
|
+
}): ExceptionLike;
|
|
91
|
+
/** Parsed frames → wire frames: platform, in_app, chunk_id. Most recent first. */
|
|
92
|
+
declare function toWireFrames(parsed: ParsedFrame[], ctx: BuildContext): StackFrame[];
|
|
93
|
+
/**
|
|
94
|
+
* Builds the whole `exception_list` for a thrown value: the value first,
|
|
95
|
+
* then its causes / aggregated errors depth-first.
|
|
96
|
+
*/
|
|
97
|
+
declare function buildExceptions(value: unknown, mechanism: Partial<Mechanism> | undefined, ctx: BuildContext): BuiltExceptions;
|
|
98
|
+
/** The event id an error was already captured as, if any. */
|
|
99
|
+
declare function capturedAs(value: unknown): string | undefined;
|
|
100
|
+
/** Remember that `value` (and what an ErrorEvent / rejection wraps) became `eventId`. */
|
|
101
|
+
declare function markCaptured(value: unknown, eventId: string): void;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Stack-string parsers. Original code; the formats covered (and the test
|
|
105
|
+
* samples) follow the cases Sentry's and PostHog's parsers document.
|
|
106
|
+
*
|
|
107
|
+
* Output order is the order of the stack string: MOST RECENT CALL FIRST
|
|
108
|
+
* (`frames[0]` is the throw site). Sentry and PostHog reverse theirs; we
|
|
109
|
+
* do not.
|
|
110
|
+
*
|
|
111
|
+
* Formats:
|
|
112
|
+
* - V8 (Chrome, Edge, Node, Deno, Bun): ` at fn (file:line:col)`,
|
|
113
|
+
* ` at file:line:col`, `async`, `new`, `[as alias]`, eval frames
|
|
114
|
+
* (`eval at outer (file:l:c), <anonymous>:l:c` → the outer location),
|
|
115
|
+
* `<anonymous>`, `native`, `index N` (Promise.all).
|
|
116
|
+
* - Gecko (Firefox) and JavaScriptCore (Safari): `fn@file:line:col`,
|
|
117
|
+
* `@file:line:col`, Firefox `async*fn@…`, `fn/<@…`, eval/Function frames
|
|
118
|
+
* (`file line N > eval:l:c` → file, line N), Safari `[native code]`,
|
|
119
|
+
* `global code@…`, frames without `@`.
|
|
120
|
+
*/
|
|
121
|
+
|
|
122
|
+
/** One V8 line (` at …`): Chrome, Edge, Node, Deno, Bun. */
|
|
123
|
+
declare const v8LineParser: StackLineParser;
|
|
124
|
+
/** One Firefox or Safari line (`fn@file:line:col`). */
|
|
125
|
+
declare const geckoLineParser: StackLineParser;
|
|
126
|
+
/**
|
|
127
|
+
* Builds a parser from line parsers. The format is decided per stack: a
|
|
128
|
+
* stack with any `at ` line is V8 (so a message line containing `@` is never
|
|
129
|
+
* read as a Gecko frame); otherwise every line goes to the Gecko parser.
|
|
130
|
+
*/
|
|
131
|
+
declare function createStackParser(v8?: StackLineParser, gecko?: StackLineParser): StackParser;
|
|
132
|
+
/** Chrome, Firefox and Safari stacks. */
|
|
133
|
+
declare const browserStackParser: StackParser;
|
|
134
|
+
/**
|
|
135
|
+
* Node stacks (`at fn (/app/x.js:1:2)`, `node:internal/…`, `file:///…`,
|
|
136
|
+
* Windows paths). The V8 line parser covers them; exported separately so
|
|
137
|
+
* the node SDK has a named parser to reuse.
|
|
138
|
+
*/
|
|
139
|
+
declare const nodeStackParser: StackParser;
|
|
140
|
+
|
|
141
|
+
type IdMap = Record<string, string>;
|
|
142
|
+
/** `filename → debug id` for every registered bundle; empty when nothing is registered. */
|
|
143
|
+
declare function getDebugIdMap(parser: StackParser): IdMap;
|
|
144
|
+
/** The release the build injected (`globalThis._starkoRelease`: a string or `{ id }`). */
|
|
145
|
+
declare function getInjectedRelease(): string | undefined;
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Trims an event to `LIMITS` (src/types/wire.ts) so the server never has
|
|
149
|
+
* to truncate or reject it, and rebuilds it from its known fields as plain
|
|
150
|
+
* JSON: whatever `beforeSend` or a hint put there (a bigint, a cycle, a
|
|
151
|
+
* throwing getter) cannot make the event, or the batch it travels in,
|
|
152
|
+
* unserialisable. URLs get the privacy defaults (core/url.ts), including
|
|
153
|
+
* frame file names and URLs inside messages. Runs last, after `beforeSend`.
|
|
154
|
+
* Returns a new event; the input is not modified.
|
|
155
|
+
*/
|
|
156
|
+
|
|
157
|
+
/** One event's serialised budget, so 20 of them always stay far below the body limit's worst case. */
|
|
158
|
+
declare const MAX_EVENT_BYTES: number;
|
|
159
|
+
/** Oldest first; drops the OLDEST until count and bytes fit. */
|
|
160
|
+
declare function trimBreadcrumbs(crumbs: Breadcrumb[]): Breadcrumb[];
|
|
161
|
+
declare function trimEvent(input: WireEvent): WireEvent;
|
|
162
|
+
|
|
163
|
+
/** A JSON-safe copy of `value`, at most `depth` levels deep. Never throws. */
|
|
164
|
+
declare function normalize(value: unknown, depth?: number): unknown;
|
|
165
|
+
/** JSON.stringify that never throws (falls back to a marker string). */
|
|
166
|
+
declare function safeStringify(v: unknown): string;
|
|
167
|
+
/**
|
|
168
|
+
* `normalize` within a byte budget: retries with shallower depth, then gives
|
|
169
|
+
* up with a marker object. The result serialises to at most `maxBytes`.
|
|
170
|
+
*/
|
|
171
|
+
declare function normalizeToSize<T = unknown>(value: unknown, maxBytes: number, depth?: number): T;
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Remote config (`GET /api/v1/ingest/config`): whether the SDK runs, the
|
|
175
|
+
* server-side sample rate and suppression rules. A missing or malformed
|
|
176
|
+
* answer means "enabled with defaults".
|
|
177
|
+
*/
|
|
178
|
+
|
|
179
|
+
declare const DEFAULT_REMOTE_CONFIG: RemoteConfig;
|
|
180
|
+
/** Validates whatever the server (or a broken proxy) returned. */
|
|
181
|
+
declare function normalizeRemoteConfig(raw: unknown): RemoteConfig;
|
|
182
|
+
/** True when the event matches a rule (every field the rule sets must match the first exception). */
|
|
183
|
+
declare function isSuppressed(event: WireEvent, rules: SuppressionRule[]): boolean;
|
|
184
|
+
|
|
185
|
+
declare function sanitizeUrl(url: string): string;
|
|
186
|
+
|
|
187
|
+
export { Breadcrumb, type BuildContext, DEFAULT_REMOTE_CONFIG, type ExceptionLike, FramePlatform, MAX_EVENT_BYTES, Mechanism, ParsedFrame, RateLimiter, type RateLimiterOptions, RemoteConfig, StackFrame, StackLineParser, StackParser, SuppressionRule, WireEvent, WireException, browserStackParser, buildExceptions, capturedAs, coerce, createStackParser, geckoLineParser, getDebugIdMap, getInjectedRelease, isSuppressed, markCaptured, nodeStackParser, normalize, normalizeRemoteConfig, normalizeToSize, safeStringify, sanitizeUrl, toWireFrames, trimBreadcrumbs, trimEvent, v8LineParser };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { F as FramePlatform, M as Mechanism, b as WireException, c as StackFrame, B as Breadcrumb, W as WireEvent, R as RemoteConfig, d as SuppressionRule } from './scope-Bvh45bOf.js';
|
|
2
|
+
export { e as BreadcrumbBuffer, D as DEBUG_ID_COMMENT, f as DEBUG_ID_GLOBAL, g as DEBUG_ID_NAMESPACE, h as DEFAULT_HOST, I as IngestRejectReason, i as IngestResponse, j as LIMITS, L as Level, N as NATIVE_DEBUG_ID_GLOBAL, P as PATHS, k as Platform, l as REDACTED, m as RELEASE_GLOBAL, n as SENSITIVE_QUERY_PARAMS, o as SESSION_ID_PATTERN, p as SOURCEMAP_MAX_BYTES, q as SOURCEMAP_MAX_CHUNKS_PER_CHECK, r as SOURCEMAP_MAX_PARTS, s as SOURCEMAP_PART_BYTES, S as Scope, t as SourcemapCheckRequest, u as SourcemapCheckResponse, v as SourcemapCompleteRequest, w as SourcemapCompleteResponse, x as SourcemapUploadResponse, y as WIRE_VERSION, z as WireEnvelope, a as WireUser } from './scope-Bvh45bOf.js';
|
|
3
|
+
import { q as StackParser, P as ParsedFrame, r as StackLineParser } from './api-B5IHeINe.js';
|
|
4
|
+
export { C as Client, t as ClientOptions, E as EventHint, u as EventQueue, I as Integration, L as Logger, O as Options, v as PlatformOptions, Q as QueueOptions, S as SDK_VERSION, x as ScopeManager, a as Transport, T as TransportOptions, b as TransportResult, y as TransportSendOptions, c as addBreadcrumb, d as captureException, e as captureMessage, f as close, z as createLogger, A as eventUrl, g as flush, h as getClient, i as getCurrentScope, j as getGlobalScope, k as identify, B as safely, s as setContext, D as setCurrentClient, l as setExtra, m as setExtras, F as setScopeManager, n as setTag, o as setTags, p as setUser, G as uuid4, w as withScope } from './api-B5IHeINe.js';
|
|
5
|
+
export { d as dedupeIntegration } from './dedupe-fw8aNtt4.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Client-side rate limits, so a render loop or a crash loop never becomes a
|
|
9
|
+
* firehose:
|
|
10
|
+
* - a token bucket per key (`rateKey`: the first exception's type and its
|
|
11
|
+
* message with numbers and ids masked, so one noisy error never uses up
|
|
12
|
+
* the allowance of a different bug of the same type): `burst` events at
|
|
13
|
+
* once, then one more every `refillMs`. At most `MAX_BUCKETS` keys are
|
|
14
|
+
* kept, the least recently used dropped first (a noisy key in use is
|
|
15
|
+
* never reset by a stream of new ones);
|
|
16
|
+
* - a budget of events per rolling minute, all keys together (servers: a
|
|
17
|
+
* loop throwing many different errors);
|
|
18
|
+
* - a cap on events for the lifetime of the page (browsers). Servers have
|
|
19
|
+
* none: a process that runs for weeks must keep reporting.
|
|
20
|
+
*/
|
|
21
|
+
interface RateLimiterOptions {
|
|
22
|
+
/** Bucket size. Default 10. */
|
|
23
|
+
burst?: number;
|
|
24
|
+
/** One token back every this many ms. Default 10 000. */
|
|
25
|
+
refillMs?: number;
|
|
26
|
+
/** Events allowed for the lifetime of the page or process. Default: no cap. */
|
|
27
|
+
lifetimeCap?: number;
|
|
28
|
+
/** Events allowed in any 60 s window, all types together. Default: no budget. */
|
|
29
|
+
perMinute?: number;
|
|
30
|
+
}
|
|
31
|
+
type LimitReason = "lifetime cap" | "per-minute budget" | "rate limited";
|
|
32
|
+
declare class RateLimiter {
|
|
33
|
+
private buckets;
|
|
34
|
+
private sent;
|
|
35
|
+
/** Send times within the last minute (only kept when there is a per-minute budget). */
|
|
36
|
+
private recent;
|
|
37
|
+
readonly burst: number;
|
|
38
|
+
readonly refillMs: number;
|
|
39
|
+
readonly lifetimeCap: number;
|
|
40
|
+
readonly perMinute: number;
|
|
41
|
+
constructor(opts?: RateLimiterOptions);
|
|
42
|
+
/** `null` when the event may go; otherwise why it may not. Consumes a token when allowed. */
|
|
43
|
+
check(key: string, now?: number): LimitReason | null;
|
|
44
|
+
/** What `check` would answer, without consuming anything. */
|
|
45
|
+
peek(key: string, now?: number): LimitReason | null;
|
|
46
|
+
private test;
|
|
47
|
+
get count(): number;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Any thrown value → `exception_list`.
|
|
52
|
+
*
|
|
53
|
+
* Coercers (first match wins): ErrorEvent, PromiseRejectionEvent (and the
|
|
54
|
+
* CustomEvent some extensions turn it into), Error and DOMException,
|
|
55
|
+
* other DOM Events, plain objects, strings, primitives. `cause` and
|
|
56
|
+
* `AggregateError.errors` become chained exceptions linked by
|
|
57
|
+
* `mechanism.exception_id / parent_id`, depth-first, at most
|
|
58
|
+
* `LIMITS.MAX_EXCEPTIONS`, cycles cut.
|
|
59
|
+
*/
|
|
60
|
+
|
|
61
|
+
/** Intermediate form of one exception. */
|
|
62
|
+
interface ExceptionLike {
|
|
63
|
+
type: string;
|
|
64
|
+
value: string;
|
|
65
|
+
stack?: string;
|
|
66
|
+
/** Frames to drop from the top of `stack`. */
|
|
67
|
+
skip?: number;
|
|
68
|
+
synthetic?: boolean;
|
|
69
|
+
/** Values to chain after this one, with their `mechanism.source`. */
|
|
70
|
+
children?: Array<[source: string, value: unknown]>;
|
|
71
|
+
}
|
|
72
|
+
interface BuildContext {
|
|
73
|
+
parser: StackParser;
|
|
74
|
+
framePlatform: FramePlatform;
|
|
75
|
+
isInApp?: (filename: string | undefined) => boolean | undefined;
|
|
76
|
+
/** Stack of an Error made at the capture site, for values that carry none. */
|
|
77
|
+
synthetic?: {
|
|
78
|
+
stack?: string;
|
|
79
|
+
skip: number;
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
interface BuiltExceptions {
|
|
83
|
+
exceptions: WireException[];
|
|
84
|
+
/** A plain object thrown as an error, serialised: goes to `extra.__serialized__`. */
|
|
85
|
+
serialized?: unknown;
|
|
86
|
+
}
|
|
87
|
+
/** Turns one value into an ExceptionLike (no chaining yet). */
|
|
88
|
+
declare function coerce(value: unknown, ctx: BuildContext, serialized?: {
|
|
89
|
+
value?: unknown;
|
|
90
|
+
}): ExceptionLike;
|
|
91
|
+
/** Parsed frames → wire frames: platform, in_app, chunk_id. Most recent first. */
|
|
92
|
+
declare function toWireFrames(parsed: ParsedFrame[], ctx: BuildContext): StackFrame[];
|
|
93
|
+
/**
|
|
94
|
+
* Builds the whole `exception_list` for a thrown value: the value first,
|
|
95
|
+
* then its causes / aggregated errors depth-first.
|
|
96
|
+
*/
|
|
97
|
+
declare function buildExceptions(value: unknown, mechanism: Partial<Mechanism> | undefined, ctx: BuildContext): BuiltExceptions;
|
|
98
|
+
/** The event id an error was already captured as, if any. */
|
|
99
|
+
declare function capturedAs(value: unknown): string | undefined;
|
|
100
|
+
/** Remember that `value` (and what an ErrorEvent / rejection wraps) became `eventId`. */
|
|
101
|
+
declare function markCaptured(value: unknown, eventId: string): void;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Stack-string parsers. Original code; the formats covered (and the test
|
|
105
|
+
* samples) follow the cases Sentry's and PostHog's parsers document.
|
|
106
|
+
*
|
|
107
|
+
* Output order is the order of the stack string: MOST RECENT CALL FIRST
|
|
108
|
+
* (`frames[0]` is the throw site). Sentry and PostHog reverse theirs; we
|
|
109
|
+
* do not.
|
|
110
|
+
*
|
|
111
|
+
* Formats:
|
|
112
|
+
* - V8 (Chrome, Edge, Node, Deno, Bun): ` at fn (file:line:col)`,
|
|
113
|
+
* ` at file:line:col`, `async`, `new`, `[as alias]`, eval frames
|
|
114
|
+
* (`eval at outer (file:l:c), <anonymous>:l:c` → the outer location),
|
|
115
|
+
* `<anonymous>`, `native`, `index N` (Promise.all).
|
|
116
|
+
* - Gecko (Firefox) and JavaScriptCore (Safari): `fn@file:line:col`,
|
|
117
|
+
* `@file:line:col`, Firefox `async*fn@…`, `fn/<@…`, eval/Function frames
|
|
118
|
+
* (`file line N > eval:l:c` → file, line N), Safari `[native code]`,
|
|
119
|
+
* `global code@…`, frames without `@`.
|
|
120
|
+
*/
|
|
121
|
+
|
|
122
|
+
/** One V8 line (` at …`): Chrome, Edge, Node, Deno, Bun. */
|
|
123
|
+
declare const v8LineParser: StackLineParser;
|
|
124
|
+
/** One Firefox or Safari line (`fn@file:line:col`). */
|
|
125
|
+
declare const geckoLineParser: StackLineParser;
|
|
126
|
+
/**
|
|
127
|
+
* Builds a parser from line parsers. The format is decided per stack: a
|
|
128
|
+
* stack with any `at ` line is V8 (so a message line containing `@` is never
|
|
129
|
+
* read as a Gecko frame); otherwise every line goes to the Gecko parser.
|
|
130
|
+
*/
|
|
131
|
+
declare function createStackParser(v8?: StackLineParser, gecko?: StackLineParser): StackParser;
|
|
132
|
+
/** Chrome, Firefox and Safari stacks. */
|
|
133
|
+
declare const browserStackParser: StackParser;
|
|
134
|
+
/**
|
|
135
|
+
* Node stacks (`at fn (/app/x.js:1:2)`, `node:internal/…`, `file:///…`,
|
|
136
|
+
* Windows paths). The V8 line parser covers them; exported separately so
|
|
137
|
+
* the node SDK has a named parser to reuse.
|
|
138
|
+
*/
|
|
139
|
+
declare const nodeStackParser: StackParser;
|
|
140
|
+
|
|
141
|
+
type IdMap = Record<string, string>;
|
|
142
|
+
/** `filename → debug id` for every registered bundle; empty when nothing is registered. */
|
|
143
|
+
declare function getDebugIdMap(parser: StackParser): IdMap;
|
|
144
|
+
/** The release the build injected (`globalThis._starkoRelease`: a string or `{ id }`). */
|
|
145
|
+
declare function getInjectedRelease(): string | undefined;
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Trims an event to `LIMITS` (src/types/wire.ts) so the server never has
|
|
149
|
+
* to truncate or reject it, and rebuilds it from its known fields as plain
|
|
150
|
+
* JSON: whatever `beforeSend` or a hint put there (a bigint, a cycle, a
|
|
151
|
+
* throwing getter) cannot make the event, or the batch it travels in,
|
|
152
|
+
* unserialisable. URLs get the privacy defaults (core/url.ts), including
|
|
153
|
+
* frame file names and URLs inside messages. Runs last, after `beforeSend`.
|
|
154
|
+
* Returns a new event; the input is not modified.
|
|
155
|
+
*/
|
|
156
|
+
|
|
157
|
+
/** One event's serialised budget, so 20 of them always stay far below the body limit's worst case. */
|
|
158
|
+
declare const MAX_EVENT_BYTES: number;
|
|
159
|
+
/** Oldest first; drops the OLDEST until count and bytes fit. */
|
|
160
|
+
declare function trimBreadcrumbs(crumbs: Breadcrumb[]): Breadcrumb[];
|
|
161
|
+
declare function trimEvent(input: WireEvent): WireEvent;
|
|
162
|
+
|
|
163
|
+
/** A JSON-safe copy of `value`, at most `depth` levels deep. Never throws. */
|
|
164
|
+
declare function normalize(value: unknown, depth?: number): unknown;
|
|
165
|
+
/** JSON.stringify that never throws (falls back to a marker string). */
|
|
166
|
+
declare function safeStringify(v: unknown): string;
|
|
167
|
+
/**
|
|
168
|
+
* `normalize` within a byte budget: retries with shallower depth, then gives
|
|
169
|
+
* up with a marker object. The result serialises to at most `maxBytes`.
|
|
170
|
+
*/
|
|
171
|
+
declare function normalizeToSize<T = unknown>(value: unknown, maxBytes: number, depth?: number): T;
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Remote config (`GET /api/v1/ingest/config`): whether the SDK runs, the
|
|
175
|
+
* server-side sample rate and suppression rules. A missing or malformed
|
|
176
|
+
* answer means "enabled with defaults".
|
|
177
|
+
*/
|
|
178
|
+
|
|
179
|
+
declare const DEFAULT_REMOTE_CONFIG: RemoteConfig;
|
|
180
|
+
/** Validates whatever the server (or a broken proxy) returned. */
|
|
181
|
+
declare function normalizeRemoteConfig(raw: unknown): RemoteConfig;
|
|
182
|
+
/** True when the event matches a rule (every field the rule sets must match the first exception). */
|
|
183
|
+
declare function isSuppressed(event: WireEvent, rules: SuppressionRule[]): boolean;
|
|
184
|
+
|
|
185
|
+
declare function sanitizeUrl(url: string): string;
|
|
186
|
+
|
|
187
|
+
export { Breadcrumb, type BuildContext, DEFAULT_REMOTE_CONFIG, type ExceptionLike, FramePlatform, MAX_EVENT_BYTES, Mechanism, ParsedFrame, RateLimiter, type RateLimiterOptions, RemoteConfig, StackFrame, StackLineParser, StackParser, SuppressionRule, WireEvent, WireException, browserStackParser, buildExceptions, capturedAs, coerce, createStackParser, geckoLineParser, getDebugIdMap, getInjectedRelease, isSuppressed, markCaptured, nodeStackParser, normalize, normalizeRemoteConfig, normalizeToSize, safeStringify, sanitizeUrl, toWireFrames, trimBreadcrumbs, trimEvent, v8LineParser };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { Client, DEFAULT_REMOTE_CONFIG, EventQueue, MAX_EVENT_BYTES, RateLimiter, browserStackParser, createStackParser, dedupeIntegration, eventUrl, geckoLineParser, isSuppressed, nodeStackParser, normalizeRemoteConfig, sanitizeUrl, trimBreadcrumbs, trimEvent, v8LineParser } from './chunk-NPGESRVQ.js';
|
|
2
|
+
export { buildExceptions, capturedAs, coerce, getDebugIdMap, getInjectedRelease, markCaptured, toWireFrames } from './chunk-G4NAVZQ4.js';
|
|
3
|
+
export { BreadcrumbBuffer, SDK_VERSION, Scope, addBreadcrumb, captureException, captureMessage, close, createLogger, flush, getClient, getCurrentScope, getGlobalScope, identify, normalize, normalizeToSize, safeStringify, safely, setContext, setCurrentClient, setExtra, setExtras, setScopeManager, setTag, setTags, setUser, uuid4, withScope } from './chunk-DFYNIWUN.js';
|
|
4
|
+
export { DEBUG_ID_COMMENT, DEBUG_ID_GLOBAL, DEBUG_ID_NAMESPACE, DEFAULT_HOST, LIMITS, NATIVE_DEBUG_ID_GLOBAL, PATHS, REDACTED, RELEASE_GLOBAL, SENSITIVE_QUERY_PARAMS, SESSION_ID_PATTERN, SOURCEMAP_MAX_BYTES, SOURCEMAP_MAX_CHUNKS_PER_CHECK, SOURCEMAP_MAX_PARTS, SOURCEMAP_PART_BYTES, WIRE_VERSION } from './chunk-GH7RYPKS.js';
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunk7HYGODU6_cjs = require('../chunk-7HYGODU6.cjs');
|
|
4
|
+
require('../chunk-HADYYQNL.cjs');
|
|
5
|
+
require('../chunk-PYYWPIFL.cjs');
|
|
6
|
+
var chunkDMVVCGKO_cjs = require('../chunk-DMVVCGKO.cjs');
|
|
7
|
+
require('../chunk-A7MYYWMP.cjs');
|
|
8
|
+
require('../chunk-OPWM5V7A.cjs');
|
|
9
|
+
var chunkKN7H22EQ_cjs = require('../chunk-KN7H22EQ.cjs');
|
|
10
|
+
require('../chunk-R7JLZ4WO.cjs');
|
|
11
|
+
|
|
12
|
+
// src/next/client.ts
|
|
13
|
+
function init2(options) {
|
|
14
|
+
try {
|
|
15
|
+
const user = options.integrations;
|
|
16
|
+
return chunk7HYGODU6_cjs.init({
|
|
17
|
+
...options,
|
|
18
|
+
// Precedence: see `buildTimeRelease`. Unset here, the client reads the injected global per event.
|
|
19
|
+
release: options.release || chunkDMVVCGKO_cjs.buildTimeRelease(),
|
|
20
|
+
integrations: (defaults) => {
|
|
21
|
+
const withNext = [...defaults, chunkDMVVCGKO_cjs.nextControlFlowIntegration()];
|
|
22
|
+
return typeof user === "function" ? user(withNext) : [...withNext, ...user || []];
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
} catch {
|
|
26
|
+
return void 0;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function captureGlobalError(error, options = {}) {
|
|
30
|
+
try {
|
|
31
|
+
if (chunkDMVVCGKO_cjs.isNextControlFlow(error)) return "";
|
|
32
|
+
const digest = chunkDMVVCGKO_cjs.digestOf(error);
|
|
33
|
+
if (digest && !(options && options.serverErrors)) return "";
|
|
34
|
+
return chunkKN7H22EQ_cjs.captureException(error, { mechanism: { type: "next.global-error", handled: true }, ...digest ? { tags: { "next.digest": digest } } : {} });
|
|
35
|
+
} catch {
|
|
36
|
+
return "";
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
Object.defineProperty(exports, "getDefaultIntegrations", {
|
|
41
|
+
enumerable: true,
|
|
42
|
+
get: function () { return chunk7HYGODU6_cjs.getDefaultIntegrations; }
|
|
43
|
+
});
|
|
44
|
+
Object.defineProperty(exports, "sessionPropagationIntegration", {
|
|
45
|
+
enumerable: true,
|
|
46
|
+
get: function () { return chunk7HYGODU6_cjs.sessionPropagationIntegration; }
|
|
47
|
+
});
|
|
48
|
+
Object.defineProperty(exports, "isNextControlFlow", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function () { return chunkDMVVCGKO_cjs.isNextControlFlow; }
|
|
51
|
+
});
|
|
52
|
+
Object.defineProperty(exports, "nextControlFlowIntegration", {
|
|
53
|
+
enumerable: true,
|
|
54
|
+
get: function () { return chunkDMVVCGKO_cjs.nextControlFlowIntegration; }
|
|
55
|
+
});
|
|
56
|
+
Object.defineProperty(exports, "addBreadcrumb", {
|
|
57
|
+
enumerable: true,
|
|
58
|
+
get: function () { return chunkKN7H22EQ_cjs.addBreadcrumb; }
|
|
59
|
+
});
|
|
60
|
+
Object.defineProperty(exports, "captureException", {
|
|
61
|
+
enumerable: true,
|
|
62
|
+
get: function () { return chunkKN7H22EQ_cjs.captureException; }
|
|
63
|
+
});
|
|
64
|
+
Object.defineProperty(exports, "captureMessage", {
|
|
65
|
+
enumerable: true,
|
|
66
|
+
get: function () { return chunkKN7H22EQ_cjs.captureMessage; }
|
|
67
|
+
});
|
|
68
|
+
Object.defineProperty(exports, "close", {
|
|
69
|
+
enumerable: true,
|
|
70
|
+
get: function () { return chunkKN7H22EQ_cjs.close; }
|
|
71
|
+
});
|
|
72
|
+
Object.defineProperty(exports, "flush", {
|
|
73
|
+
enumerable: true,
|
|
74
|
+
get: function () { return chunkKN7H22EQ_cjs.flush; }
|
|
75
|
+
});
|
|
76
|
+
Object.defineProperty(exports, "getClient", {
|
|
77
|
+
enumerable: true,
|
|
78
|
+
get: function () { return chunkKN7H22EQ_cjs.getClient; }
|
|
79
|
+
});
|
|
80
|
+
Object.defineProperty(exports, "identify", {
|
|
81
|
+
enumerable: true,
|
|
82
|
+
get: function () { return chunkKN7H22EQ_cjs.identify; }
|
|
83
|
+
});
|
|
84
|
+
Object.defineProperty(exports, "setContext", {
|
|
85
|
+
enumerable: true,
|
|
86
|
+
get: function () { return chunkKN7H22EQ_cjs.setContext; }
|
|
87
|
+
});
|
|
88
|
+
Object.defineProperty(exports, "setExtra", {
|
|
89
|
+
enumerable: true,
|
|
90
|
+
get: function () { return chunkKN7H22EQ_cjs.setExtra; }
|
|
91
|
+
});
|
|
92
|
+
Object.defineProperty(exports, "setExtras", {
|
|
93
|
+
enumerable: true,
|
|
94
|
+
get: function () { return chunkKN7H22EQ_cjs.setExtras; }
|
|
95
|
+
});
|
|
96
|
+
Object.defineProperty(exports, "setTag", {
|
|
97
|
+
enumerable: true,
|
|
98
|
+
get: function () { return chunkKN7H22EQ_cjs.setTag; }
|
|
99
|
+
});
|
|
100
|
+
Object.defineProperty(exports, "setTags", {
|
|
101
|
+
enumerable: true,
|
|
102
|
+
get: function () { return chunkKN7H22EQ_cjs.setTags; }
|
|
103
|
+
});
|
|
104
|
+
Object.defineProperty(exports, "setUser", {
|
|
105
|
+
enumerable: true,
|
|
106
|
+
get: function () { return chunkKN7H22EQ_cjs.setUser; }
|
|
107
|
+
});
|
|
108
|
+
Object.defineProperty(exports, "withScope", {
|
|
109
|
+
enumerable: true,
|
|
110
|
+
get: function () { return chunkKN7H22EQ_cjs.withScope; }
|
|
111
|
+
});
|
|
112
|
+
exports.captureGlobalError = captureGlobalError;
|
|
113
|
+
exports.init = init2;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { C as Client } from '../api-DR4HazCu.cjs';
|
|
2
|
+
export { E as EventHint, I as Integration, c as addBreadcrumb, d as captureException, e as captureMessage, f as close, g as flush, h as getClient, k as identify, s as setContext, l as setExtra, m as setExtras, n as setTag, o as setTags, p as setUser, w as withScope } from '../api-DR4HazCu.cjs';
|
|
3
|
+
import { B as BrowserOptions } from '../session-propagation-B7REA7uy.cjs';
|
|
4
|
+
export { g as getDefaultIntegrations, s as sessionPropagationIntegration } from '../session-propagation-B7REA7uy.cjs';
|
|
5
|
+
export { i as isNextControlFlow, n as nextControlFlowIntegration } from '../common-CwIFh2hK.cjs';
|
|
6
|
+
import '../scope-Bvh45bOf.cjs';
|
|
7
|
+
|
|
8
|
+
type NextClientOptions = BrowserOptions;
|
|
9
|
+
/** Start the browser SDK with Next's defaults. Never throws. */
|
|
10
|
+
declare function init(options: NextClientOptions): Client | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* Report the error `app/global-error.tsx` (or an `error.tsx`) receives.
|
|
13
|
+
* Call it from an effect. Returns the event id ("" when nothing was
|
|
14
|
+
* captured). Not captured: Next's control flow; an error the SDK already
|
|
15
|
+
* captured (through a React root hook or the global handlers); and an error
|
|
16
|
+
* that came from the server: Next gives those a `digest`, and the server's
|
|
17
|
+
* `onRequestError` (`@starko-one/sdk/next`) has already reported it, with
|
|
18
|
+
* the same digest in the `next.digest` tag and this page's session id.
|
|
19
|
+
* Without the server SDK, pass `{ serverErrors: true }` to report those
|
|
20
|
+
* from the browser instead.
|
|
21
|
+
*/
|
|
22
|
+
declare function captureGlobalError(error: unknown, options?: {
|
|
23
|
+
serverErrors?: boolean;
|
|
24
|
+
}): string;
|
|
25
|
+
|
|
26
|
+
export { BrowserOptions, Client, type NextClientOptions, captureGlobalError, init };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { C as Client } from '../api-B5IHeINe.js';
|
|
2
|
+
export { E as EventHint, I as Integration, c as addBreadcrumb, d as captureException, e as captureMessage, f as close, g as flush, h as getClient, k as identify, s as setContext, l as setExtra, m as setExtras, n as setTag, o as setTags, p as setUser, w as withScope } from '../api-B5IHeINe.js';
|
|
3
|
+
import { B as BrowserOptions } from '../session-propagation-BnJjKJbR.js';
|
|
4
|
+
export { g as getDefaultIntegrations, s as sessionPropagationIntegration } from '../session-propagation-BnJjKJbR.js';
|
|
5
|
+
export { i as isNextControlFlow, n as nextControlFlowIntegration } from '../common-ARWXbeS3.js';
|
|
6
|
+
import '../scope-Bvh45bOf.js';
|
|
7
|
+
|
|
8
|
+
type NextClientOptions = BrowserOptions;
|
|
9
|
+
/** Start the browser SDK with Next's defaults. Never throws. */
|
|
10
|
+
declare function init(options: NextClientOptions): Client | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* Report the error `app/global-error.tsx` (or an `error.tsx`) receives.
|
|
13
|
+
* Call it from an effect. Returns the event id ("" when nothing was
|
|
14
|
+
* captured). Not captured: Next's control flow; an error the SDK already
|
|
15
|
+
* captured (through a React root hook or the global handlers); and an error
|
|
16
|
+
* that came from the server: Next gives those a `digest`, and the server's
|
|
17
|
+
* `onRequestError` (`@starko-one/sdk/next`) has already reported it, with
|
|
18
|
+
* the same digest in the `next.digest` tag and this page's session id.
|
|
19
|
+
* Without the server SDK, pass `{ serverErrors: true }` to report those
|
|
20
|
+
* from the browser instead.
|
|
21
|
+
*/
|
|
22
|
+
declare function captureGlobalError(error: unknown, options?: {
|
|
23
|
+
serverErrors?: boolean;
|
|
24
|
+
}): string;
|
|
25
|
+
|
|
26
|
+
export { BrowserOptions, Client, type NextClientOptions, captureGlobalError, init };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { init } from '../chunk-CM7HM6CC.js';
|
|
2
|
+
export { getDefaultIntegrations, sessionPropagationIntegration } from '../chunk-CM7HM6CC.js';
|
|
3
|
+
import '../chunk-UKBY6HPC.js';
|
|
4
|
+
import '../chunk-NPGESRVQ.js';
|
|
5
|
+
import { nextControlFlowIntegration, buildTimeRelease, isNextControlFlow, digestOf } from '../chunk-X74AONZA.js';
|
|
6
|
+
export { isNextControlFlow, nextControlFlowIntegration } from '../chunk-X74AONZA.js';
|
|
7
|
+
import '../chunk-XW3I5CJN.js';
|
|
8
|
+
import '../chunk-G4NAVZQ4.js';
|
|
9
|
+
import { captureException } from '../chunk-DFYNIWUN.js';
|
|
10
|
+
export { addBreadcrumb, captureException, captureMessage, close, flush, getClient, identify, setContext, setExtra, setExtras, setTag, setTags, setUser, withScope } from '../chunk-DFYNIWUN.js';
|
|
11
|
+
import '../chunk-GH7RYPKS.js';
|
|
12
|
+
|
|
13
|
+
// src/next/client.ts
|
|
14
|
+
function init2(options) {
|
|
15
|
+
try {
|
|
16
|
+
const user = options.integrations;
|
|
17
|
+
return init({
|
|
18
|
+
...options,
|
|
19
|
+
// Precedence: see `buildTimeRelease`. Unset here, the client reads the injected global per event.
|
|
20
|
+
release: options.release || buildTimeRelease(),
|
|
21
|
+
integrations: (defaults) => {
|
|
22
|
+
const withNext = [...defaults, nextControlFlowIntegration()];
|
|
23
|
+
return typeof user === "function" ? user(withNext) : [...withNext, ...user || []];
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
} catch {
|
|
27
|
+
return void 0;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function captureGlobalError(error, options = {}) {
|
|
31
|
+
try {
|
|
32
|
+
if (isNextControlFlow(error)) return "";
|
|
33
|
+
const digest = digestOf(error);
|
|
34
|
+
if (digest && !(options && options.serverErrors)) return "";
|
|
35
|
+
return captureException(error, { mechanism: { type: "next.global-error", handled: true }, ...digest ? { tags: { "next.digest": digest } } : {} });
|
|
36
|
+
} catch {
|
|
37
|
+
return "";
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export { captureGlobalError, init2 as init };
|