@carto/api-client 0.5.7-alpha.2 → 0.5.7-alpha.5

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.
@@ -103,11 +103,11 @@ __export(src_exports, {
103
103
  ApiVersion: () => ApiVersion,
104
104
  BASEMAP: () => basemap_styles_default,
105
105
  CartoAPIError: () => CartoAPIError,
106
+ CellSet: () => CellSet,
106
107
  DEFAULT_API_BASE_URL: () => DEFAULT_API_BASE_URL,
107
108
  FEATURE_GEOM_PROPERTY: () => FEATURE_GEOM_PROPERTY,
108
109
  FilterType: () => FilterType,
109
110
  OPACITY_MAP: () => OPACITY_MAP,
110
- OTHERS_CATEGORY_NAME: () => OTHERS_CATEGORY_NAME,
111
111
  Provider: () => Provider,
112
112
  SOURCE_DEFAULTS: () => SOURCE_DEFAULTS,
113
113
  SchemaFieldType: () => SchemaFieldType,
@@ -5651,6 +5651,65 @@ var DEFAULT_AGGREGATION_EXP = `1 AS ${DEFAULT_AGGREGATION_EXP_ALIAS}`;
5651
5651
  // src/filters/tileFeaturesRaster.ts
5652
5652
  init_cjs_shims();
5653
5653
  var import_quadbin2 = require("quadbin");
5654
+
5655
+ // src/utils/CellSet.ts
5656
+ init_cjs_shims();
5657
+ var EMPTY_U32 = 2 ** 32 - 1;
5658
+ var CellSet = class {
5659
+ constructor(cells) {
5660
+ /** List of cells stored by the set. Stored by reference, without copying. */
5661
+ __publicField(this, "cells");
5662
+ /** DataView representing a single cell ID. Pre-allocated to reduce memory during queries. */
5663
+ __publicField(this, "cellView", new DataView(new ArrayBuffer(8)));
5664
+ /** Hash table, mapping a hash index (computed) to an index in the 'cells' array. */
5665
+ __publicField(this, "hashTable");
5666
+ this.cells = cells;
5667
+ this.hashTable = new Uint32Array(hashBuckets(cells.length)).fill(EMPTY_U32);
5668
+ for (let cellIndex = 0; cellIndex < cells.length; cellIndex++) {
5669
+ this.hashTable[this.hashLookup(cells[cellIndex])] = cellIndex;
5670
+ }
5671
+ }
5672
+ has(cell) {
5673
+ const hashIndex = this.hashLookup(cell);
5674
+ return this.hashTable[hashIndex] !== EMPTY_U32;
5675
+ }
5676
+ hashLookup(cell) {
5677
+ this.cellView.setBigUint64(0, cell);
5678
+ const hashval = hash(this.cellView);
5679
+ const hashmod = this.hashTable.length - 1;
5680
+ let bucket = hashval & hashmod;
5681
+ for (let probe = 0; probe <= hashmod; probe++) {
5682
+ const cellIndex = this.hashTable[bucket];
5683
+ if (cellIndex === EMPTY_U32 || cell === this.cells[cellIndex]) {
5684
+ return bucket;
5685
+ }
5686
+ bucket = bucket + probe + 1 & hashmod;
5687
+ }
5688
+ throw new Error("Hash table full.");
5689
+ }
5690
+ };
5691
+ function hash(view, h = 0) {
5692
+ const m = 1540483477;
5693
+ const r = 24;
5694
+ for (let i = 0, il = view.byteLength / 4; i < il; i++) {
5695
+ let k = view.getUint32(i * 4);
5696
+ k = Math.imul(k, m) >>> 0;
5697
+ k = (k ^ k >> r) >>> 0;
5698
+ k = Math.imul(k, m) >>> 0;
5699
+ h = Math.imul(h, m) >>> 0;
5700
+ h = (h ^ k) >>> 0;
5701
+ }
5702
+ return h;
5703
+ }
5704
+ function hashBuckets(initialCount) {
5705
+ let buckets = 1;
5706
+ while (buckets < initialCount + initialCount / 4) {
5707
+ buckets *= 2;
5708
+ }
5709
+ return buckets;
5710
+ }
5711
+
5712
+ // src/filters/tileFeaturesRaster.ts
5654
5713
  function tileFeaturesRaster({
5655
5714
  tiles,
5656
5715
  ...options
@@ -5664,7 +5723,7 @@ function tileFeaturesRaster({
5664
5723
  const tileResolution = (0, import_quadbin2.getResolution)(tiles[0].index.q);
5665
5724
  const tileBlockSize = tiles[0].data.blockSize;
5666
5725
  const cellResolution = tileResolution + BigInt(Math.log2(tileBlockSize));
5667
- const spatialFilterCells = new Set(
5726
+ const spatialFilterCells = new CellSet(
5668
5727
  (0, import_quadbin2.geometryToCells)(options.spatialFilter, cellResolution)
5669
5728
  );
5670
5729
  const data = /* @__PURE__ */ new Map();
@@ -6529,7 +6588,7 @@ var WidgetRemoteSource = class extends WidgetSource {
6529
6588
  spatialFiltersMode,
6530
6589
  ...params
6531
6590
  } = options;
6532
- const { column, operation: operation2, operationColumn, operationExp, othersThreshold } = params;
6591
+ const { column, operation: operation2, operationColumn, operationExp } = params;
6533
6592
  if (operation2 === AggregationTypes.Custom) {
6534
6593
  assert2(operationExp, "operationExp is required for custom operation");
6535
6594
  }
@@ -6544,8 +6603,7 @@ var WidgetRemoteSource = class extends WidgetSource {
6544
6603
  column,
6545
6604
  operation: operation2,
6546
6605
  operationExp,
6547
- operationColumn: operationColumn || column,
6548
- othersThreshold
6606
+ operationColumn: operationColumn || column
6549
6607
  },
6550
6608
  opts: { signal, headers: this.props.headers }
6551
6609
  }).then((res) => normalizeObjectKeys(res.rows));
@@ -7942,10 +8000,6 @@ var WidgetTableSource = class extends WidgetRemoteSource {
7942
8000
  }
7943
8001
  };
7944
8002
 
7945
- // src/widget-sources/constants.ts
7946
- init_cjs_shims();
7947
- var OTHERS_CATEGORY_NAME = "_carto_others";
7948
-
7949
8003
  // src/sources/h3-query-source.ts
7950
8004
  var h3QuerySource = async function(options) {
7951
8005
  const {
@@ -10300,11 +10354,11 @@ function _getHexagonResolution(viewport, tileSize) {
10300
10354
  ApiVersion,
10301
10355
  BASEMAP,
10302
10356
  CartoAPIError,
10357
+ CellSet,
10303
10358
  DEFAULT_API_BASE_URL,
10304
10359
  FEATURE_GEOM_PROPERTY,
10305
10360
  FilterType,
10306
10361
  OPACITY_MAP,
10307
- OTHERS_CATEGORY_NAME,
10308
10362
  Provider,
10309
10363
  SOURCE_DEFAULTS,
10310
10364
  SchemaFieldType,