@honua/react 0.0.20-alpha.0 → 0.1.1-beta.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/contract/discovery.d.ts +231 -0
- package/contract/discovery.d.ts.map +1 -0
- package/contract/discovery.js +554 -0
- package/contract/edit-sketch.d.ts +8 -0
- package/contract/edit-sketch.d.ts.map +1 -1
- package/contract/edit-sketch.js +15 -0
- package/contract/edit-snapping.d.ts +160 -0
- package/contract/edit-snapping.d.ts.map +1 -0
- package/contract/edit-snapping.js +675 -0
- package/contract/generated/projjson-v0.7-crs-validator.d.ts +35 -0
- package/contract/generated/projjson-v0.7-crs-validator.d.ts.map +1 -0
- package/contract/generated/projjson-v0.7-crs-validator.js +3941 -0
- package/contract/index.d.ts +12 -1
- package/contract/index.d.ts.map +1 -1
- package/contract/index.js +4 -0
- package/contract/pmtiles.d.ts +193 -0
- package/contract/pmtiles.d.ts.map +1 -0
- package/contract/pmtiles.js +195 -0
- package/contract/protocol-module.d.ts +70 -0
- package/contract/protocol-module.d.ts.map +1 -0
- package/contract/protocol-module.js +1 -0
- package/contract/schema-envelope.d.ts +26 -0
- package/contract/schema-envelope.d.ts.map +1 -0
- package/contract/schema-envelope.js +25 -0
- package/contract/schema.d.ts +582 -0
- package/contract/schema.d.ts.map +1 -0
- package/contract/schema.js +2483 -0
- package/contract/source-capability-support.d.ts +6 -0
- package/contract/source-capability-support.d.ts.map +1 -0
- package/contract/source-capability-support.js +154 -0
- package/contract/source.d.ts +57 -15
- package/contract/source.d.ts.map +1 -1
- package/contract/source.js +368 -65
- package/contract/types.d.ts +171 -6
- package/contract/types.d.ts.map +1 -1
- package/contract/types.js +14 -14
- package/core/auth/client-credentials-provider.d.ts +51 -0
- package/core/auth/client-credentials-provider.d.ts.map +1 -0
- package/core/auth/client-credentials-provider.js +115 -0
- package/core/auth/credential-store.d.ts +52 -0
- package/core/auth/credential-store.d.ts.map +1 -0
- package/core/auth/credential-store.js +82 -0
- package/core/auth/index.d.ts +23 -0
- package/core/auth/index.d.ts.map +1 -0
- package/core/auth/index.js +20 -0
- package/core/auth/oauth2-provider.d.ts +114 -0
- package/core/auth/oauth2-provider.d.ts.map +1 -0
- package/core/auth/oauth2-provider.js +408 -0
- package/core/auth/pkce.d.ts +25 -0
- package/core/auth/pkce.d.ts.map +1 -0
- package/core/auth/pkce.js +46 -0
- package/core/auth/static-providers.d.ts +20 -0
- package/core/auth/static-providers.d.ts.map +1 -0
- package/core/auth/static-providers.js +26 -0
- package/core/auth/token-endpoint.d.ts +40 -0
- package/core/auth/token-endpoint.d.ts.map +1 -0
- package/core/auth/token-endpoint.js +133 -0
- package/core/auth/types.d.ts +144 -0
- package/core/auth/types.d.ts.map +1 -0
- package/core/auth/types.js +8 -0
- package/core/bounded-json.d.ts +4 -0
- package/core/bounded-json.d.ts.map +1 -0
- package/core/bounded-json.js +38 -0
- package/core/cache-state.d.ts +9 -0
- package/core/cache-state.d.ts.map +1 -1
- package/core/cache-state.js +10 -0
- package/core/capabilities-xml.d.ts +33 -0
- package/core/capabilities-xml.d.ts.map +1 -0
- package/core/capabilities-xml.js +331 -0
- package/core/client.d.ts +35 -2
- package/core/client.d.ts.map +1 -1
- package/core/client.js +167 -29
- package/core/error-classifications.d.ts +153 -0
- package/core/error-classifications.d.ts.map +1 -0
- package/core/error-classifications.js +140 -0
- package/core/error-code-registry.d.ts +158 -0
- package/core/error-code-registry.d.ts.map +1 -0
- package/core/error-code-registry.js +143 -0
- package/core/error-envelope.d.ts +68 -0
- package/core/error-envelope.d.ts.map +1 -0
- package/core/error-envelope.js +357 -0
- package/core/errors.d.ts +73 -25
- package/core/errors.d.ts.map +1 -1
- package/core/errors.js +113 -46
- package/core/geoparquet-sql.d.ts +190 -0
- package/core/geoparquet-sql.d.ts.map +1 -0
- package/core/geoparquet-sql.js +368 -0
- package/core/odata-key-path.d.ts +12 -0
- package/core/odata-key-path.d.ts.map +1 -0
- package/core/odata-key-path.js +28 -0
- package/core/odata-write-codec.d.ts +66 -0
- package/core/odata-write-codec.d.ts.map +1 -0
- package/core/odata-write-codec.js +1083 -0
- package/core/odata.d.ts +59 -7
- package/core/odata.d.ts.map +1 -1
- package/core/odata.js +431 -99
- package/core/ogc-endpoint-layout.d.ts +70 -0
- package/core/ogc-endpoint-layout.d.ts.map +1 -0
- package/core/ogc-endpoint-layout.js +173 -0
- package/core/ogc-features.d.ts.map +1 -1
- package/core/ogc-features.js +35 -17
- package/core/ogc-maps.d.ts +7 -0
- package/core/ogc-maps.d.ts.map +1 -1
- package/core/ogc-maps.js +46 -7
- package/core/ogc-processes.d.ts +2 -1
- package/core/ogc-processes.d.ts.map +1 -1
- package/core/ogc-processes.js +33 -5
- package/core/ogc-records.d.ts +9 -0
- package/core/ogc-records.d.ts.map +1 -1
- package/core/ogc-records.js +78 -29
- package/core/ogc-tiles.d.ts +10 -1
- package/core/ogc-tiles.d.ts.map +1 -1
- package/core/ogc-tiles.js +56 -17
- package/core/path-utils.d.ts +9 -0
- package/core/path-utils.d.ts.map +1 -1
- package/core/path-utils.js +19 -0
- package/core/protocol-transport.d.ts +1 -0
- package/core/protocol-transport.d.ts.map +1 -1
- package/core/request-pipeline.d.ts.map +1 -1
- package/core/request-pipeline.js +1 -1
- package/core/spatial-filter.d.ts +8 -4
- package/core/spatial-filter.d.ts.map +1 -1
- package/core/spatial-filter.js +206 -16
- package/core/stac-static.d.ts +55 -0
- package/core/stac-static.d.ts.map +1 -0
- package/core/stac-static.js +386 -0
- package/core/stac.d.ts +12 -0
- package/core/stac.d.ts.map +1 -1
- package/core/stac.js +45 -15
- package/core/surfaces.d.ts +13 -0
- package/core/surfaces.d.ts.map +1 -1
- package/core/surfaces.js +127 -16
- package/core/types.d.ts +174 -7
- package/core/types.d.ts.map +1 -1
- package/core/wfs-capabilities.d.ts +12 -0
- package/core/wfs-capabilities.d.ts.map +1 -1
- package/core/wfs-capabilities.js +22 -3
- package/core/wfs.d.ts +13 -0
- package/core/wfs.d.ts.map +1 -1
- package/core/wfs.js +35 -5
- package/core/wms-capabilities.d.ts +56 -84
- package/core/wms-capabilities.d.ts.map +1 -1
- package/core/wms-capabilities.js +212 -509
- package/core/wmts-capabilities.d.ts +62 -62
- package/core/wmts-capabilities.d.ts.map +1 -1
- package/core/wmts-capabilities.js +224 -371
- package/esri-compat/editor.d.ts +8 -0
- package/esri-compat/editor.d.ts.map +1 -1
- package/esri-compat/editor.js +13 -0
- package/esri-compat/feature-layer.d.ts +2 -0
- package/esri-compat/feature-layer.d.ts.map +1 -1
- package/esri-compat/feature-layer.js +1 -0
- package/esri-compat/identity-manager.d.ts +43 -0
- package/esri-compat/identity-manager.d.ts.map +1 -1
- package/esri-compat/identity-manager.js +131 -1
- package/esri-compat/layer-list.d.ts +11 -0
- package/esri-compat/layer-list.d.ts.map +1 -1
- package/esri-compat/layer-list.js +49 -0
- package/esri-compat/legend.d.ts +10 -0
- package/esri-compat/legend.d.ts.map +1 -1
- package/esri-compat/legend.js +27 -0
- package/esri-compat/oauth-info.d.ts +15 -0
- package/esri-compat/oauth-info.d.ts.map +1 -1
- package/esri-compat/oauth-info.js +27 -0
- package/esri-compat/portal.d.ts +197 -0
- package/esri-compat/portal.d.ts.map +1 -0
- package/esri-compat/portal.js +251 -0
- package/esri-compat/renderer-objects.d.ts +40 -0
- package/esri-compat/renderer-objects.d.ts.map +1 -0
- package/esri-compat/renderer-objects.js +62 -0
- package/esri-compat/sketch.d.ts +43 -0
- package/esri-compat/sketch.d.ts.map +1 -1
- package/esri-compat/sketch.js +46 -0
- package/esri-compat/snapping.d.ts +43 -0
- package/esri-compat/snapping.d.ts.map +1 -0
- package/esri-compat/snapping.js +45 -0
- package/esri-compat/url.d.ts.map +1 -1
- package/esri-compat/url.js +1 -1
- package/esri-compat/widget-host.d.ts +84 -0
- package/esri-compat/widget-host.d.ts.map +1 -0
- package/esri-compat/widget-host.js +159 -0
- package/filter-registry/index.d.ts +145 -0
- package/filter-registry/index.d.ts.map +1 -0
- package/filter-registry/index.js +531 -0
- package/generated-app/errors.d.ts +18 -2
- package/generated-app/errors.d.ts.map +1 -1
- package/generated-app/errors.js +44 -11
- package/map/automatic-mount-integration.d.ts +134 -0
- package/map/automatic-mount-integration.d.ts.map +1 -0
- package/map/automatic-mount-integration.js +305 -0
- package/map/automatic-source-strategy.d.ts +125 -0
- package/map/automatic-source-strategy.d.ts.map +1 -0
- package/map/automatic-source-strategy.js +494 -0
- package/map/data-to-map-bridge.d.ts +293 -0
- package/map/data-to-map-bridge.d.ts.map +1 -0
- package/map/data-to-map-bridge.js +817 -0
- package/map/geojson-projection.d.ts +33 -0
- package/map/geojson-projection.d.ts.map +1 -0
- package/map/geojson-projection.js +118 -0
- package/map/index.d.ts +14 -0
- package/map/index.d.ts.map +1 -1
- package/map/index.js +8 -0
- package/map/raster-source-spec.d.ts +30 -0
- package/map/raster-source-spec.d.ts.map +1 -0
- package/map/raster-source-spec.js +190 -0
- package/map/raster-source-strategy.d.ts +65 -0
- package/map/raster-source-strategy.d.ts.map +1 -0
- package/map/raster-source-strategy.js +232 -0
- package/map/source-to-maplibre.d.ts +91 -0
- package/map/source-to-maplibre.d.ts.map +1 -0
- package/map/source-to-maplibre.js +454 -0
- package/map/temporal-playback.d.ts +139 -0
- package/map/temporal-playback.d.ts.map +1 -0
- package/map/temporal-playback.js +247 -0
- package/package.json +19 -1
- package/query-planner/canonical.d.ts +7 -0
- package/query-planner/canonical.d.ts.map +1 -0
- package/query-planner/canonical.js +145 -0
- package/query-planner/cql2-json.d.ts +17 -0
- package/query-planner/cql2-json.d.ts.map +1 -0
- package/query-planner/cql2-json.js +646 -0
- package/query-planner/diagnostics.d.ts +35 -0
- package/query-planner/diagnostics.d.ts.map +1 -0
- package/query-planner/diagnostics.js +373 -0
- package/query-planner/duckdb.d.ts +79 -0
- package/query-planner/duckdb.d.ts.map +1 -0
- package/query-planner/duckdb.js +758 -0
- package/query-planner/execution-context.d.ts +5 -0
- package/query-planner/execution-context.d.ts.map +1 -0
- package/query-planner/execution-context.js +50 -0
- package/query-planner/executor.d.ts +5 -0
- package/query-planner/executor.d.ts.map +1 -0
- package/query-planner/executor.js +223 -0
- package/query-planner/geoservices.d.ts +91 -0
- package/query-planner/geoservices.d.ts.map +1 -0
- package/query-planner/geoservices.js +667 -0
- package/query-planner/grpc.d.ts +100 -0
- package/query-planner/grpc.d.ts.map +1 -0
- package/query-planner/grpc.js +736 -0
- package/query-planner/index.d.ts +44 -0
- package/query-planner/index.d.ts.map +1 -0
- package/query-planner/index.js +30 -0
- package/query-planner/ir.d.ts +20 -0
- package/query-planner/ir.d.ts.map +1 -0
- package/query-planner/ir.js +417 -0
- package/query-planner/local-aggregate.d.ts +5 -0
- package/query-planner/local-aggregate.d.ts.map +1 -0
- package/query-planner/local-aggregate.js +126 -0
- package/query-planner/odata.d.ts +48 -0
- package/query-planner/odata.d.ts.map +1 -0
- package/query-planner/odata.js +662 -0
- package/query-planner/ogc-compiler.d.ts +55 -0
- package/query-planner/ogc-compiler.d.ts.map +1 -0
- package/query-planner/ogc-compiler.js +480 -0
- package/query-planner/ogc-features.d.ts +53 -0
- package/query-planner/ogc-features.d.ts.map +1 -0
- package/query-planner/ogc-features.js +617 -0
- package/query-planner/planner.d.ts +17 -0
- package/query-planner/planner.d.ts.map +1 -0
- package/query-planner/planner.js +818 -0
- package/query-planner/resource.d.ts +94 -0
- package/query-planner/resource.d.ts.map +1 -0
- package/query-planner/resource.js +526 -0
- package/query-planner/semantic-canonical.d.ts +15 -0
- package/query-planner/semantic-canonical.d.ts.map +1 -0
- package/query-planner/semantic-canonical.js +62 -0
- package/query-planner/semantic-compat.d.ts +10 -0
- package/query-planner/semantic-compat.d.ts.map +1 -0
- package/query-planner/semantic-compat.js +35 -0
- package/query-planner/semantic-compiler.d.ts +64 -0
- package/query-planner/semantic-compiler.d.ts.map +1 -0
- package/query-planner/semantic-compiler.js +81 -0
- package/query-planner/semantic-literals.d.ts +30 -0
- package/query-planner/semantic-literals.d.ts.map +1 -0
- package/query-planner/semantic-literals.js +133 -0
- package/query-planner/semantic-types.d.ts +265 -0
- package/query-planner/semantic-types.d.ts.map +1 -0
- package/query-planner/semantic-types.js +1 -0
- package/query-planner/semantic.d.ts +54 -0
- package/query-planner/semantic.d.ts.map +1 -0
- package/query-planner/semantic.js +1421 -0
- package/query-planner/types.d.ts +560 -0
- package/query-planner/types.d.ts.map +1 -0
- package/query-planner/types.js +49 -0
- package/query-planner/wfs-semantic.d.ts +58 -0
- package/query-planner/wfs-semantic.d.ts.map +1 -0
- package/query-planner/wfs-semantic.js +547 -0
- package/query-planner/wfs.d.ts +6 -0
- package/query-planner/wfs.d.ts.map +1 -0
- package/query-planner/wfs.js +71 -0
- package/react/external-map.d.ts +67 -0
- package/react/external-map.d.ts.map +1 -0
- package/react/external-map.js +63 -0
- package/react/honua-map.d.ts.map +1 -1
- package/react/honua-map.js +3 -2
- package/react/honua-source-layer.d.ts +110 -0
- package/react/honua-source-layer.d.ts.map +1 -0
- package/react/honua-source-layer.js +101 -0
- package/react/hooks.d.ts +28 -0
- package/react/hooks.d.ts.map +1 -1
- package/react/hooks.js +26 -4
- package/react/index.d.ts +8 -0
- package/react/index.d.ts.map +1 -1
- package/react/index.js +5 -0
- package/react/query-cache.d.ts +26 -4
- package/react/query-cache.d.ts.map +1 -1
- package/react/query-cache.js +51 -8
- package/react/selection.d.ts +177 -0
- package/react/selection.d.ts.map +1 -0
- package/react/selection.js +0 -0
- package/react/use-mounted-source.d.ts +69 -0
- package/react/use-mounted-source.d.ts.map +1 -0
- package/react/use-mounted-source.js +346 -0
- package/runtime/edit-snapping.d.ts +107 -0
- package/runtime/edit-snapping.d.ts.map +1 -0
- package/runtime/edit-snapping.js +190 -0
- package/runtime/errors.d.ts +3 -2
- package/runtime/errors.d.ts.map +1 -1
- package/runtime/errors.js +19 -2
- package/runtime/index.d.ts +8 -2
- package/runtime/index.d.ts.map +1 -1
- package/runtime/index.js +4 -4
- package/runtime/load-package.d.ts.map +1 -1
- package/runtime/load-package.js +8 -0
- package/runtime/map-package-validation.d.ts +0 -13
- package/runtime/map-package-validation.d.ts.map +1 -1
- package/runtime/map-package-validation.js +0 -12
- package/runtime/map-package.d.ts +1 -1
- package/runtime/map-package.d.ts.map +1 -1
- package/runtime/maplibre-renderer.d.ts +41 -0
- package/runtime/maplibre-renderer.d.ts.map +1 -0
- package/runtime/maplibre-renderer.js +322 -0
- package/runtime/pmtiles-protocol.d.ts +77 -0
- package/runtime/pmtiles-protocol.d.ts.map +1 -0
- package/runtime/pmtiles-protocol.js +120 -0
- package/runtime/query-tiles.d.ts +2 -1
- package/runtime/query-tiles.d.ts.map +1 -1
- package/runtime/query-tiles.js +6 -2
- package/runtime/source-bridge.d.ts +4 -4
- package/runtime/source-bridge.d.ts.map +1 -1
- package/runtime/source-bridge.js +36 -56
- package/runtime/style-interactions.d.ts +3 -2
- package/runtime/style-interactions.d.ts.map +1 -1
- package/runtime/style-interactions.js +11 -3
- package/runtime/terra-draw-sketch.d.ts +275 -0
- package/runtime/terra-draw-sketch.d.ts.map +1 -0
- package/runtime/terra-draw-sketch.js +404 -0
- package/source-capability-registry.d.ts +1 -0
- package/source-capability-registry.js +1 -0
- package/source-capability-types.d.ts +186 -0
- package/source-capability-types.js +7 -0
- package/style/index.d.ts +2 -0
- package/style/index.d.ts.map +1 -1
- package/style/index.js +2 -0
- package/style/renderers.d.ts +326 -0
- package/style/renderers.d.ts.map +1 -0
- package/style/renderers.js +517 -0
- package/webmap/convert-renderer.d.ts +24 -3
- package/webmap/convert-renderer.d.ts.map +1 -1
- package/webmap/convert-renderer.js +93 -112
- package/webmap/index.d.ts +1 -1
- package/webmap/index.d.ts.map +1 -1
- package/webmap/index.js +1 -1
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { HonuaAbortError } from "../core/errors.js";
|
|
2
|
+
export function aggregateLocally(features, aggregation, output, signal) {
|
|
3
|
+
throwIfLocalAggregationAborted(signal);
|
|
4
|
+
const groupKeys = aggregation.groupBy ?? [];
|
|
5
|
+
const rows = groupKeys.length === 0
|
|
6
|
+
? [computeMetrics(features, aggregation.metrics, signal)]
|
|
7
|
+
: aggregateGroups(features, groupKeys, aggregation.metrics, signal);
|
|
8
|
+
throwIfLocalAggregationAborted(signal);
|
|
9
|
+
const ordered = output.orderBy && output.orderBy.length > 0 ? [...rows].sort(rowComparator(output.orderBy, signal)) : rows;
|
|
10
|
+
throwIfLocalAggregationAborted(signal);
|
|
11
|
+
const offset = output.pagination?.offset ?? 0;
|
|
12
|
+
const limit = output.pagination?.limit;
|
|
13
|
+
return limit === undefined ? ordered.slice(offset) : ordered.slice(offset, offset + limit);
|
|
14
|
+
}
|
|
15
|
+
function aggregateGroups(features, groupKeys, metrics, signal) {
|
|
16
|
+
const groups = new Map();
|
|
17
|
+
for (let index = 0; index < features.length; index += 1) {
|
|
18
|
+
if ((index & 255) === 0)
|
|
19
|
+
throwIfLocalAggregationAborted(signal);
|
|
20
|
+
const feature = features[index];
|
|
21
|
+
if (!feature)
|
|
22
|
+
continue;
|
|
23
|
+
const key = JSON.stringify(groupKeys.map((field) => readField(feature.attributes, field)));
|
|
24
|
+
const bucket = groups.get(key);
|
|
25
|
+
if (bucket)
|
|
26
|
+
bucket.push(feature);
|
|
27
|
+
else
|
|
28
|
+
groups.set(key, [feature]);
|
|
29
|
+
}
|
|
30
|
+
return Array.from(groups.values(), (bucket, index) => {
|
|
31
|
+
if ((index & 255) === 0)
|
|
32
|
+
throwIfLocalAggregationAborted(signal);
|
|
33
|
+
const row = {};
|
|
34
|
+
for (const field of groupKeys)
|
|
35
|
+
row[field] = readField(bucket[0]?.attributes, field);
|
|
36
|
+
return Object.assign(row, computeMetrics(bucket, metrics, signal));
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
function computeMetrics(features, metrics, signal) {
|
|
40
|
+
const output = {};
|
|
41
|
+
for (let metricIndex = 0; metricIndex < metrics.length; metricIndex += 1) {
|
|
42
|
+
throwIfLocalAggregationAborted(signal);
|
|
43
|
+
const metric = metrics[metricIndex];
|
|
44
|
+
if (!metric)
|
|
45
|
+
continue;
|
|
46
|
+
const alias = metric.alias ?? `${metric.fn}_${metric.field}`;
|
|
47
|
+
const values = [];
|
|
48
|
+
for (let featureIndex = 0; featureIndex < features.length; featureIndex += 1) {
|
|
49
|
+
if ((featureIndex & 255) === 0)
|
|
50
|
+
throwIfLocalAggregationAborted(signal);
|
|
51
|
+
const feature = features[featureIndex];
|
|
52
|
+
if (!feature)
|
|
53
|
+
continue;
|
|
54
|
+
const value = readField(feature.attributes, metric.field);
|
|
55
|
+
if (typeof value === "number" && Number.isFinite(value))
|
|
56
|
+
values.push(value);
|
|
57
|
+
}
|
|
58
|
+
output[alias] = applyAggregation(metric.fn, values, features.length);
|
|
59
|
+
}
|
|
60
|
+
return output;
|
|
61
|
+
}
|
|
62
|
+
function applyAggregation(fn, values, totalRows) {
|
|
63
|
+
if (fn === "count")
|
|
64
|
+
return totalRows;
|
|
65
|
+
if (values.length === 0)
|
|
66
|
+
return 0;
|
|
67
|
+
switch (fn) {
|
|
68
|
+
case "sum":
|
|
69
|
+
return values.reduce((sum, value) => sum + value, 0);
|
|
70
|
+
case "avg":
|
|
71
|
+
return values.reduce((sum, value) => sum + value, 0) / values.length;
|
|
72
|
+
case "min":
|
|
73
|
+
return Math.min(...values);
|
|
74
|
+
case "max":
|
|
75
|
+
return Math.max(...values);
|
|
76
|
+
case "stddev":
|
|
77
|
+
case "var": {
|
|
78
|
+
const mean = values.reduce((sum, value) => sum + value, 0) / values.length;
|
|
79
|
+
const variance = values.reduce((sum, value) => sum + (value - mean) ** 2, 0) / values.length;
|
|
80
|
+
return fn === "var" ? variance : Math.sqrt(variance);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
function rowComparator(orderBy, signal) {
|
|
85
|
+
let comparisons = 0;
|
|
86
|
+
return (left, right) => {
|
|
87
|
+
comparisons += 1;
|
|
88
|
+
if ((comparisons & 255) === 0)
|
|
89
|
+
throwIfLocalAggregationAborted(signal);
|
|
90
|
+
for (const sort of orderBy) {
|
|
91
|
+
const comparison = compareValues(left[sort.field], right[sort.field]);
|
|
92
|
+
if (comparison !== 0)
|
|
93
|
+
return sort.direction === "desc" ? -comparison : comparison;
|
|
94
|
+
}
|
|
95
|
+
return 0;
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
function throwIfLocalAggregationAborted(signal) {
|
|
99
|
+
if (!signal)
|
|
100
|
+
return;
|
|
101
|
+
try {
|
|
102
|
+
if (signal.aborted)
|
|
103
|
+
throw new HonuaAbortError();
|
|
104
|
+
}
|
|
105
|
+
catch (error) {
|
|
106
|
+
if (error instanceof HonuaAbortError)
|
|
107
|
+
throw error;
|
|
108
|
+
throw new HonuaAbortError();
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
function compareValues(left, right) {
|
|
112
|
+
if (left === right)
|
|
113
|
+
return 0;
|
|
114
|
+
if (left === null || left === undefined)
|
|
115
|
+
return -1;
|
|
116
|
+
if (right === null || right === undefined)
|
|
117
|
+
return 1;
|
|
118
|
+
if (typeof left === "number" && typeof right === "number")
|
|
119
|
+
return left - right;
|
|
120
|
+
return String(left).localeCompare(String(right));
|
|
121
|
+
}
|
|
122
|
+
function readField(attributes, field) {
|
|
123
|
+
if (attributes === null || typeof attributes !== "object")
|
|
124
|
+
return undefined;
|
|
125
|
+
return attributes[field];
|
|
126
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { ExecutableCrsBinding, SourceSchemaV2 } from "../contract/schema.js";
|
|
2
|
+
import { type SemanticCompilationResult } from "./semantic-compiler.js";
|
|
3
|
+
import { type SemanticCompilerFieldMapping } from "./semantic-literals.js";
|
|
4
|
+
import type { SemanticQuery, SourceSpatiality } from "./semantic-types.js";
|
|
5
|
+
import type { CanonicalQuery, OdataCompiledQueryV1, QueryIrSourceIdentity } from "./types.js";
|
|
6
|
+
/** Compile canonical query IR to a deterministic OData v4 entity-set request. */
|
|
7
|
+
export declare function compileOdataQuery(source: QueryIrSourceIdentity, query: CanonicalQuery): OdataCompiledQueryV1;
|
|
8
|
+
export type SemanticOdataSpatialFunction = "geo.intersects" | "geo.distance";
|
|
9
|
+
/** Static, credential-free OData endpoint evidence used by the semantic compiler. */
|
|
10
|
+
export interface SemanticOdataSourceIdentity {
|
|
11
|
+
readonly entitySet: string;
|
|
12
|
+
readonly sourceVersion?: string;
|
|
13
|
+
/** Spatial functions explicitly advertised or certified for this service. */
|
|
14
|
+
readonly supportedSpatialFunctions?: readonly SemanticOdataSpatialFunction[];
|
|
15
|
+
}
|
|
16
|
+
export interface SemanticOdataCompileOptions<TRecord = Record<string, unknown>, TSpatiality extends SourceSpatiality = SourceSpatiality> {
|
|
17
|
+
readonly query: SemanticQuery<TRecord, "odata", TSpatiality>;
|
|
18
|
+
readonly schema: SourceSchemaV2;
|
|
19
|
+
readonly source: SemanticOdataSourceIdentity;
|
|
20
|
+
}
|
|
21
|
+
export interface SemanticOdataOutputGeometry {
|
|
22
|
+
readonly field: string;
|
|
23
|
+
readonly propertyPath: string;
|
|
24
|
+
readonly spatialType: "geography" | "geometry";
|
|
25
|
+
readonly crs: ExecutableCrsBinding;
|
|
26
|
+
readonly layout: "xy";
|
|
27
|
+
}
|
|
28
|
+
/** Canonical pre-image of an OData v4 entity-set request. */
|
|
29
|
+
export interface SemanticOdataCompiledQueryV1 {
|
|
30
|
+
readonly compiler: "odata-v4-semantic-query-v1";
|
|
31
|
+
readonly dialect: "odata-4.0";
|
|
32
|
+
readonly schemaFingerprint: SourceSchemaV2["fingerprint"];
|
|
33
|
+
readonly queryFingerprint: `sha256:${string}`;
|
|
34
|
+
readonly requestFingerprint: `sha256:${string}`;
|
|
35
|
+
readonly entitySet: string;
|
|
36
|
+
readonly sourceVersion?: string;
|
|
37
|
+
readonly filter?: string;
|
|
38
|
+
readonly select: readonly string[];
|
|
39
|
+
readonly orderBy?: readonly string[];
|
|
40
|
+
readonly skip?: number;
|
|
41
|
+
readonly top?: number;
|
|
42
|
+
readonly outputGeometry?: SemanticOdataOutputGeometry;
|
|
43
|
+
readonly fieldMappings: readonly SemanticCompilerFieldMapping[];
|
|
44
|
+
readonly usesNativeFilter: boolean;
|
|
45
|
+
}
|
|
46
|
+
/** Compile a validated semantic AST to exact OData v4 system query options. */
|
|
47
|
+
export declare function compileSemanticOdataQuery<TRecord, TSpatiality extends SourceSpatiality>(options: SemanticOdataCompileOptions<TRecord, TSpatiality>): SemanticCompilationResult<SemanticOdataCompiledQueryV1>;
|
|
48
|
+
//# sourceMappingURL=odata.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"odata.d.ts","sourceRoot":"","sources":["../../../src/query-planner/odata.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAGV,oBAAoB,EAOpB,cAAc,EACf,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAEL,KAAK,yBAAyB,EAO/B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,KAAK,4BAA4B,EAWlC,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAe,aAAa,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACxF,OAAO,KAAK,EAAE,cAAc,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAG9F,iFAAiF;AACjF,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,qBAAqB,EAAE,KAAK,EAAE,cAAc,GAAG,oBAAoB,CAoF5G;AAmFD,MAAM,MAAM,4BAA4B,GAAG,gBAAgB,GAAG,cAAc,CAAC;AAE7E,qFAAqF;AACrF,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC,6EAA6E;IAC7E,QAAQ,CAAC,yBAAyB,CAAC,EAAE,SAAS,4BAA4B,EAAE,CAAC;CAC9E;AAED,MAAM,WAAW,2BAA2B,CAC1C,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACjC,WAAW,SAAS,gBAAgB,GAAG,gBAAgB;IAEvD,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC,OAAO,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC;IAC7D,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAChC,QAAQ,CAAC,MAAM,EAAE,2BAA2B,CAAC;CAC9C;AAED,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,WAAW,EAAE,WAAW,GAAG,UAAU,CAAC;IAC/C,QAAQ,CAAC,GAAG,EAAE,oBAAoB,CAAC;IACnC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC;CACvB;AAED,6DAA6D;AAC7D,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,QAAQ,EAAE,4BAA4B,CAAC;IAChD,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;IAC9B,QAAQ,CAAC,iBAAiB,EAAE,cAAc,CAAC,aAAa,CAAC,CAAC;IAC1D,QAAQ,CAAC,gBAAgB,EAAE,UAAU,MAAM,EAAE,CAAC;IAC9C,QAAQ,CAAC,kBAAkB,EAAE,UAAU,MAAM,EAAE,CAAC;IAChD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,cAAc,CAAC,EAAE,2BAA2B,CAAC;IACtD,QAAQ,CAAC,aAAa,EAAE,SAAS,4BAA4B,EAAE,CAAC;IAChE,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAC;CACpC;AA0BD,+EAA+E;AAC/E,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,WAAW,SAAS,gBAAgB,EACrF,OAAO,EAAE,2BAA2B,CAAC,OAAO,EAAE,WAAW,CAAC,GACzD,yBAAyB,CAAC,4BAA4B,CAAC,CA4CzD"}
|