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,408 +1,40 @@
|
|
|
1
1
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
2
|
-
|
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
|
4
3
|
value: true
|
|
5
4
|
});
|
|
6
5
|
exports.default = void 0;
|
|
7
|
-
|
|
8
6
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
|
-
|
|
10
7
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
11
|
-
|
|
8
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
12
9
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
13
|
-
|
|
14
10
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
15
|
-
|
|
16
11
|
var _CoreManager = _interopRequireDefault(require("./CoreManager"));
|
|
17
|
-
|
|
18
12
|
var _encode = _interopRequireDefault(require("./encode"));
|
|
19
|
-
|
|
20
13
|
var _promiseUtils = require("./promiseUtils");
|
|
21
|
-
|
|
22
14
|
var _ParseError = _interopRequireDefault(require("./ParseError"));
|
|
23
|
-
|
|
24
15
|
var _ParseGeoPoint = _interopRequireDefault(require("./ParseGeoPoint"));
|
|
25
|
-
|
|
26
16
|
var _ParseObject = _interopRequireDefault(require("./ParseObject"));
|
|
27
|
-
|
|
28
17
|
var _OfflineQuery = _interopRequireDefault(require("./OfflineQuery"));
|
|
29
|
-
|
|
30
18
|
var _LocalDatastoreUtils = require("./LocalDatastoreUtils");
|
|
31
|
-
|
|
32
|
-
function _regeneratorRuntime() {
|
|
33
|
-
"use strict";
|
|
34
|
-
|
|
35
|
-
_regeneratorRuntime = function () {
|
|
36
|
-
return exports;
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
var exports = {},
|
|
40
|
-
Op = Object.prototype,
|
|
41
|
-
hasOwn = Op.hasOwnProperty,
|
|
42
|
-
$Symbol = "function" == typeof Symbol ? Symbol : {},
|
|
43
|
-
iteratorSymbol = $Symbol.iterator || "@@iterator",
|
|
44
|
-
asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
|
|
45
|
-
toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
46
|
-
|
|
47
|
-
function define(obj, key, value) {
|
|
48
|
-
return Object.defineProperty(obj, key, {
|
|
49
|
-
value: value,
|
|
50
|
-
enumerable: !0,
|
|
51
|
-
configurable: !0,
|
|
52
|
-
writable: !0
|
|
53
|
-
}), obj[key];
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
try {
|
|
57
|
-
define({}, "");
|
|
58
|
-
} catch (err) {
|
|
59
|
-
define = function (obj, key, value) {
|
|
60
|
-
return obj[key] = value;
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
65
|
-
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
|
|
66
|
-
generator = Object.create(protoGenerator.prototype),
|
|
67
|
-
context = new Context(tryLocsList || []);
|
|
68
|
-
return generator._invoke = function (innerFn, self, context) {
|
|
69
|
-
var state = "suspendedStart";
|
|
70
|
-
return function (method, arg) {
|
|
71
|
-
if ("executing" === state) throw new Error("Generator is already running");
|
|
72
|
-
|
|
73
|
-
if ("completed" === state) {
|
|
74
|
-
if ("throw" === method) throw arg;
|
|
75
|
-
return doneResult();
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
for (context.method = method, context.arg = arg;;) {
|
|
79
|
-
var delegate = context.delegate;
|
|
80
|
-
|
|
81
|
-
if (delegate) {
|
|
82
|
-
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
83
|
-
|
|
84
|
-
if (delegateResult) {
|
|
85
|
-
if (delegateResult === ContinueSentinel) continue;
|
|
86
|
-
return delegateResult;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
|
|
91
|
-
if ("suspendedStart" === state) throw state = "completed", context.arg;
|
|
92
|
-
context.dispatchException(context.arg);
|
|
93
|
-
} else "return" === context.method && context.abrupt("return", context.arg);
|
|
94
|
-
state = "executing";
|
|
95
|
-
var record = tryCatch(innerFn, self, context);
|
|
96
|
-
|
|
97
|
-
if ("normal" === record.type) {
|
|
98
|
-
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
|
|
99
|
-
return {
|
|
100
|
-
value: record.arg,
|
|
101
|
-
done: context.done
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
|
|
106
|
-
}
|
|
107
|
-
};
|
|
108
|
-
}(innerFn, self, context), generator;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
function tryCatch(fn, obj, arg) {
|
|
112
|
-
try {
|
|
113
|
-
return {
|
|
114
|
-
type: "normal",
|
|
115
|
-
arg: fn.call(obj, arg)
|
|
116
|
-
};
|
|
117
|
-
} catch (err) {
|
|
118
|
-
return {
|
|
119
|
-
type: "throw",
|
|
120
|
-
arg: err
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
exports.wrap = wrap;
|
|
126
|
-
var ContinueSentinel = {};
|
|
127
|
-
|
|
128
|
-
function Generator() {}
|
|
129
|
-
|
|
130
|
-
function GeneratorFunction() {}
|
|
131
|
-
|
|
132
|
-
function GeneratorFunctionPrototype() {}
|
|
133
|
-
|
|
134
|
-
var IteratorPrototype = {};
|
|
135
|
-
define(IteratorPrototype, iteratorSymbol, function () {
|
|
136
|
-
return this;
|
|
137
|
-
});
|
|
138
|
-
var getProto = Object.getPrototypeOf,
|
|
139
|
-
NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
140
|
-
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
|
|
141
|
-
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
|
142
|
-
|
|
143
|
-
function defineIteratorMethods(prototype) {
|
|
144
|
-
["next", "throw", "return"].forEach(function (method) {
|
|
145
|
-
define(prototype, method, function (arg) {
|
|
146
|
-
return this._invoke(method, arg);
|
|
147
|
-
});
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
function AsyncIterator(generator, PromiseImpl) {
|
|
152
|
-
function invoke(method, arg, resolve, reject) {
|
|
153
|
-
var record = tryCatch(generator[method], generator, arg);
|
|
154
|
-
|
|
155
|
-
if ("throw" !== record.type) {
|
|
156
|
-
var result = record.arg,
|
|
157
|
-
value = result.value;
|
|
158
|
-
return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
|
|
159
|
-
invoke("next", value, resolve, reject);
|
|
160
|
-
}, function (err) {
|
|
161
|
-
invoke("throw", err, resolve, reject);
|
|
162
|
-
}) : PromiseImpl.resolve(value).then(function (unwrapped) {
|
|
163
|
-
result.value = unwrapped, resolve(result);
|
|
164
|
-
}, function (error) {
|
|
165
|
-
return invoke("throw", error, resolve, reject);
|
|
166
|
-
});
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
reject(record.arg);
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
var previousPromise;
|
|
173
|
-
|
|
174
|
-
this._invoke = function (method, arg) {
|
|
175
|
-
function callInvokeWithMethodAndArg() {
|
|
176
|
-
return new PromiseImpl(function (resolve, reject) {
|
|
177
|
-
invoke(method, arg, resolve, reject);
|
|
178
|
-
});
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
182
|
-
};
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
function maybeInvokeDelegate(delegate, context) {
|
|
186
|
-
var method = delegate.iterator[context.method];
|
|
187
|
-
|
|
188
|
-
if (undefined === method) {
|
|
189
|
-
if (context.delegate = null, "throw" === context.method) {
|
|
190
|
-
if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
|
|
191
|
-
context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
return ContinueSentinel;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
198
|
-
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
|
|
199
|
-
var info = record.arg;
|
|
200
|
-
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);
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
function pushTryEntry(locs) {
|
|
204
|
-
var entry = {
|
|
205
|
-
tryLoc: locs[0]
|
|
206
|
-
};
|
|
207
|
-
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
function resetTryEntry(entry) {
|
|
211
|
-
var record = entry.completion || {};
|
|
212
|
-
record.type = "normal", delete record.arg, entry.completion = record;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
function Context(tryLocsList) {
|
|
216
|
-
this.tryEntries = [{
|
|
217
|
-
tryLoc: "root"
|
|
218
|
-
}], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
function values(iterable) {
|
|
222
|
-
if (iterable) {
|
|
223
|
-
var iteratorMethod = iterable[iteratorSymbol];
|
|
224
|
-
if (iteratorMethod) return iteratorMethod.call(iterable);
|
|
225
|
-
if ("function" == typeof iterable.next) return iterable;
|
|
226
|
-
|
|
227
|
-
if (!isNaN(iterable.length)) {
|
|
228
|
-
var i = -1,
|
|
229
|
-
next = function next() {
|
|
230
|
-
for (; ++i < iterable.length;) {
|
|
231
|
-
if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
return next.value = undefined, next.done = !0, next;
|
|
235
|
-
};
|
|
236
|
-
|
|
237
|
-
return next.next = next;
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
return {
|
|
242
|
-
next: doneResult
|
|
243
|
-
};
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
function doneResult() {
|
|
247
|
-
return {
|
|
248
|
-
value: undefined,
|
|
249
|
-
done: !0
|
|
250
|
-
};
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
|
|
254
|
-
var ctor = "function" == typeof genFun && genFun.constructor;
|
|
255
|
-
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
|
|
256
|
-
}, exports.mark = function (genFun) {
|
|
257
|
-
return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
|
|
258
|
-
}, exports.awrap = function (arg) {
|
|
259
|
-
return {
|
|
260
|
-
__await: arg
|
|
261
|
-
};
|
|
262
|
-
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
|
|
263
|
-
return this;
|
|
264
|
-
}), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
|
265
|
-
void 0 === PromiseImpl && (PromiseImpl = Promise);
|
|
266
|
-
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
|
|
267
|
-
return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
|
|
268
|
-
return result.done ? result.value : iter.next();
|
|
269
|
-
});
|
|
270
|
-
}, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
|
|
271
|
-
return this;
|
|
272
|
-
}), define(Gp, "toString", function () {
|
|
273
|
-
return "[object Generator]";
|
|
274
|
-
}), exports.keys = function (object) {
|
|
275
|
-
var keys = [];
|
|
276
|
-
|
|
277
|
-
for (var key in object) {
|
|
278
|
-
keys.push(key);
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
return keys.reverse(), function next() {
|
|
282
|
-
for (; keys.length;) {
|
|
283
|
-
var key = keys.pop();
|
|
284
|
-
if (key in object) return next.value = key, next.done = !1, next;
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
return next.done = !0, next;
|
|
288
|
-
};
|
|
289
|
-
}, exports.values = values, Context.prototype = {
|
|
290
|
-
constructor: Context,
|
|
291
|
-
reset: function (skipTempReset) {
|
|
292
|
-
if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) {
|
|
293
|
-
"t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
|
|
294
|
-
}
|
|
295
|
-
},
|
|
296
|
-
stop: function () {
|
|
297
|
-
this.done = !0;
|
|
298
|
-
var rootRecord = this.tryEntries[0].completion;
|
|
299
|
-
if ("throw" === rootRecord.type) throw rootRecord.arg;
|
|
300
|
-
return this.rval;
|
|
301
|
-
},
|
|
302
|
-
dispatchException: function (exception) {
|
|
303
|
-
if (this.done) throw exception;
|
|
304
|
-
var context = this;
|
|
305
|
-
|
|
306
|
-
function handle(loc, caught) {
|
|
307
|
-
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
311
|
-
var entry = this.tryEntries[i],
|
|
312
|
-
record = entry.completion;
|
|
313
|
-
if ("root" === entry.tryLoc) return handle("end");
|
|
314
|
-
|
|
315
|
-
if (entry.tryLoc <= this.prev) {
|
|
316
|
-
var hasCatch = hasOwn.call(entry, "catchLoc"),
|
|
317
|
-
hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
318
|
-
|
|
319
|
-
if (hasCatch && hasFinally) {
|
|
320
|
-
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
321
|
-
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
322
|
-
} else if (hasCatch) {
|
|
323
|
-
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
324
|
-
} else {
|
|
325
|
-
if (!hasFinally) throw new Error("try statement without catch or finally");
|
|
326
|
-
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
},
|
|
331
|
-
abrupt: function (type, arg) {
|
|
332
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
333
|
-
var entry = this.tryEntries[i];
|
|
334
|
-
|
|
335
|
-
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
|
336
|
-
var finallyEntry = entry;
|
|
337
|
-
break;
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
|
|
342
|
-
var record = finallyEntry ? finallyEntry.completion : {};
|
|
343
|
-
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
|
|
344
|
-
},
|
|
345
|
-
complete: function (record, afterLoc) {
|
|
346
|
-
if ("throw" === record.type) throw record.arg;
|
|
347
|
-
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;
|
|
348
|
-
},
|
|
349
|
-
finish: function (finallyLoc) {
|
|
350
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
351
|
-
var entry = this.tryEntries[i];
|
|
352
|
-
if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
|
|
353
|
-
}
|
|
354
|
-
},
|
|
355
|
-
catch: function (tryLoc) {
|
|
356
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
357
|
-
var entry = this.tryEntries[i];
|
|
358
|
-
|
|
359
|
-
if (entry.tryLoc === tryLoc) {
|
|
360
|
-
var record = entry.completion;
|
|
361
|
-
|
|
362
|
-
if ("throw" === record.type) {
|
|
363
|
-
var thrown = record.arg;
|
|
364
|
-
resetTryEntry(entry);
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
return thrown;
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
throw new Error("illegal catch attempt");
|
|
372
|
-
},
|
|
373
|
-
delegateYield: function (iterable, resultName, nextLoc) {
|
|
374
|
-
return this.delegate = {
|
|
375
|
-
iterator: values(iterable),
|
|
376
|
-
resultName: resultName,
|
|
377
|
-
nextLoc: nextLoc
|
|
378
|
-
}, "next" === this.method && (this.arg = undefined), ContinueSentinel;
|
|
379
|
-
}
|
|
380
|
-
}, exports;
|
|
381
|
-
}
|
|
382
|
-
|
|
383
19
|
function quote(s) {
|
|
384
20
|
return '\\Q' + s.replace('\\E', '\\E\\\\E\\Q') + '\\E';
|
|
385
21
|
}
|
|
386
|
-
|
|
387
22
|
function _getClassNameFromQueries(queries) {
|
|
388
23
|
var className = null;
|
|
389
24
|
queries.forEach(function (q) {
|
|
390
25
|
if (!className) {
|
|
391
26
|
className = q.className;
|
|
392
27
|
}
|
|
393
|
-
|
|
394
28
|
if (className !== q.className) {
|
|
395
29
|
throw new Error('All queries must be for the same class.');
|
|
396
30
|
}
|
|
397
31
|
});
|
|
398
32
|
return className;
|
|
399
33
|
}
|
|
400
|
-
|
|
401
34
|
function handleSelectResult(data, select) {
|
|
402
35
|
var serverDataMask = {};
|
|
403
36
|
select.forEach(function (field) {
|
|
404
37
|
var hasSubObjectSelect = field.indexOf('.') !== -1;
|
|
405
|
-
|
|
406
38
|
if (!hasSubObjectSelect && !data.hasOwnProperty(field)) {
|
|
407
39
|
data[field] = undefined;
|
|
408
40
|
} else if (hasSubObjectSelect) {
|
|
@@ -413,32 +45,26 @@ function handleSelectResult(data, select) {
|
|
|
413
45
|
if (_obj && !_obj.hasOwnProperty(component)) {
|
|
414
46
|
_obj[component] = undefined;
|
|
415
47
|
}
|
|
416
|
-
|
|
417
48
|
if (_obj && typeof _obj === 'object') {
|
|
418
49
|
_obj = _obj[component];
|
|
419
50
|
}
|
|
420
|
-
|
|
421
51
|
if (index < arr.length - 1) {
|
|
422
52
|
if (!serverMask[component]) {
|
|
423
53
|
serverMask[component] = {};
|
|
424
54
|
}
|
|
425
|
-
|
|
426
55
|
serverMask = serverMask[component];
|
|
427
56
|
}
|
|
428
57
|
});
|
|
429
58
|
}
|
|
430
59
|
});
|
|
431
|
-
|
|
432
60
|
if (Object.keys(serverDataMask).length > 0) {
|
|
433
61
|
var serverData = _CoreManager.default.getObjectStateController().getServerData({
|
|
434
62
|
id: data.objectId,
|
|
435
63
|
className: data.className
|
|
436
64
|
});
|
|
437
|
-
|
|
438
65
|
copyMissingDataWithMask(serverData, data, serverDataMask, false);
|
|
439
66
|
}
|
|
440
67
|
}
|
|
441
|
-
|
|
442
68
|
function copyMissingDataWithMask(src, dest, mask, copyThisLevel) {
|
|
443
69
|
if (copyThisLevel) {
|
|
444
70
|
for (var _key in src) {
|
|
@@ -447,58 +73,45 @@ function copyMissingDataWithMask(src, dest, mask, copyThisLevel) {
|
|
|
447
73
|
}
|
|
448
74
|
}
|
|
449
75
|
}
|
|
450
|
-
|
|
451
76
|
for (var _key2 in mask) {
|
|
452
77
|
if (dest[_key2] !== undefined && dest[_key2] !== null && src !== undefined && src !== null) {
|
|
453
78
|
copyMissingDataWithMask(src[_key2], dest[_key2], mask[_key2], true);
|
|
454
79
|
}
|
|
455
80
|
}
|
|
456
81
|
}
|
|
457
|
-
|
|
458
82
|
function handleOfflineSort(a, b, sorts) {
|
|
459
83
|
var order = sorts[0];
|
|
460
84
|
var operator = order.slice(0, 1);
|
|
461
85
|
var isDescending = operator === '-';
|
|
462
|
-
|
|
463
86
|
if (isDescending) {
|
|
464
87
|
order = order.substring(1);
|
|
465
88
|
}
|
|
466
|
-
|
|
467
89
|
if (order === '_created_at') {
|
|
468
90
|
order = 'createdAt';
|
|
469
91
|
}
|
|
470
|
-
|
|
471
92
|
if (order === '_updated_at') {
|
|
472
93
|
order = 'updatedAt';
|
|
473
94
|
}
|
|
474
|
-
|
|
475
95
|
if (!/^[A-Za-z][0-9A-Za-z_]*$/.test(order) || order === 'password') {
|
|
476
|
-
throw new _ParseError.default(_ParseError.default.INVALID_KEY_NAME,
|
|
96
|
+
throw new _ParseError.default(_ParseError.default.INVALID_KEY_NAME, `Invalid Key: ${order}`);
|
|
477
97
|
}
|
|
478
|
-
|
|
479
98
|
var field1 = a.get(order);
|
|
480
99
|
var field2 = b.get(order);
|
|
481
|
-
|
|
482
100
|
if (field1 < field2) {
|
|
483
101
|
return isDescending ? 1 : -1;
|
|
484
102
|
}
|
|
485
|
-
|
|
486
103
|
if (field1 > field2) {
|
|
487
104
|
return isDescending ? -1 : 1;
|
|
488
105
|
}
|
|
489
|
-
|
|
490
106
|
if (sorts.length > 1) {
|
|
491
107
|
var remainingSorts = sorts.slice(1);
|
|
492
108
|
return handleOfflineSort(a, b, remainingSorts);
|
|
493
109
|
}
|
|
494
|
-
|
|
495
110
|
return 0;
|
|
496
111
|
}
|
|
497
|
-
|
|
498
112
|
var ParseQuery = function () {
|
|
499
113
|
function ParseQuery(objectClass) {
|
|
500
114
|
(0, _classCallCheck2.default)(this, ParseQuery);
|
|
501
|
-
|
|
502
115
|
if (typeof objectClass === 'string') {
|
|
503
116
|
if (objectClass === 'User' && _CoreManager.default.get('PERFORM_USER_REWRITE')) {
|
|
504
117
|
this.className = '_User';
|
|
@@ -512,13 +125,11 @@ var ParseQuery = function () {
|
|
|
512
125
|
this.className = objectClass.className;
|
|
513
126
|
} else {
|
|
514
127
|
var _obj2 = new objectClass();
|
|
515
|
-
|
|
516
128
|
this.className = _obj2.className;
|
|
517
129
|
}
|
|
518
130
|
} else {
|
|
519
131
|
throw new TypeError('A ParseQuery must be constructed with a ParseObject or class name.');
|
|
520
132
|
}
|
|
521
|
-
|
|
522
133
|
this._where = {};
|
|
523
134
|
this._include = [];
|
|
524
135
|
this._exclude = [];
|
|
@@ -536,7 +147,6 @@ var ParseQuery = function () {
|
|
|
536
147
|
onchange: function () {}
|
|
537
148
|
};
|
|
538
149
|
}
|
|
539
|
-
|
|
540
150
|
(0, _createClass2.default)(ParseQuery, [{
|
|
541
151
|
key: "_orQuery",
|
|
542
152
|
value: function (queries) {
|
|
@@ -570,7 +180,6 @@ var ParseQuery = function () {
|
|
|
570
180
|
if (!this._where[key] || typeof this._where[key] === 'string') {
|
|
571
181
|
this._where[key] = {};
|
|
572
182
|
}
|
|
573
|
-
|
|
574
183
|
this._where[key][condition] = (0, _encode.default)(value, false, true);
|
|
575
184
|
return this;
|
|
576
185
|
}
|
|
@@ -581,160 +190,117 @@ var ParseQuery = function () {
|
|
|
581
190
|
}
|
|
582
191
|
}, {
|
|
583
192
|
key: "_handleOfflineQuery",
|
|
584
|
-
value: function (
|
|
585
|
-
var
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
return object;
|
|
612
|
-
}).filter(function (object) {
|
|
613
|
-
return object !== null;
|
|
614
|
-
});
|
|
615
|
-
|
|
616
|
-
if (params.keys) {
|
|
617
|
-
keys = params.keys.split(',');
|
|
618
|
-
alwaysSelectedKeys = ['className', 'objectId', 'createdAt', 'updatedAt', 'ACL'];
|
|
619
|
-
keys = keys.concat(alwaysSelectedKeys);
|
|
620
|
-
results = results.map(function (object) {
|
|
621
|
-
var json = object._toFullJSON();
|
|
622
|
-
|
|
623
|
-
Object.keys(json).forEach(function (key) {
|
|
624
|
-
if (!keys.includes(key)) {
|
|
625
|
-
delete json[key];
|
|
626
|
-
}
|
|
627
|
-
});
|
|
628
|
-
return _ParseObject.default.fromJSON(json, false);
|
|
629
|
-
});
|
|
630
|
-
}
|
|
631
|
-
|
|
632
|
-
if (params.order) {
|
|
633
|
-
sorts = params.order.split(',');
|
|
634
|
-
results.sort(function (a, b) {
|
|
635
|
-
return handleOfflineSort(a, b, sorts);
|
|
636
|
-
});
|
|
637
|
-
}
|
|
638
|
-
|
|
639
|
-
if (params.count) {
|
|
640
|
-
count = results.length;
|
|
641
|
-
}
|
|
642
|
-
|
|
643
|
-
if (params.skip) {
|
|
644
|
-
if (params.skip >= results.length) {
|
|
645
|
-
results = [];
|
|
646
|
-
} else {
|
|
647
|
-
results = results.splice(params.skip, results.length);
|
|
648
|
-
}
|
|
649
|
-
}
|
|
650
|
-
|
|
651
|
-
limit = results.length;
|
|
652
|
-
|
|
653
|
-
if (params.limit !== 0 && params.limit < results.length) {
|
|
654
|
-
limit = params.limit;
|
|
655
|
-
}
|
|
656
|
-
|
|
657
|
-
results = results.splice(0, limit);
|
|
658
|
-
|
|
659
|
-
if (!(typeof count === 'number')) {
|
|
660
|
-
_context.next = 15;
|
|
661
|
-
break;
|
|
193
|
+
value: function () {
|
|
194
|
+
var _handleOfflineQuery2 = (0, _asyncToGenerator2.default)(function* (params) {
|
|
195
|
+
var _this2 = this;
|
|
196
|
+
_OfflineQuery.default.validateQuery(this);
|
|
197
|
+
var localDatastore = _CoreManager.default.getLocalDatastore();
|
|
198
|
+
var objects = yield localDatastore._serializeObjectsFromPinName(this._localDatastorePinName);
|
|
199
|
+
var results = objects.map(function (json, index, arr) {
|
|
200
|
+
var object = _ParseObject.default.fromJSON(json, false);
|
|
201
|
+
if (json._localId && !json.objectId) {
|
|
202
|
+
object._localId = json._localId;
|
|
203
|
+
}
|
|
204
|
+
if (!_OfflineQuery.default.matchesQuery(_this2.className, object, arr, _this2)) {
|
|
205
|
+
return null;
|
|
206
|
+
}
|
|
207
|
+
return object;
|
|
208
|
+
}).filter(function (object) {
|
|
209
|
+
return object !== null;
|
|
210
|
+
});
|
|
211
|
+
if (params.keys) {
|
|
212
|
+
var keys = params.keys.split(',');
|
|
213
|
+
keys = keys.concat(['className', 'objectId', 'createdAt', 'updatedAt', 'ACL']);
|
|
214
|
+
results = results.map(function (object) {
|
|
215
|
+
var json = object._toFullJSON();
|
|
216
|
+
Object.keys(json).forEach(function (key) {
|
|
217
|
+
if (!keys.includes(key)) {
|
|
218
|
+
delete json[key];
|
|
662
219
|
}
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
220
|
+
});
|
|
221
|
+
return _ParseObject.default.fromJSON(json, false);
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
if (params.order) {
|
|
225
|
+
var sorts = params.order.split(',');
|
|
226
|
+
results.sort(function (a, b) {
|
|
227
|
+
return handleOfflineSort(a, b, sorts);
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
var count;
|
|
231
|
+
if (params.count) {
|
|
232
|
+
count = results.length;
|
|
233
|
+
}
|
|
234
|
+
if (params.skip) {
|
|
235
|
+
if (params.skip >= results.length) {
|
|
236
|
+
results = [];
|
|
237
|
+
} else {
|
|
238
|
+
results = results.splice(params.skip, results.length);
|
|
675
239
|
}
|
|
676
240
|
}
|
|
677
|
-
|
|
678
|
-
|
|
241
|
+
var limit = results.length;
|
|
242
|
+
if (params.limit !== 0 && params.limit < results.length) {
|
|
243
|
+
limit = params.limit;
|
|
244
|
+
}
|
|
245
|
+
results = results.splice(0, limit);
|
|
246
|
+
if (typeof count === 'number') {
|
|
247
|
+
return {
|
|
248
|
+
results: results,
|
|
249
|
+
count: count
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
return results;
|
|
253
|
+
});
|
|
254
|
+
function _handleOfflineQuery() {
|
|
255
|
+
return _handleOfflineQuery2.apply(this, arguments);
|
|
256
|
+
}
|
|
257
|
+
return _handleOfflineQuery;
|
|
258
|
+
}()
|
|
679
259
|
}, {
|
|
680
260
|
key: "toJSON",
|
|
681
261
|
value: function () {
|
|
682
262
|
var params = {
|
|
683
263
|
where: this._where
|
|
684
264
|
};
|
|
685
|
-
|
|
686
265
|
if (this._include.length) {
|
|
687
266
|
params.include = this._include.join(',');
|
|
688
267
|
}
|
|
689
|
-
|
|
690
268
|
if (this._exclude.length) {
|
|
691
269
|
params.excludeKeys = this._exclude.join(',');
|
|
692
270
|
}
|
|
693
|
-
|
|
694
271
|
if (this._select) {
|
|
695
272
|
params.keys = this._select.join(',');
|
|
696
273
|
}
|
|
697
|
-
|
|
698
274
|
if (this._count) {
|
|
699
275
|
params.count = 1;
|
|
700
276
|
}
|
|
701
|
-
|
|
702
277
|
if (this._limit >= 0) {
|
|
703
278
|
params.limit = this._limit;
|
|
704
279
|
}
|
|
705
|
-
|
|
706
280
|
if (this._skip > 0) {
|
|
707
281
|
params.skip = this._skip;
|
|
708
282
|
}
|
|
709
|
-
|
|
710
283
|
if (this._order) {
|
|
711
284
|
params.order = this._order.join(',');
|
|
712
285
|
}
|
|
713
|
-
|
|
714
286
|
if (this._readPreference) {
|
|
715
287
|
params.readPreference = this._readPreference;
|
|
716
288
|
}
|
|
717
|
-
|
|
718
289
|
if (this._includeReadPreference) {
|
|
719
290
|
params.includeReadPreference = this._includeReadPreference;
|
|
720
291
|
}
|
|
721
|
-
|
|
722
292
|
if (this._subqueryReadPreference) {
|
|
723
293
|
params.subqueryReadPreference = this._subqueryReadPreference;
|
|
724
294
|
}
|
|
725
|
-
|
|
726
295
|
if (this._hint) {
|
|
727
296
|
params.hint = this._hint;
|
|
728
297
|
}
|
|
729
|
-
|
|
730
298
|
if (this._explain) {
|
|
731
299
|
params.explain = true;
|
|
732
300
|
}
|
|
733
|
-
|
|
734
301
|
for (var _key3 in this._extraOptions) {
|
|
735
302
|
params[_key3] = this._extraOptions[_key3];
|
|
736
303
|
}
|
|
737
|
-
|
|
738
304
|
return params;
|
|
739
305
|
}
|
|
740
306
|
}, {
|
|
@@ -743,55 +309,42 @@ var ParseQuery = function () {
|
|
|
743
309
|
if (json.where) {
|
|
744
310
|
this._where = json.where;
|
|
745
311
|
}
|
|
746
|
-
|
|
747
312
|
if (json.include) {
|
|
748
313
|
this._include = json.include.split(',');
|
|
749
314
|
}
|
|
750
|
-
|
|
751
315
|
if (json.keys) {
|
|
752
316
|
this._select = json.keys.split(',');
|
|
753
317
|
}
|
|
754
|
-
|
|
755
318
|
if (json.excludeKeys) {
|
|
756
319
|
this._exclude = json.excludeKeys.split(',');
|
|
757
320
|
}
|
|
758
|
-
|
|
759
321
|
if (json.count) {
|
|
760
322
|
this._count = json.count === 1;
|
|
761
323
|
}
|
|
762
|
-
|
|
763
324
|
if (json.limit) {
|
|
764
325
|
this._limit = json.limit;
|
|
765
326
|
}
|
|
766
|
-
|
|
767
327
|
if (json.skip) {
|
|
768
328
|
this._skip = json.skip;
|
|
769
329
|
}
|
|
770
|
-
|
|
771
330
|
if (json.order) {
|
|
772
331
|
this._order = json.order.split(',');
|
|
773
332
|
}
|
|
774
|
-
|
|
775
333
|
if (json.readPreference) {
|
|
776
334
|
this._readPreference = json.readPreference;
|
|
777
335
|
}
|
|
778
|
-
|
|
779
336
|
if (json.includeReadPreference) {
|
|
780
337
|
this._includeReadPreference = json.includeReadPreference;
|
|
781
338
|
}
|
|
782
|
-
|
|
783
339
|
if (json.subqueryReadPreference) {
|
|
784
340
|
this._subqueryReadPreference = json.subqueryReadPreference;
|
|
785
341
|
}
|
|
786
|
-
|
|
787
342
|
if (json.hint) {
|
|
788
343
|
this._hint = json.hint;
|
|
789
344
|
}
|
|
790
|
-
|
|
791
345
|
if (json.explain) {
|
|
792
346
|
this._explain = !!json.explain;
|
|
793
347
|
}
|
|
794
|
-
|
|
795
348
|
for (var _key4 in json) {
|
|
796
349
|
if (json.hasOwnProperty(_key4)) {
|
|
797
350
|
if (['where', 'include', 'keys', 'count', 'limit', 'skip', 'order', 'readPreference', 'includeReadPreference', 'subqueryReadPreference', 'hint', 'explain'].indexOf(_key4) === -1) {
|
|
@@ -799,7 +352,6 @@ var ParseQuery = function () {
|
|
|
799
352
|
}
|
|
800
353
|
}
|
|
801
354
|
}
|
|
802
|
-
|
|
803
355
|
return this;
|
|
804
356
|
}
|
|
805
357
|
}, {
|
|
@@ -807,28 +359,22 @@ var ParseQuery = function () {
|
|
|
807
359
|
value: function (objectId, options) {
|
|
808
360
|
this.equalTo('objectId', objectId);
|
|
809
361
|
var firstOptions = {};
|
|
810
|
-
|
|
811
362
|
if (options && options.hasOwnProperty('useMasterKey')) {
|
|
812
363
|
firstOptions.useMasterKey = options.useMasterKey;
|
|
813
364
|
}
|
|
814
|
-
|
|
815
365
|
if (options && options.hasOwnProperty('sessionToken')) {
|
|
816
366
|
firstOptions.sessionToken = options.sessionToken;
|
|
817
367
|
}
|
|
818
|
-
|
|
819
368
|
if (options && options.hasOwnProperty('context') && typeof options.context === 'object') {
|
|
820
369
|
firstOptions.context = options.context;
|
|
821
370
|
}
|
|
822
|
-
|
|
823
371
|
if (options && options.hasOwnProperty('json')) {
|
|
824
372
|
firstOptions.json = options.json;
|
|
825
373
|
}
|
|
826
|
-
|
|
827
374
|
return this.first(firstOptions).then(function (response) {
|
|
828
375
|
if (response) {
|
|
829
376
|
return response;
|
|
830
377
|
}
|
|
831
|
-
|
|
832
378
|
var errorObject = new _ParseError.default(_ParseError.default.OBJECT_NOT_FOUND, 'Object not found.');
|
|
833
379
|
return Promise.reject(errorObject);
|
|
834
380
|
});
|
|
@@ -837,48 +383,35 @@ var ParseQuery = function () {
|
|
|
837
383
|
key: "find",
|
|
838
384
|
value: function (options) {
|
|
839
385
|
var _this3 = this;
|
|
840
|
-
|
|
841
386
|
options = options || {};
|
|
842
387
|
var findOptions = {};
|
|
843
|
-
|
|
844
388
|
if (options.hasOwnProperty('useMasterKey')) {
|
|
845
389
|
findOptions.useMasterKey = options.useMasterKey;
|
|
846
390
|
}
|
|
847
|
-
|
|
848
391
|
if (options.hasOwnProperty('sessionToken')) {
|
|
849
392
|
findOptions.sessionToken = options.sessionToken;
|
|
850
393
|
}
|
|
851
|
-
|
|
852
394
|
if (options.hasOwnProperty('context') && typeof options.context === 'object') {
|
|
853
395
|
findOptions.context = options.context;
|
|
854
396
|
}
|
|
855
|
-
|
|
856
397
|
this._setRequestTask(findOptions);
|
|
857
|
-
|
|
858
398
|
var controller = _CoreManager.default.getQueryController();
|
|
859
|
-
|
|
860
399
|
var select = this._select;
|
|
861
|
-
|
|
862
400
|
if (this._queriesLocalDatastore) {
|
|
863
401
|
return this._handleOfflineQuery(this.toJSON());
|
|
864
402
|
}
|
|
865
|
-
|
|
866
403
|
return controller.find(this.className, this.toJSON(), findOptions).then(function (response) {
|
|
867
404
|
if (_this3._explain) {
|
|
868
405
|
return response.results;
|
|
869
406
|
}
|
|
870
|
-
|
|
871
407
|
var results = response.results.map(function (data) {
|
|
872
408
|
var override = response.className || _this3.className;
|
|
873
|
-
|
|
874
409
|
if (!data.className) {
|
|
875
410
|
data.className = override;
|
|
876
411
|
}
|
|
877
|
-
|
|
878
412
|
if (select) {
|
|
879
413
|
handleSelectResult(data, select);
|
|
880
414
|
}
|
|
881
|
-
|
|
882
415
|
if (options.json) {
|
|
883
416
|
return data;
|
|
884
417
|
} else {
|
|
@@ -886,7 +419,6 @@ var ParseQuery = function () {
|
|
|
886
419
|
}
|
|
887
420
|
});
|
|
888
421
|
var count = response.count;
|
|
889
|
-
|
|
890
422
|
if (typeof count === 'number') {
|
|
891
423
|
return {
|
|
892
424
|
results: results,
|
|
@@ -899,46 +431,32 @@ var ParseQuery = function () {
|
|
|
899
431
|
}
|
|
900
432
|
}, {
|
|
901
433
|
key: "findAll",
|
|
902
|
-
value: function (
|
|
903
|
-
var
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
return _context2.abrupt("return", result);
|
|
916
|
-
|
|
917
|
-
case 4:
|
|
918
|
-
case "end":
|
|
919
|
-
return _context2.stop();
|
|
920
|
-
}
|
|
921
|
-
}
|
|
922
|
-
}, null, this, null, Promise);
|
|
923
|
-
}
|
|
434
|
+
value: function () {
|
|
435
|
+
var _findAll = (0, _asyncToGenerator2.default)(function* (options) {
|
|
436
|
+
var result = [];
|
|
437
|
+
yield this.eachBatch(function (objects) {
|
|
438
|
+
result = [].concat((0, _toConsumableArray2.default)(result), (0, _toConsumableArray2.default)(objects));
|
|
439
|
+
}, options);
|
|
440
|
+
return result;
|
|
441
|
+
});
|
|
442
|
+
function findAll() {
|
|
443
|
+
return _findAll.apply(this, arguments);
|
|
444
|
+
}
|
|
445
|
+
return findAll;
|
|
446
|
+
}()
|
|
924
447
|
}, {
|
|
925
448
|
key: "count",
|
|
926
449
|
value: function (options) {
|
|
927
450
|
options = options || {};
|
|
928
451
|
var findOptions = {};
|
|
929
|
-
|
|
930
452
|
if (options.hasOwnProperty('useMasterKey')) {
|
|
931
453
|
findOptions.useMasterKey = options.useMasterKey;
|
|
932
454
|
}
|
|
933
|
-
|
|
934
455
|
if (options.hasOwnProperty('sessionToken')) {
|
|
935
456
|
findOptions.sessionToken = options.sessionToken;
|
|
936
457
|
}
|
|
937
|
-
|
|
938
458
|
this._setRequestTask(findOptions);
|
|
939
|
-
|
|
940
459
|
var controller = _CoreManager.default.getQueryController();
|
|
941
|
-
|
|
942
460
|
var params = this.toJSON();
|
|
943
461
|
params.limit = 0;
|
|
944
462
|
params.count = 1;
|
|
@@ -952,15 +470,11 @@ var ParseQuery = function () {
|
|
|
952
470
|
options = options || {};
|
|
953
471
|
var distinctOptions = {};
|
|
954
472
|
distinctOptions.useMasterKey = true;
|
|
955
|
-
|
|
956
473
|
if (options.hasOwnProperty('sessionToken')) {
|
|
957
474
|
distinctOptions.sessionToken = options.sessionToken;
|
|
958
475
|
}
|
|
959
|
-
|
|
960
476
|
this._setRequestTask(distinctOptions);
|
|
961
|
-
|
|
962
477
|
var controller = _CoreManager.default.getQueryController();
|
|
963
|
-
|
|
964
478
|
var params = {
|
|
965
479
|
distinct: key,
|
|
966
480
|
where: this._where,
|
|
@@ -976,29 +490,22 @@ var ParseQuery = function () {
|
|
|
976
490
|
options = options || {};
|
|
977
491
|
var aggregateOptions = {};
|
|
978
492
|
aggregateOptions.useMasterKey = true;
|
|
979
|
-
|
|
980
493
|
if (options.hasOwnProperty('sessionToken')) {
|
|
981
494
|
aggregateOptions.sessionToken = options.sessionToken;
|
|
982
495
|
}
|
|
983
|
-
|
|
984
496
|
this._setRequestTask(aggregateOptions);
|
|
985
|
-
|
|
986
497
|
var controller = _CoreManager.default.getQueryController();
|
|
987
|
-
|
|
988
498
|
if (!Array.isArray(pipeline) && typeof pipeline !== 'object') {
|
|
989
499
|
throw new Error('Invalid pipeline must be Array or Object');
|
|
990
500
|
}
|
|
991
|
-
|
|
992
501
|
if (Object.keys(this._where || {}).length) {
|
|
993
502
|
if (!Array.isArray(pipeline)) {
|
|
994
503
|
pipeline = [pipeline];
|
|
995
504
|
}
|
|
996
|
-
|
|
997
505
|
pipeline.unshift({
|
|
998
|
-
match: this._where
|
|
506
|
+
$match: this._where
|
|
999
507
|
});
|
|
1000
508
|
}
|
|
1001
|
-
|
|
1002
509
|
var params = {
|
|
1003
510
|
pipeline: pipeline,
|
|
1004
511
|
hint: this._hint,
|
|
@@ -1013,55 +520,41 @@ var ParseQuery = function () {
|
|
|
1013
520
|
key: "first",
|
|
1014
521
|
value: function (options) {
|
|
1015
522
|
var _this4 = this;
|
|
1016
|
-
|
|
1017
523
|
options = options || {};
|
|
1018
524
|
var findOptions = {};
|
|
1019
|
-
|
|
1020
525
|
if (options.hasOwnProperty('useMasterKey')) {
|
|
1021
526
|
findOptions.useMasterKey = options.useMasterKey;
|
|
1022
527
|
}
|
|
1023
|
-
|
|
1024
528
|
if (options.hasOwnProperty('sessionToken')) {
|
|
1025
529
|
findOptions.sessionToken = options.sessionToken;
|
|
1026
530
|
}
|
|
1027
|
-
|
|
1028
531
|
if (options.hasOwnProperty('context') && typeof options.context === 'object') {
|
|
1029
532
|
findOptions.context = options.context;
|
|
1030
533
|
}
|
|
1031
|
-
|
|
1032
534
|
this._setRequestTask(findOptions);
|
|
1033
|
-
|
|
1034
535
|
var controller = _CoreManager.default.getQueryController();
|
|
1035
|
-
|
|
1036
536
|
var params = this.toJSON();
|
|
1037
537
|
params.limit = 1;
|
|
1038
538
|
var select = this._select;
|
|
1039
|
-
|
|
1040
539
|
if (this._queriesLocalDatastore) {
|
|
1041
540
|
return this._handleOfflineQuery(params).then(function (objects) {
|
|
1042
541
|
if (!objects[0]) {
|
|
1043
542
|
return undefined;
|
|
1044
543
|
}
|
|
1045
|
-
|
|
1046
544
|
return objects[0];
|
|
1047
545
|
});
|
|
1048
546
|
}
|
|
1049
|
-
|
|
1050
547
|
return controller.find(this.className, params, findOptions).then(function (response) {
|
|
1051
548
|
var objects = response.results;
|
|
1052
|
-
|
|
1053
549
|
if (!objects[0]) {
|
|
1054
550
|
return undefined;
|
|
1055
551
|
}
|
|
1056
|
-
|
|
1057
552
|
if (!objects[0].className) {
|
|
1058
553
|
objects[0].className = _this4.className;
|
|
1059
554
|
}
|
|
1060
|
-
|
|
1061
555
|
if (select) {
|
|
1062
556
|
handleSelectResult(objects[0], select);
|
|
1063
557
|
}
|
|
1064
|
-
|
|
1065
558
|
if (options.json) {
|
|
1066
559
|
return objects[0];
|
|
1067
560
|
} else {
|
|
@@ -1073,29 +566,23 @@ var ParseQuery = function () {
|
|
|
1073
566
|
key: "eachBatch",
|
|
1074
567
|
value: function (callback, options) {
|
|
1075
568
|
options = options || {};
|
|
1076
|
-
|
|
1077
569
|
if (this._order || this._skip || this._limit >= 0) {
|
|
1078
570
|
return Promise.reject('Cannot iterate on a query with sort, skip, or limit.');
|
|
1079
571
|
}
|
|
1080
|
-
|
|
1081
572
|
var query = new ParseQuery(this.className);
|
|
1082
573
|
query._limit = options.batchSize || 100;
|
|
1083
574
|
query._include = this._include.map(function (i) {
|
|
1084
575
|
return i;
|
|
1085
576
|
});
|
|
1086
|
-
|
|
1087
577
|
if (this._select) {
|
|
1088
578
|
query._select = this._select.map(function (s) {
|
|
1089
579
|
return s;
|
|
1090
580
|
});
|
|
1091
581
|
}
|
|
1092
|
-
|
|
1093
582
|
query._hint = this._hint;
|
|
1094
583
|
query._where = {};
|
|
1095
|
-
|
|
1096
584
|
for (var _attr in this._where) {
|
|
1097
585
|
var val = this._where[_attr];
|
|
1098
|
-
|
|
1099
586
|
if (Array.isArray(val)) {
|
|
1100
587
|
query._where[_attr] = val.map(function (v) {
|
|
1101
588
|
return v;
|
|
@@ -1103,7 +590,6 @@ var ParseQuery = function () {
|
|
|
1103
590
|
} else if (val && typeof val === 'object') {
|
|
1104
591
|
var conditionMap = {};
|
|
1105
592
|
query._where[_attr] = conditionMap;
|
|
1106
|
-
|
|
1107
593
|
for (var cond in val) {
|
|
1108
594
|
conditionMap[cond] = val[cond];
|
|
1109
595
|
}
|
|
@@ -1111,79 +597,38 @@ var ParseQuery = function () {
|
|
|
1111
597
|
query._where[_attr] = val;
|
|
1112
598
|
}
|
|
1113
599
|
}
|
|
1114
|
-
|
|
1115
600
|
query.ascending('objectId');
|
|
1116
601
|
var findOptions = {};
|
|
1117
|
-
|
|
1118
602
|
if (options.hasOwnProperty('useMasterKey')) {
|
|
1119
603
|
findOptions.useMasterKey = options.useMasterKey;
|
|
1120
604
|
}
|
|
1121
|
-
|
|
1122
605
|
if (options.hasOwnProperty('sessionToken')) {
|
|
1123
606
|
findOptions.sessionToken = options.sessionToken;
|
|
1124
607
|
}
|
|
1125
|
-
|
|
1126
608
|
if (options.hasOwnProperty('context') && typeof options.context === 'object') {
|
|
1127
609
|
findOptions.context = options.context;
|
|
1128
610
|
}
|
|
1129
|
-
|
|
1130
611
|
if (options.hasOwnProperty('json')) {
|
|
1131
612
|
findOptions.json = options.json;
|
|
1132
613
|
}
|
|
1133
|
-
|
|
1134
614
|
var finished = false;
|
|
1135
615
|
var previousResults = [];
|
|
1136
616
|
return (0, _promiseUtils.continueWhile)(function () {
|
|
1137
617
|
return !finished;
|
|
1138
|
-
}, function () {
|
|
1139
|
-
var
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
if (!(results.length >= query._limit)) {
|
|
1154
|
-
_context3.next = 10;
|
|
1155
|
-
break;
|
|
1156
|
-
}
|
|
1157
|
-
|
|
1158
|
-
query.greaterThan('objectId', results[results.length - 1].id);
|
|
1159
|
-
previousResults = results;
|
|
1160
|
-
_context3.next = 17;
|
|
1161
|
-
break;
|
|
1162
|
-
|
|
1163
|
-
case 10:
|
|
1164
|
-
if (!(results.length > 0)) {
|
|
1165
|
-
_context3.next = 16;
|
|
1166
|
-
break;
|
|
1167
|
-
}
|
|
1168
|
-
|
|
1169
|
-
_context3.next = 13;
|
|
1170
|
-
return _regeneratorRuntime().awrap(Promise.resolve(callback(results)));
|
|
1171
|
-
|
|
1172
|
-
case 13:
|
|
1173
|
-
finished = true;
|
|
1174
|
-
_context3.next = 17;
|
|
1175
|
-
break;
|
|
1176
|
-
|
|
1177
|
-
case 16:
|
|
1178
|
-
finished = true;
|
|
1179
|
-
|
|
1180
|
-
case 17:
|
|
1181
|
-
case "end":
|
|
1182
|
-
return _context3.stop();
|
|
1183
|
-
}
|
|
1184
|
-
}
|
|
1185
|
-
}, null, null, null, Promise);
|
|
1186
|
-
});
|
|
618
|
+
}, (0, _asyncToGenerator2.default)(function* () {
|
|
619
|
+
var _yield$Promise$all = yield Promise.all([query.find(findOptions), Promise.resolve(previousResults.length > 0 && callback(previousResults))]),
|
|
620
|
+
_yield$Promise$all2 = (0, _slicedToArray2.default)(_yield$Promise$all, 1),
|
|
621
|
+
results = _yield$Promise$all2[0];
|
|
622
|
+
if (results.length >= query._limit) {
|
|
623
|
+
query.greaterThan('objectId', results[results.length - 1].id);
|
|
624
|
+
previousResults = results;
|
|
625
|
+
} else if (results.length > 0) {
|
|
626
|
+
yield Promise.resolve(callback(results));
|
|
627
|
+
finished = true;
|
|
628
|
+
} else {
|
|
629
|
+
finished = true;
|
|
630
|
+
}
|
|
631
|
+
}));
|
|
1187
632
|
}
|
|
1188
633
|
}, {
|
|
1189
634
|
key: "each",
|
|
@@ -1204,7 +649,6 @@ var ParseQuery = function () {
|
|
|
1204
649
|
if (typeof value === 'undefined') {
|
|
1205
650
|
delete this._hint;
|
|
1206
651
|
}
|
|
1207
|
-
|
|
1208
652
|
this._hint = value;
|
|
1209
653
|
return this;
|
|
1210
654
|
}
|
|
@@ -1212,139 +656,97 @@ var ParseQuery = function () {
|
|
|
1212
656
|
key: "explain",
|
|
1213
657
|
value: function () {
|
|
1214
658
|
var _explain = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
1215
|
-
|
|
1216
659
|
if (typeof _explain !== 'boolean') {
|
|
1217
660
|
throw new Error('You can only set explain to a boolean value');
|
|
1218
661
|
}
|
|
1219
|
-
|
|
1220
662
|
this._explain = _explain;
|
|
1221
663
|
return this;
|
|
1222
664
|
}
|
|
1223
665
|
}, {
|
|
1224
666
|
key: "map",
|
|
1225
|
-
value: function (
|
|
1226
|
-
var
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
case 4:
|
|
1244
|
-
return _context4.abrupt("return", array);
|
|
1245
|
-
|
|
1246
|
-
case 5:
|
|
1247
|
-
case "end":
|
|
1248
|
-
return _context4.stop();
|
|
1249
|
-
}
|
|
1250
|
-
}
|
|
1251
|
-
}, null, this, null, Promise);
|
|
1252
|
-
}
|
|
667
|
+
value: function () {
|
|
668
|
+
var _map = (0, _asyncToGenerator2.default)(function* (callback, options) {
|
|
669
|
+
var _this5 = this;
|
|
670
|
+
var array = [];
|
|
671
|
+
var index = 0;
|
|
672
|
+
yield this.each(function (object) {
|
|
673
|
+
return Promise.resolve(callback(object, index, _this5)).then(function (result) {
|
|
674
|
+
array.push(result);
|
|
675
|
+
index += 1;
|
|
676
|
+
});
|
|
677
|
+
}, options);
|
|
678
|
+
return array;
|
|
679
|
+
});
|
|
680
|
+
function map() {
|
|
681
|
+
return _map.apply(this, arguments);
|
|
682
|
+
}
|
|
683
|
+
return map;
|
|
684
|
+
}()
|
|
1253
685
|
}, {
|
|
1254
686
|
key: "reduce",
|
|
1255
|
-
value: function (
|
|
1256
|
-
var
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
return _regeneratorRuntime().awrap(this.each(function (object) {
|
|
1265
|
-
if (index === 0 && initialValue === undefined) {
|
|
1266
|
-
accumulator = object;
|
|
1267
|
-
index += 1;
|
|
1268
|
-
return;
|
|
1269
|
-
}
|
|
1270
|
-
|
|
1271
|
-
return Promise.resolve(callback(accumulator, object, index)).then(function (result) {
|
|
1272
|
-
accumulator = result;
|
|
1273
|
-
index += 1;
|
|
1274
|
-
});
|
|
1275
|
-
}, options));
|
|
1276
|
-
|
|
1277
|
-
case 4:
|
|
1278
|
-
if (!(index === 0 && initialValue === undefined)) {
|
|
1279
|
-
_context5.next = 6;
|
|
1280
|
-
break;
|
|
1281
|
-
}
|
|
1282
|
-
|
|
1283
|
-
throw new TypeError('Reducing empty query result set with no initial value');
|
|
1284
|
-
|
|
1285
|
-
case 6:
|
|
1286
|
-
return _context5.abrupt("return", accumulator);
|
|
1287
|
-
|
|
1288
|
-
case 7:
|
|
1289
|
-
case "end":
|
|
1290
|
-
return _context5.stop();
|
|
687
|
+
value: function () {
|
|
688
|
+
var _reduce = (0, _asyncToGenerator2.default)(function* (callback, initialValue, options) {
|
|
689
|
+
var accumulator = initialValue;
|
|
690
|
+
var index = 0;
|
|
691
|
+
yield this.each(function (object) {
|
|
692
|
+
if (index === 0 && initialValue === undefined) {
|
|
693
|
+
accumulator = object;
|
|
694
|
+
index += 1;
|
|
695
|
+
return;
|
|
1291
696
|
}
|
|
697
|
+
return Promise.resolve(callback(accumulator, object, index)).then(function (result) {
|
|
698
|
+
accumulator = result;
|
|
699
|
+
index += 1;
|
|
700
|
+
});
|
|
701
|
+
}, options);
|
|
702
|
+
if (index === 0 && initialValue === undefined) {
|
|
703
|
+
throw new TypeError('Reducing empty query result set with no initial value');
|
|
1292
704
|
}
|
|
1293
|
-
|
|
1294
|
-
|
|
705
|
+
return accumulator;
|
|
706
|
+
});
|
|
707
|
+
function reduce() {
|
|
708
|
+
return _reduce.apply(this, arguments);
|
|
709
|
+
}
|
|
710
|
+
return reduce;
|
|
711
|
+
}()
|
|
1295
712
|
}, {
|
|
1296
713
|
key: "filter",
|
|
1297
|
-
value: function (
|
|
1298
|
-
var
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
array
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
case 4:
|
|
1319
|
-
return _context6.abrupt("return", array);
|
|
1320
|
-
|
|
1321
|
-
case 5:
|
|
1322
|
-
case "end":
|
|
1323
|
-
return _context6.stop();
|
|
1324
|
-
}
|
|
1325
|
-
}
|
|
1326
|
-
}, null, this, null, Promise);
|
|
1327
|
-
}
|
|
714
|
+
value: function () {
|
|
715
|
+
var _filter = (0, _asyncToGenerator2.default)(function* (callback, options) {
|
|
716
|
+
var _this6 = this;
|
|
717
|
+
var array = [];
|
|
718
|
+
var index = 0;
|
|
719
|
+
yield this.each(function (object) {
|
|
720
|
+
return Promise.resolve(callback(object, index, _this6)).then(function (flag) {
|
|
721
|
+
if (flag) {
|
|
722
|
+
array.push(object);
|
|
723
|
+
}
|
|
724
|
+
index += 1;
|
|
725
|
+
});
|
|
726
|
+
}, options);
|
|
727
|
+
return array;
|
|
728
|
+
});
|
|
729
|
+
function filter() {
|
|
730
|
+
return _filter.apply(this, arguments);
|
|
731
|
+
}
|
|
732
|
+
return filter;
|
|
733
|
+
}()
|
|
1328
734
|
}, {
|
|
1329
735
|
key: "equalTo",
|
|
1330
736
|
value: function (key, value) {
|
|
1331
737
|
var _this7 = this;
|
|
1332
|
-
|
|
1333
738
|
if (key && typeof key === 'object') {
|
|
1334
|
-
Object.entries(key).forEach(function (
|
|
1335
|
-
var
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
739
|
+
Object.entries(key).forEach(function (_ref2) {
|
|
740
|
+
var _ref3 = (0, _slicedToArray2.default)(_ref2, 2),
|
|
741
|
+
k = _ref3[0],
|
|
742
|
+
val = _ref3[1];
|
|
1339
743
|
return _this7.equalTo(k, val);
|
|
1340
744
|
});
|
|
1341
745
|
return this;
|
|
1342
746
|
}
|
|
1343
|
-
|
|
1344
747
|
if (typeof value === 'undefined') {
|
|
1345
748
|
return this.doesNotExist(key);
|
|
1346
749
|
}
|
|
1347
|
-
|
|
1348
750
|
this._where[key] = (0, _encode.default)(value, false, true);
|
|
1349
751
|
return this;
|
|
1350
752
|
}
|
|
@@ -1352,18 +754,15 @@ var ParseQuery = function () {
|
|
|
1352
754
|
key: "notEqualTo",
|
|
1353
755
|
value: function (key, value) {
|
|
1354
756
|
var _this8 = this;
|
|
1355
|
-
|
|
1356
757
|
if (key && typeof key === 'object') {
|
|
1357
|
-
Object.entries(key).forEach(function (
|
|
1358
|
-
var
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
758
|
+
Object.entries(key).forEach(function (_ref4) {
|
|
759
|
+
var _ref5 = (0, _slicedToArray2.default)(_ref4, 2),
|
|
760
|
+
k = _ref5[0],
|
|
761
|
+
val = _ref5[1];
|
|
1362
762
|
return _this8.notEqualTo(k, val);
|
|
1363
763
|
});
|
|
1364
764
|
return this;
|
|
1365
765
|
}
|
|
1366
|
-
|
|
1367
766
|
return this._addCondition(key, '$ne', value);
|
|
1368
767
|
}
|
|
1369
768
|
}, {
|
|
@@ -1410,11 +809,9 @@ var ParseQuery = function () {
|
|
|
1410
809
|
key: "containsAllStartingWith",
|
|
1411
810
|
value: function (key, values) {
|
|
1412
811
|
var _this = this;
|
|
1413
|
-
|
|
1414
812
|
if (!Array.isArray(values)) {
|
|
1415
813
|
values = [values];
|
|
1416
814
|
}
|
|
1417
|
-
|
|
1418
815
|
var regexObject = values.map(function (value) {
|
|
1419
816
|
return {
|
|
1420
817
|
$regex: _this._regexStartWith(value)
|
|
@@ -1436,23 +833,18 @@ var ParseQuery = function () {
|
|
|
1436
833
|
key: "matches",
|
|
1437
834
|
value: function (key, regex, modifiers) {
|
|
1438
835
|
this._addCondition(key, '$regex', regex);
|
|
1439
|
-
|
|
1440
836
|
if (!modifiers) {
|
|
1441
837
|
modifiers = '';
|
|
1442
838
|
}
|
|
1443
|
-
|
|
1444
839
|
if (regex.ignoreCase) {
|
|
1445
840
|
modifiers += 'i';
|
|
1446
841
|
}
|
|
1447
|
-
|
|
1448
842
|
if (regex.multiline) {
|
|
1449
843
|
modifiers += 'm';
|
|
1450
844
|
}
|
|
1451
|
-
|
|
1452
845
|
if (modifiers.length) {
|
|
1453
846
|
this._addCondition(key, '$options', modifiers);
|
|
1454
847
|
}
|
|
1455
|
-
|
|
1456
848
|
return this;
|
|
1457
849
|
}
|
|
1458
850
|
}, {
|
|
@@ -1495,48 +887,38 @@ var ParseQuery = function () {
|
|
|
1495
887
|
if (typeof substring !== 'string') {
|
|
1496
888
|
throw new Error('The value being searched for must be a string.');
|
|
1497
889
|
}
|
|
1498
|
-
|
|
1499
890
|
return this._addCondition(key, '$regex', quote(substring));
|
|
1500
891
|
}
|
|
1501
892
|
}, {
|
|
1502
893
|
key: "fullText",
|
|
1503
894
|
value: function (key, value, options) {
|
|
1504
895
|
options = options || {};
|
|
1505
|
-
|
|
1506
896
|
if (!key) {
|
|
1507
897
|
throw new Error('A key is required.');
|
|
1508
898
|
}
|
|
1509
|
-
|
|
1510
899
|
if (!value) {
|
|
1511
900
|
throw new Error('A search term is required');
|
|
1512
901
|
}
|
|
1513
|
-
|
|
1514
902
|
if (typeof value !== 'string') {
|
|
1515
903
|
throw new Error('The value being searched for must be a string.');
|
|
1516
904
|
}
|
|
1517
|
-
|
|
1518
905
|
var fullOptions = {};
|
|
1519
906
|
fullOptions.$term = value;
|
|
1520
|
-
|
|
1521
907
|
for (var option in options) {
|
|
1522
908
|
switch (option) {
|
|
1523
909
|
case 'language':
|
|
1524
910
|
fullOptions.$language = options[option];
|
|
1525
911
|
break;
|
|
1526
|
-
|
|
1527
912
|
case 'caseSensitive':
|
|
1528
913
|
fullOptions.$caseSensitive = options[option];
|
|
1529
914
|
break;
|
|
1530
|
-
|
|
1531
915
|
case 'diacriticSensitive':
|
|
1532
916
|
fullOptions.$diacriticSensitive = options[option];
|
|
1533
917
|
break;
|
|
1534
|
-
|
|
1535
918
|
default:
|
|
1536
|
-
throw new Error(
|
|
919
|
+
throw new Error(`Unknown option: ${option}`);
|
|
1537
920
|
}
|
|
1538
921
|
}
|
|
1539
|
-
|
|
1540
922
|
return this._addCondition(key, '$text', {
|
|
1541
923
|
$search: fullOptions
|
|
1542
924
|
});
|
|
@@ -1554,7 +936,6 @@ var ParseQuery = function () {
|
|
|
1554
936
|
if (typeof prefix !== 'string') {
|
|
1555
937
|
throw new Error('The value being searched for must be a string.');
|
|
1556
938
|
}
|
|
1557
|
-
|
|
1558
939
|
return this.matches(key, this._regexStartWith(prefix), modifiers);
|
|
1559
940
|
}
|
|
1560
941
|
}, {
|
|
@@ -1563,7 +944,6 @@ var ParseQuery = function () {
|
|
|
1563
944
|
if (typeof suffix !== 'string') {
|
|
1564
945
|
throw new Error('The value being searched for must be a string.');
|
|
1565
946
|
}
|
|
1566
|
-
|
|
1567
947
|
return this.matches(key, quote(suffix) + '$', modifiers);
|
|
1568
948
|
}
|
|
1569
949
|
}, {
|
|
@@ -1572,7 +952,6 @@ var ParseQuery = function () {
|
|
|
1572
952
|
if (!(point instanceof _ParseGeoPoint.default)) {
|
|
1573
953
|
point = new _ParseGeoPoint.default(point);
|
|
1574
954
|
}
|
|
1575
|
-
|
|
1576
955
|
return this._addCondition(key, '$nearSphere', point);
|
|
1577
956
|
}
|
|
1578
957
|
}, {
|
|
@@ -1603,15 +982,12 @@ var ParseQuery = function () {
|
|
|
1603
982
|
if (!(southwest instanceof _ParseGeoPoint.default)) {
|
|
1604
983
|
southwest = new _ParseGeoPoint.default(southwest);
|
|
1605
984
|
}
|
|
1606
|
-
|
|
1607
985
|
if (!(northeast instanceof _ParseGeoPoint.default)) {
|
|
1608
986
|
northeast = new _ParseGeoPoint.default(northeast);
|
|
1609
987
|
}
|
|
1610
|
-
|
|
1611
988
|
this._addCondition(key, '$within', {
|
|
1612
989
|
$box: [southwest, northeast]
|
|
1613
990
|
});
|
|
1614
|
-
|
|
1615
991
|
return this;
|
|
1616
992
|
}
|
|
1617
993
|
}, {
|
|
@@ -1632,31 +1008,25 @@ var ParseQuery = function () {
|
|
|
1632
1008
|
key: "ascending",
|
|
1633
1009
|
value: function () {
|
|
1634
1010
|
this._order = [];
|
|
1635
|
-
|
|
1636
1011
|
for (var _len = arguments.length, keys = new Array(_len), _key5 = 0; _key5 < _len; _key5++) {
|
|
1637
1012
|
keys[_key5] = arguments[_key5];
|
|
1638
1013
|
}
|
|
1639
|
-
|
|
1640
1014
|
return this.addAscending.apply(this, keys);
|
|
1641
1015
|
}
|
|
1642
1016
|
}, {
|
|
1643
1017
|
key: "addAscending",
|
|
1644
1018
|
value: function () {
|
|
1645
1019
|
var _this9 = this;
|
|
1646
|
-
|
|
1647
1020
|
if (!this._order) {
|
|
1648
1021
|
this._order = [];
|
|
1649
1022
|
}
|
|
1650
|
-
|
|
1651
1023
|
for (var _len2 = arguments.length, keys = new Array(_len2), _key6 = 0; _key6 < _len2; _key6++) {
|
|
1652
1024
|
keys[_key6] = arguments[_key6];
|
|
1653
1025
|
}
|
|
1654
|
-
|
|
1655
1026
|
keys.forEach(function (key) {
|
|
1656
1027
|
if (Array.isArray(key)) {
|
|
1657
1028
|
key = key.join();
|
|
1658
1029
|
}
|
|
1659
|
-
|
|
1660
1030
|
_this9._order = _this9._order.concat(key.replace(/\s/g, '').split(','));
|
|
1661
1031
|
});
|
|
1662
1032
|
return this;
|
|
@@ -1665,31 +1035,25 @@ var ParseQuery = function () {
|
|
|
1665
1035
|
key: "descending",
|
|
1666
1036
|
value: function () {
|
|
1667
1037
|
this._order = [];
|
|
1668
|
-
|
|
1669
1038
|
for (var _len3 = arguments.length, keys = new Array(_len3), _key7 = 0; _key7 < _len3; _key7++) {
|
|
1670
1039
|
keys[_key7] = arguments[_key7];
|
|
1671
1040
|
}
|
|
1672
|
-
|
|
1673
1041
|
return this.addDescending.apply(this, keys);
|
|
1674
1042
|
}
|
|
1675
1043
|
}, {
|
|
1676
1044
|
key: "addDescending",
|
|
1677
1045
|
value: function () {
|
|
1678
1046
|
var _this10 = this;
|
|
1679
|
-
|
|
1680
1047
|
if (!this._order) {
|
|
1681
1048
|
this._order = [];
|
|
1682
1049
|
}
|
|
1683
|
-
|
|
1684
1050
|
for (var _len4 = arguments.length, keys = new Array(_len4), _key8 = 0; _key8 < _len4; _key8++) {
|
|
1685
1051
|
keys[_key8] = arguments[_key8];
|
|
1686
1052
|
}
|
|
1687
|
-
|
|
1688
1053
|
keys.forEach(function (key) {
|
|
1689
1054
|
if (Array.isArray(key)) {
|
|
1690
1055
|
key = key.join();
|
|
1691
1056
|
}
|
|
1692
|
-
|
|
1693
1057
|
_this10._order = _this10._order.concat(key.replace(/\s/g, '').split(',').map(function (k) {
|
|
1694
1058
|
return '-' + k;
|
|
1695
1059
|
}));
|
|
@@ -1702,7 +1066,6 @@ var ParseQuery = function () {
|
|
|
1702
1066
|
if (typeof n !== 'number' || n < 0) {
|
|
1703
1067
|
throw new Error('You can only skip by a positive number');
|
|
1704
1068
|
}
|
|
1705
|
-
|
|
1706
1069
|
this._skip = n;
|
|
1707
1070
|
return this;
|
|
1708
1071
|
}
|
|
@@ -1712,7 +1075,6 @@ var ParseQuery = function () {
|
|
|
1712
1075
|
if (typeof n !== 'number') {
|
|
1713
1076
|
throw new Error('You can only set the limit to a numeric value');
|
|
1714
1077
|
}
|
|
1715
|
-
|
|
1716
1078
|
this._limit = n;
|
|
1717
1079
|
return this;
|
|
1718
1080
|
}
|
|
@@ -1720,11 +1082,9 @@ var ParseQuery = function () {
|
|
|
1720
1082
|
key: "withCount",
|
|
1721
1083
|
value: function () {
|
|
1722
1084
|
var includeCount = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
1723
|
-
|
|
1724
1085
|
if (typeof includeCount !== 'boolean') {
|
|
1725
1086
|
throw new Error('You can only set withCount to a boolean value');
|
|
1726
1087
|
}
|
|
1727
|
-
|
|
1728
1088
|
this._count = includeCount;
|
|
1729
1089
|
return this;
|
|
1730
1090
|
}
|
|
@@ -1732,11 +1092,9 @@ var ParseQuery = function () {
|
|
|
1732
1092
|
key: "include",
|
|
1733
1093
|
value: function () {
|
|
1734
1094
|
var _this11 = this;
|
|
1735
|
-
|
|
1736
1095
|
for (var _len5 = arguments.length, keys = new Array(_len5), _key9 = 0; _key9 < _len5; _key9++) {
|
|
1737
1096
|
keys[_key9] = arguments[_key9];
|
|
1738
1097
|
}
|
|
1739
|
-
|
|
1740
1098
|
keys.forEach(function (key) {
|
|
1741
1099
|
if (Array.isArray(key)) {
|
|
1742
1100
|
_this11._include = _this11._include.concat(key);
|
|
@@ -1755,15 +1113,12 @@ var ParseQuery = function () {
|
|
|
1755
1113
|
key: "select",
|
|
1756
1114
|
value: function () {
|
|
1757
1115
|
var _this12 = this;
|
|
1758
|
-
|
|
1759
1116
|
if (!this._select) {
|
|
1760
1117
|
this._select = [];
|
|
1761
1118
|
}
|
|
1762
|
-
|
|
1763
1119
|
for (var _len6 = arguments.length, keys = new Array(_len6), _key10 = 0; _key10 < _len6; _key10++) {
|
|
1764
1120
|
keys[_key10] = arguments[_key10];
|
|
1765
1121
|
}
|
|
1766
|
-
|
|
1767
1122
|
keys.forEach(function (key) {
|
|
1768
1123
|
if (Array.isArray(key)) {
|
|
1769
1124
|
_this12._select = _this12._select.concat(key);
|
|
@@ -1777,11 +1132,9 @@ var ParseQuery = function () {
|
|
|
1777
1132
|
key: "exclude",
|
|
1778
1133
|
value: function () {
|
|
1779
1134
|
var _this13 = this;
|
|
1780
|
-
|
|
1781
1135
|
for (var _len7 = arguments.length, keys = new Array(_len7), _key11 = 0; _key11 < _len7; _key11++) {
|
|
1782
1136
|
keys[_key11] = arguments[_key11];
|
|
1783
1137
|
}
|
|
1784
|
-
|
|
1785
1138
|
keys.forEach(function (key) {
|
|
1786
1139
|
if (Array.isArray(key)) {
|
|
1787
1140
|
_this13._exclude = _this13._exclude.concat(key);
|
|
@@ -1801,44 +1154,26 @@ var ParseQuery = function () {
|
|
|
1801
1154
|
}
|
|
1802
1155
|
}, {
|
|
1803
1156
|
key: "subscribe",
|
|
1804
|
-
value: function (
|
|
1805
|
-
var
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
case 0:
|
|
1810
|
-
_context7.next = 2;
|
|
1811
|
-
return _regeneratorRuntime().awrap(_CoreManager.default.getUserController().currentUserAsync());
|
|
1812
|
-
|
|
1813
|
-
case 2:
|
|
1814
|
-
currentUser = _context7.sent;
|
|
1815
|
-
|
|
1816
|
-
if (!sessionToken) {
|
|
1817
|
-
sessionToken = currentUser ? currentUser.getSessionToken() : undefined;
|
|
1818
|
-
}
|
|
1819
|
-
|
|
1820
|
-
_context7.next = 6;
|
|
1821
|
-
return _regeneratorRuntime().awrap(_CoreManager.default.getLiveQueryController().getDefaultLiveQueryClient());
|
|
1822
|
-
|
|
1823
|
-
case 6:
|
|
1824
|
-
liveQueryClient = _context7.sent;
|
|
1825
|
-
|
|
1826
|
-
if (liveQueryClient.shouldOpen()) {
|
|
1827
|
-
liveQueryClient.open();
|
|
1828
|
-
}
|
|
1829
|
-
|
|
1830
|
-
subscription = liveQueryClient.subscribe(this, sessionToken);
|
|
1831
|
-
return _context7.abrupt("return", subscription.subscribePromise.then(function () {
|
|
1832
|
-
return subscription;
|
|
1833
|
-
}));
|
|
1834
|
-
|
|
1835
|
-
case 10:
|
|
1836
|
-
case "end":
|
|
1837
|
-
return _context7.stop();
|
|
1838
|
-
}
|
|
1157
|
+
value: function () {
|
|
1158
|
+
var _subscribe = (0, _asyncToGenerator2.default)(function* (sessionToken) {
|
|
1159
|
+
var currentUser = yield _CoreManager.default.getUserController().currentUserAsync();
|
|
1160
|
+
if (!sessionToken) {
|
|
1161
|
+
sessionToken = currentUser ? currentUser.getSessionToken() : undefined;
|
|
1839
1162
|
}
|
|
1840
|
-
|
|
1841
|
-
|
|
1163
|
+
var liveQueryClient = yield _CoreManager.default.getLiveQueryController().getDefaultLiveQueryClient();
|
|
1164
|
+
if (liveQueryClient.shouldOpen()) {
|
|
1165
|
+
liveQueryClient.open();
|
|
1166
|
+
}
|
|
1167
|
+
var subscription = liveQueryClient.subscribe(this, sessionToken);
|
|
1168
|
+
return subscription.subscribePromise.then(function () {
|
|
1169
|
+
return subscription;
|
|
1170
|
+
});
|
|
1171
|
+
});
|
|
1172
|
+
function subscribe() {
|
|
1173
|
+
return _subscribe.apply(this, arguments);
|
|
1174
|
+
}
|
|
1175
|
+
return subscribe;
|
|
1176
|
+
}()
|
|
1842
1177
|
}, {
|
|
1843
1178
|
key: "fromNetwork",
|
|
1844
1179
|
value: function () {
|
|
@@ -1860,31 +1195,23 @@ var ParseQuery = function () {
|
|
|
1860
1195
|
key: "fromPinWithName",
|
|
1861
1196
|
value: function (name) {
|
|
1862
1197
|
var localDatastore = _CoreManager.default.getLocalDatastore();
|
|
1863
|
-
|
|
1864
1198
|
if (localDatastore.checkIfEnabled()) {
|
|
1865
1199
|
this._queriesLocalDatastore = true;
|
|
1866
1200
|
this._localDatastorePinName = name;
|
|
1867
1201
|
}
|
|
1868
|
-
|
|
1869
1202
|
return this;
|
|
1870
1203
|
}
|
|
1871
1204
|
}, {
|
|
1872
1205
|
key: "cancel",
|
|
1873
1206
|
value: function () {
|
|
1874
1207
|
var _this14 = this;
|
|
1875
|
-
|
|
1876
1208
|
if (this._xhrRequest.task && typeof this._xhrRequest.task.abort === 'function') {
|
|
1877
1209
|
this._xhrRequest.task._aborted = true;
|
|
1878
|
-
|
|
1879
1210
|
this._xhrRequest.task.abort();
|
|
1880
|
-
|
|
1881
1211
|
this._xhrRequest.task = null;
|
|
1882
|
-
|
|
1883
1212
|
this._xhrRequest.onchange = function () {};
|
|
1884
|
-
|
|
1885
1213
|
return this;
|
|
1886
1214
|
}
|
|
1887
|
-
|
|
1888
1215
|
return this._xhrRequest.onchange = function () {
|
|
1889
1216
|
return _this14.cancel();
|
|
1890
1217
|
};
|
|
@@ -1893,10 +1220,8 @@ var ParseQuery = function () {
|
|
|
1893
1220
|
key: "_setRequestTask",
|
|
1894
1221
|
value: function (options) {
|
|
1895
1222
|
var _this15 = this;
|
|
1896
|
-
|
|
1897
1223
|
options.requestTask = function (task) {
|
|
1898
1224
|
_this15._xhrRequest.task = task;
|
|
1899
|
-
|
|
1900
1225
|
_this15._xhrRequest.onchange();
|
|
1901
1226
|
};
|
|
1902
1227
|
}
|
|
@@ -1912,13 +1237,9 @@ var ParseQuery = function () {
|
|
|
1912
1237
|
for (var _len8 = arguments.length, queries = new Array(_len8), _key12 = 0; _key12 < _len8; _key12++) {
|
|
1913
1238
|
queries[_key12] = arguments[_key12];
|
|
1914
1239
|
}
|
|
1915
|
-
|
|
1916
1240
|
var className = _getClassNameFromQueries(queries);
|
|
1917
|
-
|
|
1918
1241
|
var query = new ParseQuery(className);
|
|
1919
|
-
|
|
1920
1242
|
query._orQuery(queries);
|
|
1921
|
-
|
|
1922
1243
|
return query;
|
|
1923
1244
|
}
|
|
1924
1245
|
}, {
|
|
@@ -1927,13 +1248,9 @@ var ParseQuery = function () {
|
|
|
1927
1248
|
for (var _len9 = arguments.length, queries = new Array(_len9), _key13 = 0; _key13 < _len9; _key13++) {
|
|
1928
1249
|
queries[_key13] = arguments[_key13];
|
|
1929
1250
|
}
|
|
1930
|
-
|
|
1931
1251
|
var className = _getClassNameFromQueries(queries);
|
|
1932
|
-
|
|
1933
1252
|
var query = new ParseQuery(className);
|
|
1934
|
-
|
|
1935
1253
|
query._andQuery(queries);
|
|
1936
|
-
|
|
1937
1254
|
return query;
|
|
1938
1255
|
}
|
|
1939
1256
|
}, {
|
|
@@ -1942,33 +1259,24 @@ var ParseQuery = function () {
|
|
|
1942
1259
|
for (var _len10 = arguments.length, queries = new Array(_len10), _key14 = 0; _key14 < _len10; _key14++) {
|
|
1943
1260
|
queries[_key14] = arguments[_key14];
|
|
1944
1261
|
}
|
|
1945
|
-
|
|
1946
1262
|
var className = _getClassNameFromQueries(queries);
|
|
1947
|
-
|
|
1948
1263
|
var query = new ParseQuery(className);
|
|
1949
|
-
|
|
1950
1264
|
query._norQuery(queries);
|
|
1951
|
-
|
|
1952
1265
|
return query;
|
|
1953
1266
|
}
|
|
1954
1267
|
}]);
|
|
1955
1268
|
return ParseQuery;
|
|
1956
1269
|
}();
|
|
1957
|
-
|
|
1958
1270
|
var DefaultController = {
|
|
1959
1271
|
find: function (className, params, options) {
|
|
1960
1272
|
var RESTController = _CoreManager.default.getRESTController();
|
|
1961
|
-
|
|
1962
1273
|
return RESTController.request('GET', 'classes/' + className, params, options);
|
|
1963
1274
|
},
|
|
1964
1275
|
aggregate: function (className, params, options) {
|
|
1965
1276
|
var RESTController = _CoreManager.default.getRESTController();
|
|
1966
|
-
|
|
1967
1277
|
return RESTController.request('GET', 'aggregate/' + className, params, options);
|
|
1968
1278
|
}
|
|
1969
1279
|
};
|
|
1970
|
-
|
|
1971
1280
|
_CoreManager.default.setQueryController(DefaultController);
|
|
1972
|
-
|
|
1973
1281
|
var _default = ParseQuery;
|
|
1974
1282
|
exports.default = _default;
|