@carto/api-client 0.5.0-alpha.5 → 0.5.0-alpha.7
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/api-client.cjs +104 -122
- package/build/api-client.d.cts +24 -13
- package/build/api-client.d.ts +24 -13
- package/build/api-client.js +104 -122
- package/build/worker.js +5 -7
- package/package.json +1 -5
- package/src/models/common.ts +2 -2
- package/src/widget-sources/types.ts +1 -1
- package/src/widget-sources/widget-remote-source.ts +16 -16
- package/src/widget-sources/widget-tileset-source.ts +2 -2
- package/src/widget-sources/widget-tileset-worker-source.ts +123 -121
- package/src/workers/types.ts +0 -1
- package/src/workers/widget-tileset-worker.ts +11 -8
- package/build/{chunk-V3E7BKVR.js → chunk-LEI5PI5X.js} +1 -1
package/build/api-client.cjs
CHANGED
|
@@ -2180,7 +2180,7 @@ async function makeCall({
|
|
|
2180
2180
|
method: opts?.method,
|
|
2181
2181
|
body: opts?.body
|
|
2182
2182
|
},
|
|
2183
|
-
signal: opts?.
|
|
2183
|
+
signal: opts?.signal,
|
|
2184
2184
|
...opts?.otherOptions
|
|
2185
2185
|
});
|
|
2186
2186
|
data = await response.json();
|
|
@@ -2315,12 +2315,12 @@ var WidgetRemoteSource = class extends WidgetSource {
|
|
|
2315
2315
|
}
|
|
2316
2316
|
async getCategories(options) {
|
|
2317
2317
|
const {
|
|
2318
|
+
signal,
|
|
2318
2319
|
filters = this.props.filters,
|
|
2319
2320
|
filterOwner,
|
|
2320
2321
|
spatialFilter,
|
|
2321
2322
|
spatialFiltersMode,
|
|
2322
2323
|
spatialIndexReferenceViewState,
|
|
2323
|
-
abortController,
|
|
2324
2324
|
...params
|
|
2325
2325
|
} = options;
|
|
2326
2326
|
const { column, operation, operationColumn } = params;
|
|
@@ -2343,17 +2343,17 @@ var WidgetRemoteSource = class extends WidgetSource {
|
|
|
2343
2343
|
operation,
|
|
2344
2344
|
operationColumn: operationColumn || column
|
|
2345
2345
|
},
|
|
2346
|
-
opts: {
|
|
2346
|
+
opts: { signal, headers: this._headers }
|
|
2347
2347
|
}).then((res) => normalizeObjectKeys(res.rows));
|
|
2348
2348
|
}
|
|
2349
2349
|
async getFeatures(options) {
|
|
2350
2350
|
const {
|
|
2351
|
+
signal,
|
|
2351
2352
|
filters = this.props.filters,
|
|
2352
2353
|
filterOwner,
|
|
2353
2354
|
spatialFilter,
|
|
2354
2355
|
spatialFiltersMode,
|
|
2355
2356
|
spatialIndexReferenceViewState,
|
|
2356
|
-
abortController,
|
|
2357
2357
|
...params
|
|
2358
2358
|
} = options;
|
|
2359
2359
|
const { columns, dataType, featureIds, z, limit, tileResolution } = params;
|
|
@@ -2379,18 +2379,18 @@ var WidgetRemoteSource = class extends WidgetSource {
|
|
|
2379
2379
|
limit: limit || 1e3,
|
|
2380
2380
|
tileResolution: tileResolution || DEFAULT_TILE_RESOLUTION
|
|
2381
2381
|
},
|
|
2382
|
-
opts: {
|
|
2382
|
+
opts: { signal, headers: this._headers }
|
|
2383
2383
|
// Avoid `normalizeObjectKeys()`, which changes column names.
|
|
2384
2384
|
}).then(({ rows }) => ({ rows }));
|
|
2385
2385
|
}
|
|
2386
2386
|
async getFormula(options) {
|
|
2387
2387
|
const {
|
|
2388
|
+
signal,
|
|
2388
2389
|
filters = this.props.filters,
|
|
2389
2390
|
filterOwner,
|
|
2390
2391
|
spatialFilter,
|
|
2391
2392
|
spatialFiltersMode,
|
|
2392
2393
|
spatialIndexReferenceViewState,
|
|
2393
|
-
abortController,
|
|
2394
2394
|
operationExp,
|
|
2395
2395
|
...params
|
|
2396
2396
|
} = options;
|
|
@@ -2414,17 +2414,17 @@ var WidgetRemoteSource = class extends WidgetSource {
|
|
|
2414
2414
|
operation: operation ?? "count",
|
|
2415
2415
|
operationExp
|
|
2416
2416
|
},
|
|
2417
|
-
opts: {
|
|
2417
|
+
opts: { signal, headers: this._headers }
|
|
2418
2418
|
}).then((res) => normalizeObjectKeys(res.rows[0]));
|
|
2419
2419
|
}
|
|
2420
2420
|
async getHistogram(options) {
|
|
2421
2421
|
const {
|
|
2422
|
+
signal,
|
|
2422
2423
|
filters = this.props.filters,
|
|
2423
2424
|
filterOwner,
|
|
2424
2425
|
spatialFilter,
|
|
2425
2426
|
spatialFiltersMode,
|
|
2426
2427
|
spatialIndexReferenceViewState,
|
|
2427
|
-
abortController,
|
|
2428
2428
|
...params
|
|
2429
2429
|
} = options;
|
|
2430
2430
|
const { column, operation, ticks } = params;
|
|
@@ -2443,7 +2443,7 @@ var WidgetRemoteSource = class extends WidgetSource {
|
|
|
2443
2443
|
spatialFilter
|
|
2444
2444
|
},
|
|
2445
2445
|
params: { column, operation, ticks },
|
|
2446
|
-
opts: {
|
|
2446
|
+
opts: { signal, headers: this._headers }
|
|
2447
2447
|
}).then((res) => normalizeObjectKeys(res.rows));
|
|
2448
2448
|
if (data.length) {
|
|
2449
2449
|
const result = Array(ticks.length + 1).fill(0);
|
|
@@ -2456,12 +2456,12 @@ var WidgetRemoteSource = class extends WidgetSource {
|
|
|
2456
2456
|
}
|
|
2457
2457
|
async getRange(options) {
|
|
2458
2458
|
const {
|
|
2459
|
+
signal,
|
|
2459
2460
|
filters = this.props.filters,
|
|
2460
2461
|
filterOwner,
|
|
2461
2462
|
spatialFilter,
|
|
2462
2463
|
spatialFiltersMode,
|
|
2463
2464
|
spatialIndexReferenceViewState,
|
|
2464
|
-
abortController,
|
|
2465
2465
|
...params
|
|
2466
2466
|
} = options;
|
|
2467
2467
|
const { column } = params;
|
|
@@ -2480,17 +2480,17 @@ var WidgetRemoteSource = class extends WidgetSource {
|
|
|
2480
2480
|
spatialFilter
|
|
2481
2481
|
},
|
|
2482
2482
|
params: { column },
|
|
2483
|
-
opts: {
|
|
2483
|
+
opts: { signal, headers: this._headers }
|
|
2484
2484
|
}).then((res) => normalizeObjectKeys(res.rows[0]));
|
|
2485
2485
|
}
|
|
2486
2486
|
async getScatter(options) {
|
|
2487
2487
|
const {
|
|
2488
|
+
signal,
|
|
2488
2489
|
filters = this.props.filters,
|
|
2489
2490
|
filterOwner,
|
|
2490
2491
|
spatialFilter,
|
|
2491
2492
|
spatialFiltersMode,
|
|
2492
2493
|
spatialIndexReferenceViewState,
|
|
2493
|
-
abortController,
|
|
2494
2494
|
...params
|
|
2495
2495
|
} = options;
|
|
2496
2496
|
const { xAxisColumn, xAxisJoinOperation, yAxisColumn, yAxisJoinOperation } = params;
|
|
@@ -2516,17 +2516,17 @@ var WidgetRemoteSource = class extends WidgetSource {
|
|
|
2516
2516
|
yAxisJoinOperation,
|
|
2517
2517
|
limit: HARD_LIMIT
|
|
2518
2518
|
},
|
|
2519
|
-
opts: {
|
|
2519
|
+
opts: { signal, headers: this._headers }
|
|
2520
2520
|
}).then((res) => normalizeObjectKeys(res.rows)).then((res) => res.map(({ x, y }) => [x, y]));
|
|
2521
2521
|
}
|
|
2522
2522
|
async getTable(options) {
|
|
2523
2523
|
const {
|
|
2524
|
+
signal,
|
|
2524
2525
|
filters = this.props.filters,
|
|
2525
2526
|
filterOwner,
|
|
2526
2527
|
spatialFilter,
|
|
2527
2528
|
spatialFiltersMode,
|
|
2528
2529
|
spatialIndexReferenceViewState,
|
|
2529
|
-
abortController,
|
|
2530
2530
|
...params
|
|
2531
2531
|
} = options;
|
|
2532
2532
|
const { columns, sortBy, sortDirection, offset = 0, limit = 10 } = params;
|
|
@@ -2551,7 +2551,7 @@ var WidgetRemoteSource = class extends WidgetSource {
|
|
|
2551
2551
|
limit,
|
|
2552
2552
|
offset
|
|
2553
2553
|
},
|
|
2554
|
-
opts: {
|
|
2554
|
+
opts: { signal, headers: this._headers }
|
|
2555
2555
|
}).then((res) => ({
|
|
2556
2556
|
// Avoid `normalizeObjectKeys()`, which changes column names.
|
|
2557
2557
|
rows: res.rows ?? res.ROWS,
|
|
@@ -2560,9 +2560,9 @@ var WidgetRemoteSource = class extends WidgetSource {
|
|
|
2560
2560
|
}
|
|
2561
2561
|
async getTimeSeries(options) {
|
|
2562
2562
|
const {
|
|
2563
|
+
signal,
|
|
2563
2564
|
filters = this.props.filters,
|
|
2564
2565
|
filterOwner,
|
|
2565
|
-
abortController,
|
|
2566
2566
|
spatialFilter,
|
|
2567
2567
|
spatialFiltersMode,
|
|
2568
2568
|
spatialIndexReferenceViewState,
|
|
@@ -2604,7 +2604,7 @@ var WidgetRemoteSource = class extends WidgetSource {
|
|
|
2604
2604
|
splitByCategoryLimit,
|
|
2605
2605
|
splitByCategoryValues
|
|
2606
2606
|
},
|
|
2607
|
-
opts: {
|
|
2607
|
+
opts: { signal, headers: this._headers }
|
|
2608
2608
|
}).then((res) => ({
|
|
2609
2609
|
rows: normalizeObjectKeys(res.rows),
|
|
2610
2610
|
categories: res.metadata?.categories
|
|
@@ -3086,10 +3086,10 @@ var WidgetTilesetSource = class extends WidgetSource {
|
|
|
3086
3086
|
filters,
|
|
3087
3087
|
filterOwner
|
|
3088
3088
|
);
|
|
3089
|
-
assertColumn(this._features, column);
|
|
3090
3089
|
if (!this._features.length) {
|
|
3091
3090
|
return [];
|
|
3092
3091
|
}
|
|
3092
|
+
assertColumn(this._features, column);
|
|
3093
3093
|
return histogram({
|
|
3094
3094
|
data: filteredFeatures,
|
|
3095
3095
|
valuesColumns: normalizeColumns(column),
|
|
@@ -3276,16 +3276,79 @@ function normalizeColumns(columns) {
|
|
|
3276
3276
|
|
|
3277
3277
|
// src/widget-sources/widget-tileset-worker-source.ts
|
|
3278
3278
|
init_cjs_shims();
|
|
3279
|
-
var
|
|
3279
|
+
var WidgetTilesetWorkerSource = class extends WidgetSource {
|
|
3280
3280
|
constructor(props) {
|
|
3281
3281
|
super(props);
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3282
|
+
/////////////////////////////////////////////////////////////////////////////
|
|
3283
|
+
// WEB WORKER MANAGEMENT
|
|
3284
|
+
__publicField(this, "_worker", null);
|
|
3285
|
+
__publicField(this, "_workerNextRequestId", 1);
|
|
3286
|
+
}
|
|
3287
|
+
/**
|
|
3288
|
+
* Returns an initialized Worker, to be reused for the lifecycle of this
|
|
3289
|
+
* source instance.
|
|
3290
|
+
*/
|
|
3291
|
+
_getWorker() {
|
|
3292
|
+
if (this._worker) {
|
|
3293
|
+
return this._worker;
|
|
3294
|
+
}
|
|
3295
|
+
this._worker = new Worker(
|
|
3296
|
+
new URL("@carto/api-client/worker", importMetaUrl),
|
|
3297
|
+
{
|
|
3298
|
+
type: "module",
|
|
3299
|
+
name: "cartowidgettileset"
|
|
3300
|
+
}
|
|
3301
|
+
);
|
|
3302
|
+
this._worker.postMessage({
|
|
3285
3303
|
method: "init" /* INIT */,
|
|
3286
3304
|
params: [this.props]
|
|
3287
3305
|
});
|
|
3306
|
+
return this._worker;
|
|
3307
|
+
}
|
|
3308
|
+
/** Executes a given method on the worker. */
|
|
3309
|
+
_executeWorkerMethod(method, params, signal) {
|
|
3310
|
+
const worker = this._getWorker();
|
|
3311
|
+
const requestId = this._workerNextRequestId++;
|
|
3312
|
+
const options = params[0];
|
|
3313
|
+
if (options?.spatialIndexReferenceViewState) {
|
|
3314
|
+
const { zoom, latitude, longitude } = options.spatialIndexReferenceViewState;
|
|
3315
|
+
options.spatialIndexReferenceViewState = { zoom, latitude, longitude };
|
|
3316
|
+
}
|
|
3317
|
+
let resolve = null;
|
|
3318
|
+
let reject = null;
|
|
3319
|
+
function onMessage(e) {
|
|
3320
|
+
const response = e.data;
|
|
3321
|
+
if (response.requestId !== requestId) return;
|
|
3322
|
+
if (signal?.aborted) {
|
|
3323
|
+
reject(new Error(signal.reason));
|
|
3324
|
+
} else if (response.ok) {
|
|
3325
|
+
resolve(response.result);
|
|
3326
|
+
} else {
|
|
3327
|
+
reject(new Error(response.error));
|
|
3328
|
+
}
|
|
3329
|
+
}
|
|
3330
|
+
function onAbort() {
|
|
3331
|
+
reject(new Error(signal.reason));
|
|
3332
|
+
}
|
|
3333
|
+
worker.addEventListener("message", onMessage);
|
|
3334
|
+
signal?.addEventListener("abort", onAbort);
|
|
3335
|
+
const promise = new Promise((_resolve, _reject) => {
|
|
3336
|
+
resolve = _resolve;
|
|
3337
|
+
reject = _reject;
|
|
3338
|
+
worker.postMessage({
|
|
3339
|
+
requestId,
|
|
3340
|
+
method,
|
|
3341
|
+
params
|
|
3342
|
+
});
|
|
3343
|
+
});
|
|
3344
|
+
void promise.finally(() => {
|
|
3345
|
+
worker.removeEventListener("message", onMessage);
|
|
3346
|
+
signal?.removeEventListener("abort", onAbort);
|
|
3347
|
+
});
|
|
3348
|
+
return promise;
|
|
3288
3349
|
}
|
|
3350
|
+
/////////////////////////////////////////////////////////////////////////////
|
|
3351
|
+
// DATA LOADING
|
|
3289
3352
|
/**
|
|
3290
3353
|
* Loads features as a list of tiles (typically provided by deck.gl).
|
|
3291
3354
|
* After tiles are loaded, {@link extractTileFeatures} must be called
|
|
@@ -3297,16 +3360,14 @@ var _WidgetTilesetWorkerSource = class _WidgetTilesetWorkerSource extends Widget
|
|
|
3297
3360
|
bbox,
|
|
3298
3361
|
data
|
|
3299
3362
|
}));
|
|
3300
|
-
|
|
3301
|
-
tableName: this.props.tableName,
|
|
3363
|
+
this._getWorker().postMessage({
|
|
3302
3364
|
method: "loadTiles" /* LOAD_TILES */,
|
|
3303
3365
|
params: [tiles2]
|
|
3304
3366
|
});
|
|
3305
3367
|
}
|
|
3306
3368
|
/** Configures options used to extract features from tiles. */
|
|
3307
3369
|
setTileFeatureExtractOptions(options) {
|
|
3308
|
-
|
|
3309
|
-
tableName: this.props.tableName,
|
|
3370
|
+
this._getWorker().postMessage({
|
|
3310
3371
|
type: "setTileFeatureExtractOptions" /* SET_TILE_FEATURE_EXTRACT_OPTIONS */,
|
|
3311
3372
|
params: [options]
|
|
3312
3373
|
});
|
|
@@ -3320,139 +3381,60 @@ var _WidgetTilesetWorkerSource = class _WidgetTilesetWorkerSource extends Widget
|
|
|
3320
3381
|
geojson,
|
|
3321
3382
|
spatialFilter
|
|
3322
3383
|
}) {
|
|
3323
|
-
|
|
3324
|
-
tableName: this.props.tableName,
|
|
3384
|
+
this._getWorker().postMessage({
|
|
3325
3385
|
method: "loadGeoJSON" /* LOAD_GEOJSON */,
|
|
3326
3386
|
params: [{ geojson, spatialFilter }]
|
|
3327
3387
|
});
|
|
3328
3388
|
}
|
|
3389
|
+
/////////////////////////////////////////////////////////////////////////////
|
|
3390
|
+
// WIDGETS API
|
|
3329
3391
|
// eslint-disable-next-line @typescript-eslint/require-await
|
|
3330
3392
|
async getFeatures() {
|
|
3331
3393
|
throw new Error("getFeatures not supported for tilesets");
|
|
3332
3394
|
}
|
|
3333
3395
|
async getFormula({
|
|
3334
|
-
|
|
3396
|
+
signal,
|
|
3335
3397
|
...options
|
|
3336
3398
|
}) {
|
|
3337
|
-
return this._executeWorkerMethod(
|
|
3338
|
-
this.props.tableName,
|
|
3339
|
-
"getFormula" /* GET_FORMULA */,
|
|
3340
|
-
[options],
|
|
3341
|
-
abortController?.signal
|
|
3342
|
-
);
|
|
3399
|
+
return this._executeWorkerMethod("getFormula" /* GET_FORMULA */, [options], signal);
|
|
3343
3400
|
}
|
|
3344
3401
|
async getHistogram({
|
|
3345
|
-
|
|
3402
|
+
signal,
|
|
3346
3403
|
...options
|
|
3347
3404
|
}) {
|
|
3348
|
-
return this._executeWorkerMethod(
|
|
3349
|
-
this.props.tableName,
|
|
3350
|
-
"getHistogram" /* GET_HISTOGRAM */,
|
|
3351
|
-
[options],
|
|
3352
|
-
abortController?.signal
|
|
3353
|
-
);
|
|
3405
|
+
return this._executeWorkerMethod("getHistogram" /* GET_HISTOGRAM */, [options], signal);
|
|
3354
3406
|
}
|
|
3355
3407
|
async getCategories({
|
|
3356
|
-
|
|
3408
|
+
signal,
|
|
3357
3409
|
...options
|
|
3358
3410
|
}) {
|
|
3359
|
-
return this._executeWorkerMethod(
|
|
3360
|
-
this.props.tableName,
|
|
3361
|
-
"getCategories" /* GET_CATEGORIES */,
|
|
3362
|
-
[options],
|
|
3363
|
-
abortController?.signal
|
|
3364
|
-
);
|
|
3411
|
+
return this._executeWorkerMethod("getCategories" /* GET_CATEGORIES */, [options], signal);
|
|
3365
3412
|
}
|
|
3366
3413
|
async getScatter({
|
|
3367
|
-
|
|
3414
|
+
signal,
|
|
3368
3415
|
...options
|
|
3369
3416
|
}) {
|
|
3370
|
-
return this._executeWorkerMethod(
|
|
3371
|
-
this.props.tableName,
|
|
3372
|
-
"getScatter" /* GET_SCATTER */,
|
|
3373
|
-
[options],
|
|
3374
|
-
abortController?.signal
|
|
3375
|
-
);
|
|
3417
|
+
return this._executeWorkerMethod("getScatter" /* GET_SCATTER */, [options], signal);
|
|
3376
3418
|
}
|
|
3377
3419
|
async getTable({
|
|
3378
|
-
|
|
3420
|
+
signal,
|
|
3379
3421
|
...options
|
|
3380
3422
|
}) {
|
|
3381
|
-
return this._executeWorkerMethod(
|
|
3382
|
-
this.props.tableName,
|
|
3383
|
-
"getTable" /* GET_TABLE */,
|
|
3384
|
-
[options],
|
|
3385
|
-
abortController?.signal
|
|
3386
|
-
);
|
|
3423
|
+
return this._executeWorkerMethod("getTable" /* GET_TABLE */, [options], signal);
|
|
3387
3424
|
}
|
|
3388
3425
|
async getTimeSeries({
|
|
3389
|
-
|
|
3426
|
+
signal,
|
|
3390
3427
|
...options
|
|
3391
3428
|
}) {
|
|
3392
|
-
return this._executeWorkerMethod(
|
|
3393
|
-
this.props.tableName,
|
|
3394
|
-
"getTimeSeries" /* GET_TIME_SERIES */,
|
|
3395
|
-
[options],
|
|
3396
|
-
abortController?.signal
|
|
3397
|
-
);
|
|
3429
|
+
return this._executeWorkerMethod("getTimeSeries" /* GET_TIME_SERIES */, [options], signal);
|
|
3398
3430
|
}
|
|
3399
3431
|
async getRange({
|
|
3400
|
-
|
|
3432
|
+
signal,
|
|
3401
3433
|
...options
|
|
3402
3434
|
}) {
|
|
3403
|
-
return this._executeWorkerMethod(
|
|
3404
|
-
this.props.tableName,
|
|
3405
|
-
"getRange" /* GET_RANGE */,
|
|
3406
|
-
[options],
|
|
3407
|
-
abortController?.signal
|
|
3408
|
-
);
|
|
3409
|
-
}
|
|
3410
|
-
static init() {
|
|
3411
|
-
_WidgetTilesetWorkerSource.WORKER = new Worker(
|
|
3412
|
-
new URL("@carto/api-client/worker", importMetaUrl),
|
|
3413
|
-
{
|
|
3414
|
-
type: "module",
|
|
3415
|
-
name: "cartowidgettileset"
|
|
3416
|
-
}
|
|
3417
|
-
);
|
|
3418
|
-
}
|
|
3419
|
-
_executeWorkerMethod(tableName, method, params, signal) {
|
|
3420
|
-
const worker = _WidgetTilesetWorkerSource.WORKER;
|
|
3421
|
-
const requestId = _WidgetTilesetWorkerSource._nextRequestID++;
|
|
3422
|
-
const options = params[0];
|
|
3423
|
-
if (options?.spatialIndexReferenceViewState) {
|
|
3424
|
-
const { zoom, latitude, longitude } = options.spatialIndexReferenceViewState;
|
|
3425
|
-
options.spatialIndexReferenceViewState = { zoom, latitude, longitude };
|
|
3426
|
-
}
|
|
3427
|
-
worker.postMessage({
|
|
3428
|
-
requestId,
|
|
3429
|
-
tableName,
|
|
3430
|
-
method,
|
|
3431
|
-
params
|
|
3432
|
-
});
|
|
3433
|
-
return new Promise((resolve, reject) => {
|
|
3434
|
-
function listener(e) {
|
|
3435
|
-
const response = e.data;
|
|
3436
|
-
if (response.requestId !== requestId) return;
|
|
3437
|
-
worker.removeEventListener("message", listener);
|
|
3438
|
-
if (signal?.aborted) {
|
|
3439
|
-
reject(new Error(signal.reason));
|
|
3440
|
-
} else if (response.ok) {
|
|
3441
|
-
resolve(response.result);
|
|
3442
|
-
} else {
|
|
3443
|
-
reject(new Error(response.error));
|
|
3444
|
-
}
|
|
3445
|
-
}
|
|
3446
|
-
worker.addEventListener("message", listener);
|
|
3447
|
-
});
|
|
3435
|
+
return this._executeWorkerMethod("getRange" /* GET_RANGE */, [options], signal);
|
|
3448
3436
|
}
|
|
3449
3437
|
};
|
|
3450
|
-
/////////////////////////////////////////////////////////////////////////////
|
|
3451
|
-
// WEB WORKER MANAGEMENT
|
|
3452
|
-
// TODO: Singleton? Pool shared among datasets? One per dataset?
|
|
3453
|
-
__publicField(_WidgetTilesetWorkerSource, "WORKER");
|
|
3454
|
-
__publicField(_WidgetTilesetWorkerSource, "_nextRequestID", 1);
|
|
3455
|
-
var WidgetTilesetWorkerSource = _WidgetTilesetWorkerSource;
|
|
3456
3438
|
|
|
3457
3439
|
// src/sources/h3-query-source.ts
|
|
3458
3440
|
var h3QuerySource = async function(options) {
|
package/build/api-client.d.cts
CHANGED
|
@@ -681,11 +681,11 @@ interface ViewState {
|
|
|
681
681
|
}
|
|
682
682
|
/** Common options for {@link WidgetRemoteSource} requests. */
|
|
683
683
|
interface BaseRequestOptions {
|
|
684
|
+
signal?: AbortSignal;
|
|
684
685
|
spatialFilter?: SpatialFilter;
|
|
685
686
|
spatialFiltersMode?: SpatialFilterPolyfillMode;
|
|
686
687
|
/** Required for table- and query-based spatial index sources (H3, Quadbin). */
|
|
687
688
|
spatialIndexReferenceViewState?: ViewState;
|
|
688
|
-
abortController?: AbortController;
|
|
689
689
|
/** Overrides source filters, if any. */
|
|
690
690
|
filters?: Filters;
|
|
691
691
|
filterOwner?: string;
|
|
@@ -1147,10 +1147,25 @@ declare enum Method {
|
|
|
1147
1147
|
}
|
|
1148
1148
|
|
|
1149
1149
|
/**
|
|
1150
|
-
*
|
|
1150
|
+
* Wrapper for {@link WidgetTilesetSource}, moving calculations to Web Workers.
|
|
1151
|
+
* When supported, use of both classes is identical.
|
|
1152
|
+
*
|
|
1153
|
+
* To use this wrapper, the application and environment must support ESM Web
|
|
1154
|
+
* Workers. For older build systems based on CommonJS, or in environments like
|
|
1155
|
+
* Node.js, it may be necessary to use {@link WidgetTilesetSource} directly,
|
|
1156
|
+
* and to (optionally) create workers manually in the application.
|
|
1151
1157
|
*/
|
|
1152
1158
|
declare class WidgetTilesetWorkerSource extends WidgetSource<WidgetTilesetSourceProps> {
|
|
1153
1159
|
constructor(props: WidgetTilesetSourceProps);
|
|
1160
|
+
protected _worker: Worker | null;
|
|
1161
|
+
protected _workerNextRequestId: number;
|
|
1162
|
+
/**
|
|
1163
|
+
* Returns an initialized Worker, to be reused for the lifecycle of this
|
|
1164
|
+
* source instance.
|
|
1165
|
+
*/
|
|
1166
|
+
_getWorker(): Worker;
|
|
1167
|
+
/** Executes a given method on the worker. */
|
|
1168
|
+
_executeWorkerMethod<T>(method: Method, params: unknown[], signal?: AbortSignal): Promise<T>;
|
|
1154
1169
|
/**
|
|
1155
1170
|
* Loads features as a list of tiles (typically provided by deck.gl).
|
|
1156
1171
|
* After tiles are loaded, {@link extractTileFeatures} must be called
|
|
@@ -1169,17 +1184,13 @@ declare class WidgetTilesetWorkerSource extends WidgetSource<WidgetTilesetSource
|
|
|
1169
1184
|
spatialFilter: SpatialFilter;
|
|
1170
1185
|
}): void;
|
|
1171
1186
|
getFeatures(): Promise<FeaturesResponse>;
|
|
1172
|
-
getFormula({
|
|
1173
|
-
getHistogram({
|
|
1174
|
-
getCategories({
|
|
1175
|
-
getScatter({
|
|
1176
|
-
getTable({
|
|
1177
|
-
getTimeSeries({
|
|
1178
|
-
getRange({
|
|
1179
|
-
protected static WORKER: Worker;
|
|
1180
|
-
protected static _nextRequestID: number;
|
|
1181
|
-
static init(): void;
|
|
1182
|
-
_executeWorkerMethod<T>(tableName: string, method: Method, params: unknown[], signal?: AbortSignal): Promise<T>;
|
|
1187
|
+
getFormula({ signal, ...options }: FormulaRequestOptions): Promise<FormulaResponse>;
|
|
1188
|
+
getHistogram({ signal, ...options }: HistogramRequestOptions): Promise<HistogramResponse>;
|
|
1189
|
+
getCategories({ signal, ...options }: CategoryRequestOptions): Promise<CategoryResponse>;
|
|
1190
|
+
getScatter({ signal, ...options }: ScatterRequestOptions): Promise<ScatterResponse>;
|
|
1191
|
+
getTable({ signal, ...options }: TableRequestOptions): Promise<TableResponse>;
|
|
1192
|
+
getTimeSeries({ signal, ...options }: TimeSeriesRequestOptions): Promise<TimeSeriesResponse>;
|
|
1193
|
+
getRange({ signal, ...options }: RangeRequestOptions): Promise<RangeResponse>;
|
|
1183
1194
|
}
|
|
1184
1195
|
|
|
1185
1196
|
type H3QuerySourceOptions = SourceOptions & QuerySourceOptions & AggregationOptions & FilterOptions;
|
package/build/api-client.d.ts
CHANGED
|
@@ -681,11 +681,11 @@ interface ViewState {
|
|
|
681
681
|
}
|
|
682
682
|
/** Common options for {@link WidgetRemoteSource} requests. */
|
|
683
683
|
interface BaseRequestOptions {
|
|
684
|
+
signal?: AbortSignal;
|
|
684
685
|
spatialFilter?: SpatialFilter;
|
|
685
686
|
spatialFiltersMode?: SpatialFilterPolyfillMode;
|
|
686
687
|
/** Required for table- and query-based spatial index sources (H3, Quadbin). */
|
|
687
688
|
spatialIndexReferenceViewState?: ViewState;
|
|
688
|
-
abortController?: AbortController;
|
|
689
689
|
/** Overrides source filters, if any. */
|
|
690
690
|
filters?: Filters;
|
|
691
691
|
filterOwner?: string;
|
|
@@ -1147,10 +1147,25 @@ declare enum Method {
|
|
|
1147
1147
|
}
|
|
1148
1148
|
|
|
1149
1149
|
/**
|
|
1150
|
-
*
|
|
1150
|
+
* Wrapper for {@link WidgetTilesetSource}, moving calculations to Web Workers.
|
|
1151
|
+
* When supported, use of both classes is identical.
|
|
1152
|
+
*
|
|
1153
|
+
* To use this wrapper, the application and environment must support ESM Web
|
|
1154
|
+
* Workers. For older build systems based on CommonJS, or in environments like
|
|
1155
|
+
* Node.js, it may be necessary to use {@link WidgetTilesetSource} directly,
|
|
1156
|
+
* and to (optionally) create workers manually in the application.
|
|
1151
1157
|
*/
|
|
1152
1158
|
declare class WidgetTilesetWorkerSource extends WidgetSource<WidgetTilesetSourceProps> {
|
|
1153
1159
|
constructor(props: WidgetTilesetSourceProps);
|
|
1160
|
+
protected _worker: Worker | null;
|
|
1161
|
+
protected _workerNextRequestId: number;
|
|
1162
|
+
/**
|
|
1163
|
+
* Returns an initialized Worker, to be reused for the lifecycle of this
|
|
1164
|
+
* source instance.
|
|
1165
|
+
*/
|
|
1166
|
+
_getWorker(): Worker;
|
|
1167
|
+
/** Executes a given method on the worker. */
|
|
1168
|
+
_executeWorkerMethod<T>(method: Method, params: unknown[], signal?: AbortSignal): Promise<T>;
|
|
1154
1169
|
/**
|
|
1155
1170
|
* Loads features as a list of tiles (typically provided by deck.gl).
|
|
1156
1171
|
* After tiles are loaded, {@link extractTileFeatures} must be called
|
|
@@ -1169,17 +1184,13 @@ declare class WidgetTilesetWorkerSource extends WidgetSource<WidgetTilesetSource
|
|
|
1169
1184
|
spatialFilter: SpatialFilter;
|
|
1170
1185
|
}): void;
|
|
1171
1186
|
getFeatures(): Promise<FeaturesResponse>;
|
|
1172
|
-
getFormula({
|
|
1173
|
-
getHistogram({
|
|
1174
|
-
getCategories({
|
|
1175
|
-
getScatter({
|
|
1176
|
-
getTable({
|
|
1177
|
-
getTimeSeries({
|
|
1178
|
-
getRange({
|
|
1179
|
-
protected static WORKER: Worker;
|
|
1180
|
-
protected static _nextRequestID: number;
|
|
1181
|
-
static init(): void;
|
|
1182
|
-
_executeWorkerMethod<T>(tableName: string, method: Method, params: unknown[], signal?: AbortSignal): Promise<T>;
|
|
1187
|
+
getFormula({ signal, ...options }: FormulaRequestOptions): Promise<FormulaResponse>;
|
|
1188
|
+
getHistogram({ signal, ...options }: HistogramRequestOptions): Promise<HistogramResponse>;
|
|
1189
|
+
getCategories({ signal, ...options }: CategoryRequestOptions): Promise<CategoryResponse>;
|
|
1190
|
+
getScatter({ signal, ...options }: ScatterRequestOptions): Promise<ScatterResponse>;
|
|
1191
|
+
getTable({ signal, ...options }: TableRequestOptions): Promise<TableResponse>;
|
|
1192
|
+
getTimeSeries({ signal, ...options }: TimeSeriesRequestOptions): Promise<TimeSeriesResponse>;
|
|
1193
|
+
getRange({ signal, ...options }: RangeRequestOptions): Promise<RangeResponse>;
|
|
1183
1194
|
}
|
|
1184
1195
|
|
|
1185
1196
|
type H3QuerySourceOptions = SourceOptions & QuerySourceOptions & AggregationOptions & FilterOptions;
|