@carto/api-client 0.4.0-alpha.3 → 0.4.0-alpha.4
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 +29 -45
- package/build/api-client.cjs.map +1 -1
- package/build/api-client.modern.js +30 -40
- package/build/api-client.modern.js.map +1 -1
- package/build/constants-internal.d.ts +11 -3
- package/build/constants.d.ts +0 -18
- 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 +14 -3
- package/src/constants.ts +0 -25
- package/src/models/common.ts +11 -3
- package/src/models/model.ts +1 -1
- package/src/sources/base-source.ts +3 -3
- 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 -2
package/build/api-client.cjs
CHANGED
|
@@ -12,9 +12,9 @@ var union__default = /*#__PURE__*/_interopDefaultLegacy(union);
|
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* @internal
|
|
15
|
-
* @internalRemarks Source: @carto/react-core
|
|
15
|
+
* @internalRemarks Source: @carto/react-core, @carto/constants, @deck.gl/carto
|
|
16
16
|
*/
|
|
17
|
-
let client = '
|
|
17
|
+
let client = 'deck-gl-carto';
|
|
18
18
|
/**
|
|
19
19
|
* Returns current client ID, used to categorize API requests. For internal use only.
|
|
20
20
|
*
|
|
@@ -65,24 +65,6 @@ exports.ApiVersion = void 0;
|
|
|
65
65
|
ApiVersion["V2"] = "v2";
|
|
66
66
|
ApiVersion["V3"] = "v3";
|
|
67
67
|
})(exports.ApiVersion || (exports.ApiVersion = {}));
|
|
68
|
-
/******************************************************************************
|
|
69
|
-
* DEFAULTS
|
|
70
|
-
*/
|
|
71
|
-
/** @internalRemarks Source: @carto/constants, @deck.gl/carto */
|
|
72
|
-
const DEFAULT_API_BASE_URL = 'https://gcp-us-east1.api.carto.com';
|
|
73
|
-
/** @internalRemarks Source: @carto/constants, @deck.gl/carto */
|
|
74
|
-
const DEFAULT_CLIENT = 'deck-gl-carto';
|
|
75
|
-
/** @internalRemarks Source: @carto/constants, @deck.gl/carto */
|
|
76
|
-
const DEFAULT_GEO_COLUMN = 'geom';
|
|
77
|
-
/**
|
|
78
|
-
* Fastly default limit is 8192; leave some padding.
|
|
79
|
-
* @internalRemarks Source: @deck.gl/carto
|
|
80
|
-
*/
|
|
81
|
-
const DEFAULT_MAX_LENGTH_URL = 7000;
|
|
82
|
-
/** @internalRemarks Source: @deck.gl/carto */
|
|
83
|
-
const DEFAULT_TILE_SIZE = 512;
|
|
84
|
-
/** @internalRemarks Source: @deck.gl/carto */
|
|
85
|
-
const DEFAULT_TILE_RESOLUTION = 0.5;
|
|
86
68
|
|
|
87
69
|
const FILTER_TYPES = new Set(Object.values(exports.FilterType));
|
|
88
70
|
const isFilterType = type => FILTER_TYPES.has(type);
|
|
@@ -371,6 +353,30 @@ function _isMultiPolygon(geometry) {
|
|
|
371
353
|
return invariant.getType(geometry) === 'MultiPolygon';
|
|
372
354
|
}
|
|
373
355
|
|
|
356
|
+
/** @internalRemarks Source: @carto/constants, @deck.gl/carto */
|
|
357
|
+
const DEFAULT_API_BASE_URL = 'https://gcp-us-east1.api.carto.com';
|
|
358
|
+
/** @internal */
|
|
359
|
+
const V3_MINOR_VERSION = '3.4';
|
|
360
|
+
/** @internalRemarks Source: @carto/constants, @deck.gl/carto */
|
|
361
|
+
const DEFAULT_GEO_COLUMN = 'geom';
|
|
362
|
+
/**
|
|
363
|
+
* Fastly default limit is 8192; leave some padding.
|
|
364
|
+
* @internalRemarks Source: @deck.gl/carto
|
|
365
|
+
*/
|
|
366
|
+
const DEFAULT_MAX_LENGTH_URL = 7000;
|
|
367
|
+
/** @internalRemarks Source: @deck.gl/carto */
|
|
368
|
+
const DEFAULT_TILE_RESOLUTION = 0.5;
|
|
369
|
+
/**
|
|
370
|
+
* @internalRemarks Source: @deck.gl/carto
|
|
371
|
+
* @internal
|
|
372
|
+
*/
|
|
373
|
+
const DEFAULT_AGGREGATION_RES_LEVEL_H3 = 4;
|
|
374
|
+
/**
|
|
375
|
+
* @internalRemarks Source: @deck.gl/carto
|
|
376
|
+
* @internal
|
|
377
|
+
*/
|
|
378
|
+
const DEFAULT_AGGREGATION_RES_LEVEL_QUADBIN = 6;
|
|
379
|
+
|
|
374
380
|
/**
|
|
375
381
|
* Return more descriptive error from API
|
|
376
382
|
* @internalRemarks Source: @carto/react-api
|
|
@@ -447,7 +453,7 @@ function dealWithApiError(_ref) {
|
|
|
447
453
|
if (data.error === 'Column not found') {
|
|
448
454
|
throw new InvalidColumnError(`${data.error} ${data.column_name}`);
|
|
449
455
|
}
|
|
450
|
-
if (data.error?.includes('Missing columns')) {
|
|
456
|
+
if (typeof data.error === 'string' && data.error?.includes('Missing columns')) {
|
|
451
457
|
throw new InvalidColumnError(data.error);
|
|
452
458
|
}
|
|
453
459
|
switch (response.status) {
|
|
@@ -1074,22 +1080,6 @@ function buildQueryUrl(_ref4) {
|
|
|
1074
1080
|
return buildV3Path(apiBaseUrl, 'v3', 'sql', connectionName, 'query');
|
|
1075
1081
|
}
|
|
1076
1082
|
|
|
1077
|
-
/******************************************************************************
|
|
1078
|
-
* VERSIONS
|
|
1079
|
-
*/
|
|
1080
|
-
/** @internal */
|
|
1081
|
-
const V3_MINOR_VERSION = '3.4';
|
|
1082
|
-
/**
|
|
1083
|
-
* @internalRemarks Source: @deck.gl/carto
|
|
1084
|
-
* @internal
|
|
1085
|
-
*/
|
|
1086
|
-
const DEFAULT_AGGREGATION_RES_LEVEL_H3 = 4;
|
|
1087
|
-
/**
|
|
1088
|
-
* @internalRemarks Source: @deck.gl/carto
|
|
1089
|
-
* @internal
|
|
1090
|
-
*/
|
|
1091
|
-
const DEFAULT_AGGREGATION_RES_LEVEL_QUADBIN = 6;
|
|
1092
|
-
|
|
1093
1083
|
// deck.gl
|
|
1094
1084
|
const requestWithParameters = function (_ref) {
|
|
1095
1085
|
let {
|
|
@@ -1105,7 +1095,7 @@ const requestWithParameters = function (_ref) {
|
|
|
1105
1095
|
// user-provided parameters.
|
|
1106
1096
|
parameters = {
|
|
1107
1097
|
v: V3_MINOR_VERSION,
|
|
1108
|
-
client:
|
|
1098
|
+
client: getClient(),
|
|
1109
1099
|
...(typeof deck !== 'undefined' && deck.VERSION && {
|
|
1110
1100
|
deckglVersion: deck.VERSION
|
|
1111
1101
|
}),
|
|
@@ -1286,7 +1276,7 @@ const baseSource = function (endpoint, options, urlParameters) {
|
|
|
1286
1276
|
};
|
|
1287
1277
|
const SOURCE_DEFAULTS = {
|
|
1288
1278
|
apiBaseUrl: DEFAULT_API_BASE_URL,
|
|
1289
|
-
clientId:
|
|
1279
|
+
clientId: getClient(),
|
|
1290
1280
|
format: 'tilejson',
|
|
1291
1281
|
headers: {},
|
|
1292
1282
|
maxLengthURL: DEFAULT_MAX_LENGTH_URL
|
|
@@ -1656,12 +1646,6 @@ const query = function (options) {
|
|
|
1656
1646
|
};
|
|
1657
1647
|
|
|
1658
1648
|
exports.CartoAPIError = CartoAPIError;
|
|
1659
|
-
exports.DEFAULT_API_BASE_URL = DEFAULT_API_BASE_URL;
|
|
1660
|
-
exports.DEFAULT_CLIENT = DEFAULT_CLIENT;
|
|
1661
|
-
exports.DEFAULT_GEO_COLUMN = DEFAULT_GEO_COLUMN;
|
|
1662
|
-
exports.DEFAULT_MAX_LENGTH_URL = DEFAULT_MAX_LENGTH_URL;
|
|
1663
|
-
exports.DEFAULT_TILE_RESOLUTION = DEFAULT_TILE_RESOLUTION;
|
|
1664
|
-
exports.DEFAULT_TILE_SIZE = DEFAULT_TILE_SIZE;
|
|
1665
1649
|
exports.SOURCE_DEFAULTS = SOURCE_DEFAULTS;
|
|
1666
1650
|
exports.WidgetBaseSource = WidgetBaseSource;
|
|
1667
1651
|
exports.WidgetQuerySource = WidgetQuerySource;
|