@interfere/types 9.0.0 → 9.0.3-canary.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/README.md +3 -3
- package/dist/data/frame.cjs +1 -0
- package/dist/data/frame.d.cts +27 -0
- package/dist/data/frame.d.mts +18 -5
- package/dist/data/frame.mjs +2 -16
- package/dist/data/session.cjs +1 -0
- package/dist/data/session.d.cts +8 -0
- package/dist/data/session.d.mts +3 -2
- package/dist/data/session.mjs +2 -9
- package/dist/data/source-maps.cjs +1 -0
- package/dist/data/source-maps.d.cts +151 -0
- package/dist/data/source-maps.d.mts +138 -27
- package/dist/data/source-maps.mjs +2 -21
- package/dist/events/error.cjs +1 -0
- package/dist/events/error.d.cts +196 -0
- package/dist/events/error.d.mts +140 -35
- package/dist/events/error.mjs +2 -64
- package/dist/events/pageleave.cjs +1 -0
- package/dist/events/pageleave.d.cts +13 -0
- package/dist/events/pageleave.d.mts +3 -2
- package/dist/events/pageleave.mjs +2 -10
- package/dist/events/pageview.cjs +1 -0
- package/dist/events/pageview.d.cts +14 -0
- package/dist/events/pageview.d.mts +3 -2
- package/dist/events/pageview.mjs +2 -11
- package/dist/integrations/index.cjs +1 -0
- package/dist/integrations/index.d.cts +48 -0
- package/dist/integrations/index.d.mts +2 -1
- package/dist/integrations/index.mjs +2 -57
- package/dist/integrations/platforms/cli.cjs +1 -0
- package/dist/integrations/platforms/cli.d.cts +12 -0
- package/dist/integrations/platforms/cli.d.mts +12 -0
- package/dist/integrations/platforms/cli.mjs +2 -0
- package/dist/integrations/platforms/github.cjs +1 -0
- package/dist/integrations/platforms/github.d.cts +16 -0
- package/dist/integrations/platforms/github.d.mts +2 -1
- package/dist/integrations/platforms/github.mjs +2 -13
- package/dist/integrations/platforms/slack.cjs +1 -0
- package/dist/integrations/platforms/slack.d.cts +33 -0
- package/dist/integrations/platforms/slack.d.mts +33 -0
- package/dist/integrations/platforms/slack.mjs +2 -0
- package/dist/integrations/platforms/vercel.cjs +1 -0
- package/dist/integrations/platforms/vercel.d.cts +47 -0
- package/dist/integrations/platforms/vercel.d.mts +2 -1
- package/dist/integrations/platforms/vercel.mjs +2 -26
- package/dist/releases/definition.cjs +1 -0
- package/dist/releases/definition.d.cts +57 -0
- package/dist/releases/definition.d.mts +4 -2
- package/dist/releases/definition.mjs +2 -63
- package/dist/releases/slug.cjs +1 -0
- package/dist/releases/slug.d.cts +24 -0
- package/dist/releases/slug.d.mts +24 -0
- package/dist/releases/slug.mjs +2 -0
- package/dist/sdk/env.cjs +1 -0
- package/dist/sdk/env.d.cts +6 -0
- package/dist/sdk/env.d.mts +2 -1
- package/dist/sdk/env.mjs +2 -17
- package/dist/sdk/envelope.cjs +1 -0
- package/dist/sdk/envelope.d.cts +1489 -0
- package/dist/sdk/envelope.d.mts +163 -35
- package/dist/sdk/envelope.mjs +2 -114
- package/dist/sdk/errors.cjs +2 -0
- package/dist/sdk/errors.d.cts +154 -0
- package/dist/sdk/errors.d.mts +88 -30
- package/dist/sdk/errors.mjs +3 -253
- package/dist/sdk/geo.cjs +1 -0
- package/dist/sdk/geo.d.cts +11 -0
- package/dist/sdk/geo.d.mts +2 -1
- package/dist/sdk/geo.mjs +2 -17
- package/dist/sdk/identify.cjs +1 -0
- package/dist/sdk/identify.d.cts +35 -0
- package/dist/sdk/identify.d.mts +3 -2
- package/dist/sdk/identify.mjs +2 -43
- package/dist/sdk/plugins/context/browser.cjs +1 -0
- package/dist/sdk/plugins/context/browser.d.cts +92 -0
- package/dist/sdk/plugins/context/browser.d.mts +10 -1
- package/dist/sdk/plugins/context/browser.mjs +2 -81
- package/dist/sdk/plugins/context/edge.cjs +1 -0
- package/dist/sdk/plugins/context/edge.d.cts +10 -0
- package/dist/sdk/plugins/context/edge.d.mts +2 -1
- package/dist/sdk/plugins/context/edge.mjs +2 -9
- package/dist/sdk/plugins/context/next.cjs +1 -0
- package/dist/sdk/plugins/context/next.d.cts +62 -0
- package/dist/sdk/plugins/context/next.d.mts +2 -1
- package/dist/sdk/plugins/context/next.mjs +2 -50
- package/dist/sdk/plugins/context/node.cjs +1 -0
- package/dist/sdk/plugins/context/node.d.cts +13 -0
- package/dist/sdk/plugins/context/node.d.mts +13 -0
- package/dist/sdk/plugins/context/node.mjs +2 -0
- package/dist/sdk/plugins/manifest.cjs +1 -0
- package/dist/sdk/plugins/manifest.d.cts +60 -0
- package/dist/sdk/plugins/manifest.d.mts +7 -1
- package/dist/sdk/plugins/manifest.mjs +2 -62
- package/dist/sdk/plugins/payload/errors.cjs +1 -0
- package/dist/sdk/plugins/payload/errors.d.cts +65 -0
- package/dist/sdk/plugins/payload/errors.d.mts +29 -19
- package/dist/sdk/plugins/payload/errors.mjs +2 -37
- package/dist/sdk/plugins/payload/page-events.cjs +1 -0
- package/dist/sdk/plugins/payload/page-events.d.cts +20 -0
- package/dist/sdk/plugins/payload/page-events.d.mts +4 -3
- package/dist/sdk/plugins/payload/page-events.mjs +2 -25
- package/dist/sdk/plugins/payload/rage-click.cjs +1 -0
- package/dist/sdk/plugins/payload/rage-click.d.cts +16 -0
- package/dist/sdk/plugins/payload/rage-click.d.mts +2 -1
- package/dist/sdk/plugins/payload/rage-click.mjs +2 -17
- package/dist/sdk/plugins/payload/replay.cjs +1 -0
- package/dist/sdk/plugins/payload/replay.d.cts +14 -0
- package/dist/sdk/plugins/payload/replay.d.mts +2 -1
- package/dist/sdk/plugins/payload/replay.mjs +2 -17
- package/dist/sdk/remote-config.cjs +1 -0
- package/dist/sdk/remote-config.d.cts +39 -0
- package/dist/sdk/remote-config.d.mts +32 -4
- package/dist/sdk/remote-config.mjs +2 -5
- package/dist/sdk/runtime.cjs +1 -0
- package/dist/sdk/runtime.d.cts +22 -0
- package/dist/sdk/runtime.d.mts +2 -1
- package/dist/sdk/runtime.mjs +2 -35
- package/package.json +122 -53
- package/dist/data/frame.d.mts.map +0 -1
- package/dist/data/frame.mjs.map +0 -1
- package/dist/data/session.d.mts.map +0 -1
- package/dist/data/session.mjs.map +0 -1
- package/dist/data/source-maps.d.mts.map +0 -1
- package/dist/data/source-maps.mjs.map +0 -1
- package/dist/events/error.d.mts.map +0 -1
- package/dist/events/error.mjs.map +0 -1
- package/dist/events/pageleave.d.mts.map +0 -1
- package/dist/events/pageleave.mjs.map +0 -1
- package/dist/events/pageview.d.mts.map +0 -1
- package/dist/events/pageview.mjs.map +0 -1
- package/dist/integrations/index.d.mts.map +0 -1
- package/dist/integrations/index.mjs.map +0 -1
- package/dist/integrations/platforms/github.d.mts.map +0 -1
- package/dist/integrations/platforms/github.mjs.map +0 -1
- package/dist/integrations/platforms/vercel.d.mts.map +0 -1
- package/dist/integrations/platforms/vercel.mjs.map +0 -1
- package/dist/releases/definition.d.mts.map +0 -1
- package/dist/releases/definition.mjs.map +0 -1
- package/dist/sdk/env.d.mts.map +0 -1
- package/dist/sdk/env.mjs.map +0 -1
- package/dist/sdk/envelope.d.mts.map +0 -1
- package/dist/sdk/envelope.mjs.map +0 -1
- package/dist/sdk/errors.d.mts.map +0 -1
- package/dist/sdk/errors.mjs.map +0 -1
- package/dist/sdk/geo.d.mts.map +0 -1
- package/dist/sdk/geo.mjs.map +0 -1
- package/dist/sdk/identify.d.mts.map +0 -1
- package/dist/sdk/identify.mjs.map +0 -1
- package/dist/sdk/plugins/context/browser.d.mts.map +0 -1
- package/dist/sdk/plugins/context/browser.mjs.map +0 -1
- package/dist/sdk/plugins/context/edge.d.mts.map +0 -1
- package/dist/sdk/plugins/context/edge.mjs.map +0 -1
- package/dist/sdk/plugins/context/next.d.mts.map +0 -1
- package/dist/sdk/plugins/context/next.mjs.map +0 -1
- package/dist/sdk/plugins/manifest.d.mts.map +0 -1
- package/dist/sdk/plugins/manifest.mjs.map +0 -1
- package/dist/sdk/plugins/payload/errors.d.mts.map +0 -1
- package/dist/sdk/plugins/payload/errors.mjs.map +0 -1
- package/dist/sdk/plugins/payload/page-events.d.mts.map +0 -1
- package/dist/sdk/plugins/payload/page-events.mjs.map +0 -1
- package/dist/sdk/plugins/payload/rage-click.d.mts.map +0 -1
- package/dist/sdk/plugins/payload/rage-click.mjs.map +0 -1
- package/dist/sdk/plugins/payload/replay.d.mts.map +0 -1
- package/dist/sdk/plugins/payload/replay.mjs.map +0 -1
- package/dist/sdk/remote-config.d.mts.map +0 -1
- package/dist/sdk/remote-config.mjs.map +0 -1
- package/dist/sdk/runtime.d.mts.map +0 -1
- package/dist/sdk/runtime.mjs.map +0 -1
package/dist/sdk/errors.mjs
CHANGED
|
@@ -1,253 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* Structured taxonomy of capture sources, tagged onto each
|
|
5
|
-
* `ErrorMechanism.type`. Follows the `auto.<surface>.<library>.<method>`
|
|
6
|
-
* convention Sentry also uses, so downstream analytics / classification can
|
|
7
|
-
* group on common prefixes:
|
|
8
|
-
*
|
|
9
|
-
* `auto.browser.*` — captured by SDK global handlers in the browser
|
|
10
|
-
* `auto.function.*` — captured by SDK functions (boundaries, callbacks,
|
|
11
|
-
* server wrappers)
|
|
12
|
-
*
|
|
13
|
-
* Leaves (`.onerror`, `.error_boundary`, `.on_request_error`, …) identify
|
|
14
|
-
* the specific capture site, which lets the agent's skill classifier reason
|
|
15
|
-
* about what "kind" of event this is without string-matching loose names.
|
|
16
|
-
*/
|
|
17
|
-
const MECHANISM_TYPE = {
|
|
18
|
-
browser: {
|
|
19
|
-
onerror: "auto.browser.global_handlers.onerror",
|
|
20
|
-
onunhandledrejection: "auto.browser.global_handlers.onunhandledrejection",
|
|
21
|
-
consoleError: "auto.browser.console.error"
|
|
22
|
-
},
|
|
23
|
-
react: {
|
|
24
|
-
errorBoundary: "auto.function.react.error_boundary",
|
|
25
|
-
captureBoundary: "auto.function.react.capture_boundary",
|
|
26
|
-
caughtError: "auto.function.react.caught_error",
|
|
27
|
-
uncaughtError: "auto.function.react.uncaught_error",
|
|
28
|
-
recoverableError: "auto.function.react.recoverable_error"
|
|
29
|
-
},
|
|
30
|
-
nextjs: {
|
|
31
|
-
onRequestError: "auto.function.nextjs.on_request_error",
|
|
32
|
-
captureError: "auto.function.nextjs.capture_error"
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
/**
|
|
36
|
-
* URL schemes used by browser extensions in stack frame `fileName` values.
|
|
37
|
-
*
|
|
38
|
-
* `webkit-masked-url://` is Safari's opaque scheme introduced to mask the
|
|
39
|
-
* origin of content scripts under ITP — it serves the same purpose as the
|
|
40
|
-
* `*-extension://` schemes from a noise-filtering perspective.
|
|
41
|
-
*/
|
|
42
|
-
const BROWSER_EXTENSION_SCRIPT_URL_PREFIXES = [
|
|
43
|
-
"chrome-extension://",
|
|
44
|
-
"moz-extension://",
|
|
45
|
-
"safari-web-extension://",
|
|
46
|
-
"safari-extension://",
|
|
47
|
-
"ms-browser-extension://",
|
|
48
|
-
"webkit-masked-url://"
|
|
49
|
-
];
|
|
50
|
-
function isExtensionOriginated({ fileName }) {
|
|
51
|
-
return BROWSER_EXTENSION_SCRIPT_URL_PREFIXES.some((prefix) => fileName?.startsWith(prefix) ?? false);
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* True when any exception in the cause chain has at least one stack frame
|
|
55
|
-
* whose `fileName` is a browser-extension script URL. Covers extension-only
|
|
56
|
-
* stacks, extension interceptors (extension frames above app), app errors
|
|
57
|
-
* whose stack still includes extension code (e.g. hydration), and errors
|
|
58
|
-
* whose outer throw is app code but whose inner `.cause` originated in an
|
|
59
|
-
* extension. Stacks with no filenames are unchanged (returns false).
|
|
60
|
-
*/
|
|
61
|
-
function shouldDropBrowserExtensionNoise(exceptions) {
|
|
62
|
-
return exceptions.some((exception) => exception.frames?.some(isExtensionOriginated) ?? false);
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* True when no frame across the full cause chain carries any `fileName`.
|
|
66
|
-
*
|
|
67
|
-
* Such stacks are structurally uninvestigatable: they come from inline
|
|
68
|
-
* `<script>` blocks (`at <anonymous>:N:M`), `eval()` / `new Function()`,
|
|
69
|
-
* CORS-masked cross-origin scripts (`"Script error."`), or browser-internal
|
|
70
|
-
* code with no URL. No source map can resolve them, no repo lookup can find
|
|
71
|
-
* them, and the agent has nothing to reason over. Dropping at capture time
|
|
72
|
-
* prevents them from dominating ingest volume.
|
|
73
|
-
*/
|
|
74
|
-
function shouldDropUnresolvableStack(exceptions) {
|
|
75
|
-
for (const exception of exceptions) {
|
|
76
|
-
const frames = exception.frames;
|
|
77
|
-
if (!frames?.length) continue;
|
|
78
|
-
if (frames.some((frame) => typeof frame.fileName === "string")) return false;
|
|
79
|
-
}
|
|
80
|
-
return true;
|
|
81
|
-
}
|
|
82
|
-
const MAX_CAUSE_DEPTH = 5;
|
|
83
|
-
/**
|
|
84
|
-
* Upper bound for any single stack-trace line. Pathologically long lines can
|
|
85
|
-
* trigger catastrophic backtracking in regex-based stack parsers (the
|
|
86
|
-
* `error-stack-parser-es` library we depend on is regex-driven). Sentry uses
|
|
87
|
-
* the same 1 KiB ceiling for the same reason.
|
|
88
|
-
*/
|
|
89
|
-
const MAX_STACK_LINE_LENGTH = 1024;
|
|
90
|
-
/**
|
|
91
|
-
* Webpack emits `(error: *)` wrappers around stack frames under certain
|
|
92
|
-
* devtool configurations. The pattern is always a trailing suffix; trimming
|
|
93
|
-
* it lets the downstream parser see a clean `at fn (file:L:C)`.
|
|
94
|
-
*/
|
|
95
|
-
const WEBPACK_ERROR_WRAPPER_RE = /\s*\(error:\s+\*\)$/;
|
|
96
|
-
const PAREN_FILE_RE = /\((.+?)(?::\d+){1,2}\)/;
|
|
97
|
-
const AT_FILE_RE = /at\s+(.+?)(?::\d+){1,2}$/;
|
|
98
|
-
const SPIDERMONKEY_RE = /(?:^|@)((?:https?:\/\/|\/).+?)(?::\d+){1,2}$/;
|
|
99
|
-
const BARE_FILE_RE = /(?:^|@)(.+?)(?::\d+){1,2}$/;
|
|
100
|
-
/**
|
|
101
|
-
* Normalizes an `Error.stack` string before feeding it to the stack parser.
|
|
102
|
-
*
|
|
103
|
-
* - Truncates each line to {@link MAX_STACK_LINE_LENGTH} to prevent ReDoS on
|
|
104
|
-
* pathological inputs (a single frame with a 100 KiB URL can stall the
|
|
105
|
-
* main thread for seconds in a regex-based parser).
|
|
106
|
-
* - Strips the trailing `(error: *)` suffix some webpack builds emit.
|
|
107
|
-
*/
|
|
108
|
-
function preprocessStack(stack) {
|
|
109
|
-
if (!stack) return stack;
|
|
110
|
-
const out = [];
|
|
111
|
-
for (const rawLine of stack.split("\n")) {
|
|
112
|
-
const line = rawLine.length > MAX_STACK_LINE_LENGTH ? rawLine.slice(0, MAX_STACK_LINE_LENGTH) : rawLine;
|
|
113
|
-
out.push(line.replace(WEBPACK_ERROR_WRAPPER_RE, ""));
|
|
114
|
-
}
|
|
115
|
-
return out.join("\n");
|
|
116
|
-
}
|
|
117
|
-
/**
|
|
118
|
-
* Matches one React component-stack line. Captures:
|
|
119
|
-
* 1. component name
|
|
120
|
-
* 2. optional file name (required to have a line number, to avoid matching
|
|
121
|
-
* "(created by Parent)" annotations emitted by React 16-18)
|
|
122
|
-
* 3. optional line number
|
|
123
|
-
* 4. optional column number
|
|
124
|
-
*/
|
|
125
|
-
const COMPONENT_STACK_RE = /^(?:in|at)\s+([^\s(]+)(?:\s+\(([^\s:)]+):(\d+)(?::(\d+))?\))?/;
|
|
126
|
-
/**
|
|
127
|
-
* Parses a React `errorInfo.componentStack` string into synthetic frames.
|
|
128
|
-
*
|
|
129
|
-
* React produces different formats across versions:
|
|
130
|
-
* - React 16–18 legacy: ` in ComponentName`
|
|
131
|
-
* ` in ComponentName (created by Parent)`
|
|
132
|
-
* - React 19 owner stacks: ` at ComponentName`
|
|
133
|
-
* ` at ComponentName (file.tsx:10:5)`
|
|
134
|
-
*
|
|
135
|
-
* Each line becomes one frame with the component as `functionName`. When file
|
|
136
|
-
* positions are present (React 19), they're preserved.
|
|
137
|
-
*/
|
|
138
|
-
function parseReactComponentStack(componentStack) {
|
|
139
|
-
const frames = [];
|
|
140
|
-
for (const rawLine of componentStack.split("\n")) {
|
|
141
|
-
const line = rawLine.trim();
|
|
142
|
-
if (!line) continue;
|
|
143
|
-
const match = COMPONENT_STACK_RE.exec(line);
|
|
144
|
-
if (!match) continue;
|
|
145
|
-
const [, name, fileName, lineStr, colStr] = match;
|
|
146
|
-
if (!name) continue;
|
|
147
|
-
const frame = { functionName: name };
|
|
148
|
-
if (fileName) frame.fileName = fileName;
|
|
149
|
-
if (lineStr) frame.lineNumber = Number(lineStr);
|
|
150
|
-
if (colStr) frame.columnNumber = Number(colStr);
|
|
151
|
-
frames.push(frame);
|
|
152
|
-
}
|
|
153
|
-
return frames;
|
|
154
|
-
}
|
|
155
|
-
/**
|
|
156
|
-
* Coerces any thrown value into an `Error` instance, preferring a nested
|
|
157
|
-
* `Error` inside a plain-object rejection over a stringified fallback.
|
|
158
|
-
*
|
|
159
|
-
* Motivated by the common `Promise.reject({ error: realErr })` pattern
|
|
160
|
-
* (tRPC, GraphQL clients, some fetch wrappers). Without this, the captured
|
|
161
|
-
* exception would be `new Error("[object Object]")` and the nested Error's
|
|
162
|
-
* stack/message would be lost entirely.
|
|
163
|
-
*
|
|
164
|
-
* When multiple candidate Error values exist on the object, the first one
|
|
165
|
-
* found (in declaration order) wins. `cause` is preferred if present, since
|
|
166
|
-
* it's the documented ES2022 convention.
|
|
167
|
-
*/
|
|
168
|
-
function toError(error) {
|
|
169
|
-
if (error instanceof Error) return error;
|
|
170
|
-
if (typeof error === "string") return new Error(error);
|
|
171
|
-
if (error !== null && typeof error === "object") {
|
|
172
|
-
const record = error;
|
|
173
|
-
if (record["cause"] instanceof Error) return record["cause"];
|
|
174
|
-
for (const value of Object.values(record)) if (value instanceof Error) return value;
|
|
175
|
-
}
|
|
176
|
-
return new Error(String(error));
|
|
177
|
-
}
|
|
178
|
-
function toExceptions(error, mechanism) {
|
|
179
|
-
const debugIdMap = getDebugIdMap();
|
|
180
|
-
const exceptions = [];
|
|
181
|
-
let current = error;
|
|
182
|
-
for (let depth = 0; current && depth < MAX_CAUSE_DEPTH; depth += 1) {
|
|
183
|
-
exceptions.push({
|
|
184
|
-
type: current.name,
|
|
185
|
-
value: current.message,
|
|
186
|
-
mechanism: depth === 0 ? mechanism : void 0,
|
|
187
|
-
frames: framesFromError(current, debugIdMap)
|
|
188
|
-
});
|
|
189
|
-
current = current.cause instanceof Error ? current.cause : void 0;
|
|
190
|
-
}
|
|
191
|
-
return exceptions;
|
|
192
|
-
}
|
|
193
|
-
/**
|
|
194
|
-
* Extracts and normalizes frames from an Error, applying:
|
|
195
|
-
* 1. `preprocessStack` — line truncation and webpack-wrapper stripping.
|
|
196
|
-
* 2. `error-stack-parser-es` — engine-specific stack parsing.
|
|
197
|
-
* 3. `framesToPop` — honoring the documented Node convention where an
|
|
198
|
-
* Error constructor sets this field to instruct callers to drop N top
|
|
199
|
-
* frames (used by invariant libraries, assertion wrappers, etc.).
|
|
200
|
-
*/
|
|
201
|
-
function framesFromError(error, debugIdMap) {
|
|
202
|
-
const rawStack = error.stack ?? "";
|
|
203
|
-
const cleaned = preprocessStack(rawStack);
|
|
204
|
-
let frames = parse(cleaned === rawStack ? error : {
|
|
205
|
-
name: error.name,
|
|
206
|
-
message: error.message,
|
|
207
|
-
stack: cleaned
|
|
208
|
-
}, { allowEmpty: true }).map((frame) => normalizeFrame(frame, debugIdMap));
|
|
209
|
-
const framesToPop = error.framesToPop;
|
|
210
|
-
if (typeof framesToPop === "number" && framesToPop > 0) frames = frames.slice(Math.floor(framesToPop));
|
|
211
|
-
return frames;
|
|
212
|
-
}
|
|
213
|
-
let cachedDebugIdMap;
|
|
214
|
-
let cachedDebugIdCount = 0;
|
|
215
|
-
function getDebugIdMap() {
|
|
216
|
-
const registry = globalThis["_debugIds"];
|
|
217
|
-
if (!registry) return /* @__PURE__ */ new Map();
|
|
218
|
-
const entries = Object.keys(registry);
|
|
219
|
-
if (cachedDebugIdMap && entries.length === cachedDebugIdCount) return cachedDebugIdMap;
|
|
220
|
-
const map = /* @__PURE__ */ new Map();
|
|
221
|
-
for (const stackKey of entries) {
|
|
222
|
-
const debugId = registry[stackKey];
|
|
223
|
-
if (!debugId) continue;
|
|
224
|
-
const filename = extractFilenameFromStack(stackKey);
|
|
225
|
-
if (filename) map.set(filename, debugId);
|
|
226
|
-
}
|
|
227
|
-
cachedDebugIdMap = map;
|
|
228
|
-
cachedDebugIdCount = entries.length;
|
|
229
|
-
return map;
|
|
230
|
-
}
|
|
231
|
-
function extractFilenameFromStack(stack) {
|
|
232
|
-
const lines = stack.split("\n");
|
|
233
|
-
for (let i = lines.length - 1; i >= 0; i--) {
|
|
234
|
-
const line = lines[i];
|
|
235
|
-
if (!line) continue;
|
|
236
|
-
const match = line.match(PAREN_FILE_RE) ?? line.match(AT_FILE_RE) ?? line.match(SPIDERMONKEY_RE) ?? line.match(BARE_FILE_RE);
|
|
237
|
-
if (match?.[1]) return match[1].trim();
|
|
238
|
-
}
|
|
239
|
-
return null;
|
|
240
|
-
}
|
|
241
|
-
function normalizeFrame(frame, debugIdMap) {
|
|
242
|
-
const fileName = typeof frame.fileName === "string" ? frame.fileName : void 0;
|
|
243
|
-
return {
|
|
244
|
-
fileName,
|
|
245
|
-
functionName: typeof frame.functionName === "string" ? frame.functionName : void 0,
|
|
246
|
-
lineNumber: typeof frame.lineNumber === "number" ? frame.lineNumber : void 0,
|
|
247
|
-
columnNumber: typeof frame.columnNumber === "number" ? frame.columnNumber : void 0,
|
|
248
|
-
source: typeof frame.source === "string" ? frame.source : void 0,
|
|
249
|
-
debugId: fileName ? debugIdMap.get(fileName) : void 0
|
|
250
|
-
};
|
|
251
|
-
}
|
|
252
|
-
//#endregion
|
|
253
|
-
export { MECHANISM_TYPE, extractFilenameFromStack, parseReactComponentStack, preprocessStack, shouldDropBrowserExtensionNoise, shouldDropUnresolvableStack, toError, toExceptions };
|
|
1
|
+
const MECHANISM_TYPE={browser:{onerror:`auto.browser.global_handlers.onerror`,onunhandledrejection:`auto.browser.global_handlers.onunhandledrejection`,consoleError:`auto.browser.console.error`},react:{errorBoundary:`auto.function.react.error_boundary`,captureBoundary:`auto.function.react.capture_boundary`,caughtError:`auto.function.react.caught_error`,uncaughtError:`auto.function.react.uncaught_error`,recoverableError:`auto.function.react.recoverable_error`},nextjs:{onRequestError:`auto.function.nextjs.on_request_error`,captureError:`auto.function.nextjs.capture_error`},node:{captureError:`auto.function.node.capture_error`,uncaughtException:`auto.node.global_handlers.uncaught_exception`,unhandledRejection:`auto.node.global_handlers.unhandled_rejection`},manual:{capture:`manual.api.capture`}},EXTENSION_URL_RE=/\b(?:chrome|moz|safari-web|safari|ms-browser|webkit-masked)-(?:extension|url):\/\//;function shouldDropBrowserExtensionNoise(stacks){return stacks.some(stack=>EXTENSION_URL_RE.test(stack))}const HAS_SOURCE_LOCATION_RE=/(?:https?|file|blob|webpack-internal):\/\/|\sat\s+[\w$.<>]+\s+\([^)]+:\d/;function shouldDropUnresolvableStack(stacks){if(stacks.length===0)return!1;for(let stack of stacks)if(HAS_SOURCE_LOCATION_RE.test(stack))return!1;return!0}const COMPONENT_STACK_RE=/^(?:in|at)\s+([^\s(]+)(?:\s+\(([^\s:)]+):(\d+)(?::(\d+))?\))?/;function parseReactComponentStack(componentStack){let frames=[];for(let rawLine of componentStack.split(`
|
|
2
|
+
`)){let line=rawLine.trim();if(!line)continue;let match=COMPONENT_STACK_RE.exec(line);if(!match)continue;let[,name,fileName,lineStr,colStr]=match;if(!name)continue;let frame={id:`react-${frames.length}`,fn:name};fileName&&(frame.file=fileName),lineStr&&(frame.line=Number(lineStr)),colStr&&(frame.column=Number(colStr)),frames.push(frame)}return frames}function toError(error){return error instanceof Error?error:typeof error==`string`?Error(error):typeof error==`object`&&error?tryUnwrapNestedError(error)||tagAsNonError(safeJson(error)??String(error)):tagAsNonError(String(error))}function tryUnwrapNestedError(record){if(record.cause instanceof Error)return record.cause;for(let value of Object.values(record))if(value instanceof Error)return value}function tagAsNonError(message){let e=Error(message);return e.name=`NonError`,e}function safeJson(value){try{return JSON.stringify(value)}catch{return null}}function classify(value){if(value===null)return`null`;let t=typeof value;if(t!==`object`)return t;let tag=Object.prototype.toString.call(value).slice(8,-1);return tag===`Object`?`PlainObject`:tag}function describe(value){if(value==null)return`Non-Error captured: ${String(value)}`;if(typeof value==`object`){let keys=Object.keys(value).sort();return keys.length===0?`Non-Error captured: empty object`:`Non-Error captured with keys: ${keys.join(`, `)}`}return`Non-Error captured: ${String(value)}`}function serializeBoundedDepth(value,maxDepth){let seen=new WeakSet,walk=(current,depth)=>{if(current===null)return null;let t=typeof current;if(t===`string`||t===`number`||t===`boolean`)return current;if(t===`undefined`)return;if(t===`function`||t===`symbol`||t===`bigint`)return String(current);if(depth>maxDepth)return`[depth-limit]`;if(seen.has(current))return`[circular]`;if(seen.add(current),Array.isArray(current))return current.map(item=>walk(item,depth+1));let out={};for(let[k,v]of Object.entries(current))out[k]=walk(v,depth+1);return out};return walk(value,0)}function toException(value){if(value instanceof Error)return value;if(typeof value==`string`)return Error(value);if(typeof value==`object`&&value){let nested=tryUnwrapNestedError(value);if(nested)return nested}return{kind:`non-error`,type:classify(value),value:describe(value),serialized:serializeBoundedDepth(value,4)}}function isNonErrorException(value){return typeof value==`object`&&!!value&&value.kind===`non-error`}function toExceptions(value,mechanism){if(isNonErrorException(value))return[{kind:`non-error`,type:value.type,value:value.value,mechanism,serialized:value.serialized}];let exceptions=[],current=value;for(let depth=0;current&&depth<5;depth+=1)exceptions.push({kind:`error`,type:current.name,value:current.message,mechanism:depth===0?mechanism:void 0,stack:current.stack??``}),current=current.cause instanceof Error?current.cause:void 0;return exceptions}export{MECHANISM_TYPE,isNonErrorException,parseReactComponentStack,shouldDropBrowserExtensionNoise,shouldDropUnresolvableStack,toError,toException,toExceptions};
|
|
3
|
+
//# sourceMappingURL=errors.mjs.map
|
package/dist/sdk/geo.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let zod=require("zod");const cloudflareTraceSchema=zod.z.object({loc:zod.z.string().length(2)}).loose(),GEO_COUNTRY_HEADERS=[`cf-ipcountry`,`x-vercel-ip-country`,`x-country-code`];function extractCountryHeader(request){for(let header of GEO_COUNTRY_HEADERS){let value=request.headers.get(header);if(value&&value.length===2)return value.toUpperCase()}return null}exports.cloudflareTraceSchema=cloudflareTraceSchema,exports.extractCountryHeader=extractCountryHeader;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
//#region src/sdk/geo.d.ts
|
|
4
|
+
declare const cloudflareTraceSchema: z.ZodObject<{
|
|
5
|
+
loc: z.ZodString;
|
|
6
|
+
}, z.core.$loose>;
|
|
7
|
+
type CloudflareTrace = z.infer<typeof cloudflareTraceSchema>;
|
|
8
|
+
declare function extractCountryHeader(request: Request): string | null;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { CloudflareTrace, cloudflareTraceSchema, extractCountryHeader };
|
|
11
|
+
//# sourceMappingURL=geo.d.cts.map
|
package/dist/sdk/geo.d.mts
CHANGED
|
@@ -7,4 +7,5 @@ declare const cloudflareTraceSchema: z.ZodObject<{
|
|
|
7
7
|
type CloudflareTrace = z.infer<typeof cloudflareTraceSchema>;
|
|
8
8
|
declare function extractCountryHeader(request: Request): string | null;
|
|
9
9
|
//#endregion
|
|
10
|
-
export { CloudflareTrace, cloudflareTraceSchema, extractCountryHeader };
|
|
10
|
+
export { CloudflareTrace, cloudflareTraceSchema, extractCountryHeader };
|
|
11
|
+
//# sourceMappingURL=geo.d.mts.map
|
package/dist/sdk/geo.mjs
CHANGED
|
@@ -1,17 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
//#
|
|
3
|
-
const cloudflareTraceSchema = z.object({ loc: z.string().length(2) }).passthrough();
|
|
4
|
-
const GEO_COUNTRY_HEADERS = [
|
|
5
|
-
"cf-ipcountry",
|
|
6
|
-
"x-vercel-ip-country",
|
|
7
|
-
"x-country-code"
|
|
8
|
-
];
|
|
9
|
-
function extractCountryHeader(request) {
|
|
10
|
-
for (const header of GEO_COUNTRY_HEADERS) {
|
|
11
|
-
const value = request.headers.get(header);
|
|
12
|
-
if (value && value.length === 2) return value.toUpperCase();
|
|
13
|
-
}
|
|
14
|
-
return null;
|
|
15
|
-
}
|
|
16
|
-
//#endregion
|
|
17
|
-
export { cloudflareTraceSchema, extractCountryHeader };
|
|
1
|
+
import{z}from"zod";const cloudflareTraceSchema=z.object({loc:z.string().length(2)}).loose(),GEO_COUNTRY_HEADERS=[`cf-ipcountry`,`x-vercel-ip-country`,`x-country-code`];function extractCountryHeader(request){for(let header of GEO_COUNTRY_HEADERS){let value=request.headers.get(header);if(value&&value.length===2)return value.toUpperCase()}return null}export{cloudflareTraceSchema,extractCountryHeader};
|
|
2
|
+
//# sourceMappingURL=geo.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let zod=require("zod");const identifySourceSchema=zod.z.discriminatedUnion(`type`,[zod.z.object({type:zod.z.literal(`clerk`),name:zod.z.literal(`Clerk`)}).meta({id:`ClerkIdentifySource`,title:`ClerkIdentifySource`}),zod.z.object({type:zod.z.literal(`auth0`),name:zod.z.literal(`Auth0`)}).meta({id:`Auth0IdentifySource`,title:`Auth0IdentifySource`}),zod.z.object({type:zod.z.literal(`custom`),name:zod.z.string()}).meta({id:`CustomIdentifySource`,title:`CustomIdentifySource`})]).meta({id:`IdentifySource`,title:`IdentifySource`,description:`Auth provider that surfaced this identification.`}),traitsSchema=zod.z.record(zod.z.string(),zod.z.unknown()).meta({id:`IdentifyTraits`,title:`IdentifyTraits`,description:`Free-form key/value bag of user attributes attached when identifying a session.`}),identifyParamsSchema=zod.z.object({avatar:zod.z.string().optional(),email:zod.z.email().optional(),identifier:zod.z.string(),name:zod.z.string().optional(),source:identifySourceSchema,traits:traitsSchema.optional()}).meta({id:`IdentifyParams`,title:`IdentifyParams`,description:`User attributes attached when identifying a session.`});exports.identifyParamsSchema=identifyParamsSchema,exports.identifySourceSchema=identifySourceSchema;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
//#region src/sdk/identify.d.ts
|
|
4
|
+
declare const identifySourceSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
5
|
+
type: z.ZodLiteral<"clerk">;
|
|
6
|
+
name: z.ZodLiteral<"Clerk">;
|
|
7
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
8
|
+
type: z.ZodLiteral<"auth0">;
|
|
9
|
+
name: z.ZodLiteral<"Auth0">;
|
|
10
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
11
|
+
type: z.ZodLiteral<"custom">;
|
|
12
|
+
name: z.ZodString;
|
|
13
|
+
}, z.core.$strip>], "type">;
|
|
14
|
+
type IdentifySource = z.infer<typeof identifySourceSchema>;
|
|
15
|
+
declare const identifyParamsSchema: z.ZodObject<{
|
|
16
|
+
avatar: z.ZodOptional<z.ZodString>;
|
|
17
|
+
email: z.ZodOptional<z.ZodEmail>;
|
|
18
|
+
identifier: z.ZodString;
|
|
19
|
+
name: z.ZodOptional<z.ZodString>;
|
|
20
|
+
source: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
21
|
+
type: z.ZodLiteral<"clerk">;
|
|
22
|
+
name: z.ZodLiteral<"Clerk">;
|
|
23
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
24
|
+
type: z.ZodLiteral<"auth0">;
|
|
25
|
+
name: z.ZodLiteral<"Auth0">;
|
|
26
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
27
|
+
type: z.ZodLiteral<"custom">;
|
|
28
|
+
name: z.ZodString;
|
|
29
|
+
}, z.core.$strip>], "type">;
|
|
30
|
+
traits: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
31
|
+
}, z.core.$strip>;
|
|
32
|
+
type IdentifyParams = z.infer<typeof identifyParamsSchema>;
|
|
33
|
+
//#endregion
|
|
34
|
+
export { IdentifyParams, IdentifySource, identifyParamsSchema, identifySourceSchema };
|
|
35
|
+
//# sourceMappingURL=identify.d.cts.map
|
package/dist/sdk/identify.d.mts
CHANGED
|
@@ -14,7 +14,7 @@ declare const identifySourceSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
14
14
|
type IdentifySource = z.infer<typeof identifySourceSchema>;
|
|
15
15
|
declare const identifyParamsSchema: z.ZodObject<{
|
|
16
16
|
avatar: z.ZodOptional<z.ZodString>;
|
|
17
|
-
email: z.ZodOptional<z.
|
|
17
|
+
email: z.ZodOptional<z.ZodEmail>;
|
|
18
18
|
identifier: z.ZodString;
|
|
19
19
|
name: z.ZodOptional<z.ZodString>;
|
|
20
20
|
source: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
@@ -31,4 +31,5 @@ declare const identifyParamsSchema: z.ZodObject<{
|
|
|
31
31
|
}, z.core.$strip>;
|
|
32
32
|
type IdentifyParams = z.infer<typeof identifyParamsSchema>;
|
|
33
33
|
//#endregion
|
|
34
|
-
export { IdentifyParams, IdentifySource, identifyParamsSchema, identifySourceSchema };
|
|
34
|
+
export { IdentifyParams, IdentifySource, identifyParamsSchema, identifySourceSchema };
|
|
35
|
+
//# sourceMappingURL=identify.d.mts.map
|
package/dist/sdk/identify.mjs
CHANGED
|
@@ -1,43 +1,2 @@
|
|
|
1
|
-
import { z }
|
|
2
|
-
//#
|
|
3
|
-
const identifySourceSchema = z.discriminatedUnion("type", [
|
|
4
|
-
z.object({
|
|
5
|
-
type: z.literal("clerk"),
|
|
6
|
-
name: z.literal("Clerk")
|
|
7
|
-
}).meta({
|
|
8
|
-
id: "ClerkIdentifySource",
|
|
9
|
-
title: "ClerkIdentifySource"
|
|
10
|
-
}),
|
|
11
|
-
z.object({
|
|
12
|
-
type: z.literal("auth0"),
|
|
13
|
-
name: z.literal("Auth0")
|
|
14
|
-
}).meta({
|
|
15
|
-
id: "Auth0IdentifySource",
|
|
16
|
-
title: "Auth0IdentifySource"
|
|
17
|
-
}),
|
|
18
|
-
z.object({
|
|
19
|
-
type: z.literal("custom"),
|
|
20
|
-
name: z.string()
|
|
21
|
-
}).meta({
|
|
22
|
-
id: "CustomIdentifySource",
|
|
23
|
-
title: "CustomIdentifySource"
|
|
24
|
-
})
|
|
25
|
-
]).meta({
|
|
26
|
-
id: "IdentifySource",
|
|
27
|
-
title: "IdentifySource",
|
|
28
|
-
description: "Auth provider that surfaced this identification."
|
|
29
|
-
});
|
|
30
|
-
const identifyParamsSchema = z.object({
|
|
31
|
-
avatar: z.string().optional(),
|
|
32
|
-
email: z.string().optional(),
|
|
33
|
-
identifier: z.string(),
|
|
34
|
-
name: z.string().optional(),
|
|
35
|
-
source: identifySourceSchema,
|
|
36
|
-
traits: z.record(z.string(), z.unknown()).optional()
|
|
37
|
-
}).meta({
|
|
38
|
-
id: "IdentifyParams",
|
|
39
|
-
title: "IdentifyParams",
|
|
40
|
-
description: "User attributes attached when identifying a session."
|
|
41
|
-
});
|
|
42
|
-
//#endregion
|
|
43
|
-
export { identifyParamsSchema, identifySourceSchema };
|
|
1
|
+
import{z}from"zod";const identifySourceSchema=z.discriminatedUnion(`type`,[z.object({type:z.literal(`clerk`),name:z.literal(`Clerk`)}).meta({id:`ClerkIdentifySource`,title:`ClerkIdentifySource`}),z.object({type:z.literal(`auth0`),name:z.literal(`Auth0`)}).meta({id:`Auth0IdentifySource`,title:`Auth0IdentifySource`}),z.object({type:z.literal(`custom`),name:z.string()}).meta({id:`CustomIdentifySource`,title:`CustomIdentifySource`})]).meta({id:`IdentifySource`,title:`IdentifySource`,description:`Auth provider that surfaced this identification.`}),traitsSchema=z.record(z.string(),z.unknown()).meta({id:`IdentifyTraits`,title:`IdentifyTraits`,description:`Free-form key/value bag of user attributes attached when identifying a session.`}),identifyParamsSchema=z.object({avatar:z.string().optional(),email:z.email().optional(),identifier:z.string(),name:z.string().optional(),source:identifySourceSchema,traits:traitsSchema.optional()}).meta({id:`IdentifyParams`,title:`IdentifyParams`,description:`User attributes attached when identifying a session.`});export{identifyParamsSchema,identifySourceSchema};
|
|
2
|
+
//# sourceMappingURL=identify.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let zod=require("zod");const deviceBrowserSchema=zod.z.object({major:zod.z.string().optional(),name:zod.z.string().optional(),type:zod.z.string().optional(),version:zod.z.string().optional(),fullVersion:zod.z.string().optional()}).meta({id:`DeviceBrowser`,title:`DeviceBrowser`}),deviceCpuSchema=zod.z.object({architecture:zod.z.string().optional(),bitness:zod.z.string().optional()}).meta({id:`DeviceCpu`,title:`DeviceCpu`}),deviceInfoSchema=zod.z.object({model:zod.z.string().optional(),type:zod.z.string().optional(),vendor:zod.z.string().optional()}).meta({id:`DeviceInfo`,title:`DeviceInfo`}),deviceEngineSchema=zod.z.object({name:zod.z.string().optional(),version:zod.z.string().optional()}).meta({id:`DeviceEngine`,title:`DeviceEngine`}),deviceOsSchema=zod.z.object({name:zod.z.string().optional(),version:zod.z.string().optional(),versionFull:zod.z.string().optional()}).meta({id:`DeviceOs`,title:`DeviceOs`}),deviceMetadataSchema=zod.z.object({browser:deviceBrowserSchema,cpu:deviceCpuSchema,device:deviceInfoSchema,engine:deviceEngineSchema,os:deviceOsSchema,ua:zod.z.string(),frozenUa:zod.z.boolean().optional()}).meta({id:`DeviceMetadata`,title:`DeviceMetadata`,description:`Device/browser metadata extracted from the user agent.`}),displayScreenSchema=zod.z.object({height:zod.z.number(),width:zod.z.number(),orientation:zod.z.string().optional()}).meta({id:`Screen`,title:`Screen`}),displaySchema=zod.z.object({screen:displayScreenSchema}).meta({id:`Display`,title:`Display`}),browserMetadataSchema=zod.z.object({language:zod.z.string().optional(),timezone:zod.z.string().optional(),display:displaySchema}).meta({id:`BrowserMetadata`,title:`BrowserMetadata`,description:`Browser locale and display metadata.`}),browserContextSchema=zod.z.object({runtime:zod.z.literal(`browser`),browser:browserMetadataSchema.nullable(),device:deviceMetadataSchema.nullable()}).meta({id:`BrowserContext`,title:`BrowserContext`,description:`Request context for the browser runtime.`});exports.browserContextSchema=browserContextSchema,exports.deviceMetadataSchema=deviceMetadataSchema;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
//#region src/sdk/plugins/context/browser.d.ts
|
|
4
|
+
declare const deviceMetadataSchema: z.ZodObject<{
|
|
5
|
+
browser: z.ZodObject<{
|
|
6
|
+
major: z.ZodOptional<z.ZodString>;
|
|
7
|
+
name: z.ZodOptional<z.ZodString>;
|
|
8
|
+
type: z.ZodOptional<z.ZodString>;
|
|
9
|
+
version: z.ZodOptional<z.ZodString>;
|
|
10
|
+
fullVersion: z.ZodOptional<z.ZodString>;
|
|
11
|
+
}, z.core.$strip>;
|
|
12
|
+
cpu: z.ZodObject<{
|
|
13
|
+
architecture: z.ZodOptional<z.ZodString>;
|
|
14
|
+
bitness: z.ZodOptional<z.ZodString>;
|
|
15
|
+
}, z.core.$strip>;
|
|
16
|
+
device: z.ZodObject<{
|
|
17
|
+
model: z.ZodOptional<z.ZodString>;
|
|
18
|
+
type: z.ZodOptional<z.ZodString>;
|
|
19
|
+
vendor: z.ZodOptional<z.ZodString>;
|
|
20
|
+
}, z.core.$strip>;
|
|
21
|
+
engine: z.ZodObject<{
|
|
22
|
+
name: z.ZodOptional<z.ZodString>;
|
|
23
|
+
version: z.ZodOptional<z.ZodString>;
|
|
24
|
+
}, z.core.$strip>;
|
|
25
|
+
os: z.ZodObject<{
|
|
26
|
+
name: z.ZodOptional<z.ZodString>;
|
|
27
|
+
version: z.ZodOptional<z.ZodString>;
|
|
28
|
+
versionFull: z.ZodOptional<z.ZodString>;
|
|
29
|
+
}, z.core.$strip>;
|
|
30
|
+
ua: z.ZodString;
|
|
31
|
+
frozenUa: z.ZodOptional<z.ZodBoolean>;
|
|
32
|
+
}, z.core.$strip>;
|
|
33
|
+
type DeviceMetadata = z.infer<typeof deviceMetadataSchema>;
|
|
34
|
+
declare const browserMetadataSchema: z.ZodObject<{
|
|
35
|
+
language: z.ZodOptional<z.ZodString>;
|
|
36
|
+
timezone: z.ZodOptional<z.ZodString>;
|
|
37
|
+
display: z.ZodObject<{
|
|
38
|
+
screen: z.ZodObject<{
|
|
39
|
+
height: z.ZodNumber;
|
|
40
|
+
width: z.ZodNumber;
|
|
41
|
+
orientation: z.ZodOptional<z.ZodString>;
|
|
42
|
+
}, z.core.$strip>;
|
|
43
|
+
}, z.core.$strip>;
|
|
44
|
+
}, z.core.$strip>;
|
|
45
|
+
type BrowserMetadata = z.infer<typeof browserMetadataSchema>;
|
|
46
|
+
declare const browserContextSchema: z.ZodObject<{
|
|
47
|
+
runtime: z.ZodLiteral<"browser">;
|
|
48
|
+
browser: z.ZodNullable<z.ZodObject<{
|
|
49
|
+
language: z.ZodOptional<z.ZodString>;
|
|
50
|
+
timezone: z.ZodOptional<z.ZodString>;
|
|
51
|
+
display: z.ZodObject<{
|
|
52
|
+
screen: z.ZodObject<{
|
|
53
|
+
height: z.ZodNumber;
|
|
54
|
+
width: z.ZodNumber;
|
|
55
|
+
orientation: z.ZodOptional<z.ZodString>;
|
|
56
|
+
}, z.core.$strip>;
|
|
57
|
+
}, z.core.$strip>;
|
|
58
|
+
}, z.core.$strip>>;
|
|
59
|
+
device: z.ZodNullable<z.ZodObject<{
|
|
60
|
+
browser: z.ZodObject<{
|
|
61
|
+
major: z.ZodOptional<z.ZodString>;
|
|
62
|
+
name: z.ZodOptional<z.ZodString>;
|
|
63
|
+
type: z.ZodOptional<z.ZodString>;
|
|
64
|
+
version: z.ZodOptional<z.ZodString>;
|
|
65
|
+
fullVersion: z.ZodOptional<z.ZodString>;
|
|
66
|
+
}, z.core.$strip>;
|
|
67
|
+
cpu: z.ZodObject<{
|
|
68
|
+
architecture: z.ZodOptional<z.ZodString>;
|
|
69
|
+
bitness: z.ZodOptional<z.ZodString>;
|
|
70
|
+
}, z.core.$strip>;
|
|
71
|
+
device: z.ZodObject<{
|
|
72
|
+
model: z.ZodOptional<z.ZodString>;
|
|
73
|
+
type: z.ZodOptional<z.ZodString>;
|
|
74
|
+
vendor: z.ZodOptional<z.ZodString>;
|
|
75
|
+
}, z.core.$strip>;
|
|
76
|
+
engine: z.ZodObject<{
|
|
77
|
+
name: z.ZodOptional<z.ZodString>;
|
|
78
|
+
version: z.ZodOptional<z.ZodString>;
|
|
79
|
+
}, z.core.$strip>;
|
|
80
|
+
os: z.ZodObject<{
|
|
81
|
+
name: z.ZodOptional<z.ZodString>;
|
|
82
|
+
version: z.ZodOptional<z.ZodString>;
|
|
83
|
+
versionFull: z.ZodOptional<z.ZodString>;
|
|
84
|
+
}, z.core.$strip>;
|
|
85
|
+
ua: z.ZodString;
|
|
86
|
+
frozenUa: z.ZodOptional<z.ZodBoolean>;
|
|
87
|
+
}, z.core.$strip>>;
|
|
88
|
+
}, z.core.$strip>;
|
|
89
|
+
type BrowserContext = z.infer<typeof browserContextSchema>;
|
|
90
|
+
//#endregion
|
|
91
|
+
export { BrowserContext, BrowserMetadata, DeviceMetadata, browserContextSchema, deviceMetadataSchema };
|
|
92
|
+
//# sourceMappingURL=browser.d.cts.map
|
|
@@ -7,9 +7,11 @@ declare const deviceMetadataSchema: z.ZodObject<{
|
|
|
7
7
|
name: z.ZodOptional<z.ZodString>;
|
|
8
8
|
type: z.ZodOptional<z.ZodString>;
|
|
9
9
|
version: z.ZodOptional<z.ZodString>;
|
|
10
|
+
fullVersion: z.ZodOptional<z.ZodString>;
|
|
10
11
|
}, z.core.$strip>;
|
|
11
12
|
cpu: z.ZodObject<{
|
|
12
13
|
architecture: z.ZodOptional<z.ZodString>;
|
|
14
|
+
bitness: z.ZodOptional<z.ZodString>;
|
|
13
15
|
}, z.core.$strip>;
|
|
14
16
|
device: z.ZodObject<{
|
|
15
17
|
model: z.ZodOptional<z.ZodString>;
|
|
@@ -23,8 +25,10 @@ declare const deviceMetadataSchema: z.ZodObject<{
|
|
|
23
25
|
os: z.ZodObject<{
|
|
24
26
|
name: z.ZodOptional<z.ZodString>;
|
|
25
27
|
version: z.ZodOptional<z.ZodString>;
|
|
28
|
+
versionFull: z.ZodOptional<z.ZodString>;
|
|
26
29
|
}, z.core.$strip>;
|
|
27
30
|
ua: z.ZodString;
|
|
31
|
+
frozenUa: z.ZodOptional<z.ZodBoolean>;
|
|
28
32
|
}, z.core.$strip>;
|
|
29
33
|
type DeviceMetadata = z.infer<typeof deviceMetadataSchema>;
|
|
30
34
|
declare const browserMetadataSchema: z.ZodObject<{
|
|
@@ -58,9 +62,11 @@ declare const browserContextSchema: z.ZodObject<{
|
|
|
58
62
|
name: z.ZodOptional<z.ZodString>;
|
|
59
63
|
type: z.ZodOptional<z.ZodString>;
|
|
60
64
|
version: z.ZodOptional<z.ZodString>;
|
|
65
|
+
fullVersion: z.ZodOptional<z.ZodString>;
|
|
61
66
|
}, z.core.$strip>;
|
|
62
67
|
cpu: z.ZodObject<{
|
|
63
68
|
architecture: z.ZodOptional<z.ZodString>;
|
|
69
|
+
bitness: z.ZodOptional<z.ZodString>;
|
|
64
70
|
}, z.core.$strip>;
|
|
65
71
|
device: z.ZodObject<{
|
|
66
72
|
model: z.ZodOptional<z.ZodString>;
|
|
@@ -74,10 +80,13 @@ declare const browserContextSchema: z.ZodObject<{
|
|
|
74
80
|
os: z.ZodObject<{
|
|
75
81
|
name: z.ZodOptional<z.ZodString>;
|
|
76
82
|
version: z.ZodOptional<z.ZodString>;
|
|
83
|
+
versionFull: z.ZodOptional<z.ZodString>;
|
|
77
84
|
}, z.core.$strip>;
|
|
78
85
|
ua: z.ZodString;
|
|
86
|
+
frozenUa: z.ZodOptional<z.ZodBoolean>;
|
|
79
87
|
}, z.core.$strip>>;
|
|
80
88
|
}, z.core.$strip>;
|
|
81
89
|
type BrowserContext = z.infer<typeof browserContextSchema>;
|
|
82
90
|
//#endregion
|
|
83
|
-
export { BrowserContext, BrowserMetadata, DeviceMetadata, browserContextSchema, deviceMetadataSchema };
|
|
91
|
+
export { BrowserContext, BrowserMetadata, DeviceMetadata, browserContextSchema, deviceMetadataSchema };
|
|
92
|
+
//# sourceMappingURL=browser.d.mts.map
|
|
@@ -1,81 +1,2 @@
|
|
|
1
|
-
import { z }
|
|
2
|
-
//#
|
|
3
|
-
const deviceBrowserSchema = z.object({
|
|
4
|
-
major: z.string().optional(),
|
|
5
|
-
name: z.string().optional(),
|
|
6
|
-
type: z.string().optional(),
|
|
7
|
-
version: z.string().optional()
|
|
8
|
-
}).meta({
|
|
9
|
-
id: "DeviceBrowser",
|
|
10
|
-
title: "DeviceBrowser"
|
|
11
|
-
});
|
|
12
|
-
const deviceCpuSchema = z.object({ architecture: z.string().optional() }).meta({
|
|
13
|
-
id: "DeviceCpu",
|
|
14
|
-
title: "DeviceCpu"
|
|
15
|
-
});
|
|
16
|
-
const deviceInfoSchema = z.object({
|
|
17
|
-
model: z.string().optional(),
|
|
18
|
-
type: z.string().optional(),
|
|
19
|
-
vendor: z.string().optional()
|
|
20
|
-
}).meta({
|
|
21
|
-
id: "DeviceInfo",
|
|
22
|
-
title: "DeviceInfo"
|
|
23
|
-
});
|
|
24
|
-
const deviceEngineSchema = z.object({
|
|
25
|
-
name: z.string().optional(),
|
|
26
|
-
version: z.string().optional()
|
|
27
|
-
}).meta({
|
|
28
|
-
id: "DeviceEngine",
|
|
29
|
-
title: "DeviceEngine"
|
|
30
|
-
});
|
|
31
|
-
const deviceOsSchema = z.object({
|
|
32
|
-
name: z.string().optional(),
|
|
33
|
-
version: z.string().optional()
|
|
34
|
-
}).meta({
|
|
35
|
-
id: "DeviceOs",
|
|
36
|
-
title: "DeviceOs"
|
|
37
|
-
});
|
|
38
|
-
const deviceMetadataSchema = z.object({
|
|
39
|
-
browser: deviceBrowserSchema,
|
|
40
|
-
cpu: deviceCpuSchema,
|
|
41
|
-
device: deviceInfoSchema,
|
|
42
|
-
engine: deviceEngineSchema,
|
|
43
|
-
os: deviceOsSchema,
|
|
44
|
-
ua: z.string()
|
|
45
|
-
}).meta({
|
|
46
|
-
id: "DeviceMetadata",
|
|
47
|
-
title: "DeviceMetadata",
|
|
48
|
-
description: "Device/browser metadata extracted from the user agent."
|
|
49
|
-
});
|
|
50
|
-
const displayScreenSchema = z.object({
|
|
51
|
-
height: z.number(),
|
|
52
|
-
width: z.number(),
|
|
53
|
-
orientation: z.string().optional()
|
|
54
|
-
}).meta({
|
|
55
|
-
id: "Screen",
|
|
56
|
-
title: "Screen"
|
|
57
|
-
});
|
|
58
|
-
const displaySchema = z.object({ screen: displayScreenSchema }).meta({
|
|
59
|
-
id: "Display",
|
|
60
|
-
title: "Display"
|
|
61
|
-
});
|
|
62
|
-
const browserMetadataSchema = z.object({
|
|
63
|
-
language: z.string().optional(),
|
|
64
|
-
timezone: z.string().optional(),
|
|
65
|
-
display: displaySchema
|
|
66
|
-
}).meta({
|
|
67
|
-
id: "BrowserMetadata",
|
|
68
|
-
title: "BrowserMetadata",
|
|
69
|
-
description: "Browser locale and display metadata."
|
|
70
|
-
});
|
|
71
|
-
const browserContextSchema = z.object({
|
|
72
|
-
runtime: z.literal("browser"),
|
|
73
|
-
browser: browserMetadataSchema.nullable(),
|
|
74
|
-
device: deviceMetadataSchema.nullable()
|
|
75
|
-
}).meta({
|
|
76
|
-
id: "BrowserContext",
|
|
77
|
-
title: "BrowserContext",
|
|
78
|
-
description: "Request context for the browser runtime."
|
|
79
|
-
});
|
|
80
|
-
//#endregion
|
|
81
|
-
export { browserContextSchema, deviceMetadataSchema };
|
|
1
|
+
import{z}from"zod";const deviceBrowserSchema=z.object({major:z.string().optional(),name:z.string().optional(),type:z.string().optional(),version:z.string().optional(),fullVersion:z.string().optional()}).meta({id:`DeviceBrowser`,title:`DeviceBrowser`}),deviceCpuSchema=z.object({architecture:z.string().optional(),bitness:z.string().optional()}).meta({id:`DeviceCpu`,title:`DeviceCpu`}),deviceInfoSchema=z.object({model:z.string().optional(),type:z.string().optional(),vendor:z.string().optional()}).meta({id:`DeviceInfo`,title:`DeviceInfo`}),deviceEngineSchema=z.object({name:z.string().optional(),version:z.string().optional()}).meta({id:`DeviceEngine`,title:`DeviceEngine`}),deviceOsSchema=z.object({name:z.string().optional(),version:z.string().optional(),versionFull:z.string().optional()}).meta({id:`DeviceOs`,title:`DeviceOs`}),deviceMetadataSchema=z.object({browser:deviceBrowserSchema,cpu:deviceCpuSchema,device:deviceInfoSchema,engine:deviceEngineSchema,os:deviceOsSchema,ua:z.string(),frozenUa:z.boolean().optional()}).meta({id:`DeviceMetadata`,title:`DeviceMetadata`,description:`Device/browser metadata extracted from the user agent.`}),displayScreenSchema=z.object({height:z.number(),width:z.number(),orientation:z.string().optional()}).meta({id:`Screen`,title:`Screen`}),displaySchema=z.object({screen:displayScreenSchema}).meta({id:`Display`,title:`Display`}),browserMetadataSchema=z.object({language:z.string().optional(),timezone:z.string().optional(),display:displaySchema}).meta({id:`BrowserMetadata`,title:`BrowserMetadata`,description:`Browser locale and display metadata.`}),browserContextSchema=z.object({runtime:z.literal(`browser`),browser:browserMetadataSchema.nullable(),device:deviceMetadataSchema.nullable()}).meta({id:`BrowserContext`,title:`BrowserContext`,description:`Request context for the browser runtime.`});export{browserContextSchema,deviceMetadataSchema};
|
|
2
|
+
//# sourceMappingURL=browser.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let zod=require("zod");const edgeContextSchema=zod.z.object({runtime:zod.z.literal(`edge`)}).meta({id:`EdgeContext`,title:`EdgeContext`,description:`Request context for the Edge runtime.`});exports.edgeContextSchema=edgeContextSchema;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
//#region src/sdk/plugins/context/edge.d.ts
|
|
4
|
+
declare const edgeContextSchema: z.ZodObject<{
|
|
5
|
+
runtime: z.ZodLiteral<"edge">;
|
|
6
|
+
}, z.core.$strip>;
|
|
7
|
+
type EdgeContext = z.infer<typeof edgeContextSchema>;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { EdgeContext, edgeContextSchema };
|
|
10
|
+
//# sourceMappingURL=edge.d.cts.map
|