🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

@iobroker/plugin-base

Package Overview
Dependencies
Maintainers
5
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@iobroker/plugin-base - npm Package Compare versions

Comparing version

to
1.2.1

.github/auto-merge.yml

17

lib/PluginBase.d.ts

@@ -17,3 +17,3 @@ /// <reference path="types.d.ts" />

pluginNamespace: string;
log: import("./NamespaceLogger");
log: NamespaceLogger;
iobrokerConfig: Record<string, any>;

@@ -55,3 +55,3 @@ parentPackage: Record<string, any>;

*/
getStateAsync(id: string): Promise<ioBroker.State>;
getStateAsync(id: string): ReturnType<ioBroker.Adapter["getStateAsync"]>;
/**

@@ -72,3 +72,3 @@ * Set a State in State DB

*/
setStateAsync(id: string, state: Partial<ioBroker.State>): Promise<ioBroker.State>;
setStateAsync(id: string, state: Partial<ioBroker.State>): Promise<ioBroker.State | null | undefined>;
/**

@@ -87,3 +87,3 @@ * Get an Object from Objects DB

*/
getObjectAsync(id: string): Promise<ioBroker.Object>;
getObjectAsync(id: string): Promise<ioBroker.Object | null | undefined>;
/**

@@ -104,5 +104,3 @@ * Set an Object in Objects DB

*/
setObjectAsync(id: string, obj: ioBroker.Object): Promise<{
id: string;
}>;
setObjectAsync(id: string, obj: ioBroker.Object): ReturnType<ioBroker.Adapter["setObjectAsync"]>;
/**

@@ -123,5 +121,3 @@ * Set/Extend an Object in Objects DB

*/
extendObjectAsync(id: string, obj: any): Promise<{
id: string;
}>;
extendObjectAsync(id: string, obj: object): ReturnType<ioBroker.Adapter["extendObjectAsync"]>;
/****************************************

@@ -164,1 +160,2 @@ * Internal methods!!

}
import NamespaceLogger = require("./NamespaceLogger");

@@ -238,23 +238,23 @@ /// <reference path="./types.d.ts" />

await this.extendObjectAsync(this.pluginNamespace, {
type: 'folder',
common: {
name: 'Plugin States',
},
native: {}
});
await this.extendObjectAsync(this.pluginNamespace + '.enabled', {
type: 'state',
common: {
name: 'Plugin - enabled',
type: 'boolean',
read: true,
write: true,
role: 'value'
},
native: {}
});
let pluginEnabledState;
try {
await this.extendObjectAsync(this.pluginNamespace, {
type: 'folder',
common: {
name: 'Plugin States',
},
native: {}
});
await this.extendObjectAsync(this.pluginNamespace + '.enabled', {
type: 'state',
common: {
name: 'Plugin - enabled',
type: 'boolean',
read: true,
write: true,
role: 'value'
},
native: {}
});
pluginEnabledState = await this.getStateAsync(this.pluginNamespace + '.enabled');

@@ -300,6 +300,12 @@ } catch {

this.init(pluginConfig, async (err, success) => {
if (!err && success) {
await this.setActive(true);
} else {
await this.setActive(false);
try {
if (!err && success) {
await this.setActive(true);
} else {
await this.setActive(false);
}
} catch (ex) {
if (!err) {
err = ex
}
}

@@ -310,3 +316,7 @@ callback(err, success);

this.log.debug('Do not initialize Plugin (enabled=' + activate + ')');
await this.setActive(false);
try {
await this.setActive(false);
} catch (ex) {
return callback(ex, false);
}
callback(null, false);

@@ -313,0 +323,0 @@ }

@@ -14,3 +14,3 @@ /// <reference path="types.d.ts" />

settings: import("@iobroker/plugin-base/types").PluginHandlerSettings;
log: import("./NamespaceLogger");
log: NamespaceLogger;
/** @type {Record<string, {config: Record<string, any>, instance?: import("./PluginBase") | null}>} */

@@ -83,3 +83,3 @@ plugins: Record<string, {

*/
getPluginInstance(name: string): import("./PluginBase");
getPluginInstance(name: string): import("./PluginBase") | null;
/**

@@ -91,3 +91,3 @@ * Return plugin configuration

*/
getPluginConfig(name: string): Record<string, any>;
getPluginConfig(name: string): Record<string, any> | null;
/**

@@ -115,1 +115,2 @@ * Return if plugin exists

}
import NamespaceLogger = require("./NamespaceLogger");

@@ -0,0 +0,0 @@ declare module "@iobroker/plugin-base/types" {

{
"name": "@iobroker/plugin-base",
"version": "1.2.0",
"description": "Base module for plugins for js-controller and adapters",
"author": {
"name": "Ingo Fischer",
"email": "iobroker@fischer-ka.de"
},
"contributors": [
"Al Calzone <d.griesel@gmx.net>"
],
"main": "index.js",
"types": "index.d.ts",
"scripts": {
"prebuild": "rimraf \"lib/!(types).d.ts\"",
"build": "tsc -p tsconfig.build.json",
"prepublishOnly": "npm run build"
},
"repository": {
"type": "git",
"url": "git+https://github.com/ioBroker/plugin-base.git"
},
"keywords": [
"iobroker",
"adapter",
"plugins"
],
"license": "MIT",
"bugs": {
"url": "https://github.com/ioBroker/plugin-base/issues"
},
"homepage": "https://github.com/ioBroker/plugin-base#readme",
"dependencies": {},
"devDependencies": {
"@types/iobroker": "^3.0.6",
"@types/node": "^13.13.5",
"eslint": "^7.0.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-prettier": "^3.1.3",
"rimraf": "^3.0.2",
"typescript": "^3.8.3"
}
"name": "@iobroker/plugin-base",
"version": "1.2.1",
"description": "Base module for plugins for js-controller and adapters",
"author": {
"name": "Ingo Fischer",
"email": "iobroker@fischer-ka.de"
},
"contributors": [
"Al Calzone <d.griesel@gmx.net>"
],
"main": "index.js",
"types": "index.d.ts",
"scripts": {
"prebuild": "rimraf \"lib/!(types).d.ts\"",
"build": "tsc -p tsconfig.build.json",
"prepublishOnly": "npm run build",
"release": "release-script"
},
"repository": {
"type": "git",
"url": "git+https://github.com/ioBroker/plugin-base.git"
},
"keywords": [
"iobroker",
"adapter",
"plugins"
],
"license": "MIT",
"bugs": {
"url": "https://github.com/ioBroker/plugin-base/issues"
},
"homepage": "https://github.com/ioBroker/plugin-base#readme",
"dependencies": {},
"devDependencies": {
"@alcalzone/release-script": "^1.8.3",
"@types/iobroker": "^3.2.8",
"@types/node": "^14.14.22",
"eslint": "^7.18.0",
"eslint-config-prettier": "^7.2.0",
"eslint-plugin-prettier": "^3.3.1",
"rimraf": "^3.0.2",
"typescript": "^4.1.3"
}
}

@@ -91,2 +91,5 @@ # plugins-base

### 1.2.1 (2021-01-24)
* (Apollon77) Add error handling in some places when setting active Status
### 1.2.0 (2020-05-09)

@@ -93,0 +96,0 @@ * (Apollon77) Add async methods for Objects and States

@@ -67,3 +67,4 @@ {

/* Advanced Options */
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
"forceConsistentCasingInFileNames": true, /* Disallow inconsistently-cased references to the same file. */
"newLine": "lf"
},

@@ -70,0 +71,0 @@ "include": [