@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.
- package/build/api-client.cjs +79 -141
- package/build/api-client.cjs.map +1 -1
- package/build/api-client.modern.js +69 -106
- package/build/api-client.modern.js.map +1 -1
- package/build/index.d.ts +1 -1
- package/build/sources/h3-query-source.d.ts +2 -1
- package/build/sources/h3-table-source.d.ts +2 -1
- package/build/sources/quadbin-query-source.d.ts +2 -1
- package/build/sources/quadbin-table-source.d.ts +2 -1
- package/build/sources/vector-query-source.d.ts +2 -1
- package/build/sources/vector-table-source.d.ts +2 -1
- package/build/widget-sources/index.d.ts +0 -1
- package/build/widget-sources/widget-query-source.d.ts +3 -0
- package/build/widget-sources/widget-table-source.d.ts +3 -0
- package/package.json +2 -2
- package/src/api/request-with-parameters.ts +1 -1
- package/src/index.ts +17 -7
- package/src/sources/h3-query-source.ts +8 -6
- package/src/sources/h3-table-source.ts +8 -6
- package/src/sources/quadbin-query-source.ts +8 -6
- package/src/sources/quadbin-table-source.ts +8 -6
- package/src/sources/vector-query-source.ts +11 -6
- package/src/sources/vector-table-source.ts +11 -6
- package/src/widget-sources/index.ts +0 -1
- package/src/widget-sources/widget-query-source.ts +2 -0
- package/src/widget-sources/widget-table-source.ts +2 -0
- package/build/widget-sources/wrappers.d.ts +0 -48
- package/src/widget-sources/wrappers.ts +0 -120
|
@@ -911,50 +911,6 @@ class WidgetTableSource extends WidgetBaseSource {
|
|
|
911
911
|
}
|
|
912
912
|
}
|
|
913
913
|
|
|
914
|
-
// deck.gl
|
|
915
|
-
// SPDX-License-Identifier: MIT
|
|
916
|
-
// Copyright (c) vis.gl contributors
|
|
917
|
-
function joinPath(...args) {
|
|
918
|
-
return args.map(part => part.endsWith('/') ? part.slice(0, -1) : part).join('/');
|
|
919
|
-
}
|
|
920
|
-
function buildV3Path(apiBaseUrl, version, endpoint, ...rest) {
|
|
921
|
-
return joinPath(apiBaseUrl, version, endpoint, ...rest);
|
|
922
|
-
}
|
|
923
|
-
/** @internal Required by fetchMap(). */
|
|
924
|
-
function buildPublicMapUrl({
|
|
925
|
-
apiBaseUrl,
|
|
926
|
-
cartoMapId
|
|
927
|
-
}) {
|
|
928
|
-
return buildV3Path(apiBaseUrl, 'v3', 'maps', 'public', cartoMapId);
|
|
929
|
-
}
|
|
930
|
-
/** @internal Required by fetchMap(). */
|
|
931
|
-
function buildStatsUrl({
|
|
932
|
-
attribute,
|
|
933
|
-
apiBaseUrl,
|
|
934
|
-
connectionName,
|
|
935
|
-
source,
|
|
936
|
-
type
|
|
937
|
-
}) {
|
|
938
|
-
if (type === 'query') {
|
|
939
|
-
return buildV3Path(apiBaseUrl, 'v3', 'stats', connectionName, attribute);
|
|
940
|
-
}
|
|
941
|
-
// type === 'table'
|
|
942
|
-
return buildV3Path(apiBaseUrl, 'v3', 'stats', connectionName, source, attribute);
|
|
943
|
-
}
|
|
944
|
-
function buildSourceUrl({
|
|
945
|
-
apiBaseUrl,
|
|
946
|
-
connectionName,
|
|
947
|
-
endpoint
|
|
948
|
-
}) {
|
|
949
|
-
return buildV3Path(apiBaseUrl, 'v3', 'maps', connectionName, endpoint);
|
|
950
|
-
}
|
|
951
|
-
function buildQueryUrl({
|
|
952
|
-
apiBaseUrl,
|
|
953
|
-
connectionName
|
|
954
|
-
}) {
|
|
955
|
-
return buildV3Path(apiBaseUrl, 'v3', 'sql', connectionName, 'query');
|
|
956
|
-
}
|
|
957
|
-
|
|
958
914
|
// deck.gl
|
|
959
915
|
// SPDX-License-Identifier: MIT
|
|
960
916
|
// Copyright (c) vis.gl contributors
|
|
@@ -1011,6 +967,50 @@ function formatErrorKey(key) {
|
|
|
1011
967
|
return key.replace(/([A-Z])/g, ' $1').replace(/^./, s => s.toUpperCase());
|
|
1012
968
|
}
|
|
1013
969
|
|
|
970
|
+
// deck.gl
|
|
971
|
+
// SPDX-License-Identifier: MIT
|
|
972
|
+
// Copyright (c) vis.gl contributors
|
|
973
|
+
function joinPath(...args) {
|
|
974
|
+
return args.map(part => part.endsWith('/') ? part.slice(0, -1) : part).join('/');
|
|
975
|
+
}
|
|
976
|
+
function buildV3Path(apiBaseUrl, version, endpoint, ...rest) {
|
|
977
|
+
return joinPath(apiBaseUrl, version, endpoint, ...rest);
|
|
978
|
+
}
|
|
979
|
+
/** @internal Required by fetchMap(). */
|
|
980
|
+
function buildPublicMapUrl({
|
|
981
|
+
apiBaseUrl,
|
|
982
|
+
cartoMapId
|
|
983
|
+
}) {
|
|
984
|
+
return buildV3Path(apiBaseUrl, 'v3', 'maps', 'public', cartoMapId);
|
|
985
|
+
}
|
|
986
|
+
/** @internal Required by fetchMap(). */
|
|
987
|
+
function buildStatsUrl({
|
|
988
|
+
attribute,
|
|
989
|
+
apiBaseUrl,
|
|
990
|
+
connectionName,
|
|
991
|
+
source,
|
|
992
|
+
type
|
|
993
|
+
}) {
|
|
994
|
+
if (type === 'query') {
|
|
995
|
+
return buildV3Path(apiBaseUrl, 'v3', 'stats', connectionName, attribute);
|
|
996
|
+
}
|
|
997
|
+
// type === 'table'
|
|
998
|
+
return buildV3Path(apiBaseUrl, 'v3', 'stats', connectionName, source, attribute);
|
|
999
|
+
}
|
|
1000
|
+
function buildSourceUrl({
|
|
1001
|
+
apiBaseUrl,
|
|
1002
|
+
connectionName,
|
|
1003
|
+
endpoint
|
|
1004
|
+
}) {
|
|
1005
|
+
return buildV3Path(apiBaseUrl, 'v3', 'maps', connectionName, endpoint);
|
|
1006
|
+
}
|
|
1007
|
+
function buildQueryUrl({
|
|
1008
|
+
apiBaseUrl,
|
|
1009
|
+
connectionName
|
|
1010
|
+
}) {
|
|
1011
|
+
return buildV3Path(apiBaseUrl, 'v3', 'sql', connectionName, 'query');
|
|
1012
|
+
}
|
|
1013
|
+
|
|
1014
1014
|
/******************************************************************************
|
|
1015
1015
|
* VERSIONS
|
|
1016
1016
|
*/
|
|
@@ -1044,7 +1044,7 @@ async function requestWithParameters({
|
|
|
1044
1044
|
// user-provided parameters.
|
|
1045
1045
|
parameters = _extends({
|
|
1046
1046
|
v: V3_MINOR_VERSION,
|
|
1047
|
-
|
|
1047
|
+
client: DEFAULT_CLIENT
|
|
1048
1048
|
}, typeof deck !== 'undefined' && deck.VERSION && {
|
|
1049
1049
|
deckglVersion: deck.VERSION
|
|
1050
1050
|
}, parameters);
|
|
@@ -1240,8 +1240,7 @@ const boundaryTableSource = async function boundaryTableSource(options) {
|
|
|
1240
1240
|
return baseSource('boundary', options, urlParameters);
|
|
1241
1241
|
};
|
|
1242
1242
|
|
|
1243
|
-
|
|
1244
|
-
const h3QuerySource$1 = async function h3QuerySource(options) {
|
|
1243
|
+
const h3QuerySource = async function h3QuerySource(options) {
|
|
1245
1244
|
const {
|
|
1246
1245
|
aggregationExp,
|
|
1247
1246
|
aggregationResLevel = DEFAULT_AGGREGATION_RES_LEVEL_H3,
|
|
@@ -1265,11 +1264,12 @@ const h3QuerySource$1 = async function h3QuerySource(options) {
|
|
|
1265
1264
|
if (filters) {
|
|
1266
1265
|
urlParameters.filters = filters;
|
|
1267
1266
|
}
|
|
1268
|
-
return baseSource('query', options, urlParameters)
|
|
1267
|
+
return baseSource('query', options, urlParameters).then(result => _extends({}, result, {
|
|
1268
|
+
widgetSource: new WidgetQuerySource(options)
|
|
1269
|
+
}));
|
|
1269
1270
|
};
|
|
1270
1271
|
|
|
1271
|
-
|
|
1272
|
-
const h3TableSource$1 = async function h3TableSource(options) {
|
|
1272
|
+
const h3TableSource = async function h3TableSource(options) {
|
|
1273
1273
|
const {
|
|
1274
1274
|
aggregationExp,
|
|
1275
1275
|
aggregationResLevel = DEFAULT_AGGREGATION_RES_LEVEL_H3,
|
|
@@ -1289,7 +1289,9 @@ const h3TableSource$1 = async function h3TableSource(options) {
|
|
|
1289
1289
|
if (filters) {
|
|
1290
1290
|
urlParameters.filters = filters;
|
|
1291
1291
|
}
|
|
1292
|
-
return baseSource('table', options, urlParameters)
|
|
1292
|
+
return baseSource('table', options, urlParameters).then(result => _extends({}, result, {
|
|
1293
|
+
widgetSource: new WidgetTableSource(options)
|
|
1294
|
+
}));
|
|
1293
1295
|
};
|
|
1294
1296
|
|
|
1295
1297
|
// deck.gl
|
|
@@ -1318,8 +1320,7 @@ const rasterSource = async function rasterSource(options) {
|
|
|
1318
1320
|
return baseSource('raster', options, urlParameters);
|
|
1319
1321
|
};
|
|
1320
1322
|
|
|
1321
|
-
|
|
1322
|
-
const quadbinQuerySource$1 = async function quadbinQuerySource(options) {
|
|
1323
|
+
const quadbinQuerySource = async function quadbinQuerySource(options) {
|
|
1323
1324
|
const {
|
|
1324
1325
|
aggregationExp,
|
|
1325
1326
|
aggregationResLevel = DEFAULT_AGGREGATION_RES_LEVEL_QUADBIN,
|
|
@@ -1343,11 +1344,12 @@ const quadbinQuerySource$1 = async function quadbinQuerySource(options) {
|
|
|
1343
1344
|
if (filters) {
|
|
1344
1345
|
urlParameters.filters = filters;
|
|
1345
1346
|
}
|
|
1346
|
-
return baseSource('query', options, urlParameters)
|
|
1347
|
+
return baseSource('query', options, urlParameters).then(result => _extends({}, result, {
|
|
1348
|
+
widgetSource: new WidgetQuerySource(options)
|
|
1349
|
+
}));
|
|
1347
1350
|
};
|
|
1348
1351
|
|
|
1349
|
-
|
|
1350
|
-
const quadbinTableSource$1 = async function quadbinTableSource(options) {
|
|
1352
|
+
const quadbinTableSource = async function quadbinTableSource(options) {
|
|
1351
1353
|
const {
|
|
1352
1354
|
aggregationExp,
|
|
1353
1355
|
aggregationResLevel = DEFAULT_AGGREGATION_RES_LEVEL_QUADBIN,
|
|
@@ -1367,7 +1369,9 @@ const quadbinTableSource$1 = async function quadbinTableSource(options) {
|
|
|
1367
1369
|
if (filters) {
|
|
1368
1370
|
urlParameters.filters = filters;
|
|
1369
1371
|
}
|
|
1370
|
-
return baseSource('table', options, urlParameters)
|
|
1372
|
+
return baseSource('table', options, urlParameters).then(result => _extends({}, result, {
|
|
1373
|
+
widgetSource: new WidgetTableSource(options)
|
|
1374
|
+
}));
|
|
1371
1375
|
};
|
|
1372
1376
|
|
|
1373
1377
|
// deck.gl
|
|
@@ -1381,8 +1385,7 @@ const quadbinTilesetSource = async function quadbinTilesetSource(options) {
|
|
|
1381
1385
|
return baseSource('tileset', options, urlParameters);
|
|
1382
1386
|
};
|
|
1383
1387
|
|
|
1384
|
-
|
|
1385
|
-
const vectorQuerySource$1 = async function vectorQuerySource(options) {
|
|
1388
|
+
const vectorQuerySource = async function vectorQuerySource(options) {
|
|
1386
1389
|
const {
|
|
1387
1390
|
columns,
|
|
1388
1391
|
filters,
|
|
@@ -1406,11 +1409,12 @@ const vectorQuerySource$1 = async function vectorQuerySource(options) {
|
|
|
1406
1409
|
if (queryParameters) {
|
|
1407
1410
|
urlParameters.queryParameters = queryParameters;
|
|
1408
1411
|
}
|
|
1409
|
-
return baseSource('query', options, urlParameters)
|
|
1412
|
+
return baseSource('query', options, urlParameters).then(result => _extends({}, result, {
|
|
1413
|
+
widgetSource: new WidgetQuerySource(options)
|
|
1414
|
+
}));
|
|
1410
1415
|
};
|
|
1411
1416
|
|
|
1412
|
-
|
|
1413
|
-
const vectorTableSource$1 = async function vectorTableSource(options) {
|
|
1417
|
+
const vectorTableSource = async function vectorTableSource(options) {
|
|
1414
1418
|
const {
|
|
1415
1419
|
columns,
|
|
1416
1420
|
filters,
|
|
@@ -1430,7 +1434,9 @@ const vectorTableSource$1 = async function vectorTableSource(options) {
|
|
|
1430
1434
|
if (filters) {
|
|
1431
1435
|
urlParameters.filters = filters;
|
|
1432
1436
|
}
|
|
1433
|
-
return baseSource('table', options, urlParameters)
|
|
1437
|
+
return baseSource('table', options, urlParameters).then(result => _extends({}, result, {
|
|
1438
|
+
widgetSource: new WidgetTableSource(options)
|
|
1439
|
+
}));
|
|
1434
1440
|
};
|
|
1435
1441
|
|
|
1436
1442
|
// deck.gl
|
|
@@ -1444,49 +1450,6 @@ const vectorTilesetSource = async function vectorTilesetSource(options) {
|
|
|
1444
1450
|
return baseSource('tileset', options, urlParameters);
|
|
1445
1451
|
};
|
|
1446
1452
|
|
|
1447
|
-
/** Wrapper adding Widget API support to [vectorTableSource](https://deck.gl/docs/api-reference/carto/data-sources). */
|
|
1448
|
-
async function vectorTableSource(props) {
|
|
1449
|
-
const response = await vectorTableSource$1(props);
|
|
1450
|
-
return _extends({}, response, {
|
|
1451
|
-
widgetSource: new WidgetTableSource(props)
|
|
1452
|
-
});
|
|
1453
|
-
}
|
|
1454
|
-
/** Wrapper adding Widget API support to [vectorQuerySource](https://deck.gl/docs/api-reference/carto/data-sources). */
|
|
1455
|
-
async function vectorQuerySource(props) {
|
|
1456
|
-
const response = await vectorQuerySource$1(props);
|
|
1457
|
-
return _extends({}, response, {
|
|
1458
|
-
widgetSource: new WidgetQuerySource(props)
|
|
1459
|
-
});
|
|
1460
|
-
}
|
|
1461
|
-
/** Wrapper adding Widget API support to [h3TableSource](https://deck.gl/docs/api-reference/carto/data-sources). */
|
|
1462
|
-
async function h3TableSource(props) {
|
|
1463
|
-
const response = await h3TableSource$1(props);
|
|
1464
|
-
return _extends({}, response, {
|
|
1465
|
-
widgetSource: new WidgetTableSource(props)
|
|
1466
|
-
});
|
|
1467
|
-
}
|
|
1468
|
-
/** Wrapper adding Widget API support to [h3QuerySource](https://deck.gl/docs/api-reference/carto/data-sources). */
|
|
1469
|
-
async function h3QuerySource(props) {
|
|
1470
|
-
const response = await h3QuerySource$1(props);
|
|
1471
|
-
return _extends({}, response, {
|
|
1472
|
-
widgetSource: new WidgetQuerySource(props)
|
|
1473
|
-
});
|
|
1474
|
-
}
|
|
1475
|
-
/** Wrapper adding Widget API support to [quadbinTableSource](https://deck.gl/docs/api-reference/carto/data-sources). */
|
|
1476
|
-
async function quadbinTableSource(props) {
|
|
1477
|
-
const response = await quadbinTableSource$1(props);
|
|
1478
|
-
return _extends({}, response, {
|
|
1479
|
-
widgetSource: new WidgetTableSource(props)
|
|
1480
|
-
});
|
|
1481
|
-
}
|
|
1482
|
-
/** Wrapper adding Widget API support to [quadbinQuerySource](https://deck.gl/docs/api-reference/carto/data-sources). */
|
|
1483
|
-
async function quadbinQuerySource(props) {
|
|
1484
|
-
const response = await quadbinQuerySource$1(props);
|
|
1485
|
-
return _extends({}, response, {
|
|
1486
|
-
widgetSource: new WidgetQuerySource(props)
|
|
1487
|
-
});
|
|
1488
|
-
}
|
|
1489
|
-
|
|
1490
1453
|
const query = async function query(options) {
|
|
1491
1454
|
const {
|
|
1492
1455
|
apiBaseUrl = SOURCE_DEFAULTS.apiBaseUrl,
|