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,366 +1,10 @@
|
|
|
1
1
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
2
|
-
|
|
3
2
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
4
|
-
|
|
3
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
5
4
|
var _CoreManager = _interopRequireDefault(require("./CoreManager"));
|
|
6
|
-
|
|
7
5
|
var _ParseObject = _interopRequireDefault(require("./ParseObject"));
|
|
8
|
-
|
|
9
6
|
var _ParseQuery = _interopRequireDefault(require("./ParseQuery"));
|
|
10
|
-
|
|
11
7
|
var _Storage = _interopRequireDefault(require("./Storage"));
|
|
12
|
-
|
|
13
|
-
function _regeneratorRuntime() {
|
|
14
|
-
"use strict";
|
|
15
|
-
|
|
16
|
-
_regeneratorRuntime = function () {
|
|
17
|
-
return exports;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
var exports = {},
|
|
21
|
-
Op = Object.prototype,
|
|
22
|
-
hasOwn = Op.hasOwnProperty,
|
|
23
|
-
$Symbol = "function" == typeof Symbol ? Symbol : {},
|
|
24
|
-
iteratorSymbol = $Symbol.iterator || "@@iterator",
|
|
25
|
-
asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
|
|
26
|
-
toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
27
|
-
|
|
28
|
-
function define(obj, key, value) {
|
|
29
|
-
return Object.defineProperty(obj, key, {
|
|
30
|
-
value: value,
|
|
31
|
-
enumerable: !0,
|
|
32
|
-
configurable: !0,
|
|
33
|
-
writable: !0
|
|
34
|
-
}), obj[key];
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
try {
|
|
38
|
-
define({}, "");
|
|
39
|
-
} catch (err) {
|
|
40
|
-
define = function (obj, key, value) {
|
|
41
|
-
return obj[key] = value;
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
46
|
-
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
|
|
47
|
-
generator = Object.create(protoGenerator.prototype),
|
|
48
|
-
context = new Context(tryLocsList || []);
|
|
49
|
-
return generator._invoke = function (innerFn, self, context) {
|
|
50
|
-
var state = "suspendedStart";
|
|
51
|
-
return function (method, arg) {
|
|
52
|
-
if ("executing" === state) throw new Error("Generator is already running");
|
|
53
|
-
|
|
54
|
-
if ("completed" === state) {
|
|
55
|
-
if ("throw" === method) throw arg;
|
|
56
|
-
return doneResult();
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
for (context.method = method, context.arg = arg;;) {
|
|
60
|
-
var delegate = context.delegate;
|
|
61
|
-
|
|
62
|
-
if (delegate) {
|
|
63
|
-
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
64
|
-
|
|
65
|
-
if (delegateResult) {
|
|
66
|
-
if (delegateResult === ContinueSentinel) continue;
|
|
67
|
-
return delegateResult;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
|
|
72
|
-
if ("suspendedStart" === state) throw state = "completed", context.arg;
|
|
73
|
-
context.dispatchException(context.arg);
|
|
74
|
-
} else "return" === context.method && context.abrupt("return", context.arg);
|
|
75
|
-
state = "executing";
|
|
76
|
-
var record = tryCatch(innerFn, self, context);
|
|
77
|
-
|
|
78
|
-
if ("normal" === record.type) {
|
|
79
|
-
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
|
|
80
|
-
return {
|
|
81
|
-
value: record.arg,
|
|
82
|
-
done: context.done
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
}(innerFn, self, context), generator;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
function tryCatch(fn, obj, arg) {
|
|
93
|
-
try {
|
|
94
|
-
return {
|
|
95
|
-
type: "normal",
|
|
96
|
-
arg: fn.call(obj, arg)
|
|
97
|
-
};
|
|
98
|
-
} catch (err) {
|
|
99
|
-
return {
|
|
100
|
-
type: "throw",
|
|
101
|
-
arg: err
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
exports.wrap = wrap;
|
|
107
|
-
var ContinueSentinel = {};
|
|
108
|
-
|
|
109
|
-
function Generator() {}
|
|
110
|
-
|
|
111
|
-
function GeneratorFunction() {}
|
|
112
|
-
|
|
113
|
-
function GeneratorFunctionPrototype() {}
|
|
114
|
-
|
|
115
|
-
var IteratorPrototype = {};
|
|
116
|
-
define(IteratorPrototype, iteratorSymbol, function () {
|
|
117
|
-
return this;
|
|
118
|
-
});
|
|
119
|
-
var getProto = Object.getPrototypeOf,
|
|
120
|
-
NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
121
|
-
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
|
|
122
|
-
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
|
123
|
-
|
|
124
|
-
function defineIteratorMethods(prototype) {
|
|
125
|
-
["next", "throw", "return"].forEach(function (method) {
|
|
126
|
-
define(prototype, method, function (arg) {
|
|
127
|
-
return this._invoke(method, arg);
|
|
128
|
-
});
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
function AsyncIterator(generator, PromiseImpl) {
|
|
133
|
-
function invoke(method, arg, resolve, reject) {
|
|
134
|
-
var record = tryCatch(generator[method], generator, arg);
|
|
135
|
-
|
|
136
|
-
if ("throw" !== record.type) {
|
|
137
|
-
var result = record.arg,
|
|
138
|
-
value = result.value;
|
|
139
|
-
return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
|
|
140
|
-
invoke("next", value, resolve, reject);
|
|
141
|
-
}, function (err) {
|
|
142
|
-
invoke("throw", err, resolve, reject);
|
|
143
|
-
}) : PromiseImpl.resolve(value).then(function (unwrapped) {
|
|
144
|
-
result.value = unwrapped, resolve(result);
|
|
145
|
-
}, function (error) {
|
|
146
|
-
return invoke("throw", error, resolve, reject);
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
reject(record.arg);
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
var previousPromise;
|
|
154
|
-
|
|
155
|
-
this._invoke = function (method, arg) {
|
|
156
|
-
function callInvokeWithMethodAndArg() {
|
|
157
|
-
return new PromiseImpl(function (resolve, reject) {
|
|
158
|
-
invoke(method, arg, resolve, reject);
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
function maybeInvokeDelegate(delegate, context) {
|
|
167
|
-
var method = delegate.iterator[context.method];
|
|
168
|
-
|
|
169
|
-
if (undefined === method) {
|
|
170
|
-
if (context.delegate = null, "throw" === context.method) {
|
|
171
|
-
if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
|
|
172
|
-
context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
return ContinueSentinel;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
179
|
-
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
|
|
180
|
-
var info = record.arg;
|
|
181
|
-
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);
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
function pushTryEntry(locs) {
|
|
185
|
-
var entry = {
|
|
186
|
-
tryLoc: locs[0]
|
|
187
|
-
};
|
|
188
|
-
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
function resetTryEntry(entry) {
|
|
192
|
-
var record = entry.completion || {};
|
|
193
|
-
record.type = "normal", delete record.arg, entry.completion = record;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
function Context(tryLocsList) {
|
|
197
|
-
this.tryEntries = [{
|
|
198
|
-
tryLoc: "root"
|
|
199
|
-
}], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
function values(iterable) {
|
|
203
|
-
if (iterable) {
|
|
204
|
-
var iteratorMethod = iterable[iteratorSymbol];
|
|
205
|
-
if (iteratorMethod) return iteratorMethod.call(iterable);
|
|
206
|
-
if ("function" == typeof iterable.next) return iterable;
|
|
207
|
-
|
|
208
|
-
if (!isNaN(iterable.length)) {
|
|
209
|
-
var i = -1,
|
|
210
|
-
next = function next() {
|
|
211
|
-
for (; ++i < iterable.length;) {
|
|
212
|
-
if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
return next.value = undefined, next.done = !0, next;
|
|
216
|
-
};
|
|
217
|
-
|
|
218
|
-
return next.next = next;
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
return {
|
|
223
|
-
next: doneResult
|
|
224
|
-
};
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
function doneResult() {
|
|
228
|
-
return {
|
|
229
|
-
value: undefined,
|
|
230
|
-
done: !0
|
|
231
|
-
};
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
|
|
235
|
-
var ctor = "function" == typeof genFun && genFun.constructor;
|
|
236
|
-
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
|
|
237
|
-
}, exports.mark = function (genFun) {
|
|
238
|
-
return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
|
|
239
|
-
}, exports.awrap = function (arg) {
|
|
240
|
-
return {
|
|
241
|
-
__await: arg
|
|
242
|
-
};
|
|
243
|
-
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
|
|
244
|
-
return this;
|
|
245
|
-
}), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
|
246
|
-
void 0 === PromiseImpl && (PromiseImpl = Promise);
|
|
247
|
-
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
|
|
248
|
-
return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
|
|
249
|
-
return result.done ? result.value : iter.next();
|
|
250
|
-
});
|
|
251
|
-
}, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
|
|
252
|
-
return this;
|
|
253
|
-
}), define(Gp, "toString", function () {
|
|
254
|
-
return "[object Generator]";
|
|
255
|
-
}), exports.keys = function (object) {
|
|
256
|
-
var keys = [];
|
|
257
|
-
|
|
258
|
-
for (var key in object) {
|
|
259
|
-
keys.push(key);
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
return keys.reverse(), function next() {
|
|
263
|
-
for (; keys.length;) {
|
|
264
|
-
var key = keys.pop();
|
|
265
|
-
if (key in object) return next.value = key, next.done = !1, next;
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
return next.done = !0, next;
|
|
269
|
-
};
|
|
270
|
-
}, exports.values = values, Context.prototype = {
|
|
271
|
-
constructor: Context,
|
|
272
|
-
reset: function (skipTempReset) {
|
|
273
|
-
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) {
|
|
274
|
-
"t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
|
|
275
|
-
}
|
|
276
|
-
},
|
|
277
|
-
stop: function () {
|
|
278
|
-
this.done = !0;
|
|
279
|
-
var rootRecord = this.tryEntries[0].completion;
|
|
280
|
-
if ("throw" === rootRecord.type) throw rootRecord.arg;
|
|
281
|
-
return this.rval;
|
|
282
|
-
},
|
|
283
|
-
dispatchException: function (exception) {
|
|
284
|
-
if (this.done) throw exception;
|
|
285
|
-
var context = this;
|
|
286
|
-
|
|
287
|
-
function handle(loc, caught) {
|
|
288
|
-
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
292
|
-
var entry = this.tryEntries[i],
|
|
293
|
-
record = entry.completion;
|
|
294
|
-
if ("root" === entry.tryLoc) return handle("end");
|
|
295
|
-
|
|
296
|
-
if (entry.tryLoc <= this.prev) {
|
|
297
|
-
var hasCatch = hasOwn.call(entry, "catchLoc"),
|
|
298
|
-
hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
299
|
-
|
|
300
|
-
if (hasCatch && hasFinally) {
|
|
301
|
-
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
302
|
-
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
303
|
-
} else if (hasCatch) {
|
|
304
|
-
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
305
|
-
} else {
|
|
306
|
-
if (!hasFinally) throw new Error("try statement without catch or finally");
|
|
307
|
-
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
},
|
|
312
|
-
abrupt: function (type, arg) {
|
|
313
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
314
|
-
var entry = this.tryEntries[i];
|
|
315
|
-
|
|
316
|
-
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
|
317
|
-
var finallyEntry = entry;
|
|
318
|
-
break;
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
|
|
323
|
-
var record = finallyEntry ? finallyEntry.completion : {};
|
|
324
|
-
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
|
|
325
|
-
},
|
|
326
|
-
complete: function (record, afterLoc) {
|
|
327
|
-
if ("throw" === record.type) throw record.arg;
|
|
328
|
-
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;
|
|
329
|
-
},
|
|
330
|
-
finish: function (finallyLoc) {
|
|
331
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
332
|
-
var entry = this.tryEntries[i];
|
|
333
|
-
if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
|
|
334
|
-
}
|
|
335
|
-
},
|
|
336
|
-
catch: function (tryLoc) {
|
|
337
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
338
|
-
var entry = this.tryEntries[i];
|
|
339
|
-
|
|
340
|
-
if (entry.tryLoc === tryLoc) {
|
|
341
|
-
var record = entry.completion;
|
|
342
|
-
|
|
343
|
-
if ("throw" === record.type) {
|
|
344
|
-
var thrown = record.arg;
|
|
345
|
-
resetTryEntry(entry);
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
return thrown;
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
throw new Error("illegal catch attempt");
|
|
353
|
-
},
|
|
354
|
-
delegateYield: function (iterable, resultName, nextLoc) {
|
|
355
|
-
return this.delegate = {
|
|
356
|
-
iterator: values(iterable),
|
|
357
|
-
resultName: resultName,
|
|
358
|
-
nextLoc: nextLoc
|
|
359
|
-
}, "next" === this.method && (this.arg = undefined), ContinueSentinel;
|
|
360
|
-
}
|
|
361
|
-
}, exports;
|
|
362
|
-
}
|
|
363
|
-
|
|
364
8
|
var QUEUE_KEY = 'Parse/Eventually/Queue';
|
|
365
9
|
var queueCache = [];
|
|
366
10
|
var dirtyCache = true;
|
|
@@ -376,58 +20,43 @@ var EventuallyQueue = {
|
|
|
376
20
|
},
|
|
377
21
|
generateQueueId: function (action, object) {
|
|
378
22
|
object._getId();
|
|
379
|
-
|
|
380
23
|
var className = object.className,
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
24
|
+
id = object.id,
|
|
25
|
+
_localId = object._localId;
|
|
384
26
|
var uniqueId = object.get('hash') || _localId;
|
|
385
|
-
|
|
386
27
|
return [action, className, id, uniqueId].join('_');
|
|
387
28
|
},
|
|
388
|
-
enqueue: function (
|
|
389
|
-
var
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
queueData = _context.sent;
|
|
399
|
-
queueId = this.generateQueueId(action, object);
|
|
400
|
-
index = this.queueItemExists(queueData, queueId);
|
|
401
|
-
|
|
402
|
-
if (index > -1) {
|
|
403
|
-
for (prop in queueData[index].object) {
|
|
404
|
-
if (typeof object.get(prop) === 'undefined') {
|
|
405
|
-
object.set(prop, queueData[index].object[prop]);
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
} else {
|
|
409
|
-
index = queueData.length;
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
queueData[index] = {
|
|
413
|
-
queueId: queueId,
|
|
414
|
-
action: action,
|
|
415
|
-
object: object.toJSON(),
|
|
416
|
-
serverOptions: serverOptions,
|
|
417
|
-
id: object.id,
|
|
418
|
-
className: object.className,
|
|
419
|
-
hash: object.get('hash'),
|
|
420
|
-
createdAt: new Date()
|
|
421
|
-
};
|
|
422
|
-
return _context.abrupt("return", this.setQueue(queueData));
|
|
423
|
-
|
|
424
|
-
case 8:
|
|
425
|
-
case "end":
|
|
426
|
-
return _context.stop();
|
|
29
|
+
enqueue: function () {
|
|
30
|
+
var _enqueue = (0, _asyncToGenerator2.default)(function* (action, object, serverOptions) {
|
|
31
|
+
var queueData = yield this.getQueue();
|
|
32
|
+
var queueId = this.generateQueueId(action, object);
|
|
33
|
+
var index = this.queueItemExists(queueData, queueId);
|
|
34
|
+
if (index > -1) {
|
|
35
|
+
for (var prop in queueData[index].object) {
|
|
36
|
+
if (typeof object.get(prop) === 'undefined') {
|
|
37
|
+
object.set(prop, queueData[index].object[prop]);
|
|
38
|
+
}
|
|
427
39
|
}
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
|
|
40
|
+
} else {
|
|
41
|
+
index = queueData.length;
|
|
42
|
+
}
|
|
43
|
+
queueData[index] = {
|
|
44
|
+
queueId: queueId,
|
|
45
|
+
action: action,
|
|
46
|
+
object: object.toJSON(),
|
|
47
|
+
serverOptions: serverOptions,
|
|
48
|
+
id: object.id,
|
|
49
|
+
className: object.className,
|
|
50
|
+
hash: object.get('hash'),
|
|
51
|
+
createdAt: new Date()
|
|
52
|
+
};
|
|
53
|
+
return this.setQueue(queueData);
|
|
54
|
+
});
|
|
55
|
+
function enqueue() {
|
|
56
|
+
return _enqueue.apply(this, arguments);
|
|
57
|
+
}
|
|
58
|
+
return enqueue;
|
|
59
|
+
}(),
|
|
431
60
|
store: function (data) {
|
|
432
61
|
return _Storage.default.setItemAsync(QUEUE_KEY, JSON.stringify(data));
|
|
433
62
|
},
|
|
@@ -435,77 +64,36 @@ var EventuallyQueue = {
|
|
|
435
64
|
return _Storage.default.getItemAsync(QUEUE_KEY);
|
|
436
65
|
},
|
|
437
66
|
getQueue: function () {
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
if (!dirtyCache) {
|
|
443
|
-
_context2.next = 10;
|
|
444
|
-
break;
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
_context2.t0 = JSON;
|
|
448
|
-
_context2.next = 4;
|
|
449
|
-
return _regeneratorRuntime().awrap(this.load());
|
|
450
|
-
|
|
451
|
-
case 4:
|
|
452
|
-
_context2.t1 = _context2.sent;
|
|
453
|
-
|
|
454
|
-
if (_context2.t1) {
|
|
455
|
-
_context2.next = 7;
|
|
456
|
-
break;
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
_context2.t1 = '[]';
|
|
460
|
-
|
|
461
|
-
case 7:
|
|
462
|
-
_context2.t2 = _context2.t1;
|
|
463
|
-
queueCache = _context2.t0.parse.call(_context2.t0, _context2.t2);
|
|
464
|
-
dirtyCache = false;
|
|
465
|
-
|
|
466
|
-
case 10:
|
|
467
|
-
return _context2.abrupt("return", queueCache);
|
|
468
|
-
|
|
469
|
-
case 11:
|
|
470
|
-
case "end":
|
|
471
|
-
return _context2.stop();
|
|
472
|
-
}
|
|
67
|
+
var _getQueue = (0, _asyncToGenerator2.default)(function* () {
|
|
68
|
+
if (dirtyCache) {
|
|
69
|
+
queueCache = JSON.parse((yield this.load()) || '[]');
|
|
70
|
+
dirtyCache = false;
|
|
473
71
|
}
|
|
474
|
-
|
|
475
|
-
|
|
72
|
+
return queueCache;
|
|
73
|
+
});
|
|
74
|
+
function getQueue() {
|
|
75
|
+
return _getQueue.apply(this, arguments);
|
|
76
|
+
}
|
|
77
|
+
return getQueue;
|
|
78
|
+
}(),
|
|
476
79
|
setQueue: function (queue) {
|
|
477
80
|
queueCache = queue;
|
|
478
81
|
return this.store(queueCache);
|
|
479
82
|
},
|
|
480
|
-
remove: function (
|
|
481
|
-
var
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
return _regeneratorRuntime().awrap(this.getQueue());
|
|
488
|
-
|
|
489
|
-
case 2:
|
|
490
|
-
queueData = _context3.sent;
|
|
491
|
-
index = this.queueItemExists(queueData, queueId);
|
|
492
|
-
|
|
493
|
-
if (!(index > -1)) {
|
|
494
|
-
_context3.next = 8;
|
|
495
|
-
break;
|
|
496
|
-
}
|
|
497
|
-
|
|
498
|
-
queueData.splice(index, 1);
|
|
499
|
-
_context3.next = 8;
|
|
500
|
-
return _regeneratorRuntime().awrap(this.setQueue(queueData));
|
|
501
|
-
|
|
502
|
-
case 8:
|
|
503
|
-
case "end":
|
|
504
|
-
return _context3.stop();
|
|
505
|
-
}
|
|
83
|
+
remove: function () {
|
|
84
|
+
var _remove = (0, _asyncToGenerator2.default)(function* (queueId) {
|
|
85
|
+
var queueData = yield this.getQueue();
|
|
86
|
+
var index = this.queueItemExists(queueData, queueId);
|
|
87
|
+
if (index > -1) {
|
|
88
|
+
queueData.splice(index, 1);
|
|
89
|
+
yield this.setQueue(queueData);
|
|
506
90
|
}
|
|
507
|
-
}
|
|
508
|
-
|
|
91
|
+
});
|
|
92
|
+
function remove() {
|
|
93
|
+
return _remove.apply(this, arguments);
|
|
94
|
+
}
|
|
95
|
+
return remove;
|
|
96
|
+
}(),
|
|
509
97
|
clear: function () {
|
|
510
98
|
queueCache = [];
|
|
511
99
|
return this.store([]);
|
|
@@ -516,208 +104,91 @@ var EventuallyQueue = {
|
|
|
516
104
|
});
|
|
517
105
|
},
|
|
518
106
|
length: function () {
|
|
519
|
-
var
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
queueData = _context4.sent;
|
|
529
|
-
return _context4.abrupt("return", queueData.length);
|
|
530
|
-
|
|
531
|
-
case 4:
|
|
532
|
-
case "end":
|
|
533
|
-
return _context4.stop();
|
|
534
|
-
}
|
|
535
|
-
}
|
|
536
|
-
}, null, this, null, Promise);
|
|
537
|
-
},
|
|
107
|
+
var _length = (0, _asyncToGenerator2.default)(function* () {
|
|
108
|
+
var queueData = yield this.getQueue();
|
|
109
|
+
return queueData.length;
|
|
110
|
+
});
|
|
111
|
+
function length() {
|
|
112
|
+
return _length.apply(this, arguments);
|
|
113
|
+
}
|
|
114
|
+
return length;
|
|
115
|
+
}(),
|
|
538
116
|
sendQueue: function () {
|
|
539
|
-
var
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
case 6:
|
|
559
|
-
i = 0;
|
|
560
|
-
|
|
561
|
-
case 7:
|
|
562
|
-
if (!(i < queueData.length)) {
|
|
563
|
-
_context5.next = 26;
|
|
564
|
-
break;
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
queueObject = queueData[i];
|
|
568
|
-
id = queueObject.id, hash = queueObject.hash, className = queueObject.className;
|
|
569
|
-
ObjectType = _ParseObject.default.extend(className);
|
|
570
|
-
|
|
571
|
-
if (!id) {
|
|
572
|
-
_context5.next = 16;
|
|
573
|
-
break;
|
|
574
|
-
}
|
|
575
|
-
|
|
576
|
-
_context5.next = 14;
|
|
577
|
-
return _regeneratorRuntime().awrap(this.process.byId(ObjectType, queueObject));
|
|
578
|
-
|
|
579
|
-
case 14:
|
|
580
|
-
_context5.next = 23;
|
|
581
|
-
break;
|
|
582
|
-
|
|
583
|
-
case 16:
|
|
584
|
-
if (!hash) {
|
|
585
|
-
_context5.next = 21;
|
|
586
|
-
break;
|
|
587
|
-
}
|
|
588
|
-
|
|
589
|
-
_context5.next = 19;
|
|
590
|
-
return _regeneratorRuntime().awrap(this.process.byHash(ObjectType, queueObject));
|
|
591
|
-
|
|
592
|
-
case 19:
|
|
593
|
-
_context5.next = 23;
|
|
594
|
-
break;
|
|
595
|
-
|
|
596
|
-
case 21:
|
|
597
|
-
_context5.next = 23;
|
|
598
|
-
return _regeneratorRuntime().awrap(this.process.create(ObjectType, queueObject));
|
|
599
|
-
|
|
600
|
-
case 23:
|
|
601
|
-
i += 1;
|
|
602
|
-
_context5.next = 7;
|
|
603
|
-
break;
|
|
604
|
-
|
|
605
|
-
case 26:
|
|
606
|
-
return _context5.abrupt("return", true);
|
|
607
|
-
|
|
608
|
-
case 27:
|
|
609
|
-
case "end":
|
|
610
|
-
return _context5.stop();
|
|
117
|
+
var _sendQueue = (0, _asyncToGenerator2.default)(function* () {
|
|
118
|
+
var queue = yield this.getQueue();
|
|
119
|
+
var queueData = (0, _toConsumableArray2.default)(queue);
|
|
120
|
+
if (queueData.length === 0) {
|
|
121
|
+
return false;
|
|
122
|
+
}
|
|
123
|
+
for (var i = 0; i < queueData.length; i += 1) {
|
|
124
|
+
var queueObject = queueData[i];
|
|
125
|
+
var id = queueObject.id,
|
|
126
|
+
hash = queueObject.hash,
|
|
127
|
+
className = queueObject.className;
|
|
128
|
+
var ObjectType = _ParseObject.default.extend(className);
|
|
129
|
+
if (id) {
|
|
130
|
+
yield this.process.byId(ObjectType, queueObject);
|
|
131
|
+
} else if (hash) {
|
|
132
|
+
yield this.process.byHash(ObjectType, queueObject);
|
|
133
|
+
} else {
|
|
134
|
+
yield this.process.create(ObjectType, queueObject);
|
|
611
135
|
}
|
|
612
136
|
}
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
}
|
|
637
|
-
|
|
638
|
-
return _context6.abrupt("return", this.remove(queueObject.queueId));
|
|
639
|
-
|
|
640
|
-
case 7:
|
|
641
|
-
_context6.prev = 7;
|
|
642
|
-
_context6.next = 10;
|
|
643
|
-
return _regeneratorRuntime().awrap(object.save(queueObject.object, queueObject.serverOptions));
|
|
644
|
-
|
|
645
|
-
case 10:
|
|
646
|
-
_context6.next = 12;
|
|
647
|
-
return _regeneratorRuntime().awrap(this.remove(queueObject.queueId));
|
|
648
|
-
|
|
649
|
-
case 12:
|
|
650
|
-
_context6.next = 19;
|
|
651
|
-
break;
|
|
652
|
-
|
|
653
|
-
case 14:
|
|
654
|
-
_context6.prev = 14;
|
|
655
|
-
_context6.t1 = _context6["catch"](7);
|
|
656
|
-
|
|
657
|
-
if (!(_context6.t1.message !== 'XMLHttpRequest failed: "Unable to connect to the Parse API"')) {
|
|
658
|
-
_context6.next = 19;
|
|
659
|
-
break;
|
|
137
|
+
return true;
|
|
138
|
+
});
|
|
139
|
+
function sendQueue() {
|
|
140
|
+
return _sendQueue.apply(this, arguments);
|
|
141
|
+
}
|
|
142
|
+
return sendQueue;
|
|
143
|
+
}(),
|
|
144
|
+
sendQueueCallback: function () {
|
|
145
|
+
var _sendQueueCallback = (0, _asyncToGenerator2.default)(function* (object, queueObject) {
|
|
146
|
+
if (!object) {
|
|
147
|
+
return this.remove(queueObject.queueId);
|
|
148
|
+
}
|
|
149
|
+
switch (queueObject.action) {
|
|
150
|
+
case 'save':
|
|
151
|
+
if (typeof object.updatedAt !== 'undefined' && object.updatedAt > new Date(queueObject.object.createdAt)) {
|
|
152
|
+
return this.remove(queueObject.queueId);
|
|
153
|
+
}
|
|
154
|
+
try {
|
|
155
|
+
yield object.save(queueObject.object, queueObject.serverOptions);
|
|
156
|
+
yield this.remove(queueObject.queueId);
|
|
157
|
+
} catch (e) {
|
|
158
|
+
if (e.message !== 'XMLHttpRequest failed: "Unable to connect to the Parse API"') {
|
|
159
|
+
yield this.remove(queueObject.queueId);
|
|
660
160
|
}
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
_context6.next = 23;
|
|
671
|
-
return _regeneratorRuntime().awrap(object.destroy(queueObject.serverOptions));
|
|
672
|
-
|
|
673
|
-
case 23:
|
|
674
|
-
_context6.next = 25;
|
|
675
|
-
return _regeneratorRuntime().awrap(this.remove(queueObject.queueId));
|
|
676
|
-
|
|
677
|
-
case 25:
|
|
678
|
-
_context6.next = 32;
|
|
679
|
-
break;
|
|
680
|
-
|
|
681
|
-
case 27:
|
|
682
|
-
_context6.prev = 27;
|
|
683
|
-
_context6.t2 = _context6["catch"](20);
|
|
684
|
-
|
|
685
|
-
if (!(_context6.t2.message !== 'XMLHttpRequest failed: "Unable to connect to the Parse API"')) {
|
|
686
|
-
_context6.next = 32;
|
|
687
|
-
break;
|
|
161
|
+
}
|
|
162
|
+
break;
|
|
163
|
+
case 'destroy':
|
|
164
|
+
try {
|
|
165
|
+
yield object.destroy(queueObject.serverOptions);
|
|
166
|
+
yield this.remove(queueObject.queueId);
|
|
167
|
+
} catch (e) {
|
|
168
|
+
if (e.message !== 'XMLHttpRequest failed: "Unable to connect to the Parse API"') {
|
|
169
|
+
yield this.remove(queueObject.queueId);
|
|
688
170
|
}
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
return _regeneratorRuntime().awrap(this.remove(queueObject.queueId));
|
|
692
|
-
|
|
693
|
-
case 32:
|
|
694
|
-
return _context6.abrupt("break", 33);
|
|
695
|
-
|
|
696
|
-
case 33:
|
|
697
|
-
case "end":
|
|
698
|
-
return _context6.stop();
|
|
699
|
-
}
|
|
171
|
+
}
|
|
172
|
+
break;
|
|
700
173
|
}
|
|
701
|
-
}
|
|
702
|
-
|
|
174
|
+
});
|
|
175
|
+
function sendQueueCallback() {
|
|
176
|
+
return _sendQueueCallback.apply(this, arguments);
|
|
177
|
+
}
|
|
178
|
+
return sendQueueCallback;
|
|
179
|
+
}(),
|
|
703
180
|
poll: function () {
|
|
704
181
|
var _this = this;
|
|
705
|
-
|
|
706
182
|
var ms = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 2000;
|
|
707
|
-
|
|
708
183
|
if (polling) {
|
|
709
184
|
return;
|
|
710
185
|
}
|
|
711
|
-
|
|
712
186
|
polling = setInterval(function () {
|
|
713
187
|
var RESTController = _CoreManager.default.getRESTController();
|
|
714
|
-
|
|
715
188
|
RESTController.request('GET', 'health').then(function (_ref) {
|
|
716
189
|
var status = _ref.status;
|
|
717
|
-
|
|
718
190
|
if (status === 'ok') {
|
|
719
191
|
_this.stopPoll();
|
|
720
|
-
|
|
721
192
|
return _this.sendQueue();
|
|
722
193
|
}
|
|
723
194
|
}).catch(function (e) {
|
|
@@ -740,65 +211,39 @@ var EventuallyQueue = {
|
|
|
740
211
|
var object = new ObjectType();
|
|
741
212
|
return EventuallyQueue.sendQueueCallback(object, queueObject);
|
|
742
213
|
},
|
|
743
|
-
byId: function (
|
|
744
|
-
var
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
}
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
byHash: function (ObjectType, queueObject) {
|
|
769
|
-
var sessionToken, query, results;
|
|
770
|
-
return _regeneratorRuntime().async(function (_context8) {
|
|
771
|
-
while (1) {
|
|
772
|
-
switch (_context8.prev = _context8.next) {
|
|
773
|
-
case 0:
|
|
774
|
-
sessionToken = queueObject.serverOptions.sessionToken;
|
|
775
|
-
query = new _ParseQuery.default(ObjectType);
|
|
776
|
-
query.equalTo('hash', queueObject.hash);
|
|
777
|
-
_context8.next = 5;
|
|
778
|
-
return _regeneratorRuntime().awrap(query.find({
|
|
779
|
-
sessionToken: sessionToken
|
|
780
|
-
}));
|
|
781
|
-
|
|
782
|
-
case 5:
|
|
783
|
-
results = _context8.sent;
|
|
784
|
-
|
|
785
|
-
if (!(results.length > 0)) {
|
|
786
|
-
_context8.next = 8;
|
|
787
|
-
break;
|
|
788
|
-
}
|
|
789
|
-
|
|
790
|
-
return _context8.abrupt("return", EventuallyQueue.sendQueueCallback(results[0], queueObject));
|
|
791
|
-
|
|
792
|
-
case 8:
|
|
793
|
-
return _context8.abrupt("return", EventuallyQueue.process.create(ObjectType, queueObject));
|
|
794
|
-
|
|
795
|
-
case 9:
|
|
796
|
-
case "end":
|
|
797
|
-
return _context8.stop();
|
|
798
|
-
}
|
|
214
|
+
byId: function () {
|
|
215
|
+
var _byId = (0, _asyncToGenerator2.default)(function* (ObjectType, queueObject) {
|
|
216
|
+
var sessionToken = queueObject.serverOptions.sessionToken;
|
|
217
|
+
var query = new _ParseQuery.default(ObjectType);
|
|
218
|
+
query.equalTo('objectId', queueObject.id);
|
|
219
|
+
var results = yield query.find({
|
|
220
|
+
sessionToken: sessionToken
|
|
221
|
+
});
|
|
222
|
+
return EventuallyQueue.sendQueueCallback(results[0], queueObject);
|
|
223
|
+
});
|
|
224
|
+
function byId() {
|
|
225
|
+
return _byId.apply(this, arguments);
|
|
226
|
+
}
|
|
227
|
+
return byId;
|
|
228
|
+
}(),
|
|
229
|
+
byHash: function () {
|
|
230
|
+
var _byHash = (0, _asyncToGenerator2.default)(function* (ObjectType, queueObject) {
|
|
231
|
+
var sessionToken = queueObject.serverOptions.sessionToken;
|
|
232
|
+
var query = new _ParseQuery.default(ObjectType);
|
|
233
|
+
query.equalTo('hash', queueObject.hash);
|
|
234
|
+
var results = yield query.find({
|
|
235
|
+
sessionToken: sessionToken
|
|
236
|
+
});
|
|
237
|
+
if (results.length > 0) {
|
|
238
|
+
return EventuallyQueue.sendQueueCallback(results[0], queueObject);
|
|
799
239
|
}
|
|
800
|
-
|
|
801
|
-
|
|
240
|
+
return EventuallyQueue.process.create(ObjectType, queueObject);
|
|
241
|
+
});
|
|
242
|
+
function byHash() {
|
|
243
|
+
return _byHash.apply(this, arguments);
|
|
244
|
+
}
|
|
245
|
+
return byHash;
|
|
246
|
+
}()
|
|
802
247
|
}
|
|
803
248
|
};
|
|
804
249
|
module.exports = EventuallyQueue;
|