ee-core 2.9.2 → 2.10.1

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.
Files changed (103) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +65 -65
  3. package/addon/index.js +34 -34
  4. package/addon/window/index.js +98 -98
  5. package/bin/tools.js +8 -8
  6. package/config/cache.js +41 -38
  7. package/config/config.default.js +331 -330
  8. package/config/index.js +86 -73
  9. package/const/channel.js +17 -17
  10. package/const/index.js +8 -8
  11. package/controller/baseContextClass.js +34 -34
  12. package/controller/index.js +34 -34
  13. package/core/index.js +10 -10
  14. package/core/lib/ee.js +216 -216
  15. package/core/lib/loader/context_loader.js +106 -106
  16. package/core/lib/loader/ee_loader.js +435 -435
  17. package/core/lib/loader/file_loader.js +326 -326
  18. package/core/lib/loader/mixin/addon.js +32 -32
  19. package/core/lib/loader/mixin/config.js +130 -130
  20. package/core/lib/loader/mixin/controller.js +125 -125
  21. package/core/lib/loader/mixin/service.js +28 -28
  22. package/core/lib/utils/base_context_class.js +34 -34
  23. package/core/lib/utils/function.js +30 -30
  24. package/core/lib/utils/index.js +133 -133
  25. package/core/lib/utils/sequencify.js +59 -59
  26. package/core/lib/utils/timing.js +77 -77
  27. package/cross/index.js +183 -183
  28. package/cross/spawnProcess.js +183 -183
  29. package/ee/appLoader.js +48 -48
  30. package/ee/application.js +99 -99
  31. package/ee/baseApp.js +103 -102
  32. package/ee/eeApp.js +408 -408
  33. package/ee/index.js +57 -57
  34. package/electron/app/index.js +64 -58
  35. package/electron/index.js +19 -19
  36. package/electron/window/index.js +73 -73
  37. package/electron/window/winState.js +186 -186
  38. package/exception/index.js +112 -112
  39. package/html/boot.html +98 -98
  40. package/html/cross-failure.html +28 -28
  41. package/html/failure.html +28 -28
  42. package/html/index.js +13 -13
  43. package/httpclient/index.js +161 -161
  44. package/index.js +54 -54
  45. package/jobs/baseJobClass.js +16 -16
  46. package/jobs/child/app.js +58 -65
  47. package/jobs/child/forkProcess.js +145 -145
  48. package/jobs/child/index.js +82 -82
  49. package/jobs/child-pool/index.js +213 -213
  50. package/jobs/index.js +8 -8
  51. package/jobs/load-balancer/algorithm/index.js +11 -11
  52. package/jobs/load-balancer/algorithm/minimumConnection.js +18 -18
  53. package/jobs/load-balancer/algorithm/polling.js +11 -11
  54. package/jobs/load-balancer/algorithm/random.js +9 -9
  55. package/jobs/load-balancer/algorithm/specify.js +14 -14
  56. package/jobs/load-balancer/algorithm/weights.js +21 -21
  57. package/jobs/load-balancer/algorithm/weightsMinimumConnection.js +29 -29
  58. package/jobs/load-balancer/algorithm/weightsPolling.js +22 -22
  59. package/jobs/load-balancer/algorithm/weightsRandom.js +16 -16
  60. package/jobs/load-balancer/consts.js +9 -9
  61. package/jobs/load-balancer/index.js +201 -201
  62. package/jobs/load-balancer/scheduler.js +31 -31
  63. package/jobs/renderer/index.js +141 -141
  64. package/jobs/renderer/loadView.js +40 -40
  65. package/jobs/unification.js +63 -63
  66. package/loader/index.js +172 -172
  67. package/log/index.js +68 -68
  68. package/log/logger.js +86 -80
  69. package/main/index.js +56 -56
  70. package/message/childMessage.js +54 -54
  71. package/message/index.js +18 -18
  72. package/old-utils/index.js +91 -91
  73. package/package.json +38 -38
  74. package/ps/index.js +371 -371
  75. package/services/baseContextClass.js +34 -34
  76. package/services/index.js +40 -40
  77. package/socket/httpServer.js +147 -147
  78. package/socket/index.js +81 -81
  79. package/socket/io.js +27 -27
  80. package/socket/ipcServer.js +112 -112
  81. package/socket/socketServer.js +69 -67
  82. package/storage/index.js +38 -38
  83. package/storage/jsondb/adapters/Base.js +23 -23
  84. package/storage/jsondb/adapters/FileSync.js +64 -52
  85. package/storage/jsondb/main.js +55 -42
  86. package/storage/jsondbStorage.js +195 -195
  87. package/storage/sqliteStorage.js +123 -123
  88. package/utils/co.js +237 -237
  89. package/utils/copyto.js +160 -160
  90. package/utils/depd/index.js +538 -538
  91. package/utils/depd/lib/browser/index.js +77 -77
  92. package/utils/extend.js +73 -73
  93. package/utils/get-port/index.d.ts +64 -64
  94. package/utils/get-port/index.js +148 -148
  95. package/utils/helper.js +220 -220
  96. package/utils/index.js +160 -160
  97. package/utils/ip.js +261 -261
  98. package/utils/is.js +145 -145
  99. package/utils/json.js +72 -72
  100. package/utils/pargv.js +263 -263
  101. package/utils/time/index.js +19 -19
  102. package/utils/time/ms.js +162 -162
  103. package/utils/wrap.js +35 -35
@@ -1,113 +1,113 @@
1
- const debug = require('debug')('ee-core:ipcServer');
2
- const is = require('is-type-of');
3
- const { ipcMain } = require('electron');
4
- const path = require('path');
5
- const fs = require('fs');
6
- const globby = require('globby');
7
- const Utils = require('../core/lib/utils');
8
- const Wrap = require('../utils/wrap');
9
- const Log = require('../log');
10
-
11
- class IpcServer {
12
- constructor (app) {
13
- this.app = app;
14
- this.register();
15
- }
16
-
17
- register () {
18
- const self = this;
19
- // 遍历方法
20
- const files = Utils.filePatterns();
21
- const directory = path.join(this.app.config.baseDir, 'controller');
22
- const filepaths = globby.sync(files, { cwd: directory });
23
-
24
- for (const filepath of filepaths) {
25
- const fullpath = path.join(directory, filepath);
26
- if (!fs.statSync(fullpath).isFile()) continue;
27
-
28
- const properties = Wrap.getProperties(filepath, {caseStyle: 'lower'});
29
- const pathName = directory.split(/[/\\]/).slice(-1) + '.' + properties.join('.');
30
-
31
- let fileObj = Utils.loadFile(fullpath);
32
- const fns = {};
33
- // 为了统一,仅支持class文件
34
- if (is.class(fileObj) || Utils.isBytecodeClass(fileObj)) {
35
- let proto = fileObj.prototype;
36
- // 不遍历父类的方法
37
- //while (proto !== Object.prototype) {
38
- const keys = Object.getOwnPropertyNames(proto);
39
- for (const key of keys) {
40
- if (key === 'constructor') {
41
- continue;
42
- }
43
- const d = Object.getOwnPropertyDescriptor(proto, key);
44
- if (is.function(d.value) && !fns.hasOwnProperty(key)) {
45
- fns[key] = 1;
46
- }
47
- }
48
- //proto = Object.getPrototypeOf(proto);
49
- //}
50
- }
51
-
52
- debug('register class %s fns %j', pathName, fns);
53
-
54
- for (const key in fns) {
55
- let channel = pathName + '.' + key;
56
- debug('register channel %s', channel);
57
-
58
- function findFn (app, c) {
59
- try {
60
- // 找函数
61
- const cmd = c;
62
- let fn = null;
63
- if (is.string(cmd)) {
64
- const actions = cmd.split('.');
65
- let obj = app;
66
- actions.forEach(key => {
67
- obj = obj[key];
68
- if (!obj) throw new Error(`class or function '${key}' not exists`);
69
- });
70
- fn = obj;
71
- }
72
- if (!fn) throw new Error('function not exists');
73
-
74
- return fn;
75
- } catch (err) {
76
- Log.coreLogger.error('[ee-core] [socket/IpcServer] throw error:', err);
77
- }
78
- return null;
79
- }
80
-
81
- // send/on 模型
82
- ipcMain.on(channel, async (event, params) => {
83
- try {
84
- const fn = findFn(self.app, channel);
85
- const result = await fn.call(self.app, params, event);
86
-
87
- event.returnValue = result;
88
- event.reply(`${channel}`, result);
89
- } catch(e) {
90
- Log.coreLogger.error('[ee-core] [socket/IpcServer] send/on throw error:', e);
91
- // event.returnValue = e;
92
- // event.reply(`${channel}`, e);
93
- }
94
- });
95
-
96
- // invoke/handle 模型
97
- ipcMain.handle(channel, async (event, params) => {
98
- try {
99
- const fn = findFn(self.app, channel);
100
- const result = await fn.call(self.app, params, event);
101
-
102
- return result;
103
- } catch(e) {
104
- Log.coreLogger.error('[ee-core] [socket/IpcServer] invoke/handle throw error:', e);
105
- return e
106
- }
107
- });
108
- }
109
- }
110
- }
111
- }
112
-
1
+ const debug = require('debug')('ee-core:ipcServer');
2
+ const is = require('is-type-of');
3
+ const { ipcMain } = require('electron');
4
+ const path = require('path');
5
+ const fs = require('fs');
6
+ const globby = require('globby');
7
+ const Utils = require('../core/lib/utils');
8
+ const Wrap = require('../utils/wrap');
9
+ const Log = require('../log');
10
+
11
+ class IpcServer {
12
+ constructor (app) {
13
+ this.app = app;
14
+ this.register();
15
+ }
16
+
17
+ register () {
18
+ const self = this;
19
+ // 遍历方法
20
+ const files = Utils.filePatterns();
21
+ const directory = path.join(this.app.config.baseDir, 'controller');
22
+ const filepaths = globby.sync(files, { cwd: directory });
23
+
24
+ for (const filepath of filepaths) {
25
+ const fullpath = path.join(directory, filepath);
26
+ if (!fs.statSync(fullpath).isFile()) continue;
27
+
28
+ const properties = Wrap.getProperties(filepath, {caseStyle: 'lower'});
29
+ const pathName = directory.split(/[/\\]/).slice(-1) + '.' + properties.join('.');
30
+
31
+ let fileObj = Utils.loadFile(fullpath);
32
+ const fns = {};
33
+ // 为了统一,仅支持class文件
34
+ if (is.class(fileObj) || Utils.isBytecodeClass(fileObj)) {
35
+ let proto = fileObj.prototype;
36
+ // 不遍历父类的方法
37
+ //while (proto !== Object.prototype) {
38
+ const keys = Object.getOwnPropertyNames(proto);
39
+ for (const key of keys) {
40
+ if (key === 'constructor') {
41
+ continue;
42
+ }
43
+ const d = Object.getOwnPropertyDescriptor(proto, key);
44
+ if (is.function(d.value) && !fns.hasOwnProperty(key)) {
45
+ fns[key] = 1;
46
+ }
47
+ }
48
+ //proto = Object.getPrototypeOf(proto);
49
+ //}
50
+ }
51
+
52
+ debug('register class %s fns %j', pathName, fns);
53
+
54
+ for (const key in fns) {
55
+ let channel = pathName + '.' + key;
56
+ debug('register channel %s', channel);
57
+
58
+ function findFn (app, c) {
59
+ try {
60
+ // 找函数
61
+ const cmd = c;
62
+ let fn = null;
63
+ if (is.string(cmd)) {
64
+ const actions = cmd.split('.');
65
+ let obj = app;
66
+ actions.forEach(key => {
67
+ obj = obj[key];
68
+ if (!obj) throw new Error(`class or function '${key}' not exists`);
69
+ });
70
+ fn = obj;
71
+ }
72
+ if (!fn) throw new Error('function not exists');
73
+
74
+ return fn;
75
+ } catch (err) {
76
+ Log.coreLogger.error('[ee-core] [socket/IpcServer] throw error:', err);
77
+ }
78
+ return null;
79
+ }
80
+
81
+ // send/on 模型
82
+ ipcMain.on(channel, async (event, params) => {
83
+ try {
84
+ const fn = findFn(self.app, channel);
85
+ const result = await fn.call(self.app, params, event);
86
+
87
+ event.returnValue = result;
88
+ event.reply(`${channel}`, result);
89
+ } catch(e) {
90
+ Log.coreLogger.error('[ee-core] [socket/IpcServer] send/on throw error:', e);
91
+ // event.returnValue = e;
92
+ // event.reply(`${channel}`, e);
93
+ }
94
+ });
95
+
96
+ // invoke/handle 模型
97
+ ipcMain.handle(channel, async (event, params) => {
98
+ try {
99
+ const fn = findFn(self.app, channel);
100
+ const result = await fn.call(self.app, params, event);
101
+
102
+ return result;
103
+ } catch(e) {
104
+ Log.coreLogger.error('[ee-core] [socket/IpcServer] invoke/handle throw error:', e);
105
+ return e
106
+ }
107
+ });
108
+ }
109
+ }
110
+ }
111
+ }
112
+
113
113
  module.exports = IpcServer;
@@ -1,68 +1,70 @@
1
- 'use strict';
2
-
3
- const { Server } = require('socket.io');
4
- const is = require('is-type-of');
5
- const Log = require('../log');
6
- const Conf = require('../config');
7
- const Ps = require('../ps');
8
- const Channel = require('../const/channel');
9
-
10
- /**
11
- * socket server
12
- */
13
- class SocketServer {
14
- constructor (app) {
15
- this.app = app;
16
- this.socket = undefined;
17
- const options = Conf.getValue('socketServer');
18
-
19
- if (options.enable == false) {
20
- return;
21
- }
22
-
23
- let port = Ps.getSocketPort();
24
- if (!port) {
25
- throw new Error('[ee-core] [socket/socketServer] socekt port required, and must be a number !');
26
- }
27
-
28
- Log.coreLogger.info('[ee-core] [socket/socketServer] port is:', port);
29
-
30
- this.io = new Server(port, options);
31
- this.connec();
32
- }
33
-
34
- connec () {
35
- const app = this.app;
36
- this.io.on('connection', (socket) => {
37
- const channel = Channel.socketIo.partySoftware;
38
- this.socket = socket;
39
- socket.on(channel, async (message, callback) => {
40
- Log.coreLogger.info('[ee-core] [socket/socketServer] socket id:' + socket.id + ' message cmd: ' + message.cmd);
41
-
42
- try {
43
- // 找函数
44
- const cmd = message.cmd;
45
- const args = message.params;
46
- let fn = null;
47
- if (is.string(cmd)) {
48
- const actions = cmd.split('.');
49
- let obj = app;
50
- actions.forEach(key => {
51
- obj = obj[key];
52
- if (!obj) throw new Error(`class or function '${key}' not exists`);
53
- });
54
- fn = obj;
55
- }
56
- if (!fn) throw new Error('function not exists');
57
-
58
- const result = await fn.call(app, args);
59
- callback(result);
60
- } catch (err) {
61
- Log.coreLogger.error('[ee-core] [socket/socketServer] throw error:', err);
62
- }
63
- });
64
- });
65
- }
66
- }
67
-
1
+ 'use strict';
2
+
3
+ const { Server } = require('socket.io');
4
+ const is = require('is-type-of');
5
+ const Log = require('../log');
6
+ const Conf = require('../config/cache');
7
+ const Ps = require('../ps');
8
+ const Channel = require('../const/channel');
9
+
10
+ /**
11
+ * socket server
12
+ */
13
+ class SocketServer {
14
+ constructor (app) {
15
+ this.app = app;
16
+ this.socket = undefined;
17
+ const options = Conf.getValue('socketServer');
18
+
19
+ if (options.enable == false) {
20
+ return;
21
+ }
22
+
23
+ let port = Ps.getSocketPort();
24
+ if (!port) {
25
+ throw new Error('[ee-core] [socket/socketServer] socekt port required, and must be a number !');
26
+ }
27
+
28
+ Log.coreLogger.info('[ee-core] [socket/socketServer] port is:', port);
29
+
30
+ this.io = new Server(port, options);
31
+ this.connec(options);
32
+ }
33
+
34
+ connec (opt = {}) {
35
+ const app = this.app;
36
+ this.io.on('connection', (socket) => {
37
+ const channel = opt.channel || Channel.socketIo.partySoftware;
38
+ this.socket = socket;
39
+ socket.on(channel, async (message, callback) => {
40
+ Log.coreLogger.info('[ee-core] [socket/socketServer] socket id:' + socket.id + ' message cmd: ' + message.cmd);
41
+
42
+ try {
43
+ // 找函数
44
+ const cmd = message.cmd;
45
+ const args = message.args || message.params;
46
+ let fn = null;
47
+ if (is.string(cmd)) {
48
+ const actions = cmd.split('.');
49
+ let obj = app;
50
+ actions.forEach(key => {
51
+ obj = obj[key];
52
+ if (!obj) throw new Error(`class or function '${key}' not exists`);
53
+ });
54
+ fn = obj;
55
+ }
56
+ if (!fn) throw new Error('function not exists');
57
+
58
+ const result = await fn.call(app, args);
59
+ if (callback) {
60
+ callback(result);
61
+ }
62
+ } catch (err) {
63
+ Log.coreLogger.error('[ee-core] [socket/socketServer] throw error:', err);
64
+ }
65
+ });
66
+ });
67
+ }
68
+ }
69
+
68
70
  module.exports = SocketServer;
package/storage/index.js CHANGED
@@ -1,39 +1,39 @@
1
- const assert = require('assert');
2
- const _ = require('lodash');
3
- const DB = {};
4
-
5
- // jsondb 要么每次new对象,要么所有地方都用同一个实例,否则会出现数据无法刷新的情况
6
-
7
- DB.connection = function (database, options = {}) {
8
- let driver = options.driver || 'jsondb';
9
-
10
- // 兼容之前api
11
- driver = driver == 'lowdb' ? 'jsondb' : driver;
12
-
13
- let opt = options.default || {};
14
- if (!_.includes(['jsondb', 'sqlite'], driver)) {
15
- assert(database, `db driver ${driver} is not supported`);
16
- }
17
- if (_.isEmpty(database)) {
18
- assert(database, `db name ${database} Cannot be empty`);
19
- }
20
- let storage;
21
- switch (driver) {
22
- case 'jsondb':
23
- const JsondbStorage = require('./jsondbStorage');
24
- storage = new JsondbStorage(database);
25
- break;
26
- case 'sqlite':
27
- const SqliteStorage = require('./sqliteStorage');
28
- storage = new SqliteStorage(database, opt);
29
- break;
30
- default:
31
- }
32
-
33
- return storage;
34
- }
35
-
36
- // 兼容之前的api
37
- DB.JsonDB = DB;
38
-
1
+ const assert = require('assert');
2
+ const _ = require('lodash');
3
+ const DB = {};
4
+
5
+ // jsondb 要么每次new对象,要么所有地方都用同一个实例,否则会出现数据无法刷新的情况
6
+
7
+ DB.connection = function (database, options = {}) {
8
+ let driver = options.driver || 'jsondb';
9
+
10
+ // 兼容之前api
11
+ driver = driver == 'lowdb' ? 'jsondb' : driver;
12
+
13
+ let opt = options.default || {};
14
+ if (!_.includes(['jsondb', 'sqlite'], driver)) {
15
+ assert(database, `db driver ${driver} is not supported`);
16
+ }
17
+ if (_.isEmpty(database)) {
18
+ assert(database, `db name ${database} Cannot be empty`);
19
+ }
20
+ let storage;
21
+ switch (driver) {
22
+ case 'jsondb':
23
+ const JsondbStorage = require('./jsondbStorage');
24
+ storage = new JsondbStorage(database);
25
+ break;
26
+ case 'sqlite':
27
+ const SqliteStorage = require('./sqliteStorage');
28
+ storage = new SqliteStorage(database, opt);
29
+ break;
30
+ default:
31
+ }
32
+
33
+ return storage;
34
+ }
35
+
36
+ // 兼容之前的api
37
+ DB.JsonDB = DB;
38
+
39
39
  module.exports = DB;
@@ -1,23 +1,23 @@
1
- class Base {
2
- constructor(source) {
3
- this.source = source
4
- this.defaultValue = {}
5
- this.serialize = this._stringify
6
- this.deserialize = JSON.parse
7
- }
8
-
9
- _canDeserialized(obj) {
10
- try {
11
- this.deserialize(obj)
12
- return true
13
- } catch (e) {
14
- return false
15
- }
16
- }
17
-
18
- _stringify(obj) {
19
- return JSON.stringify(obj, null, 2)
20
- }
21
- }
22
-
23
- module.exports = Base
1
+ class Base {
2
+ constructor(source) {
3
+ this.source = source
4
+ this.defaultValue = {}
5
+ this.serialize = this._stringify
6
+ this.deserialize = JSON.parse
7
+ }
8
+
9
+ _canDeserialized(obj) {
10
+ try {
11
+ this.deserialize(obj)
12
+ return true
13
+ } catch (e) {
14
+ return false
15
+ }
16
+ }
17
+
18
+ _stringify(obj) {
19
+ return JSON.stringify(obj, null, 2)
20
+ }
21
+ }
22
+
23
+ module.exports = Base
@@ -1,52 +1,64 @@
1
- const Base = require('./Base')
2
- const fs = require('fs')
3
- const Log = require('../../../log')
4
-
5
- class FileSync extends Base {
6
-
7
- constructor(options = {}) {
8
- const { source, isSysDB } = options;
9
- super(source);
10
- this.isSysDB = isSysDB;
11
- }
12
-
13
- read() {
14
- if (fs.existsSync(this.source)) {
15
- // Read database
16
- const data = fs.readFileSync(this.source, {encoding: 'utf8'}).trim();
17
-
18
- const canDeserialized = this._canDeserialized(data);
19
- if (!canDeserialized) {
20
- const errMessage = `Malformed JSON in file: ${this.source}\n${data}`;
21
- console.error(errMessage)
22
-
23
- // reset system.json
24
- if (this.isSysDB) {
25
- this._fsWrite(this.defaultValue);
26
- }
27
- }
28
- const value = canDeserialized ? this.deserialize(data) : this.defaultValue;
29
- return value;
30
- } else {
31
- // Initialize
32
- this._fsWrite(this.defaultValue);
33
- return this.defaultValue
34
- }
35
- }
36
-
37
- write(data) {
38
- return this._fsWrite(data);
39
- }
40
-
41
- _fsWrite(data) {
42
- const isObject = Object.prototype.toString.call(data) === '[object Object]';
43
- if (!isObject) {
44
- Log.coreLogger.error('[ee-core] [storage/jsondb] Variable is not an object :', data);
45
- return
46
- }
47
-
48
- return fs.writeFileSync(this.source, this.serialize(data), {flag:'w+'})
49
- }
50
- }
51
-
52
- module.exports = FileSync
1
+ const Base = require('./Base')
2
+ const fs = require('fs')
3
+ const Log = require('../../../log')
4
+
5
+ class FileSync extends Base {
6
+
7
+ constructor(options = {}) {
8
+ const { source, isSysDB } = options;
9
+ super(source);
10
+ this.isSysDB = isSysDB;
11
+ }
12
+
13
+ read() {
14
+ if (fs.existsSync(this.source)) {
15
+ // Read database
16
+ let data = fs.readFileSync(this.source, {encoding: 'utf8'}).trim();
17
+
18
+ // 是否可以正常解析
19
+ let canDeserialized = this._canDeserialized(data);
20
+ if (!canDeserialized) {
21
+ let errMessage = `[ee-core] [storage/jsondb] malformed json in file: ${this.source}\n${data}`;
22
+ Log.coreLogger.error(errMessage);
23
+
24
+ // 是否文件结尾多一个括号,尝试处理
25
+ data = data.trim().slice(0, -1);
26
+ canDeserialized = this._canDeserialized(data);
27
+ if (canDeserialized) {
28
+ // 转换为对象,并写入
29
+ const newData = JSON.parse(data);
30
+ this._fsWrite(newData);
31
+ } else {
32
+ // [todo] 重置 system.json ,不处理用户数据
33
+ if (this.isSysDB) {
34
+ this._fsWrite(this.defaultValue);
35
+ }
36
+ errMessage = '[ee-core] [storage/jsondb] malformed json that cannot be handled!';
37
+ Log.coreLogger.error(errMessage);
38
+ }
39
+ }
40
+ const value = canDeserialized ? this.deserialize(data) : this.defaultValue;
41
+ return value;
42
+ } else {
43
+ // Initialize
44
+ this._fsWrite(this.defaultValue);
45
+ return this.defaultValue
46
+ }
47
+ }
48
+
49
+ write(data) {
50
+ return this._fsWrite(data);
51
+ }
52
+
53
+ _fsWrite(data) {
54
+ const isObject = Object.prototype.toString.call(data) === '[object Object]';
55
+ if (!isObject) {
56
+ Log.coreLogger.error('[ee-core] [storage/jsondb] Variable is not an object :', data);
57
+ return
58
+ }
59
+
60
+ return fs.writeFileSync(this.source, this.serialize(data), {flag:'w+'})
61
+ }
62
+ }
63
+
64
+ module.exports = FileSync