@sentry/integrations
Advanced tools
Comparing version 5.3.0 to 5.3.1
@@ -316,2 +316,3 @@ (function (__window) { | ||
function Tracing(_options) { | ||
if (_options === void 0) { _options = {}; } | ||
this._options = _options; | ||
@@ -369,3 +370,3 @@ /** | ||
Tracing.prototype._traceXHR = function (getCurrentHub) { | ||
if (!('XMLHttpRequest' in global)) { | ||
if (!('XMLHttpRequest' in getGlobalObject())) { | ||
return; | ||
@@ -398,7 +399,8 @@ } | ||
var self = getCurrentHub().getIntegration(Tracing); | ||
if (self && self._xhrUrl) { | ||
if (self && self._xhrUrl && self._options.tracingOrigins) { | ||
var url_1 = self._xhrUrl; | ||
var headers_1 = getCurrentHub().traceHeaders(); | ||
// tslint:disable-next-line: prefer-for-of | ||
var isWhitelisted = self._options.tracingOrigins.some(function (origin) { | ||
return isMatchingPattern(self._xhrUrl, origin); | ||
return isMatchingPattern(url_1, origin); | ||
}); | ||
@@ -432,4 +434,4 @@ if (isWhitelisted && this.setRequestHeader) { | ||
var self = getCurrentHub().getIntegration(Tracing); | ||
if (self) { | ||
var url_1 = args[0]; | ||
if (self && self._options.tracingOrigins) { | ||
var url_2 = args[0]; | ||
var options = args[1]; | ||
@@ -439,3 +441,3 @@ var whiteListed_1 = false; | ||
if (!whiteListed_1) { | ||
whiteListed_1 = isMatchingPattern(url_1, whiteListUrl); | ||
whiteListed_1 = isMatchingPattern(url_2, whiteListUrl); | ||
} | ||
@@ -453,3 +455,3 @@ }); | ||
// tslint:disable-next-line: no-unsafe-any | ||
return originalFetch.apply(global, args); | ||
return originalFetch.apply(getGlobalObject(), args); | ||
}; | ||
@@ -456,0 +458,0 @@ }); |
@@ -1,2 +0,2 @@ | ||
!function(n){var t={};Object.defineProperty(t,"t",{value:!0});var r=function(n,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)t.hasOwnProperty(r)&&(n[r]=t[r])})(n,t)};var e=function(){return(e=Object.assign||function(n){for(var t,r=1,e=arguments.length;r<e;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o]);return n}).apply(this,arguments)};!function(n){function t(t){var r=this.constructor,e=n.call(this,t)||this;return e.message=t,e.name=r.prototype.constructor.name,Object.setPrototypeOf(e,r.prototype),e}(function(n,t){function e(){this.constructor=n}r(n,t),n.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(t,n)}(Error);var o={};function i(){return"[object process]"===Object.prototype.toString.call("undefined"!=typeof process?process:0)?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:o}function u(n){var t=i();if(!("console"in t))return n();var r=t.console,e={};["debug","info","warn","error","log","assert"].forEach(function(n){n in t.console&&r[n].o&&(e[n]=r[n].i,r[n]=r[n].u)});var o=n();return Object.keys(e).forEach(function(n){r[n]=e[n]}),o}var f=i(),c="Sentry Logger ",a=function(){function n(){this.s=!1}return n.prototype.disable=function(){this.s=!1},n.prototype.enable=function(){this.s=!0},n.prototype.log=function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];this.s&&u(function(){f.console.log(c+"[Log]: "+n.join(" "))})},n.prototype.warn=function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];this.s&&u(function(){f.console.warn(c+"[Warn]: "+n.join(" "))})},n.prototype.error=function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];this.s&&u(function(){f.console.error(c+"[Error]: "+n.join(" "))})},n}();f.v=f.v||{};var s;f.v.logger||(f.v.logger=new a);function v(n,t,r){if(t in n){var e=n[t],o=r(e);if("function"==typeof o)try{o.prototype=o.prototype||{},Object.defineProperties(o,{o:{enumerable:!1,value:!0},u:{enumerable:!1,value:e},i:{enumerable:!1,value:o}})}catch(n){}n[t]=o}}function l(n,t){return r=t,"[object RegExp]"===Object.prototype.toString.call(r)?t.test(n):"string"==typeof t&&n.includes(t);var r}function h(){return!!function(){if(!("fetch"in i()))return!1;try{return new Headers,new Request(""),new Response,!0}catch(n){return!1}}()&&-1!==i().fetch.toString().indexOf("native")}!function(n){n.PENDING="PENDING",n.RESOLVED="RESOLVED",n.REJECTED="REJECTED"}(s||(s={}));var d=function(){function n(t){this.l=t,this.name=n.id,Array.isArray(t.tracingOrigins)&&0!==t.tracingOrigins.length||u(function(){var n=["localhost",/^\//];console.warn("Sentry: You need to define `tracingOrigins` in the options. Set an array of urls or patterns to trace."),console.warn("Sentry: We added a reasonable default for you: "+n),t.tracingOrigins=n})}return n.prototype.setupOnce=function(t,r){!1!==this.l.traceXHR&&this.h(r),!1!==this.l.traceFetch&&this._(r),!1!==this.l.autoStartOnDomReady&&(i().addEventListener("DOMContentLoaded",function(){n.startTrace(r(),i().location.href)}),i().document.onreadystatechange=function(){"complete"===document.readyState&&n.startTrace(r(),i().location.href)})},n.startTrace=function(n,t){n.configureScope(function(n){n.startSpan(),n.setTransaction(t)})},n.prototype.h=function(t){if("XMLHttpRequest"in global){var r=XMLHttpRequest.prototype;v(r,"open",function(r){return function(){for(var e=[],o=0;o<arguments.length;o++)e[o]=arguments[o];var i=t().getIntegration(n);return i&&(i.p=e[1]),r.apply(this,e)}}),v(r,"send",function(r){return function(){for(var e=this,o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];var u=t().getIntegration(n);if(u&&u.p){var f=t().traceHeaders();u.l.tracingOrigins.some(function(n){return l(u.p,n)})&&this.setRequestHeader&&Object.keys(f).forEach(function(n){e.setRequestHeader(n,f[n])})}return r.apply(this,o)}})}},n.prototype._=function(t){h()&&v(i(),"fetch",function(r){return function(){for(var o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];var u=t().getIntegration(n);if(u){var f=o[0],c=o[1],a=!1;u.l.tracingOrigins.forEach(function(n){a||(a=l(f,n))}),c&&a&&(c.headers?c.headers=e({},c.headers,t().traceHeaders()):c.headers=t().traceHeaders())}return r.apply(global,o)}})},n.id="Tracing",n}();t.Tracing=d,n.Sentry=n.Sentry||{},n.Sentry.Integrations=n.Sentry.Integrations||{},Object.assign(n.Sentry.Integrations,t)}(window); | ||
!function(n){var t={};Object.defineProperty(t,"t",{value:!0});var r=function(n,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)t.hasOwnProperty(r)&&(n[r]=t[r])})(n,t)};var e=function(){return(e=Object.assign||function(n){for(var t,r=1,e=arguments.length;r<e;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o]);return n}).apply(this,arguments)};!function(n){function t(t){var r=this.constructor,e=n.call(this,t)||this;return e.message=t,e.name=r.prototype.constructor.name,Object.setPrototypeOf(e,r.prototype),e}(function(n,t){function e(){this.constructor=n}r(n,t),n.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)})(t,n)}(Error);var o={};function i(){return"[object process]"===Object.prototype.toString.call("undefined"!=typeof process?process:0)?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:o}function u(n){var t=i();if(!("console"in t))return n();var r=t.console,e={};["debug","info","warn","error","log","assert"].forEach(function(n){n in t.console&&r[n].o&&(e[n]=r[n].i,r[n]=r[n].u)});var o=n();return Object.keys(e).forEach(function(n){r[n]=e[n]}),o}var f=i(),c="Sentry Logger ",a=function(){function n(){this.s=!1}return n.prototype.disable=function(){this.s=!1},n.prototype.enable=function(){this.s=!0},n.prototype.log=function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];this.s&&u(function(){f.console.log(c+"[Log]: "+n.join(" "))})},n.prototype.warn=function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];this.s&&u(function(){f.console.warn(c+"[Warn]: "+n.join(" "))})},n.prototype.error=function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];this.s&&u(function(){f.console.error(c+"[Error]: "+n.join(" "))})},n}();f.v=f.v||{};var s;f.v.logger||(f.v.logger=new a);function v(n,t,r){if(t in n){var e=n[t],o=r(e);if("function"==typeof o)try{o.prototype=o.prototype||{},Object.defineProperties(o,{o:{enumerable:!1,value:!0},u:{enumerable:!1,value:e},i:{enumerable:!1,value:o}})}catch(n){}n[t]=o}}function h(n,t){return r=t,"[object RegExp]"===Object.prototype.toString.call(r)?t.test(n):"string"==typeof t&&n.includes(t);var r}function l(){return!!function(){if(!("fetch"in i()))return!1;try{return new Headers,new Request(""),new Response,!0}catch(n){return!1}}()&&-1!==i().fetch.toString().indexOf("native")}!function(n){n.PENDING="PENDING",n.RESOLVED="RESOLVED",n.REJECTED="REJECTED"}(s||(s={}));var d=function(){function n(t){void 0===t&&(t={}),this.h=t,this.name=n.id,Array.isArray(t.tracingOrigins)&&0!==t.tracingOrigins.length||u(function(){var n=["localhost",/^\//];console.warn("Sentry: You need to define `tracingOrigins` in the options. Set an array of urls or patterns to trace."),console.warn("Sentry: We added a reasonable default for you: "+n),t.tracingOrigins=n})}return n.prototype.setupOnce=function(t,r){!1!==this.h.traceXHR&&this.l(r),!1!==this.h.traceFetch&&this._(r),!1!==this.h.autoStartOnDomReady&&(i().addEventListener("DOMContentLoaded",function(){n.startTrace(r(),i().location.href)}),i().document.onreadystatechange=function(){"complete"===document.readyState&&n.startTrace(r(),i().location.href)})},n.startTrace=function(n,t){n.configureScope(function(n){n.startSpan(),n.setTransaction(t)})},n.prototype.l=function(t){if("XMLHttpRequest"in i()){var r=XMLHttpRequest.prototype;v(r,"open",function(r){return function(){for(var e=[],o=0;o<arguments.length;o++)e[o]=arguments[o];var i=t().getIntegration(n);return i&&(i.p=e[1]),r.apply(this,e)}}),v(r,"send",function(r){return function(){for(var e=this,o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];var u=t().getIntegration(n);if(u&&u.p&&u.h.tracingOrigins){var f=u.p,c=t().traceHeaders();u.h.tracingOrigins.some(function(n){return h(f,n)})&&this.setRequestHeader&&Object.keys(c).forEach(function(n){e.setRequestHeader(n,c[n])})}return r.apply(this,o)}})}},n.prototype._=function(t){l()&&v(i(),"fetch",function(r){return function(){for(var o=[],u=0;u<arguments.length;u++)o[u]=arguments[u];var f=t().getIntegration(n);if(f&&f.h.tracingOrigins){var c=o[0],a=o[1],s=!1;f.h.tracingOrigins.forEach(function(n){s||(s=h(c,n))}),a&&s&&(a.headers?a.headers=e({},a.headers,t().traceHeaders()):a.headers=t().traceHeaders())}return r.apply(i(),o)}})},n.id="Tracing",n}();t.Tracing=d,n.Sentry=n.Sentry||{},n.Sentry.Integrations=n.Sentry.Integrations||{},Object.assign(n.Sentry.Integrations,t)}(window); | ||
//# sourceMappingURL=tracing.min.js.map |
import { EventProcessor, Hub, Integration } from '@sentry/types'; | ||
/** JSDoc */ | ||
interface TracingOptions { | ||
tracingOrigins: Array<string | RegExp>; | ||
tracingOrigins?: Array<string | RegExp>; | ||
traceXHR?: boolean; | ||
@@ -32,3 +32,3 @@ traceFetch?: boolean; | ||
*/ | ||
constructor(_options: TracingOptions); | ||
constructor(_options?: TracingOptions); | ||
/** | ||
@@ -35,0 +35,0 @@ * @inheritDoc |
@@ -14,2 +14,3 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
function Tracing(_options) { | ||
if (_options === void 0) { _options = {}; } | ||
this._options = _options; | ||
@@ -67,3 +68,3 @@ /** | ||
Tracing.prototype._traceXHR = function (getCurrentHub) { | ||
if (!('XMLHttpRequest' in global)) { | ||
if (!('XMLHttpRequest' in utils_1.getGlobalObject())) { | ||
return; | ||
@@ -96,7 +97,8 @@ } | ||
var self = getCurrentHub().getIntegration(Tracing); | ||
if (self && self._xhrUrl) { | ||
if (self && self._xhrUrl && self._options.tracingOrigins) { | ||
var url_1 = self._xhrUrl; | ||
var headers_1 = getCurrentHub().traceHeaders(); | ||
// tslint:disable-next-line: prefer-for-of | ||
var isWhitelisted = self._options.tracingOrigins.some(function (origin) { | ||
return utils_1.isMatchingPattern(self._xhrUrl, origin); | ||
return utils_1.isMatchingPattern(url_1, origin); | ||
}); | ||
@@ -130,4 +132,4 @@ if (isWhitelisted && this.setRequestHeader) { | ||
var self = getCurrentHub().getIntegration(Tracing); | ||
if (self) { | ||
var url_1 = args[0]; | ||
if (self && self._options.tracingOrigins) { | ||
var url_2 = args[0]; | ||
var options = args[1]; | ||
@@ -137,3 +139,3 @@ var whiteListed_1 = false; | ||
if (!whiteListed_1) { | ||
whiteListed_1 = utils_1.isMatchingPattern(url_1, whiteListUrl); | ||
whiteListed_1 = utils_1.isMatchingPattern(url_2, whiteListUrl); | ||
} | ||
@@ -151,3 +153,3 @@ }); | ||
// tslint:disable-next-line: no-unsafe-any | ||
return originalFetch.apply(global, args); | ||
return originalFetch.apply(utils_1.getGlobalObject(), args); | ||
}; | ||
@@ -154,0 +156,0 @@ }); |
import { EventProcessor, Hub, Integration } from '@sentry/types'; | ||
/** JSDoc */ | ||
interface TracingOptions { | ||
tracingOrigins: Array<string | RegExp>; | ||
tracingOrigins?: Array<string | RegExp>; | ||
traceXHR?: boolean; | ||
@@ -32,3 +32,3 @@ traceFetch?: boolean; | ||
*/ | ||
constructor(_options: TracingOptions); | ||
constructor(_options?: TracingOptions); | ||
/** | ||
@@ -35,0 +35,0 @@ * @inheritDoc |
@@ -13,2 +13,3 @@ import * as tslib_1 from "tslib"; | ||
function Tracing(_options) { | ||
if (_options === void 0) { _options = {}; } | ||
this._options = _options; | ||
@@ -66,3 +67,3 @@ /** | ||
Tracing.prototype._traceXHR = function (getCurrentHub) { | ||
if (!('XMLHttpRequest' in global)) { | ||
if (!('XMLHttpRequest' in getGlobalObject())) { | ||
return; | ||
@@ -95,7 +96,8 @@ } | ||
var self = getCurrentHub().getIntegration(Tracing); | ||
if (self && self._xhrUrl) { | ||
if (self && self._xhrUrl && self._options.tracingOrigins) { | ||
var url_1 = self._xhrUrl; | ||
var headers_1 = getCurrentHub().traceHeaders(); | ||
// tslint:disable-next-line: prefer-for-of | ||
var isWhitelisted = self._options.tracingOrigins.some(function (origin) { | ||
return isMatchingPattern(self._xhrUrl, origin); | ||
return isMatchingPattern(url_1, origin); | ||
}); | ||
@@ -129,4 +131,4 @@ if (isWhitelisted && this.setRequestHeader) { | ||
var self = getCurrentHub().getIntegration(Tracing); | ||
if (self) { | ||
var url_1 = args[0]; | ||
if (self && self._options.tracingOrigins) { | ||
var url_2 = args[0]; | ||
var options = args[1]; | ||
@@ -136,3 +138,3 @@ var whiteListed_1 = false; | ||
if (!whiteListed_1) { | ||
whiteListed_1 = isMatchingPattern(url_1, whiteListUrl); | ||
whiteListed_1 = isMatchingPattern(url_2, whiteListUrl); | ||
} | ||
@@ -150,3 +152,3 @@ }); | ||
// tslint:disable-next-line: no-unsafe-any | ||
return originalFetch.apply(global, args); | ||
return originalFetch.apply(getGlobalObject(), args); | ||
}; | ||
@@ -153,0 +155,0 @@ }); |
{ | ||
"name": "@sentry/integrations", | ||
"version": "5.3.0", | ||
"version": "5.3.1", | ||
"description": "Pluggable integrations that can be used to enchance JS SDKs", | ||
@@ -5,0 +5,0 @@ "repository": "git://github.com/getsentry/sentry-javascript.git", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
968841
6576