@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 CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## 0.5
4
4
 
5
+ ### 0.5.10
6
+
7
+ - fix(widgets): orderBy support in WidgetRasterSource.getCategory (#210)
8
+
5
9
  ### 0.5.9
6
10
 
7
11
  - feat(widgets): orderBy support in WidgetSource.getCategory (#203)
@@ -6084,8 +6084,7 @@ async function requestWithParameters({
6084
6084
  headers: customHeaders = {},
6085
6085
  errorContext,
6086
6086
  maxLengthURL = DEFAULT_MAX_LENGTH_URL,
6087
- localCache,
6088
- signal
6087
+ localCache
6089
6088
  }) {
6090
6089
  parameters = {
6091
6090
  v: V3_MINOR_VERSION,
@@ -6108,9 +6107,8 @@ async function requestWithParameters({
6108
6107
  const fetchPromise = url.length > maxLengthURL ? fetch(baseUrl, {
6109
6108
  method: "POST",
6110
6109
  body: JSON.stringify(parameters),
6111
- headers,
6112
- signal
6113
- }) : fetch(url, { headers, signal });
6110
+ headers
6111
+ }) : fetch(url, { headers });
6114
6112
  let response;
6115
6113
  let responseJson;
6116
6114
  const jsonPromise = fetchPromise.then((_response) => {
@@ -6162,12 +6160,10 @@ function createURLWithParameters(baseUrlString, parameters) {
6162
6160
  if (isPureObject(value) || Array.isArray(value)) {
6163
6161
  baseUrl.searchParams.set(key, JSON.stringify(value));
6164
6162
  } else {
6165
- if (value !== null && value !== void 0) {
6166
- baseUrl.searchParams.set(
6167
- key,
6168
- value.toString()
6169
- );
6170
- }
6163
+ baseUrl.searchParams.set(
6164
+ key,
6165
+ value.toString()
6166
+ );
6171
6167
  }
6172
6168
  }
6173
6169
  return baseUrl.toString();
@@ -6211,7 +6207,7 @@ async function baseSource(endpoint, options, urlParameters) {
6211
6207
  Authorization: `Bearer ${options.accessToken}`,
6212
6208
  ...options.headers
6213
6209
  };
6214
- const parameters = { client: clientId, ...options.tags, ...urlParameters };
6210
+ const parameters = { client: clientId, ...urlParameters };
6215
6211
  const errorContext = {
6216
6212
  requestType: "Map instantiation",
6217
6213
  connection: options.connectionName,
@@ -6432,8 +6428,7 @@ function executeModel(props) {
6432
6428
  filtersLogicalOperator = "and",
6433
6429
  spatialDataType = "geo",
6434
6430
  spatialDataColumn = DEFAULT_GEO_COLUMN,
6435
- spatialFiltersMode = "intersects",
6436
- tags
6431
+ spatialFiltersMode = "intersects"
6437
6432
  } = source;
6438
6433
  const queryParams = {
6439
6434
  type,
@@ -6442,8 +6437,7 @@ function executeModel(props) {
6442
6437
  params,
6443
6438
  queryParameters: source.queryParameters || "",
6444
6439
  filters,
6445
- filtersLogicalOperator,
6446
- ...tags ?? {}
6440
+ filtersLogicalOperator
6447
6441
  };
6448
6442
  queryParams.spatialDataType = spatialDataType;
6449
6443
  queryParams.spatialDataColumn = spatialDataColumn;
@@ -6578,8 +6572,7 @@ var WidgetRemoteSource = class extends WidgetSource {
6578
6572
  filters: getApplicableFilters(filterOwner, filters || props.filters),
6579
6573
  filtersLogicalOperator: props.filtersLogicalOperator,
6580
6574
  spatialDataType: props.spatialDataType,
6581
- spatialDataColumn: props.spatialDataColumn,
6582
- tags: props.tags
6575
+ spatialDataColumn: props.spatialDataColumn
6583
6576
  };
6584
6577
  }
6585
6578
  async getCategories(options) {
@@ -7078,17 +7071,20 @@ function groupValuesByColumn({
7078
7071
  function getSorter(orderBy) {
7079
7072
  switch (orderBy) {
7080
7073
  case "frequency_asc":
7081
- return (a, b) => a.value - b.value || localeCompare(a.name, b.name);
7074
+ return (a, b) => a.value - b.value || nameCompare(a.name, b.name);
7082
7075
  case "frequency_desc":
7083
- return (a, b) => b.value - a.value || localeCompare(a.name, b.name);
7076
+ return (a, b) => b.value - a.value || nameCompare(a.name, b.name);
7084
7077
  case "alphabetical_asc":
7085
- return (a, b) => localeCompare(a.name, b.name) || b.value - a.value;
7078
+ return (a, b) => nameCompare(a.name, b.name) || b.value - a.value;
7086
7079
  case "alphabetical_desc":
7087
- return (a, b) => localeCompare(b.name, a.name) || b.value - a.value;
7080
+ return (a, b) => nameCompare(b.name, a.name) || b.value - a.value;
7088
7081
  }
7089
7082
  }
7090
- function localeCompare(a, b) {
7091
- return (a ?? "null").localeCompare(b ?? "null");
7083
+ function nameCompare(a, b) {
7084
+ if (typeof a === "number" && typeof b === "number") {
7085
+ return a - b;
7086
+ }
7087
+ return String(a ?? "null").localeCompare(String(b ?? "null"));
7092
7088
  }
7093
7089
 
7094
7090
  // src/operations/groupByDate.ts
@@ -8418,8 +8414,7 @@ var query = async function(options) {
8418
8414
  localCache,
8419
8415
  connectionName,
8420
8416
  sqlQuery,
8421
- queryParameters,
8422
- internalParameters
8417
+ queryParameters
8423
8418
  } = options;
8424
8419
  const urlParameters = { q: sqlQuery };
8425
8420
  if (queryParameters) {
@@ -8430,12 +8425,7 @@ var query = async function(options) {
8430
8425
  Authorization: `Bearer ${options.accessToken}`,
8431
8426
  ...options.headers
8432
8427
  };
8433
- const parameters = {
8434
- client: clientId,
8435
- ...options.tags,
8436
- ...internalParameters,
8437
- ...urlParameters
8438
- };
8428
+ const parameters = { client: clientId, ...urlParameters };
8439
8429
  const errorContext = {
8440
8430
  requestType: "SQL",
8441
8431
  connection: options.connectionName,
@@ -8448,8 +8438,7 @@ var query = async function(options) {
8448
8438
  headers,
8449
8439
  errorContext,
8450
8440
  maxLengthURL,
8451
- localCache,
8452
- signal: options.signal
8441
+ localCache
8453
8442
  });
8454
8443
  };
8455
8444