@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.
Files changed (108) hide show
  1. package/CHANGELOG.md +124 -0
  2. package/LICENSE +17 -0
  3. package/NOTICE +58 -0
  4. package/README.md +81 -2
  5. package/dist/api-B5IHeINe.d.ts +558 -0
  6. package/dist/api-DR4HazCu.d.cts +558 -0
  7. package/dist/browser/index.cjs +168 -0
  8. package/dist/browser/index.d.cts +131 -0
  9. package/dist/browser/index.d.ts +131 -0
  10. package/dist/browser/index.js +7 -0
  11. package/dist/build/rollup.cjs +22 -0
  12. package/dist/build/rollup.d.cts +34 -0
  13. package/dist/build/rollup.d.ts +34 -0
  14. package/dist/build/rollup.js +3 -0
  15. package/dist/build/vite.cjs +51 -0
  16. package/dist/build/vite.d.cts +23 -0
  17. package/dist/build/vite.d.ts +23 -0
  18. package/dist/build/vite.js +46 -0
  19. package/dist/build/webpack.cjs +18 -0
  20. package/dist/build/webpack.d.cts +39 -0
  21. package/dist/build/webpack.d.ts +39 -0
  22. package/dist/build/webpack.js +3 -0
  23. package/dist/chunk-7HYGODU6.cjs +583 -0
  24. package/dist/chunk-A5M4NOVT.js +413 -0
  25. package/dist/chunk-A7MYYWMP.cjs +15 -0
  26. package/dist/chunk-BAQA47FM.js +1113 -0
  27. package/dist/chunk-CM7HM6CC.js +563 -0
  28. package/dist/chunk-DFYNIWUN.js +608 -0
  29. package/dist/chunk-DMVVCGKO.cjs +96 -0
  30. package/dist/chunk-FARGXYJ4.cjs +56 -0
  31. package/dist/chunk-G3MYIAX2.js +1226 -0
  32. package/dist/chunk-G4NAVZQ4.js +249 -0
  33. package/dist/chunk-GH7RYPKS.js +96 -0
  34. package/dist/chunk-HADYYQNL.cjs +134 -0
  35. package/dist/chunk-HOQPAB4X.js +178 -0
  36. package/dist/chunk-J5RU73SW.js +214 -0
  37. package/dist/chunk-JNAJ3YZB.cjs +223 -0
  38. package/dist/chunk-KN7H22EQ.cjs +659 -0
  39. package/dist/chunk-LDQ4I7FZ.cjs +1151 -0
  40. package/dist/chunk-NPGESRVQ.js +1212 -0
  41. package/dist/chunk-OPWM5V7A.cjs +258 -0
  42. package/dist/chunk-PYYWPIFL.cjs +1230 -0
  43. package/dist/chunk-R7JLZ4WO.cjs +115 -0
  44. package/dist/chunk-SC6VQSES.js +213 -0
  45. package/dist/chunk-TPSJGLR3.cjs +220 -0
  46. package/dist/chunk-UKBY6HPC.js +131 -0
  47. package/dist/chunk-VRSEHRBX.cjs +185 -0
  48. package/dist/chunk-X74AONZA.js +90 -0
  49. package/dist/chunk-XW3I5CJN.js +12 -0
  50. package/dist/chunk-XW56FKKJ.js +53 -0
  51. package/dist/chunk-Z3G5SW7R.cjs +1251 -0
  52. package/dist/chunk-ZVMAN7OO.cjs +431 -0
  53. package/dist/cli/index.cjs +1487 -0
  54. package/dist/common-ARWXbeS3.d.ts +36 -0
  55. package/dist/common-CwIFh2hK.d.cts +36 -0
  56. package/dist/dedupe-eHBIfUUD.d.cts +13 -0
  57. package/dist/dedupe-fw8aNtt4.d.ts +13 -0
  58. package/dist/handler-DTZ4Rzcf.d.ts +82 -0
  59. package/dist/handler-_00lctTI.d.cts +82 -0
  60. package/dist/index.cjs +277 -0
  61. package/dist/index.d.cts +187 -0
  62. package/dist/index.d.ts +187 -0
  63. package/dist/index.js +4 -0
  64. package/dist/next/client.cjs +113 -0
  65. package/dist/next/client.d.cts +26 -0
  66. package/dist/next/client.d.ts +26 -0
  67. package/dist/next/client.js +41 -0
  68. package/dist/next/config.cjs +275 -0
  69. package/dist/next/config.d.cts +193 -0
  70. package/dist/next/config.d.ts +193 -0
  71. package/dist/next/config.js +261 -0
  72. package/dist/next/index.cjs +148 -0
  73. package/dist/next/index.d.cts +32 -0
  74. package/dist/next/index.d.ts +32 -0
  75. package/dist/next/index.js +59 -0
  76. package/dist/node/index.cjs +257 -0
  77. package/dist/node/index.d.cts +145 -0
  78. package/dist/node/index.d.ts +145 -0
  79. package/dist/node/index.js +83 -0
  80. package/dist/options-0BhybO54.d.cts +47 -0
  81. package/dist/options-0BhybO54.d.ts +47 -0
  82. package/dist/react/index.cjs +107 -0
  83. package/dist/react/index.d.cts +84 -0
  84. package/dist/react/index.d.ts +84 -0
  85. package/dist/react/index.js +103 -0
  86. package/dist/scope-Bvh45bOf.d.cts +404 -0
  87. package/dist/scope-Bvh45bOf.d.ts +404 -0
  88. package/dist/server-edge-BPOGA3GH.cjs +51 -0
  89. package/dist/server-edge-GYKAJREU.js +48 -0
  90. package/dist/server-node-HYK2OB2J.js +24 -0
  91. package/dist/server-node-J2DBAHDV.cjs +27 -0
  92. package/dist/session-C_WzbEN2.d.cts +4 -0
  93. package/dist/session-C_WzbEN2.d.ts +4 -0
  94. package/dist/session-propagation-B7REA7uy.d.cts +30 -0
  95. package/dist/session-propagation-BnJjKJbR.d.ts +30 -0
  96. package/dist/starko.min.js +6 -0
  97. package/docs/browser.md +381 -0
  98. package/docs/configuration.md +269 -0
  99. package/docs/nextjs.md +312 -0
  100. package/docs/node.md +376 -0
  101. package/docs/other-backends.md +232 -0
  102. package/docs/privacy.md +112 -0
  103. package/docs/react.md +187 -0
  104. package/docs/source-maps.md +332 -0
  105. package/docs/troubleshooting.md +171 -0
  106. package/docs/widget.md +84 -0
  107. package/docs/wire-format.md +367 -0
  108. package/package.json +98 -4
@@ -0,0 +1,404 @@
1
+ /**
2
+ * Wire format v1: the contract between every Starko SDK and the Starko
3
+ * ingest API. The prose version is docs/wire-format.md; the server validates
4
+ * the same shape (starko-v2 lib/error-tracking/wire.ts). A change here is a
5
+ * change to a public API: bump `WIRE_VERSION` for anything a v1 server would
6
+ * reject, and keep the fixtures in fixtures/wire/ valid.
7
+ *
8
+ * The exception shape (`exception_list`, `mechanism`, frames with `in_app`
9
+ * and `chunk_id`) follows the convention shared by Sentry and PostHog, with
10
+ * ONE deliberate difference: frames are ordered most recent call first (they
11
+ * send oldest first). Code adapted from their parsers must not reverse.
12
+ *
13
+ * Forward compatibility: a receiver ignores fields it does not know, treats an
14
+ * unknown `platform` as "other" and an unknown `level` as "error". Lengths are
15
+ * JavaScript string lengths (UTF-16 code units).
16
+ *
17
+ * This file has no imports and no runtime code except constants: it is
18
+ * safe to import from any environment.
19
+ */
20
+ declare const WIRE_VERSION: 1;
21
+ /** Where the event was captured. Drives how the server resolves and groups it. */
22
+ type Platform = "browser" | "node" | "dotnet" | "php" | "python" | "ruby" | "go" | "java" | "other";
23
+ type Level = "fatal" | "error" | "warning" | "info" | "debug";
24
+ /**
25
+ * How a frame's fields are to be read.
26
+ * - `web:javascript`: `filename` is a script URL; minified until the server resolves it.
27
+ * - `node:javascript`: `filename` is a file path; may still be bundled (chunk_id present).
28
+ * - `custom`: any other language. `lang` is required and no source-map resolution runs.
29
+ */
30
+ type FramePlatform = "web:javascript" | "node:javascript" | "custom";
31
+ interface StackFrame {
32
+ platform: FramePlatform;
33
+ /** Language name for `custom` frames, lowercase: "dotnet", "php", "python", … */
34
+ lang?: string;
35
+ /** Script URL (web) or file path. */
36
+ filename?: string;
37
+ /** Absolute path when `filename` is relative (server-side languages). */
38
+ abs_path?: string;
39
+ /** Function or method name; omit when unknown. */
40
+ function?: string;
41
+ /** Module / namespace / class the function belongs to. */
42
+ module?: string;
43
+ /** 1-based line. */
44
+ lineno?: number;
45
+ /** 1-based column. */
46
+ colno?: number;
47
+ /**
48
+ * True when the frame is the app's own code, false for dependencies and
49
+ * runtime internals. When absent the SERVER decides (false for node_modules,
50
+ * browser extensions, and after resolution for sources on a map's ignore list).
51
+ */
52
+ in_app?: boolean;
53
+ /** Debug id of the bundle the frame is in; the server finds the source map by it. */
54
+ chunk_id?: string;
55
+ /** The source line the frame points at, when the SDK can read source (Node, server languages). */
56
+ context_line?: string;
57
+ /** Lines before `context_line`, in file order. */
58
+ pre_context?: string[];
59
+ /** Lines after `context_line`, in file order. */
60
+ post_context?: string[];
61
+ /**
62
+ * True when names and positions are already original source. Honoured on
63
+ * `custom` frames (languages that run their source or carry debug info). On
64
+ * JavaScript frames the server ignores what the sender says and sets it
65
+ * itself after resolving a source map.
66
+ */
67
+ resolved?: boolean;
68
+ }
69
+ interface Mechanism {
70
+ /** What caught it: "onerror", "onunhandledrejection", "generic" (captureException), "middleware", "instrument", "chained". */
71
+ type: string;
72
+ /** False when the error was unhandled (it reached a global handler). */
73
+ handled: boolean;
74
+ /** True when the SDK made up the stack because the thrown value had none. */
75
+ synthetic?: boolean;
76
+ /** For chained exceptions: "cause" or "errors[n]". */
77
+ source?: string;
78
+ /** Position of this exception in `exception_list` when part of a chain. */
79
+ exception_id?: number;
80
+ /** `exception_id` of the exception this one is the cause of. */
81
+ parent_id?: number;
82
+ }
83
+ interface WireException {
84
+ /** Error class name: "TypeError", "System.NullReferenceException". */
85
+ type: string;
86
+ /** The message. */
87
+ value: string;
88
+ module?: string;
89
+ mechanism?: Mechanism;
90
+ /**
91
+ * Frames ordered MOST RECENT CALL FIRST: `frames[0]` is where the error was
92
+ * thrown. (Sentry sends the reverse; PostHog's SDKs differ by language and version, and the compat route normalises each.)
93
+ */
94
+ stacktrace?: {
95
+ type: "raw";
96
+ frames: StackFrame[];
97
+ };
98
+ }
99
+ interface WireUser {
100
+ /** The host app's own stable user id (Starko `external_id`). */
101
+ id?: string;
102
+ email?: string;
103
+ name?: string;
104
+ /**
105
+ * HMAC-SHA256 (hex) of the identifier, computed by the host's BACKEND with
106
+ * the workspace identity secret: over `id` when `id` is set, otherwise over
107
+ * `email` (the same value the Starko widget's `identify` takes). It is a
108
+ * credential: SDKs never log it and the server never stores or queues it.
109
+ */
110
+ hash?: string;
111
+ }
112
+ interface Breadcrumb {
113
+ /** Epoch ms. */
114
+ timestamp: number;
115
+ /** "navigation" | "http" | "ui" | "console" | "error" | "custom". */
116
+ type: string;
117
+ category?: string;
118
+ message?: string;
119
+ level?: Level;
120
+ data?: Record<string, unknown>;
121
+ }
122
+ interface WireEvent {
123
+ /** UUID minted by the SDK. The server stores an occurrence once per (workspace, event_id). */
124
+ event_id: string;
125
+ /**
126
+ * Epoch ms when the error happened, on the sender's clock. The server first
127
+ * corrects it by the clock skew it sees (`received - sent_at`, applied when
128
+ * larger than 5 minutes), then replaces it with the receipt time when it is
129
+ * still more than 24 h away from it.
130
+ */
131
+ timestamp: number;
132
+ platform: Platform;
133
+ level: Level;
134
+ /**
135
+ * The thrown error first, then its causes in order (`cause`, or the members
136
+ * of an AggregateError), linked through `mechanism.exception_id/parent_id`.
137
+ * At least one item.
138
+ */
139
+ exception_list: WireException[];
140
+ /** Overrides automatic grouping: events with the same value form one issue. */
141
+ fingerprint?: string;
142
+ /** Version of the app that produced the event; matches the release source maps were uploaded for. */
143
+ release?: string;
144
+ /** "production", "staging", … */
145
+ environment?: string;
146
+ /** Session id shared with the Starko widget / session replay, so the error links to the recording. */
147
+ session_id?: string;
148
+ user?: WireUser;
149
+ /**
150
+ * The Starko widget's client token, when the widget runs on the page: links
151
+ * the event to that exact client. A credential: the ingest route verifies it
152
+ * and keeps only the client id; it is never stored, queued or logged.
153
+ */
154
+ client_token?: string;
155
+ request?: {
156
+ url?: string;
157
+ method?: string;
158
+ route?: string;
159
+ referrer?: string;
160
+ };
161
+ /** Sent by server SDKs that forward a browser's user agent; browsers rely on the request header. */
162
+ user_agent?: string;
163
+ /** Host name of the server that captured the event (server SDKs). */
164
+ server_name?: string;
165
+ tags?: Record<string, string>;
166
+ extra?: Record<string, unknown>;
167
+ /** Named context blocks: `runtime`, `os`, `browser`, `device`, `app`, or the caller's own. */
168
+ contexts?: Record<string, Record<string, unknown>>;
169
+ breadcrumbs?: Breadcrumb[];
170
+ trace?: {
171
+ trace_id?: string;
172
+ span_id?: string;
173
+ };
174
+ }
175
+ interface WireEnvelope {
176
+ v: typeof WIRE_VERSION;
177
+ /** The workspace key (public). */
178
+ workspace: string;
179
+ sdk: {
180
+ name: string;
181
+ version: string;
182
+ };
183
+ /** Epoch ms on the sender's clock when THIS request left (refreshed on every retry); the server uses it to correct clock skew. */
184
+ sent_at: number;
185
+ events: WireEvent[];
186
+ }
187
+ /**
188
+ * Why a request was not accepted. An SDK switches itself off ONLY for
189
+ * `unknown_workspace`, `disabled` and `origin_not_allowed`, and only when they
190
+ * arrive in a JSON body of this shape: a 401/403 from a proxy, a firewall or
191
+ * a captive portal must never disable error reporting.
192
+ */
193
+ type IngestRejectReason = "unknown_workspace" | "disabled" | "origin_not_allowed" | "rate_limit" | "quota" | "busy" | "invalid" | "too_large" | "unsupported_version";
194
+ /** Body of every ingest response (`{ ok, message, data }`, the shape of the rest of the Starko public API). */
195
+ interface IngestResponse {
196
+ ok: boolean;
197
+ message: string;
198
+ data: {
199
+ accepted?: number;
200
+ rejected?: number;
201
+ /** False with reason "disabled". */
202
+ enabled?: boolean;
203
+ reason?: IngestRejectReason;
204
+ /** With reason "unsupported_version". */
205
+ supported_versions?: number[];
206
+ } | null;
207
+ }
208
+ /** `GET /api/v1/ingest/config` data: what the server lets this workspace's SDKs do. */
209
+ interface RemoteConfig {
210
+ /** False: the SDK installs nothing and sends nothing. */
211
+ enabled: boolean;
212
+ /** 0..1 share of events to send, applied by the SDK. */
213
+ sample_rate: number;
214
+ /** Events matching any rule are dropped on the client. All set fields of a rule must match. */
215
+ suppress: SuppressionRule[];
216
+ }
217
+ interface SuppressionRule {
218
+ /** Exact match on the first exception's `type`. */
219
+ type?: string;
220
+ /** Case-insensitive substring match on the first exception's `value`. */
221
+ value_contains?: string;
222
+ }
223
+ /** Hard limits. The SDK trims to them before sending; the server truncates (strings, arrays) or rejects (event, envelope) beyond them. */
224
+ declare const LIMITS: {
225
+ readonly MAX_EVENTS_PER_ENVELOPE: 20;
226
+ /** Bytes of the request body as sent (after gzip when compressed). */
227
+ readonly MAX_BODY_BYTES: number;
228
+ /** Bytes after decompression. */
229
+ readonly MAX_INFLATED_BYTES: number;
230
+ readonly MAX_EXCEPTIONS: 10;
231
+ /** Beyond it the 25 most recent and the 25 oldest frames are kept (the middle of a deep recursion is dropped). */
232
+ readonly MAX_FRAMES: 50;
233
+ /** Distinct `chunk_id`s the server resolves per event; frames of further chunks stay unresolved. */
234
+ readonly MAX_CHUNK_IDS_PER_EVENT: 8;
235
+ /** Nesting depth of the JSON body; deeper bodies are rejected before any processing. */
236
+ readonly MAX_JSON_DEPTH: 20;
237
+ readonly MAX_TYPE: 200;
238
+ readonly MAX_VALUE: 2000;
239
+ readonly MAX_FILENAME: 1000;
240
+ readonly MAX_FUNCTION: 300;
241
+ readonly MAX_CONTEXT_LINE: 300;
242
+ /** Lines in each of pre_context / post_context. */
243
+ readonly MAX_CONTEXT_LINES: 7;
244
+ readonly MAX_BREADCRUMBS: 50;
245
+ /** Serialized bytes of all breadcrumbs. */
246
+ readonly MAX_BREADCRUMB_BYTES: number;
247
+ readonly MAX_TAGS: 50;
248
+ readonly MAX_TAG_KEY: 64;
249
+ readonly MAX_TAG_VALUE: 256;
250
+ /** Serialized bytes of `extra` and of `contexts`, each. */
251
+ readonly MAX_EXTRA_BYTES: number;
252
+ readonly MAX_FINGERPRINT: 128;
253
+ readonly MAX_RELEASE: 128;
254
+ readonly MAX_ENVIRONMENT: 64;
255
+ readonly MAX_URL: 2048;
256
+ };
257
+ /** `session_id`: the format the Starko widget and recorder already use. */
258
+ declare const SESSION_ID_PATTERN: RegExp;
259
+ /** Paths on the Starko host. */
260
+ declare const PATHS: {
261
+ readonly INGEST: "/api/v1/ingest/errors";
262
+ readonly CONFIG: "/api/v1/ingest/config";
263
+ readonly SOURCEMAPS_CHECK: "/api/v1/sourcemaps/check";
264
+ readonly SOURCEMAPS_UPLOAD: "/api/v1/sourcemaps/upload";
265
+ readonly SOURCEMAPS_COMPLETE: "/api/v1/sourcemaps/complete";
266
+ };
267
+ declare const DEFAULT_HOST = "https://v2.starko.one";
268
+ /**
269
+ * Query parameters whose VALUES are replaced with "[redacted]" in every URL
270
+ * an SDK sends (page URL, referrer, request and breadcrumb URLs, frame file
271
+ * names, and URLs found inside exception messages and breadcrumb messages)
272
+ * and again on the server. A name matches when, compared case-insensitively,
273
+ * the whole name or any part of it is in this list; names split on `_`, `-`
274
+ * and camelCase boundaries (`accessToken`, `apiKey`, `X-Amz-Signature`). The
275
+ * `#fragment` and the userinfo (`user:pass@`) of a URL are always dropped.
276
+ */
277
+ declare const SENSITIVE_QUERY_PARAMS: readonly ["token", "access_token", "id_token", "refresh_token", "code", "key", "api_key", "apikey", "secret", "password", "passwd", "pwd", "auth", "authorization", "session", "sessionid", "sid", "sig", "signature", "jwt", "otp", "pin", "email", "phone", "ssn", "x-amz-signature", "x-amz-credential", "x-amz-security-token"];
278
+ declare const REDACTED = "[redacted]";
279
+ /** A source map is gzipped, cut into parts of at most this many bytes, and each part is one upload request. */
280
+ declare const SOURCEMAP_PART_BYTES: number;
281
+ /** Largest source map accepted, uncompressed. */
282
+ declare const SOURCEMAP_MAX_BYTES: number;
283
+ /** Parts per source map (`part` is 0-based, `parts` is the total). */
284
+ declare const SOURCEMAP_MAX_PARTS = 32;
285
+ /** Chunks per `check` request. */
286
+ declare const SOURCEMAP_MAX_CHUNKS_PER_CHECK = 500;
287
+ interface SourcemapCheckRequest {
288
+ /** The release these bundles belong to; created when new. */
289
+ release?: {
290
+ version: string;
291
+ commit?: string;
292
+ branch?: string;
293
+ };
294
+ chunks: Array<{
295
+ /** Debug id injected into the bundle. */
296
+ chunk_id: string;
297
+ /** sha256 hex of the uncompressed source map. */
298
+ content_hash: string;
299
+ }>;
300
+ }
301
+ interface SourcemapCheckResponse {
302
+ ok: boolean;
303
+ message: string;
304
+ /** `missing`: chunk ids the server does not have with that hash and wants uploaded. */
305
+ data: {
306
+ missing: string[];
307
+ } | null;
308
+ }
309
+ /**
310
+ * `POST /api/v1/sourcemaps/upload?chunk_id=…&part=<0-based>&parts=<total>&content_hash=…`
311
+ * with the part's bytes as the body (`application/octet-stream`). Parts may
312
+ * arrive in any order and be retried; the same part twice is a no-op.
313
+ */
314
+ interface SourcemapUploadResponse {
315
+ ok: boolean;
316
+ message: string;
317
+ data: {
318
+ part: number;
319
+ } | null;
320
+ }
321
+ interface SourcemapCompleteRequest {
322
+ chunk_id: string;
323
+ parts: number;
324
+ content_hash: string;
325
+ /** Bytes of the uncompressed map. */
326
+ size_bytes: number;
327
+ /** Path of the bundle the map belongs to, relative to the build output: shown in the dashboard. */
328
+ file_name?: string;
329
+ release?: {
330
+ version: string;
331
+ };
332
+ }
333
+ interface SourcemapCompleteResponse {
334
+ ok: boolean;
335
+ message: string;
336
+ data: {
337
+ chunk_id: string;
338
+ stored: boolean;
339
+ } | null;
340
+ }
341
+ /** Global map `{ [new Error().stack of the bundle]: debugId }` written by the injected snippet. */
342
+ declare const DEBUG_ID_GLOBAL = "_starkoDebugIds";
343
+ /** The same map as written by bundlers with native debug-id support (Turbopack, Rolldown). */
344
+ declare const NATIVE_DEBUG_ID_GLOBAL = "_debugIds";
345
+ /** Global holding the release when the build injected one. */
346
+ declare const RELEASE_GLOBAL = "_starkoRelease";
347
+ /** Trailing comment in a bundle and matching `debugId` field in its source map (TC39 debug-id proposal). */
348
+ declare const DEBUG_ID_COMMENT = "//# debugId=";
349
+ /** Namespace for content-addressed (UUIDv5) debug ids: the same bundle bytes always get the same id. */
350
+ declare const DEBUG_ID_NAMESPACE = "6f2d3c1e-9b4a-4f07-8a55-7c1e0d9b2a41";
351
+
352
+ /**
353
+ * Scope: the data applied to every event captured while it is current
354
+ * (user, tags, extra, contexts, fingerprint, level) and the breadcrumb
355
+ * buffer. `clone()` forks it for `withScope`.
356
+ */
357
+
358
+ /**
359
+ * Oldest-first ring of breadcrumbs capped by count AND by serialised bytes
360
+ * (`LIMITS.MAX_BREADCRUMB_BYTES`): adding evicts the oldest until both fit.
361
+ */
362
+ declare class BreadcrumbBuffer {
363
+ private maxItems;
364
+ private maxBytes;
365
+ private items;
366
+ private bytes;
367
+ constructor(maxItems?: number, maxBytes?: number);
368
+ add(input: Breadcrumb): void;
369
+ /** Change the count cap (0..50); the oldest are dropped when it shrinks. */
370
+ setMaxItems(n: number): void;
371
+ /** Oldest first. */
372
+ get(): Breadcrumb[];
373
+ get byteSize(): number;
374
+ clear(): void;
375
+ clone(): BreadcrumbBuffer;
376
+ }
377
+ declare class Scope {
378
+ user: WireUser | null;
379
+ tags: Record<string, string>;
380
+ extra: Record<string, unknown>;
381
+ contexts: Record<string, Record<string, unknown>>;
382
+ fingerprint: string | undefined;
383
+ level: Level | undefined;
384
+ breadcrumbs: BreadcrumbBuffer;
385
+ constructor(maxBreadcrumbs?: number);
386
+ setUser(user: WireUser | null): this;
387
+ setTag(key: string, value: unknown): this;
388
+ setTags(tags: Record<string, unknown>): this;
389
+ setExtra(key: string, value: unknown): this;
390
+ setExtras(extras: Record<string, unknown>): this;
391
+ /** `null` removes the context. */
392
+ setContext(name: string, context: Record<string, unknown> | null): this;
393
+ setFingerprint(fingerprint: string | undefined): this;
394
+ setLevel(level: Level | undefined): this;
395
+ addBreadcrumb(b: Breadcrumb): this;
396
+ clearBreadcrumbs(): this;
397
+ clear(): this;
398
+ /** A fork: changes to it never reach this scope. */
399
+ clone(): Scope;
400
+ /** Writes the scope's data into `event`; the event's own values win. */
401
+ applyToEvent(event: WireEvent): WireEvent;
402
+ }
403
+
404
+ export { type Breadcrumb as B, DEBUG_ID_COMMENT as D, type FramePlatform as F, type IngestRejectReason as I, type Level as L, type Mechanism as M, NATIVE_DEBUG_ID_GLOBAL as N, PATHS as P, type RemoteConfig as R, Scope as S, type WireEvent as W, type WireUser as a, type WireException as b, type StackFrame as c, type SuppressionRule as d, BreadcrumbBuffer as e, DEBUG_ID_GLOBAL as f, DEBUG_ID_NAMESPACE as g, DEFAULT_HOST as h, type IngestResponse as i, LIMITS as j, type Platform as k, REDACTED as l, RELEASE_GLOBAL as m, SENSITIVE_QUERY_PARAMS as n, SESSION_ID_PATTERN as o, SOURCEMAP_MAX_BYTES as p, SOURCEMAP_MAX_CHUNKS_PER_CHECK as q, SOURCEMAP_MAX_PARTS as r, SOURCEMAP_PART_BYTES as s, type SourcemapCheckRequest as t, type SourcemapCheckResponse as u, type SourcemapCompleteRequest as v, type SourcemapCompleteResponse as w, type SourcemapUploadResponse as x, WIRE_VERSION as y, type WireEnvelope as z };
@@ -0,0 +1,51 @@
1
+ 'use strict';
2
+
3
+ var chunkFARGXYJ4_cjs = require('./chunk-FARGXYJ4.cjs');
4
+ var chunkTPSJGLR3_cjs = require('./chunk-TPSJGLR3.cjs');
5
+ var chunkZVMAN7OO_cjs = require('./chunk-ZVMAN7OO.cjs');
6
+ require('./chunk-HADYYQNL.cjs');
7
+ var chunkPYYWPIFL_cjs = require('./chunk-PYYWPIFL.cjs');
8
+ var chunkDMVVCGKO_cjs = require('./chunk-DMVVCGKO.cjs');
9
+ require('./chunk-A7MYYWMP.cjs');
10
+ require('./chunk-OPWM5V7A.cjs');
11
+ var chunkKN7H22EQ_cjs = require('./chunk-KN7H22EQ.cjs');
12
+ require('./chunk-R7JLZ4WO.cjs');
13
+
14
+ // src/next/server-edge.ts
15
+ function init(input) {
16
+ try {
17
+ const options = chunkFARGXYJ4_cjs.withNextDefaults(input);
18
+ const previous = chunkKN7H22EQ_cjs.getClient();
19
+ if (previous) void previous.close(0);
20
+ chunkZVMAN7OO_cjs.installAsyncScopeManager();
21
+ const defaults = options.defaultIntegrations === false ? [] : [chunkPYYWPIFL_cjs.dedupeIntegration({ requestKey: chunkZVMAN7OO_cjs.currentRequestKey }), chunkTPSJGLR3_cjs.requestDataIntegration()];
22
+ const integrations = typeof options.integrations === "function" ? options.integrations(defaults) : [...defaults, ...options.integrations || []];
23
+ const { apiKey, fetch: fetchImpl, ...rest } = options;
24
+ const client = new chunkTPSJGLR3_cjs.ServerClient({
25
+ ...rest,
26
+ // Precedence: see `buildTimeRelease`. Unset here, the client reads the injected global per event.
27
+ release: rest.release || chunkDMVVCGKO_cjs.buildTimeRelease(),
28
+ platform: "node",
29
+ framePlatform: "node:javascript",
30
+ sdkName: "starko.nextjs.edge",
31
+ stackParser: chunkPYYWPIFL_cjs.nodeStackParser,
32
+ isInApp: chunkTPSJGLR3_cjs.nodeIsInApp,
33
+ getSessionId: () => chunkZVMAN7OO_cjs.getRequestData()?.sessionId,
34
+ ...chunkTPSJGLR3_cjs.SERVER_DEFAULTS,
35
+ transport: options.transport || ((o) => chunkTPSJGLR3_cjs.makeServerFetchTransport({ ...o, apiKey, fetchImpl: typeof fetchImpl === "function" ? fetchImpl : void 0 }))
36
+ });
37
+ chunkKN7H22EQ_cjs.setCurrentClient(client);
38
+ client.init(integrations);
39
+ chunkZVMAN7OO_cjs.noteInit(options.user ? chunkKN7H22EQ_cjs.getGlobalScope().user : null);
40
+ chunkZVMAN7OO_cjs.markServing();
41
+ return client;
42
+ } catch {
43
+ return void 0;
44
+ }
45
+ }
46
+ function captureRequestError(error, request, context, flushTimeout) {
47
+ return chunkFARGXYJ4_cjs.captureNextRequestError(error, request, context, flushTimeout, "edge");
48
+ }
49
+
50
+ exports.captureRequestError = captureRequestError;
51
+ exports.init = init;
@@ -0,0 +1,48 @@
1
+ import { withNextDefaults, captureNextRequestError } from './chunk-XW56FKKJ.js';
2
+ import { requestDataIntegration, ServerClient, makeServerFetchTransport, SERVER_DEFAULTS, nodeIsInApp } from './chunk-SC6VQSES.js';
3
+ import { installAsyncScopeManager, currentRequestKey, getRequestData, noteInit, markServing } from './chunk-A5M4NOVT.js';
4
+ import './chunk-UKBY6HPC.js';
5
+ import { dedupeIntegration, nodeStackParser } from './chunk-NPGESRVQ.js';
6
+ import { buildTimeRelease } from './chunk-X74AONZA.js';
7
+ import './chunk-XW3I5CJN.js';
8
+ import './chunk-G4NAVZQ4.js';
9
+ import { getClient, setCurrentClient, getGlobalScope } from './chunk-DFYNIWUN.js';
10
+ import './chunk-GH7RYPKS.js';
11
+
12
+ // src/next/server-edge.ts
13
+ function init(input) {
14
+ try {
15
+ const options = withNextDefaults(input);
16
+ const previous = getClient();
17
+ if (previous) void previous.close(0);
18
+ installAsyncScopeManager();
19
+ const defaults = options.defaultIntegrations === false ? [] : [dedupeIntegration({ requestKey: currentRequestKey }), requestDataIntegration()];
20
+ const integrations = typeof options.integrations === "function" ? options.integrations(defaults) : [...defaults, ...options.integrations || []];
21
+ const { apiKey, fetch: fetchImpl, ...rest } = options;
22
+ const client = new ServerClient({
23
+ ...rest,
24
+ // Precedence: see `buildTimeRelease`. Unset here, the client reads the injected global per event.
25
+ release: rest.release || buildTimeRelease(),
26
+ platform: "node",
27
+ framePlatform: "node:javascript",
28
+ sdkName: "starko.nextjs.edge",
29
+ stackParser: nodeStackParser,
30
+ isInApp: nodeIsInApp,
31
+ getSessionId: () => getRequestData()?.sessionId,
32
+ ...SERVER_DEFAULTS,
33
+ transport: options.transport || ((o) => makeServerFetchTransport({ ...o, apiKey, fetchImpl: typeof fetchImpl === "function" ? fetchImpl : void 0 }))
34
+ });
35
+ setCurrentClient(client);
36
+ client.init(integrations);
37
+ noteInit(options.user ? getGlobalScope().user : null);
38
+ markServing();
39
+ return client;
40
+ } catch {
41
+ return void 0;
42
+ }
43
+ }
44
+ function captureRequestError(error, request, context, flushTimeout) {
45
+ return captureNextRequestError(error, request, context, flushTimeout, "edge");
46
+ }
47
+
48
+ export { captureRequestError, init };
@@ -0,0 +1,24 @@
1
+ import { withNextDefaults, captureNextRequestError } from './chunk-XW56FKKJ.js';
2
+ import { initNode } from './chunk-BAQA47FM.js';
3
+ import './chunk-SC6VQSES.js';
4
+ import { markServing } from './chunk-A5M4NOVT.js';
5
+ import './chunk-UKBY6HPC.js';
6
+ import './chunk-NPGESRVQ.js';
7
+ import { buildTimeRelease } from './chunk-X74AONZA.js';
8
+ import './chunk-XW3I5CJN.js';
9
+ import { getInjectedRelease } from './chunk-G4NAVZQ4.js';
10
+ import './chunk-DFYNIWUN.js';
11
+ import './chunk-GH7RYPKS.js';
12
+
13
+ // src/next/server-node.ts
14
+ function init(options) {
15
+ const release = options.release || buildTimeRelease() || getInjectedRelease();
16
+ const client = initNode(withNextDefaults(release ? { ...options, release } : options), "starko.nextjs");
17
+ if (client) markServing();
18
+ return client;
19
+ }
20
+ function captureRequestError(error, request, context, flushTimeout) {
21
+ return captureNextRequestError(error, request, context, flushTimeout, "nodejs");
22
+ }
23
+
24
+ export { captureRequestError, init };
@@ -0,0 +1,27 @@
1
+ 'use strict';
2
+
3
+ var chunkFARGXYJ4_cjs = require('./chunk-FARGXYJ4.cjs');
4
+ var chunkLDQ4I7FZ_cjs = require('./chunk-LDQ4I7FZ.cjs');
5
+ require('./chunk-TPSJGLR3.cjs');
6
+ var chunkZVMAN7OO_cjs = require('./chunk-ZVMAN7OO.cjs');
7
+ require('./chunk-HADYYQNL.cjs');
8
+ require('./chunk-PYYWPIFL.cjs');
9
+ var chunkDMVVCGKO_cjs = require('./chunk-DMVVCGKO.cjs');
10
+ require('./chunk-A7MYYWMP.cjs');
11
+ var chunkOPWM5V7A_cjs = require('./chunk-OPWM5V7A.cjs');
12
+ require('./chunk-KN7H22EQ.cjs');
13
+ require('./chunk-R7JLZ4WO.cjs');
14
+
15
+ // src/next/server-node.ts
16
+ function init(options) {
17
+ const release = options.release || chunkDMVVCGKO_cjs.buildTimeRelease() || chunkOPWM5V7A_cjs.getInjectedRelease();
18
+ const client = chunkLDQ4I7FZ_cjs.initNode(chunkFARGXYJ4_cjs.withNextDefaults(release ? { ...options, release } : options), "starko.nextjs");
19
+ if (client) chunkZVMAN7OO_cjs.markServing();
20
+ return client;
21
+ }
22
+ function captureRequestError(error, request, context, flushTimeout) {
23
+ return chunkFARGXYJ4_cjs.captureNextRequestError(error, request, context, flushTimeout, "nodejs");
24
+ }
25
+
26
+ exports.captureRequestError = captureRequestError;
27
+ exports.init = init;
@@ -0,0 +1,4 @@
1
+ /** Lower case: Node lower-cases incoming header names. */
2
+ declare const SESSION_HEADER = "x-starko-session-id";
3
+
4
+ export { SESSION_HEADER as S };
@@ -0,0 +1,4 @@
1
+ /** Lower case: Node lower-cases incoming header names. */
2
+ declare const SESSION_HEADER = "x-starko-session-id";
3
+
4
+ export { SESSION_HEADER as S };
@@ -0,0 +1,30 @@
1
+ import { O as Options, I as Integration, C as Client } from './api-DR4HazCu.cjs';
2
+
3
+ /** `init()` for browsers. */
4
+
5
+ type BrowserOptions = Options;
6
+ /** In order: filters first (cheap drops), then dedupe, then the data adders. */
7
+ declare function getDefaultIntegrations(): Integration[];
8
+ /**
9
+ * Browser in-app rule: `false` for frames that are certainly not the app's
10
+ * (native code, extensions, node_modules served by a dev server); undefined
11
+ * otherwise, because a minified bundle mixes app and library code and only
12
+ * the server can tell after resolving its source map.
13
+ */
14
+ declare function browserIsInApp(filename: string | undefined): boolean | undefined;
15
+ /**
16
+ * Sends what is queued with `keepalive` when the page is hidden or unloading
17
+ * (the requests start inside the event handler), and ends a pause after
18
+ * repeated send failures when the browser comes back `online`.
19
+ */
20
+ declare function flushOnHideIntegration(): Integration;
21
+ /**
22
+ * Start the SDK. Calling it again replaces the previous client (whose hooks
23
+ * are removed). Returns the client, or undefined when it could not start;
24
+ * never throws.
25
+ */
26
+ declare function init(options: BrowserOptions): Client | undefined;
27
+
28
+ declare function sessionPropagationIntegration(): Integration;
29
+
30
+ export { type BrowserOptions as B, browserIsInApp as b, flushOnHideIntegration as f, getDefaultIntegrations as g, init as i, sessionPropagationIntegration as s };
@@ -0,0 +1,30 @@
1
+ import { O as Options, I as Integration, C as Client } from './api-B5IHeINe.js';
2
+
3
+ /** `init()` for browsers. */
4
+
5
+ type BrowserOptions = Options;
6
+ /** In order: filters first (cheap drops), then dedupe, then the data adders. */
7
+ declare function getDefaultIntegrations(): Integration[];
8
+ /**
9
+ * Browser in-app rule: `false` for frames that are certainly not the app's
10
+ * (native code, extensions, node_modules served by a dev server); undefined
11
+ * otherwise, because a minified bundle mixes app and library code and only
12
+ * the server can tell after resolving its source map.
13
+ */
14
+ declare function browserIsInApp(filename: string | undefined): boolean | undefined;
15
+ /**
16
+ * Sends what is queued with `keepalive` when the page is hidden or unloading
17
+ * (the requests start inside the event handler), and ends a pause after
18
+ * repeated send failures when the browser comes back `online`.
19
+ */
20
+ declare function flushOnHideIntegration(): Integration;
21
+ /**
22
+ * Start the SDK. Calling it again replaces the previous client (whose hooks
23
+ * are removed). Returns the client, or undefined when it could not start;
24
+ * never throws.
25
+ */
26
+ declare function init(options: BrowserOptions): Client | undefined;
27
+
28
+ declare function sessionPropagationIntegration(): Integration;
29
+
30
+ export { type BrowserOptions as B, browserIsInApp as b, flushOnHideIntegration as f, getDefaultIntegrations as g, init as i, sessionPropagationIntegration as s };