Skip to content
Snippets Groups Projects
onDeleteAccount.js 8.09 MiB
Newer Older
  • Learn to ignore specific revisions
  •   const include = {
        ...DEFAULT_INCLUDES,
        ...(0,_buildPolyfills__WEBPACK_IMPORTED_MODULE_3__._optionalChain)([options, 'optionalAccess', _ => _.include]),
      };
    
      if (include.request) {
        const extractedRequestData = Array.isArray(include.request)
          ? extractRequestData(req, { include: include.request, deps: (0,_buildPolyfills__WEBPACK_IMPORTED_MODULE_3__._optionalChain)([options, 'optionalAccess', _2 => _2.deps]) })
          : extractRequestData(req, { deps: (0,_buildPolyfills__WEBPACK_IMPORTED_MODULE_3__._optionalChain)([options, 'optionalAccess', _3 => _3.deps]) });
    
        event.request = {
          ...event.request,
          ...extractedRequestData,
        };
      }
    
      if (include.user) {
        const extractedUser = req.user && (0,_is_js__WEBPACK_IMPORTED_MODULE_1__.isPlainObject)(req.user) ? extractUserData(req.user, include.user) : {};
    
        if (Object.keys(extractedUser).length) {
          event.user = {
            ...event.user,
            ...extractedUser,
          };
        }
      }
    
      // client ip:
      //   node, nextjs: req.socket.remoteAddress
      //   express, koa: req.ip
      if (include.ip) {
        const ip = req.ip || (req.socket && req.socket.remoteAddress);
        if (ip) {
          event.user = {
            ...event.user,
            ip_address: ip,
          };
        }
      }
    
      if (include.transaction && !event.transaction) {
        // TODO do we even need this anymore?
        // TODO make this work for nextjs
        event.transaction = extractTransaction(req, include.transaction);
      }
    
      return event;
    }
    
    function extractQueryParams(
      req,
      deps,
    ) {
      // url (including path and query string):
      //   node, express: req.originalUrl
      //   koa, nextjs: req.url
      let originalUrl = req.originalUrl || req.url || '';
    
      if (!originalUrl) {
        return;
      }
    
      // The `URL` constructor can't handle internal URLs of the form `/some/path/here`, so stick a dummy protocol and
      // hostname on the beginning. Since the point here is just to grab the query string, it doesn't matter what we use.
      if (originalUrl.startsWith('/')) {
        originalUrl = `http://dogs.are.great${originalUrl}`;
      }
    
      return (
        req.query ||
        (typeof URL !== undefined && new URL(originalUrl).search.replace('?', '')) ||
        // In Node 8, `URL` isn't in the global scope, so we have to use the built-in module from Node
        (deps && deps.url && deps.url.parse(originalUrl).query) ||
        undefined
      );
    }
    
    
    //# sourceMappingURL=requestdata.js.map
    
    
    /***/ }),
    
    /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
    
    "use strict";
    __webpack_require__.r(__webpack_exports__);
    /* harmony export */ __webpack_require__.d(__webpack_exports__, {
    /* harmony export */   "getModule": () => (/* binding */ getModule)
    /* harmony export */ });
    
    /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1710);
    
    
    
    /** normalizes Windows paths */
    function normalizePath(path) {
      return path
        .replace(/^[A-Z]:/, '') // remove Windows-style prefix
        .replace(/\\/g, '/'); // replace all `\` instances with `/`
    }
    
    /** Gets the module from a filename */
    function getModule(filename) {
      if (!filename) {
        return;
      }
    
      const normalizedFilename = normalizePath(filename);
    
      // We could use optional chaining here but webpack does like that mixed with require
      const base = normalizePath(
        `${( true && __webpack_require__.c[__webpack_require__.s] && __webpack_require__.c[__webpack_require__.s].filename && (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_0__.dirname)(__webpack_require__.c[__webpack_require__.s].filename)) || global.process.cwd()}/`,
      );
    
      // It's specifically a module
      const file = (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_0__.basename)(normalizedFilename, '.js');
    
      const path = (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_0__.dirname)(normalizedFilename);
      let n = path.lastIndexOf('/node_modules/');
      if (n > -1) {
        // /node_modules/ is 14 chars
        return `${path.substr(n + 14).replace(/\//g, '.')}:${file}`;
      }
      // Let's see if it's a part of the main module
      // To be a part of main module, it has to share the same base
      n = `${path}/`.lastIndexOf(base, 0);
    
      if (n === 0) {
        let moduleName = path.substr(base.length).replace(/\//g, '.');
        if (moduleName) {
          moduleName += ':';
        }
        moduleName += file;
        return moduleName;
      }
      return file;
    }
    
    
    //# sourceMappingURL=module.js.map
    
    
    /***/ }),
    
    /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
    
    "use strict";
    __webpack_require__.r(__webpack_exports__);
    /* harmony export */ __webpack_require__.d(__webpack_exports__, {
    /* harmony export */   "basename": () => (/* binding */ basename),
    /* harmony export */   "dirname": () => (/* binding */ dirname),
    /* harmony export */   "isAbsolute": () => (/* binding */ isAbsolute),
    /* harmony export */   "join": () => (/* binding */ join),
    /* harmony export */   "normalizePath": () => (/* binding */ normalizePath),
    /* harmony export */   "relative": () => (/* binding */ relative),
    /* harmony export */   "resolve": () => (/* binding */ resolve)
    /* harmony export */ });
    // Slightly modified (no IE8 support, ES6) and transcribed to TypeScript
    // https://raw.githubusercontent.com/calvinmetcalf/rollup-plugin-node-builtins/master/src/es6/path.js
    
    /** JSDoc */
    function normalizeArray(parts, allowAboveRoot) {
      // if the path tries to go above the root, `up` ends up > 0
      let up = 0;
      for (let i = parts.length - 1; i >= 0; i--) {
        const last = parts[i];
        if (last === '.') {
          parts.splice(i, 1);
        } else if (last === '..') {
          parts.splice(i, 1);
          up++;
        } else if (up) {
          parts.splice(i, 1);
          up--;
        }
      }
    
      // if the path is allowed to go above the root, restore leading ..s
      if (allowAboveRoot) {
        for (; up--; up) {
          parts.unshift('..');
        }
      }
    
      return parts;
    }
    
    // Split a filename into [root, dir, basename, ext], unix version
    // 'root' is just a slash, or nothing.
    const splitPathRe = /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^/]+?|)(\.[^./]*|))(?:[/]*)$/;
    /** JSDoc */
    function splitPath(filename) {
      const parts = splitPathRe.exec(filename);
      return parts ? parts.slice(1) : [];
    }
    
    // path.resolve([from ...], to)
    // posix version
    /** JSDoc */
    function resolve(...args) {
      let resolvedPath = '';
      let resolvedAbsolute = false;
    
      for (let i = args.length - 1; i >= -1 && !resolvedAbsolute; i--) {
        const path = i >= 0 ? args[i] : '/';
    
        // Skip empty entries
        if (!path) {
          continue;
        }
    
        resolvedPath = `${path}/${resolvedPath}`;
        resolvedAbsolute = path.charAt(0) === '/';
      }
    
      // At this point the path should be resolved to a full absolute path, but
      // handle relative paths to be safe (might happen when process.cwd() fails)
    
      // Normalize the path
      resolvedPath = normalizeArray(
        resolvedPath.split('/').filter(p => !!p),
        !resolvedAbsolute,
      ).join('/');
    
      return (resolvedAbsolute ? '/' : '') + resolvedPath || '.';
    }
    
    /** JSDoc */
    function trim(arr) {
      let start = 0;
      for (; start < arr.length; start++) {
        if (arr[start] !== '') {
          break;
        }
      }
    
      let end = arr.length - 1;
      for (; end >= 0; end--) {
        if (arr[end] !== '') {
          break;
        }
      }
    
      if (start > end) {
        return [];
      }
      return arr.slice(start, end - start + 1);
    }
    
    // path.relative(from, to)
    // posix version
    /** JSDoc */
    function relative(from, to) {
      /* eslint-disable no-param-reassign */
      from = resolve(from).substr(1);
      to = resolve(to).substr(1);
      /* eslint-enable no-param-reassign */
    
      const fromParts = trim(from.split('/'));
      const toParts = trim(to.split('/'));
    
      const length = Math.min(fromParts.length, toParts.length);
      let samePartsLength = length;
      for (let i = 0; i < length; i++) {
        if (fromParts[i] !== toParts[i]) {
          samePartsLength = i;
          break;
        }
      }
    
      let outputParts = [];
      for (let i = samePartsLength; i < fromParts.length; i++) {
        outputParts.push('..');
      }
    
      outputParts = outputParts.concat(toParts.slice(samePartsLength));
    
      return outputParts.join('/');
    }
    
    // path.normalize(path)
    // posix version
    /** JSDoc */
    function normalizePath(path) {
      const isPathAbsolute = isAbsolute(path);
      const trailingSlash = path.substr(-1) === '/';
    
      // Normalize the path
      let normalizedPath = normalizeArray(
        path.split('/').filter(p => !!p),
        !isPathAbsolute,
      ).join('/');
    
      if (!normalizedPath && !isPathAbsolute) {
        normalizedPath = '.';
      }
      if (normalizedPath && trailingSlash) {
        normalizedPath += '/';
      }
    
      return (isPathAbsolute ? '/' : '') + normalizedPath;
    }
    
    // posix version
    /** JSDoc */
    function isAbsolute(path) {
      return path.charAt(0) === '/';
    }
    
    // posix version
    /** JSDoc */
    function join(...args) {
      return normalizePath(args.join('/'));
    }
    
    /** JSDoc */
    function dirname(path) {
      const result = splitPath(path);
      const root = result[0];
      let dir = result[1];
    
      if (!root && !dir) {
        // No dirname whatsoever
        return '.';
      }
    
      if (dir) {
        // It has a dirname, strip trailing slash
        dir = dir.substr(0, dir.length - 1);
      }
    
      return root + dir;
    }
    
    /** JSDoc */
    function basename(path, ext) {
      let f = splitPath(path)[2];
      if (ext && f.substr(ext.length * -1) === ext) {
        f = f.substr(0, f.length - ext.length);
      }
      return f;
    }
    
    
    //# sourceMappingURL=path.js.map
    
    
    /***/ }),
    
    /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
    
    "use strict";
    __webpack_require__.r(__webpack_exports__);
    /* harmony export */ __webpack_require__.d(__webpack_exports__, {
    /* harmony export */   "InboundFilters": () => (/* binding */ InboundFilters),
    /* harmony export */   "_mergeOptions": () => (/* binding */ _mergeOptions),
    /* harmony export */   "_shouldDropEvent": () => (/* binding */ _shouldDropEvent)
    /* harmony export */ });
    
    /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1653);
    /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1647);
    /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1648);
    
    
    
    // "Script error." is hard coded into browsers for errors that it can't read.
    // this is the result of a script being pulled in from an external domain and CORS.
    const DEFAULT_IGNORE_ERRORS = [/^Script error\.?$/, /^Javascript error: Script error\.? on line 0$/];
    
    /** Options for the InboundFilters integration */
    
    /** Inbound filters configurable by the user */
    class InboundFilters  {
      /**
       * @inheritDoc
       */
       static __initStatic() {this.id = 'InboundFilters';}
    
      /**
       * @inheritDoc
       */
       __init() {this.name = InboundFilters.id;}
    
       constructor(  _options = {}) {;this._options = _options;InboundFilters.prototype.__init.call(this);}
    
      /**
       * @inheritDoc
       */
       setupOnce(addGlobalEventProcessor, getCurrentHub) {
        const eventProcess = (event) => {
          const hub = getCurrentHub();
          if (hub) {
            const self = hub.getIntegration(InboundFilters);
            if (self) {
              const client = hub.getClient();
              const clientOptions = client ? client.getOptions() : {};
              const options = _mergeOptions(self._options, clientOptions);
              return _shouldDropEvent(event, options) ? null : event;
            }
          }
          return event;
        };
    
        eventProcess.id = this.name;
        addGlobalEventProcessor(eventProcess);
      }
    } InboundFilters.__initStatic();
    
    /** JSDoc */
    function _mergeOptions(
      internalOptions = {},
      clientOptions = {},
    ) {
      return {
        allowUrls: [...(internalOptions.allowUrls || []), ...(clientOptions.allowUrls || [])],
        denyUrls: [...(internalOptions.denyUrls || []), ...(clientOptions.denyUrls || [])],
        ignoreErrors: [
          ...(internalOptions.ignoreErrors || []),
          ...(clientOptions.ignoreErrors || []),
          ...DEFAULT_IGNORE_ERRORS,
        ],
        ignoreInternal: internalOptions.ignoreInternal !== undefined ? internalOptions.ignoreInternal : true,
      };
    }
    
    /** JSDoc */
    function _shouldDropEvent(event, options) {
      if (options.ignoreInternal && _isSentryError(event)) {
        (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) &&
          _sentry_utils__WEBPACK_IMPORTED_MODULE_0__.logger.warn(`Event dropped due to being internal Sentry Error.\nEvent: ${(0,_sentry_utils__WEBPACK_IMPORTED_MODULE_1__.getEventDescription)(event)}`);
        return true;
      }
      if (_isIgnoredError(event, options.ignoreErrors)) {
        (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) &&
          _sentry_utils__WEBPACK_IMPORTED_MODULE_0__.logger.warn(
            `Event dropped due to being matched by \`ignoreErrors\` option.\nEvent: ${(0,_sentry_utils__WEBPACK_IMPORTED_MODULE_1__.getEventDescription)(event)}`,
          );
        return true;
      }
      if (_isDeniedUrl(event, options.denyUrls)) {
        (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) &&
          _sentry_utils__WEBPACK_IMPORTED_MODULE_0__.logger.warn(
            `Event dropped due to being matched by \`denyUrls\` option.\nEvent: ${(0,_sentry_utils__WEBPACK_IMPORTED_MODULE_1__.getEventDescription)(
              event,
            )}.\nUrl: ${_getEventFilterUrl(event)}`,
          );
        return true;
      }
      if (!_isAllowedUrl(event, options.allowUrls)) {
        (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) &&
          _sentry_utils__WEBPACK_IMPORTED_MODULE_0__.logger.warn(
            `Event dropped due to not being matched by \`allowUrls\` option.\nEvent: ${(0,_sentry_utils__WEBPACK_IMPORTED_MODULE_1__.getEventDescription)(
              event,
            )}.\nUrl: ${_getEventFilterUrl(event)}`,
          );
        return true;
      }
      return false;
    }
    
    function _isIgnoredError(event, ignoreErrors) {
      if (!ignoreErrors || !ignoreErrors.length) {
        return false;
      }
    
      return _getPossibleEventMessages(event).some(message => (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_2__.stringMatchesSomePattern)(message, ignoreErrors));
    }
    
    function _isDeniedUrl(event, denyUrls) {
      // TODO: Use Glob instead?
      if (!denyUrls || !denyUrls.length) {
        return false;
      }
      const url = _getEventFilterUrl(event);
      return !url ? false : (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_2__.stringMatchesSomePattern)(url, denyUrls);
    }
    
    function _isAllowedUrl(event, allowUrls) {
      // TODO: Use Glob instead?
      if (!allowUrls || !allowUrls.length) {
        return true;
      }
      const url = _getEventFilterUrl(event);
      return !url ? true : (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_2__.stringMatchesSomePattern)(url, allowUrls);
    }
    
    function _getPossibleEventMessages(event) {
      if (event.message) {
        return [event.message];
      }
      if (event.exception) {
        try {
          const { type = '', value = '' } = (event.exception.values && event.exception.values[0]) || {};
          return [`${value}`, `${type}: ${value}`];
        } catch (oO) {
          (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && _sentry_utils__WEBPACK_IMPORTED_MODULE_0__.logger.error(`Cannot extract message for event ${(0,_sentry_utils__WEBPACK_IMPORTED_MODULE_1__.getEventDescription)(event)}`);
          return [];
        }
      }
      return [];
    }
    
    function _isSentryError(event) {
      try {
        // @ts-ignore can't be a sentry error if undefined
        // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
        return event.exception.values[0].type === 'SentryError';
      } catch (e) {
        // ignore
      }
      return false;
    }
    
    function _getLastValidUrl(frames = []) {
      for (let i = frames.length - 1; i >= 0; i--) {
        const frame = frames[i];
    
        if (frame && frame.filename !== '<anonymous>' && frame.filename !== '[native code]') {
          return frame.filename || null;
        }
      }
    
      return null;
    }
    
    function _getEventFilterUrl(event) {
      try {
        let frames;
        try {
          // @ts-ignore we only care about frames if the whole thing here is defined
          frames = event.exception.values[0].stacktrace.frames;
        } catch (e) {
          // ignore
        }
        return frames ? _getLastValidUrl(frames) : null;
      } catch (oO) {
        (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && _sentry_utils__WEBPACK_IMPORTED_MODULE_0__.logger.error(`Cannot extract url for event ${(0,_sentry_utils__WEBPACK_IMPORTED_MODULE_1__.getEventDescription)(event)}`);
        return null;
      }
    }
    
    
    //# sourceMappingURL=inboundfilters.js.map
    
    
    /***/ }),
    
    /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
    
    "use strict";
    __webpack_require__.r(__webpack_exports__);
    /* harmony export */ __webpack_require__.d(__webpack_exports__, {
    /* harmony export */   "FunctionToString": () => (/* binding */ FunctionToString)
    /* harmony export */ });
    
    /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1650);
    
    
    
    let originalFunctionToString;
    
    /** Patch toString calls to return proper name for wrapped functions */
    class FunctionToString  {constructor() { FunctionToString.prototype.__init.call(this); }
      /**
       * @inheritDoc
       */
       static __initStatic() {this.id = 'FunctionToString';}
    
      /**
       * @inheritDoc
       */
       __init() {this.name = FunctionToString.id;}
    
      /**
       * @inheritDoc
       */
       setupOnce() {
        // eslint-disable-next-line @typescript-eslint/unbound-method
        originalFunctionToString = Function.prototype.toString;
    
        // eslint-disable-next-line @typescript-eslint/no-explicit-any
        Function.prototype.toString = function ( ...args) {
          const context = (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_0__.getOriginalFunction)(this) || this;
          return originalFunctionToString.apply(context, args);
        };
      }
    } FunctionToString.__initStatic();
    
    
    //# sourceMappingURL=functiontostring.js.map
    
    
    /***/ }),
    
    /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
    
    "use strict";
    __webpack_require__.r(__webpack_exports__);
    /* harmony export */ __webpack_require__.d(__webpack_exports__, {
    /* harmony export */   "initAndBind": () => (/* binding */ initAndBind)
    /* harmony export */ });
    
    /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1653);
    /* harmony import */ var _hub_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1640);
    
    
    
    
    /** A class object that can instantiate Client objects. */
    
    /**
     * Internal function to create a new SDK client instance. The client is
     * installed and then bound to the current scope.
     *
     * @param clientClass The client class to instantiate.
     * @param options Options to pass to the client.
     */
    function initAndBind(
      clientClass,
      options,
    ) {
      if (options.debug === true) {
        if ((typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__)) {
          _sentry_utils__WEBPACK_IMPORTED_MODULE_0__.logger.enable();
        } else {
          // use `console.warn` rather than `logger.warn` since by non-debug bundles have all `logger.x` statements stripped
          // eslint-disable-next-line no-console
          console.warn('[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.');
        }
      }
      const hub = (0,_hub_js__WEBPACK_IMPORTED_MODULE_1__.getCurrentHub)();
      const scope = hub.getScope();
      if (scope) {
        scope.update(options.initialScope);
      }
    
      const client = new clientClass(options);
      hub.bindClient(client);
    }
    
    
    //# sourceMappingURL=sdk.js.map
    
    
    /***/ }),
    
    /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
    
    "use strict";
    __webpack_require__.r(__webpack_exports__);
    /* harmony export */ __webpack_require__.d(__webpack_exports__, {
    /* harmony export */   "deepReadDirSync": () => (/* binding */ deepReadDirSync)
    /* harmony export */ });
    /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(149);
    /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_0__);
    /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(142);
    /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__);
    
    
    
    /**
     * Recursively read the contents of a directory.
     *
     * @param targetDir Absolute or relative path of the directory to scan. All returned paths will be relative to this
     * directory.
     * @returns Array holding all relative paths
     */
    function deepReadDirSync(targetDir) {
      const targetDirAbsPath = path__WEBPACK_IMPORTED_MODULE_1__.resolve(targetDir);
    
      if (!fs__WEBPACK_IMPORTED_MODULE_0__.existsSync(targetDirAbsPath)) {
        throw new Error(`Cannot read contents of ${targetDirAbsPath}. Directory does not exist.`);
      }
    
      if (!fs__WEBPACK_IMPORTED_MODULE_0__.statSync(targetDirAbsPath).isDirectory()) {
        throw new Error(`Cannot read contents of ${targetDirAbsPath}, because it is not a directory.`);
      }
    
      // This does the same thing as its containing function, `deepReadDirSync` (except that - purely for convenience - it
      // deals in absolute paths rather than relative ones). We need this to be separate from the outer function to preserve
      // the difference between `targetDirAbsPath` and `currentDirAbsPath`.
      const deepReadCurrentDir = (currentDirAbsPath) => {
        return fs__WEBPACK_IMPORTED_MODULE_0__.readdirSync(currentDirAbsPath).reduce((absPaths, itemName) => {
          const itemAbsPath = path__WEBPACK_IMPORTED_MODULE_1__.join(currentDirAbsPath, itemName);
    
          if (fs__WEBPACK_IMPORTED_MODULE_0__.statSync(itemAbsPath).isDirectory()) {
            return [...absPaths, ...deepReadCurrentDir(itemAbsPath)];
          }
    
          return [...absPaths, itemAbsPath];
        }, []);
      };
    
      return deepReadCurrentDir(targetDirAbsPath).map(absPath => path__WEBPACK_IMPORTED_MODULE_1__.relative(targetDirAbsPath, absPath));
    }
    
    
    //# sourceMappingURL=utils.js.map
    
    
    /***/ }),
    
    /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
    
    "use strict";
    __webpack_require__.r(__webpack_exports__);
    /* harmony export */ __webpack_require__.d(__webpack_exports__, {
    /* harmony export */   "extractRequestData": () => (/* reexport safe */ _requestDataDeprecated_js__WEBPACK_IMPORTED_MODULE_3__.extractRequestData),
    /* harmony export */   "parseRequest": () => (/* reexport safe */ _requestDataDeprecated_js__WEBPACK_IMPORTED_MODULE_3__.parseRequest),
    /* harmony export */   "errorHandler": () => (/* binding */ errorHandler),
    /* harmony export */   "requestHandler": () => (/* binding */ requestHandler),
    /* harmony export */   "tracingHandler": () => (/* binding */ tracingHandler)
    /* harmony export */ });
    
    /* harmony import */ var _sentry_utils_esm_buildPolyfills__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(1663);
    /* harmony import */ var _sentry_core__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(1640);
    /* harmony import */ var _sentry_core__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(1655);
    /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(1653);
    /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(1649);
    /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(1717);
    /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(1695);
    /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(1708);
    /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(1650);
    /* harmony import */ var domain__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1352);
    
    /* harmony import */ var domain__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(domain__WEBPACK_IMPORTED_MODULE_0__);
    
    /* harmony import */ var _requestdata_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1705);
    /* harmony import */ var _sdk_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1689);
    /* harmony import */ var _requestDataDeprecated_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(1716);
    
    245721 245722 245723 245724 245725 245726 245727 245728 245729 245730 245731 245732 245733 245734 245735 245736 245737 245738 245739 245740 245741 245742 245743 245744 245745 245746 245747 245748 245749 245750 245751 245752 245753 245754 245755 245756 245757 245758 245759 245760 245761 245762 245763 245764 245765 245766 245767 245768 245769 245770 245771 245772 245773 245774 245775 245776 245777 245778 245779 245780 245781 245782 245783 245784 245785 245786 245787 245788 245789 245790 245791 245792 245793 245794 245795 245796 245797 245798 245799 245800 245801 245802 245803 245804 245805 245806 245807 245808 245809 245810 245811 245812 245813 245814 245815 245816 245817 245818 245819 245820 245821 245822 245823 245824 245825 245826 245827 245828 245829 245830 245831 245832 245833 245834 245835 245836 245837 245838 245839 245840 245841 245842 245843 245844 245845 245846 245847 245848 245849 245850 245851 245852 245853 245854 245855 245856 245857 245858 245859 245860 245861 245862 245863 245864 245865 245866 245867 245868 245869 245870 245871 245872 245873 245874 245875 245876 245877 245878 245879 245880 245881 245882 245883 245884 245885 245886 245887 245888 245889 245890 245891 245892 245893 245894 245895 245896 245897 245898 245899 245900 245901 245902 245903 245904 245905 245906 245907 245908 245909 245910 245911 245912 245913 245914 245915 245916 245917 245918 245919 245920 245921 245922 245923 245924 245925 245926 245927 245928 245929 245930 245931 245932 245933 245934 245935 245936 245937 245938 245939 245940 245941 245942 245943 245944 245945 245946 245947 245948 245949 245950 245951 245952 245953 245954 245955 245956 245957 245958 245959 245960 245961 245962 245963 245964 245965 245966 245967 245968 245969 245970 245971 245972 245973 245974 245975 245976 245977 245978 245979 245980 245981 245982 245983 245984 245985 245986 245987 245988 245989 245990 245991 245992 245993 245994 245995 245996 245997 245998 245999 246000
    
    
    
    
    
    
    
    
    /* eslint-disable @typescript-eslint/no-explicit-any */
    
    /**
     * Express-compatible tracing handler.
     * @see Exposed as `Handlers.tracingHandler`
     */
    function tracingHandler()
    
     {
      return function sentryTracingMiddleware(
        req,
        res,
        next,
      ) {
        const hub = (0,_sentry_core__WEBPACK_IMPORTED_MODULE_4__.getCurrentHub)();
        const options = (0,_sentry_utils_esm_buildPolyfills__WEBPACK_IMPORTED_MODULE_5__._optionalChain)([hub, 'access', _ => _.getClient, 'call', _2 => _2(), 'optionalAccess', _3 => _3.getOptions, 'call', _4 => _4()]);
    
        if (
          !options ||
          options.instrumenter !== 'sentry' ||
          (0,_sentry_utils_esm_buildPolyfills__WEBPACK_IMPORTED_MODULE_5__._optionalChain)([req, 'access', _5 => _5.method, 'optionalAccess', _6 => _6.toUpperCase, 'call', _7 => _7()]) === 'OPTIONS' ||
          (0,_sentry_utils_esm_buildPolyfills__WEBPACK_IMPORTED_MODULE_5__._optionalChain)([req, 'access', _8 => _8.method, 'optionalAccess', _9 => _9.toUpperCase, 'call', _10 => _10()]) === 'HEAD'
        ) {
          return next();
        }
    
        // TODO: This is the `hasTracingEnabled` check, but we're doing it manually since `@sentry/tracing` isn't a
        // dependency of `@sentry/node`. Long term, that function should probably move to `@sentry/hub.
        if (!('tracesSampleRate' in options) && !('tracesSampler' in options)) {
          (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) &&
            _sentry_utils__WEBPACK_IMPORTED_MODULE_6__.logger.warn(
              'Sentry `tracingHandler` is being used, but tracing is disabled. Please enable tracing by setting ' +
                'either `tracesSampleRate` or `tracesSampler` in your `Sentry.init()` options.',
            );
          return next();
        }
    
        // If there is a trace header set, we extract the data from it (parentSpanId, traceId, and sampling decision)
        const traceparentData =
          req.headers && (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_7__.isString)(req.headers['sentry-trace']) && (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_8__.extractTraceparentData)(req.headers['sentry-trace']);
        const incomingBaggageHeaders = (0,_sentry_utils_esm_buildPolyfills__WEBPACK_IMPORTED_MODULE_5__._optionalChain)([req, 'access', _11 => _11.headers, 'optionalAccess', _12 => _12.baggage]);
        const dynamicSamplingContext = (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_9__.baggageHeaderToDynamicSamplingContext)(incomingBaggageHeaders);
    
        const [name, source] = (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_10__.extractPathForTransaction)(req, { path: true, method: true });
        const transaction = (0,_sentry_core__WEBPACK_IMPORTED_MODULE_11__.startTransaction)(
          {
            name,
            op: 'http.server',
            ...traceparentData,
            metadata: {
              dynamicSamplingContext: traceparentData && !dynamicSamplingContext ? {} : dynamicSamplingContext,
              // The request should already have been stored in `scope.sdkProcessingMetadata` (which will become
              // `event.sdkProcessingMetadata` the same way the metadata here will) by `sentryRequestMiddleware`, but on the
              // off chance someone is using `sentryTracingMiddleware` without `sentryRequestMiddleware`, it doesn't hurt to
              // be sure
              request: req,
              source,
            },
          },
          // extra context passed to the tracesSampler
          { request: (0,_requestdata_js__WEBPACK_IMPORTED_MODULE_1__.extractRequestData)(req) },
        );
    
        // We put the transaction on the scope so users can attach children to it
        hub.configureScope(scope => {
          scope.setSpan(transaction);
        });
    
        // We also set __sentry_transaction on the response so people can grab the transaction there to add
        // spans to it later.
        // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
        (res ).__sentry_transaction = transaction;
    
        res.once('finish', () => {
          // Push `transaction.finish` to the next event loop so open spans have a chance to finish before the transaction
          // closes
          setImmediate(() => {
            (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_10__.addRequestDataToTransaction)(transaction, req);
            transaction.setHttpStatus(res.statusCode);
            transaction.finish();
          });
        });
    
        next();
      };
    }
    
    /**
     * Backwards compatibility shim which can be removed in v8. Forces the given options to follow the
     * `AddRequestDataToEventOptions` interface.
     *
     * TODO (v8): Get rid of this, and stop passing `requestDataOptionsFromExpressHandler` to `setSDKProcessingMetadata`.
     */
    function convertReqHandlerOptsToAddReqDataOpts(
      reqHandlerOptions = {},
    ) {
      let addRequestDataOptions;
    
      if ('include' in reqHandlerOptions) {
        addRequestDataOptions = { include: reqHandlerOptions.include };
      } else {
        // eslint-disable-next-line deprecation/deprecation
        const { ip, request, transaction, user } = reqHandlerOptions ;
    
        if (ip || request || transaction || user) {
          addRequestDataOptions = { include: (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_12__.dropUndefinedKeys)({ ip, request, transaction, user }) };
        }
      }
    
      return addRequestDataOptions;
    }
    
    /**
     * Express compatible request handler.
     * @see Exposed as `Handlers.requestHandler`
     */
    function requestHandler(
      options,
    ) {
      // TODO (v8): Get rid of this
      const requestDataOptions = convertReqHandlerOptsToAddReqDataOpts(options);
    
      const currentHub = (0,_sentry_core__WEBPACK_IMPORTED_MODULE_4__.getCurrentHub)();
      const client = currentHub.getClient();
      // Initialise an instance of SessionFlusher on the client when `autoSessionTracking` is enabled and the
      // `requestHandler` middleware is used indicating that we are running in SessionAggregates mode
      if (client && (0,_sdk_js__WEBPACK_IMPORTED_MODULE_2__.isAutoSessionTrackingEnabled)(client)) {
        client.initSessionFlusher();
    
        // If Scope contains a Single mode Session, it is removed in favor of using Session Aggregates mode
        const scope = currentHub.getScope();
        if (scope && scope.getSession()) {
          scope.setSession();
        }
      }
    
      return function sentryRequestMiddleware(
        req,
        res,
        next,
      ) {
        if (options && options.flushTimeout && options.flushTimeout > 0) {
          // eslint-disable-next-line @typescript-eslint/unbound-method
          const _end = res.end;
          res.end = function (chunk, encoding, cb) {
            void (0,_sdk_js__WEBPACK_IMPORTED_MODULE_2__.flush)(options.flushTimeout)
              .then(() => {
                _end.call(this, chunk, encoding, cb);
              })
              .then(null, e => {
                (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && _sentry_utils__WEBPACK_IMPORTED_MODULE_6__.logger.error(e);
                _end.call(this, chunk, encoding, cb);
              });
          };
        }
        const local = domain__WEBPACK_IMPORTED_MODULE_0__.create();
        local.add(req);
        local.add(res);
    
        local.run(() => {
          const currentHub = (0,_sentry_core__WEBPACK_IMPORTED_MODULE_4__.getCurrentHub)();
    
          currentHub.configureScope(scope => {
            scope.setSDKProcessingMetadata({
              request: req,
              // TODO (v8): Stop passing this
              requestDataOptionsFromExpressHandler: requestDataOptions,
            });
    
            const client = currentHub.getClient();
            if ((0,_sdk_js__WEBPACK_IMPORTED_MODULE_2__.isAutoSessionTrackingEnabled)(client)) {
              const scope = currentHub.getScope();
              if (scope) {
                // Set `status` of `RequestSession` to Ok, at the beginning of the request
                scope.setRequestSession({ status: 'ok' });
              }
            }
          });
    
          res.once('finish', () => {
            const client = currentHub.getClient();
            if ((0,_sdk_js__WEBPACK_IMPORTED_MODULE_2__.isAutoSessionTrackingEnabled)(client)) {
              setImmediate(() => {
                // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
                if (client && (client )._captureRequestSession) {
                  // Calling _captureRequestSession to capture request session at the end of the request by incrementing
                  // the correct SessionAggregates bucket i.e. crashed, errored or exited
                  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
                  (client )._captureRequestSession();
                }
              });
            }
          });
          next();
        });
      };
    }
    
    /** JSDoc */
    
    /** JSDoc */
    function getStatusCodeFromResponse(error) {
      const statusCode = error.status || error.statusCode || error.status_code || (error.output && error.output.statusCode);
      return statusCode ? parseInt(statusCode , 10) : 500;
    }
    
    /** Returns true if response code is internal server error */
    function defaultShouldHandleError(error) {
      const status = getStatusCodeFromResponse(error);
      return status >= 500;
    }
    
    /**
     * Express compatible error handler.
     * @see Exposed as `Handlers.errorHandler`
     */
    function errorHandler(options
    
    )
    
     {
      return function sentryErrorMiddleware(
        error,
        _req,
        res,
        next,
      ) {
        // eslint-disable-next-line @typescript-eslint/unbound-method
        const shouldHandleError = (options && options.shouldHandleError) || defaultShouldHandleError;
    
        if (shouldHandleError(error)) {
          (0,_sentry_core__WEBPACK_IMPORTED_MODULE_11__.withScope)(_scope => {
            // The request should already have been stored in `scope.sdkProcessingMetadata` by `sentryRequestMiddleware`,
            // but on the off chance someone is using `sentryErrorMiddleware` without `sentryRequestMiddleware`, it doesn't
            // hurt to be sure
            _scope.setSDKProcessingMetadata({ request: _req });
    
            // For some reason we need to set the transaction on the scope again
            // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
            const transaction = (res ).__sentry_transaction ;
            if (transaction && _scope.getSpan() === undefined) {
              _scope.setSpan(transaction);
            }
    
            const client = (0,_sentry_core__WEBPACK_IMPORTED_MODULE_4__.getCurrentHub)().getClient();
            if (client && (0,_sdk_js__WEBPACK_IMPORTED_MODULE_2__.isAutoSessionTrackingEnabled)(client)) {
              // Check if the `SessionFlusher` is instantiated on the client to go into this branch that marks the
              // `requestSession.status` as `Crashed`, and this check is necessary because the `SessionFlusher` is only
              // instantiated when the the`requestHandler` middleware is initialised, which indicates that we should be
              // running in SessionAggregates mode
              // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
              const isSessionAggregatesMode = (client )._sessionFlusher !== undefined;
              if (isSessionAggregatesMode) {
                const requestSession = _scope.getRequestSession();
                // If an error bubbles to the `errorHandler`, then this is an unhandled error, and should be reported as a
                // Crashed session. The `_requestSession.status` is checked to ensure that this error is happening within
                // the bounds of a request, and if so the status is updated
                if (requestSession && requestSession.status !== undefined) {
                  requestSession.status = 'crashed';
                }
              }
            }
    
            const eventId = (0,_sentry_core__WEBPACK_IMPORTED_MODULE_11__.captureException)(error);
            // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
            (res ).sentry = eventId;
            next(error);
          });
    
          return;
        }