Socket
Socket
Sign inDemoInstall

@sentry/utils

Package Overview
Dependencies
Maintainers
11
Versions
502
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sentry/utils - npm Package Compare versions

Comparing version 7.109.0 to 7.110.0

4

cjs/envelope.js

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

span: 'span',
statsd: 'statsd',
statsd: 'metric_bucket',
};

@@ -206,3 +206,3 @@

/** Extracts the minimal SDK info from from the metadata or an events */
/** Extracts the minimal SDK info from the metadata or an events */
function getSdkMetadataForEnvelopeHeader(metadataOrEvent) {

@@ -209,0 +209,0 @@ if (!metadataOrEvent || !metadataOrEvent.sdk) {

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

function eventFromUnknownInput(
// eslint-disable-next-line deprecation/deprecation
getHubOrClient,

@@ -61,0 +62,0 @@ stackParser,

@@ -34,4 +34,4 @@ Object.defineProperty(exports, '__esModule', { value: true });

*/
function disabledUntil(limits, category) {
return limits[category] || limits.all || 0;
function disabledUntil(limits, dataCategory) {
return limits[dataCategory] || limits.all || 0;
}

@@ -42,4 +42,4 @@

*/
function isRateLimited(limits, category, now = Date.now()) {
return disabledUntil(limits, category) > now;
function isRateLimited(limits, dataCategory, now = Date.now()) {
return disabledUntil(limits, dataCategory) > now;
}

@@ -71,3 +71,3 @@

* where each <header> is of the form
* <retry_after>: <categories>: <scope>: <reason_code>
* <retry_after>: <categories>: <scope>: <reason_code>: <namespaces>
* where

@@ -79,5 +79,7 @@ * <retry_after> is a delay in seconds

* <reason_code> is an arbitrary string like "org_quota" - ignored by SDK
* <namespaces> Semicolon-separated list of metric namespace identifiers. Defines which namespace(s) will be affected.
* Only present if rate limit applies to the metric_bucket data category.
*/
for (const limit of rateLimitHeader.trim().split(',')) {
const [retryAfter, categories] = limit.split(':', 2);
const [retryAfter, categories, , , namespaces] = limit.split(':', 5);
const headerDelay = parseInt(retryAfter, 10);

@@ -89,3 +91,10 @@ const delay = (!isNaN(headerDelay) ? headerDelay : 60) * 1000; // 60sec default

for (const category of categories.split(';')) {
updatedRateLimits[category] = now + delay;
if (category === 'metric_bucket') {
// namespaces will be present when category === 'metric_bucket'
if (!namespaces || namespaces.split(';').includes('custom')) {
updatedRateLimits[category] = now + delay;
}
} else {
updatedRateLimits[category] = now + delay;
}
}

@@ -92,0 +101,0 @@ }

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

* Sets parameterized route as transaction name e.g.: `GET /users/:id`
* Also adds more context data on the transaction from the request
* Also adds more context data on the transaction from the request.
*
* @deprecated This utility will be removed in v8.
*/

@@ -24,0 +26,0 @@ function addRequestDataToTransaction(

@@ -193,3 +193,3 @@ import { dsnToString } from './dsn.js';

span: 'span',
statsd: 'statsd',
statsd: 'metric_bucket',
};

@@ -204,3 +204,3 @@

/** Extracts the minimal SDK info from from the metadata or an events */
/** Extracts the minimal SDK info from the metadata or an events */
function getSdkMetadataForEnvelopeHeader(metadataOrEvent) {

@@ -207,0 +207,0 @@ if (!metadataOrEvent || !metadataOrEvent.sdk) {

@@ -57,2 +57,3 @@ import { isError, isPlainObject, isParameterizedString } from './is.js';

function eventFromUnknownInput(
// eslint-disable-next-line deprecation/deprecation
getHubOrClient,

@@ -59,0 +60,0 @@ stackParser,

@@ -32,4 +32,4 @@ // Intentionally keeping the key broad, as we don't know for sure what rate limit headers get returned from backend

*/
function disabledUntil(limits, category) {
return limits[category] || limits.all || 0;
function disabledUntil(limits, dataCategory) {
return limits[dataCategory] || limits.all || 0;
}

@@ -40,4 +40,4 @@

*/
function isRateLimited(limits, category, now = Date.now()) {
return disabledUntil(limits, category) > now;
function isRateLimited(limits, dataCategory, now = Date.now()) {
return disabledUntil(limits, dataCategory) > now;
}

@@ -69,3 +69,3 @@

* where each <header> is of the form
* <retry_after>: <categories>: <scope>: <reason_code>
* <retry_after>: <categories>: <scope>: <reason_code>: <namespaces>
* where

@@ -77,5 +77,7 @@ * <retry_after> is a delay in seconds

* <reason_code> is an arbitrary string like "org_quota" - ignored by SDK
* <namespaces> Semicolon-separated list of metric namespace identifiers. Defines which namespace(s) will be affected.
* Only present if rate limit applies to the metric_bucket data category.
*/
for (const limit of rateLimitHeader.trim().split(',')) {
const [retryAfter, categories] = limit.split(':', 2);
const [retryAfter, categories, , , namespaces] = limit.split(':', 5);
const headerDelay = parseInt(retryAfter, 10);

@@ -87,3 +89,10 @@ const delay = (!isNaN(headerDelay) ? headerDelay : 60) * 1000; // 60sec default

for (const category of categories.split(';')) {
updatedRateLimits[category] = now + delay;
if (category === 'metric_bucket') {
// namespaces will be present when category === 'metric_bucket'
if (!namespaces || namespaces.split(';').includes('custom')) {
updatedRateLimits[category] = now + delay;
}
} else {
updatedRateLimits[category] = now + delay;
}
}

@@ -90,0 +99,0 @@ }

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

* Sets parameterized route as transaction name e.g.: `GET /users/:id`
* Also adds more context data on the transaction from the request
* Also adds more context data on the transaction from the request.
*
* @deprecated This utility will be removed in v8.
*/

@@ -22,0 +24,0 @@ function addRequestDataToTransaction(

{
"name": "@sentry/utils",
"version": "7.109.0",
"version": "7.110.0",
"description": "Utilities for all Sentry JavaScript SDKs",

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

"dependencies": {
"@sentry/types": "7.109.0"
"@sentry/types": "7.110.0"
},

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

@@ -44,3 +44,3 @@ import { Attachment, AttachmentItem, DataCategory, DsnComponents, Envelope, EnvelopeItemType, Event, EventEnvelopeHeaders, SdkInfo, SdkMetadata, TextEncoderInternal } from '@sentry/types';

export declare function envelopeItemTypeToDataCategory(type: EnvelopeItemType): DataCategory;
/** Extracts the minimal SDK info from from the metadata or an events */
/** Extracts the minimal SDK info from the metadata or an events */
export declare function getSdkMetadataForEnvelopeHeader(metadataOrEvent?: SdkMetadata | Event): SdkInfo | undefined;

@@ -47,0 +47,0 @@ /**

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

import { TransportMakeRequestResponse } from '@sentry/types';
import { DataCategory, TransportMakeRequestResponse } from '@sentry/types';
export type RateLimits = Record<string, number>;

@@ -18,7 +18,7 @@ export declare const DEFAULT_RETRY_AFTER: number;

*/
export declare function disabledUntil(limits: RateLimits, category: string): number;
export declare function disabledUntil(limits: RateLimits, dataCategory: DataCategory): number;
/**
* Checks if a category is rate limited
*/
export declare function isRateLimited(limits: RateLimits, category: string, now?: number): boolean;
export declare function isRateLimited(limits: RateLimits, dataCategory: DataCategory, now?: number): boolean;
/**

@@ -25,0 +25,0 @@ * Update ratelimits from incoming headers.

@@ -40,3 +40,5 @@ import { Event, ExtractedNodeRequestData, PolymorphicRequest, Transaction, TransactionSource, WebFetchHeaders, WebFetchRequest } from '@sentry/types';

* Sets parameterized route as transaction name e.g.: `GET /users/:id`
* Also adds more context data on the transaction from the request
* Also adds more context data on the transaction from the request.
*
* @deprecated This utility will be removed in v8.
*/

@@ -43,0 +45,0 @@ export declare function addRequestDataToTransaction(transaction: Transaction | undefined, req: PolymorphicRequest, deps?: InjectedNodeDeps): void;

@@ -44,3 +44,3 @@ import type { Attachment, AttachmentItem, DataCategory, DsnComponents, Envelope, EnvelopeItemType, Event, EventEnvelopeHeaders, SdkInfo, SdkMetadata, TextEncoderInternal } from '@sentry/types';

export declare function envelopeItemTypeToDataCategory(type: EnvelopeItemType): DataCategory;
/** Extracts the minimal SDK info from from the metadata or an events */
/** Extracts the minimal SDK info from the metadata or an events */
export declare function getSdkMetadataForEnvelopeHeader(metadataOrEvent?: SdkMetadata | Event): SdkInfo | undefined;

@@ -47,0 +47,0 @@ /**

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

import type { TransportMakeRequestResponse } from '@sentry/types';
import type { DataCategory, TransportMakeRequestResponse } from '@sentry/types';
export type RateLimits = Record<string, number>;

@@ -18,7 +18,7 @@ export declare const DEFAULT_RETRY_AFTER: number;

*/
export declare function disabledUntil(limits: RateLimits, category: string): number;
export declare function disabledUntil(limits: RateLimits, dataCategory: DataCategory): number;
/**
* Checks if a category is rate limited
*/
export declare function isRateLimited(limits: RateLimits, category: string, now?: number): boolean;
export declare function isRateLimited(limits: RateLimits, dataCategory: DataCategory, now?: number): boolean;
/**

@@ -25,0 +25,0 @@ * Update ratelimits from incoming headers.

@@ -40,3 +40,5 @@ import type { Event, ExtractedNodeRequestData, PolymorphicRequest, Transaction, TransactionSource, WebFetchHeaders, WebFetchRequest } from '@sentry/types';

* Sets parameterized route as transaction name e.g.: `GET /users/:id`
* Also adds more context data on the transaction from the request
* Also adds more context data on the transaction from the request.
*
* @deprecated This utility will be removed in v8.
*/

@@ -43,0 +45,0 @@ export declare function addRequestDataToTransaction(transaction: Transaction | undefined, req: PolymorphicRequest, deps?: InjectedNodeDeps): void;

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc