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

3
node_modules/@sentry/hub/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/hub/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/hub/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/hub/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"]}

244
node_modules/@sentry/hub/dist/hub.d.ts generated vendored Normal file
View File

@@ -0,0 +1,244 @@
import { Breadcrumb, BreadcrumbHint, Client, CustomSamplingContext, Event, EventHint, Extra, Extras, Hub as HubInterface, Integration, IntegrationClass, Primitive, SessionContext, Severity, Span, SpanContext, Transaction, TransactionContext, User } from '@sentry/types';
import { Scope } from './scope';
import { Session } from './session';
/**
* API compatibility version of this hub.
*
* WARNING: This number should only be increased when the global interface
* changes and new methods are introduced.
*
* @hidden
*/
export declare const API_VERSION = 4;
/**
* A layer in the process stack.
* @hidden
*/
export interface Layer {
client?: Client;
scope?: Scope;
}
/**
* An object that contains a hub and maintains a scope stack.
* @hidden
*/
export interface Carrier {
__SENTRY__?: {
hub?: Hub;
/**
* Extra Hub properties injected by various SDKs
*/
integrations?: Integration[];
extensions?: {
/** Hack to prevent bundlers from breaking our usage of the domain package in the cross-platform Hub package */
domain?: {
[key: string]: any;
};
} & {
/** Extension methods for the hub, which are bound to the current Hub instance */
[key: string]: Function;
};
};
}
/**
* @hidden
* @deprecated Can be removed once `Hub.getActiveDomain` is removed.
*/
export interface DomainAsCarrier extends Carrier {
members: {
[key: string]: any;
}[];
}
/**
* @inheritDoc
*/
export declare class Hub implements HubInterface {
private readonly _version;
/** Is a {@link Layer}[] containing the client and scope */
private readonly _stack;
/** Contains the last event id of a captured event. */
private _lastEventId?;
/**
* Creates a new instance of the hub, will push one {@link Layer} into the
* internal stack on creation.
*
* @param client bound to the hub.
* @param scope bound to the hub.
* @param version number, higher number means higher priority.
*/
constructor(client?: Client, scope?: Scope, _version?: number);
/**
* @inheritDoc
*/
isOlderThan(version: number): boolean;
/**
* @inheritDoc
*/
bindClient(client?: Client): void;
/**
* @inheritDoc
*/
pushScope(): Scope;
/**
* @inheritDoc
*/
popScope(): boolean;
/**
* @inheritDoc
*/
withScope(callback: (scope: Scope) => void): void;
/**
* @inheritDoc
*/
getClient<C extends Client>(): C | undefined;
/** Returns the scope of the top stack. */
getScope(): Scope | undefined;
/** Returns the scope stack for domains or the process. */
getStack(): Layer[];
/** Returns the topmost scope layer in the order domain > local > process. */
getStackTop(): Layer;
/**
* @inheritDoc
*/
captureException(exception: any, hint?: EventHint): string;
/**
* @inheritDoc
*/
captureMessage(message: string, level?: Severity, hint?: EventHint): string;
/**
* @inheritDoc
*/
captureEvent(event: Event, hint?: EventHint): string;
/**
* @inheritDoc
*/
lastEventId(): string | undefined;
/**
* @inheritDoc
*/
addBreadcrumb(breadcrumb: Breadcrumb, hint?: BreadcrumbHint): void;
/**
* @inheritDoc
*/
setUser(user: User | null): void;
/**
* @inheritDoc
*/
setTags(tags: {
[key: string]: Primitive;
}): void;
/**
* @inheritDoc
*/
setExtras(extras: Extras): void;
/**
* @inheritDoc
*/
setTag(key: string, value: Primitive): void;
/**
* @inheritDoc
*/
setExtra(key: string, extra: Extra): void;
/**
* @inheritDoc
*/
setContext(name: string, context: {
[key: string]: any;
} | null): void;
/**
* @inheritDoc
*/
configureScope(callback: (scope: Scope) => void): void;
/**
* @inheritDoc
*/
run(callback: (hub: Hub) => void): void;
/**
* @inheritDoc
*/
getIntegration<T extends Integration>(integration: IntegrationClass<T>): T | null;
/**
* @inheritDoc
*/
startSpan(context: SpanContext): Span;
/**
* @inheritDoc
*/
startTransaction(context: TransactionContext, customSamplingContext?: CustomSamplingContext): Transaction;
/**
* @inheritDoc
*/
traceHeaders(): {
[key: string]: string;
};
/**
* @inheritDoc
*/
captureSession(endSession?: boolean): void;
/**
* @inheritDoc
*/
endSession(): void;
/**
* @inheritDoc
*/
startSession(context?: SessionContext): Session;
/**
* Sends the current Session on the scope
*/
private _sendSessionUpdate;
/**
* Internal helper function to call a method on the top client if it exists.
*
* @param method The method to call on the client.
* @param args Arguments to pass to the client function.
*/
private _invokeClient;
/**
* Calls global extension method and binding current instance to the function call
*/
private _callExtensionMethod;
}
/**
* Returns the global shim registry.
*
* FIXME: This function is problematic, because despite always returning a valid Carrier,
* it has an optional `__SENTRY__` property, which then in turn requires us to always perform an unnecessary check
* at the call-site. We always access the carrier through this function, so we can guarantee that `__SENTRY__` is there.
**/
export declare function getMainCarrier(): Carrier;
/**
* Replaces the current main hub with the passed one on the global object
*
* @returns The old replaced hub
*/
export declare function makeMain(hub: Hub): Hub;
/**
* Returns the default hub instance.
*
* If a hub is already registered in the global carrier but this module
* contains a more recent version, it replaces the registered version.
* Otherwise, the currently registered hub will be returned.
*/
export declare function getCurrentHub(): Hub;
/**
* Returns the active domain, if one exists
* @deprecated No longer used; remove in v7
* @returns The domain, or undefined if there is no active domain
*/
export declare function getActiveDomain(): DomainAsCarrier | undefined;
/**
* This will create a new {@link Hub} and add to the passed object on
* __SENTRY__.hub.
* @param carrier object
* @hidden
*/
export declare function getHubFromCarrier(carrier: Carrier): Hub;
/**
* This will set passed {@link Hub} on the passed object's __SENTRY__.hub attribute
* @param carrier object
* @param hub Hub
* @returns A boolean indicating success or failure
*/
export declare function setHubOnCarrier(carrier: Carrier, hub: Hub): boolean;
//# sourceMappingURL=hub.d.ts.map

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

@@ -0,0 +1 @@
{"version":3,"file":"hub.d.ts","sourceRoot":"","sources":["../../src/hub.ts"],"names":[],"mappings":"AACA,OAAO,EACL,UAAU,EACV,cAAc,EACd,MAAM,EACN,qBAAqB,EACrB,KAAK,EACL,SAAS,EACT,KAAK,EACL,MAAM,EACN,GAAG,IAAI,YAAY,EACnB,WAAW,EACX,gBAAgB,EAChB,SAAS,EACT,cAAc,EACd,QAAQ,EACR,IAAI,EACJ,WAAW,EACX,WAAW,EACX,kBAAkB,EAClB,IAAI,EACL,MAAM,eAAe,CAAC;AAYvB,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW,IAAI,CAAC;AAQ7B;;;GAGG;AACH,MAAM,WAAW,KAAK;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,KAAK,CAAC;CACf;AAED;;;GAGG;AACH,MAAM,WAAW,OAAO;IACtB,UAAU,CAAC,EAAE;QACX,GAAG,CAAC,EAAE,GAAG,CAAC;QACV;;WAEG;QACH,YAAY,CAAC,EAAE,WAAW,EAAE,CAAC;QAC7B,UAAU,CAAC,EAAE;YACX,+GAA+G;YAE/G,MAAM,CAAC,EAAE;gBAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;aAAE,CAAC;SACjC,GAAG;YACF,iFAAiF;YAEjF,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,CAAC;SACzB,CAAC;KACH,CAAC;CACH;AAED;;;GAGG;AACH,MAAM,WAAW,eAAgB,SAAQ,OAAO;IAE9C,OAAO,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,EAAE,CAAC;CACnC;AAED;;GAEG;AACH,qBA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;IACI,YAAY,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO;IA+BtD;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAY1B;;;;;OAKG;IAEH,OAAO,CAAC,aAAa;IAQrB;;OAEG;IAGH,OAAO,CAAC,oBAAoB;CAQ7B;AAED;;;;;;IAMI;AACJ,wBAAgB,cAAc,IAAI,OAAO,CAOxC;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,CAKtC;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,IAAI,GAAG,CAenC;AAED;;;;GAIG;AAEH,wBAAgB,eAAe,IAAI,eAAe,GAAG,SAAS,CAM7D;AAsCD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,GAAG,CAEvD;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,GAAG,OAAO,CAKnE"}

525
node_modules/@sentry/hub/dist/hub.js generated vendored Normal file
View File

@@ -0,0 +1,525 @@
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var utils_1 = require("@sentry/utils");
var flags_1 = require("./flags");
var scope_1 = require("./scope");
var session_1 = require("./session");
/**
* API compatibility version of this hub.
*
* WARNING: This number should only be increased when the global interface
* changes and new methods are introduced.
*
* @hidden
*/
exports.API_VERSION = 4;
/**
* Default maximum number of breadcrumbs added to an event. Can be overwritten
* with {@link Options.maxBreadcrumbs}.
*/
var DEFAULT_BREADCRUMBS = 100;
/**
* @inheritDoc
*/
var Hub = /** @class */ (function () {
/**
* Creates a new instance of the hub, will push one {@link Layer} into the
* internal stack on creation.
*
* @param client bound to the hub.
* @param scope bound to the hub.
* @param version number, higher number means higher priority.
*/
function Hub(client, scope, _version) {
if (scope === void 0) { scope = new scope_1.Scope(); }
if (_version === void 0) { _version = exports.API_VERSION; }
this._version = _version;
/** Is a {@link Layer}[] containing the client and scope */
this._stack = [{}];
this.getStackTop().scope = scope;
if (client) {
this.bindClient(client);
}
}
/**
* @inheritDoc
*/
Hub.prototype.isOlderThan = function (version) {
return this._version < version;
};
/**
* @inheritDoc
*/
Hub.prototype.bindClient = function (client) {
var top = this.getStackTop();
top.client = client;
if (client && client.setupIntegrations) {
client.setupIntegrations();
}
};
/**
* @inheritDoc
*/
Hub.prototype.pushScope = function () {
// We want to clone the content of prev scope
var scope = scope_1.Scope.clone(this.getScope());
this.getStack().push({
client: this.getClient(),
scope: scope,
});
return scope;
};
/**
* @inheritDoc
*/
Hub.prototype.popScope = function () {
if (this.getStack().length <= 1)
return false;
return !!this.getStack().pop();
};
/**
* @inheritDoc
*/
Hub.prototype.withScope = function (callback) {
var scope = this.pushScope();
try {
callback(scope);
}
finally {
this.popScope();
}
};
/**
* @inheritDoc
*/
Hub.prototype.getClient = function () {
return this.getStackTop().client;
};
/** Returns the scope of the top stack. */
Hub.prototype.getScope = function () {
return this.getStackTop().scope;
};
/** Returns the scope stack for domains or the process. */
Hub.prototype.getStack = function () {
return this._stack;
};
/** Returns the topmost scope layer in the order domain > local > process. */
Hub.prototype.getStackTop = function () {
return this._stack[this._stack.length - 1];
};
/**
* @inheritDoc
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
Hub.prototype.captureException = function (exception, hint) {
var eventId = (this._lastEventId = hint && hint.event_id ? hint.event_id : utils_1.uuid4());
var finalHint = hint;
// If there's no explicit hint provided, mimic the same thing that would happen
// in the minimal itself to create a consistent behavior.
// We don't do this in the client, as it's the lowest level API, and doing this,
// would prevent user from having full control over direct calls.
if (!hint) {
var syntheticException = void 0;
try {
throw new Error('Sentry syntheticException');
}
catch (exception) {
syntheticException = exception;
}
finalHint = {
originalException: exception,
syntheticException: syntheticException,
};
}
this._invokeClient('captureException', exception, tslib_1.__assign(tslib_1.__assign({}, finalHint), { event_id: eventId }));
return eventId;
};
/**
* @inheritDoc
*/
Hub.prototype.captureMessage = function (message, level, hint) {
var eventId = (this._lastEventId = hint && hint.event_id ? hint.event_id : utils_1.uuid4());
var finalHint = hint;
// If there's no explicit hint provided, mimic the same thing that would happen
// in the minimal itself to create a consistent behavior.
// We don't do this in the client, as it's the lowest level API, and doing this,
// would prevent user from having full control over direct calls.
if (!hint) {
var syntheticException = void 0;
try {
throw new Error(message);
}
catch (exception) {
syntheticException = exception;
}
finalHint = {
originalException: message,
syntheticException: syntheticException,
};
}
this._invokeClient('captureMessage', message, level, tslib_1.__assign(tslib_1.__assign({}, finalHint), { event_id: eventId }));
return eventId;
};
/**
* @inheritDoc
*/
Hub.prototype.captureEvent = function (event, hint) {
var eventId = hint && hint.event_id ? hint.event_id : utils_1.uuid4();
if (event.type !== 'transaction') {
this._lastEventId = eventId;
}
this._invokeClient('captureEvent', event, tslib_1.__assign(tslib_1.__assign({}, hint), { event_id: eventId }));
return eventId;
};
/**
* @inheritDoc
*/
Hub.prototype.lastEventId = function () {
return this._lastEventId;
};
/**
* @inheritDoc
*/
Hub.prototype.addBreadcrumb = function (breadcrumb, hint) {
var _a = this.getStackTop(), scope = _a.scope, client = _a.client;
if (!scope || !client)
return;
// eslint-disable-next-line @typescript-eslint/unbound-method
var _b = (client.getOptions && client.getOptions()) || {}, _c = _b.beforeBreadcrumb, beforeBreadcrumb = _c === void 0 ? null : _c, _d = _b.maxBreadcrumbs, maxBreadcrumbs = _d === void 0 ? DEFAULT_BREADCRUMBS : _d;
if (maxBreadcrumbs <= 0)
return;
var timestamp = utils_1.dateTimestampInSeconds();
var mergedBreadcrumb = tslib_1.__assign({ timestamp: timestamp }, breadcrumb);
var finalBreadcrumb = beforeBreadcrumb
? utils_1.consoleSandbox(function () { return beforeBreadcrumb(mergedBreadcrumb, hint); })
: mergedBreadcrumb;
if (finalBreadcrumb === null)
return;
scope.addBreadcrumb(finalBreadcrumb, maxBreadcrumbs);
};
/**
* @inheritDoc
*/
Hub.prototype.setUser = function (user) {
var scope = this.getScope();
if (scope)
scope.setUser(user);
};
/**
* @inheritDoc
*/
Hub.prototype.setTags = function (tags) {
var scope = this.getScope();
if (scope)
scope.setTags(tags);
};
/**
* @inheritDoc
*/
Hub.prototype.setExtras = function (extras) {
var scope = this.getScope();
if (scope)
scope.setExtras(extras);
};
/**
* @inheritDoc
*/
Hub.prototype.setTag = function (key, value) {
var scope = this.getScope();
if (scope)
scope.setTag(key, value);
};
/**
* @inheritDoc
*/
Hub.prototype.setExtra = function (key, extra) {
var scope = this.getScope();
if (scope)
scope.setExtra(key, extra);
};
/**
* @inheritDoc
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
Hub.prototype.setContext = function (name, context) {
var scope = this.getScope();
if (scope)
scope.setContext(name, context);
};
/**
* @inheritDoc
*/
Hub.prototype.configureScope = function (callback) {
var _a = this.getStackTop(), scope = _a.scope, client = _a.client;
if (scope && client) {
callback(scope);
}
};
/**
* @inheritDoc
*/
Hub.prototype.run = function (callback) {
var oldHub = makeMain(this);
try {
callback(this);
}
finally {
makeMain(oldHub);
}
};
/**
* @inheritDoc
*/
Hub.prototype.getIntegration = function (integration) {
var client = this.getClient();
if (!client)
return null;
try {
return client.getIntegration(integration);
}
catch (_oO) {
flags_1.IS_DEBUG_BUILD && utils_1.logger.warn("Cannot retrieve integration " + integration.id + " from the current Hub");
return null;
}
};
/**
* @inheritDoc
*/
Hub.prototype.startSpan = function (context) {
return this._callExtensionMethod('startSpan', context);
};
/**
* @inheritDoc
*/
Hub.prototype.startTransaction = function (context, customSamplingContext) {
return this._callExtensionMethod('startTransaction', context, customSamplingContext);
};
/**
* @inheritDoc
*/
Hub.prototype.traceHeaders = function () {
return this._callExtensionMethod('traceHeaders');
};
/**
* @inheritDoc
*/
Hub.prototype.captureSession = function (endSession) {
if (endSession === void 0) { endSession = false; }
// both send the update and pull the session from the scope
if (endSession) {
return this.endSession();
}
// only send the update
this._sendSessionUpdate();
};
/**
* @inheritDoc
*/
Hub.prototype.endSession = function () {
var layer = this.getStackTop();
var scope = layer && layer.scope;
var session = scope && scope.getSession();
if (session) {
session.close();
}
this._sendSessionUpdate();
// the session is over; take it off of the scope
if (scope) {
scope.setSession();
}
};
/**
* @inheritDoc
*/
Hub.prototype.startSession = function (context) {
var _a = this.getStackTop(), scope = _a.scope, client = _a.client;
var _b = (client && client.getOptions()) || {}, release = _b.release, environment = _b.environment;
// Will fetch userAgent if called from browser sdk
var global = utils_1.getGlobalObject();
var userAgent = (global.navigator || {}).userAgent;
var session = new session_1.Session(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ release: release,
environment: environment }, (scope && { user: scope.getUser() })), (userAgent && { userAgent: userAgent })), context));
if (scope) {
// End existing session if there's one
var currentSession = scope.getSession && scope.getSession();
if (currentSession && currentSession.status === 'ok') {
currentSession.update({ status: 'exited' });
}
this.endSession();
// Afterwards we set the new session on the scope
scope.setSession(session);
}
return session;
};
/**
* Sends the current Session on the scope
*/
Hub.prototype._sendSessionUpdate = function () {
var _a = this.getStackTop(), scope = _a.scope, client = _a.client;
if (!scope)
return;
var session = scope.getSession && scope.getSession();
if (session) {
if (client && client.captureSession) {
client.captureSession(session);
}
}
};
/**
* Internal helper function to call a method on the top client if it exists.
*
* @param method The method to call on the client.
* @param args Arguments to pass to the client function.
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
Hub.prototype._invokeClient = function (method) {
var _a;
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
var _b = this.getStackTop(), scope = _b.scope, client = _b.client;
if (client && client[method]) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any
(_a = client)[method].apply(_a, tslib_1.__spread(args, [scope]));
}
};
/**
* Calls global extension method and binding current instance to the function call
*/
// @ts-ignore Function lacks ending return statement and return type does not include 'undefined'. ts(2366)
// eslint-disable-next-line @typescript-eslint/no-explicit-any
Hub.prototype._callExtensionMethod = function (method) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
var carrier = getMainCarrier();
var sentry = carrier.__SENTRY__;
if (sentry && sentry.extensions && typeof sentry.extensions[method] === 'function') {
return sentry.extensions[method].apply(this, args);
}
flags_1.IS_DEBUG_BUILD && utils_1.logger.warn("Extension method " + method + " couldn't be found, doing nothing.");
};
return Hub;
}());
exports.Hub = Hub;
/**
* Returns the global shim registry.
*
* FIXME: This function is problematic, because despite always returning a valid Carrier,
* it has an optional `__SENTRY__` property, which then in turn requires us to always perform an unnecessary check
* at the call-site. We always access the carrier through this function, so we can guarantee that `__SENTRY__` is there.
**/
function getMainCarrier() {
var carrier = utils_1.getGlobalObject();
carrier.__SENTRY__ = carrier.__SENTRY__ || {
extensions: {},
hub: undefined,
};
return carrier;
}
exports.getMainCarrier = getMainCarrier;
/**
* Replaces the current main hub with the passed one on the global object
*
* @returns The old replaced hub
*/
function makeMain(hub) {
var registry = getMainCarrier();
var oldHub = getHubFromCarrier(registry);
setHubOnCarrier(registry, hub);
return oldHub;
}
exports.makeMain = makeMain;
/**
* Returns the default hub instance.
*
* If a hub is already registered in the global carrier but this module
* contains a more recent version, it replaces the registered version.
* Otherwise, the currently registered hub will be returned.
*/
function getCurrentHub() {
// Get main carrier (global for every environment)
var registry = getMainCarrier();
// If there's no hub, or its an old API, assign a new one
if (!hasHubOnCarrier(registry) || getHubFromCarrier(registry).isOlderThan(exports.API_VERSION)) {
setHubOnCarrier(registry, new Hub());
}
// Prefer domains over global if they are there (applicable only to Node environment)
if (utils_1.isNodeEnv()) {
return getHubFromActiveDomain(registry);
}
// Return hub that lives on a global object
return getHubFromCarrier(registry);
}
exports.getCurrentHub = getCurrentHub;
/**
* Returns the active domain, if one exists
* @deprecated No longer used; remove in v7
* @returns The domain, or undefined if there is no active domain
*/
// eslint-disable-next-line deprecation/deprecation
function getActiveDomain() {
flags_1.IS_DEBUG_BUILD && utils_1.logger.warn('Function `getActiveDomain` is deprecated and will be removed in a future version.');
var sentry = getMainCarrier().__SENTRY__;
return sentry && sentry.extensions && sentry.extensions.domain && sentry.extensions.domain.active;
}
exports.getActiveDomain = getActiveDomain;
/**
* Try to read the hub from an active domain, and fallback to the registry if one doesn't exist
* @returns discovered hub
*/
function getHubFromActiveDomain(registry) {
try {
var sentry = getMainCarrier().__SENTRY__;
var activeDomain = sentry && sentry.extensions && sentry.extensions.domain && sentry.extensions.domain.active;
// If there's no active domain, just return global hub
if (!activeDomain) {
return getHubFromCarrier(registry);
}
// If there's no hub on current domain, or it's an old API, assign a new one
if (!hasHubOnCarrier(activeDomain) || getHubFromCarrier(activeDomain).isOlderThan(exports.API_VERSION)) {
var registryHubTopStack = getHubFromCarrier(registry).getStackTop();
setHubOnCarrier(activeDomain, new Hub(registryHubTopStack.client, scope_1.Scope.clone(registryHubTopStack.scope)));
}
// Return hub that lives on a domain
return getHubFromCarrier(activeDomain);
}
catch (_Oo) {
// Return hub that lives on a global object
return getHubFromCarrier(registry);
}
}
/**
* This will tell whether a carrier has a hub on it or not
* @param carrier object
*/
function hasHubOnCarrier(carrier) {
return !!(carrier && carrier.__SENTRY__ && carrier.__SENTRY__.hub);
}
/**
* This will create a new {@link Hub} and add to the passed object on
* __SENTRY__.hub.
* @param carrier object
* @hidden
*/
function getHubFromCarrier(carrier) {
return utils_1.getGlobalSingleton('hub', function () { return new Hub(); }, carrier);
}
exports.getHubFromCarrier = getHubFromCarrier;
/**
* This will set passed {@link Hub} on the passed object's __SENTRY__.hub attribute
* @param carrier object
* @param hub Hub
* @returns A boolean indicating success or failure
*/
function setHubOnCarrier(carrier, hub) {
if (!carrier)
return false;
var __SENTRY__ = (carrier.__SENTRY__ = carrier.__SENTRY__ || {});
__SENTRY__.hub = hub;
return true;
}
exports.setHubOnCarrier = setHubOnCarrier;
//# sourceMappingURL=hub.js.map

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

File diff suppressed because one or more lines are too long

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

@@ -0,0 +1,5 @@
export { addGlobalEventProcessor, Scope } from './scope';
export { Session } from './session';
export { SessionFlusher } from './sessionflusher';
export { getActiveDomain, getCurrentHub, getHubFromCarrier, getMainCarrier, Hub, makeMain, setHubOnCarrier, Carrier, DomainAsCarrier, Layer, } from './hub';
//# sourceMappingURL=index.d.ts.map

1
node_modules/@sentry/hub/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,EAAE,uBAAuB,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAEL,eAAe,EACf,aAAa,EACb,iBAAiB,EACjB,cAAc,EACd,GAAG,EACH,QAAQ,EACR,eAAe,EACf,OAAO,EAEP,eAAe,EACf,KAAK,GACN,MAAM,OAAO,CAAC"}

18
node_modules/@sentry/hub/dist/index.js generated vendored Normal file
View File

@@ -0,0 +1,18 @@
Object.defineProperty(exports, "__esModule", { value: true });
var scope_1 = require("./scope");
exports.addGlobalEventProcessor = scope_1.addGlobalEventProcessor;
exports.Scope = scope_1.Scope;
var session_1 = require("./session");
exports.Session = session_1.Session;
var sessionflusher_1 = require("./sessionflusher");
exports.SessionFlusher = sessionflusher_1.SessionFlusher;
var hub_1 = require("./hub");
// eslint-disable-next-line deprecation/deprecation
exports.getActiveDomain = hub_1.getActiveDomain;
exports.getCurrentHub = hub_1.getCurrentHub;
exports.getHubFromCarrier = hub_1.getHubFromCarrier;
exports.getMainCarrier = hub_1.getMainCarrier;
exports.Hub = hub_1.Hub;
exports.makeMain = hub_1.makeMain;
exports.setHubOnCarrier = hub_1.setHubOnCarrier;
//# sourceMappingURL=index.js.map

1
node_modules/@sentry/hub/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,iCAAyD;AAAhD,0CAAA,uBAAuB,CAAA;AAAE,wBAAA,KAAK,CAAA;AACvC,qCAAoC;AAA3B,4BAAA,OAAO,CAAA;AAChB,mDAAkD;AAAzC,0CAAA,cAAc,CAAA;AACvB,6BAae;AAZb,mDAAmD;AACnD,gCAAA,eAAe,CAAA;AACf,8BAAA,aAAa,CAAA;AACb,kCAAA,iBAAiB,CAAA;AACjB,+BAAA,cAAc,CAAA;AACd,oBAAA,GAAG,CAAA;AACH,yBAAA,QAAQ,CAAA;AACR,gCAAA,eAAe,CAAA","sourcesContent":["export { addGlobalEventProcessor, Scope } from './scope';\nexport { Session } from './session';\nexport { SessionFlusher } from './sessionflusher';\nexport {\n // eslint-disable-next-line deprecation/deprecation\n getActiveDomain,\n getCurrentHub,\n getHubFromCarrier,\n getMainCarrier,\n Hub,\n makeMain,\n setHubOnCarrier,\n Carrier,\n // eslint-disable-next-line deprecation/deprecation\n DomainAsCarrier,\n Layer,\n} from './hub';\n"]}

184
node_modules/@sentry/hub/dist/scope.d.ts generated vendored Normal file
View File

@@ -0,0 +1,184 @@
import { Breadcrumb, CaptureContext, Context, Contexts, Event, EventHint, EventProcessor, Extra, Extras, Primitive, RequestSession, Scope as ScopeInterface, Severity, Span, Transaction, User } from '@sentry/types';
import { Session } from './session';
/**
* Holds additional event information. {@link Scope.applyToEvent} will be
* called by the client before an event will be sent.
*/
export declare class Scope implements ScopeInterface {
/** Flag if notifying is happening. */
protected _notifyingListeners: boolean;
/** Callback for client to receive scope changes. */
protected _scopeListeners: Array<(scope: Scope) => void>;
/** Callback list that will be called after {@link applyToEvent}. */
protected _eventProcessors: EventProcessor[];
/** Array of breadcrumbs. */
protected _breadcrumbs: Breadcrumb[];
/** User */
protected _user: User;
/** Tags */
protected _tags: {
[key: string]: Primitive;
};
/** Extra */
protected _extra: Extras;
/** Contexts */
protected _contexts: Contexts;
/** Fingerprint */
protected _fingerprint?: string[];
/** Severity */
protected _level?: Severity;
/** Transaction Name */
protected _transactionName?: string;
/** Span */
protected _span?: Span;
/** Session */
protected _session?: Session;
/** Request Mode Session Status */
protected _requestSession?: RequestSession;
/**
* A place to stash data which is needed at some point in the SDK's event processing pipeline but which shouldn't get
* sent to Sentry
*/
protected _sdkProcessingMetadata?: {
[key: string]: unknown;
};
/**
* Inherit values from the parent scope.
* @param scope to clone.
*/
static clone(scope?: Scope): Scope;
/**
* Add internal on change listener. Used for sub SDKs that need to store the scope.
* @hidden
*/
addScopeListener(callback: (scope: Scope) => void): void;
/**
* @inheritDoc
*/
addEventProcessor(callback: EventProcessor): this;
/**
* @inheritDoc
*/
setUser(user: User | null): this;
/**
* @inheritDoc
*/
getUser(): User | undefined;
/**
* @inheritDoc
*/
getRequestSession(): RequestSession | undefined;
/**
* @inheritDoc
*/
setRequestSession(requestSession?: RequestSession): this;
/**
* @inheritDoc
*/
setTags(tags: {
[key: string]: Primitive;
}): this;
/**
* @inheritDoc
*/
setTag(key: string, value: Primitive): this;
/**
* @inheritDoc
*/
setExtras(extras: Extras): this;
/**
* @inheritDoc
*/
setExtra(key: string, extra: Extra): this;
/**
* @inheritDoc
*/
setFingerprint(fingerprint: string[]): this;
/**
* @inheritDoc
*/
setLevel(level: Severity): this;
/**
* @inheritDoc
*/
setTransactionName(name?: string): this;
/**
* Can be removed in major version.
* @deprecated in favor of {@link this.setTransactionName}
*/
setTransaction(name?: string): this;
/**
* @inheritDoc
*/
setContext(key: string, context: Context | null): this;
/**
* @inheritDoc
*/
setSpan(span?: Span): this;
/**
* @inheritDoc
*/
getSpan(): Span | undefined;
/**
* @inheritDoc
*/
getTransaction(): Transaction | undefined;
/**
* @inheritDoc
*/
setSession(session?: Session): this;
/**
* @inheritDoc
*/
getSession(): Session | undefined;
/**
* @inheritDoc
*/
update(captureContext?: CaptureContext): this;
/**
* @inheritDoc
*/
clear(): this;
/**
* @inheritDoc
*/
addBreadcrumb(breadcrumb: Breadcrumb, maxBreadcrumbs?: number): this;
/**
* @inheritDoc
*/
clearBreadcrumbs(): this;
/**
* Applies the current context and fingerprint to the event.
* Note that breadcrumbs will be added by the client.
* Also if the event has already breadcrumbs on it, we do not merge them.
* @param event Event
* @param hint May contain additional information about the original exception.
* @hidden
*/
applyToEvent(event: Event, hint?: EventHint): PromiseLike<Event | null>;
/**
* Add data which will be accessible during event processing but won't get sent to Sentry
*/
setSDKProcessingMetadata(newData: {
[key: string]: unknown;
}): this;
/**
* This will be called after {@link applyToEvent} is finished.
*/
protected _notifyEventProcessors(processors: EventProcessor[], event: Event | null, hint?: EventHint, index?: number): PromiseLike<Event | null>;
/**
* This will be called on every set call.
*/
protected _notifyScopeListeners(): void;
/**
* Applies fingerprint from the scope to the event if there's one,
* uses message if there's one instead or get rid of empty fingerprint
*/
private _applyFingerprint;
}
/**
* Add a EventProcessor to be kept globally.
* @param callback EventProcessor to add
*/
export declare function addGlobalEventProcessor(callback: EventProcessor): void;
//# sourceMappingURL=scope.d.ts.map

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

@@ -0,0 +1 @@
{"version":3,"file":"scope.d.ts","sourceRoot":"","sources":["../../src/scope.ts"],"names":[],"mappings":"AACA,OAAO,EACL,UAAU,EACV,cAAc,EACd,OAAO,EACP,QAAQ,EACR,KAAK,EACL,SAAS,EACT,cAAc,EACd,KAAK,EACL,MAAM,EACN,SAAS,EACT,cAAc,EACd,KAAK,IAAI,cAAc,EAEvB,QAAQ,EACR,IAAI,EACJ,WAAW,EACX,IAAI,EACL,MAAM,eAAe,CAAC;AAGvB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAQpC;;;GAGG;AACH,qBAAa,KAAM,YAAW,cAAc;IAC1C,sCAAsC;IACtC,SAAS,CAAC,mBAAmB,EAAE,OAAO,CAAS;IAE/C,oDAAoD;IACpD,SAAS,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC,CAAM;IAE9D,oEAAo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ACI,aAAa,CAAC,UAAU,EAAE,UAAU,EAAE,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI;IAkB3E;;OAEG;IACI,gBAAgB,IAAI,IAAI;IAM/B;;;;;;;OAOG;IACI,YAAY,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,SAAS,GAAG,WAAW,CAAC,KAAK,GAAG,IAAI,CAAC;IAwC9E;;OAEG;IACI,wBAAwB,CAAC,OAAO,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,GAAG,IAAI;IAM1E;;OAEG;IACH,SAAS,CAAC,sBAAsB,CAC9B,UAAU,EAAE,cAAc,EAAE,EAC5B,KAAK,EAAE,KAAK,GAAG,IAAI,EACnB,IAAI,CAAC,EAAE,SAAS,EAChB,KAAK,GAAE,MAAU,GAChB,WAAW,CAAC,KAAK,GAAG,IAAI,CAAC;IAoB5B;;OAEG;IACH,SAAS,CAAC,qBAAqB,IAAI,IAAI;IAavC;;;OAGG;IACH,OAAO,CAAC,iBAAiB;CAkB1B;AASD;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI,CAEtE"}

443
node_modules/@sentry/hub/dist/scope.js generated vendored Normal file
View File

@@ -0,0 +1,443 @@
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var utils_1 = require("@sentry/utils");
/**
* Absolute maximum number of breadcrumbs added to an event.
* The `maxBreadcrumbs` option cannot be higher than this value.
*/
var MAX_BREADCRUMBS = 100;
/**
* Holds additional event information. {@link Scope.applyToEvent} will be
* called by the client before an event will be sent.
*/
var Scope = /** @class */ (function () {
function Scope() {
/** Flag if notifying is happening. */
this._notifyingListeners = false;
/** Callback for client to receive scope changes. */
this._scopeListeners = [];
/** Callback list that will be called after {@link applyToEvent}. */
this._eventProcessors = [];
/** Array of breadcrumbs. */
this._breadcrumbs = [];
/** User */
this._user = {};
/** Tags */
this._tags = {};
/** Extra */
this._extra = {};
/** Contexts */
this._contexts = {};
/**
* A place to stash data which is needed at some point in the SDK's event processing pipeline but which shouldn't get
* sent to Sentry
*/
this._sdkProcessingMetadata = {};
}
/**
* Inherit values from the parent scope.
* @param scope to clone.
*/
Scope.clone = function (scope) {
var newScope = new Scope();
if (scope) {
newScope._breadcrumbs = tslib_1.__spread(scope._breadcrumbs);
newScope._tags = tslib_1.__assign({}, scope._tags);
newScope._extra = tslib_1.__assign({}, scope._extra);
newScope._contexts = tslib_1.__assign({}, scope._contexts);
newScope._user = scope._user;
newScope._level = scope._level;
newScope._span = scope._span;
newScope._session = scope._session;
newScope._transactionName = scope._transactionName;
newScope._fingerprint = scope._fingerprint;
newScope._eventProcessors = tslib_1.__spread(scope._eventProcessors);
newScope._requestSession = scope._requestSession;
}
return newScope;
};
/**
* Add internal on change listener. Used for sub SDKs that need to store the scope.
* @hidden
*/
Scope.prototype.addScopeListener = function (callback) {
this._scopeListeners.push(callback);
};
/**
* @inheritDoc
*/
Scope.prototype.addEventProcessor = function (callback) {
this._eventProcessors.push(callback);
return this;
};
/**
* @inheritDoc
*/
Scope.prototype.setUser = function (user) {
this._user = user || {};
if (this._session) {
this._session.update({ user: user });
}
this._notifyScopeListeners();
return this;
};
/**
* @inheritDoc
*/
Scope.prototype.getUser = function () {
return this._user;
};
/**
* @inheritDoc
*/
Scope.prototype.getRequestSession = function () {
return this._requestSession;
};
/**
* @inheritDoc
*/
Scope.prototype.setRequestSession = function (requestSession) {
this._requestSession = requestSession;
return this;
};
/**
* @inheritDoc
*/
Scope.prototype.setTags = function (tags) {
this._tags = tslib_1.__assign(tslib_1.__assign({}, this._tags), tags);
this._notifyScopeListeners();
return this;
};
/**
* @inheritDoc
*/
Scope.prototype.setTag = function (key, value) {
var _a;
this._tags = tslib_1.__assign(tslib_1.__assign({}, this._tags), (_a = {}, _a[key] = value, _a));
this._notifyScopeListeners();
return this;
};
/**
* @inheritDoc
*/
Scope.prototype.setExtras = function (extras) {
this._extra = tslib_1.__assign(tslib_1.__assign({}, this._extra), extras);
this._notifyScopeListeners();
return this;
};
/**
* @inheritDoc
*/
Scope.prototype.setExtra = function (key, extra) {
var _a;
this._extra = tslib_1.__assign(tslib_1.__assign({}, this._extra), (_a = {}, _a[key] = extra, _a));
this._notifyScopeListeners();
return this;
};
/**
* @inheritDoc
*/
Scope.prototype.setFingerprint = function (fingerprint) {
this._fingerprint = fingerprint;
this._notifyScopeListeners();
return this;
};
/**
* @inheritDoc
*/
Scope.prototype.setLevel = function (level) {
this._level = level;
this._notifyScopeListeners();
return this;
};
/**
* @inheritDoc
*/
Scope.prototype.setTransactionName = function (name) {
this._transactionName = name;
this._notifyScopeListeners();
return this;
};
/**
* Can be removed in major version.
* @deprecated in favor of {@link this.setTransactionName}
*/
Scope.prototype.setTransaction = function (name) {
return this.setTransactionName(name);
};
/**
* @inheritDoc
*/
Scope.prototype.setContext = function (key, context) {
var _a;
if (context === null) {
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
delete this._contexts[key];
}
else {
this._contexts = tslib_1.__assign(tslib_1.__assign({}, this._contexts), (_a = {}, _a[key] = context, _a));
}
this._notifyScopeListeners();
return this;
};
/**
* @inheritDoc
*/
Scope.prototype.setSpan = function (span) {
this._span = span;
this._notifyScopeListeners();
return this;
};
/**
* @inheritDoc
*/
Scope.prototype.getSpan = function () {
return this._span;
};
/**
* @inheritDoc
*/
Scope.prototype.getTransaction = function () {
// Often, this span (if it exists at all) will be a transaction, but it's not guaranteed to be. Regardless, it will
// have a pointer to the currently-active transaction.
var span = this.getSpan();
return span && span.transaction;
};
/**
* @inheritDoc
*/
Scope.prototype.setSession = function (session) {
if (!session) {
delete this._session;
}
else {
this._session = session;
}
this._notifyScopeListeners();
return this;
};
/**
* @inheritDoc
*/
Scope.prototype.getSession = function () {
return this._session;
};
/**
* @inheritDoc
*/
Scope.prototype.update = function (captureContext) {
if (!captureContext) {
return this;
}
if (typeof captureContext === 'function') {
var updatedScope = captureContext(this);
return updatedScope instanceof Scope ? updatedScope : this;
}
if (captureContext instanceof Scope) {
this._tags = tslib_1.__assign(tslib_1.__assign({}, this._tags), captureContext._tags);
this._extra = tslib_1.__assign(tslib_1.__assign({}, this._extra), captureContext._extra);
this._contexts = tslib_1.__assign(tslib_1.__assign({}, this._contexts), captureContext._contexts);
if (captureContext._user && Object.keys(captureContext._user).length) {
this._user = captureContext._user;
}
if (captureContext._level) {
this._level = captureContext._level;
}
if (captureContext._fingerprint) {
this._fingerprint = captureContext._fingerprint;
}
if (captureContext._requestSession) {
this._requestSession = captureContext._requestSession;
}
}
else if (utils_1.isPlainObject(captureContext)) {
// eslint-disable-next-line no-param-reassign
captureContext = captureContext;
this._tags = tslib_1.__assign(tslib_1.__assign({}, this._tags), captureContext.tags);
this._extra = tslib_1.__assign(tslib_1.__assign({}, this._extra), captureContext.extra);
this._contexts = tslib_1.__assign(tslib_1.__assign({}, this._contexts), captureContext.contexts);
if (captureContext.user) {
this._user = captureContext.user;
}
if (captureContext.level) {
this._level = captureContext.level;
}
if (captureContext.fingerprint) {
this._fingerprint = captureContext.fingerprint;
}
if (captureContext.requestSession) {
this._requestSession = captureContext.requestSession;
}
}
return this;
};
/**
* @inheritDoc
*/
Scope.prototype.clear = function () {
this._breadcrumbs = [];
this._tags = {};
this._extra = {};
this._user = {};
this._contexts = {};
this._level = undefined;
this._transactionName = undefined;
this._fingerprint = undefined;
this._requestSession = undefined;
this._span = undefined;
this._session = undefined;
this._notifyScopeListeners();
return this;
};
/**
* @inheritDoc
*/
Scope.prototype.addBreadcrumb = function (breadcrumb, maxBreadcrumbs) {
var maxCrumbs = typeof maxBreadcrumbs === 'number' ? Math.min(maxBreadcrumbs, MAX_BREADCRUMBS) : MAX_BREADCRUMBS;
// No data has been changed, so don't notify scope listeners
if (maxCrumbs <= 0) {
return this;
}
var mergedBreadcrumb = tslib_1.__assign({ timestamp: utils_1.dateTimestampInSeconds() }, breadcrumb);
this._breadcrumbs = tslib_1.__spread(this._breadcrumbs, [mergedBreadcrumb]).slice(-maxCrumbs);
this._notifyScopeListeners();
return this;
};
/**
* @inheritDoc
*/
Scope.prototype.clearBreadcrumbs = function () {
this._breadcrumbs = [];
this._notifyScopeListeners();
return this;
};
/**
* Applies the current context and fingerprint to the event.
* Note that breadcrumbs will be added by the client.
* Also if the event has already breadcrumbs on it, we do not merge them.
* @param event Event
* @param hint May contain additional information about the original exception.
* @hidden
*/
Scope.prototype.applyToEvent = function (event, hint) {
if (this._extra && Object.keys(this._extra).length) {
event.extra = tslib_1.__assign(tslib_1.__assign({}, this._extra), event.extra);
}
if (this._tags && Object.keys(this._tags).length) {
event.tags = tslib_1.__assign(tslib_1.__assign({}, this._tags), event.tags);
}
if (this._user && Object.keys(this._user).length) {
event.user = tslib_1.__assign(tslib_1.__assign({}, this._user), event.user);
}
if (this._contexts && Object.keys(this._contexts).length) {
event.contexts = tslib_1.__assign(tslib_1.__assign({}, this._contexts), event.contexts);
}
if (this._level) {
event.level = this._level;
}
if (this._transactionName) {
event.transaction = this._transactionName;
}
// We want to set the trace context for normal events only if there isn't already
// a trace context on the event. There is a product feature in place where we link
// errors with transaction and it relies on that.
if (this._span) {
event.contexts = tslib_1.__assign({ trace: this._span.getTraceContext() }, event.contexts);
var transactionName = this._span.transaction && this._span.transaction.name;
if (transactionName) {
event.tags = tslib_1.__assign({ transaction: transactionName }, event.tags);
}
}
this._applyFingerprint(event);
event.breadcrumbs = tslib_1.__spread((event.breadcrumbs || []), this._breadcrumbs);
event.breadcrumbs = event.breadcrumbs.length > 0 ? event.breadcrumbs : undefined;
event.sdkProcessingMetadata = this._sdkProcessingMetadata;
return this._notifyEventProcessors(tslib_1.__spread(getGlobalEventProcessors(), this._eventProcessors), event, hint);
};
/**
* Add data which will be accessible during event processing but won't get sent to Sentry
*/
Scope.prototype.setSDKProcessingMetadata = function (newData) {
this._sdkProcessingMetadata = tslib_1.__assign(tslib_1.__assign({}, this._sdkProcessingMetadata), newData);
return this;
};
/**
* This will be called after {@link applyToEvent} is finished.
*/
Scope.prototype._notifyEventProcessors = function (processors, event, hint, index) {
var _this = this;
if (index === void 0) { index = 0; }
return new utils_1.SyncPromise(function (resolve, reject) {
var processor = processors[index];
if (event === null || typeof processor !== 'function') {
resolve(event);
}
else {
var result = processor(tslib_1.__assign({}, event), hint);
if (utils_1.isThenable(result)) {
void result
.then(function (final) { return _this._notifyEventProcessors(processors, final, hint, index + 1).then(resolve); })
.then(null, reject);
}
else {
void _this._notifyEventProcessors(processors, result, hint, index + 1)
.then(resolve)
.then(null, reject);
}
}
});
};
/**
* This will be called on every set call.
*/
Scope.prototype._notifyScopeListeners = function () {
var _this = this;
// We need this check for this._notifyingListeners to be able to work on scope during updates
// If this check is not here we'll produce endless recursion when something is done with the scope
// during the callback.
if (!this._notifyingListeners) {
this._notifyingListeners = true;
this._scopeListeners.forEach(function (callback) {
callback(_this);
});
this._notifyingListeners = false;
}
};
/**
* Applies fingerprint from the scope to the event if there's one,
* uses message if there's one instead or get rid of empty fingerprint
*/
Scope.prototype._applyFingerprint = function (event) {
// Make sure it's an array first and we actually have something in place
event.fingerprint = event.fingerprint
? Array.isArray(event.fingerprint)
? event.fingerprint
: [event.fingerprint]
: [];
// If we have something on the scope, then merge it with event
if (this._fingerprint) {
event.fingerprint = event.fingerprint.concat(this._fingerprint);
}
// If we have no data at all, remove empty array default
if (event.fingerprint && !event.fingerprint.length) {
delete event.fingerprint;
}
};
return Scope;
}());
exports.Scope = Scope;
/**
* Returns the global event processors.
*/
function getGlobalEventProcessors() {
return utils_1.getGlobalSingleton('globalEventProcessors', function () { return []; });
}
/**
* Add a EventProcessor to be kept globally.
* @param callback EventProcessor to add
*/
function addGlobalEventProcessor(callback) {
getGlobalEventProcessors().push(callback);
}
exports.addGlobalEventProcessor = addGlobalEventProcessor;
//# sourceMappingURL=scope.js.map

1
node_modules/@sentry/hub/dist/scope.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

42
node_modules/@sentry/hub/dist/session.d.ts generated vendored Normal file
View File

@@ -0,0 +1,42 @@
import { Session as SessionInterface, SessionContext, SessionStatus } from '@sentry/types';
/**
* @inheritdoc
*/
export declare class Session implements SessionInterface {
userAgent?: string;
errors: number;
release?: string;
sid: string;
did?: string;
timestamp: number;
started: number;
duration?: number;
status: SessionStatus;
environment?: string;
ipAddress?: string;
init: boolean;
ignoreDuration: boolean;
constructor(context?: Omit<SessionContext, 'started' | 'status'>);
/** JSDoc */
update(context?: SessionContext): void;
/** JSDoc */
close(status?: Exclude<SessionStatus, 'ok'>): void;
/** JSDoc */
toJSON(): {
init: boolean;
sid: string;
did?: string;
timestamp: string;
started: string;
duration?: number;
status: SessionStatus;
errors: number;
attrs?: {
release?: string;
environment?: string;
user_agent?: string;
ip_address?: string;
};
};
}
//# sourceMappingURL=session.d.ts.map

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

@@ -0,0 +1 @@
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAG3F;;GAEG;AACH,qBAAa,OAAQ,YAAW,gBAAgB;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAK;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,CAAW;IACtB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAK;IACtB,MAAM,EAAE,aAAa,CAAQ;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,OAAO,CAAQ;IACrB,cAAc,EAAE,OAAO,CAAS;gBAEpB,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,EAAE,SAAS,GAAG,QAAQ,CAAC;IAUvE,YAAY;IAEL,MAAM,CAAC,OAAO,GAAE,cAAmB,GAAG,IAAI;IAwDjD,YAAY;IACL,KAAK,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,aAAa,EAAE,IAAI,CAAC,GAAG,IAAI;IAUzD,YAAY;IACL,MAAM,IAAI;QACf,IAAI,EAAE,OAAO,CAAC;QACd,GAAG,EAAE,MAAM,CAAC;QACZ,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC;QAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,MAAM,EAAE,aAAa,CAAC;QACtB,MAAM,EAAE,MAAM,CAAC;QACf,KAAK,CAAC,EAAE;YACN,OAAO,CAAC,EAAE,MAAM,CAAC;YACjB,WAAW,CAAC,EAAE,MAAM,CAAC;YACrB,UAAU,CAAC,EAAE,MAAM,CAAC;YACpB,UAAU,CAAC,EAAE,MAAM,CAAC;SACrB,CAAC;KACH;CAmBF"}

115
node_modules/@sentry/hub/dist/session.js generated vendored Normal file
View File

@@ -0,0 +1,115 @@
Object.defineProperty(exports, "__esModule", { value: true });
var utils_1 = require("@sentry/utils");
/**
* @inheritdoc
*/
var Session = /** @class */ (function () {
function Session(context) {
this.errors = 0;
this.sid = utils_1.uuid4();
this.duration = 0;
this.status = 'ok';
this.init = true;
this.ignoreDuration = false;
// Both timestamp and started are in seconds since the UNIX epoch.
var startingTime = utils_1.timestampInSeconds();
this.timestamp = startingTime;
this.started = startingTime;
if (context) {
this.update(context);
}
}
/** JSDoc */
// eslint-disable-next-line complexity
Session.prototype.update = function (context) {
if (context === void 0) { context = {}; }
if (context.user) {
if (!this.ipAddress && context.user.ip_address) {
this.ipAddress = context.user.ip_address;
}
if (!this.did && !context.did) {
this.did = context.user.id || context.user.email || context.user.username;
}
}
this.timestamp = context.timestamp || utils_1.timestampInSeconds();
if (context.ignoreDuration) {
this.ignoreDuration = context.ignoreDuration;
}
if (context.sid) {
// Good enough uuid validation. — Kamil
this.sid = context.sid.length === 32 ? context.sid : utils_1.uuid4();
}
if (context.init !== undefined) {
this.init = context.init;
}
if (!this.did && context.did) {
this.did = "" + context.did;
}
if (typeof context.started === 'number') {
this.started = context.started;
}
if (this.ignoreDuration) {
this.duration = undefined;
}
else if (typeof context.duration === 'number') {
this.duration = context.duration;
}
else {
var duration = this.timestamp - this.started;
this.duration = duration >= 0 ? duration : 0;
}
if (context.release) {
this.release = context.release;
}
if (context.environment) {
this.environment = context.environment;
}
if (!this.ipAddress && context.ipAddress) {
this.ipAddress = context.ipAddress;
}
if (!this.userAgent && context.userAgent) {
this.userAgent = context.userAgent;
}
if (typeof context.errors === 'number') {
this.errors = context.errors;
}
if (context.status) {
this.status = context.status;
}
};
/** JSDoc */
Session.prototype.close = function (status) {
if (status) {
this.update({ status: status });
}
else if (this.status === 'ok') {
this.update({ status: 'exited' });
}
else {
this.update();
}
};
/** JSDoc */
Session.prototype.toJSON = function () {
return utils_1.dropUndefinedKeys({
sid: "" + this.sid,
init: this.init,
// Make sure that sec is converted to ms for date constructor
started: new Date(this.started * 1000).toISOString(),
timestamp: new Date(this.timestamp * 1000).toISOString(),
status: this.status,
errors: this.errors,
did: typeof this.did === 'number' || typeof this.did === 'string' ? "" + this.did : undefined,
duration: this.duration,
attrs: {
release: this.release,
environment: this.environment,
ip_address: this.ipAddress,
user_agent: this.userAgent,
},
});
};
return Session;
}());
exports.Session = Session;
//# sourceMappingURL=session.js.map

1
node_modules/@sentry/hub/dist/session.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

38
node_modules/@sentry/hub/dist/sessionflusher.d.ts generated vendored Normal file
View File

@@ -0,0 +1,38 @@
import { SessionAggregates, SessionFlusherLike, Transport } from '@sentry/types';
declare type ReleaseHealthAttributes = {
environment?: string;
release: string;
};
/**
* @inheritdoc
*/
export declare class SessionFlusher implements SessionFlusherLike {
readonly flushTimeout: number;
private _pendingAggregates;
private _sessionAttrs;
private _intervalId;
private _isEnabled;
private _transport;
constructor(transport: Transport, attrs: ReleaseHealthAttributes);
/** Sends session aggregates to Transport */
sendSessionAggregates(sessionAggregates: SessionAggregates): void;
/** Checks if `pendingAggregates` has entries, and if it does flushes them by calling `sendSessions` */
flush(): void;
/** Massages the entries in `pendingAggregates` and returns aggregated sessions */
getSessionAggregates(): SessionAggregates;
/** JSDoc */
close(): void;
/**
* Wrapper function for _incrementSessionStatusCount that checks if the instance of SessionFlusher is enabled then
* fetches the session status of the request from `Scope.getRequestSession().status` on the scope and passes them to
* `_incrementSessionStatusCount` along with the start date
*/
incrementSessionStatusCount(): void;
/**
* Increments status bucket in pendingAggregates buffer (internal state) corresponding to status of
* the session received
*/
private _incrementSessionStatusCount;
}
export {};
//# sourceMappingURL=sessionflusher.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"sessionflusher.d.ts","sourceRoot":"","sources":["../../src/sessionflusher.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,iBAAiB,EACjB,kBAAkB,EAClB,SAAS,EACV,MAAM,eAAe,CAAC;AAMvB,aAAK,uBAAuB,GAAG;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;GAEG;AACH,qBAAa,cAAe,YAAW,kBAAkB;IACvD,SAAgB,YAAY,EAAE,MAAM,CAAM;IAC1C,OAAO,CAAC,kBAAkB,CAAyC;IACnE,OAAO,CAAC,aAAa,CAA0B;IAC/C,OAAO,CAAC,WAAW,CAAiC;IACpD,OAAO,CAAC,UAAU,CAAiB;IACnC,OAAO,CAAC,UAAU,CAAY;gBAEX,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,uBAAuB;IAOvE,4CAA4C;IACrC,qBAAqB,CAAC,iBAAiB,EAAE,iBAAiB,GAAG,IAAI;IAUxE,uGAAuG;IAChG,KAAK,IAAI,IAAI;IASpB,kFAAkF;IAC3E,oBAAoB,IAAI,iBAAiB;IAYhD,YAAY;IACL,KAAK,IAAI,IAAI;IAMpB;;;;OAIG;IACI,2BAA2B,IAAI,IAAI;IAkB1C;;;OAGG;IACH,OAAO,CAAC,4BAA4B;CAwBrC"}

106
node_modules/@sentry/hub/dist/sessionflusher.js generated vendored Normal file
View File

@@ -0,0 +1,106 @@
Object.defineProperty(exports, "__esModule", { value: true });
var utils_1 = require("@sentry/utils");
var flags_1 = require("./flags");
var hub_1 = require("./hub");
/**
* @inheritdoc
*/
var SessionFlusher = /** @class */ (function () {
function SessionFlusher(transport, attrs) {
var _this = this;
this.flushTimeout = 60;
this._pendingAggregates = {};
this._isEnabled = true;
this._transport = transport;
// Call to setInterval, so that flush is called every 60 seconds
this._intervalId = setInterval(function () { return _this.flush(); }, this.flushTimeout * 1000);
this._sessionAttrs = attrs;
}
/** Sends session aggregates to Transport */
SessionFlusher.prototype.sendSessionAggregates = function (sessionAggregates) {
if (!this._transport.sendSession) {
flags_1.IS_DEBUG_BUILD && utils_1.logger.warn("Dropping session because custom transport doesn't implement sendSession");
return;
}
void this._transport.sendSession(sessionAggregates).then(null, function (reason) {
flags_1.IS_DEBUG_BUILD && utils_1.logger.error('Error while sending session:', reason);
});
};
/** Checks if `pendingAggregates` has entries, and if it does flushes them by calling `sendSessions` */
SessionFlusher.prototype.flush = function () {
var sessionAggregates = this.getSessionAggregates();
if (sessionAggregates.aggregates.length === 0) {
return;
}
this._pendingAggregates = {};
this.sendSessionAggregates(sessionAggregates);
};
/** Massages the entries in `pendingAggregates` and returns aggregated sessions */
SessionFlusher.prototype.getSessionAggregates = function () {
var _this = this;
var aggregates = Object.keys(this._pendingAggregates).map(function (key) {
return _this._pendingAggregates[parseInt(key)];
});
var sessionAggregates = {
attrs: this._sessionAttrs,
aggregates: aggregates,
};
return utils_1.dropUndefinedKeys(sessionAggregates);
};
/** JSDoc */
SessionFlusher.prototype.close = function () {
clearInterval(this._intervalId);
this._isEnabled = false;
this.flush();
};
/**
* Wrapper function for _incrementSessionStatusCount that checks if the instance of SessionFlusher is enabled then
* fetches the session status of the request from `Scope.getRequestSession().status` on the scope and passes them to
* `_incrementSessionStatusCount` along with the start date
*/
SessionFlusher.prototype.incrementSessionStatusCount = function () {
if (!this._isEnabled) {
return;
}
var scope = hub_1.getCurrentHub().getScope();
var requestSession = scope && scope.getRequestSession();
if (requestSession && requestSession.status) {
this._incrementSessionStatusCount(requestSession.status, new Date());
// This is not entirely necessarily but is added as a safe guard to indicate the bounds of a request and so in
// case captureRequestSession is called more than once to prevent double count
if (scope) {
scope.setRequestSession(undefined);
}
/* eslint-enable @typescript-eslint/no-unsafe-member-access */
}
};
/**
* Increments status bucket in pendingAggregates buffer (internal state) corresponding to status of
* the session received
*/
SessionFlusher.prototype._incrementSessionStatusCount = function (status, date) {
// Truncate minutes and seconds on Session Started attribute to have one minute bucket keys
var sessionStartedTrunc = new Date(date).setSeconds(0, 0);
this._pendingAggregates[sessionStartedTrunc] = this._pendingAggregates[sessionStartedTrunc] || {};
// corresponds to aggregated sessions in one specific minute bucket
// for example, {"started":"2021-03-16T08:00:00.000Z","exited":4, "errored": 1}
var aggregationCounts = this._pendingAggregates[sessionStartedTrunc];
if (!aggregationCounts.started) {
aggregationCounts.started = new Date(sessionStartedTrunc).toISOString();
}
switch (status) {
case 'errored':
aggregationCounts.errored = (aggregationCounts.errored || 0) + 1;
return aggregationCounts.errored;
case 'ok':
aggregationCounts.exited = (aggregationCounts.exited || 0) + 1;
return aggregationCounts.exited;
default:
aggregationCounts.crashed = (aggregationCounts.crashed || 0) + 1;
return aggregationCounts.crashed;
}
};
return SessionFlusher;
}());
exports.SessionFlusher = SessionFlusher;
//# sourceMappingURL=sessionflusher.js.map

1
node_modules/@sentry/hub/dist/sessionflusher.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long