parse 4.0.1-beta.1 → 4.1.0-alpha.1
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.
- package/dist/parse.js +17994 -26193
- package/dist/parse.min.js +2 -2
- package/dist/parse.weapp.js +8738 -17728
- package/dist/parse.weapp.min.js +2 -2
- package/lib/browser/Analytics.js +2 -20
- package/lib/browser/AnonymousUtils.js +6 -35
- package/lib/browser/Cloud.js +12 -70
- package/lib/browser/CloudCode.js +0 -3
- package/lib/browser/CoreManager.js +46 -184
- package/lib/browser/CryptoController.js +2 -16
- package/lib/browser/EventEmitter.js +1 -1
- package/lib/browser/EventuallyQueue.js +277 -824
- package/lib/browser/FacebookUtils.js +6 -35
- package/lib/browser/IndexedDBStorageController.js +3 -14
- package/lib/browser/InstallationController.js +2 -13
- package/lib/browser/LiveQueryClient.js +87 -204
- package/lib/browser/LiveQuerySubscription.js +10 -39
- package/lib/browser/LocalDatastore.js +451 -1081
- package/lib/browser/LocalDatastoreController.js +145 -602
- package/lib/browser/LocalDatastoreController.react-native.js +137 -573
- package/lib/browser/LocalDatastoreUtils.js +2 -12
- package/lib/browser/ObjectStateMutations.js +18 -121
- package/lib/browser/OfflineQuery.js +42 -222
- package/lib/browser/Parse.js +12 -106
- package/lib/browser/ParseACL.js +33 -141
- package/lib/browser/ParseCLP.js +96 -314
- package/lib/browser/ParseConfig.js +18 -88
- package/lib/browser/ParseError.js +63 -90
- package/lib/browser/ParseFile.js +128 -685
- package/lib/browser/ParseGeoPoint.js +23 -82
- package/lib/browser/ParseHooks.js +1 -34
- package/lib/browser/ParseInstallation.js +4 -32
- package/lib/browser/ParseLiveQuery.js +96 -505
- package/lib/browser/ParseObject.js +628 -1840
- package/lib/browser/ParseOp.js +41 -287
- package/lib/browser/ParsePolygon.js +13 -63
- package/lib/browser/ParseQuery.js +404 -1505
- package/lib/browser/ParseRelation.js +12 -61
- package/lib/browser/ParseRole.js +13 -75
- package/lib/browser/ParseSchema.js +49 -201
- package/lib/browser/ParseSession.js +11 -69
- package/lib/browser/ParseUser.js +274 -1127
- package/lib/browser/Push.js +7 -43
- package/lib/browser/RESTController.js +18 -140
- package/lib/browser/SingleInstanceStateController.js +19 -137
- package/lib/browser/Socket.weapp.js +2 -12
- package/lib/browser/Storage.js +10 -73
- package/lib/browser/StorageController.browser.js +4 -17
- package/lib/browser/StorageController.default.js +4 -17
- package/lib/browser/StorageController.react-native.js +6 -33
- package/lib/browser/StorageController.weapp.js +5 -16
- package/lib/browser/TaskQueue.js +1 -22
- package/lib/browser/UniqueInstanceStateController.js +19 -142
- package/lib/browser/Xhr.weapp.js +0 -17
- package/lib/browser/arrayContainsObject.js +2 -16
- package/lib/browser/canBeSerialized.js +3 -33
- package/lib/browser/decode.js +3 -33
- package/lib/browser/encode.js +9 -70
- package/lib/browser/equals.js +2 -25
- package/lib/browser/escape.js +1 -8
- package/lib/browser/isRevocableSession.js +2 -11
- package/lib/browser/parseDate.js +2 -13
- package/lib/browser/promiseUtils.js +3 -21
- package/lib/browser/unique.js +3 -17
- package/lib/browser/unsavedChildren.js +6 -50
- package/lib/browser/uuid.js +3 -1
- package/lib/node/Analytics.js +1 -18
- package/lib/node/AnonymousUtils.js +5 -37
- package/lib/node/Cloud.js +10 -66
- package/lib/node/CloudCode.js +0 -3
- package/lib/node/CoreManager.js +47 -220
- package/lib/node/CryptoController.js +2 -16
- package/lib/node/EventEmitter.js +1 -1
- package/lib/node/EventuallyQueue.js +16 -123
- package/lib/node/FacebookUtils.js +5 -37
- package/lib/node/IndexedDBStorageController.js +3 -19
- package/lib/node/InstallationController.js +2 -15
- package/lib/node/LiveQueryClient.js +56 -136
- package/lib/node/LiveQuerySubscription.js +7 -16
- package/lib/node/LocalDatastore.js +19 -175
- package/lib/node/LocalDatastoreController.js +6 -38
- package/lib/node/LocalDatastoreController.react-native.js +6 -45
- package/lib/node/LocalDatastoreUtils.js +1 -6
- package/lib/node/ObjectStateMutations.js +13 -93
- package/lib/node/OfflineQuery.js +20 -152
- package/lib/node/Parse.js +11 -99
- package/lib/node/ParseACL.js +32 -150
- package/lib/node/ParseCLP.js +69 -262
- package/lib/node/ParseConfig.js +16 -84
- package/lib/node/ParseError.js +61 -65
- package/lib/node/ParseFile.js +49 -205
- package/lib/node/ParseGeoPoint.js +21 -82
- package/lib/node/ParseHooks.js +0 -35
- package/lib/node/ParseInstallation.js +1 -10
- package/lib/node/ParseLiveQuery.js +10 -36
- package/lib/node/ParseObject.js +193 -939
- package/lib/node/ParseOp.js +31 -255
- package/lib/node/ParsePolygon.js +12 -62
- package/lib/node/ParseQuery.js +170 -882
- package/lib/node/ParseRelation.js +11 -61
- package/lib/node/ParseRole.js +10 -57
- package/lib/node/ParseSchema.js +46 -222
- package/lib/node/ParseSession.js +8 -50
- package/lib/node/ParseUser.js +107 -576
- package/lib/node/Push.js +4 -37
- package/lib/node/RESTController.js +8 -110
- package/lib/node/SingleInstanceStateController.js +17 -130
- package/lib/node/Socket.weapp.js +2 -9
- package/lib/node/Storage.js +10 -83
- package/lib/node/StorageController.browser.js +4 -23
- package/lib/node/StorageController.default.js +5 -21
- package/lib/node/StorageController.react-native.js +6 -40
- package/lib/node/StorageController.weapp.js +6 -21
- package/lib/node/TaskQueue.js +1 -17
- package/lib/node/UniqueInstanceStateController.js +16 -133
- package/lib/node/Xhr.weapp.js +0 -15
- package/lib/node/arrayContainsObject.js +1 -12
- package/lib/node/canBeSerialized.js +2 -28
- package/lib/node/decode.js +1 -26
- package/lib/node/encode.js +3 -54
- package/lib/node/equals.js +0 -18
- package/lib/node/escape.js +1 -6
- package/lib/node/isRevocableSession.js +1 -5
- package/lib/node/parseDate.js +1 -7
- package/lib/node/promiseUtils.js +2 -14
- package/lib/node/unique.js +1 -11
- package/lib/node/unsavedChildren.js +2 -38
- package/lib/node/uuid.js +6 -1
- package/lib/react-native/Analytics.js +0 -9
- package/lib/react-native/AnonymousUtils.js +0 -10
- package/lib/react-native/Cloud.js +0 -26
- package/lib/react-native/CoreManager.js +1 -5
- package/lib/react-native/CryptoController.js +0 -2
- package/lib/react-native/EventEmitter.js +0 -2
- package/lib/react-native/EventuallyQueue.js +4 -52
- package/lib/react-native/FacebookUtils.js +0 -22
- package/lib/react-native/IndexedDBStorageController.js +0 -1
- package/lib/react-native/InstallationController.js +0 -6
- package/lib/react-native/LiveQueryClient.js +24 -101
- package/lib/react-native/LiveQuerySubscription.js +3 -27
- package/lib/react-native/LocalDatastore.js +6 -113
- package/lib/react-native/LocalDatastoreController.js +0 -21
- package/lib/react-native/LocalDatastoreController.react-native.js +4 -31
- package/lib/react-native/LocalDatastoreUtils.js +0 -1
- package/lib/react-native/ObjectStateMutations.js +0 -34
- package/lib/react-native/OfflineQuery.js +2 -137
- package/lib/react-native/Parse.js +0 -65
- package/lib/react-native/ParseACL.js +0 -44
- package/lib/react-native/ParseCLP.js +32 -96
- package/lib/react-native/ParseConfig.js +0 -42
- package/lib/react-native/ParseError.js +1 -21
- package/lib/react-native/ParseFile.js +3 -72
- package/lib/react-native/ParseGeoPoint.js +0 -17
- package/lib/react-native/ParseHooks.js +0 -30
- package/lib/react-native/ParseInstallation.js +1 -23
- package/lib/react-native/ParseLiveQuery.js +3 -25
- package/lib/react-native/ParseObject.js +4 -371
- package/lib/react-native/ParseOp.js +1 -138
- package/lib/react-native/ParsePolygon.js +0 -24
- package/lib/react-native/ParseQuery.js +6 -262
- package/lib/react-native/ParseRelation.js +0 -25
- package/lib/react-native/ParseRole.js +1 -36
- package/lib/react-native/ParseSchema.js +0 -51
- package/lib/react-native/ParseSession.js +1 -40
- package/lib/react-native/ParseUser.js +1 -224
- package/lib/react-native/Push.js +0 -16
- package/lib/react-native/RESTController.js +1 -70
- package/lib/react-native/SingleInstanceStateController.js +0 -44
- package/lib/react-native/Socket.weapp.js +2 -12
- package/lib/react-native/Storage.js +0 -24
- package/lib/react-native/StorageController.browser.js +0 -2
- package/lib/react-native/StorageController.default.js +0 -1
- package/lib/react-native/StorageController.react-native.js +0 -2
- package/lib/react-native/TaskQueue.js +0 -15
- package/lib/react-native/UniqueInstanceStateController.js +0 -47
- package/lib/react-native/Xhr.weapp.js +0 -16
- package/lib/react-native/arrayContainsObject.js +0 -5
- package/lib/react-native/canBeSerialized.js +0 -18
- package/lib/react-native/decode.js +0 -21
- package/lib/react-native/encode.js +0 -25
- package/lib/react-native/equals.js +0 -18
- package/lib/react-native/escape.js +0 -1
- package/lib/react-native/isRevocableSession.js +0 -1
- package/lib/react-native/parseDate.js +0 -3
- package/lib/react-native/promiseUtils.js +0 -13
- package/lib/react-native/unique.js +0 -4
- package/lib/react-native/unsavedChildren.js +0 -21
- package/lib/react-native/uuid.js +3 -1
- package/lib/weapp/Analytics.js +2 -20
- package/lib/weapp/AnonymousUtils.js +6 -35
- package/lib/weapp/Cloud.js +12 -70
- package/lib/weapp/CloudCode.js +0 -3
- package/lib/weapp/CoreManager.js +46 -184
- package/lib/weapp/CryptoController.js +2 -16
- package/lib/weapp/EventEmitter.js +1 -1
- package/lib/weapp/EventuallyQueue.js +277 -824
- package/lib/weapp/FacebookUtils.js +6 -35
- package/lib/weapp/IndexedDBStorageController.js +3 -14
- package/lib/weapp/InstallationController.js +2 -13
- package/lib/weapp/LiveQueryClient.js +87 -204
- package/lib/weapp/LiveQuerySubscription.js +10 -39
- package/lib/weapp/LocalDatastore.js +451 -1081
- package/lib/weapp/LocalDatastoreController.js +145 -602
- package/lib/weapp/LocalDatastoreController.react-native.js +137 -573
- package/lib/weapp/LocalDatastoreUtils.js +2 -12
- package/lib/weapp/ObjectStateMutations.js +18 -121
- package/lib/weapp/OfflineQuery.js +42 -222
- package/lib/weapp/Parse.js +12 -106
- package/lib/weapp/ParseACL.js +33 -141
- package/lib/weapp/ParseCLP.js +96 -314
- package/lib/weapp/ParseConfig.js +18 -88
- package/lib/weapp/ParseError.js +63 -90
- package/lib/weapp/ParseFile.js +129 -686
- package/lib/weapp/ParseGeoPoint.js +23 -82
- package/lib/weapp/ParseHooks.js +1 -34
- package/lib/weapp/ParseInstallation.js +4 -32
- package/lib/weapp/ParseLiveQuery.js +96 -505
- package/lib/weapp/ParseObject.js +628 -1840
- package/lib/weapp/ParseOp.js +41 -287
- package/lib/weapp/ParsePolygon.js +13 -63
- package/lib/weapp/ParseQuery.js +404 -1505
- package/lib/weapp/ParseRelation.js +12 -61
- package/lib/weapp/ParseRole.js +13 -75
- package/lib/weapp/ParseSchema.js +49 -201
- package/lib/weapp/ParseSession.js +11 -69
- package/lib/weapp/ParseUser.js +274 -1127
- package/lib/weapp/Push.js +7 -43
- package/lib/weapp/RESTController.js +18 -140
- package/lib/weapp/SingleInstanceStateController.js +19 -137
- package/lib/weapp/Socket.weapp.js +2 -12
- package/lib/weapp/Storage.js +10 -73
- package/lib/weapp/StorageController.browser.js +4 -17
- package/lib/weapp/StorageController.default.js +4 -17
- package/lib/weapp/StorageController.react-native.js +6 -33
- package/lib/weapp/StorageController.weapp.js +5 -16
- package/lib/weapp/TaskQueue.js +1 -22
- package/lib/weapp/UniqueInstanceStateController.js +19 -142
- package/lib/weapp/Xhr.weapp.js +0 -17
- package/lib/weapp/arrayContainsObject.js +2 -16
- package/lib/weapp/canBeSerialized.js +3 -33
- package/lib/weapp/decode.js +3 -33
- package/lib/weapp/encode.js +9 -70
- package/lib/weapp/equals.js +2 -25
- package/lib/weapp/escape.js +1 -8
- package/lib/weapp/isRevocableSession.js +2 -11
- package/lib/weapp/parseDate.js +2 -13
- package/lib/weapp/promiseUtils.js +3 -21
- package/lib/weapp/unique.js +3 -17
- package/lib/weapp/unsavedChildren.js +6 -50
- package/lib/weapp/uuid.js +1 -6
- package/package.json +48 -46
|
@@ -1,28 +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
15
|
* @flow
|
|
24
16
|
*/
|
|
25
|
-
|
|
26
17
|
/**
|
|
27
18
|
* Creates a new GeoPoint with any of the following forms:<br>
|
|
28
19
|
* <pre>
|
|
@@ -46,37 +37,26 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/he
|
|
|
46
37
|
*
|
|
47
38
|
* @alias Parse.GeoPoint
|
|
48
39
|
*/
|
|
49
|
-
|
|
50
40
|
/* global navigator */
|
|
51
|
-
|
|
52
|
-
|
|
53
41
|
var ParseGeoPoint = /*#__PURE__*/function () {
|
|
54
42
|
/**
|
|
55
43
|
* @param {(number[] | object | number)} arg1 Either a list of coordinate pairs, an object with `latitude`, `longitude`, or the latitude or the point.
|
|
56
44
|
* @param {number} arg2 The longitude of the GeoPoint
|
|
57
45
|
*/
|
|
58
|
-
function ParseGeoPoint(arg1
|
|
59
|
-
/*: Array<number> | { latitude: number, longitude: number } | number*/
|
|
60
|
-
, arg2
|
|
61
|
-
/*:: ?: number*/
|
|
62
|
-
) {
|
|
46
|
+
function ParseGeoPoint(arg1 /*: Array<number> | { latitude: number, longitude: number } | number*/, arg2 /*:: ?: number*/) {
|
|
63
47
|
(0, _classCallCheck2.default)(this, ParseGeoPoint);
|
|
64
48
|
(0, _defineProperty2.default)(this, "_latitude", void 0);
|
|
65
49
|
(0, _defineProperty2.default)(this, "_longitude", void 0);
|
|
66
|
-
|
|
67
50
|
if ((0, _isArray.default)(arg1)) {
|
|
68
51
|
ParseGeoPoint._validate(arg1[0], arg1[1]);
|
|
69
|
-
|
|
70
52
|
this._latitude = arg1[0];
|
|
71
53
|
this._longitude = arg1[1];
|
|
72
54
|
} else if ((0, _typeof2.default)(arg1) === 'object') {
|
|
73
55
|
ParseGeoPoint._validate(arg1.latitude, arg1.longitude);
|
|
74
|
-
|
|
75
56
|
this._latitude = arg1.latitude;
|
|
76
57
|
this._longitude = arg1.longitude;
|
|
77
58
|
} else if (arg1 !== undefined && arg2 !== undefined) {
|
|
78
59
|
ParseGeoPoint._validate(arg1, arg2);
|
|
79
|
-
|
|
80
60
|
this._latitude = arg1;
|
|
81
61
|
this._longitude = arg2;
|
|
82
62
|
} else {
|
|
@@ -84,6 +64,7 @@ var ParseGeoPoint = /*#__PURE__*/function () {
|
|
|
84
64
|
this._longitude = 0;
|
|
85
65
|
}
|
|
86
66
|
}
|
|
67
|
+
|
|
87
68
|
/**
|
|
88
69
|
* North-south portion of the coordinate, in range [-90, 90].
|
|
89
70
|
* Throws an exception if set out of range in a modern browser.
|
|
@@ -91,22 +72,16 @@ var ParseGeoPoint = /*#__PURE__*/function () {
|
|
|
91
72
|
* @property {number} latitude
|
|
92
73
|
* @returns {number}
|
|
93
74
|
*/
|
|
94
|
-
|
|
95
|
-
|
|
96
75
|
(0, _createClass2.default)(ParseGeoPoint, [{
|
|
97
76
|
key: "latitude",
|
|
98
|
-
get: function ()
|
|
99
|
-
/*: number*/
|
|
100
|
-
{
|
|
77
|
+
get: function () /*: number*/{
|
|
101
78
|
return this._latitude;
|
|
102
79
|
},
|
|
103
|
-
set: function (val
|
|
104
|
-
/*: number*/
|
|
105
|
-
) {
|
|
80
|
+
set: function (val /*: number*/) {
|
|
106
81
|
ParseGeoPoint._validate(val, this.longitude);
|
|
107
|
-
|
|
108
82
|
this._latitude = val;
|
|
109
83
|
}
|
|
84
|
+
|
|
110
85
|
/**
|
|
111
86
|
* East-west portion of the coordinate, in range [-180, 180].
|
|
112
87
|
* Throws if set out of range in a modern browser.
|
|
@@ -114,34 +89,25 @@ var ParseGeoPoint = /*#__PURE__*/function () {
|
|
|
114
89
|
* @property {number} longitude
|
|
115
90
|
* @returns {number}
|
|
116
91
|
*/
|
|
117
|
-
|
|
118
92
|
}, {
|
|
119
93
|
key: "longitude",
|
|
120
|
-
get: function ()
|
|
121
|
-
/*: number*/
|
|
122
|
-
{
|
|
94
|
+
get: function () /*: number*/{
|
|
123
95
|
return this._longitude;
|
|
124
96
|
},
|
|
125
|
-
set: function (val
|
|
126
|
-
/*: number*/
|
|
127
|
-
) {
|
|
97
|
+
set: function (val /*: number*/) {
|
|
128
98
|
ParseGeoPoint._validate(this.latitude, val);
|
|
129
|
-
|
|
130
99
|
this._longitude = val;
|
|
131
100
|
}
|
|
101
|
+
|
|
132
102
|
/**
|
|
133
103
|
* Returns a JSON representation of the GeoPoint, suitable for Parse.
|
|
134
104
|
*
|
|
135
105
|
* @returns {object}
|
|
136
106
|
*/
|
|
137
|
-
|
|
138
107
|
}, {
|
|
139
108
|
key: "toJSON",
|
|
140
|
-
value: function ()
|
|
141
|
-
/*: { __type: string, latitude: number, longitude: number }*/
|
|
142
|
-
{
|
|
109
|
+
value: function () /*: { __type: string, latitude: number, longitude: number }*/{
|
|
143
110
|
ParseGeoPoint._validate(this._latitude, this._longitude);
|
|
144
|
-
|
|
145
111
|
return {
|
|
146
112
|
__type: 'GeoPoint',
|
|
147
113
|
latitude: this._latitude,
|
|
@@ -150,109 +116,85 @@ var ParseGeoPoint = /*#__PURE__*/function () {
|
|
|
150
116
|
}
|
|
151
117
|
}, {
|
|
152
118
|
key: "equals",
|
|
153
|
-
value: function (other
|
|
154
|
-
/*: mixed*/
|
|
155
|
-
)
|
|
156
|
-
/*: boolean*/
|
|
157
|
-
{
|
|
119
|
+
value: function (other /*: mixed*/) /*: boolean*/{
|
|
158
120
|
return other instanceof ParseGeoPoint && this.latitude === other.latitude && this.longitude === other.longitude;
|
|
159
121
|
}
|
|
122
|
+
|
|
160
123
|
/**
|
|
161
124
|
* Returns the distance from this GeoPoint to another in radians.
|
|
162
125
|
*
|
|
163
126
|
* @param {Parse.GeoPoint} point the other Parse.GeoPoint.
|
|
164
127
|
* @returns {number}
|
|
165
128
|
*/
|
|
166
|
-
|
|
167
129
|
}, {
|
|
168
130
|
key: "radiansTo",
|
|
169
|
-
value: function (point
|
|
170
|
-
/*: ParseGeoPoint*/
|
|
171
|
-
)
|
|
172
|
-
/*: number*/
|
|
173
|
-
{
|
|
131
|
+
value: function (point /*: ParseGeoPoint*/) /*: number*/{
|
|
174
132
|
var d2r = Math.PI / 180.0;
|
|
175
133
|
var lat1rad = this.latitude * d2r;
|
|
176
134
|
var long1rad = this.longitude * d2r;
|
|
177
135
|
var lat2rad = point.latitude * d2r;
|
|
178
136
|
var long2rad = point.longitude * d2r;
|
|
179
137
|
var sinDeltaLatDiv2 = Math.sin((lat1rad - lat2rad) / 2);
|
|
180
|
-
var sinDeltaLongDiv2 = Math.sin((long1rad - long2rad) / 2);
|
|
181
|
-
|
|
138
|
+
var sinDeltaLongDiv2 = Math.sin((long1rad - long2rad) / 2);
|
|
139
|
+
// Square of half the straight line chord distance between both points.
|
|
182
140
|
var a = sinDeltaLatDiv2 * sinDeltaLatDiv2 + Math.cos(lat1rad) * Math.cos(lat2rad) * sinDeltaLongDiv2 * sinDeltaLongDiv2;
|
|
183
141
|
a = Math.min(1.0, a);
|
|
184
142
|
return 2 * Math.asin(Math.sqrt(a));
|
|
185
143
|
}
|
|
144
|
+
|
|
186
145
|
/**
|
|
187
146
|
* Returns the distance from this GeoPoint to another in kilometers.
|
|
188
147
|
*
|
|
189
148
|
* @param {Parse.GeoPoint} point the other Parse.GeoPoint.
|
|
190
149
|
* @returns {number}
|
|
191
150
|
*/
|
|
192
|
-
|
|
193
151
|
}, {
|
|
194
152
|
key: "kilometersTo",
|
|
195
|
-
value: function (point
|
|
196
|
-
/*: ParseGeoPoint*/
|
|
197
|
-
)
|
|
198
|
-
/*: number*/
|
|
199
|
-
{
|
|
153
|
+
value: function (point /*: ParseGeoPoint*/) /*: number*/{
|
|
200
154
|
return this.radiansTo(point) * 6371.0;
|
|
201
155
|
}
|
|
156
|
+
|
|
202
157
|
/**
|
|
203
158
|
* Returns the distance from this GeoPoint to another in miles.
|
|
204
159
|
*
|
|
205
160
|
* @param {Parse.GeoPoint} point the other Parse.GeoPoint.
|
|
206
161
|
* @returns {number}
|
|
207
162
|
*/
|
|
208
|
-
|
|
209
163
|
}, {
|
|
210
164
|
key: "milesTo",
|
|
211
|
-
value: function (point
|
|
212
|
-
/*: ParseGeoPoint*/
|
|
213
|
-
)
|
|
214
|
-
/*: number*/
|
|
215
|
-
{
|
|
165
|
+
value: function (point /*: ParseGeoPoint*/) /*: number*/{
|
|
216
166
|
return this.radiansTo(point) * 3958.8;
|
|
217
167
|
}
|
|
168
|
+
|
|
218
169
|
/*
|
|
219
170
|
* Throws an exception if the given lat-long is out of bounds.
|
|
220
171
|
*/
|
|
221
|
-
|
|
222
172
|
}], [{
|
|
223
173
|
key: "_validate",
|
|
224
|
-
value: function (latitude
|
|
225
|
-
/*: number*/
|
|
226
|
-
, longitude
|
|
227
|
-
/*: number*/
|
|
228
|
-
) {
|
|
174
|
+
value: function (latitude /*: number*/, longitude /*: number*/) {
|
|
229
175
|
if (isNaN(latitude) || isNaN(longitude) || typeof latitude !== 'number' || typeof longitude !== 'number') {
|
|
230
176
|
throw new TypeError('GeoPoint latitude and longitude must be valid numbers');
|
|
231
177
|
}
|
|
232
|
-
|
|
233
178
|
if (latitude < -90.0) {
|
|
234
179
|
throw new TypeError('GeoPoint latitude out of bounds: ' + latitude + ' < -90.0.');
|
|
235
180
|
}
|
|
236
|
-
|
|
237
181
|
if (latitude > 90.0) {
|
|
238
182
|
throw new TypeError('GeoPoint latitude out of bounds: ' + latitude + ' > 90.0.');
|
|
239
183
|
}
|
|
240
|
-
|
|
241
184
|
if (longitude < -180.0) {
|
|
242
185
|
throw new TypeError('GeoPoint longitude out of bounds: ' + longitude + ' < -180.0.');
|
|
243
186
|
}
|
|
244
|
-
|
|
245
187
|
if (longitude > 180.0) {
|
|
246
188
|
throw new TypeError('GeoPoint longitude out of bounds: ' + longitude + ' > 180.0.');
|
|
247
189
|
}
|
|
248
190
|
}
|
|
191
|
+
|
|
249
192
|
/**
|
|
250
193
|
* Creates a GeoPoint with the user's current location, if available.
|
|
251
194
|
*
|
|
252
195
|
* @static
|
|
253
196
|
* @returns {Parse.GeoPoint} User's current location
|
|
254
197
|
*/
|
|
255
|
-
|
|
256
198
|
}, {
|
|
257
199
|
key: "current",
|
|
258
200
|
value: function () {
|
|
@@ -263,6 +205,5 @@ var ParseGeoPoint = /*#__PURE__*/function () {
|
|
|
263
205
|
}]);
|
|
264
206
|
return ParseGeoPoint;
|
|
265
207
|
}();
|
|
266
|
-
|
|
267
208
|
var _default = ParseGeoPoint;
|
|
268
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
|
-
|
|
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);
|