Socket
Socket
Sign inDemoInstall

@sentry/node

Package Overview
Dependencies
Maintainers
11
Versions
517
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sentry/node - npm Package Compare versions

Comparing version 7.109.0 to 7.110.0

cjs/trpc.js

2

cjs/async/domain.js

@@ -15,2 +15,3 @@ var {

// eslint-disable-next-line deprecation/deprecation
function getCurrentHub() {

@@ -29,2 +30,3 @@ const activeDomain = getActiveDomain();

// eslint-disable-next-line deprecation/deprecation
function createNewHub(parent) {

@@ -31,0 +33,0 @@ const carrier = {};

@@ -10,2 +10,3 @@ var {

// eslint-disable-next-line deprecation/deprecation
let asyncStorage;

@@ -18,5 +19,7 @@

if (!asyncStorage) {
// eslint-disable-next-line deprecation/deprecation
asyncStorage = new (async_hooks ).AsyncLocalStorage();
}
// eslint-disable-next-line deprecation/deprecation
function getCurrentHub() {

@@ -26,2 +29,3 @@ return asyncStorage.getStore();

// eslint-disable-next-line deprecation/deprecation
function createNewHub(parent) {

@@ -28,0 +32,0 @@ const carrier = {};

71

cjs/handlers.js

@@ -11,2 +11,3 @@ var {

const sdk = require('./sdk.js');
const trpc = require('./trpc.js');
const requestDataDeprecated = require('./requestDataDeprecated.js');

@@ -84,2 +85,3 @@

setImmediate(() => {
// eslint-disable-next-line deprecation/deprecation
utils.addRequestDataToTransaction(transaction, req);

@@ -278,60 +280,17 @@ core.setHttpStatus(transaction, res.statusCode);

* e.g. Express Request Handlers or Next.js SDK.
*
* @deprecated Please use the top level export instead:
* ```
* // OLD
* import * as Sentry from '@sentry/node';
* Sentry.Handlers.trpcMiddleware();
*
* // NEW
* import * as Sentry from '@sentry/node';
* Sentry.trpcMiddleware();
* ```
*/
function trpcMiddleware(options = {}) {
return function ({ path, type, next, rawInput }) {
const clientOptions = _optionalChain([core.getClient, 'call', _12 => _12(), 'optionalAccess', _13 => _13.getOptions, 'call', _14 => _14()]);
// eslint-disable-next-line deprecation/deprecation
const sentryTransaction = core.getCurrentScope().getTransaction();
// eslint-disable-next-line deprecation/deprecation
const trpcMiddleware = trpc.trpcMiddleware;
if (sentryTransaction) {
sentryTransaction.updateName(`trpc/${path}`);
sentryTransaction.setAttribute(core.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'route');
sentryTransaction.op = 'rpc.server';
const trpcContext = {
procedure_type: type,
};
if (options.attachRpcInput !== undefined ? options.attachRpcInput : _optionalChain([clientOptions, 'optionalAccess', _15 => _15.sendDefaultPii])) {
trpcContext.input = utils.normalize(rawInput);
}
// TODO: Can we rewrite this to an attribute? Or set this on the scope?
// eslint-disable-next-line deprecation/deprecation
sentryTransaction.setContext('trpc', trpcContext);
}
function captureIfError(nextResult) {
if (!nextResult.ok) {
core.captureException(nextResult.error, { mechanism: { handled: false, data: { function: 'trpcMiddleware' } } });
}
}
let maybePromiseResult;
try {
maybePromiseResult = next();
} catch (e) {
core.captureException(e, { mechanism: { handled: false, data: { function: 'trpcMiddleware' } } });
throw e;
}
if (utils.isThenable(maybePromiseResult)) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
Promise.resolve(maybePromiseResult).then(
nextResult => {
captureIfError(nextResult );
},
e => {
core.captureException(e, { mechanism: { handled: false, data: { function: 'trpcMiddleware' } } });
},
);
} else {
captureIfError(maybePromiseResult );
}
// We return the original promise just to be safe.
return maybePromiseResult;
};
}
exports.extractRequestData = requestDataDeprecated.extractRequestData;

@@ -338,0 +297,0 @@ exports.parseRequest = requestDataDeprecated.parseRequest;

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

const http$1 = require('./integrations/http.js');
const trpc = require('./trpc.js');
const cron$1 = require('./cron/cron.js');

@@ -145,2 +146,3 @@ const nodeCron = require('./cron/node-cron.js');

exports.httpIntegration = http$1.httpIntegration;
exports.trpcMiddleware = trpc.trpcMiddleware;
exports.Integrations = Integrations;

@@ -147,0 +149,0 @@ exports.cron = cron;

@@ -71,2 +71,3 @@ var {

_addGlobalEventProcessor,
// eslint-disable-next-line deprecation/deprecation
setupOnceGetCurrentHub,

@@ -73,0 +74,0 @@ ) {

@@ -10,2 +10,3 @@ import { _optionalChain } from '@sentry/utils';

// eslint-disable-next-line deprecation/deprecation
function getCurrentHub() {

@@ -24,2 +25,3 @@ const activeDomain = getActiveDomain();

// eslint-disable-next-line deprecation/deprecation
function createNewHub(parent) {

@@ -26,0 +28,0 @@ const carrier = {};

@@ -5,2 +5,3 @@ import { _optionalChain } from '@sentry/utils';

// eslint-disable-next-line deprecation/deprecation
let asyncStorage;

@@ -13,5 +14,7 @@

if (!asyncStorage) {
// eslint-disable-next-line deprecation/deprecation
asyncStorage = new (async_hooks ).AsyncLocalStorage();
}
// eslint-disable-next-line deprecation/deprecation
function getCurrentHub() {

@@ -21,2 +24,3 @@ return asyncStorage.getStore();

// eslint-disable-next-line deprecation/deprecation
function createNewHub(parent) {

@@ -23,0 +27,0 @@ const carrier = {};

import { _optionalChain } from '@sentry/utils';
import { hasTracingEnabled, continueTrace, startTransaction, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, getCurrentScope, setHttpStatus, getClient, flush, runWithAsyncContext, withScope, getActiveSpan, captureException } from '@sentry/core';
import { isString, extractPathForTransaction, extractRequestData, addRequestDataToTransaction, logger, normalize, isThenable, dropUndefinedKeys } from '@sentry/utils';
import { isString, extractPathForTransaction, extractRequestData, addRequestDataToTransaction, logger, dropUndefinedKeys } from '@sentry/utils';
import { DEBUG_BUILD } from './debug-build.js';
import { isAutoSessionTrackingEnabled } from './sdk.js';
import { trpcMiddleware as trpcMiddleware$1 } from './trpc.js';
export { extractRequestData, parseRequest } from './requestDataDeprecated.js';

@@ -78,2 +79,3 @@

setImmediate(() => {
// eslint-disable-next-line deprecation/deprecation
addRequestDataToTransaction(transaction, req);

@@ -272,61 +274,18 @@ setHttpStatus(transaction, res.statusCode);

* e.g. Express Request Handlers or Next.js SDK.
*
* @deprecated Please use the top level export instead:
* ```
* // OLD
* import * as Sentry from '@sentry/node';
* Sentry.Handlers.trpcMiddleware();
*
* // NEW
* import * as Sentry from '@sentry/node';
* Sentry.trpcMiddleware();
* ```
*/
function trpcMiddleware(options = {}) {
return function ({ path, type, next, rawInput }) {
const clientOptions = _optionalChain([getClient, 'call', _12 => _12(), 'optionalAccess', _13 => _13.getOptions, 'call', _14 => _14()]);
// eslint-disable-next-line deprecation/deprecation
const sentryTransaction = getCurrentScope().getTransaction();
// eslint-disable-next-line deprecation/deprecation
const trpcMiddleware = trpcMiddleware$1;
if (sentryTransaction) {
sentryTransaction.updateName(`trpc/${path}`);
sentryTransaction.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'route');
sentryTransaction.op = 'rpc.server';
const trpcContext = {
procedure_type: type,
};
if (options.attachRpcInput !== undefined ? options.attachRpcInput : _optionalChain([clientOptions, 'optionalAccess', _15 => _15.sendDefaultPii])) {
trpcContext.input = normalize(rawInput);
}
// TODO: Can we rewrite this to an attribute? Or set this on the scope?
// eslint-disable-next-line deprecation/deprecation
sentryTransaction.setContext('trpc', trpcContext);
}
function captureIfError(nextResult) {
if (!nextResult.ok) {
captureException(nextResult.error, { mechanism: { handled: false, data: { function: 'trpcMiddleware' } } });
}
}
let maybePromiseResult;
try {
maybePromiseResult = next();
} catch (e) {
captureException(e, { mechanism: { handled: false, data: { function: 'trpcMiddleware' } } });
throw e;
}
if (isThenable(maybePromiseResult)) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
Promise.resolve(maybePromiseResult).then(
nextResult => {
captureIfError(nextResult );
},
e => {
captureException(e, { mechanism: { handled: false, data: { function: 'trpcMiddleware' } } });
},
);
} else {
captureIfError(maybePromiseResult );
}
// We return the original promise just to be safe.
return maybePromiseResult;
};
}
export { errorHandler, requestHandler, tracingHandler, trpcMiddleware };
//# sourceMappingURL=handlers.js.map

@@ -28,2 +28,3 @@ import { Integrations as Integrations$1 } from '@sentry/core';

export { Http, httpIntegration } from './integrations/http.js';
export { trpcMiddleware } from './trpc.js';
import { instrumentCron } from './cron/cron.js';

@@ -30,0 +31,0 @@ import { instrumentNodeCron } from './cron/node-cron.js';

@@ -66,2 +66,3 @@ import { _optionalChain } from '@sentry/utils';

_addGlobalEventProcessor,
// eslint-disable-next-line deprecation/deprecation
setupOnceGetCurrentHub,

@@ -68,0 +69,0 @@ ) {

{
"name": "@sentry/node",
"version": "7.109.0",
"version": "7.110.0",
"description": "Official Sentry SDK for Node.js",

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

"dependencies": {
"@sentry-internal/tracing": "7.109.0",
"@sentry/core": "7.109.0",
"@sentry/types": "7.109.0",
"@sentry/utils": "7.109.0"
"@sentry-internal/tracing": "7.110.0",
"@sentry/core": "7.110.0",
"@sentry/types": "7.110.0",
"@sentry/utils": "7.110.0"
},

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

@@ -5,2 +5,3 @@ /// <reference types="node" />

import { ParseRequestOptions } from './requestDataDeprecated';
import { trpcMiddleware as newTrpcMiddleware } from './trpc';
/**

@@ -39,12 +40,2 @@ * Express-compatible tracing handler.

}): (error: MiddlewareError, req: http.IncomingMessage, res: http.ServerResponse, next: (error: MiddlewareError) => void) => void;
interface SentryTrpcMiddlewareOptions {
/** Whether to include procedure inputs in reported events. Defaults to `false`. */
attachRpcInput?: boolean;
}
interface TrpcMiddlewareArguments<T> {
path: string;
type: string;
next: () => T;
rawInput: unknown;
}
/**

@@ -55,6 +46,17 @@ * Sentry tRPC middleware that names the handling transaction after the called procedure.

* e.g. Express Request Handlers or Next.js SDK.
*
* @deprecated Please use the top level export instead:
* ```
* // OLD
* import * as Sentry from '@sentry/node';
* Sentry.Handlers.trpcMiddleware();
*
* // NEW
* import * as Sentry from '@sentry/node';
* Sentry.trpcMiddleware();
* ```
*/
export declare function trpcMiddleware(options?: SentryTrpcMiddlewareOptions): <T>({ path, type, next, rawInput }: TrpcMiddlewareArguments<T>) => T;
export declare const trpcMiddleware: typeof newTrpcMiddleware;
export { ParseRequestOptions, ExpressRequest } from './requestDataDeprecated';
export { parseRequest, extractRequestData } from './requestDataDeprecated';
//# sourceMappingURL=handlers.d.ts.map

@@ -137,2 +137,3 @@ export { Breadcrumb, BreadcrumbHint, PolymorphicRequest, Request, SdkInfo, Event, EventHint, Exception, Session, Severity, SeverityLevel, Span, StackFrame, Stacktrace, Thread, Transaction, User, } from '@sentry/types';

export { Handlers };
export { trpcMiddleware } from './trpc';
export { hapiErrorPlugin } from './integrations/hapi';

@@ -139,0 +140,0 @@ import { instrumentCron } from './cron/cron';

@@ -5,2 +5,3 @@ /// <reference types="node" />

import type { ParseRequestOptions } from './requestDataDeprecated';
import { trpcMiddleware as newTrpcMiddleware } from './trpc';
/**

@@ -39,12 +40,2 @@ * Express-compatible tracing handler.

}): (error: MiddlewareError, req: http.IncomingMessage, res: http.ServerResponse, next: (error: MiddlewareError) => void) => void;
interface SentryTrpcMiddlewareOptions {
/** Whether to include procedure inputs in reported events. Defaults to `false`. */
attachRpcInput?: boolean;
}
interface TrpcMiddlewareArguments<T> {
path: string;
type: string;
next: () => T;
rawInput: unknown;
}
/**

@@ -55,6 +46,17 @@ * Sentry tRPC middleware that names the handling transaction after the called procedure.

* e.g. Express Request Handlers or Next.js SDK.
*
* @deprecated Please use the top level export instead:
* ```
* // OLD
* import * as Sentry from '@sentry/node';
* Sentry.Handlers.trpcMiddleware();
*
* // NEW
* import * as Sentry from '@sentry/node';
* Sentry.trpcMiddleware();
* ```
*/
export declare function trpcMiddleware(options?: SentryTrpcMiddlewareOptions): <T>({ path, type, next, rawInput }: TrpcMiddlewareArguments<T>) => T;
export declare const trpcMiddleware: typeof newTrpcMiddleware;
export type { ParseRequestOptions, ExpressRequest } from './requestDataDeprecated';
export { parseRequest, extractRequestData } from './requestDataDeprecated';
//# sourceMappingURL=handlers.d.ts.map

@@ -137,2 +137,3 @@ export type { Breadcrumb, BreadcrumbHint, PolymorphicRequest, Request, SdkInfo, Event, EventHint, Exception, Session, Severity, SeverityLevel, Span, StackFrame, Stacktrace, Thread, Transaction, User, } from '@sentry/types';

export { Handlers };
export { trpcMiddleware } from './trpc';
export { hapiErrorPlugin } from './integrations/hapi';

@@ -139,0 +140,0 @@ import { instrumentCron } from './cron/cron';

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 too big to display

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 too big to display

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