@starko-one/sdk 0.0.0-stage → 0.1.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +248 -0
- package/LICENSE +17 -0
- package/NOTICE +58 -0
- package/README.md +81 -2
- package/dist/api-BAFm4Lxj.d.ts +558 -0
- package/dist/api-DNrctwJu.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-2PM4FRM5.cjs +431 -0
- package/dist/chunk-335HNCOJ.js +249 -0
- package/dist/chunk-3AW5B2WW.js +115 -0
- package/dist/chunk-3R5TQAWD.js +216 -0
- package/dist/chunk-6H5MOPTQ.cjs +1230 -0
- package/dist/chunk-7TKNT3QJ.cjs +2487 -0
- package/dist/chunk-A4WLNFMU.cjs +220 -0
- package/dist/chunk-ALYFFOPR.cjs +134 -0
- package/dist/chunk-BVVFVRMO.js +1113 -0
- package/dist/chunk-CIHNKN62.cjs +15 -0
- package/dist/chunk-CMGCH6HD.js +1212 -0
- package/dist/chunk-D6QAPQ7L.cjs +56 -0
- package/dist/chunk-DUO5V6WZ.js +213 -0
- package/dist/chunk-EC2WZ6PG.js +90 -0
- package/dist/chunk-EFURLFJT.cjs +187 -0
- package/dist/chunk-EROUORMY.js +53 -0
- package/dist/chunk-LXBXFOAP.cjs +96 -0
- package/dist/chunk-MF6SA6DB.js +563 -0
- package/dist/chunk-N5R6ORIB.js +413 -0
- package/dist/chunk-N6R6BWHK.cjs +142 -0
- package/dist/chunk-QAGGN2T7.cjs +225 -0
- package/dist/chunk-QV4HRIDD.cjs +659 -0
- package/dist/chunk-TKNDYQB3.cjs +583 -0
- package/dist/chunk-UI5YC4TH.js +131 -0
- package/dist/chunk-VEHZYLK6.cjs +1151 -0
- package/dist/chunk-VNCWOGTI.js +12 -0
- package/dist/chunk-VWNIOGE6.js +180 -0
- package/dist/chunk-WDKRKGYF.js +608 -0
- package/dist/chunk-XOZIXBUK.js +2462 -0
- package/dist/chunk-ZS3K3SDR.cjs +258 -0
- package/dist/cli/index.cjs +2780 -0
- package/dist/common-DLFAqL2d.d.cts +36 -0
- package/dist/common-DbSXkaw6.d.ts +36 -0
- package/dist/dedupe-Bh5riD8Z.d.cts +13 -0
- package/dist/dedupe-DoYiSx-9.d.ts +13 -0
- package/dist/handler-BcnsnvhF.d.cts +82 -0
- package/dist/handler-qHzilC9T.d.ts +82 -0
- package/dist/index.cjs +309 -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 +277 -0
- package/dist/next/config.d.cts +193 -0
- package/dist/next/config.d.ts +193 -0
- package/dist/next/config.js +263 -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-BUhWuWJX.d.cts +79 -0
- package/dist/options-BUhWuWJX.d.ts +79 -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-D1ouJm2h.d.cts +628 -0
- package/dist/scope-D1ouJm2h.d.ts +628 -0
- package/dist/server-edge-7624N3WF.cjs +51 -0
- package/dist/server-edge-BEEXWL7T.js +48 -0
- package/dist/server-node-ET4LIPEC.cjs +27 -0
- package/dist/server-node-TQUVMZUC.js +24 -0
- package/dist/session-C_WzbEN2.d.cts +4 -0
- package/dist/session-C_WzbEN2.d.ts +4 -0
- package/dist/session-propagation-Pr0Zb9Zn.d.cts +30 -0
- package/dist/session-propagation-RM5py1bp.d.ts +30 -0
- package/dist/starko.min.js +6 -0
- package/docs/browser.md +386 -0
- package/docs/configuration.md +310 -0
- package/docs/nextjs.md +488 -0
- package/docs/node.md +427 -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 +482 -0
- package/docs/troubleshooting.md +263 -0
- package/docs/widget.md +84 -0
- package/docs/wire-format.md +547 -0
- package/package.json +191 -4
|
@@ -0,0 +1,628 @@
|
|
|
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
|
+
* It is the ORIGINAL: the Starko web app keeps a verbatim copy below its own
|
|
21
|
+
* header (lib/error-tracking/wire-contract.ts). Change it here, then copy
|
|
22
|
+
* everything after this comment over; tests/contract/wire-mirror.test.ts
|
|
23
|
+
* compares the two when STARKO_WEB_APP_DIR points at a web app checkout.
|
|
24
|
+
*/
|
|
25
|
+
declare const WIRE_VERSION: 1;
|
|
26
|
+
/** Where the event was captured. Drives how the server resolves and groups it. */
|
|
27
|
+
type Platform = "browser" | "node" | "dotnet" | "php" | "python" | "ruby" | "go" | "java" | "other";
|
|
28
|
+
type Level = "fatal" | "error" | "warning" | "info" | "debug";
|
|
29
|
+
/**
|
|
30
|
+
* How a frame's fields are to be read.
|
|
31
|
+
* - `web:javascript`: `filename` is a script URL; minified until the server resolves it.
|
|
32
|
+
* - `node:javascript`: `filename` is a file path; may still be bundled (chunk_id present).
|
|
33
|
+
* - `custom`: any other language. `lang` is required and no source-map resolution runs.
|
|
34
|
+
*/
|
|
35
|
+
type FramePlatform = "web:javascript" | "node:javascript" | "custom";
|
|
36
|
+
interface StackFrame {
|
|
37
|
+
platform: FramePlatform;
|
|
38
|
+
/** Language name for `custom` frames, lowercase: "dotnet", "php", "python", … */
|
|
39
|
+
lang?: string;
|
|
40
|
+
/** Script URL (web) or file path. */
|
|
41
|
+
filename?: string;
|
|
42
|
+
/** Absolute path when `filename` is relative (server-side languages). */
|
|
43
|
+
abs_path?: string;
|
|
44
|
+
/** Function or method name; omit when unknown. */
|
|
45
|
+
function?: string;
|
|
46
|
+
/** Module / namespace / class the function belongs to. */
|
|
47
|
+
module?: string;
|
|
48
|
+
/** 1-based line. */
|
|
49
|
+
lineno?: number;
|
|
50
|
+
/** 1-based column. */
|
|
51
|
+
colno?: number;
|
|
52
|
+
/**
|
|
53
|
+
* True when the frame is the app's own code, false for dependencies and
|
|
54
|
+
* runtime internals. When absent the SERVER decides (false for node_modules,
|
|
55
|
+
* browser extensions, and after resolution for sources on a map's ignore list).
|
|
56
|
+
*/
|
|
57
|
+
in_app?: boolean;
|
|
58
|
+
/** Debug id of the bundle the frame is in; the server finds the source map by it. */
|
|
59
|
+
chunk_id?: string;
|
|
60
|
+
/** The source line the frame points at, when the SDK can read source (Node, server languages). */
|
|
61
|
+
context_line?: string;
|
|
62
|
+
/** Lines before `context_line`, in file order. */
|
|
63
|
+
pre_context?: string[];
|
|
64
|
+
/** Lines after `context_line`, in file order. */
|
|
65
|
+
post_context?: string[];
|
|
66
|
+
/**
|
|
67
|
+
* True when names and positions are already original source. Honoured on
|
|
68
|
+
* `custom` frames (languages that run their source or carry debug info). On
|
|
69
|
+
* JavaScript frames the server ignores what the sender says and sets it
|
|
70
|
+
* itself after resolving a source map.
|
|
71
|
+
*/
|
|
72
|
+
resolved?: boolean;
|
|
73
|
+
}
|
|
74
|
+
interface Mechanism {
|
|
75
|
+
/** What caught it: "onerror", "onunhandledrejection", "generic" (captureException), "middleware", "instrument", "chained". */
|
|
76
|
+
type: string;
|
|
77
|
+
/** False when the error was unhandled (it reached a global handler). */
|
|
78
|
+
handled: boolean;
|
|
79
|
+
/** True when the SDK made up the stack because the thrown value had none. */
|
|
80
|
+
synthetic?: boolean;
|
|
81
|
+
/** For chained exceptions: "cause" or "errors[n]". */
|
|
82
|
+
source?: string;
|
|
83
|
+
/** Position of this exception in `exception_list` when part of a chain. */
|
|
84
|
+
exception_id?: number;
|
|
85
|
+
/** `exception_id` of the exception this one is the cause of. */
|
|
86
|
+
parent_id?: number;
|
|
87
|
+
}
|
|
88
|
+
interface WireException {
|
|
89
|
+
/** Error class name: "TypeError", "System.NullReferenceException". */
|
|
90
|
+
type: string;
|
|
91
|
+
/** The message. */
|
|
92
|
+
value: string;
|
|
93
|
+
module?: string;
|
|
94
|
+
mechanism?: Mechanism;
|
|
95
|
+
/**
|
|
96
|
+
* Frames ordered MOST RECENT CALL FIRST: `frames[0]` is where the error was
|
|
97
|
+
* thrown. (Sentry sends the reverse; PostHog's SDKs differ by language and version, and the compat route normalises each.)
|
|
98
|
+
*/
|
|
99
|
+
stacktrace?: {
|
|
100
|
+
type: "raw";
|
|
101
|
+
frames: StackFrame[];
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
interface WireUser {
|
|
105
|
+
/** The host app's own stable user id (Starko `external_id`). */
|
|
106
|
+
id?: string;
|
|
107
|
+
email?: string;
|
|
108
|
+
name?: string;
|
|
109
|
+
/**
|
|
110
|
+
* HMAC-SHA256 (hex) of the identifier, computed by the host's BACKEND with
|
|
111
|
+
* the workspace identity secret: over `id` when `id` is set, otherwise over
|
|
112
|
+
* `email` (the same value the Starko widget's `identify` takes). It is a
|
|
113
|
+
* credential: SDKs never log it and the server never stores or queues it.
|
|
114
|
+
*/
|
|
115
|
+
hash?: string;
|
|
116
|
+
}
|
|
117
|
+
interface Breadcrumb {
|
|
118
|
+
/** Epoch ms. */
|
|
119
|
+
timestamp: number;
|
|
120
|
+
/** "navigation" | "http" | "ui" | "console" | "error" | "custom". */
|
|
121
|
+
type: string;
|
|
122
|
+
category?: string;
|
|
123
|
+
message?: string;
|
|
124
|
+
level?: Level;
|
|
125
|
+
data?: Record<string, unknown>;
|
|
126
|
+
}
|
|
127
|
+
interface WireEvent {
|
|
128
|
+
/** UUID minted by the SDK. The server stores an occurrence once per (workspace, event_id). */
|
|
129
|
+
event_id: string;
|
|
130
|
+
/**
|
|
131
|
+
* Epoch ms when the error happened, on the sender's clock. The server first
|
|
132
|
+
* corrects it by the clock skew it sees (`received - sent_at`, applied when
|
|
133
|
+
* larger than 5 minutes), then replaces it with the receipt time when it is
|
|
134
|
+
* still more than 24 h away from it.
|
|
135
|
+
*/
|
|
136
|
+
timestamp: number;
|
|
137
|
+
platform: Platform;
|
|
138
|
+
level: Level;
|
|
139
|
+
/**
|
|
140
|
+
* The thrown error first, then its causes in order (`cause`, or the members
|
|
141
|
+
* of an AggregateError), linked through `mechanism.exception_id/parent_id`.
|
|
142
|
+
* At least one item.
|
|
143
|
+
*/
|
|
144
|
+
exception_list: WireException[];
|
|
145
|
+
/** Overrides automatic grouping: events with the same value form one issue. */
|
|
146
|
+
fingerprint?: string;
|
|
147
|
+
/** Version of the app that produced the event; matches the release source maps were uploaded for. */
|
|
148
|
+
release?: string;
|
|
149
|
+
/** "production", "staging", … */
|
|
150
|
+
environment?: string;
|
|
151
|
+
/** Session id shared with the Starko widget / session replay, so the error links to the recording. */
|
|
152
|
+
session_id?: string;
|
|
153
|
+
user?: WireUser;
|
|
154
|
+
/**
|
|
155
|
+
* The Starko widget's client token, when the widget runs on the page: links
|
|
156
|
+
* the event to that exact client. A credential: the ingest route verifies it
|
|
157
|
+
* and keeps only the client id; it is never stored, queued or logged.
|
|
158
|
+
*/
|
|
159
|
+
client_token?: string;
|
|
160
|
+
request?: {
|
|
161
|
+
url?: string;
|
|
162
|
+
method?: string;
|
|
163
|
+
route?: string;
|
|
164
|
+
referrer?: string;
|
|
165
|
+
};
|
|
166
|
+
/** Sent by server SDKs that forward a browser's user agent; browsers rely on the request header. */
|
|
167
|
+
user_agent?: string;
|
|
168
|
+
/** Host name of the server that captured the event (server SDKs). */
|
|
169
|
+
server_name?: string;
|
|
170
|
+
tags?: Record<string, string>;
|
|
171
|
+
extra?: Record<string, unknown>;
|
|
172
|
+
/** Named context blocks: `runtime`, `os`, `browser`, `device`, `app`, or the caller's own. */
|
|
173
|
+
contexts?: Record<string, Record<string, unknown>>;
|
|
174
|
+
breadcrumbs?: Breadcrumb[];
|
|
175
|
+
trace?: {
|
|
176
|
+
trace_id?: string;
|
|
177
|
+
span_id?: string;
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
interface WireEnvelope {
|
|
181
|
+
v: typeof WIRE_VERSION;
|
|
182
|
+
/** The workspace key (public). */
|
|
183
|
+
workspace: string;
|
|
184
|
+
sdk: {
|
|
185
|
+
name: string;
|
|
186
|
+
version: string;
|
|
187
|
+
};
|
|
188
|
+
/** Epoch ms on the sender's clock when THIS request left (refreshed on every retry); the server uses it to correct clock skew. */
|
|
189
|
+
sent_at: number;
|
|
190
|
+
events: WireEvent[];
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Why a request was not accepted. An SDK switches itself off ONLY for
|
|
194
|
+
* `unknown_workspace`, `disabled` and `origin_not_allowed`, and only when they
|
|
195
|
+
* arrive in a JSON body of this shape: a 401/403 from a proxy, a firewall or
|
|
196
|
+
* a captive portal must never disable error reporting.
|
|
197
|
+
*/
|
|
198
|
+
type IngestRejectReason = "unknown_workspace" | "disabled" | "origin_not_allowed" | "rate_limit" | "quota" | "busy" | "invalid" | "too_large" | "unsupported_version";
|
|
199
|
+
/** Body of every ingest response (`{ ok, message, data }`, the shape of the rest of the Starko public API). */
|
|
200
|
+
interface IngestResponse {
|
|
201
|
+
ok: boolean;
|
|
202
|
+
message: string;
|
|
203
|
+
data: {
|
|
204
|
+
accepted?: number;
|
|
205
|
+
rejected?: number;
|
|
206
|
+
/** False with reason "disabled". */
|
|
207
|
+
enabled?: boolean;
|
|
208
|
+
reason?: IngestRejectReason;
|
|
209
|
+
/** With reason "unsupported_version". */
|
|
210
|
+
supported_versions?: number[];
|
|
211
|
+
} | null;
|
|
212
|
+
}
|
|
213
|
+
/** `GET /api/v1/ingest/config` data: what the server lets this workspace's SDKs do. */
|
|
214
|
+
interface RemoteConfig {
|
|
215
|
+
/** False: the SDK installs nothing and sends nothing. */
|
|
216
|
+
enabled: boolean;
|
|
217
|
+
/** 0..1 share of events to send, applied by the SDK. */
|
|
218
|
+
sample_rate: number;
|
|
219
|
+
/** Events matching any rule are dropped on the client. All set fields of a rule must match. */
|
|
220
|
+
suppress: SuppressionRule[];
|
|
221
|
+
}
|
|
222
|
+
interface SuppressionRule {
|
|
223
|
+
/** Exact match on the first exception's `type`. */
|
|
224
|
+
type?: string;
|
|
225
|
+
/** Case-insensitive substring match on the first exception's `value`. */
|
|
226
|
+
value_contains?: string;
|
|
227
|
+
}
|
|
228
|
+
/** Hard limits. The SDK trims to them before sending; the server truncates (strings, arrays) or rejects (event, envelope) beyond them. */
|
|
229
|
+
declare const LIMITS: {
|
|
230
|
+
readonly MAX_EVENTS_PER_ENVELOPE: 20;
|
|
231
|
+
/** Bytes of the request body as sent (after gzip when compressed). */
|
|
232
|
+
readonly MAX_BODY_BYTES: number;
|
|
233
|
+
/** Bytes after decompression. */
|
|
234
|
+
readonly MAX_INFLATED_BYTES: number;
|
|
235
|
+
readonly MAX_EXCEPTIONS: 10;
|
|
236
|
+
/** Beyond it the 25 most recent and the 25 oldest frames are kept (the middle of a deep recursion is dropped). */
|
|
237
|
+
readonly MAX_FRAMES: 50;
|
|
238
|
+
/** Distinct `chunk_id`s the server resolves per event; frames of further chunks stay unresolved. */
|
|
239
|
+
readonly MAX_CHUNK_IDS_PER_EVENT: 8;
|
|
240
|
+
/** Nesting depth of the JSON body; deeper bodies are rejected before any processing. */
|
|
241
|
+
readonly MAX_JSON_DEPTH: 20;
|
|
242
|
+
readonly MAX_TYPE: 200;
|
|
243
|
+
readonly MAX_VALUE: 2000;
|
|
244
|
+
readonly MAX_FILENAME: 1000;
|
|
245
|
+
readonly MAX_FUNCTION: 300;
|
|
246
|
+
readonly MAX_CONTEXT_LINE: 300;
|
|
247
|
+
/** Lines in each of pre_context / post_context. */
|
|
248
|
+
readonly MAX_CONTEXT_LINES: 7;
|
|
249
|
+
readonly MAX_BREADCRUMBS: 50;
|
|
250
|
+
/** Serialized bytes of all breadcrumbs. */
|
|
251
|
+
readonly MAX_BREADCRUMB_BYTES: number;
|
|
252
|
+
readonly MAX_TAGS: 50;
|
|
253
|
+
readonly MAX_TAG_KEY: 64;
|
|
254
|
+
readonly MAX_TAG_VALUE: 256;
|
|
255
|
+
/** Serialized bytes of `extra` and of `contexts`, each. */
|
|
256
|
+
readonly MAX_EXTRA_BYTES: number;
|
|
257
|
+
readonly MAX_FINGERPRINT: 128;
|
|
258
|
+
readonly MAX_RELEASE: 128;
|
|
259
|
+
readonly MAX_ENVIRONMENT: 64;
|
|
260
|
+
readonly MAX_URL: 2048;
|
|
261
|
+
};
|
|
262
|
+
/** `session_id`: the format the Starko widget and recorder already use. */
|
|
263
|
+
declare const SESSION_ID_PATTERN: RegExp;
|
|
264
|
+
/** Paths on the Starko host. */
|
|
265
|
+
declare const PATHS: {
|
|
266
|
+
readonly INGEST: "/api/v1/ingest/errors";
|
|
267
|
+
readonly CONFIG: "/api/v1/ingest/config";
|
|
268
|
+
readonly SOURCEMAPS_CHECK: "/api/v1/sourcemaps/check";
|
|
269
|
+
readonly SOURCEMAPS_UPLOAD: "/api/v1/sourcemaps/upload";
|
|
270
|
+
readonly SOURCEMAPS_COMPLETE: "/api/v1/sourcemaps/complete";
|
|
271
|
+
/** Bulk upload (wire format v1, upload v2): see "Source-map bulk upload" below. */
|
|
272
|
+
readonly SOURCEMAPS_BULK_CHECK: "/api/v1/sourcemaps/bulk/check";
|
|
273
|
+
readonly SOURCEMAPS_BULK_START: "/api/v1/sourcemaps/bulk/start";
|
|
274
|
+
readonly SOURCEMAPS_BULK_FINISH: "/api/v1/sourcemaps/bulk/finish";
|
|
275
|
+
};
|
|
276
|
+
declare const DEFAULT_HOST = "https://v2.starko.one";
|
|
277
|
+
/**
|
|
278
|
+
* Query parameters whose VALUES are replaced with "[redacted]" in every URL
|
|
279
|
+
* an SDK sends (page URL, referrer, request and breadcrumb URLs, frame file
|
|
280
|
+
* names, and URLs found inside exception messages and breadcrumb messages)
|
|
281
|
+
* and again on the server. A name matches when, compared case-insensitively,
|
|
282
|
+
* the whole name or any part of it is in this list; names split on `_`, `-`
|
|
283
|
+
* and camelCase boundaries (`accessToken`, `apiKey`, `X-Amz-Signature`). The
|
|
284
|
+
* `#fragment` and the userinfo (`user:pass@`) of a URL are always dropped.
|
|
285
|
+
*/
|
|
286
|
+
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"];
|
|
287
|
+
declare const REDACTED = "[redacted]";
|
|
288
|
+
/** A source map is gzipped, cut into parts of at most this many bytes, and each part is one upload request. */
|
|
289
|
+
declare const SOURCEMAP_PART_BYTES: number;
|
|
290
|
+
/** Largest source map accepted, uncompressed. */
|
|
291
|
+
declare const SOURCEMAP_MAX_BYTES: number;
|
|
292
|
+
/** Parts per source map (`part` is 0-based, `parts` is the total). */
|
|
293
|
+
declare const SOURCEMAP_MAX_PARTS = 32;
|
|
294
|
+
/** Chunks per `check` request. */
|
|
295
|
+
declare const SOURCEMAP_MAX_CHUNKS_PER_CHECK = 500;
|
|
296
|
+
/**
|
|
297
|
+
* `file_name` (bulk/start, v1 complete): at most this many characters
|
|
298
|
+
* (UTF-16 code units, the JavaScript string length). bulk/start refuses a
|
|
299
|
+
* longer one with 400; v1 complete keeps the first 512. A sender shortens a
|
|
300
|
+
* longer path itself.
|
|
301
|
+
*/
|
|
302
|
+
declare const SOURCEMAP_MAX_FILE_NAME = 512;
|
|
303
|
+
interface SourcemapCheckRequest {
|
|
304
|
+
/** The release these bundles belong to; created when new. */
|
|
305
|
+
release?: {
|
|
306
|
+
version: string;
|
|
307
|
+
commit?: string;
|
|
308
|
+
branch?: string;
|
|
309
|
+
};
|
|
310
|
+
chunks: Array<{
|
|
311
|
+
/** Debug id injected into the bundle. */
|
|
312
|
+
chunk_id: string;
|
|
313
|
+
/** sha256 hex of the uncompressed source map. */
|
|
314
|
+
content_hash: string;
|
|
315
|
+
}>;
|
|
316
|
+
}
|
|
317
|
+
interface SourcemapCheckResponse {
|
|
318
|
+
ok: boolean;
|
|
319
|
+
message: string;
|
|
320
|
+
/** `missing`: chunk ids the server does not have with that hash and wants uploaded. */
|
|
321
|
+
data: {
|
|
322
|
+
missing: string[];
|
|
323
|
+
} | null;
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* `POST /api/v1/sourcemaps/upload?chunk_id=…&part=<0-based>&parts=<total>&content_hash=…`
|
|
327
|
+
* with the part's bytes as the body (`application/octet-stream`). Parts may
|
|
328
|
+
* arrive in any order and be retried; the same part twice is a no-op.
|
|
329
|
+
* A chunk with an unfinished bulk reservation (see "Source-map bulk upload")
|
|
330
|
+
* is taken over by v1 at once when storage holds no object for that
|
|
331
|
+
* reservation (a build that could not reach storage falls back to v1 for
|
|
332
|
+
* the maps it reserved). 409 with Retry-After: storage holds one, or did not
|
|
333
|
+
* answer, so a bulk upload may still finish it; retry after Retry-After (up
|
|
334
|
+
* to ~20 minutes) or let that upload finish. 423: uploads disabled (below).
|
|
335
|
+
* `complete` answers 503 when the server is busy verifying or storage did
|
|
336
|
+
* not answer: retry after Retry-After.
|
|
337
|
+
*/
|
|
338
|
+
interface SourcemapUploadResponse {
|
|
339
|
+
ok: boolean;
|
|
340
|
+
message: string;
|
|
341
|
+
data: {
|
|
342
|
+
part: number;
|
|
343
|
+
} | null;
|
|
344
|
+
}
|
|
345
|
+
interface SourcemapCompleteRequest {
|
|
346
|
+
chunk_id: string;
|
|
347
|
+
parts: number;
|
|
348
|
+
content_hash: string;
|
|
349
|
+
/** Bytes of the uncompressed map. */
|
|
350
|
+
size_bytes: number;
|
|
351
|
+
/** Path of the bundle the map belongs to, relative to the build output: shown in the dashboard. At most SOURCEMAP_MAX_FILE_NAME characters are kept. */
|
|
352
|
+
file_name?: string;
|
|
353
|
+
release?: {
|
|
354
|
+
version: string;
|
|
355
|
+
};
|
|
356
|
+
}
|
|
357
|
+
interface SourcemapCompleteResponse {
|
|
358
|
+
ok: boolean;
|
|
359
|
+
message: string;
|
|
360
|
+
data: {
|
|
361
|
+
chunk_id: string;
|
|
362
|
+
stored: boolean;
|
|
363
|
+
} | null;
|
|
364
|
+
}
|
|
365
|
+
/** The longest each source-map route runs on the server, in seconds (see "Time" above). */
|
|
366
|
+
declare const SOURCEMAP_ROUTE_MAX_SECONDS: {
|
|
367
|
+
readonly CHECK: 30;
|
|
368
|
+
readonly UPLOAD: 60;
|
|
369
|
+
readonly COMPLETE: 60;
|
|
370
|
+
readonly BULK_CHECK: 30;
|
|
371
|
+
readonly BULK_START: 30;
|
|
372
|
+
readonly BULK_FINISH: 120;
|
|
373
|
+
};
|
|
374
|
+
/** Chunks per bulk/check request. */
|
|
375
|
+
declare const SOURCEMAP_BULK_MAX_CHECK = 1000;
|
|
376
|
+
/** Maps per bulk/start and per bulk/finish request. */
|
|
377
|
+
declare const SOURCEMAP_BULK_MAX_MAPS = 200;
|
|
378
|
+
/** Largest gzipped map (`size_bytes` on bulk/start): what a SOURCEMAP_MAX_BYTES map can compress to at worst (+1 %). */
|
|
379
|
+
declare const SOURCEMAP_BULK_MAX_OBJECT_BYTES: number;
|
|
380
|
+
/** PUTs to storage the build runs in parallel. */
|
|
381
|
+
declare const SOURCEMAP_BULK_UPLOAD_CONCURRENCY = 16;
|
|
382
|
+
/**
|
|
383
|
+
* bulk/start or bulk/finish requests the build runs in parallel. More gains
|
|
384
|
+
* nothing: the server verifies one workspace's maps at most
|
|
385
|
+
* SOURCEMAP_BULK_VERIFY_PER_WORKSPACE at a time (only one of them over
|
|
386
|
+
* 8 MiB gzipped) across ALL of that workspace's finishes; one finish keeps
|
|
387
|
+
* that busy and a second hides the round trip.
|
|
388
|
+
*/
|
|
389
|
+
declare const SOURCEMAP_BULK_REQUEST_CONCURRENCY = 2;
|
|
390
|
+
/** Maps of one workspace the server verifies at once, shared by all of its bulk/finish (and v1 complete) requests. */
|
|
391
|
+
declare const SOURCEMAP_BULK_VERIFY_PER_WORKSPACE = 6;
|
|
392
|
+
interface SourcemapBulkCheckRequest {
|
|
393
|
+
/** The release these bundles belong to; created when new. */
|
|
394
|
+
release?: {
|
|
395
|
+
version: string;
|
|
396
|
+
commit?: string;
|
|
397
|
+
branch?: string;
|
|
398
|
+
};
|
|
399
|
+
chunks: Array<{
|
|
400
|
+
chunk_id: string;
|
|
401
|
+
content_hash: string;
|
|
402
|
+
}>;
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* Chunk ids (as sent) the server still needs: no stored map, and no map
|
|
406
|
+
* pending verification with the SAME content_hash (bulk/start would answer
|
|
407
|
+
* `pending` for it). Unlike v1 check, which reports a pending map missing.
|
|
408
|
+
*/
|
|
409
|
+
interface SourcemapBulkCheckResponse {
|
|
410
|
+
ok: boolean;
|
|
411
|
+
message: string;
|
|
412
|
+
data: {
|
|
413
|
+
missing: string[];
|
|
414
|
+
} | null;
|
|
415
|
+
}
|
|
416
|
+
interface SourcemapBulkStartRequest {
|
|
417
|
+
/** Created when new; stamped on every map reserved by this request. */
|
|
418
|
+
release?: {
|
|
419
|
+
version: string;
|
|
420
|
+
commit?: string;
|
|
421
|
+
branch?: string;
|
|
422
|
+
};
|
|
423
|
+
maps: Array<{
|
|
424
|
+
/** Debug id of the bundle (UUID, any case, hyphens optional). Each chunk id once per request. */
|
|
425
|
+
chunk_id: string;
|
|
426
|
+
/** sha256 hex of the UNCOMPRESSED map. */
|
|
427
|
+
content_hash: string;
|
|
428
|
+
/**
|
|
429
|
+
* Bytes of the GZIPPED map the build will PUT: 1..SOURCEMAP_BULK_MAX_OBJECT_BYTES.
|
|
430
|
+
* Signed into the target. Storage is expected to refuse another size
|
|
431
|
+
* (not verified against UploadThing); bulk/finish fails an object of
|
|
432
|
+
* another size either way.
|
|
433
|
+
*/
|
|
434
|
+
size_bytes: number;
|
|
435
|
+
/** Path of the bundle, relative to the build output (shown in the dashboard). At most SOURCEMAP_MAX_FILE_NAME characters (400 beyond). */
|
|
436
|
+
file_name?: string;
|
|
437
|
+
}>;
|
|
438
|
+
}
|
|
439
|
+
/**
|
|
440
|
+
* Where and how to PUT one map. The build sends exactly this, nothing else:
|
|
441
|
+
* `PUT <url>` with every header in `headers`, and a multipart/form-data
|
|
442
|
+
* body with ONE part: name `form_field`, filename `file_name`,
|
|
443
|
+
* Content-Type `content_type`, content = the gzipped map (exactly
|
|
444
|
+
* `size_bytes` bytes). Success: any 2xx. The answer's body is not needed.
|
|
445
|
+
* After a 2xx, never PUT the same target again: name the map in
|
|
446
|
+
* bulk/finish. A PUT refused with a 4xx, whatever the 4xx (an expired URL
|
|
447
|
+
* included): do not PUT that target again; name the map in bulk/finish (an
|
|
448
|
+
* earlier attempt may have stored it). finish answers `not_uploaded` when
|
|
449
|
+
* nothing is stored: then bulk/start it again (a fresh target, or `uploaded`
|
|
450
|
+
* when the object is there after all) and PUT what it answers. A PUT that
|
|
451
|
+
* got no answer (network error, timeout) may be repeated to the same target
|
|
452
|
+
* while it has not expired. A storage host the build cannot reach at all:
|
|
453
|
+
* upload the maps through v1 instead; v1 takes over the ones reserved here
|
|
454
|
+
* whose object storage does not hold (see SourcemapUploadResponse).
|
|
455
|
+
* The URL is a bearer credential for this one object: never log it (its
|
|
456
|
+
* `signature` parameter) or show it. It cannot be revoked: storage accepts
|
|
457
|
+
* it until `expires_at`, also after the key that got it is revoked (the
|
|
458
|
+
* object stays private and is used only if a valid key finishes it).
|
|
459
|
+
*/
|
|
460
|
+
interface SourcemapUploadTarget {
|
|
461
|
+
url: string;
|
|
462
|
+
method: "PUT";
|
|
463
|
+
headers: Record<string, string>;
|
|
464
|
+
form_field: string;
|
|
465
|
+
file_name: string;
|
|
466
|
+
content_type: string;
|
|
467
|
+
size_bytes: number;
|
|
468
|
+
/**
|
|
469
|
+
* ISO time after which storage refuses the URL (10 minutes after it was
|
|
470
|
+
* issued). Call bulk/start again for a fresh one: the same object, for
|
|
471
|
+
* up to 3 hours after the map was first reserved, then a new object
|
|
472
|
+
* (transparent to the build: PUT whatever target it gets).
|
|
473
|
+
*/
|
|
474
|
+
expires_at: string;
|
|
475
|
+
/**
|
|
476
|
+
* Seconds the URL has left when the server answered, on the server's
|
|
477
|
+
* clock. A build times expiry from this and its own monotonic clock
|
|
478
|
+
* (when it received the answer + expires_in_s), not from `expires_at`,
|
|
479
|
+
* which a build machine whose clock is off misreads.
|
|
480
|
+
*/
|
|
481
|
+
expires_in_s: number;
|
|
482
|
+
}
|
|
483
|
+
/**
|
|
484
|
+
* Per map, in request order:
|
|
485
|
+
* - `upload`: reserved; PUT it to `upload`, then name it in bulk/finish.
|
|
486
|
+
* Also the answer for a map whose earlier upload FAILED, or was for
|
|
487
|
+
* other content or size, or whose earlier PUT stored nothing: a new
|
|
488
|
+
* object (or a fresh URL for the same one) at once.
|
|
489
|
+
* - `uploaded`: this map is already reserved AND storage already holds an
|
|
490
|
+
* object for it (an earlier PUT succeeded). Do NOT PUT it: name it in
|
|
491
|
+
* bulk/finish. No `upload` target.
|
|
492
|
+
* - `present`: a stored map with this content_hash exists; nothing to do.
|
|
493
|
+
* - `pending`: an identical map was uploaded and is waiting for the
|
|
494
|
+
* server's background verification; nothing to do.
|
|
495
|
+
* - `conflict`: the chunk id has a stored map with ANOTHER content_hash
|
|
496
|
+
* (write-once; delete it in Starko to replace it). Not retryable.
|
|
497
|
+
* - `busy`: only after this chunk id was restarted (new content, a failed
|
|
498
|
+
* map) more than 3 times within ~20 minutes while the earlier URLs may
|
|
499
|
+
* still be in use; retry this map after `retry_after_s` (at most ~20
|
|
500
|
+
* minutes) or leave it for the next build. A normal build never sees it.
|
|
501
|
+
* - `over_allowance`: the workspace's source-map storage allowance is
|
|
502
|
+
* reached; not retryable until maps are deleted.
|
|
503
|
+
*/
|
|
504
|
+
type SourcemapBulkStartStatus = "upload" | "uploaded" | "present" | "pending" | "conflict" | "busy" | "over_allowance";
|
|
505
|
+
interface SourcemapBulkStartResponse {
|
|
506
|
+
ok: boolean;
|
|
507
|
+
message: string;
|
|
508
|
+
data: {
|
|
509
|
+
maps: Array<{
|
|
510
|
+
chunk_id: string;
|
|
511
|
+
status: SourcemapBulkStartStatus;
|
|
512
|
+
upload?: SourcemapUploadTarget;
|
|
513
|
+
retry_after_s?: number;
|
|
514
|
+
message?: string;
|
|
515
|
+
}>;
|
|
516
|
+
} | null;
|
|
517
|
+
}
|
|
518
|
+
interface SourcemapBulkFinishRequest {
|
|
519
|
+
/** The maps whose PUT succeeded (or that might have: finishing an unsent map is harmless). */
|
|
520
|
+
maps: Array<{
|
|
521
|
+
chunk_id: string;
|
|
522
|
+
content_hash: string;
|
|
523
|
+
}>;
|
|
524
|
+
}
|
|
525
|
+
/**
|
|
526
|
+
* Per map, in request order:
|
|
527
|
+
* - `stored`: verified and stored (also when it already was).
|
|
528
|
+
* - `pending`: stored; too large to verify inside the request, the server
|
|
529
|
+
* verifies it in the background. Nothing to do.
|
|
530
|
+
* - `not_uploaded`: storage has no complete object for the reservation:
|
|
531
|
+
* PUT it (bulk/start again first when the target expired), then finish.
|
|
532
|
+
* - `not_reserved`: no reservation for this chunk id and content_hash (or
|
|
533
|
+
* it was swept): start it again.
|
|
534
|
+
* - `conflict`: as in bulk/start. Not retryable.
|
|
535
|
+
* - `failed`: the stored object is wrong (size, gzip, sha256, debugId, not
|
|
536
|
+
* a source map; `message` says which). Not retryable as is: fix the map
|
|
537
|
+
* (or re-PUT it after a truncated upload) and bulk/start it again, which
|
|
538
|
+
* reserves a new object at once.
|
|
539
|
+
* - `retry`: not checked this time (storage did not answer, or the request
|
|
540
|
+
* ran out of time or of its turn at the server's verification queue);
|
|
541
|
+
* repeat bulk/finish for it.
|
|
542
|
+
* A map that becomes `stored` or `pending` counts against the daily byte
|
|
543
|
+
* budget of the key that reserved it (bulk/start's 429), and so does a map
|
|
544
|
+
* that becomes `failed`: the larger of its size_bytes and what it inflated
|
|
545
|
+
* to (up to SOURCEMAP_MAX_BYTES). Do not loop on a failed map: a failure is
|
|
546
|
+
* deterministic (the same bytes fail again), so report it and leave it to a
|
|
547
|
+
* fixed build. The server verifies one workspace's maps
|
|
548
|
+
* SOURCEMAP_BULK_VERIFY_PER_WORKSPACE at a time (one over 8 MiB gzipped),
|
|
549
|
+
* shared by all of its requests: more than SOURCEMAP_BULK_REQUEST_CONCURRENCY
|
|
550
|
+
* finishes at once does not finish sooner; the extra ones only wait, and
|
|
551
|
+
* answer `retry` for what did not get a turn within 45 s.
|
|
552
|
+
*/
|
|
553
|
+
type SourcemapBulkFinishStatus = "stored" | "pending" | "not_uploaded" | "not_reserved" | "conflict" | "failed" | "retry";
|
|
554
|
+
interface SourcemapBulkFinishResponse {
|
|
555
|
+
ok: boolean;
|
|
556
|
+
message: string;
|
|
557
|
+
data: {
|
|
558
|
+
maps: Array<{
|
|
559
|
+
chunk_id: string;
|
|
560
|
+
status: SourcemapBulkFinishStatus;
|
|
561
|
+
message?: string;
|
|
562
|
+
}>;
|
|
563
|
+
} | null;
|
|
564
|
+
}
|
|
565
|
+
/** Global map `{ [new Error().stack of the bundle]: debugId }` written by the injected snippet. */
|
|
566
|
+
declare const DEBUG_ID_GLOBAL = "_starkoDebugIds";
|
|
567
|
+
/** The same map as written by bundlers with native debug-id support (Turbopack, Rolldown). */
|
|
568
|
+
declare const NATIVE_DEBUG_ID_GLOBAL = "_debugIds";
|
|
569
|
+
/** Global holding the release when the build injected one. */
|
|
570
|
+
declare const RELEASE_GLOBAL = "_starkoRelease";
|
|
571
|
+
/** Trailing comment in a bundle and matching `debugId` field in its source map (TC39 debug-id proposal). */
|
|
572
|
+
declare const DEBUG_ID_COMMENT = "//# debugId=";
|
|
573
|
+
/** Namespace for content-addressed (UUIDv5) debug ids: the same bundle bytes always get the same id. */
|
|
574
|
+
declare const DEBUG_ID_NAMESPACE = "6f2d3c1e-9b4a-4f07-8a55-7c1e0d9b2a41";
|
|
575
|
+
|
|
576
|
+
/**
|
|
577
|
+
* Scope: the data applied to every event captured while it is current
|
|
578
|
+
* (user, tags, extra, contexts, fingerprint, level) and the breadcrumb
|
|
579
|
+
* buffer. `clone()` forks it for `withScope`.
|
|
580
|
+
*/
|
|
581
|
+
|
|
582
|
+
/**
|
|
583
|
+
* Oldest-first ring of breadcrumbs capped by count AND by serialised bytes
|
|
584
|
+
* (`LIMITS.MAX_BREADCRUMB_BYTES`): adding evicts the oldest until both fit.
|
|
585
|
+
*/
|
|
586
|
+
declare class BreadcrumbBuffer {
|
|
587
|
+
private maxItems;
|
|
588
|
+
private maxBytes;
|
|
589
|
+
private items;
|
|
590
|
+
private bytes;
|
|
591
|
+
constructor(maxItems?: number, maxBytes?: number);
|
|
592
|
+
add(input: Breadcrumb): void;
|
|
593
|
+
/** Change the count cap (0..50); the oldest are dropped when it shrinks. */
|
|
594
|
+
setMaxItems(n: number): void;
|
|
595
|
+
/** Oldest first. */
|
|
596
|
+
get(): Breadcrumb[];
|
|
597
|
+
get byteSize(): number;
|
|
598
|
+
clear(): void;
|
|
599
|
+
clone(): BreadcrumbBuffer;
|
|
600
|
+
}
|
|
601
|
+
declare class Scope {
|
|
602
|
+
user: WireUser | null;
|
|
603
|
+
tags: Record<string, string>;
|
|
604
|
+
extra: Record<string, unknown>;
|
|
605
|
+
contexts: Record<string, Record<string, unknown>>;
|
|
606
|
+
fingerprint: string | undefined;
|
|
607
|
+
level: Level | undefined;
|
|
608
|
+
breadcrumbs: BreadcrumbBuffer;
|
|
609
|
+
constructor(maxBreadcrumbs?: number);
|
|
610
|
+
setUser(user: WireUser | null): this;
|
|
611
|
+
setTag(key: string, value: unknown): this;
|
|
612
|
+
setTags(tags: Record<string, unknown>): this;
|
|
613
|
+
setExtra(key: string, value: unknown): this;
|
|
614
|
+
setExtras(extras: Record<string, unknown>): this;
|
|
615
|
+
/** `null` removes the context. */
|
|
616
|
+
setContext(name: string, context: Record<string, unknown> | null): this;
|
|
617
|
+
setFingerprint(fingerprint: string | undefined): this;
|
|
618
|
+
setLevel(level: Level | undefined): this;
|
|
619
|
+
addBreadcrumb(b: Breadcrumb): this;
|
|
620
|
+
clearBreadcrumbs(): this;
|
|
621
|
+
clear(): this;
|
|
622
|
+
/** A fork: changes to it never reach this scope. */
|
|
623
|
+
clone(): Scope;
|
|
624
|
+
/** Writes the scope's data into `event`; the event's own values win. */
|
|
625
|
+
applyToEvent(event: WireEvent): WireEvent;
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
export { type WireEnvelope as $, SOURCEMAP_ROUTE_MAX_SECONDS as A, type Breadcrumb as B, type SourcemapBulkCheckRequest as C, DEBUG_ID_COMMENT as D, type SourcemapBulkCheckResponse as E, type FramePlatform as F, type SourcemapBulkFinishRequest as G, type SourcemapBulkFinishResponse as H, type IngestRejectReason as I, type SourcemapBulkFinishStatus as J, type SourcemapBulkStartRequest as K, type Level as L, type Mechanism as M, NATIVE_DEBUG_ID_GLOBAL as N, type SourcemapBulkStartResponse as O, PATHS as P, type SourcemapBulkStartStatus as Q, type RemoteConfig as R, Scope as S, type SourcemapCheckRequest as T, type SourcemapCheckResponse as U, type SourcemapCompleteRequest as V, type WireEvent as W, type SourcemapCompleteResponse as X, type SourcemapUploadResponse as Y, type SourcemapUploadTarget as Z, WIRE_VERSION as _, 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_BULK_MAX_CHECK as p, SOURCEMAP_BULK_MAX_MAPS as q, SOURCEMAP_BULK_MAX_OBJECT_BYTES as r, SOURCEMAP_BULK_REQUEST_CONCURRENCY as s, SOURCEMAP_BULK_UPLOAD_CONCURRENCY as t, SOURCEMAP_BULK_VERIFY_PER_WORKSPACE as u, SOURCEMAP_MAX_BYTES as v, SOURCEMAP_MAX_CHUNKS_PER_CHECK as w, SOURCEMAP_MAX_FILE_NAME as x, SOURCEMAP_MAX_PARTS as y, SOURCEMAP_PART_BYTES as z };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkD6QAPQ7L_cjs = require('./chunk-D6QAPQ7L.cjs');
|
|
4
|
+
var chunkA4WLNFMU_cjs = require('./chunk-A4WLNFMU.cjs');
|
|
5
|
+
var chunk2PM4FRM5_cjs = require('./chunk-2PM4FRM5.cjs');
|
|
6
|
+
require('./chunk-ALYFFOPR.cjs');
|
|
7
|
+
var chunk6H5MOPTQ_cjs = require('./chunk-6H5MOPTQ.cjs');
|
|
8
|
+
var chunkLXBXFOAP_cjs = require('./chunk-LXBXFOAP.cjs');
|
|
9
|
+
require('./chunk-CIHNKN62.cjs');
|
|
10
|
+
require('./chunk-ZS3K3SDR.cjs');
|
|
11
|
+
var chunkQV4HRIDD_cjs = require('./chunk-QV4HRIDD.cjs');
|
|
12
|
+
require('./chunk-N6R6BWHK.cjs');
|
|
13
|
+
|
|
14
|
+
// src/next/server-edge.ts
|
|
15
|
+
function init(input) {
|
|
16
|
+
try {
|
|
17
|
+
const options = chunkD6QAPQ7L_cjs.withNextDefaults(input);
|
|
18
|
+
const previous = chunkQV4HRIDD_cjs.getClient();
|
|
19
|
+
if (previous) void previous.close(0);
|
|
20
|
+
chunk2PM4FRM5_cjs.installAsyncScopeManager();
|
|
21
|
+
const defaults = options.defaultIntegrations === false ? [] : [chunk6H5MOPTQ_cjs.dedupeIntegration({ requestKey: chunk2PM4FRM5_cjs.currentRequestKey }), chunkA4WLNFMU_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 chunkA4WLNFMU_cjs.ServerClient({
|
|
25
|
+
...rest,
|
|
26
|
+
// Precedence: see `buildTimeRelease`. Unset here, the client reads the injected global per event.
|
|
27
|
+
release: rest.release || chunkLXBXFOAP_cjs.buildTimeRelease(),
|
|
28
|
+
platform: "node",
|
|
29
|
+
framePlatform: "node:javascript",
|
|
30
|
+
sdkName: "starko.nextjs.edge",
|
|
31
|
+
stackParser: chunk6H5MOPTQ_cjs.nodeStackParser,
|
|
32
|
+
isInApp: chunkA4WLNFMU_cjs.nodeIsInApp,
|
|
33
|
+
getSessionId: () => chunk2PM4FRM5_cjs.getRequestData()?.sessionId,
|
|
34
|
+
...chunkA4WLNFMU_cjs.SERVER_DEFAULTS,
|
|
35
|
+
transport: options.transport || ((o) => chunkA4WLNFMU_cjs.makeServerFetchTransport({ ...o, apiKey, fetchImpl: typeof fetchImpl === "function" ? fetchImpl : void 0 }))
|
|
36
|
+
});
|
|
37
|
+
chunkQV4HRIDD_cjs.setCurrentClient(client);
|
|
38
|
+
client.init(integrations);
|
|
39
|
+
chunk2PM4FRM5_cjs.noteInit(options.user ? chunkQV4HRIDD_cjs.getGlobalScope().user : null);
|
|
40
|
+
chunk2PM4FRM5_cjs.markServing();
|
|
41
|
+
return client;
|
|
42
|
+
} catch {
|
|
43
|
+
return void 0;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
function captureRequestError(error, request, context, flushTimeout) {
|
|
47
|
+
return chunkD6QAPQ7L_cjs.captureNextRequestError(error, request, context, flushTimeout, "edge");
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
exports.captureRequestError = captureRequestError;
|
|
51
|
+
exports.init = init;
|