diff --git a/build/controls/Unknown.js b/build/controls/Unknown.js index 83542f4a..9032bed7 100644 --- a/build/controls/Unknown.js +++ b/build/controls/Unknown.js @@ -1,7 +1,6 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Unknown = void 0; -const SentryNode = require("@sentry/node"); const control_base_1 = require("./control-base"); /** * This class is used if the control has an unknown type. @@ -22,7 +21,7 @@ class Unknown extends control_base_1.ControlBase { const sentry = this.adapter.getSentry(); sentry === null || sentry === void 0 ? void 0 : sentry.withScope((scope) => { scope.setExtra('control', JSON.stringify(control, null, 2)); - sentry.captureMessage(msg, SentryNode.Severity.Warning); + sentry.captureMessage(msg, 'warning'); }); } } diff --git a/build/main.js b/build/main.js index 05f0f2b2..ae04cbea 100644 --- a/build/main.js +++ b/build/main.js @@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.Loxone = void 0; const utils = require("@iobroker/adapter-core"); -const SentryNode = require("@sentry/node"); const axios_1 = require("axios"); const LxCommunicator = require("lxcommunicator"); const uuid_1 = require("uuid"); @@ -257,7 +256,7 @@ class Loxone extends utils.Adapter { const sentry = this.getSentry(); sentry === null || sentry === void 0 ? void 0 : sentry.withScope((scope) => { scope.setExtra('state', state); - sentry.captureMessage(msg, SentryNode.Severity.Warning); + sentry.captureMessage(msg, 'warning'); }); } } @@ -349,7 +348,7 @@ class Loxone extends utils.Adapter { type: 'debug', category: 'started', message: `Structure file added to event ${attachmentEventId}`, - level: SentryNode.Severity.Info, + level: 'info', }); } return event; @@ -359,8 +358,8 @@ class Loxone extends utils.Adapter { return event; } attachmentEventId = event.event_id; - const { host, path, projectId, port, protocol, user } = dsn; - const endpoint = `${protocol}://${host}${port !== '' ? `:${port}` : ''}${path !== '' ? `/${path}` : ''}/api/${projectId}/events/${attachmentEventId}/attachments/?sentry_key=${user}&sentry_version=7&sentry_client=custom-javascript`; + const { host, path, projectId, port, protocol, publicKey } = dsn; + const endpoint = `${protocol}://${host}${port !== '' ? `:${port}` : ''}${path !== '' ? `/${path}` : ''}/api/${projectId}/events/${attachmentEventId}/attachments/?sentry_key=${publicKey}&sentry_version=7&sentry_client=custom-javascript`; const form = new FormData(); form.append('att', JSON.stringify(data, null, 2), { contentType: 'application/json', @@ -889,7 +888,7 @@ class Loxone extends utils.Adapter { reportError(message) { var _a; this.log.error(message); - (_a = this.getSentry()) === null || _a === void 0 ? void 0 : _a.captureMessage(message, SentryNode.Severity.Error); + (_a = this.getSentry()) === null || _a === void 0 ? void 0 : _a.captureMessage(message, 'error'); } } exports.Loxone = Loxone; diff --git a/src/controls/Unknown.ts b/src/controls/Unknown.ts index 5affe161..36407d70 100644 --- a/src/controls/Unknown.ts +++ b/src/controls/Unknown.ts @@ -1,4 +1,3 @@ -import * as SentryNode from '@sentry/node'; import { Control } from '../structure-file'; import { ControlBase, ControlType } from './control-base'; @@ -20,7 +19,7 @@ export class Unknown extends ControlBase { const sentry = this.adapter.getSentry(); sentry?.withScope((scope) => { scope.setExtra('control', JSON.stringify(control, null, 2)); - sentry.captureMessage(msg, SentryNode.Severity.Warning); + sentry.captureMessage(msg, 'warning'); }); } } diff --git a/src/main.ts b/src/main.ts index 0cf21027..e19e3768 100644 --- a/src/main.ts +++ b/src/main.ts @@ -326,7 +326,7 @@ export class Loxone extends utils.Adapter { const sentry = this.getSentry(); sentry?.withScope((scope) => { scope.setExtra('state', state); - sentry.captureMessage(msg, SentryNode.Severity.Warning); + sentry.captureMessage(msg, 'warning'); }); } } else if (!this.lxConnected) { @@ -428,7 +428,7 @@ export class Loxone extends utils.Adapter { type: 'debug', category: 'started', message: `Structure file added to event ${attachmentEventId}`, - level: SentryNode.Severity.Info, + level: 'info', }); } return event; @@ -440,10 +440,10 @@ export class Loxone extends utils.Adapter { attachmentEventId = event.event_id; - const { host, path, projectId, port, protocol, user } = dsn; + const { host, path, projectId, port, protocol, publicKey } = dsn; const endpoint = `${protocol}://${host}${port !== '' ? `:${port}` : ''}${ path !== '' ? `/${path}` : '' - }/api/${projectId}/events/${attachmentEventId}/attachments/?sentry_key=${user}&sentry_version=7&sentry_client=custom-javascript`; + }/api/${projectId}/events/${attachmentEventId}/attachments/?sentry_key=${publicKey}&sentry_version=7&sentry_client=custom-javascript`; const form = new FormData(); form.append('att', JSON.stringify(data, null, 2), { @@ -1041,7 +1041,7 @@ export class Loxone extends utils.Adapter { public reportError(message: string): void { this.log.error(message); - this.getSentry()?.captureMessage(message, SentryNode.Severity.Error); + this.getSentry()?.captureMessage(message, 'error'); } }