@carto/api-client 0.5.4-alpha.0 → 0.5.4
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 +10 -0
- package/build/api-client.cjs +7 -2
- package/build/api-client.cjs.map +1 -1
- package/build/api-client.d.cts +12 -6
- package/build/api-client.d.ts +12 -6
- package/build/api-client.js +6 -2
- package/build/api-client.js.map +1 -1
- package/build/worker.js +2 -2
- package/build/worker.js.map +1 -1
- package/package.json +2 -3
- package/src/api/index.ts +4 -1
- package/src/api/request-with-parameters.ts +8 -0
- package/src/filters/tileFeatures.ts +3 -3
- package/src/filters/tileFeaturesGeometries.ts +8 -5
- package/src/index.ts +1 -0
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
|
|
11
|
+
"version": "0.5.4",
|
|
12
12
|
"license": "MIT",
|
|
13
13
|
"publishConfig": {
|
|
14
14
|
"access": "public"
|
|
@@ -128,6 +128,5 @@
|
|
|
128
128
|
"resolutions": {
|
|
129
129
|
"@carto/api-client": "portal:./",
|
|
130
130
|
"rollup": "^4.20.0"
|
|
131
|
-
}
|
|
132
|
-
"stableVersion": "0.5.3"
|
|
131
|
+
}
|
|
133
132
|
}
|
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 {
|
|
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
|
+
}
|
|
@@ -22,7 +22,7 @@ export type TileFeatures = {
|
|
|
22
22
|
spatialFilter: SpatialFilter;
|
|
23
23
|
uniqueIdProperty?: string;
|
|
24
24
|
rasterMetadata?: RasterMetadata;
|
|
25
|
-
|
|
25
|
+
storeGeometry?: boolean;
|
|
26
26
|
};
|
|
27
27
|
|
|
28
28
|
/** @privateRemarks Source: @carto/react-core */
|
|
@@ -42,7 +42,7 @@ export function tileFeatures({
|
|
|
42
42
|
spatialDataColumn = DEFAULT_GEO_COLUMN,
|
|
43
43
|
spatialDataType,
|
|
44
44
|
rasterMetadata,
|
|
45
|
-
|
|
45
|
+
storeGeometry = false,
|
|
46
46
|
}: TileFeatures): FeatureData[] {
|
|
47
47
|
if (spatialDataType === 'geo') {
|
|
48
48
|
return tileFeaturesGeometries({
|
|
@@ -50,7 +50,7 @@ export function tileFeatures({
|
|
|
50
50
|
tileFormat,
|
|
51
51
|
spatialFilter,
|
|
52
52
|
uniqueIdProperty,
|
|
53
|
-
options,
|
|
53
|
+
options: {storeGeometry},
|
|
54
54
|
});
|
|
55
55
|
}
|
|
56
56
|
|
|
@@ -16,7 +16,6 @@ import type {
|
|
|
16
16
|
Position,
|
|
17
17
|
} from 'geojson';
|
|
18
18
|
import type {SpatialFilter, Tile} from '../types.js';
|
|
19
|
-
import type {TileFeatureExtractOptions} from './tileFeatures.js';
|
|
20
19
|
import {featureCollection} from '@turf/helpers';
|
|
21
20
|
import type {FeatureData} from '../types-internal.js';
|
|
22
21
|
import type {
|
|
@@ -39,6 +38,10 @@ type TileDataInternal = {
|
|
|
39
38
|
numericProps: Record<string, number>;
|
|
40
39
|
};
|
|
41
40
|
|
|
41
|
+
type GeometryExtractOptions = {
|
|
42
|
+
storeGeometry?: boolean;
|
|
43
|
+
};
|
|
44
|
+
|
|
42
45
|
export function tileFeaturesGeometries({
|
|
43
46
|
tiles,
|
|
44
47
|
tileFormat,
|
|
@@ -50,7 +53,7 @@ export function tileFeaturesGeometries({
|
|
|
50
53
|
tileFormat?: TileFormat;
|
|
51
54
|
spatialFilter: SpatialFilter;
|
|
52
55
|
uniqueIdProperty?: string;
|
|
53
|
-
options?:
|
|
56
|
+
options?: GeometryExtractOptions;
|
|
54
57
|
}): FeatureData[] {
|
|
55
58
|
const map = new Map();
|
|
56
59
|
|
|
@@ -212,7 +215,7 @@ function addIntersectedFeaturesInTile({
|
|
|
212
215
|
bbox: BBox;
|
|
213
216
|
tileFormat?: TileFormat;
|
|
214
217
|
uniqueIdProperty?: string;
|
|
215
|
-
options?:
|
|
218
|
+
options?: GeometryExtractOptions;
|
|
216
219
|
}) {
|
|
217
220
|
const indices = getIndices(data, type);
|
|
218
221
|
const storeGeometry = options?.storeGeometry || false;
|
|
@@ -364,7 +367,7 @@ function calculateFeatures({
|
|
|
364
367
|
bbox: BBox;
|
|
365
368
|
tileFormat?: TileFormat;
|
|
366
369
|
uniqueIdProperty?: string;
|
|
367
|
-
options?:
|
|
370
|
+
options?: GeometryExtractOptions;
|
|
368
371
|
}) {
|
|
369
372
|
if (!data?.properties.length) {
|
|
370
373
|
return;
|
|
@@ -409,7 +412,7 @@ function addAllFeaturesInTile({
|
|
|
409
412
|
bbox: BBox;
|
|
410
413
|
tileFormat?: TileFormat;
|
|
411
414
|
uniqueIdProperty?: string;
|
|
412
|
-
options?:
|
|
415
|
+
options?: GeometryExtractOptions;
|
|
413
416
|
}) {
|
|
414
417
|
const indices = getIndices(data, type);
|
|
415
418
|
const storeGeometry = options?.storeGeometry || false;
|
package/src/index.ts
CHANGED