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

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 @@
//# 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"}

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

@@ -0,0 +1,233 @@
import { __assign, __awaiter, __generator, __read, __spread, __values } from "tslib";
import { getRequestHeaders, initAPIDetails, SDK_VERSION } from '@sentry/core';
import { eventStatusFromHttpCode, logger, makePromiseBuffer, parseRetryAfterHeader, SentryError, } from '@sentry/utils';
import * as fs from 'fs';
import { URL } from 'url';
import { IS_DEBUG_BUILD } from '../../flags';
import { SDK_NAME } from '../../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 = 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(url); };
// eslint-disable-next-line deprecation/deprecation
this._api = initAPIDetails(options.dsn, options._metadata, options.tunnel);
}
/**
* @inheritDoc
*/
BaseTransport.prototype.sendEvent = function (_) {
throw new 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 = __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 = __assign(__assign({}, getRequestHeaders(this._api.dsn, SDK_NAME, 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 __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 = __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, __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 = __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 + parseRetryAfterHeader(raHeader, now));
return true;
}
return false;
};
/** JSDoc */
BaseTransport.prototype._send = function (sentryRequest, originalPayload) {
return __awaiter(this, void 0, void 0, function () {
var _this = this;
return __generator(this, function (_a) {
if (!this.module) {
throw new 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 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 = 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)
IS_DEBUG_BUILD &&
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 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;
}());
export { BaseTransport };
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

17
node_modules/@sentry/node/esm/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"}

34
node_modules/@sentry/node/esm/transports/http.js generated vendored Normal file
View File

@@ -0,0 +1,34 @@
import { __extends } from "tslib";
import { eventToSentryRequest, sessionToSentryRequest } from '@sentry/core';
import * as http from 'http';
import { BaseTransport } from './base';
/** Node http module transport */
var HTTPTransport = /** @class */ (function (_super) {
__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(eventToSentryRequest(event, this._api), event);
};
/**
* @inheritDoc
*/
HTTPTransport.prototype.sendSession = function (session) {
return this._send(sessionToSentryRequest(session, this._api), session);
};
return HTTPTransport;
}(BaseTransport));
export { HTTPTransport };
//# sourceMappingURL=http.js.map

1
node_modules/@sentry/node/esm/transports/http.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"http.js","sourceRoot":"","sources":["../../../src/transports/http.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAE5E,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAEvC,iCAAiC;AACjC;IAAmC,iCAAa;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,oBAAoB,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,sBAAsB,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC;IACzE,CAAC;IACH,oBAAC;AAAD,CAAC,AAxBD,CAAmC,aAAa,GAwB/C","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/esm/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"}

34
node_modules/@sentry/node/esm/transports/https.js generated vendored Normal file
View File

@@ -0,0 +1,34 @@
import { __extends } from "tslib";
import { eventToSentryRequest, sessionToSentryRequest } from '@sentry/core';
import * as https from 'https';
import { BaseTransport } from './base';
/** Node https module transport */
var HTTPSTransport = /** @class */ (function (_super) {
__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(eventToSentryRequest(event, this._api), event);
};
/**
* @inheritDoc
*/
HTTPSTransport.prototype.sendSession = function (session) {
return this._send(sessionToSentryRequest(session, this._api), session);
};
return HTTPSTransport;
}(BaseTransport));
export { HTTPSTransport };
//# sourceMappingURL=https.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"https.js","sourceRoot":"","sources":["../../../src/transports/https.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAE5E,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAEvC,kCAAkC;AAClC;IAAoC,kCAAa;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,oBAAoB,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,sBAAsB,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC;IACzE,CAAC;IACH,qBAAC;AAAD,CAAC,AAxBD,CAAoC,aAAa,GAwBhD","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/esm/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"}

5
node_modules/@sentry/node/esm/transports/index.js generated vendored Normal file
View File

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

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","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,EAAwB,MAAM,OAAO,CAAC","sourcesContent":["export { BaseTransport } from './base';\nexport { HTTPTransport } from './http';\nexport { HTTPSTransport } from './https';\nexport { makeNodeTransport, NodeTransportOptions } from './new';\n"]}

18
node_modules/@sentry/node/esm/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"}

90
node_modules/@sentry/node/esm/transports/new.js generated vendored Normal file
View File

@@ -0,0 +1,90 @@
import { createTransport, } from '@sentry/core';
import { eventStatusFromHttpCode } from '@sentry/utils';
import * as http from 'http';
import * as https from 'https';
import { URL } from 'url';
/**
* Creates a Transport that uses native the native 'http' and 'https' modules to send events to Sentry.
*/
export function makeNodeTransport(options) {
var _a;
var urlSegments = new 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 createTransport({ bufferSize: options.bufferSize }, requestExecutor);
}
/**
* 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(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 = 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/esm/transports/new.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long