parse 4.1.0 → 4.2.0-alpha.10
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 +2123 -1542
- package/dist/parse.min.js +2 -2
- package/dist/parse.weapp.js +2105 -1524
- package/dist/parse.weapp.min.js +2 -2
- package/lib/browser/AnonymousUtils.js +1 -1
- package/lib/browser/Cloud.js +4 -2
- package/lib/browser/CoreManager.js +31 -4
- package/lib/browser/EventEmitter.js +7 -2
- package/lib/browser/EventuallyQueue.js +24 -4
- package/lib/browser/LiveQueryClient.js +59 -89
- package/lib/browser/LiveQuerySubscription.js +16 -51
- package/lib/browser/LocalDatastore.js +10 -1
- package/lib/browser/LocalDatastoreController.js +3 -1
- package/lib/browser/ObjectStateMutations.js +17 -2
- package/lib/browser/OfflineQuery.js +1 -1
- package/lib/browser/Parse.js +171 -135
- package/lib/browser/ParseACL.js +2 -1
- package/lib/browser/ParseCLP.js +6 -1
- package/lib/browser/ParseConfig.js +1 -0
- package/lib/browser/ParseError.js +12 -1
- package/lib/browser/ParseFile.js +5 -1
- package/lib/browser/ParseInstallation.js +4 -1
- package/lib/browser/ParseLiveQuery.js +79 -51
- package/lib/browser/ParseObject.js +11 -8
- package/lib/browser/ParseOp.js +3 -1
- package/lib/browser/ParseQuery.js +122 -72
- package/lib/browser/ParseRole.js +5 -1
- package/lib/browser/ParseSchema.js +23 -2
- package/lib/browser/ParseSession.js +1 -1
- package/lib/browser/ParseUser.js +107 -9
- package/lib/browser/Push.js +8 -2
- package/lib/browser/RESTController.js +20 -0
- package/lib/browser/SingleInstanceStateController.js +6 -1
- package/lib/browser/Storage.js +7 -0
- package/lib/browser/TaskQueue.js +4 -0
- package/lib/browser/UniqueInstanceStateController.js +3 -1
- package/lib/browser/unsavedChildren.js +4 -1
- package/lib/node/AnonymousUtils.js +1 -1
- package/lib/node/Cloud.js +4 -2
- package/lib/node/CoreManager.js +30 -4
- package/lib/node/EventEmitter.js +7 -1
- package/lib/node/EventuallyQueue.js +23 -4
- package/lib/node/LiveQueryClient.js +10 -7
- package/lib/node/LiveQuerySubscription.js +5 -7
- package/lib/node/LocalDatastore.js +7 -1
- package/lib/node/ObjectStateMutations.js +14 -2
- package/lib/node/OfflineQuery.js +1 -1
- package/lib/node/Parse.js +162 -126
- package/lib/node/ParseACL.js +2 -1
- package/lib/node/ParseCLP.js +3 -1
- package/lib/node/ParseConfig.js +1 -2
- package/lib/node/ParseError.js +15 -1
- package/lib/node/ParseFile.js +2 -1
- package/lib/node/ParseInstallation.js +1 -1
- package/lib/node/ParseLiveQuery.js +32 -24
- package/lib/node/ParseObject.js +3 -2
- package/lib/node/ParseQuery.js +53 -7
- package/lib/node/ParseRole.js +2 -1
- package/lib/node/ParseSchema.js +21 -2
- package/lib/node/ParseSession.js +1 -5
- package/lib/node/ParseUser.js +95 -9
- package/lib/node/Push.js +8 -2
- package/lib/node/RESTController.js +20 -0
- package/lib/node/SingleInstanceStateController.js +6 -1
- package/lib/node/Storage.js +6 -0
- package/lib/node/TaskQueue.js +4 -1
- package/lib/node/UniqueInstanceStateController.js +3 -1
- package/lib/node/unsavedChildren.js +4 -1
- package/lib/react-native/Cloud.js +3 -0
- package/lib/react-native/CoreManager.js +30 -4
- package/lib/react-native/EventEmitter.js +8 -5
- package/lib/react-native/EventuallyQueue.js +10 -3
- package/lib/react-native/LiveQueryClient.js +44 -70
- package/lib/react-native/LiveQuerySubscription.js +16 -46
- package/lib/react-native/LocalDatastore.js +6 -0
- package/lib/react-native/ObjectStateMutations.js +3 -1
- package/lib/react-native/OfflineQuery.js +1 -1
- package/lib/react-native/Parse.js +127 -90
- package/lib/react-native/ParseCLP.js +2 -2
- package/lib/react-native/ParseError.js +8 -1
- package/lib/react-native/ParseFile.js +1 -0
- package/lib/react-native/ParseLiveQuery.js +39 -11
- package/lib/react-native/ParseQuery.js +37 -17
- package/lib/react-native/ParseSchema.js +14 -1
- package/lib/react-native/ParseUser.js +74 -6
- package/lib/react-native/Storage.js +6 -0
- package/lib/weapp/AnonymousUtils.js +1 -1
- package/lib/weapp/Cloud.js +4 -2
- package/lib/weapp/CoreManager.js +31 -4
- package/lib/weapp/EventEmitter.js +7 -2
- package/lib/weapp/EventuallyQueue.js +24 -4
- package/lib/weapp/LiveQueryClient.js +59 -89
- package/lib/weapp/LiveQuerySubscription.js +16 -51
- package/lib/weapp/LocalDatastore.js +10 -1
- package/lib/weapp/LocalDatastoreController.js +3 -1
- package/lib/weapp/ObjectStateMutations.js +17 -2
- package/lib/weapp/OfflineQuery.js +1 -1
- package/lib/weapp/Parse.js +170 -134
- package/lib/weapp/ParseACL.js +2 -1
- package/lib/weapp/ParseCLP.js +6 -1
- package/lib/weapp/ParseConfig.js +1 -0
- package/lib/weapp/ParseError.js +12 -1
- package/lib/weapp/ParseFile.js +5 -1
- package/lib/weapp/ParseInstallation.js +4 -1
- package/lib/weapp/ParseLiveQuery.js +79 -51
- package/lib/weapp/ParseObject.js +11 -8
- package/lib/weapp/ParseOp.js +3 -1
- package/lib/weapp/ParseQuery.js +122 -72
- package/lib/weapp/ParseRole.js +5 -1
- package/lib/weapp/ParseSchema.js +23 -2
- package/lib/weapp/ParseSession.js +1 -1
- package/lib/weapp/ParseUser.js +107 -9
- package/lib/weapp/Push.js +8 -2
- package/lib/weapp/RESTController.js +20 -0
- package/lib/weapp/SingleInstanceStateController.js +6 -1
- package/lib/weapp/Storage.js +7 -0
- package/lib/weapp/TaskQueue.js +4 -0
- package/lib/weapp/UniqueInstanceStateController.js +3 -1
- package/lib/weapp/unsavedChildren.js +4 -1
- package/package.json +29 -25
package/lib/weapp/ParseOp.js
CHANGED
package/lib/weapp/ParseQuery.js
CHANGED
|
@@ -40,7 +40,29 @@ var _LocalDatastoreUtils = require("./LocalDatastoreUtils");
|
|
|
40
40
|
/*
|
|
41
41
|
* @flow
|
|
42
42
|
*/
|
|
43
|
-
|
|
43
|
+
/*:: import type LiveQuerySubscription from './LiveQuerySubscription';*/
|
|
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
|
+
};*/
|
|
44
66
|
/**
|
|
45
67
|
* Converts a string into a regex that matches it.
|
|
46
68
|
* Surrounding with \Q .. \E does this, we just need to escape any \E's in
|
|
@@ -215,17 +237,17 @@ function handleOfflineSort(a, b, sorts) {
|
|
|
215
237
|
* @alias Parse.Query
|
|
216
238
|
*/
|
|
217
239
|
var ParseQuery = /*#__PURE__*/function () {
|
|
218
|
-
/**
|
|
219
|
-
* @property {string} className
|
|
220
|
-
*/
|
|
221
|
-
|
|
222
240
|
/**
|
|
223
241
|
* @param {(string | Parse.Object)} objectClass An instance of a subclass of Parse.Object, or a Parse className string.
|
|
224
242
|
*/
|
|
225
243
|
function ParseQuery(objectClass /*: string | ParseObject*/) {
|
|
226
244
|
(0, _classCallCheck2.default)(this, ParseQuery);
|
|
245
|
+
/**
|
|
246
|
+
* @property {string} className
|
|
247
|
+
*/
|
|
227
248
|
(0, _defineProperty2.default)(this, "className", void 0);
|
|
228
249
|
(0, _defineProperty2.default)(this, "_where", void 0);
|
|
250
|
+
(0, _defineProperty2.default)(this, "_watch", void 0);
|
|
229
251
|
(0, _defineProperty2.default)(this, "_include", void 0);
|
|
230
252
|
(0, _defineProperty2.default)(this, "_exclude", void 0);
|
|
231
253
|
(0, _defineProperty2.default)(this, "_select", void 0);
|
|
@@ -261,6 +283,7 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
261
283
|
throw new TypeError('A ParseQuery must be constructed with a ParseObject or class name.');
|
|
262
284
|
}
|
|
263
285
|
this._where = {};
|
|
286
|
+
this._watch = [];
|
|
264
287
|
this._include = [];
|
|
265
288
|
this._exclude = [];
|
|
266
289
|
this._count = false;
|
|
@@ -453,6 +476,9 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
453
476
|
var params /*: QueryJSON*/ = {
|
|
454
477
|
where: this._where
|
|
455
478
|
};
|
|
479
|
+
if (this._watch.length) {
|
|
480
|
+
params.watch = this._watch.join(',');
|
|
481
|
+
}
|
|
456
482
|
if (this._include.length) {
|
|
457
483
|
params.include = this._include.join(',');
|
|
458
484
|
}
|
|
@@ -522,6 +548,9 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
522
548
|
if (json.where) {
|
|
523
549
|
this._where = json.where;
|
|
524
550
|
}
|
|
551
|
+
if (json.watch) {
|
|
552
|
+
this._watch = json.watch.split(',');
|
|
553
|
+
}
|
|
525
554
|
if (json.include) {
|
|
526
555
|
this._include = json.include.split(',');
|
|
527
556
|
}
|
|
@@ -936,21 +965,16 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
936
965
|
}, {
|
|
937
966
|
key: "eachBatch",
|
|
938
967
|
value: function (callback /*: (objs: Array<ParseObject>) => Promise<*>*/, options /*:: ?: BatchOptions*/) /*: Promise<void>*/{
|
|
939
|
-
var _context8;
|
|
940
968
|
options = options || {};
|
|
941
969
|
if (this._order || this._skip || this._limit >= 0) {
|
|
942
970
|
return _promise.default.reject('Cannot iterate on a query with sort, skip, or limit.');
|
|
943
971
|
}
|
|
944
972
|
var query = new ParseQuery(this.className);
|
|
945
973
|
query._limit = options.batchSize || 100;
|
|
946
|
-
query._include = (0,
|
|
947
|
-
|
|
948
|
-
});
|
|
974
|
+
query._include = (0, _toConsumableArray2.default)(this._include);
|
|
975
|
+
query._exclude = (0, _toConsumableArray2.default)(this._exclude);
|
|
949
976
|
if (this._select) {
|
|
950
|
-
|
|
951
|
-
query._select = (0, _map2.default)(_context9 = this._select).call(_context9, function (s) {
|
|
952
|
-
return s;
|
|
953
|
-
});
|
|
977
|
+
query._select = (0, _toConsumableArray2.default)(this._select);
|
|
954
978
|
}
|
|
955
979
|
query._hint = this._hint;
|
|
956
980
|
query._where = {};
|
|
@@ -990,39 +1014,39 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
990
1014
|
return !finished;
|
|
991
1015
|
}, /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
|
992
1016
|
var _yield$Promise$all, _yield$Promise$all2, results;
|
|
993
|
-
return _regenerator.default.wrap(function (
|
|
994
|
-
while (1) switch (
|
|
1017
|
+
return _regenerator.default.wrap(function (_context8) {
|
|
1018
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
995
1019
|
case 0:
|
|
996
|
-
|
|
1020
|
+
_context8.next = 2;
|
|
997
1021
|
return _promise.default.all([(0, _find.default)(query).call(query, findOptions), _promise.default.resolve(previousResults.length > 0 && callback(previousResults))]);
|
|
998
1022
|
case 2:
|
|
999
|
-
_yield$Promise$all =
|
|
1023
|
+
_yield$Promise$all = _context8.sent;
|
|
1000
1024
|
_yield$Promise$all2 = (0, _slicedToArray2.default)(_yield$Promise$all, 1);
|
|
1001
1025
|
results = _yield$Promise$all2[0];
|
|
1002
1026
|
if (!(results.length >= query._limit)) {
|
|
1003
|
-
|
|
1027
|
+
_context8.next = 10;
|
|
1004
1028
|
break;
|
|
1005
1029
|
}
|
|
1006
1030
|
query.greaterThan('objectId', results[results.length - 1].id);
|
|
1007
1031
|
previousResults = results;
|
|
1008
|
-
|
|
1032
|
+
_context8.next = 17;
|
|
1009
1033
|
break;
|
|
1010
1034
|
case 10:
|
|
1011
1035
|
if (!(results.length > 0)) {
|
|
1012
|
-
|
|
1036
|
+
_context8.next = 16;
|
|
1013
1037
|
break;
|
|
1014
1038
|
}
|
|
1015
|
-
|
|
1039
|
+
_context8.next = 13;
|
|
1016
1040
|
return _promise.default.resolve(callback(results));
|
|
1017
1041
|
case 13:
|
|
1018
1042
|
finished = true;
|
|
1019
|
-
|
|
1043
|
+
_context8.next = 17;
|
|
1020
1044
|
break;
|
|
1021
1045
|
case 16:
|
|
1022
1046
|
finished = true;
|
|
1023
1047
|
case 17:
|
|
1024
1048
|
case "end":
|
|
1025
|
-
return
|
|
1049
|
+
return _context8.stop();
|
|
1026
1050
|
}
|
|
1027
1051
|
}, _callee3);
|
|
1028
1052
|
})));
|
|
@@ -1123,12 +1147,12 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
1123
1147
|
var _map = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(callback /*: (currentObject: ParseObject, index: number, query: ParseQuery) => any*/, options /*:: ?: BatchOptions*/) {
|
|
1124
1148
|
var _this5 = this;
|
|
1125
1149
|
var array, index;
|
|
1126
|
-
return _regenerator.default.wrap(function (
|
|
1127
|
-
while (1) switch (
|
|
1150
|
+
return _regenerator.default.wrap(function (_context9) {
|
|
1151
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
1128
1152
|
case 0:
|
|
1129
1153
|
array = [];
|
|
1130
1154
|
index = 0;
|
|
1131
|
-
|
|
1155
|
+
_context9.next = 4;
|
|
1132
1156
|
return this.each(function (object) {
|
|
1133
1157
|
return _promise.default.resolve(callback(object, index, _this5)).then(function (result) {
|
|
1134
1158
|
array.push(result);
|
|
@@ -1136,10 +1160,10 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
1136
1160
|
});
|
|
1137
1161
|
}, options);
|
|
1138
1162
|
case 4:
|
|
1139
|
-
return
|
|
1163
|
+
return _context9.abrupt("return", array);
|
|
1140
1164
|
case 5:
|
|
1141
1165
|
case "end":
|
|
1142
|
-
return
|
|
1166
|
+
return _context9.stop();
|
|
1143
1167
|
}
|
|
1144
1168
|
}, _callee4, this);
|
|
1145
1169
|
}));
|
|
@@ -1176,12 +1200,12 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
1176
1200
|
value: function () {
|
|
1177
1201
|
var _reduce = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(callback /*: (accumulator: any, currentObject: ParseObject, index: number) => any*/, initialValue /*: any*/, options /*:: ?: BatchOptions*/) {
|
|
1178
1202
|
var accumulator, index;
|
|
1179
|
-
return _regenerator.default.wrap(function (
|
|
1180
|
-
while (1) switch (
|
|
1203
|
+
return _regenerator.default.wrap(function (_context10) {
|
|
1204
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
1181
1205
|
case 0:
|
|
1182
1206
|
accumulator = initialValue;
|
|
1183
1207
|
index = 0;
|
|
1184
|
-
|
|
1208
|
+
_context10.next = 4;
|
|
1185
1209
|
return this.each(function (object) {
|
|
1186
1210
|
// If no initial value was given, we take the first object from the query
|
|
1187
1211
|
// as the initial value and don't call the callback with it.
|
|
@@ -1197,15 +1221,15 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
1197
1221
|
}, options);
|
|
1198
1222
|
case 4:
|
|
1199
1223
|
if (!(index === 0 && initialValue === undefined)) {
|
|
1200
|
-
|
|
1224
|
+
_context10.next = 6;
|
|
1201
1225
|
break;
|
|
1202
1226
|
}
|
|
1203
1227
|
throw new TypeError('Reducing empty query result set with no initial value');
|
|
1204
1228
|
case 6:
|
|
1205
|
-
return
|
|
1229
|
+
return _context10.abrupt("return", accumulator);
|
|
1206
1230
|
case 7:
|
|
1207
1231
|
case "end":
|
|
1208
|
-
return
|
|
1232
|
+
return _context10.stop();
|
|
1209
1233
|
}
|
|
1210
1234
|
}, _callee5, this);
|
|
1211
1235
|
}));
|
|
@@ -1242,12 +1266,12 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
1242
1266
|
var _filter = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(callback /*: (currentObject: ParseObject, index: number, query: ParseQuery) => boolean*/, options /*:: ?: BatchOptions*/) {
|
|
1243
1267
|
var _this6 = this;
|
|
1244
1268
|
var array, index;
|
|
1245
|
-
return _regenerator.default.wrap(function (
|
|
1246
|
-
while (1) switch (
|
|
1269
|
+
return _regenerator.default.wrap(function (_context11) {
|
|
1270
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
1247
1271
|
case 0:
|
|
1248
1272
|
array = [];
|
|
1249
1273
|
index = 0;
|
|
1250
|
-
|
|
1274
|
+
_context11.next = 4;
|
|
1251
1275
|
return this.each(function (object) {
|
|
1252
1276
|
return _promise.default.resolve(callback(object, index, _this6)).then(function (flag) {
|
|
1253
1277
|
if (flag) {
|
|
@@ -1257,10 +1281,10 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
1257
1281
|
});
|
|
1258
1282
|
}, options);
|
|
1259
1283
|
case 4:
|
|
1260
|
-
return
|
|
1284
|
+
return _context11.abrupt("return", array);
|
|
1261
1285
|
case 5:
|
|
1262
1286
|
case "end":
|
|
1263
|
-
return
|
|
1287
|
+
return _context11.stop();
|
|
1264
1288
|
}
|
|
1265
1289
|
}, _callee6, this);
|
|
1266
1290
|
}));
|
|
@@ -1283,8 +1307,8 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
1283
1307
|
value: function (key /*: string | { [key: string]: any }*/, value /*: ?mixed*/) /*: ParseQuery*/{
|
|
1284
1308
|
var _this7 = this;
|
|
1285
1309
|
if (key && (0, _typeof2.default)(key) === 'object') {
|
|
1286
|
-
var
|
|
1287
|
-
(0, _forEach.default)(
|
|
1310
|
+
var _context12;
|
|
1311
|
+
(0, _forEach.default)(_context12 = (0, _entries.default)(key)).call(_context12, function (_ref2) {
|
|
1288
1312
|
var _ref3 = (0, _slicedToArray2.default)(_ref2, 2),
|
|
1289
1313
|
k = _ref3[0],
|
|
1290
1314
|
val = _ref3[1];
|
|
@@ -1312,8 +1336,8 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
1312
1336
|
value: function (key /*: string | { [key: string]: any }*/, value /*: ?mixed*/) /*: ParseQuery*/{
|
|
1313
1337
|
var _this8 = this;
|
|
1314
1338
|
if (key && (0, _typeof2.default)(key) === 'object') {
|
|
1315
|
-
var
|
|
1316
|
-
(0, _forEach.default)(
|
|
1339
|
+
var _context13;
|
|
1340
|
+
(0, _forEach.default)(_context13 = (0, _entries.default)(key)).call(_context13, function (_ref4) {
|
|
1317
1341
|
var _ref5 = (0, _slicedToArray2.default)(_ref4, 2),
|
|
1318
1342
|
k = _ref5[0],
|
|
1319
1343
|
val = _ref5[1];
|
|
@@ -1902,11 +1926,11 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
1902
1926
|
keys[_key6] = arguments[_key6];
|
|
1903
1927
|
}
|
|
1904
1928
|
(0, _forEach.default)(keys).call(keys, function (key) {
|
|
1905
|
-
var
|
|
1929
|
+
var _context14;
|
|
1906
1930
|
if ((0, _isArray.default)(key)) {
|
|
1907
1931
|
key = key.join();
|
|
1908
1932
|
}
|
|
1909
|
-
_this9._order = (0, _concat.default)(
|
|
1933
|
+
_this9._order = (0, _concat.default)(_context14 = _this9._order).call(_context14, key.replace(/\s/g, '').split(','));
|
|
1910
1934
|
});
|
|
1911
1935
|
return this;
|
|
1912
1936
|
}
|
|
@@ -1947,11 +1971,11 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
1947
1971
|
keys[_key8] = arguments[_key8];
|
|
1948
1972
|
}
|
|
1949
1973
|
(0, _forEach.default)(keys).call(keys, function (key) {
|
|
1950
|
-
var
|
|
1974
|
+
var _context15, _context16;
|
|
1951
1975
|
if ((0, _isArray.default)(key)) {
|
|
1952
1976
|
key = key.join();
|
|
1953
1977
|
}
|
|
1954
|
-
_this10._order = (0, _concat.default)(
|
|
1978
|
+
_this10._order = (0, _concat.default)(_context15 = _this10._order).call(_context15, (0, _map2.default)(_context16 = key.replace(/\s/g, '').split(',')).call(_context16, function (k) {
|
|
1955
1979
|
return '-' + k;
|
|
1956
1980
|
}));
|
|
1957
1981
|
});
|
|
@@ -2033,8 +2057,8 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
2033
2057
|
}
|
|
2034
2058
|
(0, _forEach.default)(keys).call(keys, function (key) {
|
|
2035
2059
|
if ((0, _isArray.default)(key)) {
|
|
2036
|
-
var
|
|
2037
|
-
_this11._include = (0, _concat.default)(
|
|
2060
|
+
var _context17;
|
|
2061
|
+
_this11._include = (0, _concat.default)(_context17 = _this11._include).call(_context17, key);
|
|
2038
2062
|
} else {
|
|
2039
2063
|
_this11._include.push(key);
|
|
2040
2064
|
}
|
|
@@ -2075,8 +2099,8 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
2075
2099
|
}
|
|
2076
2100
|
(0, _forEach.default)(keys).call(keys, function (key) {
|
|
2077
2101
|
if ((0, _isArray.default)(key)) {
|
|
2078
|
-
var
|
|
2079
|
-
_this12._select = (0, _concat.default)(
|
|
2102
|
+
var _context18;
|
|
2103
|
+
_this12._select = (0, _concat.default)(_context18 = _this12._select).call(_context18, key);
|
|
2080
2104
|
} else {
|
|
2081
2105
|
_this12._select.push(key);
|
|
2082
2106
|
}
|
|
@@ -2102,8 +2126,8 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
2102
2126
|
}
|
|
2103
2127
|
(0, _forEach.default)(keys).call(keys, function (key) {
|
|
2104
2128
|
if ((0, _isArray.default)(key)) {
|
|
2105
|
-
var
|
|
2106
|
-
_this13._exclude = (0, _concat.default)(
|
|
2129
|
+
var _context19;
|
|
2130
|
+
_this13._exclude = (0, _concat.default)(_context19 = _this13._exclude).call(_context19, key);
|
|
2107
2131
|
} else {
|
|
2108
2132
|
_this13._exclude.push(key);
|
|
2109
2133
|
}
|
|
@@ -2111,6 +2135,32 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
2111
2135
|
return this;
|
|
2112
2136
|
}
|
|
2113
2137
|
|
|
2138
|
+
/**
|
|
2139
|
+
* Restricts live query to trigger only for watched fields.
|
|
2140
|
+
*
|
|
2141
|
+
* Requires Parse Server 6.0.0+
|
|
2142
|
+
*
|
|
2143
|
+
* @param {...string|Array<string>} keys The name(s) of the key(s) to watch.
|
|
2144
|
+
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
2145
|
+
*/
|
|
2146
|
+
}, {
|
|
2147
|
+
key: "watch",
|
|
2148
|
+
value: function () /*: ParseQuery*/{
|
|
2149
|
+
var _this14 = this;
|
|
2150
|
+
for (var _len8 = arguments.length, keys = new Array(_len8), _key12 = 0; _key12 < _len8; _key12++) {
|
|
2151
|
+
keys[_key12] = arguments[_key12];
|
|
2152
|
+
}
|
|
2153
|
+
(0, _forEach.default)(keys).call(keys, function (key) {
|
|
2154
|
+
if ((0, _isArray.default)(key)) {
|
|
2155
|
+
var _context20;
|
|
2156
|
+
_this14._watch = (0, _concat.default)(_context20 = _this14._watch).call(_context20, key);
|
|
2157
|
+
} else {
|
|
2158
|
+
_this14._watch.push(key);
|
|
2159
|
+
}
|
|
2160
|
+
});
|
|
2161
|
+
return this;
|
|
2162
|
+
}
|
|
2163
|
+
|
|
2114
2164
|
/**
|
|
2115
2165
|
* Changes the read preference that the backend will use when performing the query to the database.
|
|
2116
2166
|
*
|
|
@@ -2140,30 +2190,30 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
2140
2190
|
value: function () {
|
|
2141
2191
|
var _subscribe = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(sessionToken /*:: ?: string*/) {
|
|
2142
2192
|
var currentUser, liveQueryClient, subscription;
|
|
2143
|
-
return _regenerator.default.wrap(function (
|
|
2144
|
-
while (1) switch (
|
|
2193
|
+
return _regenerator.default.wrap(function (_context21) {
|
|
2194
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
2145
2195
|
case 0:
|
|
2146
|
-
|
|
2196
|
+
_context21.next = 2;
|
|
2147
2197
|
return _CoreManager.default.getUserController().currentUserAsync();
|
|
2148
2198
|
case 2:
|
|
2149
|
-
currentUser =
|
|
2199
|
+
currentUser = _context21.sent;
|
|
2150
2200
|
if (!sessionToken) {
|
|
2151
2201
|
sessionToken = currentUser ? currentUser.getSessionToken() : undefined;
|
|
2152
2202
|
}
|
|
2153
|
-
|
|
2203
|
+
_context21.next = 6;
|
|
2154
2204
|
return _CoreManager.default.getLiveQueryController().getDefaultLiveQueryClient();
|
|
2155
2205
|
case 6:
|
|
2156
|
-
liveQueryClient =
|
|
2206
|
+
liveQueryClient = _context21.sent;
|
|
2157
2207
|
if (liveQueryClient.shouldOpen()) {
|
|
2158
2208
|
liveQueryClient.open();
|
|
2159
2209
|
}
|
|
2160
2210
|
subscription = liveQueryClient.subscribe(this, sessionToken);
|
|
2161
|
-
return
|
|
2211
|
+
return _context21.abrupt("return", subscription.subscribePromise.then(function () {
|
|
2162
2212
|
return subscription;
|
|
2163
2213
|
}));
|
|
2164
2214
|
case 10:
|
|
2165
2215
|
case "end":
|
|
2166
|
-
return
|
|
2216
|
+
return _context21.stop();
|
|
2167
2217
|
}
|
|
2168
2218
|
}, _callee7, this);
|
|
2169
2219
|
}));
|
|
@@ -2245,7 +2295,7 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
2245
2295
|
}, {
|
|
2246
2296
|
key: "cancel",
|
|
2247
2297
|
value: function () /*: ParseQuery*/{
|
|
2248
|
-
var
|
|
2298
|
+
var _this15 = this;
|
|
2249
2299
|
if (this._xhrRequest.task && typeof this._xhrRequest.task.abort === 'function') {
|
|
2250
2300
|
this._xhrRequest.task._aborted = true;
|
|
2251
2301
|
this._xhrRequest.task.abort();
|
|
@@ -2254,16 +2304,16 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
2254
2304
|
return this;
|
|
2255
2305
|
}
|
|
2256
2306
|
return this._xhrRequest.onchange = function () {
|
|
2257
|
-
return
|
|
2307
|
+
return _this15.cancel();
|
|
2258
2308
|
};
|
|
2259
2309
|
}
|
|
2260
2310
|
}, {
|
|
2261
2311
|
key: "_setRequestTask",
|
|
2262
2312
|
value: function (options) {
|
|
2263
|
-
var
|
|
2313
|
+
var _this16 = this;
|
|
2264
2314
|
options.requestTask = function (task) {
|
|
2265
|
-
|
|
2266
|
-
|
|
2315
|
+
_this16._xhrRequest.task = task;
|
|
2316
|
+
_this16._xhrRequest.onchange();
|
|
2267
2317
|
};
|
|
2268
2318
|
}
|
|
2269
2319
|
}], [{
|
|
@@ -2275,8 +2325,8 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
2275
2325
|
}, {
|
|
2276
2326
|
key: "or",
|
|
2277
2327
|
value: function () /*: ParseQuery*/{
|
|
2278
|
-
for (var
|
|
2279
|
-
queries[
|
|
2328
|
+
for (var _len9 = arguments.length, queries = new Array(_len9), _key13 = 0; _key13 < _len9; _key13++) {
|
|
2329
|
+
queries[_key13] = arguments[_key13];
|
|
2280
2330
|
}
|
|
2281
2331
|
var className = _getClassNameFromQueries(queries);
|
|
2282
2332
|
var query = new ParseQuery(className);
|
|
@@ -2299,8 +2349,8 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
2299
2349
|
}, {
|
|
2300
2350
|
key: "and",
|
|
2301
2351
|
value: function () /*: ParseQuery*/{
|
|
2302
|
-
for (var
|
|
2303
|
-
queries[
|
|
2352
|
+
for (var _len10 = arguments.length, queries = new Array(_len10), _key14 = 0; _key14 < _len10; _key14++) {
|
|
2353
|
+
queries[_key14] = arguments[_key14];
|
|
2304
2354
|
}
|
|
2305
2355
|
var className = _getClassNameFromQueries(queries);
|
|
2306
2356
|
var query = new ParseQuery(className);
|
|
@@ -2323,8 +2373,8 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
2323
2373
|
}, {
|
|
2324
2374
|
key: "nor",
|
|
2325
2375
|
value: function () /*: ParseQuery*/{
|
|
2326
|
-
for (var
|
|
2327
|
-
queries[
|
|
2376
|
+
for (var _len11 = arguments.length, queries = new Array(_len11), _key15 = 0; _key15 < _len11; _key15++) {
|
|
2377
|
+
queries[_key15] = arguments[_key15];
|
|
2328
2378
|
}
|
|
2329
2379
|
var className = _getClassNameFromQueries(queries);
|
|
2330
2380
|
var query = new ParseQuery(className);
|
package/lib/weapp/ParseRole.js
CHANGED
|
@@ -40,7 +40,11 @@ function _isNativeReflectConstruct() {
|
|
|
40
40
|
} catch (e) {
|
|
41
41
|
return false;
|
|
42
42
|
}
|
|
43
|
-
}
|
|
43
|
+
} /**
|
|
44
|
+
* @flow
|
|
45
|
+
*/
|
|
46
|
+
/*:: import type { AttributeMap } from './ObjectStateMutations';*/
|
|
47
|
+
/*:: import type ParseRelation from './ParseRelation';*/
|
|
44
48
|
/**
|
|
45
49
|
* Represents a Role on the Parse server. Roles represent groupings of
|
|
46
50
|
* Users for the purposes of granting permissions (e.g. specifying an ACL
|
package/lib/weapp/ParseSchema.js
CHANGED
|
@@ -16,8 +16,8 @@ var _ParseCLP = _interopRequireDefault(require("./ParseCLP"));
|
|
|
16
16
|
/**
|
|
17
17
|
* @flow
|
|
18
18
|
*/
|
|
19
|
-
|
|
20
|
-
var FIELD_TYPES = ['String', 'Number', 'Boolean', 'Date', 'File', 'GeoPoint', 'Polygon', 'Array', 'Object', 'Pointer', 'Relation'];
|
|
19
|
+
/*:: import type { PermissionsMap } from './ParseCLP';*/
|
|
20
|
+
var FIELD_TYPES = ['String', 'Number', 'Boolean', 'Bytes', 'Date', 'File', 'GeoPoint', 'Polygon', 'Array', 'Object', 'Pointer', 'Relation'];
|
|
21
21
|
/*:: type FieldOptions = {
|
|
22
22
|
required: boolean,
|
|
23
23
|
defaultValue: mixed,
|
|
@@ -236,6 +236,14 @@ var ParseSchema = /*#__PURE__*/function () {
|
|
|
236
236
|
};
|
|
237
237
|
}
|
|
238
238
|
}
|
|
239
|
+
if (type === 'Bytes') {
|
|
240
|
+
if (options && options.defaultValue) {
|
|
241
|
+
fieldOptions.defaultValue = {
|
|
242
|
+
__type: 'Bytes',
|
|
243
|
+
base64: options.defaultValue
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
}
|
|
239
247
|
this._fields[name] = fieldOptions;
|
|
240
248
|
return this;
|
|
241
249
|
}
|
|
@@ -303,6 +311,19 @@ var ParseSchema = /*#__PURE__*/function () {
|
|
|
303
311
|
return this.addField(name, 'Boolean', options);
|
|
304
312
|
}
|
|
305
313
|
|
|
314
|
+
/**
|
|
315
|
+
* Adding Bytes Field
|
|
316
|
+
*
|
|
317
|
+
* @param {string} name Name of the field that will be created on Parse
|
|
318
|
+
* @param {object} options See {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.Schema.html#addField addField}
|
|
319
|
+
* @returns {Parse.Schema} Returns the schema, so you can chain this call.
|
|
320
|
+
*/
|
|
321
|
+
}, {
|
|
322
|
+
key: "addBytes",
|
|
323
|
+
value: function (name /*: string*/, options /*: FieldOptions*/) {
|
|
324
|
+
return this.addField(name, 'Bytes', options);
|
|
325
|
+
}
|
|
326
|
+
|
|
306
327
|
/**
|
|
307
328
|
* Adding Date Field
|
|
308
329
|
*
|
|
@@ -57,7 +57,7 @@ var ParseSession = /*#__PURE__*/function (_ParseObject) {
|
|
|
57
57
|
/**
|
|
58
58
|
* @param {object} attributes The initial set of data to store in the user.
|
|
59
59
|
*/
|
|
60
|
-
function ParseSession(attributes
|
|
60
|
+
function ParseSession(attributes /*:: ?: any*/) {
|
|
61
61
|
var _this;
|
|
62
62
|
(0, _classCallCheck2.default)(this, ParseSession);
|
|
63
63
|
_this = _super.call(this, '_Session');
|