parse 5.2.0-alpha.1 → 5.2.0-alpha.3

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 (247) hide show
  1. package/dist/parse.js +10519 -15246
  2. package/dist/parse.min.js +2 -2
  3. package/dist/parse.weapp.js +10499 -15371
  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 +23 -41
  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 -485
  16. package/lib/browser/LiveQuerySubscription.js +25 -28
  17. package/lib/browser/LocalDatastore.js +258 -624
  18. package/lib/browser/LocalDatastoreController.default.js +42 -226
  19. package/lib/browser/LocalDatastoreController.js +11 -1
  20. package/lib/browser/LocalDatastoreController.react-native.js +66 -160
  21. package/lib/browser/LocalDatastoreUtils.js +4 -7
  22. package/lib/browser/ObjectStateMutations.js +54 -96
  23. package/lib/browser/OfflineQuery.js +106 -198
  24. package/lib/browser/Parse.js +44 -60
  25. package/lib/browser/ParseACL.js +242 -288
  26. package/lib/browser/ParseCLP.js +372 -572
  27. package/lib/browser/ParseConfig.js +115 -138
  28. package/lib/browser/ParseError.js +85 -182
  29. package/lib/browser/ParseFile.js +294 -438
  30. package/lib/browser/ParseGeoPoint.js +121 -146
  31. package/lib/browser/ParseHooks.js +23 -25
  32. package/lib/browser/ParseInstallation.js +225 -367
  33. package/lib/browser/ParseLiveQuery.js +74 -148
  34. package/lib/browser/ParseObject.js +2014 -2621
  35. package/lib/browser/ParseOp.js +343 -484
  36. package/lib/browser/ParsePolygon.js +101 -120
  37. package/lib/browser/ParseQuery.js +1708 -2052
  38. package/lib/browser/ParseRelation.js +99 -118
  39. package/lib/browser/ParseRole.js +88 -140
  40. package/lib/browser/ParseSchema.js +372 -434
  41. package/lib/browser/ParseSession.js +62 -110
  42. package/lib/browser/ParseUser.js +941 -1284
  43. package/lib/browser/Push.js +15 -38
  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 +31 -43
  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 +5 -9
  70. package/lib/node/AnonymousUtils.js +10 -15
  71. package/lib/node/Cloud.js +11 -11
  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 +20 -39
  76. package/lib/node/FacebookUtils.js +4 -8
  77. package/lib/node/IndexedDBStorageController.js +14 -10
  78. package/lib/node/InstallationController.js +12 -13
  79. package/lib/node/LiveQueryClient.js +23 -21
  80. package/lib/node/LiveQuerySubscription.js +6 -7
  81. package/lib/node/LocalDatastore.js +23 -23
  82. package/lib/node/LocalDatastoreController.default.js +11 -12
  83. package/lib/node/LocalDatastoreController.js +14 -1
  84. package/lib/node/LocalDatastoreController.react-native.js +25 -21
  85. package/lib/node/LocalDatastoreUtils.js +4 -7
  86. package/lib/node/ObjectStateMutations.js +12 -22
  87. package/lib/node/OfflineQuery.js +37 -23
  88. package/lib/node/Parse.js +36 -50
  89. package/lib/node/ParseACL.js +21 -30
  90. package/lib/node/ParseCLP.js +38 -40
  91. package/lib/node/ParseConfig.js +10 -17
  92. package/lib/node/ParseError.js +460 -461
  93. package/lib/node/ParseFile.js +27 -47
  94. package/lib/node/ParseGeoPoint.js +16 -17
  95. package/lib/node/ParseHooks.js +16 -18
  96. package/lib/node/ParseInstallation.js +10 -11
  97. package/lib/node/ParseLiveQuery.js +9 -14
  98. package/lib/node/ParseObject.js +142 -173
  99. package/lib/node/ParseOp.js +35 -47
  100. package/lib/node/ParsePolygon.js +14 -20
  101. package/lib/node/ParseQuery.js +100 -123
  102. package/lib/node/ParseRelation.js +10 -19
  103. package/lib/node/ParseRole.js +10 -11
  104. package/lib/node/ParseSchema.js +29 -42
  105. package/lib/node/ParseSession.js +10 -11
  106. package/lib/node/ParseUser.js +76 -87
  107. package/lib/node/Push.js +7 -12
  108. package/lib/node/RESTController.js +24 -36
  109. package/lib/node/SingleInstanceStateController.js +41 -69
  110. package/lib/node/Socket.weapp.js +23 -2
  111. package/lib/node/Storage.js +14 -19
  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 +20 -20
  116. package/lib/node/StorageController.weapp.js +14 -8
  117. package/lib/node/TaskQueue.js +2 -3
  118. package/lib/node/UniqueInstanceStateController.js +43 -63
  119. package/lib/node/WebSocketController.js +15 -2
  120. package/lib/node/Xhr.weapp.js +11 -2
  121. package/lib/node/arrayContainsObject.js +4 -4
  122. package/lib/node/canBeSerialized.js +5 -5
  123. package/lib/node/decode.js +4 -4
  124. package/lib/node/encode.js +5 -5
  125. package/lib/node/equals.js +4 -4
  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 +5 -5
  131. package/lib/node/unsavedChildren.js +5 -5
  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/CoreManager.js +2 -3
  136. package/lib/react-native/CryptoController.js +6 -1
  137. package/lib/react-native/EventEmitter.js +6 -1
  138. package/lib/react-native/EventuallyQueue.js +1 -2
  139. package/lib/react-native/FacebookUtils.js +1 -2
  140. package/lib/react-native/IndexedDBStorageController.js +11 -5
  141. package/lib/react-native/InstallationController.js +1 -2
  142. package/lib/react-native/LiveQueryClient.js +8 -7
  143. package/lib/react-native/LiveQuerySubscription.js +2 -4
  144. package/lib/react-native/LocalDatastore.js +3 -3
  145. package/lib/react-native/LocalDatastoreController.default.js +1 -2
  146. package/lib/react-native/LocalDatastoreController.js +11 -1
  147. package/lib/react-native/LocalDatastoreController.react-native.js +11 -12
  148. package/lib/react-native/LocalDatastoreUtils.js +3 -6
  149. package/lib/react-native/OfflineQuery.js +25 -20
  150. package/lib/react-native/Parse.js +24 -38
  151. package/lib/react-native/ParseACL.js +4 -6
  152. package/lib/react-native/ParseCLP.js +2 -4
  153. package/lib/react-native/ParseConfig.js +4 -6
  154. package/lib/react-native/ParseError.js +13 -31
  155. package/lib/react-native/ParseFile.js +3 -4
  156. package/lib/react-native/ParseGeoPoint.js +2 -4
  157. package/lib/react-native/ParseInstallation.js +13 -30
  158. package/lib/react-native/ParseLiveQuery.js +2 -4
  159. package/lib/react-native/ParseObject.js +77 -87
  160. package/lib/react-native/ParseOp.js +41 -79
  161. package/lib/react-native/ParsePolygon.js +2 -4
  162. package/lib/react-native/ParseQuery.js +43 -45
  163. package/lib/react-native/ParseRelation.js +2 -4
  164. package/lib/react-native/ParseRole.js +13 -30
  165. package/lib/react-native/ParseSchema.js +3 -5
  166. package/lib/react-native/ParseSession.js +12 -29
  167. package/lib/react-native/ParseUser.js +24 -49
  168. package/lib/react-native/RESTController.js +10 -4
  169. package/lib/react-native/SingleInstanceStateController.js +23 -37
  170. package/lib/react-native/Socket.weapp.js +9 -4
  171. package/lib/react-native/Storage.js +1 -2
  172. package/lib/react-native/StorageController.browser.js +6 -1
  173. package/lib/react-native/StorageController.default.js +6 -1
  174. package/lib/react-native/StorageController.js +13 -1
  175. package/lib/react-native/StorageController.react-native.js +11 -6
  176. package/lib/react-native/StorageController.weapp.js +6 -1
  177. package/lib/react-native/TaskQueue.js +2 -4
  178. package/lib/react-native/UniqueInstanceStateController.js +23 -37
  179. package/lib/react-native/WebSocketController.js +9 -1
  180. package/lib/react-native/Xhr.weapp.js +9 -4
  181. package/lib/react-native/unsavedChildren.js +3 -3
  182. package/lib/react-native/uuid.js +1 -2
  183. package/lib/weapp/Analytics.js +7 -11
  184. package/lib/weapp/AnonymousUtils.js +17 -22
  185. package/lib/weapp/Cloud.js +23 -41
  186. package/lib/weapp/CoreManager.js +71 -79
  187. package/lib/weapp/CryptoController.js +14 -9
  188. package/lib/weapp/EventEmitter.js +9 -2
  189. package/lib/weapp/EventuallyQueue.js +156 -357
  190. package/lib/weapp/FacebookUtils.js +23 -28
  191. package/lib/weapp/IndexedDBStorageController.js +18 -14
  192. package/lib/weapp/InstallationController.js +55 -121
  193. package/lib/weapp/LiveQueryClient.js +312 -485
  194. package/lib/weapp/LiveQuerySubscription.js +25 -28
  195. package/lib/weapp/LocalDatastore.js +258 -624
  196. package/lib/weapp/LocalDatastoreController.default.js +42 -226
  197. package/lib/weapp/LocalDatastoreController.js +11 -1
  198. package/lib/weapp/LocalDatastoreController.react-native.js +66 -160
  199. package/lib/weapp/LocalDatastoreUtils.js +4 -7
  200. package/lib/weapp/ObjectStateMutations.js +54 -96
  201. package/lib/weapp/OfflineQuery.js +106 -198
  202. package/lib/weapp/Parse.js +44 -59
  203. package/lib/weapp/ParseACL.js +242 -288
  204. package/lib/weapp/ParseCLP.js +372 -572
  205. package/lib/weapp/ParseConfig.js +115 -138
  206. package/lib/weapp/ParseError.js +85 -182
  207. package/lib/weapp/ParseFile.js +295 -440
  208. package/lib/weapp/ParseGeoPoint.js +121 -146
  209. package/lib/weapp/ParseHooks.js +23 -25
  210. package/lib/weapp/ParseInstallation.js +225 -367
  211. package/lib/weapp/ParseLiveQuery.js +74 -148
  212. package/lib/weapp/ParseObject.js +2014 -2621
  213. package/lib/weapp/ParseOp.js +343 -484
  214. package/lib/weapp/ParsePolygon.js +101 -120
  215. package/lib/weapp/ParseQuery.js +1708 -2052
  216. package/lib/weapp/ParseRelation.js +99 -118
  217. package/lib/weapp/ParseRole.js +88 -140
  218. package/lib/weapp/ParseSchema.js +372 -434
  219. package/lib/weapp/ParseSession.js +62 -110
  220. package/lib/weapp/ParseUser.js +941 -1284
  221. package/lib/weapp/Push.js +15 -38
  222. package/lib/weapp/RESTController.js +86 -125
  223. package/lib/weapp/SingleInstanceStateController.js +57 -86
  224. package/lib/weapp/Socket.weapp.js +50 -33
  225. package/lib/weapp/Storage.js +23 -28
  226. package/lib/weapp/StorageController.browser.js +16 -13
  227. package/lib/weapp/StorageController.default.js +15 -14
  228. package/lib/weapp/StorageController.js +14 -1
  229. package/lib/weapp/StorageController.react-native.js +31 -30
  230. package/lib/weapp/StorageController.weapp.js +19 -13
  231. package/lib/weapp/TaskQueue.js +31 -43
  232. package/lib/weapp/UniqueInstanceStateController.js +65 -86
  233. package/lib/weapp/WebSocketController.js +11 -4
  234. package/lib/weapp/Xhr.weapp.js +90 -78
  235. package/lib/weapp/arrayContainsObject.js +3 -3
  236. package/lib/weapp/canBeSerialized.js +10 -11
  237. package/lib/weapp/decode.js +11 -11
  238. package/lib/weapp/encode.js +11 -11
  239. package/lib/weapp/equals.js +9 -10
  240. package/lib/weapp/escape.js +2 -2
  241. package/lib/weapp/isRevocableSession.js +1 -1
  242. package/lib/weapp/parseDate.js +10 -10
  243. package/lib/weapp/promiseUtils.js +19 -19
  244. package/lib/weapp/unique.js +4 -4
  245. package/lib/weapp/unsavedChildren.js +20 -21
  246. package/lib/weapp/uuid.js +6 -8
  247. package/package.json +24 -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,150 +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.
195
- * If true and if the device is able to provide a more accurate position, it will do so.
196
- * Note that this can result in slower response times or increased power consumption (with a GPS chip on a mobile device for example).
197
- * 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.
198
- * @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.
199
- * The default value is Infinity, meaning that getCurrentPosition() won't return until the position is available.
200
- * @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.
201
- * If set to 0, it means that the device cannot use a cached position and must attempt to retrieve the real current position.
202
- * If set to Infinity the device must return a cached position regardless of its age. Default: 0.
203
- * @static
204
- * @returns {Promise<Parse.GeoPoint>} User's current location
205
- */
206
- }, {
207
- key: "current",
208
- value: function (options) /*: Promise<ParseGeoPoint>*/{
209
- return new _promise.default(function (resolve, reject) {
210
- navigator.geolocation.getCurrentPosition(function (location) {
211
- resolve(new ParseGeoPoint(location.coords.latitude, location.coords.longitude));
212
- }, reject, options);
213
- });
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.');
214
161
  }
215
- }]);
216
- return ParseGeoPoint;
217
- }();
218
- var _default = ParseGeoPoint;
219
- 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,69 +22,67 @@ 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
  }
30
28
  function getTriggers() {
31
29
  return _CoreManager.default.getHooksController().get('triggers');
32
30
  }
33
- function getFunction(name /*: string*/) {
31
+ function getFunction(name) {
34
32
  return _CoreManager.default.getHooksController().get('functions', name);
35
33
  }
36
- function getTrigger(className /*: string*/, triggerName /*: string*/) {
34
+ function getTrigger(className, triggerName) {
37
35
  return _CoreManager.default.getHooksController().get('triggers', className, triggerName);
38
36
  }
39
- function createFunction(functionName /*: string*/, url /*: string*/) {
37
+ function createFunction(functionName, url) {
40
38
  return create({
41
39
  functionName: functionName,
42
40
  url: url
43
41
  });
44
42
  }
45
- function createTrigger(className /*: string*/, triggerName /*: string*/, url /*: string*/) {
43
+ function createTrigger(className, triggerName, url) {
46
44
  return create({
47
45
  className: className,
48
46
  triggerName: triggerName,
49
47
  url: url
50
48
  });
51
49
  }
52
- function create(hook /*: HookDeclaration*/) {
50
+ function create(hook) {
53
51
  return _CoreManager.default.getHooksController().create(hook);
54
52
  }
55
- function updateFunction(functionName /*: string*/, url /*: string*/) {
53
+ function updateFunction(functionName, url) {
56
54
  return update({
57
55
  functionName: functionName,
58
56
  url: url
59
57
  });
60
58
  }
61
- function updateTrigger(className /*: string*/, triggerName /*: string*/, url /*: string*/) {
59
+ function updateTrigger(className, triggerName, url) {
62
60
  return update({
63
61
  className: className,
64
62
  triggerName: triggerName,
65
63
  url: url
66
64
  });
67
65
  }
68
- function update(hook /*: HookDeclaration*/) {
66
+ function update(hook) {
69
67
  return _CoreManager.default.getHooksController().update(hook);
70
68
  }
71
- function removeFunction(functionName /*: string*/) {
69
+ function removeFunction(functionName) {
72
70
  return remove({
73
71
  functionName: functionName
74
72
  });
75
73
  }
76
- function removeTrigger(className /*: string*/, triggerName /*: string*/) {
74
+ function removeTrigger(className, triggerName) {
77
75
  return remove({
78
76
  className: className,
79
77
  triggerName: triggerName
80
78
  });
81
79
  }
82
- function remove(hook /*: HookDeleteArg*/) {
80
+ function remove(hook) {
83
81
  return _CoreManager.default.getHooksController().remove(hook);
84
82
  }
85
- var DefaultController = {
86
- get: function (type /*: string*/, functionName /*:: ?: string*/, triggerName /*:: ?: string*/) {
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 /*: string*/, url /*: string*/, body /*:: ?: any*/) {
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
  }