@iobroker/legacy-testing 0.2.3 → 0.2.5

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 (3) hide show
  1. package/README.md +1 -1
  2. package/package.json +1 -1
  3. package/setup.js +202 -213
package/README.md CHANGED
@@ -11,7 +11,7 @@ Legacy test modules for ioBroker
11
11
 
12
12
  ## Changelog
13
13
  <!-- ### **WORK IN PROGRESS** -->
14
- ### 0.2.3 (2023-05-07)
14
+ ### 0.2.5 (2023-05-07)
15
15
  * (bluefox) Added possibility to install additional adapters at start
16
16
  * (bluefox) Added setOfflineState/getOfflineState
17
17
 
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.2.3",
2
+ "version": "0.2.5",
3
3
  "name": "@iobroker/legacy-testing",
4
4
  "main": "setup.js",
5
5
  "files": [
package/setup.js CHANGED
@@ -8,6 +8,7 @@ const path = require('path');
8
8
  const child_process = require('child_process');
9
9
  const rootDir = path.normalize(`${__dirname}/../../../`);
10
10
  const pkg = require(`${rootDir}package.json`);
11
+ const cp = require('child_process');
11
12
  const debug = typeof v8debug === 'object';
12
13
  pkg.main = pkg.main || 'main.js';
13
14
 
@@ -15,7 +16,12 @@ let JSONLDB;
15
16
 
16
17
  let adapterName = path.normalize(rootDir).replace(/\\/g, '/').split('/');
17
18
  adapterName = adapterName[adapterName.length - 2];
18
- let adapterStarted = false;
19
+ const adaptersStarted = {};
20
+ const pids = {};
21
+
22
+ let objects;
23
+ let states;
24
+ let systemConfig = null;
19
25
 
20
26
  function getAppName() {
21
27
  const parts = rootDir.replace(/\\/g, '/').split('/');
@@ -23,6 +29,8 @@ function getAppName() {
23
29
  return parts.pop().split('.')[0];
24
30
  }
25
31
 
32
+ const appName = getAppName().toLowerCase();
33
+
26
34
  function loadJSONLDB() {
27
35
  if (!JSONLDB) {
28
36
  const dbPath = require.resolve('@alcalzone/jsonl-db', {
@@ -38,15 +46,6 @@ function loadJSONLDB() {
38
46
  }
39
47
  }
40
48
 
41
- const appName = getAppName().toLowerCase();
42
-
43
- let objects;
44
- let states;
45
-
46
- let pid = null;
47
-
48
- let systemConfig = null;
49
-
50
49
  function copyFileSync(source, target) {
51
50
  let targetFile = target;
52
51
 
@@ -189,54 +188,26 @@ async function checkIsAdapterInstalled(cb, counter, customAdapterName, customIns
189
188
  customAdapterName = customAdapterName || pkg.name.split('.').pop();
190
189
  counter = counter || 0;
191
190
  const dataDir = `${rootDir}tmp/${appName}-data/`;
192
- console.log('checkIsAdapterInstalled...');
191
+ console.log(`[${customAdapterName}] checkIsAdapterInstalled...`);
193
192
 
194
193
  try {
195
- if (fs.existsSync(`${dataDir}objects.json`)) {
196
- const f = fs.readFileSync(`${dataDir}objects.json`);
197
- const objects = JSON.parse(f.toString());
198
- if (objects[`system.adapter.${customAdapterName}.${customInstance || 0}`]) {
199
- console.log('checkIsAdapterInstalled: ready!');
200
- setTimeout(() => cb && cb(), 100);
201
- return;
202
- } else {
203
- console.warn('checkIsAdapterInstalled: still not ready');
204
- }
205
- } else if (fs.existsSync(`${dataDir}objects.jsonl`)) {
206
- loadJSONLDB();
207
- const db = new JSONLDB(`${dataDir}objects.jsonl`);
208
- try {
209
- await db.open();
210
- } catch (err) {
211
- if (err.message.includes('Failed to lock DB file')) {
212
- console.log('checkIsAdapterInstalled: DB still opened ...');
213
- }
214
- throw err;
215
- }
216
-
217
- const obj = db.get(`system.adapter.${customAdapterName}.${customInstance || 0}`);
218
- await db.close();
219
-
220
- if (obj) {
221
- console.log('checkIsAdapterInstalled: ready!');
222
- setTimeout(() => cb && cb(), 100);
223
- return;
224
- } else {
225
- console.warn('checkIsAdapterInstalled: still not ready');
226
- }
194
+ const obj = await getObject(`system.adapter.${customAdapterName}.${customInstance || 0}`)
195
+ if (obj) {
196
+ console.log(`[${customAdapterName}] checkIsAdapterInstalled: ready!`);
197
+ setTimeout(() => cb && cb(), 100);
198
+ return;
227
199
  } else {
228
- console.error(`checkIsAdapterInstalled: No objects file found in datadir ${dataDir}`);
200
+ console.warn(`[${customAdapterName}] checkIsAdapterInstalled: still not ready`);
229
201
  }
230
-
231
202
  } catch (err) {
232
- console.log(`checkIsAdapterInstalled: catch ${err}`);
203
+ console.log(`[${customAdapterName}] checkIsAdapterInstalled: catch ${err}`);
233
204
  }
234
205
 
235
206
  if (counter > 20) {
236
- console.error('checkIsAdapterInstalled: Cannot install!');
207
+ console.error(`[${customAdapterName}] checkIsAdapterInstalled: Cannot install!`);
237
208
  cb && cb('Cannot install');
238
209
  } else {
239
- console.log('checkIsAdapterInstalled: wait...');
210
+ console.log(`[${customAdapterName}] checkIsAdapterInstalled: wait...`);
240
211
  setTimeout(() => checkIsAdapterInstalled(cb, counter + 1, customAdapterName, customInstance), 1000);
241
212
  }
242
213
  }
@@ -247,37 +218,11 @@ async function checkIsControllerInstalled(cb, counter) {
247
218
 
248
219
  console.log('checkIsControllerInstalled...');
249
220
  try {
250
- if (fs.existsSync(`${dataDir}objects.json`)) {
251
- const f = fs.readFileSync(`${dataDir}objects.json`);
252
- const objects = JSON.parse(f.toString());
253
- if (objects['system.certificates']) {
254
- console.log('checkIsControllerInstalled: installed!');
255
- setTimeout(() => cb && cb(), 100);
256
- return;
257
- }
258
- } else if (fs.existsSync(`${dataDir}objects.jsonl`)) {
259
- loadJSONLDB();
260
- const db = new JSONLDB(`${dataDir}objects.jsonl`);
261
- try {
262
- await db.open();
263
- } catch (err) {
264
- if (err.message.includes('Failed to lock DB file')) {
265
- console.log('checkIsControllerInstalled: DB still opened ...');
266
- }
267
- throw err;
268
- }
269
-
270
- const obj = db.get('system.certificates');
271
- await db.close();
272
-
273
- if (obj) {
274
- console.log('checkIsControllerInstalled: installed!');
275
- setTimeout(() => cb && cb(), 100);
276
- return;
277
- }
278
-
279
- } else {
280
- console.error(`checkIsControllerInstalled: No objects file found in datadir ${dataDir}`);
221
+ const obj = await getObject('system.certificates');
222
+ if (obj) {
223
+ console.log('checkIsControllerInstalled: installed!');
224
+ setTimeout(() => cb && cb(), 100);
225
+ return;
281
226
  }
282
227
  } catch (err) {
283
228
  // ignore
@@ -298,7 +243,12 @@ function installAdapter(customAdapterName, cb) {
298
243
  customAdapterName = null;
299
244
  }
300
245
  customAdapterName = customAdapterName || pkg.name.split('.').pop();
301
- console.log('Install adapter...');
246
+ console.log(`[${customAdapterName}] Install adapter...`);
247
+
248
+ if (customAdapterName.includes('@')) {
249
+ installCustomAdapter(customAdapterName);
250
+ }
251
+
302
252
  const startFile = `node_modules/${appName}.js-controller/${appName}.js`;
303
253
  // make first install
304
254
  if (debug) {
@@ -308,7 +258,7 @@ function installAdapter(customAdapterName, cb) {
308
258
  });
309
259
  checkIsAdapterInstalled(error => {
310
260
  error && console.error(error);
311
- console.log('Adapter installed.');
261
+ console.log(`[${customAdapterName}] Adapter installed.`);
312
262
  cb && cb();
313
263
  }, 0, customAdapterName);
314
264
  } else {
@@ -321,7 +271,7 @@ function installAdapter(customAdapterName, cb) {
321
271
  waitForEnd(_pid, () =>
322
272
  checkIsAdapterInstalled(error => {
323
273
  error && console.error(error);
324
- console.log('Adapter installed.');
274
+ console.log(`[${customAdapterName}] Adapter installed.`);
325
275
  cb && cb();
326
276
  }, 0, customAdapterName));
327
277
  }
@@ -516,6 +466,16 @@ function copyAdapterToController() {
516
466
  console.log('Adapter copied.');
517
467
  }
518
468
 
469
+ function installCustomAdapter(adapterName) {
470
+ if (!fs.existsSync(`${rootDir}tmp/node_modules/${adapterName}`)) {
471
+ console.log(`Install ${adapterName}`);
472
+ cp.execSync(`npm install ${adapterName} --prefix ./ --production`, {
473
+ cwd: `${rootDir}tmp/`,
474
+ stdio: [0, 1, 2],
475
+ });
476
+ }
477
+ }
478
+
519
479
  function clearControllerLog() {
520
480
  const dirPath = `${rootDir}tmp/log`;
521
481
  let files;
@@ -584,79 +544,75 @@ function setupController(preInstalledAdapters, cb) {
584
544
  restoreOriginalFiles();
585
545
  copyAdapterToController();
586
546
  }
587
- // read system.config object
588
- const dataDir = `${rootDir}tmp/${appName}-data/`;
589
-
590
- if (fs.existsSync(`${dataDir}objects.json`)) {
591
- let objs;
592
- try {
593
- objs = fs.readFileSync(`${dataDir}objects.json`);
594
- objs = JSON.parse(objs);
595
- } catch (e) {
596
- console.log('ERROR reading/parsing system configuration. Ignore');
597
- objs = {'system.config': {}};
598
- }
599
- if (!objs || !objs['system.config']) {
600
- objs = {'system.config': {}};
601
- }
602
547
 
603
- systemConfig = objs['system.config'];
604
- cb && cb(objs['system.config']);
605
- } else if (fs.existsSync(`${dataDir}objects.jsonl`)) {
606
- loadJSONLDB();
607
- const db = new JSONLDB(`${dataDir}objects.jsonl`);
608
- await db.open();
609
-
610
- const config = db.get('system.config');
611
- systemConfig = config || {};
612
-
613
- await db.close();
614
-
615
- cb && cb(systemConfig);
616
- } else {
617
- console.error(`read SystemConfig: No objects file found in datadir ${dataDir}`);
618
- }
548
+ // read system.config object
549
+ const config = await getObject('system.config');
550
+ systemConfig = config || {};
551
+ cb && cb(systemConfig);
619
552
  } catch (err) {
620
553
  console.error(`setupController: ${err}`);
621
554
  }
622
555
  });
623
556
  }
624
557
 
625
- async function getSecret() {
626
- const dataDir = `${rootDir}tmp/${appName}-data/`;
627
-
628
- if (systemConfig) {
629
- return systemConfig.native.secret;
630
- }
631
- if (fs.existsSync(`${dataDir}objects.json`)) {
632
- let objs;
558
+ async function getObject(id){
559
+ if (fs.existsSync(`${rootDir}tmp/${appName}-data/objects.json`)) {
560
+ const objects = JSON.parse(fs.readFileSync(`${rootDir}tmp/${appName}-data/objects.json`).toString());
561
+ return objects[id];
562
+ } else if (fs.existsSync(`${rootDir}tmp/${appName}-data/objects.jsonl`)) {
563
+ loadJSONLDB();
564
+ const db = new JSONLDB(`${rootDir}tmp/${appName}-data/objects.jsonl`);
633
565
  try {
634
- objs = fs.readFileSync(`${dataDir}objects.json`);
635
- objs = JSON.parse(objs);
636
- } catch (e) {
637
- console.warn(`Could not load secret. Reason: ${e}`);
638
- return null;
639
- }
640
- if (!objs || !objs['system.config']) {
641
- objs = {'system.config': {}};
566
+ await db.open();
567
+ } catch (err) {
568
+ if (err.message.includes('Failed to lock DB file')) {
569
+ console.log(`getObject: DB still opened ...`);
570
+ }
571
+ throw err;
642
572
  }
643
573
 
644
- return objs['system.config'].native.secre;
645
- } else if (fs.existsSync(`${dataDir}objects.jsonl`)) {
646
- loadJSONLDB();
647
- const db = new JSONLDB(`${dataDir}objects.jsonl`);
648
- await db.open();
574
+ const obj = db.get(id) || {};
575
+ await db.close();
576
+ return obj;
577
+ } else {
578
+ console.error(`setAdapterConfig: No objects file found in datadir ${rootDir}tmp/${appName}-data/`);
579
+ return null;
580
+ }
581
+ }
649
582
 
650
- let config = db.get('system.config');
651
- config = config || {};
583
+ async function setObject(id, obj){
584
+ if (fs.existsSync(`${rootDir}tmp/${appName}-data/objects.json`)) {
585
+ const objects = JSON.parse(fs.readFileSync(`${rootDir}tmp/${appName}-data/objects.json`).toString());
586
+ objects[id] = obj;
587
+ } else if (fs.existsSync(`${rootDir}tmp/${appName}-data/objects.jsonl`)) {
588
+ loadJSONLDB();
589
+ const db = new JSONLDB(`${rootDir}tmp/${appName}-data/objects.jsonl`);
590
+ try {
591
+ await db.open();
592
+ } catch (err) {
593
+ if (err.message.includes('Failed to lock DB file')) {
594
+ console.log(`getObject: DB still opened ...`);
595
+ }
596
+ throw err;
597
+ }
652
598
 
599
+ db.set(id, obj);
653
600
  await db.close();
654
-
655
- return config.native.secret;
601
+ return obj;
656
602
  } else {
657
- console.error(`read secret: No objects file found in datadir ${dataDir}`);
603
+ console.error(`setAdapterConfig: No objects file found in datadir ${rootDir}tmp/${appName}-data/`);
604
+ return null;
658
605
  }
606
+ }
659
607
 
608
+ async function getSecret() {
609
+ const dataDir = `${rootDir}tmp/${appName}-data/`;
610
+
611
+ if (systemConfig) {
612
+ return systemConfig.native.secret;
613
+ }
614
+ systemConfig = await getObject('system.config');
615
+ return systemConfig.native.secret;
660
616
  }
661
617
 
662
618
  function encrypt (key, value) {
@@ -668,24 +624,25 @@ function encrypt (key, value) {
668
624
  }
669
625
 
670
626
  function startAdapter(objects, states, callback) {
671
- if (adapterStarted) {
627
+ const id = `${pkg.name}.0`;
628
+ if (adaptersStarted[id]) {
672
629
  console.log('Adapter already started ...');
673
630
  callback && callback(objects, states);
674
631
  return;
675
632
  }
676
- adapterStarted = true;
633
+ adaptersStarted[id] = true;
677
634
  console.log('startAdapter...');
678
635
  if (fs.existsSync(`${rootDir}tmp/node_modules/${pkg.name}/${pkg.main}`)) {
679
636
  try {
680
637
  if (debug) {
681
638
  // start controller
682
- pid = child_process.exec(`node node_modules/${pkg.name}/${pkg.main} --console silly`, {
639
+ pids[id] = child_process.exec(`node node_modules/${pkg.name}/${pkg.main} --console silly`, {
683
640
  cwd: `${rootDir}tmp`,
684
641
  stdio: [0, 1, 2]
685
642
  });
686
643
  } else {
687
644
  // start controller
688
- pid = child_process.fork(`node_modules/${pkg.name}/${pkg.main}`, ['--console', 'silly'], {
645
+ pids[id] = child_process.fork(`node_modules/${pkg.name}/${pkg.main}`, ['--console', 'silly'], {
689
646
  cwd: `${rootDir}tmp`,
690
647
  stdio: [0, 1, 2, 'ipc']
691
648
  });
@@ -699,6 +656,39 @@ function startAdapter(objects, states, callback) {
699
656
  callback && callback(objects, states);
700
657
  }
701
658
 
659
+ function startCustomAdapter(adapterName, adapterInstance) {
660
+ adapterInstance = adapterInstance || 0;
661
+ const id = `${adapterName}.${adapterInstance}`;
662
+ if (adaptersStarted[id]) {
663
+ console.log(`Adapter ${id} already started ...`);
664
+ return;
665
+ }
666
+ adaptersStarted[`${id}`] = true;
667
+ console.log(`startAdapter ${id} ...`);
668
+ const _pkg = require(`${rootDir}tmp/node_modules/iobroker.${adapterName}/package.json`);
669
+ if (fs.existsSync(`${rootDir}tmp/node_modules/iobroker.${adapterName}/${_pkg.main || 'main.js'}`)) {
670
+ try {
671
+ if (debug) {
672
+ // start controller
673
+ pids[`${pkg.name}.0`] = child_process.exec(`node node_modules/iobroker.${adapterName}/${_pkg.main || 'main.js'} ${adapterInstance} --debug --console silly`, {
674
+ cwd: `${rootDir}tmp`,
675
+ stdio: [0, 1, 2]
676
+ });
677
+ } else {
678
+ // start controller
679
+ pids[`${pkg.name}.0`] = child_process.fork(`node_modules/iobroker.${adapterName}/${_pkg.main || 'main.js'}`, [adapterInstance, '--debug ', '--console', 'silly'], {
680
+ cwd: `${rootDir}tmp`,
681
+ stdio: [0, 1, 2, 'ipc']
682
+ });
683
+ }
684
+ } catch (error) {
685
+ console.error(JSON.stringify(error));
686
+ }
687
+ } else {
688
+ console.error(`Cannot find: ${rootDir}tmp/node_modules/iobroker.${adapterName}/${_pkg.main || 'main.js'}`);
689
+ }
690
+ }
691
+
702
692
  function startController(isStartAdapter, onObjectChange, onStateChange, callback) {
703
693
  if (typeof isStartAdapter === 'function') {
704
694
  callback = onStateChange;
@@ -712,14 +702,14 @@ function startController(isStartAdapter, onObjectChange, onStateChange, callback
712
702
  onObjectChange = undefined;
713
703
  }
714
704
 
715
- if (pid) {
705
+ if (pids[`${pkg.name}.0`]) {
716
706
  console.error('Controller is already started!');
717
707
  } else {
718
708
  console.log('startController...');
719
709
  try {
720
710
  const config = require(`${rootDir}tmp/${appName}-data/${appName}.json`);
721
711
 
722
- adapterStarted = false;
712
+ adaptersStarted[`${pkg.name}.0`] = false;
723
713
  let isObjectConnected;
724
714
  let isStatesConnected;
725
715
 
@@ -819,27 +809,56 @@ function startController(isStartAdapter, onObjectChange, onStateChange, callback
819
809
  }
820
810
 
821
811
  function stopAdapter(cb) {
822
- if (!pid) {
812
+ const id = `${pkg.name}.0`;
813
+ if (!pids[id]) {
823
814
  console.error('Controller is not running!');
824
815
  cb && setTimeout(() => cb(false), 0);
825
816
  } else {
826
- adapterStarted = false;
827
- pid.on('exit', (code, signal) => {
828
- if (pid) {
817
+ adaptersStarted[id] = false;
818
+ pids[id].on('exit', (code, signal) => {
819
+ if (pids[id]) {
829
820
  console.log(`child process terminated due to receipt of signal ${signal}`);
830
821
  cb && cb();
831
- pid = null;
822
+ pids[id] = null;
832
823
  }
833
824
  });
834
825
 
835
- pid.on('close', (/* code, signal */) => {
836
- if (pid) {
826
+ pids[id].on('close', (/* code, signal */) => {
827
+ if (pids[id]) {
837
828
  cb && cb();
838
- pid = null;
829
+ pids[id] = null;
839
830
  }
840
831
  });
841
832
 
842
- pid.kill('SIGTERM');
833
+ pids[id].kill('SIGTERM');
834
+ }
835
+ }
836
+
837
+ function stopCustomAdapter(adapterName, adapterInstance) {
838
+ const id = `${pkg.name}.0`;
839
+ if (!pids[id]) {
840
+ console.error('Controller is not running!');
841
+ return Promise.resolve()
842
+ } else {
843
+ adaptersStarted[id] = false;
844
+ return new Promise(resolve => {
845
+ pids[id].on('exit', (code, signal) => {
846
+ if (pids[id]) {
847
+ console.log(`child process terminated due to receipt of signal ${signal}`);
848
+ pids[id] = null;
849
+ resolve();
850
+ }
851
+ });
852
+
853
+ pids[id].on('close', (/* code, signal */) => {
854
+ if (pids[id]) {
855
+ pids[id] = null;
856
+ resolve();
857
+ }
858
+ });
859
+
860
+ pids[id].kill('SIGTERM');
861
+ });
843
862
  }
844
863
  }
845
864
 
@@ -860,8 +879,8 @@ function stopController(cb) {
860
879
  console.log(`Set system.adapter.${pkg.name}.0`);
861
880
  objects.setObject(`system.adapter.${pkg.name}.0`, {
862
881
  common: {
863
- enabled: false
864
- }
882
+ enabled: false,
883
+ },
865
884
  });
866
885
  }
867
886
 
@@ -889,60 +908,26 @@ function stopController(cb) {
889
908
  cb(false);
890
909
  cb = null;
891
910
  }
892
- pid = null;
911
+ pids[`${pkg.name}.0`] = null;
893
912
  }, 5000);
894
913
  }
895
914
 
896
915
  // Set up the adapter
897
916
  async function setAdapterConfig(common, native, instance, customAdapterName) {
898
- const id = `system.adapter.${(adapterName || customAdapterName).split('.').pop()}.${instance || 0}`;
899
- if (fs.existsSync(`${rootDir}tmp/${appName}-data/objects.json`)) {
900
- const objects = JSON.parse(fs.readFileSync(`${rootDir}tmp/${appName}-data/objects.json`).toString());
901
- if (common) {
902
- objects[id].common = common;
903
- }
904
- if (native) {
905
- objects[id].native = native;
906
- }
907
- fs.writeFileSync(`${rootDir}tmp/${appName}-data/objects.json`, JSON.stringify(objects));
908
- } else if (fs.existsSync(`${rootDir}tmp/${appName}-data/objects.jsonl`)) {
909
- loadJSONLDB();
910
- const db = new JSONLDB(`${rootDir}tmp/${appName}-data/objects.jsonl`);
911
- await db.open();
912
-
913
- const obj = db.get(id);
914
- if (common) {
915
- obj.common = common;
916
- }
917
- if (native) {
918
- obj.native = native;
919
- }
920
- db.set(id, obj);
921
-
922
- await db.close();
923
- } else {
924
- console.error(`setAdapterConfig: No objects file found in datadir ${rootDir}tmp/${appName}-data/`);
917
+ const id = `system.adapter.${(customAdapterName || adapterName).split('.').pop()}.${instance || 0}`;
918
+ const obj = (await getObject(id)) || {};
919
+ if (common) {
920
+ obj.common = common;
925
921
  }
922
+ if (native) {
923
+ obj.native = native;
924
+ }
925
+ await setObject(id, obj);
926
926
  }
927
927
 
928
928
  // Read config of the adapter
929
929
  async function getAdapterConfig(instance, customAdapterName) {
930
- const id = `system.adapter.${(adapterName || customAdapterName).split('.').pop()}.${instance || 0}`;
931
- if (fs.existsSync(`${rootDir}tmp/${appName}-data/objects.json`)) {
932
- const objects = JSON.parse(fs.readFileSync(`${rootDir}tmp/${appName}-data/objects.json`).toString());
933
- return objects[id];
934
- } else if (fs.existsSync(`${rootDir}tmp/${appName}-data/objects.jsonl`)) {
935
- loadJSONLDB();
936
- const db = new JSONLDB(`${rootDir}tmp/${appName}-data/objects.jsonl`);
937
- await db.open();
938
-
939
- const obj = db.get(id);
940
-
941
- await db.close();
942
- return obj;
943
- } else {
944
- console.error(`getAdapterConfig: No objects file found in datadir ${rootDir}tmp/${appName}-data/`);
945
- }
930
+ return getObject(`system.adapter.${(customAdapterName || adapterName).split('.').pop()}.${instance || 0}`);
946
931
  }
947
932
 
948
933
  async function setOfflineState(id, state) {
@@ -985,17 +970,21 @@ async function getOfflineState(id) {
985
970
  if (typeof module !== undefined && module.parent) {
986
971
  module.exports.getAdapterConfig = getAdapterConfig;
987
972
  module.exports.setAdapterConfig = setAdapterConfig;
988
- module.exports.startController = startController;
989
- module.exports.stopController = stopController;
990
- module.exports.setupController = setupController;
991
- module.exports.stopAdapter = stopAdapter;
992
- module.exports.startAdapter = startAdapter;
993
- module.exports.installAdapter = installAdapter;
994
- module.exports.appName = appName;
995
- module.exports.adapterName = adapterName;
996
- module.exports.adapterStarted = adapterStarted;
997
- module.exports.getSecret = getSecret;
998
- module.exports.encrypt = encrypt;
999
- module.exports.setOfflineState = setOfflineState;
1000
- module.exports.getOfflineState = getOfflineState;
973
+ module.exports.startController = startController;
974
+ module.exports.stopController = stopController;
975
+ module.exports.setupController = setupController;
976
+ module.exports.stopAdapter = stopAdapter;
977
+ module.exports.startAdapter = startAdapter;
978
+ module.exports.installAdapter = installAdapter;
979
+ module.exports.appName = appName;
980
+ module.exports.adapterName = adapterName;
981
+ module.exports.getSecret = getSecret;
982
+ module.exports.encrypt = encrypt;
983
+ module.exports.setOfflineState = setOfflineState;
984
+ module.exports.getOfflineState = getOfflineState;
985
+ module.exports.stopCustomAdapter = stopCustomAdapter;
986
+ module.exports.startCustomAdapter = startCustomAdapter;
987
+ module.exports.installCustomAdapter = installCustomAdapter;
988
+ module.exports.getObject = getObject;
989
+ module.exports.setObject = setObject;
1001
990
  }