parse 4.0.0-alpha.11 → 4.0.0-alpha.12
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/dist/parse.js +10 -6
- package/dist/parse.min.js +2 -2
- package/dist/parse.weapp.js +12 -8
- package/dist/parse.weapp.min.js +2 -2
- package/lib/browser/CoreManager.js +1 -1
- package/lib/browser/LiveQueryClient.js +8 -4
- package/lib/browser/Socket.weapp.js +2 -2
- package/lib/node/CoreManager.js +1 -1
- package/lib/node/LiveQueryClient.js +8 -3
- package/lib/node/Socket.weapp.js +2 -2
- package/lib/react-native/CoreManager.js +1 -1
- package/lib/react-native/LiveQueryClient.js +6 -2
- package/lib/react-native/Socket.weapp.js +2 -2
- package/lib/weapp/CoreManager.js +1 -1
- package/lib/weapp/LiveQueryClient.js +8 -4
- package/lib/weapp/Socket.weapp.js +2 -2
- package/package.json +8 -9
|
@@ -182,7 +182,7 @@ var config /*: Config & { [key: string]: mixed }*/ = {
|
|
|
182
182
|
SERVER_AUTH_TOKEN: null,
|
|
183
183
|
LIVEQUERY_SERVER_URL: null,
|
|
184
184
|
ENCRYPTED_KEY: null,
|
|
185
|
-
VERSION: 'js' + "4.0.0-alpha.
|
|
185
|
+
VERSION: 'js' + "4.0.0-alpha.12",
|
|
186
186
|
APPLICATION_ID: null,
|
|
187
187
|
JAVASCRIPT_KEY: null,
|
|
188
188
|
MASTER_KEY: null,
|
|
@@ -376,6 +376,7 @@ var LiveQueryClient = /*#__PURE__*/function (_EventEmitter) {
|
|
|
376
376
|
this.state = CLIENT_STATE.CONNECTING;
|
|
377
377
|
}
|
|
378
378
|
this.socket = new WebSocketImplementation(this.serverURL);
|
|
379
|
+
this.socket.closingPromise = (0, _promiseUtils.resolvingPromise)();
|
|
379
380
|
|
|
380
381
|
// Bind WebSocket callbacks
|
|
381
382
|
this.socket.onopen = function () {
|
|
@@ -384,7 +385,8 @@ var LiveQueryClient = /*#__PURE__*/function (_EventEmitter) {
|
|
|
384
385
|
this.socket.onmessage = function (event) {
|
|
385
386
|
_this4._handleWebSocketMessage(event);
|
|
386
387
|
};
|
|
387
|
-
this.socket.onclose = function () {
|
|
388
|
+
this.socket.onclose = function (event) {
|
|
389
|
+
_this4.socket.closingPromise.resolve(event);
|
|
388
390
|
_this4._handleWebSocketClose();
|
|
389
391
|
};
|
|
390
392
|
this.socket.onerror = function (error) {
|
|
@@ -425,16 +427,17 @@ var LiveQueryClient = /*#__PURE__*/function (_EventEmitter) {
|
|
|
425
427
|
* This method will close the WebSocket connection to this LiveQueryClient,
|
|
426
428
|
* cancel the auto reconnect and unsubscribe all subscriptions based on it.
|
|
427
429
|
*
|
|
430
|
+
* @returns {Promise | undefined} CloseEvent {@link https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/close_event}
|
|
428
431
|
*/
|
|
429
432
|
}, {
|
|
430
433
|
key: "close",
|
|
431
|
-
value: function () {
|
|
432
|
-
var _context2;
|
|
434
|
+
value: function () /*: ?Promise*/{
|
|
435
|
+
var _this$socket, _this$socket2, _context2;
|
|
433
436
|
if (this.state === CLIENT_STATE.INITIALIZED || this.state === CLIENT_STATE.DISCONNECTED) {
|
|
434
437
|
return;
|
|
435
438
|
}
|
|
436
439
|
this.state = CLIENT_STATE.DISCONNECTED;
|
|
437
|
-
this.socket.close();
|
|
440
|
+
(_this$socket = this.socket) === null || _this$socket === void 0 ? void 0 : _this$socket.close();
|
|
438
441
|
// Notify each subscription about the close
|
|
439
442
|
var _iterator = _createForOfIteratorHelper((0, _values.default)(_context2 = this.subscriptions).call(_context2)),
|
|
440
443
|
_step;
|
|
@@ -451,6 +454,7 @@ var LiveQueryClient = /*#__PURE__*/function (_EventEmitter) {
|
|
|
451
454
|
}
|
|
452
455
|
this._handleReset();
|
|
453
456
|
this.emit(CLIENT_EMMITER_TYPES.CLOSE);
|
|
457
|
+
return (_this$socket2 = this.socket) === null || _this$socket2 === void 0 ? void 0 : _this$socket2.closingPromise;
|
|
454
458
|
}
|
|
455
459
|
|
|
456
460
|
// ensure we start with valid state if connect is called again after close
|
|
@@ -17,8 +17,8 @@ module.exports = /*#__PURE__*/function () {
|
|
|
17
17
|
wx.onSocketMessage(function (msg) {
|
|
18
18
|
_this.onmessage(msg);
|
|
19
19
|
});
|
|
20
|
-
wx.onSocketClose(function () {
|
|
21
|
-
_this.onclose();
|
|
20
|
+
wx.onSocketClose(function (event) {
|
|
21
|
+
_this.onclose(event);
|
|
22
22
|
});
|
|
23
23
|
wx.onSocketError(function (error) {
|
|
24
24
|
_this.onerror(error);
|
package/lib/node/CoreManager.js
CHANGED
|
@@ -179,7 +179,7 @@ const config /*: Config & { [key: string]: mixed }*/ = {
|
|
|
179
179
|
SERVER_AUTH_TOKEN: null,
|
|
180
180
|
LIVEQUERY_SERVER_URL: null,
|
|
181
181
|
ENCRYPTED_KEY: null,
|
|
182
|
-
VERSION: 'js' + "4.0.0-alpha.
|
|
182
|
+
VERSION: 'js' + "4.0.0-alpha.12",
|
|
183
183
|
APPLICATION_ID: null,
|
|
184
184
|
JAVASCRIPT_KEY: null,
|
|
185
185
|
MASTER_KEY: null,
|
|
@@ -254,6 +254,7 @@ class LiveQueryClient extends _EventEmitter.default {
|
|
|
254
254
|
this.state = CLIENT_STATE.CONNECTING;
|
|
255
255
|
}
|
|
256
256
|
this.socket = new WebSocketImplementation(this.serverURL);
|
|
257
|
+
this.socket.closingPromise = (0, _promiseUtils.resolvingPromise)();
|
|
257
258
|
|
|
258
259
|
// Bind WebSocket callbacks
|
|
259
260
|
this.socket.onopen = () => {
|
|
@@ -262,7 +263,8 @@ class LiveQueryClient extends _EventEmitter.default {
|
|
|
262
263
|
this.socket.onmessage = event => {
|
|
263
264
|
this._handleWebSocketMessage(event);
|
|
264
265
|
};
|
|
265
|
-
this.socket.onclose =
|
|
266
|
+
this.socket.onclose = event => {
|
|
267
|
+
this.socket.closingPromise.resolve(event);
|
|
266
268
|
this._handleWebSocketClose();
|
|
267
269
|
};
|
|
268
270
|
this.socket.onerror = error => {
|
|
@@ -299,13 +301,15 @@ class LiveQueryClient extends _EventEmitter.default {
|
|
|
299
301
|
* This method will close the WebSocket connection to this LiveQueryClient,
|
|
300
302
|
* cancel the auto reconnect and unsubscribe all subscriptions based on it.
|
|
301
303
|
*
|
|
304
|
+
* @returns {Promise | undefined} CloseEvent {@link https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/close_event}
|
|
302
305
|
*/
|
|
303
|
-
close() {
|
|
306
|
+
close() /*: ?Promise*/{
|
|
307
|
+
var _this$socket, _this$socket2;
|
|
304
308
|
if (this.state === CLIENT_STATE.INITIALIZED || this.state === CLIENT_STATE.DISCONNECTED) {
|
|
305
309
|
return;
|
|
306
310
|
}
|
|
307
311
|
this.state = CLIENT_STATE.DISCONNECTED;
|
|
308
|
-
this.socket.close();
|
|
312
|
+
(_this$socket = this.socket) === null || _this$socket === void 0 ? void 0 : _this$socket.close();
|
|
309
313
|
// Notify each subscription about the close
|
|
310
314
|
for (const subscription of this.subscriptions.values()) {
|
|
311
315
|
subscription.subscribed = false;
|
|
@@ -313,6 +317,7 @@ class LiveQueryClient extends _EventEmitter.default {
|
|
|
313
317
|
}
|
|
314
318
|
this._handleReset();
|
|
315
319
|
this.emit(CLIENT_EMMITER_TYPES.CLOSE);
|
|
320
|
+
return (_this$socket2 = this.socket) === null || _this$socket2 === void 0 ? void 0 : _this$socket2.closingPromise;
|
|
316
321
|
}
|
|
317
322
|
|
|
318
323
|
// ensure we start with valid state if connect is called again after close
|
package/lib/node/Socket.weapp.js
CHANGED
|
@@ -183,13 +183,15 @@ var LiveQueryClient = function (_EventEmitter) {
|
|
|
183
183
|
this.state = CLIENT_STATE.CONNECTING;
|
|
184
184
|
}
|
|
185
185
|
this.socket = new WebSocketImplementation(this.serverURL);
|
|
186
|
+
this.socket.closingPromise = (0, _promiseUtils.resolvingPromise)();
|
|
186
187
|
this.socket.onopen = function () {
|
|
187
188
|
_this4._handleWebSocketOpen();
|
|
188
189
|
};
|
|
189
190
|
this.socket.onmessage = function (event) {
|
|
190
191
|
_this4._handleWebSocketMessage(event);
|
|
191
192
|
};
|
|
192
|
-
this.socket.onclose = function () {
|
|
193
|
+
this.socket.onclose = function (event) {
|
|
194
|
+
_this4.socket.closingPromise.resolve(event);
|
|
193
195
|
_this4._handleWebSocketClose();
|
|
194
196
|
};
|
|
195
197
|
this.socket.onerror = function (error) {
|
|
@@ -227,17 +229,19 @@ var LiveQueryClient = function (_EventEmitter) {
|
|
|
227
229
|
}, {
|
|
228
230
|
key: "close",
|
|
229
231
|
value: function () {
|
|
232
|
+
var _this$socket, _this$socket2;
|
|
230
233
|
if (this.state === CLIENT_STATE.INITIALIZED || this.state === CLIENT_STATE.DISCONNECTED) {
|
|
231
234
|
return;
|
|
232
235
|
}
|
|
233
236
|
this.state = CLIENT_STATE.DISCONNECTED;
|
|
234
|
-
this.socket.close();
|
|
237
|
+
(_this$socket = this.socket) == null ? void 0 : _this$socket.close();
|
|
235
238
|
for (var subscription of this.subscriptions.values()) {
|
|
236
239
|
subscription.subscribed = false;
|
|
237
240
|
subscription.emit(SUBSCRIPTION_EMMITER_TYPES.CLOSE);
|
|
238
241
|
}
|
|
239
242
|
this._handleReset();
|
|
240
243
|
this.emit(CLIENT_EMMITER_TYPES.CLOSE);
|
|
244
|
+
return (_this$socket2 = this.socket) == null ? void 0 : _this$socket2.closingPromise;
|
|
241
245
|
}
|
|
242
246
|
}, {
|
|
243
247
|
key: "_handleReset",
|
|
@@ -15,8 +15,8 @@ module.exports = function () {
|
|
|
15
15
|
wx.onSocketMessage(function (msg) {
|
|
16
16
|
_this.onmessage(msg);
|
|
17
17
|
});
|
|
18
|
-
wx.onSocketClose(function () {
|
|
19
|
-
_this.onclose();
|
|
18
|
+
wx.onSocketClose(function (event) {
|
|
19
|
+
_this.onclose(event);
|
|
20
20
|
});
|
|
21
21
|
wx.onSocketError(function (error) {
|
|
22
22
|
_this.onerror(error);
|
package/lib/weapp/CoreManager.js
CHANGED
|
@@ -182,7 +182,7 @@ var config /*: Config & { [key: string]: mixed }*/ = {
|
|
|
182
182
|
SERVER_AUTH_TOKEN: null,
|
|
183
183
|
LIVEQUERY_SERVER_URL: null,
|
|
184
184
|
ENCRYPTED_KEY: null,
|
|
185
|
-
VERSION: 'js' + "4.0.0-alpha.
|
|
185
|
+
VERSION: 'js' + "4.0.0-alpha.12",
|
|
186
186
|
APPLICATION_ID: null,
|
|
187
187
|
JAVASCRIPT_KEY: null,
|
|
188
188
|
MASTER_KEY: null,
|
|
@@ -376,6 +376,7 @@ var LiveQueryClient = /*#__PURE__*/function (_EventEmitter) {
|
|
|
376
376
|
this.state = CLIENT_STATE.CONNECTING;
|
|
377
377
|
}
|
|
378
378
|
this.socket = new WebSocketImplementation(this.serverURL);
|
|
379
|
+
this.socket.closingPromise = (0, _promiseUtils.resolvingPromise)();
|
|
379
380
|
|
|
380
381
|
// Bind WebSocket callbacks
|
|
381
382
|
this.socket.onopen = function () {
|
|
@@ -384,7 +385,8 @@ var LiveQueryClient = /*#__PURE__*/function (_EventEmitter) {
|
|
|
384
385
|
this.socket.onmessage = function (event) {
|
|
385
386
|
_this4._handleWebSocketMessage(event);
|
|
386
387
|
};
|
|
387
|
-
this.socket.onclose = function () {
|
|
388
|
+
this.socket.onclose = function (event) {
|
|
389
|
+
_this4.socket.closingPromise.resolve(event);
|
|
388
390
|
_this4._handleWebSocketClose();
|
|
389
391
|
};
|
|
390
392
|
this.socket.onerror = function (error) {
|
|
@@ -425,16 +427,17 @@ var LiveQueryClient = /*#__PURE__*/function (_EventEmitter) {
|
|
|
425
427
|
* This method will close the WebSocket connection to this LiveQueryClient,
|
|
426
428
|
* cancel the auto reconnect and unsubscribe all subscriptions based on it.
|
|
427
429
|
*
|
|
430
|
+
* @returns {Promise | undefined} CloseEvent {@link https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/close_event}
|
|
428
431
|
*/
|
|
429
432
|
}, {
|
|
430
433
|
key: "close",
|
|
431
|
-
value: function () {
|
|
432
|
-
var _context2;
|
|
434
|
+
value: function () /*: ?Promise*/{
|
|
435
|
+
var _this$socket, _this$socket2, _context2;
|
|
433
436
|
if (this.state === CLIENT_STATE.INITIALIZED || this.state === CLIENT_STATE.DISCONNECTED) {
|
|
434
437
|
return;
|
|
435
438
|
}
|
|
436
439
|
this.state = CLIENT_STATE.DISCONNECTED;
|
|
437
|
-
this.socket.close();
|
|
440
|
+
(_this$socket = this.socket) === null || _this$socket === void 0 ? void 0 : _this$socket.close();
|
|
438
441
|
// Notify each subscription about the close
|
|
439
442
|
var _iterator = _createForOfIteratorHelper((0, _values.default)(_context2 = this.subscriptions).call(_context2)),
|
|
440
443
|
_step;
|
|
@@ -451,6 +454,7 @@ var LiveQueryClient = /*#__PURE__*/function (_EventEmitter) {
|
|
|
451
454
|
}
|
|
452
455
|
this._handleReset();
|
|
453
456
|
this.emit(CLIENT_EMMITER_TYPES.CLOSE);
|
|
457
|
+
return (_this$socket2 = this.socket) === null || _this$socket2 === void 0 ? void 0 : _this$socket2.closingPromise;
|
|
454
458
|
}
|
|
455
459
|
|
|
456
460
|
// ensure we start with valid state if connect is called again after close
|
|
@@ -17,8 +17,8 @@ module.exports = /*#__PURE__*/function () {
|
|
|
17
17
|
wx.onSocketMessage(function (msg) {
|
|
18
18
|
_this.onmessage(msg);
|
|
19
19
|
});
|
|
20
|
-
wx.onSocketClose(function () {
|
|
21
|
-
_this.onclose();
|
|
20
|
+
wx.onSocketClose(function (event) {
|
|
21
|
+
_this.onclose(event);
|
|
22
22
|
});
|
|
23
23
|
wx.onSocketError(function (error) {
|
|
24
24
|
_this.onerror(error);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "parse",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.12",
|
|
4
4
|
"description": "Parse JavaScript SDK",
|
|
5
5
|
"homepage": "https://parseplatform.org",
|
|
6
6
|
"keywords": [
|
|
@@ -38,9 +38,9 @@
|
|
|
38
38
|
"xmlhttprequest": "1.8.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@babel/core": "7.20.
|
|
42
|
-
"@babel/plugin-proposal-class-properties": "7.
|
|
43
|
-
"@babel/plugin-transform-flow-comments": "7.
|
|
41
|
+
"@babel/core": "7.20.12",
|
|
42
|
+
"@babel/plugin-proposal-class-properties": "7.18.6",
|
|
43
|
+
"@babel/plugin-transform-flow-comments": "7.19.0",
|
|
44
44
|
"@babel/plugin-transform-flow-strip-types": "7.19.0",
|
|
45
45
|
"@babel/plugin-transform-runtime": "7.19.6",
|
|
46
46
|
"@babel/preset-env": "7.20.2",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"@semantic-release/npm": "9.0.2",
|
|
55
55
|
"@semantic-release/release-notes-generator": "10.0.3",
|
|
56
56
|
"babel-eslint": "10.1.0",
|
|
57
|
-
"babel-jest": "
|
|
57
|
+
"babel-jest": "29.4.1",
|
|
58
58
|
"babel-plugin-inline-package-json": "2.0.0",
|
|
59
59
|
"babel-plugin-minify-dead-code-elimination": "0.5.2",
|
|
60
60
|
"babel-plugin-transform-inline-environment-variables": "0.4.3",
|
|
@@ -77,7 +77,8 @@
|
|
|
77
77
|
"jasmine": "3.5.0",
|
|
78
78
|
"jasmine-reporters": "2.5.2",
|
|
79
79
|
"jasmine-spec-reporter": "7.0.0",
|
|
80
|
-
"jest": "
|
|
80
|
+
"jest": "29.4.1",
|
|
81
|
+
"jest-environment-jsdom": "29.4.1",
|
|
81
82
|
"jsdoc": "3.6.3",
|
|
82
83
|
"jsdoc-babel": "0.5.0",
|
|
83
84
|
"lint-staged": "10.5.3",
|
|
@@ -150,8 +151,6 @@
|
|
|
150
151
|
"/node_modules/",
|
|
151
152
|
"package.json"
|
|
152
153
|
],
|
|
153
|
-
"
|
|
154
|
-
"./setup-jest.js"
|
|
155
|
-
]
|
|
154
|
+
"testEnvironment": "jsdom"
|
|
156
155
|
}
|
|
157
156
|
}
|