@carto/api-client 0.5.6-alpha.bundle.4 → 0.5.7-alpha.1
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 +7 -0
- package/build/api-client.cjs +29 -18
- package/build/api-client.cjs.map +1 -1
- package/build/api-client.d.cts +15 -2
- package/build/api-client.d.ts +15 -2
- package/build/api-client.js +28 -18
- package/build/api-client.js.map +1 -1
- package/build/worker-compat.js +14 -6
- package/build/worker-compat.js.map +1 -1
- package/build/worker.js +14 -6
- package/build/worker.js.map +1 -1
- package/package.json +1 -1
- package/src/constants.ts +12 -0
- package/src/fetch-map/layer-map.ts +2 -1
- package/src/types.ts +1 -1
- package/src/widget-sources/types.ts +2 -0
- package/src/widget-sources/widget-remote-source.ts +7 -6
- package/src/widget-sources/widget-tileset-source-impl.ts +7 -6
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
## 0.5
|
|
4
4
|
|
|
5
|
+
### 0.5.6
|
|
6
|
+
|
|
7
|
+
- chore(widgets): add AggregationTypes enum-like definition (#187)
|
|
8
|
+
- feat(worker): Distribute worker script as standalone JS bundle (#189)
|
|
9
|
+
- feat(widgets): Add widgetWorkerUrl option (#188)
|
|
10
|
+
- feat(widgets): WidgetRemoteSource: custom aggregations for category, timeseries models (#174)
|
|
11
|
+
|
|
5
12
|
### 0.5.5
|
|
6
13
|
|
|
7
14
|
- feat(fetchmap): Expose legend info from fetchMap (#179)
|
package/build/api-client.cjs
CHANGED
|
@@ -99,6 +99,7 @@ var require_thenBy_module = __commonJS({
|
|
|
99
99
|
// src/index.ts
|
|
100
100
|
var src_exports = {};
|
|
101
101
|
__export(src_exports, {
|
|
102
|
+
AggregationTypes: () => AggregationTypes,
|
|
102
103
|
ApiVersion: () => ApiVersion,
|
|
103
104
|
BASEMAP: () => basemap_styles_default,
|
|
104
105
|
CartoAPIError: () => CartoAPIError,
|
|
@@ -210,11 +211,11 @@ var FilterType = /* @__PURE__ */ ((FilterType2) => {
|
|
|
210
211
|
FilterType2["STRING_SEARCH"] = "stringSearch";
|
|
211
212
|
return FilterType2;
|
|
212
213
|
})(FilterType || {});
|
|
213
|
-
var ApiVersion = /* @__PURE__ */ ((
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
return
|
|
214
|
+
var ApiVersion = /* @__PURE__ */ ((ApiVersion3) => {
|
|
215
|
+
ApiVersion3["V1"] = "v1";
|
|
216
|
+
ApiVersion3["V2"] = "v2";
|
|
217
|
+
ApiVersion3["V3"] = "v3";
|
|
218
|
+
return ApiVersion3;
|
|
218
219
|
})(ApiVersion || {});
|
|
219
220
|
var DEFAULT_API_BASE_URL = "https://gcp-us-east1.api.carto.com";
|
|
220
221
|
var TileFormat = /* @__PURE__ */ ((TileFormat2) => {
|
|
@@ -242,6 +243,14 @@ var SpatialIndexColumn = Object.freeze({
|
|
|
242
243
|
["h3" /* H3 */]: ["h3", "hex", "h3id", "hex_id", "h3hex"],
|
|
243
244
|
["quadbin" /* QUADBIN */]: ["quadbin"]
|
|
244
245
|
});
|
|
246
|
+
var AggregationTypes = {
|
|
247
|
+
Count: "count",
|
|
248
|
+
Avg: "avg",
|
|
249
|
+
Min: "min",
|
|
250
|
+
Max: "max",
|
|
251
|
+
Sum: "sum",
|
|
252
|
+
Custom: "custom"
|
|
253
|
+
};
|
|
245
254
|
|
|
246
255
|
// src/deck/get-data-filter-extension-props.ts
|
|
247
256
|
init_cjs_shims();
|
|
@@ -6519,8 +6528,8 @@ var WidgetRemoteSource = class extends WidgetSource {
|
|
|
6519
6528
|
spatialFiltersMode,
|
|
6520
6529
|
...params
|
|
6521
6530
|
} = options;
|
|
6522
|
-
const { column, operation: operation2, operationColumn, operationExp } = params;
|
|
6523
|
-
if (operation2 ===
|
|
6531
|
+
const { column, operation: operation2, operationColumn, operationExp, maxItems } = params;
|
|
6532
|
+
if (operation2 === AggregationTypes.Custom) {
|
|
6524
6533
|
assert2(operationExp, "operationExp is required for custom operation");
|
|
6525
6534
|
}
|
|
6526
6535
|
return executeModel({
|
|
@@ -6534,7 +6543,8 @@ var WidgetRemoteSource = class extends WidgetSource {
|
|
|
6534
6543
|
column,
|
|
6535
6544
|
operation: operation2,
|
|
6536
6545
|
operationExp,
|
|
6537
|
-
operationColumn: operationColumn || column
|
|
6546
|
+
operationColumn: operationColumn || column,
|
|
6547
|
+
maxItems
|
|
6538
6548
|
},
|
|
6539
6549
|
opts: { signal, headers: this.props.headers }
|
|
6540
6550
|
}).then((res) => normalizeObjectKeys(res.rows));
|
|
@@ -6579,7 +6589,7 @@ var WidgetRemoteSource = class extends WidgetSource {
|
|
|
6579
6589
|
...params
|
|
6580
6590
|
} = options;
|
|
6581
6591
|
const { column, operation: operation2 } = params;
|
|
6582
|
-
if (operation2 ===
|
|
6592
|
+
if (operation2 === AggregationTypes.Custom) {
|
|
6583
6593
|
assert2(operationExp, "operationExp is required for custom operation");
|
|
6584
6594
|
}
|
|
6585
6595
|
return executeModel({
|
|
@@ -6591,7 +6601,7 @@ var WidgetRemoteSource = class extends WidgetSource {
|
|
|
6591
6601
|
},
|
|
6592
6602
|
params: {
|
|
6593
6603
|
column: column ?? "*",
|
|
6594
|
-
operation: operation2 ??
|
|
6604
|
+
operation: operation2 ?? AggregationTypes.Count,
|
|
6595
6605
|
operationExp
|
|
6596
6606
|
},
|
|
6597
6607
|
opts: { signal, headers: this.props.headers }
|
|
@@ -6727,7 +6737,7 @@ var WidgetRemoteSource = class extends WidgetSource {
|
|
|
6727
6737
|
splitByCategoryLimit,
|
|
6728
6738
|
splitByCategoryValues
|
|
6729
6739
|
} = params;
|
|
6730
|
-
if (operation2 ===
|
|
6740
|
+
if (operation2 === AggregationTypes.Custom) {
|
|
6731
6741
|
assert2(operationExp, "operationExp is required for custom operation");
|
|
6732
6742
|
}
|
|
6733
6743
|
return executeModel({
|
|
@@ -7482,7 +7492,7 @@ var WidgetTilesetSourceImpl = class extends WidgetSource {
|
|
|
7482
7492
|
}
|
|
7483
7493
|
async getFormula({
|
|
7484
7494
|
column = "*",
|
|
7485
|
-
operation: operation2 =
|
|
7495
|
+
operation: operation2 = AggregationTypes.Count,
|
|
7486
7496
|
joinOperation,
|
|
7487
7497
|
filters,
|
|
7488
7498
|
filterOwner,
|
|
@@ -7493,13 +7503,13 @@ var WidgetTilesetSourceImpl = class extends WidgetSource {
|
|
|
7493
7503
|
filters,
|
|
7494
7504
|
filterOwner
|
|
7495
7505
|
);
|
|
7496
|
-
if (filteredFeatures.length === 0 && operation2 !==
|
|
7506
|
+
if (filteredFeatures.length === 0 && operation2 !== AggregationTypes.Count) {
|
|
7497
7507
|
return { value: null };
|
|
7498
7508
|
}
|
|
7499
|
-
if (operation2 ===
|
|
7509
|
+
if (operation2 === AggregationTypes.Custom) {
|
|
7500
7510
|
throw new Error("Custom aggregation not supported for tilesets");
|
|
7501
7511
|
}
|
|
7502
|
-
if (column && column !== "*" || operation2 !==
|
|
7512
|
+
if (column && column !== "*" || operation2 !== AggregationTypes.Count) {
|
|
7503
7513
|
assertColumn(this._features, column);
|
|
7504
7514
|
}
|
|
7505
7515
|
const targetOperation = aggregationFunctions[operation2];
|
|
@@ -7508,7 +7518,7 @@ var WidgetTilesetSourceImpl = class extends WidgetSource {
|
|
|
7508
7518
|
};
|
|
7509
7519
|
}
|
|
7510
7520
|
async getHistogram({
|
|
7511
|
-
operation: operation2 =
|
|
7521
|
+
operation: operation2 = AggregationTypes.Count,
|
|
7512
7522
|
ticks,
|
|
7513
7523
|
column,
|
|
7514
7524
|
joinOperation,
|
|
@@ -7535,7 +7545,7 @@ var WidgetTilesetSourceImpl = class extends WidgetSource {
|
|
|
7535
7545
|
}
|
|
7536
7546
|
async getCategories({
|
|
7537
7547
|
column,
|
|
7538
|
-
operation: operation2 =
|
|
7548
|
+
operation: operation2 = AggregationTypes.Count,
|
|
7539
7549
|
operationColumn,
|
|
7540
7550
|
joinOperation,
|
|
7541
7551
|
filters,
|
|
@@ -9293,7 +9303,7 @@ function negateAccessor(accessor) {
|
|
|
9293
9303
|
function getSizeAccessor({ name }, scaleType, aggregation, range, data) {
|
|
9294
9304
|
const scale2 = scaleType ? SCALE_FUNCS[scaleType]() : identity2;
|
|
9295
9305
|
if (scaleType) {
|
|
9296
|
-
if (aggregation !==
|
|
9306
|
+
if (aggregation !== AggregationTypes.Count) {
|
|
9297
9307
|
scale2.domain(calculateDomain(data, name, scaleType));
|
|
9298
9308
|
}
|
|
9299
9309
|
scale2.range(range);
|
|
@@ -10281,6 +10291,7 @@ function _getHexagonResolution(viewport, tileSize) {
|
|
|
10281
10291
|
}
|
|
10282
10292
|
// Annotate the CommonJS export names for ESM import in node:
|
|
10283
10293
|
0 && (module.exports = {
|
|
10294
|
+
AggregationTypes,
|
|
10284
10295
|
ApiVersion,
|
|
10285
10296
|
BASEMAP,
|
|
10286
10297
|
CartoAPIError,
|