Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /var/www/html/wincloud_gateway/node_modules/strapi-plugin-sentry/node_modules/@sentry/hub/esm/ drwxr-xr-x | |
| Viewing file: Select action/file-type: import { SessionStatus } from '@sentry/types';
import { dropUndefinedKeys, timestampInSeconds, uuid4 } from '@sentry/utils';
/**
* @inheritdoc
*/
var Session = /** @class */ (function () {
function Session(context) {
this.errors = 0;
this.sid = uuid4();
this.duration = 0;
this.status = SessionStatus.Ok;
this.init = true;
this.ignoreDuration = false;
// Both timestamp and started are in seconds since the UNIX epoch.
var startingTime = 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 (context.user.ip_address) {
this.ipAddress = context.user.ip_address;
}
if (!context.did) {
this.did = context.user.id || context.user.email || context.user.username;
}
}
this.timestamp = context.timestamp || timestampInSeconds();
if (context.ignoreDuration) {
this.ignoreDuration = context.ignoreDuration;
}
if (context.sid) {
// Good enough uuid validation. — Kamil
this.sid = context.sid.length === 32 ? context.sid : uuid4();
}
if (context.init !== undefined) {
this.init = context.init;
}
if (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 (context.ipAddress) {
this.ipAddress = context.ipAddress;
}
if (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 === SessionStatus.Ok) {
this.update({ status: SessionStatus.Exited });
}
else {
this.update();
}
};
/** JSDoc */
Session.prototype.toJSON = function () {
return 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: dropUndefinedKeys({
release: this.release,
environment: this.environment,
ip_address: this.ipAddress,
user_agent: this.userAgent,
}),
});
};
return Session;
}());
export { Session };
//# sourceMappingURL=session.js.map |
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0046 ]-- |