parse 3.5.0-alpha.4 → 3.5.0-alpha.6

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.
@@ -224,7 +224,7 @@ var config
224
224
  SERVER_AUTH_TOKEN: null,
225
225
  LIVEQUERY_SERVER_URL: null,
226
226
  ENCRYPTED_KEY: null,
227
- VERSION: 'js' + "3.5.0-alpha.4",
227
+ VERSION: 'js' + "3.5.0-alpha.6",
228
228
  APPLICATION_ID: null,
229
229
  JAVASCRIPT_KEY: null,
230
230
  MASTER_KEY: null,
@@ -7,8 +7,10 @@ var _idbKeyval = require("idb-keyval");
7
7
  * @flow
8
8
  */
9
9
 
10
+ /* global window */
10
11
 
11
- try {
12
+
13
+ if (typeof window !== 'undefined' && window.indexedDB) {
12
14
  var ParseStore = (0, _idbKeyval.createStore)('parseDB', 'parseStore');
13
15
  var IndexedDBStorageController = {
14
16
  async: 1,
@@ -37,5 +39,7 @@ try {
37
39
  }
38
40
  };
39
41
  module.exports = IndexedDBStorageController;
40
- } catch (e) {// IndexedDB not supported
42
+ } else {
43
+ // IndexedDB not supported
44
+ module.exports = undefined;
41
45
  }
@@ -729,21 +729,42 @@ function matchesKeyConstraints(className, object, objects, key, constraints) {
729
729
 
730
730
  case '$geoWithin':
731
731
  {
732
- var _context4;
732
+ if (compareTo.$polygon) {
733
+ var _context4;
734
+
735
+ var points = (0, _map.default)(_context4 = compareTo.$polygon).call(_context4, function (geoPoint) {
736
+ return [geoPoint.latitude, geoPoint.longitude];
737
+ });
738
+ var polygon = new ParsePolygon(points);
739
+ return polygon.containsPoint(object[key]);
740
+ }
733
741
 
734
- var points = (0, _map.default)(_context4 = compareTo.$polygon).call(_context4, function (geoPoint) {
735
- return [geoPoint.latitude, geoPoint.longitude];
736
- });
737
- var polygon = new ParsePolygon(points);
738
- return polygon.containsPoint(object[key]);
742
+ if (compareTo.$centerSphere) {
743
+ var _compareTo$$centerSph = (0, _slicedToArray2.default)(compareTo.$centerSphere, 2),
744
+ WGS84Point = _compareTo$$centerSph[0],
745
+ maxDistance = _compareTo$$centerSph[1];
746
+
747
+ var centerPoint = new ParseGeoPoint({
748
+ latitude: WGS84Point[1],
749
+ longitude: WGS84Point[0]
750
+ });
751
+ var point = new ParseGeoPoint(object[key]);
752
+
753
+ var _distance = point.radiansTo(centerPoint);
754
+
755
+ return _distance <= maxDistance;
756
+ }
757
+
758
+ break;
739
759
  }
740
760
 
741
761
  case '$geoIntersects':
742
762
  {
743
763
  var _polygon = new ParsePolygon(object[key].coordinates);
744
764
 
745
- var point = new ParseGeoPoint(compareTo.$point);
746
- return _polygon.containsPoint(point);
765
+ var _point = new ParseGeoPoint(compareTo.$point);
766
+
767
+ return _polygon.containsPoint(_point);
747
768
  }
748
769
 
749
770
  default:
@@ -217,7 +217,7 @@ const config
217
217
  SERVER_AUTH_TOKEN: null,
218
218
  LIVEQUERY_SERVER_URL: null,
219
219
  ENCRYPTED_KEY: null,
220
- VERSION: 'js' + "3.5.0-alpha.4",
220
+ VERSION: 'js' + "3.5.0-alpha.6",
221
221
  APPLICATION_ID: null,
222
222
  JAVASCRIPT_KEY: null,
223
223
  MASTER_KEY: null,
@@ -5,8 +5,10 @@ var _idbKeyval = require("idb-keyval");
5
5
  * @flow
6
6
  */
7
7
 
8
+ /* global window */
8
9
 
9
- try {
10
+
11
+ if (typeof window !== 'undefined' && window.indexedDB) {
10
12
  const ParseStore = (0, _idbKeyval.createStore)('parseDB', 'parseStore');
11
13
  module.exports = {
12
14
  async: 1,
@@ -40,5 +42,7 @@ try {
40
42
  }
41
43
 
42
44
  };
43
- } catch (e) {// IndexedDB not supported
45
+ } else {
46
+ // IndexedDB not supported
47
+ module.exports = undefined;
44
48
  }
@@ -590,9 +590,24 @@ function matchesKeyConstraints(className, object, objects, key, constraints) {
590
590
 
591
591
  case '$geoWithin':
592
592
  {
593
- const points = compareTo.$polygon.map(geoPoint => [geoPoint.latitude, geoPoint.longitude]);
594
- const polygon = new ParsePolygon(points);
595
- return polygon.containsPoint(object[key]);
593
+ if (compareTo.$polygon) {
594
+ const points = compareTo.$polygon.map(geoPoint => [geoPoint.latitude, geoPoint.longitude]);
595
+ const polygon = new ParsePolygon(points);
596
+ return polygon.containsPoint(object[key]);
597
+ }
598
+
599
+ if (compareTo.$centerSphere) {
600
+ const [WGS84Point, maxDistance] = compareTo.$centerSphere;
601
+ const centerPoint = new ParseGeoPoint({
602
+ latitude: WGS84Point[1],
603
+ longitude: WGS84Point[0]
604
+ });
605
+ const point = new ParseGeoPoint(object[key]);
606
+ const distance = point.radiansTo(centerPoint);
607
+ return distance <= maxDistance;
608
+ }
609
+
610
+ break;
596
611
  }
597
612
 
598
613
  case '$geoIntersects':
package/lib/node/Parse.js CHANGED
@@ -328,7 +328,6 @@ Parse.Storage = require('./Storage');
328
328
  Parse.User = require('./ParseUser').default;
329
329
  Parse.LiveQuery = require('./ParseLiveQuery').default;
330
330
  Parse.LiveQueryClient = require('./LiveQueryClient').default;
331
- Parse.IndexedDB = require('./IndexedDBStorageController');
332
331
 
333
332
  Parse._request = function (...args) {
334
333
  return _CoreManager.default.getRESTController().request.apply(null, args);
@@ -8,7 +8,7 @@ var config = {
8
8
  SERVER_AUTH_TOKEN: null,
9
9
  LIVEQUERY_SERVER_URL: null,
10
10
  ENCRYPTED_KEY: null,
11
- VERSION: 'js' + "3.5.0-alpha.4",
11
+ VERSION: 'js' + "3.5.0-alpha.6",
12
12
  APPLICATION_ID: null,
13
13
  JAVASCRIPT_KEY: null,
14
14
  MASTER_KEY: null,
@@ -1,6 +1,6 @@
1
1
  var _idbKeyval = require("idb-keyval");
2
2
 
3
- try {
3
+ if (typeof window !== 'undefined' && window.indexedDB) {
4
4
  var ParseStore = (0, _idbKeyval.createStore)('parseDB', 'parseStore');
5
5
  var IndexedDBStorageController = {
6
6
  async: 1,
@@ -21,4 +21,6 @@ try {
21
21
  }
22
22
  };
23
23
  module.exports = IndexedDBStorageController;
24
- } catch (e) {}
24
+ } else {
25
+ module.exports = undefined;
26
+ }
@@ -567,19 +567,40 @@ function matchesKeyConstraints(className, object, objects, key, constraints) {
567
567
 
568
568
  case '$geoWithin':
569
569
  {
570
- var points = compareTo.$polygon.map(function (geoPoint) {
571
- return [geoPoint.latitude, geoPoint.longitude];
572
- });
573
- var polygon = new ParsePolygon(points);
574
- return polygon.containsPoint(object[key]);
570
+ if (compareTo.$polygon) {
571
+ var points = compareTo.$polygon.map(function (geoPoint) {
572
+ return [geoPoint.latitude, geoPoint.longitude];
573
+ });
574
+ var polygon = new ParsePolygon(points);
575
+ return polygon.containsPoint(object[key]);
576
+ }
577
+
578
+ if (compareTo.$centerSphere) {
579
+ var _compareTo$$centerSph = (0, _slicedToArray2.default)(compareTo.$centerSphere, 2),
580
+ WGS84Point = _compareTo$$centerSph[0],
581
+ maxDistance = _compareTo$$centerSph[1];
582
+
583
+ var centerPoint = new ParseGeoPoint({
584
+ latitude: WGS84Point[1],
585
+ longitude: WGS84Point[0]
586
+ });
587
+ var point = new ParseGeoPoint(object[key]);
588
+
589
+ var _distance = point.radiansTo(centerPoint);
590
+
591
+ return _distance <= maxDistance;
592
+ }
593
+
594
+ break;
575
595
  }
576
596
 
577
597
  case '$geoIntersects':
578
598
  {
579
599
  var _polygon = new ParsePolygon(object[key].coordinates);
580
600
 
581
- var point = new ParseGeoPoint(compareTo.$point);
582
- return _polygon.containsPoint(point);
601
+ var _point = new ParseGeoPoint(compareTo.$point);
602
+
603
+ return _polygon.containsPoint(_point);
583
604
  }
584
605
 
585
606
  default:
@@ -213,7 +213,6 @@ Parse.Storage = require('./Storage');
213
213
  Parse.User = require('./ParseUser').default;
214
214
  Parse.LiveQuery = require('./ParseLiveQuery').default;
215
215
  Parse.LiveQueryClient = require('./LiveQueryClient').default;
216
- Parse.IndexedDB = require('./IndexedDBStorageController');
217
216
 
218
217
  Parse._request = function () {
219
218
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
@@ -224,7 +224,7 @@ var config
224
224
  SERVER_AUTH_TOKEN: null,
225
225
  LIVEQUERY_SERVER_URL: null,
226
226
  ENCRYPTED_KEY: null,
227
- VERSION: 'js' + "3.5.0-alpha.4",
227
+ VERSION: 'js' + "3.5.0-alpha.6",
228
228
  APPLICATION_ID: null,
229
229
  JAVASCRIPT_KEY: null,
230
230
  MASTER_KEY: null,
@@ -7,8 +7,10 @@ var _idbKeyval = require("idb-keyval");
7
7
  * @flow
8
8
  */
9
9
 
10
+ /* global window */
10
11
 
11
- try {
12
+
13
+ if (typeof window !== 'undefined' && window.indexedDB) {
12
14
  var ParseStore = (0, _idbKeyval.createStore)('parseDB', 'parseStore');
13
15
  var IndexedDBStorageController = {
14
16
  async: 1,
@@ -37,5 +39,7 @@ try {
37
39
  }
38
40
  };
39
41
  module.exports = IndexedDBStorageController;
40
- } catch (e) {// IndexedDB not supported
42
+ } else {
43
+ // IndexedDB not supported
44
+ module.exports = undefined;
41
45
  }
@@ -729,21 +729,42 @@ function matchesKeyConstraints(className, object, objects, key, constraints) {
729
729
 
730
730
  case '$geoWithin':
731
731
  {
732
- var _context4;
732
+ if (compareTo.$polygon) {
733
+ var _context4;
734
+
735
+ var points = (0, _map.default)(_context4 = compareTo.$polygon).call(_context4, function (geoPoint) {
736
+ return [geoPoint.latitude, geoPoint.longitude];
737
+ });
738
+ var polygon = new ParsePolygon(points);
739
+ return polygon.containsPoint(object[key]);
740
+ }
733
741
 
734
- var points = (0, _map.default)(_context4 = compareTo.$polygon).call(_context4, function (geoPoint) {
735
- return [geoPoint.latitude, geoPoint.longitude];
736
- });
737
- var polygon = new ParsePolygon(points);
738
- return polygon.containsPoint(object[key]);
742
+ if (compareTo.$centerSphere) {
743
+ var _compareTo$$centerSph = (0, _slicedToArray2.default)(compareTo.$centerSphere, 2),
744
+ WGS84Point = _compareTo$$centerSph[0],
745
+ maxDistance = _compareTo$$centerSph[1];
746
+
747
+ var centerPoint = new ParseGeoPoint({
748
+ latitude: WGS84Point[1],
749
+ longitude: WGS84Point[0]
750
+ });
751
+ var point = new ParseGeoPoint(object[key]);
752
+
753
+ var _distance = point.radiansTo(centerPoint);
754
+
755
+ return _distance <= maxDistance;
756
+ }
757
+
758
+ break;
739
759
  }
740
760
 
741
761
  case '$geoIntersects':
742
762
  {
743
763
  var _polygon = new ParsePolygon(object[key].coordinates);
744
764
 
745
- var point = new ParseGeoPoint(compareTo.$point);
746
- return _polygon.containsPoint(point);
765
+ var _point = new ParseGeoPoint(compareTo.$point);
766
+
767
+ return _polygon.containsPoint(_point);
747
768
  }
748
769
 
749
770
  default:
@@ -332,7 +332,6 @@ Parse.Storage = require('./Storage');
332
332
  Parse.User = require('./ParseUser').default;
333
333
  Parse.LiveQuery = require('./ParseLiveQuery').default;
334
334
  Parse.LiveQueryClient = require('./LiveQueryClient').default;
335
- Parse.IndexedDB = require('./IndexedDBStorageController');
336
335
 
337
336
  Parse._request = function () {
338
337
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "parse",
3
- "version": "3.5.0-alpha.4",
3
+ "version": "3.5.0-alpha.6",
4
4
  "description": "The Parse JavaScript SDK",
5
5
  "homepage": "https://parseplatform.org/",
6
6
  "keywords": [