@carto/api-client 0.5.12 → 0.5.14
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 +8 -0
- package/build/api-client.cjs +78 -8
- package/build/api-client.cjs.map +1 -1
- package/build/api-client.d.cts +28 -9
- package/build/api-client.d.ts +28 -9
- package/build/api-client.js +76 -8
- package/build/api-client.js.map +1 -1
- package/build/worker-compat.js +4 -0
- package/build/worker-compat.js.map +1 -1
- package/build/worker.js +4 -0
- package/build/worker.js.map +1 -1
- package/package.json +3 -3
- package/src/sources/constants.ts +8 -0
- package/src/sources/h3-tileset-source.ts +1 -0
- package/src/sources/index.ts +1 -1
- package/src/sources/quadbin-tileset-source.ts +1 -0
- package/src/sources/raster-source.ts +1 -0
- package/src/sources/types.ts +1 -9
- package/src/sources/vector-tileset-source.ts +1 -0
- package/src/widget-sources/types.ts +7 -0
- package/src/widget-sources/widget-remote-source.ts +64 -0
- package/src/widget-sources/widget-source.ts +5 -0
- package/src/widget-sources/widget-tileset-source-impl.ts +6 -0
- package/src/widget-sources/widget-tileset-source.ts +13 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
## 0.5
|
|
4
4
|
|
|
5
|
+
### 0.5.14
|
|
6
|
+
|
|
7
|
+
- feat(widgets): Add 'getExtent()' method, experimental (#220)
|
|
8
|
+
|
|
9
|
+
### 0.5.13
|
|
10
|
+
|
|
11
|
+
- fix(constants): Export RasterBandColorinterp (#216)
|
|
12
|
+
|
|
5
13
|
### 0.5.12
|
|
6
14
|
|
|
7
15
|
- feat(sources): allow passing tags to baseSource and query methods (#193)
|
package/build/api-client.cjs
CHANGED
|
@@ -110,6 +110,7 @@ __export(src_exports, {
|
|
|
110
110
|
OPACITY_MAP: () => OPACITY_MAP,
|
|
111
111
|
OTHERS_CATEGORY_NAME: () => OTHERS_CATEGORY_NAME,
|
|
112
112
|
Provider: () => Provider,
|
|
113
|
+
RasterBandColorinterp: () => RasterBandColorinterp,
|
|
113
114
|
SOURCE_DEFAULTS: () => SOURCE_DEFAULTS,
|
|
114
115
|
SchemaFieldType: () => SchemaFieldType,
|
|
115
116
|
SpatialIndex: () => SpatialIndex,
|
|
@@ -214,11 +215,11 @@ var FilterType = /* @__PURE__ */ ((FilterType2) => {
|
|
|
214
215
|
FilterType2["STRING_SEARCH"] = "stringSearch";
|
|
215
216
|
return FilterType2;
|
|
216
217
|
})(FilterType || {});
|
|
217
|
-
var ApiVersion = /* @__PURE__ */ ((
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
return
|
|
218
|
+
var ApiVersion = /* @__PURE__ */ ((ApiVersion2) => {
|
|
219
|
+
ApiVersion2["V1"] = "v1";
|
|
220
|
+
ApiVersion2["V2"] = "v2";
|
|
221
|
+
ApiVersion2["V3"] = "v3";
|
|
222
|
+
return ApiVersion2;
|
|
222
223
|
})(ApiVersion || {});
|
|
223
224
|
var DEFAULT_API_BASE_URL = "https://gcp-us-east1.api.carto.com";
|
|
224
225
|
var TileFormat = /* @__PURE__ */ ((TileFormat2) => {
|
|
@@ -6251,6 +6252,18 @@ async function baseSource(endpoint, options, urlParameters) {
|
|
|
6251
6252
|
return json;
|
|
6252
6253
|
}
|
|
6253
6254
|
|
|
6255
|
+
// src/sources/constants.ts
|
|
6256
|
+
init_cjs_shims();
|
|
6257
|
+
var RasterBandColorinterp = /* @__PURE__ */ ((RasterBandColorinterp2) => {
|
|
6258
|
+
RasterBandColorinterp2["Gray"] = "gray";
|
|
6259
|
+
RasterBandColorinterp2["Red"] = "red";
|
|
6260
|
+
RasterBandColorinterp2["Green"] = "green";
|
|
6261
|
+
RasterBandColorinterp2["Blue"] = "blue";
|
|
6262
|
+
RasterBandColorinterp2["Alpha"] = "alpha";
|
|
6263
|
+
RasterBandColorinterp2["Palette"] = "palette";
|
|
6264
|
+
return RasterBandColorinterp2;
|
|
6265
|
+
})(RasterBandColorinterp || {});
|
|
6266
|
+
|
|
6254
6267
|
// src/sources/boundary-query-source.ts
|
|
6255
6268
|
init_cjs_shims();
|
|
6256
6269
|
var boundaryQuerySource = async function(options) {
|
|
@@ -6848,6 +6861,48 @@ var WidgetRemoteSource = class extends WidgetSource {
|
|
|
6848
6861
|
categories: res.metadata?.categories
|
|
6849
6862
|
}));
|
|
6850
6863
|
}
|
|
6864
|
+
/** @experimental */
|
|
6865
|
+
async getExtent(options = {}) {
|
|
6866
|
+
const { signal, filters = this.props.filters, filterOwner } = options;
|
|
6867
|
+
const {
|
|
6868
|
+
type,
|
|
6869
|
+
data,
|
|
6870
|
+
apiBaseUrl,
|
|
6871
|
+
apiVersion,
|
|
6872
|
+
connectionName,
|
|
6873
|
+
spatialDataColumn,
|
|
6874
|
+
spatialDataType,
|
|
6875
|
+
queryParameters
|
|
6876
|
+
} = this.getModelSource(filters, filterOwner);
|
|
6877
|
+
assert2(apiVersion === "v3" /* V3 */, "Stats API requires CARTO 3+");
|
|
6878
|
+
let url;
|
|
6879
|
+
const parameters = { filters, spatialDataType };
|
|
6880
|
+
if (type === "query") {
|
|
6881
|
+
url = `${apiBaseUrl}/${apiVersion}/stats/${connectionName}/${spatialDataColumn}`;
|
|
6882
|
+
parameters.q = data;
|
|
6883
|
+
parameters.queryParameters = queryParameters;
|
|
6884
|
+
} else {
|
|
6885
|
+
url = `${apiBaseUrl}/${apiVersion}/stats/${connectionName}/${data}/${spatialDataColumn}`;
|
|
6886
|
+
}
|
|
6887
|
+
const headers = {
|
|
6888
|
+
Authorization: `Bearer ${this.props.accessToken}`,
|
|
6889
|
+
...this.props.headers
|
|
6890
|
+
};
|
|
6891
|
+
const errorContext = {
|
|
6892
|
+
requestType: "Tile stats",
|
|
6893
|
+
connection: connectionName,
|
|
6894
|
+
type
|
|
6895
|
+
};
|
|
6896
|
+
return requestWithParameters({
|
|
6897
|
+
baseUrl: url,
|
|
6898
|
+
headers,
|
|
6899
|
+
signal,
|
|
6900
|
+
errorContext,
|
|
6901
|
+
parameters
|
|
6902
|
+
}).then(({ extent: { xmin, ymin, xmax, ymax } }) => ({
|
|
6903
|
+
bbox: [xmin, ymin, xmax, ymax]
|
|
6904
|
+
}));
|
|
6905
|
+
}
|
|
6851
6906
|
};
|
|
6852
6907
|
|
|
6853
6908
|
// src/widget-sources/widget-query-source.ts
|
|
@@ -7826,6 +7881,10 @@ var WidgetTilesetSourceImpl = class extends WidgetSource {
|
|
|
7826
7881
|
max: aggregationFunctions.max(filteredFeatures, column)
|
|
7827
7882
|
};
|
|
7828
7883
|
}
|
|
7884
|
+
/** @experimental */
|
|
7885
|
+
async getExtent() {
|
|
7886
|
+
return Promise.reject(new Error("not implemented"));
|
|
7887
|
+
}
|
|
7829
7888
|
/****************************************************************************
|
|
7830
7889
|
* INTERNAL
|
|
7831
7890
|
*/
|
|
@@ -8056,6 +8115,12 @@ var WidgetTilesetSource = class extends WidgetSource {
|
|
|
8056
8115
|
}) {
|
|
8057
8116
|
return this._executeWorkerMethod("getRange" /* GET_RANGE */, [options], signal);
|
|
8058
8117
|
}
|
|
8118
|
+
/** @experimental */
|
|
8119
|
+
async getExtent() {
|
|
8120
|
+
return Promise.resolve({
|
|
8121
|
+
bbox: this.props.spatialDataBounds
|
|
8122
|
+
});
|
|
8123
|
+
}
|
|
8059
8124
|
};
|
|
8060
8125
|
|
|
8061
8126
|
// src/widget-sources/widget-raster-source.ts
|
|
@@ -8178,7 +8243,8 @@ var h3TilesetSource = async function(options) {
|
|
|
8178
8243
|
...options,
|
|
8179
8244
|
tileFormat: getTileFormat(result),
|
|
8180
8245
|
spatialDataColumn,
|
|
8181
|
-
spatialDataType: "h3"
|
|
8246
|
+
spatialDataType: "h3",
|
|
8247
|
+
spatialDataBounds: result.bounds
|
|
8182
8248
|
})
|
|
8183
8249
|
})
|
|
8184
8250
|
);
|
|
@@ -8200,6 +8266,7 @@ var rasterSource = async function(options) {
|
|
|
8200
8266
|
tileFormat: getTileFormat(result),
|
|
8201
8267
|
spatialDataColumn: "quadbin",
|
|
8202
8268
|
spatialDataType: "quadbin",
|
|
8269
|
+
spatialDataBounds: result.bounds,
|
|
8203
8270
|
rasterMetadata: result.raster_metadata
|
|
8204
8271
|
})
|
|
8205
8272
|
})
|
|
@@ -8302,7 +8369,8 @@ var quadbinTilesetSource = async function(options) {
|
|
|
8302
8369
|
...options,
|
|
8303
8370
|
tileFormat: getTileFormat(result),
|
|
8304
8371
|
spatialDataColumn,
|
|
8305
|
-
spatialDataType: "quadbin"
|
|
8372
|
+
spatialDataType: "quadbin",
|
|
8373
|
+
spatialDataBounds: result.bounds
|
|
8306
8374
|
})
|
|
8307
8375
|
})
|
|
8308
8376
|
);
|
|
@@ -8406,7 +8474,8 @@ var vectorTilesetSource = async function(options) {
|
|
|
8406
8474
|
...options,
|
|
8407
8475
|
tileFormat: getTileFormat(result),
|
|
8408
8476
|
spatialDataColumn,
|
|
8409
|
-
spatialDataType: "geo"
|
|
8477
|
+
spatialDataType: "geo",
|
|
8478
|
+
spatialDataBounds: result.bounds
|
|
8410
8479
|
})
|
|
8411
8480
|
})
|
|
8412
8481
|
);
|
|
@@ -10499,6 +10568,7 @@ function hashBuckets(initialCount) {
|
|
|
10499
10568
|
OPACITY_MAP,
|
|
10500
10569
|
OTHERS_CATEGORY_NAME,
|
|
10501
10570
|
Provider,
|
|
10571
|
+
RasterBandColorinterp,
|
|
10502
10572
|
SOURCE_DEFAULTS,
|
|
10503
10573
|
SchemaFieldType,
|
|
10504
10574
|
SpatialIndex,
|