@iobroker/db-base 1.2.3 → 4.0.0-alpha.11-20211118-e40274a2

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.
@@ -434,6 +434,7 @@ class InMemoryFileDB {
434
434
  // Destructor of the class. Called by shutting down.
435
435
  async destroy() {
436
436
  if (this.stateTimer) {
437
+ clearTimeout(this.stateTimer);
437
438
  await this.saveState();
438
439
  }
439
440
  }
package/lib/tools.js CHANGED
@@ -1,51 +1,7 @@
1
- const path = require('path');
2
- const fs = require('fs');
1
+ const { tools } = require('@iobroker/js-controller-common');
3
2
 
4
- function getControllerDir() {
5
- const possibilities = ['iobroker.js-controller', 'ioBroker.js-controller'];
6
- for (const pkg of possibilities) {
7
- try {
8
- // package.json is guaranteed to be in the module root folder
9
- // so once that is resolved, take the dirname and we're done
10
- const possiblePath = require.resolve(`${pkg}/package.json`);
11
- if (fs.existsSync(possiblePath)) {
12
- return path.dirname(possiblePath);
13
- }
14
- } catch {
15
- /* not found */
16
- }
17
- }
18
-
19
- // Apparently, checking vs null/undefined may miss the odd case of controllerPath being ""
20
- // Thus we check for falsyness, which includes failing on an empty path
21
- let checkPath = path.join(__dirname, '../..');
22
- // Also check in the current check dir (along with iobroker.js-controller subdirs)
23
- possibilities.unshift('');
24
- while (true) {
25
- for (const pkg of possibilities) {
26
- try {
27
- const possiblePath = path.join(checkPath, pkg);
28
- if (fs.existsSync(path.join(possiblePath, 'lib/tools.js'))) {
29
- return possiblePath;
30
- }
31
- } catch {
32
- // not found, continue with next possiblity
33
- }
34
- }
35
-
36
- // Controller not found here - go to the parent dir
37
- const newPath = path.dirname(checkPath);
38
- if (newPath === checkPath) {
39
- // We already reached the root dir, abort
40
- break;
41
- }
42
- checkPath = newPath;
43
- }
44
- }
45
-
46
- const controllerDir = getControllerDir() || __dirname;
47
-
48
- module.exports = require(path.join(controllerDir , 'lib/tools.js'));
3
+ module.exports = tools;
4
+ const controllerDir = tools.getControllerDir() || __dirname;
49
5
  module.exports.getControllerDir = () => controllerDir;
50
6
 
51
7
  /**
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@iobroker/db-base",
3
- "version": "1.2.3",
3
+ "version": "4.0.0-alpha.11-20211118-e40274a2",
4
4
  "engines": {
5
- "node": ">=10.0.0"
5
+ "node": ">=12.0.0"
6
6
  },
7
7
  "dependencies": {
8
+ "@iobroker/js-controller-common": "4.0.0-alpha.11-20211118-e40274a2",
8
9
  "deep-clone": "^3.0.3",
9
- "fs-extra": "^9.1.0",
10
+ "fs-extra": "^10.0.0",
10
11
  "node.extend": "^2.0.2",
11
12
  "respjs": "^4.2.0"
12
13
  },
@@ -19,11 +20,11 @@
19
20
  "contributors": [
20
21
  "bluefox <dogafox@gmail.com>",
21
22
  "Apollon77 <iobroker@fischer-ka.de>",
22
- "foxriver76"
23
+ "foxriver76 <moritz.heusinger@gmail.com>"
23
24
  ],
24
25
  "repository": {
25
26
  "type": "git",
26
- "url": "https://github.com/ioBroker/ioBroker.objects-redis"
27
+ "url": "https://github.com/ioBroker/ioBroker.js-controller/packages/db-base"
27
28
  },
28
29
  "scripts": {},
29
30
  "main": "index.js",
@@ -31,5 +32,9 @@
31
32
  "publishConfig": {
32
33
  "access": "public"
33
34
  },
34
- "gitHead": "1884db45a7952b6fa0298a93dc9f537896dd0ef5"
35
+ "files": [
36
+ "lib/",
37
+ "index.js"
38
+ ],
39
+ "gitHead": "077e48fdd1ea959e255de613bcd88f6a4cfd9dc5"
35
40
  }