@lokalise/fastify-extras 17.0.0 → 17.0.2
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.
|
@@ -1,20 +1,10 @@
|
|
|
1
|
-
import type { Event, NotifiableError } from '@bugsnag/js';
|
|
2
1
|
import type { NodeConfig } from '@bugsnag/node';
|
|
3
|
-
import type
|
|
2
|
+
import { bugsnagErrorReporter, type ErrorReport, reportErrorToBugsnag, type Severity } from '@lokalise/error-utils';
|
|
4
3
|
import type { FastifyInstance } from 'fastify';
|
|
5
|
-
export
|
|
6
|
-
export interface ErrorReport {
|
|
7
|
-
error: NotifiableError;
|
|
8
|
-
severity?: Severity;
|
|
9
|
-
unhandled?: boolean;
|
|
10
|
-
context?: Record<string, unknown>;
|
|
11
|
-
}
|
|
12
|
-
export declare const reportErrorToBugsnag: ({ error, severity, unhandled, context, }: ErrorReport) => false | void;
|
|
4
|
+
export { reportErrorToBugsnag, bugsnagErrorReporter, ErrorReport, Severity };
|
|
13
5
|
export interface BugsnagPluginConfig {
|
|
14
6
|
bugsnag: NodeConfig;
|
|
15
7
|
isEnabled: boolean;
|
|
16
8
|
}
|
|
17
|
-
|
|
18
|
-
declare function plugin(app: FastifyInstance, opts: BugsnagPluginConfig, done: () => void): void;
|
|
9
|
+
declare function plugin(_app: FastifyInstance, opts: BugsnagPluginConfig, done: () => void): void;
|
|
19
10
|
export declare const bugsnagPlugin: typeof plugin;
|
|
20
|
-
export {};
|
|
@@ -3,20 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.bugsnagPlugin = exports.bugsnagErrorReporter = exports.reportErrorToBugsnag = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const js_1 = tslib_1.__importDefault(require("@bugsnag/js"));
|
|
6
|
+
const error_utils_1 = require("@lokalise/error-utils");
|
|
7
|
+
Object.defineProperty(exports, "bugsnagErrorReporter", { enumerable: true, get: function () { return error_utils_1.bugsnagErrorReporter; } });
|
|
8
|
+
Object.defineProperty(exports, "reportErrorToBugsnag", { enumerable: true, get: function () { return error_utils_1.reportErrorToBugsnag; } });
|
|
6
9
|
const fastify_plugin_1 = tslib_1.__importDefault(require("fastify-plugin"));
|
|
7
|
-
|
|
8
|
-
js_1.default.notify(error, (event) => {
|
|
9
|
-
event.severity = severity;
|
|
10
|
-
event.unhandled = unhandled;
|
|
11
|
-
if (context) {
|
|
12
|
-
event.addMetadata('Context', context);
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
exports.reportErrorToBugsnag = reportErrorToBugsnag;
|
|
16
|
-
exports.bugsnagErrorReporter = {
|
|
17
|
-
report: (report) => (0, exports.reportErrorToBugsnag)(report),
|
|
18
|
-
};
|
|
19
|
-
function plugin(app, opts, done) {
|
|
10
|
+
function plugin(_app, opts, done) {
|
|
20
11
|
if (opts.isEnabled) {
|
|
21
12
|
js_1.default.start(opts.bugsnag);
|
|
22
13
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bugsnagPlugin.js","sourceRoot":"","sources":["../../lib/plugins/bugsnagPlugin.ts"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"bugsnagPlugin.js","sourceRoot":"","sources":["../../lib/plugins/bugsnagPlugin.ts"],"names":[],"mappings":";;;;AAAA,6DAAiC;AAEjC,uDAK8B;AAIC,qGAR7B,kCAAoB,OAQ6B;AAA1C,qGANP,kCAAoB,OAMO;AAF7B,4EAA+B;AAS/B,SAAS,MAAM,CAAC,IAAqB,EAAE,IAAyB,EAAE,IAAgB;IAChF,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;QACnB,YAAO,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IAC7B,CAAC;IAED,IAAI,EAAE,CAAA;AACR,CAAC;AAEY,QAAA,aAAa,GAAG,IAAA,wBAAE,EAAC,MAAM,EAAE;IACtC,OAAO,EAAE,KAAK;IACd,IAAI,EAAE,gBAAgB;CACvB,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lokalise/fastify-extras",
|
|
3
|
-
"version": "17.0.
|
|
3
|
+
"version": "17.0.2",
|
|
4
4
|
"description": "Opinionated set of fastify plugins, commonly used in Lokalise",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Lokalise",
|
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@bugsnag/js": "^7.22.4",
|
|
46
|
+
"@lokalise/error-utils": "^1.0.1",
|
|
46
47
|
"@opentelemetry/api": "1.8.0",
|
|
47
48
|
"@opentelemetry/exporter-trace-otlp-grpc": "~0.49.1",
|
|
48
49
|
"@opentelemetry/instrumentation": "~0.49.1",
|