@iobroker/adapter-core
Advanced tools
Comparing version 2.6.8 to 3.0.0
@@ -5,3 +5,3 @@ export declare let controllerCommonModulesInternal: 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). | ||
* Resolve a module that is either exported by @iobroker/js-controller-common (new controllers) or located in the controller's `lib` directory (old controllers). | ||
* @param name - The filename of the module to resolve | ||
@@ -61,2 +61,20 @@ * @param exportName - The name under which the module may be exported. Defaults to `name`. | ||
declare function isDocker(): boolean; | ||
/** | ||
* Checks if given ip address is matching ipv4 or ipv6 localhost | ||
* @param ip ipv4 or ipv6 address | ||
*/ | ||
declare function isLocalAddress(ip: string): boolean; | ||
/** | ||
* Checks if given ip address is matching ipv4 or ipv6 "listen all" address | ||
* @param ip ipv4 or ipv6 address | ||
*/ | ||
declare function isListenAllAddress(ip: string): boolean; | ||
/** | ||
* Retrieve the localhost address according to the configured DNS resolution strategy | ||
*/ | ||
declare function getLocalAddress(): "127.0.0.1" | "::1"; | ||
/** | ||
* Get the ip to listen to all addresses according to configured DNS resolution strategy | ||
*/ | ||
declare function getListenAllAddress(): "0.0.0.0" | "::"; | ||
export declare const commonTools: { | ||
@@ -67,7 +85,13 @@ pattern2RegEx: typeof pattern2RegEx; | ||
isDocker: typeof isDocker; | ||
getLocalAddress: typeof getLocalAddress; | ||
getListenAllAddress: typeof getListenAllAddress; | ||
isLocalAddress: typeof isLocalAddress; | ||
isListenAllAddress: typeof isListenAllAddress; | ||
password: any; | ||
/** @deprecated */ | ||
letsEncrypt: any; | ||
session: any; | ||
webServer: any; | ||
zipFiles: any; | ||
}; | ||
export {}; |
@@ -52,3 +52,3 @@ "use strict"; | ||
/** | ||
* 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). | ||
* Resolve a module that is either exported by @iobroker/js-controller-common (new controllers) or located in the controller's `lib` directory (old controllers). | ||
* @param name - The filename of the module to resolve | ||
@@ -120,2 +120,28 @@ * @param exportName - The name under which the module may be exported. Defaults to `name`. | ||
} | ||
/** | ||
* Checks if given ip address is matching ipv4 or ipv6 localhost | ||
* @param ip ipv4 or ipv6 address | ||
*/ | ||
function isLocalAddress(ip) { | ||
return exports.controllerToolsInternal.isLocalAddress(ip); | ||
} | ||
/** | ||
* Checks if given ip address is matching ipv4 or ipv6 "listen all" address | ||
* @param ip ipv4 or ipv6 address | ||
*/ | ||
function isListenAllAddress(ip) { | ||
return exports.controllerToolsInternal.isListenAllAddress(ip); | ||
} | ||
/** | ||
* Retrieve the localhost address according to the configured DNS resolution strategy | ||
*/ | ||
function getLocalAddress() { | ||
return exports.controllerToolsInternal.getLocalAddress(); | ||
} | ||
/** | ||
* Get the ip to listen to all addresses according to configured DNS resolution strategy | ||
*/ | ||
function getListenAllAddress() { | ||
return exports.controllerToolsInternal.getListenAllAddress(); | ||
} | ||
exports.commonTools = { | ||
@@ -126,8 +152,14 @@ pattern2RegEx, | ||
isDocker, | ||
getLocalAddress, | ||
getListenAllAddress, | ||
isLocalAddress, | ||
isListenAllAddress, | ||
// TODO: Add more methods from lib/tools.js as needed | ||
password: resolveNamedModule("password"), | ||
/** @deprecated */ | ||
letsEncrypt: resolveNamedModule("letsencrypt"), | ||
session: resolveNamedModule("session"), | ||
webServer: resolveNamedModule("webServer"), | ||
zipFiles: resolveNamedModule("zipFiles"), | ||
// TODO: expose more (internal) controller modules as needed | ||
}; |
@@ -1,3 +0,3 @@ | ||
/// <reference types="iobroker" /> | ||
import { ExitCodes } from "./exitCodes"; | ||
import "@iobroker/types"; | ||
export { commonTools } from "./controllerTools"; | ||
@@ -4,0 +4,0 @@ export * from "./utils"; |
@@ -21,3 +21,3 @@ "use strict"; | ||
const utils = require("./utils"); | ||
/* eslint-disable @typescript-eslint/no-var-requires */ | ||
require("@iobroker/types"); | ||
// Export utility methods to be used in adapters | ||
@@ -24,0 +24,0 @@ var controllerTools_2 = require("./controllerTools"); |
@@ -1,2 +0,1 @@ | ||
/// <reference types="iobroker" /> | ||
/** The root directory of JS-Controller */ | ||
@@ -3,0 +2,0 @@ export declare const controllerDir: string; |
{ | ||
"name": "@iobroker/adapter-core", | ||
"version": "2.6.8", | ||
"version": "3.0.0", | ||
"description": "Core module to be used in ioBroker adapters. Acts as the bridge to js-controller.", | ||
@@ -36,2 +36,5 @@ "author": { | ||
}, | ||
"files": [ | ||
"build" | ||
], | ||
"homepage": "https://github.com/ioBroker/adapter-core#readme", | ||
@@ -41,2 +44,3 @@ "devDependencies": { | ||
"@alcalzone/release-script-plugin-license": "~3.5.9", | ||
"@iobroker/types": "^5.0.10", | ||
"@types/chai": "^4.3.4", | ||
@@ -53,3 +57,3 @@ "@types/chai-as-promised": "^7.1.5", | ||
"chai-as-promised": "^7.1.1", | ||
"eslint": "^8.36.0", | ||
"eslint": "^8.41.0", | ||
"eslint-config-prettier": "^8.8.0", | ||
@@ -61,11 +65,11 @@ "eslint-plugin-prettier": "^4.2.1", | ||
"rimraf": "^3.0.2", | ||
"sinon": "^15.0.2", | ||
"sinon": "^15.1.0", | ||
"sinon-chai": "^3.7.0", | ||
"source-map-support": "^0.5.21", | ||
"ts-node": "^10.9.1", | ||
"typescript": "^4.9.5" | ||
"typescript": "^5.0.4" | ||
}, | ||
"dependencies": { | ||
"@types/iobroker": "^4.0.5" | ||
"peerDependencies": { | ||
"@iobroker/types": "^5.0.10" | ||
} | ||
} |
@@ -70,2 +70,7 @@ # Adapter-Core | ||
- `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 | ||
@@ -84,3 +89,3 @@ And the following **modules** are exposed: | ||
```json | ||
```js | ||
{ | ||
@@ -113,2 +118,6 @@ // ... | ||
--> | ||
### 3.0.0 (2023-07-28) | ||
- (foxriver76) port from `@types/iobroker` to `@iobroker/types` | ||
- (foxriver76) export dns resolution methods | ||
### 2.6.8 (2023-03-24) | ||
@@ -115,0 +124,0 @@ - (Apollon77) Expose more JS-Controller internals under the `commonTools` export |
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
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
203
33403
26
13
546
+ Added@iobroker/types@5.0.19(transitive)
- Removed@types/iobroker@^4.0.5
- Removed@types/iobroker@4.0.5(transitive)
- Removed@types/node@22.7.4(transitive)
- Removedundici-types@6.19.8(transitive)