Socket
Socket
Sign inDemoInstall

@iobroker/adapter-core

Package Overview
Dependencies
Maintainers
6
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@iobroker/adapter-core - npm Package Compare versions

Comparing version 2.6.4 to 2.6.5

7

build/controllerTools.d.ts

@@ -0,4 +1,11 @@

export declare let controllerCommonModulesInternal: any;
/** The collection of utility functions in JS-Controller, formerly `lib/tools.js` */
export declare const controllerToolsInternal: any;
/**
* Resolve a module that is either exported by @iobroker/js-controller-common (new controllers) or located in in the controller's `lib` directory (old controllers).
* @param name - The filename of the module to resolve
* @param exportName - The name under which the module may be exported. Defaults to `name`.
*/
export declare function resolveNamedModule(name: string, exportName?: string): any;
/**
* Converts a pattern to match object IDs into a RegEx string that can be used in `new RegExp(...)`

@@ -5,0 +12,0 @@ * @param pattern The pattern to convert

21

build/controllerTools.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.commonTools = exports.controllerToolsInternal = void 0;
exports.commonTools = exports.resolveNamedModule = exports.controllerToolsInternal = exports.controllerCommonModulesInternal = void 0;
const path = require("path");
const helpers_1 = require("./helpers");
const utils = require("./utils");
/* eslint-disable @typescript-eslint/no-var-requires */
function resolveControllerTools() {

@@ -13,3 +12,4 @@ // Attempt 1: Resolve @iobroker/js-controller-common from here - JS-Controller 4.1+

try {
const { tools } = require(importPath);
exports.controllerCommonModulesInternal = require(importPath);
const { tools } = exports.controllerCommonModulesInternal;
if (tools)

@@ -26,3 +26,4 @@ return tools;

try {
const { tools } = require(importPath);
exports.controllerCommonModulesInternal = require(importPath);
const { tools } = exports.controllerCommonModulesInternal;
if (tools)

@@ -52,6 +53,11 @@ return tools;

// Export a subset of the utilties in controllerTools
function resolveNamedModule(name) {
/**
* Resolve a module that is either exported by @iobroker/js-controller-common (new controllers) or located in in the controller's `lib` directory (old controllers).
* @param name - The filename of the module to resolve
* @param exportName - The name under which the module may be exported. Defaults to `name`.
*/
function resolveNamedModule(name, exportName = name) {
// The requested module might be moved to @iobroker/js-controller-common and exported from there
if (name in exports.controllerToolsInternal)
return exports.controllerToolsInternal[name];
if (exports.controllerCommonModulesInternal === null || exports.controllerCommonModulesInternal === void 0 ? void 0 : exports.controllerCommonModulesInternal[exportName])
return exports.controllerCommonModulesInternal[exportName];
// Otherwise it was not moved yet, or we're dealing with JS-Controller <= 4.0

@@ -83,2 +89,3 @@ // Attempt 1: JS-Controller 4.1+

}
exports.resolveNamedModule = resolveNamedModule;
// TODO: Import types from @iobroker/js-controller-common and iobroker.js-controller

@@ -85,0 +92,0 @@ /**

/// <reference types="iobroker" />
import { ExitCodes } from "./exitCodes";
export { commonTools } from "./controllerTools";

@@ -13,39 +14,2 @@ export * from "./utils";

export declare function getAbsoluteInstanceDataDir(adapterObject: ioBroker.Adapter): string;
export declare const EXIT_CODES: Readonly<{
NO_ERROR: number;
JS_CONTROLLER_STOPPED: number;
INVALID_ADAPTER_CONFIG: number;
NO_ADAPTER_CONFIG_FOUND: number;
INVALID_CONFIG_OBJECT: number;
INVALID_ADAPTER_ID: number;
UNCAUGHT_EXCEPTION: number;
ADAPTER_ALREADY_RUNNING: number;
INSTANCE_IS_DISABLED: number;
CANNOT_GZIP_DIRECTORY: number;
CANNOT_FIND_ADAPTER_DIR: number;
ADAPTER_REQUESTED_TERMINATION: number;
UNKNOWN_PACKET_NAME: number;
ADAPTER_REQUESTED_REBUILD: number;
CANNOT_READ_INSTANCES: number;
NO_MULTIPLE_INSTANCES_ALLOWED: number;
NO_MULTIPLE_INSTANCES_ALLOWED_ON_HOST: number;
NO_CONNECTION_TO_OBJ_DB: number;
NO_CONNECTION_TO_STATES_DB: number;
INSTANCE_ALREADY_EXISTS: number;
CANNOT_INSTALL_NPM_PACKET: number;
CANNOT_EXTRACT_FROM_ZIP: number;
INVALID_IO_PACKAGE_JSON: number;
CANNOT_COPY_DIR: number;
MISSING_ADAPTER_FILES: number;
INVALID_NPM_VERSION: number;
INVALID_NODE_VERSION: number;
INVALID_OS: number;
INVALID_DEPENDENCY_VERSION: number;
INVALID_ARGUMENTS: number;
INVALID_PASSWORD: number;
MISSING_CONFIG_JSON: number;
CANNOT_DELETE_NON_DELETABLE: number;
CANNOT_GET_STATES: number;
CANNOT_GET_REPO_LIST: number;
START_IMMEDIATELY_AFTER_STOP: number;
}>;
export declare const EXIT_CODES: ExitCodes;

@@ -42,19 +42,2 @@ "use strict";

// TODO: Expose some system utilities here, e.g. for installing npm modules (GH#1)
function resolveExitCodes() {
if ("EXIT_CODES" in controllerTools_1.controllerToolsInternal)
return controllerTools_1.controllerToolsInternal.EXIT_CODES;
// We're dealing with JS-Controller <= 4.0
const importPath = path.join(utils.controllerDir, "lib/exitCodes");
try {
// This was a default export prior to the TS migration
const EXIT_CODES = require(importPath);
if (EXIT_CODES)
return EXIT_CODES;
}
catch (_a) {
// did not work, continue
}
throw new Error("Cannot resolve EXIT_CODES");
return process.exit(10);
}
exports.EXIT_CODES = Object.freeze(Object.assign({}, resolveExitCodes()));
exports.EXIT_CODES = Object.freeze(Object.assign({}, (0, controllerTools_1.resolveNamedModule)("exitCodes", "EXIT_CODES")));
{
"name": "@iobroker/adapter-core",
"version": "2.6.4",
"version": "2.6.5",
"description": "Core module to be used in ioBroker adapters. Acts as the bridge to js-controller.",

@@ -48,3 +48,3 @@ "author": {

"@typescript-eslint/eslint-plugin": "^5.37.0",
"@typescript-eslint/parser": "^5.31.0",
"@typescript-eslint/parser": "^5.37.0",
"chai": "^4.3.6",

@@ -63,3 +63,3 @@ "chai-as-promised": "^7.1.1",

"ts-node": "^10.9.1",
"typescript": "^4.8.2"
"typescript": "^4.8.3"
},

@@ -66,0 +66,0 @@ "dependencies": {

@@ -108,3 +108,3 @@ # Adapter-Core

-->
### 2.6.4 (2022-09-13)
### 2.6.5 (2022-09-13)

@@ -111,0 +111,0 @@ - (AlCalzone) Expose more JS-Controller internals under the `commonTools` export

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc