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,35 +1,19 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
4
-
5
3
  var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
6
-
4
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
7
5
  _Object$defineProperty(exports, "__esModule", {
8
6
  value: true
9
7
  });
10
-
11
8
  exports.default = void 0;
12
-
13
- var _typeof2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/typeof"));
14
-
15
9
  var _isArray = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/array/is-array"));
16
-
10
+ var _typeof2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/typeof"));
17
11
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/classCallCheck"));
18
-
19
12
  var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/createClass"));
20
-
21
13
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
22
14
  /**
23
- * Copyright (c) 2015-present, Parse, LLC.
24
- * All rights reserved.
25
- *
26
- * This source code is licensed under the BSD-style license found in the
27
- * LICENSE file in the root directory of this source tree. An additional grant
28
- * of patent rights can be found in the PATENTS file in the same directory.
29
- *
30
15
  * @flow
31
16
  */
32
-
33
17
  /**
34
18
  * Creates a new GeoPoint with any of the following forms:<br>
35
19
  * <pre>
@@ -53,37 +37,26 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/he
53
37
  *
54
38
  * @alias Parse.GeoPoint
55
39
  */
56
-
57
40
  /* global navigator */
58
-
59
-
60
41
  var ParseGeoPoint = /*#__PURE__*/function () {
61
42
  /**
62
43
  * @param {(number[] | object | number)} arg1 Either a list of coordinate pairs, an object with `latitude`, `longitude`, or the latitude or the point.
63
44
  * @param {number} arg2 The longitude of the GeoPoint
64
45
  */
65
- function ParseGeoPoint(arg1
66
- /*: Array<number> | { latitude: number, longitude: number } | number*/
67
- , arg2
68
- /*:: ?: number*/
69
- ) {
46
+ function ParseGeoPoint(arg1 /*: Array<number> | { latitude: number, longitude: number } | number*/, arg2 /*:: ?: number*/) {
70
47
  (0, _classCallCheck2.default)(this, ParseGeoPoint);
71
48
  (0, _defineProperty2.default)(this, "_latitude", void 0);
72
49
  (0, _defineProperty2.default)(this, "_longitude", void 0);
73
-
74
50
  if ((0, _isArray.default)(arg1)) {
75
51
  ParseGeoPoint._validate(arg1[0], arg1[1]);
76
-
77
52
  this._latitude = arg1[0];
78
53
  this._longitude = arg1[1];
79
54
  } else if ((0, _typeof2.default)(arg1) === 'object') {
80
55
  ParseGeoPoint._validate(arg1.latitude, arg1.longitude);
81
-
82
56
  this._latitude = arg1.latitude;
83
57
  this._longitude = arg1.longitude;
84
58
  } else if (arg1 !== undefined && arg2 !== undefined) {
85
59
  ParseGeoPoint._validate(arg1, arg2);
86
-
87
60
  this._latitude = arg1;
88
61
  this._longitude = arg2;
89
62
  } else {
@@ -91,6 +64,7 @@ var ParseGeoPoint = /*#__PURE__*/function () {
91
64
  this._longitude = 0;
92
65
  }
93
66
  }
67
+
94
68
  /**
95
69
  * North-south portion of the coordinate, in range [-90, 90].
96
70
  * Throws an exception if set out of range in a modern browser.
@@ -98,22 +72,16 @@ var ParseGeoPoint = /*#__PURE__*/function () {
98
72
  * @property {number} latitude
99
73
  * @returns {number}
100
74
  */
101
-
102
-
103
75
  (0, _createClass2.default)(ParseGeoPoint, [{
104
76
  key: "latitude",
105
- get: function ()
106
- /*: number*/
107
- {
77
+ get: function () /*: number*/{
108
78
  return this._latitude;
109
79
  },
110
- set: function (val
111
- /*: number*/
112
- ) {
80
+ set: function (val /*: number*/) {
113
81
  ParseGeoPoint._validate(val, this.longitude);
114
-
115
82
  this._latitude = val;
116
83
  }
84
+
117
85
  /**
118
86
  * East-west portion of the coordinate, in range [-180, 180].
119
87
  * Throws if set out of range in a modern browser.
@@ -121,34 +89,25 @@ var ParseGeoPoint = /*#__PURE__*/function () {
121
89
  * @property {number} longitude
122
90
  * @returns {number}
123
91
  */
124
-
125
92
  }, {
126
93
  key: "longitude",
127
- get: function ()
128
- /*: number*/
129
- {
94
+ get: function () /*: number*/{
130
95
  return this._longitude;
131
96
  },
132
- set: function (val
133
- /*: number*/
134
- ) {
97
+ set: function (val /*: number*/) {
135
98
  ParseGeoPoint._validate(this.latitude, val);
136
-
137
99
  this._longitude = val;
138
100
  }
101
+
139
102
  /**
140
103
  * Returns a JSON representation of the GeoPoint, suitable for Parse.
141
104
  *
142
105
  * @returns {object}
143
106
  */
144
-
145
107
  }, {
146
108
  key: "toJSON",
147
- value: function ()
148
- /*: { __type: string, latitude: number, longitude: number }*/
149
- {
109
+ value: function () /*: { __type: string, latitude: number, longitude: number }*/{
150
110
  ParseGeoPoint._validate(this._latitude, this._longitude);
151
-
152
111
  return {
153
112
  __type: 'GeoPoint',
154
113
  latitude: this._latitude,
@@ -157,109 +116,85 @@ var ParseGeoPoint = /*#__PURE__*/function () {
157
116
  }
158
117
  }, {
159
118
  key: "equals",
160
- value: function (other
161
- /*: mixed*/
162
- )
163
- /*: boolean*/
164
- {
119
+ value: function (other /*: mixed*/) /*: boolean*/{
165
120
  return other instanceof ParseGeoPoint && this.latitude === other.latitude && this.longitude === other.longitude;
166
121
  }
122
+
167
123
  /**
168
124
  * Returns the distance from this GeoPoint to another in radians.
169
125
  *
170
126
  * @param {Parse.GeoPoint} point the other Parse.GeoPoint.
171
127
  * @returns {number}
172
128
  */
173
-
174
129
  }, {
175
130
  key: "radiansTo",
176
- value: function (point
177
- /*: ParseGeoPoint*/
178
- )
179
- /*: number*/
180
- {
131
+ value: function (point /*: ParseGeoPoint*/) /*: number*/{
181
132
  var d2r = Math.PI / 180.0;
182
133
  var lat1rad = this.latitude * d2r;
183
134
  var long1rad = this.longitude * d2r;
184
135
  var lat2rad = point.latitude * d2r;
185
136
  var long2rad = point.longitude * d2r;
186
137
  var sinDeltaLatDiv2 = Math.sin((lat1rad - lat2rad) / 2);
187
- var sinDeltaLongDiv2 = Math.sin((long1rad - long2rad) / 2); // Square of half the straight line chord distance between both points.
188
-
138
+ var sinDeltaLongDiv2 = Math.sin((long1rad - long2rad) / 2);
139
+ // Square of half the straight line chord distance between both points.
189
140
  var a = sinDeltaLatDiv2 * sinDeltaLatDiv2 + Math.cos(lat1rad) * Math.cos(lat2rad) * sinDeltaLongDiv2 * sinDeltaLongDiv2;
190
141
  a = Math.min(1.0, a);
191
142
  return 2 * Math.asin(Math.sqrt(a));
192
143
  }
144
+
193
145
  /**
194
146
  * Returns the distance from this GeoPoint to another in kilometers.
195
147
  *
196
148
  * @param {Parse.GeoPoint} point the other Parse.GeoPoint.
197
149
  * @returns {number}
198
150
  */
199
-
200
151
  }, {
201
152
  key: "kilometersTo",
202
- value: function (point
203
- /*: ParseGeoPoint*/
204
- )
205
- /*: number*/
206
- {
153
+ value: function (point /*: ParseGeoPoint*/) /*: number*/{
207
154
  return this.radiansTo(point) * 6371.0;
208
155
  }
156
+
209
157
  /**
210
158
  * Returns the distance from this GeoPoint to another in miles.
211
159
  *
212
160
  * @param {Parse.GeoPoint} point the other Parse.GeoPoint.
213
161
  * @returns {number}
214
162
  */
215
-
216
163
  }, {
217
164
  key: "milesTo",
218
- value: function (point
219
- /*: ParseGeoPoint*/
220
- )
221
- /*: number*/
222
- {
165
+ value: function (point /*: ParseGeoPoint*/) /*: number*/{
223
166
  return this.radiansTo(point) * 3958.8;
224
167
  }
168
+
225
169
  /*
226
170
  * Throws an exception if the given lat-long is out of bounds.
227
171
  */
228
-
229
172
  }], [{
230
173
  key: "_validate",
231
- value: function (latitude
232
- /*: number*/
233
- , longitude
234
- /*: number*/
235
- ) {
174
+ value: function (latitude /*: number*/, longitude /*: number*/) {
236
175
  if (isNaN(latitude) || isNaN(longitude) || typeof latitude !== 'number' || typeof longitude !== 'number') {
237
176
  throw new TypeError('GeoPoint latitude and longitude must be valid numbers');
238
177
  }
239
-
240
178
  if (latitude < -90.0) {
241
179
  throw new TypeError('GeoPoint latitude out of bounds: ' + latitude + ' < -90.0.');
242
180
  }
243
-
244
181
  if (latitude > 90.0) {
245
182
  throw new TypeError('GeoPoint latitude out of bounds: ' + latitude + ' > 90.0.');
246
183
  }
247
-
248
184
  if (longitude < -180.0) {
249
185
  throw new TypeError('GeoPoint longitude out of bounds: ' + longitude + ' < -180.0.');
250
186
  }
251
-
252
187
  if (longitude > 180.0) {
253
188
  throw new TypeError('GeoPoint longitude out of bounds: ' + longitude + ' > 180.0.');
254
189
  }
255
190
  }
191
+
256
192
  /**
257
193
  * Creates a GeoPoint with the user's current location, if available.
258
194
  *
259
195
  * @static
260
196
  * @returns {Parse.GeoPoint} User's current location
261
197
  */
262
-
263
198
  }, {
264
199
  key: "current",
265
200
  value: function () {
@@ -270,6 +205,5 @@ var ParseGeoPoint = /*#__PURE__*/function () {
270
205
  }]);
271
206
  return ParseGeoPoint;
272
207
  }();
273
-
274
208
  var _default = ParseGeoPoint;
275
209
  exports.default = _default;
@@ -1,13 +1,10 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
4
-
5
3
  var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
6
-
4
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
7
5
  _Object$defineProperty(exports, "__esModule", {
8
6
  value: true
9
7
  });
10
-
11
8
  exports.create = create;
12
9
  exports.createFunction = createFunction;
13
10
  exports.createTrigger = createTrigger;
@@ -21,38 +18,28 @@ exports.removeTrigger = removeTrigger;
21
18
  exports.update = update;
22
19
  exports.updateFunction = updateFunction;
23
20
  exports.updateTrigger = updateTrigger;
24
-
25
21
  var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/promise"));
26
-
27
22
  var _CoreManager = _interopRequireDefault(require("./CoreManager"));
28
-
29
23
  var _decode = _interopRequireDefault(require("./decode"));
30
-
31
24
  var _ParseError = _interopRequireDefault(require("./ParseError"));
32
-
33
25
  function getFunctions() {
34
26
  return _CoreManager.default.getHooksController().get('functions');
35
27
  }
36
-
37
28
  function getTriggers() {
38
29
  return _CoreManager.default.getHooksController().get('triggers');
39
30
  }
40
-
41
31
  function getFunction(name) {
42
32
  return _CoreManager.default.getHooksController().get('functions', name);
43
33
  }
44
-
45
34
  function getTrigger(className, triggerName) {
46
35
  return _CoreManager.default.getHooksController().get('triggers', className, triggerName);
47
36
  }
48
-
49
37
  function createFunction(functionName, url) {
50
38
  return create({
51
39
  functionName: functionName,
52
40
  url: url
53
41
  });
54
42
  }
55
-
56
43
  function createTrigger(className, triggerName, url) {
57
44
  return create({
58
45
  className: className,
@@ -60,18 +47,15 @@ function createTrigger(className, triggerName, url) {
60
47
  url: url
61
48
  });
62
49
  }
63
-
64
50
  function create(hook) {
65
51
  return _CoreManager.default.getHooksController().create(hook);
66
52
  }
67
-
68
53
  function updateFunction(functionName, url) {
69
54
  return update({
70
55
  functionName: functionName,
71
56
  url: url
72
57
  });
73
58
  }
74
-
75
59
  function updateTrigger(className, triggerName, url) {
76
60
  return update({
77
61
  className: className,
@@ -79,45 +63,36 @@ function updateTrigger(className, triggerName, url) {
79
63
  url: url
80
64
  });
81
65
  }
82
-
83
66
  function update(hook) {
84
67
  return _CoreManager.default.getHooksController().update(hook);
85
68
  }
86
-
87
69
  function removeFunction(functionName) {
88
70
  return remove({
89
71
  functionName: functionName
90
72
  });
91
73
  }
92
-
93
74
  function removeTrigger(className, triggerName) {
94
75
  return remove({
95
76
  className: className,
96
77
  triggerName: triggerName
97
78
  });
98
79
  }
99
-
100
80
  function remove(hook) {
101
81
  return _CoreManager.default.getHooksController().remove(hook);
102
82
  }
103
-
104
83
  var DefaultController = {
105
84
  get: function (type, functionName, triggerName) {
106
85
  var url = '/hooks/' + type;
107
-
108
86
  if (functionName) {
109
87
  url += '/' + functionName;
110
-
111
88
  if (triggerName) {
112
89
  url += '/' + triggerName;
113
90
  }
114
91
  }
115
-
116
92
  return this.sendRequest('GET', url);
117
93
  },
118
94
  create: function (hook) {
119
95
  var url;
120
-
121
96
  if (hook.functionName && hook.url) {
122
97
  url = '/hooks/functions';
123
98
  } else if (hook.className && hook.triggerName && hook.url) {
@@ -128,12 +103,10 @@ var DefaultController = {
128
103
  code: 143
129
104
  });
130
105
  }
131
-
132
106
  return this.sendRequest('POST', url, hook);
133
107
  },
134
108
  remove: function (hook) {
135
109
  var url;
136
-
137
110
  if (hook.functionName) {
138
111
  url = '/hooks/functions/' + hook.functionName;
139
112
  delete hook.functionName;
@@ -147,14 +120,12 @@ var DefaultController = {
147
120
  code: 143
148
121
  });
149
122
  }
150
-
151
123
  return this.sendRequest('PUT', url, {
152
124
  __op: 'Delete'
153
125
  });
154
126
  },
155
127
  update: function (hook) {
156
128
  var url;
157
-
158
129
  if (hook.functionName && hook.url) {
159
130
  url = '/hooks/functions/' + hook.functionName;
160
131
  delete hook.functionName;
@@ -168,7 +139,6 @@ var DefaultController = {
168
139
  code: 143
169
140
  });
170
141
  }
171
-
172
142
  return this.sendRequest('PUT', url, hook);
173
143
  },
174
144
  sendRequest: function (method, url, body) {
@@ -176,14 +146,11 @@ var DefaultController = {
176
146
  useMasterKey: true
177
147
  }).then(function (res) {
178
148
  var decoded = (0, _decode.default)(res);
179
-
180
149
  if (decoded) {
181
150
  return _promise.default.resolve(decoded);
182
151
  }
183
-
184
152
  return _promise.default.reject(new _ParseError.default(_ParseError.default.INVALID_JSON, 'The server returned an invalid response.'));
185
153
  });
186
154
  }
187
155
  };
188
-
189
156
  _CoreManager.default.setHooksController(DefaultController);
@@ -1,54 +1,37 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
4
-
5
- var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
6
-
7
3
  var _Reflect$construct = require("@babel/runtime-corejs3/core-js-stable/reflect/construct");
8
-
4
+ var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
5
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
9
6
  _Object$defineProperty(exports, "__esModule", {
10
7
  value: true
11
8
  });
12
-
13
9
  exports.default = void 0;
14
-
15
10
  var _typeof2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/typeof"));
16
-
17
11
  var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/createClass"));
18
-
19
12
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/classCallCheck"));
20
-
21
13
  var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/inherits"));
22
-
23
14
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/possibleConstructorReturn"));
24
-
25
15
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/getPrototypeOf"));
26
-
27
16
  var _ParseObject2 = _interopRequireDefault(require("./ParseObject"));
28
-
29
17
  function _createSuper(Derived) {
30
18
  var hasNativeReflectConstruct = _isNativeReflectConstruct();
31
-
32
19
  return function () {
33
20
  var Super = (0, _getPrototypeOf2.default)(Derived),
34
- result;
35
-
21
+ result;
36
22
  if (hasNativeReflectConstruct) {
37
23
  var NewTarget = (0, _getPrototypeOf2.default)(this).constructor;
38
24
  result = _Reflect$construct(Super, arguments, NewTarget);
39
25
  } else {
40
26
  result = Super.apply(this, arguments);
41
27
  }
42
-
43
28
  return (0, _possibleConstructorReturn2.default)(this, result);
44
29
  };
45
30
  }
46
-
47
31
  function _isNativeReflectConstruct() {
48
32
  if (typeof Reflect === "undefined" || !_Reflect$construct) return false;
49
33
  if (_Reflect$construct.sham) return false;
50
34
  if (typeof Proxy === "function") return true;
51
-
52
35
  try {
53
36
  Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {}));
54
37
  return true;
@@ -56,32 +39,21 @@ function _isNativeReflectConstruct() {
56
39
  return false;
57
40
  }
58
41
  }
59
-
60
42
  var Installation = /*#__PURE__*/function (_ParseObject) {
61
43
  (0, _inherits2.default)(Installation, _ParseObject);
62
-
63
44
  var _super = _createSuper(Installation);
64
-
65
- function Installation(attributes
66
- /*: ?AttributeMap*/
67
- ) {
45
+ function Installation(attributes /*: ?AttributeMap*/) {
68
46
  var _this;
69
-
70
47
  (0, _classCallCheck2.default)(this, Installation);
71
48
  _this = _super.call(this, '_Installation');
72
-
73
49
  if (attributes && (0, _typeof2.default)(attributes) === 'object') {
74
50
  if (!_this.set(attributes || {})) {
75
51
  throw new Error("Can't create an invalid Installation");
76
52
  }
77
53
  }
78
-
79
54
  return _this;
80
55
  }
81
-
82
56
  return (0, _createClass2.default)(Installation);
83
57
  }(_ParseObject2.default);
84
-
85
58
  exports.default = Installation;
86
-
87
59
  _ParseObject2.default.registerSubclass('_Installation', Installation);