@iobroker/js-controller-adapter 4.0.0-alpha.49-20220121-e7aa4308 → 4.0.0-alpha.52-20220126-dad3d5b3
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.
|
@@ -350,9 +350,9 @@ declare class Adapter {
|
|
|
350
350
|
getEncryptedConfig: ((attribute: string, callback?: ((error: Error | null | undefined, result?: string | undefined) => void) | undefined) => Promise<any>) | undefined;
|
|
351
351
|
/**
|
|
352
352
|
* Same as setTimeout
|
|
353
|
-
* but it
|
|
353
|
+
* but it clears the running timers on unload
|
|
354
|
+
* does not work after unload has been called
|
|
354
355
|
*
|
|
355
|
-
* It returns promise if no callback is provided.
|
|
356
356
|
* @param {function} cb - timer callback
|
|
357
357
|
* @param {number} timeout - timeout in milliseconds
|
|
358
358
|
* @param {any[]} args - as many arguments as needed, which will be passed to setTimeout
|
|
@@ -363,15 +363,22 @@ declare class Adapter {
|
|
|
363
363
|
* Same as clearTimeout
|
|
364
364
|
* but it check the running timers on unload
|
|
365
365
|
*
|
|
366
|
-
* It returns promise if no callback is provided.
|
|
367
366
|
* @param {number} id - timer id
|
|
368
367
|
*/
|
|
369
368
|
clearTimeout: ((id: number) => void) | undefined;
|
|
369
|
+
/**
|
|
370
|
+
* delays the fullfillment of the promise the amount of time.
|
|
371
|
+
* it will not fullfill during and after adapter shutdown
|
|
372
|
+
*
|
|
373
|
+
* @param {number} timeout - timeout in milliseconds
|
|
374
|
+
* @returns {Promise<void>} promise when timeout is over
|
|
375
|
+
*/
|
|
376
|
+
delay: ((timeout: number) => Promise<void>) | undefined;
|
|
370
377
|
/**
|
|
371
378
|
* Same as setInterval
|
|
372
|
-
* but it
|
|
379
|
+
* but it clears the running intervals on unload
|
|
380
|
+
* does not work after unload has been called
|
|
373
381
|
*
|
|
374
|
-
* It returns promise if no callback is provided.
|
|
375
382
|
* @param {function} cb - interval callback
|
|
376
383
|
* @param {number} timeout - interval in milliseconds
|
|
377
384
|
* @param {any[]} args - as many arguments as needed, which will be passed to setTimeout
|
|
@@ -382,7 +389,6 @@ declare class Adapter {
|
|
|
382
389
|
* Same as clearInterval
|
|
383
390
|
* but it check the running intervals on unload
|
|
384
391
|
*
|
|
385
|
-
* It returns promise if no callback is provided.
|
|
386
392
|
* @param {number} id - interval id
|
|
387
393
|
*/
|
|
388
394
|
clearInterval: ((id: number) => void) | undefined;
|
|
@@ -1783,7 +1789,7 @@ declare class Adapter {
|
|
|
1783
1789
|
/**
|
|
1784
1790
|
* Write binary block into redis, e.g image
|
|
1785
1791
|
*
|
|
1786
|
-
* @alias
|
|
1792
|
+
* @alias setForeignBinaryState
|
|
1787
1793
|
* @memberof Adapter
|
|
1788
1794
|
*
|
|
1789
1795
|
* @param {string} id of state
|
|
@@ -1792,17 +1798,41 @@ declare class Adapter {
|
|
|
1792
1798
|
* @param {ioBroker.ErrorCallback} [callback]
|
|
1793
1799
|
*
|
|
1794
1800
|
*/
|
|
1795
|
-
|
|
1801
|
+
setForeignBinaryState: (id: string, binary: Buffer, options?: object | undefined, callback?: ioBroker.ErrorCallback | undefined) => Promise<any>;
|
|
1796
1802
|
/**
|
|
1797
1803
|
* Promise-version of Adapter.setBinaryState
|
|
1798
1804
|
*
|
|
1799
|
-
* @alias
|
|
1805
|
+
* @alias setForeignBinaryStateAsync
|
|
1800
1806
|
* @memberof Adapter
|
|
1801
1807
|
* @param {string} id of state
|
|
1802
1808
|
* @param {Buffer} binary data
|
|
1803
1809
|
* @param {object} [options] optional
|
|
1804
|
-
* @return
|
|
1810
|
+
* @return {Promise}
|
|
1811
|
+
*
|
|
1812
|
+
*/
|
|
1813
|
+
setForeignBinaryStateAsync: any;
|
|
1814
|
+
/**
|
|
1815
|
+
* Same as setForeignBinaryState but prefixes the own namespace to the id
|
|
1816
|
+
*
|
|
1817
|
+
* @alias setBinaryState
|
|
1818
|
+
* @memberof Adapter
|
|
1805
1819
|
*
|
|
1820
|
+
* @param {string} id of state
|
|
1821
|
+
* @param {Buffer} binary data
|
|
1822
|
+
* @param {object} [options] optional
|
|
1823
|
+
* @param {ioBroker.ErrorCallback} [callback]
|
|
1824
|
+
*/
|
|
1825
|
+
setBinaryState: (id: string, binary: Buffer, options?: object | undefined, callback?: ioBroker.ErrorCallback | undefined) => Promise<any>;
|
|
1826
|
+
/**
|
|
1827
|
+
* Async version of setBinaryState
|
|
1828
|
+
*
|
|
1829
|
+
* @alias setBinaryStateAsync
|
|
1830
|
+
* @memberof Adapter
|
|
1831
|
+
*
|
|
1832
|
+
* @param {string} id of state
|
|
1833
|
+
* @param {Buffer} binary data
|
|
1834
|
+
* @param {object} [options] optional
|
|
1835
|
+
* @param {Promise<void>}
|
|
1806
1836
|
*/
|
|
1807
1837
|
setBinaryStateAsync: any;
|
|
1808
1838
|
/**
|
|
@@ -1812,14 +1842,30 @@ declare class Adapter {
|
|
|
1812
1842
|
* @param {object} options optional
|
|
1813
1843
|
* @param {ioBroker.GetBinaryStateCallback} callback
|
|
1814
1844
|
*/
|
|
1815
|
-
|
|
1845
|
+
getForeignBinaryState: (id: string, options: object, callback: ioBroker.GetBinaryStateCallback) => any;
|
|
1816
1846
|
/**
|
|
1817
1847
|
* Promise-version of Adapter.getBinaryState
|
|
1818
1848
|
*
|
|
1819
|
-
* @alias
|
|
1849
|
+
* @alias getForeignBinaryStateAsync
|
|
1820
1850
|
* @memberof Adapter
|
|
1821
1851
|
*
|
|
1822
1852
|
*/
|
|
1853
|
+
getForeignBinaryStateAsync: any;
|
|
1854
|
+
/**
|
|
1855
|
+
* Same as getForeignBinaryState but prefixes the own namespace to the id
|
|
1856
|
+
*
|
|
1857
|
+
* @param {string} id The state ID
|
|
1858
|
+
* @param {object} options optional
|
|
1859
|
+
* @param {ioBroker.GetBinaryStateCallback} callback
|
|
1860
|
+
*/
|
|
1861
|
+
getBinaryState: (id: string, options: object, callback: ioBroker.GetBinaryStateCallback) => any;
|
|
1862
|
+
/**
|
|
1863
|
+
* Promisified version of getBinaryState
|
|
1864
|
+
*
|
|
1865
|
+
* @param {string} id The state ID
|
|
1866
|
+
* @param {object} options optional
|
|
1867
|
+
* @return {Promise<Buffer>}
|
|
1868
|
+
*/
|
|
1823
1869
|
getBinaryStateAsync: any;
|
|
1824
1870
|
/**
|
|
1825
1871
|
* Deletes binary state
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../src/lib/adapter/adapter.js"],"names":[],"mappings":";AAuDA;;;;;;;;;GASG;AACH,kCAHW,MAAM,GAAC,MAAM,GACZ,MAAM,
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../src/lib/adapter/adapter.js"],"names":[],"mappings":";AAuDA;;;;;;;;;GASG;AACH,kCAHW,MAAM,GAAC,MAAM,GACZ,MAAM,CA2rSjB;;IAnsSD;;;;;;;;;OASG;IACH,qBAHW,MAAM,GAAC,MAAM,EA4rSvB;IAlpSG,0BAA2C;IAM3C,2BAAiB;IACjB,wBAAiB;IACjB,iCAAuB;IACvB,sBAAe;IAEf,iCAAuB;IACvB,uCAA8B;IAC9B,kCAAyB;IAIzB;;;kBAGC;IAiED,+CAAqE;IAY7D,4BAAkB;IAKV,0CAAoB;IAUpC,mIAqBC;IAED;;;;;;;;;OASG;IACH,uGAiEC;IA5DG,gCAAsB;IAgEtB,gBAAqD;IAWrD,UAA8D;IAO1D,YAAmE;IAWvE,8CAA0B;IAgD9B,UAAwB;IACxB,8BAA8C;IAC9C,iCAA0G;IAC1G,qCAAsF;IAEtF,yBAAyB;IACzB,sBAAe;IACf,6BAA6B;IAC7B,0BAAmB;IACnB,+BAA+B;IAC/B,uBAAgB;IAChB,oBAA0B;IAC1B,yDAAyD;IACzD,4BAAyB;IACzB,+BAAmB;IACnB,gCAAoB;IACpB,yDAAyD;IACzD,qBAAsC;IAKtC;;;yBAgBkB,MAAM,KAAK,IAAI;aAhBP;IAE1B;;;;;;;;;;;;;;;;OAgBG;IACH,iBALW,MAAM,8CAE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AAsB;IA+R1C,6EAAsD;IAGtD;;;;OAIG;IACH,4BAHW,OAAO,KACL,QAAQ,MAAM,EAAE,CAAC,cA4F7B"}
|
|
@@ -63,15 +63,16 @@ function Adapter(options) {
|
|
|
63
63
|
if (!options || (!config && !options.config)) {
|
|
64
64
|
throw new Error('Configuration not set!');
|
|
65
65
|
}
|
|
66
|
+
/** @type Utils*/
|
|
66
67
|
let utils;
|
|
67
68
|
let schedule;
|
|
68
69
|
let restartScheduleJob;
|
|
69
70
|
let initializeTimeout;
|
|
70
71
|
let adapterStates;
|
|
71
72
|
let adapterObjects;
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
73
|
+
const timers = new Set();
|
|
74
|
+
const intervals = new Set();
|
|
75
|
+
const delays = new Set();
|
|
75
76
|
let stopInProgress = false;
|
|
76
77
|
if (options.config && !options.config.log) {
|
|
77
78
|
options.config.log = config.log;
|
|
@@ -1098,9 +1099,9 @@ function Adapter(options) {
|
|
|
1098
1099
|
};
|
|
1099
1100
|
/**
|
|
1100
1101
|
* Same as setTimeout
|
|
1101
|
-
* but it
|
|
1102
|
+
* but it clears the running timers on unload
|
|
1103
|
+
* does not work after unload has been called
|
|
1102
1104
|
*
|
|
1103
|
-
* It returns promise if no callback is provided.
|
|
1104
1105
|
* @param {function} cb - timer callback
|
|
1105
1106
|
* @param {number} timeout - timeout in milliseconds
|
|
1106
1107
|
* @param {any[]} args - as many arguments as needed, which will be passed to setTimeout
|
|
@@ -1111,37 +1112,58 @@ function Adapter(options) {
|
|
|
1111
1112
|
this.log.warn(`setTimeout expected callback to be of type "function", but got "${typeof cb}"`);
|
|
1112
1113
|
return;
|
|
1113
1114
|
}
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
return
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1115
|
+
if (stopInProgress) {
|
|
1116
|
+
this.log.warn(`setTimeout called, but adapter is shutting down`);
|
|
1117
|
+
return;
|
|
1118
|
+
}
|
|
1119
|
+
const id = setTimeout.call(null, () => {
|
|
1120
|
+
timers.delete(id);
|
|
1121
|
+
cb(...args);
|
|
1122
|
+
}, timeout);
|
|
1123
|
+
timers.add(id);
|
|
1124
|
+
return id;
|
|
1123
1125
|
};
|
|
1124
1126
|
/**
|
|
1125
1127
|
* Same as clearTimeout
|
|
1126
1128
|
* but it check the running timers on unload
|
|
1127
1129
|
*
|
|
1128
|
-
* It returns promise if no callback is provided.
|
|
1129
1130
|
* @param {number} id - timer id
|
|
1130
1131
|
*/
|
|
1131
1132
|
this.clearTimeout = id => {
|
|
1132
|
-
if (!timers
|
|
1133
|
-
logger.warn(`${this.namespaceLog} Clear
|
|
1133
|
+
if (!timers.has(id)) {
|
|
1134
|
+
logger.warn(`${this.namespaceLog} Clear already terminated timer ${id}`);
|
|
1134
1135
|
}
|
|
1135
1136
|
else {
|
|
1136
|
-
clearTimeout(
|
|
1137
|
-
delete
|
|
1137
|
+
clearTimeout(id);
|
|
1138
|
+
timers.delete(id);
|
|
1138
1139
|
}
|
|
1139
1140
|
};
|
|
1141
|
+
/**
|
|
1142
|
+
* delays the fullfillment of the promise the amount of time.
|
|
1143
|
+
* it will not fullfill during and after adapter shutdown
|
|
1144
|
+
*
|
|
1145
|
+
* @param {number} timeout - timeout in milliseconds
|
|
1146
|
+
* @returns {Promise<void>} promise when timeout is over
|
|
1147
|
+
*/
|
|
1148
|
+
this.delay = timeout => {
|
|
1149
|
+
if (stopInProgress) {
|
|
1150
|
+
this.log.warn(`delay called, but adapter is shutting down`);
|
|
1151
|
+
}
|
|
1152
|
+
return new Promise(resolve => {
|
|
1153
|
+
const id = setTimeout(() => {
|
|
1154
|
+
delays.delete(id);
|
|
1155
|
+
if (!stopInProgress) {
|
|
1156
|
+
resolve();
|
|
1157
|
+
}
|
|
1158
|
+
}, timeout);
|
|
1159
|
+
delays.add(id);
|
|
1160
|
+
});
|
|
1161
|
+
};
|
|
1140
1162
|
/**
|
|
1141
1163
|
* Same as setInterval
|
|
1142
|
-
* but it
|
|
1164
|
+
* but it clears the running intervals on unload
|
|
1165
|
+
* does not work after unload has been called
|
|
1143
1166
|
*
|
|
1144
|
-
* It returns promise if no callback is provided.
|
|
1145
1167
|
* @param {function} cb - interval callback
|
|
1146
1168
|
* @param {number} timeout - interval in milliseconds
|
|
1147
1169
|
* @param {any[]} args - as many arguments as needed, which will be passed to setTimeout
|
|
@@ -1152,24 +1174,27 @@ function Adapter(options) {
|
|
|
1152
1174
|
this.log.error(`setInterval expected callback to be of type "function", but got "${typeof cb}"`);
|
|
1153
1175
|
return;
|
|
1154
1176
|
}
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1177
|
+
if (stopInProgress) {
|
|
1178
|
+
this.log.warn(`setInterval called, but adapter is shutting down`);
|
|
1179
|
+
return;
|
|
1180
|
+
}
|
|
1181
|
+
const id = setInterval(() => cb(...args));
|
|
1182
|
+
intervals.add(id);
|
|
1183
|
+
return id;
|
|
1158
1184
|
};
|
|
1159
1185
|
/**
|
|
1160
1186
|
* Same as clearInterval
|
|
1161
1187
|
* but it check the running intervals on unload
|
|
1162
1188
|
*
|
|
1163
|
-
* It returns promise if no callback is provided.
|
|
1164
1189
|
* @param {number} id - interval id
|
|
1165
1190
|
*/
|
|
1166
1191
|
this.clearInterval = id => {
|
|
1167
|
-
if (!intervals
|
|
1168
|
-
logger.warn(`${this.namespaceLog} Clear
|
|
1192
|
+
if (!intervals.has(id)) {
|
|
1193
|
+
logger.warn(`${this.namespaceLog} Clear already terminated interval ${id}`);
|
|
1169
1194
|
}
|
|
1170
1195
|
else {
|
|
1171
|
-
clearInterval(
|
|
1172
|
-
delete
|
|
1196
|
+
clearInterval(id);
|
|
1197
|
+
intervals.delete(id);
|
|
1173
1198
|
}
|
|
1174
1199
|
};
|
|
1175
1200
|
// Can be later deleted if no more appears
|
|
@@ -7409,7 +7434,7 @@ function Adapter(options) {
|
|
|
7409
7434
|
/**
|
|
7410
7435
|
* Write binary block into redis, e.g image
|
|
7411
7436
|
*
|
|
7412
|
-
* @alias
|
|
7437
|
+
* @alias setForeignBinaryState
|
|
7413
7438
|
* @memberof Adapter
|
|
7414
7439
|
*
|
|
7415
7440
|
* @param {string} id of state
|
|
@@ -7418,7 +7443,7 @@ function Adapter(options) {
|
|
|
7418
7443
|
* @param {ioBroker.ErrorCallback} [callback]
|
|
7419
7444
|
*
|
|
7420
7445
|
*/
|
|
7421
|
-
this.
|
|
7446
|
+
this.setForeignBinaryState = async (id, binary, options, callback) => {
|
|
7422
7447
|
if (typeof options === 'function') {
|
|
7423
7448
|
callback = options;
|
|
7424
7449
|
options = {};
|
|
@@ -7511,16 +7536,43 @@ function Adapter(options) {
|
|
|
7511
7536
|
/**
|
|
7512
7537
|
* Promise-version of Adapter.setBinaryState
|
|
7513
7538
|
*
|
|
7514
|
-
* @alias
|
|
7539
|
+
* @alias setForeignBinaryStateAsync
|
|
7515
7540
|
* @memberof Adapter
|
|
7516
7541
|
* @param {string} id of state
|
|
7517
7542
|
* @param {Buffer} binary data
|
|
7518
7543
|
* @param {object} [options] optional
|
|
7519
|
-
* @return
|
|
7544
|
+
* @return {Promise}
|
|
7520
7545
|
*
|
|
7521
7546
|
*/
|
|
7547
|
+
this.setForeignBinaryStateAsync = tools.promisify(this.setForeignBinaryState, this);
|
|
7548
|
+
/**
|
|
7549
|
+
* Same as setForeignBinaryState but prefixes the own namespace to the id
|
|
7550
|
+
*
|
|
7551
|
+
* @alias setBinaryState
|
|
7552
|
+
* @memberof Adapter
|
|
7553
|
+
*
|
|
7554
|
+
* @param {string} id of state
|
|
7555
|
+
* @param {Buffer} binary data
|
|
7556
|
+
* @param {object} [options] optional
|
|
7557
|
+
* @param {ioBroker.ErrorCallback} [callback]
|
|
7558
|
+
*/
|
|
7559
|
+
this.setBinaryState = (id, binary, options, callback) => {
|
|
7560
|
+
// TODO: call fixId as soon as adapters are migrated to setForeignBinaryState
|
|
7561
|
+
// id = utils.fixId(id, false);
|
|
7562
|
+
return this.setForeignBinaryState(id, binary, options, callback);
|
|
7563
|
+
};
|
|
7564
|
+
/**
|
|
7565
|
+
* Async version of setBinaryState
|
|
7566
|
+
*
|
|
7567
|
+
* @alias setBinaryStateAsync
|
|
7568
|
+
* @memberof Adapter
|
|
7569
|
+
*
|
|
7570
|
+
* @param {string} id of state
|
|
7571
|
+
* @param {Buffer} binary data
|
|
7572
|
+
* @param {object} [options] optional
|
|
7573
|
+
* @param {Promise<void>}
|
|
7574
|
+
*/
|
|
7522
7575
|
this.setBinaryStateAsync = tools.promisify(this.setBinaryState, this);
|
|
7523
|
-
// Read binary block from redis, e.g. image
|
|
7524
7576
|
/**
|
|
7525
7577
|
* Read a binary block from redis, e.g. an image
|
|
7526
7578
|
*
|
|
@@ -7528,7 +7580,7 @@ function Adapter(options) {
|
|
|
7528
7580
|
* @param {object} options optional
|
|
7529
7581
|
* @param {ioBroker.GetBinaryStateCallback} callback
|
|
7530
7582
|
*/
|
|
7531
|
-
this.
|
|
7583
|
+
this.getForeignBinaryState = (id, options, callback) => {
|
|
7532
7584
|
if (typeof options === 'function') {
|
|
7533
7585
|
callback = options;
|
|
7534
7586
|
options = {};
|
|
@@ -7583,10 +7635,30 @@ function Adapter(options) {
|
|
|
7583
7635
|
/**
|
|
7584
7636
|
* Promise-version of Adapter.getBinaryState
|
|
7585
7637
|
*
|
|
7586
|
-
* @alias
|
|
7638
|
+
* @alias getForeignBinaryStateAsync
|
|
7587
7639
|
* @memberof Adapter
|
|
7588
7640
|
*
|
|
7589
7641
|
*/
|
|
7642
|
+
this.getForeignBinaryStateAsync = tools.promisify(this.getForeignBinaryState, this);
|
|
7643
|
+
/**
|
|
7644
|
+
* Same as getForeignBinaryState but prefixes the own namespace to the id
|
|
7645
|
+
*
|
|
7646
|
+
* @param {string} id The state ID
|
|
7647
|
+
* @param {object} options optional
|
|
7648
|
+
* @param {ioBroker.GetBinaryStateCallback} callback
|
|
7649
|
+
*/
|
|
7650
|
+
this.getBinaryState = (id, options, callback) => {
|
|
7651
|
+
// TODO: fixId as soon as all adapters are migrated to setForeignBinaryState
|
|
7652
|
+
// id = utils.fixId(id);
|
|
7653
|
+
return this.getForeignBinaryState(id, options, callback);
|
|
7654
|
+
};
|
|
7655
|
+
/**
|
|
7656
|
+
* Promisified version of getBinaryState
|
|
7657
|
+
*
|
|
7658
|
+
* @param {string} id The state ID
|
|
7659
|
+
* @param {object} options optional
|
|
7660
|
+
* @return {Promise<Buffer>}
|
|
7661
|
+
*/
|
|
7590
7662
|
this.getBinaryStateAsync = tools.promisify(this.getBinaryState, this);
|
|
7591
7663
|
/**
|
|
7592
7664
|
* Deletes binary state
|
|
@@ -8219,17 +8291,17 @@ function Adapter(options) {
|
|
|
8219
8291
|
reportInterval = null;
|
|
8220
8292
|
const id = 'system.adapter.' + this.namespace;
|
|
8221
8293
|
const finishUnload = () => {
|
|
8222
|
-
|
|
8223
|
-
|
|
8224
|
-
|
|
8225
|
-
|
|
8226
|
-
|
|
8227
|
-
|
|
8228
|
-
|
|
8229
|
-
|
|
8230
|
-
|
|
8231
|
-
|
|
8232
|
-
|
|
8294
|
+
if (timers.size) {
|
|
8295
|
+
timers.forEach(id => clearTimeout(id));
|
|
8296
|
+
timers.clear();
|
|
8297
|
+
}
|
|
8298
|
+
if (intervals.size) {
|
|
8299
|
+
intervals.forEach(id => clearInterval(id));
|
|
8300
|
+
intervals.clear();
|
|
8301
|
+
}
|
|
8302
|
+
if (delays.size) {
|
|
8303
|
+
delays.forEach(id => clearTimeout(id));
|
|
8304
|
+
delays.clear();
|
|
8233
8305
|
}
|
|
8234
8306
|
if (this.terminated) {
|
|
8235
8307
|
return;
|