@pelcro/react-pelcro-js 3.18.0 → 3.19.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +3543 -10
- package/dist/index.esm.js +3532 -10
- package/package.json +3 -1
package/dist/index.esm.js
CHANGED
|
@@ -2,6 +2,17 @@ import * as React from 'react';
|
|
|
2
2
|
import React__default, { useContext, useState, useRef, useEffect, useReducer, useLayoutEffect, Component, memo, createElement, Fragment, useMemo, forwardRef, createContext, useCallback, isValidElement, cloneElement } from 'react';
|
|
3
3
|
import ReactDOM, { render as render$1 } from 'react-dom';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
|
+
import os from 'os';
|
|
6
|
+
import http from 'http';
|
|
7
|
+
import https from 'https';
|
|
8
|
+
import url from 'url';
|
|
9
|
+
import util$1 from 'util';
|
|
10
|
+
import domain from 'domain';
|
|
11
|
+
import path from 'path';
|
|
12
|
+
import fs from 'fs';
|
|
13
|
+
import stream from 'stream';
|
|
14
|
+
import timers from 'timers';
|
|
15
|
+
import events from 'events';
|
|
5
16
|
|
|
6
17
|
function _typeof$3(obj) {
|
|
7
18
|
"@babel/helpers - typeof";
|
|
@@ -1930,7 +1941,7 @@ function transformOptions(options) {
|
|
|
1930
1941
|
return options;
|
|
1931
1942
|
}
|
|
1932
1943
|
|
|
1933
|
-
function noop$
|
|
1944
|
+
function noop$3() {}
|
|
1934
1945
|
|
|
1935
1946
|
var I18n = function (_EventEmitter) {
|
|
1936
1947
|
_inherits$1(I18n, _EventEmitter);
|
|
@@ -1994,7 +2005,7 @@ var I18n = function (_EventEmitter) {
|
|
|
1994
2005
|
|
|
1995
2006
|
this.options = _objectSpread$7({}, get(), this.options, transformOptions(options));
|
|
1996
2007
|
this.format = this.options.interpolation.format;
|
|
1997
|
-
if (!callback) callback = noop$
|
|
2008
|
+
if (!callback) callback = noop$3;
|
|
1998
2009
|
|
|
1999
2010
|
function createClassOnDemand(ClassOrObject) {
|
|
2000
2011
|
if (!ClassOrObject) return null;
|
|
@@ -2115,7 +2126,7 @@ var I18n = function (_EventEmitter) {
|
|
|
2115
2126
|
value: function loadResources(language) {
|
|
2116
2127
|
var _this3 = this;
|
|
2117
2128
|
|
|
2118
|
-
var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop$
|
|
2129
|
+
var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop$3;
|
|
2119
2130
|
var usedCallback = callback;
|
|
2120
2131
|
var usedLng = typeof language === 'string' ? language : this.language;
|
|
2121
2132
|
if (typeof language === 'function') usedCallback = language;
|
|
@@ -2160,7 +2171,7 @@ var I18n = function (_EventEmitter) {
|
|
|
2160
2171
|
var deferred = defer();
|
|
2161
2172
|
if (!lngs) lngs = this.languages;
|
|
2162
2173
|
if (!ns) ns = this.options.ns;
|
|
2163
|
-
if (!callback) callback = noop$
|
|
2174
|
+
if (!callback) callback = noop$3;
|
|
2164
2175
|
this.services.backendConnector.reload(lngs, ns, function (err) {
|
|
2165
2176
|
deferred.resolve();
|
|
2166
2177
|
callback(err);
|
|
@@ -2415,7 +2426,7 @@ var I18n = function (_EventEmitter) {
|
|
|
2415
2426
|
var _this8 = this;
|
|
2416
2427
|
|
|
2417
2428
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
2418
|
-
var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop$
|
|
2429
|
+
var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop$3;
|
|
2419
2430
|
|
|
2420
2431
|
var mergedOptions = _objectSpread$7({}, this.options, options, {
|
|
2421
2432
|
isClone: true
|
|
@@ -3438,7 +3449,7 @@ var youAreSafe$3 = "You're safe - PCI compliant 128 SSL by";
|
|
|
3438
3449
|
var cancel$3 = "Cancel your subscription online at anytime.";
|
|
3439
3450
|
var giftSent$3 = "Subscription gift has been sent to";
|
|
3440
3451
|
var successfully$3 = "successfully";
|
|
3441
|
-
var entitlement$3 = "Some of the content on this page is available with one or more of our plans. <1>Subscribe</1> now to get full page access.";
|
|
3452
|
+
var entitlement$3 = "Some of the content on this page is available with one or more of our plans. <1> Subscribe </1> now to get full page access.";
|
|
3442
3453
|
var recaptcha$3 = "This site is protected by reCAPTCHA and the Google <1>Privacy Policy</1> and <3>Terms of Service</3> apply.";
|
|
3443
3454
|
var invalidInvoice$3 = "Invalid invoice ID, please contact support";
|
|
3444
3455
|
var invalidSubscription$2 = "Invalid subscription ID, please contact support";
|
|
@@ -4379,7 +4390,7 @@ var youAreSafe$2 = "Vous êtes en sécurité - PCI conforme 128 SSL par";
|
|
|
4379
4390
|
var cancel$2 = "Annuler votre abonnement en ligne à tout moment.";
|
|
4380
4391
|
var giftSent$2 = "Le cadeau d’abonnement a été envoyé à";
|
|
4381
4392
|
var successfully$2 = "avec succès.";
|
|
4382
|
-
var entitlement$2 = "Une partie du contenu de cette page est disponible sous un ou plusieurs de nos plans. <1>Abonnez-vous</1> à l'un de nos plans disponibles pour accéder à plus de contenu";
|
|
4393
|
+
var entitlement$2 = "Une partie du contenu de cette page est disponible sous un ou plusieurs de nos plans. <1> Abonnez-vous </1> à l'un de nos plans disponibles pour accéder à plus de contenu";
|
|
4383
4394
|
var recaptcha$2 = "Ce site est protégé par reCAPTCHA - les <1>règles de confidentialité</1> Google ainsi que les <3>conditions d'utilisation</3> s'appliquent.";
|
|
4384
4395
|
var invalidInvoice$2 = "Identifiant de facture non valide, veuillez contacter l'assistance";
|
|
4385
4396
|
var invalidSubscription$1 = "ID d'abonnement invalide, veuillez contacter l'assistance";
|
|
@@ -5206,7 +5217,7 @@ var youAreSafe$1 = "PCI 준수 128비트 SSL 인증서로 보호됩니다. 제
|
|
|
5206
5217
|
var cancel$1 = "유료 멤버십은 언제든 온라인으로 취소가 가능합니다.";
|
|
5207
5218
|
var giftSent$1 = "유료 멤버십 선물이 ";
|
|
5208
5219
|
var successfully$1 = "님께 성공적으로 전송되었습니다.";
|
|
5209
|
-
var entitlement$1 = "이 페이지의 일부 콘텐츠는 하나 이상의 요금제 가입 시 이용이 가능합니다. 전체 페이지에 액세스하려면 지금 <1
|
|
5220
|
+
var entitlement$1 = "이 페이지의 일부 콘텐츠는 하나 이상의 요금제 가입 시 이용이 가능합니다. 전체 페이지에 액세스하려면 지금 <1> 멤버십에 가입 </1>하세요.";
|
|
5210
5221
|
var recaptcha$1 = "이 사이트는 reCAPTCHA로 보호되며, Google <1>개인정보 보호정책</1> 및 <3>서비스 약관</3>이 적용됩니다.";
|
|
5211
5222
|
var invalidInvoice$1 = "유효하지 않은 인보이스 ID입니다. 지원팀에 문의하십시오.";
|
|
5212
5223
|
var invalidSubscription = "잘못된 구독 ID입니다. 지원팀에 문의하세요.";
|
|
@@ -6137,7 +6148,7 @@ var youAreSafe = "Estás seguro - PCI compliance 128 SSL por";
|
|
|
6137
6148
|
var cancel = "Cancela tu suscripción en línea en cualquier momento.";
|
|
6138
6149
|
var giftSent = "La suscripción de regalo se ha enviado a";
|
|
6139
6150
|
var successfully = "exitosamente";
|
|
6140
|
-
var entitlement = "Algunos de los contenidos de está página están disponibles con uno o más de nuestros planes. <1>Suscríbete</1> ahora para obtener acceso completo.";
|
|
6151
|
+
var entitlement = "Algunos de los contenidos de está página están disponibles con uno o más de nuestros planes. <1> Suscríbete </1> ahora para obtener acceso completo.";
|
|
6141
6152
|
var recaptcha = "Este sitio está protegido por reCAPTCHA, aplica la <1>Política de Privacidad</1> y los <3>Términos de Servicio</3> de Google.";
|
|
6142
6153
|
var invalidInvoice = "Número de comprobante de pago inválido, por favor contacta a soporte.";
|
|
6143
6154
|
var zeroTotalInvoice = "No puedes ver un comprobante de pago de $0";
|
|
@@ -8561,6 +8572,3502 @@ if (process.env.NODE_ENV === "development") {
|
|
|
8561
8572
|
c$1("Pelcro Store", usePelcro);
|
|
8562
8573
|
}
|
|
8563
8574
|
|
|
8575
|
+
var stackframe = createCommonjsModule(function (module, exports) {
|
|
8576
|
+
(function(root, factory) {
|
|
8577
|
+
// Universal Module Definition (UMD) to support AMD, CommonJS/Node.js, Rhino, and browsers.
|
|
8578
|
+
|
|
8579
|
+
/* istanbul ignore next */
|
|
8580
|
+
{
|
|
8581
|
+
module.exports = factory();
|
|
8582
|
+
}
|
|
8583
|
+
}(commonjsGlobal, function() {
|
|
8584
|
+
function _isNumber(n) {
|
|
8585
|
+
return !isNaN(parseFloat(n)) && isFinite(n);
|
|
8586
|
+
}
|
|
8587
|
+
|
|
8588
|
+
function _capitalize(str) {
|
|
8589
|
+
return str.charAt(0).toUpperCase() + str.substring(1);
|
|
8590
|
+
}
|
|
8591
|
+
|
|
8592
|
+
function _getter(p) {
|
|
8593
|
+
return function() {
|
|
8594
|
+
return this[p];
|
|
8595
|
+
};
|
|
8596
|
+
}
|
|
8597
|
+
|
|
8598
|
+
var booleanProps = ['isConstructor', 'isEval', 'isNative', 'isToplevel'];
|
|
8599
|
+
var numericProps = ['columnNumber', 'lineNumber'];
|
|
8600
|
+
var stringProps = ['fileName', 'functionName', 'source'];
|
|
8601
|
+
var arrayProps = ['args'];
|
|
8602
|
+
var objectProps = ['evalOrigin'];
|
|
8603
|
+
|
|
8604
|
+
var props = booleanProps.concat(numericProps, stringProps, arrayProps, objectProps);
|
|
8605
|
+
|
|
8606
|
+
function StackFrame(obj) {
|
|
8607
|
+
if (!obj) return;
|
|
8608
|
+
for (var i = 0; i < props.length; i++) {
|
|
8609
|
+
if (obj[props[i]] !== undefined) {
|
|
8610
|
+
this['set' + _capitalize(props[i])](obj[props[i]]);
|
|
8611
|
+
}
|
|
8612
|
+
}
|
|
8613
|
+
}
|
|
8614
|
+
|
|
8615
|
+
StackFrame.prototype = {
|
|
8616
|
+
getArgs: function() {
|
|
8617
|
+
return this.args;
|
|
8618
|
+
},
|
|
8619
|
+
setArgs: function(v) {
|
|
8620
|
+
if (Object.prototype.toString.call(v) !== '[object Array]') {
|
|
8621
|
+
throw new TypeError('Args must be an Array');
|
|
8622
|
+
}
|
|
8623
|
+
this.args = v;
|
|
8624
|
+
},
|
|
8625
|
+
|
|
8626
|
+
getEvalOrigin: function() {
|
|
8627
|
+
return this.evalOrigin;
|
|
8628
|
+
},
|
|
8629
|
+
setEvalOrigin: function(v) {
|
|
8630
|
+
if (v instanceof StackFrame) {
|
|
8631
|
+
this.evalOrigin = v;
|
|
8632
|
+
} else if (v instanceof Object) {
|
|
8633
|
+
this.evalOrigin = new StackFrame(v);
|
|
8634
|
+
} else {
|
|
8635
|
+
throw new TypeError('Eval Origin must be an Object or StackFrame');
|
|
8636
|
+
}
|
|
8637
|
+
},
|
|
8638
|
+
|
|
8639
|
+
toString: function() {
|
|
8640
|
+
var fileName = this.getFileName() || '';
|
|
8641
|
+
var lineNumber = this.getLineNumber() || '';
|
|
8642
|
+
var columnNumber = this.getColumnNumber() || '';
|
|
8643
|
+
var functionName = this.getFunctionName() || '';
|
|
8644
|
+
if (this.getIsEval()) {
|
|
8645
|
+
if (fileName) {
|
|
8646
|
+
return '[eval] (' + fileName + ':' + lineNumber + ':' + columnNumber + ')';
|
|
8647
|
+
}
|
|
8648
|
+
return '[eval]:' + lineNumber + ':' + columnNumber;
|
|
8649
|
+
}
|
|
8650
|
+
if (functionName) {
|
|
8651
|
+
return functionName + ' (' + fileName + ':' + lineNumber + ':' + columnNumber + ')';
|
|
8652
|
+
}
|
|
8653
|
+
return fileName + ':' + lineNumber + ':' + columnNumber;
|
|
8654
|
+
}
|
|
8655
|
+
};
|
|
8656
|
+
|
|
8657
|
+
StackFrame.fromString = function StackFrame$$fromString(str) {
|
|
8658
|
+
var argsStartIndex = str.indexOf('(');
|
|
8659
|
+
var argsEndIndex = str.lastIndexOf(')');
|
|
8660
|
+
|
|
8661
|
+
var functionName = str.substring(0, argsStartIndex);
|
|
8662
|
+
var args = str.substring(argsStartIndex + 1, argsEndIndex).split(',');
|
|
8663
|
+
var locationString = str.substring(argsEndIndex + 1);
|
|
8664
|
+
|
|
8665
|
+
if (locationString.indexOf('@') === 0) {
|
|
8666
|
+
var parts = /@(.+?)(?::(\d+))?(?::(\d+))?$/.exec(locationString, '');
|
|
8667
|
+
var fileName = parts[1];
|
|
8668
|
+
var lineNumber = parts[2];
|
|
8669
|
+
var columnNumber = parts[3];
|
|
8670
|
+
}
|
|
8671
|
+
|
|
8672
|
+
return new StackFrame({
|
|
8673
|
+
functionName: functionName,
|
|
8674
|
+
args: args || undefined,
|
|
8675
|
+
fileName: fileName,
|
|
8676
|
+
lineNumber: lineNumber || undefined,
|
|
8677
|
+
columnNumber: columnNumber || undefined
|
|
8678
|
+
});
|
|
8679
|
+
};
|
|
8680
|
+
|
|
8681
|
+
for (var i = 0; i < booleanProps.length; i++) {
|
|
8682
|
+
StackFrame.prototype['get' + _capitalize(booleanProps[i])] = _getter(booleanProps[i]);
|
|
8683
|
+
StackFrame.prototype['set' + _capitalize(booleanProps[i])] = (function(p) {
|
|
8684
|
+
return function(v) {
|
|
8685
|
+
this[p] = Boolean(v);
|
|
8686
|
+
};
|
|
8687
|
+
})(booleanProps[i]);
|
|
8688
|
+
}
|
|
8689
|
+
|
|
8690
|
+
for (var j = 0; j < numericProps.length; j++) {
|
|
8691
|
+
StackFrame.prototype['get' + _capitalize(numericProps[j])] = _getter(numericProps[j]);
|
|
8692
|
+
StackFrame.prototype['set' + _capitalize(numericProps[j])] = (function(p) {
|
|
8693
|
+
return function(v) {
|
|
8694
|
+
if (!_isNumber(v)) {
|
|
8695
|
+
throw new TypeError(p + ' must be a Number');
|
|
8696
|
+
}
|
|
8697
|
+
this[p] = Number(v);
|
|
8698
|
+
};
|
|
8699
|
+
})(numericProps[j]);
|
|
8700
|
+
}
|
|
8701
|
+
|
|
8702
|
+
for (var k = 0; k < stringProps.length; k++) {
|
|
8703
|
+
StackFrame.prototype['get' + _capitalize(stringProps[k])] = _getter(stringProps[k]);
|
|
8704
|
+
StackFrame.prototype['set' + _capitalize(stringProps[k])] = (function(p) {
|
|
8705
|
+
return function(v) {
|
|
8706
|
+
this[p] = String(v);
|
|
8707
|
+
};
|
|
8708
|
+
})(stringProps[k]);
|
|
8709
|
+
}
|
|
8710
|
+
|
|
8711
|
+
return StackFrame;
|
|
8712
|
+
}));
|
|
8713
|
+
});
|
|
8714
|
+
|
|
8715
|
+
var errorStackParser = createCommonjsModule(function (module, exports) {
|
|
8716
|
+
(function(root, factory) {
|
|
8717
|
+
// Universal Module Definition (UMD) to support AMD, CommonJS/Node.js, Rhino, and browsers.
|
|
8718
|
+
|
|
8719
|
+
/* istanbul ignore next */
|
|
8720
|
+
{
|
|
8721
|
+
module.exports = factory(stackframe);
|
|
8722
|
+
}
|
|
8723
|
+
}(commonjsGlobal, function ErrorStackParser(StackFrame) {
|
|
8724
|
+
|
|
8725
|
+
var FIREFOX_SAFARI_STACK_REGEXP = /(^|@)\S+:\d+/;
|
|
8726
|
+
var CHROME_IE_STACK_REGEXP = /^\s*at .*(\S+:\d+|\(native\))/m;
|
|
8727
|
+
var SAFARI_NATIVE_CODE_REGEXP = /^(eval@)?(\[native code])?$/;
|
|
8728
|
+
|
|
8729
|
+
return {
|
|
8730
|
+
/**
|
|
8731
|
+
* Given an Error object, extract the most information from it.
|
|
8732
|
+
*
|
|
8733
|
+
* @param {Error} error object
|
|
8734
|
+
* @return {Array} of StackFrames
|
|
8735
|
+
*/
|
|
8736
|
+
parse: function ErrorStackParser$$parse(error) {
|
|
8737
|
+
if (typeof error.stacktrace !== 'undefined' || typeof error['opera#sourceloc'] !== 'undefined') {
|
|
8738
|
+
return this.parseOpera(error);
|
|
8739
|
+
} else if (error.stack && error.stack.match(CHROME_IE_STACK_REGEXP)) {
|
|
8740
|
+
return this.parseV8OrIE(error);
|
|
8741
|
+
} else if (error.stack) {
|
|
8742
|
+
return this.parseFFOrSafari(error);
|
|
8743
|
+
} else {
|
|
8744
|
+
throw new Error('Cannot parse given Error object');
|
|
8745
|
+
}
|
|
8746
|
+
},
|
|
8747
|
+
|
|
8748
|
+
// Separate line and column numbers from a string of the form: (URI:Line:Column)
|
|
8749
|
+
extractLocation: function ErrorStackParser$$extractLocation(urlLike) {
|
|
8750
|
+
// Fail-fast but return locations like "(native)"
|
|
8751
|
+
if (urlLike.indexOf(':') === -1) {
|
|
8752
|
+
return [urlLike];
|
|
8753
|
+
}
|
|
8754
|
+
|
|
8755
|
+
var regExp = /(.+?)(?::(\d+))?(?::(\d+))?$/;
|
|
8756
|
+
var parts = regExp.exec(urlLike.replace(/[()]/g, ''));
|
|
8757
|
+
return [parts[1], parts[2] || undefined, parts[3] || undefined];
|
|
8758
|
+
},
|
|
8759
|
+
|
|
8760
|
+
parseV8OrIE: function ErrorStackParser$$parseV8OrIE(error) {
|
|
8761
|
+
var filtered = error.stack.split('\n').filter(function(line) {
|
|
8762
|
+
return !!line.match(CHROME_IE_STACK_REGEXP);
|
|
8763
|
+
}, this);
|
|
8764
|
+
|
|
8765
|
+
return filtered.map(function(line) {
|
|
8766
|
+
if (line.indexOf('(eval ') > -1) {
|
|
8767
|
+
// Throw away eval information until we implement stacktrace.js/stackframe#8
|
|
8768
|
+
line = line.replace(/eval code/g, 'eval').replace(/(\(eval at [^()]*)|(,.*$)/g, '');
|
|
8769
|
+
}
|
|
8770
|
+
var sanitizedLine = line.replace(/^\s+/, '').replace(/\(eval code/g, '(').replace(/^.*?\s+/, '');
|
|
8771
|
+
|
|
8772
|
+
// capture and preseve the parenthesized location "(/foo/my bar.js:12:87)" in
|
|
8773
|
+
// case it has spaces in it, as the string is split on \s+ later on
|
|
8774
|
+
var location = sanitizedLine.match(/ (\(.+\)$)/);
|
|
8775
|
+
|
|
8776
|
+
// remove the parenthesized location from the line, if it was matched
|
|
8777
|
+
sanitizedLine = location ? sanitizedLine.replace(location[0], '') : sanitizedLine;
|
|
8778
|
+
|
|
8779
|
+
// if a location was matched, pass it to extractLocation() otherwise pass all sanitizedLine
|
|
8780
|
+
// because this line doesn't have function name
|
|
8781
|
+
var locationParts = this.extractLocation(location ? location[1] : sanitizedLine);
|
|
8782
|
+
var functionName = location && sanitizedLine || undefined;
|
|
8783
|
+
var fileName = ['eval', '<anonymous>'].indexOf(locationParts[0]) > -1 ? undefined : locationParts[0];
|
|
8784
|
+
|
|
8785
|
+
return new StackFrame({
|
|
8786
|
+
functionName: functionName,
|
|
8787
|
+
fileName: fileName,
|
|
8788
|
+
lineNumber: locationParts[1],
|
|
8789
|
+
columnNumber: locationParts[2],
|
|
8790
|
+
source: line
|
|
8791
|
+
});
|
|
8792
|
+
}, this);
|
|
8793
|
+
},
|
|
8794
|
+
|
|
8795
|
+
parseFFOrSafari: function ErrorStackParser$$parseFFOrSafari(error) {
|
|
8796
|
+
var filtered = error.stack.split('\n').filter(function(line) {
|
|
8797
|
+
return !line.match(SAFARI_NATIVE_CODE_REGEXP);
|
|
8798
|
+
}, this);
|
|
8799
|
+
|
|
8800
|
+
return filtered.map(function(line) {
|
|
8801
|
+
// Throw away eval information until we implement stacktrace.js/stackframe#8
|
|
8802
|
+
if (line.indexOf(' > eval') > -1) {
|
|
8803
|
+
line = line.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g, ':$1');
|
|
8804
|
+
}
|
|
8805
|
+
|
|
8806
|
+
if (line.indexOf('@') === -1 && line.indexOf(':') === -1) {
|
|
8807
|
+
// Safari eval frames only have function names and nothing else
|
|
8808
|
+
return new StackFrame({
|
|
8809
|
+
functionName: line
|
|
8810
|
+
});
|
|
8811
|
+
} else {
|
|
8812
|
+
var functionNameRegex = /((.*".+"[^@]*)?[^@]*)(?:@)/;
|
|
8813
|
+
var matches = line.match(functionNameRegex);
|
|
8814
|
+
var functionName = matches && matches[1] ? matches[1] : undefined;
|
|
8815
|
+
var locationParts = this.extractLocation(line.replace(functionNameRegex, ''));
|
|
8816
|
+
|
|
8817
|
+
return new StackFrame({
|
|
8818
|
+
functionName: functionName,
|
|
8819
|
+
fileName: locationParts[0],
|
|
8820
|
+
lineNumber: locationParts[1],
|
|
8821
|
+
columnNumber: locationParts[2],
|
|
8822
|
+
source: line
|
|
8823
|
+
});
|
|
8824
|
+
}
|
|
8825
|
+
}, this);
|
|
8826
|
+
},
|
|
8827
|
+
|
|
8828
|
+
parseOpera: function ErrorStackParser$$parseOpera(e) {
|
|
8829
|
+
if (!e.stacktrace || (e.message.indexOf('\n') > -1 &&
|
|
8830
|
+
e.message.split('\n').length > e.stacktrace.split('\n').length)) {
|
|
8831
|
+
return this.parseOpera9(e);
|
|
8832
|
+
} else if (!e.stack) {
|
|
8833
|
+
return this.parseOpera10(e);
|
|
8834
|
+
} else {
|
|
8835
|
+
return this.parseOpera11(e);
|
|
8836
|
+
}
|
|
8837
|
+
},
|
|
8838
|
+
|
|
8839
|
+
parseOpera9: function ErrorStackParser$$parseOpera9(e) {
|
|
8840
|
+
var lineRE = /Line (\d+).*script (?:in )?(\S+)/i;
|
|
8841
|
+
var lines = e.message.split('\n');
|
|
8842
|
+
var result = [];
|
|
8843
|
+
|
|
8844
|
+
for (var i = 2, len = lines.length; i < len; i += 2) {
|
|
8845
|
+
var match = lineRE.exec(lines[i]);
|
|
8846
|
+
if (match) {
|
|
8847
|
+
result.push(new StackFrame({
|
|
8848
|
+
fileName: match[2],
|
|
8849
|
+
lineNumber: match[1],
|
|
8850
|
+
source: lines[i]
|
|
8851
|
+
}));
|
|
8852
|
+
}
|
|
8853
|
+
}
|
|
8854
|
+
|
|
8855
|
+
return result;
|
|
8856
|
+
},
|
|
8857
|
+
|
|
8858
|
+
parseOpera10: function ErrorStackParser$$parseOpera10(e) {
|
|
8859
|
+
var lineRE = /Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i;
|
|
8860
|
+
var lines = e.stacktrace.split('\n');
|
|
8861
|
+
var result = [];
|
|
8862
|
+
|
|
8863
|
+
for (var i = 0, len = lines.length; i < len; i += 2) {
|
|
8864
|
+
var match = lineRE.exec(lines[i]);
|
|
8865
|
+
if (match) {
|
|
8866
|
+
result.push(
|
|
8867
|
+
new StackFrame({
|
|
8868
|
+
functionName: match[3] || undefined,
|
|
8869
|
+
fileName: match[2],
|
|
8870
|
+
lineNumber: match[1],
|
|
8871
|
+
source: lines[i]
|
|
8872
|
+
})
|
|
8873
|
+
);
|
|
8874
|
+
}
|
|
8875
|
+
}
|
|
8876
|
+
|
|
8877
|
+
return result;
|
|
8878
|
+
},
|
|
8879
|
+
|
|
8880
|
+
// Opera 10.65+ Error.stack very similar to FF/Safari
|
|
8881
|
+
parseOpera11: function ErrorStackParser$$parseOpera11(error) {
|
|
8882
|
+
var filtered = error.stack.split('\n').filter(function(line) {
|
|
8883
|
+
return !!line.match(FIREFOX_SAFARI_STACK_REGEXP) && !line.match(/^Error created at/);
|
|
8884
|
+
}, this);
|
|
8885
|
+
|
|
8886
|
+
return filtered.map(function(line) {
|
|
8887
|
+
var tokens = line.split('@');
|
|
8888
|
+
var locationParts = this.extractLocation(tokens.pop());
|
|
8889
|
+
var functionCall = (tokens.shift() || '');
|
|
8890
|
+
var functionName = functionCall
|
|
8891
|
+
.replace(/<anonymous function(: (\w+))?>/, '$2')
|
|
8892
|
+
.replace(/\([^)]*\)/g, '') || undefined;
|
|
8893
|
+
var argsRaw;
|
|
8894
|
+
if (functionCall.match(/\(([^)]*)\)/)) {
|
|
8895
|
+
argsRaw = functionCall.replace(/^[^(]+\(([^)]*)\)$/, '$1');
|
|
8896
|
+
}
|
|
8897
|
+
var args = (argsRaw === undefined || argsRaw === '[arguments not available]') ?
|
|
8898
|
+
undefined : argsRaw.split(',');
|
|
8899
|
+
|
|
8900
|
+
return new StackFrame({
|
|
8901
|
+
functionName: functionName,
|
|
8902
|
+
args: args,
|
|
8903
|
+
fileName: locationParts[0],
|
|
8904
|
+
lineNumber: locationParts[1],
|
|
8905
|
+
columnNumber: locationParts[2],
|
|
8906
|
+
source: line
|
|
8907
|
+
});
|
|
8908
|
+
}, this);
|
|
8909
|
+
}
|
|
8910
|
+
};
|
|
8911
|
+
}));
|
|
8912
|
+
});
|
|
8913
|
+
|
|
8914
|
+
/**
|
|
8915
|
+
* Expose `isError`.
|
|
8916
|
+
*/
|
|
8917
|
+
|
|
8918
|
+
var iserror = isError;
|
|
8919
|
+
|
|
8920
|
+
/**
|
|
8921
|
+
* Test whether `value` is error object.
|
|
8922
|
+
*
|
|
8923
|
+
* @param {*} value
|
|
8924
|
+
* @returns {boolean}
|
|
8925
|
+
*/
|
|
8926
|
+
|
|
8927
|
+
function isError(value) {
|
|
8928
|
+
switch (Object.prototype.toString.call(value)) {
|
|
8929
|
+
case '[object Error]': return true;
|
|
8930
|
+
case '[object Exception]': return true;
|
|
8931
|
+
case '[object DOMException]': return true;
|
|
8932
|
+
default: return value instanceof Error;
|
|
8933
|
+
}
|
|
8934
|
+
}
|
|
8935
|
+
|
|
8936
|
+
var stackGenerator = createCommonjsModule(function (module, exports) {
|
|
8937
|
+
(function(root, factory) {
|
|
8938
|
+
// Universal Module Definition (UMD) to support AMD, CommonJS/Node.js, Rhino, and browsers.
|
|
8939
|
+
|
|
8940
|
+
/* istanbul ignore next */
|
|
8941
|
+
{
|
|
8942
|
+
module.exports = factory(stackframe);
|
|
8943
|
+
}
|
|
8944
|
+
}(commonjsGlobal, function(StackFrame) {
|
|
8945
|
+
return {
|
|
8946
|
+
backtrace: function StackGenerator$$backtrace(opts) {
|
|
8947
|
+
var stack = [];
|
|
8948
|
+
var maxStackSize = 10;
|
|
8949
|
+
|
|
8950
|
+
if (typeof opts === 'object' && typeof opts.maxStackSize === 'number') {
|
|
8951
|
+
maxStackSize = opts.maxStackSize;
|
|
8952
|
+
}
|
|
8953
|
+
|
|
8954
|
+
var curr = arguments.callee;
|
|
8955
|
+
while (curr && stack.length < maxStackSize && curr['arguments']) {
|
|
8956
|
+
// Allow V8 optimizations
|
|
8957
|
+
var args = new Array(curr['arguments'].length);
|
|
8958
|
+
for (var i = 0; i < args.length; ++i) {
|
|
8959
|
+
args[i] = curr['arguments'][i];
|
|
8960
|
+
}
|
|
8961
|
+
if (/function(?:\s+([\w$]+))+\s*\(/.test(curr.toString())) {
|
|
8962
|
+
stack.push(new StackFrame({functionName: RegExp.$1 || undefined, args: args}));
|
|
8963
|
+
} else {
|
|
8964
|
+
stack.push(new StackFrame({args: args}));
|
|
8965
|
+
}
|
|
8966
|
+
|
|
8967
|
+
try {
|
|
8968
|
+
curr = curr.caller;
|
|
8969
|
+
} catch (e) {
|
|
8970
|
+
break;
|
|
8971
|
+
}
|
|
8972
|
+
}
|
|
8973
|
+
return stack;
|
|
8974
|
+
}
|
|
8975
|
+
};
|
|
8976
|
+
}));
|
|
8977
|
+
});
|
|
8978
|
+
|
|
8979
|
+
// Returns a wrapper function that returns a wrapped callback
|
|
8980
|
+
// The wrapper function should do some stuff, and return a
|
|
8981
|
+
// presumably different callback function.
|
|
8982
|
+
// This makes sure that own properties are retained, so that
|
|
8983
|
+
// decorations and such are not lost along the way.
|
|
8984
|
+
var wrappy_1 = wrappy;
|
|
8985
|
+
function wrappy (fn, cb) {
|
|
8986
|
+
if (fn && cb) return wrappy(fn)(cb)
|
|
8987
|
+
|
|
8988
|
+
if (typeof fn !== 'function')
|
|
8989
|
+
throw new TypeError('need wrapper function')
|
|
8990
|
+
|
|
8991
|
+
Object.keys(fn).forEach(function (k) {
|
|
8992
|
+
wrapper[k] = fn[k];
|
|
8993
|
+
});
|
|
8994
|
+
|
|
8995
|
+
return wrapper
|
|
8996
|
+
|
|
8997
|
+
function wrapper() {
|
|
8998
|
+
var args = new Array(arguments.length);
|
|
8999
|
+
for (var i = 0; i < args.length; i++) {
|
|
9000
|
+
args[i] = arguments[i];
|
|
9001
|
+
}
|
|
9002
|
+
var ret = fn.apply(this, args);
|
|
9003
|
+
var cb = args[args.length-1];
|
|
9004
|
+
if (typeof ret === 'function' && ret !== cb) {
|
|
9005
|
+
Object.keys(cb).forEach(function (k) {
|
|
9006
|
+
ret[k] = cb[k];
|
|
9007
|
+
});
|
|
9008
|
+
}
|
|
9009
|
+
return ret
|
|
9010
|
+
}
|
|
9011
|
+
}
|
|
9012
|
+
|
|
9013
|
+
var once_1 = wrappy_1(once$1);
|
|
9014
|
+
var strict = wrappy_1(onceStrict);
|
|
9015
|
+
|
|
9016
|
+
once$1.proto = once$1(function () {
|
|
9017
|
+
Object.defineProperty(Function.prototype, 'once', {
|
|
9018
|
+
value: function () {
|
|
9019
|
+
return once$1(this)
|
|
9020
|
+
},
|
|
9021
|
+
configurable: true
|
|
9022
|
+
});
|
|
9023
|
+
|
|
9024
|
+
Object.defineProperty(Function.prototype, 'onceStrict', {
|
|
9025
|
+
value: function () {
|
|
9026
|
+
return onceStrict(this)
|
|
9027
|
+
},
|
|
9028
|
+
configurable: true
|
|
9029
|
+
});
|
|
9030
|
+
});
|
|
9031
|
+
|
|
9032
|
+
function once$1 (fn) {
|
|
9033
|
+
var f = function () {
|
|
9034
|
+
if (f.called) return f.value
|
|
9035
|
+
f.called = true;
|
|
9036
|
+
return f.value = fn.apply(this, arguments)
|
|
9037
|
+
};
|
|
9038
|
+
f.called = false;
|
|
9039
|
+
return f
|
|
9040
|
+
}
|
|
9041
|
+
|
|
9042
|
+
function onceStrict (fn) {
|
|
9043
|
+
var f = function () {
|
|
9044
|
+
if (f.called)
|
|
9045
|
+
throw new Error(f.onceError)
|
|
9046
|
+
f.called = true;
|
|
9047
|
+
return f.value = fn.apply(this, arguments)
|
|
9048
|
+
};
|
|
9049
|
+
var name = fn.name || 'Function wrapped with `once`';
|
|
9050
|
+
f.onceError = name + " shouldn't be called more than once";
|
|
9051
|
+
f.called = false;
|
|
9052
|
+
return f
|
|
9053
|
+
}
|
|
9054
|
+
once_1.strict = strict;
|
|
9055
|
+
|
|
9056
|
+
var noop$2 = function() {};
|
|
9057
|
+
|
|
9058
|
+
var isRequest$1 = function(stream) {
|
|
9059
|
+
return stream.setHeader && typeof stream.abort === 'function';
|
|
9060
|
+
};
|
|
9061
|
+
|
|
9062
|
+
var isChildProcess = function(stream) {
|
|
9063
|
+
return stream.stdio && Array.isArray(stream.stdio) && stream.stdio.length === 3
|
|
9064
|
+
};
|
|
9065
|
+
|
|
9066
|
+
var eos = function(stream, opts, callback) {
|
|
9067
|
+
if (typeof opts === 'function') return eos(stream, null, opts);
|
|
9068
|
+
if (!opts) opts = {};
|
|
9069
|
+
|
|
9070
|
+
callback = once_1(callback || noop$2);
|
|
9071
|
+
|
|
9072
|
+
var ws = stream._writableState;
|
|
9073
|
+
var rs = stream._readableState;
|
|
9074
|
+
var readable = opts.readable || (opts.readable !== false && stream.readable);
|
|
9075
|
+
var writable = opts.writable || (opts.writable !== false && stream.writable);
|
|
9076
|
+
var cancelled = false;
|
|
9077
|
+
|
|
9078
|
+
var onlegacyfinish = function() {
|
|
9079
|
+
if (!stream.writable) onfinish();
|
|
9080
|
+
};
|
|
9081
|
+
|
|
9082
|
+
var onfinish = function() {
|
|
9083
|
+
writable = false;
|
|
9084
|
+
if (!readable) callback.call(stream);
|
|
9085
|
+
};
|
|
9086
|
+
|
|
9087
|
+
var onend = function() {
|
|
9088
|
+
readable = false;
|
|
9089
|
+
if (!writable) callback.call(stream);
|
|
9090
|
+
};
|
|
9091
|
+
|
|
9092
|
+
var onexit = function(exitCode) {
|
|
9093
|
+
callback.call(stream, exitCode ? new Error('exited with error code: ' + exitCode) : null);
|
|
9094
|
+
};
|
|
9095
|
+
|
|
9096
|
+
var onerror = function(err) {
|
|
9097
|
+
callback.call(stream, err);
|
|
9098
|
+
};
|
|
9099
|
+
|
|
9100
|
+
var onclose = function() {
|
|
9101
|
+
process.nextTick(onclosenexttick);
|
|
9102
|
+
};
|
|
9103
|
+
|
|
9104
|
+
var onclosenexttick = function() {
|
|
9105
|
+
if (cancelled) return;
|
|
9106
|
+
if (readable && !(rs && (rs.ended && !rs.destroyed))) return callback.call(stream, new Error('premature close'));
|
|
9107
|
+
if (writable && !(ws && (ws.ended && !ws.destroyed))) return callback.call(stream, new Error('premature close'));
|
|
9108
|
+
};
|
|
9109
|
+
|
|
9110
|
+
var onrequest = function() {
|
|
9111
|
+
stream.req.on('finish', onfinish);
|
|
9112
|
+
};
|
|
9113
|
+
|
|
9114
|
+
if (isRequest$1(stream)) {
|
|
9115
|
+
stream.on('complete', onfinish);
|
|
9116
|
+
stream.on('abort', onclose);
|
|
9117
|
+
if (stream.req) onrequest();
|
|
9118
|
+
else stream.on('request', onrequest);
|
|
9119
|
+
} else if (writable && !ws) { // legacy streams
|
|
9120
|
+
stream.on('end', onlegacyfinish);
|
|
9121
|
+
stream.on('close', onlegacyfinish);
|
|
9122
|
+
}
|
|
9123
|
+
|
|
9124
|
+
if (isChildProcess(stream)) stream.on('exit', onexit);
|
|
9125
|
+
|
|
9126
|
+
stream.on('end', onend);
|
|
9127
|
+
stream.on('finish', onfinish);
|
|
9128
|
+
if (opts.error !== false) stream.on('error', onerror);
|
|
9129
|
+
stream.on('close', onclose);
|
|
9130
|
+
|
|
9131
|
+
return function() {
|
|
9132
|
+
cancelled = true;
|
|
9133
|
+
stream.removeListener('complete', onfinish);
|
|
9134
|
+
stream.removeListener('abort', onclose);
|
|
9135
|
+
stream.removeListener('request', onrequest);
|
|
9136
|
+
if (stream.req) stream.req.removeListener('finish', onfinish);
|
|
9137
|
+
stream.removeListener('end', onlegacyfinish);
|
|
9138
|
+
stream.removeListener('close', onlegacyfinish);
|
|
9139
|
+
stream.removeListener('finish', onfinish);
|
|
9140
|
+
stream.removeListener('exit', onexit);
|
|
9141
|
+
stream.removeListener('end', onend);
|
|
9142
|
+
stream.removeListener('error', onerror);
|
|
9143
|
+
stream.removeListener('close', onclose);
|
|
9144
|
+
};
|
|
9145
|
+
};
|
|
9146
|
+
|
|
9147
|
+
var endOfStream = eos;
|
|
9148
|
+
|
|
9149
|
+
// we only need fs to get the ReadStream and WriteStream prototypes
|
|
9150
|
+
|
|
9151
|
+
var noop$1 = function () {};
|
|
9152
|
+
var ancient = /^v?\.0/.test(process.version);
|
|
9153
|
+
|
|
9154
|
+
var isFn = function (fn) {
|
|
9155
|
+
return typeof fn === 'function'
|
|
9156
|
+
};
|
|
9157
|
+
|
|
9158
|
+
var isFS = function (stream) {
|
|
9159
|
+
if (!ancient) return false // newer node version do not need to care about fs is a special way
|
|
9160
|
+
if (!fs) return false // browser
|
|
9161
|
+
return (stream instanceof (fs.ReadStream || noop$1) || stream instanceof (fs.WriteStream || noop$1)) && isFn(stream.close)
|
|
9162
|
+
};
|
|
9163
|
+
|
|
9164
|
+
var isRequest = function (stream) {
|
|
9165
|
+
return stream.setHeader && isFn(stream.abort)
|
|
9166
|
+
};
|
|
9167
|
+
|
|
9168
|
+
var destroyer = function (stream, reading, writing, callback) {
|
|
9169
|
+
callback = once_1(callback);
|
|
9170
|
+
|
|
9171
|
+
var closed = false;
|
|
9172
|
+
stream.on('close', function () {
|
|
9173
|
+
closed = true;
|
|
9174
|
+
});
|
|
9175
|
+
|
|
9176
|
+
endOfStream(stream, {readable: reading, writable: writing}, function (err) {
|
|
9177
|
+
if (err) return callback(err)
|
|
9178
|
+
closed = true;
|
|
9179
|
+
callback();
|
|
9180
|
+
});
|
|
9181
|
+
|
|
9182
|
+
var destroyed = false;
|
|
9183
|
+
return function (err) {
|
|
9184
|
+
if (closed) return
|
|
9185
|
+
if (destroyed) return
|
|
9186
|
+
destroyed = true;
|
|
9187
|
+
|
|
9188
|
+
if (isFS(stream)) return stream.close(noop$1) // use close for fs streams to avoid fd leaks
|
|
9189
|
+
if (isRequest(stream)) return stream.abort() // request.destroy just do .end - .abort is what we want
|
|
9190
|
+
|
|
9191
|
+
if (isFn(stream.destroy)) return stream.destroy()
|
|
9192
|
+
|
|
9193
|
+
callback(err || new Error('stream was destroyed'));
|
|
9194
|
+
}
|
|
9195
|
+
};
|
|
9196
|
+
|
|
9197
|
+
var call = function (fn) {
|
|
9198
|
+
fn();
|
|
9199
|
+
};
|
|
9200
|
+
|
|
9201
|
+
var pipe = function (from, to) {
|
|
9202
|
+
return from.pipe(to)
|
|
9203
|
+
};
|
|
9204
|
+
|
|
9205
|
+
var pump = function () {
|
|
9206
|
+
var streams = Array.prototype.slice.call(arguments);
|
|
9207
|
+
var callback = isFn(streams[streams.length - 1] || noop$1) && streams.pop() || noop$1;
|
|
9208
|
+
|
|
9209
|
+
if (Array.isArray(streams[0])) streams = streams[0];
|
|
9210
|
+
if (streams.length < 2) throw new Error('pump requires two streams per minimum')
|
|
9211
|
+
|
|
9212
|
+
var error;
|
|
9213
|
+
var destroys = streams.map(function (stream, i) {
|
|
9214
|
+
var reading = i < streams.length - 1;
|
|
9215
|
+
var writing = i > 0;
|
|
9216
|
+
return destroyer(stream, reading, writing, function (err) {
|
|
9217
|
+
if (!error) error = err;
|
|
9218
|
+
if (err) destroys.forEach(call);
|
|
9219
|
+
if (reading) return
|
|
9220
|
+
destroys.forEach(call);
|
|
9221
|
+
callback(error);
|
|
9222
|
+
})
|
|
9223
|
+
});
|
|
9224
|
+
|
|
9225
|
+
return streams.reduce(pipe)
|
|
9226
|
+
};
|
|
9227
|
+
|
|
9228
|
+
var pump_1 = pump;
|
|
9229
|
+
|
|
9230
|
+
var byline = createCommonjsModule(function (module) {
|
|
9231
|
+
// Copyright (C) 2011-2015 John Hewson
|
|
9232
|
+
//
|
|
9233
|
+
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
9234
|
+
// of this software and associated documentation files (the "Software"), to
|
|
9235
|
+
// deal in the Software without restriction, including without limitation the
|
|
9236
|
+
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
9237
|
+
// sell copies of the Software, and to permit persons to whom the Software is
|
|
9238
|
+
// furnished to do so, subject to the following conditions:
|
|
9239
|
+
//
|
|
9240
|
+
// The above copyright notice and this permission notice shall be included in
|
|
9241
|
+
// all copies or substantial portions of the Software.
|
|
9242
|
+
//
|
|
9243
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
9244
|
+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
9245
|
+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
9246
|
+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
9247
|
+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
9248
|
+
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
9249
|
+
// IN THE SOFTWARE.
|
|
9250
|
+
|
|
9251
|
+
|
|
9252
|
+
|
|
9253
|
+
// convinience API
|
|
9254
|
+
module.exports = function(readStream, options) {
|
|
9255
|
+
return module.exports.createStream(readStream, options);
|
|
9256
|
+
};
|
|
9257
|
+
|
|
9258
|
+
// basic API
|
|
9259
|
+
module.exports.createStream = function(readStream, options) {
|
|
9260
|
+
if (readStream) {
|
|
9261
|
+
return createLineStream(readStream, options);
|
|
9262
|
+
} else {
|
|
9263
|
+
return new LineStream(options);
|
|
9264
|
+
}
|
|
9265
|
+
};
|
|
9266
|
+
|
|
9267
|
+
// deprecated API
|
|
9268
|
+
module.exports.createLineStream = function(readStream) {
|
|
9269
|
+
console.log('WARNING: byline#createLineStream is deprecated and will be removed soon');
|
|
9270
|
+
return createLineStream(readStream);
|
|
9271
|
+
};
|
|
9272
|
+
|
|
9273
|
+
function createLineStream(readStream, options) {
|
|
9274
|
+
if (!readStream) {
|
|
9275
|
+
throw new Error('expected readStream');
|
|
9276
|
+
}
|
|
9277
|
+
if (!readStream.readable) {
|
|
9278
|
+
throw new Error('readStream must be readable');
|
|
9279
|
+
}
|
|
9280
|
+
var ls = new LineStream(options);
|
|
9281
|
+
readStream.pipe(ls);
|
|
9282
|
+
return ls;
|
|
9283
|
+
}
|
|
9284
|
+
|
|
9285
|
+
//
|
|
9286
|
+
// using the new node v0.10 "streams2" API
|
|
9287
|
+
//
|
|
9288
|
+
|
|
9289
|
+
module.exports.LineStream = LineStream;
|
|
9290
|
+
|
|
9291
|
+
function LineStream(options) {
|
|
9292
|
+
stream.Transform.call(this, options);
|
|
9293
|
+
options = options || {};
|
|
9294
|
+
|
|
9295
|
+
// use objectMode to stop the output from being buffered
|
|
9296
|
+
// which re-concatanates the lines, just without newlines.
|
|
9297
|
+
this._readableState.objectMode = true;
|
|
9298
|
+
this._lineBuffer = [];
|
|
9299
|
+
this._keepEmptyLines = options.keepEmptyLines || false;
|
|
9300
|
+
this._lastChunkEndedWithCR = false;
|
|
9301
|
+
|
|
9302
|
+
// take the source's encoding if we don't have one
|
|
9303
|
+
var self = this;
|
|
9304
|
+
this.on('pipe', function(src) {
|
|
9305
|
+
if (!self.encoding) {
|
|
9306
|
+
// but we can't do this for old-style streams
|
|
9307
|
+
if (src instanceof stream.Readable) {
|
|
9308
|
+
self.encoding = src._readableState.encoding;
|
|
9309
|
+
}
|
|
9310
|
+
}
|
|
9311
|
+
});
|
|
9312
|
+
}
|
|
9313
|
+
util$1.inherits(LineStream, stream.Transform);
|
|
9314
|
+
|
|
9315
|
+
LineStream.prototype._transform = function(chunk, encoding, done) {
|
|
9316
|
+
// decode binary chunks as UTF-8
|
|
9317
|
+
encoding = encoding || 'utf8';
|
|
9318
|
+
|
|
9319
|
+
if (Buffer.isBuffer(chunk)) {
|
|
9320
|
+
if (encoding == 'buffer') {
|
|
9321
|
+
chunk = chunk.toString(); // utf8
|
|
9322
|
+
encoding = 'utf8';
|
|
9323
|
+
}
|
|
9324
|
+
else {
|
|
9325
|
+
chunk = chunk.toString(encoding);
|
|
9326
|
+
}
|
|
9327
|
+
}
|
|
9328
|
+
this._chunkEncoding = encoding;
|
|
9329
|
+
|
|
9330
|
+
// see: http://www.unicode.org/reports/tr18/#Line_Boundaries
|
|
9331
|
+
var lines = chunk.split(/\r\n|[\n\v\f\r\x85\u2028\u2029]/g);
|
|
9332
|
+
|
|
9333
|
+
// don't split CRLF which spans chunks
|
|
9334
|
+
if (this._lastChunkEndedWithCR && chunk[0] == '\n') {
|
|
9335
|
+
lines.shift();
|
|
9336
|
+
}
|
|
9337
|
+
|
|
9338
|
+
if (this._lineBuffer.length > 0) {
|
|
9339
|
+
this._lineBuffer[this._lineBuffer.length - 1] += lines[0];
|
|
9340
|
+
lines.shift();
|
|
9341
|
+
}
|
|
9342
|
+
|
|
9343
|
+
this._lastChunkEndedWithCR = chunk[chunk.length - 1] == '\r';
|
|
9344
|
+
this._lineBuffer = this._lineBuffer.concat(lines);
|
|
9345
|
+
this._pushBuffer(encoding, 1, done);
|
|
9346
|
+
};
|
|
9347
|
+
|
|
9348
|
+
LineStream.prototype._pushBuffer = function(encoding, keep, done) {
|
|
9349
|
+
// always buffer the last (possibly partial) line
|
|
9350
|
+
while (this._lineBuffer.length > keep) {
|
|
9351
|
+
var line = this._lineBuffer.shift();
|
|
9352
|
+
// skip empty lines
|
|
9353
|
+
if (this._keepEmptyLines || line.length > 0 ) {
|
|
9354
|
+
if (!this.push(this._reencode(line, encoding))) {
|
|
9355
|
+
// when the high-water mark is reached, defer pushes until the next tick
|
|
9356
|
+
var self = this;
|
|
9357
|
+
timers.setImmediate(function() {
|
|
9358
|
+
self._pushBuffer(encoding, keep, done);
|
|
9359
|
+
});
|
|
9360
|
+
return;
|
|
9361
|
+
}
|
|
9362
|
+
}
|
|
9363
|
+
}
|
|
9364
|
+
done();
|
|
9365
|
+
};
|
|
9366
|
+
|
|
9367
|
+
LineStream.prototype._flush = function(done) {
|
|
9368
|
+
this._pushBuffer(this._chunkEncoding, 0, done);
|
|
9369
|
+
};
|
|
9370
|
+
|
|
9371
|
+
// see Readable::push
|
|
9372
|
+
LineStream.prototype._reencode = function(line, chunkEncoding) {
|
|
9373
|
+
if (this.encoding && this.encoding != chunkEncoding) {
|
|
9374
|
+
return new Buffer(line, chunkEncoding).toString(this.encoding);
|
|
9375
|
+
}
|
|
9376
|
+
else if (this.encoding) {
|
|
9377
|
+
// this should be the most common case, i.e. we're using an encoded source stream
|
|
9378
|
+
return line;
|
|
9379
|
+
}
|
|
9380
|
+
else {
|
|
9381
|
+
return new Buffer(line, chunkEncoding);
|
|
9382
|
+
}
|
|
9383
|
+
};
|
|
9384
|
+
});
|
|
9385
|
+
byline.createStream;
|
|
9386
|
+
byline.createLineStream;
|
|
9387
|
+
byline.LineStream;
|
|
9388
|
+
|
|
9389
|
+
var bugsnag = createCommonjsModule(function (module, exports) {
|
|
9390
|
+
(function(f){{module.exports=f();}})(function(){var Breadcrumb = /*#__PURE__*/function () {
|
|
9391
|
+
function Breadcrumb(message, metadata, type, timestamp) {
|
|
9392
|
+
if (timestamp === void 0) {
|
|
9393
|
+
timestamp = new Date();
|
|
9394
|
+
}
|
|
9395
|
+
|
|
9396
|
+
this.type = type;
|
|
9397
|
+
this.message = message;
|
|
9398
|
+
this.metadata = metadata;
|
|
9399
|
+
this.timestamp = timestamp;
|
|
9400
|
+
}
|
|
9401
|
+
|
|
9402
|
+
var _proto = Breadcrumb.prototype;
|
|
9403
|
+
|
|
9404
|
+
_proto.toJSON = function toJSON() {
|
|
9405
|
+
return {
|
|
9406
|
+
type: this.type,
|
|
9407
|
+
name: this.message,
|
|
9408
|
+
timestamp: this.timestamp,
|
|
9409
|
+
metaData: this.metadata
|
|
9410
|
+
};
|
|
9411
|
+
};
|
|
9412
|
+
|
|
9413
|
+
return Breadcrumb;
|
|
9414
|
+
}();
|
|
9415
|
+
|
|
9416
|
+
var _$Breadcrumb_1 = Breadcrumb;
|
|
9417
|
+
|
|
9418
|
+
var _$breadcrumbTypes_6 = ['navigation', 'request', 'process', 'log', 'user', 'state', 'error', 'manual'];
|
|
9419
|
+
|
|
9420
|
+
// Array#reduce
|
|
9421
|
+
var _$reduce_16 = function (arr, fn, accum) {
|
|
9422
|
+
var val = accum;
|
|
9423
|
+
|
|
9424
|
+
for (var i = 0, len = arr.length; i < len; i++) {
|
|
9425
|
+
val = fn(val, arr[i], i, arr);
|
|
9426
|
+
}
|
|
9427
|
+
|
|
9428
|
+
return val;
|
|
9429
|
+
};
|
|
9430
|
+
|
|
9431
|
+
|
|
9432
|
+
var _$filter_11 = function (arr, fn) {
|
|
9433
|
+
return _$reduce_16(arr, function (accum, item, i, arr) {
|
|
9434
|
+
return !fn(item, i, arr) ? accum : accum.concat(item);
|
|
9435
|
+
}, []);
|
|
9436
|
+
};
|
|
9437
|
+
|
|
9438
|
+
|
|
9439
|
+
var _$includes_12 = function (arr, x) {
|
|
9440
|
+
return _$reduce_16(arr, function (accum, item, i, arr) {
|
|
9441
|
+
return accum === true || item === x;
|
|
9442
|
+
}, false);
|
|
9443
|
+
};
|
|
9444
|
+
|
|
9445
|
+
// Array#isArray
|
|
9446
|
+
var _$isArray_13 = function (obj) {
|
|
9447
|
+
return Object.prototype.toString.call(obj) === '[object Array]';
|
|
9448
|
+
};
|
|
9449
|
+
|
|
9450
|
+
/* eslint-disable-next-line no-prototype-builtins */
|
|
9451
|
+
var _hasDontEnumBug = !{
|
|
9452
|
+
toString: null
|
|
9453
|
+
}.propertyIsEnumerable('toString');
|
|
9454
|
+
|
|
9455
|
+
var _dontEnums = ['toString', 'toLocaleString', 'valueOf', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'constructor']; // Object#keys
|
|
9456
|
+
|
|
9457
|
+
var _$keys_14 = function (obj) {
|
|
9458
|
+
// stripped down version of
|
|
9459
|
+
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/Keys
|
|
9460
|
+
var result = [];
|
|
9461
|
+
var prop;
|
|
9462
|
+
|
|
9463
|
+
for (prop in obj) {
|
|
9464
|
+
if (Object.prototype.hasOwnProperty.call(obj, prop)) result.push(prop);
|
|
9465
|
+
}
|
|
9466
|
+
|
|
9467
|
+
if (!_hasDontEnumBug) return result;
|
|
9468
|
+
|
|
9469
|
+
for (var i = 0, len = _dontEnums.length; i < len; i++) {
|
|
9470
|
+
if (Object.prototype.hasOwnProperty.call(obj, _dontEnums[i])) result.push(_dontEnums[i]);
|
|
9471
|
+
}
|
|
9472
|
+
|
|
9473
|
+
return result;
|
|
9474
|
+
};
|
|
9475
|
+
|
|
9476
|
+
var _$intRange_25 = function (min, max) {
|
|
9477
|
+
if (min === void 0) {
|
|
9478
|
+
min = 1;
|
|
9479
|
+
}
|
|
9480
|
+
|
|
9481
|
+
if (max === void 0) {
|
|
9482
|
+
max = Infinity;
|
|
9483
|
+
}
|
|
9484
|
+
|
|
9485
|
+
return function (value) {
|
|
9486
|
+
return typeof value === 'number' && parseInt('' + value, 10) === value && value >= min && value <= max;
|
|
9487
|
+
};
|
|
9488
|
+
};
|
|
9489
|
+
|
|
9490
|
+
var _$listOfFunctions_26 = function (value) {
|
|
9491
|
+
return typeof value === 'function' || _$isArray_13(value) && _$filter_11(value, function (f) {
|
|
9492
|
+
return typeof f === 'function';
|
|
9493
|
+
}).length === value.length;
|
|
9494
|
+
};
|
|
9495
|
+
|
|
9496
|
+
var _$stringWithLength_27 = function (value) {
|
|
9497
|
+
return typeof value === 'string' && !!value.length;
|
|
9498
|
+
};
|
|
9499
|
+
|
|
9500
|
+
var _$config_3 = {};
|
|
9501
|
+
|
|
9502
|
+
var defaultErrorTypes = function () {
|
|
9503
|
+
return {
|
|
9504
|
+
unhandledExceptions: true,
|
|
9505
|
+
unhandledRejections: true
|
|
9506
|
+
};
|
|
9507
|
+
};
|
|
9508
|
+
|
|
9509
|
+
_$config_3.schema = {
|
|
9510
|
+
apiKey: {
|
|
9511
|
+
defaultValue: function () {
|
|
9512
|
+
return null;
|
|
9513
|
+
},
|
|
9514
|
+
message: 'is required',
|
|
9515
|
+
validate: _$stringWithLength_27
|
|
9516
|
+
},
|
|
9517
|
+
appVersion: {
|
|
9518
|
+
defaultValue: function () {
|
|
9519
|
+
return undefined;
|
|
9520
|
+
},
|
|
9521
|
+
message: 'should be a string',
|
|
9522
|
+
validate: function (value) {
|
|
9523
|
+
return value === undefined || _$stringWithLength_27(value);
|
|
9524
|
+
}
|
|
9525
|
+
},
|
|
9526
|
+
appType: {
|
|
9527
|
+
defaultValue: function () {
|
|
9528
|
+
return undefined;
|
|
9529
|
+
},
|
|
9530
|
+
message: 'should be a string',
|
|
9531
|
+
validate: function (value) {
|
|
9532
|
+
return value === undefined || _$stringWithLength_27(value);
|
|
9533
|
+
}
|
|
9534
|
+
},
|
|
9535
|
+
autoDetectErrors: {
|
|
9536
|
+
defaultValue: function () {
|
|
9537
|
+
return true;
|
|
9538
|
+
},
|
|
9539
|
+
message: 'should be true|false',
|
|
9540
|
+
validate: function (value) {
|
|
9541
|
+
return value === true || value === false;
|
|
9542
|
+
}
|
|
9543
|
+
},
|
|
9544
|
+
enabledErrorTypes: {
|
|
9545
|
+
defaultValue: function () {
|
|
9546
|
+
return defaultErrorTypes();
|
|
9547
|
+
},
|
|
9548
|
+
message: 'should be an object containing the flags { unhandledExceptions:true|false, unhandledRejections:true|false }',
|
|
9549
|
+
allowPartialObject: true,
|
|
9550
|
+
validate: function (value) {
|
|
9551
|
+
// ensure we have an object
|
|
9552
|
+
if (typeof value !== 'object' || !value) return false;
|
|
9553
|
+
var providedKeys = _$keys_14(value);
|
|
9554
|
+
var defaultKeys = _$keys_14(defaultErrorTypes()); // ensure it only has a subset of the allowed keys
|
|
9555
|
+
|
|
9556
|
+
if (_$filter_11(providedKeys, function (k) {
|
|
9557
|
+
return _$includes_12(defaultKeys, k);
|
|
9558
|
+
}).length < providedKeys.length) return false; // ensure all of the values are boolean
|
|
9559
|
+
|
|
9560
|
+
if (_$filter_11(_$keys_14(value), function (k) {
|
|
9561
|
+
return typeof value[k] !== 'boolean';
|
|
9562
|
+
}).length > 0) return false;
|
|
9563
|
+
return true;
|
|
9564
|
+
}
|
|
9565
|
+
},
|
|
9566
|
+
onError: {
|
|
9567
|
+
defaultValue: function () {
|
|
9568
|
+
return [];
|
|
9569
|
+
},
|
|
9570
|
+
message: 'should be a function or array of functions',
|
|
9571
|
+
validate: _$listOfFunctions_26
|
|
9572
|
+
},
|
|
9573
|
+
onSession: {
|
|
9574
|
+
defaultValue: function () {
|
|
9575
|
+
return [];
|
|
9576
|
+
},
|
|
9577
|
+
message: 'should be a function or array of functions',
|
|
9578
|
+
validate: _$listOfFunctions_26
|
|
9579
|
+
},
|
|
9580
|
+
onBreadcrumb: {
|
|
9581
|
+
defaultValue: function () {
|
|
9582
|
+
return [];
|
|
9583
|
+
},
|
|
9584
|
+
message: 'should be a function or array of functions',
|
|
9585
|
+
validate: _$listOfFunctions_26
|
|
9586
|
+
},
|
|
9587
|
+
endpoints: {
|
|
9588
|
+
defaultValue: function () {
|
|
9589
|
+
return {
|
|
9590
|
+
notify: 'https://notify.bugsnag.com',
|
|
9591
|
+
sessions: 'https://sessions.bugsnag.com'
|
|
9592
|
+
};
|
|
9593
|
+
},
|
|
9594
|
+
message: 'should be an object containing endpoint URLs { notify, sessions }',
|
|
9595
|
+
validate: function (val) {
|
|
9596
|
+
return (// first, ensure it's an object
|
|
9597
|
+
val && typeof val === 'object' && // notify and sessions must always be set
|
|
9598
|
+
_$stringWithLength_27(val.notify) && _$stringWithLength_27(val.sessions) && // ensure no keys other than notify/session are set on endpoints object
|
|
9599
|
+
_$filter_11(_$keys_14(val), function (k) {
|
|
9600
|
+
return !_$includes_12(['notify', 'sessions'], k);
|
|
9601
|
+
}).length === 0
|
|
9602
|
+
);
|
|
9603
|
+
}
|
|
9604
|
+
},
|
|
9605
|
+
autoTrackSessions: {
|
|
9606
|
+
defaultValue: function (val) {
|
|
9607
|
+
return true;
|
|
9608
|
+
},
|
|
9609
|
+
message: 'should be true|false',
|
|
9610
|
+
validate: function (val) {
|
|
9611
|
+
return val === true || val === false;
|
|
9612
|
+
}
|
|
9613
|
+
},
|
|
9614
|
+
enabledReleaseStages: {
|
|
9615
|
+
defaultValue: function () {
|
|
9616
|
+
return null;
|
|
9617
|
+
},
|
|
9618
|
+
message: 'should be an array of strings',
|
|
9619
|
+
validate: function (value) {
|
|
9620
|
+
return value === null || _$isArray_13(value) && _$filter_11(value, function (f) {
|
|
9621
|
+
return typeof f === 'string';
|
|
9622
|
+
}).length === value.length;
|
|
9623
|
+
}
|
|
9624
|
+
},
|
|
9625
|
+
releaseStage: {
|
|
9626
|
+
defaultValue: function () {
|
|
9627
|
+
return 'production';
|
|
9628
|
+
},
|
|
9629
|
+
message: 'should be a string',
|
|
9630
|
+
validate: function (value) {
|
|
9631
|
+
return typeof value === 'string' && value.length;
|
|
9632
|
+
}
|
|
9633
|
+
},
|
|
9634
|
+
maxBreadcrumbs: {
|
|
9635
|
+
defaultValue: function () {
|
|
9636
|
+
return 25;
|
|
9637
|
+
},
|
|
9638
|
+
message: 'should be a number ≤100',
|
|
9639
|
+
validate: function (value) {
|
|
9640
|
+
return _$intRange_25(0, 100)(value);
|
|
9641
|
+
}
|
|
9642
|
+
},
|
|
9643
|
+
enabledBreadcrumbTypes: {
|
|
9644
|
+
defaultValue: function () {
|
|
9645
|
+
return _$breadcrumbTypes_6;
|
|
9646
|
+
},
|
|
9647
|
+
message: "should be null or a list of available breadcrumb types (" + _$breadcrumbTypes_6.join(',') + ")",
|
|
9648
|
+
validate: function (value) {
|
|
9649
|
+
return value === null || _$isArray_13(value) && _$reduce_16(value, function (accum, maybeType) {
|
|
9650
|
+
if (accum === false) return accum;
|
|
9651
|
+
return _$includes_12(_$breadcrumbTypes_6, maybeType);
|
|
9652
|
+
}, true);
|
|
9653
|
+
}
|
|
9654
|
+
},
|
|
9655
|
+
context: {
|
|
9656
|
+
defaultValue: function () {
|
|
9657
|
+
return undefined;
|
|
9658
|
+
},
|
|
9659
|
+
message: 'should be a string',
|
|
9660
|
+
validate: function (value) {
|
|
9661
|
+
return value === undefined || typeof value === 'string';
|
|
9662
|
+
}
|
|
9663
|
+
},
|
|
9664
|
+
user: {
|
|
9665
|
+
defaultValue: function () {
|
|
9666
|
+
return {};
|
|
9667
|
+
},
|
|
9668
|
+
message: 'should be an object with { id, email, name } properties',
|
|
9669
|
+
validate: function (value) {
|
|
9670
|
+
return value === null || value && _$reduce_16(_$keys_14(value), function (accum, key) {
|
|
9671
|
+
return accum && _$includes_12(['id', 'email', 'name'], key);
|
|
9672
|
+
}, true);
|
|
9673
|
+
}
|
|
9674
|
+
},
|
|
9675
|
+
metadata: {
|
|
9676
|
+
defaultValue: function () {
|
|
9677
|
+
return {};
|
|
9678
|
+
},
|
|
9679
|
+
message: 'should be an object',
|
|
9680
|
+
validate: function (value) {
|
|
9681
|
+
return typeof value === 'object' && value !== null;
|
|
9682
|
+
}
|
|
9683
|
+
},
|
|
9684
|
+
logger: {
|
|
9685
|
+
defaultValue: function () {
|
|
9686
|
+
return undefined;
|
|
9687
|
+
},
|
|
9688
|
+
message: 'should be null or an object with methods { debug, info, warn, error }',
|
|
9689
|
+
validate: function (value) {
|
|
9690
|
+
return !value || value && _$reduce_16(['debug', 'info', 'warn', 'error'], function (accum, method) {
|
|
9691
|
+
return accum && typeof value[method] === 'function';
|
|
9692
|
+
}, true);
|
|
9693
|
+
}
|
|
9694
|
+
},
|
|
9695
|
+
redactedKeys: {
|
|
9696
|
+
defaultValue: function () {
|
|
9697
|
+
return ['password'];
|
|
9698
|
+
},
|
|
9699
|
+
message: 'should be an array of strings|regexes',
|
|
9700
|
+
validate: function (value) {
|
|
9701
|
+
return _$isArray_13(value) && value.length === _$filter_11(value, function (s) {
|
|
9702
|
+
return typeof s === 'string' || s && typeof s.test === 'function';
|
|
9703
|
+
}).length;
|
|
9704
|
+
}
|
|
9705
|
+
},
|
|
9706
|
+
plugins: {
|
|
9707
|
+
defaultValue: function () {
|
|
9708
|
+
return [];
|
|
9709
|
+
},
|
|
9710
|
+
message: 'should be an array of plugin objects',
|
|
9711
|
+
validate: function (value) {
|
|
9712
|
+
return _$isArray_13(value) && value.length === _$filter_11(value, function (p) {
|
|
9713
|
+
return p && typeof p === 'object' && typeof p.load === 'function';
|
|
9714
|
+
}).length;
|
|
9715
|
+
}
|
|
9716
|
+
},
|
|
9717
|
+
featureFlags: {
|
|
9718
|
+
defaultValue: function () {
|
|
9719
|
+
return [];
|
|
9720
|
+
},
|
|
9721
|
+
message: 'should be an array of objects that have a "name" property',
|
|
9722
|
+
validate: function (value) {
|
|
9723
|
+
return _$isArray_13(value) && value.length === _$filter_11(value, function (feature) {
|
|
9724
|
+
return feature && typeof feature === 'object' && typeof feature.name === 'string';
|
|
9725
|
+
}).length;
|
|
9726
|
+
}
|
|
9727
|
+
}
|
|
9728
|
+
};
|
|
9729
|
+
|
|
9730
|
+
var _$errorStackParser_9 = errorStackParser;
|
|
9731
|
+
|
|
9732
|
+
// extends helper from babel
|
|
9733
|
+
// https://github.com/babel/babel/blob/916429b516e6466fd06588ee820e40e025d7f3a3/packages/babel-helpers/src/helpers.js#L377-L393
|
|
9734
|
+
var _$assign_10 = function (target) {
|
|
9735
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
9736
|
+
var source = arguments[i];
|
|
9737
|
+
|
|
9738
|
+
for (var key in source) {
|
|
9739
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
9740
|
+
target[key] = source[key];
|
|
9741
|
+
}
|
|
9742
|
+
}
|
|
9743
|
+
}
|
|
9744
|
+
|
|
9745
|
+
return target;
|
|
9746
|
+
};
|
|
9747
|
+
|
|
9748
|
+
|
|
9749
|
+
var _$map_15 = function (arr, fn) {
|
|
9750
|
+
return _$reduce_16(arr, function (accum, item, i, arr) {
|
|
9751
|
+
return accum.concat(fn(item, i, arr));
|
|
9752
|
+
}, []);
|
|
9753
|
+
};
|
|
9754
|
+
|
|
9755
|
+
var _$safeJsonStringify_31 = function (data, replacer, space, opts) {
|
|
9756
|
+
var redactedKeys = opts && opts.redactedKeys ? opts.redactedKeys : [];
|
|
9757
|
+
var redactedPaths = opts && opts.redactedPaths ? opts.redactedPaths : [];
|
|
9758
|
+
return JSON.stringify(prepareObjForSerialization(data, redactedKeys, redactedPaths), replacer, space);
|
|
9759
|
+
};
|
|
9760
|
+
|
|
9761
|
+
var MAX_DEPTH = 20;
|
|
9762
|
+
var MAX_EDGES = 25000;
|
|
9763
|
+
var MIN_PRESERVED_DEPTH = 8;
|
|
9764
|
+
var REPLACEMENT_NODE = '...';
|
|
9765
|
+
|
|
9766
|
+
function isError(o) {
|
|
9767
|
+
return o instanceof Error || /^\[object (Error|(Dom)?Exception)\]$/.test(Object.prototype.toString.call(o));
|
|
9768
|
+
}
|
|
9769
|
+
|
|
9770
|
+
function throwsMessage(err) {
|
|
9771
|
+
return '[Throws: ' + (err ? err.message : '?') + ']';
|
|
9772
|
+
}
|
|
9773
|
+
|
|
9774
|
+
function find(haystack, needle) {
|
|
9775
|
+
for (var i = 0, len = haystack.length; i < len; i++) {
|
|
9776
|
+
if (haystack[i] === needle) return true;
|
|
9777
|
+
}
|
|
9778
|
+
|
|
9779
|
+
return false;
|
|
9780
|
+
} // returns true if the string `path` starts with any of the provided `paths`
|
|
9781
|
+
|
|
9782
|
+
|
|
9783
|
+
function isDescendent(paths, path) {
|
|
9784
|
+
for (var i = 0, len = paths.length; i < len; i++) {
|
|
9785
|
+
if (path.indexOf(paths[i]) === 0) return true;
|
|
9786
|
+
}
|
|
9787
|
+
|
|
9788
|
+
return false;
|
|
9789
|
+
}
|
|
9790
|
+
|
|
9791
|
+
function shouldRedact(patterns, key) {
|
|
9792
|
+
for (var i = 0, len = patterns.length; i < len; i++) {
|
|
9793
|
+
if (typeof patterns[i] === 'string' && patterns[i].toLowerCase() === key.toLowerCase()) return true;
|
|
9794
|
+
if (patterns[i] && typeof patterns[i].test === 'function' && patterns[i].test(key)) return true;
|
|
9795
|
+
}
|
|
9796
|
+
|
|
9797
|
+
return false;
|
|
9798
|
+
}
|
|
9799
|
+
|
|
9800
|
+
function __isArray_31(obj) {
|
|
9801
|
+
return Object.prototype.toString.call(obj) === '[object Array]';
|
|
9802
|
+
}
|
|
9803
|
+
|
|
9804
|
+
function safelyGetProp(obj, prop) {
|
|
9805
|
+
try {
|
|
9806
|
+
return obj[prop];
|
|
9807
|
+
} catch (err) {
|
|
9808
|
+
return throwsMessage(err);
|
|
9809
|
+
}
|
|
9810
|
+
}
|
|
9811
|
+
|
|
9812
|
+
function prepareObjForSerialization(obj, redactedKeys, redactedPaths) {
|
|
9813
|
+
var seen = []; // store references to objects we have seen before
|
|
9814
|
+
|
|
9815
|
+
var edges = 0;
|
|
9816
|
+
|
|
9817
|
+
function visit(obj, path) {
|
|
9818
|
+
function edgesExceeded() {
|
|
9819
|
+
return path.length > MIN_PRESERVED_DEPTH && edges > MAX_EDGES;
|
|
9820
|
+
}
|
|
9821
|
+
|
|
9822
|
+
edges++;
|
|
9823
|
+
if (path.length > MAX_DEPTH) return REPLACEMENT_NODE;
|
|
9824
|
+
if (edgesExceeded()) return REPLACEMENT_NODE;
|
|
9825
|
+
if (obj === null || typeof obj !== 'object') return obj;
|
|
9826
|
+
if (find(seen, obj)) return '[Circular]';
|
|
9827
|
+
seen.push(obj);
|
|
9828
|
+
|
|
9829
|
+
if (typeof obj.toJSON === 'function') {
|
|
9830
|
+
try {
|
|
9831
|
+
// we're not going to count this as an edge because it
|
|
9832
|
+
// replaces the value of the currently visited object
|
|
9833
|
+
edges--;
|
|
9834
|
+
var fResult = visit(obj.toJSON(), path);
|
|
9835
|
+
seen.pop();
|
|
9836
|
+
return fResult;
|
|
9837
|
+
} catch (err) {
|
|
9838
|
+
return throwsMessage(err);
|
|
9839
|
+
}
|
|
9840
|
+
}
|
|
9841
|
+
|
|
9842
|
+
var er = isError(obj);
|
|
9843
|
+
|
|
9844
|
+
if (er) {
|
|
9845
|
+
edges--;
|
|
9846
|
+
var eResult = visit({
|
|
9847
|
+
name: obj.name,
|
|
9848
|
+
message: obj.message
|
|
9849
|
+
}, path);
|
|
9850
|
+
seen.pop();
|
|
9851
|
+
return eResult;
|
|
9852
|
+
}
|
|
9853
|
+
|
|
9854
|
+
if (__isArray_31(obj)) {
|
|
9855
|
+
var aResult = [];
|
|
9856
|
+
|
|
9857
|
+
for (var i = 0, len = obj.length; i < len; i++) {
|
|
9858
|
+
if (edgesExceeded()) {
|
|
9859
|
+
aResult.push(REPLACEMENT_NODE);
|
|
9860
|
+
break;
|
|
9861
|
+
}
|
|
9862
|
+
|
|
9863
|
+
aResult.push(visit(obj[i], path.concat('[]')));
|
|
9864
|
+
}
|
|
9865
|
+
|
|
9866
|
+
seen.pop();
|
|
9867
|
+
return aResult;
|
|
9868
|
+
}
|
|
9869
|
+
|
|
9870
|
+
var result = {};
|
|
9871
|
+
|
|
9872
|
+
try {
|
|
9873
|
+
for (var prop in obj) {
|
|
9874
|
+
if (!Object.prototype.hasOwnProperty.call(obj, prop)) continue;
|
|
9875
|
+
|
|
9876
|
+
if (isDescendent(redactedPaths, path.join('.')) && shouldRedact(redactedKeys, prop)) {
|
|
9877
|
+
result[prop] = '[REDACTED]';
|
|
9878
|
+
continue;
|
|
9879
|
+
}
|
|
9880
|
+
|
|
9881
|
+
if (edgesExceeded()) {
|
|
9882
|
+
result[prop] = REPLACEMENT_NODE;
|
|
9883
|
+
break;
|
|
9884
|
+
}
|
|
9885
|
+
|
|
9886
|
+
result[prop] = visit(safelyGetProp(obj, prop), path.concat(prop));
|
|
9887
|
+
}
|
|
9888
|
+
} catch (e) {}
|
|
9889
|
+
|
|
9890
|
+
seen.pop();
|
|
9891
|
+
return result;
|
|
9892
|
+
}
|
|
9893
|
+
|
|
9894
|
+
return visit(obj, []);
|
|
9895
|
+
}
|
|
9896
|
+
|
|
9897
|
+
function add(existingFeatures, existingFeatureKeys, name, variant) {
|
|
9898
|
+
if (typeof name !== 'string') {
|
|
9899
|
+
return;
|
|
9900
|
+
}
|
|
9901
|
+
|
|
9902
|
+
if (variant === undefined) {
|
|
9903
|
+
variant = null;
|
|
9904
|
+
} else if (variant !== null && typeof variant !== 'string') {
|
|
9905
|
+
variant = _$safeJsonStringify_31(variant);
|
|
9906
|
+
}
|
|
9907
|
+
|
|
9908
|
+
var existingIndex = existingFeatureKeys[name];
|
|
9909
|
+
|
|
9910
|
+
if (typeof existingIndex === 'number') {
|
|
9911
|
+
existingFeatures[existingIndex] = {
|
|
9912
|
+
name: name,
|
|
9913
|
+
variant: variant
|
|
9914
|
+
};
|
|
9915
|
+
return;
|
|
9916
|
+
}
|
|
9917
|
+
|
|
9918
|
+
existingFeatures.push({
|
|
9919
|
+
name: name,
|
|
9920
|
+
variant: variant
|
|
9921
|
+
});
|
|
9922
|
+
existingFeatureKeys[name] = existingFeatures.length - 1;
|
|
9923
|
+
}
|
|
9924
|
+
|
|
9925
|
+
function merge(existingFeatures, newFeatures, existingFeatureKeys) {
|
|
9926
|
+
if (!_$isArray_13(newFeatures)) {
|
|
9927
|
+
return;
|
|
9928
|
+
}
|
|
9929
|
+
|
|
9930
|
+
for (var i = 0; i < newFeatures.length; ++i) {
|
|
9931
|
+
var feature = newFeatures[i];
|
|
9932
|
+
|
|
9933
|
+
if (feature === null || typeof feature !== 'object') {
|
|
9934
|
+
continue;
|
|
9935
|
+
} // 'add' will handle if 'name' doesn't exist & 'variant' is optional
|
|
9936
|
+
|
|
9937
|
+
|
|
9938
|
+
add(existingFeatures, existingFeatureKeys, feature.name, feature.variant);
|
|
9939
|
+
}
|
|
9940
|
+
|
|
9941
|
+
return existingFeatures;
|
|
9942
|
+
} // convert feature flags from a map of 'name -> variant' into the format required
|
|
9943
|
+
// by the Bugsnag Event API:
|
|
9944
|
+
// [{ featureFlag: 'name', variant: 'variant' }, { featureFlag: 'name 2' }]
|
|
9945
|
+
|
|
9946
|
+
|
|
9947
|
+
function toEventApi(featureFlags) {
|
|
9948
|
+
return _$map_15(_$filter_11(featureFlags, Boolean), function (_ref) {
|
|
9949
|
+
var name = _ref.name,
|
|
9950
|
+
variant = _ref.variant;
|
|
9951
|
+
var flag = {
|
|
9952
|
+
featureFlag: name
|
|
9953
|
+
}; // don't add a 'variant' property unless there's actually a value
|
|
9954
|
+
|
|
9955
|
+
if (typeof variant === 'string') {
|
|
9956
|
+
flag.variant = variant;
|
|
9957
|
+
}
|
|
9958
|
+
|
|
9959
|
+
return flag;
|
|
9960
|
+
});
|
|
9961
|
+
}
|
|
9962
|
+
|
|
9963
|
+
function clear(features, featuresIndex, name) {
|
|
9964
|
+
var existingIndex = featuresIndex[name];
|
|
9965
|
+
|
|
9966
|
+
if (typeof existingIndex === 'number') {
|
|
9967
|
+
features[existingIndex] = null;
|
|
9968
|
+
delete featuresIndex[name];
|
|
9969
|
+
}
|
|
9970
|
+
}
|
|
9971
|
+
|
|
9972
|
+
var _$featureFlagDelegate_17 = {
|
|
9973
|
+
add: add,
|
|
9974
|
+
clear: clear,
|
|
9975
|
+
merge: merge,
|
|
9976
|
+
toEventApi: toEventApi
|
|
9977
|
+
};
|
|
9978
|
+
|
|
9979
|
+
// Given `err` which may be an error, does it have a stack property which is a string?
|
|
9980
|
+
var _$hasStack_18 = function (err) {
|
|
9981
|
+
return !!err && (!!err.stack || !!err.stacktrace || !!err['opera#sourceloc']) && typeof (err.stack || err.stacktrace || err['opera#sourceloc']) === 'string' && err.stack !== err.name + ": " + err.message;
|
|
9982
|
+
};
|
|
9983
|
+
|
|
9984
|
+
var _$iserror_19 = iserror;
|
|
9985
|
+
|
|
9986
|
+
var __add_21 = function (state, section, keyOrObj, maybeVal) {
|
|
9987
|
+
var _updates;
|
|
9988
|
+
|
|
9989
|
+
if (!section) return;
|
|
9990
|
+
var updates; // addMetadata("section", null) -> clears section
|
|
9991
|
+
|
|
9992
|
+
if (keyOrObj === null) return __clear_21(state, section); // normalise the two supported input types into object form
|
|
9993
|
+
|
|
9994
|
+
if (typeof keyOrObj === 'object') updates = keyOrObj;
|
|
9995
|
+
if (typeof keyOrObj === 'string') updates = (_updates = {}, _updates[keyOrObj] = maybeVal, _updates); // exit if we don't have an updates object at this point
|
|
9996
|
+
|
|
9997
|
+
if (!updates) return; // ensure a section with this name exists
|
|
9998
|
+
|
|
9999
|
+
if (!state[section]) state[section] = {}; // merge the updates with the existing section
|
|
10000
|
+
|
|
10001
|
+
state[section] = _$assign_10({}, state[section], updates);
|
|
10002
|
+
};
|
|
10003
|
+
|
|
10004
|
+
var get = function (state, section, key) {
|
|
10005
|
+
if (typeof section !== 'string') return undefined;
|
|
10006
|
+
|
|
10007
|
+
if (!key) {
|
|
10008
|
+
return state[section];
|
|
10009
|
+
}
|
|
10010
|
+
|
|
10011
|
+
if (state[section]) {
|
|
10012
|
+
return state[section][key];
|
|
10013
|
+
}
|
|
10014
|
+
|
|
10015
|
+
return undefined;
|
|
10016
|
+
};
|
|
10017
|
+
|
|
10018
|
+
var __clear_21 = function (state, section, key) {
|
|
10019
|
+
if (typeof section !== 'string') return; // clear an entire section
|
|
10020
|
+
|
|
10021
|
+
if (!key) {
|
|
10022
|
+
delete state[section];
|
|
10023
|
+
return;
|
|
10024
|
+
} // clear a single value from a section
|
|
10025
|
+
|
|
10026
|
+
|
|
10027
|
+
if (state[section]) {
|
|
10028
|
+
delete state[section][key];
|
|
10029
|
+
}
|
|
10030
|
+
};
|
|
10031
|
+
|
|
10032
|
+
var _$metadataDelegate_21 = {
|
|
10033
|
+
add: __add_21,
|
|
10034
|
+
get: get,
|
|
10035
|
+
clear: __clear_21
|
|
10036
|
+
};
|
|
10037
|
+
|
|
10038
|
+
var StackGenerator = stackGenerator;
|
|
10039
|
+
|
|
10040
|
+
var Event = /*#__PURE__*/function () {
|
|
10041
|
+
function Event(errorClass, errorMessage, stacktrace, handledState, originalError) {
|
|
10042
|
+
if (stacktrace === void 0) {
|
|
10043
|
+
stacktrace = [];
|
|
10044
|
+
}
|
|
10045
|
+
|
|
10046
|
+
if (handledState === void 0) {
|
|
10047
|
+
handledState = defaultHandledState();
|
|
10048
|
+
}
|
|
10049
|
+
|
|
10050
|
+
this.apiKey = undefined;
|
|
10051
|
+
this.context = undefined;
|
|
10052
|
+
this.groupingHash = undefined;
|
|
10053
|
+
this.originalError = originalError;
|
|
10054
|
+
this._handledState = handledState;
|
|
10055
|
+
this.severity = this._handledState.severity;
|
|
10056
|
+
this.unhandled = this._handledState.unhandled;
|
|
10057
|
+
this.app = {};
|
|
10058
|
+
this.device = {};
|
|
10059
|
+
this.request = {};
|
|
10060
|
+
this.breadcrumbs = [];
|
|
10061
|
+
this.threads = [];
|
|
10062
|
+
this._metadata = {};
|
|
10063
|
+
this._features = [];
|
|
10064
|
+
this._featuresIndex = {};
|
|
10065
|
+
this._user = {};
|
|
10066
|
+
this._session = undefined;
|
|
10067
|
+
this.errors = [createBugsnagError(errorClass, errorMessage, Event.__type, stacktrace)]; // Flags.
|
|
10068
|
+
// Note these are not initialised unless they are used
|
|
10069
|
+
// to save unnecessary bytes in the browser bundle
|
|
10070
|
+
|
|
10071
|
+
/* this.attemptImmediateDelivery, default: true */
|
|
10072
|
+
}
|
|
10073
|
+
|
|
10074
|
+
var _proto = Event.prototype;
|
|
10075
|
+
|
|
10076
|
+
_proto.addMetadata = function addMetadata(section, keyOrObj, maybeVal) {
|
|
10077
|
+
return _$metadataDelegate_21.add(this._metadata, section, keyOrObj, maybeVal);
|
|
10078
|
+
};
|
|
10079
|
+
|
|
10080
|
+
_proto.getMetadata = function getMetadata(section, key) {
|
|
10081
|
+
return _$metadataDelegate_21.get(this._metadata, section, key);
|
|
10082
|
+
};
|
|
10083
|
+
|
|
10084
|
+
_proto.clearMetadata = function clearMetadata(section, key) {
|
|
10085
|
+
return _$metadataDelegate_21.clear(this._metadata, section, key);
|
|
10086
|
+
};
|
|
10087
|
+
|
|
10088
|
+
_proto.addFeatureFlag = function addFeatureFlag(name, variant) {
|
|
10089
|
+
if (variant === void 0) {
|
|
10090
|
+
variant = null;
|
|
10091
|
+
}
|
|
10092
|
+
|
|
10093
|
+
_$featureFlagDelegate_17.add(this._features, this._featuresIndex, name, variant);
|
|
10094
|
+
};
|
|
10095
|
+
|
|
10096
|
+
_proto.addFeatureFlags = function addFeatureFlags(featureFlags) {
|
|
10097
|
+
_$featureFlagDelegate_17.merge(this._features, featureFlags, this._featuresIndex);
|
|
10098
|
+
};
|
|
10099
|
+
|
|
10100
|
+
_proto.getFeatureFlags = function getFeatureFlags() {
|
|
10101
|
+
return _$featureFlagDelegate_17.toEventApi(this._features);
|
|
10102
|
+
};
|
|
10103
|
+
|
|
10104
|
+
_proto.clearFeatureFlag = function clearFeatureFlag(name) {
|
|
10105
|
+
_$featureFlagDelegate_17.clear(this._features, this._featuresIndex, name);
|
|
10106
|
+
};
|
|
10107
|
+
|
|
10108
|
+
_proto.clearFeatureFlags = function clearFeatureFlags() {
|
|
10109
|
+
this._features = [];
|
|
10110
|
+
this._featuresIndex = {};
|
|
10111
|
+
};
|
|
10112
|
+
|
|
10113
|
+
_proto.getUser = function getUser() {
|
|
10114
|
+
return this._user;
|
|
10115
|
+
};
|
|
10116
|
+
|
|
10117
|
+
_proto.setUser = function setUser(id, email, name) {
|
|
10118
|
+
this._user = {
|
|
10119
|
+
id: id,
|
|
10120
|
+
email: email,
|
|
10121
|
+
name: name
|
|
10122
|
+
};
|
|
10123
|
+
};
|
|
10124
|
+
|
|
10125
|
+
_proto.toJSON = function toJSON() {
|
|
10126
|
+
return {
|
|
10127
|
+
payloadVersion: '4',
|
|
10128
|
+
exceptions: _$map_15(this.errors, function (er) {
|
|
10129
|
+
return _$assign_10({}, er, {
|
|
10130
|
+
message: er.errorMessage
|
|
10131
|
+
});
|
|
10132
|
+
}),
|
|
10133
|
+
severity: this.severity,
|
|
10134
|
+
unhandled: this._handledState.unhandled,
|
|
10135
|
+
severityReason: this._handledState.severityReason,
|
|
10136
|
+
app: this.app,
|
|
10137
|
+
device: this.device,
|
|
10138
|
+
request: this.request,
|
|
10139
|
+
breadcrumbs: this.breadcrumbs,
|
|
10140
|
+
context: this.context,
|
|
10141
|
+
groupingHash: this.groupingHash,
|
|
10142
|
+
metaData: this._metadata,
|
|
10143
|
+
user: this._user,
|
|
10144
|
+
session: this._session,
|
|
10145
|
+
featureFlags: this.getFeatureFlags()
|
|
10146
|
+
};
|
|
10147
|
+
};
|
|
10148
|
+
|
|
10149
|
+
return Event;
|
|
10150
|
+
}(); // takes a stacktrace.js style stackframe (https://github.com/stacktracejs/stackframe)
|
|
10151
|
+
// and returns a Bugsnag compatible stackframe (https://docs.bugsnag.com/api/error-reporting/#json-payload)
|
|
10152
|
+
|
|
10153
|
+
|
|
10154
|
+
var formatStackframe = function (frame) {
|
|
10155
|
+
var f = {
|
|
10156
|
+
file: frame.fileName,
|
|
10157
|
+
method: normaliseFunctionName(frame.functionName),
|
|
10158
|
+
lineNumber: frame.lineNumber,
|
|
10159
|
+
columnNumber: frame.columnNumber,
|
|
10160
|
+
code: undefined,
|
|
10161
|
+
inProject: undefined
|
|
10162
|
+
}; // Some instances result in no file:
|
|
10163
|
+
// - calling notify() from chrome's terminal results in no file/method.
|
|
10164
|
+
// - non-error exception thrown from global code in FF
|
|
10165
|
+
// This adds one.
|
|
10166
|
+
|
|
10167
|
+
if (f.lineNumber > -1 && !f.file && !f.method) {
|
|
10168
|
+
f.file = 'global code';
|
|
10169
|
+
}
|
|
10170
|
+
|
|
10171
|
+
return f;
|
|
10172
|
+
};
|
|
10173
|
+
|
|
10174
|
+
var normaliseFunctionName = function (name) {
|
|
10175
|
+
return /^global code$/i.test(name) ? 'global code' : name;
|
|
10176
|
+
};
|
|
10177
|
+
|
|
10178
|
+
var defaultHandledState = function () {
|
|
10179
|
+
return {
|
|
10180
|
+
unhandled: false,
|
|
10181
|
+
severity: 'warning',
|
|
10182
|
+
severityReason: {
|
|
10183
|
+
type: 'handledException'
|
|
10184
|
+
}
|
|
10185
|
+
};
|
|
10186
|
+
};
|
|
10187
|
+
|
|
10188
|
+
var ensureString = function (str) {
|
|
10189
|
+
return typeof str === 'string' ? str : '';
|
|
10190
|
+
};
|
|
10191
|
+
|
|
10192
|
+
function createBugsnagError(errorClass, errorMessage, type, stacktrace) {
|
|
10193
|
+
return {
|
|
10194
|
+
errorClass: ensureString(errorClass),
|
|
10195
|
+
errorMessage: ensureString(errorMessage),
|
|
10196
|
+
type: type,
|
|
10197
|
+
stacktrace: _$reduce_16(stacktrace, function (accum, frame) {
|
|
10198
|
+
var f = formatStackframe(frame); // don't include a stackframe if none of its properties are defined
|
|
10199
|
+
|
|
10200
|
+
try {
|
|
10201
|
+
if (JSON.stringify(f) === '{}') return accum;
|
|
10202
|
+
return accum.concat(f);
|
|
10203
|
+
} catch (e) {
|
|
10204
|
+
return accum;
|
|
10205
|
+
}
|
|
10206
|
+
}, [])
|
|
10207
|
+
};
|
|
10208
|
+
}
|
|
10209
|
+
|
|
10210
|
+
function getCauseStack(error) {
|
|
10211
|
+
if (error.cause) {
|
|
10212
|
+
return [error].concat(getCauseStack(error.cause));
|
|
10213
|
+
} else {
|
|
10214
|
+
return [error];
|
|
10215
|
+
}
|
|
10216
|
+
} // Helpers
|
|
10217
|
+
|
|
10218
|
+
|
|
10219
|
+
Event.getStacktrace = function (error, errorFramesToSkip, backtraceFramesToSkip) {
|
|
10220
|
+
if (_$hasStack_18(error)) return _$errorStackParser_9.parse(error).slice(errorFramesToSkip); // error wasn't provided or didn't have a stacktrace so try to walk the callstack
|
|
10221
|
+
|
|
10222
|
+
try {
|
|
10223
|
+
return _$filter_11(StackGenerator.backtrace(), function (frame) {
|
|
10224
|
+
return (frame.functionName || '').indexOf('StackGenerator$$') === -1;
|
|
10225
|
+
}).slice(1 + backtraceFramesToSkip);
|
|
10226
|
+
} catch (e) {
|
|
10227
|
+
return [];
|
|
10228
|
+
}
|
|
10229
|
+
};
|
|
10230
|
+
|
|
10231
|
+
Event.create = function (maybeError, tolerateNonErrors, handledState, component, errorFramesToSkip, logger) {
|
|
10232
|
+
if (errorFramesToSkip === void 0) {
|
|
10233
|
+
errorFramesToSkip = 0;
|
|
10234
|
+
}
|
|
10235
|
+
|
|
10236
|
+
var _normaliseError = normaliseError(maybeError, tolerateNonErrors, component, logger),
|
|
10237
|
+
error = _normaliseError[0],
|
|
10238
|
+
internalFrames = _normaliseError[1];
|
|
10239
|
+
|
|
10240
|
+
var event;
|
|
10241
|
+
|
|
10242
|
+
try {
|
|
10243
|
+
var stacktrace = Event.getStacktrace(error, // if an error was created/throw in the normaliseError() function, we need to
|
|
10244
|
+
// tell the getStacktrace() function to skip the number of frames we know will
|
|
10245
|
+
// be from our own functions. This is added to the number of frames deep we
|
|
10246
|
+
// were told about
|
|
10247
|
+
internalFrames > 0 ? 1 + internalFrames + errorFramesToSkip : 0, // if there's no stacktrace, the callstack may be walked to generated one.
|
|
10248
|
+
// this is how many frames should be removed because they come from our library
|
|
10249
|
+
1 + errorFramesToSkip);
|
|
10250
|
+
event = new Event(error.name, error.message, stacktrace, handledState, maybeError);
|
|
10251
|
+
} catch (e) {
|
|
10252
|
+
event = new Event(error.name, error.message, [], handledState, maybeError);
|
|
10253
|
+
}
|
|
10254
|
+
|
|
10255
|
+
if (error.name === 'InvalidError') {
|
|
10256
|
+
event.addMetadata("" + component, 'non-error parameter', makeSerialisable(maybeError));
|
|
10257
|
+
}
|
|
10258
|
+
|
|
10259
|
+
if (error.cause) {
|
|
10260
|
+
var _event$errors;
|
|
10261
|
+
|
|
10262
|
+
var causes = getCauseStack(error).slice(1);
|
|
10263
|
+
var normalisedCauses = _$map_15(causes, function (cause) {
|
|
10264
|
+
// Only get stacktrace for error causes that are a valid JS Error and already have a stack
|
|
10265
|
+
var stacktrace = _$iserror_19(cause) && _$hasStack_18(cause) ? _$errorStackParser_9.parse(cause) : [];
|
|
10266
|
+
|
|
10267
|
+
var _normaliseError2 = normaliseError(cause, true, 'error cause'),
|
|
10268
|
+
error = _normaliseError2[0];
|
|
10269
|
+
|
|
10270
|
+
if (error.name === 'InvalidError') event.addMetadata('error cause', makeSerialisable(cause));
|
|
10271
|
+
return createBugsnagError(error.name, error.message, Event.__type, stacktrace);
|
|
10272
|
+
});
|
|
10273
|
+
|
|
10274
|
+
(_event$errors = event.errors).push.apply(_event$errors, normalisedCauses);
|
|
10275
|
+
}
|
|
10276
|
+
|
|
10277
|
+
return event;
|
|
10278
|
+
};
|
|
10279
|
+
|
|
10280
|
+
var makeSerialisable = function (err) {
|
|
10281
|
+
if (err === null) return 'null';
|
|
10282
|
+
if (err === undefined) return 'undefined';
|
|
10283
|
+
return err;
|
|
10284
|
+
};
|
|
10285
|
+
|
|
10286
|
+
var normaliseError = function (maybeError, tolerateNonErrors, component, logger) {
|
|
10287
|
+
var error;
|
|
10288
|
+
var internalFrames = 0;
|
|
10289
|
+
|
|
10290
|
+
var createAndLogInputError = function (reason) {
|
|
10291
|
+
var verb = component === 'error cause' ? 'was' : 'received';
|
|
10292
|
+
if (logger) logger.warn(component + " " + verb + " a non-error: \"" + reason + "\"");
|
|
10293
|
+
var err = new Error(component + " " + verb + " a non-error. See \"" + component + "\" tab for more detail.");
|
|
10294
|
+
err.name = 'InvalidError';
|
|
10295
|
+
return err;
|
|
10296
|
+
}; // In some cases:
|
|
10297
|
+
//
|
|
10298
|
+
// - the promise rejection handler (both in the browser and node)
|
|
10299
|
+
// - the node uncaughtException handler
|
|
10300
|
+
//
|
|
10301
|
+
// We are really limited in what we can do to get a stacktrace. So we use the
|
|
10302
|
+
// tolerateNonErrors option to ensure that the resulting error communicates as
|
|
10303
|
+
// such.
|
|
10304
|
+
|
|
10305
|
+
|
|
10306
|
+
if (!tolerateNonErrors) {
|
|
10307
|
+
if (_$iserror_19(maybeError)) {
|
|
10308
|
+
error = maybeError;
|
|
10309
|
+
} else {
|
|
10310
|
+
error = createAndLogInputError(typeof maybeError);
|
|
10311
|
+
internalFrames += 2;
|
|
10312
|
+
}
|
|
10313
|
+
} else {
|
|
10314
|
+
switch (typeof maybeError) {
|
|
10315
|
+
case 'string':
|
|
10316
|
+
case 'number':
|
|
10317
|
+
case 'boolean':
|
|
10318
|
+
error = new Error(String(maybeError));
|
|
10319
|
+
internalFrames += 1;
|
|
10320
|
+
break;
|
|
10321
|
+
|
|
10322
|
+
case 'function':
|
|
10323
|
+
error = createAndLogInputError('function');
|
|
10324
|
+
internalFrames += 2;
|
|
10325
|
+
break;
|
|
10326
|
+
|
|
10327
|
+
case 'object':
|
|
10328
|
+
if (maybeError !== null && _$iserror_19(maybeError)) {
|
|
10329
|
+
error = maybeError;
|
|
10330
|
+
} else if (maybeError !== null && hasNecessaryFields(maybeError)) {
|
|
10331
|
+
error = new Error(maybeError.message || maybeError.errorMessage);
|
|
10332
|
+
error.name = maybeError.name || maybeError.errorClass;
|
|
10333
|
+
internalFrames += 1;
|
|
10334
|
+
} else {
|
|
10335
|
+
error = createAndLogInputError(maybeError === null ? 'null' : 'unsupported object');
|
|
10336
|
+
internalFrames += 2;
|
|
10337
|
+
}
|
|
10338
|
+
|
|
10339
|
+
break;
|
|
10340
|
+
|
|
10341
|
+
default:
|
|
10342
|
+
error = createAndLogInputError('nothing');
|
|
10343
|
+
internalFrames += 2;
|
|
10344
|
+
}
|
|
10345
|
+
}
|
|
10346
|
+
|
|
10347
|
+
if (!_$hasStack_18(error)) {
|
|
10348
|
+
// in IE10/11 a new Error() doesn't have a stacktrace until you throw it, so try that here
|
|
10349
|
+
try {
|
|
10350
|
+
throw error;
|
|
10351
|
+
} catch (e) {
|
|
10352
|
+
if (_$hasStack_18(e)) {
|
|
10353
|
+
error = e; // if the error only got a stacktrace after we threw it here, we know it
|
|
10354
|
+
// will only have one extra internal frame from this function, regardless
|
|
10355
|
+
// of whether it went through createAndLogInputError() or not
|
|
10356
|
+
|
|
10357
|
+
internalFrames = 1;
|
|
10358
|
+
}
|
|
10359
|
+
}
|
|
10360
|
+
}
|
|
10361
|
+
|
|
10362
|
+
return [error, internalFrames];
|
|
10363
|
+
}; // default value for stacktrace.type
|
|
10364
|
+
|
|
10365
|
+
|
|
10366
|
+
Event.__type = 'browserjs';
|
|
10367
|
+
|
|
10368
|
+
var hasNecessaryFields = function (error) {
|
|
10369
|
+
return (typeof error.name === 'string' || typeof error.errorClass === 'string') && (typeof error.message === 'string' || typeof error.errorMessage === 'string');
|
|
10370
|
+
};
|
|
10371
|
+
|
|
10372
|
+
var _$Event_4 = Event;
|
|
10373
|
+
|
|
10374
|
+
// This is a heavily modified/simplified version of
|
|
10375
|
+
// https://github.com/othiym23/async-some
|
|
10376
|
+
// with the logic flipped so that it is akin to the
|
|
10377
|
+
// synchronous "every" method instead of "some".
|
|
10378
|
+
// run the asynchronous test function (fn) over each item in the array (arr)
|
|
10379
|
+
// in series until:
|
|
10380
|
+
// - fn(item, cb) => calls cb(null, false)
|
|
10381
|
+
// - or the end of the array is reached
|
|
10382
|
+
// the callback (cb) will be passed (null, false) if any of the items in arr
|
|
10383
|
+
// caused fn to call back with false, otherwise it will be passed (null, true)
|
|
10384
|
+
var _$asyncEvery_5 = function (arr, fn, cb) {
|
|
10385
|
+
var index = 0;
|
|
10386
|
+
|
|
10387
|
+
var next = function () {
|
|
10388
|
+
if (index >= arr.length) return cb(null, true);
|
|
10389
|
+
fn(arr[index], function (err, result) {
|
|
10390
|
+
if (err) return cb(err);
|
|
10391
|
+
if (result === false) return cb(null, false);
|
|
10392
|
+
index++;
|
|
10393
|
+
next();
|
|
10394
|
+
});
|
|
10395
|
+
};
|
|
10396
|
+
|
|
10397
|
+
next();
|
|
10398
|
+
};
|
|
10399
|
+
|
|
10400
|
+
var _$callbackRunner_7 = function (callbacks, event, onCallbackError, cb) {
|
|
10401
|
+
// This function is how we support different kinds of callback:
|
|
10402
|
+
// - synchronous - return value
|
|
10403
|
+
// - node-style async with callback - cb(err, value)
|
|
10404
|
+
// - promise/thenable - resolve(value)
|
|
10405
|
+
// It normalises each of these into the lowest common denominator – a node-style callback
|
|
10406
|
+
var runMaybeAsyncCallback = function (fn, cb) {
|
|
10407
|
+
if (typeof fn !== 'function') return cb(null);
|
|
10408
|
+
|
|
10409
|
+
try {
|
|
10410
|
+
// if function appears sync…
|
|
10411
|
+
if (fn.length !== 2) {
|
|
10412
|
+
var ret = fn(event); // check if it returned a "thenable" (promise)
|
|
10413
|
+
|
|
10414
|
+
if (ret && typeof ret.then === 'function') {
|
|
10415
|
+
return ret.then( // resolve
|
|
10416
|
+
function (val) {
|
|
10417
|
+
return setTimeout(function () {
|
|
10418
|
+
return cb(null, val);
|
|
10419
|
+
});
|
|
10420
|
+
}, // reject
|
|
10421
|
+
function (err) {
|
|
10422
|
+
setTimeout(function () {
|
|
10423
|
+
onCallbackError(err);
|
|
10424
|
+
return cb(null, true);
|
|
10425
|
+
});
|
|
10426
|
+
});
|
|
10427
|
+
}
|
|
10428
|
+
|
|
10429
|
+
return cb(null, ret);
|
|
10430
|
+
} // if function is async…
|
|
10431
|
+
|
|
10432
|
+
|
|
10433
|
+
fn(event, function (err, result) {
|
|
10434
|
+
if (err) {
|
|
10435
|
+
onCallbackError(err);
|
|
10436
|
+
return cb(null);
|
|
10437
|
+
}
|
|
10438
|
+
|
|
10439
|
+
cb(null, result);
|
|
10440
|
+
});
|
|
10441
|
+
} catch (e) {
|
|
10442
|
+
onCallbackError(e);
|
|
10443
|
+
cb(null);
|
|
10444
|
+
}
|
|
10445
|
+
};
|
|
10446
|
+
|
|
10447
|
+
_$asyncEvery_5(callbacks, runMaybeAsyncCallback, cb);
|
|
10448
|
+
};
|
|
10449
|
+
|
|
10450
|
+
var _$syncCallbackRunner_24 = function (callbacks, callbackArg, callbackType, logger) {
|
|
10451
|
+
var ignore = false;
|
|
10452
|
+
var cbs = callbacks.slice();
|
|
10453
|
+
|
|
10454
|
+
while (!ignore) {
|
|
10455
|
+
if (!cbs.length) break;
|
|
10456
|
+
|
|
10457
|
+
try {
|
|
10458
|
+
ignore = cbs.pop()(callbackArg) === false;
|
|
10459
|
+
} catch (e) {
|
|
10460
|
+
logger.error("Error occurred in " + callbackType + " callback, continuing anyway\u2026");
|
|
10461
|
+
logger.error(e);
|
|
10462
|
+
}
|
|
10463
|
+
}
|
|
10464
|
+
|
|
10465
|
+
return ignore;
|
|
10466
|
+
};
|
|
10467
|
+
|
|
10468
|
+
var _$pad_30 = function pad(num, size) {
|
|
10469
|
+
var s = '000000000' + num;
|
|
10470
|
+
return s.substr(s.length - size);
|
|
10471
|
+
};
|
|
10472
|
+
|
|
10473
|
+
var os$1 = os,
|
|
10474
|
+
padding = 2,
|
|
10475
|
+
pid = _$pad_30(process.pid.toString(36), padding),
|
|
10476
|
+
hostname = os$1.hostname(),
|
|
10477
|
+
length = hostname.length,
|
|
10478
|
+
hostId = _$pad_30(hostname.split('').reduce(function (prev, char) {
|
|
10479
|
+
return +prev + char.charCodeAt(0);
|
|
10480
|
+
}, +length + 36).toString(36), padding);
|
|
10481
|
+
|
|
10482
|
+
var _$fingerprint_29 = function fingerprint() {
|
|
10483
|
+
return pid + hostId;
|
|
10484
|
+
};
|
|
10485
|
+
|
|
10486
|
+
var c = 0,
|
|
10487
|
+
blockSize = 4,
|
|
10488
|
+
base = 36,
|
|
10489
|
+
discreteValues = Math.pow(base, blockSize);
|
|
10490
|
+
|
|
10491
|
+
function randomBlock() {
|
|
10492
|
+
return _$pad_30((Math.random() * discreteValues << 0).toString(base), blockSize);
|
|
10493
|
+
}
|
|
10494
|
+
|
|
10495
|
+
function safeCounter() {
|
|
10496
|
+
c = c < discreteValues ? c : 0;
|
|
10497
|
+
c++; // this is not subliminal
|
|
10498
|
+
|
|
10499
|
+
return c - 1;
|
|
10500
|
+
}
|
|
10501
|
+
|
|
10502
|
+
function cuid() {
|
|
10503
|
+
// Starting with a lowercase letter makes
|
|
10504
|
+
// it HTML element ID friendly.
|
|
10505
|
+
var letter = 'c',
|
|
10506
|
+
// hard-coded allows for sequential access
|
|
10507
|
+
// timestamp
|
|
10508
|
+
// warning: this exposes the exact date and time
|
|
10509
|
+
// that the uid was created.
|
|
10510
|
+
timestamp = new Date().getTime().toString(base),
|
|
10511
|
+
// Prevent same-machine collisions.
|
|
10512
|
+
counter = _$pad_30(safeCounter().toString(base), blockSize),
|
|
10513
|
+
// A few chars to generate distinct ids for different
|
|
10514
|
+
// clients (so different computers are far less
|
|
10515
|
+
// likely to generate the same id)
|
|
10516
|
+
print = _$fingerprint_29(),
|
|
10517
|
+
// Grab some more chars from Math.random()
|
|
10518
|
+
random = randomBlock() + randomBlock();
|
|
10519
|
+
return letter + timestamp + counter + print + random;
|
|
10520
|
+
}
|
|
10521
|
+
|
|
10522
|
+
cuid.fingerprint = _$fingerprint_29;
|
|
10523
|
+
var _$cuid_28 = cuid;
|
|
10524
|
+
|
|
10525
|
+
var Session = /*#__PURE__*/function () {
|
|
10526
|
+
function Session() {
|
|
10527
|
+
this.id = _$cuid_28();
|
|
10528
|
+
this.startedAt = new Date();
|
|
10529
|
+
this._handled = 0;
|
|
10530
|
+
this._unhandled = 0;
|
|
10531
|
+
this._user = {};
|
|
10532
|
+
this.app = {};
|
|
10533
|
+
this.device = {};
|
|
10534
|
+
}
|
|
10535
|
+
|
|
10536
|
+
var _proto = Session.prototype;
|
|
10537
|
+
|
|
10538
|
+
_proto.getUser = function getUser() {
|
|
10539
|
+
return this._user;
|
|
10540
|
+
};
|
|
10541
|
+
|
|
10542
|
+
_proto.setUser = function setUser(id, email, name) {
|
|
10543
|
+
this._user = {
|
|
10544
|
+
id: id,
|
|
10545
|
+
email: email,
|
|
10546
|
+
name: name
|
|
10547
|
+
};
|
|
10548
|
+
};
|
|
10549
|
+
|
|
10550
|
+
_proto.toJSON = function toJSON() {
|
|
10551
|
+
return {
|
|
10552
|
+
id: this.id,
|
|
10553
|
+
startedAt: this.startedAt,
|
|
10554
|
+
events: {
|
|
10555
|
+
handled: this._handled,
|
|
10556
|
+
unhandled: this._unhandled
|
|
10557
|
+
}
|
|
10558
|
+
};
|
|
10559
|
+
};
|
|
10560
|
+
|
|
10561
|
+
_proto._track = function _track(event) {
|
|
10562
|
+
this[event._handledState.unhandled ? '_unhandled' : '_handled'] += 1;
|
|
10563
|
+
};
|
|
10564
|
+
|
|
10565
|
+
return Session;
|
|
10566
|
+
}();
|
|
10567
|
+
|
|
10568
|
+
var _$Session_32 = Session;
|
|
10569
|
+
|
|
10570
|
+
var __add_2 = _$featureFlagDelegate_17.add,
|
|
10571
|
+
__clear_2 = _$featureFlagDelegate_17.clear,
|
|
10572
|
+
__merge_2 = _$featureFlagDelegate_17.merge;
|
|
10573
|
+
|
|
10574
|
+
var noop = function () {};
|
|
10575
|
+
|
|
10576
|
+
var Client = /*#__PURE__*/function () {
|
|
10577
|
+
function Client(configuration, schema, internalPlugins, notifier) {
|
|
10578
|
+
var _this = this;
|
|
10579
|
+
|
|
10580
|
+
if (schema === void 0) {
|
|
10581
|
+
schema = _$config_3.schema;
|
|
10582
|
+
}
|
|
10583
|
+
|
|
10584
|
+
if (internalPlugins === void 0) {
|
|
10585
|
+
internalPlugins = [];
|
|
10586
|
+
}
|
|
10587
|
+
|
|
10588
|
+
// notifier id
|
|
10589
|
+
this._notifier = notifier; // intialise opts and config
|
|
10590
|
+
|
|
10591
|
+
this._config = {};
|
|
10592
|
+
this._schema = schema; // i/o
|
|
10593
|
+
|
|
10594
|
+
this._delivery = {
|
|
10595
|
+
sendSession: noop,
|
|
10596
|
+
sendEvent: noop
|
|
10597
|
+
};
|
|
10598
|
+
this._logger = {
|
|
10599
|
+
debug: noop,
|
|
10600
|
+
info: noop,
|
|
10601
|
+
warn: noop,
|
|
10602
|
+
error: noop
|
|
10603
|
+
}; // plugins
|
|
10604
|
+
|
|
10605
|
+
this._plugins = {}; // state
|
|
10606
|
+
|
|
10607
|
+
this._breadcrumbs = [];
|
|
10608
|
+
this._session = null;
|
|
10609
|
+
this._metadata = {};
|
|
10610
|
+
this._featuresIndex = {};
|
|
10611
|
+
this._features = [];
|
|
10612
|
+
this._context = undefined;
|
|
10613
|
+
this._user = {}; // callbacks:
|
|
10614
|
+
// e: onError
|
|
10615
|
+
// s: onSession
|
|
10616
|
+
// sp: onSessionPayload
|
|
10617
|
+
// b: onBreadcrumb
|
|
10618
|
+
// (note these names are minified by hand because object
|
|
10619
|
+
// properties are not safe to minify automatically)
|
|
10620
|
+
|
|
10621
|
+
this._cbs = {
|
|
10622
|
+
e: [],
|
|
10623
|
+
s: [],
|
|
10624
|
+
sp: [],
|
|
10625
|
+
b: []
|
|
10626
|
+
}; // expose internal constructors
|
|
10627
|
+
|
|
10628
|
+
this.Client = Client;
|
|
10629
|
+
this.Event = _$Event_4;
|
|
10630
|
+
this.Breadcrumb = _$Breadcrumb_1;
|
|
10631
|
+
this.Session = _$Session_32;
|
|
10632
|
+
this._config = this._configure(configuration, internalPlugins);
|
|
10633
|
+
_$map_15(internalPlugins.concat(this._config.plugins), function (pl) {
|
|
10634
|
+
if (pl) _this._loadPlugin(pl);
|
|
10635
|
+
}); // when notify() is called we need to know how many frames are from our own source
|
|
10636
|
+
// this inital value is 1 not 0 because we wrap notify() to ensure it is always
|
|
10637
|
+
// bound to have the client as its `this` value – see below.
|
|
10638
|
+
|
|
10639
|
+
this._depth = 1;
|
|
10640
|
+
var self = this;
|
|
10641
|
+
var notify = this.notify;
|
|
10642
|
+
|
|
10643
|
+
this.notify = function () {
|
|
10644
|
+
return notify.apply(self, arguments);
|
|
10645
|
+
};
|
|
10646
|
+
}
|
|
10647
|
+
|
|
10648
|
+
var _proto = Client.prototype;
|
|
10649
|
+
|
|
10650
|
+
_proto.addMetadata = function addMetadata(section, keyOrObj, maybeVal) {
|
|
10651
|
+
return _$metadataDelegate_21.add(this._metadata, section, keyOrObj, maybeVal);
|
|
10652
|
+
};
|
|
10653
|
+
|
|
10654
|
+
_proto.getMetadata = function getMetadata(section, key) {
|
|
10655
|
+
return _$metadataDelegate_21.get(this._metadata, section, key);
|
|
10656
|
+
};
|
|
10657
|
+
|
|
10658
|
+
_proto.clearMetadata = function clearMetadata(section, key) {
|
|
10659
|
+
return _$metadataDelegate_21.clear(this._metadata, section, key);
|
|
10660
|
+
};
|
|
10661
|
+
|
|
10662
|
+
_proto.addFeatureFlag = function addFeatureFlag(name, variant) {
|
|
10663
|
+
if (variant === void 0) {
|
|
10664
|
+
variant = null;
|
|
10665
|
+
}
|
|
10666
|
+
|
|
10667
|
+
__add_2(this._features, this._featuresIndex, name, variant);
|
|
10668
|
+
};
|
|
10669
|
+
|
|
10670
|
+
_proto.addFeatureFlags = function addFeatureFlags(featureFlags) {
|
|
10671
|
+
__merge_2(this._features, featureFlags, this._featuresIndex);
|
|
10672
|
+
};
|
|
10673
|
+
|
|
10674
|
+
_proto.clearFeatureFlag = function clearFeatureFlag(name) {
|
|
10675
|
+
__clear_2(this._features, this._featuresIndex, name);
|
|
10676
|
+
};
|
|
10677
|
+
|
|
10678
|
+
_proto.clearFeatureFlags = function clearFeatureFlags() {
|
|
10679
|
+
this._features = [];
|
|
10680
|
+
this._featuresIndex = {};
|
|
10681
|
+
};
|
|
10682
|
+
|
|
10683
|
+
_proto.getContext = function getContext() {
|
|
10684
|
+
return this._context;
|
|
10685
|
+
};
|
|
10686
|
+
|
|
10687
|
+
_proto.setContext = function setContext(c) {
|
|
10688
|
+
this._context = c;
|
|
10689
|
+
};
|
|
10690
|
+
|
|
10691
|
+
_proto._configure = function _configure(opts, internalPlugins) {
|
|
10692
|
+
var schema = _$reduce_16(internalPlugins, function (schema, plugin) {
|
|
10693
|
+
if (plugin && plugin.configSchema) return _$assign_10({}, schema, plugin.configSchema);
|
|
10694
|
+
return schema;
|
|
10695
|
+
}, this._schema); // accumulate configuration and error messages
|
|
10696
|
+
|
|
10697
|
+
var _reduce = _$reduce_16(_$keys_14(schema), function (accum, key) {
|
|
10698
|
+
var defaultValue = schema[key].defaultValue(opts[key]);
|
|
10699
|
+
|
|
10700
|
+
if (opts[key] !== undefined) {
|
|
10701
|
+
var valid = schema[key].validate(opts[key]);
|
|
10702
|
+
|
|
10703
|
+
if (!valid) {
|
|
10704
|
+
accum.errors[key] = schema[key].message;
|
|
10705
|
+
accum.config[key] = defaultValue;
|
|
10706
|
+
} else {
|
|
10707
|
+
if (schema[key].allowPartialObject) {
|
|
10708
|
+
accum.config[key] = _$assign_10(defaultValue, opts[key]);
|
|
10709
|
+
} else {
|
|
10710
|
+
accum.config[key] = opts[key];
|
|
10711
|
+
}
|
|
10712
|
+
}
|
|
10713
|
+
} else {
|
|
10714
|
+
accum.config[key] = defaultValue;
|
|
10715
|
+
}
|
|
10716
|
+
|
|
10717
|
+
return accum;
|
|
10718
|
+
}, {
|
|
10719
|
+
errors: {},
|
|
10720
|
+
config: {}
|
|
10721
|
+
}),
|
|
10722
|
+
errors = _reduce.errors,
|
|
10723
|
+
config = _reduce.config;
|
|
10724
|
+
|
|
10725
|
+
if (schema.apiKey) {
|
|
10726
|
+
// missing api key is the only fatal error
|
|
10727
|
+
if (!config.apiKey) throw new Error('No Bugsnag API Key set'); // warn about an apikey that is not of the expected format
|
|
10728
|
+
|
|
10729
|
+
if (!/^[0-9a-f]{32}$/i.test(config.apiKey)) errors.apiKey = 'should be a string of 32 hexadecimal characters';
|
|
10730
|
+
} // update and elevate some options
|
|
10731
|
+
|
|
10732
|
+
|
|
10733
|
+
this._metadata = _$assign_10({}, config.metadata);
|
|
10734
|
+
__merge_2(this._features, config.featureFlags, this._featuresIndex);
|
|
10735
|
+
this._user = _$assign_10({}, config.user);
|
|
10736
|
+
this._context = config.context;
|
|
10737
|
+
if (config.logger) this._logger = config.logger; // add callbacks
|
|
10738
|
+
|
|
10739
|
+
if (config.onError) this._cbs.e = this._cbs.e.concat(config.onError);
|
|
10740
|
+
if (config.onBreadcrumb) this._cbs.b = this._cbs.b.concat(config.onBreadcrumb);
|
|
10741
|
+
if (config.onSession) this._cbs.s = this._cbs.s.concat(config.onSession); // finally warn about any invalid config where we fell back to the default
|
|
10742
|
+
|
|
10743
|
+
if (_$keys_14(errors).length) {
|
|
10744
|
+
this._logger.warn(generateConfigErrorMessage(errors, opts));
|
|
10745
|
+
}
|
|
10746
|
+
|
|
10747
|
+
return config;
|
|
10748
|
+
};
|
|
10749
|
+
|
|
10750
|
+
_proto.getUser = function getUser() {
|
|
10751
|
+
return this._user;
|
|
10752
|
+
};
|
|
10753
|
+
|
|
10754
|
+
_proto.setUser = function setUser(id, email, name) {
|
|
10755
|
+
this._user = {
|
|
10756
|
+
id: id,
|
|
10757
|
+
email: email,
|
|
10758
|
+
name: name
|
|
10759
|
+
};
|
|
10760
|
+
};
|
|
10761
|
+
|
|
10762
|
+
_proto._loadPlugin = function _loadPlugin(plugin) {
|
|
10763
|
+
var result = plugin.load(this); // JS objects are not the safest way to store arbitrarily keyed values,
|
|
10764
|
+
// so bookend the key with some characters that prevent tampering with
|
|
10765
|
+
// stuff like __proto__ etc. (only store the result if the plugin had a
|
|
10766
|
+
// name)
|
|
10767
|
+
|
|
10768
|
+
if (plugin.name) this._plugins["~" + plugin.name + "~"] = result;
|
|
10769
|
+
return this;
|
|
10770
|
+
};
|
|
10771
|
+
|
|
10772
|
+
_proto.getPlugin = function getPlugin(name) {
|
|
10773
|
+
return this._plugins["~" + name + "~"];
|
|
10774
|
+
};
|
|
10775
|
+
|
|
10776
|
+
_proto._setDelivery = function _setDelivery(d) {
|
|
10777
|
+
this._delivery = d(this);
|
|
10778
|
+
};
|
|
10779
|
+
|
|
10780
|
+
_proto.startSession = function startSession() {
|
|
10781
|
+
var session = new _$Session_32();
|
|
10782
|
+
session.app.releaseStage = this._config.releaseStage;
|
|
10783
|
+
session.app.version = this._config.appVersion;
|
|
10784
|
+
session.app.type = this._config.appType;
|
|
10785
|
+
session._user = _$assign_10({}, this._user); // run onSession callbacks
|
|
10786
|
+
|
|
10787
|
+
var ignore = _$syncCallbackRunner_24(this._cbs.s, session, 'onSession', this._logger);
|
|
10788
|
+
|
|
10789
|
+
if (ignore) {
|
|
10790
|
+
this._logger.debug('Session not started due to onSession callback');
|
|
10791
|
+
|
|
10792
|
+
return this;
|
|
10793
|
+
}
|
|
10794
|
+
|
|
10795
|
+
return this._sessionDelegate.startSession(this, session);
|
|
10796
|
+
};
|
|
10797
|
+
|
|
10798
|
+
_proto.addOnError = function addOnError(fn, front) {
|
|
10799
|
+
if (front === void 0) {
|
|
10800
|
+
front = false;
|
|
10801
|
+
}
|
|
10802
|
+
|
|
10803
|
+
this._cbs.e[front ? 'unshift' : 'push'](fn);
|
|
10804
|
+
};
|
|
10805
|
+
|
|
10806
|
+
_proto.removeOnError = function removeOnError(fn) {
|
|
10807
|
+
this._cbs.e = _$filter_11(this._cbs.e, function (f) {
|
|
10808
|
+
return f !== fn;
|
|
10809
|
+
});
|
|
10810
|
+
};
|
|
10811
|
+
|
|
10812
|
+
_proto._addOnSessionPayload = function _addOnSessionPayload(fn) {
|
|
10813
|
+
this._cbs.sp.push(fn);
|
|
10814
|
+
};
|
|
10815
|
+
|
|
10816
|
+
_proto.addOnSession = function addOnSession(fn) {
|
|
10817
|
+
this._cbs.s.push(fn);
|
|
10818
|
+
};
|
|
10819
|
+
|
|
10820
|
+
_proto.removeOnSession = function removeOnSession(fn) {
|
|
10821
|
+
this._cbs.s = _$filter_11(this._cbs.s, function (f) {
|
|
10822
|
+
return f !== fn;
|
|
10823
|
+
});
|
|
10824
|
+
};
|
|
10825
|
+
|
|
10826
|
+
_proto.addOnBreadcrumb = function addOnBreadcrumb(fn, front) {
|
|
10827
|
+
if (front === void 0) {
|
|
10828
|
+
front = false;
|
|
10829
|
+
}
|
|
10830
|
+
|
|
10831
|
+
this._cbs.b[front ? 'unshift' : 'push'](fn);
|
|
10832
|
+
};
|
|
10833
|
+
|
|
10834
|
+
_proto.removeOnBreadcrumb = function removeOnBreadcrumb(fn) {
|
|
10835
|
+
this._cbs.b = _$filter_11(this._cbs.b, function (f) {
|
|
10836
|
+
return f !== fn;
|
|
10837
|
+
});
|
|
10838
|
+
};
|
|
10839
|
+
|
|
10840
|
+
_proto.pauseSession = function pauseSession() {
|
|
10841
|
+
return this._sessionDelegate.pauseSession(this);
|
|
10842
|
+
};
|
|
10843
|
+
|
|
10844
|
+
_proto.resumeSession = function resumeSession() {
|
|
10845
|
+
return this._sessionDelegate.resumeSession(this);
|
|
10846
|
+
};
|
|
10847
|
+
|
|
10848
|
+
_proto.leaveBreadcrumb = function leaveBreadcrumb(message, metadata, type) {
|
|
10849
|
+
// coerce bad values so that the defaults get set
|
|
10850
|
+
message = typeof message === 'string' ? message : '';
|
|
10851
|
+
type = typeof type === 'string' && _$includes_12(_$breadcrumbTypes_6, type) ? type : 'manual';
|
|
10852
|
+
metadata = typeof metadata === 'object' && metadata !== null ? metadata : {}; // if no message, discard
|
|
10853
|
+
|
|
10854
|
+
if (!message) return;
|
|
10855
|
+
var crumb = new _$Breadcrumb_1(message, metadata, type); // run onBreadcrumb callbacks
|
|
10856
|
+
|
|
10857
|
+
var ignore = _$syncCallbackRunner_24(this._cbs.b, crumb, 'onBreadcrumb', this._logger);
|
|
10858
|
+
|
|
10859
|
+
if (ignore) {
|
|
10860
|
+
this._logger.debug('Breadcrumb not attached due to onBreadcrumb callback');
|
|
10861
|
+
|
|
10862
|
+
return;
|
|
10863
|
+
} // push the valid crumb onto the queue and maintain the length
|
|
10864
|
+
|
|
10865
|
+
|
|
10866
|
+
this._breadcrumbs.push(crumb);
|
|
10867
|
+
|
|
10868
|
+
if (this._breadcrumbs.length > this._config.maxBreadcrumbs) {
|
|
10869
|
+
this._breadcrumbs = this._breadcrumbs.slice(this._breadcrumbs.length - this._config.maxBreadcrumbs);
|
|
10870
|
+
}
|
|
10871
|
+
};
|
|
10872
|
+
|
|
10873
|
+
_proto._isBreadcrumbTypeEnabled = function _isBreadcrumbTypeEnabled(type) {
|
|
10874
|
+
var types = this._config.enabledBreadcrumbTypes;
|
|
10875
|
+
return types === null || _$includes_12(types, type);
|
|
10876
|
+
};
|
|
10877
|
+
|
|
10878
|
+
_proto.notify = function notify(maybeError, onError, postReportCallback) {
|
|
10879
|
+
if (postReportCallback === void 0) {
|
|
10880
|
+
postReportCallback = noop;
|
|
10881
|
+
}
|
|
10882
|
+
|
|
10883
|
+
var event = _$Event_4.create(maybeError, true, undefined, 'notify()', this._depth + 1, this._logger);
|
|
10884
|
+
|
|
10885
|
+
this._notify(event, onError, postReportCallback);
|
|
10886
|
+
};
|
|
10887
|
+
|
|
10888
|
+
_proto._notify = function _notify(event, onError, postReportCallback) {
|
|
10889
|
+
var _this2 = this;
|
|
10890
|
+
|
|
10891
|
+
if (postReportCallback === void 0) {
|
|
10892
|
+
postReportCallback = noop;
|
|
10893
|
+
}
|
|
10894
|
+
|
|
10895
|
+
event.app = _$assign_10({}, event.app, {
|
|
10896
|
+
releaseStage: this._config.releaseStage,
|
|
10897
|
+
version: this._config.appVersion,
|
|
10898
|
+
type: this._config.appType
|
|
10899
|
+
});
|
|
10900
|
+
event.context = event.context || this._context;
|
|
10901
|
+
event._metadata = _$assign_10({}, event._metadata, this._metadata);
|
|
10902
|
+
event._user = _$assign_10({}, event._user, this._user);
|
|
10903
|
+
event.breadcrumbs = this._breadcrumbs.slice();
|
|
10904
|
+
__merge_2(event._features, this._features, event._featuresIndex); // exit early if events should not be sent on the current releaseStage
|
|
10905
|
+
|
|
10906
|
+
if (this._config.enabledReleaseStages !== null && !_$includes_12(this._config.enabledReleaseStages, this._config.releaseStage)) {
|
|
10907
|
+
this._logger.warn('Event not sent due to releaseStage/enabledReleaseStages configuration');
|
|
10908
|
+
|
|
10909
|
+
return postReportCallback(null, event);
|
|
10910
|
+
}
|
|
10911
|
+
|
|
10912
|
+
var originalSeverity = event.severity;
|
|
10913
|
+
|
|
10914
|
+
var onCallbackError = function (err) {
|
|
10915
|
+
// errors in callbacks are tolerated but we want to log them out
|
|
10916
|
+
_this2._logger.error('Error occurred in onError callback, continuing anyway…');
|
|
10917
|
+
|
|
10918
|
+
_this2._logger.error(err);
|
|
10919
|
+
};
|
|
10920
|
+
|
|
10921
|
+
var callbacks = [].concat(this._cbs.e).concat(onError);
|
|
10922
|
+
_$callbackRunner_7(callbacks, event, onCallbackError, function (err, shouldSend) {
|
|
10923
|
+
if (err) onCallbackError(err);
|
|
10924
|
+
|
|
10925
|
+
if (!shouldSend) {
|
|
10926
|
+
_this2._logger.debug('Event not sent due to onError callback');
|
|
10927
|
+
|
|
10928
|
+
return postReportCallback(null, event);
|
|
10929
|
+
}
|
|
10930
|
+
|
|
10931
|
+
if (_this2._isBreadcrumbTypeEnabled('error')) {
|
|
10932
|
+
// only leave a crumb for the error if actually got sent
|
|
10933
|
+
Client.prototype.leaveBreadcrumb.call(_this2, event.errors[0].errorClass, {
|
|
10934
|
+
errorClass: event.errors[0].errorClass,
|
|
10935
|
+
errorMessage: event.errors[0].errorMessage,
|
|
10936
|
+
severity: event.severity
|
|
10937
|
+
}, 'error');
|
|
10938
|
+
}
|
|
10939
|
+
|
|
10940
|
+
if (originalSeverity !== event.severity) {
|
|
10941
|
+
event._handledState.severityReason = {
|
|
10942
|
+
type: 'userCallbackSetSeverity'
|
|
10943
|
+
};
|
|
10944
|
+
}
|
|
10945
|
+
|
|
10946
|
+
if (event.unhandled !== event._handledState.unhandled) {
|
|
10947
|
+
event._handledState.severityReason.unhandledOverridden = true;
|
|
10948
|
+
event._handledState.unhandled = event.unhandled;
|
|
10949
|
+
}
|
|
10950
|
+
|
|
10951
|
+
if (_this2._session) {
|
|
10952
|
+
_this2._session._track(event);
|
|
10953
|
+
|
|
10954
|
+
event._session = _this2._session;
|
|
10955
|
+
}
|
|
10956
|
+
|
|
10957
|
+
_this2._delivery.sendEvent({
|
|
10958
|
+
apiKey: event.apiKey || _this2._config.apiKey,
|
|
10959
|
+
notifier: _this2._notifier,
|
|
10960
|
+
events: [event]
|
|
10961
|
+
}, function (err) {
|
|
10962
|
+
return postReportCallback(err, event);
|
|
10963
|
+
});
|
|
10964
|
+
});
|
|
10965
|
+
};
|
|
10966
|
+
|
|
10967
|
+
return Client;
|
|
10968
|
+
}();
|
|
10969
|
+
|
|
10970
|
+
var generateConfigErrorMessage = function (errors, rawInput) {
|
|
10971
|
+
var er = new Error("Invalid configuration\n" + _$map_15(_$keys_14(errors), function (key) {
|
|
10972
|
+
return " - " + key + " " + errors[key] + ", got " + stringify(rawInput[key]);
|
|
10973
|
+
}).join('\n\n'));
|
|
10974
|
+
return er;
|
|
10975
|
+
};
|
|
10976
|
+
|
|
10977
|
+
var stringify = function (val) {
|
|
10978
|
+
switch (typeof val) {
|
|
10979
|
+
case 'string':
|
|
10980
|
+
case 'number':
|
|
10981
|
+
case 'object':
|
|
10982
|
+
return JSON.stringify(val);
|
|
10983
|
+
|
|
10984
|
+
default:
|
|
10985
|
+
return String(val);
|
|
10986
|
+
}
|
|
10987
|
+
};
|
|
10988
|
+
|
|
10989
|
+
var _$Client_2 = Client;
|
|
10990
|
+
|
|
10991
|
+
var _$jsonPayload_20 = {};
|
|
10992
|
+
|
|
10993
|
+
var EVENT_REDACTION_PATHS = ['events.[].metaData', 'events.[].breadcrumbs.[].metaData', 'events.[].request'];
|
|
10994
|
+
|
|
10995
|
+
_$jsonPayload_20.event = function (event, redactedKeys) {
|
|
10996
|
+
var payload = _$safeJsonStringify_31(event, null, null, {
|
|
10997
|
+
redactedPaths: EVENT_REDACTION_PATHS,
|
|
10998
|
+
redactedKeys: redactedKeys
|
|
10999
|
+
});
|
|
11000
|
+
|
|
11001
|
+
if (payload.length > 10e5) {
|
|
11002
|
+
event.events[0]._metadata = {
|
|
11003
|
+
notifier: "WARNING!\nSerialized payload was " + payload.length / 10e5 + "MB (limit = 1MB)\nmetadata was removed"
|
|
11004
|
+
};
|
|
11005
|
+
payload = _$safeJsonStringify_31(event, null, null, {
|
|
11006
|
+
redactedPaths: EVENT_REDACTION_PATHS,
|
|
11007
|
+
redactedKeys: redactedKeys
|
|
11008
|
+
});
|
|
11009
|
+
}
|
|
11010
|
+
|
|
11011
|
+
return payload;
|
|
11012
|
+
};
|
|
11013
|
+
|
|
11014
|
+
_$jsonPayload_20.session = function (session, redactedKeys) {
|
|
11015
|
+
var payload = _$safeJsonStringify_31(session, null, null);
|
|
11016
|
+
return payload;
|
|
11017
|
+
};
|
|
11018
|
+
|
|
11019
|
+
var http$1 = http;
|
|
11020
|
+
|
|
11021
|
+
var https$1 = https; // eslint-disable-next-line node/no-deprecated-api
|
|
11022
|
+
|
|
11023
|
+
|
|
11024
|
+
var ___require_34 = url,
|
|
11025
|
+
parse = ___require_34.parse;
|
|
11026
|
+
|
|
11027
|
+
var _$request_34 = function (_ref, cb) {
|
|
11028
|
+
var url = _ref.url,
|
|
11029
|
+
headers = _ref.headers,
|
|
11030
|
+
body = _ref.body,
|
|
11031
|
+
agent = _ref.agent;
|
|
11032
|
+
var didError = false;
|
|
11033
|
+
|
|
11034
|
+
var onError = function (err) {
|
|
11035
|
+
if (didError) return;
|
|
11036
|
+
didError = true;
|
|
11037
|
+
cb(err);
|
|
11038
|
+
};
|
|
11039
|
+
|
|
11040
|
+
var parsedUrl = parse(url);
|
|
11041
|
+
var secure = parsedUrl.protocol === 'https:';
|
|
11042
|
+
var transport = secure ? https$1 : http$1;
|
|
11043
|
+
var req = transport.request({
|
|
11044
|
+
method: 'POST',
|
|
11045
|
+
hostname: parsedUrl.hostname,
|
|
11046
|
+
port: parsedUrl.port,
|
|
11047
|
+
path: parsedUrl.path,
|
|
11048
|
+
headers: headers,
|
|
11049
|
+
agent: agent
|
|
11050
|
+
});
|
|
11051
|
+
req.on('error', onError);
|
|
11052
|
+
req.on('response', function (res) {
|
|
11053
|
+
bufferResponse(res, function (err, body) {
|
|
11054
|
+
if (err) return onError(err);
|
|
11055
|
+
|
|
11056
|
+
if (res.statusCode < 200 || res.statusCode >= 300) {
|
|
11057
|
+
return onError(new Error("Bad statusCode from API: " + res.statusCode + "\n" + body));
|
|
11058
|
+
}
|
|
11059
|
+
|
|
11060
|
+
cb(null, body);
|
|
11061
|
+
});
|
|
11062
|
+
});
|
|
11063
|
+
req.write(body);
|
|
11064
|
+
req.end();
|
|
11065
|
+
};
|
|
11066
|
+
|
|
11067
|
+
var bufferResponse = function (stream, cb) {
|
|
11068
|
+
var data = '';
|
|
11069
|
+
stream.on('error', cb);
|
|
11070
|
+
stream.setEncoding('utf8');
|
|
11071
|
+
stream.on('data', function (d) {
|
|
11072
|
+
data += d;
|
|
11073
|
+
});
|
|
11074
|
+
stream.on('end', function () {
|
|
11075
|
+
return cb(null, data);
|
|
11076
|
+
});
|
|
11077
|
+
};
|
|
11078
|
+
|
|
11079
|
+
var _$delivery_33 = function (client) {
|
|
11080
|
+
return {
|
|
11081
|
+
sendEvent: function (event, cb) {
|
|
11082
|
+
if (cb === void 0) {
|
|
11083
|
+
cb = function () {};
|
|
11084
|
+
}
|
|
11085
|
+
|
|
11086
|
+
var body = _$jsonPayload_20.event(event, client._config.redactedKeys);
|
|
11087
|
+
|
|
11088
|
+
var _cb = function (err) {
|
|
11089
|
+
if (err) client._logger.error("Event failed to send\u2026\n" + (err && err.stack ? err.stack : err), err);
|
|
11090
|
+
|
|
11091
|
+
if (body.length > 10e5) {
|
|
11092
|
+
client._logger.warn("Event oversized (" + (body.length / 10e5).toFixed(2) + " MB)");
|
|
11093
|
+
}
|
|
11094
|
+
|
|
11095
|
+
cb(err);
|
|
11096
|
+
};
|
|
11097
|
+
|
|
11098
|
+
try {
|
|
11099
|
+
_$request_34({
|
|
11100
|
+
url: client._config.endpoints.notify,
|
|
11101
|
+
headers: {
|
|
11102
|
+
'Content-Type': 'application/json',
|
|
11103
|
+
'Bugsnag-Api-Key': event.apiKey || client._config.apiKey,
|
|
11104
|
+
'Bugsnag-Payload-Version': '4',
|
|
11105
|
+
'Bugsnag-Sent-At': new Date().toISOString()
|
|
11106
|
+
},
|
|
11107
|
+
body: body,
|
|
11108
|
+
agent: client._config.agent
|
|
11109
|
+
}, function (err, body) {
|
|
11110
|
+
return _cb(err);
|
|
11111
|
+
});
|
|
11112
|
+
} catch (e) {
|
|
11113
|
+
_cb(e);
|
|
11114
|
+
}
|
|
11115
|
+
},
|
|
11116
|
+
sendSession: function (session, cb) {
|
|
11117
|
+
if (cb === void 0) {
|
|
11118
|
+
cb = function () {};
|
|
11119
|
+
}
|
|
11120
|
+
|
|
11121
|
+
var _cb = function (err) {
|
|
11122
|
+
if (err) client._logger.error("Session failed to send\u2026\n" + (err && err.stack ? err.stack : err), err);
|
|
11123
|
+
cb(err);
|
|
11124
|
+
};
|
|
11125
|
+
|
|
11126
|
+
try {
|
|
11127
|
+
_$request_34({
|
|
11128
|
+
url: client._config.endpoints.sessions,
|
|
11129
|
+
headers: {
|
|
11130
|
+
'Content-Type': 'application/json',
|
|
11131
|
+
'Bugsnag-Api-Key': client._config.apiKey,
|
|
11132
|
+
'Bugsnag-Payload-Version': '1',
|
|
11133
|
+
'Bugsnag-Sent-At': new Date().toISOString()
|
|
11134
|
+
},
|
|
11135
|
+
body: _$jsonPayload_20.session(session, client._config.redactedKeys),
|
|
11136
|
+
agent: client._config.agent
|
|
11137
|
+
}, function (err) {
|
|
11138
|
+
return _cb(err);
|
|
11139
|
+
});
|
|
11140
|
+
} catch (e) {
|
|
11141
|
+
_cb(e);
|
|
11142
|
+
}
|
|
11143
|
+
}
|
|
11144
|
+
};
|
|
11145
|
+
};
|
|
11146
|
+
|
|
11147
|
+
function _extends() { _extends = 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]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
11148
|
+
|
|
11149
|
+
var schema = _$config_3.schema;
|
|
11150
|
+
|
|
11151
|
+
var __os_35 = os;
|
|
11152
|
+
|
|
11153
|
+
var _require2 = util$1,
|
|
11154
|
+
inspect = _require2.inspect;
|
|
11155
|
+
|
|
11156
|
+
var _$config_35 = {
|
|
11157
|
+
appType: _extends({}, schema.appType, {
|
|
11158
|
+
defaultValue: function () {
|
|
11159
|
+
return 'node';
|
|
11160
|
+
}
|
|
11161
|
+
}),
|
|
11162
|
+
projectRoot: {
|
|
11163
|
+
defaultValue: function () {
|
|
11164
|
+
return process.cwd();
|
|
11165
|
+
},
|
|
11166
|
+
validate: function (value) {
|
|
11167
|
+
return value === null || _$stringWithLength_27(value);
|
|
11168
|
+
},
|
|
11169
|
+
message: 'should be string'
|
|
11170
|
+
},
|
|
11171
|
+
hostname: {
|
|
11172
|
+
defaultValue: function () {
|
|
11173
|
+
return __os_35.hostname();
|
|
11174
|
+
},
|
|
11175
|
+
message: 'should be a string',
|
|
11176
|
+
validate: function (value) {
|
|
11177
|
+
return value === null || _$stringWithLength_27(value);
|
|
11178
|
+
}
|
|
11179
|
+
},
|
|
11180
|
+
logger: _extends({}, schema.logger, {
|
|
11181
|
+
defaultValue: function () {
|
|
11182
|
+
return getPrefixedConsole();
|
|
11183
|
+
}
|
|
11184
|
+
}),
|
|
11185
|
+
releaseStage: _extends({}, schema.releaseStage, {
|
|
11186
|
+
defaultValue: function () {
|
|
11187
|
+
return process.env.NODE_ENV || 'production';
|
|
11188
|
+
}
|
|
11189
|
+
}),
|
|
11190
|
+
agent: {
|
|
11191
|
+
defaultValue: function () {
|
|
11192
|
+
return undefined;
|
|
11193
|
+
},
|
|
11194
|
+
message: 'should be an HTTP(s) agent',
|
|
11195
|
+
validate: function (value) {
|
|
11196
|
+
return value === undefined || isAgent(value);
|
|
11197
|
+
}
|
|
11198
|
+
},
|
|
11199
|
+
onUncaughtException: {
|
|
11200
|
+
defaultValue: function () {
|
|
11201
|
+
return function (err, event, logger) {
|
|
11202
|
+
logger.error("Uncaught exception" + getContext(event) + ", the process will now terminate\u2026\n" + printError(err));
|
|
11203
|
+
process.exit(1);
|
|
11204
|
+
};
|
|
11205
|
+
},
|
|
11206
|
+
message: 'should be a function',
|
|
11207
|
+
validate: function (value) {
|
|
11208
|
+
return typeof value === 'function';
|
|
11209
|
+
}
|
|
11210
|
+
},
|
|
11211
|
+
onUnhandledRejection: {
|
|
11212
|
+
defaultValue: function () {
|
|
11213
|
+
return function (err, event, logger) {
|
|
11214
|
+
logger.error("Unhandled rejection" + getContext(event) + "\u2026\n" + printError(err));
|
|
11215
|
+
};
|
|
11216
|
+
},
|
|
11217
|
+
message: 'should be a function',
|
|
11218
|
+
validate: function (value) {
|
|
11219
|
+
return typeof value === 'function';
|
|
11220
|
+
}
|
|
11221
|
+
}
|
|
11222
|
+
};
|
|
11223
|
+
|
|
11224
|
+
var printError = function (err) {
|
|
11225
|
+
return err && err.stack ? err.stack : inspect(err);
|
|
11226
|
+
};
|
|
11227
|
+
|
|
11228
|
+
var getPrefixedConsole = function () {
|
|
11229
|
+
return ['debug', 'info', 'warn', 'error'].reduce(function (accum, method) {
|
|
11230
|
+
var consoleMethod = console[method] || console.log;
|
|
11231
|
+
accum[method] = consoleMethod.bind(console, '[bugsnag]');
|
|
11232
|
+
return accum;
|
|
11233
|
+
}, {});
|
|
11234
|
+
};
|
|
11235
|
+
|
|
11236
|
+
var getContext = function (event) {
|
|
11237
|
+
return event.request && Object.keys(event.request).length ? " at " + event.request.httpMethod + " " + (event.request.path || event.request.url) : '';
|
|
11238
|
+
};
|
|
11239
|
+
|
|
11240
|
+
var isAgent = function (value) {
|
|
11241
|
+
return typeof value === 'object' && value !== null || typeof value === 'boolean';
|
|
11242
|
+
};
|
|
11243
|
+
|
|
11244
|
+
var appStart = new Date();
|
|
11245
|
+
|
|
11246
|
+
var reset = function () {
|
|
11247
|
+
appStart = new Date();
|
|
11248
|
+
};
|
|
11249
|
+
|
|
11250
|
+
var _$app_37 = {
|
|
11251
|
+
name: 'appDuration',
|
|
11252
|
+
load: function (client) {
|
|
11253
|
+
client.addOnError(function (event) {
|
|
11254
|
+
var now = new Date();
|
|
11255
|
+
event.app.duration = now - appStart;
|
|
11256
|
+
}, true);
|
|
11257
|
+
return {
|
|
11258
|
+
reset: reset
|
|
11259
|
+
};
|
|
11260
|
+
}
|
|
11261
|
+
};
|
|
11262
|
+
|
|
11263
|
+
var _$nodeFallbackStack_22 = {};
|
|
11264
|
+
// The utilities in this file are used to save the stackframes from a known execution context
|
|
11265
|
+
// to use when a subsequent error has no stack frames. This happens with a lot of
|
|
11266
|
+
// node's builtin async callbacks when they return from the native layer with no context
|
|
11267
|
+
// for example:
|
|
11268
|
+
//
|
|
11269
|
+
// fs.readFile('does not exist', (err) => {
|
|
11270
|
+
// /* node 8 */
|
|
11271
|
+
// err.stack = "ENOENT: no such file or directory, open 'nope'"
|
|
11272
|
+
// /* node 4,6 */
|
|
11273
|
+
// err.stack = "Error: ENOENT: no such file or directory, open 'nope'\n at Error (native)"
|
|
11274
|
+
// })
|
|
11275
|
+
// Gets the stack string for the current execution context
|
|
11276
|
+
_$nodeFallbackStack_22.getStack = function () {
|
|
11277
|
+
// slice(3) removes the first line + this function's frame + the caller's frame,
|
|
11278
|
+
// so the stack begins with the caller of this function
|
|
11279
|
+
return new Error().stack.split('\n').slice(3).join('\n');
|
|
11280
|
+
}; // Given an Error and a fallbackStack from getStack(), use the fallbackStack
|
|
11281
|
+
// if error.stack has no genuine stackframes (according to the example above)
|
|
11282
|
+
|
|
11283
|
+
|
|
11284
|
+
_$nodeFallbackStack_22.maybeUseFallbackStack = function (err, fallbackStack) {
|
|
11285
|
+
var lines = err.stack.split('\n');
|
|
11286
|
+
|
|
11287
|
+
if (lines.length === 1 || lines.length === 2 && /at Error \(native\)/.test(lines[1])) {
|
|
11288
|
+
err.stack = lines[0] + "\n" + fallbackStack;
|
|
11289
|
+
}
|
|
11290
|
+
|
|
11291
|
+
return err;
|
|
11292
|
+
};
|
|
11293
|
+
|
|
11294
|
+
var _$contextualize_38 = {};
|
|
11295
|
+
/* eslint node/no-deprecated-api: [error, {ignoreModuleItems: ["domain"]}] */
|
|
11296
|
+
var domain$1 = domain;
|
|
11297
|
+
|
|
11298
|
+
var getStack = _$nodeFallbackStack_22.getStack,
|
|
11299
|
+
maybeUseFallbackStack = _$nodeFallbackStack_22.maybeUseFallbackStack;
|
|
11300
|
+
|
|
11301
|
+
_$contextualize_38 = {
|
|
11302
|
+
name: 'contextualize',
|
|
11303
|
+
load: function (client) {
|
|
11304
|
+
var contextualize = function (fn, onError) {
|
|
11305
|
+
// capture a stacktrace in case a resulting error has nothing
|
|
11306
|
+
var fallbackStack = getStack();
|
|
11307
|
+
var dom = domain$1.create();
|
|
11308
|
+
dom.on('error', function (err) {
|
|
11309
|
+
// check if the stacktrace has no context, if so, if so append the frames we created earlier
|
|
11310
|
+
if (err.stack) maybeUseFallbackStack(err, fallbackStack);
|
|
11311
|
+
var event = client.Event.create(err, true, {
|
|
11312
|
+
severity: 'error',
|
|
11313
|
+
unhandled: true,
|
|
11314
|
+
severityReason: {
|
|
11315
|
+
type: 'unhandledException'
|
|
11316
|
+
}
|
|
11317
|
+
}, 'contextualize()', 1);
|
|
11318
|
+
|
|
11319
|
+
client._notify(event, onError, function (e, event) {
|
|
11320
|
+
if (e) client._logger.error('Failed to send event to Bugsnag');
|
|
11321
|
+
|
|
11322
|
+
client._config.onUncaughtException(err, event, client._logger);
|
|
11323
|
+
});
|
|
11324
|
+
});
|
|
11325
|
+
process.nextTick(function () {
|
|
11326
|
+
return dom.run(fn);
|
|
11327
|
+
});
|
|
11328
|
+
};
|
|
11329
|
+
|
|
11330
|
+
return contextualize;
|
|
11331
|
+
}
|
|
11332
|
+
}; // add a default export for ESM modules without interop
|
|
11333
|
+
|
|
11334
|
+
_$contextualize_38["default"] = _$contextualize_38;
|
|
11335
|
+
|
|
11336
|
+
var _$intercept_39 = {};
|
|
11337
|
+
var __getStack_39 = _$nodeFallbackStack_22.getStack,
|
|
11338
|
+
__maybeUseFallbackStack_39 = _$nodeFallbackStack_22.maybeUseFallbackStack;
|
|
11339
|
+
|
|
11340
|
+
_$intercept_39 = {
|
|
11341
|
+
name: 'intercept',
|
|
11342
|
+
load: function (client) {
|
|
11343
|
+
var intercept = function (onError, cb) {
|
|
11344
|
+
if (onError === void 0) {
|
|
11345
|
+
onError = function () {};
|
|
11346
|
+
}
|
|
11347
|
+
|
|
11348
|
+
if (typeof cb !== 'function') {
|
|
11349
|
+
cb = onError;
|
|
11350
|
+
|
|
11351
|
+
onError = function () {};
|
|
11352
|
+
} // capture a stacktrace in case a resulting error has nothing
|
|
11353
|
+
|
|
11354
|
+
|
|
11355
|
+
var fallbackStack = __getStack_39();
|
|
11356
|
+
return function (err) {
|
|
11357
|
+
if (err) {
|
|
11358
|
+
// check if the stacktrace has no context, if so, if so append the frames we created earlier
|
|
11359
|
+
if (err.stack) __maybeUseFallbackStack_39(err, fallbackStack);
|
|
11360
|
+
var event = client.Event.create(err, true, {
|
|
11361
|
+
severity: 'warning',
|
|
11362
|
+
unhandled: false,
|
|
11363
|
+
severityReason: {
|
|
11364
|
+
type: 'callbackErrorIntercept'
|
|
11365
|
+
}
|
|
11366
|
+
}, 'intercept()', 1);
|
|
11367
|
+
|
|
11368
|
+
client._notify(event, onError);
|
|
11369
|
+
|
|
11370
|
+
return;
|
|
11371
|
+
}
|
|
11372
|
+
|
|
11373
|
+
for (var _len = arguments.length, data = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
11374
|
+
data[_key - 1] = arguments[_key];
|
|
11375
|
+
}
|
|
11376
|
+
|
|
11377
|
+
cb.apply(void 0, data); // eslint-disable-line
|
|
11378
|
+
};
|
|
11379
|
+
};
|
|
11380
|
+
|
|
11381
|
+
return intercept;
|
|
11382
|
+
}
|
|
11383
|
+
}; // add a default export for ESM modules without interop
|
|
11384
|
+
|
|
11385
|
+
_$intercept_39["default"] = _$intercept_39;
|
|
11386
|
+
|
|
11387
|
+
function ___extends_40() { ___extends_40 = 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]; } } } return target; }; return ___extends_40.apply(this, arguments); }
|
|
11388
|
+
|
|
11389
|
+
var __os_40 = os;
|
|
11390
|
+
/*
|
|
11391
|
+
* Automatically detects Node server details ('device' in the API)
|
|
11392
|
+
*/
|
|
11393
|
+
|
|
11394
|
+
|
|
11395
|
+
var _$device_40 = {
|
|
11396
|
+
load: function (client) {
|
|
11397
|
+
var device = {
|
|
11398
|
+
osName: __os_40.platform() + " (" + __os_40.arch() + ")",
|
|
11399
|
+
osVersion: __os_40.release(),
|
|
11400
|
+
totalMemory: __os_40.totalmem(),
|
|
11401
|
+
hostname: client._config.hostname,
|
|
11402
|
+
runtimeVersions: {
|
|
11403
|
+
node: process.versions.node
|
|
11404
|
+
}
|
|
11405
|
+
};
|
|
11406
|
+
|
|
11407
|
+
client._addOnSessionPayload(function (sp) {
|
|
11408
|
+
sp.device = ___extends_40({}, sp.device, device);
|
|
11409
|
+
}); // add time just as the event is sent
|
|
11410
|
+
|
|
11411
|
+
|
|
11412
|
+
client.addOnError(function (event) {
|
|
11413
|
+
event.device = ___extends_40({}, event.device, device, {
|
|
11414
|
+
freeMemory: __os_40.freemem(),
|
|
11415
|
+
time: new Date()
|
|
11416
|
+
});
|
|
11417
|
+
}, true);
|
|
11418
|
+
}
|
|
11419
|
+
};
|
|
11420
|
+
|
|
11421
|
+
var ___require_23 = path,
|
|
11422
|
+
join = ___require_23.join,
|
|
11423
|
+
resolve = ___require_23.resolve; // normalise a path to a directory, adding a trailing slash if it doesn't already
|
|
11424
|
+
// have one and resolve it to make it absolute (e.g. get rid of any ".."s)
|
|
11425
|
+
|
|
11426
|
+
|
|
11427
|
+
var _$pathNormalizer_23 = function (p) {
|
|
11428
|
+
return join(resolve(p), '/');
|
|
11429
|
+
};
|
|
11430
|
+
|
|
11431
|
+
var _$inProject_41 = {
|
|
11432
|
+
load: function (client) {
|
|
11433
|
+
return client.addOnError(function (event) {
|
|
11434
|
+
if (!client._config.projectRoot) return;
|
|
11435
|
+
var projectRoot = _$pathNormalizer_23(client._config.projectRoot);
|
|
11436
|
+
var allFrames = event.errors.reduce(function (accum, er) {
|
|
11437
|
+
return accum.concat(er.stacktrace);
|
|
11438
|
+
}, []);
|
|
11439
|
+
allFrames.map(function (stackframe) {
|
|
11440
|
+
stackframe.inProject = typeof stackframe.file === 'string' && stackframe.file.indexOf(projectRoot) === 0 && !/\/node_modules\//.test(stackframe.file);
|
|
11441
|
+
});
|
|
11442
|
+
});
|
|
11443
|
+
}
|
|
11444
|
+
};
|
|
11445
|
+
|
|
11446
|
+
function ___extends_42() { ___extends_42 = 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]; } } } return target; }; return ___extends_42.apply(this, arguments); }
|
|
11447
|
+
|
|
11448
|
+
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
|
11449
|
+
|
|
11450
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
11451
|
+
|
|
11452
|
+
var SURROUNDING_LINES = 3;
|
|
11453
|
+
var MAX_LINE_LENGTH = 200;
|
|
11454
|
+
|
|
11455
|
+
var ___require_42 = fs,
|
|
11456
|
+
createReadStream = ___require_42.createReadStream;
|
|
11457
|
+
|
|
11458
|
+
var ___require2_42 = stream,
|
|
11459
|
+
Writable = ___require2_42.Writable;
|
|
11460
|
+
|
|
11461
|
+
var pump = pump_1;
|
|
11462
|
+
|
|
11463
|
+
var byline$1 = byline;
|
|
11464
|
+
|
|
11465
|
+
var path$1 = path;
|
|
11466
|
+
|
|
11467
|
+
var _$surroundingCode_42 = {
|
|
11468
|
+
load: function (client) {
|
|
11469
|
+
if (!client._config.sendCode) return;
|
|
11470
|
+
|
|
11471
|
+
var loadSurroundingCode = function (stackframe, cache) {
|
|
11472
|
+
return new Promise(function (resolve, reject) {
|
|
11473
|
+
try {
|
|
11474
|
+
if (!stackframe.lineNumber || !stackframe.file) return resolve(stackframe);
|
|
11475
|
+
var file = path$1.resolve(client._config.projectRoot, stackframe.file);
|
|
11476
|
+
var cacheKey = file + "@" + stackframe.lineNumber;
|
|
11477
|
+
|
|
11478
|
+
if (cacheKey in cache) {
|
|
11479
|
+
stackframe.code = cache[cacheKey];
|
|
11480
|
+
return resolve(stackframe);
|
|
11481
|
+
}
|
|
11482
|
+
|
|
11483
|
+
getSurroundingCode(file, stackframe.lineNumber, function (err, code) {
|
|
11484
|
+
if (err) return resolve(stackframe);
|
|
11485
|
+
stackframe.code = cache[cacheKey] = code;
|
|
11486
|
+
return resolve(stackframe);
|
|
11487
|
+
});
|
|
11488
|
+
} catch (e) {
|
|
11489
|
+
return resolve(stackframe);
|
|
11490
|
+
}
|
|
11491
|
+
});
|
|
11492
|
+
};
|
|
11493
|
+
|
|
11494
|
+
client.addOnError(function (event) {
|
|
11495
|
+
return new Promise(function (resolve, reject) {
|
|
11496
|
+
var cache = Object.create(null);
|
|
11497
|
+
var allFrames = event.errors.reduce(function (accum, er) {
|
|
11498
|
+
return accum.concat(er.stacktrace);
|
|
11499
|
+
}, []);
|
|
11500
|
+
pMapSeries(allFrames.map(function (stackframe) {
|
|
11501
|
+
return function () {
|
|
11502
|
+
return loadSurroundingCode(stackframe, cache);
|
|
11503
|
+
};
|
|
11504
|
+
})).then(resolve)["catch"](reject);
|
|
11505
|
+
});
|
|
11506
|
+
});
|
|
11507
|
+
},
|
|
11508
|
+
configSchema: {
|
|
11509
|
+
sendCode: {
|
|
11510
|
+
defaultValue: function () {
|
|
11511
|
+
return true;
|
|
11512
|
+
},
|
|
11513
|
+
validate: function (value) {
|
|
11514
|
+
return value === true || value === false;
|
|
11515
|
+
},
|
|
11516
|
+
message: 'should be true or false'
|
|
11517
|
+
}
|
|
11518
|
+
}
|
|
11519
|
+
};
|
|
11520
|
+
|
|
11521
|
+
var getSurroundingCode = function (file, lineNumber, cb) {
|
|
11522
|
+
var start = lineNumber - SURROUNDING_LINES;
|
|
11523
|
+
var end = lineNumber + SURROUNDING_LINES;
|
|
11524
|
+
var reader = createReadStream(file, {
|
|
11525
|
+
encoding: 'utf8'
|
|
11526
|
+
});
|
|
11527
|
+
var splitter = new byline$1.LineStream({
|
|
11528
|
+
keepEmptyLines: true
|
|
11529
|
+
});
|
|
11530
|
+
var slicer = new CodeRange({
|
|
11531
|
+
start: start,
|
|
11532
|
+
end: end
|
|
11533
|
+
}); // if the slicer has enough lines already, no need to keep reading from the file
|
|
11534
|
+
|
|
11535
|
+
slicer.on('done', function () {
|
|
11536
|
+
return reader.destroy();
|
|
11537
|
+
});
|
|
11538
|
+
pump(reader, splitter, slicer, function (err) {
|
|
11539
|
+
// reader.destroy() causes a "premature close" error which we can tolerate
|
|
11540
|
+
if (err && err.message !== 'premature close') return cb(err);
|
|
11541
|
+
cb(null, slicer.getCode());
|
|
11542
|
+
});
|
|
11543
|
+
}; // This writable stream takes { start, end } options specifying the
|
|
11544
|
+
// range of lines that should be extracted from a file. Pipe a readable
|
|
11545
|
+
// stream to it that provides source lines as each chunk. If the range
|
|
11546
|
+
// is satisfied before the end of the readable stream, it will emit the
|
|
11547
|
+
// 'done' event. Once a 'done' or 'finish' event has been seen, call getCode()
|
|
11548
|
+
// to get the range in the following format:
|
|
11549
|
+
// {
|
|
11550
|
+
// '10': 'function getSquare (cb) {',
|
|
11551
|
+
// '11': ' rectangles.find({',
|
|
11552
|
+
// '12': ' length: 12',
|
|
11553
|
+
// '13': ' width: 12',
|
|
11554
|
+
// '14': ' }, err => cb)',
|
|
11555
|
+
// '15': '}'
|
|
11556
|
+
// }
|
|
11557
|
+
|
|
11558
|
+
|
|
11559
|
+
var CodeRange = /*#__PURE__*/function (_Writable) {
|
|
11560
|
+
_inheritsLoose(CodeRange, _Writable);
|
|
11561
|
+
|
|
11562
|
+
function CodeRange(opts) {
|
|
11563
|
+
var _this;
|
|
11564
|
+
|
|
11565
|
+
_this = _Writable.call(this, ___extends_42({}, opts, {
|
|
11566
|
+
decodeStrings: false
|
|
11567
|
+
})) || this;
|
|
11568
|
+
_this._start = opts.start;
|
|
11569
|
+
_this._end = opts.end;
|
|
11570
|
+
_this._n = 0;
|
|
11571
|
+
_this._code = {};
|
|
11572
|
+
return _this;
|
|
11573
|
+
}
|
|
11574
|
+
|
|
11575
|
+
var _proto = CodeRange.prototype;
|
|
11576
|
+
|
|
11577
|
+
_proto._write = function _write(chunk, enc, cb) {
|
|
11578
|
+
this._n++;
|
|
11579
|
+
if (this._n < this._start) return cb(null);
|
|
11580
|
+
|
|
11581
|
+
if (this._n <= this._end) {
|
|
11582
|
+
this._code[String(this._n)] = chunk.length <= MAX_LINE_LENGTH ? chunk : chunk.substr(0, MAX_LINE_LENGTH);
|
|
11583
|
+
return cb(null);
|
|
11584
|
+
}
|
|
11585
|
+
|
|
11586
|
+
this.emit('done');
|
|
11587
|
+
return cb(null);
|
|
11588
|
+
};
|
|
11589
|
+
|
|
11590
|
+
_proto.getCode = function getCode() {
|
|
11591
|
+
return this._code;
|
|
11592
|
+
};
|
|
11593
|
+
|
|
11594
|
+
return CodeRange;
|
|
11595
|
+
}(Writable);
|
|
11596
|
+
|
|
11597
|
+
var pMapSeries = function (ps) {
|
|
11598
|
+
return new Promise(function (resolve, reject) {
|
|
11599
|
+
var res = [];
|
|
11600
|
+
ps.reduce(function (accum, p) {
|
|
11601
|
+
return accum.then(function (r) {
|
|
11602
|
+
res.push(r);
|
|
11603
|
+
return p();
|
|
11604
|
+
});
|
|
11605
|
+
}, Promise.resolve()).then(function (r) {
|
|
11606
|
+
res.push(r);
|
|
11607
|
+
}).then(function () {
|
|
11608
|
+
resolve(res.slice(1));
|
|
11609
|
+
});
|
|
11610
|
+
});
|
|
11611
|
+
};
|
|
11612
|
+
|
|
11613
|
+
var _handler;
|
|
11614
|
+
|
|
11615
|
+
var _$uncaughtException_43 = {
|
|
11616
|
+
load: function (client) {
|
|
11617
|
+
if (!client._config.autoDetectErrors) return;
|
|
11618
|
+
if (!client._config.enabledErrorTypes.unhandledExceptions) return;
|
|
11619
|
+
|
|
11620
|
+
_handler = function (err) {
|
|
11621
|
+
var event = client.Event.create(err, false, {
|
|
11622
|
+
severity: 'error',
|
|
11623
|
+
unhandled: true,
|
|
11624
|
+
severityReason: {
|
|
11625
|
+
type: 'unhandledException'
|
|
11626
|
+
}
|
|
11627
|
+
}, 'uncaughtException handler', 1);
|
|
11628
|
+
|
|
11629
|
+
client._notify(event, function () {}, function (e, event) {
|
|
11630
|
+
if (e) client._logger.error('Failed to send event to Bugsnag');
|
|
11631
|
+
|
|
11632
|
+
client._config.onUncaughtException(err, event, client._logger);
|
|
11633
|
+
});
|
|
11634
|
+
};
|
|
11635
|
+
|
|
11636
|
+
process.on('uncaughtException', _handler);
|
|
11637
|
+
},
|
|
11638
|
+
destroy: function () {
|
|
11639
|
+
process.removeListener('uncaughtException', _handler);
|
|
11640
|
+
}
|
|
11641
|
+
};
|
|
11642
|
+
|
|
11643
|
+
var ___handler_44;
|
|
11644
|
+
|
|
11645
|
+
var _$unhandledRejection_44 = {
|
|
11646
|
+
load: function (client) {
|
|
11647
|
+
if (!client._config.autoDetectErrors || !client._config.enabledErrorTypes.unhandledRejections) return;
|
|
11648
|
+
|
|
11649
|
+
___handler_44 = function (err) {
|
|
11650
|
+
var event = client.Event.create(err, false, {
|
|
11651
|
+
severity: 'error',
|
|
11652
|
+
unhandled: true,
|
|
11653
|
+
severityReason: {
|
|
11654
|
+
type: 'unhandledPromiseRejection'
|
|
11655
|
+
}
|
|
11656
|
+
}, 'unhandledRejection handler', 1);
|
|
11657
|
+
return new Promise(function (resolve) {
|
|
11658
|
+
client._notify(event, function () {}, function (e, event) {
|
|
11659
|
+
if (e) client._logger.error('Failed to send event to Bugsnag');
|
|
11660
|
+
|
|
11661
|
+
client._config.onUnhandledRejection(err, event, client._logger);
|
|
11662
|
+
|
|
11663
|
+
resolve();
|
|
11664
|
+
});
|
|
11665
|
+
});
|
|
11666
|
+
}; // Prepend the listener if we can (Node 6+)
|
|
11667
|
+
|
|
11668
|
+
|
|
11669
|
+
if (process.prependListener) {
|
|
11670
|
+
process.prependListener('unhandledRejection', ___handler_44);
|
|
11671
|
+
} else {
|
|
11672
|
+
process.on('unhandledRejection', ___handler_44);
|
|
11673
|
+
}
|
|
11674
|
+
},
|
|
11675
|
+
destroy: function () {
|
|
11676
|
+
process.removeListener('unhandledRejection', ___handler_44);
|
|
11677
|
+
}
|
|
11678
|
+
};
|
|
11679
|
+
|
|
11680
|
+
var _$cloneClient_8 = {};
|
|
11681
|
+
|
|
11682
|
+
var onCloneCallbacks = [];
|
|
11683
|
+
|
|
11684
|
+
_$cloneClient_8 = function (client) {
|
|
11685
|
+
var clone = new client.Client({}, {}, [], client._notifier);
|
|
11686
|
+
clone._config = client._config; // changes to these properties should not be reflected in the original client,
|
|
11687
|
+
// so ensure they are are (shallow) cloned
|
|
11688
|
+
|
|
11689
|
+
clone._breadcrumbs = client._breadcrumbs.slice();
|
|
11690
|
+
clone._metadata = _$assign_10({}, client._metadata);
|
|
11691
|
+
clone._features = [].concat(client._features);
|
|
11692
|
+
clone._featuresIndex = _$assign_10({}, client._featuresIndex);
|
|
11693
|
+
clone._user = _$assign_10({}, client._user);
|
|
11694
|
+
clone._context = client._context;
|
|
11695
|
+
clone._cbs = {
|
|
11696
|
+
e: client._cbs.e.slice(),
|
|
11697
|
+
s: client._cbs.s.slice(),
|
|
11698
|
+
sp: client._cbs.sp.slice(),
|
|
11699
|
+
b: client._cbs.b.slice()
|
|
11700
|
+
};
|
|
11701
|
+
clone._logger = client._logger;
|
|
11702
|
+
clone._delivery = client._delivery;
|
|
11703
|
+
clone._sessionDelegate = client._sessionDelegate;
|
|
11704
|
+
onCloneCallbacks.forEach(function (callback) {
|
|
11705
|
+
callback(clone);
|
|
11706
|
+
});
|
|
11707
|
+
return clone;
|
|
11708
|
+
};
|
|
11709
|
+
|
|
11710
|
+
_$cloneClient_8.registerCallback = function (callback) {
|
|
11711
|
+
onCloneCallbacks.push(callback);
|
|
11712
|
+
};
|
|
11713
|
+
|
|
11714
|
+
/**
|
|
11715
|
+
* Expose `Backoff`.
|
|
11716
|
+
*/
|
|
11717
|
+
var _$Backoff_45 = Backoff;
|
|
11718
|
+
/**
|
|
11719
|
+
* Initialize backoff timer with `opts`.
|
|
11720
|
+
*
|
|
11721
|
+
* - `min` initial timeout in milliseconds [100]
|
|
11722
|
+
* - `max` max timeout [10000]
|
|
11723
|
+
* - `jitter` [0]
|
|
11724
|
+
* - `factor` [2]
|
|
11725
|
+
*
|
|
11726
|
+
* @param {Object} opts
|
|
11727
|
+
* @api public
|
|
11728
|
+
*/
|
|
11729
|
+
|
|
11730
|
+
function Backoff(opts) {
|
|
11731
|
+
opts = opts || {};
|
|
11732
|
+
this.ms = opts.min || 100;
|
|
11733
|
+
this.max = opts.max || 10000;
|
|
11734
|
+
this.factor = opts.factor || 2;
|
|
11735
|
+
this.jitter = opts.jitter > 0 && opts.jitter <= 1 ? opts.jitter : 0;
|
|
11736
|
+
this.attempts = 0;
|
|
11737
|
+
}
|
|
11738
|
+
/**
|
|
11739
|
+
* Return the backoff duration.
|
|
11740
|
+
*
|
|
11741
|
+
* @return {Number}
|
|
11742
|
+
* @api public
|
|
11743
|
+
*/
|
|
11744
|
+
|
|
11745
|
+
|
|
11746
|
+
Backoff.prototype.duration = function () {
|
|
11747
|
+
var ms = this.ms * Math.pow(this.factor, this.attempts++);
|
|
11748
|
+
|
|
11749
|
+
if (this.jitter) {
|
|
11750
|
+
var rand = Math.random();
|
|
11751
|
+
var deviation = Math.floor(rand * this.jitter * ms);
|
|
11752
|
+
ms = (Math.floor(rand * 10) & 1) == 0 ? ms - deviation : ms + deviation;
|
|
11753
|
+
}
|
|
11754
|
+
|
|
11755
|
+
return Math.min(ms, this.max) | 0;
|
|
11756
|
+
};
|
|
11757
|
+
/**
|
|
11758
|
+
* Reset the number of attempts.
|
|
11759
|
+
*
|
|
11760
|
+
* @api public
|
|
11761
|
+
*/
|
|
11762
|
+
|
|
11763
|
+
|
|
11764
|
+
Backoff.prototype.reset = function () {
|
|
11765
|
+
this.attempts = 0;
|
|
11766
|
+
};
|
|
11767
|
+
|
|
11768
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
11769
|
+
|
|
11770
|
+
function ___inheritsLoose_47(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; ___setPrototypeOf_47(subClass, superClass); }
|
|
11771
|
+
|
|
11772
|
+
function ___setPrototypeOf_47(o, p) { ___setPrototypeOf_47 = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return ___setPrototypeOf_47(o, p); }
|
|
11773
|
+
|
|
11774
|
+
var DEFAULT_SUMMARY_INTERVAL = 10 * 1000;
|
|
11775
|
+
|
|
11776
|
+
var Emitter = events.EventEmitter;
|
|
11777
|
+
|
|
11778
|
+
var _$tracker_47 = /*#__PURE__*/function (_Emitter) {
|
|
11779
|
+
___inheritsLoose_47(SessionTracker, _Emitter);
|
|
11780
|
+
|
|
11781
|
+
function SessionTracker(intervalLength) {
|
|
11782
|
+
var _this;
|
|
11783
|
+
|
|
11784
|
+
_this = _Emitter.call(this) || this;
|
|
11785
|
+
_this._sessions = new Map();
|
|
11786
|
+
_this._interval = null;
|
|
11787
|
+
_this._intervalLength = intervalLength || DEFAULT_SUMMARY_INTERVAL;
|
|
11788
|
+
_this._summarize = _this._summarize.bind(_assertThisInitialized(_this));
|
|
11789
|
+
return _this;
|
|
11790
|
+
}
|
|
11791
|
+
|
|
11792
|
+
var _proto = SessionTracker.prototype;
|
|
11793
|
+
|
|
11794
|
+
_proto.start = function start() {
|
|
11795
|
+
if (!this._interval) {
|
|
11796
|
+
this._interval = setInterval(this._summarize, this._intervalLength).unref();
|
|
11797
|
+
}
|
|
11798
|
+
};
|
|
11799
|
+
|
|
11800
|
+
_proto.stop = function stop() {
|
|
11801
|
+
clearInterval(this._interval);
|
|
11802
|
+
this._interval = null;
|
|
11803
|
+
};
|
|
11804
|
+
|
|
11805
|
+
_proto.track = function track(session) {
|
|
11806
|
+
var key = dateToMsKey(session.startedAt);
|
|
11807
|
+
|
|
11808
|
+
var cur = this._sessions.get(key);
|
|
11809
|
+
|
|
11810
|
+
this._sessions.set(key, typeof cur === 'undefined' ? 1 : cur + 1);
|
|
11811
|
+
|
|
11812
|
+
return session;
|
|
11813
|
+
};
|
|
11814
|
+
|
|
11815
|
+
_proto._summarize = function _summarize() {
|
|
11816
|
+
var _this2 = this;
|
|
11817
|
+
|
|
11818
|
+
var summary = [];
|
|
11819
|
+
|
|
11820
|
+
this._sessions.forEach(function (val, key) {
|
|
11821
|
+
summary.push({
|
|
11822
|
+
startedAt: key,
|
|
11823
|
+
sessionsStarted: val
|
|
11824
|
+
});
|
|
11825
|
+
|
|
11826
|
+
_this2._sessions["delete"](key);
|
|
11827
|
+
});
|
|
11828
|
+
|
|
11829
|
+
if (!summary.length) return;
|
|
11830
|
+
this.emit('summary', summary);
|
|
11831
|
+
};
|
|
11832
|
+
|
|
11833
|
+
return SessionTracker;
|
|
11834
|
+
}(Emitter);
|
|
11835
|
+
|
|
11836
|
+
var dateToMsKey = function (d) {
|
|
11837
|
+
var dk = new Date(d);
|
|
11838
|
+
dk.setSeconds(0);
|
|
11839
|
+
dk.setMilliseconds(0);
|
|
11840
|
+
return dk.toISOString();
|
|
11841
|
+
};
|
|
11842
|
+
|
|
11843
|
+
var _$session_46 = {
|
|
11844
|
+
load: function (client) {
|
|
11845
|
+
var sessionTracker = new _$tracker_47(client._config.sessionSummaryInterval);
|
|
11846
|
+
sessionTracker.on('summary', sendSessionSummary(client));
|
|
11847
|
+
sessionTracker.start();
|
|
11848
|
+
client._sessionDelegate = {
|
|
11849
|
+
startSession: function (client, session) {
|
|
11850
|
+
var sessionClient = _$cloneClient_8(client);
|
|
11851
|
+
sessionClient._session = session;
|
|
11852
|
+
sessionClient._pausedSession = null;
|
|
11853
|
+
sessionTracker.track(sessionClient._session);
|
|
11854
|
+
return sessionClient;
|
|
11855
|
+
},
|
|
11856
|
+
pauseSession: function (client) {
|
|
11857
|
+
client._pausedSession = client._session;
|
|
11858
|
+
client._session = null;
|
|
11859
|
+
},
|
|
11860
|
+
resumeSession: function (client) {
|
|
11861
|
+
// Do nothing if there's already an active session
|
|
11862
|
+
if (client._session) {
|
|
11863
|
+
return client;
|
|
11864
|
+
} // If we have a paused session then make it the active session
|
|
11865
|
+
|
|
11866
|
+
|
|
11867
|
+
if (client._pausedSession) {
|
|
11868
|
+
client._session = client._pausedSession;
|
|
11869
|
+
client._pausedSession = null;
|
|
11870
|
+
return client;
|
|
11871
|
+
} // Otherwise start a new session
|
|
11872
|
+
|
|
11873
|
+
|
|
11874
|
+
return client.startSession();
|
|
11875
|
+
}
|
|
11876
|
+
};
|
|
11877
|
+
},
|
|
11878
|
+
configSchema: {
|
|
11879
|
+
sessionSummaryInterval: {
|
|
11880
|
+
defaultValue: function () {
|
|
11881
|
+
return undefined;
|
|
11882
|
+
},
|
|
11883
|
+
validate: function (value) {
|
|
11884
|
+
return value === undefined || _$intRange_25()(value);
|
|
11885
|
+
},
|
|
11886
|
+
message: 'should be a positive integer'
|
|
11887
|
+
}
|
|
11888
|
+
}
|
|
11889
|
+
};
|
|
11890
|
+
|
|
11891
|
+
var sendSessionSummary = function (client) {
|
|
11892
|
+
return function (sessionCounts) {
|
|
11893
|
+
// exit early if the current releaseStage is not enabled
|
|
11894
|
+
if (client._config.enabledReleaseStages !== null && !client._config.enabledReleaseStages.includes(client._config.releaseStage)) {
|
|
11895
|
+
client._logger.warn('Session not sent due to releaseStage/enabledReleaseStages configuration');
|
|
11896
|
+
|
|
11897
|
+
return;
|
|
11898
|
+
}
|
|
11899
|
+
|
|
11900
|
+
if (!sessionCounts.length) return;
|
|
11901
|
+
var backoff = new _$Backoff_45({
|
|
11902
|
+
min: 1000,
|
|
11903
|
+
max: 10000
|
|
11904
|
+
});
|
|
11905
|
+
var maxAttempts = 10;
|
|
11906
|
+
req(handleRes);
|
|
11907
|
+
|
|
11908
|
+
function handleRes(err) {
|
|
11909
|
+
if (!err) {
|
|
11910
|
+
var sessionCount = sessionCounts.reduce(function (accum, s) {
|
|
11911
|
+
return accum + s.sessionsStarted;
|
|
11912
|
+
}, 0);
|
|
11913
|
+
return client._logger.debug(sessionCount + " session(s) reported");
|
|
11914
|
+
}
|
|
11915
|
+
|
|
11916
|
+
if (backoff.attempts === 10) {
|
|
11917
|
+
client._logger.error('Session delivery failed, max retries exceeded', err);
|
|
11918
|
+
|
|
11919
|
+
return;
|
|
11920
|
+
}
|
|
11921
|
+
|
|
11922
|
+
client._logger.debug('Session delivery failed, retry #' + (backoff.attempts + 1) + '/' + maxAttempts, err);
|
|
11923
|
+
|
|
11924
|
+
setTimeout(function () {
|
|
11925
|
+
return req(handleRes);
|
|
11926
|
+
}, backoff.duration());
|
|
11927
|
+
}
|
|
11928
|
+
|
|
11929
|
+
function req(cb) {
|
|
11930
|
+
var payload = {
|
|
11931
|
+
notifier: client._notifier,
|
|
11932
|
+
device: {},
|
|
11933
|
+
app: {
|
|
11934
|
+
releaseStage: client._config.releaseStage,
|
|
11935
|
+
version: client._config.appVersion,
|
|
11936
|
+
type: client._config.appType
|
|
11937
|
+
},
|
|
11938
|
+
sessionCounts: sessionCounts
|
|
11939
|
+
};
|
|
11940
|
+
var ignore = _$syncCallbackRunner_24(client._cbs.sp, payload, 'onSessionPayload', client._logger);
|
|
11941
|
+
|
|
11942
|
+
if (ignore) {
|
|
11943
|
+
client._logger.debug('Session not sent due to onSessionPayload callback');
|
|
11944
|
+
|
|
11945
|
+
return cb(null);
|
|
11946
|
+
}
|
|
11947
|
+
|
|
11948
|
+
client._delivery.sendSession(payload, cb);
|
|
11949
|
+
}
|
|
11950
|
+
};
|
|
11951
|
+
};
|
|
11952
|
+
|
|
11953
|
+
var _$pathNormaliser_48 = {
|
|
11954
|
+
load: function (client) {
|
|
11955
|
+
client.addOnError(function (event) {
|
|
11956
|
+
var allFrames = event.errors.reduce(function (accum, er) {
|
|
11957
|
+
return accum.concat(er.stacktrace);
|
|
11958
|
+
}, []);
|
|
11959
|
+
allFrames.forEach(function (stackframe) {
|
|
11960
|
+
if (typeof stackframe.file !== 'string') {
|
|
11961
|
+
return;
|
|
11962
|
+
}
|
|
11963
|
+
|
|
11964
|
+
stackframe.file = stackframe.file.replace(/\\/g, '/');
|
|
11965
|
+
});
|
|
11966
|
+
});
|
|
11967
|
+
}
|
|
11968
|
+
};
|
|
11969
|
+
|
|
11970
|
+
var _$stripProjectRoot_49 = {
|
|
11971
|
+
load: function (client) {
|
|
11972
|
+
return client.addOnError(function (event) {
|
|
11973
|
+
if (!client._config.projectRoot) return;
|
|
11974
|
+
var projectRoot = _$pathNormalizer_23(client._config.projectRoot);
|
|
11975
|
+
var allFrames = event.errors.reduce(function (accum, er) {
|
|
11976
|
+
return accum.concat(er.stacktrace);
|
|
11977
|
+
}, []);
|
|
11978
|
+
allFrames.map(function (stackframe) {
|
|
11979
|
+
if (typeof stackframe.file === 'string' && stackframe.file.indexOf(projectRoot) === 0) {
|
|
11980
|
+
stackframe.file = stackframe.file.replace(projectRoot, '');
|
|
11981
|
+
}
|
|
11982
|
+
});
|
|
11983
|
+
});
|
|
11984
|
+
}
|
|
11985
|
+
};
|
|
11986
|
+
|
|
11987
|
+
var _$notifier_36 = {};
|
|
11988
|
+
function ___extends_36() { ___extends_36 = 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]; } } } return target; }; return ___extends_36.apply(this, arguments); }
|
|
11989
|
+
|
|
11990
|
+
var name = 'Bugsnag Node';
|
|
11991
|
+
var version = '7.18.0';
|
|
11992
|
+
var url$1 = 'https://github.com/bugsnag/bugsnag-js';
|
|
11993
|
+
|
|
11994
|
+
_$Event_4.__type = 'nodejs';
|
|
11995
|
+
|
|
11996
|
+
|
|
11997
|
+
var __schema_36 = ___extends_36({}, _$config_3.schema, _$config_35); // remove enabledBreadcrumbTypes from the config schema
|
|
11998
|
+
|
|
11999
|
+
|
|
12000
|
+
delete __schema_36.enabledBreadcrumbTypes;
|
|
12001
|
+
|
|
12002
|
+
var internalPlugins = [_$app_37, _$surroundingCode_42, _$inProject_41, _$stripProjectRoot_49, _$session_46, _$device_40, _$uncaughtException_43, _$unhandledRejection_44, _$intercept_39, _$contextualize_38, _$pathNormaliser_48];
|
|
12003
|
+
var Bugsnag = {
|
|
12004
|
+
_client: null,
|
|
12005
|
+
createClient: function (opts) {
|
|
12006
|
+
// handle very simple use case where user supplies just the api key as a string
|
|
12007
|
+
if (typeof opts === 'string') opts = {
|
|
12008
|
+
apiKey: opts
|
|
12009
|
+
};
|
|
12010
|
+
if (!opts) opts = {};
|
|
12011
|
+
var bugsnag = new _$Client_2(opts, __schema_36, internalPlugins, {
|
|
12012
|
+
name: name,
|
|
12013
|
+
version: version,
|
|
12014
|
+
url: url$1
|
|
12015
|
+
});
|
|
12016
|
+
|
|
12017
|
+
bugsnag._setDelivery(_$delivery_33);
|
|
12018
|
+
|
|
12019
|
+
bugsnag._logger.debug('Loaded!');
|
|
12020
|
+
|
|
12021
|
+
bugsnag.leaveBreadcrumb = function () {
|
|
12022
|
+
bugsnag._logger.warn('Breadcrumbs are not supported in Node.js yet');
|
|
12023
|
+
};
|
|
12024
|
+
|
|
12025
|
+
bugsnag._config.enabledBreadcrumbTypes = [];
|
|
12026
|
+
return bugsnag;
|
|
12027
|
+
},
|
|
12028
|
+
start: function (opts) {
|
|
12029
|
+
if (Bugsnag._client) {
|
|
12030
|
+
Bugsnag._client._logger.warn('Bugsnag.start() was called more than once. Ignoring.');
|
|
12031
|
+
|
|
12032
|
+
return Bugsnag._client;
|
|
12033
|
+
}
|
|
12034
|
+
|
|
12035
|
+
Bugsnag._client = Bugsnag.createClient(opts);
|
|
12036
|
+
return Bugsnag._client;
|
|
12037
|
+
},
|
|
12038
|
+
isStarted: function () {
|
|
12039
|
+
return Bugsnag._client != null;
|
|
12040
|
+
}
|
|
12041
|
+
};
|
|
12042
|
+
Object.keys(_$Client_2.prototype).forEach(function (m) {
|
|
12043
|
+
if (/^_/.test(m)) return;
|
|
12044
|
+
|
|
12045
|
+
Bugsnag[m] = function () {
|
|
12046
|
+
if (!Bugsnag._client) return console.error("Bugsnag." + m + "() was called before Bugsnag.start()");
|
|
12047
|
+
Bugsnag._client._depth += 1;
|
|
12048
|
+
|
|
12049
|
+
var ret = Bugsnag._client[m].apply(Bugsnag._client, arguments);
|
|
12050
|
+
|
|
12051
|
+
Bugsnag._client._depth -= 1;
|
|
12052
|
+
return ret;
|
|
12053
|
+
};
|
|
12054
|
+
});
|
|
12055
|
+
_$notifier_36 = Bugsnag;
|
|
12056
|
+
_$notifier_36.Client = _$Client_2;
|
|
12057
|
+
_$notifier_36.Event = _$Event_4;
|
|
12058
|
+
_$notifier_36.Session = _$Session_32;
|
|
12059
|
+
_$notifier_36.Breadcrumb = _$Breadcrumb_1; // Export a "default" property for compatibility with ESM imports
|
|
12060
|
+
|
|
12061
|
+
_$notifier_36["default"] = Bugsnag;
|
|
12062
|
+
|
|
12063
|
+
return _$notifier_36;
|
|
12064
|
+
|
|
12065
|
+
});
|
|
12066
|
+
|
|
12067
|
+
});
|
|
12068
|
+
|
|
12069
|
+
var notifier = bugsnag;
|
|
12070
|
+
|
|
8564
12071
|
/**
|
|
8565
12072
|
* List of zero-decimal currencies.
|
|
8566
12073
|
* @see https://stripe.com/docs/currencies#zero-decimal
|
|
@@ -8875,6 +12382,18 @@ function userMustVerifyEmail() {
|
|
|
8875
12382
|
const isUserEmailVerified = (_window$Pelcro$user$r9 = (_window$Pelcro$user$r10 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r10 === void 0 ? void 0 : _window$Pelcro$user$r10.email_confirm) !== null && _window$Pelcro$user$r9 !== void 0 ? _window$Pelcro$user$r9 : false;
|
|
8876
12383
|
return window.Pelcro.user.isAuthenticated() && isEmailVerificationEnabled && !isUserEmailVerified;
|
|
8877
12384
|
}
|
|
12385
|
+
function notifyBugsnag() {
|
|
12386
|
+
let message = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'Error';
|
|
12387
|
+
notifier.notify(message, event => {
|
|
12388
|
+
var _window$Pelcro3, _window$Pelcro3$site, _window$Pelcro4, _window$Pelcro4$user, _window$Pelcro5, _window$Pelcro5$uiSet, _window$Pelcro6;
|
|
12389
|
+
event.addMetadata("MetaData", {
|
|
12390
|
+
site: (_window$Pelcro3 = window.Pelcro) === null || _window$Pelcro3 === void 0 ? void 0 : (_window$Pelcro3$site = _window$Pelcro3.site) === null || _window$Pelcro3$site === void 0 ? void 0 : _window$Pelcro3$site.read(),
|
|
12391
|
+
user: (_window$Pelcro4 = window.Pelcro) === null || _window$Pelcro4 === void 0 ? void 0 : (_window$Pelcro4$user = _window$Pelcro4.user) === null || _window$Pelcro4$user === void 0 ? void 0 : _window$Pelcro4$user.read(),
|
|
12392
|
+
uiVersion: (_window$Pelcro5 = window.Pelcro) === null || _window$Pelcro5 === void 0 ? void 0 : (_window$Pelcro5$uiSet = _window$Pelcro5.uiSettings) === null || _window$Pelcro5$uiSet === void 0 ? void 0 : _window$Pelcro5$uiSet.uiVersion,
|
|
12393
|
+
environment: (_window$Pelcro6 = window.Pelcro) === null || _window$Pelcro6 === void 0 ? void 0 : _window$Pelcro6.environment
|
|
12394
|
+
});
|
|
12395
|
+
});
|
|
12396
|
+
}
|
|
8878
12397
|
|
|
8879
12398
|
const resources = {
|
|
8880
12399
|
en: {
|
|
@@ -11110,7 +14629,10 @@ const initSubscriptionFromURL = () => {
|
|
|
11110
14629
|
whenSiteReady(() => {
|
|
11111
14630
|
var _selectedProduct$plan;
|
|
11112
14631
|
const productsList = window.Pelcro.product.list();
|
|
11113
|
-
if (!(productsList !== null && productsList !== void 0 && productsList.length))
|
|
14632
|
+
if (!(productsList !== null && productsList !== void 0 && productsList.length)) {
|
|
14633
|
+
notifyBugsnag("initSubscriptionFromURL - Empty Products List");
|
|
14634
|
+
return;
|
|
14635
|
+
}
|
|
11114
14636
|
const [productId, planId, isGiftParam] = [window.Pelcro.helpers.getURLParameter("product_id"), window.Pelcro.helpers.getURLParameter("plan_id"), window.Pelcro.helpers.getURLParameter("is_gift")];
|
|
11115
14637
|
const isGift = (isGiftParam === null || isGiftParam === void 0 ? void 0 : isGiftParam.toLowerCase()) === "true";
|
|
11116
14638
|
const selectedProduct = productsList.find(product => product.id === Number(productId));
|