@appsignal/javascript
Advanced tools
Comparing version 1.0.1 to 1.1.0
# Changelog | ||
## 1.1.0 | ||
- Dependency bumps | ||
- Split some reusable logic into `@appsignal/core` package | ||
- Fix errors when run with in React Native (#130) | ||
- Add ignored errors list (#134) | ||
## 1.0.1 | ||
- Dependency bumps, no new features |
@@ -5,3 +5,3 @@ "use strict"; | ||
var environment_1 = require("./environment"); | ||
var url_1 = require("./utils/url"); | ||
var core_1 = require("@appsignal/core"); | ||
var xdomain_1 = require("./transports/xdomain"); | ||
@@ -42,3 +42,3 @@ var xhr_1 = require("./transports/xhr"); | ||
var auth = this._authorization(); | ||
return this._uri + "?" + url_1.urlEncode(auth); | ||
return this._uri + "?" + core_1.urlEncode(auth); | ||
}; | ||
@@ -45,0 +45,0 @@ PushApi.prototype._authorization = function () { |
@@ -13,2 +13,5 @@ "use strict"; | ||
Environment.origin = function () { | ||
if (navigator.product === "ReactNative" && !window.location) { | ||
return ""; | ||
} | ||
return (window.location.origin || | ||
@@ -29,19 +32,14 @@ window.location.protocol + "//" + window.location.hostname); | ||
Environment.supportsPromises = function () { | ||
var P = window.Promise; | ||
if (P) { | ||
var promiseToString = null; | ||
try { | ||
promiseToString = Object.prototype.toString.call(P.resolve()); | ||
} | ||
catch (e) { | ||
} | ||
if (promiseToString === "[object Promise]" && !P.cast) { | ||
return true; | ||
} | ||
if (promiseToString === "[object Object]" && | ||
Promise.prototype._guidKey) { | ||
return true; | ||
} | ||
} | ||
return false; | ||
return ("Promise" in window && | ||
"resolve" in window.Promise && | ||
"reject" in window.Promise && | ||
"all" in window.Promise && | ||
"race" in window.Promise && | ||
(function () { | ||
var resolve; | ||
new window.Promise(function (r) { | ||
resolve = r; | ||
}); | ||
return typeof resolve === "function"; | ||
})()); | ||
}; | ||
@@ -48,0 +46,0 @@ return Environment; |
@@ -7,2 +7,3 @@ import { Breadcrumb } from "@appsignal/types"; | ||
VERSION: string; | ||
ignored: RegExp[]; | ||
private _dispatcher; | ||
@@ -9,0 +10,0 @@ private _options; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var tslib_1 = require("tslib"); | ||
var core_1 = require("@appsignal/core"); | ||
var version_1 = require("./version"); | ||
@@ -10,4 +11,2 @@ var api_1 = require("./api"); | ||
var dispatcher_1 = require("./dispatcher"); | ||
var hashmap_1 = require("./utils/hashmap"); | ||
var functional_1 = require("./utils/functional"); | ||
var Appsignal = (function () { | ||
@@ -31,2 +30,3 @@ function Appsignal(options) { | ||
}); | ||
this.ignored = options.ignoreErrors || []; | ||
this._breadcrumbs = []; | ||
@@ -43,5 +43,19 @@ this._dispatcher = new dispatcher_1.Dispatcher(this._queue, this._api); | ||
} | ||
if (this.ignored.length !== 0) { | ||
if (data instanceof Error && | ||
this.ignored.some(function (el) { return el.test(data.message); })) { | ||
console.warn("[APPSIGNAL]: Ignored an error: " + data.message); | ||
return; | ||
} | ||
if (data instanceof span_1.Span) { | ||
var error_1 = data.serialize().error; | ||
if (error_1.message && this.ignored.some(function (el) { return el.test(error_1.message); })) { | ||
console.warn("[APPSIGNAL]: Ignored a span: " + error_1.message); | ||
return; | ||
} | ||
} | ||
} | ||
var span = data instanceof span_1.Span ? data : this._createSpanFromError(data); | ||
if (this._hooks.decorators.length > 0) { | ||
functional_1.compose.apply(void 0, tslib_1.__spread(this._hooks.decorators))(span); | ||
core_1.compose.apply(void 0, tslib_1.__spread(this._hooks.decorators))(span); | ||
} | ||
@@ -55,3 +69,3 @@ if (tags) | ||
if (this._hooks.overrides.length > 0) { | ||
functional_1.compose.apply(void 0, tslib_1.__spread(this._hooks.overrides))(span); | ||
core_1.compose.apply(void 0, tslib_1.__spread(this._hooks.overrides))(span); | ||
} | ||
@@ -127,3 +141,3 @@ if (environment_1.Environment.supportsPromises()) { | ||
Appsignal.prototype.addBreadcrumb = function (breadcrumb) { | ||
var crumb = tslib_1.__assign(tslib_1.__assign({ timestamp: Math.round(new Date().getTime() / 1000) }, breadcrumb), { metadata: hashmap_1.toHashMap(breadcrumb.metadata) }); | ||
var crumb = tslib_1.__assign(tslib_1.__assign({ timestamp: Math.round(new Date().getTime() / 1000) }, breadcrumb), { metadata: core_1.toHashMap(breadcrumb.metadata) }); | ||
if (!crumb.category) { | ||
@@ -130,0 +144,0 @@ console.warn("[APPSIGNAL]: Breadcrumb not added. `category` is missing."); |
@@ -0,3 +1,3 @@ | ||
import { Serializable } from "@appsignal/core"; | ||
import { SpanData, Breadcrumb, HashMap, HashMapValue } from "@appsignal/types"; | ||
import { Serializable } from "./serializable"; | ||
export declare class Span extends Serializable<SpanData> { | ||
@@ -4,0 +4,0 @@ constructor(span?: Partial<SpanData>); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var tslib_1 = require("tslib"); | ||
var serializable_1 = require("./serializable"); | ||
var stacktrace_1 = require("./utils/stacktrace"); | ||
var hashmap_1 = require("./utils/hashmap"); | ||
var core_1 = require("@appsignal/core"); | ||
var Span = (function (_super) { | ||
@@ -36,3 +34,3 @@ tslib_1.__extends(Span, _super); | ||
message: error.message || "No message given", | ||
backtrace: stacktrace_1.getStacktrace(error) | ||
backtrace: core_1.getStacktrace(error) | ||
}; | ||
@@ -42,3 +40,3 @@ return this; | ||
Span.prototype.setTags = function (tags) { | ||
this._data.tags = tslib_1.__assign(tslib_1.__assign({}, this._data.tags), hashmap_1.toHashMapString(tags)); | ||
this._data.tags = tslib_1.__assign(tslib_1.__assign({}, this._data.tags), core_1.toHashMapString(tags)); | ||
return this; | ||
@@ -55,4 +53,4 @@ }; | ||
return Span; | ||
}(serializable_1.Serializable)); | ||
}(core_1.Serializable)); | ||
exports.Span = Span; | ||
//# sourceMappingURL=span.js.map |
@@ -8,2 +8,3 @@ declare type BaseOptions = { | ||
revision?: string; | ||
ignoreErrors?: RegExp[]; | ||
}; | ||
@@ -10,0 +11,0 @@ export declare type PushApiOptions = BaseOptions & { |
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "1.0.1"; | ||
export declare const VERSION = "1.1.0"; | ||
//# sourceMappingURL=version.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.VERSION = "1.0.1"; | ||
exports.VERSION = "1.1.0"; | ||
//# sourceMappingURL=version.js.map |
import { __awaiter, __generator } from "tslib"; | ||
import { Environment } from "./environment"; | ||
import { urlEncode } from "./utils/url"; | ||
import { urlEncode } from "@appsignal/core"; | ||
import { XDomainTransport } from "./transports/xdomain"; | ||
@@ -5,0 +5,0 @@ import { XHRTransport } from "./transports/xhr"; |
@@ -11,2 +11,5 @@ var Environment = (function () { | ||
Environment.origin = function () { | ||
if (navigator.product === "ReactNative" && !window.location) { | ||
return ""; | ||
} | ||
return (window.location.origin || | ||
@@ -27,19 +30,14 @@ window.location.protocol + "//" + window.location.hostname); | ||
Environment.supportsPromises = function () { | ||
var P = window.Promise; | ||
if (P) { | ||
var promiseToString = null; | ||
try { | ||
promiseToString = Object.prototype.toString.call(P.resolve()); | ||
} | ||
catch (e) { | ||
} | ||
if (promiseToString === "[object Promise]" && !P.cast) { | ||
return true; | ||
} | ||
if (promiseToString === "[object Object]" && | ||
Promise.prototype._guidKey) { | ||
return true; | ||
} | ||
} | ||
return false; | ||
return ("Promise" in window && | ||
"resolve" in window.Promise && | ||
"reject" in window.Promise && | ||
"all" in window.Promise && | ||
"race" in window.Promise && | ||
(function () { | ||
var resolve; | ||
new window.Promise(function (r) { | ||
resolve = r; | ||
}); | ||
return typeof resolve === "function"; | ||
})()); | ||
}; | ||
@@ -46,0 +44,0 @@ return Environment; |
@@ -7,2 +7,3 @@ import { Breadcrumb } from "@appsignal/types"; | ||
VERSION: string; | ||
ignored: RegExp[]; | ||
private _dispatcher; | ||
@@ -9,0 +10,0 @@ private _options; |
import { __assign, __awaiter, __generator, __read, __spread } from "tslib"; | ||
import { compose, toHashMap } from "@appsignal/core"; | ||
import { VERSION } from "./version"; | ||
@@ -8,4 +9,2 @@ import { PushApi } from "./api"; | ||
import { Dispatcher } from "./dispatcher"; | ||
import { toHashMap } from "./utils/hashmap"; | ||
import { compose } from "./utils/functional"; | ||
var Appsignal = (function () { | ||
@@ -29,2 +28,3 @@ function Appsignal(options) { | ||
}); | ||
this.ignored = options.ignoreErrors || []; | ||
this._breadcrumbs = []; | ||
@@ -41,2 +41,16 @@ this._dispatcher = new Dispatcher(this._queue, this._api); | ||
} | ||
if (this.ignored.length !== 0) { | ||
if (data instanceof Error && | ||
this.ignored.some(function (el) { return el.test(data.message); })) { | ||
console.warn("[APPSIGNAL]: Ignored an error: " + data.message); | ||
return; | ||
} | ||
if (data instanceof Span) { | ||
var error_1 = data.serialize().error; | ||
if (error_1.message && this.ignored.some(function (el) { return el.test(error_1.message); })) { | ||
console.warn("[APPSIGNAL]: Ignored a span: " + error_1.message); | ||
return; | ||
} | ||
} | ||
} | ||
var span = data instanceof Span ? data : this._createSpanFromError(data); | ||
@@ -43,0 +57,0 @@ if (this._hooks.decorators.length > 0) { |
@@ -0,3 +1,3 @@ | ||
import { Serializable } from "@appsignal/core"; | ||
import { SpanData, Breadcrumb, HashMap, HashMapValue } from "@appsignal/types"; | ||
import { Serializable } from "./serializable"; | ||
export declare class Span extends Serializable<SpanData> { | ||
@@ -4,0 +4,0 @@ constructor(span?: Partial<SpanData>); |
import { __assign, __extends } from "tslib"; | ||
import { Serializable } from "./serializable"; | ||
import { getStacktrace } from "./utils/stacktrace"; | ||
import { toHashMapString } from "./utils/hashmap"; | ||
import { Serializable, getStacktrace, toHashMapString } from "@appsignal/core"; | ||
var Span = (function (_super) { | ||
@@ -6,0 +4,0 @@ __extends(Span, _super); |
@@ -8,2 +8,3 @@ declare type BaseOptions = { | ||
revision?: string; | ||
ignoreErrors?: RegExp[]; | ||
}; | ||
@@ -10,0 +11,0 @@ export declare type PushApiOptions = BaseOptions & { |
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "1.0.1"; | ||
export declare const VERSION = "1.1.0"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -1,2 +0,2 @@ | ||
export var VERSION = "1.0.1"; | ||
export var VERSION = "1.1.0"; | ||
//# sourceMappingURL=version.js.map |
{ | ||
"name": "@appsignal/javascript", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"main": "dist/cjs/index.js", | ||
@@ -27,6 +27,8 @@ "module": "dist/esm/index.js", | ||
"dependencies": { | ||
"@appsignal/types": "^1.0.0", | ||
"tslib": "^1.10.0" | ||
}, | ||
"gitHead": "e5e14e5abf27c1e111bb63a5d82957b61050ffda" | ||
"devDependencies": { | ||
"@appsignal/types": "^1.0.0" | ||
}, | ||
"gitHead": "4422939006f196292966eb9d390c15259056f02f" | ||
} |
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
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
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
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
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
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
1
84757
1
107
1248
1
- Removed@appsignal/types@^1.0.0
- Removed@appsignal/types@1.0.0(transitive)