parse 4.0.0-alpha.1 → 4.0.0-alpha.3

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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Parse JavaScript SDK v4.0.0-alpha.1
2
+ * Parse JavaScript SDK v4.0.0-alpha.3
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.3",
703
703
  APPLICATION_ID: null,
704
704
  JAVASCRIPT_KEY: null,
705
705
  MASTER_KEY: null,
@@ -2507,6 +2507,8 @@ var _LiveQuerySubscription = _interopRequireDefault(_dereq_("./LiveQuerySubscrip
2507
2507
 
2508
2508
  var _promiseUtils = _dereq_("./promiseUtils");
2509
2509
 
2510
+ var _ParseError = _interopRequireDefault(_dereq_("./ParseError"));
2511
+
2510
2512
  function _createForOfIteratorHelper(o, allowArrayLike) {
2511
2513
  var it = typeof _Symbol !== "undefined" && _getIteratorMethod(o) || o["@@iterator"];
2512
2514
 
@@ -2839,6 +2841,8 @@ var LiveQueryClient = /*#__PURE__*/function (_EventEmitter) {
2839
2841
  this.requestId += 1;
2840
2842
  this.connectPromise.then(function () {
2841
2843
  _this2.socket.send((0, _stringify.default)(subscribeRequest));
2844
+ }).catch(function (error) {
2845
+ subscription.subscribePromise.reject(error);
2842
2846
  });
2843
2847
  return subscription;
2844
2848
  }
@@ -3051,26 +3055,35 @@ var LiveQueryClient = /*#__PURE__*/function (_EventEmitter) {
3051
3055
  break;
3052
3056
 
3053
3057
  case OP_EVENTS.ERROR:
3054
- if (data.requestId) {
3055
- if (subscription) {
3056
- subscription.subscribePromise.resolve();
3057
- (0, _setTimeout2.default)(function () {
3058
- return subscription.emit(SUBSCRIPTION_EMMITER_TYPES.ERROR, data.error);
3059
- }, 200);
3058
+ {
3059
+ var parseError = new _ParseError.default(data.code, data.error);
3060
+
3061
+ if (!this.id) {
3062
+ this.connectPromise.reject(parseError);
3063
+ this.state = CLIENT_STATE.DISCONNECTED;
3060
3064
  }
3061
- } else {
3062
- this.emit(CLIENT_EMMITER_TYPES.ERROR, data.error);
3063
- }
3064
3065
 
3065
- if (data.error === 'Additional properties not allowed') {
3066
- this.additionalProperties = false;
3067
- }
3066
+ if (data.requestId) {
3067
+ if (subscription) {
3068
+ subscription.subscribePromise.reject(parseError);
3069
+ (0, _setTimeout2.default)(function () {
3070
+ return subscription.emit(SUBSCRIPTION_EMMITER_TYPES.ERROR, data.error);
3071
+ }, 200);
3072
+ }
3073
+ } else {
3074
+ this.emit(CLIENT_EMMITER_TYPES.ERROR, data.error);
3075
+ }
3068
3076
 
3069
- if (data.reconnect) {
3070
- this._handleReconnect();
3071
- }
3077
+ if (data.error === 'Additional properties not allowed') {
3078
+ this.additionalProperties = false;
3079
+ }
3072
3080
 
3073
- break;
3081
+ if (data.reconnect) {
3082
+ this._handleReconnect();
3083
+ }
3084
+
3085
+ break;
3086
+ }
3074
3087
 
3075
3088
  case OP_EVENTS.UNSUBSCRIBED:
3076
3089
  // We have already deleted subscription in unsubscribe(), do nothing here
@@ -3205,7 +3218,7 @@ _CoreManager.default.setWebSocketController(_dereq_('./Socket.weapp'));
3205
3218
 
3206
3219
  var _default = LiveQueryClient;
3207
3220
  exports.default = _default;
3208
- },{"./CoreManager":4,"./EventEmitter":6,"./LiveQuerySubscription":11,"./ParseObject":26,"./Socket.weapp":38,"./promiseUtils":52,"@babel/runtime-corejs3/core-js-stable/array/from":56,"@babel/runtime-corejs3/core-js-stable/array/is-array":57,"@babel/runtime-corejs3/core-js-stable/instance/bind":58,"@babel/runtime-corejs3/core-js-stable/instance/for-each":65,"@babel/runtime-corejs3/core-js-stable/instance/index-of":67,"@babel/runtime-corejs3/core-js-stable/instance/keys":68,"@babel/runtime-corejs3/core-js-stable/instance/slice":72,"@babel/runtime-corejs3/core-js-stable/instance/values":76,"@babel/runtime-corejs3/core-js-stable/json/stringify":77,"@babel/runtime-corejs3/core-js-stable/map":78,"@babel/runtime-corejs3/core-js-stable/object/define-property":83,"@babel/runtime-corejs3/core-js-stable/reflect/construct":94,"@babel/runtime-corejs3/core-js-stable/set-timeout":96,"@babel/runtime-corejs3/core-js-stable/symbol":98,"@babel/runtime-corejs3/core-js/get-iterator-method":102,"@babel/runtime-corejs3/helpers/assertThisInitialized":120,"@babel/runtime-corejs3/helpers/classCallCheck":122,"@babel/runtime-corejs3/helpers/createClass":124,"@babel/runtime-corejs3/helpers/defineProperty":125,"@babel/runtime-corejs3/helpers/getPrototypeOf":127,"@babel/runtime-corejs3/helpers/inherits":128,"@babel/runtime-corejs3/helpers/interopRequireDefault":129,"@babel/runtime-corejs3/helpers/possibleConstructorReturn":136,"@babel/runtime-corejs3/helpers/typeof":141}],11:[function(_dereq_,module,exports){
3221
+ },{"./CoreManager":4,"./EventEmitter":6,"./LiveQuerySubscription":11,"./ParseError":21,"./ParseObject":26,"./Socket.weapp":38,"./promiseUtils":52,"@babel/runtime-corejs3/core-js-stable/array/from":56,"@babel/runtime-corejs3/core-js-stable/array/is-array":57,"@babel/runtime-corejs3/core-js-stable/instance/bind":58,"@babel/runtime-corejs3/core-js-stable/instance/for-each":65,"@babel/runtime-corejs3/core-js-stable/instance/index-of":67,"@babel/runtime-corejs3/core-js-stable/instance/keys":68,"@babel/runtime-corejs3/core-js-stable/instance/slice":72,"@babel/runtime-corejs3/core-js-stable/instance/values":76,"@babel/runtime-corejs3/core-js-stable/json/stringify":77,"@babel/runtime-corejs3/core-js-stable/map":78,"@babel/runtime-corejs3/core-js-stable/object/define-property":83,"@babel/runtime-corejs3/core-js-stable/reflect/construct":94,"@babel/runtime-corejs3/core-js-stable/set-timeout":96,"@babel/runtime-corejs3/core-js-stable/symbol":98,"@babel/runtime-corejs3/core-js/get-iterator-method":102,"@babel/runtime-corejs3/helpers/assertThisInitialized":120,"@babel/runtime-corejs3/helpers/classCallCheck":122,"@babel/runtime-corejs3/helpers/createClass":124,"@babel/runtime-corejs3/helpers/defineProperty":125,"@babel/runtime-corejs3/helpers/getPrototypeOf":127,"@babel/runtime-corejs3/helpers/inherits":128,"@babel/runtime-corejs3/helpers/interopRequireDefault":129,"@babel/runtime-corejs3/helpers/possibleConstructorReturn":136,"@babel/runtime-corejs3/helpers/typeof":141}],11:[function(_dereq_,module,exports){
3209
3222
  "use strict";
3210
3223
 
3211
3224
  var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
@@ -24413,8 +24426,8 @@ var RESTController = {
24413
24426
  headers[key] = customHeaders[key];
24414
24427
  }
24415
24428
 
24416
- function handleProgress(type, event) {
24417
- if (options && typeof options.progress === 'function') {
24429
+ if (options && typeof options.progress === 'function') {
24430
+ var handleProgress = function handleProgress(type, event) {
24418
24431
  if (event.lengthComputable) {
24419
24432
  options.progress(event.loaded / event.total, event.loaded, event.total, {
24420
24433
  type: type
@@ -24424,17 +24437,17 @@ var RESTController = {
24424
24437
  type: type
24425
24438
  });
24426
24439
  }
24427
- }
24428
- }
24429
-
24430
- xhr.onprogress = function (event) {
24431
- handleProgress('download', event);
24432
- };
24440
+ };
24433
24441
 
24434
- if (xhr.upload) {
24435
- xhr.upload.onprogress = function (event) {
24436
- handleProgress('upload', event);
24442
+ xhr.onprogress = function (event) {
24443
+ handleProgress('download', event);
24437
24444
  };
24445
+
24446
+ if (xhr.upload) {
24447
+ xhr.upload.onprogress = function (event) {
24448
+ handleProgress('upload', event);
24449
+ };
24450
+ }
24438
24451
  }
24439
24452
 
24440
24453
  xhr.open(method, url, true);