parse 5.1.1-alpha.1 → 5.2.0-alpha.2

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 (249) hide show
  1. package/dist/parse.js +10186 -14918
  2. package/dist/parse.min.js +2 -2
  3. package/dist/parse.weapp.js +10180 -15057
  4. package/dist/parse.weapp.min.js +2 -2
  5. package/lib/browser/Analytics.js +7 -11
  6. package/lib/browser/AnonymousUtils.js +17 -22
  7. package/lib/browser/Cloud.js +24 -46
  8. package/lib/browser/CoreManager.js +71 -79
  9. package/lib/browser/CryptoController.js +14 -9
  10. package/lib/browser/EventEmitter.js +9 -2
  11. package/lib/browser/EventuallyQueue.js +156 -357
  12. package/lib/browser/FacebookUtils.js +23 -28
  13. package/lib/browser/IndexedDBStorageController.js +18 -14
  14. package/lib/browser/InstallationController.js +55 -121
  15. package/lib/browser/LiveQueryClient.js +312 -446
  16. package/lib/browser/LiveQuerySubscription.js +25 -28
  17. package/lib/browser/LocalDatastore.js +254 -578
  18. package/lib/browser/LocalDatastoreController.default.js +48 -227
  19. package/lib/browser/LocalDatastoreController.js +11 -1
  20. package/lib/browser/LocalDatastoreController.react-native.js +72 -164
  21. package/lib/browser/LocalDatastoreUtils.js +4 -12
  22. package/lib/browser/ObjectStateMutations.js +89 -95
  23. package/lib/browser/OfflineQuery.js +106 -198
  24. package/lib/browser/Parse.js +45 -61
  25. package/lib/browser/ParseACL.js +242 -288
  26. package/lib/browser/ParseCLP.js +372 -580
  27. package/lib/browser/ParseConfig.js +115 -138
  28. package/lib/browser/ParseError.js +85 -182
  29. package/lib/browser/ParseFile.js +296 -444
  30. package/lib/browser/ParseGeoPoint.js +121 -140
  31. package/lib/browser/ParseHooks.js +12 -14
  32. package/lib/browser/ParseInstallation.js +226 -354
  33. package/lib/browser/ParseLiveQuery.js +74 -148
  34. package/lib/browser/ParseObject.js +2017 -2622
  35. package/lib/browser/ParseOp.js +343 -484
  36. package/lib/browser/ParsePolygon.js +101 -120
  37. package/lib/browser/ParseQuery.js +1722 -2068
  38. package/lib/browser/ParseRelation.js +99 -118
  39. package/lib/browser/ParseRole.js +88 -144
  40. package/lib/browser/ParseSchema.js +372 -434
  41. package/lib/browser/ParseSession.js +62 -110
  42. package/lib/browser/ParseUser.js +942 -1270
  43. package/lib/browser/Push.js +16 -44
  44. package/lib/browser/RESTController.js +85 -124
  45. package/lib/browser/SingleInstanceStateController.js +57 -86
  46. package/lib/browser/Socket.weapp.js +50 -33
  47. package/lib/browser/Storage.js +23 -28
  48. package/lib/browser/StorageController.browser.js +16 -13
  49. package/lib/browser/StorageController.default.js +15 -14
  50. package/lib/browser/StorageController.js +14 -1
  51. package/lib/browser/StorageController.react-native.js +31 -30
  52. package/lib/browser/StorageController.weapp.js +19 -13
  53. package/lib/browser/TaskQueue.js +37 -49
  54. package/lib/browser/UniqueInstanceStateController.js +65 -86
  55. package/lib/browser/WebSocketController.js +11 -4
  56. package/lib/browser/Xhr.weapp.js +90 -78
  57. package/lib/browser/arrayContainsObject.js +3 -3
  58. package/lib/browser/canBeSerialized.js +10 -11
  59. package/lib/browser/decode.js +11 -11
  60. package/lib/browser/encode.js +11 -11
  61. package/lib/browser/equals.js +9 -10
  62. package/lib/browser/escape.js +2 -2
  63. package/lib/browser/isRevocableSession.js +1 -1
  64. package/lib/browser/parseDate.js +10 -10
  65. package/lib/browser/promiseUtils.js +19 -19
  66. package/lib/browser/unique.js +4 -4
  67. package/lib/browser/unsavedChildren.js +20 -21
  68. package/lib/browser/uuid.js +2 -4
  69. package/lib/node/Analytics.js +2 -6
  70. package/lib/node/AnonymousUtils.js +7 -12
  71. package/lib/node/Cloud.js +8 -12
  72. package/lib/node/CoreManager.js +59 -67
  73. package/lib/node/CryptoController.js +8 -3
  74. package/lib/node/EventEmitter.js +7 -1
  75. package/lib/node/EventuallyQueue.js +18 -37
  76. package/lib/node/FacebookUtils.js +1 -5
  77. package/lib/node/IndexedDBStorageController.js +14 -10
  78. package/lib/node/InstallationController.js +7 -8
  79. package/lib/node/LiveQueryClient.js +20 -32
  80. package/lib/node/LiveQuerySubscription.js +3 -4
  81. package/lib/node/LocalDatastore.js +20 -24
  82. package/lib/node/LocalDatastoreController.default.js +12 -11
  83. package/lib/node/LocalDatastoreController.js +14 -1
  84. package/lib/node/LocalDatastoreController.react-native.js +27 -22
  85. package/lib/node/LocalDatastoreUtils.js +4 -12
  86. package/lib/node/ObjectStateMutations.js +52 -36
  87. package/lib/node/OfflineQuery.js +37 -23
  88. package/lib/node/Parse.js +35 -49
  89. package/lib/node/ParseACL.js +18 -27
  90. package/lib/node/ParseCLP.js +38 -50
  91. package/lib/node/ParseConfig.js +7 -14
  92. package/lib/node/ParseError.js +457 -458
  93. package/lib/node/ParseFile.js +33 -66
  94. package/lib/node/ParseGeoPoint.js +22 -17
  95. package/lib/node/ParseHooks.js +0 -2
  96. package/lib/node/ParseInstallation.js +21 -8
  97. package/lib/node/ParseLiveQuery.js +6 -11
  98. package/lib/node/ParseObject.js +138 -167
  99. package/lib/node/ParseOp.js +32 -44
  100. package/lib/node/ParsePolygon.js +11 -17
  101. package/lib/node/ParseQuery.js +118 -164
  102. package/lib/node/ParseRelation.js +7 -16
  103. package/lib/node/ParseRole.js +7 -13
  104. package/lib/node/ParseSchema.js +26 -39
  105. package/lib/node/ParseSession.js +7 -8
  106. package/lib/node/ParseUser.js +70 -76
  107. package/lib/node/Push.js +5 -15
  108. package/lib/node/RESTController.js +21 -33
  109. package/lib/node/SingleInstanceStateController.js +41 -69
  110. package/lib/node/Socket.weapp.js +23 -2
  111. package/lib/node/Storage.js +11 -16
  112. package/lib/node/StorageController.browser.js +10 -8
  113. package/lib/node/StorageController.default.js +9 -9
  114. package/lib/node/StorageController.js +16 -1
  115. package/lib/node/StorageController.react-native.js +17 -17
  116. package/lib/node/StorageController.weapp.js +14 -8
  117. package/lib/node/TaskQueue.js +8 -11
  118. package/lib/node/UniqueInstanceStateController.js +40 -60
  119. package/lib/node/WebSocketController.js +15 -2
  120. package/lib/node/Xhr.weapp.js +11 -2
  121. package/lib/node/arrayContainsObject.js +1 -1
  122. package/lib/node/canBeSerialized.js +2 -2
  123. package/lib/node/decode.js +1 -1
  124. package/lib/node/encode.js +2 -2
  125. package/lib/node/equals.js +1 -1
  126. package/lib/node/escape.js +1 -1
  127. package/lib/node/isRevocableSession.js +1 -1
  128. package/lib/node/parseDate.js +1 -1
  129. package/lib/node/promiseUtils.js +7 -7
  130. package/lib/node/unique.js +2 -2
  131. package/lib/node/unsavedChildren.js +2 -2
  132. package/lib/node/uuid.js +2 -4
  133. package/lib/react-native/Analytics.js +2 -2
  134. package/lib/react-native/AnonymousUtils.js +3 -4
  135. package/lib/react-native/Cloud.js +0 -1
  136. package/lib/react-native/CoreManager.js +2 -3
  137. package/lib/react-native/CryptoController.js +6 -1
  138. package/lib/react-native/EventEmitter.js +6 -1
  139. package/lib/react-native/EventuallyQueue.js +1 -2
  140. package/lib/react-native/FacebookUtils.js +1 -2
  141. package/lib/react-native/IndexedDBStorageController.js +11 -5
  142. package/lib/react-native/InstallationController.js +1 -2
  143. package/lib/react-native/LiveQueryClient.js +51 -36
  144. package/lib/react-native/LiveQuerySubscription.js +2 -4
  145. package/lib/react-native/LocalDatastore.js +41 -17
  146. package/lib/react-native/LocalDatastoreController.default.js +6 -1
  147. package/lib/react-native/LocalDatastoreController.js +11 -1
  148. package/lib/react-native/LocalDatastoreController.react-native.js +16 -11
  149. package/lib/react-native/LocalDatastoreUtils.js +3 -6
  150. package/lib/react-native/ObjectStateMutations.js +30 -9
  151. package/lib/react-native/OfflineQuery.js +25 -20
  152. package/lib/react-native/Parse.js +24 -38
  153. package/lib/react-native/ParseACL.js +4 -6
  154. package/lib/react-native/ParseCLP.js +5 -7
  155. package/lib/react-native/ParseConfig.js +4 -6
  156. package/lib/react-native/ParseError.js +13 -31
  157. package/lib/react-native/ParseFile.js +10 -10
  158. package/lib/react-native/ParseGeoPoint.js +2 -4
  159. package/lib/react-native/ParseInstallation.js +13 -30
  160. package/lib/react-native/ParseLiveQuery.js +2 -4
  161. package/lib/react-native/ParseObject.js +81 -90
  162. package/lib/react-native/ParseOp.js +41 -79
  163. package/lib/react-native/ParsePolygon.js +2 -4
  164. package/lib/react-native/ParseQuery.js +87 -81
  165. package/lib/react-native/ParseRelation.js +2 -4
  166. package/lib/react-native/ParseRole.js +14 -31
  167. package/lib/react-native/ParseSchema.js +3 -5
  168. package/lib/react-native/ParseSession.js +12 -29
  169. package/lib/react-native/ParseUser.js +32 -51
  170. package/lib/react-native/RESTController.js +10 -4
  171. package/lib/react-native/SingleInstanceStateController.js +23 -37
  172. package/lib/react-native/Socket.weapp.js +9 -4
  173. package/lib/react-native/Storage.js +1 -2
  174. package/lib/react-native/StorageController.browser.js +6 -1
  175. package/lib/react-native/StorageController.default.js +6 -1
  176. package/lib/react-native/StorageController.js +13 -1
  177. package/lib/react-native/StorageController.react-native.js +11 -6
  178. package/lib/react-native/StorageController.weapp.js +6 -1
  179. package/lib/react-native/TaskQueue.js +8 -4
  180. package/lib/react-native/UniqueInstanceStateController.js +23 -37
  181. package/lib/react-native/WebSocketController.js +9 -1
  182. package/lib/react-native/Xhr.weapp.js +9 -4
  183. package/lib/react-native/unsavedChildren.js +3 -3
  184. package/lib/react-native/uuid.js +1 -2
  185. package/lib/weapp/Analytics.js +7 -11
  186. package/lib/weapp/AnonymousUtils.js +17 -22
  187. package/lib/weapp/Cloud.js +24 -46
  188. package/lib/weapp/CoreManager.js +71 -79
  189. package/lib/weapp/CryptoController.js +14 -9
  190. package/lib/weapp/EventEmitter.js +9 -2
  191. package/lib/weapp/EventuallyQueue.js +156 -357
  192. package/lib/weapp/FacebookUtils.js +23 -28
  193. package/lib/weapp/IndexedDBStorageController.js +18 -14
  194. package/lib/weapp/InstallationController.js +55 -121
  195. package/lib/weapp/LiveQueryClient.js +312 -446
  196. package/lib/weapp/LiveQuerySubscription.js +25 -28
  197. package/lib/weapp/LocalDatastore.js +254 -578
  198. package/lib/weapp/LocalDatastoreController.default.js +48 -227
  199. package/lib/weapp/LocalDatastoreController.js +11 -1
  200. package/lib/weapp/LocalDatastoreController.react-native.js +72 -164
  201. package/lib/weapp/LocalDatastoreUtils.js +4 -12
  202. package/lib/weapp/ObjectStateMutations.js +89 -95
  203. package/lib/weapp/OfflineQuery.js +106 -198
  204. package/lib/weapp/Parse.js +45 -60
  205. package/lib/weapp/ParseACL.js +242 -288
  206. package/lib/weapp/ParseCLP.js +372 -580
  207. package/lib/weapp/ParseConfig.js +115 -138
  208. package/lib/weapp/ParseError.js +85 -182
  209. package/lib/weapp/ParseFile.js +297 -446
  210. package/lib/weapp/ParseGeoPoint.js +121 -140
  211. package/lib/weapp/ParseHooks.js +12 -14
  212. package/lib/weapp/ParseInstallation.js +226 -354
  213. package/lib/weapp/ParseLiveQuery.js +74 -148
  214. package/lib/weapp/ParseObject.js +2017 -2622
  215. package/lib/weapp/ParseOp.js +343 -484
  216. package/lib/weapp/ParsePolygon.js +101 -120
  217. package/lib/weapp/ParseQuery.js +1722 -2068
  218. package/lib/weapp/ParseRelation.js +99 -118
  219. package/lib/weapp/ParseRole.js +88 -144
  220. package/lib/weapp/ParseSchema.js +372 -434
  221. package/lib/weapp/ParseSession.js +62 -110
  222. package/lib/weapp/ParseUser.js +942 -1270
  223. package/lib/weapp/Push.js +16 -44
  224. package/lib/weapp/RESTController.js +86 -125
  225. package/lib/weapp/SingleInstanceStateController.js +57 -86
  226. package/lib/weapp/Socket.weapp.js +50 -33
  227. package/lib/weapp/Storage.js +23 -28
  228. package/lib/weapp/StorageController.browser.js +16 -13
  229. package/lib/weapp/StorageController.default.js +15 -14
  230. package/lib/weapp/StorageController.js +14 -1
  231. package/lib/weapp/StorageController.react-native.js +31 -30
  232. package/lib/weapp/StorageController.weapp.js +19 -13
  233. package/lib/weapp/TaskQueue.js +37 -49
  234. package/lib/weapp/UniqueInstanceStateController.js +65 -86
  235. package/lib/weapp/WebSocketController.js +11 -4
  236. package/lib/weapp/Xhr.weapp.js +90 -78
  237. package/lib/weapp/arrayContainsObject.js +3 -3
  238. package/lib/weapp/canBeSerialized.js +10 -11
  239. package/lib/weapp/decode.js +11 -11
  240. package/lib/weapp/encode.js +11 -11
  241. package/lib/weapp/equals.js +9 -10
  242. package/lib/weapp/escape.js +2 -2
  243. package/lib/weapp/isRevocableSession.js +1 -1
  244. package/lib/weapp/parseDate.js +10 -10
  245. package/lib/weapp/promiseUtils.js +19 -19
  246. package/lib/weapp/unique.js +4 -4
  247. package/lib/weapp/unsavedChildren.js +20 -21
  248. package/lib/weapp/uuid.js +6 -8
  249. package/package.json +23 -30
@@ -8,9 +8,6 @@ _Object$defineProperty(exports, "__esModule", {
8
8
  exports.default = void 0;
9
9
  var _isArray = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/array/is-array"));
10
10
  var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/promise"));
11
- var _typeof2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/typeof"));
12
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/classCallCheck"));
13
- var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/createClass"));
14
11
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
15
12
  /**
16
13
  * Creates a new GeoPoint with any of the following forms:<br>
@@ -36,20 +33,19 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/he
36
33
  * @alias Parse.GeoPoint
37
34
  */
38
35
  /* global navigator */
39
- var ParseGeoPoint = /*#__PURE__*/function () {
36
+ class ParseGeoPoint {
40
37
  /**
41
38
  * @param {(number[] | object | number)} arg1 Either a list of coordinate pairs, an object with `latitude`, `longitude`, or the latitude or the point.
42
39
  * @param {number} arg2 The longitude of the GeoPoint
43
40
  */
44
- function ParseGeoPoint(arg1 /*: Array<number> | { latitude: number, longitude: number } | number*/, arg2 /*:: ?: number*/) {
45
- (0, _classCallCheck2.default)(this, ParseGeoPoint);
41
+ constructor(arg1, arg2) {
46
42
  (0, _defineProperty2.default)(this, "_latitude", void 0);
47
43
  (0, _defineProperty2.default)(this, "_longitude", void 0);
48
44
  if ((0, _isArray.default)(arg1)) {
49
45
  ParseGeoPoint._validate(arg1[0], arg1[1]);
50
46
  this._latitude = arg1[0];
51
47
  this._longitude = arg1[1];
52
- } else if ((0, _typeof2.default)(arg1) === 'object') {
48
+ } else if (typeof arg1 === 'object') {
53
49
  ParseGeoPoint._validate(arg1.latitude, arg1.longitude);
54
50
  this._latitude = arg1.latitude;
55
51
  this._longitude = arg1.longitude;
@@ -70,144 +66,129 @@ var ParseGeoPoint = /*#__PURE__*/function () {
70
66
  * @property {number} latitude
71
67
  * @returns {number}
72
68
  */
73
- (0, _createClass2.default)(ParseGeoPoint, [{
74
- key: "latitude",
75
- get: function () /*: number*/{
76
- return this._latitude;
77
- },
78
- set: function (val /*: number*/) {
79
- ParseGeoPoint._validate(val, this.longitude);
80
- this._latitude = val;
81
- }
69
+ get latitude() {
70
+ return this._latitude;
71
+ }
72
+ set latitude(val) {
73
+ ParseGeoPoint._validate(val, this.longitude);
74
+ this._latitude = val;
75
+ }
82
76
 
83
- /**
84
- * East-west portion of the coordinate, in range [-180, 180].
85
- * Throws if set out of range in a modern browser.
86
- *
87
- * @property {number} longitude
88
- * @returns {number}
89
- */
90
- }, {
91
- key: "longitude",
92
- get: function () /*: number*/{
93
- return this._longitude;
94
- },
95
- set: function (val /*: number*/) {
96
- ParseGeoPoint._validate(this.latitude, val);
97
- this._longitude = val;
98
- }
77
+ /**
78
+ * East-west portion of the coordinate, in range [-180, 180].
79
+ * Throws if set out of range in a modern browser.
80
+ *
81
+ * @property {number} longitude
82
+ * @returns {number}
83
+ */
84
+ get longitude() {
85
+ return this._longitude;
86
+ }
87
+ set longitude(val) {
88
+ ParseGeoPoint._validate(this.latitude, val);
89
+ this._longitude = val;
90
+ }
99
91
 
100
- /**
101
- * Returns a JSON representation of the GeoPoint, suitable for Parse.
102
- *
103
- * @returns {object}
104
- */
105
- }, {
106
- key: "toJSON",
107
- value: function () /*: { __type: string, latitude: number, longitude: number }*/{
108
- ParseGeoPoint._validate(this._latitude, this._longitude);
109
- return {
110
- __type: 'GeoPoint',
111
- latitude: this._latitude,
112
- longitude: this._longitude
113
- };
114
- }
115
- }, {
116
- key: "equals",
117
- value: function (other /*: any*/) /*: boolean*/{
118
- return other instanceof ParseGeoPoint && this.latitude === other.latitude && this.longitude === other.longitude;
119
- }
92
+ /**
93
+ * Returns a JSON representation of the GeoPoint, suitable for Parse.
94
+ *
95
+ * @returns {object}
96
+ */
97
+ toJSON() {
98
+ ParseGeoPoint._validate(this._latitude, this._longitude);
99
+ return {
100
+ __type: 'GeoPoint',
101
+ latitude: this._latitude,
102
+ longitude: this._longitude
103
+ };
104
+ }
105
+ equals(other) {
106
+ return other instanceof ParseGeoPoint && this.latitude === other.latitude && this.longitude === other.longitude;
107
+ }
120
108
 
121
- /**
122
- * Returns the distance from this GeoPoint to another in radians.
123
- *
124
- * @param {Parse.GeoPoint} point the other Parse.GeoPoint.
125
- * @returns {number}
126
- */
127
- }, {
128
- key: "radiansTo",
129
- value: function (point /*: ParseGeoPoint*/) /*: number*/{
130
- var d2r = Math.PI / 180.0;
131
- var lat1rad = this.latitude * d2r;
132
- var long1rad = this.longitude * d2r;
133
- var lat2rad = point.latitude * d2r;
134
- var long2rad = point.longitude * d2r;
135
- var sinDeltaLatDiv2 = Math.sin((lat1rad - lat2rad) / 2);
136
- var sinDeltaLongDiv2 = Math.sin((long1rad - long2rad) / 2);
137
- // Square of half the straight line chord distance between both points.
138
- var a = sinDeltaLatDiv2 * sinDeltaLatDiv2 + Math.cos(lat1rad) * Math.cos(lat2rad) * sinDeltaLongDiv2 * sinDeltaLongDiv2;
139
- a = Math.min(1.0, a);
140
- return 2 * Math.asin(Math.sqrt(a));
141
- }
109
+ /**
110
+ * Returns the distance from this GeoPoint to another in radians.
111
+ *
112
+ * @param {Parse.GeoPoint} point the other Parse.GeoPoint.
113
+ * @returns {number}
114
+ */
115
+ radiansTo(point) {
116
+ const d2r = Math.PI / 180.0;
117
+ const lat1rad = this.latitude * d2r;
118
+ const long1rad = this.longitude * d2r;
119
+ const lat2rad = point.latitude * d2r;
120
+ const long2rad = point.longitude * d2r;
121
+ const sinDeltaLatDiv2 = Math.sin((lat1rad - lat2rad) / 2);
122
+ const sinDeltaLongDiv2 = Math.sin((long1rad - long2rad) / 2);
123
+ // Square of half the straight line chord distance between both points.
124
+ let a = sinDeltaLatDiv2 * sinDeltaLatDiv2 + Math.cos(lat1rad) * Math.cos(lat2rad) * sinDeltaLongDiv2 * sinDeltaLongDiv2;
125
+ a = Math.min(1.0, a);
126
+ return 2 * Math.asin(Math.sqrt(a));
127
+ }
142
128
 
143
- /**
144
- * Returns the distance from this GeoPoint to another in kilometers.
145
- *
146
- * @param {Parse.GeoPoint} point the other Parse.GeoPoint.
147
- * @returns {number}
148
- */
149
- }, {
150
- key: "kilometersTo",
151
- value: function (point /*: ParseGeoPoint*/) /*: number*/{
152
- return this.radiansTo(point) * 6371.0;
153
- }
129
+ /**
130
+ * Returns the distance from this GeoPoint to another in kilometers.
131
+ *
132
+ * @param {Parse.GeoPoint} point the other Parse.GeoPoint.
133
+ * @returns {number}
134
+ */
135
+ kilometersTo(point) {
136
+ return this.radiansTo(point) * 6371.0;
137
+ }
154
138
 
155
- /**
156
- * Returns the distance from this GeoPoint to another in miles.
157
- *
158
- * @param {Parse.GeoPoint} point the other Parse.GeoPoint.
159
- * @returns {number}
160
- */
161
- }, {
162
- key: "milesTo",
163
- value: function (point /*: ParseGeoPoint*/) /*: number*/{
164
- return this.radiansTo(point) * 3958.8;
165
- }
139
+ /**
140
+ * Returns the distance from this GeoPoint to another in miles.
141
+ *
142
+ * @param {Parse.GeoPoint} point the other Parse.GeoPoint.
143
+ * @returns {number}
144
+ */
145
+ milesTo(point) {
146
+ return this.radiansTo(point) * 3958.8;
147
+ }
166
148
 
167
- /*
168
- * Throws an exception if the given lat-long is out of bounds.
169
- */
170
- }], [{
171
- key: "_validate",
172
- value: function (latitude /*: number*/, longitude /*: number*/) {
173
- if (isNaN(latitude) || isNaN(longitude) || typeof latitude !== 'number' || typeof longitude !== 'number') {
174
- throw new TypeError('GeoPoint latitude and longitude must be valid numbers');
175
- }
176
- if (latitude < -90.0) {
177
- throw new TypeError('GeoPoint latitude out of bounds: ' + latitude + ' < -90.0.');
178
- }
179
- if (latitude > 90.0) {
180
- throw new TypeError('GeoPoint latitude out of bounds: ' + latitude + ' > 90.0.');
181
- }
182
- if (longitude < -180.0) {
183
- throw new TypeError('GeoPoint longitude out of bounds: ' + longitude + ' < -180.0.');
184
- }
185
- if (longitude > 180.0) {
186
- throw new TypeError('GeoPoint longitude out of bounds: ' + longitude + ' > 180.0.');
187
- }
149
+ /*
150
+ * Throws an exception if the given lat-long is out of bounds.
151
+ */
152
+ static _validate(latitude, longitude) {
153
+ if (isNaN(latitude) || isNaN(longitude) || typeof latitude !== 'number' || typeof longitude !== 'number') {
154
+ throw new TypeError('GeoPoint latitude and longitude must be valid numbers');
188
155
  }
189
-
190
- /**
191
- * Creates a GeoPoint with the user's current location, if available.
192
- *
193
- * @param {object} options The options.
194
- * @param {boolean} [options.enableHighAccuracy=false] A boolean value that indicates the application would like to receive the best possible results. If true and if the device is able to provide a more accurate position, it will do so. Note that this can result in slower response times or increased power consumption (with a GPS chip on a mobile device for example). On the other hand, if false, the device can take the liberty to save resources by responding more quickly and/or using less power. Default: false.
195
- * @param {number} [options.timeout=Infinity] A positive long value representing the maximum length of time (in milliseconds) the device is allowed to take in order to return a position. The default value is Infinity, meaning that getCurrentPosition() won't return until the position is available.
196
- * @param {number} [options.maximumAge=0] A positive long value indicating the maximum age in milliseconds of a possible cached position that is acceptable to return. If set to 0, it means that the device cannot use a cached position and must attempt to retrieve the real current position. If set to Infinity the device must return a cached position regardless of its age. Default: 0.
197
- * @static
198
- * @returns {Promise<Parse.GeoPoint>} User's current location
199
- */
200
- }, {
201
- key: "current",
202
- value: function (options) /*: Promise<ParseGeoPoint>*/{
203
- return new _promise.default(function (resolve, reject) {
204
- navigator.geolocation.getCurrentPosition(function (location) {
205
- resolve(new ParseGeoPoint(location.coords.latitude, location.coords.longitude));
206
- }, reject, options);
207
- });
156
+ if (latitude < -90.0) {
157
+ throw new TypeError('GeoPoint latitude out of bounds: ' + latitude + ' < -90.0.');
158
+ }
159
+ if (latitude > 90.0) {
160
+ throw new TypeError('GeoPoint latitude out of bounds: ' + latitude + ' > 90.0.');
208
161
  }
209
- }]);
210
- return ParseGeoPoint;
211
- }();
212
- var _default = ParseGeoPoint;
213
- exports.default = _default;
162
+ if (longitude < -180.0) {
163
+ throw new TypeError('GeoPoint longitude out of bounds: ' + longitude + ' < -180.0.');
164
+ }
165
+ if (longitude > 180.0) {
166
+ throw new TypeError('GeoPoint longitude out of bounds: ' + longitude + ' > 180.0.');
167
+ }
168
+ }
169
+
170
+ /**
171
+ * Creates a GeoPoint with the user's current location, if available.
172
+ *
173
+ * @param {object} options The options.
174
+ * @param {boolean} [options.enableHighAccuracy] A boolean value that indicates the application would like to receive the best possible results.
175
+ * If true and if the device is able to provide a more accurate position, it will do so.
176
+ * Note that this can result in slower response times or increased power consumption (with a GPS chip on a mobile device for example).
177
+ * On the other hand, if false, the device can take the liberty to save resources by responding more quickly and/or using less power. Default: false.
178
+ * @param {number} [options.timeout] A positive long value representing the maximum length of time (in milliseconds) the device is allowed to take in order to return a position.
179
+ * The default value is Infinity, meaning that getCurrentPosition() won't return until the position is available.
180
+ * @param {number} [options.maximumAge] A positive long value indicating the maximum age in milliseconds of a possible cached position that is acceptable to return.
181
+ * If set to 0, it means that the device cannot use a cached position and must attempt to retrieve the real current position.
182
+ * If set to Infinity the device must return a cached position regardless of its age. Default: 0.
183
+ * @static
184
+ * @returns {Promise<Parse.GeoPoint>} User's current location
185
+ */
186
+ static current(options) {
187
+ return new _promise.default((resolve, reject) => {
188
+ navigator.geolocation.getCurrentPosition(location => {
189
+ resolve(new ParseGeoPoint(location.coords.latitude, location.coords.longitude));
190
+ }, reject, options);
191
+ });
192
+ }
193
+ }
194
+ var _default = exports.default = ParseGeoPoint;
@@ -22,8 +22,6 @@ var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-st
22
22
  var _CoreManager = _interopRequireDefault(require("./CoreManager"));
23
23
  var _decode = _interopRequireDefault(require("./decode"));
24
24
  var _ParseError = _interopRequireDefault(require("./ParseError"));
25
- /*:: export type HookDeclaration = { functionName: string, url: string } | { className: string, triggerName: string, url: string };*/
26
- /*:: export type HookDeleteArg = { functionName: string } | { className: string, triggerName: string };*/
27
25
  function getFunctions() {
28
26
  return _CoreManager.default.getHooksController().get('functions');
29
27
  }
@@ -82,9 +80,9 @@ function removeTrigger(className, triggerName) {
82
80
  function remove(hook) {
83
81
  return _CoreManager.default.getHooksController().remove(hook);
84
82
  }
85
- var DefaultController = {
86
- get: function (type, functionName, triggerName) {
87
- var url = '/hooks/' + type;
83
+ const DefaultController = {
84
+ get(type, functionName, triggerName) {
85
+ let url = '/hooks/' + type;
88
86
  if (functionName) {
89
87
  url += '/' + functionName;
90
88
  if (triggerName) {
@@ -93,8 +91,8 @@ var DefaultController = {
93
91
  }
94
92
  return this.sendRequest('GET', url);
95
93
  },
96
- create: function (hook) {
97
- var url;
94
+ create(hook) {
95
+ let url;
98
96
  if (hook.functionName && hook.url) {
99
97
  url = '/hooks/functions';
100
98
  } else if (hook.className && hook.triggerName && hook.url) {
@@ -107,8 +105,8 @@ var DefaultController = {
107
105
  }
108
106
  return this.sendRequest('POST', url, hook);
109
107
  },
110
- remove: function (hook) {
111
- var url;
108
+ remove(hook) {
109
+ let url;
112
110
  if (hook.functionName) {
113
111
  url = '/hooks/functions/' + hook.functionName;
114
112
  delete hook.functionName;
@@ -126,8 +124,8 @@ var DefaultController = {
126
124
  __op: 'Delete'
127
125
  });
128
126
  },
129
- update: function (hook) {
130
- var url;
127
+ update(hook) {
128
+ let url;
131
129
  if (hook.functionName && hook.url) {
132
130
  url = '/hooks/functions/' + hook.functionName;
133
131
  delete hook.functionName;
@@ -143,11 +141,11 @@ var DefaultController = {
143
141
  }
144
142
  return this.sendRequest('PUT', url, hook);
145
143
  },
146
- sendRequest: function (method, url, body) {
144
+ sendRequest(method, url, body) {
147
145
  return _CoreManager.default.getRESTController().request(method, url, body, {
148
146
  useMasterKey: true
149
- }).then(function (res) {
150
- var decoded = (0, _decode.default)(res);
147
+ }).then(res => {
148
+ const decoded = (0, _decode.default)(res);
151
149
  if (decoded) {
152
150
  return _promise.default.resolve(decoded);
153
151
  }