@carto/api-client 0.5.11 → 0.5.13

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)
@@ -110,6 +110,7 @@ __export(src_exports, {
110
110
  OPACITY_MAP: () => OPACITY_MAP,
111
111
  OTHERS_CATEGORY_NAME: () => OTHERS_CATEGORY_NAME,
112
112
  Provider: () => Provider,
113
+ RasterBandColorinterp: () => RasterBandColorinterp,
113
114
  SOURCE_DEFAULTS: () => SOURCE_DEFAULTS,
114
115
  SchemaFieldType: () => SchemaFieldType,
115
116
  SpatialIndex: () => SpatialIndex,
@@ -6084,7 +6085,8 @@ async function requestWithParameters({
6084
6085
  headers: customHeaders = {},
6085
6086
  errorContext,
6086
6087
  maxLengthURL = DEFAULT_MAX_LENGTH_URL,
6087
- localCache
6088
+ localCache,
6089
+ signal
6088
6090
  }) {
6089
6091
  parameters = {
6090
6092
  v: V3_MINOR_VERSION,
@@ -6107,8 +6109,9 @@ async function requestWithParameters({
6107
6109
  const fetchPromise = url.length > maxLengthURL ? fetch(baseUrl, {
6108
6110
  method: "POST",
6109
6111
  body: JSON.stringify(parameters),
6110
- headers
6111
- }) : fetch(url, { headers });
6112
+ headers,
6113
+ signal
6114
+ }) : fetch(url, { headers, signal });
6112
6115
  let response;
6113
6116
  let responseJson;
6114
6117
  const jsonPromise = fetchPromise.then((_response) => {
@@ -6160,10 +6163,12 @@ function createURLWithParameters(baseUrlString, parameters) {
6160
6163
  if (isPureObject(value) || Array.isArray(value)) {
6161
6164
  baseUrl.searchParams.set(key, JSON.stringify(value));
6162
6165
  } else {
6163
- baseUrl.searchParams.set(
6164
- key,
6165
- value.toString()
6166
- );
6166
+ if (value !== null && value !== void 0) {
6167
+ baseUrl.searchParams.set(
6168
+ key,
6169
+ value.toString()
6170
+ );
6171
+ }
6167
6172
  }
6168
6173
  }
6169
6174
  return baseUrl.toString();
@@ -6207,7 +6212,7 @@ async function baseSource(endpoint, options, urlParameters) {
6207
6212
  Authorization: `Bearer ${options.accessToken}`,
6208
6213
  ...options.headers
6209
6214
  };
6210
- const parameters = { client: clientId, ...urlParameters };
6215
+ const parameters = { client: clientId, ...options.tags, ...urlParameters };
6211
6216
  const errorContext = {
6212
6217
  requestType: "Map instantiation",
6213
6218
  connection: options.connectionName,
@@ -6247,6 +6252,18 @@ async function baseSource(endpoint, options, urlParameters) {
6247
6252
  return json;
6248
6253
  }
6249
6254
 
6255
+ // src/sources/constants.ts
6256
+ init_cjs_shims();
6257
+ var RasterBandColorinterp = /* @__PURE__ */ ((RasterBandColorinterp2) => {
6258
+ RasterBandColorinterp2["Gray"] = "gray";
6259
+ RasterBandColorinterp2["Red"] = "red";
6260
+ RasterBandColorinterp2["Green"] = "green";
6261
+ RasterBandColorinterp2["Blue"] = "blue";
6262
+ RasterBandColorinterp2["Alpha"] = "alpha";
6263
+ RasterBandColorinterp2["Palette"] = "palette";
6264
+ return RasterBandColorinterp2;
6265
+ })(RasterBandColorinterp || {});
6266
+
6250
6267
  // src/sources/boundary-query-source.ts
6251
6268
  init_cjs_shims();
6252
6269
  var boundaryQuerySource = async function(options) {
@@ -6428,7 +6445,8 @@ function executeModel(props) {
6428
6445
  filtersLogicalOperator = "and",
6429
6446
  spatialDataType = "geo",
6430
6447
  spatialDataColumn = DEFAULT_GEO_COLUMN,
6431
- spatialFiltersMode = "intersects"
6448
+ spatialFiltersMode = "intersects",
6449
+ tags
6432
6450
  } = source;
6433
6451
  const queryParams = {
6434
6452
  type,
@@ -6437,7 +6455,8 @@ function executeModel(props) {
6437
6455
  params,
6438
6456
  queryParameters: source.queryParameters || "",
6439
6457
  filters,
6440
- filtersLogicalOperator
6458
+ filtersLogicalOperator,
6459
+ ...tags ?? {}
6441
6460
  };
6442
6461
  queryParams.spatialDataType = spatialDataType;
6443
6462
  queryParams.spatialDataColumn = spatialDataColumn;
@@ -6572,7 +6591,8 @@ var WidgetRemoteSource = class extends WidgetSource {
6572
6591
  filters: getApplicableFilters(filterOwner, filters || props.filters),
6573
6592
  filtersLogicalOperator: props.filtersLogicalOperator,
6574
6593
  spatialDataType: props.spatialDataType,
6575
- spatialDataColumn: props.spatialDataColumn
6594
+ spatialDataColumn: props.spatialDataColumn,
6595
+ tags: props.tags
6576
6596
  };
6577
6597
  }
6578
6598
  async getCategories(options) {
@@ -8414,7 +8434,8 @@ var query = async function(options) {
8414
8434
  localCache,
8415
8435
  connectionName,
8416
8436
  sqlQuery,
8417
- queryParameters
8437
+ queryParameters,
8438
+ internalParameters
8418
8439
  } = options;
8419
8440
  const urlParameters = { q: sqlQuery };
8420
8441
  if (queryParameters) {
@@ -8425,7 +8446,12 @@ var query = async function(options) {
8425
8446
  Authorization: `Bearer ${options.accessToken}`,
8426
8447
  ...options.headers
8427
8448
  };
8428
- const parameters = { client: clientId, ...urlParameters };
8449
+ const parameters = {
8450
+ client: clientId,
8451
+ ...options.tags,
8452
+ ...internalParameters,
8453
+ ...urlParameters
8454
+ };
8429
8455
  const errorContext = {
8430
8456
  requestType: "SQL",
8431
8457
  connection: options.connectionName,
@@ -8438,7 +8464,8 @@ var query = async function(options) {
8438
8464
  headers,
8439
8465
  errorContext,
8440
8466
  maxLengthURL,
8441
- localCache
8467
+ localCache,
8468
+ signal: options.signal
8442
8469
  });
8443
8470
  };
8444
8471
 
@@ -10485,6 +10512,7 @@ function hashBuckets(initialCount) {
10485
10512
  OPACITY_MAP,
10486
10513
  OTHERS_CATEGORY_NAME,
10487
10514
  Provider,
10515
+ RasterBandColorinterp,
10488
10516
  SOURCE_DEFAULTS,
10489
10517
  SchemaFieldType,
10490
10518
  SpatialIndex,