parse 5.3.0 → 6.0.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/README.md +6 -5
- package/dist/parse.js +829 -884
- package/dist/parse.min.js +2 -2
- package/dist/parse.weapp.js +829 -882
- 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/FacebookUtils.js +1 -1
- package/lib/browser/LocalDatastoreController.react-native.js +1 -1
- package/lib/browser/OfflineQuery.js +5 -9
- package/lib/browser/Parse.js +1 -3
- package/lib/browser/ParseConfig.js +1 -1
- package/lib/browser/ParseFile.js +1 -2
- package/lib/browser/ParseHooks.js +7 -7
- package/lib/browser/ParseInstallation.js +3 -1
- package/lib/browser/ParseObject.js +160 -163
- package/lib/browser/ParseQuery.js +22 -89
- package/lib/browser/ParseSession.js +4 -6
- package/lib/browser/ParseUser.js +44 -58
- package/lib/browser/Push.js +2 -2
- package/lib/browser/RESTController.js +2 -2
- package/lib/browser/Storage.js +1 -1
- package/lib/browser/StorageController.default.js +2 -2
- package/lib/browser/StorageController.weapp.js +1 -1
- package/lib/node/Cloud.js +12 -16
- package/lib/node/CoreManager.js +3 -3
- package/lib/node/FacebookUtils.js +1 -1
- package/lib/node/LocalDatastoreController.react-native.js +1 -1
- package/lib/node/OfflineQuery.js +5 -9
- package/lib/node/Parse.js +1 -1
- package/lib/node/ParseConfig.js +1 -1
- package/lib/node/ParseFile.js +1 -2
- package/lib/node/ParseHooks.js +7 -7
- package/lib/node/ParseInstallation.js +3 -1
- package/lib/node/ParseObject.js +155 -158
- package/lib/node/ParseQuery.js +22 -89
- package/lib/node/ParseSession.js +4 -6
- package/lib/node/ParseUser.js +44 -58
- package/lib/node/Push.js +2 -2
- package/lib/node/RESTController.js +2 -2
- package/lib/node/Storage.js +1 -1
- package/lib/node/StorageController.default.js +2 -2
- package/lib/node/StorageController.weapp.js +1 -1
- package/lib/react-native/Cloud.js +4 -16
- package/lib/react-native/CoreManager.js +3 -3
- package/lib/react-native/LocalDatastoreController.react-native.js +1 -1
- package/lib/react-native/OfflineQuery.js +5 -5
- package/lib/react-native/ParseConfig.js +1 -1
- package/lib/react-native/ParseFile.js +1 -1
- package/lib/react-native/ParseHooks.js +7 -7
- package/lib/react-native/ParseInstallation.js +14 -6
- package/lib/react-native/ParseObject.js +147 -163
- package/lib/react-native/ParseQuery.js +21 -89
- package/lib/react-native/ParseRole.js +8 -2
- package/lib/react-native/ParseSession.js +4 -6
- package/lib/react-native/ParseUser.js +28 -63
- package/lib/react-native/Push.js +2 -2
- package/lib/react-native/RESTController.js +11 -10
- package/lib/react-native/Storage.js +1 -1
- package/lib/react-native/StorageController.default.js +2 -2
- package/lib/react-native/StorageController.weapp.js +1 -1
- package/lib/weapp/Cloud.js +12 -16
- package/lib/weapp/CoreManager.js +3 -3
- package/lib/weapp/FacebookUtils.js +1 -1
- package/lib/weapp/LocalDatastoreController.react-native.js +1 -1
- package/lib/weapp/OfflineQuery.js +5 -9
- package/lib/weapp/Parse.js +1 -1
- package/lib/weapp/ParseConfig.js +1 -1
- package/lib/weapp/ParseFile.js +1 -2
- package/lib/weapp/ParseHooks.js +7 -7
- package/lib/weapp/ParseInstallation.js +3 -1
- package/lib/weapp/ParseObject.js +160 -163
- package/lib/weapp/ParseQuery.js +22 -89
- package/lib/weapp/ParseSession.js +4 -6
- package/lib/weapp/ParseUser.js +44 -58
- package/lib/weapp/Push.js +2 -2
- package/lib/weapp/RESTController.js +2 -2
- package/lib/weapp/Storage.js +1 -1
- package/lib/weapp/StorageController.default.js +2 -2
- package/lib/weapp/StorageController.weapp.js +1 -1
- package/package.json +30 -28
package/lib/weapp/ParseQuery.js
CHANGED
|
@@ -73,7 +73,7 @@ function handleSelectResult(data, select) {
|
|
|
73
73
|
const serverDataMask = {};
|
|
74
74
|
(0, _forEach.default)(select).call(select, field => {
|
|
75
75
|
const hasSubObjectSelect = (0, _indexOf.default)(field).call(field, '.') !== -1;
|
|
76
|
-
if (!hasSubObjectSelect && !
|
|
76
|
+
if (!hasSubObjectSelect && !Object.hasOwn(data, field)) {
|
|
77
77
|
// this field was selected, but is missing from the retrieved data
|
|
78
78
|
data[field] = undefined;
|
|
79
79
|
} else if (hasSubObjectSelect) {
|
|
@@ -84,7 +84,7 @@ function handleSelectResult(data, select) {
|
|
|
84
84
|
let serverMask = serverDataMask;
|
|
85
85
|
(0, _forEach.default)(pathComponents).call(pathComponents, (component, index, arr) => {
|
|
86
86
|
// add keys if the expected data is missing
|
|
87
|
-
if (obj && !
|
|
87
|
+
if (obj && !Object.hasOwn(obj, component)) {
|
|
88
88
|
obj[component] = undefined;
|
|
89
89
|
}
|
|
90
90
|
if (obj && typeof obj === 'object') {
|
|
@@ -118,7 +118,7 @@ function copyMissingDataWithMask(src, dest, mask, copyThisLevel) {
|
|
|
118
118
|
//copy missing elements at this level
|
|
119
119
|
if (copyThisLevel) {
|
|
120
120
|
for (const key in src) {
|
|
121
|
-
if (
|
|
121
|
+
if (Object.hasOwn(src, key) && !Object.hasOwn(dest, key)) {
|
|
122
122
|
dest[key] = src[key];
|
|
123
123
|
}
|
|
124
124
|
}
|
|
@@ -342,7 +342,7 @@ class ParseQuery {
|
|
|
342
342
|
_OfflineQuery.default.validateQuery(this);
|
|
343
343
|
const localDatastore = _CoreManager.default.getLocalDatastore();
|
|
344
344
|
const objects = await localDatastore._serializeObjectsFromPinName(this._localDatastorePinName);
|
|
345
|
-
let results = (0, _filter.default)(_context = (0, _map.default)(objects).call(objects, (json,
|
|
345
|
+
let results = (0, _filter.default)(_context = (0, _map.default)(objects).call(objects, (json, _index, arr) => {
|
|
346
346
|
const object = _ParseObject.default.fromJSON(json, false);
|
|
347
347
|
if (json._localId && !json.objectId) {
|
|
348
348
|
object._localId = json._localId;
|
|
@@ -522,7 +522,7 @@ class ParseQuery {
|
|
|
522
522
|
this._comment = json.comment;
|
|
523
523
|
}
|
|
524
524
|
for (const key in json) {
|
|
525
|
-
if (
|
|
525
|
+
if (Object.hasOwn(json, key)) {
|
|
526
526
|
var _context3;
|
|
527
527
|
if ((0, _indexOf.default)(_context3 = ['where', 'include', 'keys', 'count', 'limit', 'skip', 'order', 'readPreference', 'includeReadPreference', 'subqueryReadPreference', 'hint', 'explain', 'comment']).call(_context3, key) === -1) {
|
|
528
528
|
this._extraOptions[key] = json[key];
|
|
@@ -564,19 +564,7 @@ class ParseQuery {
|
|
|
564
564
|
*/
|
|
565
565
|
get(objectId, options) {
|
|
566
566
|
this.equalTo('objectId', objectId);
|
|
567
|
-
const firstOptions =
|
|
568
|
-
if (options && options.hasOwnProperty('useMasterKey')) {
|
|
569
|
-
firstOptions.useMasterKey = options.useMasterKey;
|
|
570
|
-
}
|
|
571
|
-
if (options && options.hasOwnProperty('sessionToken')) {
|
|
572
|
-
firstOptions.sessionToken = options.sessionToken;
|
|
573
|
-
}
|
|
574
|
-
if (options && options.hasOwnProperty('context') && typeof options.context === 'object') {
|
|
575
|
-
firstOptions.context = options.context;
|
|
576
|
-
}
|
|
577
|
-
if (options && options.hasOwnProperty('json')) {
|
|
578
|
-
firstOptions.json = options.json;
|
|
579
|
-
}
|
|
567
|
+
const firstOptions = _ParseObject.default._getRequestOptions(options);
|
|
580
568
|
return this.first(firstOptions).then(response => {
|
|
581
569
|
if (response) {
|
|
582
570
|
return response;
|
|
@@ -602,17 +590,7 @@ class ParseQuery {
|
|
|
602
590
|
* the query completes.
|
|
603
591
|
*/
|
|
604
592
|
find(options) {
|
|
605
|
-
|
|
606
|
-
const findOptions = {};
|
|
607
|
-
if (options.hasOwnProperty('useMasterKey')) {
|
|
608
|
-
findOptions.useMasterKey = options.useMasterKey;
|
|
609
|
-
}
|
|
610
|
-
if (options.hasOwnProperty('sessionToken')) {
|
|
611
|
-
findOptions.sessionToken = options.sessionToken;
|
|
612
|
-
}
|
|
613
|
-
if (options.hasOwnProperty('context') && typeof options.context === 'object') {
|
|
614
|
-
findOptions.context = options.context;
|
|
615
|
-
}
|
|
593
|
+
const findOptions = _ParseObject.default._getRequestOptions(options);
|
|
616
594
|
this._setRequestTask(findOptions);
|
|
617
595
|
const controller = _CoreManager.default.getQueryController();
|
|
618
596
|
const select = this._select;
|
|
@@ -638,7 +616,7 @@ class ParseQuery {
|
|
|
638
616
|
if (select) {
|
|
639
617
|
handleSelectResult(data, select);
|
|
640
618
|
}
|
|
641
|
-
if (
|
|
619
|
+
if (findOptions.json) {
|
|
642
620
|
return data;
|
|
643
621
|
} else {
|
|
644
622
|
return _ParseObject.default.fromJSON(data, !select);
|
|
@@ -666,6 +644,7 @@ class ParseQuery {
|
|
|
666
644
|
* be used for this request.
|
|
667
645
|
* <li>sessionToken: A valid session token, used for making a request on
|
|
668
646
|
* behalf of a specific user.
|
|
647
|
+
* <li>json: Return raw JSON without converting to Parse.Object.
|
|
669
648
|
* </ul>
|
|
670
649
|
* @returns {Promise} A promise that is resolved with the results when
|
|
671
650
|
* the query completes.
|
|
@@ -695,13 +674,7 @@ class ParseQuery {
|
|
|
695
674
|
*/
|
|
696
675
|
count(options) {
|
|
697
676
|
options = options || {};
|
|
698
|
-
const findOptions =
|
|
699
|
-
if (options.hasOwnProperty('useMasterKey')) {
|
|
700
|
-
findOptions.useMasterKey = options.useMasterKey;
|
|
701
|
-
}
|
|
702
|
-
if (options.hasOwnProperty('sessionToken')) {
|
|
703
|
-
findOptions.sessionToken = options.sessionToken;
|
|
704
|
-
}
|
|
677
|
+
const findOptions = _ParseObject.default._getRequestOptions(options);
|
|
705
678
|
this._setRequestTask(findOptions);
|
|
706
679
|
const controller = _CoreManager.default.getQueryController();
|
|
707
680
|
const params = this.toJSON();
|
|
@@ -725,7 +698,7 @@ class ParseQuery {
|
|
|
725
698
|
const distinctOptions = {
|
|
726
699
|
useMasterKey: true
|
|
727
700
|
};
|
|
728
|
-
if (
|
|
701
|
+
if (Object.hasOwn(options, 'sessionToken')) {
|
|
729
702
|
distinctOptions.sessionToken = options.sessionToken;
|
|
730
703
|
}
|
|
731
704
|
this._setRequestTask(distinctOptions);
|
|
@@ -753,7 +726,7 @@ class ParseQuery {
|
|
|
753
726
|
const aggregateOptions = {
|
|
754
727
|
useMasterKey: true
|
|
755
728
|
};
|
|
756
|
-
if (
|
|
729
|
+
if (Object.hasOwn(options, 'sessionToken')) {
|
|
757
730
|
aggregateOptions.sessionToken = options.sessionToken;
|
|
758
731
|
}
|
|
759
732
|
this._setRequestTask(aggregateOptions);
|
|
@@ -798,16 +771,7 @@ class ParseQuery {
|
|
|
798
771
|
*/
|
|
799
772
|
first() {
|
|
800
773
|
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
801
|
-
const findOptions =
|
|
802
|
-
if (options.hasOwnProperty('useMasterKey')) {
|
|
803
|
-
findOptions.useMasterKey = options.useMasterKey;
|
|
804
|
-
}
|
|
805
|
-
if (options.hasOwnProperty('sessionToken')) {
|
|
806
|
-
findOptions.sessionToken = options.sessionToken;
|
|
807
|
-
}
|
|
808
|
-
if (options.hasOwnProperty('context') && typeof options.context === 'object') {
|
|
809
|
-
findOptions.context = options.context;
|
|
810
|
-
}
|
|
774
|
+
const findOptions = _ParseObject.default._getRequestOptions(options);
|
|
811
775
|
this._setRequestTask(findOptions);
|
|
812
776
|
const controller = _CoreManager.default.getQueryController();
|
|
813
777
|
const params = this.toJSON();
|
|
@@ -836,7 +800,7 @@ class ParseQuery {
|
|
|
836
800
|
if (select) {
|
|
837
801
|
handleSelectResult(objects[0], select);
|
|
838
802
|
}
|
|
839
|
-
if (
|
|
803
|
+
if (findOptions.json) {
|
|
840
804
|
return objects[0];
|
|
841
805
|
} else {
|
|
842
806
|
return _ParseObject.default.fromJSON(objects[0], !select);
|
|
@@ -870,45 +834,10 @@ class ParseQuery {
|
|
|
870
834
|
if (this._order || this._skip || this._limit >= 0) {
|
|
871
835
|
return _promise.default.reject('Cannot iterate on a query with sort, skip, or limit.');
|
|
872
836
|
}
|
|
873
|
-
const query =
|
|
874
|
-
query._limit = options.batchSize || 100;
|
|
875
|
-
query._include = [...this._include];
|
|
876
|
-
query._exclude = [...this._exclude];
|
|
877
|
-
if (this._select) {
|
|
878
|
-
query._select = [...this._select];
|
|
879
|
-
}
|
|
880
|
-
query._hint = this._hint;
|
|
881
|
-
query._where = {};
|
|
882
|
-
for (const attr in this._where) {
|
|
883
|
-
const val = this._where[attr];
|
|
884
|
-
if ((0, _isArray.default)(val)) {
|
|
885
|
-
query._where[attr] = (0, _map.default)(val).call(val, v => {
|
|
886
|
-
return v;
|
|
887
|
-
});
|
|
888
|
-
} else if (val && typeof val === 'object') {
|
|
889
|
-
const conditionMap = {};
|
|
890
|
-
query._where[attr] = conditionMap;
|
|
891
|
-
for (const cond in val) {
|
|
892
|
-
conditionMap[cond] = val[cond];
|
|
893
|
-
}
|
|
894
|
-
} else {
|
|
895
|
-
query._where[attr] = val;
|
|
896
|
-
}
|
|
897
|
-
}
|
|
837
|
+
const query = ParseQuery.fromJSON(this.className, this.toJSON());
|
|
898
838
|
query.ascending('objectId');
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
findOptions.useMasterKey = options.useMasterKey;
|
|
902
|
-
}
|
|
903
|
-
if (options.hasOwnProperty('sessionToken')) {
|
|
904
|
-
findOptions.sessionToken = options.sessionToken;
|
|
905
|
-
}
|
|
906
|
-
if (options.hasOwnProperty('context') && typeof options.context === 'object') {
|
|
907
|
-
findOptions.context = options.context;
|
|
908
|
-
}
|
|
909
|
-
if (options.hasOwnProperty('json')) {
|
|
910
|
-
findOptions.json = options.json;
|
|
911
|
-
}
|
|
839
|
+
query._limit = options.batchSize || 100;
|
|
840
|
+
const findOptions = _ParseObject.default._getRequestOptions(options);
|
|
912
841
|
let finished = false;
|
|
913
842
|
let previousResults = [];
|
|
914
843
|
return (0, _promiseUtils.continueWhile)(() => {
|
|
@@ -916,7 +845,11 @@ class ParseQuery {
|
|
|
916
845
|
}, async () => {
|
|
917
846
|
const [results] = await _promise.default.all([(0, _find.default)(query).call(query, findOptions), _promise.default.resolve(previousResults.length > 0 && callback(previousResults))]);
|
|
918
847
|
if (results.length >= query._limit) {
|
|
919
|
-
|
|
848
|
+
if (findOptions.json) {
|
|
849
|
+
query.greaterThan('objectId', results[results.length - 1].objectId);
|
|
850
|
+
} else {
|
|
851
|
+
query.greaterThan('objectId', results[results.length - 1].id);
|
|
852
|
+
}
|
|
920
853
|
previousResults = results;
|
|
921
854
|
} else if (results.length > 0) {
|
|
922
855
|
await _promise.default.resolve(callback(results));
|
|
@@ -26,7 +26,9 @@ class ParseSession extends _ParseObject.default {
|
|
|
26
26
|
constructor(attributes) {
|
|
27
27
|
super('_Session');
|
|
28
28
|
if (attributes && typeof attributes === 'object') {
|
|
29
|
-
|
|
29
|
+
try {
|
|
30
|
+
this.set(attributes || {});
|
|
31
|
+
} catch (_) {
|
|
30
32
|
throw new Error("Can't create an invalid Session");
|
|
31
33
|
}
|
|
32
34
|
}
|
|
@@ -58,12 +60,8 @@ class ParseSession extends _ParseObject.default {
|
|
|
58
60
|
* promise will be rejected.
|
|
59
61
|
*/
|
|
60
62
|
static current(options) {
|
|
61
|
-
options = options || {};
|
|
62
63
|
const controller = _CoreManager.default.getSessionController();
|
|
63
|
-
const sessionOptions =
|
|
64
|
-
if (options.hasOwnProperty('useMasterKey')) {
|
|
65
|
-
sessionOptions.useMasterKey = options.useMasterKey;
|
|
66
|
-
}
|
|
64
|
+
const sessionOptions = _ParseObject.default._getRequestOptions(options);
|
|
67
65
|
return _ParseUser.default.currentAsync().then(user => {
|
|
68
66
|
if (!user) {
|
|
69
67
|
return _promise.default.reject('There is no current user.');
|
package/lib/weapp/ParseUser.js
CHANGED
|
@@ -37,7 +37,9 @@ class ParseUser extends _ParseObject.default {
|
|
|
37
37
|
constructor(attributes) {
|
|
38
38
|
super('_User');
|
|
39
39
|
if (attributes && typeof attributes === 'object') {
|
|
40
|
-
|
|
40
|
+
try {
|
|
41
|
+
this.set(attributes || {});
|
|
42
|
+
} catch (_) {
|
|
41
43
|
throw new Error("Can't create an invalid Parse User");
|
|
42
44
|
}
|
|
43
45
|
}
|
|
@@ -47,15 +49,15 @@ class ParseUser extends _ParseObject.default {
|
|
|
47
49
|
* Request a revocable session token to replace the older style of token.
|
|
48
50
|
*
|
|
49
51
|
* @param {object} options
|
|
52
|
+
* Valid options are:<ul>
|
|
53
|
+
* <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
|
|
54
|
+
* be used for this request.
|
|
55
|
+
* </ul>
|
|
50
56
|
* @returns {Promise} A promise that is resolved when the replacement
|
|
51
57
|
* token has been fetched.
|
|
52
58
|
*/
|
|
53
59
|
_upgradeToRevocableSession(options) {
|
|
54
|
-
|
|
55
|
-
const upgradeOptions = {};
|
|
56
|
-
if (options.hasOwnProperty('useMasterKey')) {
|
|
57
|
-
upgradeOptions.useMasterKey = options.useMasterKey;
|
|
58
|
-
}
|
|
60
|
+
const upgradeOptions = _ParseObject.default._getRequestOptions(options);
|
|
59
61
|
const controller = _CoreManager.default.getUserController();
|
|
60
62
|
return controller.upgradeToRevocableSession(this, upgradeOptions);
|
|
61
63
|
}
|
|
@@ -99,7 +101,7 @@ class ParseUser extends _ParseObject.default {
|
|
|
99
101
|
} else {
|
|
100
102
|
authType = provider.getAuthType();
|
|
101
103
|
}
|
|
102
|
-
if (options &&
|
|
104
|
+
if (options && Object.hasOwn(options, 'authData')) {
|
|
103
105
|
const authData = this.get('authData') || {};
|
|
104
106
|
if (typeof authData !== 'object') {
|
|
105
107
|
throw new Error('Invalid type: authData field should be an object');
|
|
@@ -125,7 +127,7 @@ class ParseUser extends _ParseObject.default {
|
|
|
125
127
|
reject(error);
|
|
126
128
|
});
|
|
127
129
|
},
|
|
128
|
-
error: (
|
|
130
|
+
error: (_provider, error) => {
|
|
129
131
|
reject(error);
|
|
130
132
|
}
|
|
131
133
|
});
|
|
@@ -305,7 +307,7 @@ class ParseUser extends _ParseObject.default {
|
|
|
305
307
|
}
|
|
306
308
|
stripAnonymity() {
|
|
307
309
|
const authData = this.get('authData');
|
|
308
|
-
if (authData && typeof authData === 'object' &&
|
|
310
|
+
if (authData && typeof authData === 'object' && Object.hasOwn(authData, 'anonymous')) {
|
|
309
311
|
// We need to set anonymous to null instead of deleting it in order to remove it from Parse.
|
|
310
312
|
authData.anonymous = null;
|
|
311
313
|
}
|
|
@@ -407,21 +409,17 @@ class ParseUser extends _ParseObject.default {
|
|
|
407
409
|
*
|
|
408
410
|
* @param {object} attrs Extra fields to set on the new user, or null.
|
|
409
411
|
* @param {object} options
|
|
412
|
+
* Valid options are:<ul>
|
|
413
|
+
* <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
|
|
414
|
+
* be used for this request.
|
|
415
|
+
* <li>installationId: the installationId which made the request
|
|
416
|
+
* <li>context: A dictionary that is accessible in Cloud Code `beforeLogin` and `afterLogin` triggers.
|
|
417
|
+
* </ul>
|
|
410
418
|
* @returns {Promise} A promise that is fulfilled when the signup
|
|
411
419
|
* finishes.
|
|
412
420
|
*/
|
|
413
421
|
signUp(attrs, options) {
|
|
414
|
-
|
|
415
|
-
const signupOptions = {};
|
|
416
|
-
if (options.hasOwnProperty('useMasterKey')) {
|
|
417
|
-
signupOptions.useMasterKey = options.useMasterKey;
|
|
418
|
-
}
|
|
419
|
-
if (options.hasOwnProperty('installationId')) {
|
|
420
|
-
signupOptions.installationId = options.installationId;
|
|
421
|
-
}
|
|
422
|
-
if (options.hasOwnProperty('context') && Object.prototype.toString.call(options.context) === '[object Object]') {
|
|
423
|
-
signupOptions.context = options.context;
|
|
424
|
-
}
|
|
422
|
+
const signupOptions = _ParseObject.default._getRequestOptions(options);
|
|
425
423
|
const controller = _CoreManager.default.getUserController();
|
|
426
424
|
return controller.signUp(this, attrs, signupOptions);
|
|
427
425
|
}
|
|
@@ -434,26 +432,21 @@ class ParseUser extends _ParseObject.default {
|
|
|
434
432
|
* <p>A username and password must be set before calling logIn.</p>
|
|
435
433
|
*
|
|
436
434
|
* @param {object} options
|
|
435
|
+
* Valid options are:<ul>
|
|
436
|
+
* <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
|
|
437
|
+
* be used for this request.
|
|
438
|
+
* <li>usePost: Use POST method to make the request (default: true)
|
|
439
|
+
* <li>installationId: the installationId which made the request
|
|
440
|
+
* <li>context: A dictionary that is accessible in Cloud Code `beforeLogin` and `afterLogin` triggers.
|
|
441
|
+
* </ul>
|
|
437
442
|
* @returns {Promise} A promise that is fulfilled with the user when
|
|
438
443
|
* the login is complete.
|
|
439
444
|
*/
|
|
440
445
|
logIn() {
|
|
441
446
|
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
usePost
|
|
445
|
-
};
|
|
446
|
-
if (options.hasOwnProperty('useMasterKey')) {
|
|
447
|
-
loginOptions.useMasterKey = options.useMasterKey;
|
|
448
|
-
}
|
|
449
|
-
if (options.hasOwnProperty('installationId')) {
|
|
450
|
-
loginOptions.installationId = options.installationId;
|
|
451
|
-
}
|
|
452
|
-
if (options.hasOwnProperty('usePost')) {
|
|
453
|
-
loginOptions.usePost = options.usePost;
|
|
454
|
-
}
|
|
455
|
-
if (options.hasOwnProperty('context') && Object.prototype.toString.call(options.context) === '[object Object]') {
|
|
456
|
-
loginOptions.context = options.context;
|
|
447
|
+
const loginOptions = _ParseObject.default._getRequestOptions(options);
|
|
448
|
+
if (!Object.hasOwn(loginOptions, 'usePost')) {
|
|
449
|
+
loginOptions.usePost = true;
|
|
457
450
|
}
|
|
458
451
|
const controller = _CoreManager.default.getUserController();
|
|
459
452
|
return controller.logIn(this, loginOptions);
|
|
@@ -724,6 +717,7 @@ class ParseUser extends _ParseObject.default {
|
|
|
724
717
|
*
|
|
725
718
|
* @param {string} sessionToken The sessionToken to log in with.
|
|
726
719
|
* @param {object} options
|
|
720
|
+
* @param {boolean} [options.useMasterKey]
|
|
727
721
|
* @static
|
|
728
722
|
* @returns {Promise} A promise that is fulfilled with the user when
|
|
729
723
|
* the login completes.
|
|
@@ -732,13 +726,8 @@ class ParseUser extends _ParseObject.default {
|
|
|
732
726
|
if (!canUseCurrentUser) {
|
|
733
727
|
throw new Error('It is not memory-safe to become a user in a server environment');
|
|
734
728
|
}
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
sessionToken: sessionToken
|
|
738
|
-
};
|
|
739
|
-
if (options.hasOwnProperty('useMasterKey')) {
|
|
740
|
-
becomeOptions.useMasterKey = options.useMasterKey;
|
|
741
|
-
}
|
|
729
|
+
const becomeOptions = _ParseObject.default._getRequestOptions(options);
|
|
730
|
+
becomeOptions.sessionToken = sessionToken;
|
|
742
731
|
const controller = _CoreManager.default.getUserController();
|
|
743
732
|
const user = new this();
|
|
744
733
|
return controller.become(user, becomeOptions);
|
|
@@ -749,18 +738,15 @@ class ParseUser extends _ParseObject.default {
|
|
|
749
738
|
*
|
|
750
739
|
* @param {string} sessionToken The sessionToken to get user with.
|
|
751
740
|
* @param {object} options
|
|
741
|
+
* @param {boolean} [options.useMasterKey]
|
|
752
742
|
* @static
|
|
753
743
|
* @returns {Promise} A promise that is fulfilled with the user is fetched.
|
|
754
744
|
*/
|
|
755
745
|
static me(sessionToken) {
|
|
756
746
|
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
757
747
|
const controller = _CoreManager.default.getUserController();
|
|
758
|
-
const meOptions =
|
|
759
|
-
|
|
760
|
-
};
|
|
761
|
-
if (options.useMasterKey) {
|
|
762
|
-
meOptions.useMasterKey = options.useMasterKey;
|
|
763
|
-
}
|
|
748
|
+
const meOptions = _ParseObject.default._getRequestOptions(options);
|
|
749
|
+
meOptions.sessionToken = sessionToken;
|
|
764
750
|
const user = new this();
|
|
765
751
|
return controller.me(user, meOptions);
|
|
766
752
|
}
|
|
@@ -820,15 +806,15 @@ class ParseUser extends _ParseObject.default {
|
|
|
820
806
|
* @param {string} email The email address associated with the user that
|
|
821
807
|
* forgot their password.
|
|
822
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>
|
|
823
813
|
* @static
|
|
824
814
|
* @returns {Promise}
|
|
825
815
|
*/
|
|
826
816
|
static requestPasswordReset(email, options) {
|
|
827
|
-
|
|
828
|
-
const requestOptions = {};
|
|
829
|
-
if (options.hasOwnProperty('useMasterKey')) {
|
|
830
|
-
requestOptions.useMasterKey = options.useMasterKey;
|
|
831
|
-
}
|
|
817
|
+
const requestOptions = _ParseObject.default._getRequestOptions(options);
|
|
832
818
|
const controller = _CoreManager.default.getUserController();
|
|
833
819
|
return controller.requestPasswordReset(email, requestOptions);
|
|
834
820
|
}
|
|
@@ -839,15 +825,15 @@ class ParseUser extends _ParseObject.default {
|
|
|
839
825
|
* @param {string} email The email address associated with the user that
|
|
840
826
|
* needs to verify their email.
|
|
841
827
|
* @param {object} options
|
|
828
|
+
* Valid options are:<ul>
|
|
829
|
+
* <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
|
|
830
|
+
* be used for this request.
|
|
831
|
+
* </ul>
|
|
842
832
|
* @static
|
|
843
833
|
* @returns {Promise}
|
|
844
834
|
*/
|
|
845
835
|
static requestEmailVerification(email, options) {
|
|
846
|
-
|
|
847
|
-
const requestOptions = {};
|
|
848
|
-
if (options.hasOwnProperty('useMasterKey')) {
|
|
849
|
-
requestOptions.useMasterKey = options.useMasterKey;
|
|
850
|
-
}
|
|
836
|
+
const requestOptions = _ParseObject.default._getRequestOptions(options);
|
|
851
837
|
const controller = _CoreManager.default.getUserController();
|
|
852
838
|
return controller.requestEmailVerification(email, requestOptions);
|
|
853
839
|
}
|
package/lib/weapp/Push.js
CHANGED
|
@@ -62,7 +62,7 @@ function send(data) {
|
|
|
62
62
|
const pushOptions = {
|
|
63
63
|
useMasterKey: true
|
|
64
64
|
};
|
|
65
|
-
if (
|
|
65
|
+
if (Object.hasOwn(options, 'useMasterKey')) {
|
|
66
66
|
pushOptions.useMasterKey = options.useMasterKey;
|
|
67
67
|
}
|
|
68
68
|
return _CoreManager.default.getPushController().send(data, pushOptions);
|
|
@@ -86,7 +86,7 @@ function getPushStatus(pushStatusId) {
|
|
|
86
86
|
const pushOptions = {
|
|
87
87
|
useMasterKey: true
|
|
88
88
|
};
|
|
89
|
-
if (
|
|
89
|
+
if (Object.hasOwn(options, 'useMasterKey')) {
|
|
90
90
|
pushOptions.useMasterKey = options.useMasterKey;
|
|
91
91
|
}
|
|
92
92
|
const query = new _ParseQuery.default('_PushStatus');
|
|
@@ -29,7 +29,7 @@ let useXDomainRequest = false;
|
|
|
29
29
|
if (typeof XDomainRequest !== 'undefined' && !('withCredentials' in new XMLHttpRequest())) {
|
|
30
30
|
useXDomainRequest = true;
|
|
31
31
|
}
|
|
32
|
-
function ajaxIE9(method, url, data,
|
|
32
|
+
function ajaxIE9(method, url, data, _headers, options) {
|
|
33
33
|
return new _promise.default((resolve, reject) => {
|
|
34
34
|
// @ts-ignore
|
|
35
35
|
const xdr = new XDomainRequest();
|
|
@@ -292,7 +292,7 @@ const RESTController = {
|
|
|
292
292
|
try {
|
|
293
293
|
const errorJSON = JSON.parse(response.responseText);
|
|
294
294
|
error = new _ParseError.default(errorJSON.code, errorJSON.error);
|
|
295
|
-
} catch (
|
|
295
|
+
} catch (_) {
|
|
296
296
|
// If we fail to parse the error text, that's okay.
|
|
297
297
|
error = new _ParseError.default(_ParseError.default.INVALID_JSON, 'Received an error with invalid JSON from Parse: ' + response.responseText);
|
|
298
298
|
}
|
package/lib/weapp/Storage.js
CHANGED
|
@@ -12,7 +12,7 @@ const memMap = {};
|
|
|
12
12
|
const StorageController = {
|
|
13
13
|
async: 0,
|
|
14
14
|
getItem(path) {
|
|
15
|
-
if (
|
|
15
|
+
if (Object.hasOwn(memMap, path)) {
|
|
16
16
|
return memMap[path];
|
|
17
17
|
}
|
|
18
18
|
return null;
|
|
@@ -28,7 +28,7 @@ const StorageController = {
|
|
|
28
28
|
},
|
|
29
29
|
clear() {
|
|
30
30
|
for (const key in memMap) {
|
|
31
|
-
if (
|
|
31
|
+
if (Object.hasOwn(memMap, key)) {
|
|
32
32
|
delete memMap[key];
|
|
33
33
|
}
|
|
34
34
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "parse",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0-alpha.2",
|
|
4
4
|
"description": "Parse JavaScript SDK",
|
|
5
5
|
"homepage": "https://parseplatform.org",
|
|
6
6
|
"keywords": [
|
|
@@ -29,29 +29,30 @@
|
|
|
29
29
|
"react-native": false
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@babel/runtime-corejs3": "7.
|
|
32
|
+
"@babel/runtime-corejs3": "7.26.9",
|
|
33
33
|
"idb-keyval": "6.2.1",
|
|
34
34
|
"react-native-crypto-js": "1.0.0",
|
|
35
35
|
"uuid": "10.0.0",
|
|
36
|
-
"ws": "8.
|
|
36
|
+
"ws": "8.18.0",
|
|
37
37
|
"xmlhttprequest": "1.8.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@babel/core": "7.
|
|
40
|
+
"@babel/core": "7.26.7",
|
|
41
41
|
"@babel/plugin-proposal-class-properties": "7.18.6",
|
|
42
|
-
"@babel/plugin-transform-runtime": "7.
|
|
43
|
-
"@babel/preset-env": "7.
|
|
44
|
-
"@babel/preset-react": "7.
|
|
45
|
-
"@babel/preset-typescript": "7.
|
|
42
|
+
"@babel/plugin-transform-runtime": "7.26.8",
|
|
43
|
+
"@babel/preset-env": "7.26.8",
|
|
44
|
+
"@babel/preset-react": "7.26.3",
|
|
45
|
+
"@babel/preset-typescript": "7.26.0",
|
|
46
46
|
"@definitelytyped/dtslint": "0.0.163",
|
|
47
|
+
"@eslint/js": "9.18.0",
|
|
47
48
|
"@parse/minami": "git+https://github.com/parse-community/minami#main",
|
|
48
49
|
"@saithodev/semantic-release-backmerge": "4.0.1",
|
|
49
50
|
"@semantic-release/changelog": "6.0.3",
|
|
50
|
-
"@semantic-release/commit-analyzer": "13.0.
|
|
51
|
+
"@semantic-release/commit-analyzer": "13.0.1",
|
|
51
52
|
"@semantic-release/git": "10.0.1",
|
|
52
|
-
"@semantic-release/github": "
|
|
53
|
+
"@semantic-release/github": "11.0.1",
|
|
53
54
|
"@semantic-release/npm": "12.0.1",
|
|
54
|
-
"@semantic-release/release-notes-generator": "14.0.
|
|
55
|
+
"@semantic-release/release-notes-generator": "14.0.3",
|
|
55
56
|
"@types/facebook-js-sdk": "3.3.11",
|
|
56
57
|
"babel-jest": "29.5.0",
|
|
57
58
|
"babel-plugin-inline-package-json": "2.0.0",
|
|
@@ -59,11 +60,11 @@
|
|
|
59
60
|
"babel-plugin-transform-inline-environment-variables": "0.4.4",
|
|
60
61
|
"browserify": "17.0.0",
|
|
61
62
|
"codecov": "3.8.3",
|
|
62
|
-
"core-js": "3.
|
|
63
|
+
"core-js": "3.40.0",
|
|
63
64
|
"cross-env": "7.0.2",
|
|
64
|
-
"eslint": "
|
|
65
|
-
"eslint-plugin-jsdoc": "
|
|
66
|
-
"express": "4.
|
|
65
|
+
"eslint": "9.20.1",
|
|
66
|
+
"eslint-plugin-jsdoc": "50.6.3",
|
|
67
|
+
"express": "4.21.2",
|
|
67
68
|
"gulp": "5.0.0",
|
|
68
69
|
"gulp-babel": "8.0.0",
|
|
69
70
|
"gulp-derequire": "3.0.0",
|
|
@@ -71,23 +72,24 @@
|
|
|
71
72
|
"gulp-rename": "2.0.0",
|
|
72
73
|
"gulp-uglify": "3.0.2",
|
|
73
74
|
"gulp-watch": "5.0.1",
|
|
74
|
-
"husky": "9.
|
|
75
|
-
"jasmine": "5.
|
|
75
|
+
"husky": "9.1.7",
|
|
76
|
+
"jasmine": "5.5.0",
|
|
76
77
|
"jasmine-reporters": "2.5.2",
|
|
77
78
|
"jasmine-spec-reporter": "7.0.0",
|
|
78
79
|
"jest": "29.7.0",
|
|
79
80
|
"jest-environment-jsdom": "29.7.0",
|
|
80
|
-
"jsdoc": "4.0.
|
|
81
|
+
"jsdoc": "4.0.4",
|
|
81
82
|
"jsdoc-babel": "0.5.0",
|
|
82
|
-
"lint-staged": "15.
|
|
83
|
-
"madge": "
|
|
83
|
+
"lint-staged": "15.4.3",
|
|
84
|
+
"madge": "8.0.0",
|
|
84
85
|
"metro-react-native-babel-preset": "0.77.0",
|
|
85
|
-
"mongodb-runner": "5.
|
|
86
|
-
"parse-server": "7.
|
|
87
|
-
"prettier": "3.
|
|
88
|
-
"puppeteer": "
|
|
86
|
+
"mongodb-runner": "5.8.0",
|
|
87
|
+
"parse-server": "7.3.0",
|
|
88
|
+
"prettier": "3.5.1",
|
|
89
|
+
"puppeteer": "24.2.1",
|
|
89
90
|
"regenerator-runtime": "0.14.1",
|
|
90
|
-
"semantic-release": "24.
|
|
91
|
+
"semantic-release": "24.2.2",
|
|
92
|
+
"typescript-eslint": "8.22.0",
|
|
91
93
|
"vinyl-source-stream": "2.0.0"
|
|
92
94
|
},
|
|
93
95
|
"optionalDependencies": {
|
|
@@ -102,9 +104,9 @@
|
|
|
102
104
|
"test:mongodb:runnerstart": "mongodb-runner start -- --port 27017",
|
|
103
105
|
"test:types": "dtslint --expectOnly types",
|
|
104
106
|
"posttest:mongodb": "mongodb-runner stop --all",
|
|
105
|
-
"lint": "eslint --cache src/ integration/
|
|
106
|
-
"lint:fix": "eslint --fix --cache src/ integration/
|
|
107
|
-
"lint:types": "
|
|
107
|
+
"lint": "eslint --cache src/ integration/",
|
|
108
|
+
"lint:fix": "eslint --fix --cache src/ integration/",
|
|
109
|
+
"lint:types": "eslint --cache types/",
|
|
108
110
|
"watch": "cross-env PARSE_BUILD=${PARSE_BUILD} gulp watch",
|
|
109
111
|
"watch:browser": "cross-env PARSE_BUILD=browser npm run watch",
|
|
110
112
|
"watch:node": "cross-env PARSE_BUILD=node npm run watch",
|