parse 4.0.0-alpha.1 → 4.0.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/LICENSE +167 -25
- package/NOTICE +10 -0
- package/README.md +6 -5
- package/dist/parse.js +12838 -21190
- package/dist/parse.min.js +7 -6
- package/dist/parse.weapp.js +7921 -17062
- package/dist/parse.weapp.min.js +7 -6
- package/lib/browser/Analytics.js +2 -27
- package/lib/browser/AnonymousUtils.js +6 -42
- package/lib/browser/Cloud.js +12 -77
- package/lib/browser/CloudCode.js +0 -3
- package/lib/browser/CoreManager.js +46 -191
- package/lib/browser/CryptoController.js +2 -16
- package/lib/browser/EventEmitter.js +1 -8
- package/lib/browser/EventuallyQueue.js +277 -824
- package/lib/browser/FacebookUtils.js +6 -42
- package/lib/browser/IndexedDBStorageController.js +3 -14
- package/lib/browser/InstallationController.js +2 -20
- package/lib/browser/LiveQueryClient.js +105 -213
- package/lib/browser/LiveQuerySubscription.js +10 -39
- package/lib/browser/LocalDatastore.js +451 -1081
- package/lib/browser/LocalDatastoreController.js +145 -602
- package/lib/browser/LocalDatastoreController.react-native.js +137 -573
- package/lib/browser/LocalDatastoreUtils.js +2 -19
- package/lib/browser/ObjectStateMutations.js +18 -121
- package/lib/browser/OfflineQuery.js +61 -222
- package/lib/browser/Parse.js +12 -115
- package/lib/browser/ParseACL.js +33 -148
- package/lib/browser/ParseCLP.js +96 -314
- package/lib/browser/ParseConfig.js +18 -95
- package/lib/browser/ParseError.js +63 -99
- package/lib/browser/ParseFile.js +128 -685
- package/lib/browser/ParseGeoPoint.js +23 -89
- package/lib/browser/ParseHooks.js +1 -34
- package/lib/browser/ParseInstallation.js +4 -32
- package/lib/browser/ParseLiveQuery.js +96 -505
- package/lib/browser/ParseObject.js +665 -1845
- package/lib/browser/ParseOp.js +41 -287
- package/lib/browser/ParsePolygon.js +13 -70
- package/lib/browser/ParseQuery.js +403 -1504
- package/lib/browser/ParseRelation.js +12 -68
- package/lib/browser/ParseRole.js +13 -75
- package/lib/browser/ParseSchema.js +49 -208
- package/lib/browser/ParseSession.js +11 -69
- package/lib/browser/ParseUser.js +274 -1127
- package/lib/browser/Push.js +7 -50
- package/lib/browser/RESTController.js +28 -157
- package/lib/browser/SingleInstanceStateController.js +19 -144
- package/lib/browser/Socket.weapp.js +0 -10
- package/lib/browser/Storage.js +10 -80
- package/lib/browser/StorageController.browser.js +4 -24
- package/lib/browser/StorageController.default.js +4 -24
- package/lib/browser/StorageController.react-native.js +6 -40
- package/lib/browser/StorageController.weapp.js +5 -23
- package/lib/browser/TaskQueue.js +1 -29
- package/lib/browser/UniqueInstanceStateController.js +19 -149
- package/lib/browser/Xhr.weapp.js +0 -17
- package/lib/browser/arrayContainsObject.js +2 -23
- package/lib/browser/canBeSerialized.js +3 -40
- package/lib/browser/decode.js +3 -40
- package/lib/browser/encode.js +9 -77
- package/lib/browser/equals.js +2 -34
- package/lib/browser/escape.js +1 -15
- package/lib/browser/isRevocableSession.js +2 -18
- package/lib/browser/parseDate.js +2 -20
- package/lib/browser/promiseUtils.js +3 -21
- package/lib/browser/unique.js +3 -24
- package/lib/browser/unsavedChildren.js +6 -57
- package/lib/browser/uuid.js +3 -1
- package/lib/node/Analytics.js +1 -25
- package/lib/node/AnonymousUtils.js +5 -44
- package/lib/node/Cloud.js +10 -73
- package/lib/node/CloudCode.js +0 -3
- package/lib/node/CoreManager.js +47 -227
- package/lib/node/CryptoController.js +2 -16
- package/lib/node/EventEmitter.js +1 -8
- package/lib/node/EventuallyQueue.js +16 -123
- package/lib/node/FacebookUtils.js +5 -44
- package/lib/node/IndexedDBStorageController.js +3 -19
- package/lib/node/InstallationController.js +2 -22
- package/lib/node/LiveQueryClient.js +72 -154
- package/lib/node/LiveQuerySubscription.js +7 -26
- package/lib/node/LocalDatastore.js +19 -182
- package/lib/node/LocalDatastoreController.js +6 -45
- package/lib/node/LocalDatastoreController.react-native.js +6 -52
- package/lib/node/LocalDatastoreUtils.js +1 -13
- package/lib/node/ObjectStateMutations.js +13 -100
- package/lib/node/OfflineQuery.js +27 -151
- package/lib/node/Parse.js +11 -108
- package/lib/node/ParseACL.js +32 -157
- package/lib/node/ParseCLP.js +69 -269
- package/lib/node/ParseConfig.js +16 -91
- package/lib/node/ParseError.js +61 -74
- package/lib/node/ParseFile.js +49 -212
- package/lib/node/ParseGeoPoint.js +21 -89
- package/lib/node/ParseHooks.js +0 -35
- package/lib/node/ParseInstallation.js +1 -17
- package/lib/node/ParseLiveQuery.js +10 -43
- package/lib/node/ParseObject.js +229 -964
- package/lib/node/ParseOp.js +31 -262
- package/lib/node/ParsePolygon.js +12 -69
- package/lib/node/ParseQuery.js +169 -888
- package/lib/node/ParseRelation.js +11 -68
- package/lib/node/ParseRole.js +10 -64
- package/lib/node/ParseSchema.js +46 -229
- package/lib/node/ParseSession.js +8 -57
- package/lib/node/ParseUser.js +107 -583
- package/lib/node/Push.js +4 -44
- package/lib/node/RESTController.js +18 -127
- package/lib/node/SingleInstanceStateController.js +17 -137
- package/lib/node/Socket.weapp.js +0 -7
- package/lib/node/Storage.js +10 -90
- package/lib/node/StorageController.browser.js +4 -30
- package/lib/node/StorageController.default.js +5 -28
- package/lib/node/StorageController.react-native.js +6 -47
- package/lib/node/StorageController.weapp.js +6 -28
- package/lib/node/TaskQueue.js +1 -24
- package/lib/node/UniqueInstanceStateController.js +16 -140
- package/lib/node/Xhr.weapp.js +0 -15
- package/lib/node/arrayContainsObject.js +1 -19
- package/lib/node/canBeSerialized.js +2 -35
- package/lib/node/decode.js +1 -33
- package/lib/node/encode.js +3 -61
- package/lib/node/equals.js +0 -27
- package/lib/node/escape.js +1 -13
- package/lib/node/isRevocableSession.js +1 -12
- package/lib/node/parseDate.js +1 -14
- package/lib/node/promiseUtils.js +2 -14
- package/lib/node/unique.js +1 -18
- package/lib/node/unsavedChildren.js +2 -45
- package/lib/node/uuid.js +6 -1
- package/lib/react-native/Analytics.js +0 -9
- package/lib/react-native/AnonymousUtils.js +0 -10
- package/lib/react-native/Cloud.js +0 -26
- package/lib/react-native/CoreManager.js +2 -6
- package/lib/react-native/CryptoController.js +0 -2
- package/lib/react-native/EventEmitter.js +0 -2
- package/lib/react-native/EventuallyQueue.js +156 -711
- package/lib/react-native/FacebookUtils.js +0 -22
- package/lib/react-native/IndexedDBStorageController.js +0 -1
- package/lib/react-native/InstallationController.js +0 -6
- package/lib/react-native/LiveQueryClient.js +46 -157
- package/lib/react-native/LiveQuerySubscription.js +3 -27
- package/lib/react-native/LocalDatastore.js +281 -948
- package/lib/react-native/LocalDatastoreController.js +71 -552
- package/lib/react-native/LocalDatastoreController.react-native.js +91 -526
- package/lib/react-native/LocalDatastoreUtils.js +0 -1
- package/lib/react-native/ObjectStateMutations.js +2 -65
- package/lib/react-native/OfflineQuery.js +25 -196
- package/lib/react-native/Parse.js +0 -65
- package/lib/react-native/ParseACL.js +0 -44
- package/lib/react-native/ParseCLP.js +23 -161
- package/lib/react-native/ParseConfig.js +0 -42
- package/lib/react-native/ParseError.js +1 -21
- package/lib/react-native/ParseFile.js +55 -529
- package/lib/react-native/ParseGeoPoint.js +0 -17
- package/lib/react-native/ParseHooks.js +0 -30
- package/lib/react-native/ParseInstallation.js +1 -23
- package/lib/react-native/ParseLiveQuery.js +55 -472
- package/lib/react-native/ParseObject.js +245 -1246
- package/lib/react-native/ParseOp.js +1 -138
- package/lib/react-native/ParsePolygon.js +0 -24
- package/lib/react-native/ParseQuery.js +182 -874
- package/lib/react-native/ParseRelation.js +0 -25
- package/lib/react-native/ParseRole.js +1 -36
- package/lib/react-native/ParseSchema.js +3 -54
- package/lib/react-native/ParseSession.js +1 -40
- package/lib/react-native/ParseUser.js +95 -773
- package/lib/react-native/Push.js +0 -16
- package/lib/react-native/RESTController.js +12 -109
- package/lib/react-native/SingleInstanceStateController.js +0 -44
- package/lib/react-native/Socket.weapp.js +0 -10
- package/lib/react-native/Storage.js +0 -24
- package/lib/react-native/StorageController.browser.js +0 -2
- package/lib/react-native/StorageController.default.js +0 -1
- package/lib/react-native/StorageController.react-native.js +0 -2
- package/lib/react-native/TaskQueue.js +0 -15
- package/lib/react-native/UniqueInstanceStateController.js +0 -47
- package/lib/react-native/Xhr.weapp.js +0 -16
- package/lib/react-native/arrayContainsObject.js +0 -5
- package/lib/react-native/canBeSerialized.js +0 -18
- package/lib/react-native/decode.js +0 -21
- package/lib/react-native/encode.js +0 -25
- package/lib/react-native/equals.js +0 -18
- package/lib/react-native/escape.js +0 -1
- package/lib/react-native/isRevocableSession.js +0 -1
- package/lib/react-native/parseDate.js +0 -3
- package/lib/react-native/promiseUtils.js +0 -13
- package/lib/react-native/unique.js +0 -4
- package/lib/react-native/unsavedChildren.js +0 -21
- package/lib/react-native/uuid.js +3 -1
- package/lib/weapp/Analytics.js +2 -27
- package/lib/weapp/AnonymousUtils.js +6 -42
- package/lib/weapp/Cloud.js +12 -77
- package/lib/weapp/CloudCode.js +0 -3
- package/lib/weapp/CoreManager.js +46 -191
- package/lib/weapp/CryptoController.js +2 -16
- package/lib/weapp/EventEmitter.js +1 -8
- package/lib/weapp/EventuallyQueue.js +277 -824
- package/lib/weapp/FacebookUtils.js +6 -42
- package/lib/weapp/IndexedDBStorageController.js +3 -14
- package/lib/weapp/InstallationController.js +2 -20
- package/lib/weapp/LiveQueryClient.js +105 -213
- package/lib/weapp/LiveQuerySubscription.js +10 -39
- package/lib/weapp/LocalDatastore.js +451 -1081
- package/lib/weapp/LocalDatastoreController.js +145 -602
- package/lib/weapp/LocalDatastoreController.react-native.js +137 -573
- package/lib/weapp/LocalDatastoreUtils.js +2 -19
- package/lib/weapp/ObjectStateMutations.js +18 -121
- package/lib/weapp/OfflineQuery.js +61 -222
- package/lib/weapp/Parse.js +12 -115
- package/lib/weapp/ParseACL.js +33 -148
- package/lib/weapp/ParseCLP.js +96 -314
- package/lib/weapp/ParseConfig.js +18 -95
- package/lib/weapp/ParseError.js +63 -99
- package/lib/weapp/ParseFile.js +129 -686
- package/lib/weapp/ParseGeoPoint.js +23 -89
- package/lib/weapp/ParseHooks.js +1 -34
- package/lib/weapp/ParseInstallation.js +4 -32
- package/lib/weapp/ParseLiveQuery.js +96 -505
- package/lib/weapp/ParseObject.js +665 -1845
- package/lib/weapp/ParseOp.js +41 -287
- package/lib/weapp/ParsePolygon.js +13 -70
- package/lib/weapp/ParseQuery.js +403 -1504
- package/lib/weapp/ParseRelation.js +12 -68
- package/lib/weapp/ParseRole.js +13 -75
- package/lib/weapp/ParseSchema.js +49 -208
- package/lib/weapp/ParseSession.js +11 -69
- package/lib/weapp/ParseUser.js +274 -1127
- package/lib/weapp/Push.js +7 -50
- package/lib/weapp/RESTController.js +28 -157
- package/lib/weapp/SingleInstanceStateController.js +19 -144
- package/lib/weapp/Socket.weapp.js +0 -10
- package/lib/weapp/Storage.js +10 -80
- package/lib/weapp/StorageController.browser.js +4 -24
- package/lib/weapp/StorageController.default.js +4 -24
- package/lib/weapp/StorageController.react-native.js +6 -40
- package/lib/weapp/StorageController.weapp.js +5 -23
- package/lib/weapp/TaskQueue.js +1 -29
- package/lib/weapp/UniqueInstanceStateController.js +19 -149
- package/lib/weapp/Xhr.weapp.js +0 -17
- package/lib/weapp/arrayContainsObject.js +2 -23
- package/lib/weapp/canBeSerialized.js +3 -40
- package/lib/weapp/decode.js +3 -40
- package/lib/weapp/encode.js +9 -77
- package/lib/weapp/equals.js +2 -34
- package/lib/weapp/escape.js +1 -15
- package/lib/weapp/isRevocableSession.js +2 -18
- package/lib/weapp/parseDate.js +2 -20
- package/lib/weapp/promiseUtils.js +3 -21
- package/lib/weapp/unique.js +3 -24
- package/lib/weapp/unsavedChildren.js +6 -57
- package/lib/weapp/uuid.js +1 -6
- package/package.json +34 -30
- package/PATENTS +0 -37
|
@@ -1,450 +1,46 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
var _sliceInstanceProperty2 = require("@babel/runtime-corejs3/core-js-stable/instance/slice");
|
|
6
|
-
|
|
7
|
-
var _reverseInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/reverse");
|
|
8
|
-
|
|
9
|
-
var _Promise2 = require("@babel/runtime-corejs3/core-js-stable/promise");
|
|
10
|
-
|
|
11
|
-
var _Object$setPrototypeOf = require("@babel/runtime-corejs3/core-js-stable/object/set-prototype-of");
|
|
12
|
-
|
|
13
|
-
var _typeof3 = require("@babel/runtime-corejs3/helpers/typeof");
|
|
14
|
-
|
|
15
|
-
var _forEachInstanceProperty2 = require("@babel/runtime-corejs3/core-js-stable/instance/for-each");
|
|
16
|
-
|
|
17
|
-
var _Object$getPrototypeOf = require("@babel/runtime-corejs3/core-js-stable/object/get-prototype-of");
|
|
18
|
-
|
|
19
|
-
var _Object$create = require("@babel/runtime-corejs3/core-js-stable/object/create");
|
|
20
|
-
|
|
21
3
|
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
|
22
|
-
|
|
23
|
-
var _Symbol = require("@babel/runtime-corejs3/core-js-stable/symbol");
|
|
24
|
-
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
25
5
|
_Object$defineProperty(exports, "__esModule", {
|
|
26
6
|
value: true
|
|
27
7
|
});
|
|
28
|
-
|
|
29
8
|
exports.default = void 0;
|
|
30
|
-
|
|
31
|
-
var _entries = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/entries"));
|
|
32
|
-
|
|
9
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs3/regenerator"));
|
|
33
10
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/slicedToArray"));
|
|
34
|
-
|
|
35
|
-
var _isArray = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/array/is-array"));
|
|
36
|
-
|
|
37
11
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/toConsumableArray"));
|
|
38
|
-
|
|
39
|
-
var _find = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/find"));
|
|
40
|
-
|
|
41
|
-
var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/promise"));
|
|
42
|
-
|
|
43
|
-
var _splice = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/splice"));
|
|
44
|
-
|
|
45
|
-
var _sort = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/sort"));
|
|
46
|
-
|
|
47
|
-
var _includes = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/includes"));
|
|
48
|
-
|
|
49
|
-
var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
|
|
50
|
-
|
|
51
|
-
var _keys = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/keys"));
|
|
52
|
-
|
|
53
|
-
var _filter2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/filter"));
|
|
54
|
-
|
|
55
12
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/asyncToGenerator"));
|
|
56
|
-
|
|
57
|
-
var _map2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
|
|
58
|
-
|
|
59
13
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/classCallCheck"));
|
|
60
|
-
|
|
61
14
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/createClass"));
|
|
62
|
-
|
|
63
15
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
|
|
64
|
-
|
|
65
|
-
var _slice = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/slice"));
|
|
66
|
-
|
|
67
|
-
var _keys2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/keys"));
|
|
68
|
-
|
|
69
16
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/typeof"));
|
|
70
|
-
|
|
71
|
-
var _indexOf = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/index-of"));
|
|
72
|
-
|
|
73
17
|
var _forEach = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/for-each"));
|
|
74
|
-
|
|
18
|
+
var _indexOf = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/index-of"));
|
|
19
|
+
var _keys = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/keys"));
|
|
20
|
+
var _slice = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/slice"));
|
|
21
|
+
var _map2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
|
|
22
|
+
var _filter2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/filter"));
|
|
23
|
+
var _keys2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/keys"));
|
|
24
|
+
var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
|
|
25
|
+
var _includes = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/includes"));
|
|
26
|
+
var _sort = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/sort"));
|
|
27
|
+
var _splice = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/splice"));
|
|
28
|
+
var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/promise"));
|
|
29
|
+
var _find = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/find"));
|
|
30
|
+
var _isArray = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/array/is-array"));
|
|
31
|
+
var _entries = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/entries"));
|
|
75
32
|
var _CoreManager = _interopRequireDefault(require("./CoreManager"));
|
|
76
|
-
|
|
77
33
|
var _encode = _interopRequireDefault(require("./encode"));
|
|
78
|
-
|
|
79
34
|
var _promiseUtils = require("./promiseUtils");
|
|
80
|
-
|
|
81
35
|
var _ParseError = _interopRequireDefault(require("./ParseError"));
|
|
82
|
-
|
|
83
36
|
var _ParseGeoPoint = _interopRequireDefault(require("./ParseGeoPoint"));
|
|
84
|
-
|
|
85
37
|
var _ParseObject = _interopRequireDefault(require("./ParseObject"));
|
|
86
|
-
|
|
87
38
|
var _OfflineQuery = _interopRequireDefault(require("./OfflineQuery"));
|
|
88
|
-
|
|
89
39
|
var _LocalDatastoreUtils = require("./LocalDatastoreUtils");
|
|
40
|
+
/*
|
|
41
|
+
* @flow
|
|
42
|
+
*/
|
|
90
43
|
|
|
91
|
-
function _regeneratorRuntime() {
|
|
92
|
-
"use strict";
|
|
93
|
-
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
94
|
-
|
|
95
|
-
_regeneratorRuntime = function () {
|
|
96
|
-
return exports;
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
var exports = {},
|
|
100
|
-
Op = Object.prototype,
|
|
101
|
-
hasOwn = Op.hasOwnProperty,
|
|
102
|
-
$Symbol = "function" == typeof _Symbol ? _Symbol : {},
|
|
103
|
-
iteratorSymbol = $Symbol.iterator || "@@iterator",
|
|
104
|
-
asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
|
|
105
|
-
toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
106
|
-
|
|
107
|
-
function define(obj, key, value) {
|
|
108
|
-
return _Object$defineProperty(obj, key, {
|
|
109
|
-
value: value,
|
|
110
|
-
enumerable: !0,
|
|
111
|
-
configurable: !0,
|
|
112
|
-
writable: !0
|
|
113
|
-
}), obj[key];
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
try {
|
|
117
|
-
define({}, "");
|
|
118
|
-
} catch (err) {
|
|
119
|
-
define = function (obj, key, value) {
|
|
120
|
-
return obj[key] = value;
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
125
|
-
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
|
|
126
|
-
generator = _Object$create(protoGenerator.prototype),
|
|
127
|
-
context = new Context(tryLocsList || []);
|
|
128
|
-
|
|
129
|
-
return generator._invoke = function (innerFn, self, context) {
|
|
130
|
-
var state = "suspendedStart";
|
|
131
|
-
return function (method, arg) {
|
|
132
|
-
if ("executing" === state) throw new Error("Generator is already running");
|
|
133
|
-
|
|
134
|
-
if ("completed" === state) {
|
|
135
|
-
if ("throw" === method) throw arg;
|
|
136
|
-
return doneResult();
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
for (context.method = method, context.arg = arg;;) {
|
|
140
|
-
var delegate = context.delegate;
|
|
141
|
-
|
|
142
|
-
if (delegate) {
|
|
143
|
-
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
144
|
-
|
|
145
|
-
if (delegateResult) {
|
|
146
|
-
if (delegateResult === ContinueSentinel) continue;
|
|
147
|
-
return delegateResult;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
|
|
152
|
-
if ("suspendedStart" === state) throw state = "completed", context.arg;
|
|
153
|
-
context.dispatchException(context.arg);
|
|
154
|
-
} else "return" === context.method && context.abrupt("return", context.arg);
|
|
155
|
-
state = "executing";
|
|
156
|
-
var record = tryCatch(innerFn, self, context);
|
|
157
|
-
|
|
158
|
-
if ("normal" === record.type) {
|
|
159
|
-
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
|
|
160
|
-
return {
|
|
161
|
-
value: record.arg,
|
|
162
|
-
done: context.done
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
|
|
167
|
-
}
|
|
168
|
-
};
|
|
169
|
-
}(innerFn, self, context), generator;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
function tryCatch(fn, obj, arg) {
|
|
173
|
-
try {
|
|
174
|
-
return {
|
|
175
|
-
type: "normal",
|
|
176
|
-
arg: fn.call(obj, arg)
|
|
177
|
-
};
|
|
178
|
-
} catch (err) {
|
|
179
|
-
return {
|
|
180
|
-
type: "throw",
|
|
181
|
-
arg: err
|
|
182
|
-
};
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
exports.wrap = wrap;
|
|
187
|
-
var ContinueSentinel = {};
|
|
188
|
-
|
|
189
|
-
function Generator() {}
|
|
190
|
-
|
|
191
|
-
function GeneratorFunction() {}
|
|
192
|
-
|
|
193
|
-
function GeneratorFunctionPrototype() {}
|
|
194
|
-
|
|
195
|
-
var IteratorPrototype = {};
|
|
196
|
-
define(IteratorPrototype, iteratorSymbol, function () {
|
|
197
|
-
return this;
|
|
198
|
-
});
|
|
199
|
-
var getProto = _Object$getPrototypeOf,
|
|
200
|
-
NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
201
|
-
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
|
|
202
|
-
|
|
203
|
-
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = _Object$create(IteratorPrototype);
|
|
204
|
-
|
|
205
|
-
function defineIteratorMethods(prototype) {
|
|
206
|
-
var _context23;
|
|
207
|
-
|
|
208
|
-
_forEachInstanceProperty2(_context23 = ["next", "throw", "return"]).call(_context23, function (method) {
|
|
209
|
-
define(prototype, method, function (arg) {
|
|
210
|
-
return this._invoke(method, arg);
|
|
211
|
-
});
|
|
212
|
-
});
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
function AsyncIterator(generator, PromiseImpl) {
|
|
216
|
-
function invoke(method, arg, resolve, reject) {
|
|
217
|
-
var record = tryCatch(generator[method], generator, arg);
|
|
218
|
-
|
|
219
|
-
if ("throw" !== record.type) {
|
|
220
|
-
var result = record.arg,
|
|
221
|
-
value = result.value;
|
|
222
|
-
return value && "object" == _typeof3(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
|
|
223
|
-
invoke("next", value, resolve, reject);
|
|
224
|
-
}, function (err) {
|
|
225
|
-
invoke("throw", err, resolve, reject);
|
|
226
|
-
}) : PromiseImpl.resolve(value).then(function (unwrapped) {
|
|
227
|
-
result.value = unwrapped, resolve(result);
|
|
228
|
-
}, function (error) {
|
|
229
|
-
return invoke("throw", error, resolve, reject);
|
|
230
|
-
});
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
reject(record.arg);
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
var previousPromise;
|
|
237
|
-
|
|
238
|
-
this._invoke = function (method, arg) {
|
|
239
|
-
function callInvokeWithMethodAndArg() {
|
|
240
|
-
return new PromiseImpl(function (resolve, reject) {
|
|
241
|
-
invoke(method, arg, resolve, reject);
|
|
242
|
-
});
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
246
|
-
};
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
function maybeInvokeDelegate(delegate, context) {
|
|
250
|
-
var method = delegate.iterator[context.method];
|
|
251
|
-
|
|
252
|
-
if (undefined === method) {
|
|
253
|
-
if (context.delegate = null, "throw" === context.method) {
|
|
254
|
-
if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
|
|
255
|
-
context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
return ContinueSentinel;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
262
|
-
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
|
|
263
|
-
var info = record.arg;
|
|
264
|
-
return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
function pushTryEntry(locs) {
|
|
268
|
-
var entry = {
|
|
269
|
-
tryLoc: locs[0]
|
|
270
|
-
};
|
|
271
|
-
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
function resetTryEntry(entry) {
|
|
275
|
-
var record = entry.completion || {};
|
|
276
|
-
record.type = "normal", delete record.arg, entry.completion = record;
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
function Context(tryLocsList) {
|
|
280
|
-
this.tryEntries = [{
|
|
281
|
-
tryLoc: "root"
|
|
282
|
-
}], _forEachInstanceProperty2(tryLocsList).call(tryLocsList, pushTryEntry, this), this.reset(!0);
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
function values(iterable) {
|
|
286
|
-
if (iterable) {
|
|
287
|
-
var iteratorMethod = iterable[iteratorSymbol];
|
|
288
|
-
if (iteratorMethod) return iteratorMethod.call(iterable);
|
|
289
|
-
if ("function" == typeof iterable.next) return iterable;
|
|
290
|
-
|
|
291
|
-
if (!isNaN(iterable.length)) {
|
|
292
|
-
var i = -1,
|
|
293
|
-
next = function next() {
|
|
294
|
-
for (; ++i < iterable.length;) {
|
|
295
|
-
if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
return next.value = undefined, next.done = !0, next;
|
|
299
|
-
};
|
|
300
|
-
|
|
301
|
-
return next.next = next;
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
return {
|
|
306
|
-
next: doneResult
|
|
307
|
-
};
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
function doneResult() {
|
|
311
|
-
return {
|
|
312
|
-
value: undefined,
|
|
313
|
-
done: !0
|
|
314
|
-
};
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
|
|
318
|
-
var ctor = "function" == typeof genFun && genFun.constructor;
|
|
319
|
-
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
|
|
320
|
-
}, exports.mark = function (genFun) {
|
|
321
|
-
return _Object$setPrototypeOf ? _Object$setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = _Object$create(Gp), genFun;
|
|
322
|
-
}, exports.awrap = function (arg) {
|
|
323
|
-
return {
|
|
324
|
-
__await: arg
|
|
325
|
-
};
|
|
326
|
-
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
|
|
327
|
-
return this;
|
|
328
|
-
}), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
|
329
|
-
void 0 === PromiseImpl && (PromiseImpl = _Promise2);
|
|
330
|
-
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
|
|
331
|
-
return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
|
|
332
|
-
return result.done ? result.value : iter.next();
|
|
333
|
-
});
|
|
334
|
-
}, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
|
|
335
|
-
return this;
|
|
336
|
-
}), define(Gp, "toString", function () {
|
|
337
|
-
return "[object Generator]";
|
|
338
|
-
}), exports.keys = function (object) {
|
|
339
|
-
var keys = [];
|
|
340
|
-
|
|
341
|
-
for (var key in object) {
|
|
342
|
-
keys.push(key);
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
return _reverseInstanceProperty(keys).call(keys), function next() {
|
|
346
|
-
for (; keys.length;) {
|
|
347
|
-
var key = keys.pop();
|
|
348
|
-
if (key in object) return next.value = key, next.done = !1, next;
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
return next.done = !0, next;
|
|
352
|
-
};
|
|
353
|
-
}, exports.values = values, Context.prototype = {
|
|
354
|
-
constructor: Context,
|
|
355
|
-
reset: function (skipTempReset) {
|
|
356
|
-
var _context24;
|
|
357
|
-
|
|
358
|
-
if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, _forEachInstanceProperty2(_context24 = this.tryEntries).call(_context24, resetTryEntry), !skipTempReset) for (var name in this) {
|
|
359
|
-
"t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+_sliceInstanceProperty2(name).call(name, 1)) && (this[name] = undefined);
|
|
360
|
-
}
|
|
361
|
-
},
|
|
362
|
-
stop: function () {
|
|
363
|
-
this.done = !0;
|
|
364
|
-
var rootRecord = this.tryEntries[0].completion;
|
|
365
|
-
if ("throw" === rootRecord.type) throw rootRecord.arg;
|
|
366
|
-
return this.rval;
|
|
367
|
-
},
|
|
368
|
-
dispatchException: function (exception) {
|
|
369
|
-
if (this.done) throw exception;
|
|
370
|
-
var context = this;
|
|
371
|
-
|
|
372
|
-
function handle(loc, caught) {
|
|
373
|
-
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
377
|
-
var entry = this.tryEntries[i],
|
|
378
|
-
record = entry.completion;
|
|
379
|
-
if ("root" === entry.tryLoc) return handle("end");
|
|
380
|
-
|
|
381
|
-
if (entry.tryLoc <= this.prev) {
|
|
382
|
-
var hasCatch = hasOwn.call(entry, "catchLoc"),
|
|
383
|
-
hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
384
|
-
|
|
385
|
-
if (hasCatch && hasFinally) {
|
|
386
|
-
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
387
|
-
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
388
|
-
} else if (hasCatch) {
|
|
389
|
-
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
390
|
-
} else {
|
|
391
|
-
if (!hasFinally) throw new Error("try statement without catch or finally");
|
|
392
|
-
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
},
|
|
397
|
-
abrupt: function (type, arg) {
|
|
398
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
399
|
-
var entry = this.tryEntries[i];
|
|
400
|
-
|
|
401
|
-
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
|
402
|
-
var finallyEntry = entry;
|
|
403
|
-
break;
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
|
|
408
|
-
var record = finallyEntry ? finallyEntry.completion : {};
|
|
409
|
-
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
|
|
410
|
-
},
|
|
411
|
-
complete: function (record, afterLoc) {
|
|
412
|
-
if ("throw" === record.type) throw record.arg;
|
|
413
|
-
return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
|
|
414
|
-
},
|
|
415
|
-
finish: function (finallyLoc) {
|
|
416
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
417
|
-
var entry = this.tryEntries[i];
|
|
418
|
-
if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
|
|
419
|
-
}
|
|
420
|
-
},
|
|
421
|
-
catch: function (tryLoc) {
|
|
422
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
423
|
-
var entry = this.tryEntries[i];
|
|
424
|
-
|
|
425
|
-
if (entry.tryLoc === tryLoc) {
|
|
426
|
-
var record = entry.completion;
|
|
427
|
-
|
|
428
|
-
if ("throw" === record.type) {
|
|
429
|
-
var thrown = record.arg;
|
|
430
|
-
resetTryEntry(entry);
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
return thrown;
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
throw new Error("illegal catch attempt");
|
|
438
|
-
},
|
|
439
|
-
delegateYield: function (iterable, resultName, nextLoc) {
|
|
440
|
-
return this.delegate = {
|
|
441
|
-
iterator: values(iterable),
|
|
442
|
-
resultName: resultName,
|
|
443
|
-
nextLoc: nextLoc
|
|
444
|
-
}, "next" === this.method && (this.arg = undefined), ContinueSentinel;
|
|
445
|
-
}
|
|
446
|
-
}, exports;
|
|
447
|
-
}
|
|
448
44
|
/**
|
|
449
45
|
* Converts a string into a regex that matches it.
|
|
450
46
|
* Surrounding with \Q .. \E does this, we just need to escape any \E's in
|
|
@@ -454,15 +50,10 @@ function _regeneratorRuntime() {
|
|
|
454
50
|
* @private
|
|
455
51
|
* @returns {string}
|
|
456
52
|
*/
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
function quote(s
|
|
460
|
-
/*: string*/
|
|
461
|
-
)
|
|
462
|
-
/*: string*/
|
|
463
|
-
{
|
|
53
|
+
function quote(s /*: string*/) /*: string*/{
|
|
464
54
|
return '\\Q' + s.replace('\\E', '\\E\\\\E\\Q') + '\\E';
|
|
465
55
|
}
|
|
56
|
+
|
|
466
57
|
/**
|
|
467
58
|
* Extracts the class name from queries. If not all queries have the same
|
|
468
59
|
* class name an error will be thrown.
|
|
@@ -471,41 +62,28 @@ function quote(s
|
|
|
471
62
|
* @private
|
|
472
63
|
* @returns {string}
|
|
473
64
|
*/
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
function _getClassNameFromQueries(queries
|
|
477
|
-
/*: Array<ParseQuery>*/
|
|
478
|
-
)
|
|
479
|
-
/*: ?string*/
|
|
480
|
-
{
|
|
65
|
+
function _getClassNameFromQueries(queries /*: Array<ParseQuery>*/) /*: ?string*/{
|
|
481
66
|
var className = null;
|
|
482
67
|
(0, _forEach.default)(queries).call(queries, function (q) {
|
|
483
68
|
if (!className) {
|
|
484
69
|
className = q.className;
|
|
485
70
|
}
|
|
486
|
-
|
|
487
71
|
if (className !== q.className) {
|
|
488
72
|
throw new Error('All queries must be for the same class.');
|
|
489
73
|
}
|
|
490
74
|
});
|
|
491
75
|
return className;
|
|
492
76
|
}
|
|
77
|
+
|
|
493
78
|
/*
|
|
494
79
|
* Handles pre-populating the result data of a query with select fields,
|
|
495
80
|
* making sure that the data object contains keys for all objects that have
|
|
496
81
|
* been requested with a select, so that our cached state updates correctly.
|
|
497
82
|
*/
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
function handleSelectResult(data
|
|
501
|
-
/*: any*/
|
|
502
|
-
, select
|
|
503
|
-
/*: Array<string>*/
|
|
504
|
-
) {
|
|
83
|
+
function handleSelectResult(data /*: any*/, select /*: Array<string>*/) {
|
|
505
84
|
var serverDataMask = {};
|
|
506
85
|
(0, _forEach.default)(select).call(select, function (field) {
|
|
507
86
|
var hasSubObjectSelect = (0, _indexOf.default)(field).call(field, '.') !== -1;
|
|
508
|
-
|
|
509
87
|
if (!hasSubObjectSelect && !data.hasOwnProperty(field)) {
|
|
510
88
|
// this field was selected, but is missing from the retrieved data
|
|
511
89
|
data[field] = undefined;
|
|
@@ -520,37 +98,33 @@ function handleSelectResult(data
|
|
|
520
98
|
if (_obj && !_obj.hasOwnProperty(component)) {
|
|
521
99
|
_obj[component] = undefined;
|
|
522
100
|
}
|
|
523
|
-
|
|
524
101
|
if (_obj && (0, _typeof2.default)(_obj) === 'object') {
|
|
525
102
|
_obj = _obj[component];
|
|
526
|
-
}
|
|
527
|
-
|
|
103
|
+
}
|
|
528
104
|
|
|
105
|
+
//add this path component to the server mask so we can fill it in later if needed
|
|
529
106
|
if (index < arr.length - 1) {
|
|
530
107
|
if (!serverMask[component]) {
|
|
531
108
|
serverMask[component] = {};
|
|
532
109
|
}
|
|
533
|
-
|
|
534
110
|
serverMask = serverMask[component];
|
|
535
111
|
}
|
|
536
112
|
});
|
|
537
113
|
}
|
|
538
114
|
});
|
|
539
|
-
|
|
540
|
-
if ((0, _keys2.default)(serverDataMask).length > 0) {
|
|
115
|
+
if ((0, _keys.default)(serverDataMask).length > 0) {
|
|
541
116
|
// When selecting from sub-objects, we don't want to blow away the missing
|
|
542
117
|
// information that we may have retrieved before. We've already added any
|
|
543
118
|
// missing selected keys to sub-objects, but we still need to add in the
|
|
544
119
|
// data for any previously retrieved sub-objects that were not selected.
|
|
120
|
+
|
|
545
121
|
var serverData = _CoreManager.default.getObjectStateController().getServerData({
|
|
546
122
|
id: data.objectId,
|
|
547
123
|
className: data.className
|
|
548
124
|
});
|
|
549
|
-
|
|
550
125
|
copyMissingDataWithMask(serverData, data, serverDataMask, false);
|
|
551
126
|
}
|
|
552
127
|
}
|
|
553
|
-
|
|
554
128
|
function copyMissingDataWithMask(src, dest, mask, copyThisLevel) {
|
|
555
129
|
//copy missing elements at this level
|
|
556
130
|
if (copyThisLevel) {
|
|
@@ -560,7 +134,6 @@ function copyMissingDataWithMask(src, dest, mask, copyThisLevel) {
|
|
|
560
134
|
}
|
|
561
135
|
}
|
|
562
136
|
}
|
|
563
|
-
|
|
564
137
|
for (var _key2 in mask) {
|
|
565
138
|
if (dest[_key2] !== undefined && dest[_key2] !== null && src !== undefined && src !== null) {
|
|
566
139
|
//traverse into objects as needed
|
|
@@ -568,44 +141,34 @@ function copyMissingDataWithMask(src, dest, mask, copyThisLevel) {
|
|
|
568
141
|
}
|
|
569
142
|
}
|
|
570
143
|
}
|
|
571
|
-
|
|
572
144
|
function handleOfflineSort(a, b, sorts) {
|
|
573
145
|
var order = sorts[0];
|
|
574
146
|
var operator = (0, _slice.default)(order).call(order, 0, 1);
|
|
575
147
|
var isDescending = operator === '-';
|
|
576
|
-
|
|
577
148
|
if (isDescending) {
|
|
578
149
|
order = order.substring(1);
|
|
579
150
|
}
|
|
580
|
-
|
|
581
151
|
if (order === '_created_at') {
|
|
582
152
|
order = 'createdAt';
|
|
583
153
|
}
|
|
584
|
-
|
|
585
154
|
if (order === '_updated_at') {
|
|
586
155
|
order = 'updatedAt';
|
|
587
156
|
}
|
|
588
|
-
|
|
589
157
|
if (!/^[A-Za-z][0-9A-Za-z_]*$/.test(order) || order === 'password') {
|
|
590
158
|
throw new _ParseError.default(_ParseError.default.INVALID_KEY_NAME, "Invalid Key: ".concat(order));
|
|
591
159
|
}
|
|
592
|
-
|
|
593
160
|
var field1 = a.get(order);
|
|
594
161
|
var field2 = b.get(order);
|
|
595
|
-
|
|
596
162
|
if (field1 < field2) {
|
|
597
163
|
return isDescending ? 1 : -1;
|
|
598
164
|
}
|
|
599
|
-
|
|
600
165
|
if (field1 > field2) {
|
|
601
166
|
return isDescending ? -1 : 1;
|
|
602
167
|
}
|
|
603
|
-
|
|
604
168
|
if (sorts.length > 1) {
|
|
605
169
|
var remainingSorts = (0, _slice.default)(sorts).call(sorts, 1);
|
|
606
170
|
return handleOfflineSort(a, b, remainingSorts);
|
|
607
171
|
}
|
|
608
|
-
|
|
609
172
|
return 0;
|
|
610
173
|
}
|
|
611
174
|
/**
|
|
@@ -651,8 +214,6 @@ function handleOfflineSort(a, b, sorts) {
|
|
|
651
214
|
*
|
|
652
215
|
* @alias Parse.Query
|
|
653
216
|
*/
|
|
654
|
-
|
|
655
|
-
|
|
656
217
|
var ParseQuery = /*#__PURE__*/function () {
|
|
657
218
|
/**
|
|
658
219
|
* @property {string} className
|
|
@@ -661,9 +222,7 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
661
222
|
/**
|
|
662
223
|
* @param {(string | Parse.Object)} objectClass An instance of a subclass of Parse.Object, or a Parse className string.
|
|
663
224
|
*/
|
|
664
|
-
function ParseQuery(objectClass
|
|
665
|
-
/*: string | ParseObject*/
|
|
666
|
-
) {
|
|
225
|
+
function ParseQuery(objectClass /*: string | ParseObject*/) {
|
|
667
226
|
(0, _classCallCheck2.default)(this, ParseQuery);
|
|
668
227
|
(0, _defineProperty2.default)(this, "className", void 0);
|
|
669
228
|
(0, _defineProperty2.default)(this, "_where", void 0);
|
|
@@ -683,7 +242,6 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
683
242
|
(0, _defineProperty2.default)(this, "_hint", void 0);
|
|
684
243
|
(0, _defineProperty2.default)(this, "_explain", void 0);
|
|
685
244
|
(0, _defineProperty2.default)(this, "_xhrRequest", void 0);
|
|
686
|
-
|
|
687
245
|
if (typeof objectClass === 'string') {
|
|
688
246
|
if (objectClass === 'User' && _CoreManager.default.get('PERFORM_USER_REWRITE')) {
|
|
689
247
|
this.className = '_User';
|
|
@@ -697,19 +255,16 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
697
255
|
this.className = objectClass.className;
|
|
698
256
|
} else {
|
|
699
257
|
var _obj2 = new objectClass();
|
|
700
|
-
|
|
701
258
|
this.className = _obj2.className;
|
|
702
259
|
}
|
|
703
260
|
} else {
|
|
704
261
|
throw new TypeError('A ParseQuery must be constructed with a ParseObject or class name.');
|
|
705
262
|
}
|
|
706
|
-
|
|
707
263
|
this._where = {};
|
|
708
264
|
this._include = [];
|
|
709
265
|
this._exclude = [];
|
|
710
266
|
this._count = false;
|
|
711
267
|
this._limit = -1; // negative limit is not sent in the server request
|
|
712
|
-
|
|
713
268
|
this._skip = 0;
|
|
714
269
|
this._readPreference = null;
|
|
715
270
|
this._includeReadPreference = null;
|
|
@@ -722,67 +277,55 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
722
277
|
onchange: function () {}
|
|
723
278
|
};
|
|
724
279
|
}
|
|
280
|
+
|
|
725
281
|
/**
|
|
726
282
|
* Adds constraint that at least one of the passed in queries matches.
|
|
727
283
|
*
|
|
728
284
|
* @param {Array} queries
|
|
729
285
|
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
730
286
|
*/
|
|
731
|
-
|
|
732
|
-
|
|
733
287
|
(0, _createClass2.default)(ParseQuery, [{
|
|
734
288
|
key: "_orQuery",
|
|
735
|
-
value: function (queries
|
|
736
|
-
/*: Array<ParseQuery>*/
|
|
737
|
-
)
|
|
738
|
-
/*: ParseQuery*/
|
|
739
|
-
{
|
|
289
|
+
value: function (queries /*: Array<ParseQuery>*/) /*: ParseQuery*/{
|
|
740
290
|
var queryJSON = (0, _map2.default)(queries).call(queries, function (q) {
|
|
741
291
|
return q.toJSON().where;
|
|
742
292
|
});
|
|
743
293
|
this._where.$or = queryJSON;
|
|
744
294
|
return this;
|
|
745
295
|
}
|
|
296
|
+
|
|
746
297
|
/**
|
|
747
298
|
* Adds constraint that all of the passed in queries match.
|
|
748
299
|
*
|
|
749
300
|
* @param {Array} queries
|
|
750
301
|
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
751
302
|
*/
|
|
752
|
-
|
|
753
303
|
}, {
|
|
754
304
|
key: "_andQuery",
|
|
755
|
-
value: function (queries
|
|
756
|
-
/*: Array<ParseQuery>*/
|
|
757
|
-
)
|
|
758
|
-
/*: ParseQuery*/
|
|
759
|
-
{
|
|
305
|
+
value: function (queries /*: Array<ParseQuery>*/) /*: ParseQuery*/{
|
|
760
306
|
var queryJSON = (0, _map2.default)(queries).call(queries, function (q) {
|
|
761
307
|
return q.toJSON().where;
|
|
762
308
|
});
|
|
763
309
|
this._where.$and = queryJSON;
|
|
764
310
|
return this;
|
|
765
311
|
}
|
|
312
|
+
|
|
766
313
|
/**
|
|
767
314
|
* Adds constraint that none of the passed in queries match.
|
|
768
315
|
*
|
|
769
316
|
* @param {Array} queries
|
|
770
317
|
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
771
318
|
*/
|
|
772
|
-
|
|
773
319
|
}, {
|
|
774
320
|
key: "_norQuery",
|
|
775
|
-
value: function (queries
|
|
776
|
-
/*: Array<ParseQuery>*/
|
|
777
|
-
)
|
|
778
|
-
/*: ParseQuery*/
|
|
779
|
-
{
|
|
321
|
+
value: function (queries /*: Array<ParseQuery>*/) /*: ParseQuery*/{
|
|
780
322
|
var queryJSON = (0, _map2.default)(queries).call(queries, function (q) {
|
|
781
323
|
return q.toJSON().where;
|
|
782
324
|
});
|
|
783
325
|
this._where.$nor = queryJSON;
|
|
784
326
|
return this;
|
|
785
327
|
}
|
|
328
|
+
|
|
786
329
|
/**
|
|
787
330
|
* Helper for condition queries
|
|
788
331
|
*
|
|
@@ -791,150 +334,112 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
791
334
|
* @param value
|
|
792
335
|
* @returns {Parse.Query}
|
|
793
336
|
*/
|
|
794
|
-
|
|
795
337
|
}, {
|
|
796
338
|
key: "_addCondition",
|
|
797
|
-
value: function (key
|
|
798
|
-
/*: string*/
|
|
799
|
-
, condition
|
|
800
|
-
/*: string*/
|
|
801
|
-
, value
|
|
802
|
-
/*: mixed*/
|
|
803
|
-
)
|
|
804
|
-
/*: ParseQuery*/
|
|
805
|
-
{
|
|
339
|
+
value: function (key /*: string*/, condition /*: string*/, value /*: mixed*/) /*: ParseQuery*/{
|
|
806
340
|
if (!this._where[key] || typeof this._where[key] === 'string') {
|
|
807
341
|
this._where[key] = {};
|
|
808
342
|
}
|
|
809
|
-
|
|
810
343
|
this._where[key][condition] = (0, _encode.default)(value, false, true);
|
|
811
344
|
return this;
|
|
812
345
|
}
|
|
346
|
+
|
|
813
347
|
/**
|
|
814
348
|
* Converts string for regular expression at the beginning
|
|
815
349
|
*
|
|
816
350
|
* @param string
|
|
817
351
|
* @returns {string}
|
|
818
352
|
*/
|
|
819
|
-
|
|
820
353
|
}, {
|
|
821
354
|
key: "_regexStartWith",
|
|
822
|
-
value: function (string
|
|
823
|
-
/*: string*/
|
|
824
|
-
)
|
|
825
|
-
/*: string*/
|
|
826
|
-
{
|
|
355
|
+
value: function (string /*: string*/) /*: string*/{
|
|
827
356
|
return '^' + quote(string);
|
|
828
357
|
}
|
|
829
358
|
}, {
|
|
830
359
|
key: "_handleOfflineQuery",
|
|
831
360
|
value: function () {
|
|
832
|
-
var _handleOfflineQuery2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/
|
|
833
|
-
/*: any*/
|
|
834
|
-
) {
|
|
361
|
+
var _handleOfflineQuery2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(params /*: any*/) {
|
|
835
362
|
var _context,
|
|
836
|
-
|
|
837
|
-
|
|
363
|
+
_this2 = this;
|
|
838
364
|
var localDatastore, objects, results, keys, alwaysSelectedKeys, sorts, count, limit;
|
|
839
|
-
return
|
|
840
|
-
while (1) {
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
var object = _ParseObject.default.fromJSON(json, false);
|
|
853
|
-
|
|
854
|
-
if (json._localId && !json.objectId) {
|
|
855
|
-
object._localId = json._localId;
|
|
856
|
-
}
|
|
857
|
-
|
|
858
|
-
if (!_OfflineQuery.default.matchesQuery(_this2.className, object, arr, _this2)) {
|
|
859
|
-
return null;
|
|
860
|
-
}
|
|
861
|
-
|
|
862
|
-
return object;
|
|
863
|
-
})).call(_context, function (object) {
|
|
864
|
-
return object !== null;
|
|
865
|
-
});
|
|
866
|
-
|
|
867
|
-
if ((0, _keys.default)(params)) {
|
|
868
|
-
keys = (0, _keys.default)(params).split(',');
|
|
869
|
-
alwaysSelectedKeys = ['className', 'objectId', 'createdAt', 'updatedAt', 'ACL'];
|
|
870
|
-
keys = (0, _concat.default)(keys).call(keys, alwaysSelectedKeys);
|
|
871
|
-
results = (0, _map2.default)(results).call(results, function (object) {
|
|
872
|
-
var _context2;
|
|
873
|
-
|
|
874
|
-
var json = object._toFullJSON();
|
|
875
|
-
|
|
876
|
-
(0, _forEach.default)(_context2 = (0, _keys2.default)(json)).call(_context2, function (key) {
|
|
877
|
-
if (!(0, _includes.default)(keys).call(keys, key)) {
|
|
878
|
-
delete json[key];
|
|
879
|
-
}
|
|
880
|
-
});
|
|
881
|
-
return _ParseObject.default.fromJSON(json, false);
|
|
882
|
-
});
|
|
883
|
-
}
|
|
884
|
-
|
|
885
|
-
if (params.order) {
|
|
886
|
-
sorts = params.order.split(',');
|
|
887
|
-
(0, _sort.default)(results).call(results, function (a, b) {
|
|
888
|
-
return handleOfflineSort(a, b, sorts);
|
|
889
|
-
});
|
|
890
|
-
} // count total before applying limit/skip
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
if (params.count) {
|
|
894
|
-
count = results.length; // total count from response
|
|
895
|
-
}
|
|
896
|
-
|
|
897
|
-
if (params.skip) {
|
|
898
|
-
if (params.skip >= results.length) {
|
|
899
|
-
results = [];
|
|
900
|
-
} else {
|
|
901
|
-
results = (0, _splice.default)(results).call(results, params.skip, results.length);
|
|
902
|
-
}
|
|
903
|
-
}
|
|
904
|
-
|
|
905
|
-
limit = results.length;
|
|
906
|
-
|
|
907
|
-
if (params.limit !== 0 && params.limit < results.length) {
|
|
908
|
-
limit = params.limit;
|
|
365
|
+
return _regenerator.default.wrap(function (_context3) {
|
|
366
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
367
|
+
case 0:
|
|
368
|
+
_OfflineQuery.default.validateQuery(this);
|
|
369
|
+
localDatastore = _CoreManager.default.getLocalDatastore();
|
|
370
|
+
_context3.next = 4;
|
|
371
|
+
return localDatastore._serializeObjectsFromPinName(this._localDatastorePinName);
|
|
372
|
+
case 4:
|
|
373
|
+
objects = _context3.sent;
|
|
374
|
+
results = (0, _filter2.default)(_context = (0, _map2.default)(objects).call(objects, function (json, index, arr) {
|
|
375
|
+
var object = _ParseObject.default.fromJSON(json, false);
|
|
376
|
+
if (json._localId && !json.objectId) {
|
|
377
|
+
object._localId = json._localId;
|
|
909
378
|
}
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
if (!(typeof count === 'number')) {
|
|
914
|
-
_context3.next = 15;
|
|
915
|
-
break;
|
|
379
|
+
if (!_OfflineQuery.default.matchesQuery(_this2.className, object, arr, _this2)) {
|
|
380
|
+
return null;
|
|
916
381
|
}
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
382
|
+
return object;
|
|
383
|
+
})).call(_context, function (object) {
|
|
384
|
+
return object !== null;
|
|
385
|
+
});
|
|
386
|
+
if ((0, _keys2.default)(params)) {
|
|
387
|
+
keys = (0, _keys2.default)(params).split(',');
|
|
388
|
+
alwaysSelectedKeys = ['className', 'objectId', 'createdAt', 'updatedAt', 'ACL'];
|
|
389
|
+
keys = (0, _concat.default)(keys).call(keys, alwaysSelectedKeys);
|
|
390
|
+
results = (0, _map2.default)(results).call(results, function (object) {
|
|
391
|
+
var _context2;
|
|
392
|
+
var json = object._toFullJSON();
|
|
393
|
+
(0, _forEach.default)(_context2 = (0, _keys.default)(json)).call(_context2, function (key) {
|
|
394
|
+
if (!(0, _includes.default)(keys).call(keys, key)) {
|
|
395
|
+
delete json[key];
|
|
396
|
+
}
|
|
397
|
+
});
|
|
398
|
+
return _ParseObject.default.fromJSON(json, false);
|
|
921
399
|
});
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
400
|
+
}
|
|
401
|
+
if (params.order) {
|
|
402
|
+
sorts = params.order.split(',');
|
|
403
|
+
(0, _sort.default)(results).call(results, function (a, b) {
|
|
404
|
+
return handleOfflineSort(a, b, sorts);
|
|
405
|
+
});
|
|
406
|
+
}
|
|
407
|
+
// count total before applying limit/skip
|
|
408
|
+
if (params.count) {
|
|
409
|
+
count = results.length; // total count from response
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
if (params.skip) {
|
|
413
|
+
if (params.skip >= results.length) {
|
|
414
|
+
results = [];
|
|
415
|
+
} else {
|
|
416
|
+
results = (0, _splice.default)(results).call(results, params.skip, results.length);
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
limit = results.length;
|
|
420
|
+
if (params.limit !== 0 && params.limit < results.length) {
|
|
421
|
+
limit = params.limit;
|
|
422
|
+
}
|
|
423
|
+
results = (0, _splice.default)(results).call(results, 0, limit);
|
|
424
|
+
if (!(typeof count === 'number')) {
|
|
425
|
+
_context3.next = 15;
|
|
426
|
+
break;
|
|
427
|
+
}
|
|
428
|
+
return _context3.abrupt("return", {
|
|
429
|
+
results: results,
|
|
430
|
+
count: count
|
|
431
|
+
});
|
|
432
|
+
case 15:
|
|
433
|
+
return _context3.abrupt("return", results);
|
|
434
|
+
case 16:
|
|
435
|
+
case "end":
|
|
436
|
+
return _context3.stop();
|
|
930
437
|
}
|
|
931
438
|
}, _callee, this);
|
|
932
439
|
}));
|
|
933
|
-
|
|
934
440
|
function _handleOfflineQuery() {
|
|
935
441
|
return _handleOfflineQuery2.apply(this, arguments);
|
|
936
442
|
}
|
|
937
|
-
|
|
938
443
|
return _handleOfflineQuery;
|
|
939
444
|
}()
|
|
940
445
|
/**
|
|
@@ -942,72 +447,54 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
942
447
|
*
|
|
943
448
|
* @returns {object} The JSON representation of the query.
|
|
944
449
|
*/
|
|
945
|
-
|
|
946
450
|
}, {
|
|
947
451
|
key: "toJSON",
|
|
948
|
-
value: function ()
|
|
949
|
-
|
|
950
|
-
{
|
|
951
|
-
var params
|
|
952
|
-
/*: QueryJSON*/
|
|
953
|
-
= {
|
|
452
|
+
value: function () /*: QueryJSON*/{
|
|
453
|
+
var params /*: QueryJSON*/ = {
|
|
954
454
|
where: this._where
|
|
955
455
|
};
|
|
956
|
-
|
|
957
456
|
if (this._include.length) {
|
|
958
457
|
params.include = this._include.join(',');
|
|
959
458
|
}
|
|
960
|
-
|
|
961
459
|
if (this._exclude.length) {
|
|
962
460
|
params.excludeKeys = this._exclude.join(',');
|
|
963
461
|
}
|
|
964
|
-
|
|
965
462
|
if (this._select) {
|
|
966
463
|
params.keys = this._select.join(',');
|
|
967
464
|
}
|
|
968
|
-
|
|
969
465
|
if (this._count) {
|
|
970
466
|
params.count = 1;
|
|
971
467
|
}
|
|
972
|
-
|
|
973
468
|
if (this._limit >= 0) {
|
|
974
469
|
params.limit = this._limit;
|
|
975
470
|
}
|
|
976
|
-
|
|
977
471
|
if (this._skip > 0) {
|
|
978
472
|
params.skip = this._skip;
|
|
979
473
|
}
|
|
980
|
-
|
|
981
474
|
if (this._order) {
|
|
982
475
|
params.order = this._order.join(',');
|
|
983
476
|
}
|
|
984
|
-
|
|
985
477
|
if (this._readPreference) {
|
|
986
478
|
params.readPreference = this._readPreference;
|
|
987
479
|
}
|
|
988
|
-
|
|
989
480
|
if (this._includeReadPreference) {
|
|
990
481
|
params.includeReadPreference = this._includeReadPreference;
|
|
991
482
|
}
|
|
992
|
-
|
|
993
483
|
if (this._subqueryReadPreference) {
|
|
994
484
|
params.subqueryReadPreference = this._subqueryReadPreference;
|
|
995
485
|
}
|
|
996
|
-
|
|
997
486
|
if (this._hint) {
|
|
998
487
|
params.hint = this._hint;
|
|
999
488
|
}
|
|
1000
|
-
|
|
1001
489
|
if (this._explain) {
|
|
1002
490
|
params.explain = true;
|
|
1003
491
|
}
|
|
1004
|
-
|
|
1005
492
|
for (var _key3 in this._extraOptions) {
|
|
1006
493
|
params[_key3] = this._extraOptions[_key3];
|
|
1007
494
|
}
|
|
1008
|
-
|
|
1009
495
|
return params;
|
|
1010
496
|
}
|
|
497
|
+
|
|
1011
498
|
/**
|
|
1012
499
|
* Return a query with conditions from json, can be useful to send query from server side to client
|
|
1013
500
|
* Not static, all query conditions was set before calling this method will be deleted.
|
|
@@ -1029,78 +516,59 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
1029
516
|
* @param {QueryJSON} json from Parse.Query.toJSON() method
|
|
1030
517
|
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
1031
518
|
*/
|
|
1032
|
-
|
|
1033
519
|
}, {
|
|
1034
520
|
key: "withJSON",
|
|
1035
|
-
value: function (json
|
|
1036
|
-
/*: QueryJSON*/
|
|
1037
|
-
)
|
|
1038
|
-
/*: ParseQuery*/
|
|
1039
|
-
{
|
|
521
|
+
value: function (json /*: QueryJSON*/) /*: ParseQuery*/{
|
|
1040
522
|
if (json.where) {
|
|
1041
523
|
this._where = json.where;
|
|
1042
524
|
}
|
|
1043
|
-
|
|
1044
525
|
if (json.include) {
|
|
1045
526
|
this._include = json.include.split(',');
|
|
1046
527
|
}
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
this._select = (0, _keys.default)(json).split(',');
|
|
528
|
+
if ((0, _keys2.default)(json)) {
|
|
529
|
+
this._select = (0, _keys2.default)(json).split(',');
|
|
1050
530
|
}
|
|
1051
|
-
|
|
1052
531
|
if (json.excludeKeys) {
|
|
1053
532
|
this._exclude = json.excludeKeys.split(',');
|
|
1054
533
|
}
|
|
1055
|
-
|
|
1056
534
|
if (json.count) {
|
|
1057
535
|
this._count = json.count === 1;
|
|
1058
536
|
}
|
|
1059
|
-
|
|
1060
537
|
if (json.limit) {
|
|
1061
538
|
this._limit = json.limit;
|
|
1062
539
|
}
|
|
1063
|
-
|
|
1064
540
|
if (json.skip) {
|
|
1065
541
|
this._skip = json.skip;
|
|
1066
542
|
}
|
|
1067
|
-
|
|
1068
543
|
if (json.order) {
|
|
1069
544
|
this._order = json.order.split(',');
|
|
1070
545
|
}
|
|
1071
|
-
|
|
1072
546
|
if (json.readPreference) {
|
|
1073
547
|
this._readPreference = json.readPreference;
|
|
1074
548
|
}
|
|
1075
|
-
|
|
1076
549
|
if (json.includeReadPreference) {
|
|
1077
550
|
this._includeReadPreference = json.includeReadPreference;
|
|
1078
551
|
}
|
|
1079
|
-
|
|
1080
552
|
if (json.subqueryReadPreference) {
|
|
1081
553
|
this._subqueryReadPreference = json.subqueryReadPreference;
|
|
1082
554
|
}
|
|
1083
|
-
|
|
1084
555
|
if (json.hint) {
|
|
1085
556
|
this._hint = json.hint;
|
|
1086
557
|
}
|
|
1087
|
-
|
|
1088
558
|
if (json.explain) {
|
|
1089
559
|
this._explain = !!json.explain;
|
|
1090
560
|
}
|
|
1091
|
-
|
|
1092
561
|
for (var _key4 in json) {
|
|
1093
562
|
if (json.hasOwnProperty(_key4)) {
|
|
1094
563
|
var _context4;
|
|
1095
|
-
|
|
1096
564
|
if ((0, _indexOf.default)(_context4 = ['where', 'include', 'keys', 'count', 'limit', 'skip', 'order', 'readPreference', 'includeReadPreference', 'subqueryReadPreference', 'hint', 'explain']).call(_context4, _key4) === -1) {
|
|
1097
565
|
this._extraOptions[_key4] = json[_key4];
|
|
1098
566
|
}
|
|
1099
567
|
}
|
|
1100
568
|
}
|
|
1101
|
-
|
|
1102
569
|
return this;
|
|
1103
570
|
}
|
|
571
|
+
|
|
1104
572
|
/**
|
|
1105
573
|
* Static method to restore Parse.Query by json representation
|
|
1106
574
|
* Internally calling Parse.Query.withJSON
|
|
@@ -1109,7 +577,6 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
1109
577
|
* @param {QueryJSON} json from Parse.Query.toJSON() method
|
|
1110
578
|
* @returns {Parse.Query} new created query
|
|
1111
579
|
*/
|
|
1112
|
-
|
|
1113
580
|
}, {
|
|
1114
581
|
key: "get",
|
|
1115
582
|
value:
|
|
@@ -1127,45 +594,33 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
1127
594
|
* <li>context: A dictionary that is accessible in Cloud Code `beforeFind` trigger.
|
|
1128
595
|
* <li>json: Return raw json without converting to Parse.Object
|
|
1129
596
|
* </ul>
|
|
1130
|
-
*
|
|
1131
597
|
* @returns {Promise} A promise that is resolved with the result when
|
|
1132
598
|
* the query completes.
|
|
1133
599
|
*/
|
|
1134
|
-
function (objectId
|
|
1135
|
-
/*: string*/
|
|
1136
|
-
, options
|
|
1137
|
-
/*:: ?: FullOptions*/
|
|
1138
|
-
)
|
|
1139
|
-
/*: Promise<ParseObject>*/
|
|
1140
|
-
{
|
|
600
|
+
function (objectId /*: string*/, options /*:: ?: FullOptions*/) /*: Promise<ParseObject>*/{
|
|
1141
601
|
this.equalTo('objectId', objectId);
|
|
1142
602
|
var firstOptions = {};
|
|
1143
|
-
|
|
1144
603
|
if (options && options.hasOwnProperty('useMasterKey')) {
|
|
1145
604
|
firstOptions.useMasterKey = options.useMasterKey;
|
|
1146
605
|
}
|
|
1147
|
-
|
|
1148
606
|
if (options && options.hasOwnProperty('sessionToken')) {
|
|
1149
607
|
firstOptions.sessionToken = options.sessionToken;
|
|
1150
608
|
}
|
|
1151
|
-
|
|
1152
609
|
if (options && options.hasOwnProperty('context') && (0, _typeof2.default)(options.context) === 'object') {
|
|
1153
610
|
firstOptions.context = options.context;
|
|
1154
611
|
}
|
|
1155
|
-
|
|
1156
612
|
if (options && options.hasOwnProperty('json')) {
|
|
1157
613
|
firstOptions.json = options.json;
|
|
1158
614
|
}
|
|
1159
|
-
|
|
1160
615
|
return this.first(firstOptions).then(function (response) {
|
|
1161
616
|
if (response) {
|
|
1162
617
|
return response;
|
|
1163
618
|
}
|
|
1164
|
-
|
|
1165
619
|
var errorObject = new _ParseError.default(_ParseError.default.OBJECT_NOT_FOUND, 'Object not found.');
|
|
1166
620
|
return _promise.default.reject(errorObject);
|
|
1167
621
|
});
|
|
1168
622
|
}
|
|
623
|
+
|
|
1169
624
|
/**
|
|
1170
625
|
* Retrieves a list of ParseObjects that satisfy this query.
|
|
1171
626
|
*
|
|
@@ -1178,69 +633,50 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
1178
633
|
* <li>context: A dictionary that is accessible in Cloud Code `beforeFind` trigger.
|
|
1179
634
|
* <li>json: Return raw json without converting to Parse.Object
|
|
1180
635
|
* </ul>
|
|
1181
|
-
*
|
|
1182
636
|
* @returns {Promise} A promise that is resolved with the results when
|
|
1183
637
|
* the query completes.
|
|
1184
638
|
*/
|
|
1185
|
-
|
|
1186
639
|
}, {
|
|
1187
640
|
key: "find",
|
|
1188
|
-
value: function (options
|
|
1189
|
-
/*:: ?: FullOptions*/
|
|
1190
|
-
)
|
|
1191
|
-
/*: Promise<Array<ParseObject>>*/
|
|
1192
|
-
{
|
|
641
|
+
value: function (options /*:: ?: FullOptions*/) /*: Promise<Array<ParseObject>>*/{
|
|
1193
642
|
var _this3 = this;
|
|
1194
|
-
|
|
1195
643
|
options = options || {};
|
|
1196
644
|
var findOptions = {};
|
|
1197
|
-
|
|
1198
645
|
if (options.hasOwnProperty('useMasterKey')) {
|
|
1199
646
|
findOptions.useMasterKey = options.useMasterKey;
|
|
1200
647
|
}
|
|
1201
|
-
|
|
1202
648
|
if (options.hasOwnProperty('sessionToken')) {
|
|
1203
649
|
findOptions.sessionToken = options.sessionToken;
|
|
1204
650
|
}
|
|
1205
|
-
|
|
1206
651
|
if (options.hasOwnProperty('context') && (0, _typeof2.default)(options.context) === 'object') {
|
|
1207
652
|
findOptions.context = options.context;
|
|
1208
653
|
}
|
|
1209
|
-
|
|
1210
654
|
this._setRequestTask(findOptions);
|
|
1211
|
-
|
|
1212
655
|
var controller = _CoreManager.default.getQueryController();
|
|
1213
|
-
|
|
1214
656
|
var select = this._select;
|
|
1215
|
-
|
|
1216
657
|
if (this._queriesLocalDatastore) {
|
|
1217
658
|
return this._handleOfflineQuery(this.toJSON());
|
|
1218
659
|
}
|
|
1219
|
-
|
|
1220
660
|
return (0, _find.default)(controller).call(controller, this.className, this.toJSON(), findOptions).then(function (response) {
|
|
1221
|
-
var _context5;
|
|
1222
|
-
|
|
1223
|
-
|
|
661
|
+
var _context5;
|
|
662
|
+
// Return generic object when explain is used
|
|
1224
663
|
if (_this3._explain) {
|
|
1225
664
|
return response.results;
|
|
1226
665
|
}
|
|
1227
|
-
|
|
1228
666
|
var results = (0, _map2.default)(_context5 = response.results).call(_context5, function (data) {
|
|
1229
667
|
// In cases of relations, the server may send back a className
|
|
1230
668
|
// on the top level of the payload
|
|
1231
669
|
var override = response.className || _this3.className;
|
|
1232
|
-
|
|
1233
670
|
if (!data.className) {
|
|
1234
671
|
data.className = override;
|
|
1235
|
-
}
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
// Make sure the data object contains keys for all objects that
|
|
1236
675
|
// have been requested with a select, so that our cached state
|
|
1237
676
|
// updates correctly.
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
677
|
if (select) {
|
|
1241
678
|
handleSelectResult(data, select);
|
|
1242
679
|
}
|
|
1243
|
-
|
|
1244
680
|
if (options.json) {
|
|
1245
681
|
return data;
|
|
1246
682
|
} else {
|
|
@@ -1248,7 +684,6 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
1248
684
|
}
|
|
1249
685
|
});
|
|
1250
686
|
var count = response.count;
|
|
1251
|
-
|
|
1252
687
|
if (typeof count === 'number') {
|
|
1253
688
|
return {
|
|
1254
689
|
results: results,
|
|
@@ -1259,6 +694,7 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
1259
694
|
}
|
|
1260
695
|
});
|
|
1261
696
|
}
|
|
697
|
+
|
|
1262
698
|
/**
|
|
1263
699
|
* Retrieves a complete list of ParseObjects that satisfy this query.
|
|
1264
700
|
* Using `eachBatch` under the hood to fetch all the valid objects.
|
|
@@ -1273,45 +709,31 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
1273
709
|
* @returns {Promise} A promise that is resolved with the results when
|
|
1274
710
|
* the query completes.
|
|
1275
711
|
*/
|
|
1276
|
-
|
|
1277
712
|
}, {
|
|
1278
713
|
key: "findAll",
|
|
1279
714
|
value: function () {
|
|
1280
|
-
var _findAll = (0, _asyncToGenerator2.default)( /*#__PURE__*/
|
|
1281
|
-
/*:: ?: BatchOptions*/
|
|
1282
|
-
) {
|
|
715
|
+
var _findAll = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(options /*:: ?: BatchOptions*/) {
|
|
1283
716
|
var result;
|
|
1284
|
-
return
|
|
1285
|
-
while (1) {
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
}, options);
|
|
1299
|
-
|
|
1300
|
-
case 3:
|
|
1301
|
-
return _context7.abrupt("return", result);
|
|
1302
|
-
|
|
1303
|
-
case 4:
|
|
1304
|
-
case "end":
|
|
1305
|
-
return _context7.stop();
|
|
1306
|
-
}
|
|
717
|
+
return _regenerator.default.wrap(function (_context7) {
|
|
718
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
719
|
+
case 0:
|
|
720
|
+
result /*: ParseObject[]*/ = [];
|
|
721
|
+
_context7.next = 3;
|
|
722
|
+
return this.eachBatch(function (objects /*: ParseObject[]*/) {
|
|
723
|
+
var _context6;
|
|
724
|
+
result = (0, _concat.default)(_context6 = []).call(_context6, (0, _toConsumableArray2.default)(result), (0, _toConsumableArray2.default)(objects));
|
|
725
|
+
}, options);
|
|
726
|
+
case 3:
|
|
727
|
+
return _context7.abrupt("return", result);
|
|
728
|
+
case 4:
|
|
729
|
+
case "end":
|
|
730
|
+
return _context7.stop();
|
|
1307
731
|
}
|
|
1308
732
|
}, _callee2, this);
|
|
1309
733
|
}));
|
|
1310
|
-
|
|
1311
|
-
function findAll(_x2) {
|
|
734
|
+
function findAll() {
|
|
1312
735
|
return _findAll.apply(this, arguments);
|
|
1313
736
|
}
|
|
1314
|
-
|
|
1315
737
|
return findAll;
|
|
1316
738
|
}()
|
|
1317
739
|
/**
|
|
@@ -1324,33 +746,22 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
1324
746
|
* <li>sessionToken: A valid session token, used for making a request on
|
|
1325
747
|
* behalf of a specific user.
|
|
1326
748
|
* </ul>
|
|
1327
|
-
*
|
|
1328
749
|
* @returns {Promise} A promise that is resolved with the count when
|
|
1329
750
|
* the query completes.
|
|
1330
751
|
*/
|
|
1331
|
-
|
|
1332
752
|
}, {
|
|
1333
753
|
key: "count",
|
|
1334
|
-
value: function
|
|
1335
|
-
/*:: ?: FullOptions*/
|
|
1336
|
-
)
|
|
1337
|
-
/*: Promise<number>*/
|
|
1338
|
-
{
|
|
754
|
+
value: function (options /*:: ?: FullOptions*/) /*: Promise<number>*/{
|
|
1339
755
|
options = options || {};
|
|
1340
756
|
var findOptions = {};
|
|
1341
|
-
|
|
1342
757
|
if (options.hasOwnProperty('useMasterKey')) {
|
|
1343
758
|
findOptions.useMasterKey = options.useMasterKey;
|
|
1344
759
|
}
|
|
1345
|
-
|
|
1346
760
|
if (options.hasOwnProperty('sessionToken')) {
|
|
1347
761
|
findOptions.sessionToken = options.sessionToken;
|
|
1348
762
|
}
|
|
1349
|
-
|
|
1350
763
|
this._setRequestTask(findOptions);
|
|
1351
|
-
|
|
1352
764
|
var controller = _CoreManager.default.getQueryController();
|
|
1353
|
-
|
|
1354
765
|
var params = this.toJSON();
|
|
1355
766
|
params.limit = 0;
|
|
1356
767
|
params.count = 1;
|
|
@@ -1358,6 +769,7 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
1358
769
|
return result.count;
|
|
1359
770
|
});
|
|
1360
771
|
}
|
|
772
|
+
|
|
1361
773
|
/**
|
|
1362
774
|
* Executes a distinct query and returns unique values
|
|
1363
775
|
*
|
|
@@ -1367,31 +779,19 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
1367
779
|
* <li>sessionToken: A valid session token, used for making a request on
|
|
1368
780
|
* behalf of a specific user.
|
|
1369
781
|
* </ul>
|
|
1370
|
-
*
|
|
1371
782
|
* @returns {Promise} A promise that is resolved with the query completes.
|
|
1372
783
|
*/
|
|
1373
|
-
|
|
1374
784
|
}, {
|
|
1375
785
|
key: "distinct",
|
|
1376
|
-
value: function
|
|
1377
|
-
/*: string*/
|
|
1378
|
-
, options
|
|
1379
|
-
/*:: ?: FullOptions*/
|
|
1380
|
-
)
|
|
1381
|
-
/*: Promise<Array<mixed>>*/
|
|
1382
|
-
{
|
|
786
|
+
value: function (key /*: string*/, options /*:: ?: FullOptions*/) /*: Promise<Array<mixed>>*/{
|
|
1383
787
|
options = options || {};
|
|
1384
788
|
var distinctOptions = {};
|
|
1385
789
|
distinctOptions.useMasterKey = true;
|
|
1386
|
-
|
|
1387
790
|
if (options.hasOwnProperty('sessionToken')) {
|
|
1388
791
|
distinctOptions.sessionToken = options.sessionToken;
|
|
1389
792
|
}
|
|
1390
|
-
|
|
1391
793
|
this._setRequestTask(distinctOptions);
|
|
1392
|
-
|
|
1393
794
|
var controller = _CoreManager.default.getQueryController();
|
|
1394
|
-
|
|
1395
795
|
var params = {
|
|
1396
796
|
distinct: key,
|
|
1397
797
|
where: this._where,
|
|
@@ -1401,6 +801,7 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
1401
801
|
return results.results;
|
|
1402
802
|
});
|
|
1403
803
|
}
|
|
804
|
+
|
|
1404
805
|
/**
|
|
1405
806
|
* Executes an aggregate query and returns aggregate results
|
|
1406
807
|
*
|
|
@@ -1409,45 +810,30 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
1409
810
|
* <li>sessionToken: A valid session token, used for making a request on
|
|
1410
811
|
* behalf of a specific user.
|
|
1411
812
|
* </ul>
|
|
1412
|
-
*
|
|
1413
813
|
* @returns {Promise} A promise that is resolved with the query completes.
|
|
1414
814
|
*/
|
|
1415
|
-
|
|
1416
815
|
}, {
|
|
1417
816
|
key: "aggregate",
|
|
1418
|
-
value: function
|
|
1419
|
-
/*: mixed*/
|
|
1420
|
-
, options
|
|
1421
|
-
/*:: ?: FullOptions*/
|
|
1422
|
-
)
|
|
1423
|
-
/*: Promise<Array<mixed>>*/
|
|
1424
|
-
{
|
|
817
|
+
value: function (pipeline /*: mixed*/, options /*:: ?: FullOptions*/) /*: Promise<Array<mixed>>*/{
|
|
1425
818
|
options = options || {};
|
|
1426
819
|
var aggregateOptions = {};
|
|
1427
820
|
aggregateOptions.useMasterKey = true;
|
|
1428
|
-
|
|
1429
821
|
if (options.hasOwnProperty('sessionToken')) {
|
|
1430
822
|
aggregateOptions.sessionToken = options.sessionToken;
|
|
1431
823
|
}
|
|
1432
|
-
|
|
1433
824
|
this._setRequestTask(aggregateOptions);
|
|
1434
|
-
|
|
1435
825
|
var controller = _CoreManager.default.getQueryController();
|
|
1436
|
-
|
|
1437
826
|
if (!(0, _isArray.default)(pipeline) && (0, _typeof2.default)(pipeline) !== 'object') {
|
|
1438
827
|
throw new Error('Invalid pipeline must be Array or Object');
|
|
1439
828
|
}
|
|
1440
|
-
|
|
1441
|
-
if ((0, _keys2.default)(this._where || {}).length) {
|
|
829
|
+
if ((0, _keys.default)(this._where || {}).length) {
|
|
1442
830
|
if (!(0, _isArray.default)(pipeline)) {
|
|
1443
831
|
pipeline = [pipeline];
|
|
1444
832
|
}
|
|
1445
|
-
|
|
1446
833
|
pipeline.unshift({
|
|
1447
|
-
match: this._where
|
|
834
|
+
$match: this._where
|
|
1448
835
|
});
|
|
1449
836
|
}
|
|
1450
|
-
|
|
1451
837
|
var params = {
|
|
1452
838
|
pipeline: pipeline,
|
|
1453
839
|
hint: this._hint,
|
|
@@ -1458,6 +844,7 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
1458
844
|
return results.results;
|
|
1459
845
|
});
|
|
1460
846
|
}
|
|
847
|
+
|
|
1461
848
|
/**
|
|
1462
849
|
* Retrieves at most one Parse.Object that satisfies this query.
|
|
1463
850
|
*
|
|
@@ -1471,71 +858,52 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
1471
858
|
* <li>context: A dictionary that is accessible in Cloud Code `beforeFind` trigger.
|
|
1472
859
|
* <li>json: Return raw json without converting to Parse.Object
|
|
1473
860
|
* </ul>
|
|
1474
|
-
*
|
|
1475
861
|
* @returns {Promise} A promise that is resolved with the object when
|
|
1476
862
|
* the query completes.
|
|
1477
863
|
*/
|
|
1478
|
-
|
|
1479
864
|
}, {
|
|
1480
865
|
key: "first",
|
|
1481
|
-
value: function
|
|
1482
|
-
/*:: ?: FullOptions*/
|
|
1483
|
-
)
|
|
1484
|
-
/*: Promise<ParseObject | void>*/
|
|
1485
|
-
{
|
|
866
|
+
value: function (options /*:: ?: FullOptions*/) /*: Promise<ParseObject | void>*/{
|
|
1486
867
|
var _this4 = this;
|
|
1487
|
-
|
|
1488
868
|
options = options || {};
|
|
1489
869
|
var findOptions = {};
|
|
1490
|
-
|
|
1491
870
|
if (options.hasOwnProperty('useMasterKey')) {
|
|
1492
871
|
findOptions.useMasterKey = options.useMasterKey;
|
|
1493
872
|
}
|
|
1494
|
-
|
|
1495
873
|
if (options.hasOwnProperty('sessionToken')) {
|
|
1496
874
|
findOptions.sessionToken = options.sessionToken;
|
|
1497
875
|
}
|
|
1498
|
-
|
|
1499
876
|
if (options.hasOwnProperty('context') && (0, _typeof2.default)(options.context) === 'object') {
|
|
1500
877
|
findOptions.context = options.context;
|
|
1501
878
|
}
|
|
1502
|
-
|
|
1503
879
|
this._setRequestTask(findOptions);
|
|
1504
|
-
|
|
1505
880
|
var controller = _CoreManager.default.getQueryController();
|
|
1506
|
-
|
|
1507
881
|
var params = this.toJSON();
|
|
1508
882
|
params.limit = 1;
|
|
1509
883
|
var select = this._select;
|
|
1510
|
-
|
|
1511
884
|
if (this._queriesLocalDatastore) {
|
|
1512
885
|
return this._handleOfflineQuery(params).then(function (objects) {
|
|
1513
886
|
if (!objects[0]) {
|
|
1514
887
|
return undefined;
|
|
1515
888
|
}
|
|
1516
|
-
|
|
1517
889
|
return objects[0];
|
|
1518
890
|
});
|
|
1519
891
|
}
|
|
1520
|
-
|
|
1521
892
|
return (0, _find.default)(controller).call(controller, this.className, params, findOptions).then(function (response) {
|
|
1522
893
|
var objects = response.results;
|
|
1523
|
-
|
|
1524
894
|
if (!objects[0]) {
|
|
1525
895
|
return undefined;
|
|
1526
896
|
}
|
|
1527
|
-
|
|
1528
897
|
if (!objects[0].className) {
|
|
1529
898
|
objects[0].className = _this4.className;
|
|
1530
|
-
}
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
// Make sure the data object contains keys for all objects that
|
|
1531
902
|
// have been requested with a select, so that our cached state
|
|
1532
903
|
// updates correctly.
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
904
|
if (select) {
|
|
1536
905
|
handleSelectResult(objects[0], select);
|
|
1537
906
|
}
|
|
1538
|
-
|
|
1539
907
|
if (options.json) {
|
|
1540
908
|
return objects[0];
|
|
1541
909
|
} else {
|
|
@@ -1543,6 +911,7 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
1543
911
|
}
|
|
1544
912
|
});
|
|
1545
913
|
}
|
|
914
|
+
|
|
1546
915
|
/**
|
|
1547
916
|
* Iterates over objects matching a query, calling a callback for each batch.
|
|
1548
917
|
* If the callback returns a promise, the iteration will not continue until
|
|
@@ -1564,45 +933,29 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
1564
933
|
* @returns {Promise} A promise that will be fulfilled once the
|
|
1565
934
|
* iteration has completed.
|
|
1566
935
|
*/
|
|
1567
|
-
|
|
1568
936
|
}, {
|
|
1569
937
|
key: "eachBatch",
|
|
1570
|
-
value: function
|
|
1571
|
-
/*: (objs: Array<ParseObject>) => Promise<*>*/
|
|
1572
|
-
, options
|
|
1573
|
-
/*:: ?: BatchOptions*/
|
|
1574
|
-
)
|
|
1575
|
-
/*: Promise<void>*/
|
|
1576
|
-
{
|
|
938
|
+
value: function (callback /*: (objs: Array<ParseObject>) => Promise<*>*/, options /*:: ?: BatchOptions*/) /*: Promise<void>*/{
|
|
1577
939
|
var _context8;
|
|
1578
|
-
|
|
1579
940
|
options = options || {};
|
|
1580
|
-
|
|
1581
941
|
if (this._order || this._skip || this._limit >= 0) {
|
|
1582
|
-
|
|
1583
|
-
return _promise.default.reject(error);
|
|
942
|
+
return _promise.default.reject('Cannot iterate on a query with sort, skip, or limit.');
|
|
1584
943
|
}
|
|
1585
|
-
|
|
1586
944
|
var query = new ParseQuery(this.className);
|
|
1587
945
|
query._limit = options.batchSize || 100;
|
|
1588
946
|
query._include = (0, _map2.default)(_context8 = this._include).call(_context8, function (i) {
|
|
1589
947
|
return i;
|
|
1590
948
|
});
|
|
1591
|
-
|
|
1592
949
|
if (this._select) {
|
|
1593
950
|
var _context9;
|
|
1594
|
-
|
|
1595
951
|
query._select = (0, _map2.default)(_context9 = this._select).call(_context9, function (s) {
|
|
1596
952
|
return s;
|
|
1597
953
|
});
|
|
1598
954
|
}
|
|
1599
|
-
|
|
1600
955
|
query._hint = this._hint;
|
|
1601
956
|
query._where = {};
|
|
1602
|
-
|
|
1603
957
|
for (var _attr in this._where) {
|
|
1604
958
|
var val = this._where[_attr];
|
|
1605
|
-
|
|
1606
959
|
if ((0, _isArray.default)(val)) {
|
|
1607
960
|
query._where[_attr] = (0, _map2.default)(val).call(val, function (v) {
|
|
1608
961
|
return v;
|
|
@@ -1610,7 +963,6 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
1610
963
|
} else if (val && (0, _typeof2.default)(val) === 'object') {
|
|
1611
964
|
var conditionMap = {};
|
|
1612
965
|
query._where[_attr] = conditionMap;
|
|
1613
|
-
|
|
1614
966
|
for (var cond in val) {
|
|
1615
967
|
conditionMap[cond] = val[cond];
|
|
1616
968
|
}
|
|
@@ -1618,80 +970,64 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
1618
970
|
query._where[_attr] = val;
|
|
1619
971
|
}
|
|
1620
972
|
}
|
|
1621
|
-
|
|
1622
973
|
query.ascending('objectId');
|
|
1623
974
|
var findOptions = {};
|
|
1624
|
-
|
|
1625
975
|
if (options.hasOwnProperty('useMasterKey')) {
|
|
1626
976
|
findOptions.useMasterKey = options.useMasterKey;
|
|
1627
977
|
}
|
|
1628
|
-
|
|
1629
978
|
if (options.hasOwnProperty('sessionToken')) {
|
|
1630
979
|
findOptions.sessionToken = options.sessionToken;
|
|
1631
980
|
}
|
|
1632
|
-
|
|
1633
981
|
if (options.hasOwnProperty('context') && (0, _typeof2.default)(options.context) === 'object') {
|
|
1634
982
|
findOptions.context = options.context;
|
|
1635
983
|
}
|
|
1636
|
-
|
|
1637
984
|
if (options.hasOwnProperty('json')) {
|
|
1638
985
|
findOptions.json = options.json;
|
|
1639
986
|
}
|
|
1640
|
-
|
|
1641
987
|
var finished = false;
|
|
1642
988
|
var previousResults = [];
|
|
1643
989
|
return (0, _promiseUtils.continueWhile)(function () {
|
|
1644
990
|
return !finished;
|
|
1645
|
-
}, /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/
|
|
991
|
+
}, /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
|
1646
992
|
var _yield$Promise$all, _yield$Promise$all2, results;
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
results = _yield$Promise$all2[0];
|
|
1659
|
-
|
|
1660
|
-
if (!(results.length >= query._limit)) {
|
|
1661
|
-
_context10.next = 10;
|
|
1662
|
-
break;
|
|
1663
|
-
}
|
|
1664
|
-
|
|
1665
|
-
query.greaterThan('objectId', results[results.length - 1].id);
|
|
1666
|
-
previousResults = results;
|
|
1667
|
-
_context10.next = 17;
|
|
993
|
+
return _regenerator.default.wrap(function (_context10) {
|
|
994
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
995
|
+
case 0:
|
|
996
|
+
_context10.next = 2;
|
|
997
|
+
return _promise.default.all([(0, _find.default)(query).call(query, findOptions), _promise.default.resolve(previousResults.length > 0 && callback(previousResults))]);
|
|
998
|
+
case 2:
|
|
999
|
+
_yield$Promise$all = _context10.sent;
|
|
1000
|
+
_yield$Promise$all2 = (0, _slicedToArray2.default)(_yield$Promise$all, 1);
|
|
1001
|
+
results = _yield$Promise$all2[0];
|
|
1002
|
+
if (!(results.length >= query._limit)) {
|
|
1003
|
+
_context10.next = 10;
|
|
1668
1004
|
break;
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
_context10.next =
|
|
1677
|
-
return _promise.default.resolve(callback(results));
|
|
1678
|
-
|
|
1679
|
-
case 13:
|
|
1680
|
-
finished = true;
|
|
1681
|
-
_context10.next = 17;
|
|
1005
|
+
}
|
|
1006
|
+
query.greaterThan('objectId', results[results.length - 1].id);
|
|
1007
|
+
previousResults = results;
|
|
1008
|
+
_context10.next = 17;
|
|
1009
|
+
break;
|
|
1010
|
+
case 10:
|
|
1011
|
+
if (!(results.length > 0)) {
|
|
1012
|
+
_context10.next = 16;
|
|
1682
1013
|
break;
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1014
|
+
}
|
|
1015
|
+
_context10.next = 13;
|
|
1016
|
+
return _promise.default.resolve(callback(results));
|
|
1017
|
+
case 13:
|
|
1018
|
+
finished = true;
|
|
1019
|
+
_context10.next = 17;
|
|
1020
|
+
break;
|
|
1021
|
+
case 16:
|
|
1022
|
+
finished = true;
|
|
1023
|
+
case 17:
|
|
1024
|
+
case "end":
|
|
1025
|
+
return _context10.stop();
|
|
1691
1026
|
}
|
|
1692
1027
|
}, _callee3);
|
|
1693
1028
|
})));
|
|
1694
1029
|
}
|
|
1030
|
+
|
|
1695
1031
|
/**
|
|
1696
1032
|
* Iterates over each result of a query, calling a callback for each one. If
|
|
1697
1033
|
* the callback returns a promise, the iteration will not continue until
|
|
@@ -1712,19 +1048,11 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
1712
1048
|
* @returns {Promise} A promise that will be fulfilled once the
|
|
1713
1049
|
* iteration has completed.
|
|
1714
1050
|
*/
|
|
1715
|
-
|
|
1716
1051
|
}, {
|
|
1717
1052
|
key: "each",
|
|
1718
|
-
value: function
|
|
1719
|
-
/*: (obj: ParseObject) => any*/
|
|
1720
|
-
, options
|
|
1721
|
-
/*:: ?: BatchOptions*/
|
|
1722
|
-
)
|
|
1723
|
-
/*: Promise<void>*/
|
|
1724
|
-
{
|
|
1053
|
+
value: function (callback /*: (obj: ParseObject) => any*/, options /*:: ?: BatchOptions*/) /*: Promise<void>*/{
|
|
1725
1054
|
return this.eachBatch(function (results) {
|
|
1726
1055
|
var callbacksDone = _promise.default.resolve();
|
|
1727
|
-
|
|
1728
1056
|
(0, _forEach.default)(results).call(results, function (result) {
|
|
1729
1057
|
callbacksDone = callbacksDone.then(function () {
|
|
1730
1058
|
return callback(result);
|
|
@@ -1733,50 +1061,40 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
1733
1061
|
return callbacksDone;
|
|
1734
1062
|
}, options);
|
|
1735
1063
|
}
|
|
1064
|
+
|
|
1736
1065
|
/**
|
|
1737
1066
|
* Adds a hint to force index selection. (https://docs.mongodb.com/manual/reference/operator/meta/hint/)
|
|
1738
1067
|
*
|
|
1739
1068
|
* @param {(string|object)} value String or Object of index that should be used when executing query
|
|
1740
1069
|
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
1741
1070
|
*/
|
|
1742
|
-
|
|
1743
1071
|
}, {
|
|
1744
1072
|
key: "hint",
|
|
1745
|
-
value: function
|
|
1746
|
-
/*: mixed*/
|
|
1747
|
-
)
|
|
1748
|
-
/*: ParseQuery*/
|
|
1749
|
-
{
|
|
1073
|
+
value: function (value /*: mixed*/) /*: ParseQuery*/{
|
|
1750
1074
|
if (typeof value === 'undefined') {
|
|
1751
1075
|
delete this._hint;
|
|
1752
1076
|
}
|
|
1753
|
-
|
|
1754
1077
|
this._hint = value;
|
|
1755
1078
|
return this;
|
|
1756
1079
|
}
|
|
1080
|
+
|
|
1757
1081
|
/**
|
|
1758
1082
|
* Investigates the query execution plan. Useful for optimizing queries. (https://docs.mongodb.com/manual/reference/operator/meta/explain/)
|
|
1759
1083
|
*
|
|
1760
1084
|
* @param {boolean} explain Used to toggle the information on the query plan.
|
|
1761
1085
|
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
1762
1086
|
*/
|
|
1763
|
-
|
|
1764
1087
|
}, {
|
|
1765
1088
|
key: "explain",
|
|
1766
|
-
value: function
|
|
1767
|
-
|
|
1768
|
-
{
|
|
1769
|
-
var _explain
|
|
1770
|
-
/*: boolean*/
|
|
1771
|
-
= arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
1772
|
-
|
|
1089
|
+
value: function () /*: ParseQuery*/{
|
|
1090
|
+
var _explain /*: boolean*/ = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
1773
1091
|
if (typeof _explain !== 'boolean') {
|
|
1774
1092
|
throw new Error('You can only set explain to a boolean value');
|
|
1775
1093
|
}
|
|
1776
|
-
|
|
1777
1094
|
this._explain = _explain;
|
|
1778
1095
|
return this;
|
|
1779
1096
|
}
|
|
1097
|
+
|
|
1780
1098
|
/**
|
|
1781
1099
|
* Iterates over each result of a query, calling a callback for each one. If
|
|
1782
1100
|
* the callback returns a promise, the iteration will not continue until
|
|
@@ -1790,7 +1108,6 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
1790
1108
|
* <li>index: The index of the current Parse.Object being processed in the array.</li>
|
|
1791
1109
|
* <li>query: The query map was called upon.</li>
|
|
1792
1110
|
* </ul>
|
|
1793
|
-
*
|
|
1794
1111
|
* @param {object} options Valid options are:<ul>
|
|
1795
1112
|
* <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
|
|
1796
1113
|
* be used for this request.
|
|
@@ -1800,47 +1117,35 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
1800
1117
|
* @returns {Promise} A promise that will be fulfilled once the
|
|
1801
1118
|
* iteration has completed.
|
|
1802
1119
|
*/
|
|
1803
|
-
|
|
1804
1120
|
}, {
|
|
1805
1121
|
key: "map",
|
|
1806
1122
|
value: function () {
|
|
1807
|
-
var _map = (0, _asyncToGenerator2.default)( /*#__PURE__*/
|
|
1808
|
-
/*: (currentObject: ParseObject, index: number, query: ParseQuery) => any*/
|
|
1809
|
-
, options
|
|
1810
|
-
/*:: ?: BatchOptions*/
|
|
1811
|
-
) {
|
|
1123
|
+
var _map = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(callback /*: (currentObject: ParseObject, index: number, query: ParseQuery) => any*/, options /*:: ?: BatchOptions*/) {
|
|
1812
1124
|
var _this5 = this;
|
|
1813
|
-
|
|
1814
1125
|
var array, index;
|
|
1815
|
-
return
|
|
1816
|
-
while (1) {
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
return
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
case 5:
|
|
1833
|
-
case "end":
|
|
1834
|
-
return _context11.stop();
|
|
1835
|
-
}
|
|
1126
|
+
return _regenerator.default.wrap(function (_context11) {
|
|
1127
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
1128
|
+
case 0:
|
|
1129
|
+
array = [];
|
|
1130
|
+
index = 0;
|
|
1131
|
+
_context11.next = 4;
|
|
1132
|
+
return this.each(function (object) {
|
|
1133
|
+
return _promise.default.resolve(callback(object, index, _this5)).then(function (result) {
|
|
1134
|
+
array.push(result);
|
|
1135
|
+
index += 1;
|
|
1136
|
+
});
|
|
1137
|
+
}, options);
|
|
1138
|
+
case 4:
|
|
1139
|
+
return _context11.abrupt("return", array);
|
|
1140
|
+
case 5:
|
|
1141
|
+
case "end":
|
|
1142
|
+
return _context11.stop();
|
|
1836
1143
|
}
|
|
1837
1144
|
}, _callee4, this);
|
|
1838
1145
|
}));
|
|
1839
|
-
|
|
1840
|
-
function map(_x3, _x4) {
|
|
1146
|
+
function map() {
|
|
1841
1147
|
return _map.apply(this, arguments);
|
|
1842
1148
|
}
|
|
1843
|
-
|
|
1844
1149
|
return map;
|
|
1845
1150
|
}()
|
|
1846
1151
|
/**
|
|
@@ -1866,63 +1171,47 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
1866
1171
|
* @returns {Promise} A promise that will be fulfilled once the
|
|
1867
1172
|
* iteration has completed.
|
|
1868
1173
|
*/
|
|
1869
|
-
|
|
1870
1174
|
}, {
|
|
1871
1175
|
key: "reduce",
|
|
1872
1176
|
value: function () {
|
|
1873
|
-
var _reduce = (0, _asyncToGenerator2.default)( /*#__PURE__*/
|
|
1874
|
-
/*: (accumulator: any, currentObject: ParseObject, index: number) => any*/
|
|
1875
|
-
, initialValue
|
|
1876
|
-
/*: any*/
|
|
1877
|
-
, options
|
|
1878
|
-
/*:: ?: BatchOptions*/
|
|
1879
|
-
) {
|
|
1177
|
+
var _reduce = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(callback /*: (accumulator: any, currentObject: ParseObject, index: number) => any*/, initialValue /*: any*/, options /*:: ?: BatchOptions*/) {
|
|
1880
1178
|
var accumulator, index;
|
|
1881
|
-
return
|
|
1882
|
-
while (1) {
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
return;
|
|
1895
|
-
}
|
|
1896
|
-
|
|
1897
|
-
return _promise.default.resolve(callback(accumulator, object, index)).then(function (result) {
|
|
1898
|
-
accumulator = result;
|
|
1899
|
-
index += 1;
|
|
1900
|
-
});
|
|
1901
|
-
}, options);
|
|
1902
|
-
|
|
1903
|
-
case 4:
|
|
1904
|
-
if (!(index === 0 && initialValue === undefined)) {
|
|
1905
|
-
_context12.next = 6;
|
|
1906
|
-
break;
|
|
1179
|
+
return _regenerator.default.wrap(function (_context12) {
|
|
1180
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
1181
|
+
case 0:
|
|
1182
|
+
accumulator = initialValue;
|
|
1183
|
+
index = 0;
|
|
1184
|
+
_context12.next = 4;
|
|
1185
|
+
return this.each(function (object) {
|
|
1186
|
+
// If no initial value was given, we take the first object from the query
|
|
1187
|
+
// as the initial value and don't call the callback with it.
|
|
1188
|
+
if (index === 0 && initialValue === undefined) {
|
|
1189
|
+
accumulator = object;
|
|
1190
|
+
index += 1;
|
|
1191
|
+
return;
|
|
1907
1192
|
}
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1193
|
+
return _promise.default.resolve(callback(accumulator, object, index)).then(function (result) {
|
|
1194
|
+
accumulator = result;
|
|
1195
|
+
index += 1;
|
|
1196
|
+
});
|
|
1197
|
+
}, options);
|
|
1198
|
+
case 4:
|
|
1199
|
+
if (!(index === 0 && initialValue === undefined)) {
|
|
1200
|
+
_context12.next = 6;
|
|
1201
|
+
break;
|
|
1202
|
+
}
|
|
1203
|
+
throw new TypeError('Reducing empty query result set with no initial value');
|
|
1204
|
+
case 6:
|
|
1205
|
+
return _context12.abrupt("return", accumulator);
|
|
1206
|
+
case 7:
|
|
1207
|
+
case "end":
|
|
1208
|
+
return _context12.stop();
|
|
1918
1209
|
}
|
|
1919
1210
|
}, _callee5, this);
|
|
1920
1211
|
}));
|
|
1921
|
-
|
|
1922
|
-
function reduce(_x5, _x6, _x7) {
|
|
1212
|
+
function reduce() {
|
|
1923
1213
|
return _reduce.apply(this, arguments);
|
|
1924
1214
|
}
|
|
1925
|
-
|
|
1926
1215
|
return reduce;
|
|
1927
1216
|
}()
|
|
1928
1217
|
/**
|
|
@@ -1938,7 +1227,6 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
1938
1227
|
* <li>index: The index of the current Parse.Object being processed in the array.</li>
|
|
1939
1228
|
* <li>query: The query filter was called upon.</li>
|
|
1940
1229
|
* </ul>
|
|
1941
|
-
*
|
|
1942
1230
|
* @param {object} options Valid options are:<ul>
|
|
1943
1231
|
* <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
|
|
1944
1232
|
* be used for this request.
|
|
@@ -1948,54 +1236,40 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
1948
1236
|
* @returns {Promise} A promise that will be fulfilled once the
|
|
1949
1237
|
* iteration has completed.
|
|
1950
1238
|
*/
|
|
1951
|
-
|
|
1952
1239
|
}, {
|
|
1953
1240
|
key: "filter",
|
|
1954
1241
|
value: function () {
|
|
1955
|
-
var _filter = (0, _asyncToGenerator2.default)( /*#__PURE__*/
|
|
1956
|
-
/*: (currentObject: ParseObject, index: number, query: ParseQuery) => boolean*/
|
|
1957
|
-
, options
|
|
1958
|
-
/*:: ?: BatchOptions*/
|
|
1959
|
-
) {
|
|
1242
|
+
var _filter = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(callback /*: (currentObject: ParseObject, index: number, query: ParseQuery) => boolean*/, options /*:: ?: BatchOptions*/) {
|
|
1960
1243
|
var _this6 = this;
|
|
1961
|
-
|
|
1962
1244
|
var array, index;
|
|
1963
|
-
return
|
|
1964
|
-
while (1) {
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
return
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
case 5:
|
|
1984
|
-
case "end":
|
|
1985
|
-
return _context13.stop();
|
|
1986
|
-
}
|
|
1245
|
+
return _regenerator.default.wrap(function (_context13) {
|
|
1246
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
1247
|
+
case 0:
|
|
1248
|
+
array = [];
|
|
1249
|
+
index = 0;
|
|
1250
|
+
_context13.next = 4;
|
|
1251
|
+
return this.each(function (object) {
|
|
1252
|
+
return _promise.default.resolve(callback(object, index, _this6)).then(function (flag) {
|
|
1253
|
+
if (flag) {
|
|
1254
|
+
array.push(object);
|
|
1255
|
+
}
|
|
1256
|
+
index += 1;
|
|
1257
|
+
});
|
|
1258
|
+
}, options);
|
|
1259
|
+
case 4:
|
|
1260
|
+
return _context13.abrupt("return", array);
|
|
1261
|
+
case 5:
|
|
1262
|
+
case "end":
|
|
1263
|
+
return _context13.stop();
|
|
1987
1264
|
}
|
|
1988
1265
|
}, _callee6, this);
|
|
1989
1266
|
}));
|
|
1990
|
-
|
|
1991
|
-
function filter(_x8, _x9) {
|
|
1267
|
+
function filter() {
|
|
1992
1268
|
return _filter.apply(this, arguments);
|
|
1993
1269
|
}
|
|
1994
|
-
|
|
1995
1270
|
return filter;
|
|
1996
1271
|
}()
|
|
1997
|
-
|
|
1998
|
-
|
|
1272
|
+
/* Query Conditions */
|
|
1999
1273
|
/**
|
|
2000
1274
|
* Adds a constraint to the query that requires a particular key's value to
|
|
2001
1275
|
* be equal to the provided value.
|
|
@@ -2004,38 +1278,27 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
2004
1278
|
* @param value The value that the Parse.Object must contain.
|
|
2005
1279
|
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
2006
1280
|
*/
|
|
2007
|
-
|
|
2008
1281
|
}, {
|
|
2009
1282
|
key: "equalTo",
|
|
2010
|
-
value: function
|
|
2011
|
-
/*: string | { [key: string]: any }*/
|
|
2012
|
-
, value
|
|
2013
|
-
/*: ?mixed*/
|
|
2014
|
-
)
|
|
2015
|
-
/*: ParseQuery*/
|
|
2016
|
-
{
|
|
1283
|
+
value: function (key /*: string | { [key: string]: any }*/, value /*: ?mixed*/) /*: ParseQuery*/{
|
|
2017
1284
|
var _this7 = this;
|
|
2018
|
-
|
|
2019
1285
|
if (key && (0, _typeof2.default)(key) === 'object') {
|
|
2020
1286
|
var _context14;
|
|
2021
|
-
|
|
2022
1287
|
(0, _forEach.default)(_context14 = (0, _entries.default)(key)).call(_context14, function (_ref2) {
|
|
2023
1288
|
var _ref3 = (0, _slicedToArray2.default)(_ref2, 2),
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
1289
|
+
k = _ref3[0],
|
|
1290
|
+
val = _ref3[1];
|
|
2027
1291
|
return _this7.equalTo(k, val);
|
|
2028
1292
|
});
|
|
2029
1293
|
return this;
|
|
2030
1294
|
}
|
|
2031
|
-
|
|
2032
1295
|
if (typeof value === 'undefined') {
|
|
2033
1296
|
return this.doesNotExist(key);
|
|
2034
1297
|
}
|
|
2035
|
-
|
|
2036
1298
|
this._where[key] = (0, _encode.default)(value, false, true);
|
|
2037
1299
|
return this;
|
|
2038
1300
|
}
|
|
1301
|
+
|
|
2039
1302
|
/**
|
|
2040
1303
|
* Adds a constraint to the query that requires a particular key's value to
|
|
2041
1304
|
* be not equal to the provided value.
|
|
@@ -2044,33 +1307,23 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
2044
1307
|
* @param value The value that must not be equalled.
|
|
2045
1308
|
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
2046
1309
|
*/
|
|
2047
|
-
|
|
2048
1310
|
}, {
|
|
2049
1311
|
key: "notEqualTo",
|
|
2050
|
-
value: function
|
|
2051
|
-
/*: string | { [key: string]: any }*/
|
|
2052
|
-
, value
|
|
2053
|
-
/*: ?mixed*/
|
|
2054
|
-
)
|
|
2055
|
-
/*: ParseQuery*/
|
|
2056
|
-
{
|
|
1312
|
+
value: function (key /*: string | { [key: string]: any }*/, value /*: ?mixed*/) /*: ParseQuery*/{
|
|
2057
1313
|
var _this8 = this;
|
|
2058
|
-
|
|
2059
1314
|
if (key && (0, _typeof2.default)(key) === 'object') {
|
|
2060
1315
|
var _context15;
|
|
2061
|
-
|
|
2062
1316
|
(0, _forEach.default)(_context15 = (0, _entries.default)(key)).call(_context15, function (_ref4) {
|
|
2063
1317
|
var _ref5 = (0, _slicedToArray2.default)(_ref4, 2),
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
1318
|
+
k = _ref5[0],
|
|
1319
|
+
val = _ref5[1];
|
|
2067
1320
|
return _this8.notEqualTo(k, val);
|
|
2068
1321
|
});
|
|
2069
1322
|
return this;
|
|
2070
1323
|
}
|
|
2071
|
-
|
|
2072
1324
|
return this._addCondition(key, '$ne', value);
|
|
2073
1325
|
}
|
|
1326
|
+
|
|
2074
1327
|
/**
|
|
2075
1328
|
* Adds a constraint to the query that requires a particular key's value to
|
|
2076
1329
|
* be less than the provided value.
|
|
@@ -2079,18 +1332,12 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
2079
1332
|
* @param value The value that provides an upper bound.
|
|
2080
1333
|
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
2081
1334
|
*/
|
|
2082
|
-
|
|
2083
1335
|
}, {
|
|
2084
1336
|
key: "lessThan",
|
|
2085
|
-
value: function
|
|
2086
|
-
/*: string*/
|
|
2087
|
-
, value
|
|
2088
|
-
/*: mixed*/
|
|
2089
|
-
)
|
|
2090
|
-
/*: ParseQuery*/
|
|
2091
|
-
{
|
|
1337
|
+
value: function (key /*: string*/, value /*: mixed*/) /*: ParseQuery*/{
|
|
2092
1338
|
return this._addCondition(key, '$lt', value);
|
|
2093
1339
|
}
|
|
1340
|
+
|
|
2094
1341
|
/**
|
|
2095
1342
|
* Adds a constraint to the query that requires a particular key's value to
|
|
2096
1343
|
* be greater than the provided value.
|
|
@@ -2099,18 +1346,12 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
2099
1346
|
* @param value The value that provides an lower bound.
|
|
2100
1347
|
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
2101
1348
|
*/
|
|
2102
|
-
|
|
2103
1349
|
}, {
|
|
2104
1350
|
key: "greaterThan",
|
|
2105
|
-
value: function
|
|
2106
|
-
/*: string*/
|
|
2107
|
-
, value
|
|
2108
|
-
/*: mixed*/
|
|
2109
|
-
)
|
|
2110
|
-
/*: ParseQuery*/
|
|
2111
|
-
{
|
|
1351
|
+
value: function (key /*: string*/, value /*: mixed*/) /*: ParseQuery*/{
|
|
2112
1352
|
return this._addCondition(key, '$gt', value);
|
|
2113
1353
|
}
|
|
1354
|
+
|
|
2114
1355
|
/**
|
|
2115
1356
|
* Adds a constraint to the query that requires a particular key's value to
|
|
2116
1357
|
* be less than or equal to the provided value.
|
|
@@ -2119,18 +1360,12 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
2119
1360
|
* @param value The value that provides an upper bound.
|
|
2120
1361
|
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
2121
1362
|
*/
|
|
2122
|
-
|
|
2123
1363
|
}, {
|
|
2124
1364
|
key: "lessThanOrEqualTo",
|
|
2125
|
-
value: function
|
|
2126
|
-
/*: string*/
|
|
2127
|
-
, value
|
|
2128
|
-
/*: mixed*/
|
|
2129
|
-
)
|
|
2130
|
-
/*: ParseQuery*/
|
|
2131
|
-
{
|
|
1365
|
+
value: function (key /*: string*/, value /*: mixed*/) /*: ParseQuery*/{
|
|
2132
1366
|
return this._addCondition(key, '$lte', value);
|
|
2133
1367
|
}
|
|
1368
|
+
|
|
2134
1369
|
/**
|
|
2135
1370
|
* Adds a constraint to the query that requires a particular key's value to
|
|
2136
1371
|
* be greater than or equal to the provided value.
|
|
@@ -2139,18 +1374,12 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
2139
1374
|
* @param {*} value The value that provides an lower bound.
|
|
2140
1375
|
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
2141
1376
|
*/
|
|
2142
|
-
|
|
2143
1377
|
}, {
|
|
2144
1378
|
key: "greaterThanOrEqualTo",
|
|
2145
|
-
value: function
|
|
2146
|
-
/*: string*/
|
|
2147
|
-
, value
|
|
2148
|
-
/*: mixed*/
|
|
2149
|
-
)
|
|
2150
|
-
/*: ParseQuery*/
|
|
2151
|
-
{
|
|
1379
|
+
value: function (key /*: string*/, value /*: mixed*/) /*: ParseQuery*/{
|
|
2152
1380
|
return this._addCondition(key, '$gte', value);
|
|
2153
1381
|
}
|
|
1382
|
+
|
|
2154
1383
|
/**
|
|
2155
1384
|
* Adds a constraint to the query that requires a particular key's value to
|
|
2156
1385
|
* be contained in the provided list of values.
|
|
@@ -2159,18 +1388,12 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
2159
1388
|
* @param {*} value The values that will match.
|
|
2160
1389
|
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
2161
1390
|
*/
|
|
2162
|
-
|
|
2163
1391
|
}, {
|
|
2164
1392
|
key: "containedIn",
|
|
2165
|
-
value: function
|
|
2166
|
-
/*: string*/
|
|
2167
|
-
, value
|
|
2168
|
-
/*: mixed*/
|
|
2169
|
-
)
|
|
2170
|
-
/*: ParseQuery*/
|
|
2171
|
-
{
|
|
1393
|
+
value: function (key /*: string*/, value /*: mixed*/) /*: ParseQuery*/{
|
|
2172
1394
|
return this._addCondition(key, '$in', value);
|
|
2173
1395
|
}
|
|
1396
|
+
|
|
2174
1397
|
/**
|
|
2175
1398
|
* Adds a constraint to the query that requires a particular key's value to
|
|
2176
1399
|
* not be contained in the provided list of values.
|
|
@@ -2179,18 +1402,12 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
2179
1402
|
* @param {*} value The values that will not match.
|
|
2180
1403
|
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
2181
1404
|
*/
|
|
2182
|
-
|
|
2183
1405
|
}, {
|
|
2184
1406
|
key: "notContainedIn",
|
|
2185
|
-
value: function
|
|
2186
|
-
/*: string*/
|
|
2187
|
-
, value
|
|
2188
|
-
/*: mixed*/
|
|
2189
|
-
)
|
|
2190
|
-
/*: ParseQuery*/
|
|
2191
|
-
{
|
|
1407
|
+
value: function (key /*: string*/, value /*: mixed*/) /*: ParseQuery*/{
|
|
2192
1408
|
return this._addCondition(key, '$nin', value);
|
|
2193
1409
|
}
|
|
1410
|
+
|
|
2194
1411
|
/**
|
|
2195
1412
|
* Adds a constraint to the query that requires a particular key's value to
|
|
2196
1413
|
* be contained by the provided list of values. Get objects where all array elements match.
|
|
@@ -2199,18 +1416,12 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
2199
1416
|
* @param {Array} values The values that will match.
|
|
2200
1417
|
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
2201
1418
|
*/
|
|
2202
|
-
|
|
2203
1419
|
}, {
|
|
2204
1420
|
key: "containedBy",
|
|
2205
|
-
value: function
|
|
2206
|
-
/*: string*/
|
|
2207
|
-
, values
|
|
2208
|
-
/*: Array<mixed>*/
|
|
2209
|
-
)
|
|
2210
|
-
/*: ParseQuery*/
|
|
2211
|
-
{
|
|
1421
|
+
value: function (key /*: string*/, values /*: Array<mixed>*/) /*: ParseQuery*/{
|
|
2212
1422
|
return this._addCondition(key, '$containedBy', values);
|
|
2213
1423
|
}
|
|
1424
|
+
|
|
2214
1425
|
/**
|
|
2215
1426
|
* Adds a constraint to the query that requires a particular key's value to
|
|
2216
1427
|
* contain each one of the provided list of values.
|
|
@@ -2219,18 +1430,12 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
2219
1430
|
* @param {Array} values The values that will match.
|
|
2220
1431
|
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
2221
1432
|
*/
|
|
2222
|
-
|
|
2223
1433
|
}, {
|
|
2224
1434
|
key: "containsAll",
|
|
2225
|
-
value: function
|
|
2226
|
-
/*: string*/
|
|
2227
|
-
, values
|
|
2228
|
-
/*: Array<mixed>*/
|
|
2229
|
-
)
|
|
2230
|
-
/*: ParseQuery*/
|
|
2231
|
-
{
|
|
1435
|
+
value: function (key /*: string*/, values /*: Array<mixed>*/) /*: ParseQuery*/{
|
|
2232
1436
|
return this._addCondition(key, '$all', values);
|
|
2233
1437
|
}
|
|
1438
|
+
|
|
2234
1439
|
/**
|
|
2235
1440
|
* Adds a constraint to the query that requires a particular key's value to
|
|
2236
1441
|
* contain each one of the provided list of values starting with given strings.
|
|
@@ -2239,22 +1444,13 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
2239
1444
|
* @param {Array<string>} values The string values that will match as starting string.
|
|
2240
1445
|
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
2241
1446
|
*/
|
|
2242
|
-
|
|
2243
1447
|
}, {
|
|
2244
1448
|
key: "containsAllStartingWith",
|
|
2245
|
-
value: function
|
|
2246
|
-
/*: string*/
|
|
2247
|
-
, values
|
|
2248
|
-
/*: Array<string>*/
|
|
2249
|
-
)
|
|
2250
|
-
/*: ParseQuery*/
|
|
2251
|
-
{
|
|
1449
|
+
value: function (key /*: string*/, values /*: Array<string>*/) /*: ParseQuery*/{
|
|
2252
1450
|
var _this = this;
|
|
2253
|
-
|
|
2254
1451
|
if (!(0, _isArray.default)(values)) {
|
|
2255
1452
|
values = [values];
|
|
2256
1453
|
}
|
|
2257
|
-
|
|
2258
1454
|
var regexObject = (0, _map2.default)(values).call(values, function (value) {
|
|
2259
1455
|
return {
|
|
2260
1456
|
$regex: _this._regexStartWith(value)
|
|
@@ -2262,38 +1458,31 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
2262
1458
|
});
|
|
2263
1459
|
return this.containsAll(key, regexObject);
|
|
2264
1460
|
}
|
|
1461
|
+
|
|
2265
1462
|
/**
|
|
2266
1463
|
* Adds a constraint for finding objects that contain the given key.
|
|
2267
1464
|
*
|
|
2268
1465
|
* @param {string} key The key that should exist.
|
|
2269
1466
|
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
2270
1467
|
*/
|
|
2271
|
-
|
|
2272
1468
|
}, {
|
|
2273
1469
|
key: "exists",
|
|
2274
|
-
value: function
|
|
2275
|
-
/*: string*/
|
|
2276
|
-
)
|
|
2277
|
-
/*: ParseQuery*/
|
|
2278
|
-
{
|
|
1470
|
+
value: function (key /*: string*/) /*: ParseQuery*/{
|
|
2279
1471
|
return this._addCondition(key, '$exists', true);
|
|
2280
1472
|
}
|
|
1473
|
+
|
|
2281
1474
|
/**
|
|
2282
1475
|
* Adds a constraint for finding objects that do not contain a given key.
|
|
2283
1476
|
*
|
|
2284
1477
|
* @param {string} key The key that should not exist
|
|
2285
1478
|
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
2286
1479
|
*/
|
|
2287
|
-
|
|
2288
1480
|
}, {
|
|
2289
1481
|
key: "doesNotExist",
|
|
2290
|
-
value: function
|
|
2291
|
-
/*: string*/
|
|
2292
|
-
)
|
|
2293
|
-
/*: ParseQuery*/
|
|
2294
|
-
{
|
|
1482
|
+
value: function (key /*: string*/) /*: ParseQuery*/{
|
|
2295
1483
|
return this._addCondition(key, '$exists', false);
|
|
2296
1484
|
}
|
|
1485
|
+
|
|
2297
1486
|
/**
|
|
2298
1487
|
* Adds a regular expression constraint for finding string values that match
|
|
2299
1488
|
* the provided regular expression.
|
|
@@ -2304,38 +1493,25 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
2304
1493
|
* @param {string} modifiers The regular expression mode.
|
|
2305
1494
|
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
2306
1495
|
*/
|
|
2307
|
-
|
|
2308
1496
|
}, {
|
|
2309
1497
|
key: "matches",
|
|
2310
|
-
value: function
|
|
2311
|
-
/*: string*/
|
|
2312
|
-
, regex
|
|
2313
|
-
/*: RegExp*/
|
|
2314
|
-
, modifiers
|
|
2315
|
-
/*: string*/
|
|
2316
|
-
)
|
|
2317
|
-
/*: ParseQuery*/
|
|
2318
|
-
{
|
|
1498
|
+
value: function (key /*: string*/, regex /*: RegExp*/, modifiers /*: string*/) /*: ParseQuery*/{
|
|
2319
1499
|
this._addCondition(key, '$regex', regex);
|
|
2320
|
-
|
|
2321
1500
|
if (!modifiers) {
|
|
2322
1501
|
modifiers = '';
|
|
2323
1502
|
}
|
|
2324
|
-
|
|
2325
1503
|
if (regex.ignoreCase) {
|
|
2326
1504
|
modifiers += 'i';
|
|
2327
1505
|
}
|
|
2328
|
-
|
|
2329
1506
|
if (regex.multiline) {
|
|
2330
1507
|
modifiers += 'm';
|
|
2331
1508
|
}
|
|
2332
|
-
|
|
2333
1509
|
if (modifiers.length) {
|
|
2334
1510
|
this._addCondition(key, '$options', modifiers);
|
|
2335
1511
|
}
|
|
2336
|
-
|
|
2337
1512
|
return this;
|
|
2338
1513
|
}
|
|
1514
|
+
|
|
2339
1515
|
/**
|
|
2340
1516
|
* Adds a constraint that requires that a key's value matches a Parse.Query
|
|
2341
1517
|
* constraint.
|
|
@@ -2345,20 +1521,14 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
2345
1521
|
* @param {Parse.Query} query The query that should match.
|
|
2346
1522
|
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
2347
1523
|
*/
|
|
2348
|
-
|
|
2349
1524
|
}, {
|
|
2350
1525
|
key: "matchesQuery",
|
|
2351
|
-
value: function
|
|
2352
|
-
/*: string*/
|
|
2353
|
-
, query
|
|
2354
|
-
/*: ParseQuery*/
|
|
2355
|
-
)
|
|
2356
|
-
/*: ParseQuery*/
|
|
2357
|
-
{
|
|
1526
|
+
value: function (key /*: string*/, query /*: ParseQuery*/) /*: ParseQuery*/{
|
|
2358
1527
|
var queryJSON = query.toJSON();
|
|
2359
1528
|
queryJSON.className = query.className;
|
|
2360
1529
|
return this._addCondition(key, '$inQuery', queryJSON);
|
|
2361
1530
|
}
|
|
1531
|
+
|
|
2362
1532
|
/**
|
|
2363
1533
|
* Adds a constraint that requires that a key's value not matches a
|
|
2364
1534
|
* Parse.Query constraint.
|
|
@@ -2368,20 +1538,14 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
2368
1538
|
* @param {Parse.Query} query The query that should not match.
|
|
2369
1539
|
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
2370
1540
|
*/
|
|
2371
|
-
|
|
2372
1541
|
}, {
|
|
2373
1542
|
key: "doesNotMatchQuery",
|
|
2374
|
-
value: function
|
|
2375
|
-
/*: string*/
|
|
2376
|
-
, query
|
|
2377
|
-
/*: ParseQuery*/
|
|
2378
|
-
)
|
|
2379
|
-
/*: ParseQuery*/
|
|
2380
|
-
{
|
|
1543
|
+
value: function (key /*: string*/, query /*: ParseQuery*/) /*: ParseQuery*/{
|
|
2381
1544
|
var queryJSON = query.toJSON();
|
|
2382
1545
|
queryJSON.className = query.className;
|
|
2383
1546
|
return this._addCondition(key, '$notInQuery', queryJSON);
|
|
2384
1547
|
}
|
|
1548
|
+
|
|
2385
1549
|
/**
|
|
2386
1550
|
* Adds a constraint that requires that a key's value matches a value in
|
|
2387
1551
|
* an object returned by a different Parse.Query.
|
|
@@ -2393,18 +1557,9 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
2393
1557
|
* @param {Parse.Query} query The query to run.
|
|
2394
1558
|
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
2395
1559
|
*/
|
|
2396
|
-
|
|
2397
1560
|
}, {
|
|
2398
1561
|
key: "matchesKeyInQuery",
|
|
2399
|
-
value: function
|
|
2400
|
-
/*: string*/
|
|
2401
|
-
, queryKey
|
|
2402
|
-
/*: string*/
|
|
2403
|
-
, query
|
|
2404
|
-
/*: ParseQuery*/
|
|
2405
|
-
)
|
|
2406
|
-
/*: ParseQuery*/
|
|
2407
|
-
{
|
|
1562
|
+
value: function (key /*: string*/, queryKey /*: string*/, query /*: ParseQuery*/) /*: ParseQuery*/{
|
|
2408
1563
|
var queryJSON = query.toJSON();
|
|
2409
1564
|
queryJSON.className = query.className;
|
|
2410
1565
|
return this._addCondition(key, '$select', {
|
|
@@ -2412,6 +1567,7 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
2412
1567
|
query: queryJSON
|
|
2413
1568
|
});
|
|
2414
1569
|
}
|
|
1570
|
+
|
|
2415
1571
|
/**
|
|
2416
1572
|
* Adds a constraint that requires that a key's value not match a value in
|
|
2417
1573
|
* an object returned by a different Parse.Query.
|
|
@@ -2423,18 +1579,9 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
2423
1579
|
* @param {Parse.Query} query The query to run.
|
|
2424
1580
|
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
2425
1581
|
*/
|
|
2426
|
-
|
|
2427
1582
|
}, {
|
|
2428
1583
|
key: "doesNotMatchKeyInQuery",
|
|
2429
|
-
value: function
|
|
2430
|
-
/*: string*/
|
|
2431
|
-
, queryKey
|
|
2432
|
-
/*: string*/
|
|
2433
|
-
, query
|
|
2434
|
-
/*: ParseQuery*/
|
|
2435
|
-
)
|
|
2436
|
-
/*: ParseQuery*/
|
|
2437
|
-
{
|
|
1584
|
+
value: function (key /*: string*/, queryKey /*: string*/, query /*: ParseQuery*/) /*: ParseQuery*/{
|
|
2438
1585
|
var queryJSON = query.toJSON();
|
|
2439
1586
|
queryJSON.className = query.className;
|
|
2440
1587
|
return this._addCondition(key, '$dontSelect', {
|
|
@@ -2442,6 +1589,7 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
2442
1589
|
query: queryJSON
|
|
2443
1590
|
});
|
|
2444
1591
|
}
|
|
1592
|
+
|
|
2445
1593
|
/**
|
|
2446
1594
|
* Adds a constraint for finding string values that contain a provided
|
|
2447
1595
|
* string. This may be slow for large datasets.
|
|
@@ -2450,22 +1598,15 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
2450
1598
|
* @param {string} substring The substring that the value must contain.
|
|
2451
1599
|
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
2452
1600
|
*/
|
|
2453
|
-
|
|
2454
1601
|
}, {
|
|
2455
1602
|
key: "contains",
|
|
2456
|
-
value: function
|
|
2457
|
-
/*: string*/
|
|
2458
|
-
, substring
|
|
2459
|
-
/*: string*/
|
|
2460
|
-
)
|
|
2461
|
-
/*: ParseQuery*/
|
|
2462
|
-
{
|
|
1603
|
+
value: function (key /*: string*/, substring /*: string*/) /*: ParseQuery*/{
|
|
2463
1604
|
if (typeof substring !== 'string') {
|
|
2464
1605
|
throw new Error('The value being searched for must be a string.');
|
|
2465
1606
|
}
|
|
2466
|
-
|
|
2467
1607
|
return this._addCondition(key, '$regex', quote(substring));
|
|
2468
1608
|
}
|
|
1609
|
+
|
|
2469
1610
|
/**
|
|
2470
1611
|
* Adds a constraint for finding string values that contain a provided
|
|
2471
1612
|
* string. This may be slow for large datasets. Requires Parse-Server > 2.5.0
|
|
@@ -2495,71 +1636,54 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
2495
1636
|
* @param {boolean} options.diacriticSensitive A boolean flag to enable or disable diacritic sensitive search.
|
|
2496
1637
|
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
2497
1638
|
*/
|
|
2498
|
-
|
|
2499
1639
|
}, {
|
|
2500
1640
|
key: "fullText",
|
|
2501
|
-
value: function
|
|
2502
|
-
/*: string*/
|
|
2503
|
-
, value
|
|
2504
|
-
/*: string*/
|
|
2505
|
-
, options
|
|
2506
|
-
/*: ?Object*/
|
|
2507
|
-
)
|
|
2508
|
-
/*: ParseQuery*/
|
|
2509
|
-
{
|
|
1641
|
+
value: function (key /*: string*/, value /*: string*/, options /*: ?Object*/) /*: ParseQuery*/{
|
|
2510
1642
|
options = options || {};
|
|
2511
|
-
|
|
2512
1643
|
if (!key) {
|
|
2513
1644
|
throw new Error('A key is required.');
|
|
2514
1645
|
}
|
|
2515
|
-
|
|
2516
1646
|
if (!value) {
|
|
2517
1647
|
throw new Error('A search term is required');
|
|
2518
1648
|
}
|
|
2519
|
-
|
|
2520
1649
|
if (typeof value !== 'string') {
|
|
2521
1650
|
throw new Error('The value being searched for must be a string.');
|
|
2522
1651
|
}
|
|
2523
|
-
|
|
2524
1652
|
var fullOptions = {};
|
|
2525
1653
|
fullOptions.$term = value;
|
|
2526
|
-
|
|
2527
1654
|
for (var option in options) {
|
|
2528
1655
|
switch (option) {
|
|
2529
1656
|
case 'language':
|
|
2530
1657
|
fullOptions.$language = options[option];
|
|
2531
1658
|
break;
|
|
2532
|
-
|
|
2533
1659
|
case 'caseSensitive':
|
|
2534
1660
|
fullOptions.$caseSensitive = options[option];
|
|
2535
1661
|
break;
|
|
2536
|
-
|
|
2537
1662
|
case 'diacriticSensitive':
|
|
2538
1663
|
fullOptions.$diacriticSensitive = options[option];
|
|
2539
1664
|
break;
|
|
2540
|
-
|
|
2541
1665
|
default:
|
|
2542
1666
|
throw new Error("Unknown option: ".concat(option));
|
|
2543
1667
|
}
|
|
2544
1668
|
}
|
|
2545
|
-
|
|
2546
1669
|
return this._addCondition(key, '$text', {
|
|
2547
1670
|
$search: fullOptions
|
|
2548
1671
|
});
|
|
2549
1672
|
}
|
|
1673
|
+
|
|
2550
1674
|
/**
|
|
2551
1675
|
* Method to sort the full text search by text score
|
|
2552
1676
|
*
|
|
2553
1677
|
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
2554
1678
|
*/
|
|
2555
|
-
|
|
2556
1679
|
}, {
|
|
2557
1680
|
key: "sortByTextScore",
|
|
2558
|
-
value: function
|
|
1681
|
+
value: function () {
|
|
2559
1682
|
this.ascending('$score');
|
|
2560
1683
|
this.select(['$score']);
|
|
2561
1684
|
return this;
|
|
2562
1685
|
}
|
|
1686
|
+
|
|
2563
1687
|
/**
|
|
2564
1688
|
* Adds a constraint for finding string values that start with a provided
|
|
2565
1689
|
* string. This query will use the backend index, so it will be fast even
|
|
@@ -2570,24 +1694,15 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
2570
1694
|
* @param {string} modifiers The regular expression mode.
|
|
2571
1695
|
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
2572
1696
|
*/
|
|
2573
|
-
|
|
2574
1697
|
}, {
|
|
2575
1698
|
key: "startsWith",
|
|
2576
|
-
value: function
|
|
2577
|
-
/*: string*/
|
|
2578
|
-
, prefix
|
|
2579
|
-
/*: string*/
|
|
2580
|
-
, modifiers
|
|
2581
|
-
/*: string*/
|
|
2582
|
-
)
|
|
2583
|
-
/*: ParseQuery*/
|
|
2584
|
-
{
|
|
1699
|
+
value: function (key /*: string*/, prefix /*: string*/, modifiers /*: string*/) /*: ParseQuery*/{
|
|
2585
1700
|
if (typeof prefix !== 'string') {
|
|
2586
1701
|
throw new Error('The value being searched for must be a string.');
|
|
2587
1702
|
}
|
|
2588
|
-
|
|
2589
1703
|
return this.matches(key, this._regexStartWith(prefix), modifiers);
|
|
2590
1704
|
}
|
|
1705
|
+
|
|
2591
1706
|
/**
|
|
2592
1707
|
* Adds a constraint for finding string values that end with a provided
|
|
2593
1708
|
* string. This will be slow for large datasets.
|
|
@@ -2597,24 +1712,15 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
2597
1712
|
* @param {string} modifiers The regular expression mode.
|
|
2598
1713
|
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
2599
1714
|
*/
|
|
2600
|
-
|
|
2601
1715
|
}, {
|
|
2602
1716
|
key: "endsWith",
|
|
2603
|
-
value: function
|
|
2604
|
-
/*: string*/
|
|
2605
|
-
, suffix
|
|
2606
|
-
/*: string*/
|
|
2607
|
-
, modifiers
|
|
2608
|
-
/*: string*/
|
|
2609
|
-
)
|
|
2610
|
-
/*: ParseQuery*/
|
|
2611
|
-
{
|
|
1717
|
+
value: function (key /*: string*/, suffix /*: string*/, modifiers /*: string*/) /*: ParseQuery*/{
|
|
2612
1718
|
if (typeof suffix !== 'string') {
|
|
2613
1719
|
throw new Error('The value being searched for must be a string.');
|
|
2614
1720
|
}
|
|
2615
|
-
|
|
2616
1721
|
return this.matches(key, quote(suffix) + '$', modifiers);
|
|
2617
1722
|
}
|
|
1723
|
+
|
|
2618
1724
|
/**
|
|
2619
1725
|
* Adds a proximity based constraint for finding objects with key point
|
|
2620
1726
|
* values near the point given.
|
|
@@ -2623,23 +1729,16 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
2623
1729
|
* @param {Parse.GeoPoint} point The reference Parse.GeoPoint that is used.
|
|
2624
1730
|
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
2625
1731
|
*/
|
|
2626
|
-
|
|
2627
1732
|
}, {
|
|
2628
1733
|
key: "near",
|
|
2629
|
-
value: function
|
|
2630
|
-
/*: string*/
|
|
2631
|
-
, point
|
|
2632
|
-
/*: ParseGeoPoint*/
|
|
2633
|
-
)
|
|
2634
|
-
/*: ParseQuery*/
|
|
2635
|
-
{
|
|
1734
|
+
value: function (key /*: string*/, point /*: ParseGeoPoint*/) /*: ParseQuery*/{
|
|
2636
1735
|
if (!(point instanceof _ParseGeoPoint.default)) {
|
|
2637
1736
|
// Try to cast it as a GeoPoint
|
|
2638
1737
|
point = new _ParseGeoPoint.default(point);
|
|
2639
1738
|
}
|
|
2640
|
-
|
|
2641
1739
|
return this._addCondition(key, '$nearSphere', point);
|
|
2642
1740
|
}
|
|
1741
|
+
|
|
2643
1742
|
/**
|
|
2644
1743
|
* Adds a proximity based constraint for finding objects with key point
|
|
2645
1744
|
* values near the point given and within the maximum distance given.
|
|
@@ -2652,20 +1751,9 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
2652
1751
|
* defaults to true.
|
|
2653
1752
|
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
2654
1753
|
*/
|
|
2655
|
-
|
|
2656
1754
|
}, {
|
|
2657
1755
|
key: "withinRadians",
|
|
2658
|
-
value: function
|
|
2659
|
-
/*: string*/
|
|
2660
|
-
, point
|
|
2661
|
-
/*: ParseGeoPoint*/
|
|
2662
|
-
, maxDistance
|
|
2663
|
-
/*: number*/
|
|
2664
|
-
, sorted
|
|
2665
|
-
/*: boolean*/
|
|
2666
|
-
)
|
|
2667
|
-
/*: ParseQuery*/
|
|
2668
|
-
{
|
|
1756
|
+
value: function (key /*: string*/, point /*: ParseGeoPoint*/, maxDistance /*: number*/, sorted /*: boolean*/) /*: ParseQuery*/{
|
|
2669
1757
|
if (sorted || sorted === undefined) {
|
|
2670
1758
|
this.near(key, point);
|
|
2671
1759
|
return this._addCondition(key, '$maxDistance', maxDistance);
|
|
@@ -2675,6 +1763,7 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
2675
1763
|
});
|
|
2676
1764
|
}
|
|
2677
1765
|
}
|
|
1766
|
+
|
|
2678
1767
|
/**
|
|
2679
1768
|
* Adds a proximity based constraint for finding objects with key point
|
|
2680
1769
|
* values near the point given and within the maximum distance given.
|
|
@@ -2688,22 +1777,12 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
2688
1777
|
* defaults to true.
|
|
2689
1778
|
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
2690
1779
|
*/
|
|
2691
|
-
|
|
2692
1780
|
}, {
|
|
2693
1781
|
key: "withinMiles",
|
|
2694
|
-
value: function
|
|
2695
|
-
/*: string*/
|
|
2696
|
-
, point
|
|
2697
|
-
/*: ParseGeoPoint*/
|
|
2698
|
-
, maxDistance
|
|
2699
|
-
/*: number*/
|
|
2700
|
-
, sorted
|
|
2701
|
-
/*: boolean*/
|
|
2702
|
-
)
|
|
2703
|
-
/*: ParseQuery*/
|
|
2704
|
-
{
|
|
1782
|
+
value: function (key /*: string*/, point /*: ParseGeoPoint*/, maxDistance /*: number*/, sorted /*: boolean*/) /*: ParseQuery*/{
|
|
2705
1783
|
return this.withinRadians(key, point, maxDistance / 3958.8, sorted);
|
|
2706
1784
|
}
|
|
1785
|
+
|
|
2707
1786
|
/**
|
|
2708
1787
|
* Adds a proximity based constraint for finding objects with key point
|
|
2709
1788
|
* values near the point given and within the maximum distance given.
|
|
@@ -2717,22 +1796,12 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
2717
1796
|
* defaults to true.
|
|
2718
1797
|
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
2719
1798
|
*/
|
|
2720
|
-
|
|
2721
1799
|
}, {
|
|
2722
1800
|
key: "withinKilometers",
|
|
2723
|
-
value: function
|
|
2724
|
-
/*: string*/
|
|
2725
|
-
, point
|
|
2726
|
-
/*: ParseGeoPoint*/
|
|
2727
|
-
, maxDistance
|
|
2728
|
-
/*: number*/
|
|
2729
|
-
, sorted
|
|
2730
|
-
/*: boolean*/
|
|
2731
|
-
)
|
|
2732
|
-
/*: ParseQuery*/
|
|
2733
|
-
{
|
|
1801
|
+
value: function (key /*: string*/, point /*: ParseGeoPoint*/, maxDistance /*: number*/, sorted /*: boolean*/) /*: ParseQuery*/{
|
|
2734
1802
|
return this.withinRadians(key, point, maxDistance / 6371.0, sorted);
|
|
2735
1803
|
}
|
|
1804
|
+
|
|
2736
1805
|
/**
|
|
2737
1806
|
* Adds a constraint to the query that requires a particular key's
|
|
2738
1807
|
* coordinates be contained within a given rectangular geographic bounding
|
|
@@ -2745,32 +1814,21 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
2745
1814
|
* The upper-right inclusive corner of the box.
|
|
2746
1815
|
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
2747
1816
|
*/
|
|
2748
|
-
|
|
2749
1817
|
}, {
|
|
2750
1818
|
key: "withinGeoBox",
|
|
2751
|
-
value: function
|
|
2752
|
-
/*: string*/
|
|
2753
|
-
, southwest
|
|
2754
|
-
/*: ParseGeoPoint*/
|
|
2755
|
-
, northeast
|
|
2756
|
-
/*: ParseGeoPoint*/
|
|
2757
|
-
)
|
|
2758
|
-
/*: ParseQuery*/
|
|
2759
|
-
{
|
|
1819
|
+
value: function (key /*: string*/, southwest /*: ParseGeoPoint*/, northeast /*: ParseGeoPoint*/) /*: ParseQuery*/{
|
|
2760
1820
|
if (!(southwest instanceof _ParseGeoPoint.default)) {
|
|
2761
1821
|
southwest = new _ParseGeoPoint.default(southwest);
|
|
2762
1822
|
}
|
|
2763
|
-
|
|
2764
1823
|
if (!(northeast instanceof _ParseGeoPoint.default)) {
|
|
2765
1824
|
northeast = new _ParseGeoPoint.default(northeast);
|
|
2766
1825
|
}
|
|
2767
|
-
|
|
2768
1826
|
this._addCondition(key, '$within', {
|
|
2769
1827
|
$box: [southwest, northeast]
|
|
2770
1828
|
});
|
|
2771
|
-
|
|
2772
1829
|
return this;
|
|
2773
1830
|
}
|
|
1831
|
+
|
|
2774
1832
|
/**
|
|
2775
1833
|
* Adds a constraint to the query that requires a particular key's
|
|
2776
1834
|
* coordinates be contained within and on the bounds of a given polygon.
|
|
@@ -2782,20 +1840,14 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
2782
1840
|
* @param {Array} points Array of Coordinates / GeoPoints
|
|
2783
1841
|
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
2784
1842
|
*/
|
|
2785
|
-
|
|
2786
1843
|
}, {
|
|
2787
1844
|
key: "withinPolygon",
|
|
2788
|
-
value: function
|
|
2789
|
-
/*: string*/
|
|
2790
|
-
, points
|
|
2791
|
-
/*: Array<Array<number>>*/
|
|
2792
|
-
)
|
|
2793
|
-
/*: ParseQuery*/
|
|
2794
|
-
{
|
|
1845
|
+
value: function (key /*: string*/, points /*: Array<Array<number>>*/) /*: ParseQuery*/{
|
|
2795
1846
|
return this._addCondition(key, '$geoWithin', {
|
|
2796
1847
|
$polygon: points
|
|
2797
1848
|
});
|
|
2798
1849
|
}
|
|
1850
|
+
|
|
2799
1851
|
/**
|
|
2800
1852
|
* Add a constraint to the query that requires a particular key's
|
|
2801
1853
|
* coordinates that contains a ParseGeoPoint
|
|
@@ -2804,21 +1856,15 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
2804
1856
|
* @param {Parse.GeoPoint} point
|
|
2805
1857
|
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
2806
1858
|
*/
|
|
2807
|
-
|
|
2808
1859
|
}, {
|
|
2809
1860
|
key: "polygonContains",
|
|
2810
|
-
value: function
|
|
2811
|
-
/*: string*/
|
|
2812
|
-
, point
|
|
2813
|
-
/*: ParseGeoPoint*/
|
|
2814
|
-
)
|
|
2815
|
-
/*: ParseQuery*/
|
|
2816
|
-
{
|
|
1861
|
+
value: function (key /*: string*/, point /*: ParseGeoPoint*/) /*: ParseQuery*/{
|
|
2817
1862
|
return this._addCondition(key, '$geoIntersects', {
|
|
2818
1863
|
$point: point
|
|
2819
1864
|
});
|
|
2820
1865
|
}
|
|
2821
|
-
|
|
1866
|
+
|
|
1867
|
+
/* Query Orderings */
|
|
2822
1868
|
|
|
2823
1869
|
/**
|
|
2824
1870
|
* Sorts the results in ascending order by the given key.
|
|
@@ -2827,20 +1873,16 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
2827
1873
|
* string of comma separated values, or an Array of keys, or multiple keys.
|
|
2828
1874
|
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
2829
1875
|
*/
|
|
2830
|
-
|
|
2831
1876
|
}, {
|
|
2832
1877
|
key: "ascending",
|
|
2833
|
-
value: function
|
|
2834
|
-
/*: ParseQuery*/
|
|
2835
|
-
{
|
|
1878
|
+
value: function () /*: ParseQuery*/{
|
|
2836
1879
|
this._order = [];
|
|
2837
|
-
|
|
2838
1880
|
for (var _len = arguments.length, keys = new Array(_len), _key5 = 0; _key5 < _len; _key5++) {
|
|
2839
1881
|
keys[_key5] = arguments[_key5];
|
|
2840
1882
|
}
|
|
2841
|
-
|
|
2842
1883
|
return this.addAscending.apply(this, keys);
|
|
2843
1884
|
}
|
|
1885
|
+
|
|
2844
1886
|
/**
|
|
2845
1887
|
* Sorts the results in ascending order by the given key,
|
|
2846
1888
|
* but can also add secondary sort descriptors without overwriting _order.
|
|
@@ -2849,33 +1891,26 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
2849
1891
|
* string of comma separated values, or an Array of keys, or multiple keys.
|
|
2850
1892
|
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
2851
1893
|
*/
|
|
2852
|
-
|
|
2853
1894
|
}, {
|
|
2854
1895
|
key: "addAscending",
|
|
2855
|
-
value: function
|
|
2856
|
-
/*: ParseQuery*/
|
|
2857
|
-
{
|
|
1896
|
+
value: function () /*: ParseQuery*/{
|
|
2858
1897
|
var _this9 = this;
|
|
2859
|
-
|
|
2860
1898
|
if (!this._order) {
|
|
2861
1899
|
this._order = [];
|
|
2862
1900
|
}
|
|
2863
|
-
|
|
2864
1901
|
for (var _len2 = arguments.length, keys = new Array(_len2), _key6 = 0; _key6 < _len2; _key6++) {
|
|
2865
1902
|
keys[_key6] = arguments[_key6];
|
|
2866
1903
|
}
|
|
2867
|
-
|
|
2868
1904
|
(0, _forEach.default)(keys).call(keys, function (key) {
|
|
2869
1905
|
var _context16;
|
|
2870
|
-
|
|
2871
1906
|
if ((0, _isArray.default)(key)) {
|
|
2872
1907
|
key = key.join();
|
|
2873
1908
|
}
|
|
2874
|
-
|
|
2875
1909
|
_this9._order = (0, _concat.default)(_context16 = _this9._order).call(_context16, key.replace(/\s/g, '').split(','));
|
|
2876
1910
|
});
|
|
2877
1911
|
return this;
|
|
2878
1912
|
}
|
|
1913
|
+
|
|
2879
1914
|
/**
|
|
2880
1915
|
* Sorts the results in descending order by the given key.
|
|
2881
1916
|
*
|
|
@@ -2883,20 +1918,16 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
2883
1918
|
* string of comma separated values, or an Array of keys, or multiple keys.
|
|
2884
1919
|
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
2885
1920
|
*/
|
|
2886
|
-
|
|
2887
1921
|
}, {
|
|
2888
1922
|
key: "descending",
|
|
2889
|
-
value: function
|
|
2890
|
-
/*: ParseQuery*/
|
|
2891
|
-
{
|
|
1923
|
+
value: function () /*: ParseQuery*/{
|
|
2892
1924
|
this._order = [];
|
|
2893
|
-
|
|
2894
1925
|
for (var _len3 = arguments.length, keys = new Array(_len3), _key7 = 0; _key7 < _len3; _key7++) {
|
|
2895
1926
|
keys[_key7] = arguments[_key7];
|
|
2896
1927
|
}
|
|
2897
|
-
|
|
2898
1928
|
return this.addDescending.apply(this, keys);
|
|
2899
1929
|
}
|
|
1930
|
+
|
|
2900
1931
|
/**
|
|
2901
1932
|
* Sorts the results in descending order by the given key,
|
|
2902
1933
|
* but can also add secondary sort descriptors without overwriting _order.
|
|
@@ -2905,36 +1936,29 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
2905
1936
|
* string of comma separated values, or an Array of keys, or multiple keys.
|
|
2906
1937
|
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
2907
1938
|
*/
|
|
2908
|
-
|
|
2909
1939
|
}, {
|
|
2910
1940
|
key: "addDescending",
|
|
2911
|
-
value: function
|
|
2912
|
-
/*: ParseQuery*/
|
|
2913
|
-
{
|
|
1941
|
+
value: function () /*: ParseQuery*/{
|
|
2914
1942
|
var _this10 = this;
|
|
2915
|
-
|
|
2916
1943
|
if (!this._order) {
|
|
2917
1944
|
this._order = [];
|
|
2918
1945
|
}
|
|
2919
|
-
|
|
2920
1946
|
for (var _len4 = arguments.length, keys = new Array(_len4), _key8 = 0; _key8 < _len4; _key8++) {
|
|
2921
1947
|
keys[_key8] = arguments[_key8];
|
|
2922
1948
|
}
|
|
2923
|
-
|
|
2924
1949
|
(0, _forEach.default)(keys).call(keys, function (key) {
|
|
2925
1950
|
var _context17, _context18;
|
|
2926
|
-
|
|
2927
1951
|
if ((0, _isArray.default)(key)) {
|
|
2928
1952
|
key = key.join();
|
|
2929
1953
|
}
|
|
2930
|
-
|
|
2931
1954
|
_this10._order = (0, _concat.default)(_context17 = _this10._order).call(_context17, (0, _map2.default)(_context18 = key.replace(/\s/g, '').split(',')).call(_context18, function (k) {
|
|
2932
1955
|
return '-' + k;
|
|
2933
1956
|
}));
|
|
2934
1957
|
});
|
|
2935
1958
|
return this;
|
|
2936
1959
|
}
|
|
2937
|
-
|
|
1960
|
+
|
|
1961
|
+
/* Query Options */
|
|
2938
1962
|
|
|
2939
1963
|
/**
|
|
2940
1964
|
* Sets the number of results to skip before returning any results.
|
|
@@ -2944,42 +1968,32 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
2944
1968
|
* @param {number} n the number of results to skip.
|
|
2945
1969
|
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
2946
1970
|
*/
|
|
2947
|
-
|
|
2948
1971
|
}, {
|
|
2949
1972
|
key: "skip",
|
|
2950
|
-
value: function
|
|
2951
|
-
/*: number*/
|
|
2952
|
-
)
|
|
2953
|
-
/*: ParseQuery*/
|
|
2954
|
-
{
|
|
1973
|
+
value: function (n /*: number*/) /*: ParseQuery*/{
|
|
2955
1974
|
if (typeof n !== 'number' || n < 0) {
|
|
2956
1975
|
throw new Error('You can only skip by a positive number');
|
|
2957
1976
|
}
|
|
2958
|
-
|
|
2959
1977
|
this._skip = n;
|
|
2960
1978
|
return this;
|
|
2961
1979
|
}
|
|
1980
|
+
|
|
2962
1981
|
/**
|
|
2963
1982
|
* Sets the limit of the number of results to return. The default limit is 100.
|
|
2964
1983
|
*
|
|
2965
1984
|
* @param {number} n the number of results to limit to.
|
|
2966
1985
|
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
2967
1986
|
*/
|
|
2968
|
-
|
|
2969
1987
|
}, {
|
|
2970
1988
|
key: "limit",
|
|
2971
|
-
value: function
|
|
2972
|
-
/*: number*/
|
|
2973
|
-
)
|
|
2974
|
-
/*: ParseQuery*/
|
|
2975
|
-
{
|
|
1989
|
+
value: function (n /*: number*/) /*: ParseQuery*/{
|
|
2976
1990
|
if (typeof n !== 'number') {
|
|
2977
1991
|
throw new Error('You can only set the limit to a numeric value');
|
|
2978
1992
|
}
|
|
2979
|
-
|
|
2980
1993
|
this._limit = n;
|
|
2981
1994
|
return this;
|
|
2982
1995
|
}
|
|
1996
|
+
|
|
2983
1997
|
/**
|
|
2984
1998
|
* Sets the flag to include with response the total number of objects satisfying this query,
|
|
2985
1999
|
* despite limits/skip. Might be useful for pagination.
|
|
@@ -2989,20 +2003,13 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
2989
2003
|
* @param {boolean} includeCount false - disable, true - enable.
|
|
2990
2004
|
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
2991
2005
|
*/
|
|
2992
|
-
|
|
2993
2006
|
}, {
|
|
2994
2007
|
key: "withCount",
|
|
2995
|
-
value: function
|
|
2996
|
-
|
|
2997
|
-
{
|
|
2998
|
-
var includeCount
|
|
2999
|
-
/*: boolean*/
|
|
3000
|
-
= arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
3001
|
-
|
|
2008
|
+
value: function () /*: ParseQuery*/{
|
|
2009
|
+
var includeCount /*: boolean*/ = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
3002
2010
|
if (typeof includeCount !== 'boolean') {
|
|
3003
2011
|
throw new Error('You can only set withCount to a boolean value');
|
|
3004
2012
|
}
|
|
3005
|
-
|
|
3006
2013
|
this._count = includeCount;
|
|
3007
2014
|
return this;
|
|
3008
2015
|
}
|
|
@@ -3017,22 +2024,16 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
3017
2024
|
* @param {...string|Array<string>} keys The name(s) of the key(s) to include.
|
|
3018
2025
|
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
3019
2026
|
*/
|
|
3020
|
-
|
|
3021
2027
|
}, {
|
|
3022
2028
|
key: "include",
|
|
3023
|
-
value: function
|
|
3024
|
-
/*: ParseQuery*/
|
|
3025
|
-
{
|
|
2029
|
+
value: function () /*: ParseQuery*/{
|
|
3026
2030
|
var _this11 = this;
|
|
3027
|
-
|
|
3028
2031
|
for (var _len5 = arguments.length, keys = new Array(_len5), _key9 = 0; _key9 < _len5; _key9++) {
|
|
3029
2032
|
keys[_key9] = arguments[_key9];
|
|
3030
2033
|
}
|
|
3031
|
-
|
|
3032
2034
|
(0, _forEach.default)(keys).call(keys, function (key) {
|
|
3033
2035
|
if ((0, _isArray.default)(key)) {
|
|
3034
2036
|
var _context19;
|
|
3035
|
-
|
|
3036
2037
|
_this11._include = (0, _concat.default)(_context19 = _this11._include).call(_context19, key);
|
|
3037
2038
|
} else {
|
|
3038
2039
|
_this11._include.push(key);
|
|
@@ -3040,6 +2041,7 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
3040
2041
|
});
|
|
3041
2042
|
return this;
|
|
3042
2043
|
}
|
|
2044
|
+
|
|
3043
2045
|
/**
|
|
3044
2046
|
* Includes all nested Parse.Objects one level deep.
|
|
3045
2047
|
*
|
|
@@ -3047,14 +2049,12 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
3047
2049
|
*
|
|
3048
2050
|
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
3049
2051
|
*/
|
|
3050
|
-
|
|
3051
2052
|
}, {
|
|
3052
2053
|
key: "includeAll",
|
|
3053
|
-
value: function
|
|
3054
|
-
/*: ParseQuery*/
|
|
3055
|
-
{
|
|
2054
|
+
value: function () /*: ParseQuery*/{
|
|
3056
2055
|
return this.include('*');
|
|
3057
2056
|
}
|
|
2057
|
+
|
|
3058
2058
|
/**
|
|
3059
2059
|
* Restricts the fields of the returned Parse.Objects to include only the
|
|
3060
2060
|
* provided keys. If this is called multiple times, then all of the keys
|
|
@@ -3063,26 +2063,19 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
3063
2063
|
* @param {...string|Array<string>} keys The name(s) of the key(s) to include.
|
|
3064
2064
|
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
3065
2065
|
*/
|
|
3066
|
-
|
|
3067
2066
|
}, {
|
|
3068
2067
|
key: "select",
|
|
3069
|
-
value: function
|
|
3070
|
-
/*: ParseQuery*/
|
|
3071
|
-
{
|
|
2068
|
+
value: function () /*: ParseQuery*/{
|
|
3072
2069
|
var _this12 = this;
|
|
3073
|
-
|
|
3074
2070
|
if (!this._select) {
|
|
3075
2071
|
this._select = [];
|
|
3076
2072
|
}
|
|
3077
|
-
|
|
3078
2073
|
for (var _len6 = arguments.length, keys = new Array(_len6), _key10 = 0; _key10 < _len6; _key10++) {
|
|
3079
2074
|
keys[_key10] = arguments[_key10];
|
|
3080
2075
|
}
|
|
3081
|
-
|
|
3082
2076
|
(0, _forEach.default)(keys).call(keys, function (key) {
|
|
3083
2077
|
if ((0, _isArray.default)(key)) {
|
|
3084
2078
|
var _context20;
|
|
3085
|
-
|
|
3086
2079
|
_this12._select = (0, _concat.default)(_context20 = _this12._select).call(_context20, key);
|
|
3087
2080
|
} else {
|
|
3088
2081
|
_this12._select.push(key);
|
|
@@ -3090,6 +2083,7 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
3090
2083
|
});
|
|
3091
2084
|
return this;
|
|
3092
2085
|
}
|
|
2086
|
+
|
|
3093
2087
|
/**
|
|
3094
2088
|
* Restricts the fields of the returned Parse.Objects to all keys except the
|
|
3095
2089
|
* provided keys. Exclude takes precedence over select and include.
|
|
@@ -3099,22 +2093,16 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
3099
2093
|
* @param {...string|Array<string>} keys The name(s) of the key(s) to exclude.
|
|
3100
2094
|
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
3101
2095
|
*/
|
|
3102
|
-
|
|
3103
2096
|
}, {
|
|
3104
2097
|
key: "exclude",
|
|
3105
|
-
value: function
|
|
3106
|
-
/*: ParseQuery*/
|
|
3107
|
-
{
|
|
2098
|
+
value: function () /*: ParseQuery*/{
|
|
3108
2099
|
var _this13 = this;
|
|
3109
|
-
|
|
3110
2100
|
for (var _len7 = arguments.length, keys = new Array(_len7), _key11 = 0; _key11 < _len7; _key11++) {
|
|
3111
2101
|
keys[_key11] = arguments[_key11];
|
|
3112
2102
|
}
|
|
3113
|
-
|
|
3114
2103
|
(0, _forEach.default)(keys).call(keys, function (key) {
|
|
3115
2104
|
if ((0, _isArray.default)(key)) {
|
|
3116
2105
|
var _context21;
|
|
3117
|
-
|
|
3118
2106
|
_this13._exclude = (0, _concat.default)(_context21 = _this13._exclude).call(_context21, key);
|
|
3119
2107
|
} else {
|
|
3120
2108
|
_this13._exclude.push(key);
|
|
@@ -3122,6 +2110,7 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
3122
2110
|
});
|
|
3123
2111
|
return this;
|
|
3124
2112
|
}
|
|
2113
|
+
|
|
3125
2114
|
/**
|
|
3126
2115
|
* Changes the read preference that the backend will use when performing the query to the database.
|
|
3127
2116
|
*
|
|
@@ -3130,23 +2119,15 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
3130
2119
|
* @param {string} subqueryReadPreference The read preference for the sub queries.
|
|
3131
2120
|
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
3132
2121
|
*/
|
|
3133
|
-
|
|
3134
2122
|
}, {
|
|
3135
2123
|
key: "readPreference",
|
|
3136
|
-
value: function
|
|
3137
|
-
/*: string*/
|
|
3138
|
-
, includeReadPreference
|
|
3139
|
-
/*:: ?: string*/
|
|
3140
|
-
, subqueryReadPreference
|
|
3141
|
-
/*:: ?: string*/
|
|
3142
|
-
)
|
|
3143
|
-
/*: ParseQuery*/
|
|
3144
|
-
{
|
|
2124
|
+
value: function (_readPreference /*: string*/, includeReadPreference /*:: ?: string*/, subqueryReadPreference /*:: ?: string*/) /*: ParseQuery*/{
|
|
3145
2125
|
this._readPreference = _readPreference;
|
|
3146
2126
|
this._includeReadPreference = includeReadPreference;
|
|
3147
2127
|
this._subqueryReadPreference = subqueryReadPreference;
|
|
3148
2128
|
return this;
|
|
3149
2129
|
}
|
|
2130
|
+
|
|
3150
2131
|
/**
|
|
3151
2132
|
* Subscribe this query to get liveQuery updates
|
|
3152
2133
|
*
|
|
@@ -3154,55 +2135,41 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
3154
2135
|
* @returns {Promise<LiveQuerySubscription>} Returns the liveQuerySubscription, it's an event emitter
|
|
3155
2136
|
* which can be used to get liveQuery updates.
|
|
3156
2137
|
*/
|
|
3157
|
-
|
|
3158
2138
|
}, {
|
|
3159
2139
|
key: "subscribe",
|
|
3160
2140
|
value: function () {
|
|
3161
|
-
var _subscribe = (0, _asyncToGenerator2.default)( /*#__PURE__*/
|
|
3162
|
-
/*:: ?: string*/
|
|
3163
|
-
) {
|
|
2141
|
+
var _subscribe = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(sessionToken /*:: ?: string*/) {
|
|
3164
2142
|
var currentUser, liveQueryClient, subscription;
|
|
3165
|
-
return
|
|
3166
|
-
while (1) {
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
subscription = liveQueryClient.subscribe(this, sessionToken);
|
|
3190
|
-
return _context22.abrupt("return", subscription.subscribePromise.then(function () {
|
|
3191
|
-
return subscription;
|
|
3192
|
-
}));
|
|
3193
|
-
|
|
3194
|
-
case 10:
|
|
3195
|
-
case "end":
|
|
3196
|
-
return _context22.stop();
|
|
3197
|
-
}
|
|
2143
|
+
return _regenerator.default.wrap(function (_context22) {
|
|
2144
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
2145
|
+
case 0:
|
|
2146
|
+
_context22.next = 2;
|
|
2147
|
+
return _CoreManager.default.getUserController().currentUserAsync();
|
|
2148
|
+
case 2:
|
|
2149
|
+
currentUser = _context22.sent;
|
|
2150
|
+
if (!sessionToken) {
|
|
2151
|
+
sessionToken = currentUser ? currentUser.getSessionToken() : undefined;
|
|
2152
|
+
}
|
|
2153
|
+
_context22.next = 6;
|
|
2154
|
+
return _CoreManager.default.getLiveQueryController().getDefaultLiveQueryClient();
|
|
2155
|
+
case 6:
|
|
2156
|
+
liveQueryClient = _context22.sent;
|
|
2157
|
+
if (liveQueryClient.shouldOpen()) {
|
|
2158
|
+
liveQueryClient.open();
|
|
2159
|
+
}
|
|
2160
|
+
subscription = liveQueryClient.subscribe(this, sessionToken);
|
|
2161
|
+
return _context22.abrupt("return", subscription.subscribePromise.then(function () {
|
|
2162
|
+
return subscription;
|
|
2163
|
+
}));
|
|
2164
|
+
case 10:
|
|
2165
|
+
case "end":
|
|
2166
|
+
return _context22.stop();
|
|
3198
2167
|
}
|
|
3199
2168
|
}, _callee7, this);
|
|
3200
2169
|
}));
|
|
3201
|
-
|
|
3202
|
-
function subscribe(_x10) {
|
|
2170
|
+
function subscribe() {
|
|
3203
2171
|
return _subscribe.apply(this, arguments);
|
|
3204
2172
|
}
|
|
3205
|
-
|
|
3206
2173
|
return subscribe;
|
|
3207
2174
|
}()
|
|
3208
2175
|
/**
|
|
@@ -3217,7 +2184,6 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
3217
2184
|
* @static
|
|
3218
2185
|
* @returns {Parse.Query} The query that is the OR of the passed in queries.
|
|
3219
2186
|
*/
|
|
3220
|
-
|
|
3221
2187
|
}, {
|
|
3222
2188
|
key: "fromNetwork",
|
|
3223
2189
|
value:
|
|
@@ -3226,131 +2192,98 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
3226
2192
|
*
|
|
3227
2193
|
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
3228
2194
|
*/
|
|
3229
|
-
function
|
|
3230
|
-
/*: ParseQuery*/
|
|
3231
|
-
{
|
|
2195
|
+
function () /*: ParseQuery*/{
|
|
3232
2196
|
this._queriesLocalDatastore = false;
|
|
3233
2197
|
this._localDatastorePinName = null;
|
|
3234
2198
|
return this;
|
|
3235
2199
|
}
|
|
2200
|
+
|
|
3236
2201
|
/**
|
|
3237
2202
|
* Changes the source of this query to all pinned objects.
|
|
3238
2203
|
*
|
|
3239
2204
|
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
3240
2205
|
*/
|
|
3241
|
-
|
|
3242
2206
|
}, {
|
|
3243
2207
|
key: "fromLocalDatastore",
|
|
3244
|
-
value: function
|
|
3245
|
-
/*: ParseQuery*/
|
|
3246
|
-
{
|
|
2208
|
+
value: function () /*: ParseQuery*/{
|
|
3247
2209
|
return this.fromPinWithName(null);
|
|
3248
2210
|
}
|
|
2211
|
+
|
|
3249
2212
|
/**
|
|
3250
2213
|
* Changes the source of this query to the default group of pinned objects.
|
|
3251
2214
|
*
|
|
3252
2215
|
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
3253
2216
|
*/
|
|
3254
|
-
|
|
3255
2217
|
}, {
|
|
3256
2218
|
key: "fromPin",
|
|
3257
|
-
value: function
|
|
3258
|
-
/*: ParseQuery*/
|
|
3259
|
-
{
|
|
2219
|
+
value: function () /*: ParseQuery*/{
|
|
3260
2220
|
return this.fromPinWithName(_LocalDatastoreUtils.DEFAULT_PIN);
|
|
3261
2221
|
}
|
|
2222
|
+
|
|
3262
2223
|
/**
|
|
3263
2224
|
* Changes the source of this query to a specific group of pinned objects.
|
|
3264
2225
|
*
|
|
3265
2226
|
* @param {string} name The name of query source.
|
|
3266
2227
|
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
3267
2228
|
*/
|
|
3268
|
-
|
|
3269
2229
|
}, {
|
|
3270
2230
|
key: "fromPinWithName",
|
|
3271
|
-
value: function
|
|
3272
|
-
/*:: ?: string*/
|
|
3273
|
-
)
|
|
3274
|
-
/*: ParseQuery*/
|
|
3275
|
-
{
|
|
2231
|
+
value: function (name /*:: ?: string*/) /*: ParseQuery*/{
|
|
3276
2232
|
var localDatastore = _CoreManager.default.getLocalDatastore();
|
|
3277
|
-
|
|
3278
2233
|
if (localDatastore.checkIfEnabled()) {
|
|
3279
2234
|
this._queriesLocalDatastore = true;
|
|
3280
2235
|
this._localDatastorePinName = name;
|
|
3281
2236
|
}
|
|
3282
|
-
|
|
3283
2237
|
return this;
|
|
3284
2238
|
}
|
|
2239
|
+
|
|
3285
2240
|
/**
|
|
3286
2241
|
* Cancels the current network request (if any is running).
|
|
3287
2242
|
*
|
|
3288
2243
|
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
3289
2244
|
*/
|
|
3290
|
-
|
|
3291
2245
|
}, {
|
|
3292
2246
|
key: "cancel",
|
|
3293
|
-
value: function
|
|
3294
|
-
/*: ParseQuery*/
|
|
3295
|
-
{
|
|
2247
|
+
value: function () /*: ParseQuery*/{
|
|
3296
2248
|
var _this14 = this;
|
|
3297
|
-
|
|
3298
2249
|
if (this._xhrRequest.task && typeof this._xhrRequest.task.abort === 'function') {
|
|
3299
2250
|
this._xhrRequest.task._aborted = true;
|
|
3300
|
-
|
|
3301
2251
|
this._xhrRequest.task.abort();
|
|
3302
|
-
|
|
3303
2252
|
this._xhrRequest.task = null;
|
|
3304
|
-
|
|
3305
2253
|
this._xhrRequest.onchange = function () {};
|
|
3306
|
-
|
|
3307
2254
|
return this;
|
|
3308
2255
|
}
|
|
3309
|
-
|
|
3310
2256
|
return this._xhrRequest.onchange = function () {
|
|
3311
2257
|
return _this14.cancel();
|
|
3312
2258
|
};
|
|
3313
2259
|
}
|
|
3314
2260
|
}, {
|
|
3315
2261
|
key: "_setRequestTask",
|
|
3316
|
-
value: function
|
|
2262
|
+
value: function (options) {
|
|
3317
2263
|
var _this15 = this;
|
|
3318
|
-
|
|
3319
2264
|
options.requestTask = function (task) {
|
|
3320
2265
|
_this15._xhrRequest.task = task;
|
|
3321
|
-
|
|
3322
2266
|
_this15._xhrRequest.onchange();
|
|
3323
2267
|
};
|
|
3324
2268
|
}
|
|
3325
2269
|
}], [{
|
|
3326
2270
|
key: "fromJSON",
|
|
3327
|
-
value: function
|
|
3328
|
-
/*: string*/
|
|
3329
|
-
, json
|
|
3330
|
-
/*: QueryJSON*/
|
|
3331
|
-
)
|
|
3332
|
-
/*: ParseQuery*/
|
|
3333
|
-
{
|
|
2271
|
+
value: function (className /*: string*/, json /*: QueryJSON*/) /*: ParseQuery*/{
|
|
3334
2272
|
var query = new ParseQuery(className);
|
|
3335
2273
|
return query.withJSON(json);
|
|
3336
2274
|
}
|
|
3337
2275
|
}, {
|
|
3338
2276
|
key: "or",
|
|
3339
|
-
value: function
|
|
3340
|
-
/*: ParseQuery*/
|
|
3341
|
-
{
|
|
2277
|
+
value: function () /*: ParseQuery*/{
|
|
3342
2278
|
for (var _len8 = arguments.length, queries = new Array(_len8), _key12 = 0; _key12 < _len8; _key12++) {
|
|
3343
2279
|
queries[_key12] = arguments[_key12];
|
|
3344
2280
|
}
|
|
3345
|
-
|
|
3346
2281
|
var className = _getClassNameFromQueries(queries);
|
|
3347
|
-
|
|
3348
2282
|
var query = new ParseQuery(className);
|
|
3349
|
-
|
|
3350
2283
|
query._orQuery(queries);
|
|
3351
|
-
|
|
3352
2284
|
return query;
|
|
3353
2285
|
}
|
|
2286
|
+
|
|
3354
2287
|
/**
|
|
3355
2288
|
* Constructs a Parse.Query that is the AND of the passed in queries. For
|
|
3356
2289
|
* example:
|
|
@@ -3363,24 +2296,18 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
3363
2296
|
* @static
|
|
3364
2297
|
* @returns {Parse.Query} The query that is the AND of the passed in queries.
|
|
3365
2298
|
*/
|
|
3366
|
-
|
|
3367
2299
|
}, {
|
|
3368
2300
|
key: "and",
|
|
3369
|
-
value: function
|
|
3370
|
-
/*: ParseQuery*/
|
|
3371
|
-
{
|
|
2301
|
+
value: function () /*: ParseQuery*/{
|
|
3372
2302
|
for (var _len9 = arguments.length, queries = new Array(_len9), _key13 = 0; _key13 < _len9; _key13++) {
|
|
3373
2303
|
queries[_key13] = arguments[_key13];
|
|
3374
2304
|
}
|
|
3375
|
-
|
|
3376
2305
|
var className = _getClassNameFromQueries(queries);
|
|
3377
|
-
|
|
3378
2306
|
var query = new ParseQuery(className);
|
|
3379
|
-
|
|
3380
2307
|
query._andQuery(queries);
|
|
3381
|
-
|
|
3382
2308
|
return query;
|
|
3383
2309
|
}
|
|
2310
|
+
|
|
3384
2311
|
/**
|
|
3385
2312
|
* Constructs a Parse.Query that is the NOR of the passed in queries. For
|
|
3386
2313
|
* example:
|
|
@@ -3393,58 +2320,30 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
3393
2320
|
* @static
|
|
3394
2321
|
* @returns {Parse.Query} The query that is the NOR of the passed in queries.
|
|
3395
2322
|
*/
|
|
3396
|
-
|
|
3397
2323
|
}, {
|
|
3398
2324
|
key: "nor",
|
|
3399
|
-
value: function
|
|
3400
|
-
/*: ParseQuery*/
|
|
3401
|
-
{
|
|
2325
|
+
value: function () /*: ParseQuery*/{
|
|
3402
2326
|
for (var _len10 = arguments.length, queries = new Array(_len10), _key14 = 0; _key14 < _len10; _key14++) {
|
|
3403
2327
|
queries[_key14] = arguments[_key14];
|
|
3404
2328
|
}
|
|
3405
|
-
|
|
3406
2329
|
var className = _getClassNameFromQueries(queries);
|
|
3407
|
-
|
|
3408
2330
|
var query = new ParseQuery(className);
|
|
3409
|
-
|
|
3410
2331
|
query._norQuery(queries);
|
|
3411
|
-
|
|
3412
2332
|
return query;
|
|
3413
2333
|
}
|
|
3414
2334
|
}]);
|
|
3415
2335
|
return ParseQuery;
|
|
3416
2336
|
}();
|
|
3417
|
-
|
|
3418
2337
|
var DefaultController = {
|
|
3419
|
-
find: function
|
|
3420
|
-
/*: string*/
|
|
3421
|
-
, params
|
|
3422
|
-
/*: QueryJSON*/
|
|
3423
|
-
, options
|
|
3424
|
-
/*: RequestOptions*/
|
|
3425
|
-
)
|
|
3426
|
-
/*: Promise<Array<ParseObject>>*/
|
|
3427
|
-
{
|
|
2338
|
+
find: function (className /*: string*/, params /*: QueryJSON*/, options /*: RequestOptions*/) /*: Promise<Array<ParseObject>>*/{
|
|
3428
2339
|
var RESTController = _CoreManager.default.getRESTController();
|
|
3429
|
-
|
|
3430
2340
|
return RESTController.request('GET', 'classes/' + className, params, options);
|
|
3431
2341
|
},
|
|
3432
|
-
aggregate: function
|
|
3433
|
-
/*: string*/
|
|
3434
|
-
, params
|
|
3435
|
-
/*: any*/
|
|
3436
|
-
, options
|
|
3437
|
-
/*: RequestOptions*/
|
|
3438
|
-
)
|
|
3439
|
-
/*: Promise<Array<mixed>>*/
|
|
3440
|
-
{
|
|
2342
|
+
aggregate: function (className /*: string*/, params /*: any*/, options /*: RequestOptions*/) /*: Promise<Array<mixed>>*/{
|
|
3441
2343
|
var RESTController = _CoreManager.default.getRESTController();
|
|
3442
|
-
|
|
3443
2344
|
return RESTController.request('GET', 'aggregate/' + className, params, options);
|
|
3444
2345
|
}
|
|
3445
2346
|
};
|
|
3446
|
-
|
|
3447
2347
|
_CoreManager.default.setQueryController(DefaultController);
|
|
3448
|
-
|
|
3449
2348
|
var _default = ParseQuery;
|
|
3450
2349
|
exports.default = _default;
|