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