parse 5.0.0 → 5.1.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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Parse JavaScript SDK v5.0.0
2
+ * Parse JavaScript SDK v5.1.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
@@ -557,7 +557,7 @@ var config /*: Config & { [key: string]: mixed }*/ = {
557
557
  SERVER_AUTH_TOKEN: null,
558
558
  LIVEQUERY_SERVER_URL: null,
559
559
  ENCRYPTED_KEY: null,
560
- VERSION: 'js' + "5.0.0",
560
+ VERSION: 'js' + "5.1.0-alpha.2",
561
561
  APPLICATION_ID: null,
562
562
  JAVASCRIPT_KEY: null,
563
563
  MASTER_KEY: null,
@@ -3995,12 +3995,13 @@ function matchesKeyConstraints(className, object, objects, key, constraints) {
3995
3995
  }
3996
3996
  // More complex cases
3997
3997
  for (var condition in constraints) {
3998
+ var _compareTo, _compareTo2;
3998
3999
  compareTo = constraints[condition];
3999
- if (compareTo.__type) {
4000
+ if ((_compareTo = compareTo) !== null && _compareTo !== void 0 && _compareTo.__type) {
4000
4001
  compareTo = decode(compareTo);
4001
4002
  }
4002
4003
  // is it a $relativeTime? convert to date
4003
- if (compareTo['$relativeTime']) {
4004
+ if ((_compareTo2 = compareTo) !== null && _compareTo2 !== void 0 && _compareTo2['$relativeTime']) {
4004
4005
  var parserResult = relativeTimeToDate(compareTo['$relativeTime']);
4005
4006
  if (parserResult.status !== 'success') {
4006
4007
  var _context2;
@@ -9339,14 +9340,17 @@ var ParseObject = /*#__PURE__*/function () {
9339
9340
  attrs[arg1] = arg2;
9340
9341
  options = arg3;
9341
9342
  }
9343
+ options = options || {};
9342
9344
  if (attrs) {
9343
- var validation = this.validate(attrs);
9344
- if (validation) {
9345
- return _promise.default.reject(validation);
9345
+ var validationError;
9346
+ options.error = function (_, validation) {
9347
+ validationError = validation;
9348
+ };
9349
+ var success = this.set(attrs, options);
9350
+ if (!success) {
9351
+ return _promise.default.reject(validationError);
9346
9352
  }
9347
- this.set(attrs, options);
9348
9353
  }
9349
- options = options || {};
9350
9354
  var saveOptions = {};
9351
9355
  if (options.hasOwnProperty('useMasterKey')) {
9352
9356
  saveOptions.useMasterKey = !!options.useMasterKey;
@@ -15049,6 +15053,13 @@ exports.default = _default;
15049
15053
  "use strict";
15050
15054
 
15051
15055
  var _Reflect$construct = _dereq_("@babel/runtime-corejs3/core-js-stable/reflect/construct");
15056
+ var _Object$keys = _dereq_("@babel/runtime-corejs3/core-js-stable/object/keys");
15057
+ var _Object$getOwnPropertySymbols = _dereq_("@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols");
15058
+ var _filterInstanceProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/instance/filter");
15059
+ var _Object$getOwnPropertyDescriptor = _dereq_("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
15060
+ var _forEachInstanceProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/instance/for-each");
15061
+ var _Object$getOwnPropertyDescriptors = _dereq_("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors");
15062
+ var _Object$defineProperties = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-properties");
15052
15063
  var _Object$defineProperty2 = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
15053
15064
  var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
15054
15065
  _Object$defineProperty2(exports, "__esModule", {
@@ -15057,8 +15068,9 @@ _Object$defineProperty2(exports, "__esModule", {
15057
15068
  exports.default = void 0;
15058
15069
  var _regenerator = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/regenerator"));
15059
15070
  var _promise = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/promise"));
15060
- var _defineProperty = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property"));
15071
+ var _defineProperty2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property"));
15061
15072
  var _stringify = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/json/stringify"));
15073
+ var _defineProperty3 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/defineProperty"));
15062
15074
  var _asyncToGenerator2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/asyncToGenerator"));
15063
15075
  var _typeof2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/typeof"));
15064
15076
  var _classCallCheck2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/classCallCheck"));
@@ -15073,6 +15085,28 @@ var _ParseError = _interopRequireDefault(_dereq_("./ParseError"));
15073
15085
  var _ParseObject2 = _interopRequireDefault(_dereq_("./ParseObject"));
15074
15086
  var _ParseSession = _interopRequireDefault(_dereq_("./ParseSession"));
15075
15087
  var _Storage = _interopRequireDefault(_dereq_("./Storage"));
15088
+ function ownKeys(object, enumerableOnly) {
15089
+ var keys = _Object$keys(object);
15090
+ if (_Object$getOwnPropertySymbols) {
15091
+ var symbols = _Object$getOwnPropertySymbols(object);
15092
+ enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) {
15093
+ return _Object$getOwnPropertyDescriptor(object, sym).enumerable;
15094
+ })), keys.push.apply(keys, symbols);
15095
+ }
15096
+ return keys;
15097
+ }
15098
+ function _objectSpread(target) {
15099
+ for (var i = 1; i < arguments.length; i++) {
15100
+ var _context7, _context8;
15101
+ var source = null != arguments[i] ? arguments[i] : {};
15102
+ i % 2 ? _forEachInstanceProperty(_context7 = ownKeys(Object(source), !0)).call(_context7, function (key) {
15103
+ (0, _defineProperty3.default)(target, key, source[key]);
15104
+ }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context8 = ownKeys(Object(source))).call(_context8, function (key) {
15105
+ _Object$defineProperty2(target, key, _Object$getOwnPropertyDescriptor(source, key));
15106
+ });
15107
+ }
15108
+ return target;
15109
+ }
15076
15110
  function _createSuper(Derived) {
15077
15111
  var hasNativeReflectConstruct = _isNativeReflectConstruct();
15078
15112
  return function () {
@@ -15809,10 +15843,11 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
15809
15843
  /**
15810
15844
  * Verify whether a given password is the password of the current user.
15811
15845
  *
15812
- * @param {string} password A password to be verified
15813
- * @param {object} options
15814
- * @returns {Promise} A promise that is fulfilled with a user
15815
- * when the password is correct.
15846
+ * @param {string} password The password to be verified.
15847
+ * @param {object} options The options.
15848
+ * @param {boolean} [options.ignoreEmailVerification=false] Set to `true` to bypass email verification and verify
15849
+ * the password regardless of whether the email has been verified. This requires the master key.
15850
+ * @returns {Promise} A promise that is fulfilled with a user when the password is correct.
15816
15851
  */
15817
15852
  }, {
15818
15853
  key: "verifyPassword",
@@ -15840,7 +15875,7 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
15840
15875
  if (protoProps) {
15841
15876
  for (var _prop in protoProps) {
15842
15877
  if (_prop !== 'className') {
15843
- (0, _defineProperty.default)(ParseUser.prototype, _prop, {
15878
+ (0, _defineProperty2.default)(ParseUser.prototype, _prop, {
15844
15879
  value: protoProps[_prop],
15845
15880
  enumerable: false,
15846
15881
  writable: true,
@@ -15852,7 +15887,7 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
15852
15887
  if (classProps) {
15853
15888
  for (var _prop2 in classProps) {
15854
15889
  if (_prop2 !== 'className') {
15855
- (0, _defineProperty.default)(ParseUser, _prop2, {
15890
+ (0, _defineProperty2.default)(ParseUser, _prop2, {
15856
15891
  value: classProps[_prop2],
15857
15892
  enumerable: false,
15858
15893
  writable: true,
@@ -16155,13 +16190,14 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
16155
16190
 
16156
16191
  /**
16157
16192
  * Verify whether a given password is the password of the current user.
16158
- *
16159
- * @param {string} username A username to be used for identificaiton
16160
- * @param {string} password A password to be verified
16161
- * @param {object} options
16162
16193
  * @static
16163
- * @returns {Promise} A promise that is fulfilled with a user
16164
- * when the password is correct.
16194
+ *
16195
+ * @param {string} username The username of the user whose password should be verified.
16196
+ * @param {string} password The password to be verified.
16197
+ * @param {object} options The options.
16198
+ * @param {boolean} [options.ignoreEmailVerification=false] Set to `true` to bypass email verification and verify
16199
+ * the password regardless of whether the email has been verified. This requires the master key.
16200
+ * @returns {Promise} A promise that is fulfilled with a user when the password is correct.
16165
16201
  */
16166
16202
  }, {
16167
16203
  key: "verifyPassword",
@@ -16172,13 +16208,8 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
16172
16208
  if (typeof password !== 'string') {
16173
16209
  return _promise.default.reject(new _ParseError.default(_ParseError.default.OTHER_CAUSE, 'Password must be a string.'));
16174
16210
  }
16175
- options = options || {};
16176
- var verificationOption = {};
16177
- if (options.hasOwnProperty('useMasterKey')) {
16178
- verificationOption.useMasterKey = options.useMasterKey;
16179
- }
16180
16211
  var controller = _CoreManager.default.getUserController();
16181
- return controller.verifyPassword(username, password, verificationOption);
16212
+ return controller.verifyPassword(username, password, options || {});
16182
16213
  }
16183
16214
 
16184
16215
  /**
@@ -16577,10 +16608,13 @@ var DefaultController = {
16577
16608
  },
16578
16609
  verifyPassword: function (username /*: string*/, password /*: string*/, options /*: RequestOptions*/) {
16579
16610
  var RESTController = _CoreManager.default.getRESTController();
16580
- return RESTController.request('GET', 'verifyPassword', {
16611
+ var data = _objectSpread({
16581
16612
  username: username,
16582
16613
  password: password
16583
- }, options);
16614
+ }, options.ignoreEmailVerification !== undefined && {
16615
+ ignoreEmailVerification: options.ignoreEmailVerification
16616
+ });
16617
+ return RESTController.request('GET', 'verifyPassword', data, options);
16584
16618
  },
16585
16619
  requestEmailVerification: function (email /*: string*/, options /*: RequestOptions*/) {
16586
16620
  var RESTController = _CoreManager.default.getRESTController();
@@ -16592,7 +16626,7 @@ var DefaultController = {
16592
16626
  _CoreManager.default.setUserController(DefaultController);
16593
16627
  var _default = ParseUser;
16594
16628
  exports.default = _default;
16595
- },{"./CoreManager":4,"./ParseError":22,"./ParseObject":27,"./ParseSession":34,"./Storage":40,"./isRevocableSession":51,"@babel/runtime-corejs3/core-js-stable/json/stringify":77,"@babel/runtime-corejs3/core-js-stable/object/define-property":83,"@babel/runtime-corejs3/core-js-stable/promise":92,"@babel/runtime-corejs3/core-js-stable/reflect/construct":93,"@babel/runtime-corejs3/helpers/asyncToGenerator":104,"@babel/runtime-corejs3/helpers/classCallCheck":105,"@babel/runtime-corejs3/helpers/createClass":107,"@babel/runtime-corejs3/helpers/get":109,"@babel/runtime-corejs3/helpers/getPrototypeOf":110,"@babel/runtime-corejs3/helpers/inherits":111,"@babel/runtime-corejs3/helpers/interopRequireDefault":112,"@babel/runtime-corejs3/helpers/possibleConstructorReturn":119,"@babel/runtime-corejs3/helpers/typeof":127,"@babel/runtime-corejs3/regenerator":130}],36:[function(_dereq_,module,exports){
16629
+ },{"./CoreManager":4,"./ParseError":22,"./ParseObject":27,"./ParseSession":34,"./Storage":40,"./isRevocableSession":51,"@babel/runtime-corejs3/core-js-stable/instance/filter":63,"@babel/runtime-corejs3/core-js-stable/instance/for-each":66,"@babel/runtime-corejs3/core-js-stable/json/stringify":77,"@babel/runtime-corejs3/core-js-stable/object/define-properties":82,"@babel/runtime-corejs3/core-js-stable/object/define-property":83,"@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor":86,"@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors":87,"@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols":88,"@babel/runtime-corejs3/core-js-stable/object/keys":90,"@babel/runtime-corejs3/core-js-stable/promise":92,"@babel/runtime-corejs3/core-js-stable/reflect/construct":93,"@babel/runtime-corejs3/helpers/asyncToGenerator":104,"@babel/runtime-corejs3/helpers/classCallCheck":105,"@babel/runtime-corejs3/helpers/createClass":107,"@babel/runtime-corejs3/helpers/defineProperty":108,"@babel/runtime-corejs3/helpers/get":109,"@babel/runtime-corejs3/helpers/getPrototypeOf":110,"@babel/runtime-corejs3/helpers/inherits":111,"@babel/runtime-corejs3/helpers/interopRequireDefault":112,"@babel/runtime-corejs3/helpers/possibleConstructorReturn":119,"@babel/runtime-corejs3/helpers/typeof":127,"@babel/runtime-corejs3/regenerator":130}],36:[function(_dereq_,module,exports){
16596
16630
  "use strict";
16597
16631
 
16598
16632
  var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
@@ -16783,6 +16817,7 @@ var uuidv4 = _dereq_('./uuid');
16783
16817
  progress?: any,
16784
16818
  context?: any,
16785
16819
  usePost?: boolean,
16820
+ ignoreEmailVerification?: boolean,
16786
16821
  };*/
16787
16822
  /*:: export type FullOptions = {
16788
16823
  success?: any,