@interfere/types 8.1.6 → 9.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/README.md +3 -3
  2. package/dist/data/frame.d.mts +16 -4
  3. package/dist/data/frame.d.mts.map +1 -1
  4. package/dist/data/frame.mjs +1 -16
  5. package/dist/data/frame.mjs.map +1 -1
  6. package/dist/data/session.d.mts +1 -1
  7. package/dist/data/session.d.mts.map +1 -1
  8. package/dist/data/session.mjs +1 -9
  9. package/dist/data/session.mjs.map +1 -1
  10. package/dist/data/source-maps.d.mts +133 -27
  11. package/dist/data/source-maps.d.mts.map +1 -1
  12. package/dist/data/source-maps.mjs +1 -21
  13. package/dist/data/source-maps.mjs.map +1 -1
  14. package/dist/events/error.d.mts +139 -35
  15. package/dist/events/error.d.mts.map +1 -1
  16. package/dist/events/error.mjs +1 -64
  17. package/dist/events/error.mjs.map +1 -1
  18. package/dist/events/pageleave.d.mts +1 -1
  19. package/dist/events/pageleave.mjs +1 -10
  20. package/dist/events/pageleave.mjs.map +1 -1
  21. package/dist/events/pageview.d.mts +1 -1
  22. package/dist/events/pageview.d.mts.map +1 -1
  23. package/dist/events/pageview.mjs +1 -11
  24. package/dist/events/pageview.mjs.map +1 -1
  25. package/dist/integrations/index.mjs +1 -57
  26. package/dist/integrations/index.mjs.map +1 -1
  27. package/dist/integrations/platforms/github.mjs +1 -13
  28. package/dist/integrations/platforms/github.mjs.map +1 -1
  29. package/dist/integrations/platforms/slack.d.mts +32 -0
  30. package/dist/integrations/platforms/slack.d.mts.map +1 -0
  31. package/dist/integrations/platforms/slack.mjs +1 -0
  32. package/dist/integrations/platforms/slack.mjs.map +1 -0
  33. package/dist/integrations/platforms/vercel.mjs +1 -26
  34. package/dist/integrations/platforms/vercel.mjs.map +1 -1
  35. package/dist/releases/definition.d.mts +2 -1
  36. package/dist/releases/definition.d.mts.map +1 -1
  37. package/dist/releases/definition.mjs +1 -63
  38. package/dist/releases/definition.mjs.map +1 -1
  39. package/dist/releases/slug.d.mts +22 -0
  40. package/dist/releases/slug.d.mts.map +1 -0
  41. package/dist/releases/slug.mjs +1 -0
  42. package/dist/releases/slug.mjs.map +1 -0
  43. package/dist/sdk/env.mjs +1 -17
  44. package/dist/sdk/env.mjs.map +1 -1
  45. package/dist/sdk/envelope.d.mts +161 -34
  46. package/dist/sdk/envelope.d.mts.map +1 -1
  47. package/dist/sdk/envelope.mjs +1 -114
  48. package/dist/sdk/envelope.mjs.map +1 -1
  49. package/dist/sdk/errors.d.mts +87 -30
  50. package/dist/sdk/errors.d.mts.map +1 -1
  51. package/dist/sdk/errors.mjs +2 -253
  52. package/dist/sdk/errors.mjs.map +1 -1
  53. package/dist/sdk/geo.mjs +1 -17
  54. package/dist/sdk/geo.mjs.map +1 -1
  55. package/dist/sdk/identify.d.mts +1 -1
  56. package/dist/sdk/identify.d.mts.map +1 -1
  57. package/dist/sdk/identify.mjs +1 -43
  58. package/dist/sdk/identify.mjs.map +1 -1
  59. package/dist/sdk/plugins/context/browser.d.mts +8 -0
  60. package/dist/sdk/plugins/context/browser.d.mts.map +1 -1
  61. package/dist/sdk/plugins/context/browser.mjs +1 -81
  62. package/dist/sdk/plugins/context/browser.mjs.map +1 -1
  63. package/dist/sdk/plugins/context/edge.mjs +1 -9
  64. package/dist/sdk/plugins/context/edge.mjs.map +1 -1
  65. package/dist/sdk/plugins/context/next.mjs +1 -50
  66. package/dist/sdk/plugins/context/next.mjs.map +1 -1
  67. package/dist/sdk/plugins/context/node.d.mts +12 -0
  68. package/dist/sdk/plugins/context/node.d.mts.map +1 -0
  69. package/dist/sdk/plugins/context/node.mjs +1 -0
  70. package/dist/sdk/plugins/context/node.mjs.map +1 -0
  71. package/dist/sdk/plugins/manifest.d.mts +5 -0
  72. package/dist/sdk/plugins/manifest.d.mts.map +1 -1
  73. package/dist/sdk/plugins/manifest.mjs +1 -62
  74. package/dist/sdk/plugins/manifest.mjs.map +1 -1
  75. package/dist/sdk/plugins/payload/errors.d.mts +27 -18
  76. package/dist/sdk/plugins/payload/errors.d.mts.map +1 -1
  77. package/dist/sdk/plugins/payload/errors.mjs +1 -37
  78. package/dist/sdk/plugins/payload/errors.mjs.map +1 -1
  79. package/dist/sdk/plugins/payload/page-events.d.mts +2 -2
  80. package/dist/sdk/plugins/payload/page-events.mjs +1 -25
  81. package/dist/sdk/plugins/payload/page-events.mjs.map +1 -1
  82. package/dist/sdk/plugins/payload/rage-click.mjs +1 -17
  83. package/dist/sdk/plugins/payload/rage-click.mjs.map +1 -1
  84. package/dist/sdk/plugins/payload/replay.mjs +1 -17
  85. package/dist/sdk/plugins/payload/replay.mjs.map +1 -1
  86. package/dist/sdk/remote-config.d.mts +31 -4
  87. package/dist/sdk/remote-config.d.mts.map +1 -1
  88. package/dist/sdk/remote-config.mjs +1 -5
  89. package/dist/sdk/remote-config.mjs.map +1 -1
  90. package/dist/sdk/runtime.mjs +1 -35
  91. package/dist/sdk/runtime.mjs.map +1 -1
  92. package/package.json +12 -18
@@ -1 +1 @@
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;C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EAChD"}
1
+ {"version":3,"file":"errors.mjs","names":[],"sources":["../../src/sdk/errors.ts"],"sourcesContent":["import 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 node: {\n captureError: \"auto.function.node.capture_error\",\n uncaughtException: \"auto.node.global_handlers.uncaught_exception\",\n unhandledRejection: \"auto.node.global_handlers.unhandled_rejection\",\n },\n manual: {\n /** Customer called `capture(error)` from `@interfere/react/api`. */\n capture: \"manual.api.capture\",\n },\n} as const;\n\n/**\n * Browser-extension URL schemes seen in stack-frame `fileName` values.\n * Includes Safari's `webkit-masked-url://` (introduced under ITP to mask\n * the origin of content scripts) — same noise-filtering target as the\n * `*-extension://` schemes.\n */\nconst EXTENSION_URL_RE =\n /\\b(?:chrome|moz|safari-web|safari|ms-browser|webkit-masked)-(?:extension|url):\\/\\//;\n\n/**\n * True when the raw stack mentions any browser-extension URL scheme\n * anywhere. Catches extension-only stacks, extension interceptors\n * (extension frames above app), and app errors whose stack still\n * includes extension code (e.g. extension hydration). Cause-chain\n * variants are caught by passing the chain entries' stacks to this\n * check separately.\n *\n * Server-side parsing has full structured fidelity, but the noise\n * filter runs at capture time before a parsed stack exists — regex\n * over the raw string is sufficient and avoids pulling a parser into\n * the customer bundle.\n */\nexport function shouldDropBrowserExtensionNoise(\n stacks: readonly string[]\n): boolean {\n return stacks.some((stack) => EXTENSION_URL_RE.test(stack));\n}\n\n/**\n * Anchors that prove a stack frame has a real source location: a URL\n * scheme (`https://`, `webpack-internal://`, etc.) or a V8-style\n * `at fn (path:LINE)` parenthesised location. Stacks whose every frame\n * lacks both anchors come from inline `<script>` blocks\n * (`at <anonymous>:N:M`), `eval()` / `new Function()`, CORS-masked\n * cross-origin scripts (`\"Script error.\"`), or browser-internal code —\n * structurally uninvestigatable, so we drop at capture time.\n */\nconst HAS_SOURCE_LOCATION_RE =\n /(?:https?|file|blob|webpack-internal):\\/\\/|\\sat\\s+[\\w$.<>]+\\s+\\([^)]+:\\d/;\n\n/**\n * True when **none** of the supplied stacks (head + cause chain entries)\n * carries any source-location anchor. Non-Error rejections (no stack at\n * all) are exempt at the call site — they ship structured payloads the\n * agent can reason over without frames.\n */\nexport function shouldDropUnresolvableStack(\n stacks: readonly string[]\n): boolean {\n if (stacks.length === 0) {\n return false;\n }\n for (const stack of stacks) {\n if (HAS_SOURCE_LOCATION_RE.test(stack)) {\n return false;\n }\n }\n return true;\n}\n\nconst MAX_CAUSE_DEPTH = 5;\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 * Server-side stack parsing handles JS frames; component-stack frames are\n * supplementary context React emits separately and have a different shape,\n * so they're parsed at capture time and shipped via `appendFrames`.\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 */\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 = {\n id: `react-${frames.length}`,\n fn: name,\n };\n if (fileName) {\n frame.file = fileName;\n }\n if (lineStr) {\n frame.line = Number(lineStr);\n }\n if (colStr) {\n frame.column = 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 nested = tryUnwrapNestedError(error as Record<string, unknown>);\n if (nested) {\n return nested;\n }\n\n // No nested Error — preserve the original shape as a JSON-encoded\n // message under a tagged name so downstream readers can tell this\n // came from `Promise.reject({ ... })` rather than a real `Error`\n // instance. Stringification ignores cycles by falling back to the\n // value's `String(...)` representation. Prefer `toException` for\n // new code — it preserves the structured payload as a separate\n // field instead of cramming JSON into the message.\n return tagAsNonError(safeJson(error) ?? String(error));\n }\n\n return tagAsNonError(String(error));\n}\n\nfunction tryUnwrapNestedError(\n record: Record<string, unknown>\n): Error | undefined {\n if (record[\"cause\"] instanceof Error) {\n return record[\"cause\"];\n }\n for (const value of Object.values(record)) {\n if (value instanceof Error) {\n return value;\n }\n }\n return;\n}\n\nfunction tagAsNonError(message: string): Error {\n const e = new Error(message);\n e.name = \"NonError\";\n return e;\n}\n\nfunction safeJson(value: unknown): string | null {\n try {\n return JSON.stringify(value);\n } catch {\n return null;\n }\n}\n\n/**\n * Capture-side variant for thrown values that aren't Errors and don't\n * carry a nested Error (e.g. `Promise.reject({ code: 401, body: \"...\" })`,\n * `Promise.reject(42)`). The structured payload rides on `serialized`\n * so downstream consumers can render the original shape instead of\n * parsing JSON back out of an Error's message string.\n *\n * Strings are *not* represented here — `Promise.reject(\"boom\")` maps\n * cleanly to `new Error(\"boom\")` without lying about the shape, so it\n * goes through `toException`'s Error branch.\n */\nexport interface NonErrorException {\n readonly kind: \"non-error\";\n /**\n * Original payload, depth-bounded and circular-safe. Anything beyond\n * `MAX_NON_ERROR_DEPTH` is collapsed to `\"[depth-limit]\"`; circular\n * back-edges become `\"[circular]\"`. Primitives pass through unchanged.\n */\n readonly serialized: unknown;\n /**\n * Stable label for grouping. `\"PlainObject\"` / `\"Array\"` / `\"number\"`\n * etc. — derived from the value's structural class, not its content,\n * so two `Promise.reject({ code: 401 })` calls land in the same group\n * regardless of which keys the object carries.\n */\n readonly type: string;\n /**\n * Best-effort one-liner. For objects: a sorted list of keys. For\n * primitives: `String(value)`. The dashboard shows this; the\n * `serialized` field carries the actual payload.\n */\n readonly value: string;\n}\n\n/**\n * Maximum depth `serializeBoundedDepth` recurses into nested objects /\n * arrays before collapsing the rest to `\"[depth-limit]\"`. 4 covers\n * typical fetch-error shapes (`{ response: { headers: { ... } } }`)\n * without giving an attacker a way to exhaust memory by sending us a\n * deeply nested payload.\n */\nconst MAX_NON_ERROR_DEPTH = 4;\n\nconst DEPTH_LIMIT_SENTINEL = \"[depth-limit]\";\nconst CIRCULAR_SENTINEL = \"[circular]\";\n\n/**\n * Returns a label suitable for grouping. Mirrors `Object.prototype.toString`'s\n * `[object X]` tag for objects (so plain objects, arrays, dates, regexes\n * and custom classes all get distinct stable labels) and falls back to\n * `typeof` for primitives.\n */\nfunction classify(value: unknown): string {\n if (value === null) {\n return \"null\";\n }\n const t = typeof value;\n if (t !== \"object\") {\n return t;\n }\n // `[object Foo]` → `Foo`. Custom classes inherit the default `Object`\n // tag unless they override `Symbol.toStringTag`; that's fine for\n // grouping — we want the structural class, not the constructor name.\n const tag = Object.prototype.toString.call(value).slice(8, -1);\n return tag === \"Object\" ? \"PlainObject\" : tag;\n}\n\n/**\n * Best-effort one-liner description. For objects, lists the sorted keys\n * so two same-shaped rejections render identically regardless of\n * attribute ordering. For primitives, `String(value)`.\n */\nfunction describe(value: unknown): string {\n if (value === null || value === undefined) {\n return `Non-Error captured: ${String(value)}`;\n }\n if (typeof value === \"object\") {\n const keys = Object.keys(value as object).sort();\n if (keys.length === 0) {\n return \"Non-Error captured: empty object\";\n }\n return `Non-Error captured with keys: ${keys.join(\", \")}`;\n }\n return `Non-Error captured: ${String(value)}`;\n}\n\n/**\n * Depth-bounded, circular-safe clone. Primitives + null/undefined pass\n * through as-is. Objects and arrays recurse up to `MAX_NON_ERROR_DEPTH`\n * before collapsing to `DEPTH_LIMIT_SENTINEL`; back-edges become\n * `CIRCULAR_SENTINEL`. Functions, symbols, and other non-serialisable\n * values are coerced via `String(...)` so the dashboard can render\n * something rather than dropping the field.\n */\nfunction serializeBoundedDepth(value: unknown, maxDepth: number): unknown {\n const seen = new WeakSet<object>();\n const walk = (current: unknown, depth: number): unknown => {\n if (current === null) {\n return null;\n }\n const t = typeof current;\n if (t === \"string\" || t === \"number\" || t === \"boolean\") {\n return current;\n }\n if (t === \"undefined\") {\n return;\n }\n if (t === \"function\" || t === \"symbol\" || t === \"bigint\") {\n return String(current);\n }\n if (depth > maxDepth) {\n return DEPTH_LIMIT_SENTINEL;\n }\n if (seen.has(current as object)) {\n return CIRCULAR_SENTINEL;\n }\n seen.add(current as object);\n if (Array.isArray(current)) {\n return current.map((item) => walk(item, depth + 1));\n }\n const out: Record<string, unknown> = {};\n for (const [k, v] of Object.entries(current as Record<string, unknown>)) {\n out[k] = walk(v, depth + 1);\n }\n return out;\n };\n return walk(value, 0);\n}\n\n/**\n * Coerces any thrown value into either an `Error` (when one is\n * recoverable — direct Error, or nested Error inside an object via\n * `cause` / first-Error-valued property — or a string, which maps\n * cleanly to `new Error(str)`) or a structured `NonErrorException`\n * carrying the original payload.\n *\n * Replaces `toError` for capture sites that handle both branches\n * (today: `unhandledrejection`). `toError` is kept for callers that\n * specifically need an `Error` (`<ErrorBoundary>` interop, browser\n * APIs that take Error-typed args).\n */\nexport function toException(value: unknown): Error | NonErrorException {\n if (value instanceof Error) {\n return value;\n }\n if (typeof value === \"string\") {\n return new Error(value);\n }\n if (value !== null && typeof value === \"object\") {\n const nested = tryUnwrapNestedError(value as Record<string, unknown>);\n if (nested) {\n return nested;\n }\n }\n return {\n kind: \"non-error\",\n type: classify(value),\n value: describe(value),\n serialized: serializeBoundedDepth(value, MAX_NON_ERROR_DEPTH),\n };\n}\n\nexport function isNonErrorException(\n value: unknown\n): value is NonErrorException {\n return (\n typeof value === \"object\" &&\n value !== null &&\n (value as { kind?: unknown }).kind === \"non-error\"\n );\n}\n\n/**\n * Walks `Error.cause` to flatten the chain into the wire shape the\n * collector expects. Each entry carries `type` / `value` / `mechanism?`\n * plus the raw `stack` string — the SDK ships **no parsed frames**.\n * Server-side ingest parses `stack` into structured `IngestedFrame[]`\n * via the collector's stack parser (see\n * `src/services/collector/src/lib/stack-parser.ts`).\n *\n * Non-Error rejections short-circuit to a single `kind: \"non-error\"`\n * entry with the structured payload on `serialized`.\n */\nexport function toExceptions(\n value: Error | NonErrorException,\n mechanism: ErrorMechanism\n): ExceptionValue[] {\n if (isNonErrorException(value)) {\n return [\n {\n kind: \"non-error\",\n type: value.type,\n value: value.value,\n mechanism,\n serialized: value.serialized,\n },\n ];\n }\n\n const exceptions: ExceptionValue[] = [];\n let current: Error | undefined = value;\n\n for (let depth = 0; current && depth < MAX_CAUSE_DEPTH; depth += 1) {\n exceptions.push({\n kind: \"error\",\n type: current.name,\n value: current.message,\n mechanism: depth === 0 ? mechanism : undefined,\n stack: current.stack ?? \"\",\n });\n\n current = current.cause instanceof Error ? current.cause : undefined;\n }\n\n return exceptions;\n}\n"],"mappings":"AAoBA,MAAa,EAAiB,CAC5B,QAAS,CACP,QAAS,uCACT,qBAAsB,oDACtB,aAAc,6BACf,CACD,MAAO,CACL,cAAe,qCACf,gBAAiB,uCACjB,YAAa,mCACb,cAAe,qCACf,iBAAkB,wCACnB,CACD,OAAQ,CACN,eAAgB,wCAChB,aAAc,qCACf,CACD,KAAM,CACJ,aAAc,mCACd,kBAAmB,+CACnB,mBAAoB,gDACrB,CACD,OAAQ,CAEN,QAAS,qBACV,CACF,CAQK,EACJ,qFAeF,SAAgB,EACd,EACS,CACT,OAAO,EAAO,KAAM,GAAU,EAAiB,KAAK,EAAM,CAAC,CAY7D,MAAM,EACJ,2EAQF,SAAgB,EACd,EACS,CACT,GAAI,EAAO,SAAW,EACpB,MAAO,GAET,IAAK,IAAM,KAAS,EAClB,GAAI,EAAuB,KAAK,EAAM,CACpC,MAAO,GAGX,MAAO,GAGT,MAUM,EACJ,gEAcF,SAAgB,EACd,EACiB,CACjB,IAAM,EAA0B,EAAE,CAClC,IAAK,IAAM,KAAW,EAAe,MAAM;EAAK,CAAE,CAChD,IAAM,EAAO,EAAQ,MAAM,CAC3B,GAAI,CAAC,EACH,SAEF,IAAM,EAAQ,EAAmB,KAAK,EAAK,CAC3C,GAAI,CAAC,EACH,SAEF,GAAM,EAAG,EAAM,EAAU,EAAS,GAAU,EAC5C,GAAI,CAAC,EACH,SAEF,IAA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,EAC/D,EAAW,KAAK,CACd,KAAM,QACN,KAAM,EAAQ,KACd,MAAO,EAAQ,QACf,UAAW,IAAU,EAAI,EAAY,IAAA,GACrC,MAAO,EAAQ,OAAS,GACzB,CAAC,CAEF,EAAU,EAAQ,iBAAiB,MAAQ,EAAQ,MAAQ,IAAA,GAG7D,OAAO"}
package/dist/sdk/geo.mjs CHANGED
@@ -1,17 +1 @@
1
- import { z } from "zod";
2
- //#region src/sdk/geo.ts
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 as e}from"zod";const t=e.object({loc:e.string().length(2)}).loose(),n=[`cf-ipcountry`,`x-vercel-ip-country`,`x-country-code`];function r(e){for(let t of n){let n=e.headers.get(t);if(n&&n.length===2)return n.toUpperCase()}return null}export{t as cloudflareTraceSchema,r as extractCountryHeader};
@@ -1 +1 @@
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
+ {"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 .loose();\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":"wBAEA,MAAa,EAAwB,EAClC,OAAO,CAAE,IAAK,EAAE,QAAQ,CAAC,OAAO,EAAE,CAAE,CAAC,CACrC,OAAO,CAIJ,EAAsB,CAC1B,eACA,sBACA,iBACD,CAED,SAAgB,EAAqB,EAAiC,CACpE,IAAK,IAAM,KAAU,EAAqB,CACxC,IAAM,EAAQ,EAAQ,QAAQ,IAAI,EAAO,CACzC,GAAI,GAAS,EAAM,SAAW,EAC5B,OAAO,EAAM,aAAa,CAG9B,OAAO"}
@@ -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.ZodString>;
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<{
@@ -1 +1 @@
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
+ {"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,cAyB/B,oBAAA,EAAoB,CAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;KAerB,cAAA,GAAiB,CAAA,CAAE,KAAA,QAAa,oBAAA"}
@@ -1,43 +1 @@
1
- import { z } from "zod";
2
- //#region src/sdk/identify.ts
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 as e}from"zod";const t=e.discriminatedUnion(`type`,[e.object({type:e.literal(`clerk`),name:e.literal(`Clerk`)}).meta({id:`ClerkIdentifySource`,title:`ClerkIdentifySource`}),e.object({type:e.literal(`auth0`),name:e.literal(`Auth0`)}).meta({id:`Auth0IdentifySource`,title:`Auth0IdentifySource`}),e.object({type:e.literal(`custom`),name:e.string()}).meta({id:`CustomIdentifySource`,title:`CustomIdentifySource`})]).meta({id:`IdentifySource`,title:`IdentifySource`,description:`Auth provider that surfaced this identification.`}),n=e.record(e.string(),e.unknown()).meta({id:`IdentifyTraits`,title:`IdentifyTraits`,description:`Free-form key/value bag of user attributes attached when identifying a session.`}),r=e.object({avatar:e.string().optional(),email:e.email().optional(),identifier:e.string(),name:e.string().optional(),source:t,traits:n.optional()}).meta({id:`IdentifyParams`,title:`IdentifyParams`,description:`User attributes attached when identifying a session.`});export{r as identifyParamsSchema,t as identifySourceSchema};
@@ -1 +1 @@
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
+ {"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\n/**\n * Schema for the `traits` bag attached to an identify call. Modelled as\n * a flat `Record<string, unknown>` rather than the fully recursive\n * `z.json()` because:\n *\n * - Speakeasy's TS generator panics on self-recursive `$ref` cycles\n * (\"Multiple types for the same registration ID JsonValue\") even\n * when the doc is otherwise lint-clean.\n * - The wire is already JSON-parsed before reaching this validator, so\n * the recursive shape only affected the SDK's nominal type — values\n * nested arbitrarily deep still flow through unchanged.\n *\n * If the SDK ever needs to expose a recursive JSON-value type, do it\n * with a hand-written TypeScript alias rather than a recursive Zod\n * schema, until Speakeasy supports the cycle.\n */\nconst traitsSchema = z.record(z.string(), z.unknown()).meta({\n id: \"IdentifyTraits\",\n title: \"IdentifyTraits\",\n description:\n \"Free-form key/value bag of user attributes attached when identifying a session.\",\n});\n\nexport const identifyParamsSchema = z\n .object({\n avatar: z.string().optional(),\n email: z.email().optional(),\n identifier: z.string(),\n name: z.string().optional(),\n source: identifySourceSchema,\n traits: traitsSchema.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":"wBAEA,MAAa,EAAuB,EACjC,mBAAmB,OAAQ,CAC1B,EACG,OAAO,CAAE,KAAM,EAAE,QAAQ,QAAQ,CAAE,KAAM,EAAE,QAAQ,QAAQ,CAAE,CAAC,CAC9D,KAAK,CAAE,GAAI,sBAAuB,MAAO,sBAAuB,CAAC,CACpE,EACG,OAAO,CAAE,KAAM,EAAE,QAAQ,QAAQ,CAAE,KAAM,EAAE,QAAQ,QAAQ,CAAE,CAAC,CAC9D,KAAK,CAAE,GAAI,sBAAuB,MAAO,sBAAuB,CAAC,CACpE,EACG,OAAO,CAAE,KAAM,EAAE,QAAQ,SAAS,CAAE,KAAM,EAAE,QAAQ,CAAE,CAAC,CACvD,KAAK,CAAE,GAAI,uBAAwB,MAAO,uBAAwB,CAAC,CACvE,CAAC,CACD,KAAK,CACJ,GAAI,iBACJ,MAAO,iBACP,YAAa,mDACd,CAAC,CAoBE,EAAe,EAAE,OAAO,EAAE,QAAQ,CAAE,EAAE,SAAS,CAAC,CAAC,KAAK,CAC1D,GAAI,iBACJ,MAAO,iBACP,YACE,kFACH,CAAC,CAEW,EAAuB,EACjC,OAAO,CACN,OAAQ,EAAE,QAAQ,CAAC,UAAU,CAC7B,MAAO,EAAE,OAAO,CAAC,UAAU,CAC3B,WAAY,EAAE,QAAQ,CACtB,KAAM,EAAE,QAAQ,CAAC,UAAU,CAC3B,OAAQ,EACR,OAAQ,EAAa,UAAU,CAChC,CAAC,CACD,KAAK,CACJ,GAAI,iBACJ,MAAO,iBACP,YAAa,uDACd,CAAC"}
@@ -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,8 +80,10 @@ 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>;
@@ -1 +1 @@
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
+ {"version":3,"file":"browser.d.mts","names":[],"sources":["../../../../src/sdk/plugins/context/browser.ts"],"mappings":";;;cA0Ca,oBAAA,EAAoB,CAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAsBrB,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,81 +1 @@
1
- import { z } from "zod";
2
- //#region src/sdk/plugins/context/browser.ts
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 as e}from"zod";const t=e.object({major:e.string().optional(),name:e.string().optional(),type:e.string().optional(),version:e.string().optional(),fullVersion:e.string().optional()}).meta({id:`DeviceBrowser`,title:`DeviceBrowser`}),n=e.object({architecture:e.string().optional(),bitness:e.string().optional()}).meta({id:`DeviceCpu`,title:`DeviceCpu`}),r=e.object({model:e.string().optional(),type:e.string().optional(),vendor:e.string().optional()}).meta({id:`DeviceInfo`,title:`DeviceInfo`}),i=e.object({name:e.string().optional(),version:e.string().optional()}).meta({id:`DeviceEngine`,title:`DeviceEngine`}),a=e.object({name:e.string().optional(),version:e.string().optional(),versionFull:e.string().optional()}).meta({id:`DeviceOs`,title:`DeviceOs`}),o=e.object({browser:t,cpu:n,device:r,engine:i,os:a,ua:e.string(),frozenUa:e.boolean().optional()}).meta({id:`DeviceMetadata`,title:`DeviceMetadata`,description:`Device/browser metadata extracted from the user agent.`}),s=e.object({height:e.number(),width:e.number(),orientation:e.string().optional()}).meta({id:`Screen`,title:`Screen`}),c=e.object({screen:s}).meta({id:`Display`,title:`Display`}),l=e.object({language:e.string().optional(),timezone:e.string().optional(),display:c}).meta({id:`BrowserMetadata`,title:`BrowserMetadata`,description:`Browser locale and display metadata.`}),u=e.object({runtime:e.literal(`browser`),browser:l.nullable(),device:o.nullable()}).meta({id:`BrowserContext`,title:`BrowserContext`,description:`Request context for the browser runtime.`});export{u as browserContextSchema,o as deviceMetadataSchema};
@@ -1 +1 @@
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,IAAI;CAAiB,OAAO;CAAiB,CAAC;AAExD,MAAM,kBAAkB,EACrB,OAAO,EACN,cAAc,EAAE,QAAQ,CAAC,UAAU,EACpC,CAAC,CACD,KAAK;CAAE,IAAI;CAAa,OAAO;CAAa,CAAC;AAEhD,MAAM,mBAAmB,EACtB,OAAO;CACN,OAAO,EAAE,QAAQ,CAAC,UAAU;C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AAQ,qBAAqB,UAAU;CACxC,CAAC,CACD,KAAK;CACJ,IAAI;CACJ,OAAO;CACP,aAAa;CACd,CAAC"}
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 fullVersion: z.string().optional(),\n })\n .meta({ id: \"DeviceBrowser\", title: \"DeviceBrowser\" });\n\nconst deviceCpuSchema = z\n .object({\n architecture: z.string().optional(),\n bitness: 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 versionFull: 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 * `true` when the UA string has been reduced under Chrome's\n * UA-reduction (frozen UA). Indicates that fields parsed solely from\n * the UA string are unreliable on this UA and that any high-fidelity\n * data came from Client Hints.\n */\n frozenUa: z.boolean().optional(),\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":"wBAEA,MAAM,EAAsB,EACzB,OAAO,CACN,MAAO,EAAE,QAAQ,CAAC,UAAU,CAC5B,KAAM,EAAE,QAAQ,CAAC,UAAU,CAC3B,KAAM,EAAE,QAAQ,CAAC,UAAU,CAC3B,QAAS,EAAE,QAAQ,CAAC,UAAU,CAC9B,YAAa,EAAE,QAAQ,CAAC,UAAU,CACnC,CAAC,CACD,KAAK,CAAE,GAAI,gBAAiB,MAAO,gBAAiB,CAAC,CAElD,EAAkB,EACrB,OAAO,CACN,aAAc,EAAE,QAAQ,CAAC,UAAU,CACnC,QAAS,EAAE,QAAQ,CAAC,UAAU,CAC/B,CAAC,CACD,KAAK,CAAE,GAAI,YAAa,MAAO,YAAa,CAAC,CAE1C,EAAmB,EACtB,OAAO,CACN,MAAO,EAAE,QAAQ,CAAC,UAAU,CAC5B,KAAM,EAAE,QAAQ,CAAC,UAAU,CAC3B,OAAQ,EAAE,QAAQ,CAAC,UAAU,CAC9B,CAAC,CACD,KAAK,CAAE,GAAI,aAAc,MAAO,aAAc,CAAC,CAE5C,EAAqB,EACxB,OAAO,CACN,KAAM,EAAE,QAAQ,CAAC,UAAU,CAC3B,QAAS,EAAE,QAAQ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({
4
- id: "EdgeContext",
5
- title: "EdgeContext",
6
- description: "Request context for the Edge runtime."
7
- });
8
- //#endregion
9
- export { edgeContextSchema };
1
+ import{z as e}from"zod";const t=e.object({runtime:e.literal(`edge`)}).meta({id:`EdgeContext`,title:`EdgeContext`,description:`Request context for the Edge runtime.`});export{t as edgeContextSchema};
@@ -1 +1 @@
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
+ {"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":"wBAEA,MAAa,EAAoB,EAC9B,OAAO,CACN,QAAS,EAAE,QAAQ,OAAO,CAC3B,CAAC,CACD,KAAK,CACJ,GAAI,cACJ,MAAO,cACP,YAAa,wCACd,CAAC"}
@@ -1,50 +1 @@
1
- import { z } from "zod";
2
- //#region src/sdk/plugins/context/next.ts
3
- const renderSourceSchema = z.enum([
4
- "react-server-components",
5
- "react-server-components-payload",
6
- "server-rendering"
7
- ]).meta({
8
- id: "RenderSource",
9
- title: "RenderSource"
10
- });
11
- const renderTypeSchema = z.enum(["dynamic", "dynamic-resume"]).meta({
12
- id: "RenderType",
13
- title: "RenderType"
14
- });
15
- const revalidateReasonSchema = z.enum(["on-demand", "stale"]).meta({
16
- id: "RevalidateReason",
17
- title: "RevalidateReason"
18
- });
19
- const routeTypeSchema = z.enum([
20
- "render",
21
- "route",
22
- "action",
23
- "middleware",
24
- "proxy"
25
- ]).meta({
26
- id: "RouteType",
27
- title: "RouteType"
28
- });
29
- const routerKindSchema = z.enum(["Pages Router", "App Router"]).meta({
30
- id: "RouterKind",
31
- title: "RouterKind"
32
- });
33
- const nextjsContextSchema = z.object({
34
- errorDigest: z.string().optional(),
35
- renderSource: renderSourceSchema.optional(),
36
- renderType: renderTypeSchema.optional(),
37
- requestMethod: z.string().optional(),
38
- requestPath: z.string().optional(),
39
- revalidateReason: revalidateReasonSchema.optional(),
40
- routePath: z.string().optional(),
41
- routeType: routeTypeSchema.optional(),
42
- routerKind: routerKindSchema.optional(),
43
- runtime: z.literal("nextjs")
44
- }).meta({
45
- id: "NextjsContext",
46
- title: "NextjsContext",
47
- description: "Request context for the Next.js runtime."
48
- });
49
- //#endregion
50
- export { nextjsContextSchema, renderSourceSchema, renderTypeSchema, revalidateReasonSchema, routeTypeSchema, routerKindSchema };
1
+ import{z as e}from"zod";const t=e.enum([`react-server-components`,`react-server-components-payload`,`server-rendering`]).meta({id:`RenderSource`,title:`RenderSource`}),n=e.enum([`dynamic`,`dynamic-resume`]).meta({id:`RenderType`,title:`RenderType`}),r=e.enum([`on-demand`,`stale`]).meta({id:`RevalidateReason`,title:`RevalidateReason`}),i=e.enum([`render`,`route`,`action`,`middleware`,`proxy`]).meta({id:`RouteType`,title:`RouteType`}),a=e.enum([`Pages Router`,`App Router`]).meta({id:`RouterKind`,title:`RouterKind`}),o=e.object({errorDigest:e.string().optional(),renderSource:t.optional(),renderType:n.optional(),requestMethod:e.string().optional(),requestPath:e.string().optional(),revalidateReason:r.optional(),routePath:e.string().optional(),routeType:i.optional(),routerKind:a.optional(),runtime:e.literal(`nextjs`)}).meta({id:`NextjsContext`,title:`NextjsContext`,description:`Request context for the Next.js runtime.`});export{o as nextjsContextSchema,t as renderSourceSchema,n as renderTypeSchema,r as revalidateReasonSchema,i as routeTypeSchema,a as routerKindSchema};
@@ -1 +1 @@
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;AAEtD,MAAa,mBAAmB,EAC7B,KAAK,CAAC,WAAW,iBAAiB,CAAC,CACnC,KAAK;CAAE,IAAI;CAAc,OAAO;CAAc,CAAC;AAElD,MAAa,yBAAyB,EACnC,KAAK,CAAC,aAAa,QAAQ,CAAC,CAC5B,KAAK;CAAE,IAAI;CAAoB,OAAO;CAAoB,CAAC;AAE9D,MAAa,kBAAkB,EAC5B,KAAK;CAAC;CAAU;CAAS;CAAU;CAAc;CAAQ,CAAC,CAC1D,KAAK;CAAE,IAAI;CAAa,OAAO;CAAa,CAAC;AAEhD,MAAa,mBAAmB,EAC7B,KAAK,CAAC,gBAAgB,aAAa,CAAC,CACpC,KAAK;CAAE,IAAI;CAAc,OAAO;CAAc,CAAC;AAElD,MAAa,sBAAsB,EAChC,OAAO;CACN,aAAa,EAAE,QAAQ,CAAC,UAAU;CAClC,cAAc,mBAAmB,UAAU;CAC3C,YAAY,iBAAiB,UAAU;CACvC,eAAe,EAAE,QAAQ,CAAC,UAAU;CACpC,aAAa,EAAE,QAAQ,CAAC,UAAU;CAClC,kBAAkB,uBAAuB,UAAU;CACnD,WAAW,EAAE,QAAQ,CAAC,UAAU;CAChC,WAAW,gBAAgB,UAAU;CACrC,YAAY,iBAAiB,UAAU;CACvC,SAAS,EAAE,QAAQ,SAAS;CAC7B,CAAC,CACD,KAAK;CACJ,IAAI;CACJ,OAAO;CACP,aAAa;CACd,CAAC"}
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":"wBAEA,MAAa,EAAqB,EAC/B,KAAK,CACJ,0BACA,kCACA,mBACD,CAAC,CACD,KAAK,CAAE,GAAI,eAAgB,MAAO,eAAgB,CAAC,CAEzC,EAAmB,EAC7B,KAAK,CAAC,UAAW,iBAAiB,CAAC,CACnC,KAAK,CAAE,GAAI,aAAc,MAAO,aAAc,CAAC,CAErC,EAAyB,EACnC,KAAK,CAAC,YAAa,QAAQ,CAAC,CAC5B,KAAK,CAAE,GAAI,mBAAoB,MAAO,mBAAoB,CAAC,CAEjD,EAAkB,EAC5B,KAAK,CAAC,SAAU,QAAS,SAAU,aAAc,QAAQ,CAAC,CAC1D,KAAK,CAAE,GAAI,YAAa,MAAO,YAAa,CAAC,CAEnC,EAAmB,EAC7B,KAAK,CAAC,eAAgB,aAAa,CAAC,CACpC,KAAK,CAAE,GAAI,aAAc,MAAO,aAAc,CAAC,CAErC,EAAsB,EAChC,OAAO,CACN,YAAa,EAAE,QAAQ,CAAC,UAAU,CAClC,aAAc,EAAmB,UAAU,CAC3C,WAAY,EAAiB,UAAU,CACvC,cAAe,EAAE,QAAQ,CAAC,UAAU,CACpC,YAAa,EAAE,QAAQ,CAAC,UAAU,CAClC,iBAAkB,EAAuB,UAAU,CACnD,UAAW,EAAE,QAAQ,CAAC,UAAU,CAChC,UAAW,EAAgB,UAAU,CACrC,WAAY,EAAiB,UAAU,CACvC,QAAS,EAAE,QAAQ,SAAS,CAC7B,CAAC,CACD,KAAK,CACJ,GAAI,gBACJ,MAAO,gBACP,YAAa,2CACd,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { z } from "zod";
2
+
3
+ //#region src/sdk/plugins/context/node.d.ts
4
+ declare const nodeContextSchema: z.ZodObject<{
5
+ errorDigest: z.ZodOptional<z.ZodString>;
6
+ requestMethod: z.ZodOptional<z.ZodString>;
7
+ requestPath: z.ZodOptional<z.ZodString>;
8
+ runtime: z.ZodLiteral<"node">;
9
+ }, z.core.$strip>;
10
+ type NodeContext = z.infer<typeof nodeContextSchema>;
11
+ //#endregion
12
+ export { NodeContext, nodeContextSchema };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node.d.mts","names":[],"sources":["../../../../src/sdk/plugins/context/node.ts"],"mappings":";;;cAEa,iBAAA,EAAiB,CAAA,CAAA,SAAA;;;;;;KAalB,WAAA,GAAc,CAAA,CAAE,KAAA,QAAa,iBAAA"}
@@ -0,0 +1 @@
1
+ import{z as e}from"zod";const t=e.object({errorDigest:e.string().optional(),requestMethod:e.string().optional(),requestPath:e.string().optional(),runtime:e.literal(`node`)}).meta({id:`NodeContext`,title:`NodeContext`,description:`Request context for the Node.js runtime.`});export{t as nodeContextSchema};
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node.mjs","names":[],"sources":["../../../../src/sdk/plugins/context/node.ts"],"sourcesContent":["import { z } from \"zod\";\n\nexport const nodeContextSchema = z\n .object({\n errorDigest: z.string().optional(),\n requestMethod: z.string().optional(),\n requestPath: z.string().optional(),\n runtime: z.literal(\"node\"),\n })\n .meta({\n id: \"NodeContext\",\n title: \"NodeContext\",\n description: \"Request context for the Node.js runtime.\",\n });\n\nexport type NodeContext = z.infer<typeof nodeContextSchema>;\n"],"mappings":"wBAEA,MAAa,EAAoB,EAC9B,OAAO,CACN,YAAa,EAAE,QAAQ,CAAC,UAAU,CAClC,cAAe,EAAE,QAAQ,CAAC,UAAU,CACpC,YAAa,EAAE,QAAQ,CAAC,UAAU,CAClC,QAAS,EAAE,QAAQ,OAAO,CAC3B,CAAC,CACD,KAAK,CACJ,GAAI,cACJ,MAAO,cACP,YAAa,2CACd,CAAC"}
@@ -44,6 +44,11 @@ declare const PLUGIN_MANIFEST: readonly [{
44
44
  readonly name: "replay_chunk";
45
45
  }];
46
46
  readonly name: "replay";
47
+ }, {
48
+ readonly consentCategory: "necessary";
49
+ readonly defaultEnabled: true;
50
+ readonly events: readonly [];
51
+ readonly name: "logs";
47
52
  }];
48
53
  type PluginManifest = typeof PLUGIN_MANIFEST;
49
54
  type ConsentCategory = (typeof CONSENT_CATEGORIES)[number];
@@ -1 +1 @@
1
- {"version":3,"file":"manifest.d.mts","names":[],"sources":["../../../src/sdk/plugins/manifest.ts"],"mappings":";cAAa,kBAAA;AAAA,KAER,UAAA,oBACS,CAAA,KAAM,QAAA,CAAS,IAAA,CAAK,CAAA,EAAG,CAAA,KAAM,OAAA,CAAQ,CAAA,UAC3C,CAAA;AAAA,cAEK,eAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAqCD,cAAA,UAAwB,eAAA;AAAA,KAExB,eAAA,WAA0B,kBAAA;AAAA,KAC1B,SAAA,GAAY,cAAA;AAAA,KACZ,gBAAA,GAAmB,OAAA,CAAQ,eAAA;AAAA,KAC3B,YAAA,GAAe,UAAA,CAAW,MAAA,CAAO,gBAAA"}
1
+ {"version":3,"file":"manifest.d.mts","names":[],"sources":["../../../src/sdk/plugins/manifest.ts"],"mappings":";cAAa,kBAAA;AAAA,KAER,UAAA,oBACS,CAAA,KAAM,QAAA,CAAS,IAAA,CAAK,CAAA,EAAG,CAAA,KAAM,OAAA,CAAQ,CAAA,UAC3C,CAAA;AAAA,cAEK,eAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA+CD,cAAA,UAAwB,eAAA;AAAA,KAExB,eAAA,WAA0B,kBAAA;AAAA,KAC1B,SAAA,GAAY,cAAA;AAAA,KACZ,gBAAA,GAAmB,OAAA,CAAQ,eAAA;AAAA,KAC3B,YAAA,GAAe,UAAA,CAAW,MAAA,CAAO,gBAAA"}
@@ -1,62 +1 @@
1
- //#region src/sdk/plugins/manifest.ts
2
- const CONSENT_CATEGORIES = [
3
- "necessary",
4
- "analytics",
5
- "replay"
6
- ];
7
- const PLUGIN_MANIFEST = [
8
- {
9
- consentCategory: "necessary",
10
- defaultEnabled: true,
11
- events: [{
12
- enrich: true,
13
- name: "error"
14
- }],
15
- name: "errors"
16
- },
17
- {
18
- consentCategory: "analytics",
19
- defaultEnabled: true,
20
- events: [],
21
- name: "device"
22
- },
23
- {
24
- consentCategory: "analytics",
25
- defaultEnabled: true,
26
- events: [
27
- {
28
- enrich: true,
29
- name: "pageview"
30
- },
31
- {
32
- enrich: true,
33
- name: "pageleave"
34
- },
35
- {
36
- enrich: true,
37
- name: "ui_event"
38
- }
39
- ],
40
- name: "pageEvents"
41
- },
42
- {
43
- consentCategory: "analytics",
44
- defaultEnabled: true,
45
- events: [{
46
- enrich: true,
47
- name: "rage_click"
48
- }],
49
- name: "rageClick"
50
- },
51
- {
52
- consentCategory: "replay",
53
- defaultEnabled: true,
54
- events: [{
55
- enrich: false,
56
- name: "replay_chunk"
57
- }],
58
- name: "replay"
59
- }
60
- ];
61
- //#endregion
62
- export { CONSENT_CATEGORIES, PLUGIN_MANIFEST };
1
+ const e=[`necessary`,`analytics`,`replay`],t=[{consentCategory:`necessary`,defaultEnabled:!0,events:[{enrich:!0,name:`error`}],name:`errors`},{consentCategory:`analytics`,defaultEnabled:!0,events:[],name:`device`},{consentCategory:`analytics`,defaultEnabled:!0,events:[{enrich:!0,name:`pageview`},{enrich:!0,name:`pageleave`},{enrich:!0,name:`ui_event`}],name:`pageEvents`},{consentCategory:`analytics`,defaultEnabled:!0,events:[{enrich:!0,name:`rage_click`}],name:`rageClick`},{consentCategory:`replay`,defaultEnabled:!0,events:[{enrich:!1,name:`replay_chunk`}],name:`replay`},{consentCategory:`necessary`,defaultEnabled:!0,events:[],name:`logs`}];export{e as CONSENT_CATEGORIES,t as PLUGIN_MANIFEST};
@@ -1 +1 @@
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
+ {"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 {\n consentCategory: \"necessary\",\n defaultEnabled: true,\n // Logs ride OTel `LogRecord`s, not envelopes — no `events: [...]`\n // entry. The plugin patches `console.*` and emits via the kernel's\n // logger provider. Error-bearing console calls stay routed through\n // the `errors` plugin (class boundary).\n events: [],\n name: \"logs\",\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,EAAqB,CAAC,YAAa,YAAa,SAAS,CAMzD,EAAkB,CAC7B,CACE,gBAAiB,YACjB,eAAgB,GAChB,OAAQ,CAAC,CAAE,OAAQ,GAAM,KAAM,QAAS,CAAC,CACzC,KAAM,SACP,CACD,CACE,gBAAiB,YACjB,eAAgB,GAChB,OAAQ,EAAE,CACV,KAAM,SACP,CACD,CACE,gBAAiB,YACjB,eAAgB,GAChB,OAAQ,CACN,CAAE,OAAQ,GAAM,KAAM,WAAY,CAClC,CAAE,OAAQ,GAAM,KAAM,YAAa,CACnC,CAAE,OAAQ,GAAM,KAAM,WAAY,CACnC,CACD,KAAM,aACP,CACD,CACE,gBAAiB,YACjB,eAAgB,GAChB,OAAQ,CAAC,CAAE,OAAQ,GAAM,KAAM,aAAc,CAAC,CAC9C,KAAM,YACP,CACD,CACE,gBAAiB,SACjB,eAAgB,GAChB,OAAQ,CAAC,CAAE,OAAQ,GAAO,KAAM,eAAgB,CAAC,CACjD,KAAM,SACP,CACD,CACE,gBAAiB,YACjB,eAAgB,GAKhB,OAAQ,EAAE,CACV,KAAM,OACP,CACF"}