parse 5.3.0-alpha.4 → 5.3.0-alpha.6
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/README.md +6 -5
- package/dist/parse.js +171 -296
- package/dist/parse.min.js +2 -2
- package/dist/parse.weapp.js +171 -296
- package/dist/parse.weapp.min.js +2 -2
- package/lib/browser/Cloud.js +12 -16
- package/lib/browser/CoreManager.js +3 -3
- package/lib/browser/ParseFile.js +1 -1
- package/lib/browser/ParseObject.js +86 -120
- package/lib/browser/ParseQuery.js +21 -88
- package/lib/browser/ParseSession.js +1 -5
- package/lib/browser/ParseUser.js +40 -56
- package/lib/browser/Push.js +2 -2
- package/lib/browser/Storage.js +1 -1
- package/lib/browser/StorageController.default.js +2 -2
- package/lib/node/Cloud.js +12 -16
- package/lib/node/CoreManager.js +3 -3
- package/lib/node/ParseFile.js +1 -1
- package/lib/node/ParseObject.js +82 -115
- package/lib/node/ParseQuery.js +21 -88
- package/lib/node/ParseSession.js +1 -5
- package/lib/node/ParseUser.js +40 -56
- package/lib/node/Push.js +2 -2
- package/lib/node/Storage.js +1 -1
- package/lib/node/StorageController.default.js +2 -2
- package/lib/react-native/Cloud.js +4 -16
- package/lib/react-native/CoreManager.js +3 -3
- package/lib/react-native/ParseFile.js +1 -1
- package/lib/react-native/ParseInstallation.js +3 -3
- package/lib/react-native/ParseObject.js +54 -115
- package/lib/react-native/ParseQuery.js +20 -88
- package/lib/react-native/ParseRole.js +3 -3
- package/lib/react-native/ParseSession.js +1 -5
- package/lib/react-native/ParseUser.js +16 -59
- package/lib/react-native/Push.js +2 -2
- package/lib/react-native/Storage.js +1 -1
- package/lib/react-native/StorageController.default.js +2 -2
- package/lib/weapp/Cloud.js +12 -16
- package/lib/weapp/CoreManager.js +3 -3
- package/lib/weapp/ParseFile.js +1 -1
- package/lib/weapp/ParseObject.js +86 -120
- package/lib/weapp/ParseQuery.js +21 -88
- package/lib/weapp/ParseSession.js +1 -5
- package/lib/weapp/ParseUser.js +40 -56
- package/lib/weapp/Push.js +2 -2
- package/lib/weapp/Storage.js +1 -1
- package/lib/weapp/StorageController.default.js +2 -2
- package/package.json +24 -24
package/lib/node/ParseQuery.js
CHANGED
|
@@ -60,7 +60,7 @@ function handleSelectResult(data, select) {
|
|
|
60
60
|
const serverDataMask = {};
|
|
61
61
|
select.forEach(field => {
|
|
62
62
|
const hasSubObjectSelect = field.indexOf('.') !== -1;
|
|
63
|
-
if (!hasSubObjectSelect && !
|
|
63
|
+
if (!hasSubObjectSelect && !Object.hasOwn(data, field)) {
|
|
64
64
|
// this field was selected, but is missing from the retrieved data
|
|
65
65
|
data[field] = undefined;
|
|
66
66
|
} else if (hasSubObjectSelect) {
|
|
@@ -71,7 +71,7 @@ function handleSelectResult(data, select) {
|
|
|
71
71
|
let serverMask = serverDataMask;
|
|
72
72
|
pathComponents.forEach((component, index, arr) => {
|
|
73
73
|
// add keys if the expected data is missing
|
|
74
|
-
if (obj && !
|
|
74
|
+
if (obj && !Object.hasOwn(obj, component)) {
|
|
75
75
|
obj[component] = undefined;
|
|
76
76
|
}
|
|
77
77
|
if (obj && typeof obj === 'object') {
|
|
@@ -105,7 +105,7 @@ function copyMissingDataWithMask(src, dest, mask, copyThisLevel) {
|
|
|
105
105
|
//copy missing elements at this level
|
|
106
106
|
if (copyThisLevel) {
|
|
107
107
|
for (const key in src) {
|
|
108
|
-
if (
|
|
108
|
+
if (Object.hasOwn(src, key) && !Object.hasOwn(dest, key)) {
|
|
109
109
|
dest[key] = src[key];
|
|
110
110
|
}
|
|
111
111
|
}
|
|
@@ -488,7 +488,7 @@ class ParseQuery {
|
|
|
488
488
|
this._comment = json.comment;
|
|
489
489
|
}
|
|
490
490
|
for (const key in json) {
|
|
491
|
-
if (
|
|
491
|
+
if (Object.hasOwn(json, key)) {
|
|
492
492
|
if (['where', 'include', 'keys', 'count', 'limit', 'skip', 'order', 'readPreference', 'includeReadPreference', 'subqueryReadPreference', 'hint', 'explain', 'comment'].indexOf(key) === -1) {
|
|
493
493
|
this._extraOptions[key] = json[key];
|
|
494
494
|
}
|
|
@@ -529,19 +529,7 @@ class ParseQuery {
|
|
|
529
529
|
*/
|
|
530
530
|
get(objectId, options) {
|
|
531
531
|
this.equalTo('objectId', objectId);
|
|
532
|
-
const firstOptions =
|
|
533
|
-
if (options && options.hasOwnProperty('useMasterKey')) {
|
|
534
|
-
firstOptions.useMasterKey = options.useMasterKey;
|
|
535
|
-
}
|
|
536
|
-
if (options && options.hasOwnProperty('sessionToken')) {
|
|
537
|
-
firstOptions.sessionToken = options.sessionToken;
|
|
538
|
-
}
|
|
539
|
-
if (options && options.hasOwnProperty('context') && typeof options.context === 'object') {
|
|
540
|
-
firstOptions.context = options.context;
|
|
541
|
-
}
|
|
542
|
-
if (options && options.hasOwnProperty('json')) {
|
|
543
|
-
firstOptions.json = options.json;
|
|
544
|
-
}
|
|
532
|
+
const firstOptions = _ParseObject.default._getRequestOptions(options);
|
|
545
533
|
return this.first(firstOptions).then(response => {
|
|
546
534
|
if (response) {
|
|
547
535
|
return response;
|
|
@@ -567,17 +555,7 @@ class ParseQuery {
|
|
|
567
555
|
* the query completes.
|
|
568
556
|
*/
|
|
569
557
|
find(options) {
|
|
570
|
-
|
|
571
|
-
const findOptions = {};
|
|
572
|
-
if (options.hasOwnProperty('useMasterKey')) {
|
|
573
|
-
findOptions.useMasterKey = options.useMasterKey;
|
|
574
|
-
}
|
|
575
|
-
if (options.hasOwnProperty('sessionToken')) {
|
|
576
|
-
findOptions.sessionToken = options.sessionToken;
|
|
577
|
-
}
|
|
578
|
-
if (options.hasOwnProperty('context') && typeof options.context === 'object') {
|
|
579
|
-
findOptions.context = options.context;
|
|
580
|
-
}
|
|
558
|
+
const findOptions = _ParseObject.default._getRequestOptions(options);
|
|
581
559
|
this._setRequestTask(findOptions);
|
|
582
560
|
const controller = _CoreManager.default.getQueryController();
|
|
583
561
|
const select = this._select;
|
|
@@ -604,7 +582,7 @@ class ParseQuery {
|
|
|
604
582
|
if (select) {
|
|
605
583
|
handleSelectResult(data, select);
|
|
606
584
|
}
|
|
607
|
-
if (
|
|
585
|
+
if (findOptions.json) {
|
|
608
586
|
return data;
|
|
609
587
|
} else {
|
|
610
588
|
return _ParseObject.default.fromJSON(data, !select);
|
|
@@ -632,6 +610,7 @@ class ParseQuery {
|
|
|
632
610
|
* be used for this request.
|
|
633
611
|
* <li>sessionToken: A valid session token, used for making a request on
|
|
634
612
|
* behalf of a specific user.
|
|
613
|
+
* <li>json: Return raw JSON without converting to Parse.Object.
|
|
635
614
|
* </ul>
|
|
636
615
|
* @returns {Promise} A promise that is resolved with the results when
|
|
637
616
|
* the query completes.
|
|
@@ -661,13 +640,7 @@ class ParseQuery {
|
|
|
661
640
|
*/
|
|
662
641
|
count(options) {
|
|
663
642
|
options = options || {};
|
|
664
|
-
const findOptions =
|
|
665
|
-
if (options.hasOwnProperty('useMasterKey')) {
|
|
666
|
-
findOptions.useMasterKey = options.useMasterKey;
|
|
667
|
-
}
|
|
668
|
-
if (options.hasOwnProperty('sessionToken')) {
|
|
669
|
-
findOptions.sessionToken = options.sessionToken;
|
|
670
|
-
}
|
|
643
|
+
const findOptions = _ParseObject.default._getRequestOptions(options);
|
|
671
644
|
this._setRequestTask(findOptions);
|
|
672
645
|
const controller = _CoreManager.default.getQueryController();
|
|
673
646
|
const params = this.toJSON();
|
|
@@ -691,7 +664,7 @@ class ParseQuery {
|
|
|
691
664
|
const distinctOptions = {
|
|
692
665
|
useMasterKey: true
|
|
693
666
|
};
|
|
694
|
-
if (
|
|
667
|
+
if (Object.hasOwn(options, 'sessionToken')) {
|
|
695
668
|
distinctOptions.sessionToken = options.sessionToken;
|
|
696
669
|
}
|
|
697
670
|
this._setRequestTask(distinctOptions);
|
|
@@ -719,7 +692,7 @@ class ParseQuery {
|
|
|
719
692
|
const aggregateOptions = {
|
|
720
693
|
useMasterKey: true
|
|
721
694
|
};
|
|
722
|
-
if (
|
|
695
|
+
if (Object.hasOwn(options, 'sessionToken')) {
|
|
723
696
|
aggregateOptions.sessionToken = options.sessionToken;
|
|
724
697
|
}
|
|
725
698
|
this._setRequestTask(aggregateOptions);
|
|
@@ -763,16 +736,7 @@ class ParseQuery {
|
|
|
763
736
|
* the query completes.
|
|
764
737
|
*/
|
|
765
738
|
first(options = {}) {
|
|
766
|
-
const findOptions =
|
|
767
|
-
if (options.hasOwnProperty('useMasterKey')) {
|
|
768
|
-
findOptions.useMasterKey = options.useMasterKey;
|
|
769
|
-
}
|
|
770
|
-
if (options.hasOwnProperty('sessionToken')) {
|
|
771
|
-
findOptions.sessionToken = options.sessionToken;
|
|
772
|
-
}
|
|
773
|
-
if (options.hasOwnProperty('context') && typeof options.context === 'object') {
|
|
774
|
-
findOptions.context = options.context;
|
|
775
|
-
}
|
|
739
|
+
const findOptions = _ParseObject.default._getRequestOptions(options);
|
|
776
740
|
this._setRequestTask(findOptions);
|
|
777
741
|
const controller = _CoreManager.default.getQueryController();
|
|
778
742
|
const params = this.toJSON();
|
|
@@ -801,7 +765,7 @@ class ParseQuery {
|
|
|
801
765
|
if (select) {
|
|
802
766
|
handleSelectResult(objects[0], select);
|
|
803
767
|
}
|
|
804
|
-
if (
|
|
768
|
+
if (findOptions.json) {
|
|
805
769
|
return objects[0];
|
|
806
770
|
} else {
|
|
807
771
|
return _ParseObject.default.fromJSON(objects[0], !select);
|
|
@@ -835,45 +799,10 @@ class ParseQuery {
|
|
|
835
799
|
if (this._order || this._skip || this._limit >= 0) {
|
|
836
800
|
return Promise.reject('Cannot iterate on a query with sort, skip, or limit.');
|
|
837
801
|
}
|
|
838
|
-
const query =
|
|
839
|
-
query._limit = options.batchSize || 100;
|
|
840
|
-
query._include = [...this._include];
|
|
841
|
-
query._exclude = [...this._exclude];
|
|
842
|
-
if (this._select) {
|
|
843
|
-
query._select = [...this._select];
|
|
844
|
-
}
|
|
845
|
-
query._hint = this._hint;
|
|
846
|
-
query._where = {};
|
|
847
|
-
for (const attr in this._where) {
|
|
848
|
-
const val = this._where[attr];
|
|
849
|
-
if (Array.isArray(val)) {
|
|
850
|
-
query._where[attr] = val.map(v => {
|
|
851
|
-
return v;
|
|
852
|
-
});
|
|
853
|
-
} else if (val && typeof val === 'object') {
|
|
854
|
-
const conditionMap = {};
|
|
855
|
-
query._where[attr] = conditionMap;
|
|
856
|
-
for (const cond in val) {
|
|
857
|
-
conditionMap[cond] = val[cond];
|
|
858
|
-
}
|
|
859
|
-
} else {
|
|
860
|
-
query._where[attr] = val;
|
|
861
|
-
}
|
|
862
|
-
}
|
|
802
|
+
const query = ParseQuery.fromJSON(this.className, this.toJSON());
|
|
863
803
|
query.ascending('objectId');
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
findOptions.useMasterKey = options.useMasterKey;
|
|
867
|
-
}
|
|
868
|
-
if (options.hasOwnProperty('sessionToken')) {
|
|
869
|
-
findOptions.sessionToken = options.sessionToken;
|
|
870
|
-
}
|
|
871
|
-
if (options.hasOwnProperty('context') && typeof options.context === 'object') {
|
|
872
|
-
findOptions.context = options.context;
|
|
873
|
-
}
|
|
874
|
-
if (options.hasOwnProperty('json')) {
|
|
875
|
-
findOptions.json = options.json;
|
|
876
|
-
}
|
|
804
|
+
query._limit = options.batchSize || 100;
|
|
805
|
+
const findOptions = _ParseObject.default._getRequestOptions(options);
|
|
877
806
|
let finished = false;
|
|
878
807
|
let previousResults = [];
|
|
879
808
|
return (0, _promiseUtils.continueWhile)(() => {
|
|
@@ -881,7 +810,11 @@ class ParseQuery {
|
|
|
881
810
|
}, async () => {
|
|
882
811
|
const [results] = await Promise.all([query.find(findOptions), Promise.resolve(previousResults.length > 0 && callback(previousResults))]);
|
|
883
812
|
if (results.length >= query._limit) {
|
|
884
|
-
|
|
813
|
+
if (findOptions.json) {
|
|
814
|
+
query.greaterThan('objectId', results[results.length - 1].objectId);
|
|
815
|
+
} else {
|
|
816
|
+
query.greaterThan('objectId', results[results.length - 1].id);
|
|
817
|
+
}
|
|
885
818
|
previousResults = results;
|
|
886
819
|
} else if (results.length > 0) {
|
|
887
820
|
await Promise.resolve(callback(results));
|
package/lib/node/ParseSession.js
CHANGED
|
@@ -60,12 +60,8 @@ class ParseSession extends _ParseObject.default {
|
|
|
60
60
|
* promise will be rejected.
|
|
61
61
|
*/
|
|
62
62
|
static current(options) {
|
|
63
|
-
options = options || {};
|
|
64
63
|
const controller = _CoreManager.default.getSessionController();
|
|
65
|
-
const sessionOptions =
|
|
66
|
-
if (options.hasOwnProperty('useMasterKey')) {
|
|
67
|
-
sessionOptions.useMasterKey = options.useMasterKey;
|
|
68
|
-
}
|
|
64
|
+
const sessionOptions = _ParseObject.default._getRequestOptions(options);
|
|
69
65
|
return _ParseUser.default.currentAsync().then(user => {
|
|
70
66
|
if (!user) {
|
|
71
67
|
return Promise.reject('There is no current user.');
|
package/lib/node/ParseUser.js
CHANGED
|
@@ -47,15 +47,15 @@ class ParseUser extends _ParseObject.default {
|
|
|
47
47
|
* Request a revocable session token to replace the older style of token.
|
|
48
48
|
*
|
|
49
49
|
* @param {object} options
|
|
50
|
+
* Valid options are:<ul>
|
|
51
|
+
* <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
|
|
52
|
+
* be used for this request.
|
|
53
|
+
* </ul>
|
|
50
54
|
* @returns {Promise} A promise that is resolved when the replacement
|
|
51
55
|
* token has been fetched.
|
|
52
56
|
*/
|
|
53
57
|
_upgradeToRevocableSession(options) {
|
|
54
|
-
|
|
55
|
-
const upgradeOptions = {};
|
|
56
|
-
if (options.hasOwnProperty('useMasterKey')) {
|
|
57
|
-
upgradeOptions.useMasterKey = options.useMasterKey;
|
|
58
|
-
}
|
|
58
|
+
const upgradeOptions = _ParseObject.default._getRequestOptions(options);
|
|
59
59
|
const controller = _CoreManager.default.getUserController();
|
|
60
60
|
return controller.upgradeToRevocableSession(this, upgradeOptions);
|
|
61
61
|
}
|
|
@@ -98,7 +98,7 @@ class ParseUser extends _ParseObject.default {
|
|
|
98
98
|
} else {
|
|
99
99
|
authType = provider.getAuthType();
|
|
100
100
|
}
|
|
101
|
-
if (options &&
|
|
101
|
+
if (options && Object.hasOwn(options, 'authData')) {
|
|
102
102
|
const authData = this.get('authData') || {};
|
|
103
103
|
if (typeof authData !== 'object') {
|
|
104
104
|
throw new Error('Invalid type: authData field should be an object');
|
|
@@ -303,7 +303,7 @@ class ParseUser extends _ParseObject.default {
|
|
|
303
303
|
}
|
|
304
304
|
stripAnonymity() {
|
|
305
305
|
const authData = this.get('authData');
|
|
306
|
-
if (authData && typeof authData === 'object' &&
|
|
306
|
+
if (authData && typeof authData === 'object' && Object.hasOwn(authData, 'anonymous')) {
|
|
307
307
|
// We need to set anonymous to null instead of deleting it in order to remove it from Parse.
|
|
308
308
|
authData.anonymous = null;
|
|
309
309
|
}
|
|
@@ -405,21 +405,17 @@ class ParseUser extends _ParseObject.default {
|
|
|
405
405
|
*
|
|
406
406
|
* @param {object} attrs Extra fields to set on the new user, or null.
|
|
407
407
|
* @param {object} options
|
|
408
|
+
* Valid options are:<ul>
|
|
409
|
+
* <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
|
|
410
|
+
* be used for this request.
|
|
411
|
+
* <li>installationId: the installationId which made the request
|
|
412
|
+
* <li>context: A dictionary that is accessible in Cloud Code `beforeLogin` and `afterLogin` triggers.
|
|
413
|
+
* </ul>
|
|
408
414
|
* @returns {Promise} A promise that is fulfilled when the signup
|
|
409
415
|
* finishes.
|
|
410
416
|
*/
|
|
411
417
|
signUp(attrs, options) {
|
|
412
|
-
|
|
413
|
-
const signupOptions = {};
|
|
414
|
-
if (options.hasOwnProperty('useMasterKey')) {
|
|
415
|
-
signupOptions.useMasterKey = options.useMasterKey;
|
|
416
|
-
}
|
|
417
|
-
if (options.hasOwnProperty('installationId')) {
|
|
418
|
-
signupOptions.installationId = options.installationId;
|
|
419
|
-
}
|
|
420
|
-
if (options.hasOwnProperty('context') && Object.prototype.toString.call(options.context) === '[object Object]') {
|
|
421
|
-
signupOptions.context = options.context;
|
|
422
|
-
}
|
|
418
|
+
const signupOptions = _ParseObject.default._getRequestOptions(options);
|
|
423
419
|
const controller = _CoreManager.default.getUserController();
|
|
424
420
|
return controller.signUp(this, attrs, signupOptions);
|
|
425
421
|
}
|
|
@@ -432,25 +428,20 @@ class ParseUser extends _ParseObject.default {
|
|
|
432
428
|
* <p>A username and password must be set before calling logIn.</p>
|
|
433
429
|
*
|
|
434
430
|
* @param {object} options
|
|
431
|
+
* Valid options are:<ul>
|
|
432
|
+
* <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
|
|
433
|
+
* be used for this request.
|
|
434
|
+
* <li>usePost: Use POST method to make the request (default: true)
|
|
435
|
+
* <li>installationId: the installationId which made the request
|
|
436
|
+
* <li>context: A dictionary that is accessible in Cloud Code `beforeLogin` and `afterLogin` triggers.
|
|
437
|
+
* </ul>
|
|
435
438
|
* @returns {Promise} A promise that is fulfilled with the user when
|
|
436
439
|
* the login is complete.
|
|
437
440
|
*/
|
|
438
441
|
logIn(options = {}) {
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
usePost
|
|
442
|
-
};
|
|
443
|
-
if (options.hasOwnProperty('useMasterKey')) {
|
|
444
|
-
loginOptions.useMasterKey = options.useMasterKey;
|
|
445
|
-
}
|
|
446
|
-
if (options.hasOwnProperty('installationId')) {
|
|
447
|
-
loginOptions.installationId = options.installationId;
|
|
448
|
-
}
|
|
449
|
-
if (options.hasOwnProperty('usePost')) {
|
|
450
|
-
loginOptions.usePost = options.usePost;
|
|
451
|
-
}
|
|
452
|
-
if (options.hasOwnProperty('context') && Object.prototype.toString.call(options.context) === '[object Object]') {
|
|
453
|
-
loginOptions.context = options.context;
|
|
442
|
+
const loginOptions = _ParseObject.default._getRequestOptions(options);
|
|
443
|
+
if (!Object.hasOwn(loginOptions, 'usePost')) {
|
|
444
|
+
loginOptions.usePost = true;
|
|
454
445
|
}
|
|
455
446
|
const controller = _CoreManager.default.getUserController();
|
|
456
447
|
return controller.logIn(this, loginOptions);
|
|
@@ -709,6 +700,7 @@ class ParseUser extends _ParseObject.default {
|
|
|
709
700
|
*
|
|
710
701
|
* @param {string} sessionToken The sessionToken to log in with.
|
|
711
702
|
* @param {object} options
|
|
703
|
+
* @param {boolean} [options.useMasterKey]
|
|
712
704
|
* @static
|
|
713
705
|
* @returns {Promise} A promise that is fulfilled with the user when
|
|
714
706
|
* the login completes.
|
|
@@ -717,13 +709,8 @@ class ParseUser extends _ParseObject.default {
|
|
|
717
709
|
if (!canUseCurrentUser) {
|
|
718
710
|
throw new Error('It is not memory-safe to become a user in a server environment');
|
|
719
711
|
}
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
sessionToken: sessionToken
|
|
723
|
-
};
|
|
724
|
-
if (options.hasOwnProperty('useMasterKey')) {
|
|
725
|
-
becomeOptions.useMasterKey = options.useMasterKey;
|
|
726
|
-
}
|
|
712
|
+
const becomeOptions = _ParseObject.default._getRequestOptions(options);
|
|
713
|
+
becomeOptions.sessionToken = sessionToken;
|
|
727
714
|
const controller = _CoreManager.default.getUserController();
|
|
728
715
|
const user = new this();
|
|
729
716
|
return controller.become(user, becomeOptions);
|
|
@@ -734,17 +721,14 @@ class ParseUser extends _ParseObject.default {
|
|
|
734
721
|
*
|
|
735
722
|
* @param {string} sessionToken The sessionToken to get user with.
|
|
736
723
|
* @param {object} options
|
|
724
|
+
* @param {boolean} [options.useMasterKey]
|
|
737
725
|
* @static
|
|
738
726
|
* @returns {Promise} A promise that is fulfilled with the user is fetched.
|
|
739
727
|
*/
|
|
740
728
|
static me(sessionToken, options = {}) {
|
|
741
729
|
const controller = _CoreManager.default.getUserController();
|
|
742
|
-
const meOptions =
|
|
743
|
-
|
|
744
|
-
};
|
|
745
|
-
if (options.useMasterKey) {
|
|
746
|
-
meOptions.useMasterKey = options.useMasterKey;
|
|
747
|
-
}
|
|
730
|
+
const meOptions = _ParseObject.default._getRequestOptions(options);
|
|
731
|
+
meOptions.sessionToken = sessionToken;
|
|
748
732
|
const user = new this();
|
|
749
733
|
return controller.me(user, meOptions);
|
|
750
734
|
}
|
|
@@ -803,15 +787,15 @@ class ParseUser extends _ParseObject.default {
|
|
|
803
787
|
* @param {string} email The email address associated with the user that
|
|
804
788
|
* forgot their password.
|
|
805
789
|
* @param {object} options
|
|
790
|
+
* Valid options are:<ul>
|
|
791
|
+
* <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
|
|
792
|
+
* be used for this request.
|
|
793
|
+
* </ul>
|
|
806
794
|
* @static
|
|
807
795
|
* @returns {Promise}
|
|
808
796
|
*/
|
|
809
797
|
static requestPasswordReset(email, options) {
|
|
810
|
-
|
|
811
|
-
const requestOptions = {};
|
|
812
|
-
if (options.hasOwnProperty('useMasterKey')) {
|
|
813
|
-
requestOptions.useMasterKey = options.useMasterKey;
|
|
814
|
-
}
|
|
798
|
+
const requestOptions = _ParseObject.default._getRequestOptions(options);
|
|
815
799
|
const controller = _CoreManager.default.getUserController();
|
|
816
800
|
return controller.requestPasswordReset(email, requestOptions);
|
|
817
801
|
}
|
|
@@ -822,15 +806,15 @@ class ParseUser extends _ParseObject.default {
|
|
|
822
806
|
* @param {string} email The email address associated with the user that
|
|
823
807
|
* needs to verify their email.
|
|
824
808
|
* @param {object} options
|
|
809
|
+
* Valid options are:<ul>
|
|
810
|
+
* <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
|
|
811
|
+
* be used for this request.
|
|
812
|
+
* </ul>
|
|
825
813
|
* @static
|
|
826
814
|
* @returns {Promise}
|
|
827
815
|
*/
|
|
828
816
|
static requestEmailVerification(email, options) {
|
|
829
|
-
|
|
830
|
-
const requestOptions = {};
|
|
831
|
-
if (options.hasOwnProperty('useMasterKey')) {
|
|
832
|
-
requestOptions.useMasterKey = options.useMasterKey;
|
|
833
|
-
}
|
|
817
|
+
const requestOptions = _ParseObject.default._getRequestOptions(options);
|
|
834
818
|
const controller = _CoreManager.default.getUserController();
|
|
835
819
|
return controller.requestEmailVerification(email, requestOptions);
|
|
836
820
|
}
|
package/lib/node/Push.js
CHANGED
|
@@ -64,7 +64,7 @@ function send(data, options = {}) {
|
|
|
64
64
|
const pushOptions = {
|
|
65
65
|
useMasterKey: true
|
|
66
66
|
};
|
|
67
|
-
if (
|
|
67
|
+
if (Object.hasOwn(options, 'useMasterKey')) {
|
|
68
68
|
pushOptions.useMasterKey = options.useMasterKey;
|
|
69
69
|
}
|
|
70
70
|
return _CoreManager.default.getPushController().send(data, pushOptions);
|
|
@@ -87,7 +87,7 @@ function getPushStatus(pushStatusId, options = {}) {
|
|
|
87
87
|
const pushOptions = {
|
|
88
88
|
useMasterKey: true
|
|
89
89
|
};
|
|
90
|
-
if (
|
|
90
|
+
if (Object.hasOwn(options, 'useMasterKey')) {
|
|
91
91
|
pushOptions.useMasterKey = options.useMasterKey;
|
|
92
92
|
}
|
|
93
93
|
const query = new _ParseQuery.default('_PushStatus');
|
package/lib/node/Storage.js
CHANGED
|
@@ -9,7 +9,7 @@ const memMap = {};
|
|
|
9
9
|
const StorageController = {
|
|
10
10
|
async: 0,
|
|
11
11
|
getItem(path) {
|
|
12
|
-
if (
|
|
12
|
+
if (Object.hasOwn(memMap, path)) {
|
|
13
13
|
return memMap[path];
|
|
14
14
|
}
|
|
15
15
|
return null;
|
|
@@ -25,7 +25,7 @@ const StorageController = {
|
|
|
25
25
|
},
|
|
26
26
|
clear() {
|
|
27
27
|
for (const key in memMap) {
|
|
28
|
-
if (
|
|
28
|
+
if (Object.hasOwn(memMap, key)) {
|
|
29
29
|
delete memMap[key];
|
|
30
30
|
}
|
|
31
31
|
}
|
|
@@ -12,24 +12,12 @@ var _decode = _interopRequireDefault(require("./decode"));
|
|
|
12
12
|
var _encode = _interopRequireDefault(require("./encode"));
|
|
13
13
|
var _ParseError = _interopRequireDefault(require("./ParseError"));
|
|
14
14
|
var _ParseQuery = _interopRequireDefault(require("./ParseQuery"));
|
|
15
|
+
var _ParseObject = _interopRequireDefault(require("./ParseObject"));
|
|
15
16
|
function run(name, data, options) {
|
|
16
|
-
options = options || {};
|
|
17
17
|
if (typeof name !== 'string' || name.length === 0) {
|
|
18
18
|
throw new TypeError('Cloud function name must be a string.');
|
|
19
19
|
}
|
|
20
|
-
var requestOptions =
|
|
21
|
-
if (options.useMasterKey) {
|
|
22
|
-
requestOptions.useMasterKey = options.useMasterKey;
|
|
23
|
-
}
|
|
24
|
-
if (options.sessionToken) {
|
|
25
|
-
requestOptions.sessionToken = options.sessionToken;
|
|
26
|
-
}
|
|
27
|
-
if (options.installationId) {
|
|
28
|
-
requestOptions.installationId = options.installationId;
|
|
29
|
-
}
|
|
30
|
-
if (options.context && typeof options.context === 'object') {
|
|
31
|
-
requestOptions.context = options.context;
|
|
32
|
-
}
|
|
20
|
+
var requestOptions = _ParseObject.default._getRequestOptions(options);
|
|
33
21
|
return _CoreManager.default.getCloudController().run(name, data, requestOptions);
|
|
34
22
|
}
|
|
35
23
|
function getJobsData() {
|
|
@@ -57,11 +45,11 @@ var DefaultController = {
|
|
|
57
45
|
var payload = (0, _encode.default)(data, true);
|
|
58
46
|
var request = RESTController.request('POST', 'functions/' + name, payload, options);
|
|
59
47
|
return request.then(function (res) {
|
|
60
|
-
if (typeof res === 'object' && Object.keys(res).length > 0 && !
|
|
48
|
+
if (typeof res === 'object' && Object.keys(res).length > 0 && !Object.hasOwn(res, 'result')) {
|
|
61
49
|
throw new _ParseError.default(_ParseError.default.INVALID_JSON, 'The server returned an invalid response.');
|
|
62
50
|
}
|
|
63
51
|
var decoded = (0, _decode.default)(res);
|
|
64
|
-
if (decoded &&
|
|
52
|
+
if (decoded && Object.hasOwn(decoded, 'result')) {
|
|
65
53
|
return Promise.resolve(decoded.result);
|
|
66
54
|
}
|
|
67
55
|
return Promise.resolve(undefined);
|
|
@@ -12,7 +12,7 @@ var config = {
|
|
|
12
12
|
SERVER_AUTH_TOKEN: null,
|
|
13
13
|
LIVEQUERY_SERVER_URL: null,
|
|
14
14
|
ENCRYPTED_KEY: null,
|
|
15
|
-
VERSION: 'js' + "5.3.0-alpha.
|
|
15
|
+
VERSION: 'js' + "5.3.0-alpha.6",
|
|
16
16
|
APPLICATION_ID: null,
|
|
17
17
|
JAVASCRIPT_KEY: null,
|
|
18
18
|
MASTER_KEY: null,
|
|
@@ -33,7 +33,7 @@ function requireMethods(name, methods, controller) {
|
|
|
33
33
|
}
|
|
34
34
|
var CoreManager = {
|
|
35
35
|
get: function (key) {
|
|
36
|
-
if (
|
|
36
|
+
if (Object.hasOwn(config, key)) {
|
|
37
37
|
return config[key];
|
|
38
38
|
}
|
|
39
39
|
throw new Error('Configuration key not found: ' + key);
|
|
@@ -42,7 +42,7 @@ var CoreManager = {
|
|
|
42
42
|
config[key] = value;
|
|
43
43
|
},
|
|
44
44
|
setIfNeeded: function (key, value) {
|
|
45
|
-
if (!
|
|
45
|
+
if (!Object.hasOwn(config, key)) {
|
|
46
46
|
config[key] = value;
|
|
47
47
|
}
|
|
48
48
|
return config[key];
|
|
@@ -198,7 +198,7 @@ var ParseFile = function () {
|
|
|
198
198
|
var destroyOptions = {
|
|
199
199
|
useMasterKey: true
|
|
200
200
|
};
|
|
201
|
-
if (
|
|
201
|
+
if (Object.hasOwn(options, 'useMasterKey')) {
|
|
202
202
|
destroyOptions.useMasterKey = !!options.useMasterKey;
|
|
203
203
|
}
|
|
204
204
|
var controller = _CoreManager.default.getFileController();
|
|
@@ -25,10 +25,10 @@ function _isNativeReflectConstruct() {
|
|
|
25
25
|
return !!t;
|
|
26
26
|
})();
|
|
27
27
|
}
|
|
28
|
-
function _superPropGet(t,
|
|
29
|
-
var p = (0, _get2.default)((0, _getPrototypeOf2.default)(1 & r ? t.prototype : t),
|
|
28
|
+
function _superPropGet(t, o, e, r) {
|
|
29
|
+
var p = (0, _get2.default)((0, _getPrototypeOf2.default)(1 & r ? t.prototype : t), o, e);
|
|
30
30
|
return 2 & r && "function" == typeof p ? function (t) {
|
|
31
|
-
return p.apply(
|
|
31
|
+
return p.apply(e, t);
|
|
32
32
|
} : p;
|
|
33
33
|
}
|
|
34
34
|
var DEVICE_TYPES = {
|