@carto/api-client 0.5.2-alpha.1 → 0.5.2-alpha.2
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 +11 -8
- package/build/api-client.cjs.map +1 -1
- package/build/api-client.d.cts +28 -1
- package/build/api-client.d.ts +28 -1
- package/build/api-client.js +11 -8
- package/build/api-client.js.map +1 -1
- package/package.json +3 -3
- package/src/fetch-map/layer-map.ts +6 -5
- package/src/fetch-map/parse-map.ts +1 -1
- package/src/sources/base-source.ts +5 -2
- package/src/sources/types.ts +5 -1
package/build/api-client.d.cts
CHANGED
|
@@ -219,6 +219,32 @@ type PositionalQueryParameter = QueryParameterValue[];
|
|
|
219
219
|
/** @privateRemarks Source: @deck.gl/carto */
|
|
220
220
|
type QueryParameters = NamedQueryParameter | PositionalQueryParameter;
|
|
221
221
|
|
|
222
|
+
/******************************************************************************
|
|
223
|
+
* MAP INSTANTIATION
|
|
224
|
+
*/
|
|
225
|
+
/**
|
|
226
|
+
* @privateRemarks Source: @deck.gl/carto
|
|
227
|
+
* @internal
|
|
228
|
+
*/
|
|
229
|
+
declare enum SchemaFieldType {
|
|
230
|
+
Number = "number",
|
|
231
|
+
Bigint = "bigint",
|
|
232
|
+
String = "string",
|
|
233
|
+
Geometry = "geometry",
|
|
234
|
+
Timestamp = "timestamp",
|
|
235
|
+
Object = "object",
|
|
236
|
+
Boolean = "boolean",
|
|
237
|
+
Variant = "variant",
|
|
238
|
+
Unknown = "unknown"
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* @privateRemarks Source: @deck.gl/carto
|
|
242
|
+
* @internal
|
|
243
|
+
*/
|
|
244
|
+
interface SchemaField {
|
|
245
|
+
name: string;
|
|
246
|
+
type: SchemaFieldType;
|
|
247
|
+
}
|
|
222
248
|
/******************************************************************************
|
|
223
249
|
* LOCAL CALCULATIONS
|
|
224
250
|
*/
|
|
@@ -630,6 +656,7 @@ type RasterMetadata = {
|
|
|
630
656
|
};
|
|
631
657
|
type TilejsonResult = Tilejson & {
|
|
632
658
|
accessToken: string;
|
|
659
|
+
schema: SchemaField[];
|
|
633
660
|
};
|
|
634
661
|
type QueryResult = {
|
|
635
662
|
meta: {
|
|
@@ -697,7 +724,7 @@ declare function calculateClusterRadius(properties: {
|
|
|
697
724
|
max: number;
|
|
698
725
|
}>, radiusRange: [number, number], column: string): number;
|
|
699
726
|
/** @privateRemarks Source: Builder */
|
|
700
|
-
declare function getDefaultAggregationExpColumnAliasForLayerType(layerType: LayerType, provider: ProviderType,
|
|
727
|
+
declare function getDefaultAggregationExpColumnAliasForLayerType(layerType: LayerType, provider: ProviderType, schema: SchemaField[]): string;
|
|
701
728
|
/** @privateRemarks Source: Builder */
|
|
702
729
|
declare function calculateClusterTextFontSize(radius: number): number;
|
|
703
730
|
|
package/build/api-client.d.ts
CHANGED
|
@@ -219,6 +219,32 @@ type PositionalQueryParameter = QueryParameterValue[];
|
|
|
219
219
|
/** @privateRemarks Source: @deck.gl/carto */
|
|
220
220
|
type QueryParameters = NamedQueryParameter | PositionalQueryParameter;
|
|
221
221
|
|
|
222
|
+
/******************************************************************************
|
|
223
|
+
* MAP INSTANTIATION
|
|
224
|
+
*/
|
|
225
|
+
/**
|
|
226
|
+
* @privateRemarks Source: @deck.gl/carto
|
|
227
|
+
* @internal
|
|
228
|
+
*/
|
|
229
|
+
declare enum SchemaFieldType {
|
|
230
|
+
Number = "number",
|
|
231
|
+
Bigint = "bigint",
|
|
232
|
+
String = "string",
|
|
233
|
+
Geometry = "geometry",
|
|
234
|
+
Timestamp = "timestamp",
|
|
235
|
+
Object = "object",
|
|
236
|
+
Boolean = "boolean",
|
|
237
|
+
Variant = "variant",
|
|
238
|
+
Unknown = "unknown"
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* @privateRemarks Source: @deck.gl/carto
|
|
242
|
+
* @internal
|
|
243
|
+
*/
|
|
244
|
+
interface SchemaField {
|
|
245
|
+
name: string;
|
|
246
|
+
type: SchemaFieldType;
|
|
247
|
+
}
|
|
222
248
|
/******************************************************************************
|
|
223
249
|
* LOCAL CALCULATIONS
|
|
224
250
|
*/
|
|
@@ -630,6 +656,7 @@ type RasterMetadata = {
|
|
|
630
656
|
};
|
|
631
657
|
type TilejsonResult = Tilejson & {
|
|
632
658
|
accessToken: string;
|
|
659
|
+
schema: SchemaField[];
|
|
633
660
|
};
|
|
634
661
|
type QueryResult = {
|
|
635
662
|
meta: {
|
|
@@ -697,7 +724,7 @@ declare function calculateClusterRadius(properties: {
|
|
|
697
724
|
max: number;
|
|
698
725
|
}>, radiusRange: [number, number], column: string): number;
|
|
699
726
|
/** @privateRemarks Source: Builder */
|
|
700
|
-
declare function getDefaultAggregationExpColumnAliasForLayerType(layerType: LayerType, provider: ProviderType,
|
|
727
|
+
declare function getDefaultAggregationExpColumnAliasForLayerType(layerType: LayerType, provider: ProviderType, schema: SchemaField[]): string;
|
|
701
728
|
/** @privateRemarks Source: Builder */
|
|
702
729
|
declare function calculateClusterTextFontSize(radius: number): number;
|
|
703
730
|
|
package/build/api-client.js
CHANGED
|
@@ -11295,7 +11295,7 @@ async function baseSource(endpoint, options, urlParameters) {
|
|
|
11295
11295
|
type: endpoint,
|
|
11296
11296
|
source: JSON.stringify(parameters, void 0, 2)
|
|
11297
11297
|
};
|
|
11298
|
-
const
|
|
11298
|
+
const { tilejson, schema } = await requestWithParameters({
|
|
11299
11299
|
baseUrl,
|
|
11300
11300
|
parameters,
|
|
11301
11301
|
headers,
|
|
@@ -11303,7 +11303,7 @@ async function baseSource(endpoint, options, urlParameters) {
|
|
|
11303
11303
|
maxLengthURL,
|
|
11304
11304
|
localCache
|
|
11305
11305
|
});
|
|
11306
|
-
const dataUrl =
|
|
11306
|
+
const dataUrl = tilejson.url[0];
|
|
11307
11307
|
if (cache) {
|
|
11308
11308
|
cache.value = parseInt(
|
|
11309
11309
|
new URL(dataUrl).searchParams.get("cache") || "",
|
|
@@ -11322,6 +11322,9 @@ async function baseSource(endpoint, options, urlParameters) {
|
|
|
11322
11322
|
if (accessToken) {
|
|
11323
11323
|
json.accessToken = accessToken;
|
|
11324
11324
|
}
|
|
11325
|
+
if (schema) {
|
|
11326
|
+
json.schema = schema;
|
|
11327
|
+
}
|
|
11325
11328
|
return json;
|
|
11326
11329
|
}
|
|
11327
11330
|
|
|
@@ -14502,10 +14505,10 @@ function calculateClusterRadius(properties, stats, radiusRange, column) {
|
|
|
14502
14505
|
const normalizedValue = (value - min3) / (max3 - min3);
|
|
14503
14506
|
return radiusRange[0] + normalizedValue * (radiusRange[1] - radiusRange[0]);
|
|
14504
14507
|
}
|
|
14505
|
-
function getDefaultAggregationExpColumnAliasForLayerType(layerType, provider,
|
|
14506
|
-
if (
|
|
14508
|
+
function getDefaultAggregationExpColumnAliasForLayerType(layerType, provider, schema) {
|
|
14509
|
+
if (schema && layerType === "clusterTile") {
|
|
14507
14510
|
return getColumnAliasForAggregationExp(
|
|
14508
|
-
getDefaultColumnFromSchemaForAggregationExp(
|
|
14511
|
+
getDefaultColumnFromSchemaForAggregationExp(schema),
|
|
14509
14512
|
"count",
|
|
14510
14513
|
provider
|
|
14511
14514
|
);
|
|
@@ -14517,8 +14520,8 @@ function getColumnAliasForAggregationExp(name, aggregation, provider) {
|
|
|
14517
14520
|
const columnAlias = `${name}_${aggregation}`;
|
|
14518
14521
|
return provider === "snowflake" ? columnAlias.toUpperCase() : columnAlias;
|
|
14519
14522
|
}
|
|
14520
|
-
function getDefaultColumnFromSchemaForAggregationExp(
|
|
14521
|
-
return
|
|
14523
|
+
function getDefaultColumnFromSchemaForAggregationExp(schema) {
|
|
14524
|
+
return schema ? schema[0].name : "";
|
|
14522
14525
|
}
|
|
14523
14526
|
function calculateClusterTextFontSize(radius) {
|
|
14524
14527
|
if (radius >= 80) return 24;
|
|
@@ -14715,7 +14718,7 @@ function createChannelProps(id, type, config2, visualChannels, data, dataset) {
|
|
|
14715
14718
|
const aggregationExpAlias = getDefaultAggregationExpColumnAliasForLayerType(
|
|
14716
14719
|
type,
|
|
14717
14720
|
dataset.providerId,
|
|
14718
|
-
|
|
14721
|
+
data.schema
|
|
14719
14722
|
);
|
|
14720
14723
|
result.pointType = visConfig.isTextVisible ? "circle+text" : "circle";
|
|
14721
14724
|
result.clusterLevel = visConfig.clusterLevel;
|