@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.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.mjs","names":[],"sources":["../../src/sdk/errors.ts"],"sourcesContent":["import { parse } from \"error-stack-parser-es\";\n\nimport type { IngestedFrame } from \"#data/frame\";\nimport type {\n ErrorMechanism,\n ExceptionValue,\n} from \"#sdk/plugins/payload/errors\";\n\n/**\n * Structured taxonomy of capture sources, tagged onto each\n * `ErrorMechanism.type`. Follows the `auto.<surface>.<library>.<method>`\n * convention Sentry also uses, so downstream analytics / classification can\n * group on common prefixes:\n *\n * `auto.browser.*` — captured by SDK global handlers in the browser\n * `auto.function.*` — captured by SDK functions (boundaries, callbacks,\n * server wrappers)\n *\n * Leaves (`.onerror`, `.error_boundary`, `.on_request_error`, …) identify\n * the specific capture site, which lets the agent's skill classifier reason\n * about what \"kind\" of event this is without string-matching loose names.\n */\nexport const MECHANISM_TYPE = {\n browser: {\n onerror: \"auto.browser.global_handlers.onerror\",\n onunhandledrejection: \"auto.browser.global_handlers.onunhandledrejection\",\n consoleError: \"auto.browser.console.error\",\n },\n react: {\n errorBoundary: \"auto.function.react.error_boundary\",\n captureBoundary: \"auto.function.react.capture_boundary\",\n caughtError: \"auto.function.react.caught_error\",\n uncaughtError: \"auto.function.react.uncaught_error\",\n recoverableError: \"auto.function.react.recoverable_error\",\n },\n nextjs: {\n onRequestError: \"auto.function.nextjs.on_request_error\",\n captureError: \"auto.function.nextjs.capture_error\",\n },\n} as const;\n\n/**\n * URL schemes used by browser extensions in stack frame `fileName` values.\n *\n * `webkit-masked-url://` is Safari's opaque scheme introduced to mask the\n * origin of content scripts under ITP — it serves the same purpose as the\n * `*-extension://` schemes from a noise-filtering perspective.\n */\nconst BROWSER_EXTENSION_SCRIPT_URL_PREFIXES: readonly string[] = [\n \"chrome-extension://\",\n \"moz-extension://\",\n \"safari-web-extension://\",\n \"safari-extension://\",\n \"ms-browser-extension://\",\n \"webkit-masked-url://\",\n];\n\nfunction isExtensionOriginated({ fileName }: IngestedFrame): boolean {\n return BROWSER_EXTENSION_SCRIPT_URL_PREFIXES.some(\n (prefix) => fileName?.startsWith(prefix) ?? false\n );\n}\n\n/**\n * True when any exception in the cause chain has at least one stack frame\n * whose `fileName` is a browser-extension script URL. Covers extension-only\n * stacks, extension interceptors (extension frames above app), app errors\n * whose stack still includes extension code (e.g. hydration), and errors\n * whose outer throw is app code but whose inner `.cause` originated in an\n * extension. Stacks with no filenames are unchanged (returns false).\n */\nexport function shouldDropBrowserExtensionNoise(\n exceptions: readonly ExceptionValue[]\n): boolean {\n return exceptions.some(\n (exception) => exception.frames?.some(isExtensionOriginated) ?? false\n );\n}\n\n/**\n * True when no frame across the full cause chain carries any `fileName`.\n *\n * Such stacks are structurally uninvestigatable: they come from inline\n * `<script>` blocks (`at <anonymous>:N:M`), `eval()` / `new Function()`,\n * CORS-masked cross-origin scripts (`\"Script error.\"`), or browser-internal\n * code with no URL. No source map can resolve them, no repo lookup can find\n * them, and the agent has nothing to reason over. Dropping at capture time\n * prevents them from dominating ingest volume.\n */\nexport function shouldDropUnresolvableStack(\n exceptions: readonly ExceptionValue[]\n): boolean {\n for (const exception of exceptions) {\n const frames = exception.frames;\n if (!frames?.length) {\n continue;\n }\n if (frames.some((frame) => typeof frame.fileName === \"string\")) {\n return false;\n }\n }\n return true;\n}\n\nconst MAX_CAUSE_DEPTH = 5;\n\n/**\n * Upper bound for any single stack-trace line. Pathologically long lines can\n * trigger catastrophic backtracking in regex-based stack parsers (the\n * `error-stack-parser-es` library we depend on is regex-driven). Sentry uses\n * the same 1 KiB ceiling for the same reason.\n */\nconst MAX_STACK_LINE_LENGTH = 1024;\n\n/**\n * Webpack emits `(error: *)` wrappers around stack frames under certain\n * devtool configurations. The pattern is always a trailing suffix; trimming\n * it lets the downstream parser see a clean `at fn (file:L:C)`.\n */\nconst WEBPACK_ERROR_WRAPPER_RE = /\\s*\\(error:\\s+\\*\\)$/;\n\nconst PAREN_FILE_RE = /\\((.+?)(?::\\d+){1,2}\\)/;\nconst AT_FILE_RE = /at\\s+(.+?)(?::\\d+){1,2}$/;\nconst SPIDERMONKEY_RE = /(?:^|@)((?:https?:\\/\\/|\\/).+?)(?::\\d+){1,2}$/;\nconst BARE_FILE_RE = /(?:^|@)(.+?)(?::\\d+){1,2}$/;\n\n/**\n * Normalizes an `Error.stack` string before feeding it to the stack parser.\n *\n * - Truncates each line to {@link MAX_STACK_LINE_LENGTH} to prevent ReDoS on\n * pathological inputs (a single frame with a 100 KiB URL can stall the\n * main thread for seconds in a regex-based parser).\n * - Strips the trailing `(error: *)` suffix some webpack builds emit.\n */\nexport function preprocessStack(stack: string): string {\n if (!stack) {\n return stack;\n }\n\n const out: string[] = [];\n for (const rawLine of stack.split(\"\\n\")) {\n const line =\n rawLine.length > MAX_STACK_LINE_LENGTH\n ? rawLine.slice(0, MAX_STACK_LINE_LENGTH)\n : rawLine;\n out.push(line.replace(WEBPACK_ERROR_WRAPPER_RE, \"\"));\n }\n return out.join(\"\\n\");\n}\n\n/**\n * Matches one React component-stack line. Captures:\n * 1. component name\n * 2. optional file name (required to have a line number, to avoid matching\n * \"(created by Parent)\" annotations emitted by React 16-18)\n * 3. optional line number\n * 4. optional column number\n */\nconst COMPONENT_STACK_RE =\n /^(?:in|at)\\s+([^\\s(]+)(?:\\s+\\(([^\\s:)]+):(\\d+)(?::(\\d+))?\\))?/;\n\n/**\n * Parses a React `errorInfo.componentStack` string into synthetic frames.\n *\n * React produces different formats across versions:\n * - React 16–18 legacy: ` in ComponentName`\n * ` in ComponentName (created by Parent)`\n * - React 19 owner stacks: ` at ComponentName`\n * ` at ComponentName (file.tsx:10:5)`\n *\n * Each line becomes one frame with the component as `functionName`. When file\n * positions are present (React 19), they're preserved.\n */\nexport function parseReactComponentStack(\n componentStack: string\n): IngestedFrame[] {\n const frames: IngestedFrame[] = [];\n for (const rawLine of componentStack.split(\"\\n\")) {\n const line = rawLine.trim();\n if (!line) {\n continue;\n }\n const match = COMPONENT_STACK_RE.exec(line);\n if (!match) {\n continue;\n }\n const [, name, fileName, lineStr, colStr] = match;\n if (!name) {\n continue;\n }\n const frame: IngestedFrame = { functionName: name };\n if (fileName) {\n frame.fileName = fileName;\n }\n if (lineStr) {\n frame.lineNumber = Number(lineStr);\n }\n if (colStr) {\n frame.columnNumber = Number(colStr);\n }\n frames.push(frame);\n }\n return frames;\n}\n\n/**\n * Coerces any thrown value into an `Error` instance, preferring a nested\n * `Error` inside a plain-object rejection over a stringified fallback.\n *\n * Motivated by the common `Promise.reject({ error: realErr })` pattern\n * (tRPC, GraphQL clients, some fetch wrappers). Without this, the captured\n * exception would be `new Error(\"[object Object]\")` and the nested Error's\n * stack/message would be lost entirely.\n *\n * When multiple candidate Error values exist on the object, the first one\n * found (in declaration order) wins. `cause` is preferred if present, since\n * it's the documented ES2022 convention.\n */\nexport function toError(error: unknown): Error {\n if (error instanceof Error) {\n return error;\n }\n\n if (typeof error === \"string\") {\n return new Error(error);\n }\n\n if (error !== null && typeof error === \"object\") {\n const record = error as Record<string, unknown>;\n\n if (record[\"cause\"] instanceof Error) {\n return record[\"cause\"];\n }\n\n for (const value of Object.values(record)) {\n if (value instanceof Error) {\n return value;\n }\n }\n }\n\n return new Error(String(error));\n}\n\nexport function toExceptions(\n error: Error,\n mechanism: ErrorMechanism\n): ExceptionValue[] {\n const debugIdMap = getDebugIdMap();\n const exceptions: ExceptionValue[] = [];\n let current: Error | undefined = error;\n\n for (let depth = 0; current && depth < MAX_CAUSE_DEPTH; depth += 1) {\n exceptions.push({\n type: current.name,\n value: current.message,\n mechanism: depth === 0 ? mechanism : undefined,\n frames: framesFromError(current, debugIdMap),\n });\n\n current = current.cause instanceof Error ? current.cause : undefined;\n }\n\n return exceptions;\n}\n\n/**\n * Extracts and normalizes frames from an Error, applying:\n * 1. `preprocessStack` — line truncation and webpack-wrapper stripping.\n * 2. `error-stack-parser-es` — engine-specific stack parsing.\n * 3. `framesToPop` — honoring the documented Node convention where an\n * Error constructor sets this field to instruct callers to drop N top\n * frames (used by invariant libraries, assertion wrappers, etc.).\n */\nfunction framesFromError(\n error: Error,\n debugIdMap: Map<string, string>\n): IngestedFrame[] {\n const rawStack = error.stack ?? \"\";\n const cleaned = preprocessStack(rawStack);\n\n // error-stack-parser-es reads the Error's `.stack` property directly; we\n // build a minimal parse target so preprocessing doesn't mutate the caller's\n // Error.\n const parseTarget =\n cleaned === rawStack\n ? error\n : ({\n name: error.name,\n message: error.message,\n stack: cleaned,\n } as Error);\n\n let frames = parse(parseTarget, { allowEmpty: true }).map((frame) =>\n normalizeFrame(frame, debugIdMap)\n );\n\n const framesToPop = (error as Error & { framesToPop?: unknown }).framesToPop;\n if (typeof framesToPop === \"number\" && framesToPop > 0) {\n frames = frames.slice(Math.floor(framesToPop));\n }\n\n return frames;\n}\n\nlet cachedDebugIdMap: Map<string, string> | undefined;\nlet cachedDebugIdCount = 0;\n\nfunction getDebugIdMap(): Map<string, string> {\n const registry = (globalThis as Record<string, unknown>)[\"_debugIds\"] as\n | Record<string, string>\n | undefined;\n\n if (!registry) {\n return new Map();\n }\n\n const entries = Object.keys(registry);\n if (cachedDebugIdMap && entries.length === cachedDebugIdCount) {\n return cachedDebugIdMap;\n }\n\n const map = new Map<string, string>();\n for (const stackKey of entries) {\n const debugId = registry[stackKey];\n if (!debugId) {\n continue;\n }\n\n const filename = extractFilenameFromStack(stackKey);\n if (filename) {\n map.set(filename, debugId);\n }\n }\n\n cachedDebugIdMap = map;\n cachedDebugIdCount = entries.length;\n return map;\n}\n\nexport function extractFilenameFromStack(stack: string): string | null {\n const lines = stack.split(\"\\n\");\n for (let i = lines.length - 1; i >= 0; i--) {\n const line = lines[i];\n if (!line) {\n continue;\n }\n const match =\n line.match(PAREN_FILE_RE) ??\n line.match(AT_FILE_RE) ??\n line.match(SPIDERMONKEY_RE) ??\n line.match(BARE_FILE_RE);\n\n if (match?.[1]) {\n return match[1].trim();\n }\n }\n return null;\n}\n\nfunction normalizeFrame(\n frame: {\n fileName?: unknown;\n functionName?: unknown;\n lineNumber?: unknown;\n columnNumber?: unknown;\n source?: unknown;\n },\n debugIdMap: Map<string, string>\n): IngestedFrame {\n const fileName =\n typeof frame.fileName === \"string\" ? frame.fileName : undefined;\n\n return {\n fileName,\n functionName:\n typeof frame.functionName === \"string\" ? frame.functionName : undefined,\n lineNumber:\n typeof frame.lineNumber === \"number\" ? frame.lineNumber : undefined,\n columnNumber:\n typeof frame.columnNumber === \"number\" ? frame.columnNumber : undefined,\n source: typeof frame.source === \"string\" ? frame.source : undefined,\n debugId: fileName ? debugIdMap.get(fileName) : undefined,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAsBA,MAAa,iBAAiB;CAC5B,SAAS;EACP,SAAS;EACT,sBAAsB;EACtB,cAAc;EACf;CACD,OAAO;EACL,eAAe;EACf,iBAAiB;EACjB,aAAa;EACb,eAAe;EACf,kBAAkB;EACnB;CACD,QAAQ;EACN,gBAAgB;EAChB,cAAc;EACf;CACF;;;;;;;;AASD,MAAM,wCAA2D;CAC/D;CACA;CACA;CACA;CACA;CACA;CACD;AAED,SAAS,sBAAsB,EAAE,YAAoC;AACnE,QAAO,sCAAsC,MAC1C,WAAW,UAAU,WAAW,OAAO,IAAI,MAC7C;;;;;;;;;;AAWH,SAAgB,gCACd,YACS;AACT,QAAO,WAAW,MACf,cAAc,UAAU,QAAQ,KAAK,sBAAsB,IAAI,MACjE;;;;;;;;;;;;AAaH,SAAgB,4BACd,YACS;AACT,MAAK,MAAM,aAAa,YAAY;EAClC,MAAM,SAAS,UAAU;AACzB,M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|
|
|
1
|
-
{"version":3,"file":"geo.mjs","names":[],"sources":["../../src/sdk/geo.ts"],"sourcesContent":["import { z } from \"zod\";\n\nexport const cloudflareTraceSchema = z\n .object({ loc: z.string().length(2) })\n .passthrough();\n\nexport type CloudflareTrace = z.infer<typeof cloudflareTraceSchema>;\n\nconst GEO_COUNTRY_HEADERS = [\n \"cf-ipcountry\",\n \"x-vercel-ip-country\",\n \"x-country-code\",\n] as const;\n\nexport function extractCountryHeader(request: Request): string | null {\n for (const header of GEO_COUNTRY_HEADERS) {\n const value = request.headers.get(header);\n if (value && value.length === 2) {\n return value.toUpperCase();\n }\n }\n return null;\n}\n"],"mappings":";;AAEA,MAAa,wBAAwB,EAClC,OAAO,EAAE,KAAK,EAAE,QAAQ,CAAC,OAAO,EAAE,EAAE,CAAC,CACrC,aAAa;AAIhB,MAAM,sBAAsB;CAC1B;CACA;CACA;CACD;AAED,SAAgB,qBAAqB,SAAiC;AACpE,MAAK,MAAM,UAAU,qBAAqB;EACxC,MAAM,QAAQ,QAAQ,QAAQ,IAAI,OAAO;AACzC,MAAI,SAAS,MAAM,WAAW,EAC5B,QAAO,MAAM,aAAa;;AAG9B,QAAO"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"identify.d.mts","names":[],"sources":["../../src/sdk/identify.ts"],"mappings":";;;cAEa,oBAAA,EAAoB,CAAA,CAAA,qBAAA,EAAA,CAAA,CAAA,SAAA;;;;;;;;;;KAkBrB,cAAA,GAAiB,CAAA,CAAE,KAAA,QAAa,oBAAA;AAAA,cAE/B,oBAAA,EAAoB,CAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;KAerB,cAAA,GAAiB,CAAA,CAAE,KAAA,QAAa,oBAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"identify.mjs","names":[],"sources":["../../src/sdk/identify.ts"],"sourcesContent":["import { z } from \"zod\";\n\nexport const identifySourceSchema = z\n .discriminatedUnion(\"type\", [\n z\n .object({ type: z.literal(\"clerk\"), name: z.literal(\"Clerk\") })\n .meta({ id: \"ClerkIdentifySource\", title: \"ClerkIdentifySource\" }),\n z\n .object({ type: z.literal(\"auth0\"), name: z.literal(\"Auth0\") })\n .meta({ id: \"Auth0IdentifySource\", title: \"Auth0IdentifySource\" }),\n z\n .object({ type: z.literal(\"custom\"), name: z.string() })\n .meta({ id: \"CustomIdentifySource\", title: \"CustomIdentifySource\" }),\n ])\n .meta({\n id: \"IdentifySource\",\n title: \"IdentifySource\",\n description: \"Auth provider that surfaced this identification.\",\n });\n\nexport type IdentifySource = z.infer<typeof identifySourceSchema>;\n\nexport const identifyParamsSchema = z\n .object({\n avatar: z.string().optional(),\n email: z.string().optional(),\n identifier: z.string(),\n name: z.string().optional(),\n source: identifySourceSchema,\n traits: z.record(z.string(), z.unknown()).optional(),\n })\n .meta({\n id: \"IdentifyParams\",\n title: \"IdentifyParams\",\n description: \"User attributes attached when identifying a session.\",\n });\n\nexport type IdentifyParams = z.infer<typeof identifyParamsSchema>;\n"],"mappings":";;AAEA,MAAa,uBAAuB,EACjC,mBAAmB,QAAQ;CAC1B,EACG,OAAO;EAAE,MAAM,EAAE,QAAQ,QAAQ;EAAE,MAAM,EAAE,QAAQ,QAAQ;EAAE,CAAC,CAC9D,KAAK;EAAE,IAAI;EAAuB,OAAO;EAAuB,CAAC;CACpE,EACG,OAAO;EAAE,MAAM,EAAE,QAAQ,QAAQ;EAAE,MAAM,EAAE,QAAQ,QAAQ;EAAE,CAAC,CAC9D,KAAK;EAAE,IAAI;EAAuB,OAAO;EAAuB,CAAC;CACpE,EACG,OAAO;EAAE,MAAM,EAAE,QAAQ,SAAS;EAAE,MAAM,EAAE,QAAQ;EAAE,CAAC,CACvD,KAAK;EAAE,IAAI;EAAwB,OAAO;EAAwB,CAAC;CACvE,CAAC,CACD,KAAK;CACJ,IAAI;CACJ,OAAO;CACP,aAAa;CACd,CAAC;AAIJ,MAAa,uBAAuB,EACjC,OAAO;CACN,QAAQ,EAAE,QAAQ,CAAC,UAAU;CAC7B,OAAO,EAAE,QAAQ,CAAC,UAAU;CAC5B,YAAY,EAAE,QAAQ;CACtB,MAAM,EAAE,QAAQ,CAAC,UAAU;CAC3B,QAAQ;CACR,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,SAAS,CAAC,CAAC,UAAU;CACrD,CAAC,CACD,KAAK;CACJ,IAAI;CACJ,OAAO;CACP,aAAa;CACd,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"browser.d.mts","names":[],"sources":["../../../../src/sdk/plugins/context/browser.ts"],"mappings":";;;cAuCa,oBAAA,EAAoB,CAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;;;;;;;KAerB,cAAA,GAAiB,CAAA,CAAE,KAAA,QAAa,oBAAA;AAAA,cAgBtC,qBAAA,EAAqB,CAAA,CAAA,SAAA;;;;;;;;;;;KAYf,eAAA,GAAkB,CAAA,CAAE,KAAA,QAAa,qBAAA;AAAA,cAEhC,oBAAA,EAAoB,CAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAYrB,cAAA,GAAiB,CAAA,CAAE,KAAA,QAAa,oBAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"browser.mjs","names":[],"sources":["../../../../src/sdk/plugins/context/browser.ts"],"sourcesContent":["import { z } from \"zod\";\n\nconst deviceBrowserSchema = z\n .object({\n major: z.string().optional(),\n name: z.string().optional(),\n type: z.string().optional(),\n version: z.string().optional(),\n })\n .meta({ id: \"DeviceBrowser\", title: \"DeviceBrowser\" });\n\nconst deviceCpuSchema = z\n .object({\n architecture: z.string().optional(),\n })\n .meta({ id: \"DeviceCpu\", title: \"DeviceCpu\" });\n\nconst deviceInfoSchema = z\n .object({\n model: z.string().optional(),\n type: z.string().optional(),\n vendor: z.string().optional(),\n })\n .meta({ id: \"DeviceInfo\", title: \"DeviceInfo\" });\n\nconst deviceEngineSchema = z\n .object({\n name: z.string().optional(),\n version: z.string().optional(),\n })\n .meta({ id: \"DeviceEngine\", title: \"DeviceEngine\" });\n\nconst deviceOsSchema = z\n .object({\n name: z.string().optional(),\n version: z.string().optional(),\n })\n .meta({ id: \"DeviceOs\", title: \"DeviceOs\" });\n\nexport const deviceMetadataSchema = z\n .object({\n browser: deviceBrowserSchema,\n cpu: deviceCpuSchema,\n device: deviceInfoSchema,\n engine: deviceEngineSchema,\n os: deviceOsSchema,\n ua: z.string(),\n })\n .meta({\n id: \"DeviceMetadata\",\n title: \"DeviceMetadata\",\n description: \"Device/browser metadata extracted from the user agent.\",\n });\n\nexport type DeviceMetadata = z.infer<typeof deviceMetadataSchema>;\n\nconst displayScreenSchema = z\n .object({\n height: z.number(),\n width: z.number(),\n orientation: z.string().optional(),\n })\n .meta({ id: \"Screen\", title: \"Screen\" });\n\nconst displaySchema = z\n .object({\n screen: displayScreenSchema,\n })\n .meta({ id: \"Display\", title: \"Display\" });\n\nconst browserMetadataSchema = z\n .object({\n language: z.string().optional(),\n timezone: z.string().optional(),\n display: displaySchema,\n })\n .meta({\n id: \"BrowserMetadata\",\n title: \"BrowserMetadata\",\n description: \"Browser locale and display metadata.\",\n });\n\nexport type BrowserMetadata = z.infer<typeof browserMetadataSchema>;\n\nexport const browserContextSchema = z\n .object({\n runtime: z.literal(\"browser\"),\n browser: browserMetadataSchema.nullable(),\n device: deviceMetadataSchema.nullable(),\n })\n .meta({\n id: \"BrowserContext\",\n title: \"BrowserContext\",\n description: \"Request context for the browser runtime.\",\n });\n\nexport type BrowserContext = z.infer<typeof browserContextSchema>;\n"],"mappings":";;AAEA,MAAM,sBAAsB,EACzB,OAAO;CACN,OAAO,EAAE,QAAQ,CAAC,UAAU;CAC5B,MAAM,EAAE,QAAQ,CAAC,UAAU;CAC3B,MAAM,EAAE,QAAQ,CAAC,UAAU;CAC3B,SAAS,EAAE,QAAQ,CAAC,UAAU;CAC/B,CAAC,CACD,KAAK;CAAE,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,CAAC,UAAU;CAC/B,UAAU,EAAE,QAAQ,CAAC,UAAU;CAC/B,SAAS;CACV,CAAC,CACD,KAAK;CACJ,IAAI;CACJ,OAAO;CACP,aAAa;CACd,CAAC;AAIJ,MAAa,uBAAuB,EACjC,OAAO;CACN,SAAS,EAAE,QAAQ,UAAU;CAC7B,SAAS,sBAAsB,UAAU;CACzC,QAAQ,qBAAqB,UAAU;CACxC,CAAC,CACD,KAAK;CACJ,IAAI;CACJ,OAAO;CACP,aAAa;CACd,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"edge.d.mts","names":[],"sources":["../../../../src/sdk/plugins/context/edge.ts"],"mappings":";;;cAEa,iBAAA,EAAiB,CAAA,CAAA,SAAA;;;KAUlB,WAAA,GAAc,CAAA,CAAE,KAAA,QAAa,iBAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"edge.mjs","names":[],"sources":["../../../../src/sdk/plugins/context/edge.ts"],"sourcesContent":["import { z } from \"zod\";\n\nexport const edgeContextSchema = z\n .object({\n runtime: z.literal(\"edge\"),\n })\n .meta({\n id: \"EdgeContext\",\n title: \"EdgeContext\",\n description: \"Request context for the Edge runtime.\",\n });\n\nexport type EdgeContext = z.infer<typeof edgeContextSchema>;\n"],"mappings":";;AAEA,MAAa,oBAAoB,EAC9B,OAAO,EACN,SAAS,EAAE,QAAQ,OAAO,EAC3B,CAAC,CACD,KAAK;CACJ,IAAI;CACJ,OAAO;CACP,aAAa;CACd,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"next.d.mts","names":[],"sources":["../../../../src/sdk/plugins/context/next.ts"],"mappings":";;;cAEa,kBAAA,EAAkB,CAAA,CAAA,OAAA;;;;;cAQlB,gBAAA,EAAgB,CAAA,CAAA,OAAA;;;;cAIhB,sBAAA,EAAsB,CAAA,CAAA,OAAA;;;;cAItB,eAAA,EAAe,CAAA,CAAA,OAAA;;;;;;;cAIf,gBAAA,EAAgB,CAAA,CAAA,OAAA;;;;cAIhB,mBAAA,EAAmB,CAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAmBpB,aAAA,GAAgB,CAAA,CAAE,KAAA,QAAa,mBAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"next.mjs","names":[],"sources":["../../../../src/sdk/plugins/context/next.ts"],"sourcesContent":["import { z } from \"zod\";\n\nexport const renderSourceSchema = z\n .enum([\n \"react-server-components\",\n \"react-server-components-payload\",\n \"server-rendering\",\n ])\n .meta({ id: \"RenderSource\", title: \"RenderSource\" });\n\nexport const renderTypeSchema = z\n .enum([\"dynamic\", \"dynamic-resume\"])\n .meta({ id: \"RenderType\", title: \"RenderType\" });\n\nexport const revalidateReasonSchema = z\n .enum([\"on-demand\", \"stale\"])\n .meta({ id: \"RevalidateReason\", title: \"RevalidateReason\" });\n\nexport const routeTypeSchema = z\n .enum([\"render\", \"route\", \"action\", \"middleware\", \"proxy\"])\n .meta({ id: \"RouteType\", title: \"RouteType\" });\n\nexport const routerKindSchema = z\n .enum([\"Pages Router\", \"App Router\"])\n .meta({ id: \"RouterKind\", title: \"RouterKind\" });\n\nexport const nextjsContextSchema = z\n .object({\n errorDigest: z.string().optional(),\n renderSource: renderSourceSchema.optional(),\n renderType: renderTypeSchema.optional(),\n requestMethod: z.string().optional(),\n requestPath: z.string().optional(),\n revalidateReason: revalidateReasonSchema.optional(),\n routePath: z.string().optional(),\n routeType: routeTypeSchema.optional(),\n routerKind: routerKindSchema.optional(),\n runtime: z.literal(\"nextjs\"),\n })\n .meta({\n id: \"NextjsContext\",\n title: \"NextjsContext\",\n description: \"Request context for the Next.js runtime.\",\n });\n\nexport type NextjsContext = z.infer<typeof nextjsContextSchema>;\n"],"mappings":";;AAEA,MAAa,qBAAqB,EAC/B,KAAK;CACJ;CACA;CACA;CACD,CAAC,CACD,KAAK;CAAE,IAAI;CAAgB,OAAO;CAAgB,CAAC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B,kBAAA;AAAA,KAC1B,SAAA,GAAY,cAAA;AAAA,KACZ,gBAAA,GAAmB,OAAA,CAAQ,eAAA;AAAA,KAC3B,YAAA,GAAe,UAAA,CAAW,MAAA,CAAO,gBAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"manifest.mjs","names":[],"sources":["../../../src/sdk/plugins/manifest.ts"],"sourcesContent":["export const CONSENT_CATEGORIES = [\"necessary\", \"analytics\", \"replay\"] as const;\n\ntype AtLeastOne<T> = {\n [K in keyof T]-?: Required<Pick<T, K>> & Partial<T>;\n}[keyof T];\n\nexport const PLUGIN_MANIFEST = [\n {\n consentCategory: \"necessary\",\n defaultEnabled: true,\n events: [{ enrich: true, name: \"error\" }],\n name: \"errors\",\n },\n {\n consentCategory: \"analytics\",\n defaultEnabled: true,\n events: [],\n name: \"device\",\n },\n {\n consentCategory: \"analytics\",\n defaultEnabled: true,\n events: [\n { enrich: true, name: \"pageview\" },\n { enrich: true, name: \"pageleave\" },\n { enrich: true, name: \"ui_event\" },\n ],\n name: \"pageEvents\",\n },\n {\n consentCategory: \"analytics\",\n defaultEnabled: true,\n events: [{ enrich: true, name: \"rage_click\" }],\n name: \"rageClick\",\n },\n {\n consentCategory: \"replay\",\n defaultEnabled: true,\n events: [{ enrich: false, name: \"replay_chunk\" }],\n name: \"replay\",\n },\n] as const;\n\nexport type PluginManifest = typeof PLUGIN_MANIFEST;\n\nexport type ConsentCategory = (typeof CONSENT_CATEGORIES)[number];\nexport type PluginKey = PluginManifest[number][\"name\"];\nexport type GateableCategory = Exclude<ConsentCategory, \"necessary\">;\nexport type ConsentState = AtLeastOne<Record<GateableCategory, boolean>>;\n"],"mappings":";AAAA,MAAa,qBAAqB;CAAC;CAAa;CAAa;CAAS;AAMtE,MAAa,kBAAkB;CAC7B;EACE,iBAAiB;EACjB,gBAAgB;EAChB,QAAQ,CAAC;GAAE,QAAQ;GAAM,MAAM;GAAS,CAAC;EACzC,MAAM;EACP;CACD;EACE,iBAAiB;EACjB,gBAAgB;EAChB,QAAQ,EAAE;EACV,MAAM;EACP;CACD;EACE,iBAAiB;EACjB,gBAAgB;EAChB,QAAQ;GACN;IAAE,QAAQ;IAAM,MAAM;IAAY;GAClC;IAAE,QAAQ;IAAM,MAAM;IAAa;GACnC;IAAE,QAAQ;IAAM,MAAM;IAAY;GACnC;EACD,MAAM;EACP;CACD;EACE,iBAAiB;EACjB,gBAAgB;EAChB,QAAQ,CAAC;GAAE,QAAQ;GAAM,MAAM;GAAc,CAAC;EAC9C,MAAM;EACP;CACD;EACE,iBAAiB;EACjB,gBAAgB;EAChB,QAAQ,CAAC;GAAE,QAAQ;GAAO,MAAM;GAAgB,CAAC;EACjD,MAAM;EACP;CACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.mts","names":[],"sources":["../../../../src/sdk/plugins/payload/errors.ts"],"mappings":";;;cAIa,iBAAA,EAAiB,CAAA,CAAA,OAAA;;;;;KAIlB,WAAA,GAAc,CAAA,CAAE,KAAA,QAAa,iBAAA;AAAA,cAE5B,oBAAA,EAAoB,CAAA,CAAA,SAAA;;;;;KAYrB,cAAA,GAAiB,CAAA,CAAE,KAAA,QAAa,oBAAA;AAAA,cAE/B,oBAAA,EAAoB,CAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;KAarB,cAAA,GAAiB,CAAA,CAAE,KAAA,QAAa,oBAAA;AAAA,cAE/B,0BAAA,EAA0B,CAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;KAU3B,oBAAA,GAAuB,CAAA,CAAE,KAAA,QAAa,0BAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.mjs","names":[],"sources":["../../../../src/sdk/plugins/payload/errors.ts"],"sourcesContent":["import { z } from \"zod\";\n\nimport { ingestedFrame } from \"#data/frame\";\n\nexport const errorSourceSchema = z\n .enum([\"client\", \"server\", \"edge\"])\n .meta({ id: \"ErrorSource\", title: \"ErrorSource\" });\n\nexport type ErrorSource = z.infer<typeof errorSourceSchema>;\n\nexport const errorMechanismSchema = z\n .object({\n type: z.string(),\n handled: z.boolean(),\n synthetic: z.boolean().optional(),\n })\n .meta({\n id: \"ErrorMechanism\",\n title: \"ErrorMechanism\",\n description: \"How the exception was captured by the SDK.\",\n });\n\nexport type ErrorMechanism = z.infer<typeof errorMechanismSchema>;\n\nexport const exceptionValueSchema = z\n .object({\n type: z.string(),\n value: z.string(),\n mechanism: errorMechanismSchema.optional(),\n frames: z.array(ingestedFrame),\n })\n .meta({\n id: \"Exception\",\n title: \"Exception\",\n description: \"A single exception in a chained error.\",\n });\n\nexport type ExceptionValue = z.infer<typeof exceptionValueSchema>;\n\nexport const errorEnvelopePayloadSchema = z\n .object({\n exceptions: z.array(exceptionValueSchema).min(1),\n })\n .meta({\n id: \"ErrorPayload\",\n title: \"ErrorPayload\",\n description: \"Payload for an error envelope.\",\n });\n\nexport type ErrorEnvelopePayload = z.infer<typeof errorEnvelopePayloadSchema>;\n"],"mappings":";;;AAIA,MAAa,oBAAoB,EAC9B,KAAK;CAAC;CAAU;CAAU;CAAO,CAAC,CAClC,KAAK;CAAE,IAAI;CAAe,OAAO;CAAe,CAAC;AAIpD,MAAa,uBAAuB,EACjC,OAAO;CACN,MAAM,EAAE,QAAQ;CAChB,SAAS,EAAE,SAAS;CACpB,WAAW,EAAE,SAAS,CAAC,UAAU;CAClC,CAAC,CACD,KAAK;CACJ,IAAI;CACJ,OAAO;CACP,aAAa;CACd,CAAC;AAIJ,MAAa,uBAAuB,EACjC,OAAO;CACN,MAAM,EAAE,QAAQ;CAChB,OAAO,EAAE,QAAQ;CACjB,WAAW,qBAAqB,UAAU;CAC1C,QAAQ,EAAE,MAAM,cAAc;CAC/B,CAAC,CACD,KAAK;CACJ,IAAI;CACJ,OAAO;CACP,aAAa;CACd,CAAC;AAIJ,MAAa,6BAA6B,EACvC,OAAO,EACN,YAAY,EAAE,MAAM,qBAAqB,CAAC,IAAI,EAAE,EACjD,CAAC,CACD,KAAK;CACJ,IAAI;CACJ,OAAO;CACP,aAAa;CACd,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"page-events.d.mts","names":[],"sources":["../../../../src/sdk/plugins/payload/page-events.ts"],"mappings":";;;cAEa,oBAAA,EAAoB,CAAA,CAAA,SAAA;;;KAUrB,cAAA,GAAiB,CAAA,CAAE,KAAA,QAAa,oBAAA;AAAA,cAE/B,qBAAA,EAAqB,CAAA,CAAA,SAAA;;;;KAWtB,eAAA,GAAkB,CAAA,CAAE,KAAA,QAAa,qBAAA;AAAA,cAEhC,sBAAA,EAAsB,CAAA,CAAA,SAAA;;;;KAWvB,gBAAA,GAAmB,CAAA,CAAE,KAAA,QAAa,sBAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"page-events.mjs","names":[],"sources":["../../../../src/sdk/plugins/payload/page-events.ts"],"sourcesContent":["import { z } from \"zod\";\n\nexport const uiEventPayloadSchema = z\n .object({\n event: z.record(z.string(), z.unknown()),\n })\n .meta({\n id: \"UiEventPayload\",\n title: \"UiEventPayload\",\n description: \"Payload for a UI event envelope.\",\n });\n\nexport type UiEventPayload = z.infer<typeof uiEventPayloadSchema>;\n\nexport const pageviewPayloadSchema = z\n .object({\n url: z.string(),\n title: z.string().optional(),\n })\n .meta({\n id: \"PageviewPayload\",\n title: \"PageviewPayload\",\n description: \"Payload for a pageview envelope.\",\n });\n\nexport type PageviewPayload = z.infer<typeof pageviewPayloadSchema>;\n\nexport const pageleavePayloadSchema = z\n .object({\n url: z.string(),\n durationMs: z.number().optional(),\n })\n .meta({\n id: \"PageleavePayload\",\n title: \"PageleavePayload\",\n description: \"Payload for a pageleave envelope.\",\n });\n\nexport type PageleavePayload = z.infer<typeof pageleavePayloadSchema>;\n"],"mappings":";;AAEA,MAAa,uBAAuB,EACjC,OAAO,EACN,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,SAAS,CAAC,EACzC,CAAC,CACD,KAAK;CACJ,IAAI;CACJ,OAAO;CACP,aAAa;CACd,CAAC;AAIJ,MAAa,wBAAwB,EAClC,OAAO;CACN,KAAK,EAAE,QAAQ;CACf,OAAO,EAAE,QAAQ,CAAC,UAAU;CAC7B,CAAC,CACD,KAAK;CACJ,IAAI;CACJ,OAAO;CACP,aAAa;CACd,CAAC;AAIJ,MAAa,yBAAyB,EACnC,OAAO;CACN,KAAK,EAAE,QAAQ;CACf,YAAY,EAAE,QAAQ,CAAC,UAAU;CAClC,CAAC,CACD,KAAK;CACJ,IAAI;CACJ,OAAO;CACP,aAAa;CACd,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rage-click.d.mts","names":[],"sources":["../../../../src/sdk/plugins/payload/rage-click.ts"],"mappings":";;;cAEa,sBAAA,EAAsB,CAAA,CAAA,SAAA;;;;;;;;;KAgBvB,gBAAA,GAAmB,CAAA,CAAE,KAAA,QAAa,sBAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rage-click.mjs","names":[],"sources":["../../../../src/sdk/plugins/payload/rage-click.ts"],"sourcesContent":["import { z } from \"zod\";\n\nexport const rageClickPayloadSchema = z\n .object({\n count: z.number(),\n timeWindow: z.number(),\n selector: z.string(),\n text: z.string(),\n x: z.number(),\n y: z.number(),\n timestamp: z.number(),\n })\n .meta({\n id: \"RageClickPayload\",\n title: \"RageClickPayload\",\n description: \"Payload for a rage-click envelope.\",\n });\n\nexport type RageClickPayload = z.infer<typeof rageClickPayloadSchema>;\n"],"mappings":";;AAEA,MAAa,yBAAyB,EACnC,OAAO;CACN,OAAO,EAAE,QAAQ;CACjB,YAAY,EAAE,QAAQ;CACtB,UAAU,EAAE,QAAQ;CACpB,MAAM,EAAE,QAAQ;CAChB,GAAG,EAAE,QAAQ;CACb,GAAG,EAAE,QAAQ;CACb,WAAW,EAAE,QAAQ;CACtB,CAAC,CACD,KAAK;CACJ,IAAI;CACJ,OAAO;CACP,aAAa;CACd,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"replay.d.mts","names":[],"sources":["../../../../src/sdk/plugins/payload/replay.ts"],"mappings":";;;cAEa,wBAAA,EAAwB,CAAA,CAAA,SAAA;;;;;;;KAgBzB,kBAAA,GAAqB,CAAA,CAAE,KAAA,QAAa,wBAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"replay.mjs","names":[],"sources":["../../../../src/sdk/plugins/payload/replay.ts"],"sourcesContent":["import { z } from \"zod\";\n\nexport const replayChunkPayloadSchema = z\n .object({\n ts: z.number(),\n count: z.number(),\n events: z.array(z.string()),\n /** First rrweb event timestamp (ms) in this chunk – actual recording start */\n first_event_ts: z.number().optional(),\n /** Last rrweb event timestamp (ms) in this chunk – actual recording end */\n last_event_ts: z.number().optional(),\n })\n .meta({\n id: \"ReplayChunkPayload\",\n title: \"ReplayChunkPayload\",\n description: \"Payload for a replay-chunk envelope.\",\n });\n\nexport type ReplayChunkPayload = z.infer<typeof replayChunkPayloadSchema>;\n"],"mappings":";;AAEA,MAAa,2BAA2B,EACrC,OAAO;CACN,IAAI,EAAE,QAAQ;CACd,OAAO,EAAE,QAAQ;CACjB,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC;;CAE3B,gBAAgB,EAAE,QAAQ,CAAC,UAAU;;CAErC,eAAe,EAAE,QAAQ,CAAC,UAAU;CACrC,CAAC,CACD,KAAK;CACJ,IAAI;CACJ,OAAO;CACP,aAAa;CACd,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"remote-config.d.mts","names":[],"sources":["../../src/sdk/remote-config.ts"],"mappings":";;;;KAGY,kBAAA,GAAqB,OAAA,CAAQ,MAAA,CAAO,SAAA;AAAA,UAE/B,YAAA;EACf,OAAA,EAAS,MAAA,CAAO,SAAA;AAAA;AAAA,cAGL,oBAAA,EAAsB,MAAA,CAAO,SAAA,EAAW,SAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"remote-config.mjs","names":[],"sources":["../../src/sdk/remote-config.ts"],"sourcesContent":["import type { EventType } from \"./envelope.js\";\nimport { PLUGIN_MANIFEST, type PluginKey } from \"./plugins/manifest.js\";\n\nexport type RemotePluginConfig = Partial<Record<PluginKey, boolean>>;\n\nexport interface RemoteConfig {\n plugins: Record<PluginKey, boolean>;\n}\n\nexport const EVENT_TYPE_TO_PLUGIN: Record<EventType, PluginKey> =\n Object.fromEntries(\n PLUGIN_MANIFEST.flatMap((plugin) =>\n plugin.events.map((event) => [event.name, plugin.name])\n )\n ) as Record<EventType, PluginKey>;\n"],"mappings":";;AASA,MAAa,uBACX,OAAO,YACL,gBAAgB,SAAS,WACvB,OAAO,OAAO,KAAK,UAAU,CAAC,MAAM,MAAM,OAAO,KAAK,CAAC,CACxD,CACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.mts","names":[],"sources":["../../src/sdk/runtime.ts"],"mappings":";;;cAEa,SAAA,EAAS,CAAA,CAAA,WAAA,CAAA,CAAA,CAAA,OAAA;;;;;KASV,GAAA,GAAM,CAAA,CAAE,KAAA,QAAa,SAAA;AAAA,cAEpB,aAAA,EAAa,CAAA,CAAA,WAAA,CAAA,CAAA,CAAA,OAAA;;;;;KASd,OAAA,GAAU,CAAA,CAAE,KAAA,QAAa,aAAA;AAAA,iBAErB,YAAA,CAAa,OAAA;EAAA,SAClB,WAAA;AAAA,IACP,OAAA;AAAA,iBAiCY,YAAA,CAAa,KAAA,YAAiB,GAAA"}
|
package/dist/sdk/runtime.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.mjs","names":[],"sources":["../../src/sdk/runtime.ts"],"sourcesContent":["import { z } from \"zod\";\n\nexport const envSchema = z\n .enum([\"development\", \"preview\", \"production\"])\n .nullable()\n .meta({\n id: \"Environment\",\n title: \"Environment\",\n description: \"Deployment environment the SDK is running in.\",\n });\n\nexport type Env = z.infer<typeof envSchema>;\n\nexport const runtimeSchema = z\n .enum([\"browser\", \"node\", \"edge\"])\n .nullable()\n .meta({\n id: \"Runtime\",\n title: \"Runtime\",\n description: \"JavaScript runtime the SDK is running in.\",\n });\n\nexport type Runtime = z.infer<typeof runtimeSchema>;\n\nexport function inferRuntime(options?: {\n readonly nextRuntime?: unknown;\n}): Runtime {\n // Browser\n if (\n typeof window !== \"undefined\" &&\n typeof document !== \"undefined\" &&\n typeof navigator !== \"undefined\"\n ) {\n return \"browser\";\n }\n\n // Edge (Vercel sets globalThis.EdgeRuntime = \"edge-runtime\")\n if (\n typeof (globalThis as { EdgeRuntime?: unknown }).EdgeRuntime === \"string\"\n ) {\n return \"edge\";\n }\n\n // Next.js Edge (explicit signal)\n if (options?.nextRuntime === \"edge\") {\n return \"edge\";\n }\n\n // Node\n if (\n typeof process !== \"undefined\" &&\n typeof process.versions?.node === \"string\"\n ) {\n return \"node\";\n }\n\n return null;\n}\n\nexport function normalizeEnv(value: unknown): Env {\n if (typeof value !== \"string\") {\n return null;\n }\n\n const env = value.toLowerCase();\n\n if (envSchema.safeParse(env).success) {\n return env as Env;\n }\n\n return null;\n}\n"],"mappings":";;AAEA,MAAa,YAAY,EACtB,KAAK;CAAC;CAAe;CAAW;CAAa,CAAC,CAC9C,UAAU,CACV,KAAK;CACJ,IAAI;CACJ,OAAO;CACP,aAAa;CACd,CAAC;AAIJ,MAAa,gBAAgB,EAC1B,KAAK;CAAC;CAAW;CAAQ;CAAO,CAAC,CACjC,UAAU,CACV,KAAK;CACJ,IAAI;CACJ,OAAO;CACP,aAAa;CACd,CAAC;AAIJ,SAAgB,aAAa,SAEjB;AAEV,KACE,OAAO,WAAW,eAClB,OAAO,aAAa,eACpB,OAAO,cAAc,YAErB,QAAO;AAIT,KACE,OAAQ,WAAyC,gBAAgB,SAEjE,QAAO;AAIT,KAAI,SAAS,gBAAgB,OAC3B,QAAO;AAIT,KACE,OAAO,YAAY,eACnB,OAAO,QAAQ,UAAU,SAAS,SAElC,QAAO;AAGT,QAAO;;AAGT,SAAgB,aAAa,OAAqB;AAChD,KAAI,OAAO,UAAU,SACnB,QAAO;CAGT,MAAM,MAAM,MAAM,aAAa;AAE/B,KAAI,UAAU,UAAU,IAAI,CAAC,QAC3B,QAAO;AAGT,QAAO"}
|