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
                  ...transactionInfo.changes,
                  {
                    source,
                    // use the same timestamp as the processed event.
                    timestamp: processedEvent.timestamp ,
                    propagations: transactionInfo.propagations,
                  },
                ],
              };
            }
    
            this.sendEvent(processedEvent, hint);
            return processedEvent;
          })
          .then(null, reason => {
            if (reason instanceof _sentry_utils__WEBPACK_IMPORTED_MODULE_14__.SentryError) {
              throw reason;
            }
    
            this.captureException(reason, {
              data: {
                __sentry__: true,
              },
              originalException: reason ,
            });
            throw new _sentry_utils__WEBPACK_IMPORTED_MODULE_14__.SentryError(
              `Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.\nReason: ${reason}`,
            );
          });
      }
    
      /**
       * Occupies the client with processing and event
       */
       _process(promise) {
    
    build-token's avatar
    build-token committed
        this._numProcessing++;
    
    build-token's avatar
    build-token committed
        void promise.then(
          value => {
    
    build-token's avatar
    build-token committed
            this._numProcessing--;
    
    build-token's avatar
    build-token committed
            return value;
          },
          reason => {
    
    build-token's avatar
    build-token committed
            this._numProcessing--;
    
    build-token's avatar
    build-token committed
    233044 233045 233046 233047 233048 233049 233050 233051 233052 233053 233054 233055 233056 233057 233058 233059 233060 233061 233062 233063 233064 233065 233066 233067 233068 233069 233070 233071 233072 233073 233074 233075 233076 233077 233078 233079 233080 233081 233082 233083 233084 233085 233086 233087 233088 233089 233090 233091 233092 233093 233094 233095 233096 233097 233098 233099 233100 233101 233102 233103 233104 233105 233106 233107 233108 233109 233110 233111 233112 233113 233114 233115 233116 233117 233118 233119 233120 233121 233122 233123 233124 233125 233126 233127 233128 233129 233130 233131 233132 233133 233134 233135 233136 233137 233138 233139 233140 233141 233142 233143 233144 233145 233146 233147 233148 233149 233150 233151 233152 233153 233154 233155 233156 233157 233158 233159 233160 233161 233162 233163 233164 233165 233166 233167 233168 233169 233170 233171 233172 233173 233174 233175 233176 233177 233178 233179 233180 233181 233182 233183 233184 233185 233186 233187 233188 233189 233190 233191 233192 233193 233194 233195 233196 233197 233198 233199 233200 233201 233202 233203 233204 233205 233206 233207 233208 233209 233210 233211 233212 233213 233214 233215 233216 233217 233218 233219 233220 233221 233222 233223 233224 233225 233226 233227 233228 233229 233230 233231 233232 233233 233234 233235 233236 233237 233238 233239 233240 233241 233242 233243 233244 233245 233246 233247 233248 233249 233250 233251 233252 233253 233254 233255 233256 233257 233258 233259 233260 233261 233262 233263 233264 233265 233266 233267 233268 233269 233270 233271 233272 233273 233274 233275 233276 233277 233278 233279 233280 233281 233282 233283 233284 233285 233286 233287 233288 233289 233290 233291 233292 233293 233294 233295 233296 233297 233298 233299 233300 233301 233302 233303 233304 233305 233306 233307 233308 233309 233310 233311 233312 233313 233314 233315 233316 233317 233318 233319 233320 233321 233322 233323 233324 233325 233326 233327 233328 233329 233330 233331 233332 233333 233334 233335 233336 233337 233338 233339 233340 233341 233342 233343 233344 233345 233346 233347 233348 233349 233350 233351 233352 233353 233354 233355 233356 233357 233358 233359 233360 233361 233362 233363 233364 233365 233366 233367 233368 233369 233370 233371 233372 233373 233374 233375 233376 233377 233378 233379 233380 233381 233382 233383 233384 233385 233386 233387 233388 233389 233390 233391 233392 233393 233394 233395 233396 233397 233398 233399 233400 233401 233402 233403 233404 233405 233406 233407 233408 233409 233410 233411 233412 233413 233414 233415 233416 233417 233418 233419 233420 233421 233422 233423 233424 233425 233426 233427 233428 233429 233430 233431 233432 233433 233434 233435 233436 233437 233438 233439 233440 233441 233442 233443 233444 233445 233446 233447 233448 233449 233450 233451 233452 233453 233454 233455 233456 233457 233458 233459 233460 233461 233462 233463 233464 233465 233466 233467 233468 233469 233470 233471 233472 233473 233474 233475 233476 233477 233478 233479 233480 233481 233482 233483 233484 233485 233486 233487 233488 233489 233490 233491 233492 233493 233494 233495 233496 233497 233498 233499 233500 233501 233502 233503 233504 233505 233506 233507 233508 233509 233510 233511 233512 233513 233514 233515 233516 233517 233518 233519 233520 233521 233522 233523 233524 233525 233526 233527 233528 233529 233530 233531 233532 233533 233534 233535 233536 233537 233538 233539 233540 233541 233542 233543 233544 233545 233546 233547 233548 233549 233550 233551 233552 233553 233554 233555 233556 233557 233558 233559 233560 233561 233562 233563 233564 233565 233566 233567 233568 233569 233570 233571 233572 233573 233574 233575 233576 233577 233578 233579 233580 233581 233582 233583 233584 233585 233586 233587 233588 233589 233590 233591 233592 233593 233594 233595 233596 233597 233598 233599 233600 233601 233602 233603 233604 233605 233606 233607 233608 233609 233610 233611 233612 233613 233614 233615 233616 233617 233618 233619 233620 233621 233622 233623 233624 233625 233626 233627 233628 233629 233630 233631 233632 233633 233634 233635 233636 233637 233638 233639 233640 233641 233642 233643 233644 233645 233646 233647 233648 233649 233650 233651 233652 233653 233654 233655 233656 233657 233658 233659 233660 233661 233662 233663 233664 233665 233666 233667 233668 233669 233670 233671 233672 233673 233674 233675 233676 233677 233678 233679 233680 233681 233682 233683 233684 233685 233686 233687 233688 233689 233690 233691 233692 233693 233694 233695 233696 233697 233698 233699 233700 233701 233702 233703 233704 233705 233706 233707 233708 233709 233710 233711 233712 233713 233714 233715 233716 233717 233718 233719 233720 233721 233722 233723 233724 233725 233726 233727 233728 233729 233730 233731 233732 233733 233734 233735 233736 233737 233738 233739 233740 233741 233742 233743 233744 233745 233746 233747 233748 233749 233750 233751 233752 233753 233754 233755 233756 233757 233758 233759 233760 233761 233762 233763 233764 233765 233766 233767 233768 233769 233770 233771 233772 233773 233774 233775 233776 233777 233778 233779 233780 233781 233782 233783 233784 233785 233786 233787 233788 233789 233790 233791 233792 233793 233794 233795 233796 233797 233798 233799 233800 233801 233802 233803 233804 233805 233806 233807 233808 233809 233810 233811 233812 233813 233814 233815 233816 233817 233818 233819 233820 233821 233822 233823 233824 233825 233826 233827 233828 233829 233830 233831 233832 233833 233834 233835 233836 233837 233838 233839 233840 233841 233842 233843 233844 233845 233846 233847 233848 233849 233850 233851 233852 233853 233854 233855 233856 233857 233858 233859 233860 233861 233862 233863 233864 233865 233866 233867 233868 233869 233870 233871 233872 233873 233874 233875 233876 233877 233878 233879 233880 233881 233882 233883 233884 233885 233886 233887 233888 233889 233890 233891 233892 233893 233894 233895 233896 233897 233898 233899 233900 233901 233902 233903 233904 233905 233906 233907 233908 233909 233910 233911 233912 233913 233914 233915 233916 233917 233918 233919 233920 233921 233922 233923 233924 233925 233926 233927 233928 233929 233930 233931 233932 233933 233934 233935 233936 233937 233938 233939 233940 233941 233942 233943 233944 233945 233946 233947 233948 233949 233950 233951 233952 233953 233954 233955 233956 233957 233958 233959 233960 233961 233962 233963 233964 233965 233966 233967 233968 233969 233970 233971 233972 233973 233974 233975 233976 233977 233978 233979 233980 233981 233982 233983 233984 233985 233986 233987 233988 233989 233990 233991 233992 233993 233994 233995 233996 233997 233998 233999 234000
            return reason;
          },
        );
      }
    
      /**
       * @inheritdoc
       */
       _sendEnvelope(envelope) {
        if (this._transport && this._dsn) {
          this._transport.send(envelope).then(null, reason => {
            (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && _sentry_utils__WEBPACK_IMPORTED_MODULE_2__.logger.error('Error while sending event:', reason);
          });
        } else {
          (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && _sentry_utils__WEBPACK_IMPORTED_MODULE_2__.logger.error('Transport disabled');
        }
      }
    
      /**
       * Clears outcomes on this client and returns them.
       */
       _clearOutcomes() {
        const outcomes = this._outcomes;
        this._outcomes = {};
        return Object.keys(outcomes).map(key => {
          const [reason, category] = key.split(':') ;
          return {
            reason,
            category,
            quantity: outcomes[key],
          };
        });
      }
    
      /**
       * @inheritDoc
       */
      // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
    
    }
    
    /**
     * Verifies that return value of configured `beforeSend` or `beforeSendTransaction` is of expected type, and returns the value if so.
     */
    function _validateBeforeSendResult(
      beforeSendResult,
      beforeSendProcessorName,
    ) {
      const invalidValueError = `\`${beforeSendProcessorName}\` must return \`null\` or a valid event.`;
      if ((0,_sentry_utils__WEBPACK_IMPORTED_MODULE_4__.isThenable)(beforeSendResult)) {
        return beforeSendResult.then(
          event => {
            if (!(0,_sentry_utils__WEBPACK_IMPORTED_MODULE_4__.isPlainObject)(event) && event !== null) {
              throw new _sentry_utils__WEBPACK_IMPORTED_MODULE_14__.SentryError(invalidValueError);
            }
            return event;
          },
          e => {
            throw new _sentry_utils__WEBPACK_IMPORTED_MODULE_14__.SentryError(`\`${beforeSendProcessorName}\` rejected with ${e}`);
          },
        );
      } else if (!(0,_sentry_utils__WEBPACK_IMPORTED_MODULE_4__.isPlainObject)(beforeSendResult) && beforeSendResult !== null) {
        throw new _sentry_utils__WEBPACK_IMPORTED_MODULE_14__.SentryError(invalidValueError);
      }
      return beforeSendResult;
    }
    
    
    //# sourceMappingURL=baseclient.js.map
    
    
    /***/ }),
    /* 1630 */
    /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
    
    "use strict";
    __webpack_require__.r(__webpack_exports__);
    /* harmony export */ __webpack_require__.d(__webpack_exports__, {
    /* harmony export */   "dsnFromString": () => (/* binding */ dsnFromString),
    /* harmony export */   "dsnToString": () => (/* binding */ dsnToString),
    /* harmony export */   "makeDsn": () => (/* binding */ makeDsn)
    /* harmony export */ });
    /* harmony import */ var _error_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1620);
    
    
    /** Regular expression used to parse a Dsn. */
    const DSN_REGEX = /^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;
    
    function isValidProtocol(protocol) {
      return protocol === 'http' || protocol === 'https';
    }
    
    /**
     * Renders the string representation of this Dsn.
     *
     * By default, this will render the public representation without the password
     * component. To get the deprecated private representation, set `withPassword`
     * to true.
     *
     * @param withPassword When set to true, the password will be included.
     */
    function dsnToString(dsn, withPassword = false) {
      const { host, path, pass, port, projectId, protocol, publicKey } = dsn;
      return (
        `${protocol}://${publicKey}${withPassword && pass ? `:${pass}` : ''}` +
        `@${host}${port ? `:${port}` : ''}/${path ? `${path}/` : path}${projectId}`
      );
    }
    
    /**
     * Parses a Dsn from a given string.
     *
     * @param str A Dsn as string
     * @returns Dsn as DsnComponents
     */
    function dsnFromString(str) {
      const match = DSN_REGEX.exec(str);
    
      if (!match) {
        throw new _error_js__WEBPACK_IMPORTED_MODULE_0__.SentryError(`Invalid Sentry Dsn: ${str}`);
      }
    
      const [protocol, publicKey, pass = '', host, port = '', lastPath] = match.slice(1);
      let path = '';
      let projectId = lastPath;
    
      const split = projectId.split('/');
      if (split.length > 1) {
        path = split.slice(0, -1).join('/');
        projectId = split.pop() ;
      }
    
      if (projectId) {
        const projectMatch = projectId.match(/^\d+/);
        if (projectMatch) {
          projectId = projectMatch[0];
        }
      }
    
      return dsnFromComponents({ host, pass, path, projectId, port, protocol: protocol , publicKey });
    }
    
    function dsnFromComponents(components) {
      return {
        protocol: components.protocol,
        publicKey: components.publicKey || '',
        pass: components.pass || '',
        host: components.host,
        port: components.port || '',
        path: components.path || '',
        projectId: components.projectId,
      };
    }
    
    function validateDsn(dsn) {
      if (!(typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__)) {
        return;
      }
    
      const { port, projectId, protocol } = dsn;
    
      const requiredComponents = ['protocol', 'publicKey', 'host', 'projectId'];
      requiredComponents.forEach(component => {
        if (!dsn[component]) {
          throw new _error_js__WEBPACK_IMPORTED_MODULE_0__.SentryError(`Invalid Sentry Dsn: ${component} missing`);
        }
      });
    
      if (!projectId.match(/^\d+$/)) {
        throw new _error_js__WEBPACK_IMPORTED_MODULE_0__.SentryError(`Invalid Sentry Dsn: Invalid projectId ${projectId}`);
      }
    
      if (!isValidProtocol(protocol)) {
        throw new _error_js__WEBPACK_IMPORTED_MODULE_0__.SentryError(`Invalid Sentry Dsn: Invalid protocol ${protocol}`);
      }
    
      if (port && isNaN(parseInt(port, 10))) {
        throw new _error_js__WEBPACK_IMPORTED_MODULE_0__.SentryError(`Invalid Sentry Dsn: Invalid port ${port}`);
      }
    
      return true;
    }
    
    /** The Sentry Dsn, identifying a Sentry instance and project. */
    function makeDsn(from) {
      const components = typeof from === 'string' ? dsnFromString(from) : dsnFromComponents(from);
      validateDsn(components);
      return components;
    }
    
    
    //# sourceMappingURL=dsn.js.map
    
    
    /***/ }),
    /* 1631 */
    /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
    
    "use strict";
    __webpack_require__.r(__webpack_exports__);
    /* harmony export */ __webpack_require__.d(__webpack_exports__, {
    /* harmony export */   "getEnvelopeEndpointWithUrlEncodedAuth": () => (/* binding */ getEnvelopeEndpointWithUrlEncodedAuth),
    /* harmony export */   "getReportDialogEndpoint": () => (/* binding */ getReportDialogEndpoint)
    /* harmony export */ });
    /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1612);
    /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1630);
    
    
    const SENTRY_API_VERSION = '7';
    
    /** Returns the prefix to construct Sentry ingestion API endpoints. */
    function getBaseApiEndpoint(dsn) {
      const protocol = dsn.protocol ? `${dsn.protocol}:` : '';
      const port = dsn.port ? `:${dsn.port}` : '';
      return `${protocol}//${dsn.host}${port}${dsn.path ? `/${dsn.path}` : ''}/api/`;
    }
    
    /** Returns the ingest API endpoint for target. */
    function _getIngestEndpoint(dsn) {
      return `${getBaseApiEndpoint(dsn)}${dsn.projectId}/envelope/`;
    }
    
    /** Returns a URL-encoded string with auth config suitable for a query string. */
    function _encodedAuth(dsn, sdkInfo) {
      return (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_0__.urlEncode)({
        // We send only the minimum set of required information. See
        // https://github.com/getsentry/sentry-javascript/issues/2572.
        sentry_key: dsn.publicKey,
        sentry_version: SENTRY_API_VERSION,
        ...(sdkInfo && { sentry_client: `${sdkInfo.name}/${sdkInfo.version}` }),
      });
    }
    
    /**
     * Returns the envelope endpoint URL with auth in the query string.
     *
     * Sending auth as part of the query string and not as custom HTTP headers avoids CORS preflight requests.
     */
    function getEnvelopeEndpointWithUrlEncodedAuth(
      dsn,
      // TODO (v8): Remove `tunnelOrOptions` in favor of `options`, and use the substitute code below
      // options: ClientOptions = {} as ClientOptions,
      tunnelOrOptions = {} ,
    ) {
      // TODO (v8): Use this code instead
      // const { tunnel, _metadata = {} } = options;
      // return tunnel ? tunnel : `${_getIngestEndpoint(dsn)}?${_encodedAuth(dsn, _metadata.sdk)}`;
    
      const tunnel = typeof tunnelOrOptions === 'string' ? tunnelOrOptions : tunnelOrOptions.tunnel;
      const sdkInfo =
        typeof tunnelOrOptions === 'string' || !tunnelOrOptions._metadata ? undefined : tunnelOrOptions._metadata.sdk;
    
      return tunnel ? tunnel : `${_getIngestEndpoint(dsn)}?${_encodedAuth(dsn, sdkInfo)}`;
    }
    
    /** Returns the url to the report dialog endpoint. */
    function getReportDialogEndpoint(
      dsnLike,
      dialogOptions
    
    ,
    ) {
      const dsn = (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_1__.makeDsn)(dsnLike);
      const endpoint = `${getBaseApiEndpoint(dsn)}embed/error-page/`;
    
      let encodedOptions = `dsn=${(0,_sentry_utils__WEBPACK_IMPORTED_MODULE_1__.dsnToString)(dsn)}`;
      for (const key in dialogOptions) {
        if (key === 'dsn') {
          continue;
        }
    
        if (key === 'user') {
          const user = dialogOptions.user;
          if (!user) {
            continue;
          }
          if (user.name) {
            encodedOptions += `&name=${encodeURIComponent(user.name)}`;
          }
          if (user.email) {
            encodedOptions += `&email=${encodeURIComponent(user.email)}`;
          }
        } else {
          encodedOptions += `&${encodeURIComponent(key)}=${encodeURIComponent(dialogOptions[key] )}`;
        }
      }
    
      return `${endpoint}?${encodedOptions}`;
    }
    
    
    //# sourceMappingURL=api.js.map
    
    
    /***/ }),
    /* 1632 */
    /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
    
    "use strict";
    __webpack_require__.r(__webpack_exports__);
    /* harmony export */ __webpack_require__.d(__webpack_exports__, {
    /* harmony export */   "getIntegrationsToSetup": () => (/* binding */ getIntegrationsToSetup),
    /* harmony export */   "installedIntegrations": () => (/* binding */ installedIntegrations),
    /* harmony export */   "setupIntegrations": () => (/* binding */ setupIntegrations)
    /* harmony export */ });
    /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1609);
    /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(1615);
    /* harmony import */ var _hub_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1602);
    /* harmony import */ var _scope_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1603);
    
    
    
    
    const installedIntegrations = [];
    
    /** Map of integrations assigned to a client */
    
    /**
     * Remove duplicates from the given array, preferring the last instance of any duplicate. Not guaranteed to
     * preseve the order of integrations in the array.
     *
     * @private
     */
    function filterDuplicates(integrations) {
      const integrationsByName = {};
    
      integrations.forEach(currentInstance => {
        const { name } = currentInstance;
    
        const existingInstance = integrationsByName[name];
    
        // We want integrations later in the array to overwrite earlier ones of the same type, except that we never want a
        // default instance to overwrite an existing user instance
        if (existingInstance && !existingInstance.isDefaultInstance && currentInstance.isDefaultInstance) {
          return;
        }
    
        integrationsByName[name] = currentInstance;
      });
    
      return Object.values(integrationsByName);
    }
    
    /** Gets integrations to install */
    function getIntegrationsToSetup(options) {
      const defaultIntegrations = options.defaultIntegrations || [];
      const userIntegrations = options.integrations;
    
      // We flag default instances, so that later we can tell them apart from any user-created instances of the same class
      defaultIntegrations.forEach(integration => {
        integration.isDefaultInstance = true;
      });
    
      let integrations;
    
      if (Array.isArray(userIntegrations)) {
        integrations = [...defaultIntegrations, ...userIntegrations];
      } else if (typeof userIntegrations === 'function') {
        integrations = (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_0__.arrayify)(userIntegrations(defaultIntegrations));
      } else {
        integrations = defaultIntegrations;
      }
    
      const finalIntegrations = filterDuplicates(integrations);
    
      // The `Debug` integration prints copies of the `event` and `hint` which will be passed to `beforeSend` or
      // `beforeSendTransaction`. It therefore has to run after all other integrations, so that the changes of all event
      // processors will be reflected in the printed values. For lack of a more elegant way to guarantee that, we therefore
      // locate it and, assuming it exists, pop it out of its current spot and shove it onto the end of the array.
      const debugIndex = finalIntegrations.findIndex(integration => integration.name === 'Debug');
      if (debugIndex !== -1) {
        const [debugInstance] = finalIntegrations.splice(debugIndex, 1);
        finalIntegrations.push(debugInstance);
      }
    
      return finalIntegrations;
    }
    
    /**
     * Given a list of integration instances this installs them all. When `withDefaults` is set to `true` then all default
     * integrations are added unless they were already provided before.
     * @param integrations array of integration instances
     * @param withDefault should enable default integrations
     */
    function setupIntegrations(integrations) {
      const integrationIndex = {};
    
      integrations.forEach(integration => {
        integrationIndex[integration.name] = integration;
    
        if (installedIntegrations.indexOf(integration.name) === -1) {
          integration.setupOnce(_scope_js__WEBPACK_IMPORTED_MODULE_1__.addGlobalEventProcessor, _hub_js__WEBPACK_IMPORTED_MODULE_2__.getCurrentHub);
          installedIntegrations.push(integration.name);
          (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && _sentry_utils__WEBPACK_IMPORTED_MODULE_3__.logger.log(`Integration installed: ${integration.name}`);
        }
      });
    
      return integrationIndex;
    }
    
    
    //# sourceMappingURL=integration.js.map
    
    
    /***/ }),
    /* 1633 */
    /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
    
    "use strict";
    __webpack_require__.r(__webpack_exports__);
    /* harmony export */ __webpack_require__.d(__webpack_exports__, {
    /* harmony export */   "createEventEnvelope": () => (/* binding */ createEventEnvelope),
    /* harmony export */   "createSessionEnvelope": () => (/* binding */ createSessionEnvelope)
    /* harmony export */ });
    /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1630);
    /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1621);
    /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1612);
    
    
    /** Extract sdk info from from the API metadata */
    function getSdkMetadataForEnvelopeHeader(metadata) {
      if (!metadata || !metadata.sdk) {
        return;
      }
      const { name, version } = metadata.sdk;
      return { name, version };
    }
    
    /**
     * Apply SdkInfo (name, version, packages, integrations) to the corresponding event key.
     * Merge with existing data if any.
     **/
    function enhanceEventWithSdkInfo(event, sdkInfo) {
      if (!sdkInfo) {
        return event;
      }
      event.sdk = event.sdk || {};
      event.sdk.name = event.sdk.name || sdkInfo.name;
      event.sdk.version = event.sdk.version || sdkInfo.version;
      event.sdk.integrations = [...(event.sdk.integrations || []), ...(sdkInfo.integrations || [])];
      event.sdk.packages = [...(event.sdk.packages || []), ...(sdkInfo.packages || [])];
      return event;
    }
    
    /** Creates an envelope from a Session */
    function createSessionEnvelope(
      session,
      dsn,
      metadata,
      tunnel,
    ) {
      const sdkInfo = getSdkMetadataForEnvelopeHeader(metadata);
      const envelopeHeaders = {
        sent_at: new Date().toISOString(),
        ...(sdkInfo && { sdk: sdkInfo }),
        ...(!!tunnel && { dsn: (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_0__.dsnToString)(dsn) }),
      };
    
      const envelopeItem =
        'aggregates' in session ? [{ type: 'sessions' }, session] : [{ type: 'session' }, session];
    
      return (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_1__.createEnvelope)(envelopeHeaders, [envelopeItem]);
    }
    
    /**
     * Create an Envelope from an event.
     */
    function createEventEnvelope(
      event,
      dsn,
      metadata,
      tunnel,
    ) {
      const sdkInfo = getSdkMetadataForEnvelopeHeader(metadata);
      const eventType = event.type || 'event';
    
      enhanceEventWithSdkInfo(event, metadata && metadata.sdk);
    
      const envelopeHeaders = createEventEnvelopeHeaders(event, sdkInfo, tunnel, dsn);
    
      // Prevent this data (which, if it exists, was used in earlier steps in the processing pipeline) from being sent to
      // sentry. (Note: Our use of this property comes and goes with whatever we might be debugging, whatever hacks we may
      // have temporarily added, etc. Even if we don't happen to be using it at some point in the future, let's not get rid
      // of this `delete`, lest we miss putting it back in the next time the property is in use.)
      delete event.sdkProcessingMetadata;
    
      const eventItem = [{ type: eventType }, event];
      return (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_1__.createEnvelope)(envelopeHeaders, [eventItem]);
    }
    
    function createEventEnvelopeHeaders(
      event,
      sdkInfo,
      tunnel,
      dsn,
    ) {
      const dynamicSamplingContext = event.sdkProcessingMetadata && event.sdkProcessingMetadata.dynamicSamplingContext;
    
      return {
        event_id: event.event_id ,
        sent_at: new Date().toISOString(),
        ...(sdkInfo && { sdk: sdkInfo }),
        ...(!!tunnel && { dsn: (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_0__.dsnToString)(dsn) }),
        ...(event.type === 'transaction' &&
          dynamicSamplingContext && {
            trace: (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_2__.dropUndefinedKeys)({ ...dynamicSamplingContext }),
          }),
      };
    }
    
    
    //# sourceMappingURL=envelope.js.map
    
    
    /***/ }),
    /* 1634 */
    /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
    
    "use strict";
    __webpack_require__.r(__webpack_exports__);
    /* harmony export */ __webpack_require__.d(__webpack_exports__, {
    /* harmony export */   "SessionFlusher": () => (/* binding */ SessionFlusher)
    /* harmony export */ });
    /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1612);
    /* harmony import */ var _hub_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1602);
    
    
    
    /**
     * @inheritdoc
     */
    class SessionFlusher  {
        __init() {this.flushTimeout = 60;}
       __init2() {this._pendingAggregates = {};}
    
       __init3() {this._isEnabled = true;}
    
       constructor(client, attrs) {;SessionFlusher.prototype.__init.call(this);SessionFlusher.prototype.__init2.call(this);SessionFlusher.prototype.__init3.call(this);
        this._client = client;
        // Call to setInterval, so that flush is called every 60 seconds
        this._intervalId = setInterval(() => this.flush(), this.flushTimeout * 1000);
        this._sessionAttrs = attrs;
      }
    
      /** Checks if `pendingAggregates` has entries, and if it does flushes them by calling `sendSession` */
       flush() {
        const sessionAggregates = this.getSessionAggregates();
        if (sessionAggregates.aggregates.length === 0) {
          return;
        }
        this._pendingAggregates = {};
        this._client.sendSession(sessionAggregates);
      }
    
      /** Massages the entries in `pendingAggregates` and returns aggregated sessions */
       getSessionAggregates() {
        const aggregates = Object.keys(this._pendingAggregates).map((key) => {
          return this._pendingAggregates[parseInt(key)];
        });
    
        const sessionAggregates = {
          attrs: this._sessionAttrs,
          aggregates,
        };
        return (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_0__.dropUndefinedKeys)(sessionAggregates);
      }
    
      /** JSDoc */
       close() {
        clearInterval(this._intervalId);
        this._isEnabled = false;
        this.flush();
      }
    
      /**
       * Wrapper function for _incrementSessionStatusCount that checks if the instance of SessionFlusher is enabled then
       * fetches the session status of the request from `Scope.getRequestSession().status` on the scope and passes them to
       * `_incrementSessionStatusCount` along with the start date
       */
       incrementSessionStatusCount() {
        if (!this._isEnabled) {
          return;
        }
        const scope = (0,_hub_js__WEBPACK_IMPORTED_MODULE_1__.getCurrentHub)().getScope();
        const requestSession = scope && scope.getRequestSession();
    
        if (requestSession && requestSession.status) {
          this._incrementSessionStatusCount(requestSession.status, new Date());
          // This is not entirely necessarily but is added as a safe guard to indicate the bounds of a request and so in
          // case captureRequestSession is called more than once to prevent double count
          if (scope) {
            scope.setRequestSession(undefined);
          }
          /* eslint-enable @typescript-eslint/no-unsafe-member-access */
        }
      }
    
      /**
       * Increments status bucket in pendingAggregates buffer (internal state) corresponding to status of
       * the session received
       */
       _incrementSessionStatusCount(status, date) {
        // Truncate minutes and seconds on Session Started attribute to have one minute bucket keys
        const sessionStartedTrunc = new Date(date).setSeconds(0, 0);
        this._pendingAggregates[sessionStartedTrunc] = this._pendingAggregates[sessionStartedTrunc] || {};
    
        // corresponds to aggregated sessions in one specific minute bucket
        // for example, {"started":"2021-03-16T08:00:00.000Z","exited":4, "errored": 1}
        const aggregationCounts = this._pendingAggregates[sessionStartedTrunc];
        if (!aggregationCounts.started) {
          aggregationCounts.started = new Date(sessionStartedTrunc).toISOString();
        }
    
        switch (status) {
          case 'errored':
            aggregationCounts.errored = (aggregationCounts.errored || 0) + 1;
            return aggregationCounts.errored;
          case 'ok':
            aggregationCounts.exited = (aggregationCounts.exited || 0) + 1;
            return aggregationCounts.exited;
          default:
            aggregationCounts.crashed = (aggregationCounts.crashed || 0) + 1;
            return aggregationCounts.crashed;
        }
      }
    }
    
    
    //# sourceMappingURL=sessionflusher.js.map
    
    
    /***/ }),
    /* 1635 */
    /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
    
    "use strict";
    __webpack_require__.r(__webpack_exports__);
    /* harmony export */ __webpack_require__.d(__webpack_exports__, {
    /* harmony export */   "makeNodeTransport": () => (/* reexport safe */ _http_js__WEBPACK_IMPORTED_MODULE_0__.makeNodeTransport)
    /* harmony export */ });
    /* harmony import */ var _http_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1636);
    
    
    ;
    //# sourceMappingURL=index.js.map
    
    
    /***/ }),
    /* 1636 */
    /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
    
    "use strict";
    __webpack_require__.r(__webpack_exports__);
    /* harmony export */ __webpack_require__.d(__webpack_exports__, {
    /* harmony export */   "makeNodeTransport": () => (/* binding */ makeNodeTransport)
    /* harmony export */ });
    /* harmony import */ var _sentry_utils_esm_buildPolyfills__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(1650);
    /* harmony import */ var _sentry_core__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(1618);
    /* harmony import */ var http__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(80);
    /* harmony import */ var http__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(http__WEBPACK_IMPORTED_MODULE_0__);
    /* harmony import */ var https__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(81);
    /* harmony import */ var https__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(https__WEBPACK_IMPORTED_MODULE_1__);
    /* harmony import */ var stream__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(82);
    /* harmony import */ var stream__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(stream__WEBPACK_IMPORTED_MODULE_2__);
    /* harmony import */ var url__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(63);
    /* harmony import */ var url__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(url__WEBPACK_IMPORTED_MODULE_3__);
    /* harmony import */ var zlib__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(83);
    /* harmony import */ var zlib__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(zlib__WEBPACK_IMPORTED_MODULE_4__);
    
    
    
    
    
    
    
    
    // Estimated maximum size for reasonable standalone event
    const GZIP_THRESHOLD = 1024 * 32;
    
    /**
     * Gets a stream from a Uint8Array or string
     * Readable.from is ideal but was added in node.js v12.3.0 and v10.17.0
     */
    function streamFromBody(body) {
      return new stream__WEBPACK_IMPORTED_MODULE_2__.Readable({
        read() {
          this.push(body);
          this.push(null);
        },
      });
    }
    
    /**
     * Creates a Transport that uses native the native 'http' and 'https' modules to send events to Sentry.
     */
    function makeNodeTransport(options) {
      const urlSegments = new url__WEBPACK_IMPORTED_MODULE_3__.URL(options.url);
      const isHttps = urlSegments.protocol === 'https:';
    
      // Proxy prioritization: http => `options.proxy` | `process.env.http_proxy`
      // Proxy prioritization: https => `options.proxy` | `process.env.https_proxy` | `process.env.http_proxy`
      const proxy = applyNoProxyOption(
        urlSegments,
        options.proxy || (isHttps ? process.env.https_proxy : undefined) || process.env.http_proxy,
      );
    
      const nativeHttpModule = isHttps ? https__WEBPACK_IMPORTED_MODULE_1__ : http__WEBPACK_IMPORTED_MODULE_0__;
      const keepAlive = options.keepAlive === undefined ? false : options.keepAlive;
    
      // TODO(v7): Evaluate if we can set keepAlive to true. This would involve testing for memory leaks in older node
      // versions(>= 8) as they had memory leaks when using it: #2555
      const agent = proxy
        ? (new (__webpack_require__(1637))(proxy) )
        : new nativeHttpModule.Agent({ keepAlive, maxSockets: 30, timeout: 2000 });
    
      const requestExecutor = createRequestExecutor(options, (0,_sentry_utils_esm_buildPolyfills__WEBPACK_IMPORTED_MODULE_5__._nullishCoalesce)(options.httpModule, () => ( nativeHttpModule)), agent);
      return (0,_sentry_core__WEBPACK_IMPORTED_MODULE_6__.createTransport)(options, requestExecutor);
    }
    
    /**
     * Honors the `no_proxy` env variable with the highest priority to allow for hosts exclusion.
     *
     * @param transportUrl The URL the transport intends to send events to.
     * @param proxy The client configured proxy.
     * @returns A proxy the transport should use.
     */
    function applyNoProxyOption(transportUrlSegments, proxy) {
      const { no_proxy } = process.env;
    
      const urlIsExemptFromProxy =
        no_proxy &&
        no_proxy
          .split(',')
          .some(
            exemption => transportUrlSegments.host.endsWith(exemption) || transportUrlSegments.hostname.endsWith(exemption),
          );
    
      if (urlIsExemptFromProxy) {
        return undefined;
      } else {
        return proxy;
      }
    }
    
    /**
     * Creates a RequestExecutor to be used with `createTransport`.
     */
    function createRequestExecutor(
      options,
      httpModule,
      agent,
    ) {
      const { hostname, pathname, port, protocol, search } = new url__WEBPACK_IMPORTED_MODULE_3__.URL(options.url);
      return function makeRequest(request) {
        return new Promise((resolve, reject) => {
          let body = streamFromBody(request.body);
    
          const headers = { ...options.headers };
    
          if (request.body.length > GZIP_THRESHOLD) {
            headers['content-encoding'] = 'gzip';
            body = body.pipe((0,zlib__WEBPACK_IMPORTED_MODULE_4__.createGzip)());
          }
    
          const req = httpModule.request(
            {
              method: 'POST',
              agent,
              headers,
              hostname,
              path: `${pathname}${search}`,
              port,
              protocol,
              ca: options.caCerts,
            },
            res => {
              res.on('data', () => {
                // Drain socket
              });
    
              res.on('end', () => {
                // Drain socket
              });
    
              res.setEncoding('utf8');
    
              // "Key-value pairs of header names and values. Header names are lower-cased."
              // https://nodejs.org/api/http.html#http_message_headers
              const retryAfterHeader = (0,_sentry_utils_esm_buildPolyfills__WEBPACK_IMPORTED_MODULE_5__._nullishCoalesce)(res.headers['retry-after'], () => ( null));
              const rateLimitsHeader = (0,_sentry_utils_esm_buildPolyfills__WEBPACK_IMPORTED_MODULE_5__._nullishCoalesce)(res.headers['x-sentry-rate-limits'], () => ( null));
    
              resolve({
                statusCode: res.statusCode,
                headers: {
                  'retry-after': retryAfterHeader,
                  'x-sentry-rate-limits': Array.isArray(rateLimitsHeader) ? rateLimitsHeader[0] : rateLimitsHeader,
                },
              });
            },
          );
    
          req.on('error', reject);
          body.pipe(req);
        });
      };
    }
    
    
    //# sourceMappingURL=http.js.map
    
    
    /***/ }),
    /* 1637 */
    /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
    
    "use strict";
    
    var __importDefault = (this && this.__importDefault) || function (mod) {
        return (mod && mod.__esModule) ? mod : { "default": mod };
    };
    const agent_1 = __importDefault(__webpack_require__(1638));
    function createHttpsProxyAgent(opts) {
        return new agent_1.default(opts);
    }
    (function (createHttpsProxyAgent) {
        createHttpsProxyAgent.HttpsProxyAgent = agent_1.default;
        createHttpsProxyAgent.prototype = agent_1.default.prototype;
    })(createHttpsProxyAgent || (createHttpsProxyAgent = {}));
    module.exports = createHttpsProxyAgent;
    //# sourceMappingURL=index.js.map
    
    /***/ }),
    /* 1638 */
    /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
    
    "use strict";
    
    var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
        function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
        return new (P || (P = Promise))(function (resolve, reject) {
            function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
            function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
            function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
            step((generator = generator.apply(thisArg, _arguments || [])).next());
        });
    };
    var __importDefault = (this && this.__importDefault) || function (mod) {
        return (mod && mod.__esModule) ? mod : { "default": mod };
    };
    Object.defineProperty(exports, "__esModule", ({ value: true }));
    const net_1 = __importDefault(__webpack_require__(62));
    const tls_1 = __importDefault(__webpack_require__(145));
    const url_1 = __importDefault(__webpack_require__(63));
    const assert_1 = __importDefault(__webpack_require__(91));
    const debug_1 = __importDefault(__webpack_require__(1639));
    const agent_base_1 = __webpack_require__(1643);
    const parse_proxy_response_1 = __importDefault(__webpack_require__(1649));
    const debug = debug_1.default('https-proxy-agent:agent');
    /**
     * The `HttpsProxyAgent` implements an HTTP Agent subclass that connects to
     * the specified "HTTP(s) proxy server" in order to proxy HTTPS requests.
     *
     * Outgoing HTTP requests are first tunneled through the proxy server using the
     * `CONNECT` HTTP request method to establish a connection to the proxy server,
     * and then the proxy server connects to the destination target and issues the
     * HTTP request from the proxy server.
     *
     * `https:` requests have their socket connection upgraded to TLS once
     * the connection to the proxy server has been established.
     *
     * @api public
     */
    class HttpsProxyAgent extends agent_base_1.Agent {
        constructor(_opts) {
            let opts;
            if (typeof _opts === 'string') {
                opts = url_1.default.parse(_opts);
            }
            else {
                opts = _opts;
            }
            if (!opts) {
                throw new Error('an HTTP(S) proxy server `host` and `port` must be specified!');
            }
            debug('creating new HttpsProxyAgent instance: %o', opts);
            super(opts);
            const proxy = Object.assign({}, opts);
            // If `true`, then connect to the proxy server over TLS.
            // Defaults to `false`.
            this.secureProxy = opts.secureProxy || isHTTPS(proxy.protocol);
            // Prefer `hostname` over `host`, and set the `port` if needed.
            proxy.host = proxy.hostname || proxy.host;
            if (typeof proxy.port === 'string') {
                proxy.port = parseInt(proxy.port, 10);
            }
            if (!proxy.port && proxy.host) {
                proxy.port = this.secureProxy ? 443 : 80;
            }
            // ALPN is supported by Node.js >= v5.
            // attempt to negotiate http/1.1 for proxy servers that support http/2
            if (this.secureProxy && !('ALPNProtocols' in proxy)) {
                proxy.ALPNProtocols = ['http 1.1'];
            }
            if (proxy.host && proxy.path) {
                // If both a `host` and `path` are specified then it's most likely
                // the result of a `url.parse()` call... we need to remove the
                // `path` portion so that `net.connect()` doesn't attempt to open
                // that as a Unix socket file.
                delete proxy.path;
                delete proxy.pathname;
            }
            this.proxy = proxy;
        }
        /**
         * Called when the node-core HTTP client library is creating a
         * new HTTP request.
         *
         * @api protected
         */
        callback(req, opts) {
            return __awaiter(this, void 0, void 0, function* () {
                const { proxy, secureProxy } = this;
                // Create a socket connection to the proxy server.
                let socket;
                if (secureProxy) {
                    debug('Creating `tls.Socket`: %o', proxy);
                    socket = tls_1.default.connect(proxy);
                }
                else {
                    debug('Creating `net.Socket`: %o', proxy);
                    socket = net_1.default.connect(proxy);
                }
                const headers = Object.assign({}, proxy.headers);
                const hostname = `${opts.host}:${opts.port}`;
                let payload = `CONNECT ${hostname} HTTP/1.1\r\n`;
                // Inject the `Proxy-Authorization` header if necessary.
                if (proxy.auth) {
                    headers['Proxy-Authorization'] = `Basic ${Buffer.from(proxy.auth).toString('base64')}`;
                }
                // The `Host` header should only include the port
                // number when it is not the default port.
                let { host, port, secureEndpoint } = opts;
                if (!isDefaultPort(port, secureEndpoint)) {
                    host += `:${port}`;
                }
                headers.Host = host;
                headers.Connection = 'close';
                for (const name of Object.keys(headers)) {
                    payload += `${name}: ${headers[name]}\r\n`;
                }
                const proxyResponsePromise = parse_proxy_response_1.default(socket);
                socket.write(`${payload}\r\n`);
                const { statusCode, buffered } = yield proxyResponsePromise;
                if (statusCode === 200) {
                    req.once('socket', resume);
                    if (opts.secureEndpoint) {
                        // The proxy is connecting to a TLS server, so upgrade