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

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/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "homepage": "https://github.com/CartoDB/carto-api-client#readme",
9
9
  "author": "Don McCurdy <donmccurdy@carto.com>",
10
10
  "packageManager": "yarn@4.3.1",
11
- "version": "0.5.6",
11
+ "version": "0.5.7-alpha.2",
12
12
  "license": "MIT",
13
13
  "publishConfig": {
14
14
  "access": "public"
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Name of the category that represents the "Others" category.
3
+ *
4
+ * See `WidgetSource.getCategories` for more information.
5
+ */
6
+ export const OTHERS_CATEGORY_NAME = '_carto_others';
@@ -5,3 +5,4 @@ export * from './widget-remote-source.js';
5
5
  export * from './widget-table-source.js';
6
6
  export * from './widget-tileset-source.js';
7
7
  export * from './types.js';
8
+ export * from './constants.js';
@@ -59,6 +59,8 @@ export interface CategoryRequestOptions extends BaseRequestOptions {
59
59
  operationColumn?: string;
60
60
  /** Local only. */
61
61
  joinOperation?: 'count' | 'avg' | 'min' | 'max' | 'sum';
62
+ /** Calculate `_carto_others` category for all categories after first N (N is threshold). Remote only. */
63
+ othersThreshold?: boolean;
62
64
  }
63
65
 
64
66
  /**
@@ -74,7 +74,8 @@ export abstract class WidgetRemoteSource<
74
74
  spatialFiltersMode,
75
75
  ...params
76
76
  } = options;
77
- const {column, operation, operationColumn, operationExp} = params;
77
+ const {column, operation, operationColumn, operationExp, othersThreshold} =
78
+ params;
78
79
 
79
80
  if (operation === AggregationTypes.Custom) {
80
81
  assert(operationExp, 'operationExp is required for custom operation');
@@ -94,6 +95,7 @@ export abstract class WidgetRemoteSource<
94
95
  operation,
95
96
  operationExp,
96
97
  operationColumn: operationColumn || column,
98
+ othersThreshold,
97
99
  },
98
100
  opts: {signal, headers: this.props.headers},
99
101
  }).then((res: CategoriesModelResponse) => normalizeObjectKeys(res.rows));