@iobroker/js-controller-common-db 6.0.3 → 6.0.5-alpha.0-20240616-34d893b36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -2
- package/build/cjs/lib/common/tools.d.ts +4 -0
- package/build/cjs/lib/common/tools.js +8 -6
- package/build/cjs/lib/common/tools.js.map +2 -2
- package/build/esm/lib/common/tools.d.ts +4 -0
- package/build/esm/lib/common/tools.d.ts.map +1 -1
- package/build/esm/lib/common/tools.js +6 -6
- package/build/esm/lib/common/tools.js.map +1 -1
- package/build/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
# Common DB class for ioBroker
|
|
2
|
-
The Library contains the common utils
|
|
3
|
-
It makes sense to place methods here too, which require typings from the database if they are surely not used by the database.
|
|
2
|
+
The Library contains the common utils for the ioBroker controller which can be used by db classes too, as they do not rely on the db (circular dependencies).
|
|
4
3
|
|
|
5
4
|
## License
|
|
6
5
|
MIT
|
|
@@ -111,6 +111,10 @@ export declare function isSingleHost(objects: any): Promise<boolean>;
|
|
|
111
111
|
* @returns true if one or more hosts running else false
|
|
112
112
|
*/
|
|
113
113
|
export declare function isHostRunning(objects: any, states: any): Promise<boolean>;
|
|
114
|
+
/**
|
|
115
|
+
* Checks if ioBroker is installed in a dev environment
|
|
116
|
+
*/
|
|
117
|
+
export declare function isDevInstallation(): boolean;
|
|
114
118
|
/** In dev installations with uppercase B to match GitHub repo name - try to get rid of it in the long run */
|
|
115
119
|
type AppName = 'iobroker' | 'ioBroker';
|
|
116
120
|
export declare const appNameLowerCase = "iobroker";
|
|
@@ -77,6 +77,7 @@ __export(tools_exports, {
|
|
|
77
77
|
isAdapterEsmModule: () => isAdapterEsmModule,
|
|
78
78
|
isArray: () => isArray,
|
|
79
79
|
isControllerUiUpgradeSupported: () => isControllerUiUpgradeSupported,
|
|
80
|
+
isDevInstallation: () => isDevInstallation,
|
|
80
81
|
isDevServerInstallation: () => isDevServerInstallation,
|
|
81
82
|
isDocker: () => isDocker,
|
|
82
83
|
isGithubPathname: () => isGithubPathname,
|
|
@@ -276,11 +277,11 @@ async function isHostRunning(objects, states) {
|
|
|
276
277
|
}
|
|
277
278
|
return false;
|
|
278
279
|
}
|
|
279
|
-
function
|
|
280
|
+
function isDevInstallation() {
|
|
280
281
|
return import_fs_extra.default.pathExistsSync(`${getControllerDir()}/../../packages/controller`);
|
|
281
282
|
}
|
|
282
283
|
function getAppName() {
|
|
283
|
-
if (
|
|
284
|
+
if (isDevInstallation()) {
|
|
284
285
|
return "ioBroker";
|
|
285
286
|
}
|
|
286
287
|
return "iobroker";
|
|
@@ -1533,7 +1534,7 @@ function getDefaultDataDir() {
|
|
|
1533
1534
|
}
|
|
1534
1535
|
return envDataDir;
|
|
1535
1536
|
}
|
|
1536
|
-
if (
|
|
1537
|
+
if (isDevInstallation()) {
|
|
1537
1538
|
return "./data/";
|
|
1538
1539
|
}
|
|
1539
1540
|
return import_node_path.default.join("..", "..", `${appNameLowerCase}-data/`);
|
|
@@ -1548,8 +1549,8 @@ function getConfigFileName() {
|
|
|
1548
1549
|
}
|
|
1549
1550
|
const controllerDir = getControllerDir();
|
|
1550
1551
|
const fallbackConfigFile = import_node_path.default.join(controllerDir, "data", `${appNameLowerCase}.json`);
|
|
1551
|
-
const
|
|
1552
|
-
if (
|
|
1552
|
+
const isDevInstall = isDevInstallation();
|
|
1553
|
+
if (isDevInstall) {
|
|
1553
1554
|
const devConfigFile = import_node_path.default.join(controllerDir, "conf", `${appNameLowerCase}.json`);
|
|
1554
1555
|
if (import_fs_extra.default.existsSync(devConfigFile)) {
|
|
1555
1556
|
return devConfigFile;
|
|
@@ -1558,7 +1559,7 @@ function getConfigFileName() {
|
|
|
1558
1559
|
}
|
|
1559
1560
|
}
|
|
1560
1561
|
const prodConfigFile = import_node_path.default.join(getRootDir(), `${appNameLowerCase}-data`, `${appNameLowerCase}.json`);
|
|
1561
|
-
if (!import_fs_extra.default.existsSync(prodConfigFile) &&
|
|
1562
|
+
if (!import_fs_extra.default.existsSync(prodConfigFile) && isDevInstall) {
|
|
1562
1563
|
return fallbackConfigFile;
|
|
1563
1564
|
}
|
|
1564
1565
|
return prodConfigFile;
|
|
@@ -2676,6 +2677,7 @@ async function getControllerPid() {
|
|
|
2676
2677
|
isAdapterEsmModule,
|
|
2677
2678
|
isArray,
|
|
2678
2679
|
isControllerUiUpgradeSupported,
|
|
2680
|
+
isDevInstallation,
|
|
2679
2681
|
isDevServerInstallation,
|
|
2680
2682
|
isDocker,
|
|
2681
2683
|
isGithubPathname,
|