Skip to content
Snippets Groups Projects
index.js 8.75 MiB
Newer Older
  • Learn to ignore specific revisions
  • Romain CREY's avatar
    Romain CREY committed
      }
    
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    /***/ }),
    
    Romain CREY's avatar
    Romain CREY committed
    /***/ (function(module, exports, __webpack_require__) {
    
    "use strict";
    
    /*!
     * cookie
     * Copyright(c) 2012-2014 Roman Shtylman
     * Copyright(c) 2015 Douglas Christopher Wilson
     * MIT Licensed
     */
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    exports.parse = parse;
    exports.serialize = serialize;
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    /**
     * Module variables.
     * @private
     */
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    var decode = decodeURIComponent;
    var encode = encodeURIComponent;
    var pairSplitRegExp = /; */;
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    /**
     * RegExp to match field-content in RFC 7230 sec 3.2
     *
     * field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ]
     * field-vchar   = VCHAR / obs-text
     * obs-text      = %x80-FF
     */
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    var fieldContentRegExp = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    /**
     * Parse a cookie header.
     *
     * Parse the given cookie header string into an object
     * The object has the various cookies as keys(names) => values
     *
     * @param {string} str
     * @param {object} [options]
     * @return {object}
     * @public
     */
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    function parse(str, options) {
      if (typeof str !== 'string') {
        throw new TypeError('argument str must be a string');
    
    Romain CREY's avatar
    Romain CREY committed
      }
    
    
      var obj = {}
      var opt = options || {};
      var pairs = str.split(pairSplitRegExp);
      var dec = opt.decode || decode;
    
    Romain CREY's avatar
    Romain CREY committed
    
    
      for (var i = 0; i < pairs.length; i++) {
        var pair = pairs[i];
        var eq_idx = pair.indexOf('=');
    
    Romain CREY's avatar
    Romain CREY committed
    
    
        // skip things that don't look like key=value
        if (eq_idx < 0) {
          continue;
        }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
        var key = pair.substr(0, eq_idx).trim()
        var val = pair.substr(++eq_idx, pair.length).trim();
    
    Romain CREY's avatar
    Romain CREY committed
    
    
        // quoted values
        if ('"' == val[0]) {
          val = val.slice(1, -1);
        }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
        // only assign once
        if (undefined == obj[key]) {
          obj[key] = tryDecode(val, dec);
        }
    
    Romain CREY's avatar
    Romain CREY committed
      }
    
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    /**
     * Serialize data into a cookie header.
     *
     * Serialize the a name value pair into a cookie string suitable for
     * http headers. An optional options object specified cookie parameters.
     *
     * serialize('foo', 'bar', { httpOnly: true })
     *   => "foo=bar; httpOnly"
     *
     * @param {string} name
     * @param {string} val
     * @param {object} [options]
     * @return {string}
     * @public
     */
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    function serialize(name, val, options) {
      var opt = options || {};
      var enc = opt.encode || encode;
    
    Romain CREY's avatar
    Romain CREY committed
    
    
      if (typeof enc !== 'function') {
        throw new TypeError('option encode is invalid');
    
    Romain CREY's avatar
    Romain CREY committed
      }
    
    
      if (!fieldContentRegExp.test(name)) {
        throw new TypeError('argument name is invalid');
      }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
      var value = enc(val);
    
    Romain CREY's avatar
    Romain CREY committed
    
    
      if (value && !fieldContentRegExp.test(value)) {
        throw new TypeError('argument val is invalid');
    
    Romain CREY's avatar
    Romain CREY committed
      }
    
    
      var str = name + '=' + value;
    
    Romain CREY's avatar
    Romain CREY committed
    
    
      if (null != opt.maxAge) {
        var maxAge = opt.maxAge - 0;
        if (isNaN(maxAge)) throw new Error('maxAge should be a Number');
        str += '; Max-Age=' + Math.floor(maxAge);
      }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
      if (opt.domain) {
        if (!fieldContentRegExp.test(opt.domain)) {
          throw new TypeError('option domain is invalid');
    
    Romain CREY's avatar
    Romain CREY committed
        }
    
    
        str += '; Domain=' + opt.domain;
    
    Romain CREY's avatar
    Romain CREY committed
      }
    
    
      if (opt.path) {
        if (!fieldContentRegExp.test(opt.path)) {
          throw new TypeError('option path is invalid');
    
    Romain CREY's avatar
    Romain CREY committed
        }
    
    
        str += '; Path=' + opt.path;
      }
    
      if (opt.expires) {
        if (typeof opt.expires.toUTCString !== 'function') {
          throw new TypeError('option expires is invalid');
    
    Romain CREY's avatar
    Romain CREY committed
        }
    
    
        str += '; Expires=' + opt.expires.toUTCString();
    
    Romain CREY's avatar
    Romain CREY committed
      }
    
    
      if (opt.httpOnly) {
        str += '; HttpOnly';
    
    Romain CREY's avatar
    Romain CREY committed
      }
    
    
      if (opt.secure) {
        str += '; Secure';
    
    Romain CREY's avatar
    Romain CREY committed
      }
    
    
      if (opt.sameSite) {
        var sameSite = typeof opt.sameSite === 'string'
          ? opt.sameSite.toLowerCase() : opt.sameSite;
    
        switch (sameSite) {
          case true:
            str += '; SameSite=Strict';
            break;
          case 'lax':
            str += '; SameSite=Lax';
            break;
          case 'strict':
            str += '; SameSite=Strict';
            break;
          default:
            throw new TypeError('option sameSite is invalid');
        }
    
    Romain CREY's avatar
    Romain CREY committed
      }
    
    
      return str;
    }
    
    /**
     * Try decoding a string using a decoding function.
     *
     * @param {string} str
     * @param {function} decode
     * @private
     */
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    function tryDecode(str, decode) {
      try {
        return decode(str);
      } catch (e) {
        return str;
    
    Romain CREY's avatar
    Romain CREY committed
      }
    
    /***/ }),
    /* 1705 */
    /***/ (function(module, exports, __webpack_require__) {
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    var fs = __webpack_require__(167);
    var url = __webpack_require__(82);
    var transports = __webpack_require__(1706);
    var path = __webpack_require__(159);
    var lsmod = __webpack_require__(1708);
    var stacktrace = __webpack_require__(1709);
    var stringify = __webpack_require__(1702);
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    var ravenVersion = __webpack_require__(1710).version;
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    var protocolMap = {
      http: 80,
      https: 443
    };
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    var consoleAlerts = new Set();
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    // Default Node.js REPL depth
    var MAX_SERIALIZE_EXCEPTION_DEPTH = 3;
    // 50kB, as 100kB is max payload size, so half sounds reasonable
    var MAX_SERIALIZE_EXCEPTION_SIZE = 50 * 1024;
    var MAX_SERIALIZE_KEYS_LENGTH = 40;
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    function utf8Length(value) {
      return ~-encodeURI(value).split(/%..|./).length;
    }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    function jsonSize(value) {
      return utf8Length(JSON.stringify(value));
    }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    function isError(what) {
      return (
        Object.prototype.toString.call(what) === '[object Error]' || what instanceof Error
      );
    }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    module.exports.isError = isError;
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    function isPlainObject(what) {
      return Object.prototype.toString.call(what) === '[object Object]';
    
    Romain CREY's avatar
    Romain CREY committed
    }
    
    
    module.exports.isPlainObject = isPlainObject;
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    function serializeValue(value) {
      var maxLength = 40;
    
    Romain CREY's avatar
    Romain CREY committed
    
    
      if (typeof value === 'string') {
        return value.length <= maxLength ? value : value.substr(0, maxLength - 1) + '\u2026';
      } else if (
        typeof value === 'number' ||
        typeof value === 'boolean' ||
        typeof value === 'undefined'
      ) {
        return value;
      }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
      var type = Object.prototype.toString.call(value);
    
    Romain CREY's avatar
    Romain CREY committed
    
    
      // Node.js REPL notation
      if (type === '[object Object]') return '[Object]';
      if (type === '[object Array]') return '[Array]';
      if (type === '[object Function]')
        return value.name ? '[Function: ' + value.name + ']' : '[Function]';
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    function serializeObject(value, depth) {
      if (depth === 0) return serializeValue(value);
    
    Romain CREY's avatar
    Romain CREY committed
    
    
      if (isPlainObject(value)) {
        return Object.keys(value).reduce(function(acc, key) {
          acc[key] = serializeObject(value[key], depth - 1);
          return acc;
        }, {});
      } else if (Array.isArray(value)) {
        return value.map(function(val) {
          return serializeObject(val, depth - 1);
        });
    
    Romain CREY's avatar
    Romain CREY committed
      }
    
    
      return serializeValue(value);
    }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    function serializeException(ex, depth, maxSize) {
      if (!isPlainObject(ex)) return ex;
    
    Romain CREY's avatar
    Romain CREY committed
    
    
      depth = typeof depth !== 'number' ? MAX_SERIALIZE_EXCEPTION_DEPTH : depth;
      maxSize = typeof depth !== 'number' ? MAX_SERIALIZE_EXCEPTION_SIZE : maxSize;
    
    Romain CREY's avatar
    Romain CREY committed
    
    
      var serialized = serializeObject(ex, depth);
    
    Romain CREY's avatar
    Romain CREY committed
    
    
      if (jsonSize(stringify(serialized)) > maxSize) {
        return serializeException(ex, depth - 1);
    
    Romain CREY's avatar
    Romain CREY committed
      }
    
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    module.exports.serializeException = serializeException;
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    function serializeKeysForMessage(keys, maxLength) {
      if (typeof keys === 'number' || typeof keys === 'string') return keys.toString();
      if (!Array.isArray(keys)) return '';
    
    Romain CREY's avatar
    Romain CREY committed
    
    
      keys = keys.filter(function(key) {
        return typeof key === 'string';
      });
      if (keys.length === 0) return '[object has no keys]';
    
    Romain CREY's avatar
    Romain CREY committed
    
    
      maxLength = typeof maxLength !== 'number' ? MAX_SERIALIZE_KEYS_LENGTH : maxLength;
      if (keys[0].length >= maxLength) return keys[0];
    
    Romain CREY's avatar
    Romain CREY committed
    
    
      for (var usedKeys = keys.length; usedKeys > 0; usedKeys--) {
        var serialized = keys.slice(0, usedKeys).join(', ');
        if (serialized.length > maxLength) continue;
        if (usedKeys === keys.length) return serialized;
        return serialized + '\u2026';
      }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    Romain CREY's avatar
    Romain CREY committed
    }
    
    
    module.exports.serializeKeysForMessage = serializeKeysForMessage;
    
    module.exports.disableConsoleAlerts = function disableConsoleAlerts() {
      consoleAlerts = false;
    };
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    module.exports.enableConsoleAlerts = function enableConsoleAlerts() {
      consoleAlerts = new Set();
    };
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    module.exports.consoleAlert = function consoleAlert(msg) {
      if (consoleAlerts) {
        console.warn('raven@' + ravenVersion + ' alert: ' + msg);
      }
    };
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    module.exports.consoleAlertOnce = function consoleAlertOnce(msg) {
      if (consoleAlerts && !consoleAlerts.has(msg)) {
        consoleAlerts.add(msg);
        console.warn('raven@' + ravenVersion + ' alert: ' + msg);
      }
    };
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    module.exports.extend =
      Object.assign ||
      function(target) {
        for (var i = 1; i < arguments.length; i++) {
          var source = arguments[i];
          for (var key in source) {
            if (Object.prototype.hasOwnProperty.call(source, key)) {
              target[key] = source[key];
            }
    
    Romain CREY's avatar
    Romain CREY committed
          }
        }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    module.exports.getAuthHeader = function getAuthHeader(timestamp, apiKey, apiSecret) {
      var header = ['Sentry sentry_version=5'];
      header.push('sentry_timestamp=' + timestamp);
      header.push('sentry_client=raven-node/' + ravenVersion);
      header.push('sentry_key=' + apiKey);
      if (apiSecret) header.push('sentry_secret=' + apiSecret);
      return header.join(', ');
    };
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    module.exports.parseDSN = function parseDSN(dsn) {
      if (!dsn) {
        // Let a falsey value return false explicitly
        return false;
    
    Romain CREY's avatar
    Romain CREY committed
      }
    
      try {
        var parsed = url.parse(dsn),
          response = {
            protocol: parsed.protocol.slice(0, -1),
            public_key: parsed.auth.split(':')[0],
            host: parsed.host.split(':')[0]
          };
    
    Romain CREY's avatar
    Romain CREY committed
    
    
        if (parsed.auth.split(':')[1]) {
          response.private_key = parsed.auth.split(':')[1];
        }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
        if (~response.protocol.indexOf('+')) {
          response.protocol = response.protocol.split('+')[1];
    
    Romain CREY's avatar
    Romain CREY committed
        }
    
    
        if (!transports.hasOwnProperty(response.protocol)) {
          throw new Error('Invalid transport');
        }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
        var index = parsed.pathname.lastIndexOf('/');
        response.path = parsed.pathname.substr(0, index + 1);
        response.project_id = parsed.pathname.substr(index + 1);
        response.port = ~~parsed.port || protocolMap[response.protocol] || 443;
        return response;
      } catch (e) {
        throw new Error('Invalid Sentry DSN: ' + dsn);
    
    Romain CREY's avatar
    Romain CREY committed
      }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    module.exports.getTransaction = function getTransaction(frame) {
      if (frame.module || frame.function) {
        return (frame.module || '?') + ' at ' + (frame.function || '?');
      }
      return '<unknown>';
    };
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    var moduleCache;
    module.exports.getModules = function getModules() {
      if (!moduleCache) {
        moduleCache = lsmod();
      }
      return moduleCache;
    };
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    module.exports.fill = function(obj, name, replacement, track) {
      var orig = obj[name];
      obj[name] = replacement(orig);
      if (track) {
        track.push([obj, name, orig]);
      }
    };
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    var LINES_OF_CONTEXT = 7;
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    function getFunction(line) {
      try {
        return (
          line.getFunctionName() ||
          line.getTypeName() + '.' + (line.getMethodName() || '<anonymous>')
        );
      } catch (e) {
        // This seems to happen sometimes when using 'use strict',
        // stemming from `getTypeName`.
        // [TypeError: Cannot read property 'constructor' of undefined]
        return '<anonymous>';
      }
    }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    var mainModule =
      ((__webpack_require__.c[__webpack_require__.s] && __webpack_require__.c[__webpack_require__.s].filename && path.dirname(__webpack_require__.c[__webpack_require__.s].filename)) ||
        global.process.cwd()) + '/';
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    function getModule(filename, base) {
      if (!base) base = mainModule;
    
    Romain CREY's avatar
    Romain CREY committed
    
    
      // It's specifically a module
      var file = path.basename(filename, '.js');
      filename = path.dirname(filename);
      var n = filename.lastIndexOf('/node_modules/');
      if (n > -1) {
        // /node_modules/ is 14 chars
        return filename.substr(n + 14).replace(/\//g, '.') + ':' + file;
    
    Romain CREY's avatar
    Romain CREY committed
      }
    
      // Let's see if it's a part of the main module
      // To be a part of main module, it has to share the same base
      n = (filename + '/').lastIndexOf(base, 0);
      if (n === 0) {
        var module = filename.substr(base.length).replace(/\//g, '.');
        if (module) module += ':';
        module += file;
        return module;
    
    Romain CREY's avatar
    Romain CREY committed
      }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    function readSourceFiles(filenames, cb) {
      // we're relying on filenames being de-duped already
      if (filenames.length === 0) return setTimeout(cb, 0, {});
    
    Romain CREY's avatar
    Romain CREY committed
    
    
      var sourceFiles = {};
      var numFilesToRead = filenames.length;
      return filenames.forEach(function(filename) {
        fs.readFile(filename, function(readErr, file) {
          if (!readErr) sourceFiles[filename] = file.toString().split('\n');
          if (--numFilesToRead === 0) cb(sourceFiles);
        });
      });
    }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    // This is basically just `trim_line` from https://github.com/getsentry/sentry/blob/master/src/sentry/lang/javascript/processor.py#L67
    function snipLine(line, colno) {
      var ll = line.length;
      if (ll <= 150) return line;
      if (colno > ll) colno = ll;
    
    Romain CREY's avatar
    Romain CREY committed
    
    
      var start = Math.max(colno - 60, 0);
      if (start < 5) start = 0;
    
    Romain CREY's avatar
    Romain CREY committed
    
    
      var end = Math.min(start + 140, ll);
      if (end > ll - 5) end = ll;
      if (end === ll) start = Math.max(end - 140, 0);
    
    Romain CREY's avatar
    Romain CREY committed
    
    
      line = line.slice(start, end);
      if (start > 0) line = '{snip} ' + line;
      if (end < ll) line += ' {snip}';
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    function snipLine0(line) {
      return snipLine(line, 0);
    }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    function parseStack(err, cb) {
      if (!err) return cb([]);
    
    Romain CREY's avatar
    Romain CREY committed
    
    
      var stack = stacktrace.parse(err);
      if (!stack || !Array.isArray(stack) || !stack.length || !stack[0].getFileName) {
        // the stack is not the useful thing we were expecting :/
        return cb([]);
    
    Romain CREY's avatar
    Romain CREY committed
      }
    
    
      // Sentry expects the stack trace to be oldest -> newest, v8 provides newest -> oldest
      stack.reverse();
    
    Romain CREY's avatar
    Romain CREY committed
    
    
      var frames = [];
      var filesToRead = {};
      stack.forEach(function(line) {
        var frame = {
          filename: line.getFileName() || '',
          lineno: line.getLineNumber(),
          colno: line.getColumnNumber(),
          function: getFunction(line)
        };
    
    Romain CREY's avatar
    Romain CREY committed
    
    
        var isInternal =
          line.isNative() ||
          (frame.filename[0] !== '/' &&
            frame.filename[0] !== '.' &&
            frame.filename.indexOf(':\\') !== 1);
    
    Romain CREY's avatar
    Romain CREY committed
    
    
        // in_app is all that's not an internal Node function or a module within node_modules
        // note that isNative appears to return true even for node core libraries
        // see https://github.com/getsentry/raven-node/issues/176
        frame.in_app = !isInternal && frame.filename.indexOf('node_modules/') === -1;
    
    Romain CREY's avatar
    Romain CREY committed
    
    
        // Extract a module name based on the filename
        if (frame.filename) {
          frame.module = getModule(frame.filename);
          if (!isInternal) filesToRead[frame.filename] = true;
    
    Romain CREY's avatar
    Romain CREY committed
        }
    
    
    Romain CREY's avatar
    Romain CREY committed
    
    
      return readSourceFiles(Object.keys(filesToRead), function(sourceFiles) {
        frames.forEach(function(frame) {
          if (frame.filename && sourceFiles[frame.filename]) {
            var lines = sourceFiles[frame.filename];
            try {
              frame.pre_context = lines
                .slice(Math.max(0, frame.lineno - (LINES_OF_CONTEXT + 1)), frame.lineno - 1)
                .map(snipLine0);
              frame.context_line = snipLine(lines[frame.lineno - 1], frame.colno);
              frame.post_context = lines
                .slice(frame.lineno, frame.lineno + LINES_OF_CONTEXT)
                .map(snipLine0);
            } catch (e) {
              // anomaly, being defensive in case
              // unlikely to ever happen in practice but can definitely happen in theory
            }
    
    Romain CREY's avatar
    Romain CREY committed
          }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    Romain CREY's avatar
    Romain CREY committed
    }
    
    
    // expose basically for testing because I don't know what I'm doing
    module.exports.parseStack = parseStack;
    module.exports.getModule = getModule;
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    /***/ }),
    
    Romain CREY's avatar
    Romain CREY committed
    /***/ (function(module, exports, __webpack_require__) {
    
    "use strict";
    
    
    
    var events = __webpack_require__(271);
    var util = __webpack_require__(9);
    var timeoutReq = __webpack_require__(1707);
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    var http = __webpack_require__(97);
    var https = __webpack_require__(98);
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    var agentOptions = {keepAlive: true, maxSockets: 100};
    var httpAgent = new http.Agent(agentOptions);
    var httpsAgent = new https.Agent(agentOptions);
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    function Transport() {}
    util.inherits(Transport, events.EventEmitter);
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    function HTTPTransport(options) {
      this.defaultPort = 80;
      this.transport = http;
      this.options = options || {};
      this.agent = httpAgent;
    }
    util.inherits(HTTPTransport, Transport);
    HTTPTransport.prototype.send = function(client, message, headers, eventId, cb) {
      var options = {
        hostname: client.dsn.host,
        path: client.dsn.path + 'api/' + client.dsn.project_id + '/store/',
        headers: headers,
        method: 'POST',
        port: client.dsn.port || this.defaultPort,
        ca: client.ca,
        agent: this.agent
      };
      for (var key in this.options) {
        if (this.options.hasOwnProperty(key)) {
          options[key] = this.options[key];
    
    Romain CREY's avatar
    Romain CREY committed
        }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
      // prevent off heap memory explosion
      var _name = this.agent.getName({host: client.dsn.host, port: client.dsn.port});
      var _requests = this.agent.requests[_name];
      if (_requests && Object.keys(_requests).length > client.maxReqQueueCount) {
        // other feedback strategy
        client.emit('error', new Error('client req queue is full..'));
        return;
    
    Romain CREY's avatar
    Romain CREY committed
      }
    
    
      var req = this.transport.request(options, function(res) {
        res.setEncoding('utf8');
        if (res.statusCode >= 200 && res.statusCode < 300) {
          client.emit('logged', eventId);
          cb && cb(null, eventId);
        } else {
          var reason = res.headers['x-sentry-error'];
          var e = new Error('HTTP Error (' + res.statusCode + '): ' + reason);
          e.response = res;
          e.statusCode = res.statusCode;
          e.reason = reason;
          e.sendMessage = message;
          e.requestHeaders = headers;
          e.eventId = eventId;
          client.emit('error', e);
          cb && cb(e);
    
    Romain CREY's avatar
    Romain CREY committed
        }
    
    
        // force the socket to drain
        var noop = function() {};
        res.on('data', noop);
        res.on('end', noop);
      });
    
    Romain CREY's avatar
    Romain CREY committed
    
    
      timeoutReq(req, client.sendTimeout * 1000);
    
    Romain CREY's avatar
    Romain CREY committed
    
    
      var cbFired = false;
      req.on('error', function(e) {
        client.emit('error', e);
        if (!cbFired) {
          cb && cb(e);
          cbFired = true;
        }
      });
      req.end(message);
    };
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    function HTTPSTransport(options) {
      this.defaultPort = 443;
      this.transport = https;
      this.options = options || {};
      this.agent = httpsAgent;
    
    Romain CREY's avatar
    Romain CREY committed
    }
    
    util.inherits(HTTPSTransport, HTTPTransport);
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    module.exports.http = new HTTPTransport();
    module.exports.https = new HTTPSTransport();
    module.exports.Transport = Transport;
    module.exports.HTTPTransport = HTTPTransport;
    module.exports.HTTPSTransport = HTTPSTransport;
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    /***/ }),
    
    Romain CREY's avatar
    Romain CREY committed
    /***/ (function(module, exports, __webpack_require__) {
    
    "use strict";
    
    
    
    module.exports = function (req, time) {
    	if (req.timeoutTimer) {
    		return req;
    	}
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    	var delays = isNaN(time) ? time : {socket: time, connect: time};
    	var host = req._headers ? (' to ' + req._headers.host) : '';
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    	if (delays.connect !== undefined) {
    		req.timeoutTimer = setTimeout(function timeoutHandler() {
    			req.abort();
    			var e = new Error('Connection timed out on request' + host);
    			e.code = 'ETIMEDOUT';
    			req.emit('error', e);
    		}, delays.connect);
    	}
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    	// Clear the connection timeout timer once a socket is assigned to the
    	// request and is connected.
    	req.on('socket', function assign(socket) {
    		// Socket may come from Agent pool and may be already connected.
    		if (!(socket.connecting || socket._connecting)) {
    			connect();
    			return;
    		}
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    		socket.once('connect', connect);
    	});
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    	function clear() {
    		if (req.timeoutTimer) {
    			clearTimeout(req.timeoutTimer);
    			req.timeoutTimer = null;
    		}
    	}
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    	function connect() {
    		clear();
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    		if (delays.socket !== undefined) {
    			// Abort the request if there is no activity on the socket for more
    			// than `delays.socket` milliseconds.
    			req.setTimeout(delays.socket, function socketTimeoutHandler() {
    				req.abort();
    				var e = new Error('Socket timed out on request' + host);
    				e.code = 'ESOCKETTIMEDOUT';
    				req.emit('error', e);
    			});
    		}
    	}
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    	return req.on('error', clear);
    };
    
    /***/ }),
    /* 1708 */
    /***/ (function(module, exports, __webpack_require__) {
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    // Original repository: https://github.com/defunctzombie/node-lsmod/
    //
    // [2018-02-09] @kamilogorek - Handle scoped packages structure
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    // builtin
    var fs = __webpack_require__(167);
    var path = __webpack_require__(159);
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    // node 0.6 support
    fs.existsSync = fs.existsSync || path.existsSync;
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    // mainPaths are the paths where our mainprog will be able to load from
    // we store these to avoid grabbing the modules that were loaded as a result
    // of a dependency module loading its dependencies, we only care about deps our
    // mainprog loads
    var mainPaths = (__webpack_require__.c[__webpack_require__.s] && __webpack_require__.c[__webpack_require__.s].paths) || [];
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    module.exports = function() {
      var paths = Object.keys(__webpack_require__.c || []);
    
    Romain CREY's avatar
    Romain CREY committed
    
    
      // module information
      var infos = {};
    
    Romain CREY's avatar
    Romain CREY committed
    
    
      // paths we have already inspected to avoid traversing again
      var seen = {};
    
    Romain CREY's avatar
    Romain CREY committed
    
    
      paths.forEach(function(p) {
        /* eslint-disable consistent-return */
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    Romain CREY's avatar
    Romain CREY committed
    
    
        (function updir() {
          var orig = dir;
          dir = path.dirname(orig);
    
    Romain CREY's avatar
    Romain CREY committed
    
    
          if (/@[^/]+$/.test(dir)) {
            dir = path.dirname(dir);
          }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
          if (!dir || orig === dir || seen[orig]) {
            return;
          } else if (mainPaths.indexOf(dir) < 0) {
            return updir();
    
    Romain CREY's avatar
    Romain CREY committed
          }
    
    
          var pkgfile = path.join(orig, 'package.json');
          var exists = fs.existsSync(pkgfile);
    
    Romain CREY's avatar
    Romain CREY committed
    
    
          seen[orig] = true;
    
    Romain CREY's avatar
    Romain CREY committed
    
    
          // travel up the tree if no package.json here
          if (!exists) {
            return updir();
    
    Romain CREY's avatar
    Romain CREY committed
          }
    
    
          try {
            var info = JSON.parse(fs.readFileSync(pkgfile, 'utf8'));
            infos[info.name] = info.version;
          } catch (e) {}
        })();
    
    Romain CREY's avatar
    Romain CREY committed
    
    
        /* eslint-enable consistent-return */
      });
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    /***/ }),
    /* 1709 */
    /***/ (function(module, exports) {
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    exports.get = function(belowFn) {
      var oldLimit = Error.stackTraceLimit;
      Error.stackTraceLimit = Infinity;
    
    Romain CREY's avatar
    Romain CREY committed
    
    
      var dummyObject = {};
    
    Romain CREY's avatar
    Romain CREY committed
    
    
      var v8Handler = Error.prepareStackTrace;
      Error.prepareStackTrace = function(dummyObject, v8StackTrace) {
        return v8StackTrace;
      };
      Error.captureStackTrace(dummyObject, belowFn || exports.get);
    
    Romain CREY's avatar
    Romain CREY committed
    
    
      var v8StackTrace = dummyObject.stack;
      Error.prepareStackTrace = v8Handler;
      Error.stackTraceLimit = oldLimit;
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    exports.parse = function(err) {
      if (!err.stack) {
        return [];
      }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
      var self = this;
      var lines = err.stack.split('\n').slice(1);
    
    Romain CREY's avatar
    Romain CREY committed
    
    
      return lines
        .map(function(line) {
          if (line.match(/^\s*[-]{4,}$/)) {
            return self._createParsedCallSite({
              fileName: line,
              lineNumber: null,
              functionName: null,
              typeName: null,
              methodName: null,
              columnNumber: null,
              'native': null,
            });
          }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
          var lineMatch = line.match(/at (?:(.+)\s+\()?(?:(.+?):(\d+)(?::(\d+))?|([^)]+))\)?/);
          if (!lineMatch) {
            return;
          }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
          var object = null;
          var method = null;
          var functionName = null;
          var typeName = null;
          var methodName = null;
          var isNative = (lineMatch[5] === 'native');
    
    Romain CREY's avatar
    Romain CREY committed
    
    
          if (lineMatch[1]) {
            functionName = lineMatch[1];
            var methodStart = functionName.lastIndexOf('.');
            if (functionName[methodStart-1] == '.')
              methodStart--;
            if (methodStart > 0) {
              object = functionName.substr(0, methodStart);
              method = functionName.substr(methodStart + 1);
              var objectEnd = object.indexOf('.Module');
              if (objectEnd > 0) {
                functionName = functionName.substr(objectEnd + 1);
                object = object.substr(0, objectEnd);
              }
    
    Romain CREY's avatar
    Romain CREY committed
            }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
          if (method) {
            typeName = object;
            methodName = method;
          }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
          if (method === '<anonymous>') {
            methodName = null;
            functionName = null;
          }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
          var properties = {
            fileName: lineMatch[2] || null,
            lineNumber: parseInt(lineMatch[3], 10) || null,
            functionName: functionName,
            typeName: typeName,
            methodName: methodName,
            columnNumber: parseInt(lineMatch[4], 10) || null,
            'native': isNative,
          };
    
    Romain CREY's avatar
    Romain CREY committed
    
    
          return self._createParsedCallSite(properties);
        })
        .filter(function(callSite) {
          return !!callSite;
        });
    };
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    function CallSite(properties) {
      for (var property in properties) {
        this[property] = properties[property];
      }
    }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    var strProperties = [
      'this',
      'typeName',
      'functionName',
      'methodName',
      'fileName',
      'lineNumber',
      'columnNumber',
      'function',
      'evalOrigin'
    ];
    var boolProperties = [
      'topLevel',
      'eval',
      'native',
      'constructor'
    ];
    strProperties.forEach(function (property) {
      CallSite.prototype[property] = null;
      CallSite.prototype['get' + property[0].toUpperCase() + property.substr(1)] = function () {
        return this[property];
      }
    });
    boolProperties.forEach(function (property) {
      CallSite.prototype[property] = false;
      CallSite.prototype['is' + property[0].toUpperCase() + property.substr(1)] = function () {
        return this[property];
      }
    });
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    exports._createParsedCallSite = function(properties) {
      return new CallSite(properties);
    };
    
    /***/ }),
    /* 1710 */
    /***/ (function(module) {
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    module.exports = JSON.parse("{\"name\":\"raven\",\"description\":\"A standalone (Node.js) client for Sentry\",\"keywords\":[\"debugging\",\"errors\",\"exceptions\",\"logging\",\"raven\",\"sentry\"],\"version\":\"2.6.4\",\"repository\":\"git://github.com/getsentry/raven-js.git\",\"license\":\"BSD-2-Clause\",\"homepage\":\"https://github.com/getsentry/raven-js\",\"author\":\"Matt Robenolt <matt@ydekproductions.com>\",\"main\":\"index.js\",\"bin\":{\"raven\":\"./bin/raven\"},\"scripts\":{\"lint\":\"eslint .\",\"test\":\"NODE_ENV=test istanbul cover _mocha  -- --reporter dot && NODE_ENV=test coffee ./test/run.coffee\",\"test-mocha\":\"NODE_ENV=test mocha\",\"test-full\":\"npm run test && cd test/instrumentation && ./run.sh\"},\"engines\":{\"node\":\">= 4.0.0\"},\"dependencies\":{\"cookie\":\"0.3.1\",\"md5\":\"^2.2.1\",\"stack-trace\":\"0.0.10\",\"timed-out\":\"4.0.1\",\"uuid\":\"3.3.2\"},\"devDependencies\":{\"coffee-script\":\"~1.10.0\",\"connect\":\"*\",\"eslint\":\"^4.5.0\",\"eslint-config-prettier\":\"^2.3.0\",\"express\":\"*\",\"glob\":\"~3.1.13\",\"istanbul\":\"^0.4.3\",\"mocha\":\"~3.1.2\",\"nock\":\"~9.0.0\",\"prettier\":\"^1.6.1\",\"should\":\"11.2.0\",\"sinon\":\"^3.3.0\"},\"prettier\":{\"singleQuote\":true,\"bracketSpacing\":false,\"printWidth\":90}}");
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    /***/ }),
    /* 1711 */
    /***/ (function(module, exports, __webpack_require__) {
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    var v1 = __webpack_require__(1712);
    var v4 = __webpack_require__(261);
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    var uuid = v4;
    uuid.v1 = v1;
    uuid.v4 = v4;
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    module.exports = uuid;