parse 5.3.0-alpha.5 → 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 +4 -4
- 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/ParseObject.js +54 -115
- package/lib/react-native/ParseQuery.js +20 -88
- package/lib/react-native/ParseSession.js +1 -5
- package/lib/react-native/ParseUser.js +13 -56
- 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 +5 -5
package/dist/parse.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Parse JavaScript SDK v5.3.0-alpha.
|
|
2
|
+
* Parse JavaScript SDK v5.3.0-alpha.6
|
|
3
3
|
*
|
|
4
4
|
* The source tree of this library can be found at
|
|
5
5
|
* https://github.com/ParsePlatform/Parse-SDK-JS
|
|
@@ -215,6 +215,7 @@ var _decode = _interopRequireDefault(_dereq_("./decode"));
|
|
|
215
215
|
var _encode = _interopRequireDefault(_dereq_("./encode"));
|
|
216
216
|
var _ParseError = _interopRequireDefault(_dereq_("./ParseError"));
|
|
217
217
|
var _ParseQuery = _interopRequireDefault(_dereq_("./ParseQuery"));
|
|
218
|
+
var _ParseObject = _interopRequireDefault(_dereq_("./ParseObject"));
|
|
218
219
|
/**
|
|
219
220
|
* Contains functions for calling and declaring
|
|
220
221
|
* <a href="/docs/cloud_code_guide#functions">cloud functions</a>.
|
|
@@ -235,27 +236,22 @@ var _ParseQuery = _interopRequireDefault(_dereq_("./ParseQuery"));
|
|
|
235
236
|
* @param {string} name The function name.
|
|
236
237
|
* @param {object} data The parameters to send to the cloud function.
|
|
237
238
|
* @param {object} options
|
|
239
|
+
* Valid options are:<ul>
|
|
240
|
+
* <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
|
|
241
|
+
* be used for this request.
|
|
242
|
+
* <li>sessionToken: A valid session token, used for making a request on
|
|
243
|
+
* behalf of a specific user.
|
|
244
|
+
* <li>installationId: the installationId which made the request
|
|
245
|
+
* <li>context: A dictionary that is accessible in Cloud Code triggers.
|
|
246
|
+
* </ul>
|
|
238
247
|
* @returns {Promise} A promise that will be resolved with the result
|
|
239
248
|
* of the function.
|
|
240
249
|
*/
|
|
241
250
|
function run(name, data, options) {
|
|
242
|
-
options = options || {};
|
|
243
251
|
if (typeof name !== 'string' || name.length === 0) {
|
|
244
252
|
throw new TypeError('Cloud function name must be a string.');
|
|
245
253
|
}
|
|
246
|
-
const requestOptions =
|
|
247
|
-
if (options.hasOwnProperty('useMasterKey')) {
|
|
248
|
-
requestOptions.useMasterKey = !!options.useMasterKey;
|
|
249
|
-
}
|
|
250
|
-
if (options.sessionToken) {
|
|
251
|
-
requestOptions.sessionToken = options.sessionToken;
|
|
252
|
-
}
|
|
253
|
-
if (options.installationId) {
|
|
254
|
-
requestOptions.installationId = options.installationId;
|
|
255
|
-
}
|
|
256
|
-
if (options.context && typeof options.context === 'object') {
|
|
257
|
-
requestOptions.context = options.context;
|
|
258
|
-
}
|
|
254
|
+
const requestOptions = _ParseObject.default._getRequestOptions(options);
|
|
259
255
|
return _CoreManager.default.getCloudController().run(name, data, requestOptions);
|
|
260
256
|
}
|
|
261
257
|
|
|
@@ -312,11 +308,11 @@ const DefaultController = {
|
|
|
312
308
|
const payload = (0, _encode.default)(data, true);
|
|
313
309
|
const request = RESTController.request('POST', 'functions/' + name, payload, options);
|
|
314
310
|
return request.then(res => {
|
|
315
|
-
if (typeof res === 'object' && (0, _keys.default)(res).length > 0 && !
|
|
311
|
+
if (typeof res === 'object' && (0, _keys.default)(res).length > 0 && !Object.hasOwn(res, 'result')) {
|
|
316
312
|
throw new _ParseError.default(_ParseError.default.INVALID_JSON, 'The server returned an invalid response.');
|
|
317
313
|
}
|
|
318
314
|
const decoded = (0, _decode.default)(res);
|
|
319
|
-
if (decoded &&
|
|
315
|
+
if (decoded && Object.hasOwn(decoded, 'result')) {
|
|
320
316
|
return _promise.default.resolve(decoded.result);
|
|
321
317
|
}
|
|
322
318
|
return _promise.default.resolve(undefined);
|
|
@@ -335,7 +331,7 @@ const DefaultController = {
|
|
|
335
331
|
}
|
|
336
332
|
};
|
|
337
333
|
_CoreManager.default.setCloudController(DefaultController);
|
|
338
|
-
},{"./CoreManager":4,"./ParseError":24,"./ParseQuery":33,"./decode":55,"./encode":56,"@babel/runtime-corejs3/core-js-stable/object/define-property":91,"@babel/runtime-corejs3/core-js-stable/object/keys":96,"@babel/runtime-corejs3/core-js-stable/promise":98,"@babel/runtime-corejs3/helpers/interopRequireDefault":104}],4:[function(_dereq_,module,exports){
|
|
334
|
+
},{"./CoreManager":4,"./ParseError":24,"./ParseObject":30,"./ParseQuery":33,"./decode":55,"./encode":56,"@babel/runtime-corejs3/core-js-stable/object/define-property":91,"@babel/runtime-corejs3/core-js-stable/object/keys":96,"@babel/runtime-corejs3/core-js-stable/promise":98,"@babel/runtime-corejs3/helpers/interopRequireDefault":104}],4:[function(_dereq_,module,exports){
|
|
339
335
|
(function (process){(function (){
|
|
340
336
|
"use strict";
|
|
341
337
|
|
|
@@ -358,7 +354,7 @@ const config = {
|
|
|
358
354
|
SERVER_AUTH_TOKEN: null,
|
|
359
355
|
LIVEQUERY_SERVER_URL: null,
|
|
360
356
|
ENCRYPTED_KEY: null,
|
|
361
|
-
VERSION: 'js' + "5.3.0-alpha.
|
|
357
|
+
VERSION: 'js' + "5.3.0-alpha.6",
|
|
362
358
|
APPLICATION_ID: null,
|
|
363
359
|
JAVASCRIPT_KEY: null,
|
|
364
360
|
MASTER_KEY: null,
|
|
@@ -379,7 +375,7 @@ function requireMethods(name, methods, controller) {
|
|
|
379
375
|
}
|
|
380
376
|
const CoreManager = {
|
|
381
377
|
get: function (key) {
|
|
382
|
-
if (
|
|
378
|
+
if (Object.hasOwn(config, key)) {
|
|
383
379
|
return config[key];
|
|
384
380
|
}
|
|
385
381
|
throw new Error('Configuration key not found: ' + key);
|
|
@@ -388,7 +384,7 @@ const CoreManager = {
|
|
|
388
384
|
config[key] = value;
|
|
389
385
|
},
|
|
390
386
|
setIfNeeded: function (key, value) {
|
|
391
|
-
if (!
|
|
387
|
+
if (!Object.hasOwn(config, key)) {
|
|
392
388
|
config[key] = value;
|
|
393
389
|
}
|
|
394
390
|
return config[key];
|
|
@@ -5641,7 +5637,7 @@ class ParseFile {
|
|
|
5641
5637
|
const destroyOptions = {
|
|
5642
5638
|
useMasterKey: true
|
|
5643
5639
|
};
|
|
5644
|
-
if (
|
|
5640
|
+
if (Object.hasOwn(options, 'useMasterKey')) {
|
|
5645
5641
|
destroyOptions.useMasterKey = !!options.useMasterKey;
|
|
5646
5642
|
}
|
|
5647
5643
|
const controller = _CoreManager.default.getFileController();
|
|
@@ -6650,9 +6646,9 @@ var _stringify = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-
|
|
|
6650
6646
|
var _includes = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/includes"));
|
|
6651
6647
|
var _getPrototypeOf = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/object/get-prototype-of"));
|
|
6652
6648
|
var _concat = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/concat"));
|
|
6653
|
-
var _isArray = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/array/is-array"));
|
|
6654
6649
|
var _promise = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/promise"));
|
|
6655
6650
|
var _some = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/some"));
|
|
6651
|
+
var _isArray = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/array/is-array"));
|
|
6656
6652
|
var _create = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/object/create"));
|
|
6657
6653
|
var _defineProperty3 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property"));
|
|
6658
6654
|
var _find = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/find"));
|
|
@@ -7060,6 +7056,41 @@ class ParseObject {
|
|
|
7060
7056
|
static _getClassMap() {
|
|
7061
7057
|
return classMap;
|
|
7062
7058
|
}
|
|
7059
|
+
static _getRequestOptions() {
|
|
7060
|
+
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
7061
|
+
const requestOptions = {};
|
|
7062
|
+
const {
|
|
7063
|
+
hasOwn
|
|
7064
|
+
} = Object;
|
|
7065
|
+
if (hasOwn(options, 'useMasterKey')) {
|
|
7066
|
+
requestOptions.useMasterKey = !!options.useMasterKey;
|
|
7067
|
+
}
|
|
7068
|
+
if (hasOwn(options, 'sessionToken') && typeof options.sessionToken === 'string') {
|
|
7069
|
+
requestOptions.sessionToken = options.sessionToken;
|
|
7070
|
+
}
|
|
7071
|
+
if (hasOwn(options, 'installationId') && typeof options.installationId === 'string') {
|
|
7072
|
+
requestOptions.installationId = options.installationId;
|
|
7073
|
+
}
|
|
7074
|
+
if (hasOwn(options, 'transaction') && typeof options.transaction === 'boolean') {
|
|
7075
|
+
requestOptions.transaction = options.transaction;
|
|
7076
|
+
}
|
|
7077
|
+
if (hasOwn(options, 'batchSize') && typeof options.batchSize === 'number') {
|
|
7078
|
+
requestOptions.batchSize = options.batchSize;
|
|
7079
|
+
}
|
|
7080
|
+
if (hasOwn(options, 'context') && typeof options.context === 'object') {
|
|
7081
|
+
requestOptions.context = options.context;
|
|
7082
|
+
}
|
|
7083
|
+
if (hasOwn(options, 'include')) {
|
|
7084
|
+
requestOptions.include = ParseObject.handleIncludeOptions(options);
|
|
7085
|
+
}
|
|
7086
|
+
if (hasOwn(options, 'usePost')) {
|
|
7087
|
+
requestOptions.usePost = options.usePost;
|
|
7088
|
+
}
|
|
7089
|
+
if (hasOwn(options, 'json')) {
|
|
7090
|
+
requestOptions.json = options.json;
|
|
7091
|
+
}
|
|
7092
|
+
return requestOptions;
|
|
7093
|
+
}
|
|
7063
7094
|
|
|
7064
7095
|
/* Public methods */
|
|
7065
7096
|
|
|
@@ -7126,11 +7157,11 @@ class ParseObject {
|
|
|
7126
7157
|
const pendingOps = this._getPendingOps();
|
|
7127
7158
|
const dirtyObjects = this._getDirtyObjectAttributes();
|
|
7128
7159
|
if (attr) {
|
|
7129
|
-
if (
|
|
7160
|
+
if (Object.hasOwn(dirtyObjects, attr)) {
|
|
7130
7161
|
return true;
|
|
7131
7162
|
}
|
|
7132
7163
|
for (let i = 0; i < pendingOps.length; i++) {
|
|
7133
|
-
if (pendingOps[i]
|
|
7164
|
+
if (Object.hasOwn(pendingOps[i], attr)) {
|
|
7134
7165
|
return true;
|
|
7135
7166
|
}
|
|
7136
7167
|
}
|
|
@@ -7264,7 +7295,7 @@ class ParseObject {
|
|
|
7264
7295
|
*/
|
|
7265
7296
|
has(attr) {
|
|
7266
7297
|
const attributes = this.attributes;
|
|
7267
|
-
if (
|
|
7298
|
+
if (Object.hasOwn(attributes, attr)) {
|
|
7268
7299
|
return attributes[attr] != null;
|
|
7269
7300
|
}
|
|
7270
7301
|
return false;
|
|
@@ -7643,7 +7674,7 @@ class ParseObject {
|
|
|
7643
7674
|
* @see Parse.Object#set
|
|
7644
7675
|
*/
|
|
7645
7676
|
validate(attrs) {
|
|
7646
|
-
if (
|
|
7677
|
+
if (Object.hasOwn(attrs, 'ACL') && !(attrs.ACL instanceof _ParseACL.default)) {
|
|
7647
7678
|
return new _ParseError.default(_ParseError.default.OTHER_CAUSE, 'ACL must be a Parse ACL.');
|
|
7648
7679
|
}
|
|
7649
7680
|
for (const key in attrs) {
|
|
@@ -7743,33 +7774,7 @@ class ParseObject {
|
|
|
7743
7774
|
* completes.
|
|
7744
7775
|
*/
|
|
7745
7776
|
fetch(options) {
|
|
7746
|
-
|
|
7747
|
-
const fetchOptions = {};
|
|
7748
|
-
if (options.hasOwnProperty('useMasterKey')) {
|
|
7749
|
-
fetchOptions.useMasterKey = options.useMasterKey;
|
|
7750
|
-
}
|
|
7751
|
-
if (options.hasOwnProperty('sessionToken')) {
|
|
7752
|
-
fetchOptions.sessionToken = options.sessionToken;
|
|
7753
|
-
}
|
|
7754
|
-
if (options.hasOwnProperty('context') && typeof options.context === 'object') {
|
|
7755
|
-
fetchOptions.context = options.context;
|
|
7756
|
-
}
|
|
7757
|
-
if (options.hasOwnProperty('include')) {
|
|
7758
|
-
fetchOptions.include = [];
|
|
7759
|
-
if ((0, _isArray.default)(options.include)) {
|
|
7760
|
-
var _context;
|
|
7761
|
-
(0, _forEach.default)(_context = options.include).call(_context, key => {
|
|
7762
|
-
if ((0, _isArray.default)(key)) {
|
|
7763
|
-
var _context2;
|
|
7764
|
-
fetchOptions.include = (0, _concat.default)(_context2 = fetchOptions.include).call(_context2, key);
|
|
7765
|
-
} else {
|
|
7766
|
-
fetchOptions.include.push(key);
|
|
7767
|
-
}
|
|
7768
|
-
});
|
|
7769
|
-
} else {
|
|
7770
|
-
fetchOptions.include.push(options.include);
|
|
7771
|
-
}
|
|
7772
|
-
}
|
|
7777
|
+
const fetchOptions = ParseObject._getRequestOptions(options);
|
|
7773
7778
|
const controller = _CoreManager.default.getObjectController();
|
|
7774
7779
|
return controller.fetch(this, true, fetchOptions);
|
|
7775
7780
|
}
|
|
@@ -7921,23 +7926,10 @@ class ParseObject {
|
|
|
7921
7926
|
return _promise.default.reject(validationError);
|
|
7922
7927
|
}
|
|
7923
7928
|
}
|
|
7924
|
-
const saveOptions =
|
|
7925
|
-
if (options.hasOwnProperty('useMasterKey')) {
|
|
7926
|
-
saveOptions.useMasterKey = !!options.useMasterKey;
|
|
7927
|
-
}
|
|
7928
|
-
if (options.hasOwnProperty('sessionToken') && typeof options.sessionToken === 'string') {
|
|
7929
|
-
saveOptions.sessionToken = options.sessionToken;
|
|
7930
|
-
}
|
|
7931
|
-
if (options.hasOwnProperty('installationId') && typeof options.installationId === 'string') {
|
|
7932
|
-
saveOptions.installationId = options.installationId;
|
|
7933
|
-
}
|
|
7934
|
-
if (options.hasOwnProperty('context') && typeof options.context === 'object') {
|
|
7935
|
-
saveOptions.context = options.context;
|
|
7936
|
-
}
|
|
7929
|
+
const saveOptions = ParseObject._getRequestOptions(options);
|
|
7937
7930
|
const controller = _CoreManager.default.getObjectController();
|
|
7938
7931
|
const unsaved = options.cascadeSave !== false ? (0, _unsavedChildren.default)(this) : null;
|
|
7939
7932
|
if (unsaved && unsaved.length && options.transaction === true && (0, _some.default)(unsaved).call(unsaved, el => el instanceof ParseObject)) {
|
|
7940
|
-
saveOptions.transaction = options.transaction;
|
|
7941
7933
|
const unsavedFiles = [];
|
|
7942
7934
|
const unsavedObjects = [];
|
|
7943
7935
|
(0, _forEach.default)(unsaved).call(unsaved, el => {
|
|
@@ -8001,20 +7993,10 @@ class ParseObject {
|
|
|
8001
7993
|
* completes.
|
|
8002
7994
|
*/
|
|
8003
7995
|
destroy(options) {
|
|
8004
|
-
options = options || {};
|
|
8005
|
-
const destroyOptions = {};
|
|
8006
|
-
if (options.hasOwnProperty('useMasterKey')) {
|
|
8007
|
-
destroyOptions.useMasterKey = options.useMasterKey;
|
|
8008
|
-
}
|
|
8009
|
-
if (options.hasOwnProperty('sessionToken')) {
|
|
8010
|
-
destroyOptions.sessionToken = options.sessionToken;
|
|
8011
|
-
}
|
|
8012
|
-
if (options.hasOwnProperty('context') && typeof options.context === 'object') {
|
|
8013
|
-
destroyOptions.context = options.context;
|
|
8014
|
-
}
|
|
8015
7996
|
if (!this.id) {
|
|
8016
7997
|
return _promise.default.resolve();
|
|
8017
7998
|
}
|
|
7999
|
+
const destroyOptions = ParseObject._getRequestOptions(options);
|
|
8018
8000
|
return _CoreManager.default.getObjectController().destroy(this, destroyOptions);
|
|
8019
8001
|
}
|
|
8020
8002
|
|
|
@@ -8167,17 +8149,8 @@ class ParseObject {
|
|
|
8167
8149
|
*/
|
|
8168
8150
|
static fetchAll(list) {
|
|
8169
8151
|
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
8170
|
-
const
|
|
8171
|
-
|
|
8172
|
-
queryOptions.useMasterKey = options.useMasterKey;
|
|
8173
|
-
}
|
|
8174
|
-
if (options.hasOwnProperty('sessionToken')) {
|
|
8175
|
-
queryOptions.sessionToken = options.sessionToken;
|
|
8176
|
-
}
|
|
8177
|
-
if (options.hasOwnProperty('include')) {
|
|
8178
|
-
queryOptions.include = ParseObject.handleIncludeOptions(options);
|
|
8179
|
-
}
|
|
8180
|
-
return _CoreManager.default.getObjectController().fetch(list, true, queryOptions);
|
|
8152
|
+
const fetchOptions = ParseObject._getRequestOptions(options);
|
|
8153
|
+
return _CoreManager.default.getObjectController().fetch(list, true, fetchOptions);
|
|
8181
8154
|
}
|
|
8182
8155
|
|
|
8183
8156
|
/**
|
|
@@ -8266,28 +8239,27 @@ class ParseObject {
|
|
|
8266
8239
|
*
|
|
8267
8240
|
* @param {Array} list A list of <code>Parse.Object</code>.
|
|
8268
8241
|
* @param {object} options
|
|
8242
|
+
* Valid options are:<ul>
|
|
8243
|
+
* <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
|
|
8244
|
+
* be used for this request.
|
|
8245
|
+
* <li>sessionToken: A valid session token, used for making a request on
|
|
8246
|
+
* behalf of a specific user.
|
|
8247
|
+
* <li>include: The name(s) of the key(s) to include. Can be a string, an array of strings,
|
|
8248
|
+
* or an array of array of strings.
|
|
8249
|
+
* <li>context: A dictionary that is accessible in Cloud Code `beforeFind` trigger.
|
|
8250
|
+
* </ul>
|
|
8269
8251
|
* @static
|
|
8270
8252
|
* @returns {Parse.Object[]}
|
|
8271
8253
|
*/
|
|
8272
8254
|
static fetchAllIfNeeded(list, options) {
|
|
8273
|
-
|
|
8274
|
-
|
|
8275
|
-
if (options.hasOwnProperty('useMasterKey')) {
|
|
8276
|
-
queryOptions.useMasterKey = options.useMasterKey;
|
|
8277
|
-
}
|
|
8278
|
-
if (options.hasOwnProperty('sessionToken')) {
|
|
8279
|
-
queryOptions.sessionToken = options.sessionToken;
|
|
8280
|
-
}
|
|
8281
|
-
if (options.hasOwnProperty('include')) {
|
|
8282
|
-
queryOptions.include = ParseObject.handleIncludeOptions(options);
|
|
8283
|
-
}
|
|
8284
|
-
return _CoreManager.default.getObjectController().fetch(list, false, queryOptions);
|
|
8255
|
+
const fetchOptions = ParseObject._getRequestOptions(options);
|
|
8256
|
+
return _CoreManager.default.getObjectController().fetch(list, false, fetchOptions);
|
|
8285
8257
|
}
|
|
8286
8258
|
static handleIncludeOptions(options) {
|
|
8287
8259
|
let include = [];
|
|
8288
8260
|
if ((0, _isArray.default)(options.include)) {
|
|
8289
|
-
var
|
|
8290
|
-
(0, _forEach.default)(
|
|
8261
|
+
var _context;
|
|
8262
|
+
(0, _forEach.default)(_context = options.include).call(_context, key => {
|
|
8291
8263
|
if ((0, _isArray.default)(key)) {
|
|
8292
8264
|
include = (0, _concat.default)(include).call(include, key);
|
|
8293
8265
|
} else {
|
|
@@ -8342,28 +8314,22 @@ class ParseObject {
|
|
|
8342
8314
|
*
|
|
8343
8315
|
* @param {Array} list A list of <code>Parse.Object</code>.
|
|
8344
8316
|
* @param {object} options
|
|
8317
|
+
* Valid options are:<ul>
|
|
8318
|
+
* <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
|
|
8319
|
+
* be used for this request.
|
|
8320
|
+
* <li>sessionToken: A valid session token, used for making a request on
|
|
8321
|
+
* behalf of a specific user.
|
|
8322
|
+
* <li>context: A dictionary that is accessible in Cloud Code `beforeDelete` and `afterDelete` triggers.
|
|
8323
|
+
* <li>transaction: Set to true to enable transactions
|
|
8324
|
+
* <li>batchSize: How many objects to yield in each batch (default: 20)
|
|
8325
|
+
* </ul>
|
|
8345
8326
|
* @static
|
|
8346
8327
|
* @returns {Promise} A promise that is fulfilled when the destroyAll
|
|
8347
8328
|
* completes.
|
|
8348
8329
|
*/
|
|
8349
8330
|
static destroyAll(list) {
|
|
8350
8331
|
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
8351
|
-
const destroyOptions =
|
|
8352
|
-
if (options.hasOwnProperty('useMasterKey')) {
|
|
8353
|
-
destroyOptions.useMasterKey = options.useMasterKey;
|
|
8354
|
-
}
|
|
8355
|
-
if (options.hasOwnProperty('sessionToken')) {
|
|
8356
|
-
destroyOptions.sessionToken = options.sessionToken;
|
|
8357
|
-
}
|
|
8358
|
-
if (options.hasOwnProperty('transaction') && typeof options.transaction === 'boolean') {
|
|
8359
|
-
destroyOptions.transaction = options.transaction;
|
|
8360
|
-
}
|
|
8361
|
-
if (options.hasOwnProperty('batchSize') && typeof options.batchSize === 'number') {
|
|
8362
|
-
destroyOptions.batchSize = options.batchSize;
|
|
8363
|
-
}
|
|
8364
|
-
if (options.hasOwnProperty('context') && typeof options.context === 'object') {
|
|
8365
|
-
destroyOptions.context = options.context;
|
|
8366
|
-
}
|
|
8332
|
+
const destroyOptions = ParseObject._getRequestOptions(options);
|
|
8367
8333
|
return _CoreManager.default.getObjectController().destroy(list, destroyOptions);
|
|
8368
8334
|
}
|
|
8369
8335
|
|
|
@@ -8382,27 +8348,23 @@ class ParseObject {
|
|
|
8382
8348
|
*
|
|
8383
8349
|
* @param {Array} list A list of <code>Parse.Object</code>.
|
|
8384
8350
|
* @param {object} options
|
|
8351
|
+
* Valid options are:
|
|
8352
|
+
* <ul>
|
|
8353
|
+
* <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
|
|
8354
|
+
* be used for this request.
|
|
8355
|
+
* <li>sessionToken: A valid session token, used for making a request on
|
|
8356
|
+
* behalf of a specific user.
|
|
8357
|
+
* <li>cascadeSave: If `false`, nested objects will not be saved (default is `true`).
|
|
8358
|
+
* <li>context: A dictionary that is accessible in Cloud Code `beforeSave` and `afterSave` triggers.
|
|
8359
|
+
* <li>transaction: Set to true to enable transactions
|
|
8360
|
+
* <li>batchSize: How many objects to yield in each batch (default: 20)
|
|
8361
|
+
* </ul>
|
|
8385
8362
|
* @static
|
|
8386
8363
|
* @returns {Parse.Object[]}
|
|
8387
8364
|
*/
|
|
8388
8365
|
static saveAll(list) {
|
|
8389
8366
|
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
8390
|
-
const saveOptions =
|
|
8391
|
-
if (options.hasOwnProperty('useMasterKey')) {
|
|
8392
|
-
saveOptions.useMasterKey = options.useMasterKey;
|
|
8393
|
-
}
|
|
8394
|
-
if (options.hasOwnProperty('sessionToken')) {
|
|
8395
|
-
saveOptions.sessionToken = options.sessionToken;
|
|
8396
|
-
}
|
|
8397
|
-
if (options.hasOwnProperty('transaction') && typeof options.transaction === 'boolean') {
|
|
8398
|
-
saveOptions.transaction = options.transaction;
|
|
8399
|
-
}
|
|
8400
|
-
if (options.hasOwnProperty('batchSize') && typeof options.batchSize === 'number') {
|
|
8401
|
-
saveOptions.batchSize = options.batchSize;
|
|
8402
|
-
}
|
|
8403
|
-
if (options.hasOwnProperty('context') && typeof options.context === 'object') {
|
|
8404
|
-
saveOptions.context = options.context;
|
|
8405
|
-
}
|
|
8367
|
+
const saveOptions = ParseObject._getRequestOptions(options);
|
|
8406
8368
|
return _CoreManager.default.getObjectController().save(list, saveOptions);
|
|
8407
8369
|
}
|
|
8408
8370
|
|
|
@@ -8559,7 +8521,7 @@ class ParseObject {
|
|
|
8559
8521
|
adjustedClassName = '_User';
|
|
8560
8522
|
}
|
|
8561
8523
|
let parentProto = ParseObject.prototype;
|
|
8562
|
-
if (
|
|
8524
|
+
if (Object.hasOwn(this, '__super__') && this.__super__) {
|
|
8563
8525
|
parentProto = this.prototype;
|
|
8564
8526
|
}
|
|
8565
8527
|
let ParseObjectSubclass = function (attributes, options) {
|
|
@@ -8926,7 +8888,7 @@ const DefaultController = {
|
|
|
8926
8888
|
deleteCompleted = deleteCompleted.then(() => {
|
|
8927
8889
|
return RESTController.request('POST', 'batch', body, options).then(results => {
|
|
8928
8890
|
for (let i = 0; i < results.length; i++) {
|
|
8929
|
-
if (results[i] && results[i]
|
|
8891
|
+
if (results[i] && Object.hasOwn(results[i], 'error')) {
|
|
8930
8892
|
const err = new _ParseError.default(results[i].error.code, results[i].error.error);
|
|
8931
8893
|
err.object = batch[i];
|
|
8932
8894
|
errors.push(err);
|
|
@@ -8997,7 +8959,7 @@ const DefaultController = {
|
|
|
8997
8959
|
const batch = [];
|
|
8998
8960
|
const nextPending = [];
|
|
8999
8961
|
(0, _forEach.default)(pending).call(pending, el => {
|
|
9000
|
-
if (allowCustomObjectId && Object.
|
|
8962
|
+
if (allowCustomObjectId && Object.hasOwn(el, 'id') && !el.id) {
|
|
9001
8963
|
throw new _ParseError.default(_ParseError.default.MISSING_OBJECT_ID, 'objectId must not be empty or null');
|
|
9002
8964
|
}
|
|
9003
8965
|
if (batch.length < batchSize && (0, _canBeSerialized.default)(el)) {
|
|
@@ -9023,7 +8985,7 @@ const DefaultController = {
|
|
|
9023
8985
|
batchTasks.push(stateController.enqueueTask(obj._getStateIdentifier(), function () {
|
|
9024
8986
|
ready.resolve();
|
|
9025
8987
|
return batchReturned.then(responses => {
|
|
9026
|
-
if (responses[index]
|
|
8988
|
+
if (Object.hasOwn(responses[index], 'success')) {
|
|
9027
8989
|
const objectId = responses[index].success.objectId;
|
|
9028
8990
|
const status = responses[index]._status;
|
|
9029
8991
|
delete responses[index]._status;
|
|
@@ -9032,7 +8994,7 @@ const DefaultController = {
|
|
|
9032
8994
|
mapIdForPin[objectId] = obj._localId;
|
|
9033
8995
|
obj._handleSaveResponse(responses[index].success, status);
|
|
9034
8996
|
} else {
|
|
9035
|
-
if (!objectError && responses[index]
|
|
8997
|
+
if (!objectError && Object.hasOwn(responses[index], 'error')) {
|
|
9036
8998
|
const serverError = responses[index].error;
|
|
9037
8999
|
objectError = new _ParseError.default(serverError.code, serverError.error);
|
|
9038
9000
|
// Cancel the rest of the save
|
|
@@ -9076,7 +9038,7 @@ const DefaultController = {
|
|
|
9076
9038
|
});
|
|
9077
9039
|
});
|
|
9078
9040
|
} else if (target instanceof ParseObject) {
|
|
9079
|
-
if (allowCustomObjectId && Object.
|
|
9041
|
+
if (allowCustomObjectId && Object.hasOwn(target, 'id') && !target.id) {
|
|
9080
9042
|
throw new _ParseError.default(_ParseError.default.MISSING_OBJECT_ID, 'objectId must not be empty or null');
|
|
9081
9043
|
}
|
|
9082
9044
|
// generate _localId in case if cascadeSave=false
|
|
@@ -9795,7 +9757,7 @@ function handleSelectResult(data, select) {
|
|
|
9795
9757
|
const serverDataMask = {};
|
|
9796
9758
|
(0, _forEach.default)(select).call(select, field => {
|
|
9797
9759
|
const hasSubObjectSelect = (0, _indexOf.default)(field).call(field, '.') !== -1;
|
|
9798
|
-
if (!hasSubObjectSelect && !
|
|
9760
|
+
if (!hasSubObjectSelect && !Object.hasOwn(data, field)) {
|
|
9799
9761
|
// this field was selected, but is missing from the retrieved data
|
|
9800
9762
|
data[field] = undefined;
|
|
9801
9763
|
} else if (hasSubObjectSelect) {
|
|
@@ -9806,7 +9768,7 @@ function handleSelectResult(data, select) {
|
|
|
9806
9768
|
let serverMask = serverDataMask;
|
|
9807
9769
|
(0, _forEach.default)(pathComponents).call(pathComponents, (component, index, arr) => {
|
|
9808
9770
|
// add keys if the expected data is missing
|
|
9809
|
-
if (obj && !
|
|
9771
|
+
if (obj && !Object.hasOwn(obj, component)) {
|
|
9810
9772
|
obj[component] = undefined;
|
|
9811
9773
|
}
|
|
9812
9774
|
if (obj && typeof obj === 'object') {
|
|
@@ -9840,7 +9802,7 @@ function copyMissingDataWithMask(src, dest, mask, copyThisLevel) {
|
|
|
9840
9802
|
//copy missing elements at this level
|
|
9841
9803
|
if (copyThisLevel) {
|
|
9842
9804
|
for (const key in src) {
|
|
9843
|
-
if (
|
|
9805
|
+
if (Object.hasOwn(src, key) && !Object.hasOwn(dest, key)) {
|
|
9844
9806
|
dest[key] = src[key];
|
|
9845
9807
|
}
|
|
9846
9808
|
}
|
|
@@ -10244,7 +10206,7 @@ class ParseQuery {
|
|
|
10244
10206
|
this._comment = json.comment;
|
|
10245
10207
|
}
|
|
10246
10208
|
for (const key in json) {
|
|
10247
|
-
if (
|
|
10209
|
+
if (Object.hasOwn(json, key)) {
|
|
10248
10210
|
var _context3;
|
|
10249
10211
|
if ((0, _indexOf.default)(_context3 = ['where', 'include', 'keys', 'count', 'limit', 'skip', 'order', 'readPreference', 'includeReadPreference', 'subqueryReadPreference', 'hint', 'explain', 'comment']).call(_context3, key) === -1) {
|
|
10250
10212
|
this._extraOptions[key] = json[key];
|
|
@@ -10286,19 +10248,7 @@ class ParseQuery {
|
|
|
10286
10248
|
*/
|
|
10287
10249
|
get(objectId, options) {
|
|
10288
10250
|
this.equalTo('objectId', objectId);
|
|
10289
|
-
const firstOptions =
|
|
10290
|
-
if (options && options.hasOwnProperty('useMasterKey')) {
|
|
10291
|
-
firstOptions.useMasterKey = options.useMasterKey;
|
|
10292
|
-
}
|
|
10293
|
-
if (options && options.hasOwnProperty('sessionToken')) {
|
|
10294
|
-
firstOptions.sessionToken = options.sessionToken;
|
|
10295
|
-
}
|
|
10296
|
-
if (options && options.hasOwnProperty('context') && typeof options.context === 'object') {
|
|
10297
|
-
firstOptions.context = options.context;
|
|
10298
|
-
}
|
|
10299
|
-
if (options && options.hasOwnProperty('json')) {
|
|
10300
|
-
firstOptions.json = options.json;
|
|
10301
|
-
}
|
|
10251
|
+
const firstOptions = _ParseObject.default._getRequestOptions(options);
|
|
10302
10252
|
return this.first(firstOptions).then(response => {
|
|
10303
10253
|
if (response) {
|
|
10304
10254
|
return response;
|
|
@@ -10324,17 +10274,7 @@ class ParseQuery {
|
|
|
10324
10274
|
* the query completes.
|
|
10325
10275
|
*/
|
|
10326
10276
|
find(options) {
|
|
10327
|
-
|
|
10328
|
-
const findOptions = {};
|
|
10329
|
-
if (options.hasOwnProperty('useMasterKey')) {
|
|
10330
|
-
findOptions.useMasterKey = options.useMasterKey;
|
|
10331
|
-
}
|
|
10332
|
-
if (options.hasOwnProperty('sessionToken')) {
|
|
10333
|
-
findOptions.sessionToken = options.sessionToken;
|
|
10334
|
-
}
|
|
10335
|
-
if (options.hasOwnProperty('context') && typeof options.context === 'object') {
|
|
10336
|
-
findOptions.context = options.context;
|
|
10337
|
-
}
|
|
10277
|
+
const findOptions = _ParseObject.default._getRequestOptions(options);
|
|
10338
10278
|
this._setRequestTask(findOptions);
|
|
10339
10279
|
const controller = _CoreManager.default.getQueryController();
|
|
10340
10280
|
const select = this._select;
|
|
@@ -10360,7 +10300,7 @@ class ParseQuery {
|
|
|
10360
10300
|
if (select) {
|
|
10361
10301
|
handleSelectResult(data, select);
|
|
10362
10302
|
}
|
|
10363
|
-
if (
|
|
10303
|
+
if (findOptions.json) {
|
|
10364
10304
|
return data;
|
|
10365
10305
|
} else {
|
|
10366
10306
|
return _ParseObject.default.fromJSON(data, !select);
|
|
@@ -10388,6 +10328,7 @@ class ParseQuery {
|
|
|
10388
10328
|
* be used for this request.
|
|
10389
10329
|
* <li>sessionToken: A valid session token, used for making a request on
|
|
10390
10330
|
* behalf of a specific user.
|
|
10331
|
+
* <li>json: Return raw JSON without converting to Parse.Object.
|
|
10391
10332
|
* </ul>
|
|
10392
10333
|
* @returns {Promise} A promise that is resolved with the results when
|
|
10393
10334
|
* the query completes.
|
|
@@ -10417,13 +10358,7 @@ class ParseQuery {
|
|
|
10417
10358
|
*/
|
|
10418
10359
|
count(options) {
|
|
10419
10360
|
options = options || {};
|
|
10420
|
-
const findOptions =
|
|
10421
|
-
if (options.hasOwnProperty('useMasterKey')) {
|
|
10422
|
-
findOptions.useMasterKey = options.useMasterKey;
|
|
10423
|
-
}
|
|
10424
|
-
if (options.hasOwnProperty('sessionToken')) {
|
|
10425
|
-
findOptions.sessionToken = options.sessionToken;
|
|
10426
|
-
}
|
|
10361
|
+
const findOptions = _ParseObject.default._getRequestOptions(options);
|
|
10427
10362
|
this._setRequestTask(findOptions);
|
|
10428
10363
|
const controller = _CoreManager.default.getQueryController();
|
|
10429
10364
|
const params = this.toJSON();
|
|
@@ -10447,7 +10382,7 @@ class ParseQuery {
|
|
|
10447
10382
|
const distinctOptions = {
|
|
10448
10383
|
useMasterKey: true
|
|
10449
10384
|
};
|
|
10450
|
-
if (
|
|
10385
|
+
if (Object.hasOwn(options, 'sessionToken')) {
|
|
10451
10386
|
distinctOptions.sessionToken = options.sessionToken;
|
|
10452
10387
|
}
|
|
10453
10388
|
this._setRequestTask(distinctOptions);
|
|
@@ -10475,7 +10410,7 @@ class ParseQuery {
|
|
|
10475
10410
|
const aggregateOptions = {
|
|
10476
10411
|
useMasterKey: true
|
|
10477
10412
|
};
|
|
10478
|
-
if (
|
|
10413
|
+
if (Object.hasOwn(options, 'sessionToken')) {
|
|
10479
10414
|
aggregateOptions.sessionToken = options.sessionToken;
|
|
10480
10415
|
}
|
|
10481
10416
|
this._setRequestTask(aggregateOptions);
|
|
@@ -10520,16 +10455,7 @@ class ParseQuery {
|
|
|
10520
10455
|
*/
|
|
10521
10456
|
first() {
|
|
10522
10457
|
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
10523
|
-
const findOptions =
|
|
10524
|
-
if (options.hasOwnProperty('useMasterKey')) {
|
|
10525
|
-
findOptions.useMasterKey = options.useMasterKey;
|
|
10526
|
-
}
|
|
10527
|
-
if (options.hasOwnProperty('sessionToken')) {
|
|
10528
|
-
findOptions.sessionToken = options.sessionToken;
|
|
10529
|
-
}
|
|
10530
|
-
if (options.hasOwnProperty('context') && typeof options.context === 'object') {
|
|
10531
|
-
findOptions.context = options.context;
|
|
10532
|
-
}
|
|
10458
|
+
const findOptions = _ParseObject.default._getRequestOptions(options);
|
|
10533
10459
|
this._setRequestTask(findOptions);
|
|
10534
10460
|
const controller = _CoreManager.default.getQueryController();
|
|
10535
10461
|
const params = this.toJSON();
|
|
@@ -10558,7 +10484,7 @@ class ParseQuery {
|
|
|
10558
10484
|
if (select) {
|
|
10559
10485
|
handleSelectResult(objects[0], select);
|
|
10560
10486
|
}
|
|
10561
|
-
if (
|
|
10487
|
+
if (findOptions.json) {
|
|
10562
10488
|
return objects[0];
|
|
10563
10489
|
} else {
|
|
10564
10490
|
return _ParseObject.default.fromJSON(objects[0], !select);
|
|
@@ -10592,45 +10518,10 @@ class ParseQuery {
|
|
|
10592
10518
|
if (this._order || this._skip || this._limit >= 0) {
|
|
10593
10519
|
return _promise.default.reject('Cannot iterate on a query with sort, skip, or limit.');
|
|
10594
10520
|
}
|
|
10595
|
-
const query =
|
|
10596
|
-
query._limit = options.batchSize || 100;
|
|
10597
|
-
query._include = [...this._include];
|
|
10598
|
-
query._exclude = [...this._exclude];
|
|
10599
|
-
if (this._select) {
|
|
10600
|
-
query._select = [...this._select];
|
|
10601
|
-
}
|
|
10602
|
-
query._hint = this._hint;
|
|
10603
|
-
query._where = {};
|
|
10604
|
-
for (const attr in this._where) {
|
|
10605
|
-
const val = this._where[attr];
|
|
10606
|
-
if ((0, _isArray.default)(val)) {
|
|
10607
|
-
query._where[attr] = (0, _map.default)(val).call(val, v => {
|
|
10608
|
-
return v;
|
|
10609
|
-
});
|
|
10610
|
-
} else if (val && typeof val === 'object') {
|
|
10611
|
-
const conditionMap = {};
|
|
10612
|
-
query._where[attr] = conditionMap;
|
|
10613
|
-
for (const cond in val) {
|
|
10614
|
-
conditionMap[cond] = val[cond];
|
|
10615
|
-
}
|
|
10616
|
-
} else {
|
|
10617
|
-
query._where[attr] = val;
|
|
10618
|
-
}
|
|
10619
|
-
}
|
|
10521
|
+
const query = ParseQuery.fromJSON(this.className, this.toJSON());
|
|
10620
10522
|
query.ascending('objectId');
|
|
10621
|
-
|
|
10622
|
-
|
|
10623
|
-
findOptions.useMasterKey = options.useMasterKey;
|
|
10624
|
-
}
|
|
10625
|
-
if (options.hasOwnProperty('sessionToken')) {
|
|
10626
|
-
findOptions.sessionToken = options.sessionToken;
|
|
10627
|
-
}
|
|
10628
|
-
if (options.hasOwnProperty('context') && typeof options.context === 'object') {
|
|
10629
|
-
findOptions.context = options.context;
|
|
10630
|
-
}
|
|
10631
|
-
if (options.hasOwnProperty('json')) {
|
|
10632
|
-
findOptions.json = options.json;
|
|
10633
|
-
}
|
|
10523
|
+
query._limit = options.batchSize || 100;
|
|
10524
|
+
const findOptions = _ParseObject.default._getRequestOptions(options);
|
|
10634
10525
|
let finished = false;
|
|
10635
10526
|
let previousResults = [];
|
|
10636
10527
|
return (0, _promiseUtils.continueWhile)(() => {
|
|
@@ -10638,7 +10529,11 @@ class ParseQuery {
|
|
|
10638
10529
|
}, async () => {
|
|
10639
10530
|
const [results] = await _promise.default.all([(0, _find.default)(query).call(query, findOptions), _promise.default.resolve(previousResults.length > 0 && callback(previousResults))]);
|
|
10640
10531
|
if (results.length >= query._limit) {
|
|
10641
|
-
|
|
10532
|
+
if (findOptions.json) {
|
|
10533
|
+
query.greaterThan('objectId', results[results.length - 1].objectId);
|
|
10534
|
+
} else {
|
|
10535
|
+
query.greaterThan('objectId', results[results.length - 1].id);
|
|
10536
|
+
}
|
|
10642
10537
|
previousResults = results;
|
|
10643
10538
|
} else if (results.length > 0) {
|
|
10644
10539
|
await _promise.default.resolve(callback(results));
|
|
@@ -12630,12 +12525,8 @@ class ParseSession extends _ParseObject.default {
|
|
|
12630
12525
|
* promise will be rejected.
|
|
12631
12526
|
*/
|
|
12632
12527
|
static current(options) {
|
|
12633
|
-
options = options || {};
|
|
12634
12528
|
const controller = _CoreManager.default.getSessionController();
|
|
12635
|
-
const sessionOptions =
|
|
12636
|
-
if (options.hasOwnProperty('useMasterKey')) {
|
|
12637
|
-
sessionOptions.useMasterKey = options.useMasterKey;
|
|
12638
|
-
}
|
|
12529
|
+
const sessionOptions = _ParseObject.default._getRequestOptions(options);
|
|
12639
12530
|
return _ParseUser.default.currentAsync().then(user => {
|
|
12640
12531
|
if (!user) {
|
|
12641
12532
|
return _promise.default.reject('There is no current user.');
|
|
@@ -12727,15 +12618,15 @@ class ParseUser extends _ParseObject.default {
|
|
|
12727
12618
|
* Request a revocable session token to replace the older style of token.
|
|
12728
12619
|
*
|
|
12729
12620
|
* @param {object} options
|
|
12621
|
+
* Valid options are:<ul>
|
|
12622
|
+
* <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
|
|
12623
|
+
* be used for this request.
|
|
12624
|
+
* </ul>
|
|
12730
12625
|
* @returns {Promise} A promise that is resolved when the replacement
|
|
12731
12626
|
* token has been fetched.
|
|
12732
12627
|
*/
|
|
12733
12628
|
_upgradeToRevocableSession(options) {
|
|
12734
|
-
|
|
12735
|
-
const upgradeOptions = {};
|
|
12736
|
-
if (options.hasOwnProperty('useMasterKey')) {
|
|
12737
|
-
upgradeOptions.useMasterKey = options.useMasterKey;
|
|
12738
|
-
}
|
|
12629
|
+
const upgradeOptions = _ParseObject.default._getRequestOptions(options);
|
|
12739
12630
|
const controller = _CoreManager.default.getUserController();
|
|
12740
12631
|
return controller.upgradeToRevocableSession(this, upgradeOptions);
|
|
12741
12632
|
}
|
|
@@ -12779,7 +12670,7 @@ class ParseUser extends _ParseObject.default {
|
|
|
12779
12670
|
} else {
|
|
12780
12671
|
authType = provider.getAuthType();
|
|
12781
12672
|
}
|
|
12782
|
-
if (options &&
|
|
12673
|
+
if (options && Object.hasOwn(options, 'authData')) {
|
|
12783
12674
|
const authData = this.get('authData') || {};
|
|
12784
12675
|
if (typeof authData !== 'object') {
|
|
12785
12676
|
throw new Error('Invalid type: authData field should be an object');
|
|
@@ -12985,7 +12876,7 @@ class ParseUser extends _ParseObject.default {
|
|
|
12985
12876
|
}
|
|
12986
12877
|
stripAnonymity() {
|
|
12987
12878
|
const authData = this.get('authData');
|
|
12988
|
-
if (authData && typeof authData === 'object' &&
|
|
12879
|
+
if (authData && typeof authData === 'object' && Object.hasOwn(authData, 'anonymous')) {
|
|
12989
12880
|
// We need to set anonymous to null instead of deleting it in order to remove it from Parse.
|
|
12990
12881
|
authData.anonymous = null;
|
|
12991
12882
|
}
|
|
@@ -13087,21 +12978,17 @@ class ParseUser extends _ParseObject.default {
|
|
|
13087
12978
|
*
|
|
13088
12979
|
* @param {object} attrs Extra fields to set on the new user, or null.
|
|
13089
12980
|
* @param {object} options
|
|
12981
|
+
* Valid options are:<ul>
|
|
12982
|
+
* <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
|
|
12983
|
+
* be used for this request.
|
|
12984
|
+
* <li>installationId: the installationId which made the request
|
|
12985
|
+
* <li>context: A dictionary that is accessible in Cloud Code `beforeLogin` and `afterLogin` triggers.
|
|
12986
|
+
* </ul>
|
|
13090
12987
|
* @returns {Promise} A promise that is fulfilled when the signup
|
|
13091
12988
|
* finishes.
|
|
13092
12989
|
*/
|
|
13093
12990
|
signUp(attrs, options) {
|
|
13094
|
-
|
|
13095
|
-
const signupOptions = {};
|
|
13096
|
-
if (options.hasOwnProperty('useMasterKey')) {
|
|
13097
|
-
signupOptions.useMasterKey = options.useMasterKey;
|
|
13098
|
-
}
|
|
13099
|
-
if (options.hasOwnProperty('installationId')) {
|
|
13100
|
-
signupOptions.installationId = options.installationId;
|
|
13101
|
-
}
|
|
13102
|
-
if (options.hasOwnProperty('context') && Object.prototype.toString.call(options.context) === '[object Object]') {
|
|
13103
|
-
signupOptions.context = options.context;
|
|
13104
|
-
}
|
|
12991
|
+
const signupOptions = _ParseObject.default._getRequestOptions(options);
|
|
13105
12992
|
const controller = _CoreManager.default.getUserController();
|
|
13106
12993
|
return controller.signUp(this, attrs, signupOptions);
|
|
13107
12994
|
}
|
|
@@ -13114,26 +13001,21 @@ class ParseUser extends _ParseObject.default {
|
|
|
13114
13001
|
* <p>A username and password must be set before calling logIn.</p>
|
|
13115
13002
|
*
|
|
13116
13003
|
* @param {object} options
|
|
13004
|
+
* Valid options are:<ul>
|
|
13005
|
+
* <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
|
|
13006
|
+
* be used for this request.
|
|
13007
|
+
* <li>usePost: Use POST method to make the request (default: true)
|
|
13008
|
+
* <li>installationId: the installationId which made the request
|
|
13009
|
+
* <li>context: A dictionary that is accessible in Cloud Code `beforeLogin` and `afterLogin` triggers.
|
|
13010
|
+
* </ul>
|
|
13117
13011
|
* @returns {Promise} A promise that is fulfilled with the user when
|
|
13118
13012
|
* the login is complete.
|
|
13119
13013
|
*/
|
|
13120
13014
|
logIn() {
|
|
13121
13015
|
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
13122
|
-
|
|
13123
|
-
|
|
13124
|
-
usePost
|
|
13125
|
-
};
|
|
13126
|
-
if (options.hasOwnProperty('useMasterKey')) {
|
|
13127
|
-
loginOptions.useMasterKey = options.useMasterKey;
|
|
13128
|
-
}
|
|
13129
|
-
if (options.hasOwnProperty('installationId')) {
|
|
13130
|
-
loginOptions.installationId = options.installationId;
|
|
13131
|
-
}
|
|
13132
|
-
if (options.hasOwnProperty('usePost')) {
|
|
13133
|
-
loginOptions.usePost = options.usePost;
|
|
13134
|
-
}
|
|
13135
|
-
if (options.hasOwnProperty('context') && Object.prototype.toString.call(options.context) === '[object Object]') {
|
|
13136
|
-
loginOptions.context = options.context;
|
|
13016
|
+
const loginOptions = _ParseObject.default._getRequestOptions(options);
|
|
13017
|
+
if (!Object.hasOwn(loginOptions, 'usePost')) {
|
|
13018
|
+
loginOptions.usePost = true;
|
|
13137
13019
|
}
|
|
13138
13020
|
const controller = _CoreManager.default.getUserController();
|
|
13139
13021
|
return controller.logIn(this, loginOptions);
|
|
@@ -13404,6 +13286,7 @@ class ParseUser extends _ParseObject.default {
|
|
|
13404
13286
|
*
|
|
13405
13287
|
* @param {string} sessionToken The sessionToken to log in with.
|
|
13406
13288
|
* @param {object} options
|
|
13289
|
+
* @param {boolean} [options.useMasterKey]
|
|
13407
13290
|
* @static
|
|
13408
13291
|
* @returns {Promise} A promise that is fulfilled with the user when
|
|
13409
13292
|
* the login completes.
|
|
@@ -13412,13 +13295,8 @@ class ParseUser extends _ParseObject.default {
|
|
|
13412
13295
|
if (!canUseCurrentUser) {
|
|
13413
13296
|
throw new Error('It is not memory-safe to become a user in a server environment');
|
|
13414
13297
|
}
|
|
13415
|
-
|
|
13416
|
-
|
|
13417
|
-
sessionToken: sessionToken
|
|
13418
|
-
};
|
|
13419
|
-
if (options.hasOwnProperty('useMasterKey')) {
|
|
13420
|
-
becomeOptions.useMasterKey = options.useMasterKey;
|
|
13421
|
-
}
|
|
13298
|
+
const becomeOptions = _ParseObject.default._getRequestOptions(options);
|
|
13299
|
+
becomeOptions.sessionToken = sessionToken;
|
|
13422
13300
|
const controller = _CoreManager.default.getUserController();
|
|
13423
13301
|
const user = new this();
|
|
13424
13302
|
return controller.become(user, becomeOptions);
|
|
@@ -13429,18 +13307,15 @@ class ParseUser extends _ParseObject.default {
|
|
|
13429
13307
|
*
|
|
13430
13308
|
* @param {string} sessionToken The sessionToken to get user with.
|
|
13431
13309
|
* @param {object} options
|
|
13310
|
+
* @param {boolean} [options.useMasterKey]
|
|
13432
13311
|
* @static
|
|
13433
13312
|
* @returns {Promise} A promise that is fulfilled with the user is fetched.
|
|
13434
13313
|
*/
|
|
13435
13314
|
static me(sessionToken) {
|
|
13436
13315
|
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
13437
13316
|
const controller = _CoreManager.default.getUserController();
|
|
13438
|
-
const meOptions =
|
|
13439
|
-
|
|
13440
|
-
};
|
|
13441
|
-
if (options.useMasterKey) {
|
|
13442
|
-
meOptions.useMasterKey = options.useMasterKey;
|
|
13443
|
-
}
|
|
13317
|
+
const meOptions = _ParseObject.default._getRequestOptions(options);
|
|
13318
|
+
meOptions.sessionToken = sessionToken;
|
|
13444
13319
|
const user = new this();
|
|
13445
13320
|
return controller.me(user, meOptions);
|
|
13446
13321
|
}
|
|
@@ -13500,15 +13375,15 @@ class ParseUser extends _ParseObject.default {
|
|
|
13500
13375
|
* @param {string} email The email address associated with the user that
|
|
13501
13376
|
* forgot their password.
|
|
13502
13377
|
* @param {object} options
|
|
13378
|
+
* Valid options are:<ul>
|
|
13379
|
+
* <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
|
|
13380
|
+
* be used for this request.
|
|
13381
|
+
* </ul>
|
|
13503
13382
|
* @static
|
|
13504
13383
|
* @returns {Promise}
|
|
13505
13384
|
*/
|
|
13506
13385
|
static requestPasswordReset(email, options) {
|
|
13507
|
-
|
|
13508
|
-
const requestOptions = {};
|
|
13509
|
-
if (options.hasOwnProperty('useMasterKey')) {
|
|
13510
|
-
requestOptions.useMasterKey = options.useMasterKey;
|
|
13511
|
-
}
|
|
13386
|
+
const requestOptions = _ParseObject.default._getRequestOptions(options);
|
|
13512
13387
|
const controller = _CoreManager.default.getUserController();
|
|
13513
13388
|
return controller.requestPasswordReset(email, requestOptions);
|
|
13514
13389
|
}
|
|
@@ -13519,15 +13394,15 @@ class ParseUser extends _ParseObject.default {
|
|
|
13519
13394
|
* @param {string} email The email address associated with the user that
|
|
13520
13395
|
* needs to verify their email.
|
|
13521
13396
|
* @param {object} options
|
|
13397
|
+
* Valid options are:<ul>
|
|
13398
|
+
* <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
|
|
13399
|
+
* be used for this request.
|
|
13400
|
+
* </ul>
|
|
13522
13401
|
* @static
|
|
13523
13402
|
* @returns {Promise}
|
|
13524
13403
|
*/
|
|
13525
13404
|
static requestEmailVerification(email, options) {
|
|
13526
|
-
|
|
13527
|
-
const requestOptions = {};
|
|
13528
|
-
if (options.hasOwnProperty('useMasterKey')) {
|
|
13529
|
-
requestOptions.useMasterKey = options.useMasterKey;
|
|
13530
|
-
}
|
|
13405
|
+
const requestOptions = _ParseObject.default._getRequestOptions(options);
|
|
13531
13406
|
const controller = _CoreManager.default.getUserController();
|
|
13532
13407
|
return controller.requestEmailVerification(email, requestOptions);
|
|
13533
13408
|
}
|
|
@@ -13992,7 +13867,7 @@ function send(data) {
|
|
|
13992
13867
|
const pushOptions = {
|
|
13993
13868
|
useMasterKey: true
|
|
13994
13869
|
};
|
|
13995
|
-
if (
|
|
13870
|
+
if (Object.hasOwn(options, 'useMasterKey')) {
|
|
13996
13871
|
pushOptions.useMasterKey = options.useMasterKey;
|
|
13997
13872
|
}
|
|
13998
13873
|
return _CoreManager.default.getPushController().send(data, pushOptions);
|
|
@@ -14016,7 +13891,7 @@ function getPushStatus(pushStatusId) {
|
|
|
14016
13891
|
const pushOptions = {
|
|
14017
13892
|
useMasterKey: true
|
|
14018
13893
|
};
|
|
14019
|
-
if (
|
|
13894
|
+
if (Object.hasOwn(options, 'useMasterKey')) {
|
|
14020
13895
|
pushOptions.useMasterKey = options.useMasterKey;
|
|
14021
13896
|
}
|
|
14022
13897
|
const query = new _ParseQuery.default('_PushStatus');
|
|
@@ -14639,7 +14514,7 @@ const Storage = {
|
|
|
14639
14514
|
},
|
|
14640
14515
|
_clear() {
|
|
14641
14516
|
const controller = _CoreManager.default.getStorageController();
|
|
14642
|
-
if (
|
|
14517
|
+
if (Object.hasOwn(controller, 'clear')) {
|
|
14643
14518
|
controller.clear();
|
|
14644
14519
|
}
|
|
14645
14520
|
}
|
|
@@ -14700,7 +14575,7 @@ const memMap = {};
|
|
|
14700
14575
|
const StorageController = {
|
|
14701
14576
|
async: 0,
|
|
14702
14577
|
getItem(path) {
|
|
14703
|
-
if (
|
|
14578
|
+
if (Object.hasOwn(memMap, path)) {
|
|
14704
14579
|
return memMap[path];
|
|
14705
14580
|
}
|
|
14706
14581
|
return null;
|
|
@@ -14716,7 +14591,7 @@ const StorageController = {
|
|
|
14716
14591
|
},
|
|
14717
14592
|
clear() {
|
|
14718
14593
|
for (const key in memMap) {
|
|
14719
|
-
if (
|
|
14594
|
+
if (Object.hasOwn(memMap, key)) {
|
|
14720
14595
|
delete memMap[key];
|
|
14721
14596
|
}
|
|
14722
14597
|
}
|