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.
package/dist/parse.js CHANGED
@@ -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;
@@ -9346,14 +9347,17 @@ var ParseObject = /*#__PURE__*/function () {
9346
9347
  attrs[arg1] = arg2;
9347
9348
  options = arg3;
9348
9349
  }
9350
+ options = options || {};
9349
9351
  if (attrs) {
9350
- var validation = this.validate(attrs);
9351
- if (validation) {
9352
- return _promise.default.reject(validation);
9352
+ var validationError;
9353
+ options.error = function (_, validation) {
9354
+ validationError = validation;
9355
+ };
9356
+ var success = this.set(attrs, options);
9357
+ if (!success) {
9358
+ return _promise.default.reject(validationError);
9353
9359
  }
9354
- this.set(attrs, options);
9355
9360
  }
9356
- options = options || {};
9357
9361
  var saveOptions = {};
9358
9362
  if (options.hasOwnProperty('useMasterKey')) {
9359
9363
  saveOptions.useMasterKey = !!options.useMasterKey;
@@ -15056,6 +15060,13 @@ exports.default = _default;
15056
15060
  "use strict";
15057
15061
 
15058
15062
  var _Reflect$construct = _dereq_("@babel/runtime-corejs3/core-js-stable/reflect/construct");
15063
+ var _Object$keys = _dereq_("@babel/runtime-corejs3/core-js-stable/object/keys");
15064
+ var _Object$getOwnPropertySymbols = _dereq_("@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols");
15065
+ var _filterInstanceProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/instance/filter");
15066
+ var _Object$getOwnPropertyDescriptor = _dereq_("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
15067
+ var _forEachInstanceProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/instance/for-each");
15068
+ var _Object$getOwnPropertyDescriptors = _dereq_("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors");
15069
+ var _Object$defineProperties = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-properties");
15059
15070
  var _Object$defineProperty2 = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
15060
15071
  var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
15061
15072
  _Object$defineProperty2(exports, "__esModule", {
@@ -15064,8 +15075,9 @@ _Object$defineProperty2(exports, "__esModule", {
15064
15075
  exports.default = void 0;
15065
15076
  var _regenerator = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/regenerator"));
15066
15077
  var _promise = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/promise"));
15067
- var _defineProperty = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property"));
15078
+ var _defineProperty2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property"));
15068
15079
  var _stringify = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/json/stringify"));
15080
+ var _defineProperty3 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/defineProperty"));
15069
15081
  var _asyncToGenerator2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/asyncToGenerator"));
15070
15082
  var _typeof2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/typeof"));
15071
15083
  var _classCallCheck2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/classCallCheck"));
@@ -15080,6 +15092,28 @@ var _ParseError = _interopRequireDefault(_dereq_("./ParseError"));
15080
15092
  var _ParseObject2 = _interopRequireDefault(_dereq_("./ParseObject"));
15081
15093
  var _ParseSession = _interopRequireDefault(_dereq_("./ParseSession"));
15082
15094
  var _Storage = _interopRequireDefault(_dereq_("./Storage"));
15095
+ function ownKeys(object, enumerableOnly) {
15096
+ var keys = _Object$keys(object);
15097
+ if (_Object$getOwnPropertySymbols) {
15098
+ var symbols = _Object$getOwnPropertySymbols(object);
15099
+ enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) {
15100
+ return _Object$getOwnPropertyDescriptor(object, sym).enumerable;
15101
+ })), keys.push.apply(keys, symbols);
15102
+ }
15103
+ return keys;
15104
+ }
15105
+ function _objectSpread(target) {
15106
+ for (var i = 1; i < arguments.length; i++) {
15107
+ var _context7, _context8;
15108
+ var source = null != arguments[i] ? arguments[i] : {};
15109
+ i % 2 ? _forEachInstanceProperty(_context7 = ownKeys(Object(source), !0)).call(_context7, function (key) {
15110
+ (0, _defineProperty3.default)(target, key, source[key]);
15111
+ }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context8 = ownKeys(Object(source))).call(_context8, function (key) {
15112
+ _Object$defineProperty2(target, key, _Object$getOwnPropertyDescriptor(source, key));
15113
+ });
15114
+ }
15115
+ return target;
15116
+ }
15083
15117
  function _createSuper(Derived) {
15084
15118
  var hasNativeReflectConstruct = _isNativeReflectConstruct();
15085
15119
  return function () {
@@ -15816,10 +15850,11 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
15816
15850
  /**
15817
15851
  * Verify whether a given password is the password of the current user.
15818
15852
  *
15819
- * @param {string} password A password to be verified
15820
- * @param {object} options
15821
- * @returns {Promise} A promise that is fulfilled with a user
15822
- * when the password is correct.
15853
+ * @param {string} password The password to be verified.
15854
+ * @param {object} options The options.
15855
+ * @param {boolean} [options.ignoreEmailVerification=false] Set to `true` to bypass email verification and verify
15856
+ * the password regardless of whether the email has been verified. This requires the master key.
15857
+ * @returns {Promise} A promise that is fulfilled with a user when the password is correct.
15823
15858
  */
15824
15859
  }, {
15825
15860
  key: "verifyPassword",
@@ -15847,7 +15882,7 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
15847
15882
  if (protoProps) {
15848
15883
  for (var _prop in protoProps) {
15849
15884
  if (_prop !== 'className') {
15850
- (0, _defineProperty.default)(ParseUser.prototype, _prop, {
15885
+ (0, _defineProperty2.default)(ParseUser.prototype, _prop, {
15851
15886
  value: protoProps[_prop],
15852
15887
  enumerable: false,
15853
15888
  writable: true,
@@ -15859,7 +15894,7 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
15859
15894
  if (classProps) {
15860
15895
  for (var _prop2 in classProps) {
15861
15896
  if (_prop2 !== 'className') {
15862
- (0, _defineProperty.default)(ParseUser, _prop2, {
15897
+ (0, _defineProperty2.default)(ParseUser, _prop2, {
15863
15898
  value: classProps[_prop2],
15864
15899
  enumerable: false,
15865
15900
  writable: true,
@@ -16162,13 +16197,14 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
16162
16197
 
16163
16198
  /**
16164
16199
  * Verify whether a given password is the password of the current user.
16165
- *
16166
- * @param {string} username A username to be used for identificaiton
16167
- * @param {string} password A password to be verified
16168
- * @param {object} options
16169
16200
  * @static
16170
- * @returns {Promise} A promise that is fulfilled with a user
16171
- * when the password is correct.
16201
+ *
16202
+ * @param {string} username The username of the user whose password should be verified.
16203
+ * @param {string} password The password to be verified.
16204
+ * @param {object} options The options.
16205
+ * @param {boolean} [options.ignoreEmailVerification=false] Set to `true` to bypass email verification and verify
16206
+ * the password regardless of whether the email has been verified. This requires the master key.
16207
+ * @returns {Promise} A promise that is fulfilled with a user when the password is correct.
16172
16208
  */
16173
16209
  }, {
16174
16210
  key: "verifyPassword",
@@ -16179,13 +16215,8 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
16179
16215
  if (typeof password !== 'string') {
16180
16216
  return _promise.default.reject(new _ParseError.default(_ParseError.default.OTHER_CAUSE, 'Password must be a string.'));
16181
16217
  }
16182
- options = options || {};
16183
- var verificationOption = {};
16184
- if (options.hasOwnProperty('useMasterKey')) {
16185
- verificationOption.useMasterKey = options.useMasterKey;
16186
- }
16187
16218
  var controller = _CoreManager.default.getUserController();
16188
- return controller.verifyPassword(username, password, verificationOption);
16219
+ return controller.verifyPassword(username, password, options || {});
16189
16220
  }
16190
16221
 
16191
16222
  /**
@@ -16584,10 +16615,13 @@ var DefaultController = {
16584
16615
  },
16585
16616
  verifyPassword: function (username /*: string*/, password /*: string*/, options /*: RequestOptions*/) {
16586
16617
  var RESTController = _CoreManager.default.getRESTController();
16587
- return RESTController.request('GET', 'verifyPassword', {
16618
+ var data = _objectSpread({
16588
16619
  username: username,
16589
16620
  password: password
16590
- }, options);
16621
+ }, options.ignoreEmailVerification !== undefined && {
16622
+ ignoreEmailVerification: options.ignoreEmailVerification
16623
+ });
16624
+ return RESTController.request('GET', 'verifyPassword', data, options);
16591
16625
  },
16592
16626
  requestEmailVerification: function (email /*: string*/, options /*: RequestOptions*/) {
16593
16627
  var RESTController = _CoreManager.default.getRESTController();
@@ -16599,7 +16633,7 @@ var DefaultController = {
16599
16633
  _CoreManager.default.setUserController(DefaultController);
16600
16634
  var _default = ParseUser;
16601
16635
  exports.default = _default;
16602
- },{"./CoreManager":4,"./ParseError":22,"./ParseObject":27,"./ParseSession":34,"./Storage":39,"./isRevocableSession":49,"@babel/runtime-corejs3/core-js-stable/json/stringify":75,"@babel/runtime-corejs3/core-js-stable/object/define-property":81,"@babel/runtime-corejs3/core-js-stable/promise":90,"@babel/runtime-corejs3/core-js-stable/reflect/construct":91,"@babel/runtime-corejs3/helpers/asyncToGenerator":102,"@babel/runtime-corejs3/helpers/classCallCheck":103,"@babel/runtime-corejs3/helpers/createClass":105,"@babel/runtime-corejs3/helpers/get":107,"@babel/runtime-corejs3/helpers/getPrototypeOf":108,"@babel/runtime-corejs3/helpers/inherits":109,"@babel/runtime-corejs3/helpers/interopRequireDefault":110,"@babel/runtime-corejs3/helpers/possibleConstructorReturn":117,"@babel/runtime-corejs3/helpers/typeof":125,"@babel/runtime-corejs3/regenerator":128}],36:[function(_dereq_,module,exports){
16636
+ },{"./CoreManager":4,"./ParseError":22,"./ParseObject":27,"./ParseSession":34,"./Storage":39,"./isRevocableSession":49,"@babel/runtime-corejs3/core-js-stable/instance/filter":61,"@babel/runtime-corejs3/core-js-stable/instance/for-each":64,"@babel/runtime-corejs3/core-js-stable/json/stringify":75,"@babel/runtime-corejs3/core-js-stable/object/define-properties":80,"@babel/runtime-corejs3/core-js-stable/object/define-property":81,"@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor":84,"@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors":85,"@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols":86,"@babel/runtime-corejs3/core-js-stable/object/keys":88,"@babel/runtime-corejs3/core-js-stable/promise":90,"@babel/runtime-corejs3/core-js-stable/reflect/construct":91,"@babel/runtime-corejs3/helpers/asyncToGenerator":102,"@babel/runtime-corejs3/helpers/classCallCheck":103,"@babel/runtime-corejs3/helpers/createClass":105,"@babel/runtime-corejs3/helpers/defineProperty":106,"@babel/runtime-corejs3/helpers/get":107,"@babel/runtime-corejs3/helpers/getPrototypeOf":108,"@babel/runtime-corejs3/helpers/inherits":109,"@babel/runtime-corejs3/helpers/interopRequireDefault":110,"@babel/runtime-corejs3/helpers/possibleConstructorReturn":117,"@babel/runtime-corejs3/helpers/typeof":125,"@babel/runtime-corejs3/regenerator":128}],36:[function(_dereq_,module,exports){
16603
16637
  "use strict";
16604
16638
 
16605
16639
  var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
@@ -16790,6 +16824,7 @@ var uuidv4 = _dereq_('./uuid');
16790
16824
  progress?: any,
16791
16825
  context?: any,
16792
16826
  usePost?: boolean,
16827
+ ignoreEmailVerification?: boolean,
16793
16828
  };*/
16794
16829
  /*:: export type FullOptions = {
16795
16830
  success?: any,