@schukai/monster 3.1.1 → 3.1.2
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/package.json
CHANGED
@@ -231,14 +231,15 @@ class WebSocketDatasource extends Datasource {
|
|
231
231
|
|
232
232
|
/**
|
233
233
|
* @return {Promise}
|
234
|
-
* @throws {Error} the options does not contain a valid json definition
|
235
|
-
* @throws {Error} the data cannot be read
|
236
|
-
* @throws {TypeError} value is not an object
|
237
234
|
*/
|
238
235
|
read() {
|
239
236
|
const self = this;
|
240
237
|
let response;
|
241
238
|
|
239
|
+
if (self[connectionSymbol]?.socket?.readyState!==1) {
|
240
|
+
return Promise.reject('The connection is not established.');
|
241
|
+
}
|
242
|
+
|
242
243
|
return new Promise((resolve, reject) => {
|
243
244
|
if (self[receiveQueueSymbol].isEmpty()) {
|
244
245
|
resolve();
|
@@ -290,6 +291,10 @@ class WebSocketDatasource extends Datasource {
|
|
290
291
|
*/
|
291
292
|
write() {
|
292
293
|
const self = this;
|
294
|
+
|
295
|
+
if (self[connectionSymbol]?.socket?.readyState!==1) {
|
296
|
+
return Promise.reject('The connection is not established.');
|
297
|
+
}
|
293
298
|
|
294
299
|
let obj = self.get();
|
295
300
|
let transformation = self.getOption('write.mapping.transformer');
|
package/source/types/version.mjs
CHANGED
package/test/cases/monster.mjs
CHANGED