parse 4.0.0 → 4.0.1
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 +1 -3
- package/dist/parse.js +188 -374
- package/dist/parse.min.js +7 -6
- package/dist/parse.weapp.js +188 -374
- package/dist/parse.weapp.min.js +7 -6
- package/lib/browser/Analytics.js +0 -7
- package/lib/browser/AnonymousUtils.js +0 -7
- package/lib/browser/Cloud.js +0 -7
- package/lib/browser/CoreManager.js +1 -8
- package/lib/browser/EventEmitter.js +0 -7
- package/lib/browser/FacebookUtils.js +0 -7
- package/lib/browser/InstallationController.js +0 -7
- package/lib/browser/LocalDatastoreUtils.js +0 -7
- package/lib/browser/OfflineQuery.js +27 -8
- package/lib/browser/Parse.js +0 -9
- package/lib/browser/ParseACL.js +0 -7
- package/lib/browser/ParseConfig.js +0 -7
- package/lib/browser/ParseError.js +0 -9
- package/lib/browser/ParseGeoPoint.js +0 -7
- package/lib/browser/ParseObject.js +158 -126
- package/lib/browser/ParsePolygon.js +0 -7
- package/lib/browser/ParseRelation.js +0 -7
- package/lib/browser/ParseSchema.js +0 -7
- package/lib/browser/Push.js +0 -7
- package/lib/browser/RESTController.js +0 -7
- package/lib/browser/SingleInstanceStateController.js +0 -7
- package/lib/browser/Storage.js +0 -7
- package/lib/browser/StorageController.browser.js +0 -7
- package/lib/browser/StorageController.default.js +0 -7
- package/lib/browser/StorageController.react-native.js +0 -7
- package/lib/browser/StorageController.weapp.js +0 -7
- package/lib/browser/TaskQueue.js +0 -7
- package/lib/browser/UniqueInstanceStateController.js +0 -7
- package/lib/browser/arrayContainsObject.js +0 -7
- package/lib/browser/canBeSerialized.js +0 -7
- package/lib/browser/decode.js +0 -7
- package/lib/browser/encode.js +0 -7
- package/lib/browser/equals.js +0 -9
- package/lib/browser/escape.js +0 -7
- package/lib/browser/isRevocableSession.js +0 -7
- package/lib/browser/parseDate.js +0 -7
- package/lib/browser/unique.js +0 -7
- package/lib/browser/unsavedChildren.js +0 -7
- package/lib/node/Analytics.js +0 -7
- package/lib/node/AnonymousUtils.js +0 -7
- package/lib/node/Cloud.js +0 -7
- package/lib/node/CoreManager.js +1 -8
- package/lib/node/EventEmitter.js +0 -7
- package/lib/node/FacebookUtils.js +0 -7
- package/lib/node/InstallationController.js +0 -7
- package/lib/node/LiveQueryClient.js +0 -10
- package/lib/node/LiveQuerySubscription.js +0 -10
- package/lib/node/LocalDatastore.js +0 -7
- package/lib/node/LocalDatastoreController.js +0 -7
- package/lib/node/LocalDatastoreController.react-native.js +0 -7
- package/lib/node/LocalDatastoreUtils.js +0 -7
- package/lib/node/ObjectStateMutations.js +0 -7
- package/lib/node/OfflineQuery.js +8 -0
- package/lib/node/Parse.js +0 -9
- package/lib/node/ParseACL.js +0 -7
- package/lib/node/ParseCLP.js +0 -7
- package/lib/node/ParseConfig.js +0 -7
- package/lib/node/ParseError.js +0 -9
- package/lib/node/ParseFile.js +0 -7
- package/lib/node/ParseGeoPoint.js +0 -7
- package/lib/node/ParseInstallation.js +0 -7
- package/lib/node/ParseLiveQuery.js +0 -7
- package/lib/node/ParseObject.js +40 -29
- package/lib/node/ParseOp.js +0 -7
- package/lib/node/ParsePolygon.js +0 -7
- package/lib/node/ParseQuery.js +0 -7
- package/lib/node/ParseRelation.js +0 -7
- package/lib/node/ParseRole.js +0 -7
- package/lib/node/ParseSchema.js +0 -7
- package/lib/node/ParseSession.js +0 -7
- package/lib/node/ParseUser.js +0 -7
- package/lib/node/Push.js +0 -7
- package/lib/node/RESTController.js +0 -7
- package/lib/node/SingleInstanceStateController.js +0 -7
- package/lib/node/Storage.js +0 -7
- package/lib/node/StorageController.browser.js +0 -7
- package/lib/node/StorageController.default.js +0 -7
- package/lib/node/StorageController.react-native.js +0 -7
- package/lib/node/StorageController.weapp.js +0 -7
- package/lib/node/TaskQueue.js +0 -7
- package/lib/node/UniqueInstanceStateController.js +0 -7
- package/lib/node/arrayContainsObject.js +0 -7
- package/lib/node/canBeSerialized.js +0 -7
- package/lib/node/decode.js +0 -7
- package/lib/node/encode.js +0 -7
- package/lib/node/equals.js +0 -9
- package/lib/node/escape.js +0 -7
- package/lib/node/isRevocableSession.js +0 -7
- package/lib/node/parseDate.js +0 -7
- package/lib/node/unique.js +0 -7
- package/lib/node/unsavedChildren.js +0 -7
- package/lib/react-native/CoreManager.js +2 -2
- package/lib/react-native/EventuallyQueue.js +169 -676
- package/lib/react-native/LiveQueryClient.js +3 -46
- package/lib/react-native/LocalDatastore.js +303 -863
- package/lib/react-native/LocalDatastoreController.js +75 -535
- package/lib/react-native/LocalDatastoreController.react-native.js +95 -503
- package/lib/react-native/ObjectStateMutations.js +2 -31
- package/lib/react-native/OfflineQuery.js +24 -60
- package/lib/react-native/ParseCLP.js +55 -129
- package/lib/react-native/ParseFile.js +63 -468
- package/lib/react-native/ParseLiveQuery.js +60 -455
- package/lib/react-native/ParseObject.js +263 -897
- package/lib/react-native/ParseQuery.js +207 -643
- package/lib/react-native/ParseSchema.js +3 -3
- package/lib/react-native/ParseUser.js +118 -573
- package/lib/react-native/RESTController.js +1 -29
- package/lib/weapp/Analytics.js +0 -7
- package/lib/weapp/AnonymousUtils.js +0 -7
- package/lib/weapp/Cloud.js +0 -7
- package/lib/weapp/CoreManager.js +1 -8
- package/lib/weapp/EventEmitter.js +0 -7
- package/lib/weapp/FacebookUtils.js +0 -7
- package/lib/weapp/InstallationController.js +0 -7
- package/lib/weapp/LocalDatastoreUtils.js +0 -7
- package/lib/weapp/OfflineQuery.js +27 -8
- package/lib/weapp/Parse.js +0 -9
- package/lib/weapp/ParseACL.js +0 -7
- package/lib/weapp/ParseConfig.js +0 -7
- package/lib/weapp/ParseError.js +0 -9
- package/lib/weapp/ParseGeoPoint.js +0 -7
- package/lib/weapp/ParseObject.js +158 -126
- package/lib/weapp/ParsePolygon.js +0 -7
- package/lib/weapp/ParseRelation.js +0 -7
- package/lib/weapp/ParseSchema.js +0 -7
- package/lib/weapp/Push.js +0 -7
- package/lib/weapp/RESTController.js +0 -7
- package/lib/weapp/SingleInstanceStateController.js +0 -7
- package/lib/weapp/Storage.js +0 -7
- package/lib/weapp/StorageController.browser.js +0 -7
- package/lib/weapp/StorageController.default.js +0 -7
- package/lib/weapp/StorageController.react-native.js +0 -7
- package/lib/weapp/StorageController.weapp.js +0 -7
- package/lib/weapp/TaskQueue.js +0 -7
- package/lib/weapp/UniqueInstanceStateController.js +0 -7
- package/lib/weapp/arrayContainsObject.js +0 -7
- package/lib/weapp/canBeSerialized.js +0 -7
- package/lib/weapp/decode.js +0 -7
- package/lib/weapp/encode.js +0 -7
- package/lib/weapp/equals.js +0 -9
- package/lib/weapp/escape.js +0 -7
- package/lib/weapp/isRevocableSession.js +0 -7
- package/lib/weapp/parseDate.js +0 -7
- package/lib/weapp/unique.js +0 -7
- package/lib/weapp/unsavedChildren.js +0 -7
- package/package.json +11 -11
- package/PATENTS +0 -37
|
@@ -2,545 +2,137 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
2
2
|
|
|
3
3
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
function _regeneratorRuntime() {
|
|
8
|
-
"use strict";
|
|
9
|
-
|
|
10
|
-
_regeneratorRuntime = function () {
|
|
11
|
-
return exports;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
var exports = {},
|
|
15
|
-
Op = Object.prototype,
|
|
16
|
-
hasOwn = Op.hasOwnProperty,
|
|
17
|
-
$Symbol = "function" == typeof Symbol ? Symbol : {},
|
|
18
|
-
iteratorSymbol = $Symbol.iterator || "@@iterator",
|
|
19
|
-
asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
|
|
20
|
-
toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
21
|
-
|
|
22
|
-
function define(obj, key, value) {
|
|
23
|
-
return Object.defineProperty(obj, key, {
|
|
24
|
-
value: value,
|
|
25
|
-
enumerable: !0,
|
|
26
|
-
configurable: !0,
|
|
27
|
-
writable: !0
|
|
28
|
-
}), obj[key];
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
try {
|
|
32
|
-
define({}, "");
|
|
33
|
-
} catch (err) {
|
|
34
|
-
define = function (obj, key, value) {
|
|
35
|
-
return obj[key] = value;
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
40
|
-
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
|
|
41
|
-
generator = Object.create(protoGenerator.prototype),
|
|
42
|
-
context = new Context(tryLocsList || []);
|
|
43
|
-
return generator._invoke = function (innerFn, self, context) {
|
|
44
|
-
var state = "suspendedStart";
|
|
45
|
-
return function (method, arg) {
|
|
46
|
-
if ("executing" === state) throw new Error("Generator is already running");
|
|
47
|
-
|
|
48
|
-
if ("completed" === state) {
|
|
49
|
-
if ("throw" === method) throw arg;
|
|
50
|
-
return doneResult();
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
for (context.method = method, context.arg = arg;;) {
|
|
54
|
-
var delegate = context.delegate;
|
|
55
|
-
|
|
56
|
-
if (delegate) {
|
|
57
|
-
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
58
|
-
|
|
59
|
-
if (delegateResult) {
|
|
60
|
-
if (delegateResult === ContinueSentinel) continue;
|
|
61
|
-
return delegateResult;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
|
|
66
|
-
if ("suspendedStart" === state) throw state = "completed", context.arg;
|
|
67
|
-
context.dispatchException(context.arg);
|
|
68
|
-
} else "return" === context.method && context.abrupt("return", context.arg);
|
|
69
|
-
state = "executing";
|
|
70
|
-
var record = tryCatch(innerFn, self, context);
|
|
71
|
-
|
|
72
|
-
if ("normal" === record.type) {
|
|
73
|
-
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
|
|
74
|
-
return {
|
|
75
|
-
value: record.arg,
|
|
76
|
-
done: context.done
|
|
77
|
-
};
|
|
78
|
-
}
|
|
5
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
79
6
|
|
|
80
|
-
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
}(innerFn, self, context), generator;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
function tryCatch(fn, obj, arg) {
|
|
87
|
-
try {
|
|
88
|
-
return {
|
|
89
|
-
type: "normal",
|
|
90
|
-
arg: fn.call(obj, arg)
|
|
91
|
-
};
|
|
92
|
-
} catch (err) {
|
|
93
|
-
return {
|
|
94
|
-
type: "throw",
|
|
95
|
-
arg: err
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
exports.wrap = wrap;
|
|
101
|
-
var ContinueSentinel = {};
|
|
102
|
-
|
|
103
|
-
function Generator() {}
|
|
104
|
-
|
|
105
|
-
function GeneratorFunction() {}
|
|
106
|
-
|
|
107
|
-
function GeneratorFunctionPrototype() {}
|
|
108
|
-
|
|
109
|
-
var IteratorPrototype = {};
|
|
110
|
-
define(IteratorPrototype, iteratorSymbol, function () {
|
|
111
|
-
return this;
|
|
112
|
-
});
|
|
113
|
-
var getProto = Object.getPrototypeOf,
|
|
114
|
-
NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
115
|
-
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
|
|
116
|
-
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
|
117
|
-
|
|
118
|
-
function defineIteratorMethods(prototype) {
|
|
119
|
-
["next", "throw", "return"].forEach(function (method) {
|
|
120
|
-
define(prototype, method, function (arg) {
|
|
121
|
-
return this._invoke(method, arg);
|
|
122
|
-
});
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
function AsyncIterator(generator, PromiseImpl) {
|
|
127
|
-
function invoke(method, arg, resolve, reject) {
|
|
128
|
-
var record = tryCatch(generator[method], generator, arg);
|
|
129
|
-
|
|
130
|
-
if ("throw" !== record.type) {
|
|
131
|
-
var result = record.arg,
|
|
132
|
-
value = result.value;
|
|
133
|
-
return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
|
|
134
|
-
invoke("next", value, resolve, reject);
|
|
135
|
-
}, function (err) {
|
|
136
|
-
invoke("throw", err, resolve, reject);
|
|
137
|
-
}) : PromiseImpl.resolve(value).then(function (unwrapped) {
|
|
138
|
-
result.value = unwrapped, resolve(result);
|
|
139
|
-
}, function (error) {
|
|
140
|
-
return invoke("throw", error, resolve, reject);
|
|
141
|
-
});
|
|
142
|
-
}
|
|
7
|
+
var _LocalDatastoreUtils = require("./LocalDatastoreUtils");
|
|
143
8
|
|
|
144
|
-
|
|
145
|
-
}
|
|
9
|
+
var RNStorage = require('./StorageController.react-native');
|
|
146
10
|
|
|
147
|
-
|
|
11
|
+
var LocalDatastoreController = {
|
|
12
|
+
fromPinWithName: function () {
|
|
13
|
+
var _fromPinWithName = (0, _asyncToGenerator2.default)(function* (name) {
|
|
14
|
+
var values = yield RNStorage.getItemAsync(name);
|
|
148
15
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
return new PromiseImpl(function (resolve, reject) {
|
|
152
|
-
invoke(method, arg, resolve, reject);
|
|
153
|
-
});
|
|
16
|
+
if (!values) {
|
|
17
|
+
return [];
|
|
154
18
|
}
|
|
155
19
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
function maybeInvokeDelegate(delegate, context) {
|
|
161
|
-
var method = delegate.iterator[context.method];
|
|
162
|
-
|
|
163
|
-
if (undefined === method) {
|
|
164
|
-
if (context.delegate = null, "throw" === context.method) {
|
|
165
|
-
if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
|
|
166
|
-
context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
|
|
167
|
-
}
|
|
20
|
+
var objects = JSON.parse(values);
|
|
21
|
+
return objects;
|
|
22
|
+
});
|
|
168
23
|
|
|
169
|
-
|
|
24
|
+
function fromPinWithName() {
|
|
25
|
+
return _fromPinWithName.apply(this, arguments);
|
|
170
26
|
}
|
|
171
27
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
};
|
|
182
|
-
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
function resetTryEntry(entry) {
|
|
186
|
-
var record = entry.completion || {};
|
|
187
|
-
record.type = "normal", delete record.arg, entry.completion = record;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
function Context(tryLocsList) {
|
|
191
|
-
this.tryEntries = [{
|
|
192
|
-
tryLoc: "root"
|
|
193
|
-
}], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
function values(iterable) {
|
|
197
|
-
if (iterable) {
|
|
198
|
-
var iteratorMethod = iterable[iteratorSymbol];
|
|
199
|
-
if (iteratorMethod) return iteratorMethod.call(iterable);
|
|
200
|
-
if ("function" == typeof iterable.next) return iterable;
|
|
201
|
-
|
|
202
|
-
if (!isNaN(iterable.length)) {
|
|
203
|
-
var i = -1,
|
|
204
|
-
next = function next() {
|
|
205
|
-
for (; ++i < iterable.length;) {
|
|
206
|
-
if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
return next.value = undefined, next.done = !0, next;
|
|
210
|
-
};
|
|
211
|
-
|
|
212
|
-
return next.next = next;
|
|
28
|
+
return fromPinWithName;
|
|
29
|
+
}(),
|
|
30
|
+
pinWithName: function () {
|
|
31
|
+
var _pinWithName = (0, _asyncToGenerator2.default)(function* (name, value) {
|
|
32
|
+
try {
|
|
33
|
+
var values = JSON.stringify(value);
|
|
34
|
+
yield RNStorage.setItemAsync(name, values);
|
|
35
|
+
} catch (e) {
|
|
36
|
+
console.error(e.message);
|
|
213
37
|
}
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
return {
|
|
217
|
-
next: doneResult
|
|
218
|
-
};
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
function doneResult() {
|
|
222
|
-
return {
|
|
223
|
-
value: undefined,
|
|
224
|
-
done: !0
|
|
225
|
-
};
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
|
|
229
|
-
var ctor = "function" == typeof genFun && genFun.constructor;
|
|
230
|
-
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
|
|
231
|
-
}, exports.mark = function (genFun) {
|
|
232
|
-
return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
|
|
233
|
-
}, exports.awrap = function (arg) {
|
|
234
|
-
return {
|
|
235
|
-
__await: arg
|
|
236
|
-
};
|
|
237
|
-
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
|
|
238
|
-
return this;
|
|
239
|
-
}), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
|
240
|
-
void 0 === PromiseImpl && (PromiseImpl = Promise);
|
|
241
|
-
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
|
|
242
|
-
return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
|
|
243
|
-
return result.done ? result.value : iter.next();
|
|
244
38
|
});
|
|
245
|
-
}, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
|
|
246
|
-
return this;
|
|
247
|
-
}), define(Gp, "toString", function () {
|
|
248
|
-
return "[object Generator]";
|
|
249
|
-
}), exports.keys = function (object) {
|
|
250
|
-
var keys = [];
|
|
251
39
|
|
|
252
|
-
|
|
253
|
-
|
|
40
|
+
function pinWithName() {
|
|
41
|
+
return _pinWithName.apply(this, arguments);
|
|
254
42
|
}
|
|
255
43
|
|
|
256
|
-
return
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
constructor: Context,
|
|
266
|
-
reset: function (skipTempReset) {
|
|
267
|
-
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) {
|
|
268
|
-
"t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
|
|
269
|
-
}
|
|
270
|
-
},
|
|
271
|
-
stop: function () {
|
|
272
|
-
this.done = !0;
|
|
273
|
-
var rootRecord = this.tryEntries[0].completion;
|
|
274
|
-
if ("throw" === rootRecord.type) throw rootRecord.arg;
|
|
275
|
-
return this.rval;
|
|
276
|
-
},
|
|
277
|
-
dispatchException: function (exception) {
|
|
278
|
-
if (this.done) throw exception;
|
|
279
|
-
var context = this;
|
|
280
|
-
|
|
281
|
-
function handle(loc, caught) {
|
|
282
|
-
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
286
|
-
var entry = this.tryEntries[i],
|
|
287
|
-
record = entry.completion;
|
|
288
|
-
if ("root" === entry.tryLoc) return handle("end");
|
|
44
|
+
return pinWithName;
|
|
45
|
+
}(),
|
|
46
|
+
unPinWithName: function (name) {
|
|
47
|
+
return RNStorage.removeItemAsync(name);
|
|
48
|
+
},
|
|
49
|
+
getAllContents: function () {
|
|
50
|
+
var _getAllContents = (0, _asyncToGenerator2.default)(function* () {
|
|
51
|
+
var keys = yield RNStorage.getAllKeysAsync();
|
|
52
|
+
var batch = [];
|
|
289
53
|
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
54
|
+
for (var i = 0; i < keys.length; i += 1) {
|
|
55
|
+
var key = keys[i];
|
|
293
56
|
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
297
|
-
} else if (hasCatch) {
|
|
298
|
-
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
299
|
-
} else {
|
|
300
|
-
if (!hasFinally) throw new Error("try statement without catch or finally");
|
|
301
|
-
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
302
|
-
}
|
|
57
|
+
if ((0, _LocalDatastoreUtils.isLocalDatastoreKey)(key)) {
|
|
58
|
+
batch.push(key);
|
|
303
59
|
}
|
|
304
60
|
}
|
|
305
|
-
},
|
|
306
|
-
abrupt: function (type, arg) {
|
|
307
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
308
|
-
var entry = this.tryEntries[i];
|
|
309
61
|
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
break;
|
|
313
|
-
}
|
|
314
|
-
}
|
|
62
|
+
var LDS = {};
|
|
63
|
+
var results = [];
|
|
315
64
|
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
if ("throw" === record.type) throw record.arg;
|
|
322
|
-
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;
|
|
323
|
-
},
|
|
324
|
-
finish: function (finallyLoc) {
|
|
325
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
326
|
-
var entry = this.tryEntries[i];
|
|
327
|
-
if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
|
|
65
|
+
try {
|
|
66
|
+
results = yield RNStorage.multiGet(batch);
|
|
67
|
+
} catch (error) {
|
|
68
|
+
console.error('Error getAllContents: ', error);
|
|
69
|
+
return {};
|
|
328
70
|
}
|
|
329
|
-
},
|
|
330
|
-
catch: function (tryLoc) {
|
|
331
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
332
|
-
var entry = this.tryEntries[i];
|
|
333
71
|
|
|
334
|
-
|
|
335
|
-
|
|
72
|
+
results.forEach(function (pair) {
|
|
73
|
+
var _pair = (0, _slicedToArray2.default)(pair, 2),
|
|
74
|
+
key = _pair[0],
|
|
75
|
+
value = _pair[1];
|
|
336
76
|
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
return thrown;
|
|
77
|
+
try {
|
|
78
|
+
LDS[key] = JSON.parse(value);
|
|
79
|
+
} catch (error) {
|
|
80
|
+
LDS[key] = null;
|
|
343
81
|
}
|
|
344
|
-
}
|
|
82
|
+
});
|
|
83
|
+
return LDS;
|
|
84
|
+
});
|
|
345
85
|
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
delegateYield: function (iterable, resultName, nextLoc) {
|
|
349
|
-
return this.delegate = {
|
|
350
|
-
iterator: values(iterable),
|
|
351
|
-
resultName: resultName,
|
|
352
|
-
nextLoc: nextLoc
|
|
353
|
-
}, "next" === this.method && (this.arg = undefined), ContinueSentinel;
|
|
86
|
+
function getAllContents() {
|
|
87
|
+
return _getAllContents.apply(this, arguments);
|
|
354
88
|
}
|
|
355
|
-
}, exports;
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
var RNStorage = require('./StorageController.react-native');
|
|
359
|
-
|
|
360
|
-
var LocalDatastoreController = {
|
|
361
|
-
fromPinWithName: function (name) {
|
|
362
|
-
var values, objects;
|
|
363
|
-
return _regeneratorRuntime().async(function (_context) {
|
|
364
|
-
while (1) {
|
|
365
|
-
switch (_context.prev = _context.next) {
|
|
366
|
-
case 0:
|
|
367
|
-
_context.next = 2;
|
|
368
|
-
return _regeneratorRuntime().awrap(RNStorage.getItemAsync(name));
|
|
369
|
-
|
|
370
|
-
case 2:
|
|
371
|
-
values = _context.sent;
|
|
372
|
-
|
|
373
|
-
if (values) {
|
|
374
|
-
_context.next = 5;
|
|
375
|
-
break;
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
return _context.abrupt("return", []);
|
|
379
|
-
|
|
380
|
-
case 5:
|
|
381
|
-
objects = JSON.parse(values);
|
|
382
|
-
return _context.abrupt("return", objects);
|
|
383
|
-
|
|
384
|
-
case 7:
|
|
385
|
-
case "end":
|
|
386
|
-
return _context.stop();
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
}, null, null, null, Promise);
|
|
390
|
-
},
|
|
391
|
-
pinWithName: function (name, value) {
|
|
392
|
-
var values;
|
|
393
|
-
return _regeneratorRuntime().async(function (_context2) {
|
|
394
|
-
while (1) {
|
|
395
|
-
switch (_context2.prev = _context2.next) {
|
|
396
|
-
case 0:
|
|
397
|
-
_context2.prev = 0;
|
|
398
|
-
values = JSON.stringify(value);
|
|
399
|
-
_context2.next = 4;
|
|
400
|
-
return _regeneratorRuntime().awrap(RNStorage.setItemAsync(name, values));
|
|
401
|
-
|
|
402
|
-
case 4:
|
|
403
|
-
_context2.next = 9;
|
|
404
|
-
break;
|
|
405
|
-
|
|
406
|
-
case 6:
|
|
407
|
-
_context2.prev = 6;
|
|
408
|
-
_context2.t0 = _context2["catch"](0);
|
|
409
|
-
console.error(_context2.t0.message);
|
|
410
|
-
|
|
411
|
-
case 9:
|
|
412
|
-
case "end":
|
|
413
|
-
return _context2.stop();
|
|
414
|
-
}
|
|
415
|
-
}
|
|
416
|
-
}, null, null, [[0, 6]], Promise);
|
|
417
|
-
},
|
|
418
|
-
unPinWithName: function (name) {
|
|
419
|
-
return RNStorage.removeItemAsync(name);
|
|
420
|
-
},
|
|
421
|
-
getAllContents: function () {
|
|
422
|
-
var keys, batch, i, key, LDS, results;
|
|
423
|
-
return _regeneratorRuntime().async(function (_context3) {
|
|
424
|
-
while (1) {
|
|
425
|
-
switch (_context3.prev = _context3.next) {
|
|
426
|
-
case 0:
|
|
427
|
-
_context3.next = 2;
|
|
428
|
-
return _regeneratorRuntime().awrap(RNStorage.getAllKeysAsync());
|
|
429
|
-
|
|
430
|
-
case 2:
|
|
431
|
-
keys = _context3.sent;
|
|
432
|
-
batch = [];
|
|
433
|
-
|
|
434
|
-
for (i = 0; i < keys.length; i += 1) {
|
|
435
|
-
key = keys[i];
|
|
436
|
-
|
|
437
|
-
if ((0, _LocalDatastoreUtils.isLocalDatastoreKey)(key)) {
|
|
438
|
-
batch.push(key);
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
LDS = {};
|
|
443
|
-
results = [];
|
|
444
|
-
_context3.prev = 7;
|
|
445
|
-
_context3.next = 10;
|
|
446
|
-
return _regeneratorRuntime().awrap(RNStorage.multiGet(batch));
|
|
447
89
|
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
_context3.next = 17;
|
|
451
|
-
break;
|
|
452
|
-
|
|
453
|
-
case 13:
|
|
454
|
-
_context3.prev = 13;
|
|
455
|
-
_context3.t0 = _context3["catch"](7);
|
|
456
|
-
console.error('Error getAllContents: ', _context3.t0);
|
|
457
|
-
return _context3.abrupt("return", {});
|
|
458
|
-
|
|
459
|
-
case 17:
|
|
460
|
-
results.forEach(function (pair) {
|
|
461
|
-
var _pair = (0, _slicedToArray2.default)(pair, 2),
|
|
462
|
-
key = _pair[0],
|
|
463
|
-
value = _pair[1];
|
|
464
|
-
|
|
465
|
-
try {
|
|
466
|
-
LDS[key] = JSON.parse(value);
|
|
467
|
-
} catch (error) {
|
|
468
|
-
LDS[key] = null;
|
|
469
|
-
}
|
|
470
|
-
});
|
|
471
|
-
return _context3.abrupt("return", LDS);
|
|
472
|
-
|
|
473
|
-
case 19:
|
|
474
|
-
case "end":
|
|
475
|
-
return _context3.stop();
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
|
-
}, null, null, [[7, 13]], Promise);
|
|
479
|
-
},
|
|
90
|
+
return getAllContents;
|
|
91
|
+
}(),
|
|
480
92
|
getRawStorage: function () {
|
|
481
|
-
var
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
93
|
+
var _getRawStorage = (0, _asyncToGenerator2.default)(function* () {
|
|
94
|
+
var keys = yield RNStorage.getAllKeysAsync();
|
|
95
|
+
var storage = {};
|
|
96
|
+
var results = yield RNStorage.multiGet(keys);
|
|
97
|
+
results.map(function (pair) {
|
|
98
|
+
var _pair2 = (0, _slicedToArray2.default)(pair, 2),
|
|
99
|
+
key = _pair2[0],
|
|
100
|
+
value = _pair2[1];
|
|
101
|
+
|
|
102
|
+
storage[key] = value;
|
|
103
|
+
});
|
|
104
|
+
return storage;
|
|
105
|
+
});
|
|
488
106
|
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
_context4.next = 6;
|
|
493
|
-
return _regeneratorRuntime().awrap(RNStorage.multiGet(keys));
|
|
107
|
+
function getRawStorage() {
|
|
108
|
+
return _getRawStorage.apply(this, arguments);
|
|
109
|
+
}
|
|
494
110
|
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
111
|
+
return getRawStorage;
|
|
112
|
+
}(),
|
|
113
|
+
clear: function () {
|
|
114
|
+
var _clear = (0, _asyncToGenerator2.default)(function* () {
|
|
115
|
+
var keys = yield RNStorage.getAllKeysAsync();
|
|
116
|
+
var batch = [];
|
|
501
117
|
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
return _context4.abrupt("return", storage);
|
|
118
|
+
for (var i = 0; i < keys.length; i += 1) {
|
|
119
|
+
var key = keys[i];
|
|
505
120
|
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
return _context4.stop();
|
|
121
|
+
if ((0, _LocalDatastoreUtils.isLocalDatastoreKey)(key)) {
|
|
122
|
+
batch.push(key);
|
|
509
123
|
}
|
|
510
124
|
}
|
|
511
|
-
}, null, null, null, Promise);
|
|
512
|
-
},
|
|
513
|
-
clear: function () {
|
|
514
|
-
var keys, batch, i, key;
|
|
515
|
-
return _regeneratorRuntime().async(function (_context5) {
|
|
516
|
-
while (1) {
|
|
517
|
-
switch (_context5.prev = _context5.next) {
|
|
518
|
-
case 0:
|
|
519
|
-
_context5.next = 2;
|
|
520
|
-
return _regeneratorRuntime().awrap(RNStorage.getAllKeysAsync());
|
|
521
|
-
|
|
522
|
-
case 2:
|
|
523
|
-
keys = _context5.sent;
|
|
524
|
-
batch = [];
|
|
525
125
|
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
batch.push(key);
|
|
531
|
-
}
|
|
532
|
-
}
|
|
126
|
+
return RNStorage.multiRemove(batch).catch(function (error) {
|
|
127
|
+
return console.error('Error clearing local datastore: ', error);
|
|
128
|
+
});
|
|
129
|
+
});
|
|
533
130
|
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
131
|
+
function clear() {
|
|
132
|
+
return _clear.apply(this, arguments);
|
|
133
|
+
}
|
|
537
134
|
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
return _context5.stop();
|
|
541
|
-
}
|
|
542
|
-
}
|
|
543
|
-
}, null, null, null, Promise);
|
|
544
|
-
}
|
|
135
|
+
return clear;
|
|
136
|
+
}()
|
|
545
137
|
};
|
|
546
138
|
module.exports = LocalDatastoreController;
|