parse 4.2.0-alpha.7 → 4.2.0-alpha.9

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.2.0-alpha.7
2
+ * Parse JavaScript SDK v4.2.0-alpha.9
3
3
  *
4
4
  * The source tree of this library can be found at
5
5
  * https://github.com/ParsePlatform/Parse-SDK-JS
@@ -538,7 +538,7 @@ var config /*: Config & { [key: string]: mixed }*/ = {
538
538
  SERVER_AUTH_TOKEN: null,
539
539
  LIVEQUERY_SERVER_URL: null,
540
540
  ENCRYPTED_KEY: null,
541
- VERSION: 'js' + "4.2.0-alpha.7",
541
+ VERSION: 'js' + "4.2.0-alpha.9",
542
542
  APPLICATION_ID: null,
543
543
  JAVASCRIPT_KEY: null,
544
544
  MASTER_KEY: null,
@@ -547,7 +547,8 @@ var config /*: Config & { [key: string]: mixed }*/ = {
547
547
  FORCE_REVOCABLE_SESSION: false,
548
548
  ENCRYPTED_USER: false,
549
549
  IDEMPOTENCY: false,
550
- ALLOW_CUSTOM_OBJECT_ID: false
550
+ ALLOW_CUSTOM_OBJECT_ID: false,
551
+ PARSE_ERRORS: []
551
552
  };
552
553
  function requireMethods(name /*: string*/, methods /*: Array<string>*/, controller /*: any*/) {
553
554
  (0, _forEach.default)(methods).call(methods, function (func) {
@@ -767,6 +768,7 @@ var _regenerator = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/regene
767
768
  var _toConsumableArray2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/toConsumableArray"));
768
769
  var _asyncToGenerator2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/asyncToGenerator"));
769
770
  var _CoreManager = _interopRequireDefault(_dereq_("./CoreManager"));
771
+ var _ParseError = _interopRequireDefault(_dereq_("./ParseError"));
770
772
  var _ParseObject = _interopRequireDefault(_dereq_("./ParseObject"));
771
773
  var _ParseQuery = _interopRequireDefault(_dereq_("./ParseQuery"));
772
774
  var _Storage = _interopRequireDefault(_dereq_("./Storage"));
@@ -1158,7 +1160,7 @@ var EventuallyQueue = {
1158
1160
  case 14:
1159
1161
  _context6.prev = 14;
1160
1162
  _context6.t1 = _context6["catch"](7);
1161
- if (!(_context6.t1.message !== 'XMLHttpRequest failed: "Unable to connect to the Parse API"')) {
1163
+ if (!(_context6.t1.code !== _ParseError.default.CONNECTION_FAILED)) {
1162
1164
  _context6.next = 19;
1163
1165
  break;
1164
1166
  }
@@ -1179,7 +1181,7 @@ var EventuallyQueue = {
1179
1181
  case 27:
1180
1182
  _context6.prev = 27;
1181
1183
  _context6.t2 = _context6["catch"](20);
1182
- if (!(_context6.t2.message !== 'XMLHttpRequest failed: "Unable to connect to the Parse API"')) {
1184
+ if (!(_context6.t2.code !== _ParseError.default.CONNECTION_FAILED)) {
1183
1185
  _context6.next = 32;
1184
1186
  break;
1185
1187
  }
@@ -1309,7 +1311,7 @@ var EventuallyQueue = {
1309
1311
  module.exports = EventuallyQueue;
1310
1312
  var _default = EventuallyQueue;
1311
1313
  exports.default = _default;
1312
- },{"./CoreManager":4,"./ParseObject":26,"./ParseQuery":29,"./Storage":39,"@babel/runtime-corejs3/core-js-stable/instance/find":64,"@babel/runtime-corejs3/core-js-stable/instance/find-index":63,"@babel/runtime-corejs3/core-js-stable/instance/splice":73,"@babel/runtime-corejs3/core-js-stable/json/stringify":76,"@babel/runtime-corejs3/core-js-stable/object/define-property":82,"@babel/runtime-corejs3/core-js-stable/set-interval":93,"@babel/runtime-corejs3/helpers/asyncToGenerator":103,"@babel/runtime-corejs3/helpers/interopRequireDefault":111,"@babel/runtime-corejs3/helpers/toConsumableArray":123,"@babel/runtime-corejs3/regenerator":129}],8:[function(_dereq_,module,exports){
1314
+ },{"./CoreManager":4,"./ParseError":21,"./ParseObject":26,"./ParseQuery":29,"./Storage":39,"@babel/runtime-corejs3/core-js-stable/instance/find":64,"@babel/runtime-corejs3/core-js-stable/instance/find-index":63,"@babel/runtime-corejs3/core-js-stable/instance/splice":73,"@babel/runtime-corejs3/core-js-stable/json/stringify":76,"@babel/runtime-corejs3/core-js-stable/object/define-property":82,"@babel/runtime-corejs3/core-js-stable/set-interval":93,"@babel/runtime-corejs3/helpers/asyncToGenerator":103,"@babel/runtime-corejs3/helpers/interopRequireDefault":111,"@babel/runtime-corejs3/helpers/toConsumableArray":123,"@babel/runtime-corejs3/regenerator":129}],8:[function(_dereq_,module,exports){
1313
1315
  "use strict";
1314
1316
 
1315
1317
  var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
@@ -6023,6 +6025,7 @@ _Object$defineProperty2(exports, "__esModule", {
6023
6025
  value: true
6024
6026
  });
6025
6027
  exports.default = void 0;
6028
+ var _forEach = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/for-each"));
6026
6029
  var _defineProperty = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property"));
6027
6030
  var _classCallCheck2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/classCallCheck"));
6028
6031
  var _createClass2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/createClass"));
@@ -6031,6 +6034,7 @@ var _inherits2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/
6031
6034
  var _possibleConstructorReturn2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/possibleConstructorReturn"));
6032
6035
  var _getPrototypeOf2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/getPrototypeOf"));
6033
6036
  var _wrapNativeSuper2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/wrapNativeSuper"));
6037
+ var _CoreManager = _interopRequireDefault(_dereq_("./CoreManager"));
6034
6038
  function _createSuper(Derived) {
6035
6039
  var hasNativeReflectConstruct = _isNativeReflectConstruct();
6036
6040
  return function () {
@@ -6059,6 +6063,8 @@ function _isNativeReflectConstruct() {
6059
6063
  /**
6060
6064
  * Constructs a new Parse.Error object with the given code and message.
6061
6065
  *
6066
+ * Parse.CoreManager.set('PARSE_ERRORS', [{ code, message }]) can be use to override error messages.
6067
+ *
6062
6068
  * @alias Parse.Error
6063
6069
  */
6064
6070
  var ParseError = /*#__PURE__*/function (_Error) {
@@ -6069,13 +6075,20 @@ var ParseError = /*#__PURE__*/function (_Error) {
6069
6075
  * @param {string} message A detailed description of the error.
6070
6076
  */
6071
6077
  function ParseError(code, message) {
6078
+ var _context;
6072
6079
  var _this;
6073
6080
  (0, _classCallCheck2.default)(this, ParseError);
6074
6081
  _this = _super.call(this, message);
6075
6082
  _this.code = code;
6083
+ var customMessage = message;
6084
+ (0, _forEach.default)(_context = _CoreManager.default.get('PARSE_ERRORS')).call(_context, function (error) {
6085
+ if (error.code === code && error.code) {
6086
+ customMessage = error.message;
6087
+ }
6088
+ });
6076
6089
  (0, _defineProperty.default)((0, _assertThisInitialized2.default)(_this), 'message', {
6077
6090
  enumerable: true,
6078
- value: message
6091
+ value: customMessage
6079
6092
  });
6080
6093
  return _this;
6081
6094
  }
@@ -6604,7 +6617,7 @@ ParseError.FILE_READ_ERROR = 601;
6604
6617
  ParseError.X_DOMAIN_REQUEST = 602;
6605
6618
  var _default = ParseError;
6606
6619
  exports.default = _default;
6607
- },{"@babel/runtime-corejs3/core-js-stable/object/define-property":82,"@babel/runtime-corejs3/core-js-stable/reflect/construct":92,"@babel/runtime-corejs3/helpers/assertThisInitialized":102,"@babel/runtime-corejs3/helpers/classCallCheck":104,"@babel/runtime-corejs3/helpers/createClass":106,"@babel/runtime-corejs3/helpers/getPrototypeOf":109,"@babel/runtime-corejs3/helpers/inherits":110,"@babel/runtime-corejs3/helpers/interopRequireDefault":111,"@babel/runtime-corejs3/helpers/possibleConstructorReturn":118,"@babel/runtime-corejs3/helpers/wrapNativeSuper":128}],22:[function(_dereq_,module,exports){
6620
+ },{"./CoreManager":4,"@babel/runtime-corejs3/core-js-stable/instance/for-each":65,"@babel/runtime-corejs3/core-js-stable/object/define-property":82,"@babel/runtime-corejs3/core-js-stable/reflect/construct":92,"@babel/runtime-corejs3/helpers/assertThisInitialized":102,"@babel/runtime-corejs3/helpers/classCallCheck":104,"@babel/runtime-corejs3/helpers/createClass":106,"@babel/runtime-corejs3/helpers/getPrototypeOf":109,"@babel/runtime-corejs3/helpers/inherits":110,"@babel/runtime-corejs3/helpers/interopRequireDefault":111,"@babel/runtime-corejs3/helpers/possibleConstructorReturn":118,"@babel/runtime-corejs3/helpers/wrapNativeSuper":128}],22:[function(_dereq_,module,exports){
6608
6621
  "use strict";
6609
6622
 
6610
6623
  var _Object$keys2 = _dereq_("@babel/runtime-corejs3/core-js-stable/object/keys");
@@ -15531,6 +15544,9 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
15531
15544
  if (options.hasOwnProperty('usePost')) {
15532
15545
  loginOptions.usePost = options.usePost;
15533
15546
  }
15547
+ if (options.hasOwnProperty('context') && Object.prototype.toString.call(options.context) === '[object Object]') {
15548
+ loginOptions.context = options.context;
15549
+ }
15534
15550
  var controller = _CoreManager.default.getUserController();
15535
15551
  return controller.logIn(this, loginOptions);
15536
15552
  }