UNPKG

2.98 kBTypeScriptView Raw
1export declare let controllerCommonModulesInternal: any;
2/** The collection of utility functions in JS-Controller, formerly `lib/tools.js` */
3export declare const controllerToolsInternal: any;
4/**
5 * Resolve a module that is either exported by @iobroker/js-controller-common (new controllers) or located in the controller's `lib` directory (old controllers).
6 * @param name - The filename of the module to resolve
7 * @param exportName - The name under which the module may be exported. Defaults to `name`.
8 */
9export declare function resolveNamedModule(name: string, exportName?: string): any;
10/**
11 * Converts a pattern to match object IDs into a RegEx string that can be used in `new RegExp(...)`
12 * @param pattern The pattern to convert
13 * @returns The RegEx string
14 */
15declare function pattern2RegEx(pattern: string): string;
16/**
17 * Finds the adapter directory of a given adapter
18 *
19 * @param adapter name of the adapter, e.g. hm-rpc
20 * @returns path to adapter directory or null if no directory found
21 */
22declare function getAdapterDir(adapter: string): string | null;
23export interface InstalledInfo {
24 controller?: boolean;
25 version?: string;
26 icon?: string;
27 title?: string;
28 titleLang?: ioBroker.Translated;
29 desc?: ioBroker.Translated;
30 platform?: string;
31 keywords?: string[];
32 readme?: string;
33 runningVersion?: string;
34 license?: string;
35 licenseUrl?: string;
36}
37/**
38 * Get list of all installed adapters and controller version on this host
39 * @param hostJsControllerVersion Version of the running js-controller, will be included in the returned information if provided
40 * @returns object containing information about installed host
41 */
42declare function getInstalledInfo(hostJsControllerVersion?: string): Record<string, InstalledInfo>;
43/**
44 * Checks if we are running inside a docker container
45 */
46declare function isDocker(): boolean;
47/**
48 * Checks if given ip address is matching ipv4 or ipv6 localhost
49 * @param ip ipv4 or ipv6 address
50 */
51declare function isLocalAddress(ip: string): boolean;
52/**
53 * Checks if given ip address is matching ipv4 or ipv6 "listen all" address
54 * @param ip ipv4 or ipv6 address
55 */
56declare function isListenAllAddress(ip: string): boolean;
57/**
58 * Retrieve the localhost address according to the configured DNS resolution strategy
59 */
60declare function getLocalAddress(): "127.0.0.1" | "::1";
61/**
62 * Get the ip to listen to all addresses according to configured DNS resolution strategy
63 */
64declare function getListenAllAddress(): "0.0.0.0" | "::";
65export declare const commonTools: {
66 pattern2RegEx: typeof pattern2RegEx;
67 getAdapterDir: typeof getAdapterDir;
68 getInstalledInfo: typeof getInstalledInfo;
69 isDocker: typeof isDocker;
70 getLocalAddress: typeof getLocalAddress;
71 getListenAllAddress: typeof getListenAllAddress;
72 isLocalAddress: typeof isLocalAddress;
73 isListenAllAddress: typeof isListenAllAddress;
74 password: any;
75 session: any;
76 zipFiles: any;
77};
78export {};