@carto/api-client 0.5.23-alpha.fill-data.0 → 0.5.23

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/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "homepage": "https://github.com/CartoDB/carto-api-client#readme",
9
9
  "author": "Don McCurdy <donmccurdy@carto.com>",
10
10
  "packageManager": "yarn@4.3.1",
11
- "version": "0.5.23-alpha.fill-data.0",
11
+ "version": "0.5.23",
12
12
  "license": "MIT",
13
13
  "publishConfig": {
14
14
  "access": "public"
@@ -110,12 +110,10 @@
110
110
  "@types/react": "^18.3.18",
111
111
  "@types/semver": "^7.5.8",
112
112
  "@vitest/coverage-istanbul": "^3.0.9",
113
- "@webcomponents/webcomponentsjs": "^2.8.0",
114
113
  "concurrently": "^9.1.2",
115
114
  "echarts": "^6.0.0",
116
115
  "eslint": "^9.22.0",
117
116
  "lit": "^3.2.1",
118
- "lit-analyzer": "^2.0.3",
119
117
  "maplibre-gl": "^5.2.0",
120
118
  "prettier": "^3.5.3",
121
119
  "resolve-package-path": "^4.0.3",
@@ -132,6 +130,5 @@
132
130
  "resolutions": {
133
131
  "@carto/api-client": "portal:./",
134
132
  "rollup": "^4.20.0"
135
- },
136
- "stableVersion": "0.5.22"
133
+ }
137
134
  }
package/src/constants.ts CHANGED
@@ -32,6 +32,10 @@ export enum ApiVersion {
32
32
  /** @privateRemarks Source: @carto/constants, @deck.gl/carto */
33
33
  export const DEFAULT_API_BASE_URL = 'https://gcp-us-east1.api.carto.com';
34
34
 
35
+ export const AUDIT_TAGS = {
36
+ mapId: 'tag-mapId',
37
+ };
38
+
35
39
  /** @privateRemarks Source: @carto/react-core */
36
40
  export enum TileFormat {
37
41
  MVT = 'mvt',
@@ -1,4 +1,4 @@
1
- import {DEFAULT_API_BASE_URL} from '../constants.js';
1
+ import {AUDIT_TAGS, DEFAULT_API_BASE_URL} from '../constants.js';
2
2
 
3
3
  import {
4
4
  type APIErrorContext,
@@ -9,7 +9,7 @@ import {
9
9
  } from '../api/index.js';
10
10
 
11
11
  import {type ParseMapResult, parseMap} from './parse-map.js';
12
- import {assert} from '../utils.js';
12
+ import {assert, isEmptyObject} from '../utils.js';
13
13
  import type {Basemap, Dataset, KeplerMapConfig} from './types.js';
14
14
  import {fetchBasemapProps} from './basemap.js';
15
15
  import {configureSource} from './source.js';
@@ -26,7 +26,10 @@ async function _fetchMapDataset(
26
26
  const cache: {value?: number} = {};
27
27
  const configuredSource = configureSource({
28
28
  dataset,
29
- filters: isRemoteCalculationSupported(dataset) ? filters : undefined,
29
+ filters:
30
+ !isEmptyObject(filters) && isRemoteCalculationSupported(dataset)
31
+ ? filters
32
+ : undefined,
30
33
  options: {
31
34
  ...context,
32
35
  connection: connectionName,
@@ -34,6 +37,11 @@ async function _fetchMapDataset(
34
37
  accessToken: context.accessToken!,
35
38
  apiBaseUrl: context.apiBaseUrl,
36
39
  maxLengthURL: context.maxLengthURL,
40
+ ...(context.mapId && {
41
+ tags: {
42
+ [AUDIT_TAGS.mapId]: context.mapId,
43
+ },
44
+ }),
37
45
  },
38
46
  });
39
47
  dataset.data = await configuredSource;
@@ -74,6 +82,9 @@ async function _fetchTilestats(
74
82
  if (client) {
75
83
  parameters.client = client;
76
84
  }
85
+ if (context.mapId) {
86
+ parameters[AUDIT_TAGS.mapId] = context.mapId;
87
+ }
77
88
  if (type === 'query') {
78
89
  parameters.q = source;
79
90
  if (queryParameters) {
@@ -190,7 +201,7 @@ export type FetchMapOptions = {
190
201
  /**
191
202
  * Context reused while fetching and updating a map with fetchMap().
192
203
  */
193
- type _FetchMapContext = {apiBaseUrl: string} & Pick<
204
+ type _FetchMapContext = {apiBaseUrl: string; mapId?: string} & Pick<
194
205
  FetchMapOptions,
195
206
  'accessToken' | 'clientId' | 'headers' | 'maxLengthURL'
196
207
  >;
@@ -243,6 +254,7 @@ export async function fetchMap({
243
254
  maxLengthURL,
244
255
  });
245
256
  const context: _FetchMapContext = {
257
+ mapId: cartoMapId,
246
258
  accessToken: map.token || accessToken,
247
259
  apiBaseUrl,
248
260
  clientId,
@@ -41,6 +41,7 @@ type FetchDatasetOptions = {
41
41
  cacheControl: 'no-cache'[];
42
42
  };
43
43
  maxLengthURL?: number;
44
+ tags?: Record<string, string>;
44
45
  };
45
46
 
46
47
  type FetchDataset = {
@@ -169,6 +170,7 @@ function getSourceOptions({
169
170
  connection,
170
171
  headers,
171
172
  maxLengthURL,
173
+ tags,
172
174
  }: FetchDatasetOptions) {
173
175
  return {
174
176
  accessToken,
@@ -181,6 +183,7 @@ function getSourceOptions({
181
183
  cacheControl: ['no-cache'] as 'no-cache'[],
182
184
  },
183
185
  }),
186
+ tags,
184
187
  };
185
188
  }
186
189