Skip to content
Snippets Groups Projects
onDeleteAccount.js 7.96 MiB
Newer Older
  • Learn to ignore specific revisions
  • build-token's avatar
    build-token committed
    232001 232002 232003 232004 232005 232006 232007 232008 232009 232010 232011 232012 232013 232014 232015 232016 232017 232018 232019 232020 232021 232022 232023 232024 232025 232026 232027 232028 232029 232030 232031 232032 232033 232034 232035 232036 232037 232038 232039 232040 232041 232042 232043 232044 232045 232046 232047 232048 232049 232050 232051 232052 232053 232054 232055 232056 232057 232058 232059 232060 232061 232062 232063 232064 232065 232066 232067 232068 232069 232070 232071 232072 232073 232074 232075 232076 232077 232078 232079 232080 232081 232082 232083 232084 232085 232086 232087 232088 232089 232090 232091 232092 232093 232094 232095 232096 232097 232098 232099 232100 232101 232102 232103 232104 232105 232106 232107 232108 232109 232110 232111 232112 232113 232114 232115 232116 232117 232118 232119 232120 232121 232122 232123 232124 232125 232126 232127 232128 232129 232130 232131 232132 232133 232134 232135 232136 232137 232138 232139 232140 232141 232142 232143 232144 232145 232146 232147 232148 232149 232150 232151 232152 232153 232154 232155 232156 232157 232158 232159 232160 232161 232162 232163 232164 232165 232166 232167 232168 232169 232170 232171 232172 232173 232174 232175 232176 232177 232178 232179 232180 232181 232182 232183 232184 232185 232186 232187 232188 232189 232190 232191 232192 232193 232194 232195 232196 232197 232198 232199 232200 232201 232202 232203 232204 232205 232206 232207 232208 232209 232210 232211 232212 232213 232214 232215 232216 232217 232218 232219 232220 232221 232222 232223 232224 232225 232226 232227 232228 232229 232230 232231 232232 232233 232234 232235 232236 232237 232238 232239 232240 232241 232242 232243 232244 232245 232246 232247 232248 232249 232250 232251 232252 232253 232254 232255 232256 232257 232258 232259 232260 232261 232262 232263 232264 232265 232266 232267 232268 232269 232270 232271 232272 232273 232274 232275 232276 232277 232278 232279 232280 232281 232282 232283 232284 232285 232286 232287 232288 232289 232290 232291 232292 232293 232294 232295 232296 232297 232298 232299 232300 232301 232302 232303 232304 232305 232306 232307 232308 232309 232310 232311 232312 232313 232314 232315 232316 232317 232318 232319 232320 232321 232322 232323 232324 232325 232326 232327 232328 232329 232330 232331 232332 232333 232334 232335 232336 232337 232338 232339 232340 232341 232342 232343 232344 232345 232346 232347 232348 232349 232350 232351 232352 232353 232354 232355 232356 232357 232358 232359 232360 232361 232362 232363 232364 232365 232366 232367 232368 232369 232370 232371 232372 232373 232374 232375 232376 232377 232378 232379 232380 232381 232382 232383 232384 232385 232386 232387 232388 232389 232390 232391 232392 232393 232394 232395 232396 232397 232398 232399 232400 232401 232402 232403 232404 232405 232406 232407 232408 232409 232410 232411 232412 232413 232414 232415 232416 232417 232418 232419 232420 232421 232422 232423 232424 232425 232426 232427 232428 232429 232430 232431 232432 232433 232434 232435 232436 232437 232438 232439 232440 232441 232442 232443 232444 232445 232446 232447 232448 232449 232450 232451 232452 232453 232454 232455 232456 232457 232458 232459 232460 232461 232462 232463 232464 232465 232466 232467 232468 232469 232470 232471 232472 232473 232474 232475 232476 232477 232478 232479 232480 232481 232482 232483 232484 232485 232486 232487 232488 232489 232490 232491 232492 232493 232494 232495 232496 232497 232498 232499 232500 232501 232502 232503 232504 232505 232506 232507 232508 232509 232510 232511 232512 232513 232514 232515 232516 232517 232518 232519 232520 232521 232522 232523 232524 232525 232526 232527 232528 232529 232530 232531 232532 232533 232534 232535 232536 232537 232538 232539 232540 232541 232542 232543 232544 232545 232546 232547 232548 232549 232550 232551 232552 232553 232554 232555 232556 232557 232558 232559 232560 232561 232562 232563 232564 232565 232566 232567 232568 232569 232570 232571 232572 232573 232574 232575 232576 232577 232578 232579 232580 232581 232582 232583 232584 232585 232586 232587 232588 232589 232590 232591 232592 232593 232594 232595 232596 232597 232598 232599 232600 232601 232602 232603 232604 232605 232606 232607 232608 232609 232610 232611 232612 232613 232614 232615 232616 232617 232618 232619 232620 232621 232622 232623 232624 232625 232626 232627 232628 232629 232630 232631 232632 232633 232634 232635 232636 232637 232638 232639 232640 232641 232642 232643 232644 232645 232646 232647 232648 232649 232650 232651 232652 232653 232654 232655 232656 232657 232658 232659 232660 232661 232662 232663 232664 232665 232666 232667 232668 232669 232670 232671 232672 232673 232674 232675 232676 232677 232678 232679 232680 232681 232682 232683 232684 232685 232686 232687 232688 232689 232690 232691 232692 232693 232694 232695 232696 232697 232698 232699 232700 232701 232702 232703 232704 232705 232706 232707 232708 232709 232710 232711 232712 232713 232714 232715 232716 232717 232718 232719 232720 232721 232722 232723 232724 232725 232726 232727 232728 232729 232730 232731 232732 232733 232734 232735 232736 232737 232738 232739 232740 232741 232742 232743 232744 232745 232746 232747 232748 232749 232750 232751 232752 232753 232754 232755 232756 232757 232758 232759 232760 232761 232762 232763 232764 232765 232766 232767 232768 232769 232770 232771 232772 232773 232774 232775 232776 232777 232778 232779 232780 232781 232782 232783 232784 232785 232786 232787 232788 232789 232790 232791 232792 232793 232794 232795 232796 232797 232798 232799 232800 232801 232802 232803 232804 232805 232806 232807 232808 232809 232810 232811 232812 232813 232814 232815 232816 232817 232818 232819 232820 232821 232822 232823 232824 232825 232826 232827 232828 232829 232830 232831 232832 232833 232834 232835 232836 232837 232838 232839 232840 232841 232842 232843 232844 232845 232846 232847 232848 232849 232850 232851 232852 232853 232854 232855 232856 232857 232858 232859 232860 232861 232862 232863 232864 232865 232866 232867 232868 232869 232870 232871 232872 232873 232874 232875 232876 232877 232878 232879 232880 232881 232882 232883 232884 232885 232886 232887 232888 232889 232890 232891 232892 232893 232894 232895 232896 232897 232898 232899 232900 232901 232902 232903 232904 232905 232906 232907 232908 232909 232910 232911 232912 232913 232914 232915 232916 232917 232918 232919 232920 232921 232922 232923 232924 232925 232926 232927 232928 232929 232930 232931 232932 232933 232934 232935 232936 232937 232938 232939 232940 232941 232942 232943 232944 232945 232946 232947 232948 232949 232950 232951 232952 232953 232954 232955 232956 232957 232958 232959 232960 232961 232962 232963 232964 232965 232966 232967 232968 232969 232970 232971 232972 232973 232974 232975 232976 232977 232978 232979 232980 232981 232982 232983 232984 232985 232986 232987 232988 232989 232990 232991 232992 232993 232994 232995 232996 232997 232998 232999 233000
      } else if (retryAfterHeader) {
        updatedRateLimits.all = now + parseRetryAfterHeader(retryAfterHeader, now);
      } else if (statusCode === 429) {
        updatedRateLimits.all = now + 60 * 1000;
      }
    
      return updatedRateLimits;
    }
    
    
    //# sourceMappingURL=ratelimit.js.map
    
    
    /***/ }),
    /* 1627 */
    /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
    
    "use strict";
    __webpack_require__.r(__webpack_exports__);
    /* harmony export */ __webpack_require__.d(__webpack_exports__, {
    /* harmony export */   "NodeClient": () => (/* binding */ NodeClient)
    /* harmony export */ });
    /* harmony import */ var _sentry_utils_esm_buildPolyfills__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(1625);
    /* harmony import */ var _sentry_core__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(1629);
    /* harmony import */ var _sentry_core__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(1616);
    /* harmony import */ var _sentry_core__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(1634);
    /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(1615);
    /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(1614);
    /* harmony import */ var os__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(253);
    /* harmony import */ var os__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(os__WEBPACK_IMPORTED_MODULE_0__);
    /* harmony import */ var util__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(64);
    /* harmony import */ var util__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(util__WEBPACK_IMPORTED_MODULE_1__);
    /* harmony import */ var _eventbuilder_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1628);
    
    
    
    
    
    
    
    /**
     * The Sentry Node SDK Client.
     *
     * @see NodeClientOptions for documentation on configuration options.
     * @see SentryClient for usage documentation.
     */
    class NodeClient extends _sentry_core__WEBPACK_IMPORTED_MODULE_3__.BaseClient {
    
      /**
       * Creates a new Node SDK instance.
       * @param options Configuration options for this SDK.
       */
       constructor(options) {
        options._metadata = options._metadata || {};
        options._metadata.sdk = options._metadata.sdk || {
          name: 'sentry.javascript.node',
          packages: [
            {
              name: 'npm:@sentry/node',
              version: _sentry_core__WEBPACK_IMPORTED_MODULE_4__.SDK_VERSION,
            },
          ],
          version: _sentry_core__WEBPACK_IMPORTED_MODULE_4__.SDK_VERSION,
        };
    
        // Until node supports global TextEncoder in all versions we support, we are forced to pass it from util
        options.transportOptions = {
          textEncoder: new util__WEBPACK_IMPORTED_MODULE_1__.TextEncoder(),
          ...options.transportOptions,
        };
    
        super(options);
      }
    
      /**
       * @inheritDoc
       */
      // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
       captureException(exception, hint, scope) {
        // Check if the flag `autoSessionTracking` is enabled, and if `_sessionFlusher` exists because it is initialised only
        // when the `requestHandler` middleware is used, and hence the expectation is to have SessionAggregates payload
        // sent to the Server only when the `requestHandler` middleware is used
        if (this._options.autoSessionTracking && this._sessionFlusher && scope) {
          const requestSession = scope.getRequestSession();
    
          // Necessary checks to ensure this is code block is executed only within a request
          // Should override the status only if `requestSession.status` is `Ok`, which is its initial stage
          if (requestSession && requestSession.status === 'ok') {
            requestSession.status = 'errored';
          }
        }
    
        return super.captureException(exception, hint, scope);
      }
    
      /**
       * @inheritDoc
       */
       captureEvent(event, hint, scope) {
        // Check if the flag `autoSessionTracking` is enabled, and if `_sessionFlusher` exists because it is initialised only
        // when the `requestHandler` middleware is used, and hence the expectation is to have SessionAggregates payload
        // sent to the Server only when the `requestHandler` middleware is used
        if (this._options.autoSessionTracking && this._sessionFlusher && scope) {
          const eventType = event.type || 'exception';
          const isException =
            eventType === 'exception' && event.exception && event.exception.values && event.exception.values.length > 0;
    
          // If the event is of type Exception, then a request session should be captured
          if (isException) {
            const requestSession = scope.getRequestSession();
    
            // Ensure that this is happening within the bounds of a request, and make sure not to override
            // Session Status if Errored / Crashed
            if (requestSession && requestSession.status === 'ok') {
              requestSession.status = 'errored';
            }
          }
        }
    
        return super.captureEvent(event, hint, scope);
      }
    
      /**
       *
       * @inheritdoc
       */
       close(timeout) {
        (0,_sentry_utils_esm_buildPolyfills__WEBPACK_IMPORTED_MODULE_5__._optionalChain)([this, 'access', _ => _._sessionFlusher, 'optionalAccess', _2 => _2.close, 'call', _3 => _3()]);
        return super.close(timeout);
      }
    
      /** Method that initialises an instance of SessionFlusher on Client */
       initSessionFlusher() {
        const { release, environment } = this._options;
        if (!release) {
          (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && _sentry_utils__WEBPACK_IMPORTED_MODULE_6__.logger.warn('Cannot initialise an instance of SessionFlusher if no release is provided!');
        } else {
          this._sessionFlusher = new _sentry_core__WEBPACK_IMPORTED_MODULE_7__.SessionFlusher(this, {
            release,
            environment,
          });
        }
      }
    
      /**
       * @inheritDoc
       */
      // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
       eventFromException(exception, hint) {
        return (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_8__.resolvedSyncPromise)((0,_eventbuilder_js__WEBPACK_IMPORTED_MODULE_2__.eventFromUnknownInput)(this._options.stackParser, exception, hint));
      }
    
      /**
       * @inheritDoc
       */
       eventFromMessage(
        message,
        // eslint-disable-next-line deprecation/deprecation
        level = 'info',
        hint,
      ) {
        return (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_8__.resolvedSyncPromise)(
          (0,_eventbuilder_js__WEBPACK_IMPORTED_MODULE_2__.eventFromMessage)(this._options.stackParser, message, level, hint, this._options.attachStacktrace),
        );
      }
    
      /**
       * @inheritDoc
       */
       _prepareEvent(event, hint, scope) {
        event.platform = event.platform || 'node';
        event.contexts = {
          ...event.contexts,
          runtime: (0,_sentry_utils_esm_buildPolyfills__WEBPACK_IMPORTED_MODULE_5__._optionalChain)([event, 'access', _4 => _4.contexts, 'optionalAccess', _5 => _5.runtime]) || {
            name: 'node',
            version: global.process.version,
          },
        };
        event.server_name =
          event.server_name || this.getOptions().serverName || global.process.env.SENTRY_NAME || os__WEBPACK_IMPORTED_MODULE_0__.hostname();
        return super._prepareEvent(event, hint, scope);
      }
    
      /**
       * Method responsible for capturing/ending a request session by calling `incrementSessionStatusCount` to increment
       * appropriate session aggregates bucket
       */
       _captureRequestSession() {
        if (!this._sessionFlusher) {
          (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && _sentry_utils__WEBPACK_IMPORTED_MODULE_6__.logger.warn('Discarded request mode session because autoSessionTracking option was disabled');
        } else {
          this._sessionFlusher.incrementSessionStatusCount();
        }
      }
    }
    
    
    //# sourceMappingURL=client.js.map
    
    
    /***/ }),
    /* 1628 */
    /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
    
    "use strict";
    __webpack_require__.r(__webpack_exports__);
    /* harmony export */ __webpack_require__.d(__webpack_exports__, {
    /* harmony export */   "eventFromMessage": () => (/* binding */ eventFromMessage),
    /* harmony export */   "eventFromUnknownInput": () => (/* binding */ eventFromUnknownInput),
    /* harmony export */   "exceptionFromError": () => (/* binding */ exceptionFromError),
    /* harmony export */   "parseStackFrames": () => (/* binding */ parseStackFrames)
    /* harmony export */ });
    /* harmony import */ var _sentry_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1602);
    /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1611);
    /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1612);
    /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(1622);
    /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(1609);
    
    
    
    /**
     * Extracts stack frames from the error.stack string
     */
    function parseStackFrames(stackParser, error) {
      return stackParser(error.stack || '', 1);
    }
    
    /**
     * Extracts stack frames from the error and builds a Sentry Exception
     */
    function exceptionFromError(stackParser, error) {
      const exception = {
        type: error.name || error.constructor.name,
        value: error.message,
      };
    
      const frames = parseStackFrames(stackParser, error);
      if (frames.length) {
        exception.stacktrace = { frames };
      }
    
      return exception;
    }
    
    /**
     * Builds and Event from a Exception
     * @hidden
     */
    function eventFromUnknownInput(stackParser, exception, hint) {
      // eslint-disable-next-line @typescript-eslint/no-explicit-any
      let ex = exception;
      const providedMechanism =
        hint && hint.data && (hint.data ).mechanism;
      const mechanism = providedMechanism || {
        handled: true,
        type: 'generic',
      };
    
      if (!(0,_sentry_utils__WEBPACK_IMPORTED_MODULE_0__.isError)(exception)) {
        if ((0,_sentry_utils__WEBPACK_IMPORTED_MODULE_0__.isPlainObject)(exception)) {
          // This will allow us to group events based on top-level keys
          // which is much better than creating new group when any key/value change
          const message = `Non-Error exception captured with keys: ${(0,_sentry_utils__WEBPACK_IMPORTED_MODULE_1__.extractExceptionKeysForMessage)(exception)}`;
    
          const hub = (0,_sentry_core__WEBPACK_IMPORTED_MODULE_2__.getCurrentHub)();
          const client = hub.getClient();
          const normalizeDepth = client && client.getOptions().normalizeDepth;
          hub.configureScope(scope => {
            scope.setExtra('__serialized__', (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_3__.normalizeToSize)(exception, normalizeDepth));
          });
    
          ex = (hint && hint.syntheticException) || new Error(message);
          (ex ).message = message;
        } else {
          // This handles when someone does: `throw "something awesome";`
          // We use synthesized Error here so we can extract a (rough) stack trace.
          ex = (hint && hint.syntheticException) || new Error(exception );
          (ex ).message = exception ;
        }
        mechanism.synthetic = true;
      }
    
      const event = {
        exception: {
          values: [exceptionFromError(stackParser, ex )],
        },
      };
    
      (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_4__.addExceptionTypeValue)(event, undefined, undefined);
      (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_4__.addExceptionMechanism)(event, mechanism);
    
      return {
        ...event,
        event_id: hint && hint.event_id,
      };
    }
    
    /**
     * Builds and Event from a Message
     * @hidden
     */
    function eventFromMessage(
      stackParser,
      message,
      // eslint-disable-next-line deprecation/deprecation
      level = 'info',
      hint,
      attachStacktrace,
    ) {
      const event = {
        event_id: hint && hint.event_id,
        level,
        message,
      };
    
      if (attachStacktrace && hint && hint.syntheticException) {
        const frames = parseStackFrames(stackParser, hint.syntheticException);
        if (frames.length) {
          event.exception = {
            values: [
              {
                value: message,
                stacktrace: { frames },
              },
            ],
          };
        }
      }
    
      return event;
    }
    
    
    //# sourceMappingURL=eventbuilder.js.map
    
    
    /***/ }),
    /* 1629 */
    /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
    
    "use strict";
    __webpack_require__.r(__webpack_exports__);
    /* harmony export */ __webpack_require__.d(__webpack_exports__, {
    /* harmony export */   "BaseClient": () => (/* binding */ BaseClient)
    /* harmony export */ });
    /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1630);
    /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1615);
    /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(1609);
    /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(1611);
    /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(1614);
    /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(1621);
    /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(1605);
    /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(1622);
    /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(1610);
    /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(1620);
    /* harmony import */ var _api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1631);
    /* harmony import */ var _envelope_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(1633);
    /* harmony import */ var _integration_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(1632);
    /* harmony import */ var _scope_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(1603);
    /* harmony import */ var _session_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(1604);
    
    
    
    
    
    
    
    const ALREADY_SEEN_ERROR = "Not capturing exception because it's already been captured.";
    
    /**
     * Base implementation for all JavaScript SDK clients.
     *
     * Call the constructor with the corresponding options
     * specific to the client subclass. To access these options later, use
     * {@link Client.getOptions}.
     *
     * If a Dsn is specified in the options, it will be parsed and stored. Use
     * {@link Client.getDsn} to retrieve the Dsn at any moment. In case the Dsn is
     * invalid, the constructor will throw a {@link SentryException}. Note that
     * without a valid Dsn, the SDK will not send any events to Sentry.
     *
     * Before sending an event, it is passed through
     * {@link BaseClient._prepareEvent} to add SDK information and scope data
     * (breadcrumbs and context). To add more custom information, override this
     * method and extend the resulting prepared event.
     *
     * To issue automatically created events (e.g. via instrumentation), use
     * {@link Client.captureEvent}. It will prepare the event and pass it through
     * the callback lifecycle. To issue auto-breadcrumbs, use
     * {@link Client.addBreadcrumb}.
     *
     * @example
     * class NodeClient extends BaseClient<NodeOptions> {
     *   public constructor(options: NodeOptions) {
     *     super(options);
     *   }
     *
     *   // ...
     * }
     */
    class BaseClient {
      /** Options passed to the SDK. */
    
      /** The client Dsn, if specified in options. Without this Dsn, the SDK will be disabled. */
    
      /** Array of set up integrations. */
       __init() {this._integrations = {};}
    
      /** Indicates whether this client's integrations have been set up. */
       __init2() {this._integrationsInitialized = false;}
    
      /** Number of calls being processed */
       __init3() {this._numProcessing = 0;}
    
      /** Holds flushable  */
       __init4() {this._outcomes = {};}
    
      /**
       * Initializes this client instance.
       *
       * @param options Options for the client.
       */
       constructor(options) {;BaseClient.prototype.__init.call(this);BaseClient.prototype.__init2.call(this);BaseClient.prototype.__init3.call(this);BaseClient.prototype.__init4.call(this);
        this._options = options;
        if (options.dsn) {
          this._dsn = (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_0__.makeDsn)(options.dsn);
          const url = (0,_api_js__WEBPACK_IMPORTED_MODULE_1__.getEnvelopeEndpointWithUrlEncodedAuth)(this._dsn, options);
          this._transport = options.transport({
            recordDroppedEvent: this.recordDroppedEvent.bind(this),
            ...options.transportOptions,
            url,
          });
        } else {
          (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && _sentry_utils__WEBPACK_IMPORTED_MODULE_2__.logger.warn('No DSN provided, client will not do anything.');
        }
      }
    
      /**
       * @inheritDoc
       */
      // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
       captureException(exception, hint, scope) {
        // ensure we haven't captured this very object before
        if ((0,_sentry_utils__WEBPACK_IMPORTED_MODULE_3__.checkOrSetAlreadyCaught)(exception)) {
          (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && _sentry_utils__WEBPACK_IMPORTED_MODULE_2__.logger.log(ALREADY_SEEN_ERROR);
          return;
        }
    
        let eventId;
        this._process(
          this.eventFromException(exception, hint)
            .then(event => this._captureEvent(event, hint, scope))
            .then(result => {
              eventId = result;
            }),
        );
    
        return eventId;
      }
    
      /**
       * @inheritDoc
       */
       captureMessage(
        message,
        // eslint-disable-next-line deprecation/deprecation
        level,
        hint,
        scope,
      ) {
        let eventId;
    
        const promisedEvent = (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_4__.isPrimitive)(message)
          ? this.eventFromMessage(String(message), level, hint)
          : this.eventFromException(message, hint);
    
        this._process(
          promisedEvent
            .then(event => this._captureEvent(event, hint, scope))
            .then(result => {
              eventId = result;
            }),
        );
    
        return eventId;
      }
    
      /**
       * @inheritDoc
       */
       captureEvent(event, hint, scope) {
        // ensure we haven't captured this very object before
        if (hint && hint.originalException && (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_3__.checkOrSetAlreadyCaught)(hint.originalException)) {
          (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && _sentry_utils__WEBPACK_IMPORTED_MODULE_2__.logger.log(ALREADY_SEEN_ERROR);
          return;
        }
    
        let eventId;
    
        this._process(
          this._captureEvent(event, hint, scope).then(result => {
            eventId = result;
          }),
        );
    
        return eventId;
      }
    
      /**
       * @inheritDoc
       */
       captureSession(session) {
        if (!this._isEnabled()) {
          (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && _sentry_utils__WEBPACK_IMPORTED_MODULE_2__.logger.warn('SDK not enabled, will not capture session.');
          return;
        }
    
        if (!(typeof session.release === 'string')) {
          (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && _sentry_utils__WEBPACK_IMPORTED_MODULE_2__.logger.warn('Discarded session because of missing or non-string release');
        } else {
          this.sendSession(session);
          // After sending, we set init false to indicate it's not the first occurrence
          (0,_session_js__WEBPACK_IMPORTED_MODULE_5__.updateSession)(session, { init: false });
        }
      }
    
      /**
       * @inheritDoc
       */
       getDsn() {
        return this._dsn;
      }
    
      /**
       * @inheritDoc
       */
       getOptions() {
        return this._options;
      }
    
      /**
       * @inheritDoc
       */
       getTransport() {
        return this._transport;
      }
    
      /**
       * @inheritDoc
       */
       flush(timeout) {
        const transport = this._transport;
        if (transport) {
          return this._isClientDoneProcessing(timeout).then(clientFinished => {
            return transport.flush(timeout).then(transportFlushed => clientFinished && transportFlushed);
          });
        } else {
          return (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_6__.resolvedSyncPromise)(true);
        }
      }
    
      /**
       * @inheritDoc
       */
       close(timeout) {
        return this.flush(timeout).then(result => {
          this.getOptions().enabled = false;
          return result;
        });
      }
    
      /**
       * Sets up the integrations
       */
       setupIntegrations() {
        if (this._isEnabled() && !this._integrationsInitialized) {
          this._integrations = (0,_integration_js__WEBPACK_IMPORTED_MODULE_7__.setupIntegrations)(this._options.integrations);
          this._integrationsInitialized = true;
        }
      }
    
      /**
       * Gets an installed integration by its `id`.
       *
       * @returns The installed integration or `undefined` if no integration with that `id` was installed.
       */
       getIntegrationById(integrationId) {
        return this._integrations[integrationId];
      }
    
      /**
       * @inheritDoc
       */
       getIntegration(integration) {
        try {
          return (this._integrations[integration.id] ) || null;
        } catch (_oO) {
          (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && _sentry_utils__WEBPACK_IMPORTED_MODULE_2__.logger.warn(`Cannot retrieve integration ${integration.id} from the current Client`);
          return null;
        }
      }
    
      /**
       * @inheritDoc
       */
       sendEvent(event, hint = {}) {
        if (this._dsn) {
          let env = (0,_envelope_js__WEBPACK_IMPORTED_MODULE_8__.createEventEnvelope)(event, this._dsn, this._options._metadata, this._options.tunnel);
    
          for (const attachment of hint.attachments || []) {
            env = (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_9__.addItemToEnvelope)(
              env,
              (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_9__.createAttachmentEnvelopeItem)(
                attachment,
                this._options.transportOptions && this._options.transportOptions.textEncoder,
              ),
            );
          }
    
          this._sendEnvelope(env);
        }
      }
    
      /**
       * @inheritDoc
       */
       sendSession(session) {
        if (this._dsn) {
          const env = (0,_envelope_js__WEBPACK_IMPORTED_MODULE_8__.createSessionEnvelope)(session, this._dsn, this._options._metadata, this._options.tunnel);
          this._sendEnvelope(env);
        }
      }
    
      /**
       * @inheritDoc
       */
       recordDroppedEvent(reason, category, _event) {
        // Note: we use `event` in replay, where we overwrite this hook.
    
        if (this._options.sendClientReports) {
          // We want to track each category (error, transaction, session) separately
          // but still keep the distinction between different type of outcomes.
          // We could use nested maps, but it's much easier to read and type this way.
          // A correct type for map-based implementation if we want to go that route
          // would be `Partial<Record<SentryRequestType, Partial<Record<Outcome, number>>>>`
          // With typescript 4.1 we could even use template literal types
          const key = `${reason}:${category}`;
          (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && _sentry_utils__WEBPACK_IMPORTED_MODULE_2__.logger.log(`Adding outcome: "${key}"`);
    
          // The following works because undefined + 1 === NaN and NaN is falsy
          this._outcomes[key] = this._outcomes[key] + 1 || 1;
        }
      }
    
      /** Updates existing session based on the provided event */
       _updateSessionFromEvent(session, event) {
        let crashed = false;
        let errored = false;
        const exceptions = event.exception && event.exception.values;
    
        if (exceptions) {
          errored = true;
    
          for (const ex of exceptions) {
            const mechanism = ex.mechanism;
            if (mechanism && mechanism.handled === false) {
              crashed = true;
              break;
            }
          }
        }
    
        // A session is updated and that session update is sent in only one of the two following scenarios:
        // 1. Session with non terminal status and 0 errors + an error occurred -> Will set error count to 1 and send update
        // 2. Session with non terminal status and 1 error + a crash occurred -> Will set status crashed and send update
        const sessionNonTerminal = session.status === 'ok';
        const shouldUpdateAndSend = (sessionNonTerminal && session.errors === 0) || (sessionNonTerminal && crashed);
    
        if (shouldUpdateAndSend) {
          (0,_session_js__WEBPACK_IMPORTED_MODULE_5__.updateSession)(session, {
            ...(crashed && { status: 'crashed' }),
            errors: session.errors || Number(errored || crashed),
          });
          this.captureSession(session);
        }
      }
    
      /**
       * Determine if the client is finished processing. Returns a promise because it will wait `timeout` ms before saying
       * "no" (resolving to `false`) in order to give the client a chance to potentially finish first.
       *
       * @param timeout The time, in ms, after which to resolve to `false` if the client is still busy. Passing `0` (or not
       * passing anything) will make the promise wait as long as it takes for processing to finish before resolving to
       * `true`.
       * @returns A promise which will resolve to `true` if processing is already done or finishes before the timeout, and
       * `false` otherwise
       */
       _isClientDoneProcessing(timeout) {
        return new _sentry_utils__WEBPACK_IMPORTED_MODULE_6__.SyncPromise(resolve => {
          let ticked = 0;
          const tick = 1;
    
          const interval = setInterval(() => {
            if (this._numProcessing == 0) {
              clearInterval(interval);
              resolve(true);
            } else {
              ticked += tick;
              if (timeout && ticked >= timeout) {
                clearInterval(interval);
                resolve(false);
              }
            }
          }, tick);
        });
      }
    
      /** Determines whether this SDK is enabled and a valid Dsn is present. */
       _isEnabled() {
        return this.getOptions().enabled !== false && this._dsn !== undefined;
      }
    
      /**
       * Adds common information to events.
       *
       * The information includes release and environment from `options`,
       * breadcrumbs and context (extra, tags and user) from the scope.
       *
       * Information that is already present in the event is never overwritten. For
       * nested objects, such as the context, keys are merged.
       *
       * @param event The original event.
       * @param hint May contain additional information about the original exception.
       * @param scope A scope containing event metadata.
       * @returns A new event with more information.
       */
       _prepareEvent(event, hint, scope) {
        const { normalizeDepth = 3, normalizeMaxBreadth = 1000 } = this.getOptions();
        const prepared = {
          ...event,
          event_id: event.event_id || hint.event_id || (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_3__.uuid4)(),
          timestamp: event.timestamp || (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_10__.dateTimestampInSeconds)(),
        };
    
        this._applyClientOptions(prepared);
        this._applyIntegrationsMetadata(prepared);
    
        // If we have scope given to us, use it as the base for further modifications.
        // This allows us to prevent unnecessary copying of data if `captureContext` is not provided.
        let finalScope = scope;
        if (hint.captureContext) {
          finalScope = _scope_js__WEBPACK_IMPORTED_MODULE_11__.Scope.clone(finalScope).update(hint.captureContext);
        }
    
        // We prepare the result here with a resolved Event.
        let result = (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_6__.resolvedSyncPromise)(prepared);
    
        // This should be the last thing called, since we want that
        // {@link Hub.addEventProcessor} gets the finished prepared event.
        //
        // We need to check for the existence of `finalScope.getAttachments`
        // because `getAttachments` can be undefined if users are using an older version
        // of `@sentry/core` that does not have the `getAttachments` method.
        // See: https://github.com/getsentry/sentry-javascript/issues/5229
        if (finalScope && finalScope.getAttachments) {
          // Collect attachments from the hint and scope
          const attachments = [...(hint.attachments || []), ...finalScope.getAttachments()];
    
          if (attachments.length) {
            hint.attachments = attachments;
          }
    
          // In case we have a hub we reassign it.
          result = finalScope.applyToEvent(prepared, hint);
        }
    
        return result.then(evt => {
          if (typeof normalizeDepth === 'number' && normalizeDepth > 0) {
            return this._normalizeEvent(evt, normalizeDepth, normalizeMaxBreadth);
          }
          return evt;
        });
      }
    
      /**
       * Applies `normalize` function on necessary `Event` attributes to make them safe for serialization.
       * Normalized keys:
       * - `breadcrumbs.data`
       * - `user`
       * - `contexts`
       * - `extra`
       * @param event Event
       * @returns Normalized event
       */
       _normalizeEvent(event, depth, maxBreadth) {
        if (!event) {
          return null;
        }
    
        const normalized = {
          ...event,
          ...(event.breadcrumbs && {
            breadcrumbs: event.breadcrumbs.map(b => ({
              ...b,
              ...(b.data && {
                data: (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_12__.normalize)(b.data, depth, maxBreadth),
              }),
            })),
          }),
          ...(event.user && {
            user: (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_12__.normalize)(event.user, depth, maxBreadth),
          }),
          ...(event.contexts && {
            contexts: (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_12__.normalize)(event.contexts, depth, maxBreadth),
          }),
          ...(event.extra && {
            extra: (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_12__.normalize)(event.extra, depth, maxBreadth),
          }),
        };
    
        // event.contexts.trace stores information about a Transaction. Similarly,
        // event.spans[] stores information about child Spans. Given that a
        // Transaction is conceptually a Span, normalization should apply to both
        // Transactions and Spans consistently.
        // For now the decision is to skip normalization of Transactions and Spans,
        // so this block overwrites the normalized event to add back the original
        // Transaction information prior to normalization.
        if (event.contexts && event.contexts.trace && normalized.contexts) {
          normalized.contexts.trace = event.contexts.trace;
    
          // event.contexts.trace.data may contain circular/dangerous data so we need to normalize it
          if (event.contexts.trace.data) {
            normalized.contexts.trace.data = (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_12__.normalize)(event.contexts.trace.data, depth, maxBreadth);
          }
        }
    
        // event.spans[].data may contain circular/dangerous data so we need to normalize it
        if (event.spans) {
          normalized.spans = event.spans.map(span => {
            // We cannot use the spread operator here because `toJSON` on `span` is non-enumerable
            if (span.data) {
              span.data = (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_12__.normalize)(span.data, depth, maxBreadth);
            }
            return span;
          });
        }
    
        return normalized;
      }
    
      /**
       *  Enhances event using the client configuration.
       *  It takes care of all "static" values like environment, release and `dist`,
       *  as well as truncating overly long values.
       * @param event event instance to be enhanced
       */
       _applyClientOptions(event) {
        const options = this.getOptions();
        const { environment, release, dist, maxValueLength = 250 } = options;
    
        if (!('environment' in event)) {
          event.environment = 'environment' in options ? environment : 'production';
        }
    
        if (event.release === undefined && release !== undefined) {
          event.release = release;
        }
    
        if (event.dist === undefined && dist !== undefined) {
          event.dist = dist;
        }
    
        if (event.message) {
          event.message = (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_13__.truncate)(event.message, maxValueLength);
        }
    
        const exception = event.exception && event.exception.values && event.exception.values[0];
        if (exception && exception.value) {
          exception.value = (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_13__.truncate)(exception.value, maxValueLength);
        }
    
        const request = event.request;
        if (request && request.url) {
          request.url = (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_13__.truncate)(request.url, maxValueLength);
        }
      }
    
      /**
       * This function adds all used integrations to the SDK info in the event.
       * @param event The event that will be filled with all integrations.
       */
       _applyIntegrationsMetadata(event) {
        const integrationsArray = Object.keys(this._integrations);
        if (integrationsArray.length > 0) {
          event.sdk = event.sdk || {};
          event.sdk.integrations = [...(event.sdk.integrations || []), ...integrationsArray];
        }
      }
    
      /**
       * Processes the event and logs an error in case of rejection
       * @param event
       * @param hint
       * @param scope
       */
       _captureEvent(event, hint = {}, scope) {
        return this._processEvent(event, hint, scope).then(
          finalEvent => {
            return finalEvent.event_id;
          },
          reason => {
            if ((typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__)) {
              // If something's gone wrong, log the error as a warning. If it's just us having used a `SentryError` for
              // control flow, log just the message (no stack) as a log-level log.
              const sentryError = reason ;
              if (sentryError.logLevel === 'log') {
                _sentry_utils__WEBPACK_IMPORTED_MODULE_2__.logger.log(sentryError.message);
              } else {
                _sentry_utils__WEBPACK_IMPORTED_MODULE_2__.logger.warn(sentryError);
              }
            }
            return undefined;
          },
        );
      }
    
      /**
       * Processes an event (either error or message) and sends it to Sentry.
       *
       * This also adds breadcrumbs and context information to the event. However,
       * platform specific meta data (such as the User's IP address) must be added
       * by the SDK implementor.
       *
       *
       * @param event The event to send to Sentry.
       * @param hint May contain additional information about the original exception.
       * @param scope A scope containing event metadata.
       * @returns A SyncPromise that resolves with the event or rejects in case event was/will not be send.
       */
       _processEvent(event, hint, scope) {
        const options = this.getOptions();
        const { sampleRate } = options;
    
        if (!this._isEnabled()) {
          return (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_6__.rejectedSyncPromise)(new _sentry_utils__WEBPACK_IMPORTED_MODULE_14__.SentryError('SDK not enabled, will not capture event.', 'log'));
        }
    
        const isTransaction = event.type === 'transaction';
        const beforeSendProcessorName = isTransaction ? 'beforeSendTransaction' : 'beforeSend';
        const beforeSendProcessor = options[beforeSendProcessorName];
    
        // 1.0 === 100% events are sent
        // 0.0 === 0% events are sent
        // Sampling for transaction happens somewhere else
        if (!isTransaction && typeof sampleRate === 'number' && Math.random() > sampleRate) {
          this.recordDroppedEvent('sample_rate', 'error', event);
          return (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_6__.rejectedSyncPromise)(
            new _sentry_utils__WEBPACK_IMPORTED_MODULE_14__.SentryError(
              `Discarding event because it's not included in the random sample (sampling rate = ${sampleRate})`,
              'log',
            ),
          );
        }
    
        return this._prepareEvent(event, hint, scope)
          .then(prepared => {
            if (prepared === null) {
              this.recordDroppedEvent('event_processor', event.type || 'error', event);
              throw new _sentry_utils__WEBPACK_IMPORTED_MODULE_14__.SentryError('An event processor returned `null`, will not send event.', 'log');
            }
    
            const isInternalException = hint.data && (hint.data ).__sentry__ === true;
            if (isInternalException || !beforeSendProcessor) {
              return prepared;
            }
    
            const beforeSendResult = beforeSendProcessor(prepared, hint);
            return _validateBeforeSendResult(beforeSendResult, beforeSendProcessorName);
          })
          .then(processedEvent => {
            if (processedEvent === null) {
              this.recordDroppedEvent('before_send', event.type || 'error', event);
              throw new _sentry_utils__WEBPACK_IMPORTED_MODULE_14__.SentryError(`\`${beforeSendProcessorName}\` returned \`null\`, will not send event.`, 'log');
            }
    
            const session = scope && scope.getSession();
            if (!isTransaction && session) {
              this._updateSessionFromEvent(session, processedEvent);
            }
    
            // None of the Sentry built event processor will update transaction name,
            // so if the transaction name has been changed by an event processor, we know
            // it has to come from custom event processor added by a user
            const transactionInfo = processedEvent.transaction_info;
            if (isTransaction && transactionInfo && processedEvent.transaction !== event.transaction) {
              const source = 'custom';
              processedEvent.transaction_info = {
                ...transactionInfo,
                source,
                changes: [