@carto/api-client 0.5.15 → 0.5.17

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/build/worker.js CHANGED
@@ -6323,6 +6323,7 @@ var WidgetTilesetSourceImpl = class extends WidgetSource {
6323
6323
  assertColumn(this._features, column);
6324
6324
  }
6325
6325
  const targetOperation = aggregationFunctions[operation2];
6326
+ assert(targetOperation, `Unsupported aggregation operation: ${operation2}`);
6326
6327
  return {
6327
6328
  value: targetOperation(filteredFeatures, column, joinOperation)
6328
6329
  };
@@ -6521,6 +6522,39 @@ var WidgetTilesetSourceImpl = class extends WidgetSource {
6521
6522
  max: aggregationFunctions.max(filteredFeatures, column)
6522
6523
  };
6523
6524
  }
6525
+ async getAggregations({
6526
+ aggregations,
6527
+ filters,
6528
+ filterOwner,
6529
+ spatialFilter
6530
+ }) {
6531
+ const filteredFeatures = this._getFilteredFeatures(
6532
+ spatialFilter,
6533
+ filters,
6534
+ filterOwner
6535
+ );
6536
+ if (!this._features.length) {
6537
+ return { rows: [] };
6538
+ }
6539
+ assert(
6540
+ typeof aggregations !== "string",
6541
+ "Unsupported tileset SQL aggregation"
6542
+ );
6543
+ const result = {};
6544
+ const usedAliases = /* @__PURE__ */ new Set();
6545
+ for (const { column, operation: operation2, alias } of aggregations) {
6546
+ if (column && column !== "*" || operation2 !== AggregationTypes.Count) {
6547
+ assertColumn(this._features, column);
6548
+ }
6549
+ const aliasKey = alias.toLowerCase();
6550
+ assert(!usedAliases.has(aliasKey), `Duplicate alias: ${aliasKey}`);
6551
+ usedAliases.add(aliasKey);
6552
+ const targetOperation = aggregationFunctions[operation2];
6553
+ assert(targetOperation, `Unsupported operation: ${operation2}`);
6554
+ result[alias] = targetOperation(filteredFeatures, column);
6555
+ }
6556
+ return { rows: [result] };
6557
+ }
6524
6558
  /** @experimental */
6525
6559
  async getExtent() {
6526
6560
  return Promise.reject(new Error("not implemented"));