Skip to content

Commit f15de95

Browse files
committed
chore: release v2.0.4
* (foxriver76) work with plugin base v2 * (foxriver76) ported to TypeScript to provide improved type support **Breaking Changes**: Due to the port to Plugin Base v2, `init` now returns a promise instead of accepting a callback parameter, also the export has changed to a named export
1 parent 4606b21 commit f15de95

File tree

7 files changed

+21
-35
lines changed

7 files changed

+21
-35
lines changed

README.md

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -147,16 +147,7 @@ This should cause the adapter to crash and the exception to be shown in the sent
147147
-->
148148

149149
## Changelog
150-
### 2.0.3 (2024-06-01)
151-
* (foxriver76) provide default and named export
152-
153-
### 2.0.2 (2024-06-01)
154-
* (foxriver76) changed export to named export
155-
156-
### 2.0.1 (2024-06-01)
157-
* (foxriver76) fixed `types` and `main` file export
158-
159-
### 2.0.0 (2024-06-01)
150+
### 2.0.4 (2024-06-01)
160151
* (foxriver76) work with plugin base v2
161152
* (foxriver76) ported to TypeScript to provide improved type support
162153

build/index.d.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { PluginBase } from '@iobroker/plugin-base';
2-
export default class SentryPlugin extends PluginBase {
2+
declare class SentryPlugin extends PluginBase {
33
/** The Sentry instance */
44
Sentry: typeof import('@sentry/node');
55
/** If plugin is enabled after all checks */
@@ -17,5 +17,4 @@ export default class SentryPlugin extends PluginBase {
1717
*/
1818
getSentryObject(): typeof this.Sentry;
1919
}
20-
/** Type for a Sentry Instance */
21-
export type SentryInstance = InstanceType<typeof SentryPlugin>;
20+
export = SentryPlugin;

build/index.js

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
11
"use strict";
2-
Object.defineProperty(exports, "__esModule", { value: true });
32
const plugin_base_1 = require("@iobroker/plugin-base");
43
class SentryPlugin extends plugin_base_1.PluginBase {
5-
constructor() {
6-
super(...arguments);
7-
/** If plugin is enabled after all checks */
8-
this.reallyEnabled = false;
9-
}
4+
/** The Sentry instance */
5+
Sentry;
6+
/** If plugin is enabled after all checks */
7+
reallyEnabled = false;
108
/**
119
* Register and initialize Sentry
1210
*
1311
* @param pluginConfig plugin configuration from config files
1412
*/
1513
async init(pluginConfig) {
16-
var _a, _b;
1714
if (!pluginConfig.enabled) {
1815
this.log.info('Sentry Plugin disabled by user');
1916
throw new Error('Sentry Plugin disabled by user');
@@ -39,11 +36,11 @@ class SentryPlugin extends plugin_base_1.PluginBase {
3936
try {
4037
hostObj = (await this.getObject(`system.host.${this.parentIoPackage.common.host}`));
4138
}
42-
catch (_c) {
39+
catch {
4340
// ignore
4441
}
4542
// @ts-expect-error comes with https://github.com/ioBroker/ioBroker.js-controller/pull/2738
46-
if ((_a = hostObj === null || hostObj === void 0 ? void 0 : hostObj.common) === null || _a === void 0 ? void 0 : _a.disableDataReporting) {
43+
if (hostObj?.common?.disableDataReporting) {
4744
this.log.info('Sentry Plugin disabled for this process because data reporting is disabled on host');
4845
throw new Error('Sentry Plugin disabled for this process because data reporting is disabled on host');
4946
}
@@ -61,11 +58,11 @@ class SentryPlugin extends plugin_base_1.PluginBase {
6158
try {
6259
hostObj = (await this.getObject(hostObjName));
6360
}
64-
catch (_d) {
61+
catch {
6562
// ignore
6663
}
6764
// @ts-expect-error comes with https://github.com/ioBroker/ioBroker.js-controller/pull/2738
68-
if ((_b = hostObj === null || hostObj === void 0 ? void 0 : hostObj.common) === null || _b === void 0 ? void 0 : _b.disableDataReporting) {
65+
if (hostObj?.common?.disableDataReporting) {
6966
this.log.info('Sentry Plugin disabled for this process because data reporting is disabled on host');
7067
throw new Error('Sentry Plugin disabled for this process because data reporting is disabled on host');
7168
}
@@ -75,7 +72,7 @@ class SentryPlugin extends plugin_base_1.PluginBase {
7572
try {
7673
systemConfig = (await this.getObject('system.config'));
7774
}
78-
catch (_e) {
75+
catch {
7976
// ignore
8077
}
8178
if (!systemConfig || !systemConfig.common || systemConfig.common.diag === 'none') {
@@ -86,7 +83,7 @@ class SentryPlugin extends plugin_base_1.PluginBase {
8683
try {
8784
uuidObj = (await this.getObject('system.meta.uuid'));
8885
}
89-
catch (_f) {
86+
catch {
9087
// ignore
9188
}
9289
const uuid = uuidObj && uuidObj.native ? uuidObj.native.uuid : null;
@@ -140,7 +137,7 @@ class SentryPlugin extends plugin_base_1.PluginBase {
140137
try {
141138
scope.setTag('plugin-sentry', require('./package.json').version);
142139
}
143-
catch (_a) {
140+
catch {
144141
// ignore
145142
}
146143
if (this.iobrokerConfig) {
@@ -232,4 +229,4 @@ class SentryPlugin extends plugin_base_1.PluginBase {
232229
return this.Sentry;
233230
}
234231
}
235-
exports.default = SentryPlugin;
232+
module.exports = SentryPlugin;

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@iobroker/plugin-sentry",
3-
"version": "2.0.3",
3+
"version": "2.0.4",
44
"description": "Sentry module for plugins for js-controller and adapters",
55
"author": {
66
"name": "Ingo Fischer",

src/index.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { PluginBase } from '@iobroker/plugin-base';
22

3-
export default class SentryPlugin extends PluginBase {
3+
class SentryPlugin extends PluginBase {
44
/** The Sentry instance */
55
Sentry: typeof import('@sentry/node');
66
/** If plugin is enabled after all checks */
@@ -273,5 +273,4 @@ export default class SentryPlugin extends PluginBase {
273273
}
274274
}
275275

276-
/** Type for a Sentry Instance */
277-
export type SentryInstance = InstanceType<typeof SentryPlugin>;
276+
export = SentryPlugin;

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"compilerOptions": {
3-
"target": "es2018",
3+
"target": "ESNext",
44
"moduleResolution": "node",
55
"module": "CommonJS",
66
"outDir": "./build/",

0 commit comments

Comments
 (0)