@carto/api-client 0.5.10-alpha.PR193.4 → 0.5.11
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/CHANGELOG.md +4 -0
- package/build/api-client.cjs +23 -34
- package/build/api-client.cjs.map +1 -1
- package/build/api-client.d.cts +11 -18
- package/build/api-client.d.ts +11 -18
- package/build/api-client.js +23 -34
- package/build/api-client.js.map +1 -1
- package/build/worker-compat.js +9 -6
- package/build/worker-compat.js.map +1 -1
- package/build/worker.js +9 -6
- package/build/worker.js.map +1 -1
- package/package.json +1 -1
- package/src/api/query.ts +2 -19
- package/src/api/request-with-parameters.ts +5 -10
- package/src/models/model.ts +0 -3
- package/src/operations/groupBy.ts +14 -6
- package/src/sources/base-source.ts +1 -1
- package/src/sources/types.ts +10 -5
- package/src/widget-sources/types.ts +5 -1
- package/src/widget-sources/widget-remote-source.ts +0 -1
package/build/api-client.d.cts
CHANGED
|
@@ -388,8 +388,6 @@ type SourceOptionalOptions = {
|
|
|
388
388
|
* By default, local in-memory caching is enabled.
|
|
389
389
|
*/
|
|
390
390
|
localCache?: LocalCacheOptions;
|
|
391
|
-
/** Additional tags appended to HTTP requests, available for analytics and audits. */
|
|
392
|
-
tags?: Record<string, string>;
|
|
393
391
|
};
|
|
394
392
|
type LocalCacheOptions = {
|
|
395
393
|
/**
|
|
@@ -525,7 +523,7 @@ interface Tilejson {
|
|
|
525
523
|
minzoom: number;
|
|
526
524
|
maxzoom: number;
|
|
527
525
|
bounds: [left: number, bottom: number, right: number, top: number];
|
|
528
|
-
center: [
|
|
526
|
+
center: [longitude: number, latitude: number, zoom: number];
|
|
529
527
|
vector_layers: VectorLayer[];
|
|
530
528
|
minresolution: number;
|
|
531
529
|
maxresolution: number;
|
|
@@ -637,6 +635,11 @@ type RasterMetadataBand = {
|
|
|
637
635
|
type: RasterBandType;
|
|
638
636
|
name: string;
|
|
639
637
|
stats: RasterMetadataBandStats;
|
|
638
|
+
/**
|
|
639
|
+
* Optional table of mappings from (integer) band values to (string) human
|
|
640
|
+
* readable labels. Values found in tiles are NOT guaranteed to have labels.
|
|
641
|
+
*/
|
|
642
|
+
valuelabels?: Record<string, string>;
|
|
640
643
|
/**
|
|
641
644
|
* Known values:
|
|
642
645
|
* * `palette`: use unique value and `colortable` ad default mapping
|
|
@@ -660,10 +663,11 @@ type RasterMetadata = {
|
|
|
660
663
|
block_resolution: number;
|
|
661
664
|
minresolution: number;
|
|
662
665
|
maxresolution: number;
|
|
666
|
+
/** @deprecated Use {@link RasterMetadataBand.nodata} from {@link RasterMetadata.bands}. */
|
|
663
667
|
nodata: number | string;
|
|
664
668
|
bands: RasterMetadataBand[];
|
|
665
669
|
bounds: [left: number, bottom: number, right: number, top: number];
|
|
666
|
-
center: [
|
|
670
|
+
center: [longitude: number, latitude: number, zoom: number];
|
|
667
671
|
width: number;
|
|
668
672
|
height: number;
|
|
669
673
|
block_width: number;
|
|
@@ -689,26 +693,16 @@ type QueryResult = {
|
|
|
689
693
|
}[];
|
|
690
694
|
};
|
|
691
695
|
|
|
692
|
-
type QueryOptions = SourceOptions & QuerySourceOptions
|
|
693
|
-
/**
|
|
694
|
-
* @internal
|
|
695
|
-
* @experimental
|
|
696
|
-
* Used to append additional parameters to the SQL API request for features specific to providers or integrations.
|
|
697
|
-
*/
|
|
698
|
-
internalParameters?: Record<string, string | boolean | number>;
|
|
699
|
-
/** Used to abort the request. */
|
|
700
|
-
signal?: AbortSignal;
|
|
701
|
-
};
|
|
696
|
+
type QueryOptions = SourceOptions & QuerySourceOptions;
|
|
702
697
|
declare const query: (options: QueryOptions) => Promise<QueryResult>;
|
|
703
698
|
|
|
704
|
-
declare function requestWithParameters<T = any>({ baseUrl, parameters, headers: customHeaders, errorContext, maxLengthURL, localCache,
|
|
699
|
+
declare function requestWithParameters<T = any>({ baseUrl, parameters, headers: customHeaders, errorContext, maxLengthURL, localCache, }: {
|
|
705
700
|
baseUrl: string;
|
|
706
701
|
parameters?: Record<string, unknown>;
|
|
707
702
|
headers?: Record<string, string>;
|
|
708
703
|
errorContext: APIErrorContext;
|
|
709
704
|
maxLengthURL?: number;
|
|
710
705
|
localCache?: LocalCacheOptions;
|
|
711
|
-
signal?: AbortSignal;
|
|
712
706
|
}): Promise<T>;
|
|
713
707
|
/**
|
|
714
708
|
* Clears the HTTP response cache for all requests using the default cache.
|
|
@@ -1351,7 +1345,7 @@ type FormulaResponse = {
|
|
|
1351
1345
|
};
|
|
1352
1346
|
/** Entry in the category widget response, see {@link WidgetRemoteSource#getCategories}. */
|
|
1353
1347
|
type CategoryResponseEntry = {
|
|
1354
|
-
name: string | null;
|
|
1348
|
+
name: string | number | null;
|
|
1355
1349
|
value: number;
|
|
1356
1350
|
};
|
|
1357
1351
|
/** Response from {@link WidgetRemoteSource#getCategories}. */
|
|
@@ -1469,7 +1463,6 @@ interface ModelSource {
|
|
|
1469
1463
|
spatialDataColumn?: string;
|
|
1470
1464
|
spatialDataType?: SpatialDataType;
|
|
1471
1465
|
spatialFiltersMode?: SpatialFilterPolyfillMode;
|
|
1472
|
-
tags?: Record<string, string>;
|
|
1473
1466
|
}
|
|
1474
1467
|
|
|
1475
1468
|
type WidgetRemoteSourceProps = WidgetSourceProps;
|
package/build/api-client.d.ts
CHANGED
|
@@ -388,8 +388,6 @@ type SourceOptionalOptions = {
|
|
|
388
388
|
* By default, local in-memory caching is enabled.
|
|
389
389
|
*/
|
|
390
390
|
localCache?: LocalCacheOptions;
|
|
391
|
-
/** Additional tags appended to HTTP requests, available for analytics and audits. */
|
|
392
|
-
tags?: Record<string, string>;
|
|
393
391
|
};
|
|
394
392
|
type LocalCacheOptions = {
|
|
395
393
|
/**
|
|
@@ -525,7 +523,7 @@ interface Tilejson {
|
|
|
525
523
|
minzoom: number;
|
|
526
524
|
maxzoom: number;
|
|
527
525
|
bounds: [left: number, bottom: number, right: number, top: number];
|
|
528
|
-
center: [
|
|
526
|
+
center: [longitude: number, latitude: number, zoom: number];
|
|
529
527
|
vector_layers: VectorLayer[];
|
|
530
528
|
minresolution: number;
|
|
531
529
|
maxresolution: number;
|
|
@@ -637,6 +635,11 @@ type RasterMetadataBand = {
|
|
|
637
635
|
type: RasterBandType;
|
|
638
636
|
name: string;
|
|
639
637
|
stats: RasterMetadataBandStats;
|
|
638
|
+
/**
|
|
639
|
+
* Optional table of mappings from (integer) band values to (string) human
|
|
640
|
+
* readable labels. Values found in tiles are NOT guaranteed to have labels.
|
|
641
|
+
*/
|
|
642
|
+
valuelabels?: Record<string, string>;
|
|
640
643
|
/**
|
|
641
644
|
* Known values:
|
|
642
645
|
* * `palette`: use unique value and `colortable` ad default mapping
|
|
@@ -660,10 +663,11 @@ type RasterMetadata = {
|
|
|
660
663
|
block_resolution: number;
|
|
661
664
|
minresolution: number;
|
|
662
665
|
maxresolution: number;
|
|
666
|
+
/** @deprecated Use {@link RasterMetadataBand.nodata} from {@link RasterMetadata.bands}. */
|
|
663
667
|
nodata: number | string;
|
|
664
668
|
bands: RasterMetadataBand[];
|
|
665
669
|
bounds: [left: number, bottom: number, right: number, top: number];
|
|
666
|
-
center: [
|
|
670
|
+
center: [longitude: number, latitude: number, zoom: number];
|
|
667
671
|
width: number;
|
|
668
672
|
height: number;
|
|
669
673
|
block_width: number;
|
|
@@ -689,26 +693,16 @@ type QueryResult = {
|
|
|
689
693
|
}[];
|
|
690
694
|
};
|
|
691
695
|
|
|
692
|
-
type QueryOptions = SourceOptions & QuerySourceOptions
|
|
693
|
-
/**
|
|
694
|
-
* @internal
|
|
695
|
-
* @experimental
|
|
696
|
-
* Used to append additional parameters to the SQL API request for features specific to providers or integrations.
|
|
697
|
-
*/
|
|
698
|
-
internalParameters?: Record<string, string | boolean | number>;
|
|
699
|
-
/** Used to abort the request. */
|
|
700
|
-
signal?: AbortSignal;
|
|
701
|
-
};
|
|
696
|
+
type QueryOptions = SourceOptions & QuerySourceOptions;
|
|
702
697
|
declare const query: (options: QueryOptions) => Promise<QueryResult>;
|
|
703
698
|
|
|
704
|
-
declare function requestWithParameters<T = any>({ baseUrl, parameters, headers: customHeaders, errorContext, maxLengthURL, localCache,
|
|
699
|
+
declare function requestWithParameters<T = any>({ baseUrl, parameters, headers: customHeaders, errorContext, maxLengthURL, localCache, }: {
|
|
705
700
|
baseUrl: string;
|
|
706
701
|
parameters?: Record<string, unknown>;
|
|
707
702
|
headers?: Record<string, string>;
|
|
708
703
|
errorContext: APIErrorContext;
|
|
709
704
|
maxLengthURL?: number;
|
|
710
705
|
localCache?: LocalCacheOptions;
|
|
711
|
-
signal?: AbortSignal;
|
|
712
706
|
}): Promise<T>;
|
|
713
707
|
/**
|
|
714
708
|
* Clears the HTTP response cache for all requests using the default cache.
|
|
@@ -1351,7 +1345,7 @@ type FormulaResponse = {
|
|
|
1351
1345
|
};
|
|
1352
1346
|
/** Entry in the category widget response, see {@link WidgetRemoteSource#getCategories}. */
|
|
1353
1347
|
type CategoryResponseEntry = {
|
|
1354
|
-
name: string | null;
|
|
1348
|
+
name: string | number | null;
|
|
1355
1349
|
value: number;
|
|
1356
1350
|
};
|
|
1357
1351
|
/** Response from {@link WidgetRemoteSource#getCategories}. */
|
|
@@ -1469,7 +1463,6 @@ interface ModelSource {
|
|
|
1469
1463
|
spatialDataColumn?: string;
|
|
1470
1464
|
spatialDataType?: SpatialDataType;
|
|
1471
1465
|
spatialFiltersMode?: SpatialFilterPolyfillMode;
|
|
1472
|
-
tags?: Record<string, string>;
|
|
1473
1466
|
}
|
|
1474
1467
|
|
|
1475
1468
|
type WidgetRemoteSourceProps = WidgetSourceProps;
|
package/build/api-client.js
CHANGED
|
@@ -5839,8 +5839,7 @@ async function requestWithParameters({
|
|
|
5839
5839
|
headers: customHeaders = {},
|
|
5840
5840
|
errorContext,
|
|
5841
5841
|
maxLengthURL = DEFAULT_MAX_LENGTH_URL,
|
|
5842
|
-
localCache
|
|
5843
|
-
signal
|
|
5842
|
+
localCache
|
|
5844
5843
|
}) {
|
|
5845
5844
|
parameters = {
|
|
5846
5845
|
v: V3_MINOR_VERSION,
|
|
@@ -5863,9 +5862,8 @@ async function requestWithParameters({
|
|
|
5863
5862
|
const fetchPromise = url.length > maxLengthURL ? fetch(baseUrl, {
|
|
5864
5863
|
method: "POST",
|
|
5865
5864
|
body: JSON.stringify(parameters),
|
|
5866
|
-
headers
|
|
5867
|
-
|
|
5868
|
-
}) : fetch(url, { headers, signal });
|
|
5865
|
+
headers
|
|
5866
|
+
}) : fetch(url, { headers });
|
|
5869
5867
|
let response;
|
|
5870
5868
|
let responseJson;
|
|
5871
5869
|
const jsonPromise = fetchPromise.then((_response) => {
|
|
@@ -5917,12 +5915,10 @@ function createURLWithParameters(baseUrlString, parameters) {
|
|
|
5917
5915
|
if (isPureObject(value) || Array.isArray(value)) {
|
|
5918
5916
|
baseUrl.searchParams.set(key, JSON.stringify(value));
|
|
5919
5917
|
} else {
|
|
5920
|
-
|
|
5921
|
-
|
|
5922
|
-
|
|
5923
|
-
|
|
5924
|
-
);
|
|
5925
|
-
}
|
|
5918
|
+
baseUrl.searchParams.set(
|
|
5919
|
+
key,
|
|
5920
|
+
value.toString()
|
|
5921
|
+
);
|
|
5926
5922
|
}
|
|
5927
5923
|
}
|
|
5928
5924
|
return baseUrl.toString();
|
|
@@ -5966,7 +5962,7 @@ async function baseSource(endpoint, options, urlParameters) {
|
|
|
5966
5962
|
Authorization: `Bearer ${options.accessToken}`,
|
|
5967
5963
|
...options.headers
|
|
5968
5964
|
};
|
|
5969
|
-
const parameters = { client: clientId, ...
|
|
5965
|
+
const parameters = { client: clientId, ...urlParameters };
|
|
5970
5966
|
const errorContext = {
|
|
5971
5967
|
requestType: "Map instantiation",
|
|
5972
5968
|
connection: options.connectionName,
|
|
@@ -6168,8 +6164,7 @@ function executeModel(props) {
|
|
|
6168
6164
|
filtersLogicalOperator = "and",
|
|
6169
6165
|
spatialDataType = "geo",
|
|
6170
6166
|
spatialDataColumn = DEFAULT_GEO_COLUMN,
|
|
6171
|
-
spatialFiltersMode = "intersects"
|
|
6172
|
-
tags
|
|
6167
|
+
spatialFiltersMode = "intersects"
|
|
6173
6168
|
} = source;
|
|
6174
6169
|
const queryParams = {
|
|
6175
6170
|
type,
|
|
@@ -6178,8 +6173,7 @@ function executeModel(props) {
|
|
|
6178
6173
|
params,
|
|
6179
6174
|
queryParameters: source.queryParameters || "",
|
|
6180
6175
|
filters,
|
|
6181
|
-
filtersLogicalOperator
|
|
6182
|
-
...tags ?? {}
|
|
6176
|
+
filtersLogicalOperator
|
|
6183
6177
|
};
|
|
6184
6178
|
queryParams.spatialDataType = spatialDataType;
|
|
6185
6179
|
queryParams.spatialDataColumn = spatialDataColumn;
|
|
@@ -6312,8 +6306,7 @@ var WidgetRemoteSource = class extends WidgetSource {
|
|
|
6312
6306
|
filters: getApplicableFilters(filterOwner, filters || props.filters),
|
|
6313
6307
|
filtersLogicalOperator: props.filtersLogicalOperator,
|
|
6314
6308
|
spatialDataType: props.spatialDataType,
|
|
6315
|
-
spatialDataColumn: props.spatialDataColumn
|
|
6316
|
-
tags: props.tags
|
|
6309
|
+
spatialDataColumn: props.spatialDataColumn
|
|
6317
6310
|
};
|
|
6318
6311
|
}
|
|
6319
6312
|
async getCategories(options) {
|
|
@@ -6800,17 +6793,20 @@ function groupValuesByColumn({
|
|
|
6800
6793
|
function getSorter(orderBy) {
|
|
6801
6794
|
switch (orderBy) {
|
|
6802
6795
|
case "frequency_asc":
|
|
6803
|
-
return (a, b) => a.value - b.value ||
|
|
6796
|
+
return (a, b) => a.value - b.value || nameCompare(a.name, b.name);
|
|
6804
6797
|
case "frequency_desc":
|
|
6805
|
-
return (a, b) => b.value - a.value ||
|
|
6798
|
+
return (a, b) => b.value - a.value || nameCompare(a.name, b.name);
|
|
6806
6799
|
case "alphabetical_asc":
|
|
6807
|
-
return (a, b) =>
|
|
6800
|
+
return (a, b) => nameCompare(a.name, b.name) || b.value - a.value;
|
|
6808
6801
|
case "alphabetical_desc":
|
|
6809
|
-
return (a, b) =>
|
|
6802
|
+
return (a, b) => nameCompare(b.name, a.name) || b.value - a.value;
|
|
6810
6803
|
}
|
|
6811
6804
|
}
|
|
6812
|
-
function
|
|
6813
|
-
|
|
6805
|
+
function nameCompare(a, b) {
|
|
6806
|
+
if (typeof a === "number" && typeof b === "number") {
|
|
6807
|
+
return a - b;
|
|
6808
|
+
}
|
|
6809
|
+
return String(a ?? "null").localeCompare(String(b ?? "null"));
|
|
6814
6810
|
}
|
|
6815
6811
|
|
|
6816
6812
|
// src/utils/dateUtils.ts
|
|
@@ -8116,8 +8112,7 @@ var query = async function(options) {
|
|
|
8116
8112
|
localCache,
|
|
8117
8113
|
connectionName,
|
|
8118
8114
|
sqlQuery,
|
|
8119
|
-
queryParameters
|
|
8120
|
-
internalParameters
|
|
8115
|
+
queryParameters
|
|
8121
8116
|
} = options;
|
|
8122
8117
|
const urlParameters = { q: sqlQuery };
|
|
8123
8118
|
if (queryParameters) {
|
|
@@ -8128,12 +8123,7 @@ var query = async function(options) {
|
|
|
8128
8123
|
Authorization: `Bearer ${options.accessToken}`,
|
|
8129
8124
|
...options.headers
|
|
8130
8125
|
};
|
|
8131
|
-
const parameters = {
|
|
8132
|
-
client: clientId,
|
|
8133
|
-
...options.tags,
|
|
8134
|
-
...internalParameters,
|
|
8135
|
-
...urlParameters
|
|
8136
|
-
};
|
|
8126
|
+
const parameters = { client: clientId, ...urlParameters };
|
|
8137
8127
|
const errorContext = {
|
|
8138
8128
|
requestType: "SQL",
|
|
8139
8129
|
connection: options.connectionName,
|
|
@@ -8146,8 +8136,7 @@ var query = async function(options) {
|
|
|
8146
8136
|
headers,
|
|
8147
8137
|
errorContext,
|
|
8148
8138
|
maxLengthURL,
|
|
8149
|
-
localCache
|
|
8150
|
-
signal: options.signal
|
|
8139
|
+
localCache
|
|
8151
8140
|
});
|
|
8152
8141
|
};
|
|
8153
8142
|
|