Socket
Socket
Sign inDemoInstall

@sentry/utils

Package Overview
Dependencies
1
Maintainers
11
Versions
470
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 7.92.0 to 7.93.0

cjs/parameterize.js

12

cjs/eventbuilder.js

@@ -127,3 +127,2 @@ Object.defineProperty(exports, '__esModule', { value: true });

level,
message,
};

@@ -145,2 +144,13 @@

if (is.isParameterizedString(message)) {
const { __sentry_template_string__, __sentry_template_values__ } = message;
event.logentry = {
message: __sentry_template_string__,
params: __sentry_template_values__,
};
return event;
}
event.message = message;
return event;

@@ -147,0 +157,0 @@ }

4

cjs/index.js

@@ -36,2 +36,3 @@ Object.defineProperty(exports, '__esModule', { value: true });

const eventbuilder = require('./eventbuilder.js');
const parameterize = require('./parameterize.js');
const anr = require('./anr.js');

@@ -80,2 +81,3 @@ const lru = require('./lru.js');

exports.isNaN = is.isNaN;
exports.isParameterizedString = is.isParameterizedString;
exports.isPlainObject = is.isPlainObject;

@@ -165,3 +167,2 @@ exports.isPrimitive = is.isPrimitive;

exports.timestampWithMs = time.timestampWithMs;
exports.usingPerformanceAPI = time.usingPerformanceAPI;
exports.TRACEPARENT_REGEXP = tracing.TRACEPARENT_REGEXP;

@@ -205,2 +206,3 @@ exports.extractTraceparentData = tracing.extractTraceparentData;

exports.parseStackFrames = eventbuilder.parseStackFrames;
exports.parameterize = parameterize.parameterize;
exports.callFrameToStackFrame = anr.callFrameToStackFrame;

@@ -207,0 +209,0 @@ exports.watchdogTimer = anr.watchdogTimer;

@@ -79,2 +79,18 @@ Object.defineProperty(exports, '__esModule', { value: true });

/**
* Checks whether given string is parameterized
* {@link isParameterizedString}.
*
* @param wat A value to be checked.
* @returns A boolean representing the result.
*/
function isParameterizedString(wat) {
return (
typeof wat === 'object' &&
wat !== null &&
'__sentry_template_string__' in wat &&
'__sentry_template_values__' in wat
);
}
/**
* Checks whether given value is a primitive (undefined, null, number, boolean, string, bigint, symbol)

@@ -87,3 +103,3 @@ * {@link isPrimitive}.

function isPrimitive(wat) {
return wat === null || (typeof wat !== 'object' && typeof wat !== 'function');
return wat === null || isParameterizedString(wat) || (typeof wat !== 'object' && typeof wat !== 'function');
}

@@ -201,2 +217,3 @@

exports.isNaN = isNaN;
exports.isParameterizedString = isParameterizedString;
exports.isPlainObject = isPlainObject;

@@ -203,0 +220,0 @@ exports.isPrimitive = isPrimitive;

@@ -29,2 +29,3 @@ Object.defineProperty(exports, '__esModule', { value: true });

if (!transaction) return;
// eslint-disable-next-line deprecation/deprecation
if (!transaction.metadata.source || transaction.metadata.source === 'url') {

@@ -34,8 +35,12 @@ // Attempt to grab a parameterized route off of the request

transaction.updateName(name);
// TODO: SEMANTIC_ATTRIBUTE_SENTRY_SOURCE is in core, align this once we merge utils & core
// eslint-disable-next-line deprecation/deprecation
transaction.setMetadata({ source });
}
transaction.setData('url', req.originalUrl || req.url);
transaction.setAttribute('url', req.originalUrl || req.url);
if (req.baseUrl) {
transaction.setData('baseUrl', req.baseUrl);
transaction.setAttribute('baseUrl', req.baseUrl);
}
// TODO: We need to rewrite this to a flat format?
// eslint-disable-next-line deprecation/deprecation
transaction.setData('query', extractQueryParams(req, deps));

@@ -145,2 +150,3 @@ }

const { include = DEFAULT_REQUEST_INCLUDES, deps } = options || {};
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const requestData = {};

@@ -147,0 +153,0 @@

Object.defineProperty(exports, '__esModule', { value: true });
const node = require('./node.js');
const worldwide = require('./worldwide.js');
// eslint-disable-next-line deprecation/deprecation
const WINDOW = worldwide.getGlobalObject();
const ONE_SECOND_IN_MS = 1000;
/**
* An object that can return the current timestamp in seconds since the UNIX epoch.
* A partial definition of the [Performance Web API]{@link https://developer.mozilla.org/en-US/docs/Web/API/Performance}
* for accessing a high-resolution monotonic clock.
*/
/**
* A TimestampSource implementation for environments that do not support the Performance Web API natively.
* Returns a timestamp in seconds since the UNIX epoch using the Date API.
*
* Note that this TimestampSource does not use a monotonic clock. A call to `nowSeconds` may return a timestamp earlier
* than a previously returned value. We do not try to emulate a monotonic behavior in order to facilitate debugging. It
* is more obvious to explain "why does my span have negative duration" than "why my spans have zero duration".
* TODO(v8): Return type should be rounded.
*/
const dateTimestampSource = {
nowSeconds: () => Date.now() / 1000,
};
function dateTimestampInSeconds() {
return Date.now() / ONE_SECOND_IN_MS;
}
/**
* A partial definition of the [Performance Web API]{@link https://developer.mozilla.org/en-US/docs/Web/API/Performance}
* for accessing a high-resolution monotonic clock.
*/
/**
* Returns a wrapper around the native Performance API browser implementation, or undefined for browsers that do not

@@ -35,34 +27,24 @@ * support the API.

*/
function getBrowserPerformance() {
const { performance } = WINDOW;
function createUnixTimestampInSecondsFunc() {
const { performance } = worldwide.GLOBAL_OBJ ;
if (!performance || !performance.now) {
return undefined;
return dateTimestampInSeconds;
}
// Replace performance.timeOrigin with our own timeOrigin based on Date.now().
// Some browser and environments don't have a timeOrigin, so we fallback to
// using Date.now() to compute the starting time.
const approxStartingTimeOrigin = Date.now() - performance.now();
const timeOrigin = performance.timeOrigin == undefined ? approxStartingTimeOrigin : performance.timeOrigin;
// performance.now() is a monotonic clock, which means it starts at 0 when the process begins. To get the current
// wall clock time (actual UNIX timestamp), we need to add the starting time origin and the current time elapsed.
//
// This is a partial workaround for browsers reporting performance.timeOrigin such that performance.timeOrigin +
// performance.now() gives a date arbitrarily in the past.
//
// Additionally, computing timeOrigin in this way fills the gap for browsers where performance.timeOrigin is
// undefined.
//
// The assumption that performance.timeOrigin + performance.now() ~= Date.now() is flawed, but we depend on it to
// interact with data coming out of performance entries.
//
// Note that despite recommendations against it in the spec, browsers implement the Performance API with a clock that
// might stop when the computer is asleep (and perhaps under other circumstances). Such behavior causes
// performance.timeOrigin + performance.now() to have an arbitrary skew over Date.now(). In laptop computers, we have
// observed skews that can be as long as days, weeks or months.
//
// See https://github.com/getsentry/sentry-javascript/issues/2590.
//
// BUG: despite our best intentions, this workaround has its limitations. It mostly addresses timings of pageload
// transactions, but ignores the skew built up over time that can aversely affect timestamps of navigation
// transactions of long-lived web pages.
const timeOrigin = Date.now() - performance.now();
return {
now: () => performance.now(),
timeOrigin,
// TODO: This does not account for the case where the monotonic clock that powers performance.now() drifts from the
// wall clock time, which causes the returned timestamp to be inaccurate. We should investigate how to detect and
// correct for this.
// See: https://github.com/getsentry/sentry-javascript/issues/2590
// See: https://github.com/mdn/content/issues/4713
// See: https://dev.to/noamr/when-a-millisecond-is-not-a-millisecond-3h6
return () => {
return (timeOrigin + performance.now()) / ONE_SECOND_IN_MS;
};

@@ -72,37 +54,5 @@ }

/**
* Returns the native Performance API implementation from Node.js. Returns undefined in old Node.js versions that don't
* implement the API.
*/
function getNodePerformance() {
try {
const perfHooks = node.dynamicRequire(module, 'perf_hooks') ;
return perfHooks.performance;
} catch (_) {
return undefined;
}
}
/**
* The Performance API implementation for the current platform, if available.
*/
const platformPerformance = node.isNodeEnv() ? getNodePerformance() : getBrowserPerformance();
const timestampSource =
platformPerformance === undefined
? dateTimestampSource
: {
nowSeconds: () => (platformPerformance.timeOrigin + platformPerformance.now()) / 1000,
};
/**
* Returns a timestamp in seconds since the UNIX epoch using the Date API.
*/
const dateTimestampInSeconds = dateTimestampSource.nowSeconds.bind(dateTimestampSource);
/**
* Returns a timestamp in seconds since the UNIX epoch using either the Performance or Date APIs, depending on the
* availability of the Performance API.
*
* See `usingPerformanceAPI` to test whether the Performance API is used.
*
* BUG: Note that because of how browsers implement the Performance API, the clock might stop when the computer is

@@ -113,3 +63,3 @@ * asleep. This creates a skew between `dateTimestampInSeconds` and `timestampInSeconds`. The

*/
const timestampInSeconds = timestampSource.nowSeconds.bind(timestampSource);
const timestampInSeconds = createUnixTimestampInSecondsFunc();

@@ -125,7 +75,2 @@ /**

/**
* A boolean that is true when timestampInSeconds uses the Performance API to produce monotonic timestamps.
*/
const usingPerformanceAPI = platformPerformance !== undefined;
/**
* Internal helper to store what is the source of browserPerformanceTimeOrigin below. For debugging only.

@@ -144,3 +89,3 @@ */

const { performance } = WINDOW;
const { performance } = worldwide.GLOBAL_OBJ ;
if (!performance || !performance.now) {

@@ -193,3 +138,2 @@ exports._browserPerformanceTimeOriginMode = 'none';

exports.timestampWithMs = timestampWithMs;
exports.usingPerformanceAPI = usingPerformanceAPI;
//# sourceMappingURL=time.js.map

@@ -1,2 +0,2 @@

import { isError, isPlainObject } from './is.js';
import { isError, isPlainObject, isParameterizedString } from './is.js';
import { addExceptionTypeValue, addExceptionMechanism } from './misc.js';

@@ -125,3 +125,2 @@ import { normalizeToSize } from './normalize.js';

level,
message,
};

@@ -143,2 +142,13 @@

if (isParameterizedString(message)) {
const { __sentry_template_string__, __sentry_template_values__ } = message;
event.logentry = {
message: __sentry_template_string__,
params: __sentry_template_values__,
};
return event;
}
event.message = message;
return event;

@@ -145,0 +155,0 @@ }

@@ -7,3 +7,3 @@ export { applyAggregateErrorsToEvent } from './aggregate-errors.js';

export { addInstrumentationHandler } from './instrument/index.js';
export { isDOMError, isDOMException, isElement, isError, isErrorEvent, isEvent, isInstanceOf, isNaN, isPlainObject, isPrimitive, isRegExp, isString, isSyntheticEvent, isThenable, isVueViewModel } from './is.js';
export { isDOMError, isDOMException, isElement, isError, isErrorEvent, isEvent, isInstanceOf, isNaN, isParameterizedString, isPlainObject, isPrimitive, isRegExp, isString, isSyntheticEvent, isThenable, isVueViewModel } from './is.js';
export { isBrowser } from './isBrowser.js';

@@ -24,3 +24,3 @@ export { CONSOLE_LEVELS, consoleSandbox, logger, originalConsoleMethods } from './logger.js';

export { SyncPromise, rejectedSyncPromise, resolvedSyncPromise } from './syncpromise.js';
export { _browserPerformanceTimeOriginMode, browserPerformanceTimeOrigin, dateTimestampInSeconds, timestampInSeconds, timestampWithMs, usingPerformanceAPI } from './time.js';
export { _browserPerformanceTimeOriginMode, browserPerformanceTimeOrigin, dateTimestampInSeconds, timestampInSeconds, timestampWithMs } from './time.js';
export { TRACEPARENT_REGEXP, extractTraceparentData, generateSentryTraceHeader, tracingContextFromHeaders } from './tracing.js';

@@ -36,2 +36,3 @@ export { getSDKSource, isBrowserBundle } from './env.js';

export { eventFromMessage, eventFromUnknownInput, exceptionFromError, parseStackFrames } from './eventbuilder.js';
export { parameterize } from './parameterize.js';
export { callFrameToStackFrame, watchdogTimer } from './anr.js';

@@ -38,0 +39,0 @@ export { LRUMap } from './lru.js';

@@ -77,2 +77,18 @@ // eslint-disable-next-line @typescript-eslint/unbound-method

/**
* Checks whether given string is parameterized
* {@link isParameterizedString}.
*
* @param wat A value to be checked.
* @returns A boolean representing the result.
*/
function isParameterizedString(wat) {
return (
typeof wat === 'object' &&
wat !== null &&
'__sentry_template_string__' in wat &&
'__sentry_template_values__' in wat
);
}
/**
* Checks whether given value is a primitive (undefined, null, number, boolean, string, bigint, symbol)

@@ -85,3 +101,3 @@ * {@link isPrimitive}.

function isPrimitive(wat) {
return wat === null || (typeof wat !== 'object' && typeof wat !== 'function');
return wat === null || isParameterizedString(wat) || (typeof wat !== 'object' && typeof wat !== 'function');
}

@@ -191,3 +207,3 @@

export { isDOMError, isDOMException, isElement, isError, isErrorEvent, isEvent, isInstanceOf, isNaN, isPlainObject, isPrimitive, isRegExp, isString, isSyntheticEvent, isThenable, isVueViewModel };
export { isDOMError, isDOMException, isElement, isError, isErrorEvent, isEvent, isInstanceOf, isNaN, isParameterizedString, isPlainObject, isPrimitive, isRegExp, isString, isSyntheticEvent, isThenable, isVueViewModel };
//# sourceMappingURL=is.js.map

@@ -27,2 +27,3 @@ import { parseCookie } from './cookie.js';

if (!transaction) return;
// eslint-disable-next-line deprecation/deprecation
if (!transaction.metadata.source || transaction.metadata.source === 'url') {

@@ -32,8 +33,12 @@ // Attempt to grab a parameterized route off of the request

transaction.updateName(name);
// TODO: SEMANTIC_ATTRIBUTE_SENTRY_SOURCE is in core, align this once we merge utils & core
// eslint-disable-next-line deprecation/deprecation
transaction.setMetadata({ source });
}
transaction.setData('url', req.originalUrl || req.url);
transaction.setAttribute('url', req.originalUrl || req.url);
if (req.baseUrl) {
transaction.setData('baseUrl', req.baseUrl);
transaction.setAttribute('baseUrl', req.baseUrl);
}
// TODO: We need to rewrite this to a flat format?
// eslint-disable-next-line deprecation/deprecation
transaction.setData('query', extractQueryParams(req, deps));

@@ -143,2 +148,3 @@ }

const { include = DEFAULT_REQUEST_INCLUDES, deps } = options || {};
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const requestData = {};

@@ -145,0 +151,0 @@

@@ -1,28 +0,20 @@

import { isNodeEnv, dynamicRequire } from './node.js';
import { getGlobalObject } from './worldwide.js';
import { GLOBAL_OBJ } from './worldwide.js';
// eslint-disable-next-line deprecation/deprecation
const WINDOW = getGlobalObject();
const ONE_SECOND_IN_MS = 1000;
/**
* An object that can return the current timestamp in seconds since the UNIX epoch.
* A partial definition of the [Performance Web API]{@link https://developer.mozilla.org/en-US/docs/Web/API/Performance}
* for accessing a high-resolution monotonic clock.
*/
/**
* A TimestampSource implementation for environments that do not support the Performance Web API natively.
* Returns a timestamp in seconds since the UNIX epoch using the Date API.
*
* Note that this TimestampSource does not use a monotonic clock. A call to `nowSeconds` may return a timestamp earlier
* than a previously returned value. We do not try to emulate a monotonic behavior in order to facilitate debugging. It
* is more obvious to explain "why does my span have negative duration" than "why my spans have zero duration".
* TODO(v8): Return type should be rounded.
*/
const dateTimestampSource = {
nowSeconds: () => Date.now() / 1000,
};
function dateTimestampInSeconds() {
return Date.now() / ONE_SECOND_IN_MS;
}
/**
* A partial definition of the [Performance Web API]{@link https://developer.mozilla.org/en-US/docs/Web/API/Performance}
* for accessing a high-resolution monotonic clock.
*/
/**
* Returns a wrapper around the native Performance API browser implementation, or undefined for browsers that do not

@@ -33,34 +25,24 @@ * support the API.

*/
function getBrowserPerformance() {
const { performance } = WINDOW;
function createUnixTimestampInSecondsFunc() {
const { performance } = GLOBAL_OBJ ;
if (!performance || !performance.now) {
return undefined;
return dateTimestampInSeconds;
}
// Replace performance.timeOrigin with our own timeOrigin based on Date.now().
// Some browser and environments don't have a timeOrigin, so we fallback to
// using Date.now() to compute the starting time.
const approxStartingTimeOrigin = Date.now() - performance.now();
const timeOrigin = performance.timeOrigin == undefined ? approxStartingTimeOrigin : performance.timeOrigin;
// performance.now() is a monotonic clock, which means it starts at 0 when the process begins. To get the current
// wall clock time (actual UNIX timestamp), we need to add the starting time origin and the current time elapsed.
//
// This is a partial workaround for browsers reporting performance.timeOrigin such that performance.timeOrigin +
// performance.now() gives a date arbitrarily in the past.
//
// Additionally, computing timeOrigin in this way fills the gap for browsers where performance.timeOrigin is
// undefined.
//
// The assumption that performance.timeOrigin + performance.now() ~= Date.now() is flawed, but we depend on it to
// interact with data coming out of performance entries.
//
// Note that despite recommendations against it in the spec, browsers implement the Performance API with a clock that
// might stop when the computer is asleep (and perhaps under other circumstances). Such behavior causes
// performance.timeOrigin + performance.now() to have an arbitrary skew over Date.now(). In laptop computers, we have
// observed skews that can be as long as days, weeks or months.
//
// See https://github.com/getsentry/sentry-javascript/issues/2590.
//
// BUG: despite our best intentions, this workaround has its limitations. It mostly addresses timings of pageload
// transactions, but ignores the skew built up over time that can aversely affect timestamps of navigation
// transactions of long-lived web pages.
const timeOrigin = Date.now() - performance.now();
return {
now: () => performance.now(),
timeOrigin,
// TODO: This does not account for the case where the monotonic clock that powers performance.now() drifts from the
// wall clock time, which causes the returned timestamp to be inaccurate. We should investigate how to detect and
// correct for this.
// See: https://github.com/getsentry/sentry-javascript/issues/2590
// See: https://github.com/mdn/content/issues/4713
// See: https://dev.to/noamr/when-a-millisecond-is-not-a-millisecond-3h6
return () => {
return (timeOrigin + performance.now()) / ONE_SECOND_IN_MS;
};

@@ -70,37 +52,5 @@ }

/**
* Returns the native Performance API implementation from Node.js. Returns undefined in old Node.js versions that don't
* implement the API.
*/
function getNodePerformance() {
try {
const perfHooks = dynamicRequire(module, 'perf_hooks') ;
return perfHooks.performance;
} catch (_) {
return undefined;
}
}
/**
* The Performance API implementation for the current platform, if available.
*/
const platformPerformance = isNodeEnv() ? getNodePerformance() : getBrowserPerformance();
const timestampSource =
platformPerformance === undefined
? dateTimestampSource
: {
nowSeconds: () => (platformPerformance.timeOrigin + platformPerformance.now()) / 1000,
};
/**
* Returns a timestamp in seconds since the UNIX epoch using the Date API.
*/
const dateTimestampInSeconds = dateTimestampSource.nowSeconds.bind(dateTimestampSource);
/**
* Returns a timestamp in seconds since the UNIX epoch using either the Performance or Date APIs, depending on the
* availability of the Performance API.
*
* See `usingPerformanceAPI` to test whether the Performance API is used.
*
* BUG: Note that because of how browsers implement the Performance API, the clock might stop when the computer is

@@ -111,3 +61,3 @@ * asleep. This creates a skew between `dateTimestampInSeconds` and `timestampInSeconds`. The

*/
const timestampInSeconds = timestampSource.nowSeconds.bind(timestampSource);
const timestampInSeconds = createUnixTimestampInSecondsFunc();

@@ -123,7 +73,2 @@ /**

/**
* A boolean that is true when timestampInSeconds uses the Performance API to produce monotonic timestamps.
*/
const usingPerformanceAPI = platformPerformance !== undefined;
/**
* Internal helper to store what is the source of browserPerformanceTimeOrigin below. For debugging only.

@@ -142,3 +87,3 @@ */

const { performance } = WINDOW;
const { performance } = GLOBAL_OBJ ;
if (!performance || !performance.now) {

@@ -187,3 +132,3 @@ _browserPerformanceTimeOriginMode = 'none';

export { _browserPerformanceTimeOriginMode, browserPerformanceTimeOrigin, dateTimestampInSeconds, timestampInSeconds, timestampWithMs, usingPerformanceAPI };
export { _browserPerformanceTimeOriginMode, browserPerformanceTimeOrigin, dateTimestampInSeconds, timestampInSeconds, timestampWithMs };
//# sourceMappingURL=time.js.map
{
"name": "@sentry/utils",
"version": "7.92.0",
"version": "7.93.0",
"description": "Utilities for all Sentry JavaScript SDKs",

@@ -32,3 +32,3 @@ "repository": "git://github.com/getsentry/sentry-javascript.git",

"dependencies": {
"@sentry/types": "7.92.0"
"@sentry/types": "7.93.0"
},

@@ -35,0 +35,0 @@ "devDependencies": {

@@ -1,2 +0,2 @@

import { Client, Event, EventHint, Exception, Hub, Severity, SeverityLevel, StackFrame, StackParser } from '@sentry/types';
import { Client, Event, EventHint, Exception, Hub, ParameterizedString, Severity, SeverityLevel, StackFrame, StackParser } from '@sentry/types';
/**

@@ -21,3 +21,3 @@ * Extracts stack frames from the error.stack string

*/
export declare function eventFromMessage(stackParser: StackParser, message: string, level?: Severity | SeverityLevel, hint?: EventHint, attachStacktrace?: boolean): Event;
export declare function eventFromMessage(stackParser: StackParser, message: ParameterizedString, level?: Severity | SeverityLevel, hint?: EventHint, attachStacktrace?: boolean): Event;
//# sourceMappingURL=eventbuilder.d.ts.map

@@ -34,2 +34,3 @@ export * from './aggregate-errors';

export * from './eventbuilder';
export * from './parameterize';
export * from './anr';

@@ -36,0 +37,0 @@ export * from './lru';

@@ -1,2 +0,2 @@

import { PolymorphicEvent, Primitive } from '@sentry/types';
import { ParameterizedString, PolymorphicEvent, Primitive } from '@sentry/types';
/**

@@ -43,2 +43,10 @@ * Checks whether given value's type is one of a few Error or Error-like

/**
* Checks whether given string is parameterized
* {@link isParameterizedString}.
*
* @param wat A value to be checked.
* @returns A boolean representing the result.
*/
export declare function isParameterizedString(wat: unknown): wat is ParameterizedString;
/**
* Checks whether given value is a primitive (undefined, null, number, boolean, string, bigint, symbol)

@@ -45,0 +53,0 @@ * {@link isPrimitive}.

/**
* Returns a timestamp in seconds since the UNIX epoch using the Date API.
*
* TODO(v8): Return type should be rounded.
*/
export declare const dateTimestampInSeconds: () => number;
export declare function dateTimestampInSeconds(): number;
/**

@@ -9,4 +11,2 @@ * Returns a timestamp in seconds since the UNIX epoch using either the Performance or Date APIs, depending on the

*
* See `usingPerformanceAPI` to test whether the Performance API is used.
*
* BUG: Note that because of how browsers implement the Performance API, the clock might stop when the computer is

@@ -26,6 +26,2 @@ * asleep. This creates a skew between `dateTimestampInSeconds` and `timestampInSeconds`. The

/**
* A boolean that is true when timestampInSeconds uses the Performance API to produce monotonic timestamps.
*/
export declare const usingPerformanceAPI: boolean;
/**
* Internal helper to store what is the source of browserPerformanceTimeOrigin below. For debugging only.

@@ -32,0 +28,0 @@ */

@@ -1,2 +0,2 @@

import type { Client, Event, EventHint, Exception, Hub, Severity, SeverityLevel, StackFrame, StackParser } from '@sentry/types';
import type { Client, Event, EventHint, Exception, Hub, ParameterizedString, Severity, SeverityLevel, StackFrame, StackParser } from '@sentry/types';
/**

@@ -21,3 +21,3 @@ * Extracts stack frames from the error.stack string

*/
export declare function eventFromMessage(stackParser: StackParser, message: string, level?: Severity | SeverityLevel, hint?: EventHint, attachStacktrace?: boolean): Event;
export declare function eventFromMessage(stackParser: StackParser, message: ParameterizedString, level?: Severity | SeverityLevel, hint?: EventHint, attachStacktrace?: boolean): Event;
//# sourceMappingURL=eventbuilder.d.ts.map

@@ -34,2 +34,3 @@ export * from './aggregate-errors';

export * from './eventbuilder';
export * from './parameterize';
export * from './anr';

@@ -36,0 +37,0 @@ export * from './lru';

@@ -1,2 +0,2 @@

import type { PolymorphicEvent, Primitive } from '@sentry/types';
import type { ParameterizedString, PolymorphicEvent, Primitive } from '@sentry/types';
/**

@@ -43,2 +43,10 @@ * Checks whether given value's type is one of a few Error or Error-like

/**
* Checks whether given string is parameterized
* {@link isParameterizedString}.
*
* @param wat A value to be checked.
* @returns A boolean representing the result.
*/
export declare function isParameterizedString(wat: unknown): wat is ParameterizedString;
/**
* Checks whether given value is a primitive (undefined, null, number, boolean, string, bigint, symbol)

@@ -45,0 +53,0 @@ * {@link isPrimitive}.

/**
* Returns a timestamp in seconds since the UNIX epoch using the Date API.
*
* TODO(v8): Return type should be rounded.
*/
export declare const dateTimestampInSeconds: () => number;
export declare function dateTimestampInSeconds(): number;
/**

@@ -9,4 +11,2 @@ * Returns a timestamp in seconds since the UNIX epoch using either the Performance or Date APIs, depending on the

*
* See `usingPerformanceAPI` to test whether the Performance API is used.
*
* BUG: Note that because of how browsers implement the Performance API, the clock might stop when the computer is

@@ -26,6 +26,2 @@ * asleep. This creates a skew between `dateTimestampInSeconds` and `timestampInSeconds`. The

/**
* A boolean that is true when timestampInSeconds uses the Performance API to produce monotonic timestamps.
*/
export declare const usingPerformanceAPI: boolean;
/**
* Internal helper to store what is the source of browserPerformanceTimeOrigin below. For debugging only.

@@ -32,0 +28,0 @@ */

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc