@carto/api-client 0.5.4-alpha.1 → 0.5.5-alpha.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/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.4-alpha.1",
11
+ "version": "0.5.5-alpha.0",
12
12
  "license": "MIT",
13
13
  "publishConfig": {
14
14
  "access": "public"
@@ -129,5 +129,5 @@
129
129
  "@carto/api-client": "portal:./",
130
130
  "rollup": "^4.20.0"
131
131
  },
132
- "stableVersion": "0.5.3"
132
+ "stableVersion": "0.5.4"
133
133
  }
package/src/api/index.ts CHANGED
@@ -11,4 +11,7 @@ export {
11
11
  export {buildPublicMapUrl, buildStatsUrl} from './endpoints.js';
12
12
  export {query} from './query.js';
13
13
  export type {QueryOptions} from './query.js';
14
- export {requestWithParameters} from './request-with-parameters.js';
14
+ export {
15
+ requestWithParameters,
16
+ clearDefaultRequestCache,
17
+ } from './request-with-parameters.js';
@@ -164,3 +164,11 @@ function excludeURLParameters(baseUrlString: string, parameters: string[]) {
164
164
  }
165
165
  return baseUrl.toString();
166
166
  }
167
+
168
+ /**
169
+ * Clears the HTTP response cache for all requests using the default cache.
170
+ * @internal
171
+ */
172
+ export function clearDefaultRequestCache() {
173
+ DEFAULT_REQUEST_CACHE.clear();
174
+ }
package/src/index.ts CHANGED
@@ -18,6 +18,7 @@ export {
18
18
  buildStatsUrl, // Internal, but required for fetchMap().
19
19
  query,
20
20
  requestWithParameters,
21
+ clearDefaultRequestCache, // Internal, for unit testing.
21
22
  } from './api/index.js';
22
23
 
23
24
  export {_getHexagonResolution} from './spatial-index.js';
@@ -85,6 +85,7 @@ export function executeModel(props: {
85
85
  filters,
86
86
  filtersLogicalOperator = 'and',
87
87
  spatialDataType = 'geo',
88
+ spatialDataColumn = DEFAULT_GEO_COLUMN,
88
89
  spatialFiltersMode = 'intersects',
89
90
  } = source;
90
91
 
@@ -98,26 +99,15 @@ export function executeModel(props: {
98
99
  filtersLogicalOperator,
99
100
  };
100
101
 
101
- const spatialDataColumn = source.spatialDataColumn || DEFAULT_GEO_COLUMN;
102
+ queryParams.spatialDataType = spatialDataType;
103
+ queryParams.spatialDataColumn = spatialDataColumn;
102
104
 
103
- // Picking Model API requires 'spatialDataColumn'.
104
- if (model === 'pick') {
105
- queryParams.spatialDataColumn = spatialDataColumn;
106
- }
107
-
108
- // API supports multiple filters, we apply it only to spatialDataColumn
109
- const spatialFilters = source.spatialFilter
110
- ? {[spatialDataColumn]: source.spatialFilter}
111
- : undefined;
112
-
113
- if (spatialFilters) {
114
- queryParams.spatialFilters = spatialFilters;
115
- queryParams.spatialDataColumn = spatialDataColumn;
116
- queryParams.spatialDataType = spatialDataType;
117
- }
118
-
119
- if (spatialDataType !== 'geo') {
120
- queryParams.spatialFiltersMode = spatialFiltersMode;
105
+ if (source.spatialFilter) {
106
+ // API supports multiple filters, we apply it only to spatialDataColumn
107
+ queryParams.spatialFilters = {[spatialDataColumn]: source.spatialFilter};
108
+ if (spatialDataType !== 'geo') {
109
+ queryParams.spatialFiltersMode = spatialFiltersMode;
110
+ }
121
111
  }
122
112
 
123
113
  const urlWithSearchParams =