@carto/api-client 0.5.6-alpha.bundle.4 → 0.5.6

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 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)
@@ -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__ */ ((ApiVersion2) => {
214
- ApiVersion2["V1"] = "v1";
215
- ApiVersion2["V2"] = "v2";
216
- ApiVersion2["V3"] = "v3";
217
- return ApiVersion2;
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();
@@ -6520,7 +6529,7 @@ var WidgetRemoteSource = class extends WidgetSource {
6520
6529
  ...params
6521
6530
  } = options;
6522
6531
  const { column, operation: operation2, operationColumn, operationExp } = params;
6523
- if (operation2 === "custom") {
6532
+ if (operation2 === AggregationTypes.Custom) {
6524
6533
  assert2(operationExp, "operationExp is required for custom operation");
6525
6534
  }
6526
6535
  return executeModel({
@@ -6579,7 +6588,7 @@ var WidgetRemoteSource = class extends WidgetSource {
6579
6588
  ...params
6580
6589
  } = options;
6581
6590
  const { column, operation: operation2 } = params;
6582
- if (operation2 === "custom") {
6591
+ if (operation2 === AggregationTypes.Custom) {
6583
6592
  assert2(operationExp, "operationExp is required for custom operation");
6584
6593
  }
6585
6594
  return executeModel({
@@ -6591,7 +6600,7 @@ var WidgetRemoteSource = class extends WidgetSource {
6591
6600
  },
6592
6601
  params: {
6593
6602
  column: column ?? "*",
6594
- operation: operation2 ?? "count",
6603
+ operation: operation2 ?? AggregationTypes.Count,
6595
6604
  operationExp
6596
6605
  },
6597
6606
  opts: { signal, headers: this.props.headers }
@@ -6727,7 +6736,7 @@ var WidgetRemoteSource = class extends WidgetSource {
6727
6736
  splitByCategoryLimit,
6728
6737
  splitByCategoryValues
6729
6738
  } = params;
6730
- if (operation2 === "custom") {
6739
+ if (operation2 === AggregationTypes.Custom) {
6731
6740
  assert2(operationExp, "operationExp is required for custom operation");
6732
6741
  }
6733
6742
  return executeModel({
@@ -7482,7 +7491,7 @@ var WidgetTilesetSourceImpl = class extends WidgetSource {
7482
7491
  }
7483
7492
  async getFormula({
7484
7493
  column = "*",
7485
- operation: operation2 = "count",
7494
+ operation: operation2 = AggregationTypes.Count,
7486
7495
  joinOperation,
7487
7496
  filters,
7488
7497
  filterOwner,
@@ -7493,13 +7502,13 @@ var WidgetTilesetSourceImpl = class extends WidgetSource {
7493
7502
  filters,
7494
7503
  filterOwner
7495
7504
  );
7496
- if (filteredFeatures.length === 0 && operation2 !== "count") {
7505
+ if (filteredFeatures.length === 0 && operation2 !== AggregationTypes.Count) {
7497
7506
  return { value: null };
7498
7507
  }
7499
- if (operation2 === "custom") {
7508
+ if (operation2 === AggregationTypes.Custom) {
7500
7509
  throw new Error("Custom aggregation not supported for tilesets");
7501
7510
  }
7502
- if (column && column !== "*" || operation2 !== "count") {
7511
+ if (column && column !== "*" || operation2 !== AggregationTypes.Count) {
7503
7512
  assertColumn(this._features, column);
7504
7513
  }
7505
7514
  const targetOperation = aggregationFunctions[operation2];
@@ -7508,7 +7517,7 @@ var WidgetTilesetSourceImpl = class extends WidgetSource {
7508
7517
  };
7509
7518
  }
7510
7519
  async getHistogram({
7511
- operation: operation2 = "count",
7520
+ operation: operation2 = AggregationTypes.Count,
7512
7521
  ticks,
7513
7522
  column,
7514
7523
  joinOperation,
@@ -7535,7 +7544,7 @@ var WidgetTilesetSourceImpl = class extends WidgetSource {
7535
7544
  }
7536
7545
  async getCategories({
7537
7546
  column,
7538
- operation: operation2 = "count",
7547
+ operation: operation2 = AggregationTypes.Count,
7539
7548
  operationColumn,
7540
7549
  joinOperation,
7541
7550
  filters,
@@ -9293,7 +9302,7 @@ function negateAccessor(accessor) {
9293
9302
  function getSizeAccessor({ name }, scaleType, aggregation, range, data) {
9294
9303
  const scale2 = scaleType ? SCALE_FUNCS[scaleType]() : identity2;
9295
9304
  if (scaleType) {
9296
- if (aggregation !== "count") {
9305
+ if (aggregation !== AggregationTypes.Count) {
9297
9306
  scale2.domain(calculateDomain(data, name, scaleType));
9298
9307
  }
9299
9308
  scale2.range(range);
@@ -10281,6 +10290,7 @@ function _getHexagonResolution(viewport, tileSize) {
10281
10290
  }
10282
10291
  // Annotate the CommonJS export names for ESM import in node:
10283
10292
  0 && (module.exports = {
10293
+ AggregationTypes,
10284
10294
  ApiVersion,
10285
10295
  BASEMAP,
10286
10296
  CartoAPIError,