@carto/api-client 0.5.22 → 0.5.23-alpha.audit-tags.0

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,8 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ - fix(fetchMap): Add tag-mapId to requests (#255)
6
+
5
7
  ## 0.5
6
8
 
7
9
  ### 0.5.22
@@ -99,6 +99,7 @@ var require_thenBy_module = __commonJS({
99
99
  // src/index.ts
100
100
  var src_exports = {};
101
101
  __export(src_exports, {
102
+ AUDIT_TAGS: () => AUDIT_TAGS,
102
103
  AggregationTypes: () => AggregationTypes,
103
104
  ApiVersion: () => ApiVersion,
104
105
  BASEMAP: () => basemap_styles_default,
@@ -132,6 +133,8 @@ __export(src_exports, {
132
133
  _createVecExprEvaluator: () => createVecExprEvaluator,
133
134
  _domainFromValues: () => domainFromValues,
134
135
  _evaluateVecExpr: () => evaluateVecExpr,
136
+ _fillInMapDatasets: () => fillInMapDatasets,
137
+ _fillInTileStats: () => fillInTileStats,
135
138
  _getHexagonResolution: () => _getHexagonResolution,
136
139
  _getLog10ScaleSteps: () => getLog10ScaleSteps,
137
140
  _getRasterTileLayerStyleProps: () => getRasterTileLayerStyleProps,
@@ -235,6 +238,9 @@ var ApiVersion = /* @__PURE__ */ ((ApiVersion2) => {
235
238
  return ApiVersion2;
236
239
  })(ApiVersion || {});
237
240
  var DEFAULT_API_BASE_URL = "https://gcp-us-east1.api.carto.com";
241
+ var AUDIT_TAGS = {
242
+ mapId: "tag-mapId"
243
+ };
238
244
  var TileFormat = /* @__PURE__ */ ((TileFormat2) => {
239
245
  TileFormat2["MVT"] = "mvt";
240
246
  TileFormat2["JSON"] = "json";
@@ -11142,7 +11148,8 @@ function getSourceOptions({
11142
11148
  apiBaseUrl,
11143
11149
  connection,
11144
11150
  headers,
11145
- maxLengthURL
11151
+ maxLengthURL,
11152
+ tags
11146
11153
  }) {
11147
11154
  return {
11148
11155
  accessToken,
@@ -11154,7 +11161,8 @@ function getSourceOptions({
11154
11161
  localCache: {
11155
11162
  cacheControl: ["no-cache"]
11156
11163
  }
11157
- }
11164
+ },
11165
+ tags
11158
11166
  };
11159
11167
  }
11160
11168
  function getDynamicTileResolution(spatialIndex) {
@@ -11190,14 +11198,19 @@ async function _fetchMapDataset(dataset, filters, context) {
11190
11198
  const cache = {};
11191
11199
  const configuredSource = configureSource({
11192
11200
  dataset,
11193
- filters: isRemoteCalculationSupported(dataset) ? filters : void 0,
11201
+ filters: !isEmptyObject(filters) && isRemoteCalculationSupported(dataset) ? filters : void 0,
11194
11202
  options: {
11195
11203
  ...context,
11196
11204
  connection: connectionName,
11197
11205
  headers: context.headers,
11198
11206
  accessToken: context.accessToken,
11199
11207
  apiBaseUrl: context.apiBaseUrl,
11200
- maxLengthURL: context.maxLengthURL
11208
+ maxLengthURL: context.maxLengthURL,
11209
+ ...context.mapId && {
11210
+ tags: {
11211
+ [AUDIT_TAGS.mapId]: context.mapId
11212
+ }
11213
+ }
11201
11214
  }
11202
11215
  });
11203
11216
  dataset.data = await configuredSource;
@@ -11230,6 +11243,9 @@ async function _fetchTilestats(attribute, dataset, context) {
11230
11243
  if (client2) {
11231
11244
  parameters.client = client2;
11232
11245
  }
11246
+ if (context.mapId) {
11247
+ parameters[AUDIT_TAGS.mapId] = context.mapId;
11248
+ }
11233
11249
  if (type === "query") {
11234
11250
  parameters.q = source;
11235
11251
  if (queryParameters) {
@@ -11319,6 +11335,7 @@ async function fetchMap({
11319
11335
  maxLengthURL
11320
11336
  });
11321
11337
  const context = {
11338
+ mapId: cartoMapId,
11322
11339
  accessToken: map.token || accessToken,
11323
11340
  apiBaseUrl,
11324
11341
  clientId,
@@ -11580,6 +11597,7 @@ function hashBuckets(initialCount) {
11580
11597
  }
11581
11598
  // Annotate the CommonJS export names for ESM import in node:
11582
11599
  0 && (module.exports = {
11600
+ AUDIT_TAGS,
11583
11601
  AggregationTypes,
11584
11602
  ApiVersion,
11585
11603
  BASEMAP,
@@ -11613,6 +11631,8 @@ function hashBuckets(initialCount) {
11613
11631
  _createVecExprEvaluator,
11614
11632
  _domainFromValues,
11615
11633
  _evaluateVecExpr,
11634
+ _fillInMapDatasets,
11635
+ _fillInTileStats,
11616
11636
  _getHexagonResolution,
11617
11637
  _getLog10ScaleSteps,
11618
11638
  _getRasterTileLayerStyleProps,