@honua/sdk-esri-compat 0.0.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/README.md +5 -0
- package/contract/edit-session.d.ts +203 -0
- package/contract/edit-session.d.ts.map +1 -0
- package/contract/edit-session.js +717 -0
- package/contract/index.d.ts +20 -0
- package/contract/index.d.ts.map +1 -0
- package/contract/index.js +15 -0
- package/contract/jobs.d.ts +115 -0
- package/contract/jobs.d.ts.map +1 -0
- package/contract/jobs.js +22 -0
- package/contract/source.d.ts +138 -0
- package/contract/source.d.ts.map +1 -0
- package/contract/source.js +3364 -0
- package/contract/spatial-aggregation.d.ts +312 -0
- package/contract/spatial-aggregation.d.ts.map +1 -0
- package/contract/spatial-aggregation.js +196 -0
- package/contract/types.d.ts +542 -0
- package/contract/types.d.ts.map +1 -0
- package/contract/types.js +171 -0
- package/core/batch.d.ts +37 -0
- package/core/batch.d.ts.map +1 -0
- package/core/batch.js +78 -0
- package/core/cache-state.d.ts +76 -0
- package/core/cache-state.d.ts.map +1 -0
- package/core/cache-state.js +84 -0
- package/core/client.d.ts +289 -0
- package/core/client.d.ts.map +1 -0
- package/core/client.js +2625 -0
- package/core/errors.d.ts +68 -0
- package/core/errors.d.ts.map +1 -0
- package/core/errors.js +116 -0
- package/core/grpc-adapter.d.ts +23 -0
- package/core/grpc-adapter.d.ts.map +1 -0
- package/core/grpc-adapter.js +704 -0
- package/core/odata.d.ts +347 -0
- package/core/odata.d.ts.map +1 -0
- package/core/odata.js +837 -0
- package/core/ogc-conformance.d.ts +35 -0
- package/core/ogc-conformance.d.ts.map +1 -0
- package/core/ogc-conformance.js +121 -0
- package/core/ogc-maps.d.ts +45 -0
- package/core/ogc-maps.d.ts.map +1 -0
- package/core/ogc-maps.js +53 -0
- package/core/ogc-processes.d.ts +92 -0
- package/core/ogc-processes.d.ts.map +1 -0
- package/core/ogc-processes.js +325 -0
- package/core/ogc-tiles.d.ts +55 -0
- package/core/ogc-tiles.d.ts.map +1 -0
- package/core/ogc-tiles.js +81 -0
- package/core/pbf-decoder.d.ts +28 -0
- package/core/pbf-decoder.d.ts.map +1 -0
- package/core/pbf-decoder.js +627 -0
- package/core/query-builder.d.ts +261 -0
- package/core/query-builder.d.ts.map +1 -0
- package/core/query-builder.js +538 -0
- package/core/spatial-filter.d.ts +93 -0
- package/core/spatial-filter.d.ts.map +1 -0
- package/core/spatial-filter.js +153 -0
- package/core/stac.d.ts +43 -0
- package/core/stac.d.ts.map +1 -0
- package/core/stac.js +116 -0
- package/core/surfaces.d.ts +464 -0
- package/core/surfaces.d.ts.map +1 -0
- package/core/surfaces.js +1322 -0
- package/core/types.d.ts +1238 -0
- package/core/types.d.ts.map +1 -0
- package/core/types.js +13 -0
- package/core/wfs-capabilities.d.ts +143 -0
- package/core/wfs-capabilities.d.ts.map +1 -0
- package/core/wfs-capabilities.js +478 -0
- package/core/wfs-filter.d.ts +118 -0
- package/core/wfs-filter.d.ts.map +1 -0
- package/core/wfs-filter.js +586 -0
- package/core/wfs.d.ts +219 -0
- package/core/wfs.d.ts.map +1 -0
- package/core/wfs.js +406 -0
- package/core/wms-capabilities.d.ts +110 -0
- package/core/wms-capabilities.d.ts.map +1 -0
- package/core/wms-capabilities.js +566 -0
- package/core/wms-types.d.ts +128 -0
- package/core/wms-types.d.ts.map +1 -0
- package/core/wms-types.js +32 -0
- package/core/wms.d.ts +108 -0
- package/core/wms.d.ts.map +1 -0
- package/core/wms.js +182 -0
- package/core/wmts-capabilities.d.ts +82 -0
- package/core/wmts-capabilities.d.ts.map +1 -0
- package/core/wmts-capabilities.js +409 -0
- package/core/wmts.d.ts +80 -0
- package/core/wmts.d.ts.map +1 -0
- package/core/wmts.js +173 -0
- package/esri-compat/basemap-gallery.d.ts +38 -0
- package/esri-compat/basemap-gallery.d.ts.map +1 -0
- package/esri-compat/basemap-gallery.js +159 -0
- package/esri-compat/basemap-layer-list.d.ts +35 -0
- package/esri-compat/basemap-layer-list.d.ts.map +1 -0
- package/esri-compat/basemap-layer-list.js +139 -0
- package/esri-compat/basemap.d.ts +32 -0
- package/esri-compat/basemap.d.ts.map +1 -0
- package/esri-compat/basemap.js +84 -0
- package/esri-compat/bookmarks.d.ts +36 -0
- package/esri-compat/bookmarks.d.ts.map +1 -0
- package/esri-compat/bookmarks.js +108 -0
- package/esri-compat/class-breaks-renderer.d.ts +50 -0
- package/esri-compat/class-breaks-renderer.d.ts.map +1 -0
- package/esri-compat/class-breaks-renderer.js +164 -0
- package/esri-compat/color.d.ts +22 -0
- package/esri-compat/color.d.ts.map +1 -0
- package/esri-compat/color.js +106 -0
- package/esri-compat/controls.d.ts +174 -0
- package/esri-compat/controls.d.ts.map +1 -0
- package/esri-compat/controls.js +479 -0
- package/esri-compat/coordinate-conversion.d.ts +41 -0
- package/esri-compat/coordinate-conversion.d.ts.map +1 -0
- package/esri-compat/coordinate-conversion.js +125 -0
- package/esri-compat/directions.d.ts +45 -0
- package/esri-compat/directions.d.ts.map +1 -0
- package/esri-compat/directions.js +123 -0
- package/esri-compat/editor.d.ts +47 -0
- package/esri-compat/editor.d.ts.map +1 -0
- package/esri-compat/editor.js +170 -0
- package/esri-compat/esri-config.d.ts +16 -0
- package/esri-compat/esri-config.d.ts.map +1 -0
- package/esri-compat/esri-config.js +23 -0
- package/esri-compat/esri-request.d.ts +17 -0
- package/esri-compat/esri-request.d.ts.map +1 -0
- package/esri-compat/esri-request.js +66 -0
- package/esri-compat/event-bus.d.ts +106 -0
- package/esri-compat/event-bus.d.ts.map +1 -0
- package/esri-compat/event-bus.js +90 -0
- package/esri-compat/expand.d.ts +36 -0
- package/esri-compat/expand.d.ts.map +1 -0
- package/esri-compat/expand.js +97 -0
- package/esri-compat/extent.d.ts +43 -0
- package/esri-compat/extent.d.ts.map +1 -0
- package/esri-compat/extent.js +140 -0
- package/esri-compat/feature-form.d.ts +64 -0
- package/esri-compat/feature-form.d.ts.map +1 -0
- package/esri-compat/feature-form.js +137 -0
- package/esri-compat/feature-layer.d.ts +173 -0
- package/esri-compat/feature-layer.d.ts.map +1 -0
- package/esri-compat/feature-layer.js +655 -0
- package/esri-compat/feature-set.d.ts +32 -0
- package/esri-compat/feature-set.d.ts.map +1 -0
- package/esri-compat/feature-set.js +80 -0
- package/esri-compat/feature-table.d.ts +141 -0
- package/esri-compat/feature-table.d.ts.map +1 -0
- package/esri-compat/feature-table.js +500 -0
- package/esri-compat/feature-templates.d.ts +41 -0
- package/esri-compat/feature-templates.d.ts.map +1 -0
- package/esri-compat/feature-templates.js +97 -0
- package/esri-compat/feature.d.ts +33 -0
- package/esri-compat/feature.d.ts.map +1 -0
- package/esri-compat/feature.js +83 -0
- package/esri-compat/graphic.d.ts +46 -0
- package/esri-compat/graphic.d.ts.map +1 -0
- package/esri-compat/graphic.js +103 -0
- package/esri-compat/graphics-layer.d.ts +49 -0
- package/esri-compat/graphics-layer.d.ts.map +1 -0
- package/esri-compat/graphics-layer.js +185 -0
- package/esri-compat/group-layer.d.ts +48 -0
- package/esri-compat/group-layer.d.ts.map +1 -0
- package/esri-compat/group-layer.js +212 -0
- package/esri-compat/identify.d.ts +71 -0
- package/esri-compat/identify.d.ts.map +1 -0
- package/esri-compat/identify.js +299 -0
- package/esri-compat/identity-manager.d.ts +31 -0
- package/esri-compat/identity-manager.d.ts.map +1 -0
- package/esri-compat/identity-manager.js +115 -0
- package/esri-compat/label-class.d.ts +31 -0
- package/esri-compat/label-class.d.ts.map +1 -0
- package/esri-compat/label-class.js +102 -0
- package/esri-compat/layer-list.d.ts +77 -0
- package/esri-compat/layer-list.d.ts.map +1 -0
- package/esri-compat/layer-list.js +342 -0
- package/esri-compat/legend.d.ts +53 -0
- package/esri-compat/legend.d.ts.map +1 -0
- package/esri-compat/legend.js +254 -0
- package/esri-compat/map-image-layer.d.ts +162 -0
- package/esri-compat/map-image-layer.d.ts.map +1 -0
- package/esri-compat/map-image-layer.js +704 -0
- package/esri-compat/map-view.d.ts +315 -0
- package/esri-compat/map-view.d.ts.map +1 -0
- package/esri-compat/map-view.js +1110 -0
- package/esri-compat/map.d.ts +47 -0
- package/esri-compat/map.d.ts.map +1 -0
- package/esri-compat/map.js +209 -0
- package/esri-compat/measurement-2d.d.ts +61 -0
- package/esri-compat/measurement-2d.d.ts.map +1 -0
- package/esri-compat/measurement-2d.js +184 -0
- package/esri-compat/measurement.d.ts +45 -0
- package/esri-compat/measurement.d.ts.map +1 -0
- package/esri-compat/measurement.js +193 -0
- package/esri-compat/oauth-info.d.ts +35 -0
- package/esri-compat/oauth-info.d.ts.map +1 -0
- package/esri-compat/oauth-info.js +115 -0
- package/esri-compat/picture-marker-symbol.d.ts +35 -0
- package/esri-compat/picture-marker-symbol.d.ts.map +1 -0
- package/esri-compat/picture-marker-symbol.js +126 -0
- package/esri-compat/point.d.ts +31 -0
- package/esri-compat/point.d.ts.map +1 -0
- package/esri-compat/point.js +102 -0
- package/esri-compat/polygon.d.ts +31 -0
- package/esri-compat/polygon.d.ts.map +1 -0
- package/esri-compat/polygon.js +107 -0
- package/esri-compat/polyline.d.ts +31 -0
- package/esri-compat/polyline.d.ts.map +1 -0
- package/esri-compat/polyline.js +107 -0
- package/esri-compat/popup-template.d.ts +55 -0
- package/esri-compat/popup-template.d.ts.map +1 -0
- package/esri-compat/popup-template.js +128 -0
- package/esri-compat/popup.d.ts +54 -0
- package/esri-compat/popup.d.ts.map +1 -0
- package/esri-compat/popup.js +312 -0
- package/esri-compat/print.d.ts +47 -0
- package/esri-compat/print.d.ts.map +1 -0
- package/esri-compat/print.js +105 -0
- package/esri-compat/query.d.ts +46 -0
- package/esri-compat/query.d.ts.map +1 -0
- package/esri-compat/query.js +119 -0
- package/esri-compat/reactive-utils.d.ts +23 -0
- package/esri-compat/reactive-utils.d.ts.map +1 -0
- package/esri-compat/reactive-utils.js +178 -0
- package/esri-compat/request.d.ts +41 -0
- package/esri-compat/request.d.ts.map +1 -0
- package/esri-compat/request.js +253 -0
- package/esri-compat/route-layer.d.ts +59 -0
- package/esri-compat/route-layer.d.ts.map +1 -0
- package/esri-compat/route-layer.js +223 -0
- package/esri-compat/route-task.d.ts +88 -0
- package/esri-compat/route-task.d.ts.map +1 -0
- package/esri-compat/route-task.js +225 -0
- package/esri-compat/scene-view.d.ts +41 -0
- package/esri-compat/scene-view.d.ts.map +1 -0
- package/esri-compat/scene-view.js +68 -0
- package/esri-compat/search.d.ts +112 -0
- package/esri-compat/search.d.ts.map +1 -0
- package/esri-compat/search.js +820 -0
- package/esri-compat/simple-fill-symbol.d.ts +27 -0
- package/esri-compat/simple-fill-symbol.d.ts.map +1 -0
- package/esri-compat/simple-fill-symbol.js +85 -0
- package/esri-compat/simple-line-symbol.d.ts +27 -0
- package/esri-compat/simple-line-symbol.d.ts.map +1 -0
- package/esri-compat/simple-line-symbol.js +85 -0
- package/esri-compat/simple-marker-symbol.d.ts +29 -0
- package/esri-compat/simple-marker-symbol.d.ts.map +1 -0
- package/esri-compat/simple-marker-symbol.js +92 -0
- package/esri-compat/simple-renderer.d.ts +29 -0
- package/esri-compat/simple-renderer.d.ts.map +1 -0
- package/esri-compat/simple-renderer.js +92 -0
- package/esri-compat/sketch.d.ts +64 -0
- package/esri-compat/sketch.d.ts.map +1 -0
- package/esri-compat/sketch.js +227 -0
- package/esri-compat/spatial-reference.d.ts +31 -0
- package/esri-compat/spatial-reference.d.ts.map +1 -0
- package/esri-compat/spatial-reference.js +102 -0
- package/esri-compat/swipe.d.ts +34 -0
- package/esri-compat/swipe.d.ts.map +1 -0
- package/esri-compat/swipe.js +93 -0
- package/esri-compat/table-list.d.ts +36 -0
- package/esri-compat/table-list.d.ts.map +1 -0
- package/esri-compat/table-list.js +126 -0
- package/esri-compat/text-symbol.d.ts +37 -0
- package/esri-compat/text-symbol.d.ts.map +1 -0
- package/esri-compat/text-symbol.js +123 -0
- package/esri-compat/tile-layer.d.ts +52 -0
- package/esri-compat/tile-layer.d.ts.map +1 -0
- package/esri-compat/tile-layer.js +167 -0
- package/esri-compat/time-slider.d.ts +70 -0
- package/esri-compat/time-slider.d.ts.map +1 -0
- package/esri-compat/time-slider.js +208 -0
- package/esri-compat/track.d.ts +51 -0
- package/esri-compat/track.d.ts.map +1 -0
- package/esri-compat/track.js +174 -0
- package/esri-compat/unique-value-renderer.d.ts +41 -0
- package/esri-compat/unique-value-renderer.d.ts.map +1 -0
- package/esri-compat/unique-value-renderer.js +127 -0
- package/esri-compat/url.d.ts +12 -0
- package/esri-compat/url.d.ts.map +1 -0
- package/esri-compat/url.js +54 -0
- package/esri-compat/web-map.d.ts +14 -0
- package/esri-compat/web-map.d.ts.map +1 -0
- package/esri-compat/web-map.js +24 -0
- package/gen/honua/v1/feature_service_pb.d.ts +918 -0
- package/gen/honua/v1/feature_service_pb.d.ts.map +1 -0
- package/gen/honua/v1/feature_service_pb.js +375 -0
- package/index.d.ts +130 -0
- package/index.js +65 -0
- package/package.json +22 -0
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Protocol-neutral request and response shapes for indexed spatial aggregation.
|
|
3
|
+
*
|
|
4
|
+
* This module is intentionally a contract surface only. It describes the
|
|
5
|
+
* request envelope SDKs send to a backend that can aggregate into indexed
|
|
6
|
+
* cells, and the response metadata apps need to build widgets and load
|
|
7
|
+
* progressively. The index model id is opaque so callers can work with H3,
|
|
8
|
+
* Quadbin, WebMercatorQuad, or a provider-specific grid without switching on
|
|
9
|
+
* one implementation.
|
|
10
|
+
*
|
|
11
|
+
* @module
|
|
12
|
+
*/
|
|
13
|
+
import type { SpatialFilter } from "../core/spatial-filter.js";
|
|
14
|
+
import type { HonuaExtent } from "../core/types.js";
|
|
15
|
+
import type { DegradedReason, SourceId } from "./types.js";
|
|
16
|
+
export declare const SPATIAL_AGGREGATION_SCHEMA_VERSION: "honua.spatial-aggregation.v1";
|
|
17
|
+
export declare const SPATIAL_AGGREGATION_METADATA_SCHEMA_VERSION: "honua.spatial-aggregation.metadata.v1";
|
|
18
|
+
export declare const SPATIAL_AGGREGATION_CAPABILITY: "spatialAggregate";
|
|
19
|
+
export type SpatialAggregationSummaryKind = "category" | "histogram" | "range" | "count" | "sum" | "avg" | "min" | "max";
|
|
20
|
+
export type SpatialAggregationMetricKind = Extract<SpatialAggregationSummaryKind, "count" | "sum" | "avg" | "min" | "max">;
|
|
21
|
+
export type SpatialAggregationValueType = "number" | "string" | "boolean" | "date" | "unknown";
|
|
22
|
+
export type SpatialAggregationCellGeometry = "none" | "centroid" | "extent" | "boundary";
|
|
23
|
+
export type SpatialAggregationWidgetKind = "stat" | "category-list" | "histogram" | "range-list" | "grouped-table";
|
|
24
|
+
export type SpatialAggregationProgressStatus = "complete" | "partial" | "estimated" | "streaming";
|
|
25
|
+
export type SpatialAggregationProgressRefinement = "append" | "replace" | "refine";
|
|
26
|
+
export interface SpatialAggregationViewport {
|
|
27
|
+
readonly extent: HonuaExtent;
|
|
28
|
+
readonly zoom?: number;
|
|
29
|
+
readonly width?: number;
|
|
30
|
+
readonly height?: number;
|
|
31
|
+
readonly devicePixelRatio?: number;
|
|
32
|
+
}
|
|
33
|
+
export interface SpatialAggregationResolutionInput {
|
|
34
|
+
/** Map zoom that should drive backend resolution selection. */
|
|
35
|
+
readonly zoom?: number;
|
|
36
|
+
/** Backend-native index resolution. Its meaning is index-model specific. */
|
|
37
|
+
readonly indexResolution?: number;
|
|
38
|
+
/** Preferred number of cells for the returned page or viewport. */
|
|
39
|
+
readonly targetCellCount?: number;
|
|
40
|
+
/** Hard cap the backend should not exceed without paging/refinement. */
|
|
41
|
+
readonly maxCellCount?: number;
|
|
42
|
+
readonly strategy?: "backend-default" | "fit-viewport" | "fixed-index-resolution";
|
|
43
|
+
}
|
|
44
|
+
export interface SpatialAggregationIndexSelection {
|
|
45
|
+
/** Opaque backend-advertised id, for example "h3" or "quadbin". */
|
|
46
|
+
readonly modelId?: string;
|
|
47
|
+
readonly geometry?: SpatialAggregationCellGeometry;
|
|
48
|
+
readonly allowApproximate?: boolean;
|
|
49
|
+
}
|
|
50
|
+
export interface SpatialAggregationPageRequest {
|
|
51
|
+
readonly cursor?: string;
|
|
52
|
+
readonly limit?: number;
|
|
53
|
+
}
|
|
54
|
+
export interface SpatialAggregationInclude {
|
|
55
|
+
readonly cells?: boolean;
|
|
56
|
+
readonly totals?: boolean;
|
|
57
|
+
readonly emptyCells?: boolean;
|
|
58
|
+
readonly metadata?: boolean;
|
|
59
|
+
}
|
|
60
|
+
export interface SpatialAggregationRequest {
|
|
61
|
+
readonly schemaVersion?: typeof SPATIAL_AGGREGATION_SCHEMA_VERSION;
|
|
62
|
+
readonly requestId?: string;
|
|
63
|
+
readonly sourceId: SourceId;
|
|
64
|
+
readonly where?: string;
|
|
65
|
+
readonly spatialFilter?: SpatialFilter;
|
|
66
|
+
readonly viewport?: SpatialAggregationViewport;
|
|
67
|
+
readonly resolution?: SpatialAggregationResolutionInput;
|
|
68
|
+
readonly index?: SpatialAggregationIndexSelection;
|
|
69
|
+
readonly summaries: readonly SpatialAggregationSummarySpec[];
|
|
70
|
+
readonly groupBy?: readonly SpatialAggregationGroupBySpec[];
|
|
71
|
+
readonly include?: SpatialAggregationInclude;
|
|
72
|
+
readonly page?: SpatialAggregationPageRequest;
|
|
73
|
+
readonly signal?: AbortSignal;
|
|
74
|
+
readonly metadata?: Readonly<Record<string, unknown>>;
|
|
75
|
+
}
|
|
76
|
+
export interface SpatialAggregationSummaryBase {
|
|
77
|
+
readonly id: string;
|
|
78
|
+
readonly title?: string;
|
|
79
|
+
readonly description?: string;
|
|
80
|
+
readonly field?: string;
|
|
81
|
+
readonly valueType?: SpatialAggregationValueType;
|
|
82
|
+
readonly unit?: string;
|
|
83
|
+
}
|
|
84
|
+
export interface SpatialAggregationCountSummarySpec extends SpatialAggregationSummaryBase {
|
|
85
|
+
readonly kind: "count";
|
|
86
|
+
readonly countDistinct?: boolean;
|
|
87
|
+
}
|
|
88
|
+
export interface SpatialAggregationCategorySummarySpec extends SpatialAggregationSummaryBase {
|
|
89
|
+
readonly kind: "category";
|
|
90
|
+
readonly field: string;
|
|
91
|
+
readonly limit?: number;
|
|
92
|
+
readonly includeOther?: boolean;
|
|
93
|
+
readonly orderBy?: "count-desc" | "count-asc" | "value-asc" | "value-desc";
|
|
94
|
+
}
|
|
95
|
+
export interface SpatialAggregationHistogramSummarySpec extends SpatialAggregationSummaryBase {
|
|
96
|
+
readonly kind: "histogram";
|
|
97
|
+
readonly field: string;
|
|
98
|
+
readonly bins?: number;
|
|
99
|
+
readonly min?: number;
|
|
100
|
+
readonly max?: number;
|
|
101
|
+
readonly method?: "equal-interval" | "quantile" | "custom";
|
|
102
|
+
}
|
|
103
|
+
export interface SpatialAggregationRangeSummarySpec extends SpatialAggregationSummaryBase {
|
|
104
|
+
readonly kind: "range";
|
|
105
|
+
readonly field: string;
|
|
106
|
+
readonly ranges: readonly SpatialAggregationRangeBucketSpec[];
|
|
107
|
+
}
|
|
108
|
+
export interface SpatialAggregationMetricSummarySpec extends SpatialAggregationSummaryBase {
|
|
109
|
+
readonly kind: Exclude<SpatialAggregationMetricKind, "count">;
|
|
110
|
+
readonly field: string;
|
|
111
|
+
}
|
|
112
|
+
export type SpatialAggregationSummarySpec = SpatialAggregationCountSummarySpec | SpatialAggregationCategorySummarySpec | SpatialAggregationHistogramSummarySpec | SpatialAggregationRangeSummarySpec | SpatialAggregationMetricSummarySpec;
|
|
113
|
+
export interface SpatialAggregationRangeBucketSpec {
|
|
114
|
+
readonly id: string;
|
|
115
|
+
readonly label?: string;
|
|
116
|
+
readonly min?: number;
|
|
117
|
+
readonly max?: number;
|
|
118
|
+
readonly includeMin?: boolean;
|
|
119
|
+
readonly includeMax?: boolean;
|
|
120
|
+
}
|
|
121
|
+
export interface SpatialAggregationGroupBySpec {
|
|
122
|
+
readonly field: string;
|
|
123
|
+
readonly alias?: string;
|
|
124
|
+
readonly label?: string;
|
|
125
|
+
readonly limit?: number;
|
|
126
|
+
readonly nullLabel?: string;
|
|
127
|
+
}
|
|
128
|
+
export interface SpatialAggregationIndexModelMetadata {
|
|
129
|
+
/** Opaque model id. Apps must not infer behavior from this string. */
|
|
130
|
+
readonly id: string;
|
|
131
|
+
readonly title?: string;
|
|
132
|
+
readonly description?: string;
|
|
133
|
+
readonly family?: string;
|
|
134
|
+
readonly cellIdEncoding?: "string" | "number" | "bigint" | "opaque";
|
|
135
|
+
readonly minResolution?: number;
|
|
136
|
+
readonly maxResolution?: number;
|
|
137
|
+
readonly supportedGeometry?: readonly SpatialAggregationCellGeometry[];
|
|
138
|
+
readonly hierarchy?: "parent-child" | "flat" | "unknown";
|
|
139
|
+
readonly spatialReference?: HonuaExtent["spatialReference"];
|
|
140
|
+
}
|
|
141
|
+
export interface SpatialAggregationIndexState {
|
|
142
|
+
readonly model: SpatialAggregationIndexModelMetadata;
|
|
143
|
+
readonly resolution?: number;
|
|
144
|
+
readonly requestedResolution?: SpatialAggregationResolutionInput;
|
|
145
|
+
readonly cellCount?: number;
|
|
146
|
+
readonly extent?: HonuaExtent;
|
|
147
|
+
}
|
|
148
|
+
export interface SpatialAggregationPageInfo {
|
|
149
|
+
readonly nextCursor?: string;
|
|
150
|
+
readonly loadedCellCount?: number;
|
|
151
|
+
readonly totalCellCount?: number;
|
|
152
|
+
}
|
|
153
|
+
export interface SpatialAggregationProgressiveState {
|
|
154
|
+
readonly status: SpatialAggregationProgressStatus;
|
|
155
|
+
readonly refinement?: SpatialAggregationProgressRefinement;
|
|
156
|
+
readonly nextCursor?: string;
|
|
157
|
+
readonly loadedCellCount?: number;
|
|
158
|
+
readonly totalCellCount?: number;
|
|
159
|
+
readonly loadedSummaryCount?: number;
|
|
160
|
+
readonly estimatedSummaryCount?: number;
|
|
161
|
+
}
|
|
162
|
+
export interface SpatialAggregationMetadata {
|
|
163
|
+
readonly schemaVersion?: typeof SPATIAL_AGGREGATION_METADATA_SCHEMA_VERSION;
|
|
164
|
+
readonly sourceId?: SourceId;
|
|
165
|
+
readonly indexModels?: readonly SpatialAggregationIndexModelMetadata[];
|
|
166
|
+
readonly summaries: readonly SpatialAggregationSummaryMetadata[];
|
|
167
|
+
readonly groupBy?: readonly SpatialAggregationGroupByMetadata[];
|
|
168
|
+
readonly widgets?: readonly SpatialAggregationWidgetMetadata[];
|
|
169
|
+
readonly progressive?: SpatialAggregationProgressiveState;
|
|
170
|
+
readonly cache?: SpatialAggregationCacheMetadata;
|
|
171
|
+
}
|
|
172
|
+
export interface SpatialAggregationCacheMetadata {
|
|
173
|
+
readonly metadataCacheable: boolean;
|
|
174
|
+
readonly resultCacheable: boolean;
|
|
175
|
+
readonly cacheKeyParts?: readonly string[];
|
|
176
|
+
readonly ttlMs?: number;
|
|
177
|
+
}
|
|
178
|
+
export interface SpatialAggregationSummaryMetadata {
|
|
179
|
+
readonly id: string;
|
|
180
|
+
readonly kind: SpatialAggregationSummaryKind;
|
|
181
|
+
readonly title?: string;
|
|
182
|
+
readonly field?: string;
|
|
183
|
+
readonly valueType?: SpatialAggregationValueType;
|
|
184
|
+
readonly unit?: string;
|
|
185
|
+
readonly domain?: readonly SpatialAggregationDomainValue[];
|
|
186
|
+
readonly ranges?: readonly SpatialAggregationRangeBucketSpec[];
|
|
187
|
+
readonly histogram?: {
|
|
188
|
+
readonly bins?: number;
|
|
189
|
+
readonly min?: number;
|
|
190
|
+
readonly max?: number;
|
|
191
|
+
readonly method?: SpatialAggregationHistogramSummarySpec["method"];
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
export interface SpatialAggregationGroupByMetadata {
|
|
195
|
+
readonly field: string;
|
|
196
|
+
readonly alias?: string;
|
|
197
|
+
readonly title?: string;
|
|
198
|
+
readonly valueType?: SpatialAggregationValueType;
|
|
199
|
+
readonly domain?: readonly SpatialAggregationDomainValue[];
|
|
200
|
+
}
|
|
201
|
+
export interface SpatialAggregationDomainValue {
|
|
202
|
+
readonly value: string | number | boolean | null;
|
|
203
|
+
readonly label?: string;
|
|
204
|
+
readonly color?: string;
|
|
205
|
+
}
|
|
206
|
+
export interface SpatialAggregationWidgetMetadata {
|
|
207
|
+
readonly id: string;
|
|
208
|
+
readonly kind: SpatialAggregationWidgetKind;
|
|
209
|
+
readonly title?: string;
|
|
210
|
+
readonly summaryId?: string;
|
|
211
|
+
readonly summaryIds?: readonly string[];
|
|
212
|
+
readonly field?: string;
|
|
213
|
+
readonly groupBy?: readonly string[];
|
|
214
|
+
readonly valueType?: SpatialAggregationValueType;
|
|
215
|
+
readonly unit?: string;
|
|
216
|
+
readonly interactions?: readonly ("filter" | "drilldown" | "highlight")[];
|
|
217
|
+
readonly progressive?: {
|
|
218
|
+
readonly stableAcrossPages: boolean;
|
|
219
|
+
readonly partialValueSemantics: SpatialAggregationProgressRefinement;
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
export interface SpatialAggregationResult {
|
|
223
|
+
readonly schemaVersion: typeof SPATIAL_AGGREGATION_SCHEMA_VERSION;
|
|
224
|
+
readonly requestId?: string;
|
|
225
|
+
readonly sourceId: SourceId;
|
|
226
|
+
readonly generatedAt?: string;
|
|
227
|
+
readonly index: SpatialAggregationIndexState;
|
|
228
|
+
readonly metadata: SpatialAggregationMetadata;
|
|
229
|
+
readonly cells: readonly SpatialAggregationCell[];
|
|
230
|
+
readonly totals?: SpatialAggregationSummaryBag;
|
|
231
|
+
readonly groups?: readonly SpatialAggregationGroupedSummary[];
|
|
232
|
+
readonly page?: SpatialAggregationPageInfo;
|
|
233
|
+
readonly degraded?: readonly DegradedReason[];
|
|
234
|
+
}
|
|
235
|
+
export interface SpatialAggregationCell {
|
|
236
|
+
readonly id: string;
|
|
237
|
+
readonly parentId?: string;
|
|
238
|
+
readonly resolution?: number;
|
|
239
|
+
readonly extent?: HonuaExtent;
|
|
240
|
+
readonly centroid?: readonly [number, number];
|
|
241
|
+
readonly geometry?: Record<string, unknown> | null;
|
|
242
|
+
readonly summaries: SpatialAggregationSummaryBag;
|
|
243
|
+
readonly groups?: readonly SpatialAggregationGroupedSummary[];
|
|
244
|
+
readonly partial?: boolean;
|
|
245
|
+
}
|
|
246
|
+
export type SpatialAggregationSummaryBag = Readonly<Record<string, SpatialAggregationSummaryValue>>;
|
|
247
|
+
export interface SpatialAggregationGroupedSummary {
|
|
248
|
+
readonly key: Readonly<Record<string, string | number | boolean | null>>;
|
|
249
|
+
readonly label?: string;
|
|
250
|
+
readonly summaries: SpatialAggregationSummaryBag;
|
|
251
|
+
}
|
|
252
|
+
export type SpatialAggregationSummaryValue = SpatialAggregationCountValue | SpatialAggregationMetricValue | SpatialAggregationCategoryValue | SpatialAggregationHistogramValue | SpatialAggregationRangeValue;
|
|
253
|
+
export interface SpatialAggregationCountValue {
|
|
254
|
+
readonly kind: "count";
|
|
255
|
+
readonly value: number;
|
|
256
|
+
readonly approximate?: boolean;
|
|
257
|
+
}
|
|
258
|
+
export interface SpatialAggregationMetricValue {
|
|
259
|
+
readonly kind: Exclude<SpatialAggregationMetricKind, "count">;
|
|
260
|
+
readonly value: number | null;
|
|
261
|
+
readonly unit?: string;
|
|
262
|
+
readonly approximate?: boolean;
|
|
263
|
+
}
|
|
264
|
+
export interface SpatialAggregationCategoryValue {
|
|
265
|
+
readonly kind: "category";
|
|
266
|
+
readonly buckets: readonly SpatialAggregationCategoryBucket[];
|
|
267
|
+
readonly otherCount?: number;
|
|
268
|
+
readonly nullCount?: number;
|
|
269
|
+
readonly approximate?: boolean;
|
|
270
|
+
}
|
|
271
|
+
export interface SpatialAggregationCategoryBucket {
|
|
272
|
+
readonly value: string | number | boolean | null;
|
|
273
|
+
readonly label?: string;
|
|
274
|
+
readonly count: number;
|
|
275
|
+
readonly color?: string;
|
|
276
|
+
}
|
|
277
|
+
export interface SpatialAggregationHistogramValue {
|
|
278
|
+
readonly kind: "histogram";
|
|
279
|
+
readonly buckets: readonly SpatialAggregationHistogramBucket[];
|
|
280
|
+
readonly approximate?: boolean;
|
|
281
|
+
}
|
|
282
|
+
export interface SpatialAggregationHistogramBucket {
|
|
283
|
+
readonly min: number;
|
|
284
|
+
readonly max: number;
|
|
285
|
+
readonly count: number;
|
|
286
|
+
readonly includeMin?: boolean;
|
|
287
|
+
readonly includeMax?: boolean;
|
|
288
|
+
}
|
|
289
|
+
export interface SpatialAggregationRangeValue {
|
|
290
|
+
readonly kind: "range";
|
|
291
|
+
readonly buckets: readonly SpatialAggregationRangeBucketValue[];
|
|
292
|
+
readonly approximate?: boolean;
|
|
293
|
+
}
|
|
294
|
+
export interface SpatialAggregationRangeBucketValue extends SpatialAggregationRangeBucketSpec {
|
|
295
|
+
readonly count: number;
|
|
296
|
+
}
|
|
297
|
+
export interface SpatialAggregationValidationIssue {
|
|
298
|
+
readonly path: string;
|
|
299
|
+
readonly message: string;
|
|
300
|
+
}
|
|
301
|
+
export interface SpatialAggregationContractFixture {
|
|
302
|
+
readonly schemaVersion: 1;
|
|
303
|
+
readonly request: SpatialAggregationRequest;
|
|
304
|
+
readonly response: SpatialAggregationResult;
|
|
305
|
+
}
|
|
306
|
+
export declare function spatialAggregationSummaryKindRequiresField(kind: SpatialAggregationSummaryKind): boolean;
|
|
307
|
+
export declare function validateSpatialAggregationRequest(request: SpatialAggregationRequest): readonly SpatialAggregationValidationIssue[];
|
|
308
|
+
export declare function assertValidSpatialAggregationRequest(request: SpatialAggregationRequest): void;
|
|
309
|
+
export declare function spatialAggregationWidgets(input: SpatialAggregationResult | SpatialAggregationMetadata): readonly SpatialAggregationWidgetMetadata[];
|
|
310
|
+
export declare function spatialAggregationProgress(input: SpatialAggregationResult | SpatialAggregationMetadata): SpatialAggregationProgressiveState;
|
|
311
|
+
export declare function isSpatialAggregationComplete(input: SpatialAggregationResult | SpatialAggregationMetadata): boolean;
|
|
312
|
+
//# sourceMappingURL=spatial-aggregation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spatial-aggregation.d.ts","sourceRoot":"","sources":["../../../src/contract/spatial-aggregation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,KAAK,E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
3
|
+
*
|
|
4
|
+
* This module is intentionally a contract surface only. It describes the
|
|
5
|
+
* request envelope SDKs send to a backend that can aggregate into indexed
|
|
6
|
+
* cells, and the response metadata apps need to build widgets and load
|
|
7
|
+
* progressively. The index model id is opaque so callers can work with H3,
|
|
8
|
+
* Quadbin, WebMercatorQuad, or a provider-specific grid without switching on
|
|
9
|
+
* one implementation.
|
|
10
|
+
*
|
|
11
|
+
* @module
|
|
12
|
+
*/
|
|
13
|
+
export const SPATIAL_AGGREGATION_SCHEMA_VERSION = "honua.spatial-aggregation.v1";
|
|
14
|
+
export const SPATIAL_AGGREGATION_METADATA_SCHEMA_VERSION = "honua.spatial-aggregation.metadata.v1";
|
|
15
|
+
export const SPATIAL_AGGREGATION_CAPABILITY = "spatialAggregate";
|
|
16
|
+
export function spatialAggregationSummaryKindRequiresField(kind) {
|
|
17
|
+
return kind !== "count";
|
|
18
|
+
}
|
|
19
|
+
export function validateSpatialAggregationRequest(request) {
|
|
20
|
+
const issues = [];
|
|
21
|
+
if (!isNonEmptyString(request.sourceId)) {
|
|
22
|
+
issues.push({ path: "sourceId", message: "sourceId is required" });
|
|
23
|
+
}
|
|
24
|
+
if (request.summaries.length === 0) {
|
|
25
|
+
issues.push({ path: "summaries", message: "at least one summary is required" });
|
|
26
|
+
}
|
|
27
|
+
const summaryIds = new Set();
|
|
28
|
+
request.summaries.forEach((summary, index) => {
|
|
29
|
+
const path = `summaries[${index}]`;
|
|
30
|
+
if (!isNonEmptyString(summary.id)) {
|
|
31
|
+
issues.push({ path: `${path}.id`, message: "summary id is required" });
|
|
32
|
+
}
|
|
33
|
+
else if (summaryIds.has(summary.id)) {
|
|
34
|
+
issues.push({ path: `${path}.id`, message: `duplicate summary id "${summary.id}"` });
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
summaryIds.add(summary.id);
|
|
38
|
+
}
|
|
39
|
+
if (spatialAggregationSummaryKindRequiresField(summary.kind) && !isNonEmptyString(summary.field)) {
|
|
40
|
+
issues.push({ path: `${path}.field`, message: `${summary.kind} summaries require a field` });
|
|
41
|
+
}
|
|
42
|
+
if (summary.kind === "histogram") {
|
|
43
|
+
if (summary.bins !== undefined && !isPositiveInteger(summary.bins)) {
|
|
44
|
+
issues.push({ path: `${path}.bins`, message: "histogram bins must be a positive integer" });
|
|
45
|
+
}
|
|
46
|
+
if (summary.min !== undefined && summary.max !== undefined && summary.min >= summary.max) {
|
|
47
|
+
issues.push({ path: `${path}.max`, message: "histogram max must be greater than min" });
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
if (summary.kind === "range") {
|
|
51
|
+
if (summary.ranges.length === 0) {
|
|
52
|
+
issues.push({ path: `${path}.ranges`, message: "range summaries require at least one range" });
|
|
53
|
+
}
|
|
54
|
+
summary.ranges.forEach((range, rangeIndex) => {
|
|
55
|
+
if (!isNonEmptyString(range.id)) {
|
|
56
|
+
issues.push({ path: `${path}.ranges[${rangeIndex}].id`, message: "range id is required" });
|
|
57
|
+
}
|
|
58
|
+
if (range.min !== undefined && range.max !== undefined && range.min >= range.max) {
|
|
59
|
+
issues.push({ path: `${path}.ranges[${rangeIndex}].max`, message: "range max must be greater than min" });
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
request.groupBy?.forEach((group, index) => {
|
|
65
|
+
if (!isNonEmptyString(group.field)) {
|
|
66
|
+
issues.push({ path: `groupBy[${index}].field`, message: "group field is required" });
|
|
67
|
+
}
|
|
68
|
+
if (group.limit !== undefined && !isPositiveInteger(group.limit)) {
|
|
69
|
+
issues.push({ path: `groupBy[${index}].limit`, message: "group limit must be a positive integer" });
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
const viewport = request.viewport;
|
|
73
|
+
if (viewport) {
|
|
74
|
+
if (viewport.zoom !== undefined && !isNonNegativeFinite(viewport.zoom)) {
|
|
75
|
+
issues.push({ path: "viewport.zoom", message: "viewport zoom must be a non-negative number" });
|
|
76
|
+
}
|
|
77
|
+
if (viewport.width !== undefined && !isPositiveFinite(viewport.width)) {
|
|
78
|
+
issues.push({ path: "viewport.width", message: "viewport width must be greater than zero" });
|
|
79
|
+
}
|
|
80
|
+
if (viewport.height !== undefined && !isPositiveFinite(viewport.height)) {
|
|
81
|
+
issues.push({ path: "viewport.height", message: "viewport height must be greater than zero" });
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
const resolution = request.resolution;
|
|
85
|
+
if (resolution) {
|
|
86
|
+
if (resolution.zoom !== undefined && !isNonNegativeFinite(resolution.zoom)) {
|
|
87
|
+
issues.push({ path: "resolution.zoom", message: "resolution zoom must be a non-negative number" });
|
|
88
|
+
}
|
|
89
|
+
if (resolution.indexResolution !== undefined && !isNonNegativeFinite(resolution.indexResolution)) {
|
|
90
|
+
issues.push({
|
|
91
|
+
path: "resolution.indexResolution",
|
|
92
|
+
message: "index resolution must be a non-negative number",
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
if (resolution.targetCellCount !== undefined && !isPositiveInteger(resolution.targetCellCount)) {
|
|
96
|
+
issues.push({ path: "resolution.targetCellCount", message: "target cell count must be a positive integer" });
|
|
97
|
+
}
|
|
98
|
+
if (resolution.maxCellCount !== undefined && !isPositiveInteger(resolution.maxCellCount)) {
|
|
99
|
+
issues.push({ path: "resolution.maxCellCount", message: "max cell count must be a positive integer" });
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
if (request.page?.limit !== undefined && !isPositiveInteger(request.page.limit)) {
|
|
103
|
+
issues.push({ path: "page.limit", message: "page limit must be a positive integer" });
|
|
104
|
+
}
|
|
105
|
+
return issues;
|
|
106
|
+
}
|
|
107
|
+
export function assertValidSpatialAggregationRequest(request) {
|
|
108
|
+
const issues = validateSpatialAggregationRequest(request);
|
|
109
|
+
if (issues.length > 0) {
|
|
110
|
+
const details = issues.map((issue) => `${issue.path}: ${issue.message}`).join("; ");
|
|
111
|
+
throw new Error(`Invalid spatial aggregation request: ${details}`);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
export function spatialAggregationWidgets(input) {
|
|
115
|
+
const metadata = "metadata" in input ? input.metadata : input;
|
|
116
|
+
if (metadata.widgets && metadata.widgets.length > 0)
|
|
117
|
+
return metadata.widgets;
|
|
118
|
+
const widgets = metadata.summaries.map(summaryToWidget);
|
|
119
|
+
if (metadata.groupBy && metadata.groupBy.length > 0) {
|
|
120
|
+
widgets.push({
|
|
121
|
+
id: "grouped-summaries",
|
|
122
|
+
kind: "grouped-table",
|
|
123
|
+
title: "Grouped summaries",
|
|
124
|
+
summaryIds: metadata.summaries.map((summary) => summary.id),
|
|
125
|
+
groupBy: metadata.groupBy.map((group) => group.alias ?? group.field),
|
|
126
|
+
interactions: ["filter", "drilldown"],
|
|
127
|
+
progressive: {
|
|
128
|
+
stableAcrossPages: false,
|
|
129
|
+
partialValueSemantics: "refine",
|
|
130
|
+
},
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
return widgets;
|
|
134
|
+
}
|
|
135
|
+
export function spatialAggregationProgress(input) {
|
|
136
|
+
const metadata = "metadata" in input ? input.metadata : input;
|
|
137
|
+
if (metadata.progressive)
|
|
138
|
+
return metadata.progressive;
|
|
139
|
+
if ("page" in input && input.page?.nextCursor) {
|
|
140
|
+
return {
|
|
141
|
+
status: "partial",
|
|
142
|
+
refinement: "append",
|
|
143
|
+
nextCursor: input.page.nextCursor,
|
|
144
|
+
loadedCellCount: input.page.loadedCellCount ?? input.cells.length,
|
|
145
|
+
totalCellCount: input.page.totalCellCount,
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
return {
|
|
149
|
+
status: "complete",
|
|
150
|
+
loadedCellCount: "cells" in input ? input.cells.length : undefined,
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
export function isSpatialAggregationComplete(input) {
|
|
154
|
+
const progress = spatialAggregationProgress(input);
|
|
155
|
+
return progress.status === "complete" && !progress.nextCursor;
|
|
156
|
+
}
|
|
157
|
+
function summaryToWidget(summary) {
|
|
158
|
+
return {
|
|
159
|
+
id: `${summary.id}-widget`,
|
|
160
|
+
kind: widgetKindForSummary(summary.kind),
|
|
161
|
+
title: summary.title,
|
|
162
|
+
summaryId: summary.id,
|
|
163
|
+
field: summary.field,
|
|
164
|
+
valueType: summary.valueType,
|
|
165
|
+
unit: summary.unit,
|
|
166
|
+
interactions: summary.kind === "count" ? ["highlight"] : ["filter", "highlight"],
|
|
167
|
+
progressive: {
|
|
168
|
+
stableAcrossPages: summary.kind !== "histogram" && summary.kind !== "range",
|
|
169
|
+
partialValueSemantics: "refine",
|
|
170
|
+
},
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
function widgetKindForSummary(kind) {
|
|
174
|
+
switch (kind) {
|
|
175
|
+
case "category":
|
|
176
|
+
return "category-list";
|
|
177
|
+
case "histogram":
|
|
178
|
+
return "histogram";
|
|
179
|
+
case "range":
|
|
180
|
+
return "range-list";
|
|
181
|
+
default:
|
|
182
|
+
return "stat";
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
function isNonEmptyString(value) {
|
|
186
|
+
return typeof value === "string" && value.trim().length > 0;
|
|
187
|
+
}
|
|
188
|
+
function isPositiveFinite(value) {
|
|
189
|
+
return Number.isFinite(value) && value > 0;
|
|
190
|
+
}
|
|
191
|
+
function isNonNegativeFinite(value) {
|
|
192
|
+
return Number.isFinite(value) && value >= 0;
|
|
193
|
+
}
|
|
194
|
+
function isPositiveInteger(value) {
|
|
195
|
+
return Number.isInteger(value) && value > 0;
|
|
196
|
+
}
|