@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/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "homepage": "https://github.com/CartoDB/carto-api-client#readme",
9
9
  "author": "Don McCurdy <donmccurdy@carto.com>",
10
10
  "packageManager": "yarn@4.3.1",
11
- "version": "0.5.2-alpha.1",
11
+ "version": "0.5.2-alpha.2",
12
12
  "license": "MIT",
13
13
  "publishConfig": {
14
14
  "access": "public"
@@ -67,7 +67,7 @@
67
67
  "@types/geojson": "^7946.0.16",
68
68
  "d3-format": "^3.1.0",
69
69
  "d3-scale": "^4.0.2",
70
- "h3-js": "4.1.0",
70
+ "h3-js": "4.2.1",
71
71
  "quadbin": "^0.4.1-alpha.0"
72
72
  },
73
73
  "devDependencies": {
@@ -123,7 +123,7 @@
123
123
  "typescript": "~5.8.2",
124
124
  "typescript-eslint": "^8.26.1",
125
125
  "vite": "^6.2.2",
126
- "vitest": "3.1.1"
126
+ "vitest": "3.1.2"
127
127
  },
128
128
  "resolutions": {
129
129
  "@carto/api-client": "portal:./",
@@ -33,6 +33,7 @@ import type {
33
33
  } from './types.js';
34
34
  import type {ProviderType} from '../types.js';
35
35
  import {DEFAULT_AGGREGATION_EXP_ALIAS} from '../constants-internal.js';
36
+ import type {SchemaField} from '../types-internal.js';
36
37
 
37
38
  const SCALE_FUNCS: Record<string, () => any> = {
38
39
  linear: scaleLinear,
@@ -495,11 +496,11 @@ export function calculateClusterRadius(
495
496
  export function getDefaultAggregationExpColumnAliasForLayerType(
496
497
  layerType: LayerType,
497
498
  provider: ProviderType,
498
- columns: string[]
499
+ schema: SchemaField[]
499
500
  ): string {
500
- if (columns && layerType === 'clusterTile') {
501
+ if (schema && layerType === 'clusterTile') {
501
502
  return getColumnAliasForAggregationExp(
502
- getDefaultColumnFromSchemaForAggregationExp(columns),
503
+ getDefaultColumnFromSchemaForAggregationExp(schema),
503
504
  'count',
504
505
  provider
505
506
  );
@@ -520,9 +521,9 @@ function getColumnAliasForAggregationExp(
520
521
 
521
522
  /** @privateRemarks Source: Builder */
522
523
  function getDefaultColumnFromSchemaForAggregationExp(
523
- columns: string[]
524
+ schema: SchemaField[]
524
525
  ): string {
525
- return columns ? columns[0] : '';
526
+ return schema ? schema[0].name : '';
526
527
  }
527
528
 
528
529
  /** @privateRemarks Source: Builder */
@@ -279,7 +279,7 @@ function createChannelProps(
279
279
  const aggregationExpAlias = getDefaultAggregationExpColumnAliasForLayerType(
280
280
  type,
281
281
  dataset.providerId,
282
- dataset.columns
282
+ data.schema
283
283
  );
284
284
 
285
285
  result.pointType = visConfig.isTextVisible ? 'circle+text' : 'circle';
@@ -55,7 +55,7 @@ export async function baseSource<UrlParameters extends Record<string, unknown>>(
55
55
  type: endpoint,
56
56
  source: JSON.stringify(parameters, undefined, 2),
57
57
  };
58
- const mapInstantiation =
58
+ const {tilejson, schema} =
59
59
  await requestWithParameters<TilejsonMapInstantiation>({
60
60
  baseUrl,
61
61
  parameters,
@@ -65,7 +65,7 @@ export async function baseSource<UrlParameters extends Record<string, unknown>>(
65
65
  localCache,
66
66
  });
67
67
 
68
- const dataUrl = mapInstantiation.tilejson.url[0];
68
+ const dataUrl = tilejson.url[0];
69
69
  if (cache) {
70
70
  cache.value = parseInt(
71
71
  new URL(dataUrl).searchParams.get('cache') || '',
@@ -85,5 +85,8 @@ export async function baseSource<UrlParameters extends Record<string, unknown>>(
85
85
  if (accessToken) {
86
86
  json.accessToken = accessToken;
87
87
  }
88
+ if (schema) {
89
+ json.schema = schema;
90
+ }
88
91
  return json;
89
92
  }
@@ -414,7 +414,11 @@ export type RasterMetadata = {
414
414
  pixel_resolution: number;
415
415
  };
416
416
 
417
- export type TilejsonResult = Tilejson & {accessToken: string};
417
+ export type TilejsonResult = Tilejson & {
418
+ accessToken: string;
419
+ schema: SchemaField[];
420
+ };
421
+
418
422
  export type QueryResult = {
419
423
  meta: {cacheHit: boolean; location: string; totalBytesProcessed: string};
420
424
  rows: Record<string, any>[];