@iobroker/adapter-core
Advanced tools
Comparing version 3.1.4 to 3.1.5
@@ -38,13 +38,13 @@ "use strict"; | ||
const import_meta = {}; | ||
var require2 = (0, import_node_module.createRequire)(import_meta.url || "file://" + __filename); | ||
var controllerCommonModulesInternal; | ||
const require2 = (0, import_node_module.createRequire)(import_meta.url || "file://" + __filename); | ||
let controllerCommonModulesInternal; | ||
function resolveControllerTools() { | ||
var importPath = (0, import_helpers.tryResolvePackage)(["@iobroker/js-controller-common"]); | ||
let importPath = (0, import_helpers.tryResolvePackage)(["@iobroker/js-controller-common"]); | ||
if (importPath) { | ||
try { | ||
controllerCommonModulesInternal = require2(importPath); | ||
var tools = controllerCommonModulesInternal.tools; | ||
const { tools } = controllerCommonModulesInternal; | ||
if (tools) | ||
return tools; | ||
} catch (_a) { | ||
} catch { | ||
} | ||
@@ -56,6 +56,6 @@ } | ||
controllerCommonModulesInternal = require2(importPath); | ||
var tools = controllerCommonModulesInternal.tools; | ||
const { tools } = controllerCommonModulesInternal; | ||
if (tools) | ||
return tools; | ||
} catch (_b) { | ||
} catch { | ||
} | ||
@@ -65,17 +65,14 @@ } | ||
try { | ||
var tools = require2(path.join(importPath, "tools")); | ||
const tools = require2(path.join(importPath, "tools")); | ||
if (tools) | ||
return tools; | ||
} catch (_c) { | ||
} catch { | ||
} | ||
throw new Error("Cannot resolve tools module"); | ||
} | ||
var controllerToolsInternal = resolveControllerTools(); | ||
function resolveNamedModule(name, exportName) { | ||
if (exportName === void 0) { | ||
exportName = name; | ||
} | ||
if (controllerCommonModulesInternal === null || controllerCommonModulesInternal === void 0 ? void 0 : controllerCommonModulesInternal[exportName]) | ||
const controllerToolsInternal = resolveControllerTools(); | ||
function resolveNamedModule(name, exportName = name) { | ||
if (controllerCommonModulesInternal == null ? void 0 : controllerCommonModulesInternal[exportName]) | ||
return controllerCommonModulesInternal[exportName]; | ||
var importPaths = [ | ||
const importPaths = [ | ||
path.join(utils.controllerDir, "build/cjs/lib", name), | ||
@@ -85,12 +82,11 @@ path.join(utils.controllerDir, "build/lib", name), | ||
]; | ||
for (var _i = 0, importPaths_1 = importPaths; _i < importPaths_1.length; _i++) { | ||
var importPath = importPaths_1[_i]; | ||
for (const importPath of importPaths) { | ||
try { | ||
var module_1 = require2(importPath); | ||
if (module_1) | ||
return module_1; | ||
} catch (_a) { | ||
const module2 = require2(importPath); | ||
if (module2) | ||
return module2; | ||
} catch { | ||
} | ||
} | ||
throw new Error("Cannot resolve JS-Controller module ".concat(name, ".js")); | ||
throw new Error(`Cannot resolve JS-Controller module ${name}.js`); | ||
} | ||
@@ -121,3 +117,3 @@ function pattern2RegEx(pattern) { | ||
} | ||
var commonTools = { | ||
const commonTools = { | ||
pattern2RegEx, | ||
@@ -124,0 +120,0 @@ getAdapterDir, |
@@ -36,27 +36,22 @@ "use strict"; | ||
const import_meta = {}; | ||
var require2 = (0, import_node_module.createRequire)(import_meta.url || "file://" + __filename); | ||
var thisDir = url.fileURLToPath( | ||
const require2 = (0, import_node_module.createRequire)(import_meta.url || "file://" + __filename); | ||
const thisDir = url.fileURLToPath( | ||
new URL(".", import_meta.url || "file://" + __filename) | ||
); | ||
function tryResolvePackage(possiblePaths, lookupPaths) { | ||
for (var _i = 0, possiblePaths_1 = possiblePaths; _i < possiblePaths_1.length; _i++) { | ||
var pkg = possiblePaths_1[_i]; | ||
for (const pkg of possiblePaths) { | ||
try { | ||
var possiblePath = require2.resolve("".concat(pkg, "/package.json"), (lookupPaths === null || lookupPaths === void 0 ? void 0 : lookupPaths.length) ? { paths: lookupPaths } : void 0); | ||
const possiblePath = require2.resolve(`${pkg}/package.json`, (lookupPaths == null ? void 0 : lookupPaths.length) ? { paths: lookupPaths } : void 0); | ||
if (fs.existsSync(possiblePath)) { | ||
return path.dirname(possiblePath); | ||
} | ||
} catch (_a) { | ||
} catch { | ||
} | ||
} | ||
} | ||
function scanForPackage(possiblePaths, startDir) { | ||
if (startDir === void 0) { | ||
startDir = thisDir; | ||
} | ||
var curDir = path.join(startDir, "../node_modules"); | ||
function scanForPackage(possiblePaths, startDir = thisDir) { | ||
let curDir = path.join(startDir, "../node_modules"); | ||
while (true) { | ||
for (var _i = 0, possiblePaths_2 = possiblePaths; _i < possiblePaths_2.length; _i++) { | ||
var pkg = possiblePaths_2[_i]; | ||
var possiblePath = path.join(curDir, pkg, "package.json"); | ||
for (const pkg of possiblePaths) { | ||
const possiblePath = path.join(curDir, pkg, "package.json"); | ||
try { | ||
@@ -66,6 +61,6 @@ if (fs.existsSync(possiblePath) && JSON.parse(fs.readFileSync(possiblePath, "utf8")).name === pkg.toLowerCase()) { | ||
} | ||
} catch (_a) { | ||
} catch { | ||
} | ||
} | ||
var parentDir = path.dirname(curDir); | ||
const parentDir = path.dirname(curDir); | ||
if (parentDir === curDir) { | ||
@@ -72,0 +67,0 @@ break; |
@@ -40,14 +40,2 @@ "use strict"; | ||
__reExport(esm_exports, require("./utils.js"), module.exports); | ||
var __assign = function() { | ||
__assign = Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) | ||
if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
function getAbsoluteDefaultDataDir() { | ||
@@ -59,3 +47,5 @@ return path.join(utils.controllerDir, import_controllerTools.controllerToolsInternal.getDefaultDataDir()); | ||
} | ||
var EXIT_CODES = Object.freeze(__assign({}, (0, import_controllerTools.resolveNamedModule)("exitCodes", "EXIT_CODES"))); | ||
const EXIT_CODES = Object.freeze({ | ||
...(0, import_controllerTools.resolveNamedModule)("exitCodes", "EXIT_CODES") | ||
}); | ||
// Annotate the CommonJS export names for ESM import in node: | ||
@@ -62,0 +52,0 @@ 0 && (module.exports = { |
@@ -39,6 +39,6 @@ "use strict"; | ||
var _a; | ||
var require2 = (0, import_node_module.createRequire)(import_meta.url || "file://" + __filename); | ||
const require2 = (0, import_node_module.createRequire)(import_meta.url || "file://" + __filename); | ||
function getControllerDir(isInstall) { | ||
var possibilities = ["iobroker.js-controller", "ioBroker.js-controller"]; | ||
var controllerDir2 = (0, import_helpers.tryResolvePackage)(possibilities); | ||
const possibilities = ["iobroker.js-controller", "ioBroker.js-controller"]; | ||
let controllerDir2 = (0, import_helpers.tryResolvePackage)(possibilities); | ||
if (controllerDir2) | ||
@@ -56,11 +56,11 @@ return controllerDir2; | ||
} | ||
var controllerDir = getControllerDir(!!((_a = process === null || process === void 0 ? void 0 : process.argv) === null || _a === void 0 ? void 0 : _a.includes("--install"))); | ||
const controllerDir = getControllerDir(!!((_a = process == null ? void 0 : process.argv) == null ? void 0 : _a.includes("--install"))); | ||
function resolveAdapterConstructor() { | ||
var adapterPath = (0, import_helpers.tryResolvePackage)(["@iobroker/js-controller-adapter"]); | ||
let adapterPath = (0, import_helpers.tryResolvePackage)(["@iobroker/js-controller-adapter"]); | ||
if (adapterPath) { | ||
try { | ||
var Adapter_1 = require2(adapterPath).Adapter; | ||
if (Adapter_1) | ||
return Adapter_1; | ||
} catch (_a2) { | ||
const { Adapter: Adapter2 } = require2(adapterPath); | ||
if (Adapter2) | ||
return Adapter2; | ||
} catch { | ||
} | ||
@@ -71,6 +71,6 @@ } | ||
try { | ||
var Adapter_2 = require2(adapterPath).Adapter; | ||
if (Adapter_2) | ||
return Adapter_2; | ||
} catch (_b) { | ||
const { Adapter: Adapter2 } = require2(adapterPath); | ||
if (Adapter2) | ||
return Adapter2; | ||
} catch { | ||
} | ||
@@ -80,20 +80,20 @@ } | ||
try { | ||
var Adapter_3 = require2(adapterPath); | ||
if (Adapter_3) | ||
return Adapter_3; | ||
} catch (_c) { | ||
const Adapter2 = require2(adapterPath); | ||
if (Adapter2) | ||
return Adapter2; | ||
} catch { | ||
} | ||
adapterPath = path.join(controllerDir, "build/lib/adapter.js"); | ||
try { | ||
var Adapter_4 = require2(adapterPath); | ||
if (Adapter_4) | ||
return Adapter_4; | ||
} catch (_d) { | ||
const Adapter2 = require2(adapterPath); | ||
if (Adapter2) | ||
return Adapter2; | ||
} catch { | ||
} | ||
adapterPath = path.join(controllerDir, "lib/adapter.js"); | ||
try { | ||
var Adapter_5 = require2(adapterPath); | ||
if (Adapter_5) | ||
return Adapter_5; | ||
} catch (_e) { | ||
const Adapter2 = require2(adapterPath); | ||
if (Adapter2) | ||
return Adapter2; | ||
} catch { | ||
} | ||
@@ -106,4 +106,4 @@ throw new Error("Cannot resolve adapter class"); | ||
} | ||
var adapter = resolveAdapterConstructor(); | ||
var Adapter = adapter; | ||
const adapter = resolveAdapterConstructor(); | ||
const Adapter = adapter; | ||
// Annotate the CommonJS export names for ESM import in node: | ||
@@ -110,0 +110,0 @@ 0 && (module.exports = { |
@@ -6,15 +6,15 @@ import * as path from "node:path"; | ||
// eslint-disable-next-line unicorn/prefer-module | ||
var require = createRequire(import.meta.url || "file://" + __filename); | ||
export var controllerCommonModulesInternal; | ||
const require = createRequire(import.meta.url || "file://" + __filename); | ||
export let controllerCommonModulesInternal; | ||
function resolveControllerTools() { | ||
// Attempt 1: Resolve @iobroker/js-controller-common from here - JS-Controller 4.1+ | ||
var importPath = tryResolvePackage(["@iobroker/js-controller-common"]); | ||
let importPath = tryResolvePackage(["@iobroker/js-controller-common"]); | ||
if (importPath) { | ||
try { | ||
controllerCommonModulesInternal = require(importPath); | ||
var tools = controllerCommonModulesInternal.tools; | ||
const { tools } = controllerCommonModulesInternal; | ||
if (tools) | ||
return tools; | ||
} | ||
catch (_a) { | ||
catch { | ||
// did not work, continue | ||
@@ -28,7 +28,7 @@ } | ||
controllerCommonModulesInternal = require(importPath); | ||
var tools = controllerCommonModulesInternal.tools; | ||
const { tools } = controllerCommonModulesInternal; | ||
if (tools) | ||
return tools; | ||
} | ||
catch (_b) { | ||
catch { | ||
// did not work, continue | ||
@@ -41,7 +41,7 @@ } | ||
// This was a default export prior to the TS migration | ||
var tools = require(path.join(importPath, "tools")); | ||
const tools = require(path.join(importPath, "tools")); | ||
if (tools) | ||
return tools; | ||
} | ||
catch (_c) { | ||
catch { | ||
// did not work, continue | ||
@@ -53,3 +53,3 @@ } | ||
/** The collection of utility functions in JS-Controller, formerly `lib/tools.js` */ | ||
export var controllerToolsInternal = resolveControllerTools(); | ||
export const controllerToolsInternal = resolveControllerTools(); | ||
// Export a subset of the utilties in controllerTools | ||
@@ -61,9 +61,8 @@ /** | ||
*/ | ||
export function resolveNamedModule(name, exportName) { | ||
if (exportName === void 0) { exportName = name; } | ||
export function resolveNamedModule(name, exportName = name) { | ||
// The requested module might be moved to @iobroker/js-controller-common and exported from there | ||
if (controllerCommonModulesInternal === null || controllerCommonModulesInternal === void 0 ? void 0 : controllerCommonModulesInternal[exportName]) | ||
if (controllerCommonModulesInternal?.[exportName]) | ||
return controllerCommonModulesInternal[exportName]; | ||
// Otherwise it was not moved yet, or we're dealing with JS-Controller <= 4.0 | ||
var importPaths = [ | ||
const importPaths = [ | ||
// Attempt 1: JS-Controller 6+ | ||
@@ -76,15 +75,14 @@ path.join(utils.controllerDir, "build/cjs/lib", name), | ||
]; | ||
for (var _i = 0, importPaths_1 = importPaths; _i < importPaths_1.length; _i++) { | ||
var importPath = importPaths_1[_i]; | ||
for (const importPath of importPaths) { | ||
try { | ||
// This was a default export prior to the TS migration | ||
var module_1 = require(importPath); | ||
if (module_1) | ||
return module_1; | ||
const module = require(importPath); | ||
if (module) | ||
return module; | ||
} | ||
catch (_a) { | ||
catch { | ||
// did not work, continue | ||
} | ||
} | ||
throw new Error("Cannot resolve JS-Controller module ".concat(name, ".js")); | ||
throw new Error(`Cannot resolve JS-Controller module ${name}.js`); | ||
//return process.exit(10); | ||
@@ -150,11 +148,11 @@ } | ||
} | ||
export var commonTools = { | ||
pattern2RegEx: pattern2RegEx, | ||
getAdapterDir: getAdapterDir, | ||
getInstalledInfo: getInstalledInfo, | ||
isDocker: isDocker, | ||
getLocalAddress: getLocalAddress, | ||
getListenAllAddress: getListenAllAddress, | ||
isLocalAddress: isLocalAddress, | ||
isListenAllAddress: isListenAllAddress, | ||
export const commonTools = { | ||
pattern2RegEx, | ||
getAdapterDir, | ||
getInstalledInfo, | ||
isDocker, | ||
getLocalAddress, | ||
getListenAllAddress, | ||
isLocalAddress, | ||
isListenAllAddress, | ||
// TODO: Add more methods from lib/tools.js as needed | ||
@@ -161,0 +159,0 @@ password: resolveNamedModule("password"), |
@@ -6,4 +6,4 @@ import * as fs from "node:fs"; | ||
// eslint-disable-next-line unicorn/prefer-module | ||
var require = createRequire(import.meta.url || "file://" + __filename); | ||
var thisDir = url.fileURLToPath( | ||
const require = createRequire(import.meta.url || "file://" + __filename); | ||
const thisDir = url.fileURLToPath( | ||
// eslint-disable-next-line unicorn/prefer-module | ||
@@ -16,8 +16,7 @@ new URL(".", import.meta.url || "file://" + __filename)); | ||
export function tryResolvePackage(possiblePaths, lookupPaths) { | ||
for (var _i = 0, possiblePaths_1 = possiblePaths; _i < possiblePaths_1.length; _i++) { | ||
var pkg = possiblePaths_1[_i]; | ||
for (const pkg of possiblePaths) { | ||
try { | ||
// package.json is guaranteed to be in the module root folder | ||
// so once that is resolved, take the dirname and we're done | ||
var possiblePath = require.resolve("".concat(pkg, "/package.json"), (lookupPaths === null || lookupPaths === void 0 ? void 0 : lookupPaths.length) ? { paths: lookupPaths } : undefined); | ||
const possiblePath = require.resolve(`${pkg}/package.json`, lookupPaths?.length ? { paths: lookupPaths } : undefined); | ||
if (fs.existsSync(possiblePath)) { | ||
@@ -27,3 +26,3 @@ return path.dirname(possiblePath); | ||
} | ||
catch (_a) { | ||
catch { | ||
/* not found */ | ||
@@ -37,10 +36,8 @@ } | ||
*/ | ||
export function scanForPackage(possiblePaths, startDir) { | ||
if (startDir === void 0) { startDir = thisDir; } | ||
export function scanForPackage(possiblePaths, startDir = thisDir) { | ||
// We start in the node_modules subfolder of adapter-core, which is the deepest we should be able to expect the controller | ||
var curDir = path.join(startDir, "../node_modules"); | ||
let curDir = path.join(startDir, "../node_modules"); | ||
while (true) { | ||
for (var _i = 0, possiblePaths_2 = possiblePaths; _i < possiblePaths_2.length; _i++) { | ||
var pkg = possiblePaths_2[_i]; | ||
var possiblePath = path.join(curDir, pkg, "package.json"); | ||
for (const pkg of possiblePaths) { | ||
const possiblePath = path.join(curDir, pkg, "package.json"); | ||
try { | ||
@@ -54,3 +51,3 @@ // If package.json exists in the directory and its name field matches, we've found js-controller | ||
} | ||
catch (_a) { | ||
catch { | ||
// don't care | ||
@@ -60,3 +57,3 @@ } | ||
// Nothing found here, go up one level | ||
var parentDir = path.dirname(curDir); | ||
const parentDir = path.dirname(curDir); | ||
if (parentDir === curDir) { | ||
@@ -63,0 +60,0 @@ // we've reached the root without finding js-controller |
@@ -1,12 +0,1 @@ | ||
var __assign = (this && this.__assign) || function () { | ||
__assign = Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
import * as path from "node:path"; | ||
@@ -33,2 +22,5 @@ import { controllerToolsInternal, resolveNamedModule, } from "./controllerTools.js"; | ||
// TODO: Expose some system utilities here, e.g. for installing npm modules (GH#1) | ||
export var EXIT_CODES = Object.freeze(__assign({}, resolveNamedModule("exitCodes", "EXIT_CODES"))); | ||
export const EXIT_CODES = Object.freeze({ | ||
// Create a shallow copy so compact adapters cannot overwrite the dict in js-controller | ||
...resolveNamedModule("exitCodes", "EXIT_CODES"), | ||
}); |
@@ -1,2 +0,1 @@ | ||
var _a; | ||
import * as fs from "node:fs"; | ||
@@ -7,3 +6,3 @@ import * as path from "node:path"; | ||
// eslint-disable-next-line unicorn/prefer-module | ||
var require = createRequire(import.meta.url || "file://" + __filename); | ||
const require = createRequire(import.meta.url || "file://" + __filename); | ||
/** | ||
@@ -15,5 +14,5 @@ * Resolves the root directory of JS-Controller and returns it or exits the process | ||
// Find the js-controller location | ||
var possibilities = ["iobroker.js-controller", "ioBroker.js-controller"]; | ||
const possibilities = ["iobroker.js-controller", "ioBroker.js-controller"]; | ||
// First try to let Node.js resolve the package by itself | ||
var controllerDir = tryResolvePackage(possibilities); | ||
let controllerDir = tryResolvePackage(possibilities); | ||
// Apparently, checking vs null/undefined may miss the odd case of controllerPath being "" | ||
@@ -36,13 +35,13 @@ // Thus we check for falsyness, which includes failing on an empty path | ||
/** The root directory of JS-Controller */ | ||
export var controllerDir = getControllerDir(!!((_a = process === null || process === void 0 ? void 0 : process.argv) === null || _a === void 0 ? void 0 : _a.includes("--install"))); | ||
export const controllerDir = getControllerDir(!!process?.argv?.includes("--install")); | ||
function resolveAdapterConstructor() { | ||
// Attempt 1: Resolve @iobroker/js-controller-adapter from here - JS-Controller 4.1+ | ||
var adapterPath = tryResolvePackage(["@iobroker/js-controller-adapter"]); | ||
let adapterPath = tryResolvePackage(["@iobroker/js-controller-adapter"]); | ||
if (adapterPath) { | ||
try { | ||
var Adapter_1 = require(adapterPath).Adapter; | ||
if (Adapter_1) | ||
return Adapter_1; | ||
const { Adapter } = require(adapterPath); | ||
if (Adapter) | ||
return Adapter; | ||
} | ||
catch (_a) { | ||
catch { | ||
// did not work, continue | ||
@@ -55,7 +54,7 @@ } | ||
try { | ||
var Adapter_2 = require(adapterPath).Adapter; | ||
if (Adapter_2) | ||
return Adapter_2; | ||
const { Adapter } = require(adapterPath); | ||
if (Adapter) | ||
return Adapter; | ||
} | ||
catch (_b) { | ||
catch { | ||
// did not work, continue | ||
@@ -68,7 +67,7 @@ } | ||
// This was a default export prior to the TS migration | ||
var Adapter_3 = require(adapterPath); | ||
if (Adapter_3) | ||
return Adapter_3; | ||
const Adapter = require(adapterPath); | ||
if (Adapter) | ||
return Adapter; | ||
} | ||
catch (_c) { | ||
catch { | ||
// did not work, continue | ||
@@ -80,7 +79,7 @@ } | ||
// This was a default export prior to the TS migration | ||
var Adapter_4 = require(adapterPath); | ||
if (Adapter_4) | ||
return Adapter_4; | ||
const Adapter = require(adapterPath); | ||
if (Adapter) | ||
return Adapter; | ||
} | ||
catch (_d) { | ||
catch { | ||
// did not work, continue | ||
@@ -92,7 +91,7 @@ } | ||
// This was a default export prior to the TS migration | ||
var Adapter_5 = require(adapterPath); | ||
if (Adapter_5) | ||
return Adapter_5; | ||
const Adapter = require(adapterPath); | ||
if (Adapter) | ||
return Adapter; | ||
} | ||
catch (_e) { | ||
catch { | ||
// did not work, continue | ||
@@ -108,4 +107,4 @@ } | ||
/** Creates a new adapter instance */ | ||
export var adapter = resolveAdapterConstructor(); | ||
export const adapter = resolveAdapterConstructor(); | ||
/** Creates a new adapter instance */ | ||
export var Adapter = adapter; | ||
export const Adapter = adapter; |
{ | ||
"name": "@iobroker/adapter-core", | ||
"version": "3.1.4", | ||
"version": "3.1.5", | ||
"description": "Core module to be used in ioBroker adapters. Acts as the bridge to js-controller.", | ||
@@ -83,4 +83,4 @@ "engines": { | ||
"peerDependencies": { | ||
"@iobroker/types": "^5.0.11" | ||
"@iobroker/types": "^6.0.0" | ||
} | ||
} |
131
README.md
@@ -67,19 +67,20 @@ # Adapter-Core | ||
- `commonTools.pattern2RegEx` - Converts a pattern to match object IDs into a RegEx string that can be used in `new RegExp(...)` | ||
- `commonTools.getAdapterDir` - Finds the adapter directory of a given adapter | ||
- `commonTools.getInstalledInfo` - Get list of all installed adapters and controller version on this host | ||
- `commonTools.getLocalAddress` - Get the localhost (IPv6 or IPv4) address according to the ioBroker config | ||
- `commonTools.getListenAllAddress` - Get the "listen all" (IPv6 or IPv4) address according to the ioBroker config | ||
- `commonTools.isLocalAddress` - Check if given IPv4 or IPv6 ip address corresponds to localhost | ||
- `commonTools.isListenAllAddress` - Check if given IPv4 or IPv6 ip address corresponds to "listen all" address | ||
- `commonTools.ensureDNSOrder` - Ensure that DNS resolution is performed according to ioBroker config | ||
- `commonTools.pattern2RegEx` - Converts a pattern to match object IDs into a RegEx string that can be used in `new RegExp(...)` | ||
- `commonTools.getAdapterDir` - Finds the adapter directory of a given adapter | ||
- `commonTools.getInstalledInfo` - Get list of all installed adapters and controller version on this host | ||
- `commonTools.getLocalAddress` - Get the localhost (IPv6 or IPv4) address according to the ioBroker config | ||
- `commonTools.getListenAllAddress` - Get the "listen all" (IPv6 or IPv4) address according to the ioBroker config | ||
- `commonTools.isLocalAddress` - Check if given IPv4 or IPv6 ip address corresponds to localhost | ||
- `commonTools.isListenAllAddress` - Check if given IPv4 or IPv6 ip address corresponds to "listen all" address | ||
- `commonTools.ensureDNSOrder` - Ensure that DNS resolution is performed according to ioBroker config | ||
And the following **modules** are exposed: | ||
- `commonTools.password` - Previously exposed as `lib/password.js` in JS-Controller. | ||
- `commonTools.letsEncrypt` - Previously exposed as `lib/letsencrypt.js` in JS-Controller. Note that `letsEncrypt` has a capital `E`! | ||
- `commonTools.session` - Previously exposed as `lib/session.js` in JS-Controller. | ||
- `commonTools.zipFiles` - Previously exposed as `lib/zipFiles.js` in JS-Controller. | ||
- `commonTools.isDocker` - Checks if we are running inside a docker container | ||
- `commonTools.password` - Previously exposed as `lib/password.js` in JS-Controller. | ||
- `commonTools.session` - Previously exposed as `lib/session.js` in JS-Controller. | ||
- `commonTools.zipFiles` - Previously exposed as `lib/zipFiles.js` in JS-Controller. | ||
- `commonTools.isDocker` - Checks if we are running inside a docker container | ||
Note that `commonTools.letsEncrypt` is not available anymore as the next controller won't support it (use `@iobroker/webserver` instead). | ||
## Automatic backup of data files | ||
@@ -103,9 +104,9 @@ | ||
- `npm run build` creates a clean rebuild of the module. This is done automatically before every build | ||
- `npm run lint` checks for linting errors | ||
- `npm run watch` creates an initial build and then incrementally compiles the changes while working. | ||
- `npm run build` creates a clean rebuild of the module. This is done automatically before every build | ||
- `npm run lint` checks for linting errors | ||
- `npm run watch` creates an initial build and then incrementally compiles the changes while working. | ||
## Errors in the definitions? | ||
If you find errors in the definitions, e.g. function calls that should be allowed but aren't, please open an issue here or over at https://github.com/DefinitelyTyped/DefinitelyTyped and make sure to mention @AlCalzone. | ||
If you find errors in the definitions, e.g., function calls that should be allowed but aren't, please open an issue here or over at https://github.com/DefinitelyTyped/DefinitelyTyped and make sure to mention @AlCalzone. | ||
@@ -118,116 +119,92 @@ ## Changelog | ||
--> | ||
### 3.1.5 (2024-06-03) | ||
* (foxriver76) provide up-to-date types | ||
### 3.1.4 (2024-04-19) | ||
- (foxriver76) fixes for adapters which are written in ESM | ||
- (foxriver76) fixes for adapters which are written in ESM | ||
### 3.1.3 (2024-04-19) | ||
- (foxriver76) fixes for cjs adapters | ||
- (foxriver76) fixes for cjs adapters | ||
### 3.1.2 (2024-04-19) | ||
- (foxriver76) fixes for adapters which are written in ESM | ||
- (foxriver76) fixes for adapters which are written in ESM | ||
### 3.1.1 (2024-04-19) | ||
- (foxriver76) removed letsEncrypt support as next controller won't support it anymore (use `@iobroker/webserver` instead) | ||
- (foxriver76) removed letsEncrypt support as next controller won't support it anymore (use `@iobroker/webserver` instead) | ||
### 3.1.0 (2024-04-16) | ||
- (foxriver76) provide `esm` and `cjs` exports | ||
- (foxriver76) provide `esm` and `cjs` exports | ||
### 3.0.6 (2024-03-24) | ||
- (foxriver76) hotfix previous release: compatibility with next controller with new esm/cjs exports | ||
- (foxriver76) hotfix previous release: compatibility with next controller with new esm/cjs exports | ||
### 3.0.5 (2024-03-24) | ||
- (foxriver76) compatibility with next controller with new esm/cjs exports | ||
- (foxriver76) compatibility with next controller with new esm/cjs exports | ||
### 3.0.4 (2023-10-12) | ||
- (foxriver76) ensure that utility methods work with the returned adapter instance on type level | ||
- (foxriver76) ensure that utility methods work with the returned adapter instance on type level | ||
### 3.0.3 (2023-07-30) | ||
- (foxriver76) upgrade to a new version of types package | ||
- (foxriver76) upgrade to new version of types package | ||
### 3.0.2 (2023-07-30) | ||
- (foxriver76) fix require of `@iobroker/types` in built module | ||
- (foxriver76) fix require of `@iobroker/types` in built module | ||
### 3.0.1 (2023-07-29) | ||
- (foxriver76) remove non-existing webserver from tools | ||
- (foxriver76) remove non-existing webserver from tools | ||
### 3.0.0 (2023-07-28) | ||
- (foxriver76) port from `@types/iobroker` to `@iobroker/types` | ||
- (foxriver76) export dns resolution methods | ||
- **BREAKING:** requires `npm` v7 or newer and/or Node.js 16 or newer | ||
- (foxriver76) port from `@types/iobroker` to `@iobroker/types` | ||
- (foxriver76) export dns resolution methods | ||
- **BREAKING:** requires `npm` v7 or newer and/or Node.js 16 or newer | ||
### 2.6.8 (2023-03-24) | ||
- (Apollon77) Expose more JS-Controller internals under the `commonTools` export | ||
- (Apollon77) Expose more JS-Controller internals under the `commonTools` export | ||
### 2.6.7 (2022-10-08) | ||
- (Apollon77) Expose more JS-Controller internals under the `commonTools` export | ||
- (Apollon77) Expose more JS-Controller internals under the `commonTools` export | ||
### 2.6.6 (2022-09-13) | ||
- (AlCalzone) Expose more JS-Controller internals under the `commonTools` export | ||
- (AlCalzone) Expose more JS-Controller internals under the `commonTools` export | ||
### 2.6.2 (2022-09-07) | ||
- (AlCalzone) Fix: Restore compatibility with JS-Controller < 4.1 | ||
- (AlCalzone) Fix: Restore compatibility with JS-Controller < 4.1 | ||
### 2.6.1 (2022-09-06) | ||
- (AlCalzone) Fix: detecting JS-Controller now finds the correct directory and not a subdirectory. | ||
- (AlCalzone) Fix: detecting JS-Controller now finds the correct directory and not a subdirectory. | ||
### 2.6.0 (2022-02-20) | ||
- (AlCalzone) Updated core declarations to `v4.0.1` for support with JS-Controller 4.x | ||
- (AlCalzone) Updated core declarations to `v4.0.1` for support with JS-Controller 4.x | ||
### 2.5.1 (2021-07-22) | ||
- (AlCalzone) Updated core declarations to `v3.3.4`. | ||
- (AlCalzone) Updated core declarations to `v3.3.4`. | ||
### 2.5.0 (2021-05-19) | ||
- (AlCalzone) Added the fallback solution to detect js-controller if require.resolve fails in dev situations with symlinks | ||
- (AlCalzone) Use release-script for releases | ||
- (AlCalzone) Updated core declarations to `v3.3.0` to be up to date with JS-Controller 3.3.x. | ||
- (AlCalzone) Add fallback solution to detect js-controller if require.resolve fails in dev situations with symlinks | ||
- (AlCalzone) Use release-script for releases | ||
- (AlCalzone) Updated core declarations to `v3.3.0` to be up to date with JS-Controller 3.3.x. | ||
### v2.4.0 (2020-05-03) | ||
- (AlCalzone) Updated core declarations to v3.0.6. | ||
- (AlCalzone) Expose the predefined collection of adapter exit codes as `utils.EXIT_CODES` | ||
- (AlCalzone) Updated core declarations to v3.0.6. | ||
- (AlCalzone) Expose the predefined collection of adapter exit codes as `utils.EXIT_CODES` | ||
### v2.3.1 (2020-04-17) | ||
- (AlCalzone) Updated core declarations to v3.0.4. | ||
- (AlCalzone) Updated core declarations to v3.0.4. | ||
### v2.3.0 (2020-04-15) | ||
- (AlCalzone) Updated core declarations to v3.0.2. This includes support for new methods in JS-Controller 3.0 | ||
- (AlCalzone) Updated core declarations to v3.0.2. This includes support for new methods in JS-Controller 3.0 | ||
### v2.2.1 (2020-01-27) | ||
- (AlCalzone) Included typings for the objects and states cache in the adapter class | ||
- (AlCalzone) Included typings for the objects and states cache in the adapter class | ||
### v2.0.0 (2019-12-27) | ||
- (AlCalzone) Updated core declarations to v2.0.0. This removes access to `adapter.objects` and `adapter.states`. You must use the new methods `adapter.getObjectView` and `adapter.getObjectList` instead of their counterparts from `objects`. | ||
- (AlCalzone) Updated core declarations to v2.0.0. This removes access to `adapter.objects` and `adapter.states`. You must use the new methods `adapter.getObjectView` and `adapter.getObjectList` instead of their counterparts from `objects`. | ||
### v1.0.3 (2019-01-06) | ||
- (AlCalzone) Updated core declarations | ||
- (AlCalzone) Fix included declarations to allow creating adapter instances with `new`. | ||
- (AlCalzone) Updated core declarations | ||
- (AlCalzone) Fix included declarations to allow creating adapter instances with `new`. | ||
### v1.0.0 (2018-27-11) | ||
- (AlCalzone) Initial version | ||
- (AlCalzone) Initial version | ||
## MIT License | ||
@@ -234,0 +211,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
74913
1105
228