@carto/api-client 0.4.4 → 0.4.5-alpha.0

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.
@@ -4,12 +4,6 @@ var union = require('@turf/union');
4
4
  var invariant = require('@turf/invariant');
5
5
  var helpers = require('@turf/helpers');
6
6
 
7
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
-
9
- var bboxClip__default = /*#__PURE__*/_interopDefaultLegacy(bboxClip);
10
- var bboxPolygon__default = /*#__PURE__*/_interopDefaultLegacy(bboxPolygon);
11
- var union__default = /*#__PURE__*/_interopDefaultLegacy(union);
12
-
13
7
  /**
14
8
  * @internal
15
9
  * @internalRemarks Source: @carto/react-core, @carto/constants, @deck.gl/carto
@@ -245,7 +239,7 @@ function createViewportSpatialFilter(viewport) {
245
239
  if (_isGlobalViewport(viewport)) {
246
240
  return;
247
241
  }
248
- return createPolygonSpatialFilter(bboxPolygon__default["default"](viewport).geometry);
242
+ return createPolygonSpatialFilter(bboxPolygon(viewport).geometry);
249
243
  }
250
244
  /**
251
245
  * Returns a {@link SpatialFilter} for a given {@link Polygon} or
@@ -277,23 +271,23 @@ function _isGlobalViewport(viewport) {
277
271
  */
278
272
  function _normalizeGeometry(geometry) {
279
273
  const WORLD = [-180, -90, +180, +90];
280
- const worldClip = _clean(bboxClip__default["default"](geometry, WORLD).geometry);
274
+ const worldClip = _clean(bboxClip(geometry, WORLD).geometry);
281
275
  const geometryTxWest = _tx(geometry, 360);
282
276
  const geometryTxEast = _tx(geometry, -360);
283
277
  let result = worldClip;
284
278
  if (result && geometryTxWest) {
285
- const worldWestClip = _clean(bboxClip__default["default"](geometryTxWest, WORLD).geometry);
279
+ const worldWestClip = _clean(bboxClip(geometryTxWest, WORLD).geometry);
286
280
  if (worldWestClip) {
287
281
  const collection = helpers.featureCollection([helpers.feature(result), helpers.feature(worldWestClip)]);
288
- const merged = union__default["default"](collection);
282
+ const merged = union(collection);
289
283
  result = merged ? _clean(merged.geometry) : result;
290
284
  }
291
285
  }
292
286
  if (result && geometryTxEast) {
293
- const worldEastClip = _clean(bboxClip__default["default"](geometryTxEast, WORLD).geometry);
287
+ const worldEastClip = _clean(bboxClip(geometryTxEast, WORLD).geometry);
294
288
  if (worldEastClip) {
295
289
  const collection = helpers.featureCollection([helpers.feature(result), helpers.feature(worldEastClip)]);
296
- const merged = union__default["default"](collection);
290
+ const merged = union(collection);
297
291
  result = merged ? _clean(merged.geometry) : result;
298
292
  }
299
293
  }
@@ -486,6 +480,8 @@ function formatErrorKey(key) {
486
480
  }
487
481
 
488
482
  // deck.gl
483
+ // SPDX-License-Identifier: MIT
484
+ // Copyright (c) vis.gl contributors
489
485
  const requestWithParameters = function (_ref) {
490
486
  let {
491
487
  baseUrl,
@@ -617,6 +613,8 @@ function excludeURLParameters(baseUrlString, parameters) {
617
613
  }
618
614
 
619
615
  // deck.gl
616
+ // SPDX-License-Identifier: MIT
617
+ // Copyright (c) vis.gl contributors
620
618
  const baseSource = function (endpoint, options, urlParameters) {
621
619
  try {
622
620
  const {
@@ -712,6 +710,8 @@ const SOURCE_DEFAULTS = {
712
710
  };
713
711
 
714
712
  // deck.gl
713
+ // SPDX-License-Identifier: MIT
714
+ // Copyright (c) vis.gl contributors
715
715
  const boundaryQuerySource = function (options) {
716
716
  try {
717
717
  const {
@@ -741,6 +741,8 @@ const boundaryQuerySource = function (options) {
741
741
  };
742
742
 
743
743
  // deck.gl
744
+ // SPDX-License-Identifier: MIT
745
+ // Copyright (c) vis.gl contributors
744
746
  const boundaryTableSource = function (options) {
745
747
  try {
746
748
  const {
@@ -1546,6 +1548,9 @@ class WidgetTableSource extends WidgetBaseSource {
1546
1548
  }
1547
1549
 
1548
1550
  // deck.gl
1551
+ // SPDX-License-Identifier: MIT
1552
+ // Copyright (c) vis.gl contributors
1553
+ /* eslint-disable camelcase */
1549
1554
  const h3QuerySource = function (options) {
1550
1555
  try {
1551
1556
  const {
@@ -1556,10 +1561,11 @@ const h3QuerySource = function (options) {
1556
1561
  queryParameters,
1557
1562
  filters
1558
1563
  } = options;
1564
+ const spatialDataType = 'h3';
1559
1565
  const urlParameters = {
1560
1566
  aggregationExp,
1561
1567
  spatialDataColumn,
1562
- spatialDataType: 'h3',
1568
+ spatialDataType,
1563
1569
  q: sqlQuery
1564
1570
  };
1565
1571
  if (aggregationResLevel) {
@@ -1575,9 +1581,9 @@ const h3QuerySource = function (options) {
1575
1581
  ...result,
1576
1582
  widgetSource: new WidgetQuerySource({
1577
1583
  ...options,
1578
- // NOTE: passing redundant spatialDataColumn here to apply the default value 'h3'
1584
+ // NOTE: Parameters with default values above must be explicitly passed here.
1579
1585
  spatialDataColumn,
1580
- spatialDataType: 'h3'
1586
+ spatialDataType
1581
1587
  })
1582
1588
  })));
1583
1589
  } catch (e) {
@@ -1586,6 +1592,9 @@ const h3QuerySource = function (options) {
1586
1592
  };
1587
1593
 
1588
1594
  // deck.gl
1595
+ // SPDX-License-Identifier: MIT
1596
+ // Copyright (c) vis.gl contributors
1597
+ /* eslint-disable camelcase */
1589
1598
  const h3TableSource = function (options) {
1590
1599
  try {
1591
1600
  const {
@@ -1595,11 +1604,12 @@ const h3TableSource = function (options) {
1595
1604
  tableName,
1596
1605
  filters
1597
1606
  } = options;
1607
+ const spatialDataType = 'h3';
1598
1608
  const urlParameters = {
1599
1609
  aggregationExp,
1600
1610
  name: tableName,
1601
1611
  spatialDataColumn,
1602
- spatialDataType: 'h3'
1612
+ spatialDataType
1603
1613
  };
1604
1614
  if (aggregationResLevel) {
1605
1615
  urlParameters.aggregationResLevel = String(aggregationResLevel);
@@ -1611,9 +1621,9 @@ const h3TableSource = function (options) {
1611
1621
  ...result,
1612
1622
  widgetSource: new WidgetTableSource({
1613
1623
  ...options,
1614
- // NOTE: passing redundant spatialDataColumn here to apply the default value 'h3'
1624
+ // NOTE: Parameters with default values above must be explicitly passed here.
1615
1625
  spatialDataColumn,
1616
- spatialDataType: 'h3'
1626
+ spatialDataType
1617
1627
  })
1618
1628
  })));
1619
1629
  } catch (e) {
@@ -1622,6 +1632,8 @@ const h3TableSource = function (options) {
1622
1632
  };
1623
1633
 
1624
1634
  // deck.gl
1635
+ // SPDX-License-Identifier: MIT
1636
+ // Copyright (c) vis.gl contributors
1625
1637
  const h3TilesetSource = function (options) {
1626
1638
  try {
1627
1639
  const {
@@ -1637,6 +1649,8 @@ const h3TilesetSource = function (options) {
1637
1649
  };
1638
1650
 
1639
1651
  // deck.gl
1652
+ // SPDX-License-Identifier: MIT
1653
+ // Copyright (c) vis.gl contributors
1640
1654
  const rasterSource = function (options) {
1641
1655
  try {
1642
1656
  const {
@@ -1656,6 +1670,9 @@ const rasterSource = function (options) {
1656
1670
  };
1657
1671
 
1658
1672
  // deck.gl
1673
+ // SPDX-License-Identifier: MIT
1674
+ // Copyright (c) vis.gl contributors
1675
+ /* eslint-disable camelcase */
1659
1676
  const quadbinQuerySource = function (options) {
1660
1677
  try {
1661
1678
  const {
@@ -1666,11 +1683,12 @@ const quadbinQuerySource = function (options) {
1666
1683
  queryParameters,
1667
1684
  filters
1668
1685
  } = options;
1686
+ const spatialDataType = 'quadbin';
1669
1687
  const urlParameters = {
1670
1688
  aggregationExp,
1671
1689
  q: sqlQuery,
1672
1690
  spatialDataColumn,
1673
- spatialDataType: 'quadbin'
1691
+ spatialDataType
1674
1692
  };
1675
1693
  if (aggregationResLevel) {
1676
1694
  urlParameters.aggregationResLevel = String(aggregationResLevel);
@@ -1685,9 +1703,9 @@ const quadbinQuerySource = function (options) {
1685
1703
  ...result,
1686
1704
  widgetSource: new WidgetQuerySource({
1687
1705
  ...options,
1688
- // NOTE: passing redundant spatialDataColumn here to apply the default value 'quadbin'
1706
+ // NOTE: Parameters with default values above must be explicitly passed here.
1689
1707
  spatialDataColumn,
1690
- spatialDataType: 'quadbin'
1708
+ spatialDataType
1691
1709
  })
1692
1710
  })));
1693
1711
  } catch (e) {
@@ -1696,6 +1714,9 @@ const quadbinQuerySource = function (options) {
1696
1714
  };
1697
1715
 
1698
1716
  // deck.gl
1717
+ // SPDX-License-Identifier: MIT
1718
+ // Copyright (c) vis.gl contributors
1719
+ /* eslint-disable camelcase */
1699
1720
  const quadbinTableSource = function (options) {
1700
1721
  try {
1701
1722
  const {
@@ -1705,11 +1726,12 @@ const quadbinTableSource = function (options) {
1705
1726
  tableName,
1706
1727
  filters
1707
1728
  } = options;
1729
+ const spatialDataType = 'quadbin';
1708
1730
  const urlParameters = {
1709
1731
  aggregationExp,
1710
1732
  name: tableName,
1711
1733
  spatialDataColumn,
1712
- spatialDataType: 'quadbin'
1734
+ spatialDataType
1713
1735
  };
1714
1736
  if (aggregationResLevel) {
1715
1737
  urlParameters.aggregationResLevel = String(aggregationResLevel);
@@ -1721,9 +1743,9 @@ const quadbinTableSource = function (options) {
1721
1743
  ...result,
1722
1744
  widgetSource: new WidgetTableSource({
1723
1745
  ...options,
1724
- // NOTE: passing redundant spatialDataColumn here to apply the default value 'quadbin'
1746
+ // NOTE: Parameters with default values above must be explicitly passed here.
1725
1747
  spatialDataColumn,
1726
- spatialDataType: 'quadbin'
1748
+ spatialDataType
1727
1749
  })
1728
1750
  })));
1729
1751
  } catch (e) {
@@ -1732,6 +1754,8 @@ const quadbinTableSource = function (options) {
1732
1754
  };
1733
1755
 
1734
1756
  // deck.gl
1757
+ // SPDX-License-Identifier: MIT
1758
+ // Copyright (c) vis.gl contributors
1735
1759
  const quadbinTilesetSource = function (options) {
1736
1760
  try {
1737
1761
  const {
@@ -1747,6 +1771,9 @@ const quadbinTilesetSource = function (options) {
1747
1771
  };
1748
1772
 
1749
1773
  // deck.gl
1774
+ // SPDX-License-Identifier: MIT
1775
+ // Copyright (c) vis.gl contributors
1776
+ /* eslint-disable camelcase */
1750
1777
  const vectorQuerySource = function (options) {
1751
1778
  try {
1752
1779
  const {
@@ -1758,9 +1785,10 @@ const vectorQuerySource = function (options) {
1758
1785
  queryParameters,
1759
1786
  aggregationExp
1760
1787
  } = options;
1788
+ const spatialDataType = 'geo';
1761
1789
  const urlParameters = {
1762
1790
  spatialDataColumn,
1763
- spatialDataType: 'geo',
1791
+ spatialDataType,
1764
1792
  tileResolution: tileResolution.toString(),
1765
1793
  q: sqlQuery
1766
1794
  };
@@ -1780,7 +1808,10 @@ const vectorQuerySource = function (options) {
1780
1808
  ...result,
1781
1809
  widgetSource: new WidgetQuerySource({
1782
1810
  ...options,
1783
- spatialDataType: 'geo'
1811
+ // NOTE: Parameters with default values above must be explicitly passed here.
1812
+ spatialDataColumn,
1813
+ spatialDataType,
1814
+ tileResolution
1784
1815
  })
1785
1816
  })));
1786
1817
  } catch (e) {
@@ -1789,6 +1820,9 @@ const vectorQuerySource = function (options) {
1789
1820
  };
1790
1821
 
1791
1822
  // deck.gl
1823
+ // SPDX-License-Identifier: MIT
1824
+ // Copyright (c) vis.gl contributors
1825
+ /* eslint-disable camelcase */
1792
1826
  const vectorTableSource = function (options) {
1793
1827
  try {
1794
1828
  const {
@@ -1799,10 +1833,11 @@ const vectorTableSource = function (options) {
1799
1833
  tileResolution = DEFAULT_TILE_RESOLUTION,
1800
1834
  aggregationExp
1801
1835
  } = options;
1836
+ const spatialDataType = 'geo';
1802
1837
  const urlParameters = {
1803
1838
  name: tableName,
1804
1839
  spatialDataColumn,
1805
- spatialDataType: 'geo',
1840
+ spatialDataType,
1806
1841
  tileResolution: tileResolution.toString()
1807
1842
  };
1808
1843
  if (columns) {
@@ -1818,7 +1853,10 @@ const vectorTableSource = function (options) {
1818
1853
  ...result,
1819
1854
  widgetSource: new WidgetTableSource({
1820
1855
  ...options,
1821
- spatialDataType: 'geo'
1856
+ // NOTE: Parameters with default values above must be explicitly passed here.
1857
+ spatialDataColumn,
1858
+ spatialDataType,
1859
+ tileResolution
1822
1860
  })
1823
1861
  })));
1824
1862
  } catch (e) {
@@ -1827,6 +1865,8 @@ const vectorTableSource = function (options) {
1827
1865
  };
1828
1866
 
1829
1867
  // deck.gl
1868
+ // SPDX-License-Identifier: MIT
1869
+ // Copyright (c) vis.gl contributors
1830
1870
  const vectorTilesetSource = function (options) {
1831
1871
  try {
1832
1872
  const {
@@ -1842,6 +1882,8 @@ const vectorTilesetSource = function (options) {
1842
1882
  };
1843
1883
 
1844
1884
  // deck.gl
1885
+ // SPDX-License-Identifier: MIT
1886
+ // Copyright (c) vis.gl contributors
1845
1887
  const query = function (options) {
1846
1888
  try {
1847
1889
  const {