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/dist/parse.weapp.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.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];
|
|
@@ -5636,7 +5632,7 @@ class ParseFile {
|
|
|
5636
5632
|
const destroyOptions = {
|
|
5637
5633
|
useMasterKey: true
|
|
5638
5634
|
};
|
|
5639
|
-
if (
|
|
5635
|
+
if (Object.hasOwn(options, 'useMasterKey')) {
|
|
5640
5636
|
destroyOptions.useMasterKey = !!options.useMasterKey;
|
|
5641
5637
|
}
|
|
5642
5638
|
const controller = _CoreManager.default.getFileController();
|
|
@@ -6645,9 +6641,9 @@ var _stringify = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-
|
|
|
6645
6641
|
var _includes = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/includes"));
|
|
6646
6642
|
var _getPrototypeOf = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/object/get-prototype-of"));
|
|
6647
6643
|
var _concat = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/concat"));
|
|
6648
|
-
var _isArray = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/array/is-array"));
|
|
6649
6644
|
var _promise = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/promise"));
|
|
6650
6645
|
var _some = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/some"));
|
|
6646
|
+
var _isArray = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/array/is-array"));
|
|
6651
6647
|
var _create = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/object/create"));
|
|
6652
6648
|
var _defineProperty3 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property"));
|
|
6653
6649
|
var _find = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/find"));
|
|
@@ -7055,6 +7051,41 @@ class ParseObject {
|
|
|
7055
7051
|
static _getClassMap() {
|
|
7056
7052
|
return classMap;
|
|
7057
7053
|
}
|
|
7054
|
+
static _getRequestOptions() {
|
|
7055
|
+
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
7056
|
+
const requestOptions = {};
|
|
7057
|
+
const {
|
|
7058
|
+
hasOwn
|
|
7059
|
+
} = Object;
|
|
7060
|
+
if (hasOwn(options, 'useMasterKey')) {
|
|
7061
|
+
requestOptions.useMasterKey = !!options.useMasterKey;
|
|
7062
|
+
}
|
|
7063
|
+
if (hasOwn(options, 'sessionToken') && typeof options.sessionToken === 'string') {
|
|
7064
|
+
requestOptions.sessionToken = options.sessionToken;
|
|
7065
|
+
}
|
|
7066
|
+
if (hasOwn(options, 'installationId') && typeof options.installationId === 'string') {
|
|
7067
|
+
requestOptions.installationId = options.installationId;
|
|
7068
|
+
}
|
|
7069
|
+
if (hasOwn(options, 'transaction') && typeof options.transaction === 'boolean') {
|
|
7070
|
+
requestOptions.transaction = options.transaction;
|
|
7071
|
+
}
|
|
7072
|
+
if (hasOwn(options, 'batchSize') && typeof options.batchSize === 'number') {
|
|
7073
|
+
requestOptions.batchSize = options.batchSize;
|
|
7074
|
+
}
|
|
7075
|
+
if (hasOwn(options, 'context') && typeof options.context === 'object') {
|
|
7076
|
+
requestOptions.context = options.context;
|
|
7077
|
+
}
|
|
7078
|
+
if (hasOwn(options, 'include')) {
|
|
7079
|
+
requestOptions.include = ParseObject.handleIncludeOptions(options);
|
|
7080
|
+
}
|
|
7081
|
+
if (hasOwn(options, 'usePost')) {
|
|
7082
|
+
requestOptions.usePost = options.usePost;
|
|
7083
|
+
}
|
|
7084
|
+
if (hasOwn(options, 'json')) {
|
|
7085
|
+
requestOptions.json = options.json;
|
|
7086
|
+
}
|
|
7087
|
+
return requestOptions;
|
|
7088
|
+
}
|
|
7058
7089
|
|
|
7059
7090
|
/* Public methods */
|
|
7060
7091
|
|
|
@@ -7121,11 +7152,11 @@ class ParseObject {
|
|
|
7121
7152
|
const pendingOps = this._getPendingOps();
|
|
7122
7153
|
const dirtyObjects = this._getDirtyObjectAttributes();
|
|
7123
7154
|
if (attr) {
|
|
7124
|
-
if (
|
|
7155
|
+
if (Object.hasOwn(dirtyObjects, attr)) {
|
|
7125
7156
|
return true;
|
|
7126
7157
|
}
|
|
7127
7158
|
for (let i = 0; i < pendingOps.length; i++) {
|
|
7128
|
-
if (pendingOps[i]
|
|
7159
|
+
if (Object.hasOwn(pendingOps[i], attr)) {
|
|
7129
7160
|
return true;
|
|
7130
7161
|
}
|
|
7131
7162
|
}
|
|
@@ -7259,7 +7290,7 @@ class ParseObject {
|
|
|
7259
7290
|
*/
|
|
7260
7291
|
has(attr) {
|
|
7261
7292
|
const attributes = this.attributes;
|
|
7262
|
-
if (
|
|
7293
|
+
if (Object.hasOwn(attributes, attr)) {
|
|
7263
7294
|
return attributes[attr] != null;
|
|
7264
7295
|
}
|
|
7265
7296
|
return false;
|
|
@@ -7638,7 +7669,7 @@ class ParseObject {
|
|
|
7638
7669
|
* @see Parse.Object#set
|
|
7639
7670
|
*/
|
|
7640
7671
|
validate(attrs) {
|
|
7641
|
-
if (
|
|
7672
|
+
if (Object.hasOwn(attrs, 'ACL') && !(attrs.ACL instanceof _ParseACL.default)) {
|
|
7642
7673
|
return new _ParseError.default(_ParseError.default.OTHER_CAUSE, 'ACL must be a Parse ACL.');
|
|
7643
7674
|
}
|
|
7644
7675
|
for (const key in attrs) {
|
|
@@ -7738,33 +7769,7 @@ class ParseObject {
|
|
|
7738
7769
|
* completes.
|
|
7739
7770
|
*/
|
|
7740
7771
|
fetch(options) {
|
|
7741
|
-
|
|
7742
|
-
const fetchOptions = {};
|
|
7743
|
-
if (options.hasOwnProperty('useMasterKey')) {
|
|
7744
|
-
fetchOptions.useMasterKey = options.useMasterKey;
|
|
7745
|
-
}
|
|
7746
|
-
if (options.hasOwnProperty('sessionToken')) {
|
|
7747
|
-
fetchOptions.sessionToken = options.sessionToken;
|
|
7748
|
-
}
|
|
7749
|
-
if (options.hasOwnProperty('context') && typeof options.context === 'object') {
|
|
7750
|
-
fetchOptions.context = options.context;
|
|
7751
|
-
}
|
|
7752
|
-
if (options.hasOwnProperty('include')) {
|
|
7753
|
-
fetchOptions.include = [];
|
|
7754
|
-
if ((0, _isArray.default)(options.include)) {
|
|
7755
|
-
var _context;
|
|
7756
|
-
(0, _forEach.default)(_context = options.include).call(_context, key => {
|
|
7757
|
-
if ((0, _isArray.default)(key)) {
|
|
7758
|
-
var _context2;
|
|
7759
|
-
fetchOptions.include = (0, _concat.default)(_context2 = fetchOptions.include).call(_context2, key);
|
|
7760
|
-
} else {
|
|
7761
|
-
fetchOptions.include.push(key);
|
|
7762
|
-
}
|
|
7763
|
-
});
|
|
7764
|
-
} else {
|
|
7765
|
-
fetchOptions.include.push(options.include);
|
|
7766
|
-
}
|
|
7767
|
-
}
|
|
7772
|
+
const fetchOptions = ParseObject._getRequestOptions(options);
|
|
7768
7773
|
const controller = _CoreManager.default.getObjectController();
|
|
7769
7774
|
return controller.fetch(this, true, fetchOptions);
|
|
7770
7775
|
}
|
|
@@ -7916,23 +7921,10 @@ class ParseObject {
|
|
|
7916
7921
|
return _promise.default.reject(validationError);
|
|
7917
7922
|
}
|
|
7918
7923
|
}
|
|
7919
|
-
const saveOptions =
|
|
7920
|
-
if (options.hasOwnProperty('useMasterKey')) {
|
|
7921
|
-
saveOptions.useMasterKey = !!options.useMasterKey;
|
|
7922
|
-
}
|
|
7923
|
-
if (options.hasOwnProperty('sessionToken') && typeof options.sessionToken === 'string') {
|
|
7924
|
-
saveOptions.sessionToken = options.sessionToken;
|
|
7925
|
-
}
|
|
7926
|
-
if (options.hasOwnProperty('installationId') && typeof options.installationId === 'string') {
|
|
7927
|
-
saveOptions.installationId = options.installationId;
|
|
7928
|
-
}
|
|
7929
|
-
if (options.hasOwnProperty('context') && typeof options.context === 'object') {
|
|
7930
|
-
saveOptions.context = options.context;
|
|
7931
|
-
}
|
|
7924
|
+
const saveOptions = ParseObject._getRequestOptions(options);
|
|
7932
7925
|
const controller = _CoreManager.default.getObjectController();
|
|
7933
7926
|
const unsaved = options.cascadeSave !== false ? (0, _unsavedChildren.default)(this) : null;
|
|
7934
7927
|
if (unsaved && unsaved.length && options.transaction === true && (0, _some.default)(unsaved).call(unsaved, el => el instanceof ParseObject)) {
|
|
7935
|
-
saveOptions.transaction = options.transaction;
|
|
7936
7928
|
const unsavedFiles = [];
|
|
7937
7929
|
const unsavedObjects = [];
|
|
7938
7930
|
(0, _forEach.default)(unsaved).call(unsaved, el => {
|
|
@@ -7996,20 +7988,10 @@ class ParseObject {
|
|
|
7996
7988
|
* completes.
|
|
7997
7989
|
*/
|
|
7998
7990
|
destroy(options) {
|
|
7999
|
-
options = options || {};
|
|
8000
|
-
const destroyOptions = {};
|
|
8001
|
-
if (options.hasOwnProperty('useMasterKey')) {
|
|
8002
|
-
destroyOptions.useMasterKey = options.useMasterKey;
|
|
8003
|
-
}
|
|
8004
|
-
if (options.hasOwnProperty('sessionToken')) {
|
|
8005
|
-
destroyOptions.sessionToken = options.sessionToken;
|
|
8006
|
-
}
|
|
8007
|
-
if (options.hasOwnProperty('context') && typeof options.context === 'object') {
|
|
8008
|
-
destroyOptions.context = options.context;
|
|
8009
|
-
}
|
|
8010
7991
|
if (!this.id) {
|
|
8011
7992
|
return _promise.default.resolve();
|
|
8012
7993
|
}
|
|
7994
|
+
const destroyOptions = ParseObject._getRequestOptions(options);
|
|
8013
7995
|
return _CoreManager.default.getObjectController().destroy(this, destroyOptions);
|
|
8014
7996
|
}
|
|
8015
7997
|
|
|
@@ -8162,17 +8144,8 @@ class ParseObject {
|
|
|
8162
8144
|
*/
|
|
8163
8145
|
static fetchAll(list) {
|
|
8164
8146
|
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
8165
|
-
const
|
|
8166
|
-
|
|
8167
|
-
queryOptions.useMasterKey = options.useMasterKey;
|
|
8168
|
-
}
|
|
8169
|
-
if (options.hasOwnProperty('sessionToken')) {
|
|
8170
|
-
queryOptions.sessionToken = options.sessionToken;
|
|
8171
|
-
}
|
|
8172
|
-
if (options.hasOwnProperty('include')) {
|
|
8173
|
-
queryOptions.include = ParseObject.handleIncludeOptions(options);
|
|
8174
|
-
}
|
|
8175
|
-
return _CoreManager.default.getObjectController().fetch(list, true, queryOptions);
|
|
8147
|
+
const fetchOptions = ParseObject._getRequestOptions(options);
|
|
8148
|
+
return _CoreManager.default.getObjectController().fetch(list, true, fetchOptions);
|
|
8176
8149
|
}
|
|
8177
8150
|
|
|
8178
8151
|
/**
|
|
@@ -8261,28 +8234,27 @@ class ParseObject {
|
|
|
8261
8234
|
*
|
|
8262
8235
|
* @param {Array} list A list of <code>Parse.Object</code>.
|
|
8263
8236
|
* @param {object} options
|
|
8237
|
+
* Valid options are:<ul>
|
|
8238
|
+
* <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
|
|
8239
|
+
* be used for this request.
|
|
8240
|
+
* <li>sessionToken: A valid session token, used for making a request on
|
|
8241
|
+
* behalf of a specific user.
|
|
8242
|
+
* <li>include: The name(s) of the key(s) to include. Can be a string, an array of strings,
|
|
8243
|
+
* or an array of array of strings.
|
|
8244
|
+
* <li>context: A dictionary that is accessible in Cloud Code `beforeFind` trigger.
|
|
8245
|
+
* </ul>
|
|
8264
8246
|
* @static
|
|
8265
8247
|
* @returns {Parse.Object[]}
|
|
8266
8248
|
*/
|
|
8267
8249
|
static fetchAllIfNeeded(list, options) {
|
|
8268
|
-
|
|
8269
|
-
|
|
8270
|
-
if (options.hasOwnProperty('useMasterKey')) {
|
|
8271
|
-
queryOptions.useMasterKey = options.useMasterKey;
|
|
8272
|
-
}
|
|
8273
|
-
if (options.hasOwnProperty('sessionToken')) {
|
|
8274
|
-
queryOptions.sessionToken = options.sessionToken;
|
|
8275
|
-
}
|
|
8276
|
-
if (options.hasOwnProperty('include')) {
|
|
8277
|
-
queryOptions.include = ParseObject.handleIncludeOptions(options);
|
|
8278
|
-
}
|
|
8279
|
-
return _CoreManager.default.getObjectController().fetch(list, false, queryOptions);
|
|
8250
|
+
const fetchOptions = ParseObject._getRequestOptions(options);
|
|
8251
|
+
return _CoreManager.default.getObjectController().fetch(list, false, fetchOptions);
|
|
8280
8252
|
}
|
|
8281
8253
|
static handleIncludeOptions(options) {
|
|
8282
8254
|
let include = [];
|
|
8283
8255
|
if ((0, _isArray.default)(options.include)) {
|
|
8284
|
-
var
|
|
8285
|
-
(0, _forEach.default)(
|
|
8256
|
+
var _context;
|
|
8257
|
+
(0, _forEach.default)(_context = options.include).call(_context, key => {
|
|
8286
8258
|
if ((0, _isArray.default)(key)) {
|
|
8287
8259
|
include = (0, _concat.default)(include).call(include, key);
|
|
8288
8260
|
} else {
|
|
@@ -8337,28 +8309,22 @@ class ParseObject {
|
|
|
8337
8309
|
*
|
|
8338
8310
|
* @param {Array} list A list of <code>Parse.Object</code>.
|
|
8339
8311
|
* @param {object} options
|
|
8312
|
+
* Valid options are:<ul>
|
|
8313
|
+
* <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
|
|
8314
|
+
* be used for this request.
|
|
8315
|
+
* <li>sessionToken: A valid session token, used for making a request on
|
|
8316
|
+
* behalf of a specific user.
|
|
8317
|
+
* <li>context: A dictionary that is accessible in Cloud Code `beforeDelete` and `afterDelete` triggers.
|
|
8318
|
+
* <li>transaction: Set to true to enable transactions
|
|
8319
|
+
* <li>batchSize: How many objects to yield in each batch (default: 20)
|
|
8320
|
+
* </ul>
|
|
8340
8321
|
* @static
|
|
8341
8322
|
* @returns {Promise} A promise that is fulfilled when the destroyAll
|
|
8342
8323
|
* completes.
|
|
8343
8324
|
*/
|
|
8344
8325
|
static destroyAll(list) {
|
|
8345
8326
|
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
8346
|
-
const destroyOptions =
|
|
8347
|
-
if (options.hasOwnProperty('useMasterKey')) {
|
|
8348
|
-
destroyOptions.useMasterKey = options.useMasterKey;
|
|
8349
|
-
}
|
|
8350
|
-
if (options.hasOwnProperty('sessionToken')) {
|
|
8351
|
-
destroyOptions.sessionToken = options.sessionToken;
|
|
8352
|
-
}
|
|
8353
|
-
if (options.hasOwnProperty('transaction') && typeof options.transaction === 'boolean') {
|
|
8354
|
-
destroyOptions.transaction = options.transaction;
|
|
8355
|
-
}
|
|
8356
|
-
if (options.hasOwnProperty('batchSize') && typeof options.batchSize === 'number') {
|
|
8357
|
-
destroyOptions.batchSize = options.batchSize;
|
|
8358
|
-
}
|
|
8359
|
-
if (options.hasOwnProperty('context') && typeof options.context === 'object') {
|
|
8360
|
-
destroyOptions.context = options.context;
|
|
8361
|
-
}
|
|
8327
|
+
const destroyOptions = ParseObject._getRequestOptions(options);
|
|
8362
8328
|
return _CoreManager.default.getObjectController().destroy(list, destroyOptions);
|
|
8363
8329
|
}
|
|
8364
8330
|
|
|
@@ -8377,27 +8343,23 @@ class ParseObject {
|
|
|
8377
8343
|
*
|
|
8378
8344
|
* @param {Array} list A list of <code>Parse.Object</code>.
|
|
8379
8345
|
* @param {object} options
|
|
8346
|
+
* Valid options are:
|
|
8347
|
+
* <ul>
|
|
8348
|
+
* <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
|
|
8349
|
+
* be used for this request.
|
|
8350
|
+
* <li>sessionToken: A valid session token, used for making a request on
|
|
8351
|
+
* behalf of a specific user.
|
|
8352
|
+
* <li>cascadeSave: If `false`, nested objects will not be saved (default is `true`).
|
|
8353
|
+
* <li>context: A dictionary that is accessible in Cloud Code `beforeSave` and `afterSave` triggers.
|
|
8354
|
+
* <li>transaction: Set to true to enable transactions
|
|
8355
|
+
* <li>batchSize: How many objects to yield in each batch (default: 20)
|
|
8356
|
+
* </ul>
|
|
8380
8357
|
* @static
|
|
8381
8358
|
* @returns {Parse.Object[]}
|
|
8382
8359
|
*/
|
|
8383
8360
|
static saveAll(list) {
|
|
8384
8361
|
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
8385
|
-
const saveOptions =
|
|
8386
|
-
if (options.hasOwnProperty('useMasterKey')) {
|
|
8387
|
-
saveOptions.useMasterKey = options.useMasterKey;
|
|
8388
|
-
}
|
|
8389
|
-
if (options.hasOwnProperty('sessionToken')) {
|
|
8390
|
-
saveOptions.sessionToken = options.sessionToken;
|
|
8391
|
-
}
|
|
8392
|
-
if (options.hasOwnProperty('transaction') && typeof options.transaction === 'boolean') {
|
|
8393
|
-
saveOptions.transaction = options.transaction;
|
|
8394
|
-
}
|
|
8395
|
-
if (options.hasOwnProperty('batchSize') && typeof options.batchSize === 'number') {
|
|
8396
|
-
saveOptions.batchSize = options.batchSize;
|
|
8397
|
-
}
|
|
8398
|
-
if (options.hasOwnProperty('context') && typeof options.context === 'object') {
|
|
8399
|
-
saveOptions.context = options.context;
|
|
8400
|
-
}
|
|
8362
|
+
const saveOptions = ParseObject._getRequestOptions(options);
|
|
8401
8363
|
return _CoreManager.default.getObjectController().save(list, saveOptions);
|
|
8402
8364
|
}
|
|
8403
8365
|
|
|
@@ -8554,7 +8516,7 @@ class ParseObject {
|
|
|
8554
8516
|
adjustedClassName = '_User';
|
|
8555
8517
|
}
|
|
8556
8518
|
let parentProto = ParseObject.prototype;
|
|
8557
|
-
if (
|
|
8519
|
+
if (Object.hasOwn(this, '__super__') && this.__super__) {
|
|
8558
8520
|
parentProto = this.prototype;
|
|
8559
8521
|
}
|
|
8560
8522
|
let ParseObjectSubclass = function (attributes, options) {
|
|
@@ -8921,7 +8883,7 @@ const DefaultController = {
|
|
|
8921
8883
|
deleteCompleted = deleteCompleted.then(() => {
|
|
8922
8884
|
return RESTController.request('POST', 'batch', body, options).then(results => {
|
|
8923
8885
|
for (let i = 0; i < results.length; i++) {
|
|
8924
|
-
if (results[i] && results[i]
|
|
8886
|
+
if (results[i] && Object.hasOwn(results[i], 'error')) {
|
|
8925
8887
|
const err = new _ParseError.default(results[i].error.code, results[i].error.error);
|
|
8926
8888
|
err.object = batch[i];
|
|
8927
8889
|
errors.push(err);
|
|
@@ -8992,7 +8954,7 @@ const DefaultController = {
|
|
|
8992
8954
|
const batch = [];
|
|
8993
8955
|
const nextPending = [];
|
|
8994
8956
|
(0, _forEach.default)(pending).call(pending, el => {
|
|
8995
|
-
if (allowCustomObjectId && Object.
|
|
8957
|
+
if (allowCustomObjectId && Object.hasOwn(el, 'id') && !el.id) {
|
|
8996
8958
|
throw new _ParseError.default(_ParseError.default.MISSING_OBJECT_ID, 'objectId must not be empty or null');
|
|
8997
8959
|
}
|
|
8998
8960
|
if (batch.length < batchSize && (0, _canBeSerialized.default)(el)) {
|
|
@@ -9018,7 +8980,7 @@ const DefaultController = {
|
|
|
9018
8980
|
batchTasks.push(stateController.enqueueTask(obj._getStateIdentifier(), function () {
|
|
9019
8981
|
ready.resolve();
|
|
9020
8982
|
return batchReturned.then(responses => {
|
|
9021
|
-
if (responses[index]
|
|
8983
|
+
if (Object.hasOwn(responses[index], 'success')) {
|
|
9022
8984
|
const objectId = responses[index].success.objectId;
|
|
9023
8985
|
const status = responses[index]._status;
|
|
9024
8986
|
delete responses[index]._status;
|
|
@@ -9027,7 +8989,7 @@ const DefaultController = {
|
|
|
9027
8989
|
mapIdForPin[objectId] = obj._localId;
|
|
9028
8990
|
obj._handleSaveResponse(responses[index].success, status);
|
|
9029
8991
|
} else {
|
|
9030
|
-
if (!objectError && responses[index]
|
|
8992
|
+
if (!objectError && Object.hasOwn(responses[index], 'error')) {
|
|
9031
8993
|
const serverError = responses[index].error;
|
|
9032
8994
|
objectError = new _ParseError.default(serverError.code, serverError.error);
|
|
9033
8995
|
// Cancel the rest of the save
|
|
@@ -9071,7 +9033,7 @@ const DefaultController = {
|
|
|
9071
9033
|
});
|
|
9072
9034
|
});
|
|
9073
9035
|
} else if (target instanceof ParseObject) {
|
|
9074
|
-
if (allowCustomObjectId && Object.
|
|
9036
|
+
if (allowCustomObjectId && Object.hasOwn(target, 'id') && !target.id) {
|
|
9075
9037
|
throw new _ParseError.default(_ParseError.default.MISSING_OBJECT_ID, 'objectId must not be empty or null');
|
|
9076
9038
|
}
|
|
9077
9039
|
// generate _localId in case if cascadeSave=false
|
|
@@ -9790,7 +9752,7 @@ function handleSelectResult(data, select) {
|
|
|
9790
9752
|
const serverDataMask = {};
|
|
9791
9753
|
(0, _forEach.default)(select).call(select, field => {
|
|
9792
9754
|
const hasSubObjectSelect = (0, _indexOf.default)(field).call(field, '.') !== -1;
|
|
9793
|
-
if (!hasSubObjectSelect && !
|
|
9755
|
+
if (!hasSubObjectSelect && !Object.hasOwn(data, field)) {
|
|
9794
9756
|
// this field was selected, but is missing from the retrieved data
|
|
9795
9757
|
data[field] = undefined;
|
|
9796
9758
|
} else if (hasSubObjectSelect) {
|
|
@@ -9801,7 +9763,7 @@ function handleSelectResult(data, select) {
|
|
|
9801
9763
|
let serverMask = serverDataMask;
|
|
9802
9764
|
(0, _forEach.default)(pathComponents).call(pathComponents, (component, index, arr) => {
|
|
9803
9765
|
// add keys if the expected data is missing
|
|
9804
|
-
if (obj && !
|
|
9766
|
+
if (obj && !Object.hasOwn(obj, component)) {
|
|
9805
9767
|
obj[component] = undefined;
|
|
9806
9768
|
}
|
|
9807
9769
|
if (obj && typeof obj === 'object') {
|
|
@@ -9835,7 +9797,7 @@ function copyMissingDataWithMask(src, dest, mask, copyThisLevel) {
|
|
|
9835
9797
|
//copy missing elements at this level
|
|
9836
9798
|
if (copyThisLevel) {
|
|
9837
9799
|
for (const key in src) {
|
|
9838
|
-
if (
|
|
9800
|
+
if (Object.hasOwn(src, key) && !Object.hasOwn(dest, key)) {
|
|
9839
9801
|
dest[key] = src[key];
|
|
9840
9802
|
}
|
|
9841
9803
|
}
|
|
@@ -10239,7 +10201,7 @@ class ParseQuery {
|
|
|
10239
10201
|
this._comment = json.comment;
|
|
10240
10202
|
}
|
|
10241
10203
|
for (const key in json) {
|
|
10242
|
-
if (
|
|
10204
|
+
if (Object.hasOwn(json, key)) {
|
|
10243
10205
|
var _context3;
|
|
10244
10206
|
if ((0, _indexOf.default)(_context3 = ['where', 'include', 'keys', 'count', 'limit', 'skip', 'order', 'readPreference', 'includeReadPreference', 'subqueryReadPreference', 'hint', 'explain', 'comment']).call(_context3, key) === -1) {
|
|
10245
10207
|
this._extraOptions[key] = json[key];
|
|
@@ -10281,19 +10243,7 @@ class ParseQuery {
|
|
|
10281
10243
|
*/
|
|
10282
10244
|
get(objectId, options) {
|
|
10283
10245
|
this.equalTo('objectId', objectId);
|
|
10284
|
-
const firstOptions =
|
|
10285
|
-
if (options && options.hasOwnProperty('useMasterKey')) {
|
|
10286
|
-
firstOptions.useMasterKey = options.useMasterKey;
|
|
10287
|
-
}
|
|
10288
|
-
if (options && options.hasOwnProperty('sessionToken')) {
|
|
10289
|
-
firstOptions.sessionToken = options.sessionToken;
|
|
10290
|
-
}
|
|
10291
|
-
if (options && options.hasOwnProperty('context') && typeof options.context === 'object') {
|
|
10292
|
-
firstOptions.context = options.context;
|
|
10293
|
-
}
|
|
10294
|
-
if (options && options.hasOwnProperty('json')) {
|
|
10295
|
-
firstOptions.json = options.json;
|
|
10296
|
-
}
|
|
10246
|
+
const firstOptions = _ParseObject.default._getRequestOptions(options);
|
|
10297
10247
|
return this.first(firstOptions).then(response => {
|
|
10298
10248
|
if (response) {
|
|
10299
10249
|
return response;
|
|
@@ -10319,17 +10269,7 @@ class ParseQuery {
|
|
|
10319
10269
|
* the query completes.
|
|
10320
10270
|
*/
|
|
10321
10271
|
find(options) {
|
|
10322
|
-
|
|
10323
|
-
const findOptions = {};
|
|
10324
|
-
if (options.hasOwnProperty('useMasterKey')) {
|
|
10325
|
-
findOptions.useMasterKey = options.useMasterKey;
|
|
10326
|
-
}
|
|
10327
|
-
if (options.hasOwnProperty('sessionToken')) {
|
|
10328
|
-
findOptions.sessionToken = options.sessionToken;
|
|
10329
|
-
}
|
|
10330
|
-
if (options.hasOwnProperty('context') && typeof options.context === 'object') {
|
|
10331
|
-
findOptions.context = options.context;
|
|
10332
|
-
}
|
|
10272
|
+
const findOptions = _ParseObject.default._getRequestOptions(options);
|
|
10333
10273
|
this._setRequestTask(findOptions);
|
|
10334
10274
|
const controller = _CoreManager.default.getQueryController();
|
|
10335
10275
|
const select = this._select;
|
|
@@ -10355,7 +10295,7 @@ class ParseQuery {
|
|
|
10355
10295
|
if (select) {
|
|
10356
10296
|
handleSelectResult(data, select);
|
|
10357
10297
|
}
|
|
10358
|
-
if (
|
|
10298
|
+
if (findOptions.json) {
|
|
10359
10299
|
return data;
|
|
10360
10300
|
} else {
|
|
10361
10301
|
return _ParseObject.default.fromJSON(data, !select);
|
|
@@ -10383,6 +10323,7 @@ class ParseQuery {
|
|
|
10383
10323
|
* be used for this request.
|
|
10384
10324
|
* <li>sessionToken: A valid session token, used for making a request on
|
|
10385
10325
|
* behalf of a specific user.
|
|
10326
|
+
* <li>json: Return raw JSON without converting to Parse.Object.
|
|
10386
10327
|
* </ul>
|
|
10387
10328
|
* @returns {Promise} A promise that is resolved with the results when
|
|
10388
10329
|
* the query completes.
|
|
@@ -10412,13 +10353,7 @@ class ParseQuery {
|
|
|
10412
10353
|
*/
|
|
10413
10354
|
count(options) {
|
|
10414
10355
|
options = options || {};
|
|
10415
|
-
const findOptions =
|
|
10416
|
-
if (options.hasOwnProperty('useMasterKey')) {
|
|
10417
|
-
findOptions.useMasterKey = options.useMasterKey;
|
|
10418
|
-
}
|
|
10419
|
-
if (options.hasOwnProperty('sessionToken')) {
|
|
10420
|
-
findOptions.sessionToken = options.sessionToken;
|
|
10421
|
-
}
|
|
10356
|
+
const findOptions = _ParseObject.default._getRequestOptions(options);
|
|
10422
10357
|
this._setRequestTask(findOptions);
|
|
10423
10358
|
const controller = _CoreManager.default.getQueryController();
|
|
10424
10359
|
const params = this.toJSON();
|
|
@@ -10442,7 +10377,7 @@ class ParseQuery {
|
|
|
10442
10377
|
const distinctOptions = {
|
|
10443
10378
|
useMasterKey: true
|
|
10444
10379
|
};
|
|
10445
|
-
if (
|
|
10380
|
+
if (Object.hasOwn(options, 'sessionToken')) {
|
|
10446
10381
|
distinctOptions.sessionToken = options.sessionToken;
|
|
10447
10382
|
}
|
|
10448
10383
|
this._setRequestTask(distinctOptions);
|
|
@@ -10470,7 +10405,7 @@ class ParseQuery {
|
|
|
10470
10405
|
const aggregateOptions = {
|
|
10471
10406
|
useMasterKey: true
|
|
10472
10407
|
};
|
|
10473
|
-
if (
|
|
10408
|
+
if (Object.hasOwn(options, 'sessionToken')) {
|
|
10474
10409
|
aggregateOptions.sessionToken = options.sessionToken;
|
|
10475
10410
|
}
|
|
10476
10411
|
this._setRequestTask(aggregateOptions);
|
|
@@ -10515,16 +10450,7 @@ class ParseQuery {
|
|
|
10515
10450
|
*/
|
|
10516
10451
|
first() {
|
|
10517
10452
|
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
10518
|
-
const findOptions =
|
|
10519
|
-
if (options.hasOwnProperty('useMasterKey')) {
|
|
10520
|
-
findOptions.useMasterKey = options.useMasterKey;
|
|
10521
|
-
}
|
|
10522
|
-
if (options.hasOwnProperty('sessionToken')) {
|
|
10523
|
-
findOptions.sessionToken = options.sessionToken;
|
|
10524
|
-
}
|
|
10525
|
-
if (options.hasOwnProperty('context') && typeof options.context === 'object') {
|
|
10526
|
-
findOptions.context = options.context;
|
|
10527
|
-
}
|
|
10453
|
+
const findOptions = _ParseObject.default._getRequestOptions(options);
|
|
10528
10454
|
this._setRequestTask(findOptions);
|
|
10529
10455
|
const controller = _CoreManager.default.getQueryController();
|
|
10530
10456
|
const params = this.toJSON();
|
|
@@ -10553,7 +10479,7 @@ class ParseQuery {
|
|
|
10553
10479
|
if (select) {
|
|
10554
10480
|
handleSelectResult(objects[0], select);
|
|
10555
10481
|
}
|
|
10556
|
-
if (
|
|
10482
|
+
if (findOptions.json) {
|
|
10557
10483
|
return objects[0];
|
|
10558
10484
|
} else {
|
|
10559
10485
|
return _ParseObject.default.fromJSON(objects[0], !select);
|
|
@@ -10587,45 +10513,10 @@ class ParseQuery {
|
|
|
10587
10513
|
if (this._order || this._skip || this._limit >= 0) {
|
|
10588
10514
|
return _promise.default.reject('Cannot iterate on a query with sort, skip, or limit.');
|
|
10589
10515
|
}
|
|
10590
|
-
const query =
|
|
10591
|
-
query._limit = options.batchSize || 100;
|
|
10592
|
-
query._include = [...this._include];
|
|
10593
|
-
query._exclude = [...this._exclude];
|
|
10594
|
-
if (this._select) {
|
|
10595
|
-
query._select = [...this._select];
|
|
10596
|
-
}
|
|
10597
|
-
query._hint = this._hint;
|
|
10598
|
-
query._where = {};
|
|
10599
|
-
for (const attr in this._where) {
|
|
10600
|
-
const val = this._where[attr];
|
|
10601
|
-
if ((0, _isArray.default)(val)) {
|
|
10602
|
-
query._where[attr] = (0, _map.default)(val).call(val, v => {
|
|
10603
|
-
return v;
|
|
10604
|
-
});
|
|
10605
|
-
} else if (val && typeof val === 'object') {
|
|
10606
|
-
const conditionMap = {};
|
|
10607
|
-
query._where[attr] = conditionMap;
|
|
10608
|
-
for (const cond in val) {
|
|
10609
|
-
conditionMap[cond] = val[cond];
|
|
10610
|
-
}
|
|
10611
|
-
} else {
|
|
10612
|
-
query._where[attr] = val;
|
|
10613
|
-
}
|
|
10614
|
-
}
|
|
10516
|
+
const query = ParseQuery.fromJSON(this.className, this.toJSON());
|
|
10615
10517
|
query.ascending('objectId');
|
|
10616
|
-
|
|
10617
|
-
|
|
10618
|
-
findOptions.useMasterKey = options.useMasterKey;
|
|
10619
|
-
}
|
|
10620
|
-
if (options.hasOwnProperty('sessionToken')) {
|
|
10621
|
-
findOptions.sessionToken = options.sessionToken;
|
|
10622
|
-
}
|
|
10623
|
-
if (options.hasOwnProperty('context') && typeof options.context === 'object') {
|
|
10624
|
-
findOptions.context = options.context;
|
|
10625
|
-
}
|
|
10626
|
-
if (options.hasOwnProperty('json')) {
|
|
10627
|
-
findOptions.json = options.json;
|
|
10628
|
-
}
|
|
10518
|
+
query._limit = options.batchSize || 100;
|
|
10519
|
+
const findOptions = _ParseObject.default._getRequestOptions(options);
|
|
10629
10520
|
let finished = false;
|
|
10630
10521
|
let previousResults = [];
|
|
10631
10522
|
return (0, _promiseUtils.continueWhile)(() => {
|
|
@@ -10633,7 +10524,11 @@ class ParseQuery {
|
|
|
10633
10524
|
}, async () => {
|
|
10634
10525
|
const [results] = await _promise.default.all([(0, _find.default)(query).call(query, findOptions), _promise.default.resolve(previousResults.length > 0 && callback(previousResults))]);
|
|
10635
10526
|
if (results.length >= query._limit) {
|
|
10636
|
-
|
|
10527
|
+
if (findOptions.json) {
|
|
10528
|
+
query.greaterThan('objectId', results[results.length - 1].objectId);
|
|
10529
|
+
} else {
|
|
10530
|
+
query.greaterThan('objectId', results[results.length - 1].id);
|
|
10531
|
+
}
|
|
10637
10532
|
previousResults = results;
|
|
10638
10533
|
} else if (results.length > 0) {
|
|
10639
10534
|
await _promise.default.resolve(callback(results));
|
|
@@ -12625,12 +12520,8 @@ class ParseSession extends _ParseObject.default {
|
|
|
12625
12520
|
* promise will be rejected.
|
|
12626
12521
|
*/
|
|
12627
12522
|
static current(options) {
|
|
12628
|
-
options = options || {};
|
|
12629
12523
|
const controller = _CoreManager.default.getSessionController();
|
|
12630
|
-
const sessionOptions =
|
|
12631
|
-
if (options.hasOwnProperty('useMasterKey')) {
|
|
12632
|
-
sessionOptions.useMasterKey = options.useMasterKey;
|
|
12633
|
-
}
|
|
12524
|
+
const sessionOptions = _ParseObject.default._getRequestOptions(options);
|
|
12634
12525
|
return _ParseUser.default.currentAsync().then(user => {
|
|
12635
12526
|
if (!user) {
|
|
12636
12527
|
return _promise.default.reject('There is no current user.');
|
|
@@ -12722,15 +12613,15 @@ class ParseUser extends _ParseObject.default {
|
|
|
12722
12613
|
* Request a revocable session token to replace the older style of token.
|
|
12723
12614
|
*
|
|
12724
12615
|
* @param {object} options
|
|
12616
|
+
* Valid options are:<ul>
|
|
12617
|
+
* <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
|
|
12618
|
+
* be used for this request.
|
|
12619
|
+
* </ul>
|
|
12725
12620
|
* @returns {Promise} A promise that is resolved when the replacement
|
|
12726
12621
|
* token has been fetched.
|
|
12727
12622
|
*/
|
|
12728
12623
|
_upgradeToRevocableSession(options) {
|
|
12729
|
-
|
|
12730
|
-
const upgradeOptions = {};
|
|
12731
|
-
if (options.hasOwnProperty('useMasterKey')) {
|
|
12732
|
-
upgradeOptions.useMasterKey = options.useMasterKey;
|
|
12733
|
-
}
|
|
12624
|
+
const upgradeOptions = _ParseObject.default._getRequestOptions(options);
|
|
12734
12625
|
const controller = _CoreManager.default.getUserController();
|
|
12735
12626
|
return controller.upgradeToRevocableSession(this, upgradeOptions);
|
|
12736
12627
|
}
|
|
@@ -12774,7 +12665,7 @@ class ParseUser extends _ParseObject.default {
|
|
|
12774
12665
|
} else {
|
|
12775
12666
|
authType = provider.getAuthType();
|
|
12776
12667
|
}
|
|
12777
|
-
if (options &&
|
|
12668
|
+
if (options && Object.hasOwn(options, 'authData')) {
|
|
12778
12669
|
const authData = this.get('authData') || {};
|
|
12779
12670
|
if (typeof authData !== 'object') {
|
|
12780
12671
|
throw new Error('Invalid type: authData field should be an object');
|
|
@@ -12980,7 +12871,7 @@ class ParseUser extends _ParseObject.default {
|
|
|
12980
12871
|
}
|
|
12981
12872
|
stripAnonymity() {
|
|
12982
12873
|
const authData = this.get('authData');
|
|
12983
|
-
if (authData && typeof authData === 'object' &&
|
|
12874
|
+
if (authData && typeof authData === 'object' && Object.hasOwn(authData, 'anonymous')) {
|
|
12984
12875
|
// We need to set anonymous to null instead of deleting it in order to remove it from Parse.
|
|
12985
12876
|
authData.anonymous = null;
|
|
12986
12877
|
}
|
|
@@ -13082,21 +12973,17 @@ class ParseUser extends _ParseObject.default {
|
|
|
13082
12973
|
*
|
|
13083
12974
|
* @param {object} attrs Extra fields to set on the new user, or null.
|
|
13084
12975
|
* @param {object} options
|
|
12976
|
+
* Valid options are:<ul>
|
|
12977
|
+
* <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
|
|
12978
|
+
* be used for this request.
|
|
12979
|
+
* <li>installationId: the installationId which made the request
|
|
12980
|
+
* <li>context: A dictionary that is accessible in Cloud Code `beforeLogin` and `afterLogin` triggers.
|
|
12981
|
+
* </ul>
|
|
13085
12982
|
* @returns {Promise} A promise that is fulfilled when the signup
|
|
13086
12983
|
* finishes.
|
|
13087
12984
|
*/
|
|
13088
12985
|
signUp(attrs, options) {
|
|
13089
|
-
|
|
13090
|
-
const signupOptions = {};
|
|
13091
|
-
if (options.hasOwnProperty('useMasterKey')) {
|
|
13092
|
-
signupOptions.useMasterKey = options.useMasterKey;
|
|
13093
|
-
}
|
|
13094
|
-
if (options.hasOwnProperty('installationId')) {
|
|
13095
|
-
signupOptions.installationId = options.installationId;
|
|
13096
|
-
}
|
|
13097
|
-
if (options.hasOwnProperty('context') && Object.prototype.toString.call(options.context) === '[object Object]') {
|
|
13098
|
-
signupOptions.context = options.context;
|
|
13099
|
-
}
|
|
12986
|
+
const signupOptions = _ParseObject.default._getRequestOptions(options);
|
|
13100
12987
|
const controller = _CoreManager.default.getUserController();
|
|
13101
12988
|
return controller.signUp(this, attrs, signupOptions);
|
|
13102
12989
|
}
|
|
@@ -13109,26 +12996,21 @@ class ParseUser extends _ParseObject.default {
|
|
|
13109
12996
|
* <p>A username and password must be set before calling logIn.</p>
|
|
13110
12997
|
*
|
|
13111
12998
|
* @param {object} options
|
|
12999
|
+
* Valid options are:<ul>
|
|
13000
|
+
* <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
|
|
13001
|
+
* be used for this request.
|
|
13002
|
+
* <li>usePost: Use POST method to make the request (default: true)
|
|
13003
|
+
* <li>installationId: the installationId which made the request
|
|
13004
|
+
* <li>context: A dictionary that is accessible in Cloud Code `beforeLogin` and `afterLogin` triggers.
|
|
13005
|
+
* </ul>
|
|
13112
13006
|
* @returns {Promise} A promise that is fulfilled with the user when
|
|
13113
13007
|
* the login is complete.
|
|
13114
13008
|
*/
|
|
13115
13009
|
logIn() {
|
|
13116
13010
|
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
13117
|
-
|
|
13118
|
-
|
|
13119
|
-
usePost
|
|
13120
|
-
};
|
|
13121
|
-
if (options.hasOwnProperty('useMasterKey')) {
|
|
13122
|
-
loginOptions.useMasterKey = options.useMasterKey;
|
|
13123
|
-
}
|
|
13124
|
-
if (options.hasOwnProperty('installationId')) {
|
|
13125
|
-
loginOptions.installationId = options.installationId;
|
|
13126
|
-
}
|
|
13127
|
-
if (options.hasOwnProperty('usePost')) {
|
|
13128
|
-
loginOptions.usePost = options.usePost;
|
|
13129
|
-
}
|
|
13130
|
-
if (options.hasOwnProperty('context') && Object.prototype.toString.call(options.context) === '[object Object]') {
|
|
13131
|
-
loginOptions.context = options.context;
|
|
13011
|
+
const loginOptions = _ParseObject.default._getRequestOptions(options);
|
|
13012
|
+
if (!Object.hasOwn(loginOptions, 'usePost')) {
|
|
13013
|
+
loginOptions.usePost = true;
|
|
13132
13014
|
}
|
|
13133
13015
|
const controller = _CoreManager.default.getUserController();
|
|
13134
13016
|
return controller.logIn(this, loginOptions);
|
|
@@ -13399,6 +13281,7 @@ class ParseUser extends _ParseObject.default {
|
|
|
13399
13281
|
*
|
|
13400
13282
|
* @param {string} sessionToken The sessionToken to log in with.
|
|
13401
13283
|
* @param {object} options
|
|
13284
|
+
* @param {boolean} [options.useMasterKey]
|
|
13402
13285
|
* @static
|
|
13403
13286
|
* @returns {Promise} A promise that is fulfilled with the user when
|
|
13404
13287
|
* the login completes.
|
|
@@ -13407,13 +13290,8 @@ class ParseUser extends _ParseObject.default {
|
|
|
13407
13290
|
if (!canUseCurrentUser) {
|
|
13408
13291
|
throw new Error('It is not memory-safe to become a user in a server environment');
|
|
13409
13292
|
}
|
|
13410
|
-
|
|
13411
|
-
|
|
13412
|
-
sessionToken: sessionToken
|
|
13413
|
-
};
|
|
13414
|
-
if (options.hasOwnProperty('useMasterKey')) {
|
|
13415
|
-
becomeOptions.useMasterKey = options.useMasterKey;
|
|
13416
|
-
}
|
|
13293
|
+
const becomeOptions = _ParseObject.default._getRequestOptions(options);
|
|
13294
|
+
becomeOptions.sessionToken = sessionToken;
|
|
13417
13295
|
const controller = _CoreManager.default.getUserController();
|
|
13418
13296
|
const user = new this();
|
|
13419
13297
|
return controller.become(user, becomeOptions);
|
|
@@ -13424,18 +13302,15 @@ class ParseUser extends _ParseObject.default {
|
|
|
13424
13302
|
*
|
|
13425
13303
|
* @param {string} sessionToken The sessionToken to get user with.
|
|
13426
13304
|
* @param {object} options
|
|
13305
|
+
* @param {boolean} [options.useMasterKey]
|
|
13427
13306
|
* @static
|
|
13428
13307
|
* @returns {Promise} A promise that is fulfilled with the user is fetched.
|
|
13429
13308
|
*/
|
|
13430
13309
|
static me(sessionToken) {
|
|
13431
13310
|
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
13432
13311
|
const controller = _CoreManager.default.getUserController();
|
|
13433
|
-
const meOptions =
|
|
13434
|
-
|
|
13435
|
-
};
|
|
13436
|
-
if (options.useMasterKey) {
|
|
13437
|
-
meOptions.useMasterKey = options.useMasterKey;
|
|
13438
|
-
}
|
|
13312
|
+
const meOptions = _ParseObject.default._getRequestOptions(options);
|
|
13313
|
+
meOptions.sessionToken = sessionToken;
|
|
13439
13314
|
const user = new this();
|
|
13440
13315
|
return controller.me(user, meOptions);
|
|
13441
13316
|
}
|
|
@@ -13495,15 +13370,15 @@ class ParseUser extends _ParseObject.default {
|
|
|
13495
13370
|
* @param {string} email The email address associated with the user that
|
|
13496
13371
|
* forgot their password.
|
|
13497
13372
|
* @param {object} options
|
|
13373
|
+
* Valid options are:<ul>
|
|
13374
|
+
* <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
|
|
13375
|
+
* be used for this request.
|
|
13376
|
+
* </ul>
|
|
13498
13377
|
* @static
|
|
13499
13378
|
* @returns {Promise}
|
|
13500
13379
|
*/
|
|
13501
13380
|
static requestPasswordReset(email, options) {
|
|
13502
|
-
|
|
13503
|
-
const requestOptions = {};
|
|
13504
|
-
if (options.hasOwnProperty('useMasterKey')) {
|
|
13505
|
-
requestOptions.useMasterKey = options.useMasterKey;
|
|
13506
|
-
}
|
|
13381
|
+
const requestOptions = _ParseObject.default._getRequestOptions(options);
|
|
13507
13382
|
const controller = _CoreManager.default.getUserController();
|
|
13508
13383
|
return controller.requestPasswordReset(email, requestOptions);
|
|
13509
13384
|
}
|
|
@@ -13514,15 +13389,15 @@ class ParseUser extends _ParseObject.default {
|
|
|
13514
13389
|
* @param {string} email The email address associated with the user that
|
|
13515
13390
|
* needs to verify their email.
|
|
13516
13391
|
* @param {object} options
|
|
13392
|
+
* Valid options are:<ul>
|
|
13393
|
+
* <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
|
|
13394
|
+
* be used for this request.
|
|
13395
|
+
* </ul>
|
|
13517
13396
|
* @static
|
|
13518
13397
|
* @returns {Promise}
|
|
13519
13398
|
*/
|
|
13520
13399
|
static requestEmailVerification(email, options) {
|
|
13521
|
-
|
|
13522
|
-
const requestOptions = {};
|
|
13523
|
-
if (options.hasOwnProperty('useMasterKey')) {
|
|
13524
|
-
requestOptions.useMasterKey = options.useMasterKey;
|
|
13525
|
-
}
|
|
13400
|
+
const requestOptions = _ParseObject.default._getRequestOptions(options);
|
|
13526
13401
|
const controller = _CoreManager.default.getUserController();
|
|
13527
13402
|
return controller.requestEmailVerification(email, requestOptions);
|
|
13528
13403
|
}
|
|
@@ -13987,7 +13862,7 @@ function send(data) {
|
|
|
13987
13862
|
const pushOptions = {
|
|
13988
13863
|
useMasterKey: true
|
|
13989
13864
|
};
|
|
13990
|
-
if (
|
|
13865
|
+
if (Object.hasOwn(options, 'useMasterKey')) {
|
|
13991
13866
|
pushOptions.useMasterKey = options.useMasterKey;
|
|
13992
13867
|
}
|
|
13993
13868
|
return _CoreManager.default.getPushController().send(data, pushOptions);
|
|
@@ -14011,7 +13886,7 @@ function getPushStatus(pushStatusId) {
|
|
|
14011
13886
|
const pushOptions = {
|
|
14012
13887
|
useMasterKey: true
|
|
14013
13888
|
};
|
|
14014
|
-
if (
|
|
13889
|
+
if (Object.hasOwn(options, 'useMasterKey')) {
|
|
14015
13890
|
pushOptions.useMasterKey = options.useMasterKey;
|
|
14016
13891
|
}
|
|
14017
13892
|
const query = new _ParseQuery.default('_PushStatus');
|
|
@@ -14635,7 +14510,7 @@ const Storage = {
|
|
|
14635
14510
|
},
|
|
14636
14511
|
_clear() {
|
|
14637
14512
|
const controller = _CoreManager.default.getStorageController();
|
|
14638
|
-
if (
|
|
14513
|
+
if (Object.hasOwn(controller, 'clear')) {
|
|
14639
14514
|
controller.clear();
|
|
14640
14515
|
}
|
|
14641
14516
|
}
|
|
@@ -14696,7 +14571,7 @@ const memMap = {};
|
|
|
14696
14571
|
const StorageController = {
|
|
14697
14572
|
async: 0,
|
|
14698
14573
|
getItem(path) {
|
|
14699
|
-
if (
|
|
14574
|
+
if (Object.hasOwn(memMap, path)) {
|
|
14700
14575
|
return memMap[path];
|
|
14701
14576
|
}
|
|
14702
14577
|
return null;
|
|
@@ -14712,7 +14587,7 @@ const StorageController = {
|
|
|
14712
14587
|
},
|
|
14713
14588
|
clear() {
|
|
14714
14589
|
for (const key in memMap) {
|
|
14715
|
-
if (
|
|
14590
|
+
if (Object.hasOwn(memMap, key)) {
|
|
14716
14591
|
delete memMap[key];
|
|
14717
14592
|
}
|
|
14718
14593
|
}
|