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.
Files changed (255) hide show
  1. package/LICENSE +167 -25
  2. package/NOTICE +10 -0
  3. package/README.md +6 -5
  4. package/dist/parse.js +12838 -21190
  5. package/dist/parse.min.js +7 -6
  6. package/dist/parse.weapp.js +7921 -17062
  7. package/dist/parse.weapp.min.js +7 -6
  8. package/lib/browser/Analytics.js +2 -27
  9. package/lib/browser/AnonymousUtils.js +6 -42
  10. package/lib/browser/Cloud.js +12 -77
  11. package/lib/browser/CloudCode.js +0 -3
  12. package/lib/browser/CoreManager.js +46 -191
  13. package/lib/browser/CryptoController.js +2 -16
  14. package/lib/browser/EventEmitter.js +1 -8
  15. package/lib/browser/EventuallyQueue.js +277 -824
  16. package/lib/browser/FacebookUtils.js +6 -42
  17. package/lib/browser/IndexedDBStorageController.js +3 -14
  18. package/lib/browser/InstallationController.js +2 -20
  19. package/lib/browser/LiveQueryClient.js +105 -213
  20. package/lib/browser/LiveQuerySubscription.js +10 -39
  21. package/lib/browser/LocalDatastore.js +451 -1081
  22. package/lib/browser/LocalDatastoreController.js +145 -602
  23. package/lib/browser/LocalDatastoreController.react-native.js +137 -573
  24. package/lib/browser/LocalDatastoreUtils.js +2 -19
  25. package/lib/browser/ObjectStateMutations.js +18 -121
  26. package/lib/browser/OfflineQuery.js +61 -222
  27. package/lib/browser/Parse.js +12 -115
  28. package/lib/browser/ParseACL.js +33 -148
  29. package/lib/browser/ParseCLP.js +96 -314
  30. package/lib/browser/ParseConfig.js +18 -95
  31. package/lib/browser/ParseError.js +63 -99
  32. package/lib/browser/ParseFile.js +128 -685
  33. package/lib/browser/ParseGeoPoint.js +23 -89
  34. package/lib/browser/ParseHooks.js +1 -34
  35. package/lib/browser/ParseInstallation.js +4 -32
  36. package/lib/browser/ParseLiveQuery.js +96 -505
  37. package/lib/browser/ParseObject.js +665 -1845
  38. package/lib/browser/ParseOp.js +41 -287
  39. package/lib/browser/ParsePolygon.js +13 -70
  40. package/lib/browser/ParseQuery.js +403 -1504
  41. package/lib/browser/ParseRelation.js +12 -68
  42. package/lib/browser/ParseRole.js +13 -75
  43. package/lib/browser/ParseSchema.js +49 -208
  44. package/lib/browser/ParseSession.js +11 -69
  45. package/lib/browser/ParseUser.js +274 -1127
  46. package/lib/browser/Push.js +7 -50
  47. package/lib/browser/RESTController.js +28 -157
  48. package/lib/browser/SingleInstanceStateController.js +19 -144
  49. package/lib/browser/Socket.weapp.js +0 -10
  50. package/lib/browser/Storage.js +10 -80
  51. package/lib/browser/StorageController.browser.js +4 -24
  52. package/lib/browser/StorageController.default.js +4 -24
  53. package/lib/browser/StorageController.react-native.js +6 -40
  54. package/lib/browser/StorageController.weapp.js +5 -23
  55. package/lib/browser/TaskQueue.js +1 -29
  56. package/lib/browser/UniqueInstanceStateController.js +19 -149
  57. package/lib/browser/Xhr.weapp.js +0 -17
  58. package/lib/browser/arrayContainsObject.js +2 -23
  59. package/lib/browser/canBeSerialized.js +3 -40
  60. package/lib/browser/decode.js +3 -40
  61. package/lib/browser/encode.js +9 -77
  62. package/lib/browser/equals.js +2 -34
  63. package/lib/browser/escape.js +1 -15
  64. package/lib/browser/isRevocableSession.js +2 -18
  65. package/lib/browser/parseDate.js +2 -20
  66. package/lib/browser/promiseUtils.js +3 -21
  67. package/lib/browser/unique.js +3 -24
  68. package/lib/browser/unsavedChildren.js +6 -57
  69. package/lib/browser/uuid.js +3 -1
  70. package/lib/node/Analytics.js +1 -25
  71. package/lib/node/AnonymousUtils.js +5 -44
  72. package/lib/node/Cloud.js +10 -73
  73. package/lib/node/CloudCode.js +0 -3
  74. package/lib/node/CoreManager.js +47 -227
  75. package/lib/node/CryptoController.js +2 -16
  76. package/lib/node/EventEmitter.js +1 -8
  77. package/lib/node/EventuallyQueue.js +16 -123
  78. package/lib/node/FacebookUtils.js +5 -44
  79. package/lib/node/IndexedDBStorageController.js +3 -19
  80. package/lib/node/InstallationController.js +2 -22
  81. package/lib/node/LiveQueryClient.js +72 -154
  82. package/lib/node/LiveQuerySubscription.js +7 -26
  83. package/lib/node/LocalDatastore.js +19 -182
  84. package/lib/node/LocalDatastoreController.js +6 -45
  85. package/lib/node/LocalDatastoreController.react-native.js +6 -52
  86. package/lib/node/LocalDatastoreUtils.js +1 -13
  87. package/lib/node/ObjectStateMutations.js +13 -100
  88. package/lib/node/OfflineQuery.js +27 -151
  89. package/lib/node/Parse.js +11 -108
  90. package/lib/node/ParseACL.js +32 -157
  91. package/lib/node/ParseCLP.js +69 -269
  92. package/lib/node/ParseConfig.js +16 -91
  93. package/lib/node/ParseError.js +61 -74
  94. package/lib/node/ParseFile.js +49 -212
  95. package/lib/node/ParseGeoPoint.js +21 -89
  96. package/lib/node/ParseHooks.js +0 -35
  97. package/lib/node/ParseInstallation.js +1 -17
  98. package/lib/node/ParseLiveQuery.js +10 -43
  99. package/lib/node/ParseObject.js +229 -964
  100. package/lib/node/ParseOp.js +31 -262
  101. package/lib/node/ParsePolygon.js +12 -69
  102. package/lib/node/ParseQuery.js +169 -888
  103. package/lib/node/ParseRelation.js +11 -68
  104. package/lib/node/ParseRole.js +10 -64
  105. package/lib/node/ParseSchema.js +46 -229
  106. package/lib/node/ParseSession.js +8 -57
  107. package/lib/node/ParseUser.js +107 -583
  108. package/lib/node/Push.js +4 -44
  109. package/lib/node/RESTController.js +18 -127
  110. package/lib/node/SingleInstanceStateController.js +17 -137
  111. package/lib/node/Socket.weapp.js +0 -7
  112. package/lib/node/Storage.js +10 -90
  113. package/lib/node/StorageController.browser.js +4 -30
  114. package/lib/node/StorageController.default.js +5 -28
  115. package/lib/node/StorageController.react-native.js +6 -47
  116. package/lib/node/StorageController.weapp.js +6 -28
  117. package/lib/node/TaskQueue.js +1 -24
  118. package/lib/node/UniqueInstanceStateController.js +16 -140
  119. package/lib/node/Xhr.weapp.js +0 -15
  120. package/lib/node/arrayContainsObject.js +1 -19
  121. package/lib/node/canBeSerialized.js +2 -35
  122. package/lib/node/decode.js +1 -33
  123. package/lib/node/encode.js +3 -61
  124. package/lib/node/equals.js +0 -27
  125. package/lib/node/escape.js +1 -13
  126. package/lib/node/isRevocableSession.js +1 -12
  127. package/lib/node/parseDate.js +1 -14
  128. package/lib/node/promiseUtils.js +2 -14
  129. package/lib/node/unique.js +1 -18
  130. package/lib/node/unsavedChildren.js +2 -45
  131. package/lib/node/uuid.js +6 -1
  132. package/lib/react-native/Analytics.js +0 -9
  133. package/lib/react-native/AnonymousUtils.js +0 -10
  134. package/lib/react-native/Cloud.js +0 -26
  135. package/lib/react-native/CoreManager.js +2 -6
  136. package/lib/react-native/CryptoController.js +0 -2
  137. package/lib/react-native/EventEmitter.js +0 -2
  138. package/lib/react-native/EventuallyQueue.js +156 -711
  139. package/lib/react-native/FacebookUtils.js +0 -22
  140. package/lib/react-native/IndexedDBStorageController.js +0 -1
  141. package/lib/react-native/InstallationController.js +0 -6
  142. package/lib/react-native/LiveQueryClient.js +46 -157
  143. package/lib/react-native/LiveQuerySubscription.js +3 -27
  144. package/lib/react-native/LocalDatastore.js +281 -948
  145. package/lib/react-native/LocalDatastoreController.js +71 -552
  146. package/lib/react-native/LocalDatastoreController.react-native.js +91 -526
  147. package/lib/react-native/LocalDatastoreUtils.js +0 -1
  148. package/lib/react-native/ObjectStateMutations.js +2 -65
  149. package/lib/react-native/OfflineQuery.js +25 -196
  150. package/lib/react-native/Parse.js +0 -65
  151. package/lib/react-native/ParseACL.js +0 -44
  152. package/lib/react-native/ParseCLP.js +23 -161
  153. package/lib/react-native/ParseConfig.js +0 -42
  154. package/lib/react-native/ParseError.js +1 -21
  155. package/lib/react-native/ParseFile.js +55 -529
  156. package/lib/react-native/ParseGeoPoint.js +0 -17
  157. package/lib/react-native/ParseHooks.js +0 -30
  158. package/lib/react-native/ParseInstallation.js +1 -23
  159. package/lib/react-native/ParseLiveQuery.js +55 -472
  160. package/lib/react-native/ParseObject.js +245 -1246
  161. package/lib/react-native/ParseOp.js +1 -138
  162. package/lib/react-native/ParsePolygon.js +0 -24
  163. package/lib/react-native/ParseQuery.js +182 -874
  164. package/lib/react-native/ParseRelation.js +0 -25
  165. package/lib/react-native/ParseRole.js +1 -36
  166. package/lib/react-native/ParseSchema.js +3 -54
  167. package/lib/react-native/ParseSession.js +1 -40
  168. package/lib/react-native/ParseUser.js +95 -773
  169. package/lib/react-native/Push.js +0 -16
  170. package/lib/react-native/RESTController.js +12 -109
  171. package/lib/react-native/SingleInstanceStateController.js +0 -44
  172. package/lib/react-native/Socket.weapp.js +0 -10
  173. package/lib/react-native/Storage.js +0 -24
  174. package/lib/react-native/StorageController.browser.js +0 -2
  175. package/lib/react-native/StorageController.default.js +0 -1
  176. package/lib/react-native/StorageController.react-native.js +0 -2
  177. package/lib/react-native/TaskQueue.js +0 -15
  178. package/lib/react-native/UniqueInstanceStateController.js +0 -47
  179. package/lib/react-native/Xhr.weapp.js +0 -16
  180. package/lib/react-native/arrayContainsObject.js +0 -5
  181. package/lib/react-native/canBeSerialized.js +0 -18
  182. package/lib/react-native/decode.js +0 -21
  183. package/lib/react-native/encode.js +0 -25
  184. package/lib/react-native/equals.js +0 -18
  185. package/lib/react-native/escape.js +0 -1
  186. package/lib/react-native/isRevocableSession.js +0 -1
  187. package/lib/react-native/parseDate.js +0 -3
  188. package/lib/react-native/promiseUtils.js +0 -13
  189. package/lib/react-native/unique.js +0 -4
  190. package/lib/react-native/unsavedChildren.js +0 -21
  191. package/lib/react-native/uuid.js +3 -1
  192. package/lib/weapp/Analytics.js +2 -27
  193. package/lib/weapp/AnonymousUtils.js +6 -42
  194. package/lib/weapp/Cloud.js +12 -77
  195. package/lib/weapp/CloudCode.js +0 -3
  196. package/lib/weapp/CoreManager.js +46 -191
  197. package/lib/weapp/CryptoController.js +2 -16
  198. package/lib/weapp/EventEmitter.js +1 -8
  199. package/lib/weapp/EventuallyQueue.js +277 -824
  200. package/lib/weapp/FacebookUtils.js +6 -42
  201. package/lib/weapp/IndexedDBStorageController.js +3 -14
  202. package/lib/weapp/InstallationController.js +2 -20
  203. package/lib/weapp/LiveQueryClient.js +105 -213
  204. package/lib/weapp/LiveQuerySubscription.js +10 -39
  205. package/lib/weapp/LocalDatastore.js +451 -1081
  206. package/lib/weapp/LocalDatastoreController.js +145 -602
  207. package/lib/weapp/LocalDatastoreController.react-native.js +137 -573
  208. package/lib/weapp/LocalDatastoreUtils.js +2 -19
  209. package/lib/weapp/ObjectStateMutations.js +18 -121
  210. package/lib/weapp/OfflineQuery.js +61 -222
  211. package/lib/weapp/Parse.js +12 -115
  212. package/lib/weapp/ParseACL.js +33 -148
  213. package/lib/weapp/ParseCLP.js +96 -314
  214. package/lib/weapp/ParseConfig.js +18 -95
  215. package/lib/weapp/ParseError.js +63 -99
  216. package/lib/weapp/ParseFile.js +129 -686
  217. package/lib/weapp/ParseGeoPoint.js +23 -89
  218. package/lib/weapp/ParseHooks.js +1 -34
  219. package/lib/weapp/ParseInstallation.js +4 -32
  220. package/lib/weapp/ParseLiveQuery.js +96 -505
  221. package/lib/weapp/ParseObject.js +665 -1845
  222. package/lib/weapp/ParseOp.js +41 -287
  223. package/lib/weapp/ParsePolygon.js +13 -70
  224. package/lib/weapp/ParseQuery.js +403 -1504
  225. package/lib/weapp/ParseRelation.js +12 -68
  226. package/lib/weapp/ParseRole.js +13 -75
  227. package/lib/weapp/ParseSchema.js +49 -208
  228. package/lib/weapp/ParseSession.js +11 -69
  229. package/lib/weapp/ParseUser.js +274 -1127
  230. package/lib/weapp/Push.js +7 -50
  231. package/lib/weapp/RESTController.js +28 -157
  232. package/lib/weapp/SingleInstanceStateController.js +19 -144
  233. package/lib/weapp/Socket.weapp.js +0 -10
  234. package/lib/weapp/Storage.js +10 -80
  235. package/lib/weapp/StorageController.browser.js +4 -24
  236. package/lib/weapp/StorageController.default.js +4 -24
  237. package/lib/weapp/StorageController.react-native.js +6 -40
  238. package/lib/weapp/StorageController.weapp.js +5 -23
  239. package/lib/weapp/TaskQueue.js +1 -29
  240. package/lib/weapp/UniqueInstanceStateController.js +19 -149
  241. package/lib/weapp/Xhr.weapp.js +0 -17
  242. package/lib/weapp/arrayContainsObject.js +2 -23
  243. package/lib/weapp/canBeSerialized.js +3 -40
  244. package/lib/weapp/decode.js +3 -40
  245. package/lib/weapp/encode.js +9 -77
  246. package/lib/weapp/equals.js +2 -34
  247. package/lib/weapp/escape.js +1 -15
  248. package/lib/weapp/isRevocableSession.js +2 -18
  249. package/lib/weapp/parseDate.js +2 -20
  250. package/lib/weapp/promiseUtils.js +3 -21
  251. package/lib/weapp/unique.js +3 -24
  252. package/lib/weapp/unsavedChildren.js +6 -57
  253. package/lib/weapp/uuid.js +1 -6
  254. package/package.json +34 -30
  255. package/PATENTS +0 -37
@@ -1,431 +1,22 @@
1
1
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
2
-
2
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
3
3
  var _LocalDatastoreUtils = require("./LocalDatastoreUtils");
4
-
5
4
  var _Storage = _interopRequireDefault(require("./Storage"));
6
-
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
- };
251
-
252
- return next.next = next;
5
+ var LocalDatastoreController = {
6
+ fromPinWithName: function () {
7
+ var _fromPinWithName = (0, _asyncToGenerator2.default)(function* (name) {
8
+ var values = yield _Storage.default.getItemAsync(name);
9
+ if (!values) {
10
+ return [];
253
11
  }
254
- }
255
-
256
- return {
257
- next: doneResult
258
- };
259
- }
260
-
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();
12
+ var objects = JSON.parse(values);
13
+ return objects;
284
14
  });
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);
15
+ function fromPinWithName() {
16
+ return _fromPinWithName.apply(this, arguments);
294
17
  }
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
-
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;
394
- }
395
- }, exports;
396
- }
397
-
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
- },
18
+ return fromPinWithName;
19
+ }(),
429
20
  pinWithName: function (name, value) {
430
21
  var values = JSON.stringify(value);
431
22
  return _Storage.default.setItemAsync(name, values);
@@ -434,139 +25,67 @@ var LocalDatastoreController = {
434
25
  return _Storage.default.removeItemAsync(name);
435
26
  },
436
27
  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;
469
-
470
- try {
471
- LDS[key] = JSON.parse(value);
472
- } catch (error) {
473
- console.error('Error getAllContents: ', error);
474
- }
475
-
476
- case 8:
477
- return _context2.abrupt("return", LDS);
478
-
479
- case 9:
480
- case "end":
481
- return _context2.stop();
482
- }
483
- }
484
- }, null, null, null, Promise);
485
- }, Promise.resolve({})));
486
-
487
- case 4:
488
- case "end":
489
- return _context3.stop();
490
- }
491
- }
492
- }, null, null, null, Promise);
493
- },
28
+ var _getAllContents = (0, _asyncToGenerator2.default)(function* () {
29
+ var keys = yield _Storage.default.getAllKeysAsync();
30
+ return keys.reduce(function () {
31
+ var _ref = (0, _asyncToGenerator2.default)(function* (previousPromise, key) {
32
+ var LDS = yield previousPromise;
33
+ if ((0, _LocalDatastoreUtils.isLocalDatastoreKey)(key)) {
34
+ var value = yield _Storage.default.getItemAsync(key);
35
+ try {
36
+ LDS[key] = JSON.parse(value);
37
+ } catch (error) {
38
+ console.error('Error getAllContents: ', error);
39
+ }
40
+ }
41
+ return LDS;
42
+ });
43
+ return function () {
44
+ return _ref.apply(this, arguments);
45
+ };
46
+ }(), Promise.resolve({}));
47
+ });
48
+ function getAllContents() {
49
+ return _getAllContents.apply(this, arguments);
50
+ }
51
+ return getAllContents;
52
+ }(),
494
53
  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);
513
-
514
- case 2:
515
- LDS = _context4.sent;
516
- _context4.next = 5;
517
- return _regeneratorRuntime().awrap(_Storage.default.getItemAsync(key));
518
-
519
- case 5:
520
- value = _context4.sent;
521
- LDS[key] = value;
522
- return _context4.abrupt("return", LDS);
523
-
524
- case 8:
525
- case "end":
526
- return _context4.stop();
527
- }
528
- }
529
- }, null, null, null, Promise);
530
- }, Promise.resolve({})));
531
-
532
- case 4:
533
- case "end":
534
- return _context5.stop();
535
- }
536
- }
537
- }, null, null, null, Promise);
538
- },
54
+ var _getRawStorage = (0, _asyncToGenerator2.default)(function* () {
55
+ var keys = yield _Storage.default.getAllKeysAsync();
56
+ return keys.reduce(function () {
57
+ var _ref2 = (0, _asyncToGenerator2.default)(function* (previousPromise, key) {
58
+ var LDS = yield previousPromise;
59
+ var value = yield _Storage.default.getItemAsync(key);
60
+ LDS[key] = value;
61
+ return LDS;
62
+ });
63
+ return function () {
64
+ return _ref2.apply(this, arguments);
65
+ };
66
+ }(), Promise.resolve({}));
67
+ });
68
+ function getRawStorage() {
69
+ return _getRawStorage.apply(this, arguments);
70
+ }
71
+ return getRawStorage;
72
+ }(),
539
73
  clear: function () {
540
- var keys, toRemove, _iterator, _step, key, promises;
541
-
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
- }
560
-
561
- promises = toRemove.map(this.unPinWithName);
562
- return _context6.abrupt("return", Promise.all(promises));
563
-
564
- case 7:
565
- case "end":
566
- return _context6.stop();
74
+ var _clear = (0, _asyncToGenerator2.default)(function* () {
75
+ var keys = yield _Storage.default.getAllKeysAsync();
76
+ var toRemove = [];
77
+ for (var key of keys) {
78
+ if ((0, _LocalDatastoreUtils.isLocalDatastoreKey)(key)) {
79
+ toRemove.push(key);
567
80
  }
568
81
  }
569
- }, null, this, null, Promise);
570
- }
82
+ var promises = toRemove.map(this.unPinWithName);
83
+ return Promise.all(promises);
84
+ });
85
+ function clear() {
86
+ return _clear.apply(this, arguments);
87
+ }
88
+ return clear;
89
+ }()
571
90
  };
572
91
  module.exports = LocalDatastoreController;