@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,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OGC API endpoint-layout resolution.
|
|
3
|
+
*
|
|
4
|
+
* The SDK's headline claim is one typed contract against ANY standards
|
|
5
|
+
* server. For OGC API Features / Records that means the client must not
|
|
6
|
+
* assume a fixed path prefix: a Honua Server mounts the facade at
|
|
7
|
+
* `/ogc/features/...`, but pygeoapi, ldproxy, and GeoServer's OGC API each
|
|
8
|
+
* serve the landing page at their own root and advertise their collections
|
|
9
|
+
* and conformance URLs through the landing page's `links` array
|
|
10
|
+
* (OGC API - Common Requirement 5).
|
|
11
|
+
*
|
|
12
|
+
* This module produces an {@link OgcEndpointLayout} — the concrete set of
|
|
13
|
+
* resource paths a Features client addresses:
|
|
14
|
+
*
|
|
15
|
+
* - {@link honuaFacadeFeaturesLayout} is the fixed facade layout and the
|
|
16
|
+
* default. It performs no network round-trips, so existing callers see
|
|
17
|
+
* zero behaviour change.
|
|
18
|
+
* - {@link resolveOgcEndpointLayout} discovers the layout from the landing
|
|
19
|
+
* page (`ogc-api` mode) or auto-detects the facade first and falls back
|
|
20
|
+
* to discovery (`auto` mode).
|
|
21
|
+
*
|
|
22
|
+
* Per OGC API - Features Requirement 17 the items resource is always at
|
|
23
|
+
* `{collections}/{collectionId}/items`, so a single landing-page fetch is
|
|
24
|
+
* enough to derive every per-collection path from the discovered
|
|
25
|
+
* collections URL.
|
|
26
|
+
*
|
|
27
|
+
* @module
|
|
28
|
+
*/
|
|
29
|
+
import type { HonuaProtocolTransport } from "./protocol-transport.js";
|
|
30
|
+
import type { OgcEndpointLayout } from "./types.js";
|
|
31
|
+
/** Discovery mode carried on a source locator. */
|
|
32
|
+
export type OgcApiLayoutMode = "honua-facade" | "ogc-api" | "auto";
|
|
33
|
+
/**
|
|
34
|
+
* The Honua Server facade layout (`/ogc/features/...`). No network access;
|
|
35
|
+
* this is the default fast path and preserves the pre-existing behaviour of
|
|
36
|
+
* every OGC Features caller that points at a Honua Server.
|
|
37
|
+
*/
|
|
38
|
+
export declare function honuaFacadeFeaturesLayout(base?: string): OgcEndpointLayout;
|
|
39
|
+
/**
|
|
40
|
+
* A raw OGC API layout built from a discovered (or configured) landing +
|
|
41
|
+
* collections + conformance URL triple. Per-collection paths are templated
|
|
42
|
+
* off the collections URL per OGC API - Features Requirement 17.
|
|
43
|
+
*/
|
|
44
|
+
export declare function ogcApiFeaturesLayout(options: {
|
|
45
|
+
landingUrl: string;
|
|
46
|
+
collectionsUrl: string;
|
|
47
|
+
conformanceUrl: string;
|
|
48
|
+
}): OgcEndpointLayout;
|
|
49
|
+
/**
|
|
50
|
+
* Find the first link whose `rel` matches one of `rels` (exact or as the
|
|
51
|
+
* final path segment of a full OGC relation URI, e.g.
|
|
52
|
+
* `http://www.opengis.net/def/rel/ogc/1.0/data`).
|
|
53
|
+
*/
|
|
54
|
+
export declare function findOgcLink(links: ReadonlyArray<{
|
|
55
|
+
href?: string;
|
|
56
|
+
rel?: string;
|
|
57
|
+
}> | undefined, ...rels: string[]): string | undefined;
|
|
58
|
+
/**
|
|
59
|
+
* Resolve the endpoint layout for the requested `mode`:
|
|
60
|
+
*
|
|
61
|
+
* - `honua-facade` (default) — the fixed facade layout, no round-trips.
|
|
62
|
+
* - `ogc-api` — discover from the landing page at the client baseUrl.
|
|
63
|
+
* - `auto` — probe the facade landing; use it when valid, otherwise
|
|
64
|
+
* discover from the root.
|
|
65
|
+
*
|
|
66
|
+
* Discovery failures surface as {@link HonuaCapabilityNotSupportedError}
|
|
67
|
+
* (per the SDK convention of throwing rather than returning empty data).
|
|
68
|
+
*/
|
|
69
|
+
export declare function resolveOgcEndpointLayout(transport: HonuaProtocolTransport, mode?: OgcApiLayoutMode): Promise<OgcEndpointLayout>;
|
|
70
|
+
//# sourceMappingURL=ogc-endpoint-layout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ogc-endpoint-layout.d.ts","sourceRoot":"","sources":["../../../src/core/ogc-endpoint-layout.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAGH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,KAAK,EAA2B,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE7E,kDAAkD;AAClD,MAAM,MAAM,gBAAgB,GAAG,cAAc,GAAG,SAAS,GAAG,MAAM,CAAC;AAcnE;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,GAAE,MAA4B,GAAG,iBAAiB,CAY/F;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE;IAC5C,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;CACxB,GAAG,iBAAiB,CAiBpB;AAgBD;;;;GAIG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,aAAa,CAAC;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,GAAG,SAAS,EACjE,GAAG,IAAI,EAAE,MAAM,EAAE,GAChB,MAAM,GAAG,SAAS,CAWpB;AAyCD;;;;;;;;;;GAUG;AACH,wBAAsB,wBAAwB,CAC5C,SAAS,EAAE,sBAAsB,EACjC,IAAI,GAAE,gBAAiC,GACtC,OAAO,CAAC,iBAAiB,CAAC,CAe5B"}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OGC API endpoint-layout resolution.
|
|
3
|
+
*
|
|
4
|
+
* The SDK's headline claim is one typed contract against ANY standards
|
|
5
|
+
* server. For OGC API Features / Records that means the client must not
|
|
6
|
+
* assume a fixed path prefix: a Honua Server mounts the facade at
|
|
7
|
+
* `/ogc/features/...`, but pygeoapi, ldproxy, and GeoServer's OGC API each
|
|
8
|
+
* serve the landing page at their own root and advertise their collections
|
|
9
|
+
* and conformance URLs through the landing page's `links` array
|
|
10
|
+
* (OGC API - Common Requirement 5).
|
|
11
|
+
*
|
|
12
|
+
* This module produces an {@link OgcEndpointLayout} — the concrete set of
|
|
13
|
+
* resource paths a Features client addresses:
|
|
14
|
+
*
|
|
15
|
+
* - {@link honuaFacadeFeaturesLayout} is the fixed facade layout and the
|
|
16
|
+
* default. It performs no network round-trips, so existing callers see
|
|
17
|
+
* zero behaviour change.
|
|
18
|
+
* - {@link resolveOgcEndpointLayout} discovers the layout from the landing
|
|
19
|
+
* page (`ogc-api` mode) or auto-detects the facade first and falls back
|
|
20
|
+
* to discovery (`auto` mode).
|
|
21
|
+
*
|
|
22
|
+
* Per OGC API - Features Requirement 17 the items resource is always at
|
|
23
|
+
* `{collections}/{collectionId}/items`, so a single landing-page fetch is
|
|
24
|
+
* enough to derive every per-collection path from the discovered
|
|
25
|
+
* collections URL.
|
|
26
|
+
*
|
|
27
|
+
* @module
|
|
28
|
+
*/
|
|
29
|
+
import { HonuaCapabilityNotSupportedError } from "./errors.js";
|
|
30
|
+
const DEFAULT_FACADE_BASE = "/ogc/features";
|
|
31
|
+
function enc(id) {
|
|
32
|
+
return encodeURIComponent(String(id));
|
|
33
|
+
}
|
|
34
|
+
function trimTrailingSlash(url) {
|
|
35
|
+
let end = url.length;
|
|
36
|
+
while (end > 0 && url.charCodeAt(end - 1) === 0x2f)
|
|
37
|
+
end--;
|
|
38
|
+
return url.slice(0, end);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* The Honua Server facade layout (`/ogc/features/...`). No network access;
|
|
42
|
+
* this is the default fast path and preserves the pre-existing behaviour of
|
|
43
|
+
* every OGC Features caller that points at a Honua Server.
|
|
44
|
+
*/
|
|
45
|
+
export function honuaFacadeFeaturesLayout(base = DEFAULT_FACADE_BASE) {
|
|
46
|
+
const root = trimTrailingSlash(base) || DEFAULT_FACADE_BASE;
|
|
47
|
+
return {
|
|
48
|
+
mode: "honua-facade",
|
|
49
|
+
landing: () => root,
|
|
50
|
+
conformance: () => `${root}/conformance`,
|
|
51
|
+
collections: () => `${root}/collections`,
|
|
52
|
+
collection: (id) => `${root}/collections/${enc(id)}`,
|
|
53
|
+
queryables: (id) => `${root}/collections/${enc(id)}/queryables`,
|
|
54
|
+
items: (id) => `${root}/collections/${enc(id)}/items`,
|
|
55
|
+
item: (id, featureId) => `${root}/collections/${enc(id)}/items/${enc(featureId)}`,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* A raw OGC API layout built from a discovered (or configured) landing +
|
|
60
|
+
* collections + conformance URL triple. Per-collection paths are templated
|
|
61
|
+
* off the collections URL per OGC API - Features Requirement 17.
|
|
62
|
+
*/
|
|
63
|
+
export function ogcApiFeaturesLayout(options) {
|
|
64
|
+
const landing = trimTrailingSlash(options.landingUrl);
|
|
65
|
+
const collections = trimTrailingSlash(options.collectionsUrl);
|
|
66
|
+
const conformance = trimTrailingSlash(options.conformanceUrl);
|
|
67
|
+
return {
|
|
68
|
+
mode: "ogc-api",
|
|
69
|
+
// A bare landing path can be empty (the client baseUrl is the landing
|
|
70
|
+
// root); the wire layer still appends the `f=` param, producing
|
|
71
|
+
// `${baseUrl}?f=json`.
|
|
72
|
+
landing: () => landing,
|
|
73
|
+
conformance: () => conformance,
|
|
74
|
+
collections: () => collections,
|
|
75
|
+
collection: (id) => `${collections}/${enc(id)}`,
|
|
76
|
+
queryables: (id) => `${collections}/${enc(id)}/queryables`,
|
|
77
|
+
items: (id) => `${collections}/${enc(id)}/items`,
|
|
78
|
+
item: (id, featureId) => `${collections}/${enc(id)}/items/${enc(featureId)}`,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Resolve a link href to an absolute URL against a base. Absolute hrefs are
|
|
83
|
+
* returned unchanged; relative hrefs resolve against `${baseUrl}/`.
|
|
84
|
+
*/
|
|
85
|
+
function absolutize(href, baseUrl) {
|
|
86
|
+
if (/^https?:\/\//i.test(href))
|
|
87
|
+
return href;
|
|
88
|
+
const root = baseUrl.endsWith("/") ? baseUrl : `${baseUrl}/`;
|
|
89
|
+
try {
|
|
90
|
+
return new URL(href, root).toString();
|
|
91
|
+
}
|
|
92
|
+
catch {
|
|
93
|
+
return href;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Find the first link whose `rel` matches one of `rels` (exact or as the
|
|
98
|
+
* final path segment of a full OGC relation URI, e.g.
|
|
99
|
+
* `http://www.opengis.net/def/rel/ogc/1.0/data`).
|
|
100
|
+
*/
|
|
101
|
+
export function findOgcLink(links, ...rels) {
|
|
102
|
+
if (!links)
|
|
103
|
+
return undefined;
|
|
104
|
+
const wanted = new Set(rels.map((r) => r.toLowerCase()));
|
|
105
|
+
for (const link of links) {
|
|
106
|
+
if (typeof link.href !== "string" || link.href.length === 0)
|
|
107
|
+
continue;
|
|
108
|
+
const rel = (link.rel ?? "").toLowerCase();
|
|
109
|
+
if (wanted.has(rel))
|
|
110
|
+
return link.href;
|
|
111
|
+
const tail = rel.slice(rel.lastIndexOf("/") + 1);
|
|
112
|
+
if (tail && wanted.has(tail))
|
|
113
|
+
return link.href;
|
|
114
|
+
}
|
|
115
|
+
return undefined;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Discover an OGC API layout from the landing page. The client `baseUrl`
|
|
119
|
+
* IS the landing page root; the collections and conformance URLs are read
|
|
120
|
+
* from the landing `links` (falling back to the mandated relative
|
|
121
|
+
* `collections` / `conformance` sub-paths when a server omits them).
|
|
122
|
+
*/
|
|
123
|
+
async function discoverOgcApiLayout(transport) {
|
|
124
|
+
const landing = await transport.requestCachedMetadataJson("ogc-features:layout:landing", "?f=json", {});
|
|
125
|
+
const baseUrl = trimTrailingSlash(transport.baseUrl);
|
|
126
|
+
const links = landing?.links;
|
|
127
|
+
const dataHref = findOgcLink(links, "data");
|
|
128
|
+
const conformanceHref = findOgcLink(links, "conformance");
|
|
129
|
+
const collectionsUrl = dataHref ? absolutize(dataHref, baseUrl) : `${baseUrl}/collections`;
|
|
130
|
+
const conformanceUrl = conformanceHref ? absolutize(conformanceHref, baseUrl) : `${baseUrl}/conformance`;
|
|
131
|
+
return ogcApiFeaturesLayout({ landingUrl: baseUrl, collectionsUrl, conformanceUrl });
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Probe whether the Honua facade landing (`/ogc/features`) exists. Used by
|
|
135
|
+
* `auto` mode: a valid OGC landing document there confirms the facade
|
|
136
|
+
* fast path; anything else falls through to landing-page discovery.
|
|
137
|
+
*/
|
|
138
|
+
async function facadeLandingLooksValid(transport) {
|
|
139
|
+
try {
|
|
140
|
+
const landing = await transport.requestCachedMetadataJson("ogc-features:layout:facade-probe", `${DEFAULT_FACADE_BASE}?f=json`, {});
|
|
141
|
+
return Array.isArray(landing?.links);
|
|
142
|
+
}
|
|
143
|
+
catch {
|
|
144
|
+
return false;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Resolve the endpoint layout for the requested `mode`:
|
|
149
|
+
*
|
|
150
|
+
* - `honua-facade` (default) — the fixed facade layout, no round-trips.
|
|
151
|
+
* - `ogc-api` — discover from the landing page at the client baseUrl.
|
|
152
|
+
* - `auto` — probe the facade landing; use it when valid, otherwise
|
|
153
|
+
* discover from the root.
|
|
154
|
+
*
|
|
155
|
+
* Discovery failures surface as {@link HonuaCapabilityNotSupportedError}
|
|
156
|
+
* (per the SDK convention of throwing rather than returning empty data).
|
|
157
|
+
*/
|
|
158
|
+
export async function resolveOgcEndpointLayout(transport, mode = "honua-facade") {
|
|
159
|
+
if (mode === "honua-facade")
|
|
160
|
+
return honuaFacadeFeaturesLayout();
|
|
161
|
+
if (mode === "auto") {
|
|
162
|
+
if (await facadeLandingLooksValid(transport))
|
|
163
|
+
return honuaFacadeFeaturesLayout();
|
|
164
|
+
}
|
|
165
|
+
try {
|
|
166
|
+
return await discoverOgcApiLayout(transport);
|
|
167
|
+
}
|
|
168
|
+
catch (err) {
|
|
169
|
+
if (err instanceof HonuaCapabilityNotSupportedError)
|
|
170
|
+
throw err;
|
|
171
|
+
throw new HonuaCapabilityNotSupportedError("query", "ogc-features", `ogc-api layout discovery failed for ${transport.baseUrl}: ${err instanceof Error ? err.message : String(err)}`);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ogc-features.d.ts","sourceRoot":"","sources":["../../../src/core/ogc-features.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;
|
|
1
|
+
{"version":3,"file":"ogc-features.d.ts","sourceRoot":"","sources":["../../../src/core/ogc-features.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,KAAK,EACV,0BAA0B,EAC1B,2BAA2B,EAC3B,2BAA2B,EAC3B,iCAAiC,EACjC,uBAAuB,EACvB,uBAAuB,EACvB,0BAA0B,EAC1B,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EAEpB,cAAc,EACd,eAAe,EACf,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,EACtB,MAAM,YAAY,CAAC;AAoBpB,wBAAsB,qBAAqB,CACzC,SAAS,EAAE,sBAAsB,EACjC,OAAO,GAAE,kBAAuB,GAC/B,OAAO,CAAC,uBAAuB,CAAC,CAQlC;AAED,wBAAsB,yBAAyB,CAC7C,SAAS,EAAE,sBAAsB,EACjC,OAAO,GAAE,kBAAuB,GAC/B,OAAO,CAAC,2BAA2B,CAAC,CAQtC;AAED,wBAAsB,kBAAkB,CACtC,SAAS,EAAE,sBAAsB,EACjC,OAAO,GAAE,kBAAuB,GAC/B,OAAO,CAAC,2BAA2B,CAAC,CAQtC;AAED,wBAAsB,gBAAgB,CACpC,SAAS,EAAE,sBAAsB,EACjC,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,0BAA0B,CAAC,CAQrC;AAED,wBAAsB,gBAAgB,CACpC,SAAS,EAAE,sBAAsB,EACjC,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,0BAA0B,CAAC,CAQrC;AAED,wBAAsB,YAAY,CAChC,SAAS,EAAE,sBAAsB,EACjC,OAAO,EAAE,eAAe,GACvB,OAAO,CAAC,iCAAiC,CAAC,CAuC5C;AAED,wBAAsB,UAAU,CAC9B,SAAS,EAAE,sBAAsB,EACjC,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,uBAAuB,CAAC,CAYlC;AAED,wBAAsB,aAAa,CACjC,SAAS,EAAE,sBAAsB,EACjC,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,uBAAuB,CAAC,CAYlC;AAED,wBAAsB,cAAc,CAClC,SAAS,EAAE,sBAAsB,EACjC,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,uBAAuB,CAAC,CAelC;AAED,wBAAsB,YAAY,CAChC,SAAS,EAAE,sBAAsB,EACjC,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC,uBAAuB,CAAC,CAelC;AAED,wBAAsB,aAAa,CAAC,SAAS,EAAE,sBAAsB,EAAE,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CAOnH"}
|
package/core/ogc-features.js
CHANGED
|
@@ -7,28 +7,47 @@
|
|
|
7
7
|
*
|
|
8
8
|
* @module
|
|
9
9
|
*/
|
|
10
|
+
import { honuaFacadeFeaturesLayout } from "./ogc-endpoint-layout.js";
|
|
10
11
|
import { createOgcMetadataParams, mergeHeaders, normalizeCsv } from "./wire-shared.js";
|
|
12
|
+
/**
|
|
13
|
+
* The endpoint layout to build paths against. Defaults to the Honua facade
|
|
14
|
+
* fast path (`/ogc/features/...`); backend-agnostic callers thread a
|
|
15
|
+
* spec-discovered layout onto `request.layout`.
|
|
16
|
+
*/
|
|
17
|
+
function layoutOf(request) {
|
|
18
|
+
return request.layout ?? honuaFacadeFeaturesLayout();
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* A layout key fragment for cache keys so the facade and a discovered raw
|
|
22
|
+
* layout never collide in the metadata cache.
|
|
23
|
+
*/
|
|
24
|
+
function layoutKey(layout) {
|
|
25
|
+
return layout.mode === "honua-facade" ? "facade" : layout.collections();
|
|
26
|
+
}
|
|
11
27
|
export async function getOgcFeaturesLanding(transport, request = {}) {
|
|
12
28
|
const params = createOgcMetadataParams(request);
|
|
13
|
-
|
|
29
|
+
const layout = layoutOf(request);
|
|
30
|
+
return transport.requestCachedMetadataJson(`ogc-features:landing:${layoutKey(layout)}:${params.toString()}`, `${layout.landing()}?${params.toString()}`, request);
|
|
14
31
|
}
|
|
15
32
|
export async function getOgcFeaturesConformance(transport, request = {}) {
|
|
16
33
|
const params = createOgcMetadataParams(request);
|
|
17
|
-
|
|
34
|
+
const layout = layoutOf(request);
|
|
35
|
+
return transport.requestCachedMetadataJson(`ogc-features:conformance:${layoutKey(layout)}:${params.toString()}`, `${layout.conformance()}?${params.toString()}`, request);
|
|
18
36
|
}
|
|
19
37
|
export async function listOgcCollections(transport, request = {}) {
|
|
20
38
|
const params = createOgcMetadataParams(request);
|
|
21
|
-
|
|
39
|
+
const layout = layoutOf(request);
|
|
40
|
+
return transport.requestCachedMetadataJson(`ogc-features:collections:${layoutKey(layout)}:${params.toString()}`, `${layout.collections()}?${params.toString()}`, request);
|
|
22
41
|
}
|
|
23
42
|
export async function getOgcCollection(transport, request) {
|
|
24
43
|
const params = createOgcMetadataParams(request);
|
|
25
|
-
const
|
|
26
|
-
return transport.requestCachedMetadataJson(`ogc-features:collection:${request.collectionId}:${params.toString()}`, `${
|
|
44
|
+
const layout = layoutOf(request);
|
|
45
|
+
return transport.requestCachedMetadataJson(`ogc-features:collection:${layoutKey(layout)}:${request.collectionId}:${params.toString()}`, `${layout.collection(request.collectionId)}?${params.toString()}`, request);
|
|
27
46
|
}
|
|
28
47
|
export async function getOgcQueryables(transport, request) {
|
|
29
48
|
const params = createOgcMetadataParams(request);
|
|
30
|
-
const
|
|
31
|
-
return transport.requestCachedMetadataJson(`ogc-features:queryables:${request.collectionId}:${params.toString()}`, `${
|
|
49
|
+
const layout = layoutOf(request);
|
|
50
|
+
return transport.requestCachedMetadataJson(`ogc-features:queryables:${layoutKey(layout)}:${request.collectionId}:${params.toString()}`, `${layout.queryables(request.collectionId)}?${params.toString()}`, request);
|
|
32
51
|
}
|
|
33
52
|
export async function listOgcItems(transport, request) {
|
|
34
53
|
const params = createOgcMetadataParams(request);
|
|
@@ -47,6 +66,9 @@ export async function listOgcItems(transport, request) {
|
|
|
47
66
|
if (request.filter !== undefined) {
|
|
48
67
|
params.set("filter", request.filter);
|
|
49
68
|
}
|
|
69
|
+
if (request.filterLang !== undefined) {
|
|
70
|
+
params.set("filter-lang", request.filterLang);
|
|
71
|
+
}
|
|
50
72
|
if (request.ids !== undefined) {
|
|
51
73
|
params.set("ids", normalizeCsv(request.ids));
|
|
52
74
|
}
|
|
@@ -59,7 +81,7 @@ export async function listOgcItems(transport, request) {
|
|
|
59
81
|
if (request.crs !== undefined) {
|
|
60
82
|
params.set("crs", request.crs);
|
|
61
83
|
}
|
|
62
|
-
const path =
|
|
84
|
+
const path = layoutOf(request).items(request.collectionId);
|
|
63
85
|
return transport.requestJson("GET", `${path}?${params.toString()}`, undefined, request.signal);
|
|
64
86
|
}
|
|
65
87
|
export async function getOgcItem(transport, request) {
|
|
@@ -67,13 +89,12 @@ export async function getOgcItem(transport, request) {
|
|
|
67
89
|
if (request.crs !== undefined) {
|
|
68
90
|
params.set("crs", request.crs);
|
|
69
91
|
}
|
|
70
|
-
const path =
|
|
71
|
-
`/items/${encodeURIComponent(String(request.featureId))}`;
|
|
92
|
+
const path = layoutOf(request).item(request.collectionId, request.featureId);
|
|
72
93
|
return transport.requestJson("GET", `${path}?${params.toString()}`, undefined, request.signal);
|
|
73
94
|
}
|
|
74
95
|
export async function createOgcItem(transport, request) {
|
|
75
96
|
const params = createOgcMetadataParams(request);
|
|
76
|
-
const path =
|
|
97
|
+
const path = layoutOf(request).items(request.collectionId);
|
|
77
98
|
return transport.requestJson("POST", `${path}?${params.toString()}`, {
|
|
78
99
|
headers: mergeHeaders({ "Content-Type": "application/geo+json" }, request.headers),
|
|
79
100
|
body: JSON.stringify(request.feature),
|
|
@@ -84,8 +105,7 @@ export async function replaceOgcItem(transport, request) {
|
|
|
84
105
|
if (request.crs !== undefined) {
|
|
85
106
|
params.set("crs", request.crs);
|
|
86
107
|
}
|
|
87
|
-
const path =
|
|
88
|
-
`/items/${encodeURIComponent(String(request.featureId))}`;
|
|
108
|
+
const path = layoutOf(request).item(request.collectionId, request.featureId);
|
|
89
109
|
return transport.requestJson("PUT", `${path}?${params.toString()}`, {
|
|
90
110
|
headers: mergeHeaders({ "Content-Type": "application/geo+json" }, request.headers),
|
|
91
111
|
body: JSON.stringify(request.feature),
|
|
@@ -96,8 +116,7 @@ export async function patchOgcItem(transport, request) {
|
|
|
96
116
|
if (request.crs !== undefined) {
|
|
97
117
|
params.set("crs", request.crs);
|
|
98
118
|
}
|
|
99
|
-
const path =
|
|
100
|
-
`/items/${encodeURIComponent(String(request.featureId))}`;
|
|
119
|
+
const path = layoutOf(request).item(request.collectionId, request.featureId);
|
|
101
120
|
return transport.requestJson("PATCH", `${path}?${params.toString()}`, {
|
|
102
121
|
headers: mergeHeaders({ "Content-Type": "application/merge-patch+json" }, request.headers),
|
|
103
122
|
body: JSON.stringify(request.patch),
|
|
@@ -108,7 +127,6 @@ export async function deleteOgcItem(transport, request) {
|
|
|
108
127
|
if (request.crs !== undefined) {
|
|
109
128
|
params.set("crs", request.crs);
|
|
110
129
|
}
|
|
111
|
-
const path =
|
|
112
|
-
`/items/${encodeURIComponent(String(request.featureId))}`;
|
|
130
|
+
const path = layoutOf(request).item(request.collectionId, request.featureId);
|
|
113
131
|
await transport.requestJson("DELETE", `${path}?${params.toString()}`, undefined, request.signal);
|
|
114
132
|
}
|
package/core/ogc-maps.d.ts
CHANGED
|
@@ -12,11 +12,15 @@ import type { HonuaProtocolTransport } from "./protocol-transport.js";
|
|
|
12
12
|
import type { HonuaOgcConformanceResponse, HonuaOgcLandingResponse, HonuaOgcMapImageResponse, OgcMapImageRequest, OgcMetadataRequest } from "./types.js";
|
|
13
13
|
export interface HonuaOgcMapsOptions {
|
|
14
14
|
client: HonuaClient;
|
|
15
|
+
/** Raw endpoint path prefix (defaults to the Honua facade `/ogc/maps`). */
|
|
16
|
+
basePath?: string;
|
|
15
17
|
}
|
|
16
18
|
export interface HonuaOgcCollectionMapOptions {
|
|
17
19
|
client: HonuaClient;
|
|
18
20
|
collectionId: string | number;
|
|
19
21
|
styleId?: string;
|
|
22
|
+
/** Raw endpoint path prefix (defaults to the Honua facade `/ogc/maps`). */
|
|
23
|
+
basePath?: string;
|
|
20
24
|
}
|
|
21
25
|
export type HonuaOgcCollectionMapImageRequest = Omit<OgcMapImageRequest, "collectionId" | "styleId"> & {
|
|
22
26
|
styleId?: string;
|
|
@@ -24,7 +28,9 @@ export type HonuaOgcCollectionMapImageRequest = Omit<OgcMapImageRequest, "collec
|
|
|
24
28
|
/** Top-level OGC API Maps handle. */
|
|
25
29
|
export declare class HonuaOgcMaps {
|
|
26
30
|
readonly client: HonuaClient;
|
|
31
|
+
private readonly basePath;
|
|
27
32
|
constructor(options: HonuaOgcMapsOptions);
|
|
33
|
+
private withBase;
|
|
28
34
|
collection(collectionId: string | number, styleId?: string): HonuaOgcCollectionMap;
|
|
29
35
|
landing(request?: OgcMetadataRequest): Promise<HonuaOgcLandingResponse>;
|
|
30
36
|
conformance(request?: OgcMetadataRequest): Promise<HonuaOgcConformanceResponse>;
|
|
@@ -39,6 +45,7 @@ export declare class HonuaOgcCollectionMap {
|
|
|
39
45
|
readonly client: HonuaClient;
|
|
40
46
|
readonly collectionId: string | number;
|
|
41
47
|
readonly styleId: string | undefined;
|
|
48
|
+
private readonly basePath;
|
|
42
49
|
constructor(options: HonuaOgcCollectionMapOptions);
|
|
43
50
|
map(request?: HonuaOgcCollectionMapImageRequest): Promise<HonuaOgcMapImageResponse>;
|
|
44
51
|
}
|
package/core/ogc-maps.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ogc-maps.d.ts","sourceRoot":"","sources":["../../../src/core/ogc-maps.ts"],"names":[],"mappings":"AAAA;;;;;;;;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AAG,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,qBAAqB;IAS5E,OAAO,CAAC,OAAO,GAAE,kBAAuB,GAAG,OAAO,CAAC,uBAAuB,CAAC;IAI3E,WAAW,CAAC,OAAO,GAAE,kBAAuB,GAAG,OAAO,CAAC,2BAA2B,CAAC;IAIhG,mEAAmE;IACtD,GAAG,CAAC,OAAO,GAAE,kBAAuB,GAAG,OAAO,CAAC,wBAAwB,CAAC;CAGtF;AAED;;;GAGG;AACH,qBAAa,qBAAqB;IAChC,SAAgB,MAAM,EAAE,WAAW,CAAC;IACpC,SAAgB,YAAY,EAAE,MAAM,GAAG,MAAM,CAAC;IAC9C,SAAgB,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAqB;gBAE3B,OAAO,EAAE,4BAA4B;IAO3C,GAAG,CAAC,OAAO,GAAE,iCAAsC,GAAG,OAAO,CAAC,wBAAwB,CAAC;CAQrG;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,WAAW,GAAG,YAAY,CAEpE;AAID,wBAAsB,iBAAiB,CACrC,SAAS,EAAE,sBAAsB,EACjC,OAAO,GAAE,kBAAuB,GAC/B,OAAO,CAAC,uBAAuB,CAAC,CAQlC;AAED,wBAAsB,qBAAqB,CACzC,SAAS,EAAE,sBAAsB,EACjC,OAAO,GAAE,kBAAuB,GAC/B,OAAO,CAAC,2BAA2B,CAAC,CAQtC;AAED,wBAAsB,cAAc,CAClC,SAAS,EAAE,sBAAsB,EACjC,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,wBAAwB,CAAC,CASnC"}
|
package/core/ogc-maps.js
CHANGED
|
@@ -8,24 +8,58 @@
|
|
|
8
8
|
* @module
|
|
9
9
|
*/
|
|
10
10
|
import { createOgcMetadataParams } from "./wire-shared.js";
|
|
11
|
+
/** Honua facade path prefix for OGC API Maps. */
|
|
12
|
+
const MAPS_FACADE_BASE = "/ogc/maps";
|
|
13
|
+
/**
|
|
14
|
+
* Resolve the OGC API Maps path prefix: the caller-supplied raw `basePath` (a
|
|
15
|
+
* `connect()`-discovered third-party service root) or the Honua facade default.
|
|
16
|
+
* Trailing slashes are trimmed so a discovered root and the facade compose the
|
|
17
|
+
* same sub-paths. Mirrors the OGC API Records seam in `ogc-records.ts`.
|
|
18
|
+
*/
|
|
19
|
+
function mapsBase(request) {
|
|
20
|
+
// An omitted basePath uses the Honua facade; an explicit "" is a legitimate
|
|
21
|
+
// root-mounted raw service and must NOT fall back to the facade prefix.
|
|
22
|
+
if (request.basePath === undefined)
|
|
23
|
+
return MAPS_FACADE_BASE;
|
|
24
|
+
const base = request.basePath;
|
|
25
|
+
let end = base.length;
|
|
26
|
+
while (end > 0 && base.charCodeAt(end - 1) === 0x2f)
|
|
27
|
+
end--;
|
|
28
|
+
return base.slice(0, end);
|
|
29
|
+
}
|
|
30
|
+
/** Cache-key discriminator so a discovered root never collides with the facade. */
|
|
31
|
+
function mapsBaseKey(request) {
|
|
32
|
+
const base = mapsBase(request);
|
|
33
|
+
return base === MAPS_FACADE_BASE ? "" : `${base}:`;
|
|
34
|
+
}
|
|
11
35
|
/** Top-level OGC API Maps handle. */
|
|
12
36
|
export class HonuaOgcMaps {
|
|
13
37
|
client;
|
|
38
|
+
basePath;
|
|
14
39
|
constructor(options) {
|
|
15
40
|
this.client = options.client;
|
|
41
|
+
this.basePath = options.basePath;
|
|
42
|
+
}
|
|
43
|
+
withBase(request) {
|
|
44
|
+
return this.basePath !== undefined ? { ...request, basePath: this.basePath } : request;
|
|
16
45
|
}
|
|
17
46
|
collection(collectionId, styleId) {
|
|
18
|
-
return new HonuaOgcCollectionMap({
|
|
47
|
+
return new HonuaOgcCollectionMap({
|
|
48
|
+
client: this.client,
|
|
49
|
+
collectionId,
|
|
50
|
+
styleId,
|
|
51
|
+
...(this.basePath !== undefined ? { basePath: this.basePath } : {}),
|
|
52
|
+
});
|
|
19
53
|
}
|
|
20
54
|
async landing(request = {}) {
|
|
21
|
-
return this.client.getOgcMapsLanding(request);
|
|
55
|
+
return this.client.getOgcMapsLanding(this.withBase(request));
|
|
22
56
|
}
|
|
23
57
|
async conformance(request = {}) {
|
|
24
|
-
return this.client.getOgcMapsConformance(request);
|
|
58
|
+
return this.client.getOgcMapsConformance(this.withBase(request));
|
|
25
59
|
}
|
|
26
60
|
/** Render a dataset-level map (across one or more collections). */
|
|
27
61
|
async map(request = {}) {
|
|
28
|
-
return this.client.getOgcMapImage(request);
|
|
62
|
+
return this.client.getOgcMapImage(this.withBase(request));
|
|
29
63
|
}
|
|
30
64
|
}
|
|
31
65
|
/**
|
|
@@ -36,16 +70,19 @@ export class HonuaOgcCollectionMap {
|
|
|
36
70
|
client;
|
|
37
71
|
collectionId;
|
|
38
72
|
styleId;
|
|
73
|
+
basePath;
|
|
39
74
|
constructor(options) {
|
|
40
75
|
this.client = options.client;
|
|
41
76
|
this.collectionId = options.collectionId;
|
|
42
77
|
this.styleId = options.styleId;
|
|
78
|
+
this.basePath = options.basePath;
|
|
43
79
|
}
|
|
44
80
|
async map(request = {}) {
|
|
45
81
|
return this.client.getOgcMapImage({
|
|
46
82
|
...request,
|
|
47
83
|
collectionId: this.collectionId,
|
|
48
84
|
styleId: request.styleId ?? this.styleId,
|
|
85
|
+
...(this.basePath !== undefined ? { basePath: this.basePath } : {}),
|
|
49
86
|
});
|
|
50
87
|
}
|
|
51
88
|
}
|
|
@@ -55,17 +92,19 @@ export function createHonuaOgcMaps(client) {
|
|
|
55
92
|
// ── OGC API Maps wire methods ───────────────────────────────────
|
|
56
93
|
export async function getOgcMapsLanding(transport, request = {}) {
|
|
57
94
|
const params = createOgcMetadataParams(request);
|
|
58
|
-
|
|
95
|
+
const base = mapsBase(request);
|
|
96
|
+
return transport.requestCachedMetadataJson(`ogc-maps:landing:${mapsBaseKey(request)}${params.toString()}`, `${base}?${params.toString()}`, request);
|
|
59
97
|
}
|
|
60
98
|
export async function getOgcMapsConformance(transport, request = {}) {
|
|
61
99
|
const params = createOgcMetadataParams(request);
|
|
62
|
-
|
|
100
|
+
const base = mapsBase(request);
|
|
101
|
+
return transport.requestCachedMetadataJson(`ogc-maps:conformance:${mapsBaseKey(request)}${params.toString()}`, `${base}/conformance?${params.toString()}`, request);
|
|
63
102
|
}
|
|
64
103
|
export async function getOgcMapImage(transport, request) {
|
|
65
104
|
const params = serializeOgcMapImageParams(request);
|
|
66
105
|
const collectionPart = request.collectionId !== undefined ? `/collections/${encodeURIComponent(String(request.collectionId))}` : "";
|
|
67
106
|
const stylePart = request.styleId ? `/styles/${encodeURIComponent(request.styleId)}` : "";
|
|
68
|
-
const path =
|
|
107
|
+
const path = `${mapsBase(request)}${collectionPart}${stylePart}/map${params.size > 0 ? `?${params.toString()}` : ""}`;
|
|
69
108
|
const accept = ogcMapAcceptHeader(request.format) ?? "image/png";
|
|
70
109
|
const response = await transport.requestBytes("GET", path, accept, undefined, request.signal);
|
|
71
110
|
return { bytes: response.bytes, contentType: response.contentType };
|
package/core/ogc-processes.d.ts
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import type { IJobRun, JobProgress, JobResult, JobResultsOptions, JobSnapshot, JobSnapshotListener, JobStatus } from "../contract/jobs.js";
|
|
10
10
|
import type { HonuaClient } from "./client.js";
|
|
11
|
+
import { HonuaSdkError } from "./error-envelope.js";
|
|
11
12
|
import type { HonuaProtocolTransport } from "./protocol-transport.js";
|
|
12
13
|
import type { HonuaOgcConformanceResponse, HonuaOgcLandingResponse, HonuaOgcProcessDescription, HonuaOgcProcessJobAccepted, HonuaOgcProcessJobResults, HonuaOgcProcessJobStatus, HonuaOgcProcessesResponse, OgcMetadataRequest, OgcProcessExecuteRequest, OgcProcessStatus } from "./types.js";
|
|
13
14
|
export interface HonuaOgcProcessesOptions {
|
|
@@ -81,7 +82,7 @@ export declare class HonuaOgcProcessJobRun<T = unknown> implements IJobRun<T> {
|
|
|
81
82
|
private notify;
|
|
82
83
|
}
|
|
83
84
|
/** Error thrown when `IJobRun.results()` resolves a non-success terminal. */
|
|
84
|
-
export declare class HonuaJobFailedError extends
|
|
85
|
+
export declare class HonuaJobFailedError extends HonuaSdkError {
|
|
85
86
|
readonly status: JobStatus;
|
|
86
87
|
readonly errorCode: string | undefined;
|
|
87
88
|
readonly details: unknown;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ogc-processes.d.ts","sourceRoot":"","sources":["../../../src/core/ogc-processes.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,OAAO,EAEP,WAAW,EACX,SAAS,EACT,iBAAiB,EACjB,WAAW,EACX,mBAAmB,EACnB,SAAS,EACV,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,KAAK,EACV,2BAA2B,EAC3B,uBAAuB,EACvB,0BAA0B,EAC1B,0BAA0B,EAC1B,yBAAyB,EACzB,wBAAwB,EACxB,yBAAyB,EACzB,kBAAkB,EAClB,wBAAwB,EACxB,gBAAgB,EACjB,MAAM,YAAY,CAAC;AAGpB,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,WAAW,CAAC;CACrB;AAED,MAAM,WAAW,yBAAyB;IACxC,MAAM,EAAE,WAAW,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,+DAA+D;IAC/D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qEAAqE;IACrE,aAAa,CAAC,EAAE,wBAAwB,CAAC;IACzC,gDAAgD;IAChD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,iEAAiE;IACjE,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,wBAAwB,CAAC,CAAC;CACrF;
|
|
1
|
+
{"version":3,"file":"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C,OAAO,CAAC,0BAA0B,CAAC,CAerC;AAED,wBAAsB,gBAAgB,CACpC,SAAS,EAAE,sBAAsB,EACjC,OAAO,EAAE;IACP,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC;CACzD,GACA,OAAO,CAAC,wBAAwB,CAAC,CAQnC;AAED,wBAAsB,uBAAuB,CAC3C,SAAS,EAAE,sBAAsB,EACjC,OAAO,EAAE;IACP,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC;CACzD,GACA,OAAO,CAAC,yBAAyB,CAAC,CAQpC;AAED,wBAAsB,mBAAmB,CACvC,SAAS,EAAE,sBAAsB,EACjC,OAAO,EAAE;IACP,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC;CACzD,GACA,OAAO,CAAC,wBAAwB,CAAC,CAQnC"}
|
package/core/ogc-processes.js
CHANGED
|
@@ -7,8 +7,33 @@
|
|
|
7
7
|
* @module
|
|
8
8
|
*/
|
|
9
9
|
import { HonuaJobPollTimeoutError, isJobTerminal } from "../contract/jobs.js";
|
|
10
|
+
import { HonuaSdkError } from "./error-envelope.js";
|
|
10
11
|
import { createOgcMetadataParams, mergeHeaders } from "./wire-shared.js";
|
|
11
12
|
const DEFAULT_POLL_INTERVAL_MS = 1_000;
|
|
13
|
+
/** Honua facade path prefix for OGC API Processes. */
|
|
14
|
+
const PROCESSES_FACADE_BASE = "/ogc/processes";
|
|
15
|
+
/**
|
|
16
|
+
* Resolve the OGC API Processes path prefix: the caller-supplied raw `basePath`
|
|
17
|
+
* (a `discoverOgcProcesses()`-discovered third-party service root) or the Honua
|
|
18
|
+
* facade default. Trailing slashes are trimmed so a discovered root and the
|
|
19
|
+
* facade compose the same sub-paths. Mirrors the OGC API Records seam.
|
|
20
|
+
*/
|
|
21
|
+
function processesBase(request) {
|
|
22
|
+
// An omitted basePath uses the Honua facade; an explicit "" is a legitimate
|
|
23
|
+
// root-mounted raw service and must NOT fall back to the facade prefix.
|
|
24
|
+
if (request.basePath === undefined)
|
|
25
|
+
return PROCESSES_FACADE_BASE;
|
|
26
|
+
const base = request.basePath;
|
|
27
|
+
let end = base.length;
|
|
28
|
+
while (end > 0 && base.charCodeAt(end - 1) === 0x2f)
|
|
29
|
+
end--;
|
|
30
|
+
return base.slice(0, end);
|
|
31
|
+
}
|
|
32
|
+
/** Cache-key discriminator so a discovered root never collides with the facade. */
|
|
33
|
+
function processesBaseKey(request) {
|
|
34
|
+
const base = processesBase(request);
|
|
35
|
+
return base === PROCESSES_FACADE_BASE ? "" : `${base}:`;
|
|
36
|
+
}
|
|
12
37
|
/** Top-level OGC API Processes handle. */
|
|
13
38
|
export class HonuaOgcProcesses {
|
|
14
39
|
client;
|
|
@@ -271,12 +296,12 @@ export class HonuaOgcProcessJobRun {
|
|
|
271
296
|
}
|
|
272
297
|
}
|
|
273
298
|
/** Error thrown when `IJobRun.results()` resolves a non-success terminal. */
|
|
274
|
-
export class HonuaJobFailedError extends
|
|
299
|
+
export class HonuaJobFailedError extends HonuaSdkError {
|
|
275
300
|
status;
|
|
276
301
|
errorCode;
|
|
277
302
|
details;
|
|
278
303
|
constructor(message, status, errorCode, details) {
|
|
279
|
-
super(message);
|
|
304
|
+
super("core.job-failed", message, { context: { status, errorCode } });
|
|
280
305
|
this.name = "HonuaJobFailedError";
|
|
281
306
|
this.status = status;
|
|
282
307
|
this.errorCode = errorCode;
|
|
@@ -371,15 +396,18 @@ export function createHonuaOgcProcesses(client) {
|
|
|
371
396
|
// ── OGC API Processes wire methods ──────────────────────────────
|
|
372
397
|
export async function getOgcProcessesLanding(transport, request = {}) {
|
|
373
398
|
const params = createOgcMetadataParams(request);
|
|
374
|
-
|
|
399
|
+
const base = processesBase(request);
|
|
400
|
+
return transport.requestCachedMetadataJson(`ogc-processes:landing:${processesBaseKey(request)}${params.toString()}`, `${base}?${params.toString()}`, request);
|
|
375
401
|
}
|
|
376
402
|
export async function getOgcProcessesConformance(transport, request = {}) {
|
|
377
403
|
const params = createOgcMetadataParams(request);
|
|
378
|
-
|
|
404
|
+
const base = processesBase(request);
|
|
405
|
+
return transport.requestCachedMetadataJson(`ogc-processes:conformance:${processesBaseKey(request)}${params.toString()}`, `${base}/conformance?${params.toString()}`, request);
|
|
379
406
|
}
|
|
380
407
|
export async function listOgcProcesses(transport, request = {}) {
|
|
381
408
|
const params = createOgcMetadataParams(request);
|
|
382
|
-
|
|
409
|
+
const base = processesBase(request);
|
|
410
|
+
return transport.requestCachedMetadataJson(`ogc-processes:processes:${processesBaseKey(request)}${params.toString()}`, `${base}/processes?${params.toString()}`, request);
|
|
383
411
|
}
|
|
384
412
|
export async function getOgcProcess(transport, request) {
|
|
385
413
|
const params = createOgcMetadataParams(request);
|