parse 4.1.0-alpha.4 → 4.1.0
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/dist/parse.js +58 -253
- package/dist/parse.min.js +2 -2
- package/dist/parse.weapp.js +58 -253
- package/dist/parse.weapp.min.js +2 -2
- package/lib/browser/AnonymousUtils.js +1 -1
- package/lib/browser/Cloud.js +2 -1
- package/lib/browser/CoreManager.js +1 -1
- package/lib/browser/EventuallyQueue.js +1 -13
- package/lib/browser/LiveQueryClient.js +4 -8
- package/lib/browser/LocalDatastore.js +1 -3
- package/lib/browser/LocalDatastoreController.js +1 -3
- package/lib/browser/ObjectStateMutations.js +1 -14
- package/lib/browser/ParseACL.js +1 -2
- package/lib/browser/ParseCLP.js +1 -6
- package/lib/browser/ParseConfig.js +0 -1
- package/lib/browser/ParseFile.js +1 -5
- package/lib/browser/ParseInstallation.js +1 -4
- package/lib/browser/ParseObject.js +7 -10
- package/lib/browser/ParseOp.js +1 -3
- package/lib/browser/ParseQuery.js +24 -79
- package/lib/browser/ParseRole.js +1 -5
- package/lib/browser/ParseSchema.js +1 -1
- package/lib/browser/ParseSession.js +1 -5
- package/lib/browser/ParseUser.js +1 -42
- package/lib/browser/Push.js +2 -8
- package/lib/browser/RESTController.js +0 -20
- package/lib/browser/SingleInstanceStateController.js +1 -6
- package/lib/browser/TaskQueue.js +0 -4
- package/lib/browser/UniqueInstanceStateController.js +1 -3
- package/lib/browser/unsavedChildren.js +1 -4
- package/lib/node/AnonymousUtils.js +1 -1
- package/lib/node/Cloud.js +2 -1
- package/lib/node/CoreManager.js +1 -1
- package/lib/node/EventuallyQueue.js +1 -13
- package/lib/node/LiveQueryClient.js +2 -5
- package/lib/node/LocalDatastore.js +1 -1
- package/lib/node/ObjectStateMutations.js +1 -11
- package/lib/node/ParseACL.js +1 -2
- package/lib/node/ParseCLP.js +1 -3
- package/lib/node/ParseConfig.js +2 -1
- package/lib/node/ParseFile.js +1 -2
- package/lib/node/ParseInstallation.js +1 -1
- package/lib/node/ParseObject.js +1 -2
- package/lib/node/ParseQuery.js +1 -50
- package/lib/node/ParseRole.js +1 -2
- package/lib/node/ParseSchema.js +1 -1
- package/lib/node/ParseSession.js +1 -2
- package/lib/node/ParseUser.js +1 -37
- package/lib/node/Push.js +2 -8
- package/lib/node/RESTController.js +0 -20
- package/lib/node/SingleInstanceStateController.js +1 -6
- package/lib/node/TaskQueue.js +1 -4
- package/lib/node/UniqueInstanceStateController.js +1 -3
- package/lib/node/unsavedChildren.js +1 -4
- package/lib/react-native/CoreManager.js +1 -1
- package/lib/react-native/LiveQueryClient.js +3 -7
- package/lib/react-native/ParseCLP.js +2 -2
- package/lib/react-native/ParseFile.js +0 -1
- package/lib/react-native/ParseQuery.js +11 -34
- package/lib/react-native/ParseUser.js +0 -25
- package/lib/weapp/AnonymousUtils.js +1 -1
- package/lib/weapp/Cloud.js +2 -1
- package/lib/weapp/CoreManager.js +1 -1
- package/lib/weapp/EventuallyQueue.js +1 -13
- package/lib/weapp/LiveQueryClient.js +4 -8
- package/lib/weapp/LocalDatastore.js +1 -3
- package/lib/weapp/LocalDatastoreController.js +1 -3
- package/lib/weapp/ObjectStateMutations.js +1 -14
- package/lib/weapp/ParseACL.js +1 -2
- package/lib/weapp/ParseCLP.js +1 -6
- package/lib/weapp/ParseConfig.js +0 -1
- package/lib/weapp/ParseFile.js +1 -5
- package/lib/weapp/ParseInstallation.js +1 -4
- package/lib/weapp/ParseObject.js +7 -10
- package/lib/weapp/ParseOp.js +1 -3
- package/lib/weapp/ParseQuery.js +24 -79
- package/lib/weapp/ParseRole.js +1 -5
- package/lib/weapp/ParseSchema.js +1 -1
- package/lib/weapp/ParseSession.js +1 -5
- package/lib/weapp/ParseUser.js +1 -42
- package/lib/weapp/Push.js +2 -8
- package/lib/weapp/RESTController.js +0 -20
- package/lib/weapp/SingleInstanceStateController.js +1 -6
- package/lib/weapp/TaskQueue.js +0 -4
- package/lib/weapp/UniqueInstanceStateController.js +1 -3
- package/lib/weapp/unsavedChildren.js +1 -4
- package/package.json +18 -18
|
@@ -131,7 +131,6 @@ var ParseQuery = function () {
|
|
|
131
131
|
throw new TypeError('A ParseQuery must be constructed with a ParseObject or class name.');
|
|
132
132
|
}
|
|
133
133
|
this._where = {};
|
|
134
|
-
this._watch = [];
|
|
135
134
|
this._include = [];
|
|
136
135
|
this._exclude = [];
|
|
137
136
|
this._count = false;
|
|
@@ -263,9 +262,6 @@ var ParseQuery = function () {
|
|
|
263
262
|
var params = {
|
|
264
263
|
where: this._where
|
|
265
264
|
};
|
|
266
|
-
if (this._watch.length) {
|
|
267
|
-
params.watch = this._watch.join(',');
|
|
268
|
-
}
|
|
269
265
|
if (this._include.length) {
|
|
270
266
|
params.include = this._include.join(',');
|
|
271
267
|
}
|
|
@@ -313,9 +309,6 @@ var ParseQuery = function () {
|
|
|
313
309
|
if (json.where) {
|
|
314
310
|
this._where = json.where;
|
|
315
311
|
}
|
|
316
|
-
if (json.watch) {
|
|
317
|
-
this._watch = json.watch.split(',');
|
|
318
|
-
}
|
|
319
312
|
if (json.include) {
|
|
320
313
|
this._include = json.include.split(',');
|
|
321
314
|
}
|
|
@@ -1151,22 +1144,6 @@ var ParseQuery = function () {
|
|
|
1151
1144
|
});
|
|
1152
1145
|
return this;
|
|
1153
1146
|
}
|
|
1154
|
-
}, {
|
|
1155
|
-
key: "watch",
|
|
1156
|
-
value: function () {
|
|
1157
|
-
var _this14 = this;
|
|
1158
|
-
for (var _len8 = arguments.length, keys = new Array(_len8), _key12 = 0; _key12 < _len8; _key12++) {
|
|
1159
|
-
keys[_key12] = arguments[_key12];
|
|
1160
|
-
}
|
|
1161
|
-
keys.forEach(function (key) {
|
|
1162
|
-
if (Array.isArray(key)) {
|
|
1163
|
-
_this14._watch = _this14._watch.concat(key);
|
|
1164
|
-
} else {
|
|
1165
|
-
_this14._watch.push(key);
|
|
1166
|
-
}
|
|
1167
|
-
});
|
|
1168
|
-
return this;
|
|
1169
|
-
}
|
|
1170
1147
|
}, {
|
|
1171
1148
|
key: "readPreference",
|
|
1172
1149
|
value: function (_readPreference, includeReadPreference, subqueryReadPreference) {
|
|
@@ -1227,7 +1204,7 @@ var ParseQuery = function () {
|
|
|
1227
1204
|
}, {
|
|
1228
1205
|
key: "cancel",
|
|
1229
1206
|
value: function () {
|
|
1230
|
-
var
|
|
1207
|
+
var _this14 = this;
|
|
1231
1208
|
if (this._xhrRequest.task && typeof this._xhrRequest.task.abort === 'function') {
|
|
1232
1209
|
this._xhrRequest.task._aborted = true;
|
|
1233
1210
|
this._xhrRequest.task.abort();
|
|
@@ -1236,16 +1213,16 @@ var ParseQuery = function () {
|
|
|
1236
1213
|
return this;
|
|
1237
1214
|
}
|
|
1238
1215
|
return this._xhrRequest.onchange = function () {
|
|
1239
|
-
return
|
|
1216
|
+
return _this14.cancel();
|
|
1240
1217
|
};
|
|
1241
1218
|
}
|
|
1242
1219
|
}, {
|
|
1243
1220
|
key: "_setRequestTask",
|
|
1244
1221
|
value: function (options) {
|
|
1245
|
-
var
|
|
1222
|
+
var _this15 = this;
|
|
1246
1223
|
options.requestTask = function (task) {
|
|
1247
|
-
|
|
1248
|
-
|
|
1224
|
+
_this15._xhrRequest.task = task;
|
|
1225
|
+
_this15._xhrRequest.onchange();
|
|
1249
1226
|
};
|
|
1250
1227
|
}
|
|
1251
1228
|
}], [{
|
|
@@ -1257,8 +1234,8 @@ var ParseQuery = function () {
|
|
|
1257
1234
|
}, {
|
|
1258
1235
|
key: "or",
|
|
1259
1236
|
value: function () {
|
|
1260
|
-
for (var
|
|
1261
|
-
queries[
|
|
1237
|
+
for (var _len8 = arguments.length, queries = new Array(_len8), _key12 = 0; _key12 < _len8; _key12++) {
|
|
1238
|
+
queries[_key12] = arguments[_key12];
|
|
1262
1239
|
}
|
|
1263
1240
|
var className = _getClassNameFromQueries(queries);
|
|
1264
1241
|
var query = new ParseQuery(className);
|
|
@@ -1268,8 +1245,8 @@ var ParseQuery = function () {
|
|
|
1268
1245
|
}, {
|
|
1269
1246
|
key: "and",
|
|
1270
1247
|
value: function () {
|
|
1271
|
-
for (var
|
|
1272
|
-
queries[
|
|
1248
|
+
for (var _len9 = arguments.length, queries = new Array(_len9), _key13 = 0; _key13 < _len9; _key13++) {
|
|
1249
|
+
queries[_key13] = arguments[_key13];
|
|
1273
1250
|
}
|
|
1274
1251
|
var className = _getClassNameFromQueries(queries);
|
|
1275
1252
|
var query = new ParseQuery(className);
|
|
@@ -1279,8 +1256,8 @@ var ParseQuery = function () {
|
|
|
1279
1256
|
}, {
|
|
1280
1257
|
key: "nor",
|
|
1281
1258
|
value: function () {
|
|
1282
|
-
for (var
|
|
1283
|
-
queries[
|
|
1259
|
+
for (var _len10 = arguments.length, queries = new Array(_len10), _key14 = 0; _key14 < _len10; _key14++) {
|
|
1260
|
+
queries[_key14] = arguments[_key14];
|
|
1284
1261
|
}
|
|
1285
1262
|
var className = _getClassNameFromQueries(queries);
|
|
1286
1263
|
var query = new ParseQuery(className);
|
|
@@ -500,16 +500,6 @@ var ParseUser = function (_ParseObject) {
|
|
|
500
500
|
});
|
|
501
501
|
return user.logIn(options);
|
|
502
502
|
}
|
|
503
|
-
}, {
|
|
504
|
-
key: "loginAs",
|
|
505
|
-
value: function (userId) {
|
|
506
|
-
if (!userId) {
|
|
507
|
-
throw new _ParseError.default(_ParseError.default.USERNAME_MISSING, 'Cannot log in as user with an empty user id');
|
|
508
|
-
}
|
|
509
|
-
var controller = _CoreManager.default.getUserController();
|
|
510
|
-
var user = new this();
|
|
511
|
-
return controller.loginAs(user, userId);
|
|
512
|
-
}
|
|
513
503
|
}, {
|
|
514
504
|
key: "become",
|
|
515
505
|
value: function (sessionToken, options) {
|
|
@@ -803,21 +793,6 @@ var DefaultController = {
|
|
|
803
793
|
return DefaultController.setCurrentUser(user);
|
|
804
794
|
});
|
|
805
795
|
},
|
|
806
|
-
loginAs: function (user, userId) {
|
|
807
|
-
var RESTController = _CoreManager.default.getRESTController();
|
|
808
|
-
return RESTController.request('POST', 'loginAs', {
|
|
809
|
-
userId: userId
|
|
810
|
-
}, {
|
|
811
|
-
useMasterKey: true
|
|
812
|
-
}).then(function (response) {
|
|
813
|
-
user._finishFetch(response);
|
|
814
|
-
user._setExisted(true);
|
|
815
|
-
if (!canUseCurrentUser) {
|
|
816
|
-
return Promise.resolve(user);
|
|
817
|
-
}
|
|
818
|
-
return DefaultController.setCurrentUser(user);
|
|
819
|
-
});
|
|
820
|
-
},
|
|
821
796
|
become: function (user, options) {
|
|
822
797
|
var RESTController = _CoreManager.default.getRESTController();
|
|
823
798
|
return RESTController.request('GET', 'users/me', {}, options).then(function (response) {
|
package/lib/weapp/Cloud.js
CHANGED
|
@@ -21,7 +21,7 @@ var _ParseObject = _interopRequireDefault(require("./ParseObject"));
|
|
|
21
21
|
/**
|
|
22
22
|
* @flow
|
|
23
23
|
*/
|
|
24
|
-
|
|
24
|
+
|
|
25
25
|
/**
|
|
26
26
|
* Contains functions for calling and declaring
|
|
27
27
|
* <a href="/docs/cloud_code_guide#functions">cloud functions</a>.
|
|
@@ -33,6 +33,7 @@ var _ParseObject = _interopRequireDefault(require("./ParseObject"));
|
|
|
33
33
|
* @static
|
|
34
34
|
* @hideconstructor
|
|
35
35
|
*/
|
|
36
|
+
|
|
36
37
|
/**
|
|
37
38
|
* Makes a call to a cloud function.
|
|
38
39
|
*
|
package/lib/weapp/CoreManager.js
CHANGED
|
@@ -182,7 +182,7 @@ var config /*: Config & { [key: string]: mixed }*/ = {
|
|
|
182
182
|
SERVER_AUTH_TOKEN: null,
|
|
183
183
|
LIVEQUERY_SERVER_URL: null,
|
|
184
184
|
ENCRYPTED_KEY: null,
|
|
185
|
-
VERSION: 'js' + "4.1.0
|
|
185
|
+
VERSION: 'js' + "4.1.0",
|
|
186
186
|
APPLICATION_ID: null,
|
|
187
187
|
JAVASCRIPT_KEY: null,
|
|
188
188
|
MASTER_KEY: null,
|
|
@@ -18,19 +18,7 @@ var _Storage = _interopRequireDefault(require("./Storage"));
|
|
|
18
18
|
*
|
|
19
19
|
* @flow
|
|
20
20
|
*/
|
|
21
|
-
|
|
22
|
-
/*:: import type { RequestOptions } from './RESTController';*/
|
|
23
|
-
/*:: type QueueObject = {
|
|
24
|
-
queueId: string,
|
|
25
|
-
action: string,
|
|
26
|
-
object: ParseObject,
|
|
27
|
-
serverOptions: SaveOptions | RequestOptions,
|
|
28
|
-
id: string,
|
|
29
|
-
className: string,
|
|
30
|
-
hash: string,
|
|
31
|
-
createdAt: Date,
|
|
32
|
-
};*/
|
|
33
|
-
/*:: type Queue = Array<QueueObject>;*/
|
|
21
|
+
|
|
34
22
|
var QUEUE_KEY = 'Parse/Eventually/Queue';
|
|
35
23
|
var queueCache = [];
|
|
36
24
|
var dirtyCache = true;
|
|
@@ -123,7 +123,7 @@ function _isNativeReflectConstruct() {
|
|
|
123
123
|
} catch (e) {
|
|
124
124
|
return false;
|
|
125
125
|
}
|
|
126
|
-
}
|
|
126
|
+
}
|
|
127
127
|
// The LiveQuery client inner state
|
|
128
128
|
var CLIENT_STATE = {
|
|
129
129
|
INITIALIZED: 'initialized',
|
|
@@ -303,25 +303,21 @@ var LiveQueryClient = /*#__PURE__*/function (_EventEmitter) {
|
|
|
303
303
|
}, {
|
|
304
304
|
key: "subscribe",
|
|
305
305
|
value: function (query /*: Object*/, sessionToken /*: ?string*/) /*: LiveQuerySubscription*/{
|
|
306
|
-
var
|
|
307
|
-
_queryJSON$watch,
|
|
308
|
-
_this2 = this;
|
|
306
|
+
var _this2 = this;
|
|
309
307
|
if (!query) {
|
|
310
308
|
return;
|
|
311
309
|
}
|
|
312
310
|
var className = query.className;
|
|
313
311
|
var queryJSON = query.toJSON();
|
|
314
312
|
var where = queryJSON.where;
|
|
315
|
-
var fields = (
|
|
316
|
-
var watch = (_queryJSON$watch = queryJSON.watch) === null || _queryJSON$watch === void 0 ? void 0 : _queryJSON$watch.split(',');
|
|
313
|
+
var fields = (0, _keys.default)(queryJSON) ? (0, _keys.default)(queryJSON).split(',') : undefined;
|
|
317
314
|
var subscribeRequest = {
|
|
318
315
|
op: OP_TYPES.SUBSCRIBE,
|
|
319
316
|
requestId: this.requestId,
|
|
320
317
|
query: {
|
|
321
318
|
className: className,
|
|
322
319
|
where: where,
|
|
323
|
-
fields: fields
|
|
324
|
-
watch: watch
|
|
320
|
+
fields: fields
|
|
325
321
|
}
|
|
326
322
|
};
|
|
327
323
|
if (sessionToken) {
|
|
@@ -89,9 +89,7 @@ function _arrayLikeToArray(arr, len) {
|
|
|
89
89
|
if (len == null || len > arr.length) len = arr.length;
|
|
90
90
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
91
91
|
return arr2;
|
|
92
|
-
}
|
|
93
|
-
* @flow
|
|
94
|
-
*/ /*:: import type ParseObject from './ParseObject';*/
|
|
92
|
+
}
|
|
95
93
|
/**
|
|
96
94
|
* Provides a local datastore which can be used to store and retrieve <code>Parse.Object</code>. <br />
|
|
97
95
|
* To enable this functionality, call <code>Parse.enableLocalDatastore()</code>.
|
|
@@ -78,9 +78,7 @@ function _arrayLikeToArray(arr, len) {
|
|
|
78
78
|
if (len == null || len > arr.length) len = arr.length;
|
|
79
79
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
80
80
|
return arr2;
|
|
81
|
-
}
|
|
82
|
-
* @flow
|
|
83
|
-
*/
|
|
81
|
+
}
|
|
84
82
|
var LocalDatastoreController = {
|
|
85
83
|
fromPinWithName: function (name /*: string*/) /*: Array<Object>*/{
|
|
86
84
|
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
@@ -52,20 +52,7 @@ function _objectSpread(target) {
|
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
54
|
return target;
|
|
55
|
-
}
|
|
56
|
-
* @flow
|
|
57
|
-
*/
|
|
58
|
-
/*:: import type { Op } from './ParseOp';*/
|
|
59
|
-
/*:: export type AttributeMap = { [attr: string]: any };*/
|
|
60
|
-
/*:: export type OpsMap = { [attr: string]: Op };*/
|
|
61
|
-
/*:: export type ObjectCache = { [attr: string]: string };*/
|
|
62
|
-
/*:: export type State = {
|
|
63
|
-
serverData: AttributeMap,
|
|
64
|
-
pendingOps: Array<OpsMap>,
|
|
65
|
-
objectCache: ObjectCache,
|
|
66
|
-
tasks: TaskQueue,
|
|
67
|
-
existed: boolean,
|
|
68
|
-
};*/
|
|
55
|
+
}
|
|
69
56
|
function defaultState() /*: State*/{
|
|
70
57
|
return {
|
|
71
58
|
serverData: {},
|
package/lib/weapp/ParseACL.js
CHANGED
package/lib/weapp/ParseCLP.js
CHANGED
|
@@ -119,12 +119,7 @@ function _arrayLikeToArray(arr, len) {
|
|
|
119
119
|
if (len == null || len > arr.length) len = arr.length;
|
|
120
120
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
121
121
|
return arr2;
|
|
122
|
-
}
|
|
123
|
-
* @flow
|
|
124
|
-
*/
|
|
125
|
-
/*:: type Entity = Entity;*/
|
|
126
|
-
/*:: type UsersMap = { [userId: string]: boolean | any };*/
|
|
127
|
-
/*:: export type PermissionsMap = { [permission: string]: UsersMap };*/
|
|
122
|
+
}
|
|
128
123
|
var PUBLIC_KEY = '*';
|
|
129
124
|
var VALID_PERMISSIONS /*: Map<string, UsersMap>*/ = new _map.default(
|
|
130
125
|
/*:: <string, UsersMap>*/
|
package/lib/weapp/ParseConfig.js
CHANGED
|
@@ -21,7 +21,6 @@ var _Storage = _interopRequireDefault(require("./Storage"));
|
|
|
21
21
|
/**
|
|
22
22
|
* @flow
|
|
23
23
|
*/
|
|
24
|
-
/*:: import type { RequestOptions } from './RESTController';*/
|
|
25
24
|
/**
|
|
26
25
|
* Parse.Config is a local representation of configuration data that
|
|
27
26
|
* can be set from the Parse dashboard.
|
package/lib/weapp/ParseFile.js
CHANGED
|
@@ -48,10 +48,7 @@ function _objectSpread(target) {
|
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
50
|
return target;
|
|
51
|
-
}
|
|
52
|
-
* @flow
|
|
53
|
-
*/ /* global XMLHttpRequest, Blob */
|
|
54
|
-
/*:: import type { FullOptions } from './RESTController';*/
|
|
51
|
+
}
|
|
55
52
|
var ParseError = require('./ParseError').default;
|
|
56
53
|
var XHR = null;
|
|
57
54
|
if (typeof XMLHttpRequest !== 'undefined') {
|
|
@@ -374,7 +371,6 @@ var ParseFile = /*#__PURE__*/function () {
|
|
|
374
371
|
key: "cancel",
|
|
375
372
|
value: function () {
|
|
376
373
|
if (this._requestTask && typeof this._requestTask.abort === 'function') {
|
|
377
|
-
this._requestTask._aborted = true;
|
|
378
374
|
this._requestTask.abort();
|
|
379
375
|
}
|
|
380
376
|
this._requestTask = null;
|
|
@@ -38,10 +38,7 @@ function _isNativeReflectConstruct() {
|
|
|
38
38
|
} catch (e) {
|
|
39
39
|
return false;
|
|
40
40
|
}
|
|
41
|
-
}
|
|
42
|
-
* @flow
|
|
43
|
-
*/
|
|
44
|
-
/*:: import type { AttributeMap } from './ObjectStateMutations';*/
|
|
41
|
+
}
|
|
45
42
|
var Installation = /*#__PURE__*/function (_ParseObject) {
|
|
46
43
|
(0, _inherits2.default)(Installation, _ParseObject);
|
|
47
44
|
var _super = _createSuper(Installation);
|
package/lib/weapp/ParseObject.js
CHANGED
|
@@ -184,11 +184,7 @@ function _objectSpread(target) {
|
|
|
184
184
|
});
|
|
185
185
|
}
|
|
186
186
|
return target;
|
|
187
|
-
}
|
|
188
|
-
* @flow
|
|
189
|
-
*/
|
|
190
|
-
/*:: import type { AttributeMap, OpsMap } from './ObjectStateMutations';*/
|
|
191
|
-
/*:: import type { RequestOptions, FullOptions } from './RESTController';*/
|
|
187
|
+
}
|
|
192
188
|
var uuidv4 = require('./uuid');
|
|
193
189
|
/*:: export type Pointer = {
|
|
194
190
|
__type: string,
|
|
@@ -254,11 +250,6 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
254
250
|
*/
|
|
255
251
|
function ParseObject(className /*: ?string | { className: string, [attr: string]: mixed }*/, attributes /*:: ?: { [attr: string]: mixed }*/, options /*:: ?: { ignoreValidation: boolean }*/) {
|
|
256
252
|
(0, _classCallCheck2.default)(this, ParseObject);
|
|
257
|
-
/**
|
|
258
|
-
* The ID of this object, unique within its class.
|
|
259
|
-
*
|
|
260
|
-
* @property {string} id
|
|
261
|
-
*/
|
|
262
253
|
(0, _defineProperty2.default)(this, "id", void 0);
|
|
263
254
|
(0, _defineProperty2.default)(this, "_localId", void 0);
|
|
264
255
|
(0, _defineProperty2.default)(this, "_objCount", void 0);
|
|
@@ -290,6 +281,12 @@ var ParseObject = /*#__PURE__*/function () {
|
|
|
290
281
|
throw new Error("Can't create an invalid Parse Object");
|
|
291
282
|
}
|
|
292
283
|
}
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* The ID of this object, unique within its class.
|
|
287
|
+
*
|
|
288
|
+
* @property {string} id
|
|
289
|
+
*/
|
|
293
290
|
(0, _createClass2.default)(ParseObject, [{
|
|
294
291
|
key: "attributes",
|
|
295
292
|
get: /* Prototype getters / setters */
|
package/lib/weapp/ParseOp.js
CHANGED
package/lib/weapp/ParseQuery.js
CHANGED
|
@@ -40,29 +40,7 @@ var _LocalDatastoreUtils = require("./LocalDatastoreUtils");
|
|
|
40
40
|
/*
|
|
41
41
|
* @flow
|
|
42
42
|
*/
|
|
43
|
-
|
|
44
|
-
/*:: import type { RequestOptions, FullOptions } from './RESTController';*/
|
|
45
|
-
/*:: type BatchOptions = FullOptions & { batchSize?: number };*/
|
|
46
|
-
/*:: export type WhereClause = {
|
|
47
|
-
[attr: string]: mixed,
|
|
48
|
-
};*/
|
|
49
|
-
/*:: export type QueryJSON = {
|
|
50
|
-
where: WhereClause,
|
|
51
|
-
watch?: string,
|
|
52
|
-
include?: string,
|
|
53
|
-
excludeKeys?: string,
|
|
54
|
-
keys?: string,
|
|
55
|
-
limit?: number,
|
|
56
|
-
skip?: number,
|
|
57
|
-
order?: string,
|
|
58
|
-
className?: string,
|
|
59
|
-
count?: number,
|
|
60
|
-
hint?: mixed,
|
|
61
|
-
explain?: boolean,
|
|
62
|
-
readPreference?: string,
|
|
63
|
-
includeReadPreference?: string,
|
|
64
|
-
subqueryReadPreference?: string,
|
|
65
|
-
};*/
|
|
43
|
+
|
|
66
44
|
/**
|
|
67
45
|
* Converts a string into a regex that matches it.
|
|
68
46
|
* Surrounding with \Q .. \E does this, we just need to escape any \E's in
|
|
@@ -237,17 +215,17 @@ function handleOfflineSort(a, b, sorts) {
|
|
|
237
215
|
* @alias Parse.Query
|
|
238
216
|
*/
|
|
239
217
|
var ParseQuery = /*#__PURE__*/function () {
|
|
218
|
+
/**
|
|
219
|
+
* @property {string} className
|
|
220
|
+
*/
|
|
221
|
+
|
|
240
222
|
/**
|
|
241
223
|
* @param {(string | Parse.Object)} objectClass An instance of a subclass of Parse.Object, or a Parse className string.
|
|
242
224
|
*/
|
|
243
225
|
function ParseQuery(objectClass /*: string | ParseObject*/) {
|
|
244
226
|
(0, _classCallCheck2.default)(this, ParseQuery);
|
|
245
|
-
/**
|
|
246
|
-
* @property {string} className
|
|
247
|
-
*/
|
|
248
227
|
(0, _defineProperty2.default)(this, "className", void 0);
|
|
249
228
|
(0, _defineProperty2.default)(this, "_where", void 0);
|
|
250
|
-
(0, _defineProperty2.default)(this, "_watch", void 0);
|
|
251
229
|
(0, _defineProperty2.default)(this, "_include", void 0);
|
|
252
230
|
(0, _defineProperty2.default)(this, "_exclude", void 0);
|
|
253
231
|
(0, _defineProperty2.default)(this, "_select", void 0);
|
|
@@ -283,7 +261,6 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
283
261
|
throw new TypeError('A ParseQuery must be constructed with a ParseObject or class name.');
|
|
284
262
|
}
|
|
285
263
|
this._where = {};
|
|
286
|
-
this._watch = [];
|
|
287
264
|
this._include = [];
|
|
288
265
|
this._exclude = [];
|
|
289
266
|
this._count = false;
|
|
@@ -476,9 +453,6 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
476
453
|
var params /*: QueryJSON*/ = {
|
|
477
454
|
where: this._where
|
|
478
455
|
};
|
|
479
|
-
if (this._watch.length) {
|
|
480
|
-
params.watch = this._watch.join(',');
|
|
481
|
-
}
|
|
482
456
|
if (this._include.length) {
|
|
483
457
|
params.include = this._include.join(',');
|
|
484
458
|
}
|
|
@@ -548,9 +522,6 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
548
522
|
if (json.where) {
|
|
549
523
|
this._where = json.where;
|
|
550
524
|
}
|
|
551
|
-
if (json.watch) {
|
|
552
|
-
this._watch = json.watch.split(',');
|
|
553
|
-
}
|
|
554
525
|
if (json.include) {
|
|
555
526
|
this._include = json.include.split(',');
|
|
556
527
|
}
|
|
@@ -2140,32 +2111,6 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
2140
2111
|
return this;
|
|
2141
2112
|
}
|
|
2142
2113
|
|
|
2143
|
-
/**
|
|
2144
|
-
* Restricts live query to trigger only for watched fields.
|
|
2145
|
-
*
|
|
2146
|
-
* Requires Parse Server 6.0.0+
|
|
2147
|
-
*
|
|
2148
|
-
* @param {...string|Array<string>} keys The name(s) of the key(s) to watch.
|
|
2149
|
-
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
2150
|
-
*/
|
|
2151
|
-
}, {
|
|
2152
|
-
key: "watch",
|
|
2153
|
-
value: function () /*: ParseQuery*/{
|
|
2154
|
-
var _this14 = this;
|
|
2155
|
-
for (var _len8 = arguments.length, keys = new Array(_len8), _key12 = 0; _key12 < _len8; _key12++) {
|
|
2156
|
-
keys[_key12] = arguments[_key12];
|
|
2157
|
-
}
|
|
2158
|
-
(0, _forEach.default)(keys).call(keys, function (key) {
|
|
2159
|
-
if ((0, _isArray.default)(key)) {
|
|
2160
|
-
var _context22;
|
|
2161
|
-
_this14._watch = (0, _concat.default)(_context22 = _this14._watch).call(_context22, key);
|
|
2162
|
-
} else {
|
|
2163
|
-
_this14._watch.push(key);
|
|
2164
|
-
}
|
|
2165
|
-
});
|
|
2166
|
-
return this;
|
|
2167
|
-
}
|
|
2168
|
-
|
|
2169
2114
|
/**
|
|
2170
2115
|
* Changes the read preference that the backend will use when performing the query to the database.
|
|
2171
2116
|
*
|
|
@@ -2195,30 +2140,30 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
2195
2140
|
value: function () {
|
|
2196
2141
|
var _subscribe = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(sessionToken /*:: ?: string*/) {
|
|
2197
2142
|
var currentUser, liveQueryClient, subscription;
|
|
2198
|
-
return _regenerator.default.wrap(function (
|
|
2199
|
-
while (1) switch (
|
|
2143
|
+
return _regenerator.default.wrap(function (_context22) {
|
|
2144
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
2200
2145
|
case 0:
|
|
2201
|
-
|
|
2146
|
+
_context22.next = 2;
|
|
2202
2147
|
return _CoreManager.default.getUserController().currentUserAsync();
|
|
2203
2148
|
case 2:
|
|
2204
|
-
currentUser =
|
|
2149
|
+
currentUser = _context22.sent;
|
|
2205
2150
|
if (!sessionToken) {
|
|
2206
2151
|
sessionToken = currentUser ? currentUser.getSessionToken() : undefined;
|
|
2207
2152
|
}
|
|
2208
|
-
|
|
2153
|
+
_context22.next = 6;
|
|
2209
2154
|
return _CoreManager.default.getLiveQueryController().getDefaultLiveQueryClient();
|
|
2210
2155
|
case 6:
|
|
2211
|
-
liveQueryClient =
|
|
2156
|
+
liveQueryClient = _context22.sent;
|
|
2212
2157
|
if (liveQueryClient.shouldOpen()) {
|
|
2213
2158
|
liveQueryClient.open();
|
|
2214
2159
|
}
|
|
2215
2160
|
subscription = liveQueryClient.subscribe(this, sessionToken);
|
|
2216
|
-
return
|
|
2161
|
+
return _context22.abrupt("return", subscription.subscribePromise.then(function () {
|
|
2217
2162
|
return subscription;
|
|
2218
2163
|
}));
|
|
2219
2164
|
case 10:
|
|
2220
2165
|
case "end":
|
|
2221
|
-
return
|
|
2166
|
+
return _context22.stop();
|
|
2222
2167
|
}
|
|
2223
2168
|
}, _callee7, this);
|
|
2224
2169
|
}));
|
|
@@ -2300,7 +2245,7 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
2300
2245
|
}, {
|
|
2301
2246
|
key: "cancel",
|
|
2302
2247
|
value: function () /*: ParseQuery*/{
|
|
2303
|
-
var
|
|
2248
|
+
var _this14 = this;
|
|
2304
2249
|
if (this._xhrRequest.task && typeof this._xhrRequest.task.abort === 'function') {
|
|
2305
2250
|
this._xhrRequest.task._aborted = true;
|
|
2306
2251
|
this._xhrRequest.task.abort();
|
|
@@ -2309,16 +2254,16 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
2309
2254
|
return this;
|
|
2310
2255
|
}
|
|
2311
2256
|
return this._xhrRequest.onchange = function () {
|
|
2312
|
-
return
|
|
2257
|
+
return _this14.cancel();
|
|
2313
2258
|
};
|
|
2314
2259
|
}
|
|
2315
2260
|
}, {
|
|
2316
2261
|
key: "_setRequestTask",
|
|
2317
2262
|
value: function (options) {
|
|
2318
|
-
var
|
|
2263
|
+
var _this15 = this;
|
|
2319
2264
|
options.requestTask = function (task) {
|
|
2320
|
-
|
|
2321
|
-
|
|
2265
|
+
_this15._xhrRequest.task = task;
|
|
2266
|
+
_this15._xhrRequest.onchange();
|
|
2322
2267
|
};
|
|
2323
2268
|
}
|
|
2324
2269
|
}], [{
|
|
@@ -2330,8 +2275,8 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
2330
2275
|
}, {
|
|
2331
2276
|
key: "or",
|
|
2332
2277
|
value: function () /*: ParseQuery*/{
|
|
2333
|
-
for (var
|
|
2334
|
-
queries[
|
|
2278
|
+
for (var _len8 = arguments.length, queries = new Array(_len8), _key12 = 0; _key12 < _len8; _key12++) {
|
|
2279
|
+
queries[_key12] = arguments[_key12];
|
|
2335
2280
|
}
|
|
2336
2281
|
var className = _getClassNameFromQueries(queries);
|
|
2337
2282
|
var query = new ParseQuery(className);
|
|
@@ -2354,8 +2299,8 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
2354
2299
|
}, {
|
|
2355
2300
|
key: "and",
|
|
2356
2301
|
value: function () /*: ParseQuery*/{
|
|
2357
|
-
for (var
|
|
2358
|
-
queries[
|
|
2302
|
+
for (var _len9 = arguments.length, queries = new Array(_len9), _key13 = 0; _key13 < _len9; _key13++) {
|
|
2303
|
+
queries[_key13] = arguments[_key13];
|
|
2359
2304
|
}
|
|
2360
2305
|
var className = _getClassNameFromQueries(queries);
|
|
2361
2306
|
var query = new ParseQuery(className);
|
|
@@ -2378,8 +2323,8 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
2378
2323
|
}, {
|
|
2379
2324
|
key: "nor",
|
|
2380
2325
|
value: function () /*: ParseQuery*/{
|
|
2381
|
-
for (var
|
|
2382
|
-
queries[
|
|
2326
|
+
for (var _len10 = arguments.length, queries = new Array(_len10), _key14 = 0; _key14 < _len10; _key14++) {
|
|
2327
|
+
queries[_key14] = arguments[_key14];
|
|
2383
2328
|
}
|
|
2384
2329
|
var className = _getClassNameFromQueries(queries);
|
|
2385
2330
|
var query = new ParseQuery(className);
|
package/lib/weapp/ParseRole.js
CHANGED
|
@@ -40,11 +40,7 @@ function _isNativeReflectConstruct() {
|
|
|
40
40
|
} catch (e) {
|
|
41
41
|
return false;
|
|
42
42
|
}
|
|
43
|
-
}
|
|
44
|
-
* @flow
|
|
45
|
-
*/
|
|
46
|
-
/*:: import type { AttributeMap } from './ObjectStateMutations';*/
|
|
47
|
-
/*:: import type ParseRelation from './ParseRelation';*/
|
|
43
|
+
}
|
|
48
44
|
/**
|
|
49
45
|
* Represents a Role on the Parse server. Roles represent groupings of
|
|
50
46
|
* Users for the purposes of granting permissions (e.g. specifying an ACL
|
package/lib/weapp/ParseSchema.js
CHANGED
|
@@ -16,7 +16,7 @@ var _ParseCLP = _interopRequireDefault(require("./ParseCLP"));
|
|
|
16
16
|
/**
|
|
17
17
|
* @flow
|
|
18
18
|
*/
|
|
19
|
-
|
|
19
|
+
|
|
20
20
|
var FIELD_TYPES = ['String', 'Number', 'Boolean', 'Date', 'File', 'GeoPoint', 'Polygon', 'Array', 'Object', 'Pointer', 'Relation'];
|
|
21
21
|
/*:: type FieldOptions = {
|
|
22
22
|
required: boolean,
|
|
@@ -42,11 +42,7 @@ function _isNativeReflectConstruct() {
|
|
|
42
42
|
} catch (e) {
|
|
43
43
|
return false;
|
|
44
44
|
}
|
|
45
|
-
}
|
|
46
|
-
* @flow
|
|
47
|
-
*/
|
|
48
|
-
/*:: import type { AttributeMap } from './ObjectStateMutations';*/
|
|
49
|
-
/*:: import type { RequestOptions, FullOptions } from './RESTController';*/
|
|
45
|
+
}
|
|
50
46
|
/**
|
|
51
47
|
* <p>A Parse.Session object is a local representation of a revocable session.
|
|
52
48
|
* This class is a subclass of a Parse.Object, and retains the same
|