@carto/api-client 0.5.11 → 0.5.12

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,12 @@
2
2
 
3
3
  ## 0.5
4
4
 
5
+ ### 0.5.12
6
+
7
+ - feat(sources): allow passing tags to baseSource and query methods (#193)
8
+
9
+ ### 0.5.11
10
+
5
11
  ### 0.5.10
6
12
 
7
13
  - fix(widgets): orderBy support in WidgetRasterSource.getCategory (#210)
@@ -6084,7 +6084,8 @@ async function requestWithParameters({
6084
6084
  headers: customHeaders = {},
6085
6085
  errorContext,
6086
6086
  maxLengthURL = DEFAULT_MAX_LENGTH_URL,
6087
- localCache
6087
+ localCache,
6088
+ signal
6088
6089
  }) {
6089
6090
  parameters = {
6090
6091
  v: V3_MINOR_VERSION,
@@ -6107,8 +6108,9 @@ async function requestWithParameters({
6107
6108
  const fetchPromise = url.length > maxLengthURL ? fetch(baseUrl, {
6108
6109
  method: "POST",
6109
6110
  body: JSON.stringify(parameters),
6110
- headers
6111
- }) : fetch(url, { headers });
6111
+ headers,
6112
+ signal
6113
+ }) : fetch(url, { headers, signal });
6112
6114
  let response;
6113
6115
  let responseJson;
6114
6116
  const jsonPromise = fetchPromise.then((_response) => {
@@ -6160,10 +6162,12 @@ function createURLWithParameters(baseUrlString, parameters) {
6160
6162
  if (isPureObject(value) || Array.isArray(value)) {
6161
6163
  baseUrl.searchParams.set(key, JSON.stringify(value));
6162
6164
  } else {
6163
- baseUrl.searchParams.set(
6164
- key,
6165
- value.toString()
6166
- );
6165
+ if (value !== null && value !== void 0) {
6166
+ baseUrl.searchParams.set(
6167
+ key,
6168
+ value.toString()
6169
+ );
6170
+ }
6167
6171
  }
6168
6172
  }
6169
6173
  return baseUrl.toString();
@@ -6207,7 +6211,7 @@ async function baseSource(endpoint, options, urlParameters) {
6207
6211
  Authorization: `Bearer ${options.accessToken}`,
6208
6212
  ...options.headers
6209
6213
  };
6210
- const parameters = { client: clientId, ...urlParameters };
6214
+ const parameters = { client: clientId, ...options.tags, ...urlParameters };
6211
6215
  const errorContext = {
6212
6216
  requestType: "Map instantiation",
6213
6217
  connection: options.connectionName,
@@ -6428,7 +6432,8 @@ function executeModel(props) {
6428
6432
  filtersLogicalOperator = "and",
6429
6433
  spatialDataType = "geo",
6430
6434
  spatialDataColumn = DEFAULT_GEO_COLUMN,
6431
- spatialFiltersMode = "intersects"
6435
+ spatialFiltersMode = "intersects",
6436
+ tags
6432
6437
  } = source;
6433
6438
  const queryParams = {
6434
6439
  type,
@@ -6437,7 +6442,8 @@ function executeModel(props) {
6437
6442
  params,
6438
6443
  queryParameters: source.queryParameters || "",
6439
6444
  filters,
6440
- filtersLogicalOperator
6445
+ filtersLogicalOperator,
6446
+ ...tags ?? {}
6441
6447
  };
6442
6448
  queryParams.spatialDataType = spatialDataType;
6443
6449
  queryParams.spatialDataColumn = spatialDataColumn;
@@ -6572,7 +6578,8 @@ var WidgetRemoteSource = class extends WidgetSource {
6572
6578
  filters: getApplicableFilters(filterOwner, filters || props.filters),
6573
6579
  filtersLogicalOperator: props.filtersLogicalOperator,
6574
6580
  spatialDataType: props.spatialDataType,
6575
- spatialDataColumn: props.spatialDataColumn
6581
+ spatialDataColumn: props.spatialDataColumn,
6582
+ tags: props.tags
6576
6583
  };
6577
6584
  }
6578
6585
  async getCategories(options) {
@@ -8414,7 +8421,8 @@ var query = async function(options) {
8414
8421
  localCache,
8415
8422
  connectionName,
8416
8423
  sqlQuery,
8417
- queryParameters
8424
+ queryParameters,
8425
+ internalParameters
8418
8426
  } = options;
8419
8427
  const urlParameters = { q: sqlQuery };
8420
8428
  if (queryParameters) {
@@ -8425,7 +8433,12 @@ var query = async function(options) {
8425
8433
  Authorization: `Bearer ${options.accessToken}`,
8426
8434
  ...options.headers
8427
8435
  };
8428
- const parameters = { client: clientId, ...urlParameters };
8436
+ const parameters = {
8437
+ client: clientId,
8438
+ ...options.tags,
8439
+ ...internalParameters,
8440
+ ...urlParameters
8441
+ };
8429
8442
  const errorContext = {
8430
8443
  requestType: "SQL",
8431
8444
  connection: options.connectionName,
@@ -8438,7 +8451,8 @@ var query = async function(options) {
8438
8451
  headers,
8439
8452
  errorContext,
8440
8453
  maxLengthURL,
8441
- localCache
8454
+ localCache,
8455
+ signal: options.signal
8442
8456
  });
8443
8457
  };
8444
8458