parse 3.5.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 +20 -7
  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 +18 -134
  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 +73 -302
  92. package/lib/node/ParseConfig.js +16 -91
  93. package/lib/node/ParseError.js +61 -74
  94. package/lib/node/ParseFile.js +55 -244
  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 +234 -997
  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 +19 -169
  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 +37 -30
  255. package/PATENTS +0 -37
@@ -1,17 +1,12 @@
1
1
  "use strict";
2
2
 
3
- var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
4
-
5
- var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
6
-
7
3
  var _typeof = require("@babel/runtime-corejs3/helpers/typeof");
8
-
9
4
  var _WeakMap = require("@babel/runtime-corejs3/core-js-stable/weak-map");
10
-
5
+ var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
6
+ var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
11
7
  _Object$defineProperty(exports, "__esModule", {
12
8
  value: true
13
9
  });
14
-
15
10
  exports.clearAllState = clearAllState;
16
11
  exports.commitServerChanges = commitServerChanges;
17
12
  exports.duplicateState = duplicateState;
@@ -29,9 +24,7 @@ exports.pushPendingState = pushPendingState;
29
24
  exports.removeState = removeState;
30
25
  exports.setPendingOp = setPendingOp;
31
26
  exports.setServerData = setServerData;
32
-
33
27
  var ObjectStateMutations = _interopRequireWildcard(require("./ObjectStateMutations"));
34
-
35
28
  function _getRequireWildcardCache(nodeInterop) {
36
29
  if (typeof _WeakMap !== "function") return null;
37
30
  var cacheBabelInterop = new _WeakMap();
@@ -40,30 +33,23 @@ function _getRequireWildcardCache(nodeInterop) {
40
33
  return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
41
34
  })(nodeInterop);
42
35
  }
43
-
44
36
  function _interopRequireWildcard(obj, nodeInterop) {
45
37
  if (!nodeInterop && obj && obj.__esModule) {
46
38
  return obj;
47
39
  }
48
-
49
40
  if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") {
50
41
  return {
51
42
  default: obj
52
43
  };
53
44
  }
54
-
55
45
  var cache = _getRequireWildcardCache(nodeInterop);
56
-
57
46
  if (cache && cache.has(obj)) {
58
47
  return cache.get(obj);
59
48
  }
60
-
61
49
  var newObj = {};
62
-
63
50
  for (var key in obj) {
64
51
  if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
65
52
  var desc = _Object$defineProperty && _Object$getOwnPropertyDescriptor ? _Object$getOwnPropertyDescriptor(obj, key) : null;
66
-
67
53
  if (desc && (desc.get || desc.set)) {
68
54
  _Object$defineProperty(newObj, key, desc);
69
55
  } else {
@@ -71,224 +57,113 @@ function _interopRequireWildcard(obj, nodeInterop) {
71
57
  }
72
58
  }
73
59
  }
74
-
75
60
  newObj.default = obj;
76
-
77
61
  if (cache) {
78
62
  cache.set(obj, newObj);
79
63
  }
80
-
81
64
  return newObj;
82
65
  }
83
66
  /**
84
- * Copyright (c) 2015-present, Parse, LLC.
85
- * All rights reserved.
86
- *
87
- * This source code is licensed under the BSD-style license found in the
88
- * LICENSE file in the root directory of this source tree. An additional grant
89
- * of patent rights can be found in the PATENTS file in the same directory.
90
- *
91
67
  * @flow
92
68
  */
93
69
 
94
-
95
70
  var objectState
96
71
  /*: {
97
72
  [className: string]: {
98
73
  [id: string]: State,
99
74
  },
100
- }*/
101
- = {};
102
-
103
- function getState(obj
104
- /*: ObjectIdentifier*/
105
- )
106
- /*: ?State*/
107
- {
75
+ }*/ = {};
76
+ function getState(obj /*: ObjectIdentifier*/) /*: ?State*/{
108
77
  var classData = objectState[obj.className];
109
-
110
78
  if (classData) {
111
79
  return classData[obj.id] || null;
112
80
  }
113
-
114
81
  return null;
115
82
  }
116
-
117
- function initializeState(obj
118
- /*: ObjectIdentifier*/
119
- , initial
120
- /*:: ?: State*/
121
- )
122
- /*: State*/
123
- {
83
+ function initializeState(obj /*: ObjectIdentifier*/, initial /*:: ?: State*/) /*: State*/{
124
84
  var state = getState(obj);
125
-
126
85
  if (state) {
127
86
  return state;
128
87
  }
129
-
130
88
  if (!objectState[obj.className]) {
131
89
  objectState[obj.className] = {};
132
90
  }
133
-
134
91
  if (!initial) {
135
92
  initial = ObjectStateMutations.defaultState();
136
93
  }
137
-
138
94
  state = objectState[obj.className][obj.id] = initial;
139
95
  return state;
140
96
  }
141
-
142
- function removeState(obj
143
- /*: ObjectIdentifier*/
144
- )
145
- /*: ?State*/
146
- {
97
+ function removeState(obj /*: ObjectIdentifier*/) /*: ?State*/{
147
98
  var state = getState(obj);
148
-
149
99
  if (state === null) {
150
100
  return null;
151
101
  }
152
-
153
102
  delete objectState[obj.className][obj.id];
154
103
  return state;
155
104
  }
156
-
157
- function getServerData(obj
158
- /*: ObjectIdentifier*/
159
- )
160
- /*: AttributeMap*/
161
- {
105
+ function getServerData(obj /*: ObjectIdentifier*/) /*: AttributeMap*/{
162
106
  var state = getState(obj);
163
-
164
107
  if (state) {
165
108
  return state.serverData;
166
109
  }
167
-
168
110
  return {};
169
111
  }
170
-
171
- function setServerData(obj
172
- /*: ObjectIdentifier*/
173
- , attributes
174
- /*: AttributeMap*/
175
- ) {
112
+ function setServerData(obj /*: ObjectIdentifier*/, attributes /*: AttributeMap*/) {
176
113
  var serverData = initializeState(obj).serverData;
177
114
  ObjectStateMutations.setServerData(serverData, attributes);
178
115
  }
179
-
180
- function getPendingOps(obj
181
- /*: ObjectIdentifier*/
182
- )
183
- /*: Array<OpsMap>*/
184
- {
116
+ function getPendingOps(obj /*: ObjectIdentifier*/) /*: Array<OpsMap>*/{
185
117
  var state = getState(obj);
186
-
187
118
  if (state) {
188
119
  return state.pendingOps;
189
120
  }
190
-
191
121
  return [{}];
192
122
  }
193
-
194
- function setPendingOp(obj
195
- /*: ObjectIdentifier*/
196
- , attr
197
- /*: string*/
198
- , op
199
- /*: ?Op*/
200
- ) {
123
+ function setPendingOp(obj /*: ObjectIdentifier*/, attr /*: string*/, op /*: ?Op*/) {
201
124
  var pendingOps = initializeState(obj).pendingOps;
202
125
  ObjectStateMutations.setPendingOp(pendingOps, attr, op);
203
126
  }
204
-
205
- function pushPendingState(obj
206
- /*: ObjectIdentifier*/
207
- ) {
127
+ function pushPendingState(obj /*: ObjectIdentifier*/) {
208
128
  var pendingOps = initializeState(obj).pendingOps;
209
129
  ObjectStateMutations.pushPendingState(pendingOps);
210
130
  }
211
-
212
- function popPendingState(obj
213
- /*: ObjectIdentifier*/
214
- )
215
- /*: OpsMap*/
216
- {
131
+ function popPendingState(obj /*: ObjectIdentifier*/) /*: OpsMap*/{
217
132
  var pendingOps = initializeState(obj).pendingOps;
218
133
  return ObjectStateMutations.popPendingState(pendingOps);
219
134
  }
220
-
221
- function mergeFirstPendingState(obj
222
- /*: ObjectIdentifier*/
223
- ) {
135
+ function mergeFirstPendingState(obj /*: ObjectIdentifier*/) {
224
136
  var pendingOps = getPendingOps(obj);
225
137
  ObjectStateMutations.mergeFirstPendingState(pendingOps);
226
138
  }
227
-
228
- function getObjectCache(obj
229
- /*: ObjectIdentifier*/
230
- )
231
- /*: ObjectCache*/
232
- {
139
+ function getObjectCache(obj /*: ObjectIdentifier*/) /*: ObjectCache*/{
233
140
  var state = getState(obj);
234
-
235
141
  if (state) {
236
142
  return state.objectCache;
237
143
  }
238
-
239
144
  return {};
240
145
  }
241
-
242
- function estimateAttribute(obj
243
- /*: ObjectIdentifier*/
244
- , attr
245
- /*: string*/
246
- )
247
- /*: mixed*/
248
- {
146
+ function estimateAttribute(obj /*: ObjectIdentifier*/, attr /*: string*/) /*: mixed*/{
249
147
  var serverData = getServerData(obj);
250
148
  var pendingOps = getPendingOps(obj);
251
149
  return ObjectStateMutations.estimateAttribute(serverData, pendingOps, obj.className, obj.id, attr);
252
150
  }
253
-
254
- function estimateAttributes(obj
255
- /*: ObjectIdentifier*/
256
- )
257
- /*: AttributeMap*/
258
- {
151
+ function estimateAttributes(obj /*: ObjectIdentifier*/) /*: AttributeMap*/{
259
152
  var serverData = getServerData(obj);
260
153
  var pendingOps = getPendingOps(obj);
261
154
  return ObjectStateMutations.estimateAttributes(serverData, pendingOps, obj.className, obj.id);
262
155
  }
263
-
264
- function commitServerChanges(obj
265
- /*: ObjectIdentifier*/
266
- , changes
267
- /*: AttributeMap*/
268
- ) {
156
+ function commitServerChanges(obj /*: ObjectIdentifier*/, changes /*: AttributeMap*/) {
269
157
  var state = initializeState(obj);
270
158
  ObjectStateMutations.commitServerChanges(state.serverData, state.objectCache, changes);
271
159
  }
272
-
273
- function enqueueTask(obj
274
- /*: ObjectIdentifier*/
275
- , task
276
- /*: () => Promise*/
277
- )
278
- /*: Promise*/
279
- {
160
+ function enqueueTask(obj /*: ObjectIdentifier*/, task /*: () => Promise*/) /*: Promise*/{
280
161
  var state = initializeState(obj);
281
162
  return state.tasks.enqueue(task);
282
163
  }
283
-
284
164
  function clearAllState() {
285
165
  objectState = {};
286
166
  }
287
-
288
- function duplicateState(source
289
- /*: { id: string }*/
290
- , dest
291
- /*: { id: string }*/
292
- ) {
167
+ function duplicateState(source /*: { id: string }*/, dest /*: { id: string }*/) {
293
168
  dest.id = source.id;
294
169
  }
@@ -1,25 +1,16 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
4
-
5
4
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/classCallCheck"));
6
-
7
5
  var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/createClass"));
8
-
9
6
  module.exports = /*#__PURE__*/function () {
10
7
  function SocketWeapp(serverURL) {
11
8
  var _this = this;
12
-
13
9
  (0, _classCallCheck2.default)(this, SocketWeapp);
14
-
15
10
  this.onopen = function () {};
16
-
17
11
  this.onmessage = function () {};
18
-
19
12
  this.onclose = function () {};
20
-
21
13
  this.onerror = function () {};
22
-
23
14
  wx.onSocketOpen(function () {
24
15
  _this.onopen();
25
16
  });
@@ -36,7 +27,6 @@ module.exports = /*#__PURE__*/function () {
36
27
  url: serverURL
37
28
  });
38
29
  }
39
-
40
30
  (0, _createClass2.default)(SocketWeapp, [{
41
31
  key: "send",
42
32
  value: function (data) {
@@ -1,161 +1,91 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
4
-
5
4
  var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/promise"));
6
-
7
5
  var _CoreManager = _interopRequireDefault(require("./CoreManager"));
8
6
  /**
9
- * Copyright (c) 2015-present, Parse, LLC.
10
- * All rights reserved.
11
- *
12
- * This source code is licensed under the BSD-style license found in the
13
- * LICENSE file in the root directory of this source tree. An additional grant
14
- * of patent rights can be found in the PATENTS file in the same directory.
15
- *
16
7
  * @flow
17
8
  */
18
9
 
19
-
20
10
  var Storage = {
21
- async: function ()
22
- /*: boolean*/
23
- {
11
+ async: function () /*: boolean*/{
24
12
  var controller = _CoreManager.default.getStorageController();
25
-
26
13
  return !!controller.async;
27
14
  },
28
- getItem: function (path
29
- /*: string*/
30
- )
31
- /*: ?string*/
32
- {
15
+ getItem: function (path /*: string*/) /*: ?string*/{
33
16
  var controller = _CoreManager.default.getStorageController();
34
-
35
17
  if (controller.async === 1) {
36
18
  throw new Error('Synchronous storage is not supported by the current storage controller');
37
19
  }
38
-
39
20
  return controller.getItem(path);
40
21
  },
41
- getItemAsync: function (path
42
- /*: string*/
43
- )
44
- /*: Promise<string>*/
45
- {
22
+ getItemAsync: function (path /*: string*/) /*: Promise<string>*/{
46
23
  var controller = _CoreManager.default.getStorageController();
47
-
48
24
  if (controller.async === 1) {
49
25
  return controller.getItemAsync(path);
50
26
  }
51
-
52
27
  return _promise.default.resolve(controller.getItem(path));
53
28
  },
54
- setItem: function (path
55
- /*: string*/
56
- , value
57
- /*: string*/
58
- )
59
- /*: void*/
60
- {
29
+ setItem: function (path /*: string*/, value /*: string*/) /*: void*/{
61
30
  var controller = _CoreManager.default.getStorageController();
62
-
63
31
  if (controller.async === 1) {
64
32
  throw new Error('Synchronous storage is not supported by the current storage controller');
65
33
  }
66
-
67
34
  return controller.setItem(path, value);
68
35
  },
69
- setItemAsync: function (path
70
- /*: string*/
71
- , value
72
- /*: string*/
73
- )
74
- /*: Promise<void>*/
75
- {
36
+ setItemAsync: function (path /*: string*/, value /*: string*/) /*: Promise<void>*/{
76
37
  var controller = _CoreManager.default.getStorageController();
77
-
78
38
  if (controller.async === 1) {
79
39
  return controller.setItemAsync(path, value);
80
40
  }
81
-
82
41
  return _promise.default.resolve(controller.setItem(path, value));
83
42
  },
84
- removeItem: function (path
85
- /*: string*/
86
- )
87
- /*: void*/
88
- {
43
+ removeItem: function (path /*: string*/) /*: void*/{
89
44
  var controller = _CoreManager.default.getStorageController();
90
-
91
45
  if (controller.async === 1) {
92
46
  throw new Error('Synchronous storage is not supported by the current storage controller');
93
47
  }
94
-
95
48
  return controller.removeItem(path);
96
49
  },
97
- removeItemAsync: function (path
98
- /*: string*/
99
- )
100
- /*: Promise<void>*/
101
- {
50
+ removeItemAsync: function (path /*: string*/) /*: Promise<void>*/{
102
51
  var controller = _CoreManager.default.getStorageController();
103
-
104
52
  if (controller.async === 1) {
105
53
  return controller.removeItemAsync(path);
106
54
  }
107
-
108
55
  return _promise.default.resolve(controller.removeItem(path));
109
56
  },
110
- getAllKeys: function ()
111
- /*: Array<string>*/
112
- {
57
+ getAllKeys: function () /*: Array<string>*/{
113
58
  var controller = _CoreManager.default.getStorageController();
114
-
115
59
  if (controller.async === 1) {
116
60
  throw new Error('Synchronous storage is not supported by the current storage controller');
117
61
  }
118
-
119
62
  return controller.getAllKeys();
120
63
  },
121
- getAllKeysAsync: function ()
122
- /*: Promise<Array<string>>*/
123
- {
64
+ getAllKeysAsync: function () /*: Promise<Array<string>>*/{
124
65
  var controller = _CoreManager.default.getStorageController();
125
-
126
66
  if (controller.async === 1) {
127
67
  return controller.getAllKeysAsync();
128
68
  }
129
-
130
69
  return _promise.default.resolve(controller.getAllKeys());
131
70
  },
132
- generatePath: function (path
133
- /*: string*/
134
- )
135
- /*: string*/
136
- {
71
+ generatePath: function (path /*: string*/) /*: string*/{
137
72
  if (!_CoreManager.default.get('APPLICATION_ID')) {
138
73
  throw new Error('You need to call Parse.initialize before using Parse.');
139
74
  }
140
-
141
75
  if (typeof path !== 'string') {
142
76
  throw new Error('Tried to get a Storage path that was not a String.');
143
77
  }
144
-
145
78
  if (path[0] === '/') {
146
79
  path = path.substr(1);
147
80
  }
148
-
149
81
  return 'Parse/' + _CoreManager.default.get('APPLICATION_ID') + '/' + path;
150
82
  },
151
83
  _clear: function () {
152
84
  var controller = _CoreManager.default.getStorageController();
153
-
154
85
  if (controller.hasOwnProperty('clear')) {
155
86
  controller.clear();
156
87
  }
157
88
  }
158
89
  };
159
90
  module.exports = Storage;
160
-
161
91
  _CoreManager.default.setStorageController(require('./StorageController.browser'));
@@ -1,32 +1,16 @@
1
1
  "use strict";
2
+
2
3
  /**
3
- * Copyright (c) 2015-present, Parse, LLC.
4
- * All rights reserved.
5
- *
6
- * This source code is licensed under the BSD-style license found in the
7
- * LICENSE file in the root directory of this source tree. An additional grant
8
- * of patent rights can be found in the PATENTS file in the same directory.
9
- *
10
4
  * @flow
11
5
  * @private
12
6
  */
13
-
14
7
  /* global localStorage */
15
-
16
8
  var StorageController = {
17
9
  async: 0,
18
- getItem: function (path
19
- /*: string*/
20
- )
21
- /*: ?string*/
22
- {
10
+ getItem: function (path /*: string*/) /*: ?string*/{
23
11
  return localStorage.getItem(path);
24
12
  },
25
- setItem: function (path
26
- /*: string*/
27
- , value
28
- /*: string*/
29
- ) {
13
+ setItem: function (path /*: string*/, value /*: string*/) {
30
14
  try {
31
15
  localStorage.setItem(path, value);
32
16
  } catch (e) {
@@ -34,18 +18,14 @@ var StorageController = {
34
18
  console.log(e.message);
35
19
  }
36
20
  },
37
- removeItem: function (path
38
- /*: string*/
39
- ) {
21
+ removeItem: function (path /*: string*/) {
40
22
  localStorage.removeItem(path);
41
23
  },
42
24
  getAllKeys: function () {
43
25
  var keys = [];
44
-
45
26
  for (var i = 0; i < localStorage.length; i += 1) {
46
27
  keys.push(localStorage.key(i));
47
28
  }
48
-
49
29
  return keys;
50
30
  },
51
31
  clear: function () {
@@ -1,46 +1,26 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
4
-
5
4
  var _keys = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/keys"));
6
5
  /**
7
- * Copyright (c) 2015-present, Parse, LLC.
8
- * All rights reserved.
9
- *
10
- * This source code is licensed under the BSD-style license found in the
11
- * LICENSE file in the root directory of this source tree. An additional grant
12
- * of patent rights can be found in the PATENTS file in the same directory.
13
- *
14
6
  * @flow
15
7
  * @private
16
8
  */
17
- // When there is no native storage interface, we default to an in-memory map
18
-
19
9
 
10
+ // When there is no native storage interface, we default to an in-memory map
20
11
  var memMap = {};
21
12
  var StorageController = {
22
13
  async: 0,
23
- getItem: function (path
24
- /*: string*/
25
- )
26
- /*: ?string*/
27
- {
14
+ getItem: function (path /*: string*/) /*: ?string*/{
28
15
  if (memMap.hasOwnProperty(path)) {
29
16
  return memMap[path];
30
17
  }
31
-
32
18
  return null;
33
19
  },
34
- setItem: function (path
35
- /*: string*/
36
- , value
37
- /*: string*/
38
- ) {
20
+ setItem: function (path /*: string*/, value /*: string*/) {
39
21
  memMap[path] = String(value);
40
22
  },
41
- removeItem: function (path
42
- /*: string*/
43
- ) {
23
+ removeItem: function (path /*: string*/) {
44
24
  delete memMap[path];
45
25
  },
46
26
  getAllKeys: function () {
@@ -1,30 +1,16 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
4
-
5
4
  var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/promise"));
6
-
7
5
  var _CoreManager = _interopRequireDefault(require("./CoreManager"));
8
6
  /**
9
- * Copyright (c) 2015-present, Parse, LLC.
10
- * All rights reserved.
11
- *
12
- * This source code is licensed under the BSD-style license found in the
13
- * LICENSE file in the root directory of this source tree. An additional grant
14
- * of patent rights can be found in the PATENTS file in the same directory.
15
- *
16
7
  * @flow
17
8
  * @private
18
9
  */
19
10
 
20
-
21
11
  var StorageController = {
22
12
  async: 1,
23
- getItemAsync: function (path
24
- /*: string*/
25
- )
26
- /*: Promise*/
27
- {
13
+ getItemAsync: function (path /*: string*/) /*: Promise*/{
28
14
  return new _promise.default(function (resolve, reject) {
29
15
  _CoreManager.default.getAsyncStorage().getItem(path, function (err, value) {
30
16
  if (err) {
@@ -35,13 +21,7 @@ var StorageController = {
35
21
  });
36
22
  });
37
23
  },
38
- setItemAsync: function (path
39
- /*: string*/
40
- , value
41
- /*: string*/
42
- )
43
- /*: Promise*/
44
- {
24
+ setItemAsync: function (path /*: string*/, value /*: string*/) /*: Promise*/{
45
25
  return new _promise.default(function (resolve, reject) {
46
26
  _CoreManager.default.getAsyncStorage().setItem(path, value, function (err, value) {
47
27
  if (err) {
@@ -52,11 +32,7 @@ var StorageController = {
52
32
  });
53
33
  });
54
34
  },
55
- removeItemAsync: function (path
56
- /*: string*/
57
- )
58
- /*: Promise*/
59
- {
35
+ removeItemAsync: function (path /*: string*/) /*: Promise*/{
60
36
  return new _promise.default(function (resolve, reject) {
61
37
  _CoreManager.default.getAsyncStorage().removeItem(path, function (err) {
62
38
  if (err) {
@@ -67,9 +43,7 @@ var StorageController = {
67
43
  });
68
44
  });
69
45
  },
70
- getAllKeysAsync: function ()
71
- /*: Promise*/
72
- {
46
+ getAllKeysAsync: function () /*: Promise*/{
73
47
  return new _promise.default(function (resolve, reject) {
74
48
  _CoreManager.default.getAsyncStorage().getAllKeys(function (err, keys) {
75
49
  if (err) {
@@ -80,11 +54,7 @@ var StorageController = {
80
54
  });
81
55
  });
82
56
  },
83
- multiGet: function (keys
84
- /*: Array<string>*/
85
- )
86
- /*: Promise<Array<Array<string>>>*/
87
- {
57
+ multiGet: function (keys /*: Array<string>*/) /*: Promise<Array<Array<string>>>*/{
88
58
  return new _promise.default(function (resolve, reject) {
89
59
  _CoreManager.default.getAsyncStorage().multiGet(keys, function (err, result) {
90
60
  if (err) {
@@ -95,11 +65,7 @@ var StorageController = {
95
65
  });
96
66
  });
97
67
  },
98
- multiRemove: function (keys
99
- /*: Array<string>*/
100
- )
101
- /*: Promise*/
102
- {
68
+ multiRemove: function (keys /*: Array<string>*/) /*: Promise*/{
103
69
  return new _promise.default(function (resolve, reject) {
104
70
  _CoreManager.default.getAsyncStorage().multiRemove(keys, function (err) {
105
71
  if (err) {