@carto/api-client 0.5.5-alpha.0 → 0.5.6-alpha.0
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 +9 -0
- package/build/api-client.cjs +123 -293
- package/build/api-client.cjs.map +1 -1
- package/build/api-client.d.cts +90 -23
- package/build/api-client.d.ts +90 -23
- package/build/api-client.js +123 -279
- package/build/api-client.js.map +1 -1
- package/build/worker.js +4 -0
- package/build/worker.js.map +1 -1
- package/package.json +1 -1
- package/src/fetch-map/layer-map.ts +33 -45
- package/src/fetch-map/parse-map.ts +97 -83
- package/src/fetch-map/types.ts +8 -8
- package/src/widget-sources/types.ts +59 -7
- package/src/widget-sources/widget-remote-source.ts +17 -2
- package/src/widget-sources/widget-tileset-source-impl.ts +4 -0
|
@@ -17,7 +17,7 @@ import type {
|
|
|
17
17
|
TimeSeriesRequestOptions,
|
|
18
18
|
TimeSeriesResponse,
|
|
19
19
|
} from './types.js';
|
|
20
|
-
import {normalizeObjectKeys} from '../utils.js';
|
|
20
|
+
import {assert, normalizeObjectKeys} from '../utils.js';
|
|
21
21
|
import {DEFAULT_TILE_RESOLUTION} from '../constants-internal.js';
|
|
22
22
|
import {WidgetSource, type WidgetSourceProps} from './widget-source.js';
|
|
23
23
|
import type {Filters} from '../types.js';
|
|
@@ -74,7 +74,11 @@ export abstract class WidgetRemoteSource<
|
|
|
74
74
|
spatialFiltersMode,
|
|
75
75
|
...params
|
|
76
76
|
} = options;
|
|
77
|
-
const {column, operation, operationColumn} = params;
|
|
77
|
+
const {column, operation, operationColumn, operationExp} = params;
|
|
78
|
+
|
|
79
|
+
if (operation === 'custom') {
|
|
80
|
+
assert(operationExp, 'operationExp is required for custom operation');
|
|
81
|
+
}
|
|
78
82
|
|
|
79
83
|
type CategoriesModelResponse = {rows: {name: string; value: number}[]};
|
|
80
84
|
|
|
@@ -88,6 +92,7 @@ export abstract class WidgetRemoteSource<
|
|
|
88
92
|
params: {
|
|
89
93
|
column,
|
|
90
94
|
operation,
|
|
95
|
+
operationExp,
|
|
91
96
|
operationColumn: operationColumn || column,
|
|
92
97
|
},
|
|
93
98
|
opts: {signal, headers: this.props.headers},
|
|
@@ -143,6 +148,10 @@ export abstract class WidgetRemoteSource<
|
|
|
143
148
|
|
|
144
149
|
type FormulaModelResponse = {rows: {value: number}[]};
|
|
145
150
|
|
|
151
|
+
if (operation === 'custom') {
|
|
152
|
+
assert(operationExp, 'operationExp is required for custom operation');
|
|
153
|
+
}
|
|
154
|
+
|
|
146
155
|
return executeModel({
|
|
147
156
|
model: 'formula',
|
|
148
157
|
source: {
|
|
@@ -314,6 +323,7 @@ export abstract class WidgetRemoteSource<
|
|
|
314
323
|
operationColumn,
|
|
315
324
|
joinOperation,
|
|
316
325
|
operation,
|
|
326
|
+
operationExp,
|
|
317
327
|
stepSize,
|
|
318
328
|
stepMultiplier,
|
|
319
329
|
splitByCategory,
|
|
@@ -321,6 +331,10 @@ export abstract class WidgetRemoteSource<
|
|
|
321
331
|
splitByCategoryValues,
|
|
322
332
|
} = params;
|
|
323
333
|
|
|
334
|
+
if (operation === 'custom') {
|
|
335
|
+
assert(operationExp, 'operationExp is required for custom operation');
|
|
336
|
+
}
|
|
337
|
+
|
|
324
338
|
type TimeSeriesModelResponse = {
|
|
325
339
|
rows: {name: string; value: number}[];
|
|
326
340
|
metadata: {categories: string[]};
|
|
@@ -340,6 +354,7 @@ export abstract class WidgetRemoteSource<
|
|
|
340
354
|
operationColumn: operationColumn || column,
|
|
341
355
|
joinOperation,
|
|
342
356
|
operation,
|
|
357
|
+
operationExp,
|
|
343
358
|
splitByCategory,
|
|
344
359
|
splitByCategoryLimit,
|
|
345
360
|
splitByCategoryValues,
|
|
@@ -329,6 +329,10 @@ export class WidgetTilesetSourceImpl extends WidgetSource<WidgetTilesetSourcePro
|
|
|
329
329
|
}
|
|
330
330
|
|
|
331
331
|
assertColumn(this._features, column, operationColumn as string);
|
|
332
|
+
assert(
|
|
333
|
+
operation !== 'custom',
|
|
334
|
+
'Custom operation not supported for tilesets'
|
|
335
|
+
);
|
|
332
336
|
|
|
333
337
|
const rows =
|
|
334
338
|
groupValuesByDateColumn({
|