@interfere/types 10.1.2 → 10.2.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/dist/data/frame.cjs +1 -1
- package/dist/data/frame.d.cts +6 -7
- package/dist/data/frame.d.mts +6 -7
- package/dist/data/frame.mjs +1 -1
- package/dist/data/session.cjs +1 -1
- package/dist/data/session.d.cts +3 -4
- package/dist/data/session.d.mts +3 -4
- package/dist/data/session.mjs +1 -1
- package/dist/data/source-map-batch.cjs +1 -0
- package/dist/data/source-map-batch.d.cts +4 -0
- package/dist/data/source-map-batch.d.mts +4 -0
- package/dist/data/source-map-batch.mjs +1 -0
- package/dist/data/source-map-diagnostics.cjs +1 -0
- package/dist/data/source-map-diagnostics.d.cts +49 -0
- package/dist/data/source-map-diagnostics.d.mts +49 -0
- package/dist/data/source-map-diagnostics.mjs +1 -0
- package/dist/data/source-map-status.cjs +1 -0
- package/dist/data/source-map-status.d.cts +65 -0
- package/dist/data/source-map-status.d.mts +65 -0
- package/dist/data/source-map-status.mjs +1 -0
- package/dist/data/source-map-upload-batch.cjs +1 -0
- package/dist/data/source-map-upload-batch.d.cts +22 -0
- package/dist/data/source-map-upload-batch.d.mts +22 -0
- package/dist/data/source-map-upload-batch.mjs +1 -0
- package/dist/data/source-maps.cjs +1 -1
- package/dist/data/source-maps.d.cts +73 -63
- package/dist/data/source-maps.d.mts +73 -63
- package/dist/data/source-maps.mjs +1 -1
- package/dist/events/error.cjs +1 -1
- package/dist/events/error.d.cts +118 -111
- package/dist/events/error.d.mts +118 -111
- package/dist/events/error.mjs +1 -1
- package/dist/events/pageleave.cjs +1 -1
- package/dist/events/pageleave.d.cts +5 -6
- package/dist/events/pageleave.d.mts +5 -6
- package/dist/events/pageleave.mjs +1 -1
- package/dist/events/pageview.cjs +1 -1
- package/dist/events/pageview.d.cts +6 -7
- package/dist/events/pageview.d.mts +6 -7
- package/dist/events/pageview.mjs +1 -1
- package/dist/integrations/index.cjs +1 -1
- package/dist/integrations/index.d.cts +62 -63
- package/dist/integrations/index.d.mts +62 -63
- package/dist/integrations/index.mjs +1 -1
- package/dist/integrations/platforms/cli.cjs +1 -1
- package/dist/integrations/platforms/cli.d.cts +3 -4
- package/dist/integrations/platforms/cli.d.mts +3 -4
- package/dist/integrations/platforms/cli.mjs +1 -1
- package/dist/integrations/platforms/cloudflare.cjs +1 -1
- package/dist/integrations/platforms/cloudflare.d.cts +12 -13
- package/dist/integrations/platforms/cloudflare.d.mts +12 -13
- package/dist/integrations/platforms/cloudflare.mjs +1 -1
- package/dist/integrations/platforms/github.cjs +1 -1
- package/dist/integrations/platforms/github.d.cts +30 -31
- package/dist/integrations/platforms/github.d.mts +30 -31
- package/dist/integrations/platforms/github.mjs +1 -1
- package/dist/integrations/platforms/slack.cjs +1 -1
- package/dist/integrations/platforms/slack.d.cts +7 -8
- package/dist/integrations/platforms/slack.d.mts +7 -8
- package/dist/integrations/platforms/slack.mjs +1 -1
- package/dist/integrations/platforms/vercel.cjs +1 -1
- package/dist/integrations/platforms/vercel.d.cts +12 -13
- package/dist/integrations/platforms/vercel.d.mts +12 -13
- package/dist/integrations/platforms/vercel.mjs +1 -1
- package/dist/releases/build-telemetry.d.cts +8 -9
- package/dist/releases/build-telemetry.d.mts +8 -9
- package/dist/releases/definition.cjs +1 -1
- package/dist/releases/definition.d.cts +48 -49
- package/dist/releases/definition.d.mts +48 -49
- package/dist/releases/definition.mjs +1 -1
- package/dist/releases/slug.d.cts +5 -6
- package/dist/releases/slug.d.mts +5 -6
- package/dist/sdk/build-config.cjs +1 -0
- package/dist/sdk/build-config.d.cts +22 -0
- package/dist/sdk/build-config.d.mts +22 -0
- package/dist/sdk/build-config.mjs +1 -0
- package/dist/sdk/build-diagnostics.cjs +1 -1
- package/dist/sdk/build-diagnostics.d.cts +11 -12
- package/dist/sdk/build-diagnostics.d.mts +11 -12
- package/dist/sdk/build-diagnostics.mjs +1 -1
- package/dist/sdk/cli-destination.cjs +1 -1
- package/dist/sdk/cli-destination.d.cts +7 -4
- package/dist/sdk/cli-destination.d.mts +7 -4
- package/dist/sdk/cli-destination.mjs +1 -1
- package/dist/sdk/deploy-environment.cjs +1 -1
- package/dist/sdk/deploy-environment.d.cts +28 -6
- package/dist/sdk/deploy-environment.d.mts +28 -6
- package/dist/sdk/deploy-environment.mjs +1 -1
- package/dist/sdk/env.d.cts +3 -4
- package/dist/sdk/env.d.mts +3 -4
- package/dist/sdk/envelope.cjs +1 -1
- package/dist/sdk/envelope.d.cts +129 -130
- package/dist/sdk/envelope.d.mts +129 -130
- package/dist/sdk/envelope.mjs +1 -1
- package/dist/sdk/errors.cjs +2 -2
- package/dist/sdk/errors.d.cts +70 -28
- package/dist/sdk/errors.d.mts +70 -28
- package/dist/sdk/errors.mjs +2 -2
- package/dist/sdk/geo.cjs +1 -1
- package/dist/sdk/geo.d.cts +4 -5
- package/dist/sdk/geo.d.mts +4 -5
- package/dist/sdk/geo.mjs +1 -1
- package/dist/sdk/github-source.cjs +1 -1
- package/dist/sdk/github-source.d.cts +9 -9
- package/dist/sdk/github-source.d.mts +9 -9
- package/dist/sdk/github-source.mjs +1 -1
- package/dist/sdk/identify.cjs +1 -1
- package/dist/sdk/identify.d.cts +13 -14
- package/dist/sdk/identify.d.mts +13 -14
- package/dist/sdk/identify.mjs +1 -1
- package/dist/sdk/injected-globals.d.cts +9 -10
- package/dist/sdk/injected-globals.d.mts +9 -10
- package/dist/sdk/log-sourcing.cjs +1 -1
- package/dist/sdk/log-sourcing.d.cts +9 -10
- package/dist/sdk/log-sourcing.d.mts +9 -10
- package/dist/sdk/log-sourcing.mjs +1 -1
- package/dist/sdk/plugins/context/browser.cjs +1 -1
- package/dist/sdk/plugins/context/browser.d.cts +17 -18
- package/dist/sdk/plugins/context/browser.d.mts +17 -18
- package/dist/sdk/plugins/context/browser.mjs +1 -1
- package/dist/sdk/plugins/context/edge.cjs +1 -1
- package/dist/sdk/plugins/context/edge.d.cts +3 -4
- package/dist/sdk/plugins/context/edge.d.mts +3 -4
- package/dist/sdk/plugins/context/edge.mjs +1 -1
- package/dist/sdk/plugins/context/next.cjs +1 -1
- package/dist/sdk/plugins/context/next.d.cts +8 -9
- package/dist/sdk/plugins/context/next.d.mts +8 -9
- package/dist/sdk/plugins/context/next.mjs +1 -1
- package/dist/sdk/plugins/context/node.cjs +1 -1
- package/dist/sdk/plugins/context/node.d.cts +3 -4
- package/dist/sdk/plugins/context/node.d.mts +3 -4
- package/dist/sdk/plugins/context/node.mjs +1 -1
- package/dist/sdk/plugins/manifest.d.cts +8 -9
- package/dist/sdk/plugins/manifest.d.mts +8 -9
- package/dist/sdk/plugins/payload/errors.cjs +1 -1
- package/dist/sdk/plugins/payload/errors.d.cts +23 -24
- package/dist/sdk/plugins/payload/errors.d.mts +23 -24
- package/dist/sdk/plugins/payload/errors.mjs +1 -1
- package/dist/sdk/plugins/payload/page-events.cjs +1 -1
- package/dist/sdk/plugins/payload/page-events.d.cts +9 -10
- package/dist/sdk/plugins/payload/page-events.d.mts +9 -10
- package/dist/sdk/plugins/payload/page-events.mjs +1 -1
- package/dist/sdk/plugins/payload/rage-click.cjs +1 -1
- package/dist/sdk/plugins/payload/rage-click.d.cts +5 -6
- package/dist/sdk/plugins/payload/rage-click.d.mts +5 -6
- package/dist/sdk/plugins/payload/rage-click.mjs +1 -1
- package/dist/sdk/plugins/payload/replay.cjs +1 -1
- package/dist/sdk/plugins/payload/replay.d.cts +4 -5
- package/dist/sdk/plugins/payload/replay.d.mts +4 -5
- package/dist/sdk/plugins/payload/replay.mjs +1 -1
- package/dist/sdk/remote-config.cjs +1 -1
- package/dist/sdk/remote-config.d.cts +43 -20
- package/dist/sdk/remote-config.d.mts +43 -20
- package/dist/sdk/remote-config.mjs +1 -1
- package/dist/sdk/runtime.cjs +1 -1
- package/dist/sdk/runtime.d.cts +11 -12
- package/dist/sdk/runtime.d.mts +11 -12
- package/dist/sdk/runtime.mjs +1 -1
- package/dist/sdk/server-tracing.cjs +1 -1
- package/dist/sdk/server-tracing.d.cts +9 -10
- package/dist/sdk/server-tracing.d.mts +9 -10
- package/dist/sdk/server-tracing.mjs +1 -1
- package/dist/sdk/source-map-richness.cjs +1 -0
- package/dist/sdk/source-map-richness.d.cts +9 -0
- package/dist/sdk/source-map-richness.d.mts +9 -0
- package/dist/sdk/source-map-richness.mjs +1 -0
- package/dist/sdk/trace-freshness.cjs +1 -0
- package/dist/sdk/trace-freshness.d.cts +6 -0
- package/dist/sdk/trace-freshness.d.mts +6 -0
- package/dist/sdk/trace-freshness.mjs +1 -0
- package/package.json +11 -11
package/dist/sdk/envelope.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z}from"zod";import{sessionIdSchema}from"#data/session";import{browserContextSchema}from"#sdk/plugins/context/browser";import{edgeContextSchema}from"#sdk/plugins/context/edge";import{nextjsContextSchema}from"#sdk/plugins/context/next";import{nodeContextSchema}from"#sdk/plugins/context/node";import{errorEnvelopePayloadSchema}from"#sdk/plugins/payload/errors";import{pageleavePayloadSchema,pageviewPayloadSchema,uiEventPayloadSchema}from"#sdk/plugins/payload/page-events";import{rageClickPayloadSchema}from"#sdk/plugins/payload/rage-click";import{replayChunkPayloadSchema}from"#sdk/plugins/payload/replay";import{envSchema,runtimeSchema}from"#sdk/runtime";const sessionSourceSchema=z.enum([`header`,`async_context`,`fallback`,`client`]).optional().meta({
|
|
1
|
+
import{z}from"zod";import{sessionIdSchema}from"#data/session";import{browserContextSchema}from"#sdk/plugins/context/browser";import{edgeContextSchema}from"#sdk/plugins/context/edge";import{nextjsContextSchema}from"#sdk/plugins/context/next";import{nodeContextSchema}from"#sdk/plugins/context/node";import{errorEnvelopePayloadSchema}from"#sdk/plugins/payload/errors";import{pageleavePayloadSchema,pageviewPayloadSchema,uiEventPayloadSchema}from"#sdk/plugins/payload/page-events";import{rageClickPayloadSchema}from"#sdk/plugins/payload/rage-click";import{replayChunkPayloadSchema}from"#sdk/plugins/payload/replay";import{envSchema,runtimeSchema}from"#sdk/runtime";const sessionSourceSchema=z.enum([`header`,`async_context`,`fallback`,`client`]).optional().meta({description:`How the server resolved the sessionId for this envelope.`,id:`SessionSource`,title:`SessionSource`}),envelopeContextSchema=z.discriminatedUnion(`runtime`,[browserContextSchema,nextjsContextSchema,edgeContextSchema,nodeContextSchema]).meta({description:`Runtime-specific request context attached to every envelope.`,id:`EnvelopeContext`,title:`EnvelopeContext`}),envelopeHeaderValidators={buildId:z.string(),clientTs:z.int(),context:envelopeContextSchema.optional(),environment:envSchema,producerVersion:z.string().optional(),releaseId:z.string().nullable(),runtime:runtimeSchema,sdkStack:z.array(z.string()).optional(),sessionId:sessionIdSchema.nullable(),sessionSource:sessionSourceSchema,uuid:z.uuidv7(),v:z.literal(0)},errorEnvelopeSchema=z.object({...envelopeHeaderValidators,payload:errorEnvelopePayloadSchema,type:z.literal(`error`)}).meta({id:`ErrorEnvelope`,title:`ErrorEnvelope`}),pageviewEnvelopeSchema=z.object({...envelopeHeaderValidators,payload:pageviewPayloadSchema,type:z.literal(`pageview`)}).meta({id:`PageviewEnvelope`,title:`PageviewEnvelope`}),pageleaveEnvelopeSchema=z.object({...envelopeHeaderValidators,payload:pageleavePayloadSchema,type:z.literal(`pageleave`)}).meta({id:`PageleaveEnvelope`,title:`PageleaveEnvelope`}),uiEventEnvelopeSchema=z.object({...envelopeHeaderValidators,payload:uiEventPayloadSchema,type:z.literal(`ui_event`)}).meta({id:`UiEventEnvelope`,title:`UiEventEnvelope`}),replayChunkEnvelopeSchema=z.object({...envelopeHeaderValidators,payload:replayChunkPayloadSchema,type:z.literal(`replay_chunk`)}).meta({id:`ReplayChunkEnvelope`,title:`ReplayChunkEnvelope`}),rageClickEnvelopeSchema=z.object({...envelopeHeaderValidators,payload:rageClickPayloadSchema,type:z.literal(`rage_click`)}).meta({id:`RageClickEnvelope`,title:`RageClickEnvelope`}),envelopeSchema=z.discriminatedUnion(`type`,[errorEnvelopeSchema,pageviewEnvelopeSchema,pageleaveEnvelopeSchema,uiEventEnvelopeSchema,replayChunkEnvelopeSchema,rageClickEnvelopeSchema]).meta({description:`A single event envelope accepted by the collector.`,id:`Envelope`,title:`Envelope`});export{envelopeContextSchema,envelopeSchema,errorEnvelopeSchema,pageleaveEnvelopeSchema,pageviewEnvelopeSchema,rageClickEnvelopeSchema,replayChunkEnvelopeSchema,sessionSourceSchema,uiEventEnvelopeSchema};
|
package/dist/sdk/errors.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const MECHANISM_TYPE={browser:{
|
|
2
|
-
`)){let line=rawLine.trim();if(!line)continue;let match=COMPONENT_STACK_RE.exec(line);if(!match)continue;let[,name,fileName,lineStr,colStr]=match;if(!name)continue;let frame={id:`react-${frames.length}
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const MECHANISM_TYPE={browser:{consoleError:`auto.browser.console.error`,fetchFailedResponse:`auto.browser.fetch.failed_response`,fetchNetworkError:`auto.browser.fetch.network_error`,onerror:`auto.browser.global_handlers.onerror`,onunhandledrejection:`auto.browser.global_handlers.onunhandledrejection`,resourceError:`auto.browser.resource.error`,securityPolicyViolation:`auto.browser.security_policy.violation`,xhrFailedResponse:`auto.browser.xhr.failed_response`,xhrNetworkError:`auto.browser.xhr.network_error`},manual:{capture:`manual.api.capture`},nextjs:{captureError:`auto.function.nextjs.capture_error`,onRequestError:`auto.function.nextjs.on_request_error`,proxy:`auto.function.nextjs.proxy`,routeHandler:`auto.function.nextjs.route_handler`,serverAction:`auto.function.nextjs.server_action`},node:{captureError:`auto.function.node.capture_error`,uncaughtException:`auto.node.global_handlers.uncaught_exception`,unhandledRejection:`auto.node.global_handlers.unhandled_rejection`},react:{captureBoundary:`auto.function.react.capture_boundary`,caughtError:`auto.function.react.caught_error`,errorBoundary:`auto.function.react.error_boundary`,recoverableError:`auto.function.react.recoverable_error`,uncaughtError:`auto.function.react.uncaught_error`}},EXTENSION_URL_RE=/\b(?:chrome|moz|safari-web|safari|ms-browser|webkit-masked)-(?:extension|url):\/\//u;function shouldDropBrowserExtensionNoise(stacks){return stacks.some(stack=>EXTENSION_URL_RE.test(stack))}const HAS_SOURCE_LOCATION_RE=/(?:https?|file|blob|webpack-internal):\/\/|\sat\s+[\w$.<>]+\s+\([^)]+:\d/u;function shouldDropUnresolvableStack(stacks){if(stacks.length===0)return!1;for(let stack of stacks)if(HAS_SOURCE_LOCATION_RE.test(stack))return!1;return!0}const COMPONENT_STACK_RE=/^(?:in|at)\s+(?<name>[^\s(]+)(?:\s+\((?<fileName>[^\s:)]+):(?<line>\d+)(?::(?<column>\d+))?\))?/u;function parseReactComponentStack(componentStack){let frames=[];for(let rawLine of componentStack.split(`
|
|
2
|
+
`)){let line=rawLine.trim();if(!line)continue;let match=COMPONENT_STACK_RE.exec(line);if(!match)continue;let[,name,fileName,lineStr,colStr]=match;if(!name)continue;let frame={fn:name,id:`react-${frames.length}`};fileName&&(frame.file=fileName),lineStr&&(frame.line=Number(lineStr)),colStr&&(frame.column=Number(colStr)),frames.push(frame)}return frames}function toError(error){return error instanceof Error?error:typeof error==`string`?Error(error):typeof error==`object`&&error?tryUnwrapNestedError(error)||tagAsNonError(safeJson(error)??Object.prototype.toString.call(error)):tagAsNonError(String(error))}function tryUnwrapNestedError(record){if(`cause`in record&&record.cause instanceof Error)return record.cause;for(let value of Object.values(record))if(value instanceof Error)return value}function tagAsNonError(message){let e=Error(message);return e.name=`NonError`,e}function safeJson(value){try{return JSON.stringify(value)}catch{return null}}function classify(value){if(value===null)return`null`;let t=typeof value;if(t!==`object`)return t;let tag=Object.prototype.toString.call(value).slice(8,-1);return tag===`Object`?`PlainObject`:tag}function describe(value){if(value==null)return`Non-Error captured: ${String(value)}`;if(typeof value==`object`){let keys=Object.keys(value).toSorted();return keys.length===0?`Non-Error captured: empty object`:`Non-Error captured with keys: ${keys.join(`, `)}`}return typeof value==`function`?`Non-Error captured: ${Function.prototype.toString.call(value)}`:typeof value==`string`||typeof value==`number`||typeof value==`boolean`||typeof value==`bigint`||typeof value==`symbol`?`Non-Error captured: ${String(value)}`:`Non-Error captured`}function serializeBoundedDepth(value,maxDepth){let seen=new WeakSet,walk=(current,depth)=>{if(current===null)return null;if(typeof current==`string`||typeof current==`number`||typeof current==`boolean`)return current;if(current===void 0)return;if(typeof current==`function`)return current.toString();if(typeof current==`symbol`||typeof current==`bigint`)return String(current);if(depth>maxDepth)return`[depth-limit]`;if(seen.has(current))return`[circular]`;if(seen.add(current),Array.isArray(current))return current.map(item=>walk(item,depth+1));let out={};for(let[k,v]of Object.entries(current))out[k]=walk(v,depth+1);return out};return walk(value,0)}function toException(value){if(value instanceof Error)return value;if(typeof value==`string`)return Error(value);if(typeof value==`object`&&value){let nested=tryUnwrapNestedError(value);if(nested)return nested}return{kind:`non-error`,serialized:serializeBoundedDepth(value,4),type:classify(value),value:describe(value)}}function isNonErrorException(value){return typeof value==`object`&&!!value&&`kind`in value&&value.kind===`non-error`}function toExceptions(value,mechanism){if(isNonErrorException(value))return[{kind:`non-error`,mechanism,serialized:value.serialized,type:value.type,value:value.value}];let exceptions=[],current=value;for(let depth=0;current&&depth<5;depth+=1)exceptions.push({kind:`error`,mechanism:depth===0?mechanism:void 0,stack:current.stack??``,type:current.name,value:current.message}),current=current.cause instanceof Error?current.cause:void 0;return exceptions}exports.MECHANISM_TYPE=MECHANISM_TYPE,exports.isNonErrorException=isNonErrorException,exports.parseReactComponentStack=parseReactComponentStack,exports.shouldDropBrowserExtensionNoise=shouldDropBrowserExtensionNoise,exports.shouldDropUnresolvableStack=shouldDropUnresolvableStack,exports.toError=toError,exports.toException=toException,exports.toExceptions=toExceptions;
|
package/dist/sdk/errors.d.cts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ErrorMechanism, ExceptionValue } from "#sdk/plugins/payload/errors";
|
|
1
|
+
import { ErrorMechanism } from "#sdk/plugins/payload/errors";
|
|
3
2
|
//#region src/sdk/errors.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* Structured taxonomy of capture sources, tagged onto each
|
|
@@ -15,28 +14,25 @@ import { ErrorMechanism, ExceptionValue } from "#sdk/plugins/payload/errors";
|
|
|
15
14
|
* the specific capture site, which lets Interfere's skill classifier reason
|
|
16
15
|
* about what "kind" of event this is without string-matching loose names.
|
|
17
16
|
*/
|
|
18
|
-
declare const MECHANISM_TYPE: {
|
|
17
|
+
export declare const MECHANISM_TYPE: {
|
|
19
18
|
readonly browser: {
|
|
20
|
-
readonly onerror: "auto.browser.global_handlers.onerror";
|
|
21
|
-
readonly onunhandledrejection: "auto.browser.global_handlers.onunhandledrejection";
|
|
22
19
|
readonly consoleError: "auto.browser.console.error";
|
|
23
20
|
readonly fetchFailedResponse: "auto.browser.fetch.failed_response";
|
|
24
21
|
readonly fetchNetworkError: "auto.browser.fetch.network_error";
|
|
22
|
+
readonly onerror: "auto.browser.global_handlers.onerror";
|
|
23
|
+
readonly onunhandledrejection: "auto.browser.global_handlers.onunhandledrejection";
|
|
24
|
+
readonly resourceError: "auto.browser.resource.error";
|
|
25
|
+
readonly securityPolicyViolation: "auto.browser.security_policy.violation";
|
|
25
26
|
readonly xhrFailedResponse: "auto.browser.xhr.failed_response";
|
|
26
27
|
readonly xhrNetworkError: "auto.browser.xhr.network_error";
|
|
27
|
-
readonly securityPolicyViolation: "auto.browser.security_policy.violation";
|
|
28
|
-
readonly resourceError: "auto.browser.resource.error";
|
|
29
28
|
};
|
|
30
|
-
readonly
|
|
31
|
-
|
|
32
|
-
readonly
|
|
33
|
-
readonly caughtError: "auto.function.react.caught_error";
|
|
34
|
-
readonly uncaughtError: "auto.function.react.uncaught_error";
|
|
35
|
-
readonly recoverableError: "auto.function.react.recoverable_error";
|
|
29
|
+
readonly manual: {
|
|
30
|
+
/** Customer called `capture(error)` from `@interfere/react/api`. */
|
|
31
|
+
readonly capture: "manual.api.capture";
|
|
36
32
|
};
|
|
37
33
|
readonly nextjs: {
|
|
38
|
-
readonly onRequestError: "auto.function.nextjs.on_request_error";
|
|
39
34
|
readonly captureError: "auto.function.nextjs.capture_error";
|
|
35
|
+
readonly onRequestError: "auto.function.nextjs.on_request_error";
|
|
40
36
|
readonly proxy: "auto.function.nextjs.proxy";
|
|
41
37
|
readonly routeHandler: "auto.function.nextjs.route_handler";
|
|
42
38
|
readonly serverAction: "auto.function.nextjs.server_action";
|
|
@@ -46,9 +42,12 @@ declare const MECHANISM_TYPE: {
|
|
|
46
42
|
readonly uncaughtException: "auto.node.global_handlers.uncaught_exception";
|
|
47
43
|
readonly unhandledRejection: "auto.node.global_handlers.unhandled_rejection";
|
|
48
44
|
};
|
|
49
|
-
readonly
|
|
50
|
-
|
|
51
|
-
readonly
|
|
45
|
+
readonly react: {
|
|
46
|
+
readonly captureBoundary: "auto.function.react.capture_boundary";
|
|
47
|
+
readonly caughtError: "auto.function.react.caught_error";
|
|
48
|
+
readonly errorBoundary: "auto.function.react.error_boundary";
|
|
49
|
+
readonly recoverableError: "auto.function.react.recoverable_error";
|
|
50
|
+
readonly uncaughtError: "auto.function.react.uncaught_error";
|
|
52
51
|
};
|
|
53
52
|
};
|
|
54
53
|
/**
|
|
@@ -64,14 +63,14 @@ declare const MECHANISM_TYPE: {
|
|
|
64
63
|
* over the raw string is sufficient and avoids pulling a parser into
|
|
65
64
|
* the customer bundle.
|
|
66
65
|
*/
|
|
67
|
-
declare function shouldDropBrowserExtensionNoise(stacks: readonly string[]): boolean;
|
|
66
|
+
export declare function shouldDropBrowserExtensionNoise(stacks: readonly string[]): boolean;
|
|
68
67
|
/**
|
|
69
68
|
* True when **none** of the supplied stacks (head + cause chain entries)
|
|
70
69
|
* carries any source-location anchor. Non-Error rejections (no stack at
|
|
71
70
|
* all) are exempt at the call site — they ship structured payloads the
|
|
72
71
|
* agent can reason over without frames.
|
|
73
72
|
*/
|
|
74
|
-
declare function shouldDropUnresolvableStack(stacks: readonly string[]): boolean;
|
|
73
|
+
export declare function shouldDropUnresolvableStack(stacks: readonly string[]): boolean;
|
|
75
74
|
/**
|
|
76
75
|
* Parses a React `errorInfo.componentStack` string into synthetic frames.
|
|
77
76
|
* Server-side stack parsing handles JS frames; component-stack frames are
|
|
@@ -84,7 +83,15 @@ declare function shouldDropUnresolvableStack(stacks: readonly string[]): boolean
|
|
|
84
83
|
* - React 19 owner stacks: ` at ComponentName`
|
|
85
84
|
* ` at ComponentName (file.tsx:10:5)`
|
|
86
85
|
*/
|
|
87
|
-
declare function parseReactComponentStack(componentStack: string):
|
|
86
|
+
export declare function parseReactComponentStack(componentStack: string): {
|
|
87
|
+
column?: number | undefined;
|
|
88
|
+
debugId?: string | undefined;
|
|
89
|
+
file?: string | undefined;
|
|
90
|
+
fn?: string | undefined;
|
|
91
|
+
id?: string | undefined;
|
|
92
|
+
line?: number | undefined;
|
|
93
|
+
source?: string | undefined;
|
|
94
|
+
}[];
|
|
88
95
|
/**
|
|
89
96
|
* Coerces any thrown value into an `Error` instance, preferring a nested
|
|
90
97
|
* `Error` inside a plain-object rejection over a stringified fallback.
|
|
@@ -98,7 +105,7 @@ declare function parseReactComponentStack(componentStack: string): IngestedFrame
|
|
|
98
105
|
* found (in declaration order) wins. `cause` is preferred if present, since
|
|
99
106
|
* it's the documented ES2022 convention.
|
|
100
107
|
*/
|
|
101
|
-
declare function toError(error: unknown): Error;
|
|
108
|
+
export declare function toError(error: unknown): Error;
|
|
102
109
|
/**
|
|
103
110
|
* Capture-side variant for thrown values that aren't Errors and don't
|
|
104
111
|
* carry a nested Error (e.g. `Promise.reject({ code: 401, body: "..." })`,
|
|
@@ -110,7 +117,7 @@ declare function toError(error: unknown): Error;
|
|
|
110
117
|
* cleanly to `new Error("boom")` without lying about the shape, so it
|
|
111
118
|
* goes through `toException`'s Error branch.
|
|
112
119
|
*/
|
|
113
|
-
interface NonErrorException {
|
|
120
|
+
export interface NonErrorException {
|
|
114
121
|
readonly kind: "non-error";
|
|
115
122
|
/**
|
|
116
123
|
* Original payload, depth-bounded and circular-safe. Anything beyond
|
|
@@ -132,6 +139,17 @@ interface NonErrorException {
|
|
|
132
139
|
*/
|
|
133
140
|
readonly value: string;
|
|
134
141
|
}
|
|
142
|
+
/**
|
|
143
|
+
* Depth-bounded, circular-safe clone. Primitives + null/undefined pass
|
|
144
|
+
* through as-is. Objects and arrays recurse up to `MAX_NON_ERROR_DEPTH`
|
|
145
|
+
* before collapsing to `DEPTH_LIMIT_SENTINEL`; back-edges become
|
|
146
|
+
* `CIRCULAR_SENTINEL`. Functions, symbols, and other non-serialisable
|
|
147
|
+
* values are coerced via `String(...)` so the dashboard can render
|
|
148
|
+
* something rather than dropping the field.
|
|
149
|
+
*/
|
|
150
|
+
type SerializedException = null | undefined | string | number | boolean | SerializedException[] | {
|
|
151
|
+
[key: string]: SerializedException;
|
|
152
|
+
};
|
|
135
153
|
/**
|
|
136
154
|
* Coerces any thrown value into either an `Error` (when one is
|
|
137
155
|
* recoverable — direct Error, or nested Error inside an object via
|
|
@@ -144,19 +162,43 @@ interface NonErrorException {
|
|
|
144
162
|
* specifically need an `Error` (`<ErrorBoundary>` interop, browser
|
|
145
163
|
* APIs that take Error-typed args).
|
|
146
164
|
*/
|
|
147
|
-
declare function toException(value: unknown): Error |
|
|
148
|
-
|
|
165
|
+
export declare function toException(value: unknown): Error | {
|
|
166
|
+
kind: "non-error";
|
|
167
|
+
serialized: SerializedException;
|
|
168
|
+
type: string;
|
|
169
|
+
value: string;
|
|
170
|
+
};
|
|
171
|
+
export declare function isNonErrorException(value: unknown): value is NonErrorException;
|
|
149
172
|
/**
|
|
150
173
|
* Walks `Error.cause` to flatten the chain into the wire shape the
|
|
151
174
|
* collector expects. Each entry carries `type` / `value` / `mechanism?`
|
|
152
175
|
* plus the raw `stack` string — the SDK ships **no parsed frames**.
|
|
153
176
|
* Server-side ingest parses `stack` into structured `IngestedFrame[]`
|
|
154
177
|
* via the collector's stack parser (see
|
|
155
|
-
* `src/
|
|
178
|
+
* `src/packages/private/otlp-ingest/src/stack-parser.ts`).
|
|
156
179
|
*
|
|
157
180
|
* Non-Error rejections short-circuit to a single `kind: "non-error"`
|
|
158
181
|
* entry with the structured payload on `serialized`.
|
|
159
182
|
*/
|
|
160
|
-
declare function toExceptions(value: Error | NonErrorException, mechanism: ErrorMechanism):
|
|
161
|
-
|
|
162
|
-
|
|
183
|
+
export declare function toExceptions(value: Error | NonErrorException, mechanism: ErrorMechanism): ({
|
|
184
|
+
kind: "error";
|
|
185
|
+
mechanism?: {
|
|
186
|
+
handled: boolean;
|
|
187
|
+
synthetic?: boolean | undefined;
|
|
188
|
+
type: string;
|
|
189
|
+
} | undefined;
|
|
190
|
+
stack: string;
|
|
191
|
+
type: string;
|
|
192
|
+
value: string;
|
|
193
|
+
} | {
|
|
194
|
+
kind: "non-error";
|
|
195
|
+
mechanism?: {
|
|
196
|
+
handled: boolean;
|
|
197
|
+
synthetic?: boolean | undefined;
|
|
198
|
+
type: string;
|
|
199
|
+
} | undefined;
|
|
200
|
+
serialized: unknown;
|
|
201
|
+
type: string;
|
|
202
|
+
value: string;
|
|
203
|
+
})[];
|
|
204
|
+
//#endregion
|
package/dist/sdk/errors.d.mts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ErrorMechanism, ExceptionValue } from "#sdk/plugins/payload/errors";
|
|
1
|
+
import { ErrorMechanism } from "#sdk/plugins/payload/errors";
|
|
3
2
|
//#region src/sdk/errors.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* Structured taxonomy of capture sources, tagged onto each
|
|
@@ -15,28 +14,25 @@ import { ErrorMechanism, ExceptionValue } from "#sdk/plugins/payload/errors";
|
|
|
15
14
|
* the specific capture site, which lets Interfere's skill classifier reason
|
|
16
15
|
* about what "kind" of event this is without string-matching loose names.
|
|
17
16
|
*/
|
|
18
|
-
declare const MECHANISM_TYPE: {
|
|
17
|
+
export declare const MECHANISM_TYPE: {
|
|
19
18
|
readonly browser: {
|
|
20
|
-
readonly onerror: "auto.browser.global_handlers.onerror";
|
|
21
|
-
readonly onunhandledrejection: "auto.browser.global_handlers.onunhandledrejection";
|
|
22
19
|
readonly consoleError: "auto.browser.console.error";
|
|
23
20
|
readonly fetchFailedResponse: "auto.browser.fetch.failed_response";
|
|
24
21
|
readonly fetchNetworkError: "auto.browser.fetch.network_error";
|
|
22
|
+
readonly onerror: "auto.browser.global_handlers.onerror";
|
|
23
|
+
readonly onunhandledrejection: "auto.browser.global_handlers.onunhandledrejection";
|
|
24
|
+
readonly resourceError: "auto.browser.resource.error";
|
|
25
|
+
readonly securityPolicyViolation: "auto.browser.security_policy.violation";
|
|
25
26
|
readonly xhrFailedResponse: "auto.browser.xhr.failed_response";
|
|
26
27
|
readonly xhrNetworkError: "auto.browser.xhr.network_error";
|
|
27
|
-
readonly securityPolicyViolation: "auto.browser.security_policy.violation";
|
|
28
|
-
readonly resourceError: "auto.browser.resource.error";
|
|
29
28
|
};
|
|
30
|
-
readonly
|
|
31
|
-
|
|
32
|
-
readonly
|
|
33
|
-
readonly caughtError: "auto.function.react.caught_error";
|
|
34
|
-
readonly uncaughtError: "auto.function.react.uncaught_error";
|
|
35
|
-
readonly recoverableError: "auto.function.react.recoverable_error";
|
|
29
|
+
readonly manual: {
|
|
30
|
+
/** Customer called `capture(error)` from `@interfere/react/api`. */
|
|
31
|
+
readonly capture: "manual.api.capture";
|
|
36
32
|
};
|
|
37
33
|
readonly nextjs: {
|
|
38
|
-
readonly onRequestError: "auto.function.nextjs.on_request_error";
|
|
39
34
|
readonly captureError: "auto.function.nextjs.capture_error";
|
|
35
|
+
readonly onRequestError: "auto.function.nextjs.on_request_error";
|
|
40
36
|
readonly proxy: "auto.function.nextjs.proxy";
|
|
41
37
|
readonly routeHandler: "auto.function.nextjs.route_handler";
|
|
42
38
|
readonly serverAction: "auto.function.nextjs.server_action";
|
|
@@ -46,9 +42,12 @@ declare const MECHANISM_TYPE: {
|
|
|
46
42
|
readonly uncaughtException: "auto.node.global_handlers.uncaught_exception";
|
|
47
43
|
readonly unhandledRejection: "auto.node.global_handlers.unhandled_rejection";
|
|
48
44
|
};
|
|
49
|
-
readonly
|
|
50
|
-
|
|
51
|
-
readonly
|
|
45
|
+
readonly react: {
|
|
46
|
+
readonly captureBoundary: "auto.function.react.capture_boundary";
|
|
47
|
+
readonly caughtError: "auto.function.react.caught_error";
|
|
48
|
+
readonly errorBoundary: "auto.function.react.error_boundary";
|
|
49
|
+
readonly recoverableError: "auto.function.react.recoverable_error";
|
|
50
|
+
readonly uncaughtError: "auto.function.react.uncaught_error";
|
|
52
51
|
};
|
|
53
52
|
};
|
|
54
53
|
/**
|
|
@@ -64,14 +63,14 @@ declare const MECHANISM_TYPE: {
|
|
|
64
63
|
* over the raw string is sufficient and avoids pulling a parser into
|
|
65
64
|
* the customer bundle.
|
|
66
65
|
*/
|
|
67
|
-
declare function shouldDropBrowserExtensionNoise(stacks: readonly string[]): boolean;
|
|
66
|
+
export declare function shouldDropBrowserExtensionNoise(stacks: readonly string[]): boolean;
|
|
68
67
|
/**
|
|
69
68
|
* True when **none** of the supplied stacks (head + cause chain entries)
|
|
70
69
|
* carries any source-location anchor. Non-Error rejections (no stack at
|
|
71
70
|
* all) are exempt at the call site — they ship structured payloads the
|
|
72
71
|
* agent can reason over without frames.
|
|
73
72
|
*/
|
|
74
|
-
declare function shouldDropUnresolvableStack(stacks: readonly string[]): boolean;
|
|
73
|
+
export declare function shouldDropUnresolvableStack(stacks: readonly string[]): boolean;
|
|
75
74
|
/**
|
|
76
75
|
* Parses a React `errorInfo.componentStack` string into synthetic frames.
|
|
77
76
|
* Server-side stack parsing handles JS frames; component-stack frames are
|
|
@@ -84,7 +83,15 @@ declare function shouldDropUnresolvableStack(stacks: readonly string[]): boolean
|
|
|
84
83
|
* - React 19 owner stacks: ` at ComponentName`
|
|
85
84
|
* ` at ComponentName (file.tsx:10:5)`
|
|
86
85
|
*/
|
|
87
|
-
declare function parseReactComponentStack(componentStack: string):
|
|
86
|
+
export declare function parseReactComponentStack(componentStack: string): {
|
|
87
|
+
column?: number | undefined;
|
|
88
|
+
debugId?: string | undefined;
|
|
89
|
+
file?: string | undefined;
|
|
90
|
+
fn?: string | undefined;
|
|
91
|
+
id?: string | undefined;
|
|
92
|
+
line?: number | undefined;
|
|
93
|
+
source?: string | undefined;
|
|
94
|
+
}[];
|
|
88
95
|
/**
|
|
89
96
|
* Coerces any thrown value into an `Error` instance, preferring a nested
|
|
90
97
|
* `Error` inside a plain-object rejection over a stringified fallback.
|
|
@@ -98,7 +105,7 @@ declare function parseReactComponentStack(componentStack: string): IngestedFrame
|
|
|
98
105
|
* found (in declaration order) wins. `cause` is preferred if present, since
|
|
99
106
|
* it's the documented ES2022 convention.
|
|
100
107
|
*/
|
|
101
|
-
declare function toError(error: unknown): Error;
|
|
108
|
+
export declare function toError(error: unknown): Error;
|
|
102
109
|
/**
|
|
103
110
|
* Capture-side variant for thrown values that aren't Errors and don't
|
|
104
111
|
* carry a nested Error (e.g. `Promise.reject({ code: 401, body: "..." })`,
|
|
@@ -110,7 +117,7 @@ declare function toError(error: unknown): Error;
|
|
|
110
117
|
* cleanly to `new Error("boom")` without lying about the shape, so it
|
|
111
118
|
* goes through `toException`'s Error branch.
|
|
112
119
|
*/
|
|
113
|
-
interface NonErrorException {
|
|
120
|
+
export interface NonErrorException {
|
|
114
121
|
readonly kind: "non-error";
|
|
115
122
|
/**
|
|
116
123
|
* Original payload, depth-bounded and circular-safe. Anything beyond
|
|
@@ -132,6 +139,17 @@ interface NonErrorException {
|
|
|
132
139
|
*/
|
|
133
140
|
readonly value: string;
|
|
134
141
|
}
|
|
142
|
+
/**
|
|
143
|
+
* Depth-bounded, circular-safe clone. Primitives + null/undefined pass
|
|
144
|
+
* through as-is. Objects and arrays recurse up to `MAX_NON_ERROR_DEPTH`
|
|
145
|
+
* before collapsing to `DEPTH_LIMIT_SENTINEL`; back-edges become
|
|
146
|
+
* `CIRCULAR_SENTINEL`. Functions, symbols, and other non-serialisable
|
|
147
|
+
* values are coerced via `String(...)` so the dashboard can render
|
|
148
|
+
* something rather than dropping the field.
|
|
149
|
+
*/
|
|
150
|
+
type SerializedException = null | undefined | string | number | boolean | SerializedException[] | {
|
|
151
|
+
[key: string]: SerializedException;
|
|
152
|
+
};
|
|
135
153
|
/**
|
|
136
154
|
* Coerces any thrown value into either an `Error` (when one is
|
|
137
155
|
* recoverable — direct Error, or nested Error inside an object via
|
|
@@ -144,19 +162,43 @@ interface NonErrorException {
|
|
|
144
162
|
* specifically need an `Error` (`<ErrorBoundary>` interop, browser
|
|
145
163
|
* APIs that take Error-typed args).
|
|
146
164
|
*/
|
|
147
|
-
declare function toException(value: unknown): Error |
|
|
148
|
-
|
|
165
|
+
export declare function toException(value: unknown): Error | {
|
|
166
|
+
kind: "non-error";
|
|
167
|
+
serialized: SerializedException;
|
|
168
|
+
type: string;
|
|
169
|
+
value: string;
|
|
170
|
+
};
|
|
171
|
+
export declare function isNonErrorException(value: unknown): value is NonErrorException;
|
|
149
172
|
/**
|
|
150
173
|
* Walks `Error.cause` to flatten the chain into the wire shape the
|
|
151
174
|
* collector expects. Each entry carries `type` / `value` / `mechanism?`
|
|
152
175
|
* plus the raw `stack` string — the SDK ships **no parsed frames**.
|
|
153
176
|
* Server-side ingest parses `stack` into structured `IngestedFrame[]`
|
|
154
177
|
* via the collector's stack parser (see
|
|
155
|
-
* `src/
|
|
178
|
+
* `src/packages/private/otlp-ingest/src/stack-parser.ts`).
|
|
156
179
|
*
|
|
157
180
|
* Non-Error rejections short-circuit to a single `kind: "non-error"`
|
|
158
181
|
* entry with the structured payload on `serialized`.
|
|
159
182
|
*/
|
|
160
|
-
declare function toExceptions(value: Error | NonErrorException, mechanism: ErrorMechanism):
|
|
161
|
-
|
|
162
|
-
|
|
183
|
+
export declare function toExceptions(value: Error | NonErrorException, mechanism: ErrorMechanism): ({
|
|
184
|
+
kind: "error";
|
|
185
|
+
mechanism?: {
|
|
186
|
+
handled: boolean;
|
|
187
|
+
synthetic?: boolean | undefined;
|
|
188
|
+
type: string;
|
|
189
|
+
} | undefined;
|
|
190
|
+
stack: string;
|
|
191
|
+
type: string;
|
|
192
|
+
value: string;
|
|
193
|
+
} | {
|
|
194
|
+
kind: "non-error";
|
|
195
|
+
mechanism?: {
|
|
196
|
+
handled: boolean;
|
|
197
|
+
synthetic?: boolean | undefined;
|
|
198
|
+
type: string;
|
|
199
|
+
} | undefined;
|
|
200
|
+
serialized: unknown;
|
|
201
|
+
type: string;
|
|
202
|
+
value: string;
|
|
203
|
+
})[];
|
|
204
|
+
//#endregion
|
package/dist/sdk/errors.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const MECHANISM_TYPE={browser:{
|
|
2
|
-
`)){let line=rawLine.trim();if(!line)continue;let match=COMPONENT_STACK_RE.exec(line);if(!match)continue;let[,name,fileName,lineStr,colStr]=match;if(!name)continue;let frame={id:`react-${frames.length}
|
|
1
|
+
const MECHANISM_TYPE={browser:{consoleError:`auto.browser.console.error`,fetchFailedResponse:`auto.browser.fetch.failed_response`,fetchNetworkError:`auto.browser.fetch.network_error`,onerror:`auto.browser.global_handlers.onerror`,onunhandledrejection:`auto.browser.global_handlers.onunhandledrejection`,resourceError:`auto.browser.resource.error`,securityPolicyViolation:`auto.browser.security_policy.violation`,xhrFailedResponse:`auto.browser.xhr.failed_response`,xhrNetworkError:`auto.browser.xhr.network_error`},manual:{capture:`manual.api.capture`},nextjs:{captureError:`auto.function.nextjs.capture_error`,onRequestError:`auto.function.nextjs.on_request_error`,proxy:`auto.function.nextjs.proxy`,routeHandler:`auto.function.nextjs.route_handler`,serverAction:`auto.function.nextjs.server_action`},node:{captureError:`auto.function.node.capture_error`,uncaughtException:`auto.node.global_handlers.uncaught_exception`,unhandledRejection:`auto.node.global_handlers.unhandled_rejection`},react:{captureBoundary:`auto.function.react.capture_boundary`,caughtError:`auto.function.react.caught_error`,errorBoundary:`auto.function.react.error_boundary`,recoverableError:`auto.function.react.recoverable_error`,uncaughtError:`auto.function.react.uncaught_error`}},EXTENSION_URL_RE=/\b(?:chrome|moz|safari-web|safari|ms-browser|webkit-masked)-(?:extension|url):\/\//u;function shouldDropBrowserExtensionNoise(stacks){return stacks.some(stack=>EXTENSION_URL_RE.test(stack))}const HAS_SOURCE_LOCATION_RE=/(?:https?|file|blob|webpack-internal):\/\/|\sat\s+[\w$.<>]+\s+\([^)]+:\d/u;function shouldDropUnresolvableStack(stacks){if(stacks.length===0)return!1;for(let stack of stacks)if(HAS_SOURCE_LOCATION_RE.test(stack))return!1;return!0}const COMPONENT_STACK_RE=/^(?:in|at)\s+(?<name>[^\s(]+)(?:\s+\((?<fileName>[^\s:)]+):(?<line>\d+)(?::(?<column>\d+))?\))?/u;function parseReactComponentStack(componentStack){let frames=[];for(let rawLine of componentStack.split(`
|
|
2
|
+
`)){let line=rawLine.trim();if(!line)continue;let match=COMPONENT_STACK_RE.exec(line);if(!match)continue;let[,name,fileName,lineStr,colStr]=match;if(!name)continue;let frame={fn:name,id:`react-${frames.length}`};fileName&&(frame.file=fileName),lineStr&&(frame.line=Number(lineStr)),colStr&&(frame.column=Number(colStr)),frames.push(frame)}return frames}function toError(error){return error instanceof Error?error:typeof error==`string`?Error(error):typeof error==`object`&&error?tryUnwrapNestedError(error)||tagAsNonError(safeJson(error)??Object.prototype.toString.call(error)):tagAsNonError(String(error))}function tryUnwrapNestedError(record){if(`cause`in record&&record.cause instanceof Error)return record.cause;for(let value of Object.values(record))if(value instanceof Error)return value}function tagAsNonError(message){let e=Error(message);return e.name=`NonError`,e}function safeJson(value){try{return JSON.stringify(value)}catch{return null}}function classify(value){if(value===null)return`null`;let t=typeof value;if(t!==`object`)return t;let tag=Object.prototype.toString.call(value).slice(8,-1);return tag===`Object`?`PlainObject`:tag}function describe(value){if(value==null)return`Non-Error captured: ${String(value)}`;if(typeof value==`object`){let keys=Object.keys(value).toSorted();return keys.length===0?`Non-Error captured: empty object`:`Non-Error captured with keys: ${keys.join(`, `)}`}return typeof value==`function`?`Non-Error captured: ${Function.prototype.toString.call(value)}`:typeof value==`string`||typeof value==`number`||typeof value==`boolean`||typeof value==`bigint`||typeof value==`symbol`?`Non-Error captured: ${String(value)}`:`Non-Error captured`}function serializeBoundedDepth(value,maxDepth){let seen=new WeakSet,walk=(current,depth)=>{if(current===null)return null;if(typeof current==`string`||typeof current==`number`||typeof current==`boolean`)return current;if(current===void 0)return;if(typeof current==`function`)return current.toString();if(typeof current==`symbol`||typeof current==`bigint`)return String(current);if(depth>maxDepth)return`[depth-limit]`;if(seen.has(current))return`[circular]`;if(seen.add(current),Array.isArray(current))return current.map(item=>walk(item,depth+1));let out={};for(let[k,v]of Object.entries(current))out[k]=walk(v,depth+1);return out};return walk(value,0)}function toException(value){if(value instanceof Error)return value;if(typeof value==`string`)return Error(value);if(typeof value==`object`&&value){let nested=tryUnwrapNestedError(value);if(nested)return nested}return{kind:`non-error`,serialized:serializeBoundedDepth(value,4),type:classify(value),value:describe(value)}}function isNonErrorException(value){return typeof value==`object`&&!!value&&`kind`in value&&value.kind===`non-error`}function toExceptions(value,mechanism){if(isNonErrorException(value))return[{kind:`non-error`,mechanism,serialized:value.serialized,type:value.type,value:value.value}];let exceptions=[],current=value;for(let depth=0;current&&depth<5;depth+=1)exceptions.push({kind:`error`,mechanism:depth===0?mechanism:void 0,stack:current.stack??``,type:current.name,value:current.message}),current=current.cause instanceof Error?current.cause:void 0;return exceptions}export{MECHANISM_TYPE,isNonErrorException,parseReactComponentStack,shouldDropBrowserExtensionNoise,shouldDropUnresolvableStack,toError,toException,toExceptions};
|
package/dist/sdk/geo.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let zod=require("zod");const cloudflareTraceSchema=zod.z.object({loc:zod.z.string().length(2)}).loose(),GEO_COUNTRY_HEADERS=[`cf-ipcountry`,`x-vercel-ip-country`,`x-country-code`];function extractCountryHeader(request){for(let header of GEO_COUNTRY_HEADERS){let value=request.headers.get(header);if(value
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let zod=require("zod");const cloudflareTraceSchema=zod.z.object({loc:zod.z.string().length(2)}).loose(),GEO_COUNTRY_HEADERS=[`cf-ipcountry`,`x-vercel-ip-country`,`x-country-code`];function extractCountryHeader(request){for(let header of GEO_COUNTRY_HEADERS){let value=request.headers.get(header);if(value?.length===2)return value.toUpperCase()}return null}exports.cloudflareTraceSchema=cloudflareTraceSchema,exports.extractCountryHeader=extractCountryHeader;
|
package/dist/sdk/geo.d.cts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
//#region src/sdk/geo.d.ts
|
|
3
|
-
declare const cloudflareTraceSchema: z.ZodObject<{
|
|
3
|
+
export declare const cloudflareTraceSchema: z.ZodObject<{
|
|
4
4
|
loc: z.ZodString;
|
|
5
5
|
}, z.core.$loose>;
|
|
6
|
-
type CloudflareTrace = z.infer<typeof cloudflareTraceSchema>;
|
|
7
|
-
declare function extractCountryHeader(request: Request): string | null;
|
|
8
|
-
//#endregion
|
|
9
|
-
export { CloudflareTrace, cloudflareTraceSchema, extractCountryHeader };
|
|
6
|
+
export type CloudflareTrace = z.infer<typeof cloudflareTraceSchema>;
|
|
7
|
+
export declare function extractCountryHeader(request: Request): string | null;
|
|
8
|
+
//#endregion
|
package/dist/sdk/geo.d.mts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
//#region src/sdk/geo.d.ts
|
|
3
|
-
declare const cloudflareTraceSchema: z.ZodObject<{
|
|
3
|
+
export declare const cloudflareTraceSchema: z.ZodObject<{
|
|
4
4
|
loc: z.ZodString;
|
|
5
5
|
}, z.core.$loose>;
|
|
6
|
-
type CloudflareTrace = z.infer<typeof cloudflareTraceSchema>;
|
|
7
|
-
declare function extractCountryHeader(request: Request): string | null;
|
|
8
|
-
//#endregion
|
|
9
|
-
export { CloudflareTrace, cloudflareTraceSchema, extractCountryHeader };
|
|
6
|
+
export type CloudflareTrace = z.infer<typeof cloudflareTraceSchema>;
|
|
7
|
+
export declare function extractCountryHeader(request: Request): string | null;
|
|
8
|
+
//#endregion
|
package/dist/sdk/geo.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z}from"zod";const cloudflareTraceSchema=z.object({loc:z.string().length(2)}).loose(),GEO_COUNTRY_HEADERS=[`cf-ipcountry`,`x-vercel-ip-country`,`x-country-code`];function extractCountryHeader(request){for(let header of GEO_COUNTRY_HEADERS){let value=request.headers.get(header);if(value
|
|
1
|
+
import{z}from"zod";const cloudflareTraceSchema=z.object({loc:z.string().length(2)}).loose(),GEO_COUNTRY_HEADERS=[`cf-ipcountry`,`x-vercel-ip-country`,`x-country-code`];function extractCountryHeader(request){for(let header of GEO_COUNTRY_HEADERS){let value=request.headers.get(header);if(value?.length===2)return value.toUpperCase()}return null}export{cloudflareTraceSchema,extractCountryHeader};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const require_integrations_index=require("../integrations/index.cjs"),require_sdk_env=require("./env.cjs");function resolveReleaseCommitSha(env,runGit){return require_sdk_env.readFirstEnvValue(env,require_integrations_index.releaseSourceIdEnvKeys)??runGit(`git rev-parse HEAD`)}function resolveGithubReleaseSource(env,runGit){return{
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const require_integrations_index=require("../integrations/index.cjs"),require_sdk_env=require("./env.cjs");function resolveReleaseCommitSha(env,runGit){return require_sdk_env.readFirstEnvValue(env,require_integrations_index.releaseSourceIdEnvKeys)??runGit(`git rev-parse HEAD`)}function resolveGithubReleaseSource(env,runGit){return{branch:require_sdk_env.parseEnvValue(env.VERCEL_GIT_COMMIT_REF)??require_sdk_env.parseEnvValue(env.GITHUB_REF_NAME)??require_sdk_env.parseEnvValue(env.GITHUB_HEAD_REF)??runGit(`git rev-parse --abbrev-ref HEAD`)??`unknown`,commitMessage:require_sdk_env.parseEnvValue(env.VERCEL_GIT_COMMIT_MESSAGE)??runGit(`git log -1 --pretty=%B`)??``,commitSha:resolveReleaseCommitSha(env,runGit),provider:`github`}}exports.resolveGithubReleaseSource=resolveGithubReleaseSource,exports.resolveReleaseCommitSha=resolveReleaseCommitSha;
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { ReleaseSourceMetadata } from "../integrations/index.cjs";
|
|
2
1
|
//#region src/sdk/github-source.d.ts
|
|
3
|
-
type GithubReleaseSource = Extract<ReleaseSourceMetadata, {
|
|
4
|
-
provider: "github";
|
|
5
|
-
}>;
|
|
6
2
|
/**
|
|
7
3
|
* Runs a git command, returning `null` when git is unavailable. Injected
|
|
8
4
|
* rather than imported so this module stays free of `node:child_process` —
|
|
9
5
|
* it is reachable from bundles that never run in Node.
|
|
10
6
|
*/
|
|
11
|
-
type RunGitCommand = (command: string) => string | null;
|
|
7
|
+
export type RunGitCommand = (command: string) => string | null;
|
|
12
8
|
/**
|
|
13
9
|
* The single answer to "what commit is this build?". The release slug and
|
|
14
10
|
* `source_metadata.commitSha` must resolve identically or the release
|
|
15
11
|
* registers with a working slug and a null ref, and every source tool 404s
|
|
16
12
|
* against it for the life of that release (ENG-3303).
|
|
17
13
|
*/
|
|
18
|
-
declare function resolveReleaseCommitSha(env: Record<string, string | undefined>, runGit: RunGitCommand): string | null;
|
|
19
|
-
declare function resolveGithubReleaseSource(env: Record<string, string | undefined>, runGit: RunGitCommand):
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
export declare function resolveReleaseCommitSha(env: Record<string, string | undefined>, runGit: RunGitCommand): string | null;
|
|
15
|
+
export declare function resolveGithubReleaseSource(env: Record<string, string | undefined>, runGit: RunGitCommand): {
|
|
16
|
+
branch: string;
|
|
17
|
+
commitMessage: string;
|
|
18
|
+
commitSha: string | null;
|
|
19
|
+
provider: "github";
|
|
20
|
+
};
|
|
21
|
+
//#endregion
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { ReleaseSourceMetadata } from "../integrations/index.mjs";
|
|
2
1
|
//#region src/sdk/github-source.d.ts
|
|
3
|
-
type GithubReleaseSource = Extract<ReleaseSourceMetadata, {
|
|
4
|
-
provider: "github";
|
|
5
|
-
}>;
|
|
6
2
|
/**
|
|
7
3
|
* Runs a git command, returning `null` when git is unavailable. Injected
|
|
8
4
|
* rather than imported so this module stays free of `node:child_process` —
|
|
9
5
|
* it is reachable from bundles that never run in Node.
|
|
10
6
|
*/
|
|
11
|
-
type RunGitCommand = (command: string) => string | null;
|
|
7
|
+
export type RunGitCommand = (command: string) => string | null;
|
|
12
8
|
/**
|
|
13
9
|
* The single answer to "what commit is this build?". The release slug and
|
|
14
10
|
* `source_metadata.commitSha` must resolve identically or the release
|
|
15
11
|
* registers with a working slug and a null ref, and every source tool 404s
|
|
16
12
|
* against it for the life of that release (ENG-3303).
|
|
17
13
|
*/
|
|
18
|
-
declare function resolveReleaseCommitSha(env: Record<string, string | undefined>, runGit: RunGitCommand): string | null;
|
|
19
|
-
declare function resolveGithubReleaseSource(env: Record<string, string | undefined>, runGit: RunGitCommand):
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
export declare function resolveReleaseCommitSha(env: Record<string, string | undefined>, runGit: RunGitCommand): string | null;
|
|
15
|
+
export declare function resolveGithubReleaseSource(env: Record<string, string | undefined>, runGit: RunGitCommand): {
|
|
16
|
+
branch: string;
|
|
17
|
+
commitMessage: string;
|
|
18
|
+
commitSha: string | null;
|
|
19
|
+
provider: "github";
|
|
20
|
+
};
|
|
21
|
+
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{releaseSourceIdEnvKeys}from"../integrations/index.mjs";import{parseEnvValue,readFirstEnvValue}from"./env.mjs";function resolveReleaseCommitSha(env,runGit){return readFirstEnvValue(env,releaseSourceIdEnvKeys)??runGit(`git rev-parse HEAD`)}function resolveGithubReleaseSource(env,runGit){return{
|
|
1
|
+
import{releaseSourceIdEnvKeys}from"../integrations/index.mjs";import{parseEnvValue,readFirstEnvValue}from"./env.mjs";function resolveReleaseCommitSha(env,runGit){return readFirstEnvValue(env,releaseSourceIdEnvKeys)??runGit(`git rev-parse HEAD`)}function resolveGithubReleaseSource(env,runGit){return{branch:parseEnvValue(env.VERCEL_GIT_COMMIT_REF)??parseEnvValue(env.GITHUB_REF_NAME)??parseEnvValue(env.GITHUB_HEAD_REF)??runGit(`git rev-parse --abbrev-ref HEAD`)??`unknown`,commitMessage:parseEnvValue(env.VERCEL_GIT_COMMIT_MESSAGE)??runGit(`git log -1 --pretty=%B`)??``,commitSha:resolveReleaseCommitSha(env,runGit),provider:`github`}}export{resolveGithubReleaseSource,resolveReleaseCommitSha};
|
package/dist/sdk/identify.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let zod=require("zod");const identifySourceSchema=zod.z.discriminatedUnion(`type`,[zod.z.object({
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let zod=require("zod");const identifySourceSchema=zod.z.discriminatedUnion(`type`,[zod.z.object({name:zod.z.literal(`Clerk`),type:zod.z.literal(`clerk`)}).meta({id:`ClerkIdentifySource`,title:`ClerkIdentifySource`}),zod.z.object({name:zod.z.literal(`Auth0`),type:zod.z.literal(`auth0`)}).meta({id:`Auth0IdentifySource`,title:`Auth0IdentifySource`}),zod.z.object({name:zod.z.literal(`WorkOS`),type:zod.z.literal(`workos`)}).meta({id:`WorkOSIdentifySource`,title:`WorkOSIdentifySource`}),zod.z.object({name:zod.z.string(),type:zod.z.literal(`custom`)}).meta({id:`CustomIdentifySource`,title:`CustomIdentifySource`})]).meta({description:`Auth provider that surfaced this identification.`,id:`IdentifySource`,title:`IdentifySource`}),traitsSchema=zod.z.record(zod.z.string(),zod.z.unknown()).meta({description:`Free-form key/value bag of user attributes attached when identifying a session.`,id:`IdentifyTraits`,title:`IdentifyTraits`}),identifyParamsSchema=zod.z.object({avatar:zod.z.string().optional(),email:zod.z.email().optional(),identifier:zod.z.string(),name:zod.z.string().optional(),source:identifySourceSchema,traits:traitsSchema.optional()}).superRefine((params,ctx)=>{params.source.type===`clerk`&&!params.identifier.startsWith(`user_`)&&ctx.addIssue({code:`custom`,message:`Clerk identifiers must be raw Clerk user ids starting with user_.`,path:[`identifier`]})}).meta({description:`User attributes attached when identifying a session.`,id:`IdentifyParams`,title:`IdentifyParams`});exports.identifyParamsSchema=identifyParamsSchema,exports.identifySourceSchema=identifySourceSchema;
|
package/dist/sdk/identify.d.cts
CHANGED
|
@@ -1,39 +1,38 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
//#region src/sdk/identify.d.ts
|
|
3
|
-
declare const identifySourceSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
4
|
-
type: z.ZodLiteral<"clerk">;
|
|
3
|
+
export declare const identifySourceSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
5
4
|
name: z.ZodLiteral<"Clerk">;
|
|
5
|
+
type: z.ZodLiteral<"clerk">;
|
|
6
6
|
}, z.core.$strip>, z.ZodObject<{
|
|
7
|
-
type: z.ZodLiteral<"auth0">;
|
|
8
7
|
name: z.ZodLiteral<"Auth0">;
|
|
8
|
+
type: z.ZodLiteral<"auth0">;
|
|
9
9
|
}, z.core.$strip>, z.ZodObject<{
|
|
10
|
-
type: z.ZodLiteral<"workos">;
|
|
11
10
|
name: z.ZodLiteral<"WorkOS">;
|
|
11
|
+
type: z.ZodLiteral<"workos">;
|
|
12
12
|
}, z.core.$strip>, z.ZodObject<{
|
|
13
|
-
type: z.ZodLiteral<"custom">;
|
|
14
13
|
name: z.ZodString;
|
|
14
|
+
type: z.ZodLiteral<"custom">;
|
|
15
15
|
}, z.core.$strip>], "type">;
|
|
16
|
-
type IdentifySource = z.infer<typeof identifySourceSchema>;
|
|
17
|
-
declare const identifyParamsSchema: z.ZodObject<{
|
|
16
|
+
export type IdentifySource = z.infer<typeof identifySourceSchema>;
|
|
17
|
+
export declare const identifyParamsSchema: z.ZodObject<{
|
|
18
18
|
avatar: z.ZodOptional<z.ZodString>;
|
|
19
19
|
email: z.ZodOptional<z.ZodEmail>;
|
|
20
20
|
identifier: z.ZodString;
|
|
21
21
|
name: z.ZodOptional<z.ZodString>;
|
|
22
22
|
source: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
23
|
-
type: z.ZodLiteral<"clerk">;
|
|
24
23
|
name: z.ZodLiteral<"Clerk">;
|
|
24
|
+
type: z.ZodLiteral<"clerk">;
|
|
25
25
|
}, z.core.$strip>, z.ZodObject<{
|
|
26
|
-
type: z.ZodLiteral<"auth0">;
|
|
27
26
|
name: z.ZodLiteral<"Auth0">;
|
|
27
|
+
type: z.ZodLiteral<"auth0">;
|
|
28
28
|
}, z.core.$strip>, z.ZodObject<{
|
|
29
|
-
type: z.ZodLiteral<"workos">;
|
|
30
29
|
name: z.ZodLiteral<"WorkOS">;
|
|
30
|
+
type: z.ZodLiteral<"workos">;
|
|
31
31
|
}, z.core.$strip>, z.ZodObject<{
|
|
32
|
-
type: z.ZodLiteral<"custom">;
|
|
33
32
|
name: z.ZodString;
|
|
33
|
+
type: z.ZodLiteral<"custom">;
|
|
34
34
|
}, z.core.$strip>], "type">;
|
|
35
35
|
traits: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
36
36
|
}, z.core.$strip>;
|
|
37
|
-
type IdentifyParams = z.infer<typeof identifyParamsSchema>;
|
|
38
|
-
//#endregion
|
|
39
|
-
export { IdentifyParams, IdentifySource, identifyParamsSchema, identifySourceSchema };
|
|
37
|
+
export type IdentifyParams = z.infer<typeof identifyParamsSchema>;
|
|
38
|
+
//#endregion
|