@carto/api-client 0.4.0-alpha.3 → 0.4.0-alpha.5
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 +31 -42
- package/build/api-client.cjs.map +1 -1
- package/build/api-client.modern.js +32 -38
- package/build/api-client.modern.js.map +1 -1
- package/build/constants-internal.d.ts +9 -3
- package/build/constants.d.ts +0 -16
- package/build/models/common.d.ts +7 -2
- package/package.json +2 -2
- package/src/api/request-with-parameters.ts +3 -2
- package/src/client.ts +2 -2
- package/src/constants-internal.ts +12 -4
- package/src/constants.ts +0 -22
- package/src/models/common.ts +11 -3
- package/src/models/model.ts +1 -1
- package/src/sources/base-source.ts +4 -7
- package/src/sources/vector-query-source.ts +1 -1
- package/src/sources/vector-table-source.ts +1 -1
- package/src/types.ts +0 -1
- package/src/utils.ts +1 -2
- package/src/widget-sources/widget-base-source.ts +2 -5
|
@@ -6,9 +6,9 @@ import { featureCollection, feature, polygon, multiPolygon } from '@turf/helpers
|
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* @internal
|
|
9
|
-
* @internalRemarks Source: @carto/react-core
|
|
9
|
+
* @internalRemarks Source: @carto/react-core, @carto/constants, @deck.gl/carto
|
|
10
10
|
*/
|
|
11
|
-
let client = '
|
|
11
|
+
let client = 'deck-gl-carto';
|
|
12
12
|
/**
|
|
13
13
|
* Returns current client ID, used to categorize API requests. For internal use only.
|
|
14
14
|
*
|
|
@@ -59,24 +59,8 @@ var ApiVersion;
|
|
|
59
59
|
ApiVersion["V2"] = "v2";
|
|
60
60
|
ApiVersion["V3"] = "v3";
|
|
61
61
|
})(ApiVersion || (ApiVersion = {}));
|
|
62
|
-
/******************************************************************************
|
|
63
|
-
* DEFAULTS
|
|
64
|
-
*/
|
|
65
62
|
/** @internalRemarks Source: @carto/constants, @deck.gl/carto */
|
|
66
63
|
const DEFAULT_API_BASE_URL = 'https://gcp-us-east1.api.carto.com';
|
|
67
|
-
/** @internalRemarks Source: @carto/constants, @deck.gl/carto */
|
|
68
|
-
const DEFAULT_CLIENT = 'deck-gl-carto';
|
|
69
|
-
/** @internalRemarks Source: @carto/constants, @deck.gl/carto */
|
|
70
|
-
const DEFAULT_GEO_COLUMN = 'geom';
|
|
71
|
-
/**
|
|
72
|
-
* Fastly default limit is 8192; leave some padding.
|
|
73
|
-
* @internalRemarks Source: @deck.gl/carto
|
|
74
|
-
*/
|
|
75
|
-
const DEFAULT_MAX_LENGTH_URL = 7000;
|
|
76
|
-
/** @internalRemarks Source: @deck.gl/carto */
|
|
77
|
-
const DEFAULT_TILE_SIZE = 512;
|
|
78
|
-
/** @internalRemarks Source: @deck.gl/carto */
|
|
79
|
-
const DEFAULT_TILE_RESOLUTION = 0.5;
|
|
80
64
|
|
|
81
65
|
const FILTER_TYPES = new Set(Object.values(FilterType));
|
|
82
66
|
const isFilterType = type => FILTER_TYPES.has(type);
|
|
@@ -383,6 +367,32 @@ function _objectWithoutPropertiesLoose(r, e) {
|
|
|
383
367
|
return t;
|
|
384
368
|
}
|
|
385
369
|
|
|
370
|
+
/**
|
|
371
|
+
* Current version of @carto/api-client.
|
|
372
|
+
* @internal
|
|
373
|
+
*/
|
|
374
|
+
/** @internal */
|
|
375
|
+
const V3_MINOR_VERSION = '3.4';
|
|
376
|
+
/** @internalRemarks Source: @carto/constants, @deck.gl/carto */
|
|
377
|
+
const DEFAULT_GEO_COLUMN = 'geom';
|
|
378
|
+
/**
|
|
379
|
+
* Fastly default limit is 8192; leave some padding.
|
|
380
|
+
* @internalRemarks Source: @deck.gl/carto
|
|
381
|
+
*/
|
|
382
|
+
const DEFAULT_MAX_LENGTH_URL = 7000;
|
|
383
|
+
/** @internalRemarks Source: @deck.gl/carto */
|
|
384
|
+
const DEFAULT_TILE_RESOLUTION = 0.5;
|
|
385
|
+
/**
|
|
386
|
+
* @internalRemarks Source: @deck.gl/carto
|
|
387
|
+
* @internal
|
|
388
|
+
*/
|
|
389
|
+
const DEFAULT_AGGREGATION_RES_LEVEL_H3 = 4;
|
|
390
|
+
/**
|
|
391
|
+
* @internalRemarks Source: @deck.gl/carto
|
|
392
|
+
* @internal
|
|
393
|
+
*/
|
|
394
|
+
const DEFAULT_AGGREGATION_RES_LEVEL_QUADBIN = 6;
|
|
395
|
+
|
|
386
396
|
/**
|
|
387
397
|
* Return more descriptive error from API
|
|
388
398
|
* @internalRemarks Source: @carto/react-api
|
|
@@ -395,7 +405,7 @@ function dealWithApiError({
|
|
|
395
405
|
if (data.error === 'Column not found') {
|
|
396
406
|
throw new InvalidColumnError(`${data.error} ${data.column_name}`);
|
|
397
407
|
}
|
|
398
|
-
if ((_data$error = data.error) != null && _data$error.includes('Missing columns')) {
|
|
408
|
+
if (typeof data.error === 'string' && (_data$error = data.error) != null && _data$error.includes('Missing columns')) {
|
|
399
409
|
throw new InvalidColumnError(data.error);
|
|
400
410
|
}
|
|
401
411
|
switch (response.status) {
|
|
@@ -1011,22 +1021,6 @@ function buildQueryUrl({
|
|
|
1011
1021
|
return buildV3Path(apiBaseUrl, 'v3', 'sql', connectionName, 'query');
|
|
1012
1022
|
}
|
|
1013
1023
|
|
|
1014
|
-
/******************************************************************************
|
|
1015
|
-
* VERSIONS
|
|
1016
|
-
*/
|
|
1017
|
-
/** @internal */
|
|
1018
|
-
const V3_MINOR_VERSION = '3.4';
|
|
1019
|
-
/**
|
|
1020
|
-
* @internalRemarks Source: @deck.gl/carto
|
|
1021
|
-
* @internal
|
|
1022
|
-
*/
|
|
1023
|
-
const DEFAULT_AGGREGATION_RES_LEVEL_H3 = 4;
|
|
1024
|
-
/**
|
|
1025
|
-
* @internalRemarks Source: @deck.gl/carto
|
|
1026
|
-
* @internal
|
|
1027
|
-
*/
|
|
1028
|
-
const DEFAULT_AGGREGATION_RES_LEVEL_QUADBIN = 6;
|
|
1029
|
-
|
|
1030
1024
|
const DEFAULT_HEADERS = {
|
|
1031
1025
|
Accept: 'application/json',
|
|
1032
1026
|
'Content-Type': 'application/json'
|
|
@@ -1044,7 +1038,7 @@ async function requestWithParameters({
|
|
|
1044
1038
|
// user-provided parameters.
|
|
1045
1039
|
parameters = _extends({
|
|
1046
1040
|
v: V3_MINOR_VERSION,
|
|
1047
|
-
client:
|
|
1041
|
+
client: getClient()
|
|
1048
1042
|
}, typeof deck !== 'undefined' && deck.VERSION && {
|
|
1049
1043
|
deckglVersion: deck.VERSION
|
|
1050
1044
|
}, parameters);
|
|
@@ -1122,7 +1116,7 @@ function excludeURLParameters(baseUrlString, parameters) {
|
|
|
1122
1116
|
const _excluded = ["accessToken", "connectionName", "cache"];
|
|
1123
1117
|
const SOURCE_DEFAULTS = {
|
|
1124
1118
|
apiBaseUrl: DEFAULT_API_BASE_URL,
|
|
1125
|
-
clientId:
|
|
1119
|
+
clientId: getClient(),
|
|
1126
1120
|
format: 'tilejson',
|
|
1127
1121
|
headers: {},
|
|
1128
1122
|
maxLengthURL: DEFAULT_MAX_LENGTH_URL
|
|
@@ -1490,5 +1484,5 @@ const query = async function query(options) {
|
|
|
1490
1484
|
});
|
|
1491
1485
|
};
|
|
1492
1486
|
|
|
1493
|
-
export { ApiVersion, CartoAPIError, DEFAULT_API_BASE_URL,
|
|
1487
|
+
export { ApiVersion, CartoAPIError, DEFAULT_API_BASE_URL, FilterType, SOURCE_DEFAULTS, WidgetBaseSource, WidgetQuerySource, WidgetTableSource, addFilter, boundaryQuerySource, boundaryTableSource, buildPublicMapUrl, buildStatsUrl, clearFilters, createPolygonSpatialFilter, createViewportSpatialFilter, getClient, getFilter, h3QuerySource, h3TableSource, h3TilesetSource, hasFilter, quadbinQuerySource, quadbinTableSource, quadbinTilesetSource, query, rasterSource, removeFilter, requestWithParameters, setClient, vectorQuerySource, vectorTableSource, vectorTilesetSource };
|
|
1494
1488
|
//# sourceMappingURL=api-client.modern.js.map
|