Socket
Socket
Sign inDemoInstall

@sentry/core

Package Overview
Dependencies
2
Maintainers
11
Versions
476
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 7.87.0 to 7.88.0

cjs/metrics/constants.js

26

cjs/baseclient.js

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

const integration = require('./integration.js');
const envelope$1 = require('./metrics/envelope.js');
const session = require('./session.js');

@@ -48,2 +49,8 @@ const dynamicSamplingContext = require('./tracing/dynamicSamplingContext.js');

class BaseClient {
/**
* A reference to a metrics aggregator
*
* @experimental Note this is alpha API. It may experience breaking changes in the future.
*/
/** Options passed to the SDK. */

@@ -214,2 +221,5 @@

if (transport) {
if (this.metricsAggregator) {
this.metricsAggregator.flush();
}
return this._isClientDoneProcessing(timeout).then(clientFinished => {

@@ -229,2 +239,5 @@ return transport.flush(timeout).then(transportFlushed => clientFinished && transportFlushed);

this.getOptions().enabled = false;
if (this.metricsAggregator) {
this.metricsAggregator.close();
}
return result;

@@ -335,2 +348,15 @@ });

/**
* @inheritDoc
*/
captureAggregateMetrics(metricBucketItems) {
const metricsEnvelope = envelope$1.createMetricEnvelope(
metricBucketItems,
this._dsn,
this._options._metadata,
this._options.tunnel,
);
void this._sendEnvelope(metricsEnvelope);
}
// Keep on() & emit() signatures in sync with types' client.ts interface

@@ -337,0 +363,0 @@ /* eslint-disable @typescript-eslint/unified-signatures */

2

cjs/index.js

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

const requestdata = require('./integrations/requestdata.js');
const exports$2 = require('./metrics/exports.js');
const functiontostring = require('./integrations/functiontostring.js');

@@ -121,2 +122,3 @@ const inboundfilters = require('./integrations/inboundfilters.js');

exports.RequestData = requestdata.RequestData;
exports.metrics = exports$2.metrics;
exports.FunctionToString = functiontostring.FunctionToString;

@@ -123,0 +125,0 @@ exports.InboundFilters = inboundfilters.InboundFilters;

19

cjs/integrations/metadata.js

@@ -32,6 +32,9 @@ Object.defineProperty(exports, '__esModule', { value: true });

*/
setupOnce(addGlobalEventProcessor, getCurrentHub) {
const client = getCurrentHub().getClient();
setupOnce(_addGlobalEventProcessor, _getCurrentHub) {
// noop
}
if (!client || typeof client.on !== 'function') {
/** @inheritDoc */
setup(client) {
if (typeof client.on !== 'function') {
return;

@@ -53,9 +56,9 @@ }

});
}
/** @inheritDoc */
processEvent(event, _hint, client) {
const stackParser = client.getOptions().stackParser;
addGlobalEventProcessor(event => {
metadata.addMetadataToStackFrames(stackParser, event);
return event;
});
metadata.addMetadataToStackFrames(stackParser, event);
return event;
}

@@ -62,0 +65,0 @@ } ModuleMetadata.__initStatic();

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

*/
setupOnce(addGlobalEventProcessor, getCurrentHub) {
setupOnce(
_addGlobalEventProcessor,
_getCurrentHub,
) {
// noop
}
/** @inheritdoc */
processEvent(event, _hint, client) {
// Note: In the long run, most of the logic here should probably move into the request data utility functions. For

@@ -78,54 +86,47 @@ // the moment it lives here, though, until https://github.com/getsentry/sentry-javascript/issues/5718 is addressed.

addGlobalEventProcessor(event => {
const hub = getCurrentHub();
const self = hub.getIntegration(RequestData);
const { sdkProcessingMetadata = {} } = event;
const req = sdkProcessingMetadata.request;
const { sdkProcessingMetadata = {} } = event;
const req = sdkProcessingMetadata.request;
if (!req) {
return event;
}
// If the globally installed instance of this integration isn't associated with the current hub, `self` will be
// undefined
if (!self || !req) {
return event;
}
// The Express request handler takes a similar `include` option to that which can be passed to this integration.
// If passed there, we store it in `sdkProcessingMetadata`. TODO(v8): Force express and GCP people to use this
// integration, so that all of this passing and conversion isn't necessary
const addRequestDataOptions =
sdkProcessingMetadata.requestDataOptionsFromExpressHandler ||
sdkProcessingMetadata.requestDataOptionsFromGCPWrapper ||
convertReqDataIntegrationOptsToAddReqDataOpts(this._options);
// The Express request handler takes a similar `include` option to that which can be passed to this integration.
// If passed there, we store it in `sdkProcessingMetadata`. TODO(v8): Force express and GCP people to use this
// integration, so that all of this passing and conversion isn't necessary
const addRequestDataOptions =
sdkProcessingMetadata.requestDataOptionsFromExpressHandler ||
sdkProcessingMetadata.requestDataOptionsFromGCPWrapper ||
convertReqDataIntegrationOptsToAddReqDataOpts(this._options);
const processedEvent = this._addRequestData(event, req, addRequestDataOptions);
const processedEvent = this._addRequestData(event, req, addRequestDataOptions);
// Transaction events already have the right `transaction` value
if (event.type === 'transaction' || transactionNamingScheme === 'handler') {
return processedEvent;
}
// Transaction events already have the right `transaction` value
if (event.type === 'transaction' || transactionNamingScheme === 'handler') {
return processedEvent;
}
// In all other cases, use the request's associated transaction (if any) to overwrite the event's `transaction`
// value with a high-quality one
const reqWithTransaction = req ;
const transaction = reqWithTransaction._sentryTransaction;
if (transaction) {
// TODO (v8): Remove the nextjs check and just base it on `transactionNamingScheme` for all SDKs. (We have to
// keep it the way it is for the moment, because changing the names of transactions in Sentry has the potential
// to break things like alert rules.)
const shouldIncludeMethodInTransactionName =
getSDKName(client) === 'sentry.javascript.nextjs'
? transaction.name.startsWith('/api')
: transactionNamingScheme !== 'path';
// In all other cases, use the request's associated transaction (if any) to overwrite the event's `transaction`
// value with a high-quality one
const reqWithTransaction = req ;
const transaction = reqWithTransaction._sentryTransaction;
if (transaction) {
// TODO (v8): Remove the nextjs check and just base it on `transactionNamingScheme` for all SDKs. (We have to
// keep it the way it is for the moment, because changing the names of transactions in Sentry has the potential
// to break things like alert rules.)
const shouldIncludeMethodInTransactionName =
getSDKName(hub) === 'sentry.javascript.nextjs'
? transaction.name.startsWith('/api')
: transactionNamingScheme !== 'path';
const [transactionValue] = utils.extractPathForTransaction(req, {
path: true,
method: shouldIncludeMethodInTransactionName,
customRoute: transaction.name,
});
const [transactionValue] = utils.extractPathForTransaction(req, {
path: true,
method: shouldIncludeMethodInTransactionName,
customRoute: transaction.name,
});
processedEvent.transaction = transactionValue;
}
processedEvent.transaction = transactionValue;
}
return processedEvent;
});
return processedEvent;
}

@@ -176,3 +177,3 @@ } RequestData.__initStatic();

function getSDKName(hub) {
function getSDKName(client) {
try {

@@ -182,3 +183,3 @@ // For a long chain like this, it's fewer bytes to combine a try-catch with assuming everything is there than to

// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
return hub.getClient().getOptions()._metadata.sdk.name;
return client.getOptions()._metadata.sdk.name;
} catch (err) {

@@ -185,0 +186,0 @@ // In theory we should never get here

Object.defineProperty(exports, '__esModule', { value: true });
const SDK_VERSION = '7.87.0';
const SDK_VERSION = '7.88.0';
exports.SDK_VERSION = SDK_VERSION;
//# sourceMappingURL=version.js.map

@@ -7,2 +7,3 @@ import { makeDsn, logger, checkOrSetAlreadyCaught, isPrimitive, resolvedSyncPromise, addItemToEnvelope, createAttachmentEnvelopeItem, SyncPromise, rejectedSyncPromise, SentryError, isThenable, isPlainObject } from '@sentry/utils';

import { setupIntegrations, setupIntegration } from './integration.js';
import { createMetricEnvelope } from './metrics/envelope.js';
import { updateSession } from './session.js';

@@ -46,2 +47,8 @@ import { getDynamicSamplingContextFromClient } from './tracing/dynamicSamplingContext.js';

class BaseClient {
/**
* A reference to a metrics aggregator
*
* @experimental Note this is alpha API. It may experience breaking changes in the future.
*/
/** Options passed to the SDK. */

@@ -212,2 +219,5 @@

if (transport) {
if (this.metricsAggregator) {
this.metricsAggregator.flush();
}
return this._isClientDoneProcessing(timeout).then(clientFinished => {

@@ -227,2 +237,5 @@ return transport.flush(timeout).then(transportFlushed => clientFinished && transportFlushed);

this.getOptions().enabled = false;
if (this.metricsAggregator) {
this.metricsAggregator.close();
}
return result;

@@ -333,2 +346,15 @@ });

/**
* @inheritDoc
*/
captureAggregateMetrics(metricBucketItems) {
const metricsEnvelope = createMetricEnvelope(
metricBucketItems,
this._dsn,
this._options._metadata,
this._options.tunnel,
);
void this._sendEnvelope(metricsEnvelope);
}
// Keep on() & emit() signatures in sync with types' client.ts interface

@@ -335,0 +361,0 @@ /* eslint-disable @typescript-eslint/unified-signatures */

@@ -35,2 +35,3 @@ export { addTracingExtensions, startIdleTransaction } from './tracing/hubextensions.js';

export { RequestData } from './integrations/requestdata.js';
export { metrics } from './metrics/exports.js';
export { FunctionToString } from './integrations/functiontostring.js';

@@ -37,0 +38,0 @@ export { InboundFilters } from './integrations/inboundfilters.js';

@@ -30,6 +30,9 @@ import { forEachEnvelopeItem } from '@sentry/utils';

*/
setupOnce(addGlobalEventProcessor, getCurrentHub) {
const client = getCurrentHub().getClient();
setupOnce(_addGlobalEventProcessor, _getCurrentHub) {
// noop
}
if (!client || typeof client.on !== 'function') {
/** @inheritDoc */
setup(client) {
if (typeof client.on !== 'function') {
return;

@@ -51,9 +54,9 @@ }

});
}
/** @inheritDoc */
processEvent(event, _hint, client) {
const stackParser = client.getOptions().stackParser;
addGlobalEventProcessor(event => {
addMetadataToStackFrames(stackParser, event);
return event;
});
addMetadataToStackFrames(stackParser, event);
return event;
}

@@ -60,0 +63,0 @@ } ModuleMetadata.__initStatic();

@@ -68,3 +68,11 @@ import { addRequestDataToEvent, extractPathForTransaction } from '@sentry/utils';

*/
setupOnce(addGlobalEventProcessor, getCurrentHub) {
setupOnce(
_addGlobalEventProcessor,
_getCurrentHub,
) {
// noop
}
/** @inheritdoc */
processEvent(event, _hint, client) {
// Note: In the long run, most of the logic here should probably move into the request data utility functions. For

@@ -76,54 +84,47 @@ // the moment it lives here, though, until https://github.com/getsentry/sentry-javascript/issues/5718 is addressed.

addGlobalEventProcessor(event => {
const hub = getCurrentHub();
const self = hub.getIntegration(RequestData);
const { sdkProcessingMetadata = {} } = event;
const req = sdkProcessingMetadata.request;
const { sdkProcessingMetadata = {} } = event;
const req = sdkProcessingMetadata.request;
if (!req) {
return event;
}
// If the globally installed instance of this integration isn't associated with the current hub, `self` will be
// undefined
if (!self || !req) {
return event;
}
// The Express request handler takes a similar `include` option to that which can be passed to this integration.
// If passed there, we store it in `sdkProcessingMetadata`. TODO(v8): Force express and GCP people to use this
// integration, so that all of this passing and conversion isn't necessary
const addRequestDataOptions =
sdkProcessingMetadata.requestDataOptionsFromExpressHandler ||
sdkProcessingMetadata.requestDataOptionsFromGCPWrapper ||
convertReqDataIntegrationOptsToAddReqDataOpts(this._options);
// The Express request handler takes a similar `include` option to that which can be passed to this integration.
// If passed there, we store it in `sdkProcessingMetadata`. TODO(v8): Force express and GCP people to use this
// integration, so that all of this passing and conversion isn't necessary
const addRequestDataOptions =
sdkProcessingMetadata.requestDataOptionsFromExpressHandler ||
sdkProcessingMetadata.requestDataOptionsFromGCPWrapper ||
convertReqDataIntegrationOptsToAddReqDataOpts(this._options);
const processedEvent = this._addRequestData(event, req, addRequestDataOptions);
const processedEvent = this._addRequestData(event, req, addRequestDataOptions);
// Transaction events already have the right `transaction` value
if (event.type === 'transaction' || transactionNamingScheme === 'handler') {
return processedEvent;
}
// Transaction events already have the right `transaction` value
if (event.type === 'transaction' || transactionNamingScheme === 'handler') {
return processedEvent;
}
// In all other cases, use the request's associated transaction (if any) to overwrite the event's `transaction`
// value with a high-quality one
const reqWithTransaction = req ;
const transaction = reqWithTransaction._sentryTransaction;
if (transaction) {
// TODO (v8): Remove the nextjs check and just base it on `transactionNamingScheme` for all SDKs. (We have to
// keep it the way it is for the moment, because changing the names of transactions in Sentry has the potential
// to break things like alert rules.)
const shouldIncludeMethodInTransactionName =
getSDKName(client) === 'sentry.javascript.nextjs'
? transaction.name.startsWith('/api')
: transactionNamingScheme !== 'path';
// In all other cases, use the request's associated transaction (if any) to overwrite the event's `transaction`
// value with a high-quality one
const reqWithTransaction = req ;
const transaction = reqWithTransaction._sentryTransaction;
if (transaction) {
// TODO (v8): Remove the nextjs check and just base it on `transactionNamingScheme` for all SDKs. (We have to
// keep it the way it is for the moment, because changing the names of transactions in Sentry has the potential
// to break things like alert rules.)
const shouldIncludeMethodInTransactionName =
getSDKName(hub) === 'sentry.javascript.nextjs'
? transaction.name.startsWith('/api')
: transactionNamingScheme !== 'path';
const [transactionValue] = extractPathForTransaction(req, {
path: true,
method: shouldIncludeMethodInTransactionName,
customRoute: transaction.name,
});
const [transactionValue] = extractPathForTransaction(req, {
path: true,
method: shouldIncludeMethodInTransactionName,
customRoute: transaction.name,
});
processedEvent.transaction = transactionValue;
}
processedEvent.transaction = transactionValue;
}
return processedEvent;
});
return processedEvent;
}

@@ -174,3 +175,3 @@ } RequestData.__initStatic();

function getSDKName(hub) {
function getSDKName(client) {
try {

@@ -180,3 +181,3 @@ // For a long chain like this, it's fewer bytes to combine a try-catch with assuming everything is there than to

// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
return hub.getClient().getOptions()._metadata.sdk.name;
return client.getOptions()._metadata.sdk.name;
} catch (err) {

@@ -183,0 +184,0 @@ // In theory we should never get here

@@ -1,4 +0,4 @@

const SDK_VERSION = '7.87.0';
const SDK_VERSION = '7.88.0';
export { SDK_VERSION };
//# sourceMappingURL=version.js.map
{
"name": "@sentry/core",
"version": "7.87.0",
"version": "7.88.0",
"description": "Base implementation for all Sentry JavaScript SDKs",

@@ -26,6 +26,6 @@ "repository": "git://github.com/getsentry/sentry-javascript.git",

"dependencies": {
"@sentry/types": "7.87.0",
"@sentry/utils": "7.87.0"
"@sentry/types": "7.88.0",
"@sentry/utils": "7.88.0"
},
"sideEffects": false
}

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

import { Breadcrumb, BreadcrumbHint, Client, ClientOptions, DataCategory, DsnComponents, DynamicSamplingContext, Envelope, Event, EventDropReason, EventHint, EventProcessor, FeedbackEvent, Integration, IntegrationClass, Outcome, SdkMetadata, Session, SessionAggregates, Severity, SeverityLevel, Transaction, Transport, TransportMakeRequestResponse } from '@sentry/types';
import { Breadcrumb, BreadcrumbHint, Client, ClientOptions, DataCategory, DsnComponents, DynamicSamplingContext, Envelope, Event, EventDropReason, EventHint, EventProcessor, FeedbackEvent, Integration, IntegrationClass, MetricBucketItem, MetricsAggregator, Outcome, SdkMetadata, Session, SessionAggregates, Severity, SeverityLevel, Transaction, Transport, TransportMakeRequestResponse } from '@sentry/types';
import { IntegrationIndex } from './integration';

@@ -36,2 +36,8 @@ import { Scope } from './scope';

export declare abstract class BaseClient<O extends ClientOptions> implements Client<O> {
/**
* A reference to a metrics aggregator
*
* @experimental Note this is alpha API. It may experience breaking changes in the future.
*/
metricsAggregator?: MetricsAggregator;
/** Options passed to the SDK. */

@@ -134,2 +140,6 @@ protected readonly _options: O;

recordDroppedEvent(reason: EventDropReason, category: DataCategory, _event?: Event): void;
/**
* @inheritDoc
*/
captureAggregateMetrics(metricBucketItems: Array<MetricBucketItem>): void;
/** @inheritdoc */

@@ -136,0 +146,0 @@ on(hook: 'startTransaction', callback: (transaction: Transaction) => void): void;

@@ -32,3 +32,4 @@ export { ClientClass } from './sdk';

import * as Integrations from './integrations';
export { metrics } from './metrics/exports';
export { Integrations };
//# sourceMappingURL=index.d.ts.map

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

import { EventProcessor, Hub, Integration } from '@sentry/types';
import { Client, Event, EventProcessor, Hub, Integration } from '@sentry/types';
/**

@@ -21,4 +21,8 @@ * Adds module metadata to stack frames.

*/
setupOnce(addGlobalEventProcessor: (processor: EventProcessor) => void, getCurrentHub: () => Hub): void;
setupOnce(_addGlobalEventProcessor: (processor: EventProcessor) => void, _getCurrentHub: () => Hub): void;
/** @inheritDoc */
setup(client: Client): void;
/** @inheritDoc */
processEvent(event: Event, _hint: unknown, client: Client): Event;
}
//# sourceMappingURL=metadata.d.ts.map

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

import { Event, EventProcessor, Hub, Integration, PolymorphicRequest } from '@sentry/types';
import { Client, Event, EventProcessor, Hub, Integration, PolymorphicRequest } from '@sentry/types';
import { TransactionNamingScheme } from '@sentry/utils';

@@ -50,4 +50,6 @@ export type RequestDataIntegrationOptions = {

*/
setupOnce(addGlobalEventProcessor: (eventProcessor: EventProcessor) => void, getCurrentHub: () => Hub): void;
setupOnce(_addGlobalEventProcessor: (eventProcessor: EventProcessor) => void, _getCurrentHub: () => Hub): void;
/** @inheritdoc */
processEvent(event: Event, _hint: unknown, client: Client): Event;
}
//# sourceMappingURL=requestdata.d.ts.map

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

export declare const SDK_VERSION = "7.87.0";
export declare const SDK_VERSION = "7.88.0";
//# sourceMappingURL=version.d.ts.map

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

import type { Breadcrumb, BreadcrumbHint, Client, ClientOptions, DataCategory, DsnComponents, DynamicSamplingContext, Envelope, Event, EventDropReason, EventHint, EventProcessor, FeedbackEvent, Integration, IntegrationClass, Outcome, SdkMetadata, Session, SessionAggregates, Severity, SeverityLevel, Transaction, Transport, TransportMakeRequestResponse } from '@sentry/types';
import type { Breadcrumb, BreadcrumbHint, Client, ClientOptions, DataCategory, DsnComponents, DynamicSamplingContext, Envelope, Event, EventDropReason, EventHint, EventProcessor, FeedbackEvent, Integration, IntegrationClass, MetricBucketItem, MetricsAggregator, Outcome, SdkMetadata, Session, SessionAggregates, Severity, SeverityLevel, Transaction, Transport, TransportMakeRequestResponse } from '@sentry/types';
import type { IntegrationIndex } from './integration';

@@ -36,2 +36,8 @@ import type { Scope } from './scope';

export declare abstract class BaseClient<O extends ClientOptions> implements Client<O> {
/**
* A reference to a metrics aggregator
*
* @experimental Note this is alpha API. It may experience breaking changes in the future.
*/
metricsAggregator?: MetricsAggregator;
/** Options passed to the SDK. */

@@ -134,2 +140,6 @@ protected readonly _options: O;

recordDroppedEvent(reason: EventDropReason, category: DataCategory, _event?: Event): void;
/**
* @inheritDoc
*/
captureAggregateMetrics(metricBucketItems: Array<MetricBucketItem>): void;
/** @inheritdoc */

@@ -136,0 +146,0 @@ on(hook: 'startTransaction', callback: (transaction: Transaction) => void): void;

@@ -32,3 +32,4 @@ export type { ClientClass } from './sdk';

import * as Integrations from './integrations';
export { metrics } from './metrics/exports';
export { Integrations };
//# sourceMappingURL=index.d.ts.map

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

import type { EventProcessor, Hub, Integration } from '@sentry/types';
import type { Client, Event, EventProcessor, Hub, Integration } from '@sentry/types';
/**

@@ -21,4 +21,8 @@ * Adds module metadata to stack frames.

*/
setupOnce(addGlobalEventProcessor: (processor: EventProcessor) => void, getCurrentHub: () => Hub): void;
setupOnce(_addGlobalEventProcessor: (processor: EventProcessor) => void, _getCurrentHub: () => Hub): void;
/** @inheritDoc */
setup(client: Client): void;
/** @inheritDoc */
processEvent(event: Event, _hint: unknown, client: Client): Event;
}
//# sourceMappingURL=metadata.d.ts.map

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

import type { Event, EventProcessor, Hub, Integration, PolymorphicRequest } from '@sentry/types';
import type { Client, Event, EventProcessor, Hub, Integration, PolymorphicRequest } from '@sentry/types';
import type { TransactionNamingScheme } from '@sentry/utils';

@@ -50,4 +50,6 @@ export type RequestDataIntegrationOptions = {

*/
setupOnce(addGlobalEventProcessor: (eventProcessor: EventProcessor) => void, getCurrentHub: () => Hub): void;
setupOnce(_addGlobalEventProcessor: (eventProcessor: EventProcessor) => void, _getCurrentHub: () => Hub): void;
/** @inheritdoc */
processEvent(event: Event, _hint: unknown, client: Client): Event;
}
//# sourceMappingURL=requestdata.d.ts.map

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

export declare const SDK_VERSION = "7.87.0";
export declare const SDK_VERSION = "7.88.0";
//# sourceMappingURL=version.d.ts.map

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