Skip to content

Commit 2491a89

Browse files
authored
[chore]: update to plugin v2 (base + sentry) (#2863)
* merge * regenerated pack lock * pack lock update * what is wrong with that pack lock * drop a line in changelog * re-generate pack lock * update pack lock
1 parent c15ef59 commit 2491a89

File tree

8 files changed

+16646
-15467
lines changed

8 files changed

+16646
-15467
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
-->
66

77
## __WORK IN PROGRESS__
8+
* (@foxriver76) updated plugin base and sentry plugin to version 2
89
* (@foxriver76) enhanced translations for the `diskSpaceIssues` notification category
910
* (@foxriver76) improved backup/restore process to work for arbitrary large installations
1011

package-lock.json

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

packages/adapter/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@
1515
"@iobroker/db-states-redis": "file:../db-states-redis",
1616
"@iobroker/js-controller-common": "file:../common",
1717
"@iobroker/js-controller-common-db": "file:../common-db",
18-
"@iobroker/plugin-base": "~1.2.1",
19-
"@iobroker/plugin-sentry": "~1.2.1",
18+
"@iobroker/plugin-base": "~2.0.1",
2019
"deep-clone": "^3.0.3",
2120
"fs-extra": "^11.1.0",
2221
"jsonwebtoken": "^9.0.0",

packages/adapter/src/lib/adapter/adapter.ts

Lines changed: 255 additions & 261 deletions
Large diffs are not rendered by default.

packages/cli/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"dependencies": {
99
"@iobroker/js-controller-common": "file:../common",
1010
"@iobroker/js-controller-common-db": "file:../common-db",
11+
"@iobroker/plugin-base": "~2.0.1",
1112
"axios": "^1.7.4",
1213
"chokidar": "^3.5.3",
1314
"debug": "^4.3.4",

packages/cli/src/lib/setup/dbConnection.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -413,9 +413,7 @@ function initializePlugins(config: Record<string, any>): Promise<void> {
413413
pluginHandler.addPlugins(config.plugins, tools.getControllerDir()); // ... plugins from iobroker.json
414414
pluginHandler.setDatabaseForPlugins(objects, states);
415415

416-
return new Promise(resolve => {
417-
pluginHandler.initPlugins(ioPackage, () => resolve());
418-
});
416+
return pluginHandler.initPlugins(ioPackage);
419417
}
420418

421419
/**

packages/controller/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
"@iobroker/js-controller-cli": "file:../cli",
2121
"@iobroker/js-controller-common": "file:../common",
2222
"@iobroker/js-controller-common-db": "file:../common-db",
23-
"@iobroker/plugin-base": "~1.2.1",
24-
"@iobroker/plugin-sentry": "~1.2.1",
23+
"@iobroker/plugin-base": "~2.0.1",
24+
"@iobroker/plugin-sentry": "~2.0.4",
2525
"axios": "^1.7.4",
2626
"cron-parser": "^4.9.0",
2727
"debug": "^4.3.4",

packages/controller/src/main.ts

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import {
3939
SYSTEM_REPOSITORIES_ID
4040
} from '@iobroker/js-controller-common-db/constants';
4141
import { PluginHandler } from '@iobroker/plugin-base';
42+
import type SentryPlugin from '@iobroker/plugin-sentry';
4243
import { BlocklistManager } from '@/lib/blocklistManager.js';
4344
import type { Client as ObjectsClient } from '@iobroker/db-objects-redis';
4445
import type { Client as StatesClient } from '@iobroker/db-states-redis';
@@ -616,8 +617,8 @@ function createStates(onConnect: () => void): void {
616617
}
617618
if (pluginHandler.isPluginActive(pluginName) !== state.val) {
618619
if (state.val) {
619-
if (!pluginHandler.isPluginInstanciated(pluginName)) {
620-
pluginHandler.instanciatePlugin(
620+
if (!pluginHandler.isPluginInstantiated(pluginName)) {
621+
pluginHandler.instantiatePlugin(
621622
pluginName,
622623
pluginHandler.getPluginConfig(pluginName)!,
623624
controllerDir
@@ -712,16 +713,15 @@ async function initializeController(): Promise<void> {
712713
connected = true;
713714
if (!isStopping) {
714715
pluginHandler.setDatabaseForPlugins(objects, states);
715-
pluginHandler.initPlugins(ioPackage, async () => {
716-
states!.subscribe(`${hostObjectPrefix}.plugins.*`);
717-
718-
// Do not start if we're still stopping the instances
719-
await checkHost();
720-
startMultihost(config);
721-
setMeta();
722-
started = true;
723-
getInstances();
724-
});
716+
await pluginHandler.initPlugins(ioPackage);
717+
states!.subscribe(`${hostObjectPrefix}.plugins.*`);
718+
719+
// Do not start if we're still stopping the instances
720+
await checkHost();
721+
startMultihost(config);
722+
setMeta();
723+
started = true;
724+
getInstances();
725725
}
726726
} else {
727727
connected = true;
@@ -3015,8 +3015,9 @@ async function processMessage(msg: ioBroker.SendableMessage): Promise<null | voi
30153015
const level: string = msg.message.level;
30163016
const extraInfo: Record<string, unknown> = msg.message.extraInfo;
30173017

3018-
// @ts-expect-error Plugin is not well typed and SentryPlugin has no types at all currently
3019-
const sentryObj = pluginHandler.getPluginInstance('sentry')?.getSentryObject();
3018+
const sentryObj = (
3019+
pluginHandler.getPluginInstance('sentry') as InstanceType<typeof SentryPlugin> | null
3020+
)?.getSentryObject();
30203021

30213022
if (!sentryObj) {
30223023
logger.debug(`${hostLogPrefix} Do not send message "${message}" to Sentry, because it is disabled`);

0 commit comments

Comments
 (0)