@carto/api-client 0.4.0-alpha.1 → 0.4.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.
@@ -970,54 +970,6 @@ class WidgetTableSource extends WidgetBaseSource {
970
970
  }
971
971
  }
972
972
 
973
- // deck.gl
974
- // SPDX-License-Identifier: MIT
975
- // Copyright (c) vis.gl contributors
976
- function joinPath() {
977
- return [].slice.call(arguments).map(part => part.endsWith('/') ? part.slice(0, -1) : part).join('/');
978
- }
979
- function buildV3Path(apiBaseUrl, version, endpoint) {
980
- return joinPath(apiBaseUrl, version, endpoint, ...[].slice.call(arguments, 3));
981
- }
982
- /** @internal Required by fetchMap(). */
983
- function buildPublicMapUrl(_ref) {
984
- let {
985
- apiBaseUrl,
986
- cartoMapId
987
- } = _ref;
988
- return buildV3Path(apiBaseUrl, 'v3', 'maps', 'public', cartoMapId);
989
- }
990
- /** @internal Required by fetchMap(). */
991
- function buildStatsUrl(_ref2) {
992
- let {
993
- attribute,
994
- apiBaseUrl,
995
- connectionName,
996
- source,
997
- type
998
- } = _ref2;
999
- if (type === 'query') {
1000
- return buildV3Path(apiBaseUrl, 'v3', 'stats', connectionName, attribute);
1001
- }
1002
- // type === 'table'
1003
- return buildV3Path(apiBaseUrl, 'v3', 'stats', connectionName, source, attribute);
1004
- }
1005
- function buildSourceUrl(_ref3) {
1006
- let {
1007
- apiBaseUrl,
1008
- connectionName,
1009
- endpoint
1010
- } = _ref3;
1011
- return buildV3Path(apiBaseUrl, 'v3', 'maps', connectionName, endpoint);
1012
- }
1013
- function buildQueryUrl(_ref4) {
1014
- let {
1015
- apiBaseUrl,
1016
- connectionName
1017
- } = _ref4;
1018
- return buildV3Path(apiBaseUrl, 'v3', 'sql', connectionName, 'query');
1019
- }
1020
-
1021
973
  // deck.gl
1022
974
  // SPDX-License-Identifier: MIT
1023
975
  // Copyright (c) vis.gl contributors
@@ -1074,6 +1026,54 @@ function formatErrorKey(key) {
1074
1026
  return key.replace(/([A-Z])/g, ' $1').replace(/^./, s => s.toUpperCase());
1075
1027
  }
1076
1028
 
1029
+ // deck.gl
1030
+ // SPDX-License-Identifier: MIT
1031
+ // Copyright (c) vis.gl contributors
1032
+ function joinPath() {
1033
+ return [].slice.call(arguments).map(part => part.endsWith('/') ? part.slice(0, -1) : part).join('/');
1034
+ }
1035
+ function buildV3Path(apiBaseUrl, version, endpoint) {
1036
+ return joinPath(apiBaseUrl, version, endpoint, ...[].slice.call(arguments, 3));
1037
+ }
1038
+ /** @internal Required by fetchMap(). */
1039
+ function buildPublicMapUrl(_ref) {
1040
+ let {
1041
+ apiBaseUrl,
1042
+ cartoMapId
1043
+ } = _ref;
1044
+ return buildV3Path(apiBaseUrl, 'v3', 'maps', 'public', cartoMapId);
1045
+ }
1046
+ /** @internal Required by fetchMap(). */
1047
+ function buildStatsUrl(_ref2) {
1048
+ let {
1049
+ attribute,
1050
+ apiBaseUrl,
1051
+ connectionName,
1052
+ source,
1053
+ type
1054
+ } = _ref2;
1055
+ if (type === 'query') {
1056
+ return buildV3Path(apiBaseUrl, 'v3', 'stats', connectionName, attribute);
1057
+ }
1058
+ // type === 'table'
1059
+ return buildV3Path(apiBaseUrl, 'v3', 'stats', connectionName, source, attribute);
1060
+ }
1061
+ function buildSourceUrl(_ref3) {
1062
+ let {
1063
+ apiBaseUrl,
1064
+ connectionName,
1065
+ endpoint
1066
+ } = _ref3;
1067
+ return buildV3Path(apiBaseUrl, 'v3', 'maps', connectionName, endpoint);
1068
+ }
1069
+ function buildQueryUrl(_ref4) {
1070
+ let {
1071
+ apiBaseUrl,
1072
+ connectionName
1073
+ } = _ref4;
1074
+ return buildV3Path(apiBaseUrl, 'v3', 'sql', connectionName, 'query');
1075
+ }
1076
+
1077
1077
  /******************************************************************************
1078
1078
  * VERSIONS
1079
1079
  */
@@ -1105,7 +1105,7 @@ const requestWithParameters = function (_ref) {
1105
1105
  // user-provided parameters.
1106
1106
  parameters = {
1107
1107
  v: V3_MINOR_VERSION,
1108
- clientId: DEFAULT_CLIENT,
1108
+ client: DEFAULT_CLIENT,
1109
1109
  ...(typeof deck !== 'undefined' && deck.VERSION && {
1110
1110
  deckglVersion: deck.VERSION
1111
1111
  }),
@@ -1347,7 +1347,7 @@ const boundaryTableSource = function (options) {
1347
1347
  };
1348
1348
 
1349
1349
  // deck.gl
1350
- const h3QuerySource$1 = function (options) {
1350
+ const h3QuerySource = function (options) {
1351
1351
  try {
1352
1352
  const {
1353
1353
  aggregationExp,
@@ -1372,14 +1372,17 @@ const h3QuerySource$1 = function (options) {
1372
1372
  if (filters) {
1373
1373
  urlParameters.filters = filters;
1374
1374
  }
1375
- return Promise.resolve(baseSource('query', options, urlParameters));
1375
+ return Promise.resolve(baseSource('query', options, urlParameters).then(result => ({
1376
+ ...result,
1377
+ widgetSource: new WidgetQuerySource(options)
1378
+ })));
1376
1379
  } catch (e) {
1377
1380
  return Promise.reject(e);
1378
1381
  }
1379
1382
  };
1380
1383
 
1381
1384
  // deck.gl
1382
- const h3TableSource$1 = function (options) {
1385
+ const h3TableSource = function (options) {
1383
1386
  try {
1384
1387
  const {
1385
1388
  aggregationExp,
@@ -1400,7 +1403,10 @@ const h3TableSource$1 = function (options) {
1400
1403
  if (filters) {
1401
1404
  urlParameters.filters = filters;
1402
1405
  }
1403
- return Promise.resolve(baseSource('table', options, urlParameters));
1406
+ return Promise.resolve(baseSource('table', options, urlParameters).then(result => ({
1407
+ ...result,
1408
+ widgetSource: new WidgetTableSource(options)
1409
+ })));
1404
1410
  } catch (e) {
1405
1411
  return Promise.reject(e);
1406
1412
  }
@@ -1441,7 +1447,7 @@ const rasterSource = function (options) {
1441
1447
  };
1442
1448
 
1443
1449
  // deck.gl
1444
- const quadbinQuerySource$1 = function (options) {
1450
+ const quadbinQuerySource = function (options) {
1445
1451
  try {
1446
1452
  const {
1447
1453
  aggregationExp,
@@ -1466,14 +1472,17 @@ const quadbinQuerySource$1 = function (options) {
1466
1472
  if (filters) {
1467
1473
  urlParameters.filters = filters;
1468
1474
  }
1469
- return Promise.resolve(baseSource('query', options, urlParameters));
1475
+ return Promise.resolve(baseSource('query', options, urlParameters).then(result => ({
1476
+ ...result,
1477
+ widgetSource: new WidgetQuerySource(options)
1478
+ })));
1470
1479
  } catch (e) {
1471
1480
  return Promise.reject(e);
1472
1481
  }
1473
1482
  };
1474
1483
 
1475
1484
  // deck.gl
1476
- const quadbinTableSource$1 = function (options) {
1485
+ const quadbinTableSource = function (options) {
1477
1486
  try {
1478
1487
  const {
1479
1488
  aggregationExp,
@@ -1494,7 +1503,10 @@ const quadbinTableSource$1 = function (options) {
1494
1503
  if (filters) {
1495
1504
  urlParameters.filters = filters;
1496
1505
  }
1497
- return Promise.resolve(baseSource('table', options, urlParameters));
1506
+ return Promise.resolve(baseSource('table', options, urlParameters).then(result => ({
1507
+ ...result,
1508
+ widgetSource: new WidgetTableSource(options)
1509
+ })));
1498
1510
  } catch (e) {
1499
1511
  return Promise.reject(e);
1500
1512
  }
@@ -1516,7 +1528,7 @@ const quadbinTilesetSource = function (options) {
1516
1528
  };
1517
1529
 
1518
1530
  // deck.gl
1519
- const vectorQuerySource$1 = function (options) {
1531
+ const vectorQuerySource = function (options) {
1520
1532
  try {
1521
1533
  const {
1522
1534
  columns,
@@ -1541,14 +1553,17 @@ const vectorQuerySource$1 = function (options) {
1541
1553
  if (queryParameters) {
1542
1554
  urlParameters.queryParameters = queryParameters;
1543
1555
  }
1544
- return Promise.resolve(baseSource('query', options, urlParameters));
1556
+ return Promise.resolve(baseSource('query', options, urlParameters).then(result => ({
1557
+ ...result,
1558
+ widgetSource: new WidgetQuerySource(options)
1559
+ })));
1545
1560
  } catch (e) {
1546
1561
  return Promise.reject(e);
1547
1562
  }
1548
1563
  };
1549
1564
 
1550
1565
  // deck.gl
1551
- const vectorTableSource$1 = function (options) {
1566
+ const vectorTableSource = function (options) {
1552
1567
  try {
1553
1568
  const {
1554
1569
  columns,
@@ -1569,7 +1584,10 @@ const vectorTableSource$1 = function (options) {
1569
1584
  if (filters) {
1570
1585
  urlParameters.filters = filters;
1571
1586
  }
1572
- return Promise.resolve(baseSource('table', options, urlParameters));
1587
+ return Promise.resolve(baseSource('table', options, urlParameters).then(result => ({
1588
+ ...result,
1589
+ widgetSource: new WidgetTableSource(options)
1590
+ })));
1573
1591
  } catch (e) {
1574
1592
  return Promise.reject(e);
1575
1593
  }
@@ -1590,86 +1608,6 @@ const vectorTilesetSource = function (options) {
1590
1608
  }
1591
1609
  };
1592
1610
 
1593
- /** Wrapper adding Widget API support to [vectorTableSource](https://deck.gl/docs/api-reference/carto/data-sources). */
1594
-
1595
- /** Wrapper adding Widget API support to [quadbinQuerySource](https://deck.gl/docs/api-reference/carto/data-sources). */
1596
- const quadbinQuerySource = function (props) {
1597
- try {
1598
- return Promise.resolve(quadbinQuerySource$1(props)).then(function (response) {
1599
- return {
1600
- ...response,
1601
- widgetSource: new WidgetQuerySource(props)
1602
- };
1603
- });
1604
- } catch (e) {
1605
- return Promise.reject(e);
1606
- }
1607
- };
1608
- /** Wrapper adding Widget API support to [quadbinTableSource](https://deck.gl/docs/api-reference/carto/data-sources). */
1609
- const quadbinTableSource = function (props) {
1610
- try {
1611
- return Promise.resolve(quadbinTableSource$1(props)).then(function (response) {
1612
- return {
1613
- ...response,
1614
- widgetSource: new WidgetTableSource(props)
1615
- };
1616
- });
1617
- } catch (e) {
1618
- return Promise.reject(e);
1619
- }
1620
- };
1621
- /** Wrapper adding Widget API support to [h3QuerySource](https://deck.gl/docs/api-reference/carto/data-sources). */
1622
- const h3QuerySource = function (props) {
1623
- try {
1624
- return Promise.resolve(h3QuerySource$1(props)).then(function (response) {
1625
- return {
1626
- ...response,
1627
- widgetSource: new WidgetQuerySource(props)
1628
- };
1629
- });
1630
- } catch (e) {
1631
- return Promise.reject(e);
1632
- }
1633
- };
1634
- /** Wrapper adding Widget API support to [h3TableSource](https://deck.gl/docs/api-reference/carto/data-sources). */
1635
- const h3TableSource = function (props) {
1636
- try {
1637
- return Promise.resolve(h3TableSource$1(props)).then(function (response) {
1638
- return {
1639
- ...response,
1640
- widgetSource: new WidgetTableSource(props)
1641
- };
1642
- });
1643
- } catch (e) {
1644
- return Promise.reject(e);
1645
- }
1646
- };
1647
- /** Wrapper adding Widget API support to [vectorQuerySource](https://deck.gl/docs/api-reference/carto/data-sources). */
1648
- const vectorQuerySource = function (props) {
1649
- try {
1650
- return Promise.resolve(vectorQuerySource$1(props)).then(function (response) {
1651
- return {
1652
- ...response,
1653
- widgetSource: new WidgetQuerySource(props)
1654
- };
1655
- });
1656
- } catch (e) {
1657
- return Promise.reject(e);
1658
- }
1659
- };
1660
- const vectorTableSource = function (props) {
1661
- try {
1662
- return Promise.resolve(vectorTableSource$1(props)).then(function (response) {
1663
- return {
1664
- ...response,
1665
- widgetSource: new WidgetTableSource(props)
1666
- };
1667
- });
1668
- } catch (e) {
1669
- return Promise.reject(e);
1670
- }
1671
- };
1672
-
1673
1611
  // deck.gl
1674
1612
  const query = function (options) {
1675
1613
  try {