parse 6.0.0 → 6.1.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -1
- package/dist/parse.js +70 -62
- package/dist/parse.min.js +2 -2
- package/dist/parse.weapp.js +70 -62
- package/dist/parse.weapp.min.js +2 -2
- package/lib/browser/Cloud.js +1 -0
- package/lib/browser/CoreManager.js +2 -1
- package/lib/browser/EventuallyQueue.js +6 -9
- package/lib/browser/LiveQuerySubscription.js +4 -4
- package/lib/browser/Parse.js +12 -1
- package/lib/browser/ParseACL.js +1 -1
- package/lib/browser/ParseConfig.js +2 -4
- package/lib/browser/ParseLiveQuery.js +2 -2
- package/lib/browser/ParseObject.js +12 -12
- package/lib/browser/ParseQuery.js +7 -8
- package/lib/browser/ParseRole.js +1 -1
- package/lib/browser/ParseSchema.js +6 -6
- package/lib/browser/ParseUser.js +10 -12
- package/lib/browser/RESTController.js +3 -0
- package/lib/node/Cloud.js +1 -0
- package/lib/node/CoreManager.js +2 -1
- package/lib/node/EventuallyQueue.js +6 -6
- package/lib/node/LiveQuerySubscription.js +4 -4
- package/lib/node/Parse.js +12 -1
- package/lib/node/ParseACL.js +1 -1
- package/lib/node/ParseConfig.js +2 -2
- package/lib/node/ParseLiveQuery.js +2 -2
- package/lib/node/ParseObject.js +12 -9
- package/lib/node/ParseQuery.js +7 -7
- package/lib/node/ParseRole.js +1 -1
- package/lib/node/ParseSchema.js +6 -4
- package/lib/node/ParseUser.js +10 -10
- package/lib/node/RESTController.js +3 -0
- package/lib/react-native/CoreManager.js +2 -1
- package/lib/react-native/EventuallyQueue.js +5 -8
- package/lib/react-native/LiveQuerySubscription.js +7 -7
- package/lib/react-native/Parse.js +8 -1
- package/lib/react-native/ParseConfig.js +2 -4
- package/lib/react-native/ParseLiveQuery.js +2 -2
- package/lib/react-native/ParseObject.js +16 -18
- package/lib/react-native/ParseQuery.js +5 -6
- package/lib/react-native/ParseSchema.js +5 -6
- package/lib/react-native/ParseUser.js +3 -5
- package/lib/react-native/RESTController.js +3 -0
- package/lib/weapp/Cloud.js +1 -0
- package/lib/weapp/CoreManager.js +2 -1
- package/lib/weapp/EventuallyQueue.js +6 -9
- package/lib/weapp/LiveQuerySubscription.js +4 -4
- package/lib/weapp/Parse.js +12 -1
- package/lib/weapp/ParseACL.js +1 -1
- package/lib/weapp/ParseConfig.js +2 -4
- package/lib/weapp/ParseLiveQuery.js +2 -2
- package/lib/weapp/ParseObject.js +12 -12
- package/lib/weapp/ParseQuery.js +7 -8
- package/lib/weapp/ParseRole.js +1 -1
- package/lib/weapp/ParseSchema.js +6 -6
- package/lib/weapp/ParseUser.js +10 -12
- package/lib/weapp/RESTController.js +3 -0
- package/package.json +8 -6
package/lib/node/ParseObject.js
CHANGED
|
@@ -198,7 +198,7 @@ class ParseObject {
|
|
|
198
198
|
id = this._getId();
|
|
199
199
|
}
|
|
200
200
|
return {
|
|
201
|
-
id
|
|
201
|
+
id,
|
|
202
202
|
className: this.className
|
|
203
203
|
};
|
|
204
204
|
} else {
|
|
@@ -423,6 +423,9 @@ class ParseObject {
|
|
|
423
423
|
if (hasOwn(options, 'useMasterKey')) {
|
|
424
424
|
requestOptions.useMasterKey = !!options.useMasterKey;
|
|
425
425
|
}
|
|
426
|
+
if (hasOwn(options, 'useMaintenanceKey')) {
|
|
427
|
+
requestOptions.useMaintenanceKey = !!options.useMaintenanceKey;
|
|
428
|
+
}
|
|
426
429
|
if (hasOwn(options, 'sessionToken') && typeof options.sessionToken === 'string') {
|
|
427
430
|
requestOptions.sessionToken = options.sessionToken;
|
|
428
431
|
}
|
|
@@ -1033,8 +1036,8 @@ class ParseObject {
|
|
|
1033
1036
|
return new _ParseError.default(_ParseError.default.OTHER_CAUSE, 'ACL must be a Parse ACL.');
|
|
1034
1037
|
}
|
|
1035
1038
|
for (const key in attrs) {
|
|
1036
|
-
if (!/^[A-Za-
|
|
1037
|
-
return new _ParseError.default(_ParseError.default.INVALID_KEY_NAME, `Invalid key name:
|
|
1039
|
+
if (!/^[A-Za-z_][0-9A-Za-z_.]*$/.test(key)) {
|
|
1040
|
+
return new _ParseError.default(_ParseError.default.INVALID_KEY_NAME, `Invalid key name: ${key}`);
|
|
1038
1041
|
}
|
|
1039
1042
|
}
|
|
1040
1043
|
return false;
|
|
@@ -1254,6 +1257,7 @@ class ParseObject {
|
|
|
1254
1257
|
* @returns {Promise} A promise that is fulfilled when the save
|
|
1255
1258
|
* completes.
|
|
1256
1259
|
*/
|
|
1260
|
+
|
|
1257
1261
|
async save(arg1, arg2, arg3) {
|
|
1258
1262
|
let attrs;
|
|
1259
1263
|
let options;
|
|
@@ -1284,9 +1288,8 @@ class ParseObject {
|
|
|
1284
1288
|
const filePromise = unsavedFiles.length ? controller.save(unsavedFiles, saveOptions) : Promise.resolve();
|
|
1285
1289
|
return filePromise.then(() => controller.save(unsavedObjects, saveOptions)).then(savedOjbects => savedOjbects.pop());
|
|
1286
1290
|
}
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
});
|
|
1291
|
+
await controller.save(unsaved, saveOptions);
|
|
1292
|
+
return controller.save(this, saveOptions);
|
|
1290
1293
|
}
|
|
1291
1294
|
|
|
1292
1295
|
/**
|
|
@@ -1492,7 +1495,7 @@ class ParseObject {
|
|
|
1492
1495
|
* @static
|
|
1493
1496
|
* @returns {Parse.Object[]}
|
|
1494
1497
|
*/
|
|
1495
|
-
static fetchAll(list, options
|
|
1498
|
+
static fetchAll(list, options) {
|
|
1496
1499
|
const fetchOptions = ParseObject._getRequestOptions(options);
|
|
1497
1500
|
return _CoreManager.default.getObjectController().fetch(list, true, fetchOptions);
|
|
1498
1501
|
}
|
|
@@ -1670,7 +1673,7 @@ class ParseObject {
|
|
|
1670
1673
|
* @returns {Promise} A promise that is fulfilled when the destroyAll
|
|
1671
1674
|
* completes.
|
|
1672
1675
|
*/
|
|
1673
|
-
static destroyAll(list, options
|
|
1676
|
+
static destroyAll(list, options) {
|
|
1674
1677
|
const destroyOptions = ParseObject._getRequestOptions(options);
|
|
1675
1678
|
return _CoreManager.default.getObjectController().destroy(list, destroyOptions);
|
|
1676
1679
|
}
|
|
@@ -1704,7 +1707,7 @@ class ParseObject {
|
|
|
1704
1707
|
* @static
|
|
1705
1708
|
* @returns {Parse.Object[]}
|
|
1706
1709
|
*/
|
|
1707
|
-
static saveAll(list, options
|
|
1710
|
+
static saveAll(list, options) {
|
|
1708
1711
|
const saveOptions = ParseObject._getRequestOptions(options);
|
|
1709
1712
|
return _CoreManager.default.getObjectController().save(list, saveOptions);
|
|
1710
1713
|
}
|
package/lib/node/ParseQuery.js
CHANGED
|
@@ -1093,11 +1093,11 @@ class ParseQuery {
|
|
|
1093
1093
|
* be contained in the provided list of values.
|
|
1094
1094
|
*
|
|
1095
1095
|
* @param {string} key The key to check.
|
|
1096
|
-
* @param {Array<*>}
|
|
1096
|
+
* @param {Array<*>} values The values that will match.
|
|
1097
1097
|
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
1098
1098
|
*/
|
|
1099
|
-
containedIn(key,
|
|
1100
|
-
return this._addCondition(key, '$in',
|
|
1099
|
+
containedIn(key, values) {
|
|
1100
|
+
return this._addCondition(key, '$in', values);
|
|
1101
1101
|
}
|
|
1102
1102
|
|
|
1103
1103
|
/**
|
|
@@ -1105,11 +1105,11 @@ class ParseQuery {
|
|
|
1105
1105
|
* not be contained in the provided list of values.
|
|
1106
1106
|
*
|
|
1107
1107
|
* @param {string} key The key to check.
|
|
1108
|
-
* @param {Array<*>}
|
|
1108
|
+
* @param {Array<*>} values The values that will not match.
|
|
1109
1109
|
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
1110
1110
|
*/
|
|
1111
|
-
notContainedIn(key,
|
|
1112
|
-
return this._addCondition(key, '$nin',
|
|
1111
|
+
notContainedIn(key, values) {
|
|
1112
|
+
return this._addCondition(key, '$nin', values);
|
|
1113
1113
|
}
|
|
1114
1114
|
|
|
1115
1115
|
/**
|
|
@@ -1319,7 +1319,7 @@ class ParseQuery {
|
|
|
1319
1319
|
* @param {boolean} options.diacriticSensitive A boolean flag to enable or disable diacritic sensitive search.
|
|
1320
1320
|
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
1321
1321
|
*/
|
|
1322
|
-
fullText(key, value, options
|
|
1322
|
+
fullText(key, value, options) {
|
|
1323
1323
|
options = options || {};
|
|
1324
1324
|
if (!key) {
|
|
1325
1325
|
throw new Error('A key is required.');
|
package/lib/node/ParseRole.js
CHANGED
|
@@ -69,7 +69,7 @@ class ParseRole extends _ParseObject.default {
|
|
|
69
69
|
* @param {string} name The name of the role.
|
|
70
70
|
* @param {object} options Standard options object with success and error
|
|
71
71
|
* callbacks.
|
|
72
|
-
* @returns {
|
|
72
|
+
* @returns {Parse.Object} Returns the object, so you can chain this call.
|
|
73
73
|
*/
|
|
74
74
|
setName(name, options) {
|
|
75
75
|
this._validateName(name);
|
package/lib/node/ParseSchema.js
CHANGED
|
@@ -13,6 +13,7 @@ function _interopRequireDefault(e) {
|
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
15
|
const FIELD_TYPES = ['String', 'Number', 'Boolean', 'Bytes', 'Date', 'File', 'GeoPoint', 'Polygon', 'Array', 'Object', 'Pointer', 'Relation'];
|
|
16
|
+
|
|
16
17
|
/**
|
|
17
18
|
* A Parse.Schema object is for handling schema data from Parse.
|
|
18
19
|
* <p>All the schemas methods require MasterKey.
|
|
@@ -183,8 +184,9 @@ class ParseSchema {
|
|
|
183
184
|
* </ul>
|
|
184
185
|
* @returns {Parse.Schema} Returns the schema, so you can chain this call.
|
|
185
186
|
*/
|
|
186
|
-
addField(name, type, options
|
|
187
|
+
addField(name, type, options) {
|
|
187
188
|
type = type || 'String';
|
|
189
|
+
options = options || {};
|
|
188
190
|
if (!name) {
|
|
189
191
|
throw new Error('field name may not be null.');
|
|
190
192
|
}
|
|
@@ -366,7 +368,7 @@ class ParseSchema {
|
|
|
366
368
|
* @param {object} options See {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.Schema.html#addField addField}
|
|
367
369
|
* @returns {Parse.Schema} Returns the schema, so you can chain this call.
|
|
368
370
|
*/
|
|
369
|
-
addPointer(name, targetClass, options
|
|
371
|
+
addPointer(name, targetClass, options) {
|
|
370
372
|
if (!name) {
|
|
371
373
|
throw new Error('field name may not be null.');
|
|
372
374
|
}
|
|
@@ -377,10 +379,10 @@ class ParseSchema {
|
|
|
377
379
|
type: 'Pointer',
|
|
378
380
|
targetClass
|
|
379
381
|
};
|
|
380
|
-
if (typeof options.required === 'boolean') {
|
|
382
|
+
if (typeof (options === null || options === void 0 ? void 0 : options.required) === 'boolean') {
|
|
381
383
|
fieldOptions.required = options.required;
|
|
382
384
|
}
|
|
383
|
-
if (options.defaultValue !== undefined) {
|
|
385
|
+
if ((options === null || options === void 0 ? void 0 : options.defaultValue) !== undefined) {
|
|
384
386
|
fieldOptions.defaultValue = options.defaultValue;
|
|
385
387
|
if (options.defaultValue instanceof _ParseObject.default) {
|
|
386
388
|
fieldOptions.defaultValue = options.defaultValue.toPointer();
|
package/lib/node/ParseUser.js
CHANGED
|
@@ -571,7 +571,7 @@ class ParseUser extends _ParseObject.default {
|
|
|
571
571
|
* either from memory or localStorage, if necessary.
|
|
572
572
|
*
|
|
573
573
|
* @static
|
|
574
|
-
* @returns {Parse.
|
|
574
|
+
* @returns {Parse.User} The currently logged in Parse.User.
|
|
575
575
|
*/
|
|
576
576
|
static current() {
|
|
577
577
|
if (!canUseCurrentUser) {
|
|
@@ -638,8 +638,8 @@ class ParseUser extends _ParseObject.default {
|
|
|
638
638
|
}
|
|
639
639
|
const user = new this();
|
|
640
640
|
user._finishFetch({
|
|
641
|
-
username
|
|
642
|
-
password
|
|
641
|
+
username,
|
|
642
|
+
password
|
|
643
643
|
});
|
|
644
644
|
return user.logIn(options);
|
|
645
645
|
}
|
|
@@ -669,8 +669,8 @@ class ParseUser extends _ParseObject.default {
|
|
|
669
669
|
}
|
|
670
670
|
const user = new this();
|
|
671
671
|
user._finishFetch({
|
|
672
|
-
username
|
|
673
|
-
password
|
|
672
|
+
username,
|
|
673
|
+
password,
|
|
674
674
|
authData
|
|
675
675
|
});
|
|
676
676
|
return user.logIn(options);
|
|
@@ -727,7 +727,7 @@ class ParseUser extends _ParseObject.default {
|
|
|
727
727
|
* @static
|
|
728
728
|
* @returns {Promise} A promise that is fulfilled with the user is fetched.
|
|
729
729
|
*/
|
|
730
|
-
static me(sessionToken, options
|
|
730
|
+
static me(sessionToken, options) {
|
|
731
731
|
const controller = _CoreManager.default.getUserController();
|
|
732
732
|
const meOptions = _ParseObject.default._getRequestOptions(options);
|
|
733
733
|
meOptions.sessionToken = sessionToken;
|
|
@@ -776,7 +776,7 @@ class ParseUser extends _ParseObject.default {
|
|
|
776
776
|
* @returns {Promise} A promise that is resolved when the session is
|
|
777
777
|
* destroyed on the server.
|
|
778
778
|
*/
|
|
779
|
-
static logOut(options
|
|
779
|
+
static logOut(options) {
|
|
780
780
|
const controller = _CoreManager.default.getUserController();
|
|
781
781
|
return controller.logOut(options);
|
|
782
782
|
}
|
|
@@ -1137,7 +1137,7 @@ const DefaultController = {
|
|
|
1137
1137
|
},
|
|
1138
1138
|
logOut(options) {
|
|
1139
1139
|
const RESTController = _CoreManager.default.getRESTController();
|
|
1140
|
-
if (options.sessionToken) {
|
|
1140
|
+
if (options !== null && options !== void 0 && options.sessionToken) {
|
|
1141
1141
|
return RESTController.request('POST', 'logout', {}, options);
|
|
1142
1142
|
}
|
|
1143
1143
|
return DefaultController.currentUserAsync().then(currentUser => {
|
|
@@ -1165,7 +1165,7 @@ const DefaultController = {
|
|
|
1165
1165
|
requestPasswordReset(email, options) {
|
|
1166
1166
|
const RESTController = _CoreManager.default.getRESTController();
|
|
1167
1167
|
return RESTController.request('POST', 'requestPasswordReset', {
|
|
1168
|
-
email
|
|
1168
|
+
email
|
|
1169
1169
|
}, options);
|
|
1170
1170
|
},
|
|
1171
1171
|
async upgradeToRevocableSession(user, options) {
|
|
@@ -1209,7 +1209,7 @@ const DefaultController = {
|
|
|
1209
1209
|
requestEmailVerification(email, options) {
|
|
1210
1210
|
const RESTController = _CoreManager.default.getRESTController();
|
|
1211
1211
|
return RESTController.request('POST', 'verificationEmailRequest', {
|
|
1212
|
-
email
|
|
1212
|
+
email
|
|
1213
1213
|
}, options);
|
|
1214
1214
|
}
|
|
1215
1215
|
};
|
|
@@ -230,6 +230,9 @@ const RESTController = {
|
|
|
230
230
|
throw new Error('Cannot use the Master Key, it has not been provided.');
|
|
231
231
|
}
|
|
232
232
|
}
|
|
233
|
+
if (options.useMaintenanceKey) {
|
|
234
|
+
payload._MaintenanceKey = _CoreManager.default.get('MAINTENANCE_KEY');
|
|
235
|
+
}
|
|
233
236
|
if (_CoreManager.default.get('FORCE_REVOCABLE_SESSION')) {
|
|
234
237
|
payload._RevocableSession = '1';
|
|
235
238
|
}
|
|
@@ -12,9 +12,10 @@ var config = {
|
|
|
12
12
|
SERVER_AUTH_TOKEN: null,
|
|
13
13
|
LIVEQUERY_SERVER_URL: null,
|
|
14
14
|
ENCRYPTED_KEY: null,
|
|
15
|
-
VERSION: 'js' + "6.0.
|
|
15
|
+
VERSION: 'js' + "6.1.0-alpha.2",
|
|
16
16
|
APPLICATION_ID: null,
|
|
17
17
|
JAVASCRIPT_KEY: null,
|
|
18
|
+
MAINTENANCE_KEY: null,
|
|
18
19
|
MASTER_KEY: null,
|
|
19
20
|
USE_MASTER_KEY: false,
|
|
20
21
|
PERFORM_USER_REWRITE: true,
|
|
@@ -15,12 +15,10 @@ var queueCache = [];
|
|
|
15
15
|
var dirtyCache = true;
|
|
16
16
|
var polling = undefined;
|
|
17
17
|
var EventuallyQueue = {
|
|
18
|
-
save: function (object) {
|
|
19
|
-
var serverOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
18
|
+
save: function (object, serverOptions) {
|
|
20
19
|
return this.enqueue('save', object, serverOptions);
|
|
21
20
|
},
|
|
22
|
-
destroy: function (object) {
|
|
23
|
-
var serverOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
21
|
+
destroy: function (object, serverOptions) {
|
|
24
22
|
return this.enqueue('destroy', object, serverOptions);
|
|
25
23
|
},
|
|
26
24
|
generateQueueId: function (action, object) {
|
|
@@ -49,7 +47,7 @@ var EventuallyQueue = {
|
|
|
49
47
|
queueId: queueId,
|
|
50
48
|
action: action,
|
|
51
49
|
object: object.toJSON(),
|
|
52
|
-
serverOptions: serverOptions,
|
|
50
|
+
serverOptions: serverOptions || {},
|
|
53
51
|
id: object.id,
|
|
54
52
|
className: object.className,
|
|
55
53
|
hash: object.get('hash'),
|
|
@@ -182,9 +180,8 @@ var EventuallyQueue = {
|
|
|
182
180
|
}
|
|
183
181
|
return sendQueueCallback;
|
|
184
182
|
}(),
|
|
185
|
-
poll: function () {
|
|
183
|
+
poll: function (ms) {
|
|
186
184
|
var _this = this;
|
|
187
|
-
var ms = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 2000;
|
|
188
185
|
if (polling) {
|
|
189
186
|
return;
|
|
190
187
|
}
|
|
@@ -199,7 +196,7 @@ var EventuallyQueue = {
|
|
|
199
196
|
}).catch(function (e) {
|
|
200
197
|
return e;
|
|
201
198
|
});
|
|
202
|
-
}, ms);
|
|
199
|
+
}, ms || 2000);
|
|
203
200
|
},
|
|
204
201
|
stopPoll: function () {
|
|
205
202
|
clearInterval(polling);
|
|
@@ -7,18 +7,18 @@ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/cl
|
|
|
7
7
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
8
8
|
var _CoreManager = _interopRequireDefault(require("./CoreManager"));
|
|
9
9
|
var _promiseUtils = require("./promiseUtils");
|
|
10
|
-
var
|
|
11
|
-
function
|
|
10
|
+
var LiveQuerySubscription = function () {
|
|
11
|
+
function LiveQuerySubscription(id, query, sessionToken) {
|
|
12
12
|
var _this = this;
|
|
13
|
-
(0, _classCallCheck2.default)(this,
|
|
13
|
+
(0, _classCallCheck2.default)(this, LiveQuerySubscription);
|
|
14
14
|
this.id = id;
|
|
15
15
|
this.query = query;
|
|
16
16
|
this.sessionToken = sessionToken;
|
|
17
17
|
this.subscribePromise = (0, _promiseUtils.resolvingPromise)();
|
|
18
18
|
this.unsubscribePromise = (0, _promiseUtils.resolvingPromise)();
|
|
19
19
|
this.subscribed = false;
|
|
20
|
-
var
|
|
21
|
-
this.emitter = new
|
|
20
|
+
var Emitter = _CoreManager.default.getEventEmitter();
|
|
21
|
+
this.emitter = new Emitter();
|
|
22
22
|
this.on = function (eventName, listener) {
|
|
23
23
|
return _this.emitter.on(eventName, listener);
|
|
24
24
|
};
|
|
@@ -31,7 +31,7 @@ var Subscription = function () {
|
|
|
31
31
|
};
|
|
32
32
|
this.on('error', function () {});
|
|
33
33
|
}
|
|
34
|
-
return (0, _createClass2.default)(
|
|
34
|
+
return (0, _createClass2.default)(LiveQuerySubscription, [{
|
|
35
35
|
key: "unsubscribe",
|
|
36
36
|
value: function () {
|
|
37
37
|
var _this2 = this;
|
|
@@ -42,4 +42,4 @@ var Subscription = function () {
|
|
|
42
42
|
}
|
|
43
43
|
}]);
|
|
44
44
|
}();
|
|
45
|
-
var _default = exports.default =
|
|
45
|
+
var _default = exports.default = LiveQuerySubscription;
|
|
@@ -112,9 +112,10 @@ var Parse = {
|
|
|
112
112
|
initialize: function (applicationId, javaScriptKey) {
|
|
113
113
|
Parse._initialize(applicationId, javaScriptKey);
|
|
114
114
|
},
|
|
115
|
-
_initialize: function (applicationId, javaScriptKey, masterKey) {
|
|
115
|
+
_initialize: function (applicationId, javaScriptKey, masterKey, maintenanceKey) {
|
|
116
116
|
_CoreManager.default.set('APPLICATION_ID', applicationId);
|
|
117
117
|
_CoreManager.default.set('JAVASCRIPT_KEY', javaScriptKey);
|
|
118
|
+
_CoreManager.default.set('MAINTENANCE_KEY', maintenanceKey);
|
|
118
119
|
_CoreManager.default.set('MASTER_KEY', masterKey);
|
|
119
120
|
_CoreManager.default.set('USE_MASTER_KEY', false);
|
|
120
121
|
_CoreManager.default.setIfNeeded('EventEmitter', _EventEmitter.default);
|
|
@@ -153,6 +154,12 @@ var Parse = {
|
|
|
153
154
|
get masterKey() {
|
|
154
155
|
return _CoreManager.default.get('MASTER_KEY');
|
|
155
156
|
},
|
|
157
|
+
set maintenanceKey(value) {
|
|
158
|
+
_CoreManager.default.set('MAINTENANCE_KEY', value);
|
|
159
|
+
},
|
|
160
|
+
get maintenanceKey() {
|
|
161
|
+
return _CoreManager.default.get('MAINTENANCE_KEY');
|
|
162
|
+
},
|
|
156
163
|
set serverURL(value) {
|
|
157
164
|
_CoreManager.default.set('SERVER_URL', value);
|
|
158
165
|
},
|
|
@@ -45,8 +45,7 @@ var ParseConfig = function () {
|
|
|
45
45
|
}
|
|
46
46
|
}, {
|
|
47
47
|
key: "get",
|
|
48
|
-
value: function () {
|
|
49
|
-
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
48
|
+
value: function (options) {
|
|
50
49
|
var controller = _CoreManager.default.getConfigController();
|
|
51
50
|
return controller.get(options);
|
|
52
51
|
}
|
|
@@ -110,8 +109,7 @@ var DefaultController = {
|
|
|
110
109
|
return config;
|
|
111
110
|
});
|
|
112
111
|
},
|
|
113
|
-
get: function () {
|
|
114
|
-
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
112
|
+
get: function (options) {
|
|
115
113
|
var RESTController = _CoreManager.default.getRESTController();
|
|
116
114
|
return RESTController.request('GET', 'config', {}, options).then(function (response) {
|
|
117
115
|
if (!response || !response.params) {
|
|
@@ -16,8 +16,8 @@ var LiveQuery = function () {
|
|
|
16
16
|
function LiveQuery() {
|
|
17
17
|
var _this = this;
|
|
18
18
|
(0, _classCallCheck2.default)(this, LiveQuery);
|
|
19
|
-
var
|
|
20
|
-
this.emitter = new
|
|
19
|
+
var Emitter = _CoreManager.default.getEventEmitter();
|
|
20
|
+
this.emitter = new Emitter();
|
|
21
21
|
this.on = function (eventName, listener) {
|
|
22
22
|
return _this.emitter.on(eventName, listener);
|
|
23
23
|
};
|
|
@@ -740,9 +740,9 @@ var ParseObject = function () {
|
|
|
740
740
|
if (Object.hasOwn(attrs, 'ACL') && !(attrs.ACL instanceof _ParseACL.default)) {
|
|
741
741
|
return new _ParseError.default(_ParseError.default.OTHER_CAUSE, 'ACL must be a Parse ACL.');
|
|
742
742
|
}
|
|
743
|
-
for (var
|
|
744
|
-
if (!/^[A-Za-
|
|
745
|
-
return new _ParseError.default(_ParseError.default.INVALID_KEY_NAME, `Invalid key name:
|
|
743
|
+
for (var _key in attrs) {
|
|
744
|
+
if (!/^[A-Za-z_][0-9A-Za-z_.]*$/.test(_key)) {
|
|
745
|
+
return new _ParseError.default(_ParseError.default.INVALID_KEY_NAME, `Invalid key name: ${_key}`);
|
|
746
746
|
}
|
|
747
747
|
}
|
|
748
748
|
return false;
|
|
@@ -765,14 +765,14 @@ var ParseObject = function () {
|
|
|
765
765
|
key: "revert",
|
|
766
766
|
value: function () {
|
|
767
767
|
var keysToRevert;
|
|
768
|
-
for (var _len = arguments.length, keys = new Array(_len),
|
|
769
|
-
keys[
|
|
768
|
+
for (var _len = arguments.length, keys = new Array(_len), _key2 = 0; _key2 < _len; _key2++) {
|
|
769
|
+
keys[_key2] = arguments[_key2];
|
|
770
770
|
}
|
|
771
771
|
if (keys.length) {
|
|
772
772
|
keysToRevert = [];
|
|
773
|
-
for (var
|
|
774
|
-
if (typeof
|
|
775
|
-
keysToRevert.push(
|
|
773
|
+
for (var _key3 of keys) {
|
|
774
|
+
if (typeof _key3 === 'string') {
|
|
775
|
+
keysToRevert.push(_key3);
|
|
776
776
|
} else {
|
|
777
777
|
throw new Error('Parse.Object#revert expects either no, or a list of string, arguments.');
|
|
778
778
|
}
|
|
@@ -835,7 +835,6 @@ var ParseObject = function () {
|
|
|
835
835
|
key: "save",
|
|
836
836
|
value: function () {
|
|
837
837
|
var _save = (0, _asyncToGenerator2.default)(function* (arg1, arg2, arg3) {
|
|
838
|
-
var _this = this;
|
|
839
838
|
var attrs;
|
|
840
839
|
var options;
|
|
841
840
|
if (typeof arg1 === 'object' || typeof arg1 === 'undefined') {
|
|
@@ -871,9 +870,8 @@ var ParseObject = function () {
|
|
|
871
870
|
return savedOjbects.pop();
|
|
872
871
|
});
|
|
873
872
|
}
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
});
|
|
873
|
+
yield controller.save(unsaved, saveOptions);
|
|
874
|
+
return controller.save(this, saveOptions);
|
|
877
875
|
});
|
|
878
876
|
function save() {
|
|
879
877
|
return _save.apply(this, arguments);
|
|
@@ -981,6 +979,9 @@ var ParseObject = function () {
|
|
|
981
979
|
if (hasOwn(options, 'useMasterKey')) {
|
|
982
980
|
requestOptions.useMasterKey = !!options.useMasterKey;
|
|
983
981
|
}
|
|
982
|
+
if (hasOwn(options, 'useMaintenanceKey')) {
|
|
983
|
+
requestOptions.useMaintenanceKey = !!options.useMaintenanceKey;
|
|
984
|
+
}
|
|
984
985
|
if (hasOwn(options, 'sessionToken') && typeof options.sessionToken === 'string') {
|
|
985
986
|
requestOptions.sessionToken = options.sessionToken;
|
|
986
987
|
}
|
|
@@ -1015,8 +1016,7 @@ var ParseObject = function () {
|
|
|
1015
1016
|
}
|
|
1016
1017
|
}, {
|
|
1017
1018
|
key: "fetchAll",
|
|
1018
|
-
value: function (list) {
|
|
1019
|
-
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1019
|
+
value: function (list, options) {
|
|
1020
1020
|
var fetchOptions = ParseObject._getRequestOptions(options);
|
|
1021
1021
|
return _CoreManager.default.getObjectController().fetch(list, true, fetchOptions);
|
|
1022
1022
|
}
|
|
@@ -1059,15 +1059,13 @@ var ParseObject = function () {
|
|
|
1059
1059
|
}
|
|
1060
1060
|
}, {
|
|
1061
1061
|
key: "destroyAll",
|
|
1062
|
-
value: function (list) {
|
|
1063
|
-
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1062
|
+
value: function (list, options) {
|
|
1064
1063
|
var destroyOptions = ParseObject._getRequestOptions(options);
|
|
1065
1064
|
return _CoreManager.default.getObjectController().destroy(list, destroyOptions);
|
|
1066
1065
|
}
|
|
1067
1066
|
}, {
|
|
1068
1067
|
key: "saveAll",
|
|
1069
|
-
value: function (list) {
|
|
1070
|
-
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1068
|
+
value: function (list, options) {
|
|
1071
1069
|
var saveOptions = ParseObject._getRequestOptions(options);
|
|
1072
1070
|
return _CoreManager.default.getObjectController().save(list, saveOptions);
|
|
1073
1071
|
}
|
|
@@ -734,13 +734,13 @@ var ParseQuery = function () {
|
|
|
734
734
|
}
|
|
735
735
|
}, {
|
|
736
736
|
key: "containedIn",
|
|
737
|
-
value: function (key,
|
|
738
|
-
return this._addCondition(key, '$in',
|
|
737
|
+
value: function (key, values) {
|
|
738
|
+
return this._addCondition(key, '$in', values);
|
|
739
739
|
}
|
|
740
740
|
}, {
|
|
741
741
|
key: "notContainedIn",
|
|
742
|
-
value: function (key,
|
|
743
|
-
return this._addCondition(key, '$nin',
|
|
742
|
+
value: function (key, values) {
|
|
743
|
+
return this._addCondition(key, '$nin', values);
|
|
744
744
|
}
|
|
745
745
|
}, {
|
|
746
746
|
key: "containedBy",
|
|
@@ -840,8 +840,7 @@ var ParseQuery = function () {
|
|
|
840
840
|
}
|
|
841
841
|
}, {
|
|
842
842
|
key: "fullText",
|
|
843
|
-
value: function (key, value) {
|
|
844
|
-
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
843
|
+
value: function (key, value, options) {
|
|
845
844
|
options = options || {};
|
|
846
845
|
if (!key) {
|
|
847
846
|
throw new Error('A key is required.');
|
|
@@ -95,9 +95,9 @@ var ParseSchema = function () {
|
|
|
95
95
|
}
|
|
96
96
|
}, {
|
|
97
97
|
key: "addField",
|
|
98
|
-
value: function (name, type) {
|
|
99
|
-
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
98
|
+
value: function (name, type, options) {
|
|
100
99
|
type = type || 'String';
|
|
100
|
+
options = options || {};
|
|
101
101
|
if (!name) {
|
|
102
102
|
throw new Error('field name may not be null.');
|
|
103
103
|
}
|
|
@@ -202,8 +202,7 @@ var ParseSchema = function () {
|
|
|
202
202
|
}
|
|
203
203
|
}, {
|
|
204
204
|
key: "addPointer",
|
|
205
|
-
value: function (name, targetClass) {
|
|
206
|
-
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
205
|
+
value: function (name, targetClass, options) {
|
|
207
206
|
if (!name) {
|
|
208
207
|
throw new Error('field name may not be null.');
|
|
209
208
|
}
|
|
@@ -214,10 +213,10 @@ var ParseSchema = function () {
|
|
|
214
213
|
type: 'Pointer',
|
|
215
214
|
targetClass: targetClass
|
|
216
215
|
};
|
|
217
|
-
if (typeof options.required === 'boolean') {
|
|
216
|
+
if (typeof (options == null ? void 0 : options.required) === 'boolean') {
|
|
218
217
|
fieldOptions.required = options.required;
|
|
219
218
|
}
|
|
220
|
-
if (options.defaultValue !== undefined) {
|
|
219
|
+
if ((options == null ? void 0 : options.defaultValue) !== undefined) {
|
|
221
220
|
fieldOptions.defaultValue = options.defaultValue;
|
|
222
221
|
if (options.defaultValue instanceof _ParseObject.default) {
|
|
223
222
|
fieldOptions.defaultValue = options.defaultValue.toPointer();
|
|
@@ -533,8 +533,7 @@ var ParseUser = function (_ParseObject) {
|
|
|
533
533
|
}
|
|
534
534
|
}, {
|
|
535
535
|
key: "me",
|
|
536
|
-
value: function (sessionToken) {
|
|
537
|
-
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
536
|
+
value: function (sessionToken, options) {
|
|
538
537
|
var controller = _CoreManager.default.getUserController();
|
|
539
538
|
var meOptions = _ParseObject2.default._getRequestOptions(options);
|
|
540
539
|
meOptions.sessionToken = sessionToken;
|
|
@@ -556,8 +555,7 @@ var ParseUser = function (_ParseObject) {
|
|
|
556
555
|
}
|
|
557
556
|
}, {
|
|
558
557
|
key: "logOut",
|
|
559
|
-
value: function () {
|
|
560
|
-
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
558
|
+
value: function (options) {
|
|
561
559
|
var controller = _CoreManager.default.getUserController();
|
|
562
560
|
return controller.logOut(options);
|
|
563
561
|
}
|
|
@@ -832,7 +830,7 @@ var DefaultController = {
|
|
|
832
830
|
},
|
|
833
831
|
logOut: function (options) {
|
|
834
832
|
var RESTController = _CoreManager.default.getRESTController();
|
|
835
|
-
if (options.sessionToken) {
|
|
833
|
+
if (options != null && options.sessionToken) {
|
|
836
834
|
return RESTController.request('POST', 'logout', {}, options);
|
|
837
835
|
}
|
|
838
836
|
return DefaultController.currentUserAsync().then(function (currentUser) {
|
|
@@ -209,6 +209,9 @@ var RESTController = {
|
|
|
209
209
|
throw new Error('Cannot use the Master Key, it has not been provided.');
|
|
210
210
|
}
|
|
211
211
|
}
|
|
212
|
+
if (options.useMaintenanceKey) {
|
|
213
|
+
payload._MaintenanceKey = _CoreManager.default.get('MAINTENANCE_KEY');
|
|
214
|
+
}
|
|
212
215
|
if (_CoreManager.default.get('FORCE_REVOCABLE_SESSION')) {
|
|
213
216
|
payload._RevocableSession = '1';
|
|
214
217
|
}
|
package/lib/weapp/Cloud.js
CHANGED
|
@@ -48,6 +48,7 @@ var _ParseObject = _interopRequireDefault(require("./ParseObject"));
|
|
|
48
48
|
* @returns {Promise} A promise that will be resolved with the result
|
|
49
49
|
* of the function.
|
|
50
50
|
*/
|
|
51
|
+
|
|
51
52
|
function run(name, data, options) {
|
|
52
53
|
if (typeof name !== 'string' || name.length === 0) {
|
|
53
54
|
throw new TypeError('Cloud function name must be a string.');
|
package/lib/weapp/CoreManager.js
CHANGED
|
@@ -19,9 +19,10 @@ const config = {
|
|
|
19
19
|
SERVER_AUTH_TOKEN: null,
|
|
20
20
|
LIVEQUERY_SERVER_URL: null,
|
|
21
21
|
ENCRYPTED_KEY: null,
|
|
22
|
-
VERSION: 'js' + "6.0.
|
|
22
|
+
VERSION: 'js' + "6.1.0-alpha.2",
|
|
23
23
|
APPLICATION_ID: null,
|
|
24
24
|
JAVASCRIPT_KEY: null,
|
|
25
|
+
MAINTENANCE_KEY: null,
|
|
25
26
|
MASTER_KEY: null,
|
|
26
27
|
USE_MASTER_KEY: false,
|
|
27
28
|
PERFORM_USER_REWRITE: true,
|