@carto/api-client 0.5.20 → 0.5.21

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.20",
11
+ "version": "0.5.21",
12
12
  "license": "MIT",
13
13
  "publishConfig": {
14
14
  "access": "public"
package/src/api/query.ts CHANGED
@@ -24,7 +24,10 @@ export type QueryOptions = SourceOptions &
24
24
  /** Used to abort the request. */
25
25
  signal?: AbortSignal;
26
26
  };
27
- type UrlParameters = {q: string; queryParameters?: string};
27
+ type UrlParameters = {
28
+ q: string;
29
+ queryParameters?: Record<string, unknown> | unknown[];
30
+ };
28
31
 
29
32
  export const query = async function (
30
33
  options: QueryOptions
@@ -42,7 +45,7 @@ export const query = async function (
42
45
  const urlParameters: UrlParameters = {q: sqlQuery};
43
46
 
44
47
  if (queryParameters) {
45
- urlParameters.queryParameters = JSON.stringify(queryParameters);
48
+ urlParameters.queryParameters = queryParameters;
46
49
  }
47
50
 
48
51
  const baseUrl = buildQueryUrl({apiBaseUrl, connectionName});
@@ -70,14 +70,14 @@ async function _fetchTilestats(
70
70
  const baseUrl = buildStatsUrl({attribute, apiBaseUrl, ...dataset});
71
71
  const client = new URLSearchParams(data.tiles[0]).get('client');
72
72
  const headers = {Authorization: `Bearer ${context.accessToken}`};
73
- const parameters: Record<string, string> = {};
73
+ const parameters: Record<string, unknown> = {};
74
74
  if (client) {
75
75
  parameters.client = client;
76
76
  }
77
77
  if (type === 'query') {
78
78
  parameters.q = source;
79
79
  if (queryParameters) {
80
- parameters.queryParameters = JSON.stringify(queryParameters);
80
+ parameters.queryParameters = queryParameters;
81
81
  }
82
82
  }
83
83
  const stats = await requestWithParameters({