UNPKG

3.41 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 *
7 * @param name - The filename of the module to resolve
8 * @param exportName - The name under which the module may be exported. Defaults to `name`.
9 */
10export declare function resolveNamedModule(name: string, exportName?: string): any;
11/**
12 * Converts a pattern to match object IDs into a RegEx string that can be used in `new RegExp(...)`
13 *
14 * @param pattern The pattern to convert
15 * @returns The RegEx string
16 */
17declare function pattern2RegEx(pattern: string): string;
18/**
19 * Finds the adapter directory of a given adapter
20 *
21 * @param adapter name of the adapter, e.g., `hm-rpc`
22 * @returns path to adapter directory or null if no directory found
23 */
24declare function getAdapterDir(adapter: string): string | null;
25/** Information about Host */
26export interface InstalledInfo {
27 /** If it is the js-controller */
28 controller?: boolean;
29 /** Version of adapter */
30 version?: string;
31 /** Path to adapter icon */
32 icon?: string;
33 /** Title of adapter */
34 title?: string;
35 /** I18n title of adapter */
36 titleLang?: ioBroker.Translated;
37 /** I18n adapter description */
38 desc?: ioBroker.Translated;
39 /** Supported adapter platform */
40 platform?: string;
41 /** The keywords */
42 keywords?: string[];
43 /** Path to ReadMe */
44 readme?: string;
45 /** Running version of adapter */
46 runningVersion?: string;
47 /** The license */
48 license?: string;
49 /** The url of the license */
50 licenseUrl?: string;
51}
52/**
53 * Get a list of all installed adapters and controller version on this host
54 *
55 * @param hostJsControllerVersion Version of the running js-controller, will be included in the returned information if provided
56 * @returns object containing information about installed host
57 */
58declare function getInstalledInfo(hostJsControllerVersion?: string): Record<string, InstalledInfo>;
59/**
60 * Checks if we are running inside a docker container
61 */
62declare function isDocker(): boolean;
63/**
64 * Checks if given ip address is matching ipv4 or ipv6 localhost
65 *
66 * @param ip ipv4 or ipv6 address
67 */
68declare function isLocalAddress(ip: string): boolean;
69/**
70 * Checks if given ip address is matching ipv4 or ipv6 "listen all" address
71 *
72 * @param ip ipv4 or ipv6 address
73 */
74declare function isListenAllAddress(ip: string): boolean;
75/**
76 * Retrieve the localhost address according to the configured DNS resolution strategy
77 */
78declare function getLocalAddress(): '127.0.0.1' | '::1';
79/**
80 * Get the ip to listen to all addresses according to configured DNS resolution strategy
81 */
82declare function getListenAllAddress(): '0.0.0.0' | '::';
83export declare const commonTools: {
84 pattern2RegEx: typeof pattern2RegEx;
85 getAdapterDir: typeof getAdapterDir;
86 getInstalledInfo: typeof getInstalledInfo;
87 isDocker: typeof isDocker;
88 getLocalAddress: typeof getLocalAddress;
89 getListenAllAddress: typeof getListenAllAddress;
90 isLocalAddress: typeof isLocalAddress;
91 isListenAllAddress: typeof isListenAllAddress;
92 password: any;
93 session: any;
94 zipFiles: any;
95};
96export {};