@appsignal/javascript
Advanced tools
Comparing version 1.3.18 to 1.3.19
# AppSignal for JavaScript changelog | ||
## 1.3.19 | ||
- [387ee27](https://github.com/appsignal/appsignal-javascript/commit/387ee2711554b5e701be37a9b70d9c01861b6ef5) patch - Fix the reported library version of the JavaScript package. This was stuck on 1.3.12 for the last few releases. | ||
- [e737a7f](https://github.com/appsignal/appsignal-javascript/commit/e737a7f8ca15cbe3577a7209e641b43610f0f68b) patch - Add callback argument to the `sendError` function to allow for more customization of errors sent with `sendError` and `wrap`. The `tags` and `namespace` parameters are now deprecated for both helpers. | ||
```js | ||
// Deprecated behavior | ||
appsignal.sendError( | ||
new Error("sendError with tags and namespace argument"), | ||
{ tag1: "value 1", tag2: "value 2" }, | ||
"custom_namespace" | ||
); | ||
// New behavior | ||
appsignal.sendError( | ||
new Error("sendError with callback argument"), | ||
function(span) { | ||
span.setAction("SendErrorTestAction"); | ||
span.setNamespace("custom_namespace"); | ||
span.setTags({ tag1: "value 1", tag2: "value 2" }); | ||
} | ||
); | ||
``` | ||
- patch - Update @appsignal/core dependency to 1.1.14. | ||
- patch - Update @appsignal/types dependency to 2.1.6. | ||
## 1.3.18 | ||
@@ -4,0 +30,0 @@ |
@@ -15,8 +15,12 @@ import type { Breadcrumb, JSClient, Hook } from "@appsignal/types"; | ||
constructor(options: AppsignalOptions); | ||
send<T>(error: Error, fn?: (span: Span) => T): Promise<Span> | void; | ||
send(error: Error, tags?: object, namespace?: string): Promise<Span> | void; | ||
send(span: Span): Promise<Span> | void; | ||
sendError(error: Error, tags?: object, namespace?: string): Promise<Span> | void; | ||
sendError<T>(error: Error): Promise<Span> | void; | ||
sendError<T>(error: Error, callback: (span: Span) => T): Promise<Span> | void; | ||
sendError<T>(error: Error, tags?: object, namespace?: string): Promise<Span> | void; | ||
use(plugin: Function): void; | ||
createSpan(fn?: (span: Span) => void): Span; | ||
wrap<T>(fn: () => T, tags?: {}, namespace?: string): Promise<T>; | ||
wrap<T>(fn: () => T, callbackFn?: (span: Span) => T): Promise<T>; | ||
wrap<T>(fn: () => T, tags?: object, namespace?: string): Promise<T>; | ||
addDecorator<T extends Hook>(decorator: T): void; | ||
@@ -23,0 +27,0 @@ addOverride<T extends Hook>(override: T): void; |
@@ -40,5 +40,4 @@ "use strict"; | ||
} | ||
Appsignal.prototype.send = function (data, tags, namespace) { | ||
Appsignal.prototype.send = function (data, tagsOrFn, namespace) { | ||
var _this = this; | ||
if (tags === void 0) { tags = {}; } | ||
if (!(data instanceof Error) && !(data instanceof span_1.Span)) { | ||
@@ -66,6 +65,17 @@ console.error("[APPSIGNAL]: Can't send error, given error is not a valid type"); | ||
} | ||
if (tags) | ||
span.setTags(tags); | ||
if (namespace) | ||
if (tagsOrFn) { | ||
if (typeof tagsOrFn === "function") { | ||
var callback = tagsOrFn; | ||
callback(span); | ||
} | ||
else { | ||
console.warn("[APPSIGNAL]: DEPRECATED: Calling the `send`/`sendError` function with a tags object is deprecated. Use the callback argument instead."); | ||
var tags = (core_1.toHashMap(tagsOrFn) || {}); | ||
span.setTags(tags); | ||
} | ||
} | ||
if (namespace) { | ||
console.warn("[APPSIGNAL]: DEPRECATED: Calling the `send`/`sendError` function with a namespace is deprecated. Use the callback argument instead."); | ||
span.setNamespace(namespace); | ||
} | ||
if (this._breadcrumbs.length > 0) | ||
@@ -96,4 +106,4 @@ span.setBreadcrumbs(this._breadcrumbs); | ||
}; | ||
Appsignal.prototype.sendError = function (error, tags, namespace) { | ||
return this.send(error, tags, namespace); | ||
Appsignal.prototype.sendError = function (error, tagsOrFn, namespace) { | ||
return this.send(error, tagsOrFn, namespace); | ||
}; | ||
@@ -115,4 +125,3 @@ Appsignal.prototype.use = function (plugin) { | ||
}; | ||
Appsignal.prototype.wrap = function (fn, tags, namespace) { | ||
if (tags === void 0) { tags = {}; } | ||
Appsignal.prototype.wrap = function (fn, tagsOrFn, namespace) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function () { | ||
@@ -128,3 +137,3 @@ var e_1; | ||
e_1 = _a.sent(); | ||
return [4, this.sendError(e_1, tags, namespace)]; | ||
return [4, this.sendError(e_1, tagsOrFn, namespace)]; | ||
case 3: | ||
@@ -131,0 +140,0 @@ _a.sent(); |
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "1.3.12"; | ||
export declare const VERSION = "1.3.18"; | ||
//# sourceMappingURL=version.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.VERSION = void 0; | ||
exports.VERSION = "1.3.12"; | ||
exports.VERSION = "1.3.18"; | ||
//# sourceMappingURL=version.js.map |
@@ -15,8 +15,12 @@ import type { Breadcrumb, JSClient, Hook } from "@appsignal/types"; | ||
constructor(options: AppsignalOptions); | ||
send<T>(error: Error, fn?: (span: Span) => T): Promise<Span> | void; | ||
send(error: Error, tags?: object, namespace?: string): Promise<Span> | void; | ||
send(span: Span): Promise<Span> | void; | ||
sendError(error: Error, tags?: object, namespace?: string): Promise<Span> | void; | ||
sendError<T>(error: Error): Promise<Span> | void; | ||
sendError<T>(error: Error, callback: (span: Span) => T): Promise<Span> | void; | ||
sendError<T>(error: Error, tags?: object, namespace?: string): Promise<Span> | void; | ||
use(plugin: Function): void; | ||
createSpan(fn?: (span: Span) => void): Span; | ||
wrap<T>(fn: () => T, tags?: {}, namespace?: string): Promise<T>; | ||
wrap<T>(fn: () => T, callbackFn?: (span: Span) => T): Promise<T>; | ||
wrap<T>(fn: () => T, tags?: object, namespace?: string): Promise<T>; | ||
addDecorator<T extends Hook>(decorator: T): void; | ||
@@ -23,0 +27,0 @@ addOverride<T extends Hook>(override: T): void; |
@@ -38,5 +38,4 @@ import { __assign, __awaiter, __generator, __read, __spread } from "tslib"; | ||
} | ||
Appsignal.prototype.send = function (data, tags, namespace) { | ||
Appsignal.prototype.send = function (data, tagsOrFn, namespace) { | ||
var _this = this; | ||
if (tags === void 0) { tags = {}; } | ||
if (!(data instanceof Error) && !(data instanceof Span)) { | ||
@@ -64,6 +63,17 @@ console.error("[APPSIGNAL]: Can't send error, given error is not a valid type"); | ||
} | ||
if (tags) | ||
span.setTags(tags); | ||
if (namespace) | ||
if (tagsOrFn) { | ||
if (typeof tagsOrFn === "function") { | ||
var callback = tagsOrFn; | ||
callback(span); | ||
} | ||
else { | ||
console.warn("[APPSIGNAL]: DEPRECATED: Calling the `send`/`sendError` function with a tags object is deprecated. Use the callback argument instead."); | ||
var tags = (toHashMap(tagsOrFn) || {}); | ||
span.setTags(tags); | ||
} | ||
} | ||
if (namespace) { | ||
console.warn("[APPSIGNAL]: DEPRECATED: Calling the `send`/`sendError` function with a namespace is deprecated. Use the callback argument instead."); | ||
span.setNamespace(namespace); | ||
} | ||
if (this._breadcrumbs.length > 0) | ||
@@ -94,4 +104,4 @@ span.setBreadcrumbs(this._breadcrumbs); | ||
}; | ||
Appsignal.prototype.sendError = function (error, tags, namespace) { | ||
return this.send(error, tags, namespace); | ||
Appsignal.prototype.sendError = function (error, tagsOrFn, namespace) { | ||
return this.send(error, tagsOrFn, namespace); | ||
}; | ||
@@ -113,4 +123,3 @@ Appsignal.prototype.use = function (plugin) { | ||
}; | ||
Appsignal.prototype.wrap = function (fn, tags, namespace) { | ||
if (tags === void 0) { tags = {}; } | ||
Appsignal.prototype.wrap = function (fn, tagsOrFn, namespace) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
@@ -126,3 +135,3 @@ var e_1; | ||
e_1 = _a.sent(); | ||
return [4, this.sendError(e_1, tags, namespace)]; | ||
return [4, this.sendError(e_1, tagsOrFn, namespace)]; | ||
case 3: | ||
@@ -129,0 +138,0 @@ _a.sent(); |
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "1.3.12"; | ||
export declare const VERSION = "1.3.18"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -1,2 +0,2 @@ | ||
export var VERSION = "1.3.12"; | ||
export var VERSION = "1.3.18"; | ||
//# sourceMappingURL=version.js.map |
{ | ||
"name": "@appsignal/javascript", | ||
"version": "1.3.18", | ||
"version": "1.3.19", | ||
"main": "dist/cjs/index.js", | ||
@@ -11,2 +11,3 @@ "module": "dist/esm/index.js", | ||
"build": "yarn build:cjs && yarn build:esm", | ||
"postbuild": "yarn versionfile", | ||
"build:esm": "tsc -p tsconfig.esm.json", | ||
@@ -28,4 +29,4 @@ "build:esm:watch": "tsc -p tsconfig.esm.json -w --preserveWatchOutput", | ||
"dependencies": { | ||
"@appsignal/core": "=1.1.13", | ||
"@appsignal/types": "=2.1.5", | ||
"@appsignal/core": "=1.1.14", | ||
"@appsignal/types": "=2.1.6", | ||
"tslib": "^2.3.0" | ||
@@ -32,0 +33,0 @@ }, |
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
101769
1413
Updated@appsignal/core@=1.1.14
Updated@appsignal/types@=2.1.6