parse 4.0.0-alpha.1 → 4.0.0-alpha.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/dist/parse.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Parse JavaScript SDK v4.0.0-alpha.1
2
+ * Parse JavaScript SDK v4.0.0-alpha.2
3
3
  *
4
4
  * The source tree of this library can be found at
5
5
  * https://github.com/ParsePlatform/Parse-SDK-JS
@@ -699,7 +699,7 @@ var config
699
699
  SERVER_AUTH_TOKEN: null,
700
700
  LIVEQUERY_SERVER_URL: null,
701
701
  ENCRYPTED_KEY: null,
702
- VERSION: 'js' + "4.0.0-alpha.1",
702
+ VERSION: 'js' + "4.0.0-alpha.2",
703
703
  APPLICATION_ID: null,
704
704
  JAVASCRIPT_KEY: null,
705
705
  MASTER_KEY: null,
@@ -2553,6 +2553,8 @@ var _LiveQuerySubscription = _interopRequireDefault(_dereq_("./LiveQuerySubscrip
2553
2553
 
2554
2554
  var _promiseUtils = _dereq_("./promiseUtils");
2555
2555
 
2556
+ var _ParseError = _interopRequireDefault(_dereq_("./ParseError"));
2557
+
2556
2558
  function _createForOfIteratorHelper(o, allowArrayLike) {
2557
2559
  var it = typeof _Symbol !== "undefined" && _getIteratorMethod(o) || o["@@iterator"];
2558
2560
 
@@ -2885,6 +2887,8 @@ var LiveQueryClient = /*#__PURE__*/function (_EventEmitter) {
2885
2887
  this.requestId += 1;
2886
2888
  this.connectPromise.then(function () {
2887
2889
  _this2.socket.send((0, _stringify.default)(subscribeRequest));
2890
+ }).catch(function (error) {
2891
+ subscription.subscribePromise.reject(error);
2888
2892
  });
2889
2893
  return subscription;
2890
2894
  }
@@ -3097,26 +3101,35 @@ var LiveQueryClient = /*#__PURE__*/function (_EventEmitter) {
3097
3101
  break;
3098
3102
 
3099
3103
  case OP_EVENTS.ERROR:
3100
- if (data.requestId) {
3101
- if (subscription) {
3102
- subscription.subscribePromise.resolve();
3103
- (0, _setTimeout2.default)(function () {
3104
- return subscription.emit(SUBSCRIPTION_EMMITER_TYPES.ERROR, data.error);
3105
- }, 200);
3104
+ {
3105
+ var parseError = new _ParseError.default(data.code, data.error);
3106
+
3107
+ if (!this.id) {
3108
+ this.connectPromise.reject(parseError);
3109
+ this.state = CLIENT_STATE.DISCONNECTED;
3106
3110
  }
3107
- } else {
3108
- this.emit(CLIENT_EMMITER_TYPES.ERROR, data.error);
3109
- }
3110
3111
 
3111
- if (data.error === 'Additional properties not allowed') {
3112
- this.additionalProperties = false;
3113
- }
3112
+ if (data.requestId) {
3113
+ if (subscription) {
3114
+ subscription.subscribePromise.reject(parseError);
3115
+ (0, _setTimeout2.default)(function () {
3116
+ return subscription.emit(SUBSCRIPTION_EMMITER_TYPES.ERROR, data.error);
3117
+ }, 200);
3118
+ }
3119
+ } else {
3120
+ this.emit(CLIENT_EMMITER_TYPES.ERROR, data.error);
3121
+ }
3114
3122
 
3115
- if (data.reconnect) {
3116
- this._handleReconnect();
3117
- }
3123
+ if (data.error === 'Additional properties not allowed') {
3124
+ this.additionalProperties = false;
3125
+ }
3118
3126
 
3119
- break;
3127
+ if (data.reconnect) {
3128
+ this._handleReconnect();
3129
+ }
3130
+
3131
+ break;
3132
+ }
3120
3133
 
3121
3134
  case OP_EVENTS.UNSUBSCRIBED:
3122
3135
  // We have already deleted subscription in unsubscribe(), do nothing here
@@ -3251,7 +3264,7 @@ _CoreManager.default.setWebSocketController(typeof WebSocket === 'function' || (
3251
3264
 
3252
3265
  var _default = LiveQueryClient;
3253
3266
  exports.default = _default;
3254
- },{"./CoreManager":4,"./EventEmitter":6,"./LiveQuerySubscription":12,"./ParseObject":27,"./promiseUtils":51,"@babel/runtime-corejs3/core-js-stable/array/from":55,"@babel/runtime-corejs3/core-js-stable/array/is-array":56,"@babel/runtime-corejs3/core-js-stable/instance/bind":57,"@babel/runtime-corejs3/core-js-stable/instance/for-each":64,"@babel/runtime-corejs3/core-js-stable/instance/index-of":66,"@babel/runtime-corejs3/core-js-stable/instance/keys":67,"@babel/runtime-corejs3/core-js-stable/instance/slice":71,"@babel/runtime-corejs3/core-js-stable/instance/values":75,"@babel/runtime-corejs3/core-js-stable/json/stringify":76,"@babel/runtime-corejs3/core-js-stable/map":77,"@babel/runtime-corejs3/core-js-stable/object/define-property":82,"@babel/runtime-corejs3/core-js-stable/reflect/construct":93,"@babel/runtime-corejs3/core-js-stable/set-timeout":95,"@babel/runtime-corejs3/core-js-stable/symbol":97,"@babel/runtime-corejs3/core-js/get-iterator-method":101,"@babel/runtime-corejs3/helpers/assertThisInitialized":119,"@babel/runtime-corejs3/helpers/classCallCheck":121,"@babel/runtime-corejs3/helpers/createClass":123,"@babel/runtime-corejs3/helpers/defineProperty":124,"@babel/runtime-corejs3/helpers/getPrototypeOf":126,"@babel/runtime-corejs3/helpers/inherits":127,"@babel/runtime-corejs3/helpers/interopRequireDefault":128,"@babel/runtime-corejs3/helpers/possibleConstructorReturn":135,"@babel/runtime-corejs3/helpers/typeof":140}],12:[function(_dereq_,module,exports){
3267
+ },{"./CoreManager":4,"./EventEmitter":6,"./LiveQuerySubscription":12,"./ParseError":22,"./ParseObject":27,"./promiseUtils":51,"@babel/runtime-corejs3/core-js-stable/array/from":55,"@babel/runtime-corejs3/core-js-stable/array/is-array":56,"@babel/runtime-corejs3/core-js-stable/instance/bind":57,"@babel/runtime-corejs3/core-js-stable/instance/for-each":64,"@babel/runtime-corejs3/core-js-stable/instance/index-of":66,"@babel/runtime-corejs3/core-js-stable/instance/keys":67,"@babel/runtime-corejs3/core-js-stable/instance/slice":71,"@babel/runtime-corejs3/core-js-stable/instance/values":75,"@babel/runtime-corejs3/core-js-stable/json/stringify":76,"@babel/runtime-corejs3/core-js-stable/map":77,"@babel/runtime-corejs3/core-js-stable/object/define-property":82,"@babel/runtime-corejs3/core-js-stable/reflect/construct":93,"@babel/runtime-corejs3/core-js-stable/set-timeout":95,"@babel/runtime-corejs3/core-js-stable/symbol":97,"@babel/runtime-corejs3/core-js/get-iterator-method":101,"@babel/runtime-corejs3/helpers/assertThisInitialized":119,"@babel/runtime-corejs3/helpers/classCallCheck":121,"@babel/runtime-corejs3/helpers/createClass":123,"@babel/runtime-corejs3/helpers/defineProperty":124,"@babel/runtime-corejs3/helpers/getPrototypeOf":126,"@babel/runtime-corejs3/helpers/inherits":127,"@babel/runtime-corejs3/helpers/interopRequireDefault":128,"@babel/runtime-corejs3/helpers/possibleConstructorReturn":135,"@babel/runtime-corejs3/helpers/typeof":140}],12:[function(_dereq_,module,exports){
3255
3268
  "use strict";
3256
3269
 
3257
3270
  var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");