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 +66 -31
- package/dist/parse.min.js +2 -2
- package/dist/parse.weapp.js +66 -31
- package/dist/parse.weapp.min.js +2 -2
- package/lib/browser/CoreManager.js +1 -1
- package/lib/browser/OfflineQuery.js +3 -2
- package/lib/browser/ParseObject.js +8 -5
- package/lib/browser/ParseUser.js +51 -21
- package/lib/browser/RESTController.js +1 -0
- package/lib/node/CoreManager.js +1 -1
- package/lib/node/OfflineQuery.js +3 -2
- package/lib/node/ParseObject.js +8 -5
- package/lib/node/ParseUser.js +20 -19
- package/lib/node/RESTController.js +1 -0
- package/lib/react-native/CoreManager.js +1 -1
- package/lib/react-native/OfflineQuery.js +3 -2
- package/lib/react-native/ParseObject.js +8 -5
- package/lib/react-native/ParseUser.js +6 -8
- package/lib/weapp/CoreManager.js +1 -1
- package/lib/weapp/OfflineQuery.js +3 -2
- package/lib/weapp/ParseObject.js +8 -5
- package/lib/weapp/ParseUser.js +51 -21
- package/lib/weapp/RESTController.js +1 -0
- package/package.json +2 -2
|
@@ -187,7 +187,7 @@ var config /*: Config & { [key: string]: mixed }*/ = {
|
|
|
187
187
|
SERVER_AUTH_TOKEN: null,
|
|
188
188
|
LIVEQUERY_SERVER_URL: null,
|
|
189
189
|
ENCRYPTED_KEY: null,
|
|
190
|
-
VERSION: 'js' + "5.0.
|
|
190
|
+
VERSION: 'js' + "5.1.0-alpha.2",
|
|
191
191
|
APPLICATION_ID: null,
|
|
192
192
|
JAVASCRIPT_KEY: null,
|
|
193
193
|
MASTER_KEY: null,
|
|
@@ -386,12 +386,13 @@ function matchesKeyConstraints(className, object, objects, key, constraints) {
|
|
|
386
386
|
}
|
|
387
387
|
// More complex cases
|
|
388
388
|
for (var condition in constraints) {
|
|
389
|
+
var _compareTo, _compareTo2;
|
|
389
390
|
compareTo = constraints[condition];
|
|
390
|
-
if (compareTo.__type) {
|
|
391
|
+
if ((_compareTo = compareTo) !== null && _compareTo !== void 0 && _compareTo.__type) {
|
|
391
392
|
compareTo = decode(compareTo);
|
|
392
393
|
}
|
|
393
394
|
// is it a $relativeTime? convert to date
|
|
394
|
-
if (compareTo['$relativeTime']) {
|
|
395
|
+
if ((_compareTo2 = compareTo) !== null && _compareTo2 !== void 0 && _compareTo2['$relativeTime']) {
|
|
395
396
|
var parserResult = relativeTimeToDate(compareTo['$relativeTime']);
|
|
396
397
|
if (parserResult.status !== 'success') {
|
|
397
398
|
var _context2;
|
|
@@ -1573,14 +1573,17 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
1573
1573
|
attrs[arg1] = arg2;
|
|
1574
1574
|
options = arg3;
|
|
1575
1575
|
}
|
|
1576
|
+
options = options || {};
|
|
1576
1577
|
if (attrs) {
|
|
1577
|
-
var
|
|
1578
|
-
|
|
1579
|
-
|
|
1578
|
+
var validationError;
|
|
1579
|
+
options.error = function (_, validation) {
|
|
1580
|
+
validationError = validation;
|
|
1581
|
+
};
|
|
1582
|
+
var success = this.set(attrs, options);
|
|
1583
|
+
if (!success) {
|
|
1584
|
+
return _promise.default.reject(validationError);
|
|
1580
1585
|
}
|
|
1581
|
-
this.set(attrs, options);
|
|
1582
1586
|
}
|
|
1583
|
-
options = options || {};
|
|
1584
1587
|
var saveOptions = {};
|
|
1585
1588
|
if (options.hasOwnProperty('useMasterKey')) {
|
|
1586
1589
|
saveOptions.useMasterKey = !!options.useMasterKey;
|
package/lib/browser/ParseUser.js
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _Reflect$construct = require("@babel/runtime-corejs3/core-js-stable/reflect/construct");
|
|
4
|
+
var _Object$keys = require("@babel/runtime-corejs3/core-js-stable/object/keys");
|
|
5
|
+
var _Object$getOwnPropertySymbols = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols");
|
|
6
|
+
var _filterInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/filter");
|
|
7
|
+
var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
|
|
8
|
+
var _forEachInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/for-each");
|
|
9
|
+
var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors");
|
|
10
|
+
var _Object$defineProperties = require("@babel/runtime-corejs3/core-js-stable/object/define-properties");
|
|
4
11
|
var _Object$defineProperty2 = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
|
5
12
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
6
13
|
_Object$defineProperty2(exports, "__esModule", {
|
|
@@ -9,8 +16,9 @@ _Object$defineProperty2(exports, "__esModule", {
|
|
|
9
16
|
exports.default = void 0;
|
|
10
17
|
var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs3/regenerator"));
|
|
11
18
|
var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/promise"));
|
|
12
|
-
var
|
|
19
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/define-property"));
|
|
13
20
|
var _stringify = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/json/stringify"));
|
|
21
|
+
var _defineProperty3 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
|
|
14
22
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/asyncToGenerator"));
|
|
15
23
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/typeof"));
|
|
16
24
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/classCallCheck"));
|
|
@@ -25,6 +33,28 @@ var _ParseError = _interopRequireDefault(require("./ParseError"));
|
|
|
25
33
|
var _ParseObject2 = _interopRequireDefault(require("./ParseObject"));
|
|
26
34
|
var _ParseSession = _interopRequireDefault(require("./ParseSession"));
|
|
27
35
|
var _Storage = _interopRequireDefault(require("./Storage"));
|
|
36
|
+
function ownKeys(object, enumerableOnly) {
|
|
37
|
+
var keys = _Object$keys(object);
|
|
38
|
+
if (_Object$getOwnPropertySymbols) {
|
|
39
|
+
var symbols = _Object$getOwnPropertySymbols(object);
|
|
40
|
+
enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) {
|
|
41
|
+
return _Object$getOwnPropertyDescriptor(object, sym).enumerable;
|
|
42
|
+
})), keys.push.apply(keys, symbols);
|
|
43
|
+
}
|
|
44
|
+
return keys;
|
|
45
|
+
}
|
|
46
|
+
function _objectSpread(target) {
|
|
47
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
48
|
+
var _context7, _context8;
|
|
49
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
50
|
+
i % 2 ? _forEachInstanceProperty(_context7 = ownKeys(Object(source), !0)).call(_context7, function (key) {
|
|
51
|
+
(0, _defineProperty3.default)(target, key, source[key]);
|
|
52
|
+
}) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context8 = ownKeys(Object(source))).call(_context8, function (key) {
|
|
53
|
+
_Object$defineProperty2(target, key, _Object$getOwnPropertyDescriptor(source, key));
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
return target;
|
|
57
|
+
}
|
|
28
58
|
function _createSuper(Derived) {
|
|
29
59
|
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
|
30
60
|
return function () {
|
|
@@ -761,10 +791,11 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
|
|
|
761
791
|
/**
|
|
762
792
|
* Verify whether a given password is the password of the current user.
|
|
763
793
|
*
|
|
764
|
-
* @param {string} password
|
|
765
|
-
* @param {object} options
|
|
766
|
-
* @
|
|
767
|
-
*
|
|
794
|
+
* @param {string} password The password to be verified.
|
|
795
|
+
* @param {object} options The options.
|
|
796
|
+
* @param {boolean} [options.ignoreEmailVerification=false] Set to `true` to bypass email verification and verify
|
|
797
|
+
* the password regardless of whether the email has been verified. This requires the master key.
|
|
798
|
+
* @returns {Promise} A promise that is fulfilled with a user when the password is correct.
|
|
768
799
|
*/
|
|
769
800
|
}, {
|
|
770
801
|
key: "verifyPassword",
|
|
@@ -792,7 +823,7 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
|
|
|
792
823
|
if (protoProps) {
|
|
793
824
|
for (var _prop in protoProps) {
|
|
794
825
|
if (_prop !== 'className') {
|
|
795
|
-
(0,
|
|
826
|
+
(0, _defineProperty2.default)(ParseUser.prototype, _prop, {
|
|
796
827
|
value: protoProps[_prop],
|
|
797
828
|
enumerable: false,
|
|
798
829
|
writable: true,
|
|
@@ -804,7 +835,7 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
|
|
|
804
835
|
if (classProps) {
|
|
805
836
|
for (var _prop2 in classProps) {
|
|
806
837
|
if (_prop2 !== 'className') {
|
|
807
|
-
(0,
|
|
838
|
+
(0, _defineProperty2.default)(ParseUser, _prop2, {
|
|
808
839
|
value: classProps[_prop2],
|
|
809
840
|
enumerable: false,
|
|
810
841
|
writable: true,
|
|
@@ -1107,13 +1138,14 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
|
|
|
1107
1138
|
|
|
1108
1139
|
/**
|
|
1109
1140
|
* Verify whether a given password is the password of the current user.
|
|
1110
|
-
*
|
|
1111
|
-
* @param {string} username A username to be used for identificaiton
|
|
1112
|
-
* @param {string} password A password to be verified
|
|
1113
|
-
* @param {object} options
|
|
1114
1141
|
* @static
|
|
1115
|
-
*
|
|
1116
|
-
*
|
|
1142
|
+
*
|
|
1143
|
+
* @param {string} username The username of the user whose password should be verified.
|
|
1144
|
+
* @param {string} password The password to be verified.
|
|
1145
|
+
* @param {object} options The options.
|
|
1146
|
+
* @param {boolean} [options.ignoreEmailVerification=false] Set to `true` to bypass email verification and verify
|
|
1147
|
+
* the password regardless of whether the email has been verified. This requires the master key.
|
|
1148
|
+
* @returns {Promise} A promise that is fulfilled with a user when the password is correct.
|
|
1117
1149
|
*/
|
|
1118
1150
|
}, {
|
|
1119
1151
|
key: "verifyPassword",
|
|
@@ -1124,13 +1156,8 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
|
|
|
1124
1156
|
if (typeof password !== 'string') {
|
|
1125
1157
|
return _promise.default.reject(new _ParseError.default(_ParseError.default.OTHER_CAUSE, 'Password must be a string.'));
|
|
1126
1158
|
}
|
|
1127
|
-
options = options || {};
|
|
1128
|
-
var verificationOption = {};
|
|
1129
|
-
if (options.hasOwnProperty('useMasterKey')) {
|
|
1130
|
-
verificationOption.useMasterKey = options.useMasterKey;
|
|
1131
|
-
}
|
|
1132
1159
|
var controller = _CoreManager.default.getUserController();
|
|
1133
|
-
return controller.verifyPassword(username, password,
|
|
1160
|
+
return controller.verifyPassword(username, password, options || {});
|
|
1134
1161
|
}
|
|
1135
1162
|
|
|
1136
1163
|
/**
|
|
@@ -1529,10 +1556,13 @@ var DefaultController = {
|
|
|
1529
1556
|
},
|
|
1530
1557
|
verifyPassword: function (username /*: string*/, password /*: string*/, options /*: RequestOptions*/) {
|
|
1531
1558
|
var RESTController = _CoreManager.default.getRESTController();
|
|
1532
|
-
|
|
1559
|
+
var data = _objectSpread({
|
|
1533
1560
|
username: username,
|
|
1534
1561
|
password: password
|
|
1535
|
-
}, options
|
|
1562
|
+
}, options.ignoreEmailVerification !== undefined && {
|
|
1563
|
+
ignoreEmailVerification: options.ignoreEmailVerification
|
|
1564
|
+
});
|
|
1565
|
+
return RESTController.request('GET', 'verifyPassword', data, options);
|
|
1536
1566
|
},
|
|
1537
1567
|
requestEmailVerification: function (email /*: string*/, options /*: RequestOptions*/) {
|
|
1538
1568
|
var RESTController = _CoreManager.default.getRESTController();
|
package/lib/node/CoreManager.js
CHANGED
|
@@ -183,7 +183,7 @@ const config /*: Config & { [key: string]: mixed }*/ = {
|
|
|
183
183
|
SERVER_AUTH_TOKEN: null,
|
|
184
184
|
LIVEQUERY_SERVER_URL: null,
|
|
185
185
|
ENCRYPTED_KEY: null,
|
|
186
|
-
VERSION: 'js' + "5.0.
|
|
186
|
+
VERSION: 'js' + "5.1.0-alpha.2",
|
|
187
187
|
APPLICATION_ID: null,
|
|
188
188
|
JAVASCRIPT_KEY: null,
|
|
189
189
|
MASTER_KEY: null,
|
package/lib/node/OfflineQuery.js
CHANGED
|
@@ -288,12 +288,13 @@ function matchesKeyConstraints(className, object, objects, key, constraints) {
|
|
|
288
288
|
}
|
|
289
289
|
// More complex cases
|
|
290
290
|
for (const condition in constraints) {
|
|
291
|
+
var _compareTo, _compareTo2;
|
|
291
292
|
compareTo = constraints[condition];
|
|
292
|
-
if (compareTo.__type) {
|
|
293
|
+
if ((_compareTo = compareTo) !== null && _compareTo !== void 0 && _compareTo.__type) {
|
|
293
294
|
compareTo = decode(compareTo);
|
|
294
295
|
}
|
|
295
296
|
// is it a $relativeTime? convert to date
|
|
296
|
-
if (compareTo['$relativeTime']) {
|
|
297
|
+
if ((_compareTo2 = compareTo) !== null && _compareTo2 !== void 0 && _compareTo2['$relativeTime']) {
|
|
297
298
|
const parserResult = relativeTimeToDate(compareTo['$relativeTime']);
|
|
298
299
|
if (parserResult.status !== 'success') {
|
|
299
300
|
throw new ParseError(ParseError.INVALID_JSON, `bad $relativeTime (${key}) value. ${parserResult.info}`);
|
package/lib/node/ParseObject.js
CHANGED
|
@@ -1290,14 +1290,17 @@ class ParseObject {
|
|
|
1290
1290
|
attrs[arg1] = arg2;
|
|
1291
1291
|
options = arg3;
|
|
1292
1292
|
}
|
|
1293
|
+
options = options || {};
|
|
1293
1294
|
if (attrs) {
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1295
|
+
let validationError;
|
|
1296
|
+
options.error = (_, validation) => {
|
|
1297
|
+
validationError = validation;
|
|
1298
|
+
};
|
|
1299
|
+
const success = this.set(attrs, options);
|
|
1300
|
+
if (!success) {
|
|
1301
|
+
return Promise.reject(validationError);
|
|
1297
1302
|
}
|
|
1298
|
-
this.set(attrs, options);
|
|
1299
1303
|
}
|
|
1300
|
-
options = options || {};
|
|
1301
1304
|
const saveOptions = {};
|
|
1302
1305
|
if (options.hasOwnProperty('useMasterKey')) {
|
|
1303
1306
|
saveOptions.useMasterKey = !!options.useMasterKey;
|
package/lib/node/ParseUser.js
CHANGED
|
@@ -528,10 +528,11 @@ class ParseUser extends _ParseObject.default {
|
|
|
528
528
|
/**
|
|
529
529
|
* Verify whether a given password is the password of the current user.
|
|
530
530
|
*
|
|
531
|
-
* @param {string} password
|
|
532
|
-
* @param {object} options
|
|
533
|
-
* @
|
|
534
|
-
*
|
|
531
|
+
* @param {string} password The password to be verified.
|
|
532
|
+
* @param {object} options The options.
|
|
533
|
+
* @param {boolean} [options.ignoreEmailVerification=false] Set to `true` to bypass email verification and verify
|
|
534
|
+
* the password regardless of whether the email has been verified. This requires the master key.
|
|
535
|
+
* @returns {Promise} A promise that is fulfilled with a user when the password is correct.
|
|
535
536
|
*/
|
|
536
537
|
verifyPassword(password /*: string*/, options /*:: ?: RequestOptions*/) /*: Promise<ParseUser>*/{
|
|
537
538
|
const username = this.getUsername() || '';
|
|
@@ -840,13 +841,14 @@ class ParseUser extends _ParseObject.default {
|
|
|
840
841
|
|
|
841
842
|
/**
|
|
842
843
|
* Verify whether a given password is the password of the current user.
|
|
843
|
-
*
|
|
844
|
-
* @param {string} username A username to be used for identificaiton
|
|
845
|
-
* @param {string} password A password to be verified
|
|
846
|
-
* @param {object} options
|
|
847
844
|
* @static
|
|
848
|
-
*
|
|
849
|
-
*
|
|
845
|
+
*
|
|
846
|
+
* @param {string} username The username of the user whose password should be verified.
|
|
847
|
+
* @param {string} password The password to be verified.
|
|
848
|
+
* @param {object} options The options.
|
|
849
|
+
* @param {boolean} [options.ignoreEmailVerification=false] Set to `true` to bypass email verification and verify
|
|
850
|
+
* the password regardless of whether the email has been verified. This requires the master key.
|
|
851
|
+
* @returns {Promise} A promise that is fulfilled with a user when the password is correct.
|
|
850
852
|
*/
|
|
851
853
|
static verifyPassword(username /*: string*/, password /*: string*/, options /*:: ?: RequestOptions*/) {
|
|
852
854
|
if (typeof username !== 'string') {
|
|
@@ -855,13 +857,8 @@ class ParseUser extends _ParseObject.default {
|
|
|
855
857
|
if (typeof password !== 'string') {
|
|
856
858
|
return Promise.reject(new _ParseError.default(_ParseError.default.OTHER_CAUSE, 'Password must be a string.'));
|
|
857
859
|
}
|
|
858
|
-
options = options || {};
|
|
859
|
-
const verificationOption = {};
|
|
860
|
-
if (options.hasOwnProperty('useMasterKey')) {
|
|
861
|
-
verificationOption.useMasterKey = options.useMasterKey;
|
|
862
|
-
}
|
|
863
860
|
const controller = _CoreManager.default.getUserController();
|
|
864
|
-
return controller.verifyPassword(username, password,
|
|
861
|
+
return controller.verifyPassword(username, password, options || {});
|
|
865
862
|
}
|
|
866
863
|
|
|
867
864
|
/**
|
|
@@ -1219,10 +1216,14 @@ const DefaultController = {
|
|
|
1219
1216
|
},
|
|
1220
1217
|
verifyPassword(username /*: string*/, password /*: string*/, options /*: RequestOptions*/) {
|
|
1221
1218
|
const RESTController = _CoreManager.default.getRESTController();
|
|
1222
|
-
|
|
1219
|
+
const data = {
|
|
1223
1220
|
username,
|
|
1224
|
-
password
|
|
1225
|
-
|
|
1221
|
+
password,
|
|
1222
|
+
...(options.ignoreEmailVerification !== undefined && {
|
|
1223
|
+
ignoreEmailVerification: options.ignoreEmailVerification
|
|
1224
|
+
})
|
|
1225
|
+
};
|
|
1226
|
+
return RESTController.request('GET', 'verifyPassword', data, options);
|
|
1226
1227
|
},
|
|
1227
1228
|
requestEmailVerification(email /*: string*/, options /*: RequestOptions*/) {
|
|
1228
1229
|
const RESTController = _CoreManager.default.getRESTController();
|
|
@@ -233,11 +233,12 @@ function matchesKeyConstraints(className, object, objects, key, constraints) {
|
|
|
233
233
|
return equalObjectsGeneric(decode(object[key]), decode(constraints), equalObjects);
|
|
234
234
|
}
|
|
235
235
|
for (var condition in constraints) {
|
|
236
|
+
var _compareTo, _compareTo2;
|
|
236
237
|
compareTo = constraints[condition];
|
|
237
|
-
if (compareTo.__type) {
|
|
238
|
+
if ((_compareTo = compareTo) != null && _compareTo.__type) {
|
|
238
239
|
compareTo = decode(compareTo);
|
|
239
240
|
}
|
|
240
|
-
if (compareTo['$relativeTime']) {
|
|
241
|
+
if ((_compareTo2 = compareTo) != null && _compareTo2['$relativeTime']) {
|
|
241
242
|
var parserResult = relativeTimeToDate(compareTo['$relativeTime']);
|
|
242
243
|
if (parserResult.status !== 'success') {
|
|
243
244
|
throw new ParseError(ParseError.INVALID_JSON, `bad $relativeTime (${key}) value. ${parserResult.info}`);
|
|
@@ -882,14 +882,17 @@ var ParseObject = function () {
|
|
|
882
882
|
attrs[arg1] = arg2;
|
|
883
883
|
options = arg3;
|
|
884
884
|
}
|
|
885
|
+
options = options || {};
|
|
885
886
|
if (attrs) {
|
|
886
|
-
var
|
|
887
|
-
|
|
888
|
-
|
|
887
|
+
var validationError;
|
|
888
|
+
options.error = function (_, validation) {
|
|
889
|
+
validationError = validation;
|
|
890
|
+
};
|
|
891
|
+
var success = this.set(attrs, options);
|
|
892
|
+
if (!success) {
|
|
893
|
+
return Promise.reject(validationError);
|
|
889
894
|
}
|
|
890
|
-
this.set(attrs, options);
|
|
891
895
|
}
|
|
892
|
-
options = options || {};
|
|
893
896
|
var saveOptions = {};
|
|
894
897
|
if (options.hasOwnProperty('useMasterKey')) {
|
|
895
898
|
saveOptions.useMasterKey = !!options.useMasterKey;
|
|
@@ -634,13 +634,8 @@ var ParseUser = function (_ParseObject) {
|
|
|
634
634
|
if (typeof password !== 'string') {
|
|
635
635
|
return Promise.reject(new _ParseError.default(_ParseError.default.OTHER_CAUSE, 'Password must be a string.'));
|
|
636
636
|
}
|
|
637
|
-
options = options || {};
|
|
638
|
-
var verificationOption = {};
|
|
639
|
-
if (options.hasOwnProperty('useMasterKey')) {
|
|
640
|
-
verificationOption.useMasterKey = options.useMasterKey;
|
|
641
|
-
}
|
|
642
637
|
var controller = _CoreManager.default.getUserController();
|
|
643
|
-
return controller.verifyPassword(username, password,
|
|
638
|
+
return controller.verifyPassword(username, password, options || {});
|
|
644
639
|
}
|
|
645
640
|
}, {
|
|
646
641
|
key: "allowCustomUserClass",
|
|
@@ -956,10 +951,13 @@ var DefaultController = {
|
|
|
956
951
|
},
|
|
957
952
|
verifyPassword: function (username, password, options) {
|
|
958
953
|
var RESTController = _CoreManager.default.getRESTController();
|
|
959
|
-
|
|
954
|
+
var data = Object.assign({
|
|
960
955
|
username: username,
|
|
961
956
|
password: password
|
|
962
|
-
}, options
|
|
957
|
+
}, options.ignoreEmailVerification !== undefined && {
|
|
958
|
+
ignoreEmailVerification: options.ignoreEmailVerification
|
|
959
|
+
});
|
|
960
|
+
return RESTController.request('GET', 'verifyPassword', data, options);
|
|
963
961
|
},
|
|
964
962
|
requestEmailVerification: function (email, options) {
|
|
965
963
|
var RESTController = _CoreManager.default.getRESTController();
|
package/lib/weapp/CoreManager.js
CHANGED
|
@@ -187,7 +187,7 @@ var config /*: Config & { [key: string]: mixed }*/ = {
|
|
|
187
187
|
SERVER_AUTH_TOKEN: null,
|
|
188
188
|
LIVEQUERY_SERVER_URL: null,
|
|
189
189
|
ENCRYPTED_KEY: null,
|
|
190
|
-
VERSION: 'js' + "5.0.
|
|
190
|
+
VERSION: 'js' + "5.1.0-alpha.2",
|
|
191
191
|
APPLICATION_ID: null,
|
|
192
192
|
JAVASCRIPT_KEY: null,
|
|
193
193
|
MASTER_KEY: null,
|
|
@@ -386,12 +386,13 @@ function matchesKeyConstraints(className, object, objects, key, constraints) {
|
|
|
386
386
|
}
|
|
387
387
|
// More complex cases
|
|
388
388
|
for (var condition in constraints) {
|
|
389
|
+
var _compareTo, _compareTo2;
|
|
389
390
|
compareTo = constraints[condition];
|
|
390
|
-
if (compareTo.__type) {
|
|
391
|
+
if ((_compareTo = compareTo) !== null && _compareTo !== void 0 && _compareTo.__type) {
|
|
391
392
|
compareTo = decode(compareTo);
|
|
392
393
|
}
|
|
393
394
|
// is it a $relativeTime? convert to date
|
|
394
|
-
if (compareTo['$relativeTime']) {
|
|
395
|
+
if ((_compareTo2 = compareTo) !== null && _compareTo2 !== void 0 && _compareTo2['$relativeTime']) {
|
|
395
396
|
var parserResult = relativeTimeToDate(compareTo['$relativeTime']);
|
|
396
397
|
if (parserResult.status !== 'success') {
|
|
397
398
|
var _context2;
|
package/lib/weapp/ParseObject.js
CHANGED
|
@@ -1573,14 +1573,17 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
1573
1573
|
attrs[arg1] = arg2;
|
|
1574
1574
|
options = arg3;
|
|
1575
1575
|
}
|
|
1576
|
+
options = options || {};
|
|
1576
1577
|
if (attrs) {
|
|
1577
|
-
var
|
|
1578
|
-
|
|
1579
|
-
|
|
1578
|
+
var validationError;
|
|
1579
|
+
options.error = function (_, validation) {
|
|
1580
|
+
validationError = validation;
|
|
1581
|
+
};
|
|
1582
|
+
var success = this.set(attrs, options);
|
|
1583
|
+
if (!success) {
|
|
1584
|
+
return _promise.default.reject(validationError);
|
|
1580
1585
|
}
|
|
1581
|
-
this.set(attrs, options);
|
|
1582
1586
|
}
|
|
1583
|
-
options = options || {};
|
|
1584
1587
|
var saveOptions = {};
|
|
1585
1588
|
if (options.hasOwnProperty('useMasterKey')) {
|
|
1586
1589
|
saveOptions.useMasterKey = !!options.useMasterKey;
|
package/lib/weapp/ParseUser.js
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _Reflect$construct = require("@babel/runtime-corejs3/core-js-stable/reflect/construct");
|
|
4
|
+
var _Object$keys = require("@babel/runtime-corejs3/core-js-stable/object/keys");
|
|
5
|
+
var _Object$getOwnPropertySymbols = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols");
|
|
6
|
+
var _filterInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/filter");
|
|
7
|
+
var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
|
|
8
|
+
var _forEachInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/for-each");
|
|
9
|
+
var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors");
|
|
10
|
+
var _Object$defineProperties = require("@babel/runtime-corejs3/core-js-stable/object/define-properties");
|
|
4
11
|
var _Object$defineProperty2 = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
|
5
12
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
6
13
|
_Object$defineProperty2(exports, "__esModule", {
|
|
@@ -9,8 +16,9 @@ _Object$defineProperty2(exports, "__esModule", {
|
|
|
9
16
|
exports.default = void 0;
|
|
10
17
|
var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs3/regenerator"));
|
|
11
18
|
var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/promise"));
|
|
12
|
-
var
|
|
19
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/define-property"));
|
|
13
20
|
var _stringify = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/json/stringify"));
|
|
21
|
+
var _defineProperty3 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
|
|
14
22
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/asyncToGenerator"));
|
|
15
23
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/typeof"));
|
|
16
24
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/classCallCheck"));
|
|
@@ -25,6 +33,28 @@ var _ParseError = _interopRequireDefault(require("./ParseError"));
|
|
|
25
33
|
var _ParseObject2 = _interopRequireDefault(require("./ParseObject"));
|
|
26
34
|
var _ParseSession = _interopRequireDefault(require("./ParseSession"));
|
|
27
35
|
var _Storage = _interopRequireDefault(require("./Storage"));
|
|
36
|
+
function ownKeys(object, enumerableOnly) {
|
|
37
|
+
var keys = _Object$keys(object);
|
|
38
|
+
if (_Object$getOwnPropertySymbols) {
|
|
39
|
+
var symbols = _Object$getOwnPropertySymbols(object);
|
|
40
|
+
enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) {
|
|
41
|
+
return _Object$getOwnPropertyDescriptor(object, sym).enumerable;
|
|
42
|
+
})), keys.push.apply(keys, symbols);
|
|
43
|
+
}
|
|
44
|
+
return keys;
|
|
45
|
+
}
|
|
46
|
+
function _objectSpread(target) {
|
|
47
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
48
|
+
var _context7, _context8;
|
|
49
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
50
|
+
i % 2 ? _forEachInstanceProperty(_context7 = ownKeys(Object(source), !0)).call(_context7, function (key) {
|
|
51
|
+
(0, _defineProperty3.default)(target, key, source[key]);
|
|
52
|
+
}) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context8 = ownKeys(Object(source))).call(_context8, function (key) {
|
|
53
|
+
_Object$defineProperty2(target, key, _Object$getOwnPropertyDescriptor(source, key));
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
return target;
|
|
57
|
+
}
|
|
28
58
|
function _createSuper(Derived) {
|
|
29
59
|
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
|
30
60
|
return function () {
|
|
@@ -761,10 +791,11 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
|
|
|
761
791
|
/**
|
|
762
792
|
* Verify whether a given password is the password of the current user.
|
|
763
793
|
*
|
|
764
|
-
* @param {string} password
|
|
765
|
-
* @param {object} options
|
|
766
|
-
* @
|
|
767
|
-
*
|
|
794
|
+
* @param {string} password The password to be verified.
|
|
795
|
+
* @param {object} options The options.
|
|
796
|
+
* @param {boolean} [options.ignoreEmailVerification=false] Set to `true` to bypass email verification and verify
|
|
797
|
+
* the password regardless of whether the email has been verified. This requires the master key.
|
|
798
|
+
* @returns {Promise} A promise that is fulfilled with a user when the password is correct.
|
|
768
799
|
*/
|
|
769
800
|
}, {
|
|
770
801
|
key: "verifyPassword",
|
|
@@ -792,7 +823,7 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
|
|
|
792
823
|
if (protoProps) {
|
|
793
824
|
for (var _prop in protoProps) {
|
|
794
825
|
if (_prop !== 'className') {
|
|
795
|
-
(0,
|
|
826
|
+
(0, _defineProperty2.default)(ParseUser.prototype, _prop, {
|
|
796
827
|
value: protoProps[_prop],
|
|
797
828
|
enumerable: false,
|
|
798
829
|
writable: true,
|
|
@@ -804,7 +835,7 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
|
|
|
804
835
|
if (classProps) {
|
|
805
836
|
for (var _prop2 in classProps) {
|
|
806
837
|
if (_prop2 !== 'className') {
|
|
807
|
-
(0,
|
|
838
|
+
(0, _defineProperty2.default)(ParseUser, _prop2, {
|
|
808
839
|
value: classProps[_prop2],
|
|
809
840
|
enumerable: false,
|
|
810
841
|
writable: true,
|
|
@@ -1107,13 +1138,14 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
|
|
|
1107
1138
|
|
|
1108
1139
|
/**
|
|
1109
1140
|
* Verify whether a given password is the password of the current user.
|
|
1110
|
-
*
|
|
1111
|
-
* @param {string} username A username to be used for identificaiton
|
|
1112
|
-
* @param {string} password A password to be verified
|
|
1113
|
-
* @param {object} options
|
|
1114
1141
|
* @static
|
|
1115
|
-
*
|
|
1116
|
-
*
|
|
1142
|
+
*
|
|
1143
|
+
* @param {string} username The username of the user whose password should be verified.
|
|
1144
|
+
* @param {string} password The password to be verified.
|
|
1145
|
+
* @param {object} options The options.
|
|
1146
|
+
* @param {boolean} [options.ignoreEmailVerification=false] Set to `true` to bypass email verification and verify
|
|
1147
|
+
* the password regardless of whether the email has been verified. This requires the master key.
|
|
1148
|
+
* @returns {Promise} A promise that is fulfilled with a user when the password is correct.
|
|
1117
1149
|
*/
|
|
1118
1150
|
}, {
|
|
1119
1151
|
key: "verifyPassword",
|
|
@@ -1124,13 +1156,8 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
|
|
|
1124
1156
|
if (typeof password !== 'string') {
|
|
1125
1157
|
return _promise.default.reject(new _ParseError.default(_ParseError.default.OTHER_CAUSE, 'Password must be a string.'));
|
|
1126
1158
|
}
|
|
1127
|
-
options = options || {};
|
|
1128
|
-
var verificationOption = {};
|
|
1129
|
-
if (options.hasOwnProperty('useMasterKey')) {
|
|
1130
|
-
verificationOption.useMasterKey = options.useMasterKey;
|
|
1131
|
-
}
|
|
1132
1159
|
var controller = _CoreManager.default.getUserController();
|
|
1133
|
-
return controller.verifyPassword(username, password,
|
|
1160
|
+
return controller.verifyPassword(username, password, options || {});
|
|
1134
1161
|
}
|
|
1135
1162
|
|
|
1136
1163
|
/**
|
|
@@ -1529,10 +1556,13 @@ var DefaultController = {
|
|
|
1529
1556
|
},
|
|
1530
1557
|
verifyPassword: function (username /*: string*/, password /*: string*/, options /*: RequestOptions*/) {
|
|
1531
1558
|
var RESTController = _CoreManager.default.getRESTController();
|
|
1532
|
-
|
|
1559
|
+
var data = _objectSpread({
|
|
1533
1560
|
username: username,
|
|
1534
1561
|
password: password
|
|
1535
|
-
}, options
|
|
1562
|
+
}, options.ignoreEmailVerification !== undefined && {
|
|
1563
|
+
ignoreEmailVerification: options.ignoreEmailVerification
|
|
1564
|
+
});
|
|
1565
|
+
return RESTController.request('GET', 'verifyPassword', data, options);
|
|
1536
1566
|
},
|
|
1537
1567
|
requestEmailVerification: function (email /*: string*/, options /*: RequestOptions*/) {
|
|
1538
1568
|
var RESTController = _CoreManager.default.getRESTController();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "parse",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.1.0-alpha.2",
|
|
4
4
|
"description": "Parse JavaScript SDK",
|
|
5
5
|
"homepage": "https://parseplatform.org",
|
|
6
6
|
"keywords": [
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"lint-staged": "13.2.2",
|
|
86
86
|
"metro-react-native-babel-preset": "0.76.4",
|
|
87
87
|
"mongodb-runner": "5.4.3",
|
|
88
|
-
"parse-server": "7.
|
|
88
|
+
"parse-server": "7.1.0-alpha.1",
|
|
89
89
|
"prettier": "3.0.2",
|
|
90
90
|
"puppeteer": "20.4.0",
|
|
91
91
|
"regenerator-runtime": "0.13.11",
|