fix: prevent asset conflicts between React and Grid.js versions

Add coexistence checks to all enqueue methods to prevent loading
both React and Grid.js assets simultaneously.

Changes:
- ReactAdmin.php: Only enqueue React assets when ?react=1
- Init.php: Skip Grid.js when React active on admin pages
- Form.php, Coupon.php, Access.php: Restore classic assets when ?react=0
- Customer.php, Product.php, License.php: Add coexistence checks

Now the toggle between Classic and React versions works correctly.

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
dwindown
2026-04-18 17:02:14 +07:00
parent bd9cdac02e
commit e8fbfb14c1
74973 changed files with 6658406 additions and 71 deletions

29
node_modules/@sentry/node/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,29 @@
BSD 3-Clause License
Copyright (c) 2019, Sentry
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

64
node_modules/@sentry/node/README.md generated vendored Normal file
View File

@@ -0,0 +1,64 @@
<p align="center">
<a href="https://sentry.io" target="_blank" align="center">
<img src="https://sentry-brand.storage.googleapis.com/sentry-logo-black.png" width="280">
</a>
<br />
</p>
# Official Sentry SDK for NodeJS
[![npm version](https://img.shields.io/npm/v/@sentry/node.svg)](https://www.npmjs.com/package/@sentry/node)
[![npm dm](https://img.shields.io/npm/dm/@sentry/node.svg)](https://www.npmjs.com/package/@sentry/node)
[![npm dt](https://img.shields.io/npm/dt/@sentry/node.svg)](https://www.npmjs.com/package/@sentry/node)
[![typedoc](https://img.shields.io/badge/docs-typedoc-blue.svg)](http://getsentry.github.io/sentry-javascript/)
## Links
- [Official SDK Docs](https://docs.sentry.io/quickstart/)
- [TypeDoc](http://getsentry.github.io/sentry-javascript/)
## Usage
To use this SDK, call `init(options)` as early as possible in the main entry module. This will initialize the SDK and
hook into the environment. Note that you can turn off almost all side effects using the respective options.
```javascript
// ES5 Syntax
const Sentry = require('@sentry/node');
// ES6 Syntax
import * as Sentry from '@sentry/node';
Sentry.init({
dsn: '__DSN__',
// ...
});
```
To set context information or send manual events, use the exported functions of `@sentry/node`. Note that these
functions will not perform any action before you have called `init()`:
```javascript
// Set user information, as well as tags and further extras
Sentry.configureScope(scope => {
scope.setExtra('battery', 0.7);
scope.setTag('user_mode', 'admin');
scope.setUser({ id: '4711' });
// scope.clear();
});
// Add a breadcrumb for future events
Sentry.addBreadcrumb({
message: 'My Breadcrumb',
// ...
});
// Capture exceptions, messages or manual events
Sentry.captureMessage('Hello, world!');
Sentry.captureException(new Error('Good bye'));
Sentry.captureEvent({
message: 'Manual',
stacktrace: [
// ...
],
});
```

22
node_modules/@sentry/node/dist/backend.d.ts generated vendored Normal file
View File

@@ -0,0 +1,22 @@
import { BaseBackend } from '@sentry/core';
import { Event, EventHint, Severity, Transport } from '@sentry/types';
import { NodeOptions } from './types';
/**
* The Sentry Node SDK Backend.
* @hidden
*/
export declare class NodeBackend extends BaseBackend<NodeOptions> {
/**
* @inheritDoc
*/
eventFromException(exception: any, hint?: EventHint): PromiseLike<Event>;
/**
* @inheritDoc
*/
eventFromMessage(message: string, level?: Severity, hint?: EventHint): PromiseLike<Event>;
/**
* @inheritDoc
*/
protected _setupTransport(): Transport;
}
//# sourceMappingURL=backend.d.ts.map

1
node_modules/@sentry/node/dist/backend.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"backend.d.ts","sourceRoot":"","sources":["../../src/backend.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAyD,MAAM,cAAc,CAAC;AAClG,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAoB,MAAM,eAAe,CAAC;AAKxF,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC;;;GAGG;AACH,qBAAa,WAAY,SAAQ,WAAW,CAAC,WAAW,CAAC;IACvD;;OAEG;IAEI,kBAAkB,CAAC,SAAS,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,SAAS,GAAG,WAAW,CAAC,KAAK,CAAC;IAI/E;;OAEG;IACI,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,GAAE,QAAwB,EAAE,IAAI,CAAC,EAAE,SAAS,GAAG,WAAW,CAAC,KAAK,CAAC;IAI/G;;OAEG;IACH,SAAS,CAAC,eAAe,IAAI,SAAS;CAqCvC"}

60
node_modules/@sentry/node/dist/backend.js generated vendored Normal file
View File

@@ -0,0 +1,60 @@
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var core_1 = require("@sentry/core");
var types_1 = require("@sentry/types");
var utils_1 = require("@sentry/utils");
var eventbuilder_1 = require("./eventbuilder");
var transports_1 = require("./transports");
/**
* The Sentry Node SDK Backend.
* @hidden
*/
var NodeBackend = /** @class */ (function (_super) {
tslib_1.__extends(NodeBackend, _super);
function NodeBackend() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* @inheritDoc
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
NodeBackend.prototype.eventFromException = function (exception, hint) {
return utils_1.resolvedSyncPromise(eventbuilder_1.eventFromUnknownInput(exception, hint));
};
/**
* @inheritDoc
*/
NodeBackend.prototype.eventFromMessage = function (message, level, hint) {
if (level === void 0) { level = types_1.Severity.Info; }
return utils_1.resolvedSyncPromise(eventbuilder_1.eventFromMessage(message, level, hint, this._options.attachStacktrace));
};
/**
* @inheritDoc
*/
NodeBackend.prototype._setupTransport = function () {
if (!this._options.dsn) {
// We return the noop transport here in case there is no Dsn.
return _super.prototype._setupTransport.call(this);
}
var dsn = utils_1.makeDsn(this._options.dsn);
var transportOptions = tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, this._options.transportOptions), (this._options.httpProxy && { httpProxy: this._options.httpProxy })), (this._options.httpsProxy && { httpsProxy: this._options.httpsProxy })), (this._options.caCerts && { caCerts: this._options.caCerts })), { dsn: this._options.dsn, tunnel: this._options.tunnel, _metadata: this._options._metadata });
if (this._options.transport) {
return new this._options.transport(transportOptions);
}
var api = core_1.initAPIDetails(transportOptions.dsn, transportOptions._metadata, transportOptions.tunnel);
var url = core_1.getEnvelopeEndpointWithUrlEncodedAuth(api.dsn, api.tunnel);
this._newTransport = transports_1.makeNodeTransport({
url: url,
headers: transportOptions.headers,
proxy: transportOptions.httpProxy,
caCerts: transportOptions.caCerts,
});
if (dsn.protocol === 'http') {
return new transports_1.HTTPTransport(transportOptions);
}
return new transports_1.HTTPSTransport(transportOptions);
};
return NodeBackend;
}(core_1.BaseBackend));
exports.NodeBackend = NodeBackend;
//# sourceMappingURL=backend.js.map

1
node_modules/@sentry/node/dist/backend.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"backend.js","sourceRoot":"","sources":["../../src/backend.ts"],"names":[],"mappings":";;AAAA,qCAAkG;AAClG,uCAAwF;AACxF,uCAA6D;AAE7D,+CAAyE;AACzE,2CAAgF;AAGhF;;;GAGG;AACH;IAAiC,uCAAwB;IAAzD;;IAwDA,CAAC;IAvDC;;OAEG;IACH,iHAAiH;IAC1G,wCAAkB,GAAzB,UAA0B,SAAc,EAAE,IAAgB;QACxD,OAAO,2BAAmB,CAAC,oCAAqB,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC;IACrE,CAAC;IAED;;OAEG;IACI,sCAAgB,GAAvB,UAAwB,OAAe,EAAE,KAA+B,EAAE,IAAgB;QAAjD,sBAAA,EAAA,QAAkB,gBAAQ,CAAC,IAAI;QACtE,OAAO,2BAAmB,CAAC,+BAAgB,CAAC,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC,CAAC;IACrG,CAAC;IAED;;OAEG;IACO,qCAAe,GAAzB;QACE,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE;YACtB,6DAA6D;YAC7D,OAAO,iBAAM,eAAe,WAAE,CAAC;SAChC;QAED,IAAM,GAAG,GAAG,eAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;QAEvC,IAAM,gBAAgB,4FACjB,IAAI,CAAC,QAAQ,CAAC,gBAAgB,GAC9B,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,IAAI,EAAE,SAAS,EAAE,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE,CAAC,GACnE,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,IAAI,EAAE,UAAU,EAAE,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC,GACtE,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,KAChE,GAAG,EAAE,IAAI,CAAC,QAAQ,CAAC,GAAG,EACtB,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,EAC5B,SAAS,EAAE,IAAI,CAAC,QAAQ,CAAC,SAAS,GACnC,CAAC;QAEF,IAAI,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE;YAC3B,OAAO,IAAI,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC;SACtD;QAED,IAAM,GAAG,GAAG,qBAAc,CAAC,gBAAgB,CAAC,GAAG,EAAE,gBAAgB,CAAC,SAAS,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAC;QACtG,IAAM,GAAG,GAAG,4CAAqC,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;QAEvE,IAAI,CAAC,aAAa,GAAG,8BAAiB,CAAC;YACrC,GAAG,KAAA;YACH,OAAO,EAAE,gBAAgB,CAAC,OAAO;YACjC,KAAK,EAAE,gBAAgB,CAAC,SAAS;YACjC,OAAO,EAAE,gBAAgB,CAAC,OAAO;SAClC,CAAC,CAAC;QAEH,IAAI,GAAG,CAAC,QAAQ,KAAK,MAAM,EAAE;YAC3B,OAAO,IAAI,0BAAa,CAAC,gBAAgB,CAAC,CAAC;SAC5C;QACD,OAAO,IAAI,2BAAc,CAAC,gBAAgB,CAAC,CAAC;IAC9C,CAAC;IACH,kBAAC;AAAD,CAAC,AAxDD,CAAiC,kBAAW,GAwD3C;AAxDY,kCAAW","sourcesContent":["import { BaseBackend, getEnvelopeEndpointWithUrlEncodedAuth, initAPIDetails } from '@sentry/core';\nimport { Event, EventHint, Severity, Transport, TransportOptions } from '@sentry/types';\nimport { makeDsn, resolvedSyncPromise } from '@sentry/utils';\n\nimport { eventFromMessage, eventFromUnknownInput } from './eventbuilder';\nimport { HTTPSTransport, HTTPTransport, makeNodeTransport } from './transports';\nimport { NodeOptions } from './types';\n\n/**\n * The Sentry Node SDK Backend.\n * @hidden\n */\nexport class NodeBackend extends BaseBackend<NodeOptions> {\n /**\n * @inheritDoc\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types\n public eventFromException(exception: any, hint?: EventHint): PromiseLike<Event> {\n return resolvedSyncPromise(eventFromUnknownInput(exception, hint));\n }\n\n /**\n * @inheritDoc\n */\n public eventFromMessage(message: string, level: Severity = Severity.Info, hint?: EventHint): PromiseLike<Event> {\n return resolvedSyncPromise(eventFromMessage(message, level, hint, this._options.attachStacktrace));\n }\n\n /**\n * @inheritDoc\n */\n protected _setupTransport(): Transport {\n if (!this._options.dsn) {\n // We return the noop transport here in case there is no Dsn.\n return super._setupTransport();\n }\n\n const dsn = makeDsn(this._options.dsn);\n\n const transportOptions: TransportOptions = {\n ...this._options.transportOptions,\n ...(this._options.httpProxy && { httpProxy: this._options.httpProxy }),\n ...(this._options.httpsProxy && { httpsProxy: this._options.httpsProxy }),\n ...(this._options.caCerts && { caCerts: this._options.caCerts }),\n dsn: this._options.dsn,\n tunnel: this._options.tunnel,\n _metadata: this._options._metadata,\n };\n\n if (this._options.transport) {\n return new this._options.transport(transportOptions);\n }\n\n const api = initAPIDetails(transportOptions.dsn, transportOptions._metadata, transportOptions.tunnel);\n const url = getEnvelopeEndpointWithUrlEncodedAuth(api.dsn, api.tunnel);\n\n this._newTransport = makeNodeTransport({\n url,\n headers: transportOptions.headers,\n proxy: transportOptions.httpProxy,\n caCerts: transportOptions.caCerts,\n });\n\n if (dsn.protocol === 'http') {\n return new HTTPTransport(transportOptions);\n }\n return new HTTPSTransport(transportOptions);\n }\n}\n"]}

44
node_modules/@sentry/node/dist/client.d.ts generated vendored Normal file
View File

@@ -0,0 +1,44 @@
import { BaseClient, Scope } from '@sentry/core';
import { SessionFlusher } from '@sentry/hub';
import { Event, EventHint } from '@sentry/types';
import { NodeBackend } from './backend';
import { NodeOptions } from './types';
/**
* The Sentry Node SDK Client.
*
* @see NodeOptions for documentation on configuration options.
* @see SentryClient for usage documentation.
*/
export declare class NodeClient extends BaseClient<NodeBackend, NodeOptions> {
protected _sessionFlusher: SessionFlusher | undefined;
/**
* Creates a new Node SDK instance.
* @param options Configuration options for this SDK.
*/
constructor(options: NodeOptions);
/**
* @inheritDoc
*/
captureException(exception: any, hint?: EventHint, scope?: Scope): string | undefined;
/**
* @inheritDoc
*/
captureEvent(event: Event, hint?: EventHint, scope?: Scope): string | undefined;
/**
*
* @inheritdoc
*/
close(timeout?: number): PromiseLike<boolean>;
/** Method that initialises an instance of SessionFlusher on Client */
initSessionFlusher(): void;
/**
* @inheritDoc
*/
protected _prepareEvent(event: Event, scope?: Scope, hint?: EventHint): PromiseLike<Event | null>;
/**
* Method responsible for capturing/ending a request session by calling `incrementSessionStatusCount` to increment
* appropriate session aggregates bucket
*/
protected _captureRequestSession(): void;
}
//# sourceMappingURL=client.d.ts.map

1
node_modules/@sentry/node/dist/client.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,EAAe,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAGjD,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC;;;;;GAKG;AACH,qBAAa,UAAW,SAAQ,UAAU,CAAC,WAAW,EAAE,WAAW,CAAC;IAClE,SAAS,CAAC,eAAe,EAAE,cAAc,GAAG,SAAS,CAAC;IAEtD;;;OAGG;gBACgB,OAAO,EAAE,WAAW;IAgBvC;;OAEG;IAEI,gBAAgB,CAAC,SAAS,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,SAAS,EAAE,KAAK,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,SAAS;IAiB5F;;OAEG;IACI,YAAY,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,SAAS,EAAE,KAAK,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,SAAS;IAwBtF;;;OAGG;IACI,KAAK,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,WAAW,CAAC,OAAO,CAAC;IAKpD,sEAAsE;IAC/D,kBAAkB,IAAI,IAAI;IAYjC;;OAEG;IACH,SAAS,CAAC,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,SAAS,GAAG,WAAW,CAAC,KAAK,GAAG,IAAI,CAAC;IAQjG;;;OAGG;IACH,SAAS,CAAC,sBAAsB,IAAI,IAAI;CAOzC"}

123
node_modules/@sentry/node/dist/client.js generated vendored Normal file
View File

@@ -0,0 +1,123 @@
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var core_1 = require("@sentry/core");
var hub_1 = require("@sentry/hub");
var utils_1 = require("@sentry/utils");
var backend_1 = require("./backend");
var flags_1 = require("./flags");
/**
* The Sentry Node SDK Client.
*
* @see NodeOptions for documentation on configuration options.
* @see SentryClient for usage documentation.
*/
var NodeClient = /** @class */ (function (_super) {
tslib_1.__extends(NodeClient, _super);
/**
* Creates a new Node SDK instance.
* @param options Configuration options for this SDK.
*/
function NodeClient(options) {
var _this = this;
options._metadata = options._metadata || {};
options._metadata.sdk = options._metadata.sdk || {
name: 'sentry.javascript.node',
packages: [
{
name: 'npm:@sentry/node',
version: core_1.SDK_VERSION,
},
],
version: core_1.SDK_VERSION,
};
_this = _super.call(this, backend_1.NodeBackend, options) || this;
return _this;
}
/**
* @inheritDoc
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
NodeClient.prototype.captureException = function (exception, hint, scope) {
// Check if the flag `autoSessionTracking` is enabled, and if `_sessionFlusher` exists because it is initialised only
// when the `requestHandler` middleware is used, and hence the expectation is to have SessionAggregates payload
// sent to the Server only when the `requestHandler` middleware is used
if (this._options.autoSessionTracking && this._sessionFlusher && scope) {
var requestSession = scope.getRequestSession();
// Necessary checks to ensure this is code block is executed only within a request
// Should override the status only if `requestSession.status` is `Ok`, which is its initial stage
if (requestSession && requestSession.status === 'ok') {
requestSession.status = 'errored';
}
}
return _super.prototype.captureException.call(this, exception, hint, scope);
};
/**
* @inheritDoc
*/
NodeClient.prototype.captureEvent = function (event, hint, scope) {
// Check if the flag `autoSessionTracking` is enabled, and if `_sessionFlusher` exists because it is initialised only
// when the `requestHandler` middleware is used, and hence the expectation is to have SessionAggregates payload
// sent to the Server only when the `requestHandler` middleware is used
if (this._options.autoSessionTracking && this._sessionFlusher && scope) {
var eventType = event.type || 'exception';
var isException = eventType === 'exception' && event.exception && event.exception.values && event.exception.values.length > 0;
// If the event is of type Exception, then a request session should be captured
if (isException) {
var requestSession = scope.getRequestSession();
// Ensure that this is happening within the bounds of a request, and make sure not to override
// Session Status if Errored / Crashed
if (requestSession && requestSession.status === 'ok') {
requestSession.status = 'errored';
}
}
}
return _super.prototype.captureEvent.call(this, event, hint, scope);
};
/**
*
* @inheritdoc
*/
NodeClient.prototype.close = function (timeout) {
var _a;
(_a = this._sessionFlusher) === null || _a === void 0 ? void 0 : _a.close();
return _super.prototype.close.call(this, timeout);
};
/** Method that initialises an instance of SessionFlusher on Client */
NodeClient.prototype.initSessionFlusher = function () {
var _a = this._options, release = _a.release, environment = _a.environment;
if (!release) {
flags_1.IS_DEBUG_BUILD && utils_1.logger.warn('Cannot initialise an instance of SessionFlusher if no release is provided!');
}
else {
this._sessionFlusher = new hub_1.SessionFlusher(this.getTransport(), {
release: release,
environment: environment,
});
}
};
/**
* @inheritDoc
*/
NodeClient.prototype._prepareEvent = function (event, scope, hint) {
event.platform = event.platform || 'node';
if (this.getOptions().serverName) {
event.server_name = this.getOptions().serverName;
}
return _super.prototype._prepareEvent.call(this, event, scope, hint);
};
/**
* Method responsible for capturing/ending a request session by calling `incrementSessionStatusCount` to increment
* appropriate session aggregates bucket
*/
NodeClient.prototype._captureRequestSession = function () {
if (!this._sessionFlusher) {
flags_1.IS_DEBUG_BUILD && utils_1.logger.warn('Discarded request mode session because autoSessionTracking option was disabled');
}
else {
this._sessionFlusher.incrementSessionStatusCount();
}
};
return NodeClient;
}(core_1.BaseClient));
exports.NodeClient = NodeClient;
//# sourceMappingURL=client.js.map

1
node_modules/@sentry/node/dist/client.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

20
node_modules/@sentry/node/dist/eventbuilder.d.ts generated vendored Normal file
View File

@@ -0,0 +1,20 @@
import { Event, EventHint, Exception, Severity, StackFrame } from '@sentry/types';
/**
* Extracts stack frames from the error.stack string
*/
export declare function parseStackFrames(error: Error): StackFrame[];
/**
* Extracts stack frames from the error and builds a Sentry Exception
*/
export declare function exceptionFromError(error: Error): Exception;
/**
* Builds and Event from a Exception
* @hidden
*/
export declare function eventFromUnknownInput(exception: unknown, hint?: EventHint): Event;
/**
* Builds and Event from a Message
* @hidden
*/
export declare function eventFromMessage(message: string, level?: Severity, hint?: EventHint, attachStacktrace?: boolean): Event;
//# sourceMappingURL=eventbuilder.d.ts.map

1
node_modules/@sentry/node/dist/eventbuilder.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"eventbuilder.d.ts","sourceRoot":"","sources":["../../src/eventbuilder.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAa,QAAQ,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAa7F;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,KAAK,GAAG,UAAU,EAAE,CAE3D;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,KAAK,GAAG,SAAS,CAY1D;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,SAAS,GAAG,KAAK,CA4CjF;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,MAAM,EACf,KAAK,GAAE,QAAwB,EAC/B,IAAI,CAAC,EAAE,SAAS,EAChB,gBAAgB,CAAC,EAAE,OAAO,GACzB,KAAK,CAeP"}

90
node_modules/@sentry/node/dist/eventbuilder.js generated vendored Normal file
View File

@@ -0,0 +1,90 @@
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var hub_1 = require("@sentry/hub");
var types_1 = require("@sentry/types");
var utils_1 = require("@sentry/utils");
var stack_parser_1 = require("./stack-parser");
/**
* Extracts stack frames from the error.stack string
*/
function parseStackFrames(error) {
return utils_1.createStackParser(stack_parser_1.nodeStackParser)(error.stack || '', 1);
}
exports.parseStackFrames = parseStackFrames;
/**
* Extracts stack frames from the error and builds a Sentry Exception
*/
function exceptionFromError(error) {
var exception = {
type: error.name || error.constructor.name,
value: error.message,
};
var frames = parseStackFrames(error);
if (frames.length) {
exception.stacktrace = { frames: frames };
}
return exception;
}
exports.exceptionFromError = exceptionFromError;
/**
* Builds and Event from a Exception
* @hidden
*/
function eventFromUnknownInput(exception, hint) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
var ex = exception;
var providedMechanism = hint && hint.data && hint.data.mechanism;
var mechanism = providedMechanism || {
handled: true,
type: 'generic',
};
if (!utils_1.isError(exception)) {
if (utils_1.isPlainObject(exception)) {
// This will allow us to group events based on top-level keys
// which is much better than creating new group when any key/value change
var message = "Non-Error exception captured with keys: " + utils_1.extractExceptionKeysForMessage(exception);
hub_1.getCurrentHub().configureScope(function (scope) {
scope.setExtra('__serialized__', utils_1.normalizeToSize(exception));
});
ex = (hint && hint.syntheticException) || new Error(message);
ex.message = message;
}
else {
// This handles when someone does: `throw "something awesome";`
// We use synthesized Error here so we can extract a (rough) stack trace.
ex = (hint && hint.syntheticException) || new Error(exception);
ex.message = exception;
}
mechanism.synthetic = true;
}
var event = {
exception: {
values: [exceptionFromError(ex)],
},
};
utils_1.addExceptionTypeValue(event, undefined, undefined);
utils_1.addExceptionMechanism(event, mechanism);
return tslib_1.__assign(tslib_1.__assign({}, event), { event_id: hint && hint.event_id });
}
exports.eventFromUnknownInput = eventFromUnknownInput;
/**
* Builds and Event from a Message
* @hidden
*/
function eventFromMessage(message, level, hint, attachStacktrace) {
if (level === void 0) { level = types_1.Severity.Info; }
var event = {
event_id: hint && hint.event_id,
level: level,
message: message,
};
if (attachStacktrace && hint && hint.syntheticException) {
var frames_1 = parseStackFrames(hint.syntheticException);
if (frames_1.length) {
event.stacktrace = { frames: frames_1 };
}
}
return event;
}
exports.eventFromMessage = eventFromMessage;
//# sourceMappingURL=eventbuilder.js.map

1
node_modules/@sentry/node/dist/eventbuilder.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

3
node_modules/@sentry/node/dist/flags.d.ts generated vendored Normal file
View File

@@ -0,0 +1,3 @@
/** Flag that is true for debug builds, false otherwise. */
export declare const IS_DEBUG_BUILD: boolean;
//# sourceMappingURL=flags.d.ts.map

1
node_modules/@sentry/node/dist/flags.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"flags.d.ts","sourceRoot":"","sources":["../../src/flags.ts"],"names":[],"mappings":"AAgBA,2DAA2D;AAC3D,eAAO,MAAM,cAAc,SAAoE,CAAC"}

17
node_modules/@sentry/node/dist/flags.js generated vendored Normal file
View File

@@ -0,0 +1,17 @@
/*
* This file defines flags and constants that can be modified during compile time in order to facilitate tree shaking
* for users.
*
* Debug flags need to be declared in each package individually and must not be imported across package boundaries,
* because some build tools have trouble tree-shaking imported guards.
*
* As a convention, we define debug flags in a `flags.ts` file in the root of a package's `src` folder.
*
* Debug flag files will contain "magic strings" like `__SENTRY_DEBUG__` that may get replaced with actual values during
* our, or the user's build process. Take care when introducing new flags - they must not throw if they are not
* replaced.
*/
Object.defineProperty(exports, "__esModule", { value: true });
/** Flag that is true for debug builds, false otherwise. */
exports.IS_DEBUG_BUILD = typeof __SENTRY_DEBUG__ === 'undefined' ? true : __SENTRY_DEBUG__;
//# sourceMappingURL=flags.js.map

1
node_modules/@sentry/node/dist/flags.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"flags.js","sourceRoot":"","sources":["../../src/flags.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;;AAIH,2DAA2D;AAC9C,QAAA,cAAc,GAAG,OAAO,gBAAgB,KAAK,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,gBAAgB,CAAC","sourcesContent":["/*\n * This file defines flags and constants that can be modified during compile time in order to facilitate tree shaking\n * for users.\n *\n * Debug flags need to be declared in each package individually and must not be imported across package boundaries,\n * because some build tools have trouble tree-shaking imported guards.\n *\n * As a convention, we define debug flags in a `flags.ts` file in the root of a package's `src` folder.\n *\n * Debug flag files will contain \"magic strings\" like `__SENTRY_DEBUG__` that may get replaced with actual values during\n * our, or the user's build process. Take care when introducing new flags - they must not throw if they are not\n * replaced.\n */\n\ndeclare const __SENTRY_DEBUG__: boolean;\n\n/** Flag that is true for debug builds, false otherwise. */\nexport const IS_DEBUG_BUILD = typeof __SENTRY_DEBUG__ === 'undefined' ? true : __SENTRY_DEBUG__;\n"]}

92
node_modules/@sentry/node/dist/handlers.d.ts generated vendored Normal file
View File

@@ -0,0 +1,92 @@
/// <reference types="node" />
import { Event, ExtractedNodeRequestData } from '@sentry/types';
import * as http from 'http';
export interface ExpressRequest {
baseUrl?: string;
connection?: {
remoteAddress?: string;
};
ip?: string;
method?: string;
originalUrl?: string;
route?: {
path: string;
stack: [{
name: string;
}];
};
query?: {
[key: string]: unknown;
};
url?: string;
user?: {
[key: string]: any;
};
}
/**
* Express-compatible tracing handler.
* @see Exposed as `Handlers.tracingHandler`
*/
export declare function tracingHandler(): (req: http.IncomingMessage, res: http.ServerResponse, next: (error?: any) => void) => void;
declare type TransactionNamingScheme = 'path' | 'methodPath' | 'handler';
/**
* Normalizes data from the request object, accounting for framework differences.
*
* @param req The request object from which to extract data
* @param keys An optional array of keys to include in the normalized data. Defaults to DEFAULT_REQUEST_KEYS if not
* provided.
* @returns An object containing normalized request data
*/
export declare function extractRequestData(req: {
[key: string]: any;
}, keys?: string[]): ExtractedNodeRequestData;
/**
* Options deciding what parts of the request to use when enhancing an event
*/
export interface ParseRequestOptions {
ip?: boolean;
request?: boolean | string[];
serverName?: boolean;
transaction?: boolean | TransactionNamingScheme;
user?: boolean | string[];
version?: boolean;
}
/**
* Enriches passed event with request data.
*
* @param event Will be mutated and enriched with req data
* @param req Request object
* @param options object containing flags to enable functionality
* @hidden
*/
export declare function parseRequest(event: Event, req: ExpressRequest, options?: ParseRequestOptions): Event;
export declare type RequestHandlerOptions = ParseRequestOptions & {
flushTimeout?: number;
};
/**
* Express compatible request handler.
* @see Exposed as `Handlers.requestHandler`
*/
export declare function requestHandler(options?: RequestHandlerOptions): (req: http.IncomingMessage, res: http.ServerResponse, next: (error?: any) => void) => void;
/** JSDoc */
interface MiddlewareError extends Error {
status?: number | string;
statusCode?: number | string;
status_code?: number | string;
output?: {
statusCode?: number | string;
};
}
/**
* Express compatible error handler.
* @see Exposed as `Handlers.errorHandler`
*/
export declare function errorHandler(options?: {
/**
* Callback method deciding whether error should be captured and sent to Sentry
* @param error Captured middleware error
*/
shouldHandleError?(error: MiddlewareError): boolean;
}): (error: MiddlewareError, req: http.IncomingMessage, res: http.ServerResponse, next: (error: MiddlewareError) => void) => void;
export {};
//# sourceMappingURL=handlers.d.ts.map

1
node_modules/@sentry/node/dist/handlers.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../../src/handlers.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,KAAK,EAAE,wBAAwB,EAAqB,MAAM,eAAe,CAAC;AAWnF,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAQ7B,MAAM,WAAW,cAAc;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE;QACX,aAAa,CAAC,EAAE,MAAM,CAAC;KACxB,CAAC;IACF,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,CACL;YACE,IAAI,EAAE,MAAM,CAAC;SACd,CACF,CAAC;KACH,CAAC;IACF,KAAK,CAAC,EAAE;QAEN,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;KACxB,CAAC;IACF,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE;QACL,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACpB,CAAC;CACH;AAED;;;GAGG;AACH,wBAAgB,cAAc,IAAI,CAChC,GAAG,EAAE,IAAI,CAAC,eAAe,EACzB,GAAG,EAAE,IAAI,CAAC,cAAc,EACxB,IAAI,EAAE,CAAC,KAAK,CAAC,EAAE,GAAG,KAAK,IAAI,KACxB,IAAI,CA4CR;AAmDD,aAAK,uBAAuB,GAAG,MAAM,GAAG,YAAY,GAAG,SAAS,CAAC;AA2CjE;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAChC,GAAG,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,EAC3B,IAAI,GAAE,MAAM,EAAyB,GACpC,wBAAwB,CA+E1B;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,EAAE,CAAC,EAAE,OAAO,CAAC;IACb,OAAO,CAAC,EAAE,OAAO,GAAG,MAAM,EAAE,CAAC;IAC7B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,GAAG,uBAAuB,CAAC;IAChD,IAAI,CAAC,EAAE,OAAO,GAAG,MAAM,EAAE,CAAC;IAC1B,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,cAAc,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,KAAK,CAoEpG;AAED,oBAAY,qBAAqB,GAAG,mBAAmB,GAAG;IACxD,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,OAAO,CAAC,EAAE,qBAAqB,GAC9B,CAAC,GAAG,EAAE,IAAI,CAAC,eAAe,EAAE,GAAG,EAAE,IAAI,CAAC,cAAc,EAAE,IAAI,EAAE,CAAC,KAAK,CAAC,EAAE,GAAG,KAAK,IAAI,KAAK,IAAI,CAsE5F;AAED,YAAY;AACZ,UAAU,eAAgB,SAAQ,KAAK;IACrC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7B,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC9B,MAAM,CAAC,EAAE;QACP,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;KAC9B,CAAC;CACH;AAcD;;;GAGG;AACH,wBAAgB,YAAY,CAAC,OAAO,CAAC,EAAE;IACrC;;;OAGG;IACH,iBAAiB,CAAC,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC;CACrD,GAAG,CACF,KAAK,EAAE,eAAe,EACtB,GAAG,EAAE,IAAI,CAAC,eAAe,EACzB,GAAG,EAAE,IAAI,CAAC,cAAc,EACxB,IAAI,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,KACnC,IAAI,CAiDR"}

381
node_modules/@sentry/node/dist/handlers.js generated vendored Normal file
View File

@@ -0,0 +1,381 @@
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
/* eslint-disable max-lines */
/* eslint-disable @typescript-eslint/no-explicit-any */
var core_1 = require("@sentry/core");
var utils_1 = require("@sentry/utils");
var cookie = require("cookie");
var domain = require("domain");
var os = require("os");
var url = require("url");
var flags_1 = require("./flags");
var sdk_1 = require("./sdk");
/**
* Express-compatible tracing handler.
* @see Exposed as `Handlers.tracingHandler`
*/
function tracingHandler() {
return function sentryTracingMiddleware(req, res, next) {
// If there is a trace header set, we extract the data from it (parentSpanId, traceId, and sampling decision)
var traceparentData;
if (req.headers && utils_1.isString(req.headers['sentry-trace'])) {
traceparentData = utils_1.extractTraceparentData(req.headers['sentry-trace']);
}
var transaction = core_1.startTransaction(tslib_1.__assign({ name: extractExpressTransactionName(req, { path: true, method: true }), op: 'http.server' }, traceparentData),
// extra context passed to the tracesSampler
{ request: extractRequestData(req) });
// We put the transaction on the scope so users can attach children to it
core_1.getCurrentHub().configureScope(function (scope) {
scope.setSpan(transaction);
});
// We also set __sentry_transaction on the response so people can grab the transaction there to add
// spans to it later.
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
res.__sentry_transaction = transaction;
res.once('finish', function () {
// Push `transaction.finish` to the next event loop so open spans have a chance to finish before the transaction
// closes
setImmediate(function () {
addExpressReqToTransaction(transaction, req);
transaction.setHttpStatus(res.statusCode);
transaction.finish();
});
});
next();
};
}
exports.tracingHandler = tracingHandler;
/**
* Set parameterized as transaction name e.g.: `GET /users/:id`
* Also adds more context data on the transaction from the request
*/
function addExpressReqToTransaction(transaction, req) {
if (!transaction)
return;
transaction.name = extractExpressTransactionName(req, { path: true, method: true });
transaction.setData('url', req.originalUrl);
transaction.setData('baseUrl', req.baseUrl);
transaction.setData('query', req.query);
}
/**
* Extracts complete generalized path from the request object and uses it to construct transaction name.
*
* eg. GET /mountpoint/user/:id
*
* @param req The ExpressRequest object
* @param options What to include in the transaction name (method, path, or both)
*
* @returns The fully constructed transaction name
*/
function extractExpressTransactionName(req, options) {
if (options === void 0) { options = {}; }
var _a;
var method = (_a = req.method) === null || _a === void 0 ? void 0 : _a.toUpperCase();
var path = '';
if (req.route) {
path = "" + (req.baseUrl || '') + req.route.path;
}
else if (req.originalUrl || req.url) {
path = utils_1.stripUrlQueryAndFragment(req.originalUrl || req.url || '');
}
var info = '';
if (options.method && method) {
info += method;
}
if (options.method && options.path) {
info += ' ';
}
if (options.path && path) {
info += path;
}
return info;
}
/** JSDoc */
function extractTransaction(req, type) {
var _a;
switch (type) {
case 'path': {
return extractExpressTransactionName(req, { path: true });
}
case 'handler': {
return ((_a = req.route) === null || _a === void 0 ? void 0 : _a.stack[0].name) || '<anonymous>';
}
case 'methodPath':
default: {
return extractExpressTransactionName(req, { path: true, method: true });
}
}
}
/** Default user keys that'll be used to extract data from the request */
var DEFAULT_USER_KEYS = ['id', 'username', 'email'];
/** JSDoc */
function extractUserData(user, keys) {
var extractedUser = {};
var attributes = Array.isArray(keys) ? keys : DEFAULT_USER_KEYS;
attributes.forEach(function (key) {
if (user && key in user) {
extractedUser[key] = user[key];
}
});
return extractedUser;
}
/** Default request keys that'll be used to extract data from the request */
var DEFAULT_REQUEST_KEYS = ['cookies', 'data', 'headers', 'method', 'query_string', 'url'];
/**
* Normalizes data from the request object, accounting for framework differences.
*
* @param req The request object from which to extract data
* @param keys An optional array of keys to include in the normalized data. Defaults to DEFAULT_REQUEST_KEYS if not
* provided.
* @returns An object containing normalized request data
*/
function extractRequestData(req, keys) {
if (keys === void 0) { keys = DEFAULT_REQUEST_KEYS; }
var requestData = {};
// headers:
// node, express, nextjs: req.headers
// koa: req.header
var headers = (req.headers || req.header || {});
// method:
// node, express, koa, nextjs: req.method
var method = req.method;
// host:
// express: req.hostname in > 4 and req.host in < 4
// koa: req.host
// node, nextjs: req.headers.host
var host = req.hostname || req.host || headers.host || '<no host>';
// protocol:
// node, nextjs: <n/a>
// express, koa: req.protocol
var protocol = req.protocol === 'https' || req.secure || (req.socket || {}).encrypted
? 'https'
: 'http';
// url (including path and query string):
// node, express: req.originalUrl
// koa, nextjs: req.url
var originalUrl = (req.originalUrl || req.url || '');
// absolute url
var absoluteUrl = protocol + "://" + host + originalUrl;
keys.forEach(function (key) {
switch (key) {
case 'headers':
requestData.headers = headers;
break;
case 'method':
requestData.method = method;
break;
case 'url':
requestData.url = absoluteUrl;
break;
case 'cookies':
// cookies:
// node, express, koa: req.headers.cookie
// vercel, sails.js, express (w/ cookie middleware), nextjs: req.cookies
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
requestData.cookies = req.cookies || cookie.parse(headers.cookie || '');
break;
case 'query_string':
// query string:
// node: req.url (raw)
// express, koa, nextjs: req.query
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
requestData.query_string = req.query || url.parse(originalUrl || '', false).query;
break;
case 'data':
if (method === 'GET' || method === 'HEAD') {
break;
}
// body data:
// express, koa, nextjs: req.body
//
// when using node by itself, you have to read the incoming stream(see
// https://nodejs.dev/learn/get-http-request-body-data-using-nodejs); if a user is doing that, we can't know
// where they're going to store the final result, so they'll have to capture this data themselves
if (req.body !== undefined) {
requestData.data = utils_1.isString(req.body) ? req.body : JSON.stringify(utils_1.normalize(req.body));
}
break;
default:
if ({}.hasOwnProperty.call(req, key)) {
requestData[key] = req[key];
}
}
});
return requestData;
}
exports.extractRequestData = extractRequestData;
/**
* Enriches passed event with request data.
*
* @param event Will be mutated and enriched with req data
* @param req Request object
* @param options object containing flags to enable functionality
* @hidden
*/
function parseRequest(event, req, options) {
// eslint-disable-next-line no-param-reassign
options = tslib_1.__assign({ ip: false, request: true, serverName: true, transaction: true, user: true, version: true }, options);
if (options.version) {
event.contexts = tslib_1.__assign(tslib_1.__assign({}, event.contexts), { runtime: {
name: 'node',
version: global.process.version,
} });
}
if (options.request) {
// if the option value is `true`, use the default set of keys by not passing anything to `extractRequestData()`
var extractedRequestData = Array.isArray(options.request)
? extractRequestData(req, options.request)
: extractRequestData(req);
event.request = tslib_1.__assign(tslib_1.__assign({}, event.request), extractedRequestData);
}
if (options.serverName && !event.server_name) {
event.server_name = global.process.env.SENTRY_NAME || os.hostname();
}
if (options.user) {
var extractedUser = req.user && utils_1.isPlainObject(req.user) ? extractUserData(req.user, options.user) : {};
if (Object.keys(extractedUser)) {
event.user = tslib_1.__assign(tslib_1.__assign({}, event.user), extractedUser);
}
}
// client ip:
// node, nextjs: req.connection.remoteAddress
// express, koa: req.ip
if (options.ip) {
var ip = req.ip || (req.connection && req.connection.remoteAddress);
if (ip) {
event.user = tslib_1.__assign(tslib_1.__assign({}, event.user), { ip_address: ip });
}
}
if (options.transaction && !event.transaction) {
// TODO do we even need this anymore?
// TODO make this work for nextjs
event.transaction = extractTransaction(req, options.transaction);
}
return event;
}
exports.parseRequest = parseRequest;
/**
* Express compatible request handler.
* @see Exposed as `Handlers.requestHandler`
*/
function requestHandler(options) {
var currentHub = core_1.getCurrentHub();
var client = currentHub.getClient();
// Initialise an instance of SessionFlusher on the client when `autoSessionTracking` is enabled and the
// `requestHandler` middleware is used indicating that we are running in SessionAggregates mode
if (client && sdk_1.isAutoSessionTrackingEnabled(client)) {
client.initSessionFlusher();
// If Scope contains a Single mode Session, it is removed in favor of using Session Aggregates mode
var scope = currentHub.getScope();
if (scope && scope.getSession()) {
scope.setSession();
}
}
return function sentryRequestMiddleware(req, res, next) {
if (options && options.flushTimeout && options.flushTimeout > 0) {
// eslint-disable-next-line @typescript-eslint/unbound-method
var _end_1 = res.end;
res.end = function (chunk, encoding, cb) {
var _this = this;
void sdk_1.flush(options.flushTimeout)
.then(function () {
_end_1.call(_this, chunk, encoding, cb);
})
.then(null, function (e) {
flags_1.IS_DEBUG_BUILD && utils_1.logger.error(e);
_end_1.call(_this, chunk, encoding, cb);
});
};
}
var local = domain.create();
local.add(req);
local.add(res);
local.on('error', next);
local.run(function () {
var currentHub = core_1.getCurrentHub();
currentHub.configureScope(function (scope) {
scope.addEventProcessor(function (event) { return parseRequest(event, req, options); });
var client = currentHub.getClient();
if (sdk_1.isAutoSessionTrackingEnabled(client)) {
var scope_1 = currentHub.getScope();
if (scope_1) {
// Set `status` of `RequestSession` to Ok, at the beginning of the request
scope_1.setRequestSession({ status: 'ok' });
}
}
});
res.once('finish', function () {
var client = currentHub.getClient();
if (sdk_1.isAutoSessionTrackingEnabled(client)) {
setImmediate(function () {
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
if (client && client._captureRequestSession) {
// Calling _captureRequestSession to capture request session at the end of the request by incrementing
// the correct SessionAggregates bucket i.e. crashed, errored or exited
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
client._captureRequestSession();
}
});
}
});
next();
});
};
}
exports.requestHandler = requestHandler;
/** JSDoc */
function getStatusCodeFromResponse(error) {
var statusCode = error.status || error.statusCode || error.status_code || (error.output && error.output.statusCode);
return statusCode ? parseInt(statusCode, 10) : 500;
}
/** Returns true if response code is internal server error */
function defaultShouldHandleError(error) {
var status = getStatusCodeFromResponse(error);
return status >= 500;
}
/**
* Express compatible error handler.
* @see Exposed as `Handlers.errorHandler`
*/
function errorHandler(options) {
return function sentryErrorMiddleware(error, _req, res, next) {
// eslint-disable-next-line @typescript-eslint/unbound-method
var shouldHandleError = (options && options.shouldHandleError) || defaultShouldHandleError;
if (shouldHandleError(error)) {
core_1.withScope(function (_scope) {
// For some reason we need to set the transaction on the scope again
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
var transaction = res.__sentry_transaction;
if (transaction && _scope.getSpan() === undefined) {
_scope.setSpan(transaction);
}
var client = core_1.getCurrentHub().getClient();
if (client && sdk_1.isAutoSessionTrackingEnabled(client)) {
// Check if the `SessionFlusher` is instantiated on the client to go into this branch that marks the
// `requestSession.status` as `Crashed`, and this check is necessary because the `SessionFlusher` is only
// instantiated when the the`requestHandler` middleware is initialised, which indicates that we should be
// running in SessionAggregates mode
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
var isSessionAggregatesMode = client._sessionFlusher !== undefined;
if (isSessionAggregatesMode) {
var requestSession = _scope.getRequestSession();
// If an error bubbles to the `errorHandler`, then this is an unhandled error, and should be reported as a
// Crashed session. The `_requestSession.status` is checked to ensure that this error is happening within
// the bounds of a request, and if so the status is updated
if (requestSession && requestSession.status !== undefined) {
requestSession.status = 'crashed';
}
}
}
var eventId = core_1.captureException(error);
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
res.sentry = eventId;
next(error);
});
return;
}
next(error);
};
}
exports.errorHandler = errorHandler;
//# sourceMappingURL=handlers.js.map

1
node_modules/@sentry/node/dist/handlers.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

26
node_modules/@sentry/node/dist/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,26 @@
export { Breadcrumb, BreadcrumbHint, Request, SdkInfo, Event, EventHint, EventStatus, Exception, Response, Severity, StackFrame, Stacktrace, Thread, User, } from '@sentry/types';
export { SeverityLevel } from '@sentry/utils';
export { addGlobalEventProcessor, addBreadcrumb, captureException, captureEvent, captureMessage, configureScope, getHubFromCarrier, getCurrentHub, Hub, makeMain, Scope, Session, startTransaction, SDK_VERSION, setContext, setExtra, setExtras, setTag, setTags, setUser, withScope, } from '@sentry/core';
export { NodeOptions } from './types';
export { NodeBackend } from './backend';
export { NodeClient } from './client';
export { defaultIntegrations, init, lastEventId, flush, close, getSentryRelease } from './sdk';
export { deepReadDirSync } from './utils';
export { SDK_NAME } from './version';
import { Integrations as CoreIntegrations } from '@sentry/core';
import * as Handlers from './handlers';
import * as NodeIntegrations from './integrations';
import * as Transports from './transports';
declare const INTEGRATIONS: {
Console: typeof NodeIntegrations.Console;
Http: typeof NodeIntegrations.Http;
OnUncaughtException: typeof NodeIntegrations.OnUncaughtException;
OnUnhandledRejection: typeof NodeIntegrations.OnUnhandledRejection;
LinkedErrors: typeof NodeIntegrations.LinkedErrors;
Modules: typeof NodeIntegrations.Modules;
ContextLines: typeof NodeIntegrations.ContextLines;
FunctionToString: typeof CoreIntegrations.FunctionToString;
InboundFilters: typeof CoreIntegrations.InboundFilters;
};
export { INTEGRATIONS as Integrations, Transports, Handlers };
//# sourceMappingURL=index.d.ts.map

1
node_modules/@sentry/node/dist/index.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,cAAc,EACd,OAAO,EACP,OAAO,EACP,KAAK,EACL,SAAS,EACT,WAAW,EACX,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,UAAU,EACV,MAAM,EACN,IAAI,GACL,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9C,OAAO,EACL,uBAAuB,EACvB,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,GAAG,EACH,QAAQ,EACR,KAAK,EACL,OAAO,EACP,gBAAgB,EAChB,WAAW,EACX,UAAU,EACV,QAAQ,EACR,SAAS,EACT,MAAM,EACN,OAAO,EACP,OAAO,EACP,SAAS,GACV,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,mBAAmB,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAC/F,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAErC,OAAO,EAAE,YAAY,IAAI,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAIhE,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,gBAAgB,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAE3C,QAAA,MAAM,YAAY;;;;;;;;;;CAGjB,CAAC;AAEF,OAAO,EAAE,YAAY,IAAI,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC"}

59
node_modules/@sentry/node/dist/index.js generated vendored Normal file
View File

@@ -0,0 +1,59 @@
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var types_1 = require("@sentry/types");
exports.Severity = types_1.Severity;
var core_1 = require("@sentry/core");
exports.addGlobalEventProcessor = core_1.addGlobalEventProcessor;
exports.addBreadcrumb = core_1.addBreadcrumb;
exports.captureException = core_1.captureException;
exports.captureEvent = core_1.captureEvent;
exports.captureMessage = core_1.captureMessage;
exports.configureScope = core_1.configureScope;
exports.getHubFromCarrier = core_1.getHubFromCarrier;
exports.getCurrentHub = core_1.getCurrentHub;
exports.Hub = core_1.Hub;
exports.makeMain = core_1.makeMain;
exports.Scope = core_1.Scope;
exports.Session = core_1.Session;
exports.startTransaction = core_1.startTransaction;
exports.SDK_VERSION = core_1.SDK_VERSION;
exports.setContext = core_1.setContext;
exports.setExtra = core_1.setExtra;
exports.setExtras = core_1.setExtras;
exports.setTag = core_1.setTag;
exports.setTags = core_1.setTags;
exports.setUser = core_1.setUser;
exports.withScope = core_1.withScope;
var backend_1 = require("./backend");
exports.NodeBackend = backend_1.NodeBackend;
var client_1 = require("./client");
exports.NodeClient = client_1.NodeClient;
var sdk_1 = require("./sdk");
exports.defaultIntegrations = sdk_1.defaultIntegrations;
exports.init = sdk_1.init;
exports.lastEventId = sdk_1.lastEventId;
exports.flush = sdk_1.flush;
exports.close = sdk_1.close;
exports.getSentryRelease = sdk_1.getSentryRelease;
var utils_1 = require("./utils");
exports.deepReadDirSync = utils_1.deepReadDirSync;
var version_1 = require("./version");
exports.SDK_NAME = version_1.SDK_NAME;
var core_2 = require("@sentry/core");
var hub_1 = require("@sentry/hub");
var domain = require("domain");
var Handlers = require("./handlers");
exports.Handlers = Handlers;
var NodeIntegrations = require("./integrations");
var Transports = require("./transports");
exports.Transports = Transports;
var INTEGRATIONS = tslib_1.__assign(tslib_1.__assign({}, core_2.Integrations), NodeIntegrations);
exports.Integrations = INTEGRATIONS;
// We need to patch domain on the global __SENTRY__ object to make it work for node in cross-platform packages like
// @sentry/hub. If we don't do this, browser bundlers will have troubles resolving `require('domain')`.
var carrier = hub_1.getMainCarrier();
if (carrier.__SENTRY__) {
carrier.__SENTRY__.extensions = carrier.__SENTRY__.extensions || {};
carrier.__SENTRY__.extensions.domain = carrier.__SENTRY__.extensions.domain || domain;
}
//# sourceMappingURL=index.js.map

1
node_modules/@sentry/node/dist/index.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;AAAA,uCAeuB;AALrB,2BAAA,QAAQ,CAAA;AASV,qCAsBsB;AArBpB,yCAAA,uBAAuB,CAAA;AACvB,+BAAA,aAAa,CAAA;AACb,kCAAA,gBAAgB,CAAA;AAChB,8BAAA,YAAY,CAAA;AACZ,gCAAA,cAAc,CAAA;AACd,gCAAA,cAAc,CAAA;AACd,mCAAA,iBAAiB,CAAA;AACjB,+BAAA,aAAa,CAAA;AACb,qBAAA,GAAG,CAAA;AACH,0BAAA,QAAQ,CAAA;AACR,uBAAA,KAAK,CAAA;AACL,yBAAA,OAAO,CAAA;AACP,kCAAA,gBAAgB,CAAA;AAChB,6BAAA,WAAW,CAAA;AACX,4BAAA,UAAU,CAAA;AACV,0BAAA,QAAQ,CAAA;AACR,2BAAA,SAAS,CAAA;AACT,wBAAA,MAAM,CAAA;AACN,yBAAA,OAAO,CAAA;AACP,yBAAA,OAAO,CAAA;AACP,2BAAA,SAAS,CAAA;AAIX,qCAAwC;AAA/B,gCAAA,WAAW,CAAA;AACpB,mCAAsC;AAA7B,8BAAA,UAAU,CAAA;AACnB,6BAA+F;AAAtF,oCAAA,mBAAmB,CAAA;AAAE,qBAAA,IAAI,CAAA;AAAE,4BAAA,WAAW,CAAA;AAAE,sBAAA,KAAK,CAAA;AAAE,sBAAA,KAAK,CAAA;AAAE,iCAAA,gBAAgB,CAAA;AAC/E,iCAA0C;AAAjC,kCAAA,eAAe,CAAA;AACxB,qCAAqC;AAA5B,6BAAA,QAAQ,CAAA;AAEjB,qCAAgE;AAChE,mCAA6C;AAC7C,+BAAiC;AAEjC,qCAAuC;AASY,4BAAQ;AAR3D,iDAAmD;AACnD,yCAA2C;AAOJ,gCAAU;AALjD,IAAM,YAAY,yCACb,mBAAgB,GAChB,gBAAgB,CACpB,CAAC;AAEuB,oCAAY;AAErC,mHAAmH;AACnH,uGAAuG;AACvG,IAAM,OAAO,GAAG,oBAAc,EAAE,CAAC;AACjC,IAAI,OAAO,CAAC,UAAU,EAAE;IACtB,OAAO,CAAC,UAAU,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,UAAU,IAAI,EAAE,CAAC;IACpE,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,MAAM,IAAI,MAAM,CAAC;CACvF","sourcesContent":["export {\n Breadcrumb,\n BreadcrumbHint,\n Request,\n SdkInfo,\n Event,\n EventHint,\n EventStatus,\n Exception,\n Response,\n Severity,\n StackFrame,\n Stacktrace,\n Thread,\n User,\n} from '@sentry/types';\n\nexport { SeverityLevel } from '@sentry/utils';\n\nexport {\n addGlobalEventProcessor,\n addBreadcrumb,\n captureException,\n captureEvent,\n captureMessage,\n configureScope,\n getHubFromCarrier,\n getCurrentHub,\n Hub,\n makeMain,\n Scope,\n Session,\n startTransaction,\n SDK_VERSION,\n setContext,\n setExtra,\n setExtras,\n setTag,\n setTags,\n setUser,\n withScope,\n} from '@sentry/core';\n\nexport { NodeOptions } from './types';\nexport { NodeBackend } from './backend';\nexport { NodeClient } from './client';\nexport { defaultIntegrations, init, lastEventId, flush, close, getSentryRelease } from './sdk';\nexport { deepReadDirSync } from './utils';\nexport { SDK_NAME } from './version';\n\nimport { Integrations as CoreIntegrations } from '@sentry/core';\nimport { getMainCarrier } from '@sentry/hub';\nimport * as domain from 'domain';\n\nimport * as Handlers from './handlers';\nimport * as NodeIntegrations from './integrations';\nimport * as Transports from './transports';\n\nconst INTEGRATIONS = {\n ...CoreIntegrations,\n ...NodeIntegrations,\n};\n\nexport { INTEGRATIONS as Integrations, Transports, Handlers };\n\n// We need to patch domain on the global __SENTRY__ object to make it work for node in cross-platform packages like\n// @sentry/hub. If we don't do this, browser bundlers will have troubles resolving `require('domain')`.\nconst carrier = getMainCarrier();\nif (carrier.__SENTRY__) {\n carrier.__SENTRY__.extensions = carrier.__SENTRY__.extensions || {};\n carrier.__SENTRY__.extensions.domain = carrier.__SENTRY__.extensions.domain || domain;\n}\n"]}

View File

@@ -0,0 +1,17 @@
import { Integration } from '@sentry/types';
/** Console module integration */
export declare class Console implements Integration {
/**
* @inheritDoc
*/
static id: string;
/**
* @inheritDoc
*/
name: string;
/**
* @inheritDoc
*/
setupOnce(): void;
}
//# sourceMappingURL=console.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"console.d.ts","sourceRoot":"","sources":["../../../src/integrations/console.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAI5C,iCAAiC;AACjC,qBAAa,OAAQ,YAAW,WAAW;IACzC;;OAEG;IACH,OAAc,EAAE,EAAE,MAAM,CAAa;IAErC;;OAEG;IACI,IAAI,EAAE,MAAM,CAAc;IAEjC;;OAEG;IACI,SAAS,IAAI,IAAI;CAKzB"}

63
node_modules/@sentry/node/dist/integrations/console.js generated vendored Normal file
View File

@@ -0,0 +1,63 @@
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var core_1 = require("@sentry/core");
var utils_1 = require("@sentry/utils");
var util = require("util");
/** Console module integration */
var Console = /** @class */ (function () {
function Console() {
/**
* @inheritDoc
*/
this.name = Console.id;
}
/**
* @inheritDoc
*/
Console.prototype.setupOnce = function () {
var e_1, _a;
try {
for (var _b = tslib_1.__values(['debug', 'info', 'warn', 'error', 'log']), _c = _b.next(); !_c.done; _c = _b.next()) {
var level = _c.value;
utils_1.fill(console, level, createConsoleWrapper(level));
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_1) throw e_1.error; }
}
};
/**
* @inheritDoc
*/
Console.id = 'Console';
return Console;
}());
exports.Console = Console;
/**
* Wrapper function that'll be used for every console level
*/
function createConsoleWrapper(level) {
return function consoleWrapper(originalConsoleMethod) {
var sentryLevel = utils_1.severityFromString(level);
/* eslint-disable prefer-rest-params */
return function () {
if (core_1.getCurrentHub().getIntegration(Console)) {
core_1.getCurrentHub().addBreadcrumb({
category: 'console',
level: sentryLevel,
message: util.format.apply(undefined, arguments),
}, {
input: tslib_1.__spread(arguments),
level: level,
});
}
originalConsoleMethod.apply(this, arguments);
};
/* eslint-enable prefer-rest-params */
};
}
//# sourceMappingURL=console.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"console.js","sourceRoot":"","sources":["../../../src/integrations/console.ts"],"names":[],"mappings":";;AAAA,qCAA6C;AAE7C,uCAAyD;AACzD,2BAA6B;AAE7B,iCAAiC;AACjC;IAAA;QAME;;WAEG;QACI,SAAI,GAAW,OAAO,CAAC,EAAE,CAAC;IAUnC,CAAC;IARC;;OAEG;IACI,2BAAS,GAAhB;;;YACE,KAAoB,IAAA,KAAA,iBAAA,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,CAAC,CAAA,gBAAA,4BAAE;gBAA1D,IAAM,KAAK,WAAA;gBACd,YAAI,CAAC,OAAO,EAAE,KAAK,EAAE,oBAAoB,CAAC,KAAK,CAAC,CAAC,CAAC;aACnD;;;;;;;;;IACH,CAAC;IAjBD;;OAEG;IACW,UAAE,GAAW,SAAS,CAAC;IAevC,cAAC;CAAA,AAnBD,IAmBC;AAnBY,0BAAO;AAqBpB;;GAEG;AACH,SAAS,oBAAoB,CAAC,KAAa;IACzC,OAAO,SAAS,cAAc,CAAC,qBAAiC;QAC9D,IAAM,WAAW,GAAG,0BAAkB,CAAC,KAAK,CAAC,CAAC;QAE9C,uCAAuC;QACvC,OAAO;YACL,IAAI,oBAAa,EAAE,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE;gBAC3C,oBAAa,EAAE,CAAC,aAAa,CAC3B;oBACE,QAAQ,EAAE,SAAS;oBACnB,KAAK,EAAE,WAAW;oBAClB,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,EAAE,SAAS,CAAC;iBACjD,EACD;oBACE,KAAK,mBAAM,SAAS,CAAC;oBACrB,KAAK,OAAA;iBACN,CACF,CAAC;aACH;YAED,qBAAqB,CAAC,KAAK,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;QAC/C,CAAC,CAAC;QACF,sCAAsC;IACxC,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { getCurrentHub } from '@sentry/core';\nimport { Integration } from '@sentry/types';\nimport { fill, severityFromString } from '@sentry/utils';\nimport * as util from 'util';\n\n/** Console module integration */\nexport class Console implements Integration {\n /**\n * @inheritDoc\n */\n public static id: string = 'Console';\n\n /**\n * @inheritDoc\n */\n public name: string = Console.id;\n\n /**\n * @inheritDoc\n */\n public setupOnce(): void {\n for (const level of ['debug', 'info', 'warn', 'error', 'log']) {\n fill(console, level, createConsoleWrapper(level));\n }\n }\n}\n\n/**\n * Wrapper function that'll be used for every console level\n */\nfunction createConsoleWrapper(level: string): (originalConsoleMethod: () => void) => void {\n return function consoleWrapper(originalConsoleMethod: () => void): () => void {\n const sentryLevel = severityFromString(level);\n\n /* eslint-disable prefer-rest-params */\n return function (this: typeof console): void {\n if (getCurrentHub().getIntegration(Console)) {\n getCurrentHub().addBreadcrumb(\n {\n category: 'console',\n level: sentryLevel,\n message: util.format.apply(undefined, arguments),\n },\n {\n input: [...arguments],\n level,\n },\n );\n }\n\n originalConsoleMethod.apply(this, arguments);\n };\n /* eslint-enable prefer-rest-params */\n };\n}\n"]}

View File

@@ -0,0 +1,40 @@
import { Event, EventProcessor, Integration, StackFrame } from '@sentry/types';
/**
* Resets the file cache. Exists for testing purposes.
* @hidden
*/
export declare function resetFileContentCache(): void;
interface ContextLinesOptions {
/**
* Sets the number of context lines for each frame when loading a file.
* Defaults to 7.
*
* Set to 0 to disable loading and inclusion of source files.
**/
frameContextLines?: number;
}
/** Add node modules / packages to the event */
export declare class ContextLines implements Integration {
private readonly _options;
/**
* @inheritDoc
*/
static id: string;
/**
* @inheritDoc
*/
name: string;
constructor(_options?: ContextLinesOptions);
/** Get's the number of context lines to add */
private get _contextLines();
/**
* @inheritDoc
*/
setupOnce(addGlobalEventProcessor: (callback: EventProcessor) => void): void;
/** Processes an event and adds context lines */
addSourceContext(event: Event): Promise<Event>;
/** Adds context lines to frames */
addSourceContextToFrames(frames: StackFrame[]): Promise<void>;
}
export {};
//# sourceMappingURL=contextlines.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"contextlines.d.ts","sourceRoot":"","sources":["../../../src/integrations/contextlines.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAoB/E;;;GAGG;AACH,wBAAgB,qBAAqB,IAAI,IAAI,CAE5C;AAED,UAAU,mBAAmB;IAC3B;;;;;QAKI;IACJ,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,+CAA+C;AAC/C,qBAAa,YAAa,YAAW,WAAW;IAW3B,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAV5C;;OAEG;IACH,OAAc,EAAE,EAAE,MAAM,CAAkB;IAE1C;;OAEG;IACI,IAAI,EAAE,MAAM,CAAmB;gBAEF,QAAQ,GAAE,mBAAwB;IAEtE,+CAA+C;IAC/C,OAAO,KAAK,aAAa,GAYxB;IAED;;OAEG;IACI,SAAS,CAAC,uBAAuB,EAAE,CAAC,QAAQ,EAAE,cAAc,KAAK,IAAI,GAAG,IAAI;IAInF,gDAAgD;IACnC,gBAAgB,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;IAY3D,mCAAmC;IACtB,wBAAwB,CAAC,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAoB3E"}

View File

@@ -0,0 +1,197 @@
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var core_1 = require("@sentry/core");
var utils_1 = require("@sentry/utils");
var fs_1 = require("fs");
var lru_map_1 = require("lru_map");
var FILE_CONTENT_CACHE = new lru_map_1.LRUMap(100);
var DEFAULT_LINES_OF_CONTEXT = 7;
// TODO: Replace with promisify when minimum supported node >= v8
function readTextFileAsync(path) {
return new Promise(function (resolve, reject) {
fs_1.readFile(path, 'utf8', function (err, data) {
if (err)
reject(err);
else
resolve(data);
});
});
}
/**
* Resets the file cache. Exists for testing purposes.
* @hidden
*/
function resetFileContentCache() {
FILE_CONTENT_CACHE.clear();
}
exports.resetFileContentCache = resetFileContentCache;
/** Add node modules / packages to the event */
var ContextLines = /** @class */ (function () {
function ContextLines(_options) {
if (_options === void 0) { _options = {}; }
this._options = _options;
/**
* @inheritDoc
*/
this.name = ContextLines.id;
}
Object.defineProperty(ContextLines.prototype, "_contextLines", {
/** Get's the number of context lines to add */
get: function () {
var _a, _b;
// This is only here to copy frameContextLines from init options if it hasn't
// been set via this integrations constructor.
//
// TODO: Remove on next major!
if (this._options.frameContextLines === undefined) {
var initOptions = (_a = core_1.getCurrentHub().getClient()) === null || _a === void 0 ? void 0 : _a.getOptions();
// eslint-disable-next-line deprecation/deprecation
this._options.frameContextLines = (_b = initOptions) === null || _b === void 0 ? void 0 : _b.frameContextLines;
}
return this._options.frameContextLines !== undefined ? this._options.frameContextLines : DEFAULT_LINES_OF_CONTEXT;
},
enumerable: true,
configurable: true
});
/**
* @inheritDoc
*/
ContextLines.prototype.setupOnce = function (addGlobalEventProcessor) {
var _this = this;
addGlobalEventProcessor(function (event) { return _this.addSourceContext(event); });
};
/** Processes an event and adds context lines */
ContextLines.prototype.addSourceContext = function (event) {
var _a, _b;
return tslib_1.__awaiter(this, void 0, void 0, function () {
var _c, _d, exception, e_1_1;
var e_1, _e;
return tslib_1.__generator(this, function (_f) {
switch (_f.label) {
case 0:
if (!(this._contextLines > 0 && ((_a = event.exception) === null || _a === void 0 ? void 0 : _a.values))) return [3 /*break*/, 8];
_f.label = 1;
case 1:
_f.trys.push([1, 6, 7, 8]);
_c = tslib_1.__values(event.exception.values), _d = _c.next();
_f.label = 2;
case 2:
if (!!_d.done) return [3 /*break*/, 5];
exception = _d.value;
if (!((_b = exception.stacktrace) === null || _b === void 0 ? void 0 : _b.frames)) return [3 /*break*/, 4];
return [4 /*yield*/, this.addSourceContextToFrames(exception.stacktrace.frames)];
case 3:
_f.sent();
_f.label = 4;
case 4:
_d = _c.next();
return [3 /*break*/, 2];
case 5: return [3 /*break*/, 8];
case 6:
e_1_1 = _f.sent();
e_1 = { error: e_1_1 };
return [3 /*break*/, 8];
case 7:
try {
if (_d && !_d.done && (_e = _c.return)) _e.call(_c);
}
finally { if (e_1) throw e_1.error; }
return [7 /*endfinally*/];
case 8: return [2 /*return*/, event];
}
});
});
};
/** Adds context lines to frames */
ContextLines.prototype.addSourceContextToFrames = function (frames) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var contextLines, frames_1, frames_1_1, frame, sourceFile, lines, e_2_1;
var e_2, _a;
return tslib_1.__generator(this, function (_b) {
switch (_b.label) {
case 0:
contextLines = this._contextLines;
_b.label = 1;
case 1:
_b.trys.push([1, 6, 7, 8]);
frames_1 = tslib_1.__values(frames), frames_1_1 = frames_1.next();
_b.label = 2;
case 2:
if (!!frames_1_1.done) return [3 /*break*/, 5];
frame = frames_1_1.value;
if (!(frame.filename && frame.context_line === undefined)) return [3 /*break*/, 4];
return [4 /*yield*/, _readSourceFile(frame.filename)];
case 3:
sourceFile = _b.sent();
if (sourceFile) {
try {
lines = sourceFile.split('\n');
utils_1.addContextToFrame(lines, frame, contextLines);
}
catch (e) {
// anomaly, being defensive in case
// unlikely to ever happen in practice but can definitely happen in theory
}
}
_b.label = 4;
case 4:
frames_1_1 = frames_1.next();
return [3 /*break*/, 2];
case 5: return [3 /*break*/, 8];
case 6:
e_2_1 = _b.sent();
e_2 = { error: e_2_1 };
return [3 /*break*/, 8];
case 7:
try {
if (frames_1_1 && !frames_1_1.done && (_a = frames_1.return)) _a.call(frames_1);
}
finally { if (e_2) throw e_2.error; }
return [7 /*endfinally*/];
case 8: return [2 /*return*/];
}
});
});
};
/**
* @inheritDoc
*/
ContextLines.id = 'ContextLines';
return ContextLines;
}());
exports.ContextLines = ContextLines;
/**
* Reads file contents and caches them in a global LRU cache.
*
* @param filename filepath to read content from.
*/
function _readSourceFile(filename) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var cachedFile, content, _1;
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0:
cachedFile = FILE_CONTENT_CACHE.get(filename);
// We have a cache hit
if (cachedFile !== undefined) {
return [2 /*return*/, cachedFile];
}
content = null;
_a.label = 1;
case 1:
_a.trys.push([1, 3, , 4]);
return [4 /*yield*/, readTextFileAsync(filename)];
case 2:
content = _a.sent();
return [3 /*break*/, 4];
case 3:
_1 = _a.sent();
return [3 /*break*/, 4];
case 4:
FILE_CONTENT_CACHE.set(filename, content);
return [2 /*return*/, content];
}
});
});
}
//# sourceMappingURL=contextlines.js.map

File diff suppressed because one or more lines are too long

32
node_modules/@sentry/node/dist/integrations/http.d.ts generated vendored Normal file
View File

@@ -0,0 +1,32 @@
import { Integration } from '@sentry/types';
/** http module integration */
export declare class Http implements Integration {
/**
* @inheritDoc
*/
static id: string;
/**
* @inheritDoc
*/
name: string;
/**
* @inheritDoc
*/
private readonly _breadcrumbs;
/**
* @inheritDoc
*/
private readonly _tracing;
/**
* @inheritDoc
*/
constructor(options?: {
breadcrumbs?: boolean;
tracing?: boolean;
});
/**
* @inheritDoc
*/
setupOnce(): void;
}
//# sourceMappingURL=http.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../src/integrations/http.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAQ,MAAM,eAAe,CAAC;AAiBlD,8BAA8B;AAC9B,qBAAa,IAAK,YAAW,WAAW;IACtC;;OAEG;IACH,OAAc,EAAE,EAAE,MAAM,CAAU;IAElC;;OAEG;IACI,IAAI,EAAE,MAAM,CAAW;IAE9B;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAU;IAEvC;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAU;IAEnC;;OAEG;gBACgB,OAAO,GAAE;QAAE,WAAW,CAAC,EAAE,OAAO,CAAC;QAAC,OAAO,CAAC,EAAE,OAAO,CAAA;KAAO;IAK7E;;OAEG;IACI,SAAS,IAAI,IAAI;CAuBzB"}

146
node_modules/@sentry/node/dist/integrations/http.js generated vendored Normal file
View File

@@ -0,0 +1,146 @@
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var core_1 = require("@sentry/core");
var utils_1 = require("@sentry/utils");
var flags_1 = require("../flags");
var http_1 = require("./utils/http");
var NODE_VERSION = utils_1.parseSemver(process.versions.node);
/** http module integration */
var Http = /** @class */ (function () {
/**
* @inheritDoc
*/
function Http(options) {
if (options === void 0) { options = {}; }
/**
* @inheritDoc
*/
this.name = Http.id;
this._breadcrumbs = typeof options.breadcrumbs === 'undefined' ? true : options.breadcrumbs;
this._tracing = typeof options.tracing === 'undefined' ? false : options.tracing;
}
/**
* @inheritDoc
*/
Http.prototype.setupOnce = function () {
// No need to instrument if we don't want to track anything
if (!this._breadcrumbs && !this._tracing) {
return;
}
var wrappedHandlerMaker = _createWrappedRequestMethodFactory(this._breadcrumbs, this._tracing);
// eslint-disable-next-line @typescript-eslint/no-var-requires
var httpModule = require('http');
utils_1.fill(httpModule, 'get', wrappedHandlerMaker);
utils_1.fill(httpModule, 'request', wrappedHandlerMaker);
// NOTE: Prior to Node 9, `https` used internals of `http` module, thus we don't patch it.
// If we do, we'd get double breadcrumbs and double spans for `https` calls.
// It has been changed in Node 9, so for all versions equal and above, we patch `https` separately.
if (NODE_VERSION.major && NODE_VERSION.major > 8) {
// eslint-disable-next-line @typescript-eslint/no-var-requires
var httpsModule = require('https');
utils_1.fill(httpsModule, 'get', wrappedHandlerMaker);
utils_1.fill(httpsModule, 'request', wrappedHandlerMaker);
}
};
/**
* @inheritDoc
*/
Http.id = 'Http';
return Http;
}());
exports.Http = Http;
/**
* Function which creates a function which creates wrapped versions of internal `request` and `get` calls within `http`
* and `https` modules. (NB: Not a typo - this is a creator^2!)
*
* @param breadcrumbsEnabled Whether or not to record outgoing requests as breadcrumbs
* @param tracingEnabled Whether or not to record outgoing requests as tracing spans
*
* @returns A function which accepts the exiting handler and returns a wrapped handler
*/
function _createWrappedRequestMethodFactory(breadcrumbsEnabled, tracingEnabled) {
return function wrappedRequestMethodFactory(originalRequestMethod) {
return function wrappedMethod() {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
// eslint-disable-next-line @typescript-eslint/no-this-alias
var httpModule = this;
var requestArgs = http_1.normalizeRequestArgs(this, args);
var requestOptions = requestArgs[0];
var requestUrl = http_1.extractUrl(requestOptions);
// we don't want to record requests to Sentry as either breadcrumbs or spans, so just use the original method
if (http_1.isSentryRequest(requestUrl)) {
return originalRequestMethod.apply(httpModule, requestArgs);
}
var span;
var parentSpan;
var scope = core_1.getCurrentHub().getScope();
if (scope && tracingEnabled) {
parentSpan = scope.getSpan();
if (parentSpan) {
span = parentSpan.startChild({
description: (requestOptions.method || 'GET') + " " + requestUrl,
op: 'http.client',
});
var sentryTraceHeader = span.toTraceparent();
flags_1.IS_DEBUG_BUILD &&
utils_1.logger.log("[Tracing] Adding sentry-trace header " + sentryTraceHeader + " to outgoing request to " + requestUrl + ": ");
requestOptions.headers = tslib_1.__assign(tslib_1.__assign({}, requestOptions.headers), { 'sentry-trace': sentryTraceHeader });
}
}
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
return originalRequestMethod
.apply(httpModule, requestArgs)
.once('response', function (res) {
// eslint-disable-next-line @typescript-eslint/no-this-alias
var req = this;
if (breadcrumbsEnabled) {
addRequestBreadcrumb('response', requestUrl, req, res);
}
if (tracingEnabled && span) {
if (res.statusCode) {
span.setHttpStatus(res.statusCode);
}
span.description = http_1.cleanSpanDescription(span.description, requestOptions, req);
span.finish();
}
})
.once('error', function () {
// eslint-disable-next-line @typescript-eslint/no-this-alias
var req = this;
if (breadcrumbsEnabled) {
addRequestBreadcrumb('error', requestUrl, req);
}
if (tracingEnabled && span) {
span.setHttpStatus(500);
span.description = http_1.cleanSpanDescription(span.description, requestOptions, req);
span.finish();
}
});
};
};
}
/**
* Captures Breadcrumb based on provided request/response pair
*/
function addRequestBreadcrumb(event, url, req, res) {
if (!core_1.getCurrentHub().getIntegration(Http)) {
return;
}
core_1.getCurrentHub().addBreadcrumb({
category: 'http',
data: {
method: req.method,
status_code: res && res.statusCode,
url: url,
},
type: 'http',
}, {
event: event,
request: req,
response: res,
});
}
//# sourceMappingURL=http.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,8 @@
export { Console } from './console';
export { Http } from './http';
export { OnUncaughtException } from './onuncaughtexception';
export { OnUnhandledRejection } from './onunhandledrejection';
export { LinkedErrors } from './linkederrors';
export { Modules } from './modules';
export { ContextLines } from './contextlines';
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/integrations/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC"}

16
node_modules/@sentry/node/dist/integrations/index.js generated vendored Normal file
View File

@@ -0,0 +1,16 @@
Object.defineProperty(exports, "__esModule", { value: true });
var console_1 = require("./console");
exports.Console = console_1.Console;
var http_1 = require("./http");
exports.Http = http_1.Http;
var onuncaughtexception_1 = require("./onuncaughtexception");
exports.OnUncaughtException = onuncaughtexception_1.OnUncaughtException;
var onunhandledrejection_1 = require("./onunhandledrejection");
exports.OnUnhandledRejection = onunhandledrejection_1.OnUnhandledRejection;
var linkederrors_1 = require("./linkederrors");
exports.LinkedErrors = linkederrors_1.LinkedErrors;
var modules_1 = require("./modules");
exports.Modules = modules_1.Modules;
var contextlines_1 = require("./contextlines");
exports.ContextLines = contextlines_1.ContextLines;
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/integrations/index.ts"],"names":[],"mappings":";AAAA,qCAAoC;AAA3B,4BAAA,OAAO,CAAA;AAChB,+BAA8B;AAArB,sBAAA,IAAI,CAAA;AACb,6DAA4D;AAAnD,oDAAA,mBAAmB,CAAA;AAC5B,+DAA8D;AAArD,sDAAA,oBAAoB,CAAA;AAC7B,+CAA8C;AAArC,sCAAA,YAAY,CAAA;AACrB,qCAAoC;AAA3B,4BAAA,OAAO,CAAA;AAChB,+CAA8C;AAArC,sCAAA,YAAY,CAAA","sourcesContent":["export { Console } from './console';\nexport { Http } from './http';\nexport { OnUncaughtException } from './onuncaughtexception';\nexport { OnUnhandledRejection } from './onunhandledrejection';\nexport { LinkedErrors } from './linkederrors';\nexport { Modules } from './modules';\nexport { ContextLines } from './contextlines';\n"]}

View File

@@ -0,0 +1,40 @@
import { Integration } from '@sentry/types';
/** Adds SDK info to an event. */
export declare class LinkedErrors implements Integration {
/**
* @inheritDoc
*/
static id: string;
/**
* @inheritDoc
*/
readonly name: string;
/**
* @inheritDoc
*/
private readonly _key;
/**
* @inheritDoc
*/
private readonly _limit;
/**
* @inheritDoc
*/
constructor(options?: {
key?: string;
limit?: number;
});
/**
* @inheritDoc
*/
setupOnce(): void;
/**
* @inheritDoc
*/
private _handler;
/**
* @inheritDoc
*/
private _walkErrorTree;
}
//# sourceMappingURL=linkederrors.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"linkederrors.d.ts","sourceRoot":"","sources":["../../../src/integrations/linkederrors.ts"],"names":[],"mappings":"AACA,OAAO,EAA8C,WAAW,EAAE,MAAM,eAAe,CAAC;AASxF,iCAAiC;AACjC,qBAAa,YAAa,YAAW,WAAW;IAC9C;;OAEG;IACH,OAAc,EAAE,EAAE,MAAM,CAAkB;IAE1C;;OAEG;IACH,SAAgB,IAAI,EAAE,MAAM,CAAmB;IAE/C;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAS;IAE9B;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAEhC;;OAEG;gBACgB,OAAO,GAAE;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAO;IAKjE;;OAEG;IACI,SAAS,IAAI,IAAI;IAWxB;;OAEG;IACH,OAAO,CAAC,QAAQ;IAmBhB;;OAEG;YACW,cAAc;CAsB7B"}

View File

@@ -0,0 +1,97 @@
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var core_1 = require("@sentry/core");
var utils_1 = require("@sentry/utils");
var eventbuilder_1 = require("../eventbuilder");
var contextlines_1 = require("./contextlines");
var DEFAULT_KEY = 'cause';
var DEFAULT_LIMIT = 5;
/** Adds SDK info to an event. */
var LinkedErrors = /** @class */ (function () {
/**
* @inheritDoc
*/
function LinkedErrors(options) {
if (options === void 0) { options = {}; }
/**
* @inheritDoc
*/
this.name = LinkedErrors.id;
this._key = options.key || DEFAULT_KEY;
this._limit = options.limit || DEFAULT_LIMIT;
}
/**
* @inheritDoc
*/
LinkedErrors.prototype.setupOnce = function () {
core_1.addGlobalEventProcessor(function (event, hint) {
var self = core_1.getCurrentHub().getIntegration(LinkedErrors);
if (self) {
var handler = self._handler && self._handler.bind(self);
return typeof handler === 'function' ? handler(event, hint) : event;
}
return event;
});
};
/**
* @inheritDoc
*/
LinkedErrors.prototype._handler = function (event, hint) {
var _this = this;
if (!event.exception || !event.exception.values || !hint || !utils_1.isInstanceOf(hint.originalException, Error)) {
return utils_1.resolvedSyncPromise(event);
}
return new utils_1.SyncPromise(function (resolve) {
void _this._walkErrorTree(hint.originalException, _this._key)
.then(function (linkedErrors) {
if (event && event.exception && event.exception.values) {
event.exception.values = tslib_1.__spread(linkedErrors, event.exception.values);
}
resolve(event);
})
.then(null, function () {
resolve(event);
});
});
};
/**
* @inheritDoc
*/
LinkedErrors.prototype._walkErrorTree = function (error, key, stack) {
if (stack === void 0) { stack = []; }
var _a;
return tslib_1.__awaiter(this, void 0, void 0, function () {
var exception, contextLines;
var _this = this;
return tslib_1.__generator(this, function (_b) {
switch (_b.label) {
case 0:
if (!utils_1.isInstanceOf(error[key], Error) || stack.length + 1 >= this._limit) {
return [2 /*return*/, Promise.resolve(stack)];
}
exception = eventbuilder_1.exceptionFromError(error[key]);
contextLines = core_1.getCurrentHub().getIntegration(contextlines_1.ContextLines);
if (!(contextLines && ((_a = exception.stacktrace) === null || _a === void 0 ? void 0 : _a.frames))) return [3 /*break*/, 2];
return [4 /*yield*/, contextLines.addSourceContextToFrames(exception.stacktrace.frames)];
case 1:
_b.sent();
_b.label = 2;
case 2: return [2 /*return*/, new Promise(function (resolve, reject) {
void _this._walkErrorTree(error[key], key, tslib_1.__spread([exception], stack))
.then(resolve)
.then(null, function () {
reject();
});
})];
}
});
});
};
/**
* @inheritDoc
*/
LinkedErrors.id = 'LinkedErrors';
return LinkedErrors;
}());
exports.LinkedErrors = LinkedErrors;
//# sourceMappingURL=linkederrors.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,19 @@
import { EventProcessor, Hub, Integration } from '@sentry/types';
/** Add node modules / packages to the event */
export declare class Modules implements Integration {
/**
* @inheritDoc
*/
static id: string;
/**
* @inheritDoc
*/
name: string;
/**
* @inheritDoc
*/
setupOnce(addGlobalEventProcessor: (callback: EventProcessor) => void, getCurrentHub: () => Hub): void;
/** Fetches the list of modules and the versions loaded by the entry file for your node.js app. */
private _getModules;
}
//# sourceMappingURL=modules.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"modules.d.ts","sourceRoot":"","sources":["../../../src/integrations/modules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAmEjE,+CAA+C;AAC/C,qBAAa,OAAQ,YAAW,WAAW;IACzC;;OAEG;IACH,OAAc,EAAE,EAAE,MAAM,CAAa;IAErC;;OAEG;IACI,IAAI,EAAE,MAAM,CAAc;IAEjC;;OAEG;IACI,SAAS,CAAC,uBAAuB,EAAE,CAAC,QAAQ,EAAE,cAAc,KAAK,IAAI,EAAE,aAAa,EAAE,MAAM,GAAG,GAAG,IAAI;IAY7G,kGAAkG;IAClG,OAAO,CAAC,WAAW;CAMpB"}

84
node_modules/@sentry/node/dist/integrations/modules.js generated vendored Normal file
View File

@@ -0,0 +1,84 @@
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var fs_1 = require("fs");
var path_1 = require("path");
var moduleCache;
/** Extract information about paths */
function getPaths() {
try {
return require.cache ? Object.keys(require.cache) : [];
}
catch (e) {
return [];
}
}
/** Extract information about package.json modules */
function collectModules() {
var mainPaths = (require.main && require.main.paths) || [];
var paths = getPaths();
var infos = {};
var seen = {};
paths.forEach(function (path) {
var dir = path;
/** Traverse directories upward in the search of package.json file */
var updir = function () {
var orig = dir;
dir = path_1.dirname(orig);
if (!dir || orig === dir || seen[orig]) {
return undefined;
}
if (mainPaths.indexOf(dir) < 0) {
return updir();
}
var pkgfile = path_1.join(orig, 'package.json');
seen[orig] = true;
if (!fs_1.existsSync(pkgfile)) {
return updir();
}
try {
var info = JSON.parse(fs_1.readFileSync(pkgfile, 'utf8'));
infos[info.name] = info.version;
}
catch (_oO) {
// no-empty
}
};
updir();
});
return infos;
}
/** Add node modules / packages to the event */
var Modules = /** @class */ (function () {
function Modules() {
/**
* @inheritDoc
*/
this.name = Modules.id;
}
/**
* @inheritDoc
*/
Modules.prototype.setupOnce = function (addGlobalEventProcessor, getCurrentHub) {
var _this = this;
addGlobalEventProcessor(function (event) {
if (!getCurrentHub().getIntegration(Modules)) {
return event;
}
return tslib_1.__assign(tslib_1.__assign({}, event), { modules: _this._getModules() });
});
};
/** Fetches the list of modules and the versions loaded by the entry file for your node.js app. */
Modules.prototype._getModules = function () {
if (!moduleCache) {
moduleCache = collectModules();
}
return moduleCache;
};
/**
* @inheritDoc
*/
Modules.id = 'Modules';
return Modules;
}());
exports.Modules = Modules;
//# sourceMappingURL=modules.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"modules.js","sourceRoot":"","sources":["../../../src/integrations/modules.ts"],"names":[],"mappings":";;AACA,yBAA8C;AAC9C,6BAAqC;AAErC,IAAI,WAAsC,CAAC;AAE3C,sCAAsC;AACtC,SAAS,QAAQ;IACf,IAAI;QACF,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,KAAgC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;KACnF;IAAC,OAAO,CAAC,EAAE;QACV,OAAO,EAAE,CAAC;KACX;AACH,CAAC;AAED,qDAAqD;AACrD,SAAS,cAAc;IAGrB,IAAM,SAAS,GAAG,CAAC,OAAO,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;IAC7D,IAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;IACzB,IAAM,KAAK,GAEP,EAAE,CAAC;IACP,IAAM,IAAI,GAEN,EAAE,CAAC;IAEP,KAAK,CAAC,OAAO,CAAC,UAAA,IAAI;QAChB,IAAI,GAAG,GAAG,IAAI,CAAC;QAEf,qEAAqE;QACrE,IAAM,KAAK,GAAG;YACZ,IAAM,IAAI,GAAG,GAAG,CAAC;YACjB,GAAG,GAAG,cAAO,CAAC,IAAI,CAAC,CAAC;YAEpB,IAAI,CAAC,GAAG,IAAI,IAAI,KAAK,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,EAAE;gBACtC,OAAO,SAAS,CAAC;aAClB;YACD,IAAI,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;gBAC9B,OAAO,KAAK,EAAE,CAAC;aAChB;YAED,IAAM,OAAO,GAAG,WAAI,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;YAC3C,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;YAElB,IAAI,CAAC,eAAU,CAAC,OAAO,CAAC,EAAE;gBACxB,OAAO,KAAK,EAAE,CAAC;aAChB;YAED,IAAI;gBACF,IAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,iBAAY,CAAC,OAAO,EAAE,MAAM,CAAC,CAGpD,CAAC;gBACF,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC;aACjC;YAAC,OAAO,GAAG,EAAE;gBACZ,WAAW;aACZ;QACH,CAAC,CAAC;QAEF,KAAK,EAAE,CAAC;IACV,CAAC,CAAC,CAAC;IAEH,OAAO,KAAK,CAAC;AACf,CAAC;AAED,+CAA+C;AAC/C;IAAA;QAME;;WAEG;QACI,SAAI,GAAW,OAAO,CAAC,EAAE,CAAC;IAwBnC,CAAC;IAtBC;;OAEG;IACI,2BAAS,GAAhB,UAAiB,uBAA2D,EAAE,aAAwB;QAAtG,iBAUC;QATC,uBAAuB,CAAC,UAAA,KAAK;YAC3B,IAAI,CAAC,aAAa,EAAE,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE;gBAC5C,OAAO,KAAK,CAAC;aACd;YACD,6CACK,KAAK,KACR,OAAO,EAAE,KAAI,CAAC,WAAW,EAAE,IAC3B;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;IAED,kGAAkG;IAC1F,6BAAW,GAAnB;QACE,IAAI,CAAC,WAAW,EAAE;YAChB,WAAW,GAAG,cAAc,EAAE,CAAC;SAChC;QACD,OAAO,WAAW,CAAC;IACrB,CAAC;IA/BD;;OAEG;IACW,UAAE,GAAW,SAAS,CAAC;IA6BvC,cAAC;CAAA,AAjCD,IAiCC;AAjCY,0BAAO","sourcesContent":["import { EventProcessor, Hub, Integration } from '@sentry/types';\nimport { existsSync, readFileSync } from 'fs';\nimport { dirname, join } from 'path';\n\nlet moduleCache: { [key: string]: string };\n\n/** Extract information about paths */\nfunction getPaths(): string[] {\n try {\n return require.cache ? Object.keys(require.cache as Record<string, unknown>) : [];\n } catch (e) {\n return [];\n }\n}\n\n/** Extract information about package.json modules */\nfunction collectModules(): {\n [name: string]: string;\n} {\n const mainPaths = (require.main && require.main.paths) || [];\n const paths = getPaths();\n const infos: {\n [name: string]: string;\n } = {};\n const seen: {\n [path: string]: boolean;\n } = {};\n\n paths.forEach(path => {\n let dir = path;\n\n /** Traverse directories upward in the search of package.json file */\n const updir = (): void | (() => void) => {\n const orig = dir;\n dir = dirname(orig);\n\n if (!dir || orig === dir || seen[orig]) {\n return undefined;\n }\n if (mainPaths.indexOf(dir) < 0) {\n return updir();\n }\n\n const pkgfile = join(orig, 'package.json');\n seen[orig] = true;\n\n if (!existsSync(pkgfile)) {\n return updir();\n }\n\n try {\n const info = JSON.parse(readFileSync(pkgfile, 'utf8')) as {\n name: string;\n version: string;\n };\n infos[info.name] = info.version;\n } catch (_oO) {\n // no-empty\n }\n };\n\n updir();\n });\n\n return infos;\n}\n\n/** Add node modules / packages to the event */\nexport class Modules implements Integration {\n /**\n * @inheritDoc\n */\n public static id: string = 'Modules';\n\n /**\n * @inheritDoc\n */\n public name: string = Modules.id;\n\n /**\n * @inheritDoc\n */\n public setupOnce(addGlobalEventProcessor: (callback: EventProcessor) => void, getCurrentHub: () => Hub): void {\n addGlobalEventProcessor(event => {\n if (!getCurrentHub().getIntegration(Modules)) {\n return event;\n }\n return {\n ...event,\n modules: this._getModules(),\n };\n });\n }\n\n /** Fetches the list of modules and the versions loaded by the entry file for your node.js app. */\n private _getModules(): { [key: string]: string } {\n if (!moduleCache) {\n moduleCache = collectModules();\n }\n return moduleCache;\n }\n}\n"]}

View File

@@ -0,0 +1,37 @@
import { Integration } from '@sentry/types';
/** Global Promise Rejection handler */
export declare class OnUncaughtException implements Integration {
private readonly _options;
/**
* @inheritDoc
*/
static id: string;
/**
* @inheritDoc
*/
name: string;
/**
* @inheritDoc
*/
readonly handler: (error: Error) => void;
/**
* @inheritDoc
*/
constructor(_options?: {
/**
* Default onFatalError handler
* @param firstError Error that has been thrown
* @param secondError If this was called multiple times this will be set
*/
onFatalError?(firstError: Error, secondError?: Error): void;
});
/**
* @inheritDoc
*/
setupOnce(): void;
/**
* @hidden
*/
private _makeErrorHandler;
}
//# sourceMappingURL=onuncaughtexception.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"onuncaughtexception.d.ts","sourceRoot":"","sources":["../../../src/integrations/onuncaughtexception.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAY,MAAM,eAAe,CAAC;AAStD,uCAAuC;AACvC,qBAAa,mBAAoB,YAAW,WAAW;IAoBnD,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAnB3B;;OAEG;IACH,OAAc,EAAE,EAAE,MAAM,CAAyB;IAEjD;;OAEG;IACI,IAAI,EAAE,MAAM,CAA0B;IAE7C;;OAEG;IACH,SAAgB,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAA4B;IAE3E;;OAEG;gBAEgB,QAAQ,GAAE;QACzB;;;;WAIG;QACH,YAAY,CAAC,CAAC,UAAU,EAAE,KAAK,EAAE,WAAW,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC;KACxD;IAER;;OAEG;IACI,SAAS,IAAI,IAAI;IAIxB;;OAEG;IACH,OAAO,CAAC,iBAAiB;CA+E1B"}

View File

@@ -0,0 +1,120 @@
Object.defineProperty(exports, "__esModule", { value: true });
var core_1 = require("@sentry/core");
var types_1 = require("@sentry/types");
var utils_1 = require("@sentry/utils");
var flags_1 = require("../flags");
var errorhandling_1 = require("./utils/errorhandling");
/** Global Promise Rejection handler */
var OnUncaughtException = /** @class */ (function () {
/**
* @inheritDoc
*/
function OnUncaughtException(_options) {
if (_options === void 0) { _options = {}; }
this._options = _options;
/**
* @inheritDoc
*/
this.name = OnUncaughtException.id;
/**
* @inheritDoc
*/
this.handler = this._makeErrorHandler();
}
/**
* @inheritDoc
*/
OnUncaughtException.prototype.setupOnce = function () {
global.process.on('uncaughtException', this.handler.bind(this));
};
/**
* @hidden
*/
OnUncaughtException.prototype._makeErrorHandler = function () {
var _this = this;
var timeout = 2000;
var caughtFirstError = false;
var caughtSecondError = false;
var calledFatalError = false;
var firstError;
return function (error) {
var onFatalError = errorhandling_1.logAndExitProcess;
var client = core_1.getCurrentHub().getClient();
if (_this._options.onFatalError) {
// eslint-disable-next-line @typescript-eslint/unbound-method
onFatalError = _this._options.onFatalError;
}
else if (client && client.getOptions().onFatalError) {
// eslint-disable-next-line @typescript-eslint/unbound-method
onFatalError = client.getOptions().onFatalError;
}
if (!caughtFirstError) {
var hub_1 = core_1.getCurrentHub();
// this is the first uncaught error and the ultimate reason for shutting down
// we want to do absolutely everything possible to ensure it gets captured
// also we want to make sure we don't go recursion crazy if more errors happen after this one
firstError = error;
caughtFirstError = true;
if (hub_1.getIntegration(OnUncaughtException)) {
hub_1.withScope(function (scope) {
scope.setLevel(types_1.Severity.Fatal);
hub_1.captureException(error, {
originalException: error,
data: { mechanism: { handled: false, type: 'onuncaughtexception' } },
});
if (!calledFatalError) {
calledFatalError = true;
onFatalError(error);
}
});
}
else {
if (!calledFatalError) {
calledFatalError = true;
onFatalError(error);
}
}
}
else if (calledFatalError) {
// we hit an error *after* calling onFatalError - pretty boned at this point, just shut it down
flags_1.IS_DEBUG_BUILD &&
utils_1.logger.warn('uncaught exception after calling fatal error shutdown callback - this is bad! forcing shutdown');
errorhandling_1.logAndExitProcess(error);
}
else if (!caughtSecondError) {
// two cases for how we can hit this branch:
// - capturing of first error blew up and we just caught the exception from that
// - quit trying to capture, proceed with shutdown
// - a second independent error happened while waiting for first error to capture
// - want to avoid causing premature shutdown before first error capture finishes
// it's hard to immediately tell case 1 from case 2 without doing some fancy/questionable domain stuff
// so let's instead just delay a bit before we proceed with our action here
// in case 1, we just wait a bit unnecessarily but ultimately do the same thing
// in case 2, the delay hopefully made us wait long enough for the capture to finish
// two potential nonideal outcomes:
// nonideal case 1: capturing fails fast, we sit around for a few seconds unnecessarily before proceeding correctly by calling onFatalError
// nonideal case 2: case 2 happens, 1st error is captured but slowly, timeout completes before capture and we treat second error as the sendErr of (nonexistent) failure from trying to capture first error
// note that after hitting this branch, we might catch more errors where (caughtSecondError && !calledFatalError)
// we ignore them - they don't matter to us, we're just waiting for the second error timeout to finish
caughtSecondError = true;
setTimeout(function () {
if (!calledFatalError) {
// it was probably case 1, let's treat err as the sendErr and call onFatalError
calledFatalError = true;
onFatalError(firstError, error);
}
else {
// it was probably case 2, our first error finished capturing while we waited, cool, do nothing
}
}, timeout); // capturing could take at least sendTimeout to fail, plus an arbitrary second for how long it takes to collect surrounding source etc
}
};
};
/**
* @inheritDoc
*/
OnUncaughtException.id = 'OnUncaughtException';
return OnUncaughtException;
}());
exports.OnUncaughtException = OnUncaughtException;
//# sourceMappingURL=onuncaughtexception.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,40 @@
import { Integration } from '@sentry/types';
declare type UnhandledRejectionMode = 'none' | 'warn' | 'strict';
/** Global Promise Rejection handler */
export declare class OnUnhandledRejection implements Integration {
private readonly _options;
/**
* @inheritDoc
*/
static id: string;
/**
* @inheritDoc
*/
name: string;
/**
* @inheritDoc
*/
constructor(_options?: {
/**
* Option deciding what to do after capturing unhandledRejection,
* that mimicks behavior of node's --unhandled-rejection flag.
*/
mode: UnhandledRejectionMode;
});
/**
* @inheritDoc
*/
setupOnce(): void;
/**
* Send an exception with reason
* @param reason string
* @param promise promise
*/
sendUnhandledPromise(reason: any, promise: any): void;
/**
* Handler for `mode` option
*/
private _handleRejection;
}
export {};
//# sourceMappingURL=onunhandledrejection.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"onunhandledrejection.d.ts","sourceRoot":"","sources":["../../../src/integrations/onunhandledrejection.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAK5C,aAAK,sBAAsB,GAAG,MAAM,GAAG,MAAM,GAAG,QAAQ,CAAC;AAEzD,uCAAuC;AACvC,qBAAa,oBAAqB,YAAW,WAAW;IAepD,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAd3B;;OAEG;IACH,OAAc,EAAE,EAAE,MAAM,CAA0B;IAElD;;OAEG;IACI,IAAI,EAAE,MAAM,CAA2B;IAE9C;;OAEG;gBAEgB,QAAQ,GAAE;QACzB;;;WAGG;QACH,IAAI,EAAE,sBAAsB,CAAC;KACX;IAGtB;;OAEG;IACI,SAAS,IAAI,IAAI;IAIxB;;;;OAIG;IAEI,oBAAoB,CAAC,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,GAAG,IAAI;IAmC5D;;OAEG;IAEH,OAAO,CAAC,gBAAgB;CAuBzB"}

View File

@@ -0,0 +1,91 @@
Object.defineProperty(exports, "__esModule", { value: true });
var core_1 = require("@sentry/core");
var utils_1 = require("@sentry/utils");
var errorhandling_1 = require("./utils/errorhandling");
/** Global Promise Rejection handler */
var OnUnhandledRejection = /** @class */ (function () {
/**
* @inheritDoc
*/
function OnUnhandledRejection(_options) {
if (_options === void 0) { _options = { mode: 'warn' }; }
this._options = _options;
/**
* @inheritDoc
*/
this.name = OnUnhandledRejection.id;
}
/**
* @inheritDoc
*/
OnUnhandledRejection.prototype.setupOnce = function () {
global.process.on('unhandledRejection', this.sendUnhandledPromise.bind(this));
};
/**
* Send an exception with reason
* @param reason string
* @param promise promise
*/
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
OnUnhandledRejection.prototype.sendUnhandledPromise = function (reason, promise) {
var hub = core_1.getCurrentHub();
if (!hub.getIntegration(OnUnhandledRejection)) {
this._handleRejection(reason);
return;
}
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
var context = (promise.domain && promise.domain.sentryContext) || {};
hub.withScope(function (scope) {
scope.setExtra('unhandledPromiseRejection', true);
// Preserve backwards compatibility with raven-node for now
if (context.user) {
scope.setUser(context.user);
}
if (context.tags) {
scope.setTags(context.tags);
}
if (context.extra) {
scope.setExtras(context.extra);
}
hub.captureException(reason, {
originalException: promise,
data: { mechanism: { handled: false, type: 'onunhandledrejection' } },
});
});
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
this._handleRejection(reason);
};
/**
* Handler for `mode` option
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
OnUnhandledRejection.prototype._handleRejection = function (reason) {
// https://github.com/nodejs/node/blob/7cf6f9e964aa00772965391c23acda6d71972a9a/lib/internal/process/promises.js#L234-L240
var rejectionWarning = 'This error originated either by ' +
'throwing inside of an async function without a catch block, ' +
'or by rejecting a promise which was not handled with .catch().' +
' The promise rejected with the reason:';
/* eslint-disable no-console */
if (this._options.mode === 'warn') {
utils_1.consoleSandbox(function () {
console.warn(rejectionWarning);
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
console.error(reason && reason.stack ? reason.stack : reason);
});
}
else if (this._options.mode === 'strict') {
utils_1.consoleSandbox(function () {
console.warn(rejectionWarning);
});
errorhandling_1.logAndExitProcess(reason);
}
/* eslint-enable no-console */
};
/**
* @inheritDoc
*/
OnUnhandledRejection.id = 'OnUnhandledRejection';
return OnUnhandledRejection;
}());
exports.OnUnhandledRejection = OnUnhandledRejection;
//# sourceMappingURL=onunhandledrejection.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,5 @@
/**
* @hidden
*/
export declare function logAndExitProcess(error: Error): void;
//# sourceMappingURL=errorhandling.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"errorhandling.d.ts","sourceRoot":"","sources":["../../../../src/integrations/utils/errorhandling.ts"],"names":[],"mappings":"AAQA;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAuBpD"}

View File

@@ -0,0 +1,28 @@
Object.defineProperty(exports, "__esModule", { value: true });
var core_1 = require("@sentry/core");
var utils_1 = require("@sentry/utils");
var flags_1 = require("../../flags");
var DEFAULT_SHUTDOWN_TIMEOUT = 2000;
/**
* @hidden
*/
function logAndExitProcess(error) {
// eslint-disable-next-line no-console
console.error(error && error.stack ? error.stack : error);
var client = core_1.getCurrentHub().getClient();
if (client === undefined) {
flags_1.IS_DEBUG_BUILD && utils_1.logger.warn('No NodeClient was defined, we are exiting the process now.');
global.process.exit(1);
}
var options = client.getOptions();
var timeout = (options && options.shutdownTimeout && options.shutdownTimeout > 0 && options.shutdownTimeout) ||
DEFAULT_SHUTDOWN_TIMEOUT;
utils_1.forget(client.close(timeout).then(function (result) {
if (!result) {
flags_1.IS_DEBUG_BUILD && utils_1.logger.warn('We reached the timeout for emptying the request buffer, still exiting now!');
}
global.process.exit(1);
}));
}
exports.logAndExitProcess = logAndExitProcess;
//# sourceMappingURL=errorhandling.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"errorhandling.js","sourceRoot":"","sources":["../../../../src/integrations/utils/errorhandling.ts"],"names":[],"mappings":";AAAA,qCAA6C;AAC7C,uCAA+C;AAG/C,qCAA6C;AAE7C,IAAM,wBAAwB,GAAG,IAAI,CAAC;AAEtC;;GAEG;AACH,SAAgB,iBAAiB,CAAC,KAAY;IAC5C,sCAAsC;IACtC,OAAO,CAAC,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IAE1D,IAAM,MAAM,GAAG,oBAAa,EAAE,CAAC,SAAS,EAAc,CAAC;IAEvD,IAAI,MAAM,KAAK,SAAS,EAAE;QACxB,sBAAc,IAAI,cAAM,CAAC,IAAI,CAAC,4DAA4D,CAAC,CAAC;QAC5F,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KACxB;IAED,IAAM,OAAO,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;IACpC,IAAM,OAAO,GACX,CAAC,OAAO,IAAI,OAAO,CAAC,eAAe,IAAI,OAAO,CAAC,eAAe,GAAG,CAAC,IAAI,OAAO,CAAC,eAAe,CAAC;QAC9F,wBAAwB,CAAC;IAC3B,cAAM,CACJ,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,UAAC,MAAe;QACzC,IAAI,CAAC,MAAM,EAAE;YACX,sBAAc,IAAI,cAAM,CAAC,IAAI,CAAC,4EAA4E,CAAC,CAAC;SAC7G;QACD,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACzB,CAAC,CAAC,CACH,CAAC;AACJ,CAAC;AAvBD,8CAuBC","sourcesContent":["import { getCurrentHub } from '@sentry/core';\nimport { forget, logger } from '@sentry/utils';\n\nimport { NodeClient } from '../../client';\nimport { IS_DEBUG_BUILD } from '../../flags';\n\nconst DEFAULT_SHUTDOWN_TIMEOUT = 2000;\n\n/**\n * @hidden\n */\nexport function logAndExitProcess(error: Error): void {\n // eslint-disable-next-line no-console\n console.error(error && error.stack ? error.stack : error);\n\n const client = getCurrentHub().getClient<NodeClient>();\n\n if (client === undefined) {\n IS_DEBUG_BUILD && logger.warn('No NodeClient was defined, we are exiting the process now.');\n global.process.exit(1);\n }\n\n const options = client.getOptions();\n const timeout =\n (options && options.shutdownTimeout && options.shutdownTimeout > 0 && options.shutdownTimeout) ||\n DEFAULT_SHUTDOWN_TIMEOUT;\n forget(\n client.close(timeout).then((result: boolean) => {\n if (!result) {\n IS_DEBUG_BUILD && logger.warn('We reached the timeout for emptying the request buffer, still exiting now!');\n }\n global.process.exit(1);\n }),\n );\n}\n"]}

View File

@@ -0,0 +1,64 @@
/// <reference types="node" />
import * as http from 'http';
import * as https from 'https';
import { URL } from 'url';
/**
* Checks whether given url points to Sentry server
* @param url url to verify
*/
export declare function isSentryRequest(url: string): boolean;
/**
* Assemble a URL to be used for breadcrumbs and spans.
*
* @param requestOptions RequestOptions object containing the component parts for a URL
* @returns Fully-formed URL
*/
export declare function extractUrl(requestOptions: RequestOptions): string;
/**
* Handle various edge cases in the span description (for spans representing http(s) requests).
*
* @param description current `description` property of the span representing the request
* @param requestOptions Configuration data for the request
* @param Request Request object
*
* @returns The cleaned description
*/
export declare function cleanSpanDescription(description: string | undefined, requestOptions: RequestOptions, request: http.ClientRequest): string | undefined;
export declare type RequestOptions = http.RequestOptions & {
hash?: string;
search?: string;
pathname?: string;
href?: string;
};
declare type RequestCallback = (response: http.IncomingMessage) => void;
export declare type RequestMethodArgs = [RequestOptions | string | URL, RequestCallback?] | [string | URL, RequestOptions, RequestCallback?];
export declare type RequestMethod = (...args: RequestMethodArgs) => http.ClientRequest;
/**
* Convert a URL object into a RequestOptions object.
*
* Copied from Node's internals (where it's used in http(s).request() and http(s).get()), modified only to use the
* RequestOptions type above.
*
* See https://github.com/nodejs/node/blob/master/lib/internal/url.js.
*/
export declare function urlToOptions(url: URL): RequestOptions;
/**
* Normalize inputs to `http(s).request()` and `http(s).get()`.
*
* Legal inputs to `http(s).request()` and `http(s).get()` can take one of ten forms:
* [ RequestOptions | string | URL ],
* [ RequestOptions | string | URL, RequestCallback ],
* [ string | URL, RequestOptions ], and
* [ string | URL, RequestOptions, RequestCallback ].
*
* This standardizes to one of two forms: [ RequestOptions ] and [ RequestOptions, RequestCallback ]. A similar thing is
* done as the first step of `http(s).request()` and `http(s).get()`; this just does it early so that we can interact
* with the args in a standard way.
*
* @param requestArgs The inputs to `http(s).request()` or `http(s).get()`, as an array.
*
* @returns Equivalent args of the form [ RequestOptions ] or [ RequestOptions, RequestCallback ].
*/
export declare function normalizeRequestArgs(httpModule: typeof http | typeof https, requestArgs: RequestMethodArgs): [RequestOptions] | [RequestOptions, RequestCallback];
export {};
//# sourceMappingURL=http.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../../src/integrations/utils/http.ts"],"names":[],"mappings":";AAEA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAI1B;;;GAGG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAGpD;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,cAAc,EAAE,cAAc,GAAG,MAAM,CASjE;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,MAAM,GAAG,SAAS,EAC/B,cAAc,EAAE,cAAc,EAC9B,OAAO,EAAE,IAAI,CAAC,aAAa,GAC1B,MAAM,GAAG,SAAS,CAuBpB;AAGD,oBAAY,cAAc,GAAG,IAAI,CAAC,cAAc,GAAG;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AACxH,aAAK,eAAe,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,eAAe,KAAK,IAAI,CAAC;AAChE,oBAAY,iBAAiB,GACzB,CAAC,cAAc,GAAG,MAAM,GAAG,GAAG,EAAE,eAAe,CAAC,CAAC,GACjD,CAAC,MAAM,GAAG,GAAG,EAAE,cAAc,EAAE,eAAe,CAAC,CAAC,CAAC;AACrD,oBAAY,aAAa,GAAG,CAAC,GAAG,IAAI,EAAE,iBAAiB,KAAK,IAAI,CAAC,aAAa,CAAC;AAE/E;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,GAAG,GAAG,cAAc,CAkBrD;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,OAAO,IAAI,GAAG,OAAO,KAAK,EACtC,WAAW,EAAE,iBAAiB,GAC7B,CAAC,cAAc,CAAC,GAAG,CAAC,cAAc,EAAE,eAAe,CAAC,CAoDtD"}

View File

@@ -0,0 +1,156 @@
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var core_1 = require("@sentry/core");
var utils_1 = require("@sentry/utils");
var url_1 = require("url");
var NODE_VERSION = utils_1.parseSemver(process.versions.node);
/**
* Checks whether given url points to Sentry server
* @param url url to verify
*/
function isSentryRequest(url) {
var _a;
var dsn = (_a = core_1.getCurrentHub().getClient()) === null || _a === void 0 ? void 0 : _a.getDsn();
return dsn ? url.includes(dsn.host) : false;
}
exports.isSentryRequest = isSentryRequest;
/**
* Assemble a URL to be used for breadcrumbs and spans.
*
* @param requestOptions RequestOptions object containing the component parts for a URL
* @returns Fully-formed URL
*/
function extractUrl(requestOptions) {
var protocol = requestOptions.protocol || '';
var hostname = requestOptions.hostname || requestOptions.host || '';
// Don't log standard :80 (http) and :443 (https) ports to reduce the noise
var port = !requestOptions.port || requestOptions.port === 80 || requestOptions.port === 443 ? '' : ":" + requestOptions.port;
var path = requestOptions.path ? requestOptions.path : '/';
return protocol + "//" + hostname + port + path;
}
exports.extractUrl = extractUrl;
/**
* Handle various edge cases in the span description (for spans representing http(s) requests).
*
* @param description current `description` property of the span representing the request
* @param requestOptions Configuration data for the request
* @param Request Request object
*
* @returns The cleaned description
*/
function cleanSpanDescription(description, requestOptions, request) {
var _a, _b, _c;
// nothing to clean
if (!description) {
return description;
}
// eslint-disable-next-line prefer-const
var _d = tslib_1.__read(description.split(' '), 2), method = _d[0], requestUrl = _d[1];
// superagent sticks the protocol in a weird place (we check for host because if both host *and* protocol are missing,
// we're likely dealing with an internal route and this doesn't apply)
if (requestOptions.host && !requestOptions.protocol) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any
requestOptions.protocol = (_b = (_a = request) === null || _a === void 0 ? void 0 : _a.agent) === null || _b === void 0 ? void 0 : _b.protocol; // worst comes to worst, this is undefined and nothing changes
requestUrl = extractUrl(requestOptions);
}
// internal routes can end up starting with a triple slash rather than a single one
if ((_c = requestUrl) === null || _c === void 0 ? void 0 : _c.startsWith('///')) {
requestUrl = requestUrl.slice(2);
}
return method + " " + requestUrl;
}
exports.cleanSpanDescription = cleanSpanDescription;
/**
* Convert a URL object into a RequestOptions object.
*
* Copied from Node's internals (where it's used in http(s).request() and http(s).get()), modified only to use the
* RequestOptions type above.
*
* See https://github.com/nodejs/node/blob/master/lib/internal/url.js.
*/
function urlToOptions(url) {
var options = {
protocol: url.protocol,
hostname: typeof url.hostname === 'string' && url.hostname.startsWith('[') ? url.hostname.slice(1, -1) : url.hostname,
hash: url.hash,
search: url.search,
pathname: url.pathname,
path: "" + (url.pathname || '') + (url.search || ''),
href: url.href,
};
if (url.port !== '') {
options.port = Number(url.port);
}
if (url.username || url.password) {
options.auth = url.username + ":" + url.password;
}
return options;
}
exports.urlToOptions = urlToOptions;
/**
* Normalize inputs to `http(s).request()` and `http(s).get()`.
*
* Legal inputs to `http(s).request()` and `http(s).get()` can take one of ten forms:
* [ RequestOptions | string | URL ],
* [ RequestOptions | string | URL, RequestCallback ],
* [ string | URL, RequestOptions ], and
* [ string | URL, RequestOptions, RequestCallback ].
*
* This standardizes to one of two forms: [ RequestOptions ] and [ RequestOptions, RequestCallback ]. A similar thing is
* done as the first step of `http(s).request()` and `http(s).get()`; this just does it early so that we can interact
* with the args in a standard way.
*
* @param requestArgs The inputs to `http(s).request()` or `http(s).get()`, as an array.
*
* @returns Equivalent args of the form [ RequestOptions ] or [ RequestOptions, RequestCallback ].
*/
function normalizeRequestArgs(httpModule, requestArgs) {
var _a, _b, _c, _d, _e, _f, _g, _h;
var callback, requestOptions;
// pop off the callback, if there is one
if (typeof requestArgs[requestArgs.length - 1] === 'function') {
callback = requestArgs.pop();
}
// create a RequestOptions object of whatever's at index 0
if (typeof requestArgs[0] === 'string') {
requestOptions = urlToOptions(new url_1.URL(requestArgs[0]));
}
else if (requestArgs[0] instanceof url_1.URL) {
requestOptions = urlToOptions(requestArgs[0]);
}
else {
requestOptions = requestArgs[0];
}
// if the options were given separately from the URL, fold them in
if (requestArgs.length === 2) {
requestOptions = tslib_1.__assign(tslib_1.__assign({}, requestOptions), requestArgs[1]);
}
// Figure out the protocol if it's currently missing
if (requestOptions.protocol === undefined) {
// Worst case we end up populating protocol with undefined, which it already is
/* eslint-disable @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any */
// NOTE: Prior to Node 9, `https` used internals of `http` module, thus we don't patch it.
// Because of that, we cannot rely on `httpModule` to provide us with valid protocol,
// as it will always return `http`, even when using `https` module.
//
// See test/integrations/http.test.ts for more details on Node <=v8 protocol issue.
if (NODE_VERSION.major && NODE_VERSION.major > 8) {
requestOptions.protocol =
((_b = (_a = httpModule) === null || _a === void 0 ? void 0 : _a.globalAgent) === null || _b === void 0 ? void 0 : _b.protocol) || ((_c = requestOptions.agent) === null || _c === void 0 ? void 0 : _c.protocol) || ((_d = requestOptions._defaultAgent) === null || _d === void 0 ? void 0 : _d.protocol);
}
else {
requestOptions.protocol =
((_e = requestOptions.agent) === null || _e === void 0 ? void 0 : _e.protocol) || ((_f = requestOptions._defaultAgent) === null || _f === void 0 ? void 0 : _f.protocol) || ((_h = (_g = httpModule) === null || _g === void 0 ? void 0 : _g.globalAgent) === null || _h === void 0 ? void 0 : _h.protocol);
}
/* eslint-enable @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any */
}
// return args in standardized form
if (callback) {
return [requestOptions, callback];
}
else {
return [requestOptions];
}
}
exports.normalizeRequestArgs = normalizeRequestArgs;
//# sourceMappingURL=http.js.map

File diff suppressed because one or more lines are too long

94
node_modules/@sentry/node/dist/sdk.d.ts generated vendored Normal file
View File

@@ -0,0 +1,94 @@
import { Integrations as CoreIntegrations } from '@sentry/core';
import { NodeClient } from './client';
import { Console, ContextLines, Http, LinkedErrors, OnUncaughtException, OnUnhandledRejection } from './integrations';
import { NodeOptions } from './types';
export declare const defaultIntegrations: (CoreIntegrations.FunctionToString | CoreIntegrations.InboundFilters | Console | Http | OnUncaughtException | OnUnhandledRejection | ContextLines | LinkedErrors)[];
/**
* The Sentry Node SDK Client.
*
* To use this SDK, call the {@link init} function as early as possible in the
* main entry module. To set context information or send manual events, use the
* provided methods.
*
* @example
* ```
*
* const { init } = require('@sentry/node');
*
* init({
* dsn: '__DSN__',
* // ...
* });
* ```
*
* @example
* ```
*
* const { configureScope } = require('@sentry/node');
* configureScope((scope: Scope) => {
* scope.setExtra({ battery: 0.7 });
* scope.setTag({ user_mode: 'admin' });
* scope.setUser({ id: '4711' });
* });
* ```
*
* @example
* ```
*
* const { addBreadcrumb } = require('@sentry/node');
* addBreadcrumb({
* message: 'My Breadcrumb',
* // ...
* });
* ```
*
* @example
* ```
*
* const Sentry = require('@sentry/node');
* Sentry.captureMessage('Hello, world!');
* Sentry.captureException(new Error('Good bye'));
* Sentry.captureEvent({
* message: 'Manual',
* stacktrace: [
* // ...
* ],
* });
* ```
*
* @see {@link NodeOptions} for documentation on configuration options.
*/
export declare function init(options?: NodeOptions): void;
/**
* This is the getter for lastEventId.
*
* @returns The last event id of a captured event.
*/
export declare function lastEventId(): string | undefined;
/**
* Call `flush()` on the current client, if there is one. See {@link Client.flush}.
*
* @param timeout Maximum time in ms the client should wait to flush its event queue. Omitting this parameter will cause
* the client to wait until all events are sent before resolving the promise.
* @returns A promise which resolves to `true` if the queue successfully drains before the timeout, or `false` if it
* doesn't (or if there's no client defined).
*/
export declare function flush(timeout?: number): Promise<boolean>;
/**
* Call `close()` on the current client, if there is one. See {@link Client.close}.
*
* @param timeout Maximum time in ms the client should wait to flush its event queue before shutting down. Omitting this
* parameter will cause the client to wait until all events are sent before disabling itself.
* @returns A promise which resolves to `true` if the queue successfully drains before the timeout, or `false` if it
* doesn't (or if there's no client defined).
*/
export declare function close(timeout?: number): Promise<boolean>;
/**
* Function that takes an instance of NodeClient and checks if autoSessionTracking option is enabled for that client
*/
export declare function isAutoSessionTrackingEnabled(client?: NodeClient): boolean;
/**
* Returns a release dynamically from environment variables.
*/
export declare function getSentryRelease(fallback?: string): string | undefined;
//# sourceMappingURL=sdk.d.ts.map

1
node_modules/@sentry/node/dist/sdk.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../src/sdk.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,YAAY,IAAI,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAM5F,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,YAAY,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtH,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC,eAAO,MAAM,mBAAmB,qKAa/B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AACH,wBAAgB,IAAI,CAAC,OAAO,GAAE,WAAgB,GAAG,IAAI,CAmDpD;AAED;;;;GAIG;AACH,wBAAgB,WAAW,IAAI,MAAM,GAAG,SAAS,CAEhD;AAED;;;;;;;GAOG;AACH,wBAAsB,KAAK,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAO9D;AAED;;;;;;;GAOG;AACH,wBAAsB,KAAK,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAO9D;AAED;;GAEG;AACH,wBAAgB,4BAA4B,CAAC,MAAM,CAAC,EAAE,UAAU,GAAG,OAAO,CASzE;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CA4BtE"}

242
node_modules/@sentry/node/dist/sdk.js generated vendored Normal file
View File

@@ -0,0 +1,242 @@
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var core_1 = require("@sentry/core");
var hub_1 = require("@sentry/hub");
var utils_1 = require("@sentry/utils");
var domain = require("domain");
var client_1 = require("./client");
var flags_1 = require("./flags");
var integrations_1 = require("./integrations");
exports.defaultIntegrations = [
// Common
new core_1.Integrations.InboundFilters(),
new core_1.Integrations.FunctionToString(),
new integrations_1.ContextLines(),
// Native Wrappers
new integrations_1.Console(),
new integrations_1.Http(),
// Global Handlers
new integrations_1.OnUncaughtException(),
new integrations_1.OnUnhandledRejection(),
// Misc
new integrations_1.LinkedErrors(),
];
/**
* The Sentry Node SDK Client.
*
* To use this SDK, call the {@link init} function as early as possible in the
* main entry module. To set context information or send manual events, use the
* provided methods.
*
* @example
* ```
*
* const { init } = require('@sentry/node');
*
* init({
* dsn: '__DSN__',
* // ...
* });
* ```
*
* @example
* ```
*
* const { configureScope } = require('@sentry/node');
* configureScope((scope: Scope) => {
* scope.setExtra({ battery: 0.7 });
* scope.setTag({ user_mode: 'admin' });
* scope.setUser({ id: '4711' });
* });
* ```
*
* @example
* ```
*
* const { addBreadcrumb } = require('@sentry/node');
* addBreadcrumb({
* message: 'My Breadcrumb',
* // ...
* });
* ```
*
* @example
* ```
*
* const Sentry = require('@sentry/node');
* Sentry.captureMessage('Hello, world!');
* Sentry.captureException(new Error('Good bye'));
* Sentry.captureEvent({
* message: 'Manual',
* stacktrace: [
* // ...
* ],
* });
* ```
*
* @see {@link NodeOptions} for documentation on configuration options.
*/
function init(options) {
if (options === void 0) { options = {}; }
var _a;
var carrier = hub_1.getMainCarrier();
var autoloadedIntegrations = ((_a = carrier.__SENTRY__) === null || _a === void 0 ? void 0 : _a.integrations) || [];
options.defaultIntegrations =
options.defaultIntegrations === false
? []
: tslib_1.__spread((Array.isArray(options.defaultIntegrations) ? options.defaultIntegrations : exports.defaultIntegrations), autoloadedIntegrations);
if (options.dsn === undefined && process.env.SENTRY_DSN) {
options.dsn = process.env.SENTRY_DSN;
}
if (options.tracesSampleRate === undefined && process.env.SENTRY_TRACES_SAMPLE_RATE) {
var tracesSampleRate = parseFloat(process.env.SENTRY_TRACES_SAMPLE_RATE);
if (isFinite(tracesSampleRate)) {
options.tracesSampleRate = tracesSampleRate;
}
}
if (options.release === undefined) {
var detectedRelease = getSentryRelease();
if (detectedRelease !== undefined) {
options.release = detectedRelease;
}
else {
// If release is not provided, then we should disable autoSessionTracking
options.autoSessionTracking = false;
}
}
if (options.environment === undefined && process.env.SENTRY_ENVIRONMENT) {
options.environment = process.env.SENTRY_ENVIRONMENT;
}
if (options.autoSessionTracking === undefined && options.dsn !== undefined) {
options.autoSessionTracking = true;
}
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any
if (domain.active) {
hub_1.setHubOnCarrier(carrier, core_1.getCurrentHub());
}
core_1.initAndBind(client_1.NodeClient, options);
if (options.autoSessionTracking) {
startSessionTracking();
}
}
exports.init = init;
/**
* This is the getter for lastEventId.
*
* @returns The last event id of a captured event.
*/
function lastEventId() {
return core_1.getCurrentHub().lastEventId();
}
exports.lastEventId = lastEventId;
/**
* Call `flush()` on the current client, if there is one. See {@link Client.flush}.
*
* @param timeout Maximum time in ms the client should wait to flush its event queue. Omitting this parameter will cause
* the client to wait until all events are sent before resolving the promise.
* @returns A promise which resolves to `true` if the queue successfully drains before the timeout, or `false` if it
* doesn't (or if there's no client defined).
*/
function flush(timeout) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var client;
return tslib_1.__generator(this, function (_a) {
client = core_1.getCurrentHub().getClient();
if (client) {
return [2 /*return*/, client.flush(timeout)];
}
flags_1.IS_DEBUG_BUILD && utils_1.logger.warn('Cannot flush events. No client defined.');
return [2 /*return*/, Promise.resolve(false)];
});
});
}
exports.flush = flush;
/**
* Call `close()` on the current client, if there is one. See {@link Client.close}.
*
* @param timeout Maximum time in ms the client should wait to flush its event queue before shutting down. Omitting this
* parameter will cause the client to wait until all events are sent before disabling itself.
* @returns A promise which resolves to `true` if the queue successfully drains before the timeout, or `false` if it
* doesn't (or if there's no client defined).
*/
function close(timeout) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var client;
return tslib_1.__generator(this, function (_a) {
client = core_1.getCurrentHub().getClient();
if (client) {
return [2 /*return*/, client.close(timeout)];
}
flags_1.IS_DEBUG_BUILD && utils_1.logger.warn('Cannot flush events and disable SDK. No client defined.');
return [2 /*return*/, Promise.resolve(false)];
});
});
}
exports.close = close;
/**
* Function that takes an instance of NodeClient and checks if autoSessionTracking option is enabled for that client
*/
function isAutoSessionTrackingEnabled(client) {
if (client === undefined) {
return false;
}
var clientOptions = client && client.getOptions();
if (clientOptions && clientOptions.autoSessionTracking !== undefined) {
return clientOptions.autoSessionTracking;
}
return false;
}
exports.isAutoSessionTrackingEnabled = isAutoSessionTrackingEnabled;
/**
* Returns a release dynamically from environment variables.
*/
function getSentryRelease(fallback) {
// Always read first as Sentry takes this as precedence
if (process.env.SENTRY_RELEASE) {
return process.env.SENTRY_RELEASE;
}
// This supports the variable that sentry-webpack-plugin injects
var global = utils_1.getGlobalObject();
if (global.SENTRY_RELEASE && global.SENTRY_RELEASE.id) {
return global.SENTRY_RELEASE.id;
}
return (
// GitHub Actions - https://help.github.com/en/actions/configuring-and-managing-workflows/using-environment-variables#default-environment-variables
process.env.GITHUB_SHA ||
// Netlify - https://docs.netlify.com/configure-builds/environment-variables/#build-metadata
process.env.COMMIT_REF ||
// Vercel - https://vercel.com/docs/v2/build-step#system-environment-variables
process.env.VERCEL_GIT_COMMIT_SHA ||
process.env.VERCEL_GITHUB_COMMIT_SHA ||
process.env.VERCEL_GITLAB_COMMIT_SHA ||
process.env.VERCEL_BITBUCKET_COMMIT_SHA ||
// Zeit (now known as Vercel)
process.env.ZEIT_GITHUB_COMMIT_SHA ||
process.env.ZEIT_GITLAB_COMMIT_SHA ||
process.env.ZEIT_BITBUCKET_COMMIT_SHA ||
fallback);
}
exports.getSentryRelease = getSentryRelease;
/**
* Enable automatic Session Tracking for the node process.
*/
function startSessionTracking() {
var hub = core_1.getCurrentHub();
hub.startSession();
// Emitted in the case of healthy sessions, error of `mechanism.handled: true` and unhandledrejections because
// The 'beforeExit' event is not emitted for conditions causing explicit termination,
// such as calling process.exit() or uncaught exceptions.
// Ref: https://nodejs.org/api/process.html#process_event_beforeexit
process.on('beforeExit', function () {
var _a;
var session = (_a = hub.getScope()) === null || _a === void 0 ? void 0 : _a.getSession();
var terminalStates = ['exited', 'crashed'];
// Only call endSession, if the Session exists on Scope and SessionStatus is not a
// Terminal Status i.e. Exited or Crashed because
// "When a session is moved away from ok it must not be updated anymore."
// Ref: https://develop.sentry.dev/sdk/sessions/
if (session && !terminalStates.includes(session.status))
hub.endSession();
});
}
//# sourceMappingURL=sdk.js.map

1
node_modules/@sentry/node/dist/sdk.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

3
node_modules/@sentry/node/dist/stack-parser.d.ts generated vendored Normal file
View File

@@ -0,0 +1,3 @@
import { StackLineParser } from '@sentry/utils';
export declare const nodeStackParser: StackLineParser;
//# sourceMappingURL=stack-parser.d.ts.map

1
node_modules/@sentry/node/dist/stack-parser.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"stack-parser.d.ts","sourceRoot":"","sources":["../../src/stack-parser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,eAAe,EAAqB,MAAM,eAAe,CAAC;AAmHtF,eAAO,MAAM,eAAe,EAAE,eAA4B,CAAC"}

97
node_modules/@sentry/node/dist/stack-parser.js generated vendored Normal file
View File

@@ -0,0 +1,97 @@
Object.defineProperty(exports, "__esModule", { value: true });
var utils_1 = require("@sentry/utils");
/** Gets the module */
function getModule(filename) {
if (!filename) {
return;
}
// We could use optional chaining here but webpack does like that mixed with require
var base = ((require && require.main && require.main.filename && utils_1.dirname(require.main.filename)) || global.process.cwd()) + "/";
// It's specifically a module
var file = utils_1.basename(filename, '.js');
var path = utils_1.dirname(filename);
var n = path.lastIndexOf('/node_modules/');
if (n > -1) {
// /node_modules/ is 14 chars
return path.substr(n + 14).replace(/\//g, '.') + ":" + file;
}
// Let's see if it's a part of the main module
// To be a part of main module, it has to share the same base
n = (path + "/").lastIndexOf(base, 0);
if (n === 0) {
var moduleName = path.substr(base.length).replace(/\//g, '.');
if (moduleName) {
moduleName += ':';
}
moduleName += file;
return moduleName;
}
return file;
}
var FILENAME_MATCH = /^\s*[-]{4,}$/;
var FULL_MATCH = /at (?:async )?(?:(.+?)\s+\()?(?:(.+?):(\d+)(?::(\d+))?|([^)]+))\)?/;
// eslint-disable-next-line complexity
var node = function (line) {
var _a;
if (line.match(FILENAME_MATCH)) {
return {
filename: line,
};
}
var lineMatch = line.match(FULL_MATCH);
if (!lineMatch) {
return undefined;
}
var object;
var method;
var functionName;
var typeName;
var methodName;
if (lineMatch[1]) {
functionName = lineMatch[1];
var methodStart = functionName.lastIndexOf('.');
if (functionName[methodStart - 1] === '.') {
// eslint-disable-next-line no-plusplus
methodStart--;
}
if (methodStart > 0) {
object = functionName.substr(0, methodStart);
method = functionName.substr(methodStart + 1);
var objectEnd = object.indexOf('.Module');
if (objectEnd > 0) {
functionName = functionName.substr(objectEnd + 1);
object = object.substr(0, objectEnd);
}
}
typeName = undefined;
}
if (method) {
typeName = object;
methodName = method;
}
if (method === '<anonymous>') {
methodName = undefined;
functionName = undefined;
}
if (functionName === undefined) {
methodName = methodName || '<anonymous>';
functionName = typeName ? typeName + "." + methodName : methodName;
}
var filename = ((_a = lineMatch[2]) === null || _a === void 0 ? void 0 : _a.startsWith('file://')) ? lineMatch[2].substr(7) : lineMatch[2];
var isNative = lineMatch[5] === 'native';
var isInternal = isNative || (filename && !filename.startsWith('/') && !filename.startsWith('.') && filename.indexOf(':\\') !== 1);
// in_app is all that's not an internal Node function or a module within node_modules
// note that isNative appears to return true even for node core libraries
// see https://github.com/getsentry/raven-node/issues/176
var in_app = !isInternal && filename !== undefined && !filename.includes('node_modules/');
return {
filename: filename,
module: getModule(filename),
function: functionName,
lineno: parseInt(lineMatch[3], 10) || undefined,
colno: parseInt(lineMatch[4], 10) || undefined,
in_app: in_app,
};
};
exports.nodeStackParser = [90, node];
//# sourceMappingURL=stack-parser.js.map

1
node_modules/@sentry/node/dist/stack-parser.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,36 @@
/// <reference types="node" />
import { IncomingHttpHeaders, RequestOptions as HTTPRequestOptions } from 'http';
import { RequestOptions as HTTPSRequestOptions } from 'https';
import { URL } from 'url';
export declare type HTTPModuleRequestOptions = HTTPRequestOptions | HTTPSRequestOptions | string | URL;
/**
* Cut version of http.IncomingMessage.
* Some transports work in a special Javascript environment where http.IncomingMessage is not available.
*/
export interface HTTPModuleRequestIncomingMessage {
headers: IncomingHttpHeaders;
statusCode?: number;
on(event: 'data' | 'end', listener: () => void): void;
setEncoding(encoding: string): void;
}
/**
* Cut version of http.ClientRequest.
* Some transports work in a special Javascript environment where http.IncomingMessage is not available.
*/
export interface HTTPModuleClientRequest {
end(chunk: string): void;
on(event: 'error', listener: () => void): void;
}
/**
* Internal used interface for typescript.
* @hidden
*/
export interface HTTPModule {
/**
* Request wrapper
* @param options These are {@see TransportOptions}
* @param callback Callback when request is finished
*/
request(options: HTTPModuleRequestOptions, callback?: (res: HTTPModuleRequestIncomingMessage) => void): HTTPModuleClientRequest;
}
//# sourceMappingURL=http-module.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"http-module.d.ts","sourceRoot":"","sources":["../../../../src/transports/base/http-module.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,mBAAmB,EAAE,cAAc,IAAI,kBAAkB,EAAE,MAAM,MAAM,CAAC;AACjF,OAAO,EAAE,cAAc,IAAI,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAC9D,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,oBAAY,wBAAwB,GAAG,kBAAkB,GAAG,mBAAmB,GAAG,MAAM,GAAG,GAAG,CAAC;AAE/F;;;GAGG;AACH,MAAM,WAAW,gCAAgC;IAC/C,OAAO,EAAE,mBAAmB,CAAC;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,EAAE,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI,CAAC;IACtD,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACrC;AAED;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACtC,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI,CAAC;CAChD;AAED;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB;;;;OAIG;IACH,OAAO,CACL,OAAO,EAAE,wBAAwB,EACjC,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,gCAAgC,KAAK,IAAI,GACzD,uBAAuB,CAAC;CAW5B"}

View File

@@ -0,0 +1,2 @@
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=http-module.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"http-module.js","sourceRoot":"","sources":["../../../../src/transports/base/http-module.ts"],"names":[],"mappings":"","sourcesContent":["import { IncomingHttpHeaders, RequestOptions as HTTPRequestOptions } from 'http';\nimport { RequestOptions as HTTPSRequestOptions } from 'https';\nimport { URL } from 'url';\n\nexport type HTTPModuleRequestOptions = HTTPRequestOptions | HTTPSRequestOptions | string | URL;\n\n/**\n * Cut version of http.IncomingMessage.\n * Some transports work in a special Javascript environment where http.IncomingMessage is not available.\n */\nexport interface HTTPModuleRequestIncomingMessage {\n headers: IncomingHttpHeaders;\n statusCode?: number;\n on(event: 'data' | 'end', listener: () => void): void;\n setEncoding(encoding: string): void;\n}\n\n/**\n * Cut version of http.ClientRequest.\n * Some transports work in a special Javascript environment where http.IncomingMessage is not available.\n */\nexport interface HTTPModuleClientRequest {\n end(chunk: string): void;\n on(event: 'error', listener: () => void): void;\n}\n\n/**\n * Internal used interface for typescript.\n * @hidden\n */\nexport interface HTTPModule {\n /**\n * Request wrapper\n * @param options These are {@see TransportOptions}\n * @param callback Callback when request is finished\n */\n request(\n options: HTTPModuleRequestOptions,\n callback?: (res: HTTPModuleRequestIncomingMessage) => void,\n ): HTTPModuleClientRequest;\n\n // This is the type for nodejs versions that handle the URL argument\n // (v10.9.0+), but we do not use it just yet because we support older node\n // versions:\n\n // request(\n // url: string | URL,\n // options: http.RequestOptions | https.RequestOptions,\n // callback?: (res: http.IncomingMessage) => void,\n // ): http.ClientRequest;\n}\n"]}

View File

@@ -0,0 +1,63 @@
/// <reference types="node" />
import { APIDetails } from '@sentry/core';
import { DsnProtocol, Event, Response, SentryRequest, SentryRequestType, Session, SessionAggregates, Transport, TransportOptions } from '@sentry/types';
import { PromiseBuffer } from '@sentry/utils';
import * as http from 'http';
import * as https from 'https';
import { URL } from 'url';
import { HTTPModule } from './http-module';
export declare type URLParts = Pick<URL, 'hostname' | 'pathname' | 'port' | 'protocol'>;
export declare type UrlParser = (url: string) => URLParts;
/** Base Transport class implementation */
export declare abstract class BaseTransport implements Transport {
options: TransportOptions;
/** The Agent used for corresponding transport */
module?: HTTPModule;
/** The Agent used for corresponding transport */
client?: http.Agent | https.Agent;
/** API object */
protected _api: APIDetails;
/** A simple buffer holding all requests. */
protected readonly _buffer: PromiseBuffer<Response>;
/** Locks transport after receiving rate limits in a response */
protected readonly _rateLimits: Record<string, Date>;
/** Create instance and set this.dsn */
constructor(options: TransportOptions);
/** Default function used to parse URLs */
urlParser: UrlParser;
/**
* @inheritDoc
*/
sendEvent(_: Event): PromiseLike<Response>;
/**
* @inheritDoc
*/
close(timeout?: number): PromiseLike<boolean>;
/**
* Extracts proxy settings from client options and env variables.
*
* Honors `no_proxy` env variable with the highest priority to allow for hosts exclusion.
*
* An order of priority for available protocols is:
* `http` => `options.httpProxy` | `process.env.http_proxy`
* `https` => `options.httpsProxy` | `options.httpProxy` | `process.env.https_proxy` | `process.env.http_proxy`
*/
protected _getProxy(protocol: DsnProtocol): string | undefined;
/** Returns a build request option object used by request */
protected _getRequestOptions(urlParts: URLParts): http.RequestOptions | https.RequestOptions;
/**
* Gets the time that given category is disabled until for rate limiting
*/
protected _disabledUntil(requestType: SentryRequestType): Date;
/**
* Checks if a category is rate limited
*/
protected _isRateLimited(requestType: SentryRequestType): boolean;
/**
* Sets internal _rateLimits from incoming headers. Returns true if headers contains a non-empty rate limiting header.
*/
protected _handleRateLimit(headers: Record<string, string | null>): boolean;
/** JSDoc */
protected _send(sentryRequest: SentryRequest, originalPayload?: Event | Session | SessionAggregates): Promise<Response>;
}
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/transports/base/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAkD,MAAM,cAAc,CAAC;AAC1F,OAAO,EACL,WAAW,EACX,KAAK,EACL,QAAQ,EACR,aAAa,EACb,iBAAiB,EACjB,OAAO,EACP,iBAAiB,EACjB,SAAS,EACT,gBAAgB,EACjB,MAAM,eAAe,CAAC;AACvB,OAAO,EAKL,aAAa,EAEd,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAI1B,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,oBAAY,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,UAAU,GAAG,UAAU,GAAG,MAAM,GAAG,UAAU,CAAC,CAAC;AAChF,oBAAY,SAAS,GAAG,CAAC,GAAG,EAAE,MAAM,KAAK,QAAQ,CAAC;AAWlD,0CAA0C;AAC1C,8BAAsB,aAAc,YAAW,SAAS;IAiB5B,OAAO,EAAE,gBAAgB;IAhBnD,iDAAiD;IAC1C,MAAM,CAAC,EAAE,UAAU,CAAC;IAE3B,iDAAiD;IAC1C,MAAM,CAAC,EAAE,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;IAEzC,iBAAiB;IACjB,SAAS,CAAC,IAAI,EAAE,UAAU,CAAC;IAE3B,4CAA4C;IAC5C,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAyB;IAE5E,gEAAgE;IAChE,SAAS,CAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAM;IAE1D,uCAAuC;gBACb,OAAO,EAAE,gBAAgB;IAKnD,0CAA0C;IACnC,SAAS,EAAE,SAAS,CAAuB;IAElD;;OAEG;IACI,SAAS,CAAC,CAAC,EAAE,KAAK,GAAG,WAAW,CAAC,QAAQ,CAAC;IAIjD;;OAEG;IACI,KAAK,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,WAAW,CAAC,OAAO,CAAC;IAIpD;;;;;;;;OAQG;IACH,SAAS,CAAC,SAAS,CAAC,QAAQ,EAAE,WAAW,GAAG,MAAM,GAAG,SAAS;IAmB9D,4DAA4D;IAC5D,SAAS,CAAC,kBAAkB,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAC,cAAc,GAAG,KAAK,CAAC,cAAc;IAwB5F;;OAEG;IACH,SAAS,CAAC,cAAc,CAAC,WAAW,EAAE,iBAAiB,GAAG,IAAI;IAK9D;;OAEG;IACH,SAAS,CAAC,cAAc,CAAC,WAAW,EAAE,iBAAiB,GAAG,OAAO;IAIjE;;OAEG;IACH,SAAS,CAAC,gBAAgB,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,GAAG,OAAO;IAsC3E,YAAY;cACI,KAAK,CACnB,aAAa,EAAE,aAAa,EAC5B,eAAe,CAAC,EAAE,KAAK,GAAG,OAAO,GAAG,iBAAiB,GACpD,OAAO,CAAC,QAAQ,CAAC;CA2ErB"}

234
node_modules/@sentry/node/dist/transports/base/index.js generated vendored Normal file
View File

@@ -0,0 +1,234 @@
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var core_1 = require("@sentry/core");
var utils_1 = require("@sentry/utils");
var fs = require("fs");
var url_1 = require("url");
var flags_1 = require("../../flags");
var version_1 = require("../../version");
var CATEGORY_MAPPING = {
event: 'error',
transaction: 'transaction',
session: 'session',
attachment: 'attachment',
};
/** Base Transport class implementation */
var BaseTransport = /** @class */ (function () {
/** Create instance and set this.dsn */
function BaseTransport(options) {
this.options = options;
/** A simple buffer holding all requests. */
this._buffer = utils_1.makePromiseBuffer(30);
/** Locks transport after receiving rate limits in a response */
this._rateLimits = {};
/** Default function used to parse URLs */
this.urlParser = function (url) { return new url_1.URL(url); };
// eslint-disable-next-line deprecation/deprecation
this._api = core_1.initAPIDetails(options.dsn, options._metadata, options.tunnel);
}
/**
* @inheritDoc
*/
BaseTransport.prototype.sendEvent = function (_) {
throw new utils_1.SentryError('Transport Class has to implement `sendEvent` method.');
};
/**
* @inheritDoc
*/
BaseTransport.prototype.close = function (timeout) {
return this._buffer.drain(timeout);
};
/**
* Extracts proxy settings from client options and env variables.
*
* Honors `no_proxy` env variable with the highest priority to allow for hosts exclusion.
*
* An order of priority for available protocols is:
* `http` => `options.httpProxy` | `process.env.http_proxy`
* `https` => `options.httpsProxy` | `options.httpProxy` | `process.env.https_proxy` | `process.env.http_proxy`
*/
BaseTransport.prototype._getProxy = function (protocol) {
var e_1, _a;
var _b = process.env, no_proxy = _b.no_proxy, http_proxy = _b.http_proxy, https_proxy = _b.https_proxy;
var _c = this.options, httpProxy = _c.httpProxy, httpsProxy = _c.httpsProxy;
var proxy = protocol === 'http' ? httpProxy || http_proxy : httpsProxy || httpProxy || https_proxy || http_proxy;
if (!no_proxy) {
return proxy;
}
var _d = this._api.dsn, host = _d.host, port = _d.port;
try {
for (var _e = tslib_1.__values(no_proxy.split(',')), _f = _e.next(); !_f.done; _f = _e.next()) {
var np = _f.value;
if (host.endsWith(np) || (host + ":" + port).endsWith(np)) {
return;
}
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_f && !_f.done && (_a = _e.return)) _a.call(_e);
}
finally { if (e_1) throw e_1.error; }
}
return proxy;
};
/** Returns a build request option object used by request */
BaseTransport.prototype._getRequestOptions = function (urlParts) {
var headers = tslib_1.__assign(tslib_1.__assign({}, core_1.getRequestHeaders(this._api.dsn, version_1.SDK_NAME, core_1.SDK_VERSION)), this.options.headers);
var hostname = urlParts.hostname, pathname = urlParts.pathname, port = urlParts.port, protocol = urlParts.protocol;
// See https://github.com/nodejs/node/blob/38146e717fed2fabe3aacb6540d839475e0ce1c6/lib/internal/url.js#L1268-L1290
// We ignore the query string on purpose
var path = "" + pathname;
return tslib_1.__assign({ agent: this.client, headers: headers,
hostname: hostname, method: 'POST', path: path,
port: port,
protocol: protocol }, (this.options.caCerts && {
ca: fs.readFileSync(this.options.caCerts),
}));
};
/**
* Gets the time that given category is disabled until for rate limiting
*/
BaseTransport.prototype._disabledUntil = function (requestType) {
var category = CATEGORY_MAPPING[requestType];
return this._rateLimits[category] || this._rateLimits.all;
};
/**
* Checks if a category is rate limited
*/
BaseTransport.prototype._isRateLimited = function (requestType) {
return this._disabledUntil(requestType) > new Date(Date.now());
};
/**
* Sets internal _rateLimits from incoming headers. Returns true if headers contains a non-empty rate limiting header.
*/
BaseTransport.prototype._handleRateLimit = function (headers) {
var e_2, _a, e_3, _b;
var now = Date.now();
var rlHeader = headers['x-sentry-rate-limits'];
var raHeader = headers['retry-after'];
if (rlHeader) {
try {
// rate limit headers are of the form
// <header>,<header>,..
// where each <header> is of the form
// <retry_after>: <categories>: <scope>: <reason_code>
// where
// <retry_after> is a delay in ms
// <categories> is the event type(s) (error, transaction, etc) being rate limited and is of the form
// <category>;<category>;...
// <scope> is what's being limited (org, project, or key) - ignored by SDK
// <reason_code> is an arbitrary string like "org_quota" - ignored by SDK
for (var _c = tslib_1.__values(rlHeader.trim().split(',')), _d = _c.next(); !_d.done; _d = _c.next()) {
var limit = _d.value;
var parameters = limit.split(':', 2);
var headerDelay = parseInt(parameters[0], 10);
var delay = (!isNaN(headerDelay) ? headerDelay : 60) * 1000; // 60sec default
try {
for (var _e = (e_3 = void 0, tslib_1.__values((parameters[1] && parameters[1].split(';')) || ['all'])), _f = _e.next(); !_f.done; _f = _e.next()) {
var category = _f.value;
// categoriesAllowed is added here to ensure we are only storing rate limits for categories we support in this
// sdk and any categories that are not supported will not be added redundantly to the rateLimits object
var categoriesAllowed = tslib_1.__spread(Object.keys(CATEGORY_MAPPING).map(function (k) { return CATEGORY_MAPPING[k]; }), [
'all',
]);
if (categoriesAllowed.includes(category))
this._rateLimits[category] = new Date(now + delay);
}
}
catch (e_3_1) { e_3 = { error: e_3_1 }; }
finally {
try {
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
}
finally { if (e_3) throw e_3.error; }
}
}
}
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
}
finally { if (e_2) throw e_2.error; }
}
return true;
}
else if (raHeader) {
this._rateLimits.all = new Date(now + utils_1.parseRetryAfterHeader(raHeader, now));
return true;
}
return false;
};
/** JSDoc */
BaseTransport.prototype._send = function (sentryRequest, originalPayload) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var _this = this;
return tslib_1.__generator(this, function (_a) {
if (!this.module) {
throw new utils_1.SentryError('No module available');
}
if (originalPayload && this._isRateLimited(sentryRequest.type)) {
return [2 /*return*/, Promise.reject({
payload: originalPayload,
type: sentryRequest.type,
reason: "Transport for " + sentryRequest.type + " requests locked till " + this._disabledUntil(sentryRequest.type) + " due to too many requests.",
status: 429,
})];
}
return [2 /*return*/, this._buffer.add(function () {
return new Promise(function (resolve, reject) {
if (!_this.module) {
throw new utils_1.SentryError('No module available');
}
var options = _this._getRequestOptions(_this.urlParser(sentryRequest.url));
var req = _this.module.request(options, function (res) {
var statusCode = res.statusCode || 500;
var status = utils_1.eventStatusFromHttpCode(statusCode);
res.setEncoding('utf8');
/**
* "Key-value pairs of header names and values. Header names are lower-cased."
* https://nodejs.org/api/http.html#http_message_headers
*/
var retryAfterHeader = res.headers ? res.headers['retry-after'] : '';
retryAfterHeader = (Array.isArray(retryAfterHeader) ? retryAfterHeader[0] : retryAfterHeader);
var rlHeader = res.headers ? res.headers['x-sentry-rate-limits'] : '';
rlHeader = (Array.isArray(rlHeader) ? rlHeader[0] : rlHeader);
var headers = {
'x-sentry-rate-limits': rlHeader,
'retry-after': retryAfterHeader,
};
var limited = _this._handleRateLimit(headers);
if (limited)
flags_1.IS_DEBUG_BUILD &&
utils_1.logger.warn("Too many " + sentryRequest.type + " requests, backing off until: " + _this._disabledUntil(sentryRequest.type));
if (status === 'success') {
resolve({ status: status });
}
else {
var rejectionMessage = "HTTP Error (" + statusCode + ")";
if (res.headers && res.headers['x-sentry-error']) {
rejectionMessage += ": " + res.headers['x-sentry-error'];
}
reject(new utils_1.SentryError(rejectionMessage));
}
// Force the socket to drain
res.on('data', function () {
// Drain
});
res.on('end', function () {
// Drain
});
});
req.on('error', reject);
req.end(sentryRequest.body);
});
})];
});
});
};
return BaseTransport;
}());
exports.BaseTransport = BaseTransport;
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

17
node_modules/@sentry/node/dist/transports/http.d.ts generated vendored Normal file
View File

@@ -0,0 +1,17 @@
import { Event, Response, Session, SessionAggregates, TransportOptions } from '@sentry/types';
import { BaseTransport } from './base';
/** Node http module transport */
export declare class HTTPTransport extends BaseTransport {
options: TransportOptions;
/** Create a new instance and set this.agent */
constructor(options: TransportOptions);
/**
* @inheritDoc
*/
sendEvent(event: Event): Promise<Response>;
/**
* @inheritDoc
*/
sendSession(session: Session | SessionAggregates): PromiseLike<Response>;
}
//# sourceMappingURL=http.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../src/transports/http.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAG9F,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAEvC,iCAAiC;AACjC,qBAAa,aAAc,SAAQ,aAAa;IAEpB,OAAO,EAAE,gBAAgB;IADnD,+CAA+C;gBACrB,OAAO,EAAE,gBAAgB;IASnD;;OAEG;IACI,SAAS,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,QAAQ,CAAC;IAIjD;;OAEG;IACI,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG,iBAAiB,GAAG,WAAW,CAAC,QAAQ,CAAC;CAGhF"}

35
node_modules/@sentry/node/dist/transports/http.js generated vendored Normal file
View File

@@ -0,0 +1,35 @@
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var core_1 = require("@sentry/core");
var http = require("http");
var base_1 = require("./base");
/** Node http module transport */
var HTTPTransport = /** @class */ (function (_super) {
tslib_1.__extends(HTTPTransport, _super);
/** Create a new instance and set this.agent */
function HTTPTransport(options) {
var _this = _super.call(this, options) || this;
_this.options = options;
var proxy = _this._getProxy('http');
_this.module = http;
_this.client = proxy
? new (require('https-proxy-agent'))(proxy)
: new http.Agent({ keepAlive: false, maxSockets: 30, timeout: 2000 });
return _this;
}
/**
* @inheritDoc
*/
HTTPTransport.prototype.sendEvent = function (event) {
return this._send(core_1.eventToSentryRequest(event, this._api), event);
};
/**
* @inheritDoc
*/
HTTPTransport.prototype.sendSession = function (session) {
return this._send(core_1.sessionToSentryRequest(session, this._api), session);
};
return HTTPTransport;
}(base_1.BaseTransport));
exports.HTTPTransport = HTTPTransport;
//# sourceMappingURL=http.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"http.js","sourceRoot":"","sources":["../../../src/transports/http.ts"],"names":[],"mappings":";;AAAA,qCAA4E;AAE5E,2BAA6B;AAE7B,+BAAuC;AAEvC,iCAAiC;AACjC;IAAmC,yCAAa;IAC9C,+CAA+C;IAC/C,uBAA0B,OAAyB;QAAnD,YACE,kBAAM,OAAO,CAAC,SAMf;QAPyB,aAAO,GAAP,OAAO,CAAkB;QAEjD,IAAM,KAAK,GAAG,KAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QACrC,KAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACnB,KAAI,CAAC,MAAM,GAAG,KAAK;YACjB,CAAC,CAAE,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC,CAAC,KAAK,CAAgB;YAC3D,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;;IAC1E,CAAC;IAED;;OAEG;IACI,iCAAS,GAAhB,UAAiB,KAAY;QAC3B,OAAO,IAAI,CAAC,KAAK,CAAC,2BAAoB,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC,CAAC;IACnE,CAAC;IAED;;OAEG;IACI,mCAAW,GAAlB,UAAmB,OAAoC;QACrD,OAAO,IAAI,CAAC,KAAK,CAAC,6BAAsB,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC;IACzE,CAAC;IACH,oBAAC;AAAD,CAAC,AAxBD,CAAmC,oBAAa,GAwB/C;AAxBY,sCAAa","sourcesContent":["import { eventToSentryRequest, sessionToSentryRequest } from '@sentry/core';\nimport { Event, Response, Session, SessionAggregates, TransportOptions } from '@sentry/types';\nimport * as http from 'http';\n\nimport { BaseTransport } from './base';\n\n/** Node http module transport */\nexport class HTTPTransport extends BaseTransport {\n /** Create a new instance and set this.agent */\n public constructor(public options: TransportOptions) {\n super(options);\n const proxy = this._getProxy('http');\n this.module = http;\n this.client = proxy\n ? (new (require('https-proxy-agent'))(proxy) as http.Agent)\n : new http.Agent({ keepAlive: false, maxSockets: 30, timeout: 2000 });\n }\n\n /**\n * @inheritDoc\n */\n public sendEvent(event: Event): Promise<Response> {\n return this._send(eventToSentryRequest(event, this._api), event);\n }\n\n /**\n * @inheritDoc\n */\n public sendSession(session: Session | SessionAggregates): PromiseLike<Response> {\n return this._send(sessionToSentryRequest(session, this._api), session);\n }\n}\n"]}

17
node_modules/@sentry/node/dist/transports/https.d.ts generated vendored Normal file
View File

@@ -0,0 +1,17 @@
import { Event, Response, Session, SessionAggregates, TransportOptions } from '@sentry/types';
import { BaseTransport } from './base';
/** Node https module transport */
export declare class HTTPSTransport extends BaseTransport {
options: TransportOptions;
/** Create a new instance and set this.agent */
constructor(options: TransportOptions);
/**
* @inheritDoc
*/
sendEvent(event: Event): Promise<Response>;
/**
* @inheritDoc
*/
sendSession(session: Session | SessionAggregates): PromiseLike<Response>;
}
//# sourceMappingURL=https.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"https.d.ts","sourceRoot":"","sources":["../../../src/transports/https.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAG9F,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAEvC,kCAAkC;AAClC,qBAAa,cAAe,SAAQ,aAAa;IAErB,OAAO,EAAE,gBAAgB;IADnD,+CAA+C;gBACrB,OAAO,EAAE,gBAAgB;IASnD;;OAEG;IACI,SAAS,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,QAAQ,CAAC;IAIjD;;OAEG;IACI,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG,iBAAiB,GAAG,WAAW,CAAC,QAAQ,CAAC;CAGhF"}

35
node_modules/@sentry/node/dist/transports/https.js generated vendored Normal file
View File

@@ -0,0 +1,35 @@
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var core_1 = require("@sentry/core");
var https = require("https");
var base_1 = require("./base");
/** Node https module transport */
var HTTPSTransport = /** @class */ (function (_super) {
tslib_1.__extends(HTTPSTransport, _super);
/** Create a new instance and set this.agent */
function HTTPSTransport(options) {
var _this = _super.call(this, options) || this;
_this.options = options;
var proxy = _this._getProxy('https');
_this.module = https;
_this.client = proxy
? new (require('https-proxy-agent'))(proxy)
: new https.Agent({ keepAlive: false, maxSockets: 30, timeout: 2000 });
return _this;
}
/**
* @inheritDoc
*/
HTTPSTransport.prototype.sendEvent = function (event) {
return this._send(core_1.eventToSentryRequest(event, this._api), event);
};
/**
* @inheritDoc
*/
HTTPSTransport.prototype.sendSession = function (session) {
return this._send(core_1.sessionToSentryRequest(session, this._api), session);
};
return HTTPSTransport;
}(base_1.BaseTransport));
exports.HTTPSTransport = HTTPSTransport;
//# sourceMappingURL=https.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"https.js","sourceRoot":"","sources":["../../../src/transports/https.ts"],"names":[],"mappings":";;AAAA,qCAA4E;AAE5E,6BAA+B;AAE/B,+BAAuC;AAEvC,kCAAkC;AAClC;IAAoC,0CAAa;IAC/C,+CAA+C;IAC/C,wBAA0B,OAAyB;QAAnD,YACE,kBAAM,OAAO,CAAC,SAMf;QAPyB,aAAO,GAAP,OAAO,CAAkB;QAEjD,IAAM,KAAK,GAAG,KAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QACtC,KAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,KAAI,CAAC,MAAM,GAAG,KAAK;YACjB,CAAC,CAAE,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC,CAAC,KAAK,CAAiB;YAC5D,CAAC,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;;IAC3E,CAAC;IAED;;OAEG;IACI,kCAAS,GAAhB,UAAiB,KAAY;QAC3B,OAAO,IAAI,CAAC,KAAK,CAAC,2BAAoB,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC,CAAC;IACnE,CAAC;IAED;;OAEG;IACI,oCAAW,GAAlB,UAAmB,OAAoC;QACrD,OAAO,IAAI,CAAC,KAAK,CAAC,6BAAsB,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC;IACzE,CAAC;IACH,qBAAC;AAAD,CAAC,AAxBD,CAAoC,oBAAa,GAwBhD;AAxBY,wCAAc","sourcesContent":["import { eventToSentryRequest, sessionToSentryRequest } from '@sentry/core';\nimport { Event, Response, Session, SessionAggregates, TransportOptions } from '@sentry/types';\nimport * as https from 'https';\n\nimport { BaseTransport } from './base';\n\n/** Node https module transport */\nexport class HTTPSTransport extends BaseTransport {\n /** Create a new instance and set this.agent */\n public constructor(public options: TransportOptions) {\n super(options);\n const proxy = this._getProxy('https');\n this.module = https;\n this.client = proxy\n ? (new (require('https-proxy-agent'))(proxy) as https.Agent)\n : new https.Agent({ keepAlive: false, maxSockets: 30, timeout: 2000 });\n }\n\n /**\n * @inheritDoc\n */\n public sendEvent(event: Event): Promise<Response> {\n return this._send(eventToSentryRequest(event, this._api), event);\n }\n\n /**\n * @inheritDoc\n */\n public sendSession(session: Session | SessionAggregates): PromiseLike<Response> {\n return this._send(sessionToSentryRequest(session, this._api), session);\n }\n}\n"]}

5
node_modules/@sentry/node/dist/transports/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,5 @@
export { BaseTransport } from './base';
export { HTTPTransport } from './http';
export { HTTPSTransport } from './https';
export { makeNodeTransport, NodeTransportOptions } from './new';
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/transports/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC"}

10
node_modules/@sentry/node/dist/transports/index.js generated vendored Normal file
View File

@@ -0,0 +1,10 @@
Object.defineProperty(exports, "__esModule", { value: true });
var base_1 = require("./base");
exports.BaseTransport = base_1.BaseTransport;
var http_1 = require("./http");
exports.HTTPTransport = http_1.HTTPTransport;
var https_1 = require("./https");
exports.HTTPSTransport = https_1.HTTPSTransport;
var new_1 = require("./new");
exports.makeNodeTransport = new_1.makeNodeTransport;
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/transports/index.ts"],"names":[],"mappings":";AAAA,+BAAuC;AAA9B,+BAAA,aAAa,CAAA;AACtB,+BAAuC;AAA9B,+BAAA,aAAa,CAAA;AACtB,iCAAyC;AAAhC,iCAAA,cAAc,CAAA;AACvB,6BAAgE;AAAvD,kCAAA,iBAAiB,CAAA","sourcesContent":["export { BaseTransport } from './base';\nexport { HTTPTransport } from './http';\nexport { HTTPSTransport } from './https';\nexport { makeNodeTransport, NodeTransportOptions } from './new';\n"]}

18
node_modules/@sentry/node/dist/transports/new.d.ts generated vendored Normal file
View File

@@ -0,0 +1,18 @@
/// <reference types="node" />
import { BaseTransportOptions, NewTransport } from '@sentry/core';
import { HTTPModule } from './base/http-module';
export interface NodeTransportOptions extends BaseTransportOptions {
/** Define custom headers */
headers?: Record<string, string>;
/** Set a proxy that should be used for outbound requests. */
proxy?: string;
/** HTTPS proxy CA certificates */
caCerts?: string | Buffer | Array<string | Buffer>;
/** Custom HTTP module. Defaults to the native 'http' and 'https' modules. */
httpModule?: HTTPModule;
}
/**
* Creates a Transport that uses native the native 'http' and 'https' modules to send events to Sentry.
*/
export declare function makeNodeTransport(options: NodeTransportOptions): NewTransport;
//# sourceMappingURL=new.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"new.d.ts","sourceRoot":"","sources":["../../../src/transports/new.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,oBAAoB,EAEpB,YAAY,EAIb,MAAM,cAAc,CAAC;AAMtB,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAShD,MAAM,WAAW,oBAAqB,SAAQ,oBAAoB;IAChE,4BAA4B;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,6DAA6D;IAC7D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kCAAkC;IAClC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;IACnD,6EAA6E;IAC7E,UAAU,CAAC,EAAE,UAAU,CAAC;CACzB;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,oBAAoB,GAAG,YAAY,CAqB7E"}

92
node_modules/@sentry/node/dist/transports/new.js generated vendored Normal file
View File

@@ -0,0 +1,92 @@
Object.defineProperty(exports, "__esModule", { value: true });
var core_1 = require("@sentry/core");
var utils_1 = require("@sentry/utils");
var http = require("http");
var https = require("https");
var url_1 = require("url");
/**
* Creates a Transport that uses native the native 'http' and 'https' modules to send events to Sentry.
*/
function makeNodeTransport(options) {
var _a;
var urlSegments = new url_1.URL(options.url);
var isHttps = urlSegments.protocol === 'https:';
// Proxy prioritization: http => `options.proxy` | `process.env.http_proxy`
// Proxy prioritization: https => `options.proxy` | `process.env.https_proxy` | `process.env.http_proxy`
var proxy = applyNoProxyOption(urlSegments, options.proxy || (isHttps ? process.env.https_proxy : undefined) || process.env.http_proxy);
var nativeHttpModule = isHttps ? https : http;
// TODO(v7): Evaluate if we can set keepAlive to true. This would involve testing for memory leaks in older node
// versions(>= 8) as they had memory leaks when using it: #2555
var agent = proxy
? new (require('https-proxy-agent'))(proxy)
: new nativeHttpModule.Agent({ keepAlive: false, maxSockets: 30, timeout: 2000 });
var requestExecutor = createRequestExecutor(options, (_a = options.httpModule, (_a !== null && _a !== void 0 ? _a : nativeHttpModule)), agent);
return core_1.createTransport({ bufferSize: options.bufferSize }, requestExecutor);
}
exports.makeNodeTransport = makeNodeTransport;
/**
* Honors the `no_proxy` env variable with the highest priority to allow for hosts exclusion.
*
* @param transportUrl The URL the transport intends to send events to.
* @param proxy The client configured proxy.
* @returns A proxy the transport should use.
*/
function applyNoProxyOption(transportUrlSegments, proxy) {
var no_proxy = process.env.no_proxy;
var urlIsExemptFromProxy = no_proxy &&
no_proxy
.split(',')
.some(function (exemption) { return transportUrlSegments.host.endsWith(exemption) || transportUrlSegments.hostname.endsWith(exemption); });
if (urlIsExemptFromProxy) {
return undefined;
}
else {
return proxy;
}
}
/**
* Creates a RequestExecutor to be used with `createTransport`.
*/
function createRequestExecutor(options, httpModule, agent) {
var _a = new url_1.URL(options.url), hostname = _a.hostname, pathname = _a.pathname, port = _a.port, protocol = _a.protocol, search = _a.search;
return function makeRequest(request) {
return new Promise(function (resolve, reject) {
var req = httpModule.request({
method: 'POST',
agent: agent,
headers: options.headers,
hostname: hostname,
path: "" + pathname + search,
port: port,
protocol: protocol,
ca: options.caCerts,
}, function (res) {
var _a, _b, _c;
res.on('data', function () {
// Drain socket
});
res.on('end', function () {
// Drain socket
});
var statusCode = (_a = res.statusCode, (_a !== null && _a !== void 0 ? _a : 500));
var status = utils_1.eventStatusFromHttpCode(statusCode);
res.setEncoding('utf8');
// "Key-value pairs of header names and values. Header names are lower-cased."
// https://nodejs.org/api/http.html#http_message_headers
var retryAfterHeader = (_b = res.headers['retry-after'], (_b !== null && _b !== void 0 ? _b : null));
var rateLimitsHeader = (_c = res.headers['x-sentry-rate-limits'], (_c !== null && _c !== void 0 ? _c : null));
resolve({
headers: {
'retry-after': retryAfterHeader,
'x-sentry-rate-limits': Array.isArray(rateLimitsHeader) ? rateLimitsHeader[0] : rateLimitsHeader,
},
reason: status,
statusCode: statusCode,
});
});
req.on('error', reject);
req.end(request.body);
});
};
}
//# sourceMappingURL=new.js.map

1
node_modules/@sentry/node/dist/transports/new.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

34
node_modules/@sentry/node/dist/types.d.ts generated vendored Normal file
View File

@@ -0,0 +1,34 @@
import { Options } from '@sentry/types';
/**
* Configuration options for the Sentry Node SDK.
* @see NodeClient for more information.
*/
export interface NodeOptions extends Options {
/** Sets an optional server name (device name) */
serverName?: string;
/** Maximum time in milliseconds to wait to drain the request queue, before the process is allowed to exit. */
shutdownTimeout?: number;
/** Set a HTTP proxy that should be used for outbound requests. */
httpProxy?: string;
/** Set a HTTPS proxy that should be used for outbound requests. */
httpsProxy?: string;
/** HTTPS proxy certificates path */
caCerts?: string;
/**
* Sets the number of context lines for each frame when loading a file.
*
* @deprecated Context lines configuration has moved to the `ContextLines` integration, and can be used like this:
*
* ```
* init({
* dsn: '__DSN__',
* integrations: [new ContextLines({ frameContextLines: 10 })]
* })
* ```
*
* */
frameContextLines?: number;
/** Callback that is executed when a fatal global error occurs. */
onFatalError?(error: Error): void;
}
//# sourceMappingURL=types.d.ts.map

1
node_modules/@sentry/node/dist/types.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC;;;GAGG;AACH,MAAM,WAAW,WAAY,SAAQ,OAAO;IAC1C,iDAAiD;IACjD,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,8GAA8G;IAC9G,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB,kEAAkE;IAClE,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,mEAAmE;IACnE,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,oCAAoC;IACpC,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;;;;;;;;;;SAYK;IACL,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B,kEAAkE;IAClE,YAAY,CAAC,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;CACnC"}

Some files were not shown because too many files have changed in this diff Show More