@honua/react 0.0.20-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/LICENSE +201 -0
- package/README.md +9 -0
- package/contract/analytics-sources.d.ts +149 -0
- package/contract/analytics-sources.d.ts.map +1 -0
- package/contract/analytics-sources.js +235 -0
- package/contract/edit-session.d.ts +203 -0
- package/contract/edit-session.d.ts.map +1 -0
- package/contract/edit-session.js +760 -0
- package/contract/edit-sketch.d.ts +91 -0
- package/contract/edit-sketch.d.ts.map +1 -0
- package/contract/edit-sketch.js +281 -0
- package/contract/index.d.ts +61 -0
- package/contract/index.d.ts.map +1 -0
- package/contract/index.js +51 -0
- package/contract/jobs.d.ts +149 -0
- package/contract/jobs.d.ts.map +1 -0
- package/contract/jobs.js +40 -0
- package/contract/source.d.ts +423 -0
- package/contract/source.d.ts.map +1 -0
- package/contract/source.js +3802 -0
- package/contract/spatial-aggregation.d.ts +336 -0
- package/contract/spatial-aggregation.d.ts.map +1 -0
- package/contract/spatial-aggregation.js +298 -0
- package/contract/temporal.d.ts +455 -0
- package/contract/temporal.d.ts.map +1 -0
- package/contract/temporal.js +146 -0
- package/contract/tiles.d.ts +370 -0
- package/contract/tiles.d.ts.map +1 -0
- package/contract/tiles.js +519 -0
- package/contract/types.d.ts +665 -0
- package/contract/types.d.ts.map +1 -0
- package/contract/types.js +175 -0
- package/contract/widget-source.d.ts +205 -0
- package/contract/widget-source.d.ts.map +1 -0
- package/contract/widget-source.js +1473 -0
- package/control-plane/client.d.ts +95 -0
- package/control-plane/client.d.ts.map +1 -0
- package/control-plane/client.js +374 -0
- package/control-plane/index.d.ts +18 -0
- package/control-plane/index.d.ts.map +1 -0
- package/control-plane/index.js +14 -0
- package/control-plane/types.d.ts +233 -0
- package/control-plane/types.d.ts.map +1 -0
- package/control-plane/types.js +7 -0
- package/core/batch.d.ts +37 -0
- package/core/batch.d.ts.map +1 -0
- package/core/batch.js +79 -0
- package/core/cache-state.d.ts +79 -0
- package/core/cache-state.d.ts.map +1 -0
- package/core/cache-state.js +87 -0
- package/core/client.d.ts +577 -0
- package/core/client.d.ts.map +1 -0
- package/core/client.js +1664 -0
- package/core/compatibility.d.ts +18 -0
- package/core/compatibility.d.ts.map +1 -0
- package/core/compatibility.js +245 -0
- package/core/errors.d.ts +107 -0
- package/core/errors.d.ts.map +1 -0
- package/core/errors.js +156 -0
- package/core/esri-geojson.d.ts +66 -0
- package/core/esri-geojson.d.ts.map +1 -0
- package/core/esri-geojson.js +363 -0
- package/core/geoservices.d.ts +34 -0
- package/core/geoservices.d.ts.map +1 -0
- package/core/geoservices.js +434 -0
- package/core/grpc-adapter.d.ts +23 -0
- package/core/grpc-adapter.d.ts.map +1 -0
- package/core/grpc-adapter.js +688 -0
- package/core/odata.d.ts +347 -0
- package/core/odata.d.ts.map +1 -0
- package/core/odata.js +913 -0
- package/core/ogc-conformance.d.ts +35 -0
- package/core/ogc-conformance.d.ts.map +1 -0
- package/core/ogc-conformance.js +134 -0
- package/core/ogc-features.d.ts +23 -0
- package/core/ogc-features.d.ts.map +1 -0
- package/core/ogc-features.js +114 -0
- package/core/ogc-maps.d.ts +49 -0
- package/core/ogc-maps.d.ts.map +1 -0
- package/core/ogc-maps.js +126 -0
- package/core/ogc-processes.d.ts +118 -0
- package/core/ogc-processes.d.ts.map +1 -0
- package/core/ogc-processes.js +423 -0
- package/core/ogc-records.d.ts +75 -0
- package/core/ogc-records.d.ts.map +1 -0
- package/core/ogc-records.js +251 -0
- package/core/ogc-tiles.d.ts +125 -0
- package/core/ogc-tiles.d.ts.map +1 -0
- package/core/ogc-tiles.js +183 -0
- package/core/path-utils.d.ts +69 -0
- package/core/path-utils.d.ts.map +1 -0
- package/core/path-utils.js +123 -0
- package/core/pbf-decoder.d.ts +39 -0
- package/core/pbf-decoder.d.ts.map +1 -0
- package/core/pbf-decoder.js +702 -0
- package/core/process-runner.d.ts +104 -0
- package/core/process-runner.d.ts.map +1 -0
- package/core/process-runner.js +315 -0
- package/core/protocol-transport.d.ts +76 -0
- package/core/protocol-transport.d.ts.map +1 -0
- package/core/protocol-transport.js +15 -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/request-pipeline.d.ts +88 -0
- package/core/request-pipeline.d.ts.map +1 -0
- package/core/request-pipeline.js +273 -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 +55 -0
- package/core/stac.d.ts.map +1 -0
- package/core/stac.js +229 -0
- package/core/surfaces.d.ts +527 -0
- package/core/surfaces.d.ts.map +1 -0
- package/core/surfaces.js +1917 -0
- package/core/terrain-elevation.d.ts +114 -0
- package/core/terrain-elevation.d.ts.map +1 -0
- package/core/terrain-elevation.js +150 -0
- package/core/types.d.ts +1355 -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 +634 -0
- package/core/wfs.d.ts +219 -0
- package/core/wfs.d.ts.map +1 -0
- package/core/wfs.js +406 -0
- package/core/wire-shared.d.ts +32 -0
- package/core/wire-shared.d.ts.map +1 -0
- package/core/wire-shared.js +76 -0
- package/core/wms-axis.d.ts +36 -0
- package/core/wms-axis.d.ts.map +1 -0
- package/core/wms-axis.js +73 -0
- package/core/wms-capabilities.d.ts +110 -0
- package/core/wms-capabilities.d.ts.map +1 -0
- package/core/wms-capabilities.js +559 -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 +144 -0
- package/core/wms.d.ts.map +1 -0
- package/core/wms.js +338 -0
- package/core/wmts-capabilities.d.ts +82 -0
- package/core/wmts-capabilities.d.ts.map +1 -0
- package/core/wmts-capabilities.js +402 -0
- package/core/wmts.d.ts +103 -0
- package/core/wmts.d.ts.map +1 -0
- package/core/wmts.js +332 -0
- package/core/xml-text.d.ts +20 -0
- package/core/xml-text.d.ts.map +1 -0
- package/core/xml-text.js +85 -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 +127 -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-filter.d.ts +55 -0
- package/esri-compat/feature-filter.d.ts.map +1 -0
- package/esri-compat/feature-filter.js +109 -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 +661 -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/geojson-layer.d.ts +86 -0
- package/esri-compat/geojson-layer.d.ts.map +1 -0
- package/esri-compat/geojson-layer.js +191 -0
- package/esri-compat/geometry-engine.d.ts +107 -0
- package/esri-compat/geometry-engine.d.ts.map +1 -0
- package/esri-compat/geometry-engine.js +266 -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/imagery-layer.d.ts +78 -0
- package/esri-compat/imagery-layer.d.ts.map +1 -0
- package/esri-compat/imagery-layer.js +167 -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 +709 -0
- package/esri-compat/map-view.d.ts +323 -0
- package/esri-compat/map-view.d.ts.map +1 -0
- package/esri-compat/map-view.js +1175 -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 +58 -0
- package/esri-compat/query.d.ts.map +1 -0
- package/esri-compat/query.js +128 -0
- package/esri-compat/reactive-utils.d.ts +24 -0
- package/esri-compat/reactive-utils.d.ts.map +1 -0
- package/esri-compat/reactive-utils.js +193 -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 +168 -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 +13 -0
- package/esri-compat/url.d.ts.map +1 -0
- package/esri-compat/url.js +68 -0
- package/esri-compat/vector-tile-layer.d.ts +47 -0
- package/esri-compat/vector-tile-layer.d.ts.map +1 -0
- package/esri-compat/vector-tile-layer.js +130 -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/esri-compat/wfs-layer.d.ts +64 -0
- package/esri-compat/wfs-layer.d.ts.map +1 -0
- package/esri-compat/wfs-layer.js +145 -0
- package/esri-compat/wms-layer.d.ts +76 -0
- package/esri-compat/wms-layer.d.ts.map +1 -0
- package/esri-compat/wms-layer.js +157 -0
- package/exploration/context.d.ts +25 -0
- package/exploration/context.d.ts.map +1 -0
- package/exploration/context.js +396 -0
- package/exploration/index.d.ts +27 -0
- package/exploration/index.d.ts.map +1 -0
- package/exploration/index.js +24 -0
- package/exploration/presets.d.ts +27 -0
- package/exploration/presets.d.ts.map +1 -0
- package/exploration/presets.js +114 -0
- package/exploration/reducer.d.ts +23 -0
- package/exploration/reducer.d.ts.map +1 -0
- package/exploration/reducer.js +332 -0
- package/exploration/selection.d.ts +25 -0
- package/exploration/selection.d.ts.map +1 -0
- package/exploration/selection.js +34 -0
- package/exploration/selectors.d.ts +56 -0
- package/exploration/selectors.d.ts.map +1 -0
- package/exploration/selectors.js +110 -0
- package/exploration/types.d.ts +294 -0
- package/exploration/types.d.ts.map +1 -0
- package/exploration/types.js +33 -0
- package/expr/expression.d.ts +457 -0
- package/expr/expression.d.ts.map +1 -0
- package/expr/expression.js +663 -0
- package/expr/index.d.ts +32 -0
- package/expr/index.d.ts.map +1 -0
- package/expr/index.js +30 -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/generated-app/errors.d.ts +41 -0
- package/generated-app/errors.d.ts.map +1 -0
- package/generated-app/errors.js +41 -0
- package/generated-app/index.d.ts +17 -0
- package/generated-app/index.d.ts.map +1 -0
- package/generated-app/index.js +12 -0
- package/generated-app/manifest.d.ts +183 -0
- package/generated-app/manifest.d.ts.map +1 -0
- package/generated-app/manifest.js +14 -0
- package/generated-app/projection.d.ts +44 -0
- package/generated-app/projection.d.ts.map +1 -0
- package/generated-app/projection.js +234 -0
- package/generated-app/runtime.d.ts +215 -0
- package/generated-app/runtime.d.ts.map +1 -0
- package/generated-app/runtime.js +1196 -0
- package/interactions/detail-model.d.ts +54 -0
- package/interactions/detail-model.d.ts.map +1 -0
- package/interactions/detail-model.js +105 -0
- package/interactions/exploration-bindings.d.ts +120 -0
- package/interactions/exploration-bindings.d.ts.map +1 -0
- package/interactions/exploration-bindings.js +218 -0
- package/interactions/feature-state.d.ts +144 -0
- package/interactions/feature-state.d.ts.map +1 -0
- package/interactions/feature-state.js +169 -0
- package/interactions/hit-test.d.ts +112 -0
- package/interactions/hit-test.d.ts.map +1 -0
- package/interactions/hit-test.js +291 -0
- package/interactions/index.d.ts +31 -0
- package/interactions/index.d.ts.map +1 -0
- package/interactions/index.js +24 -0
- package/interactions/share-state.d.ts +36 -0
- package/interactions/share-state.d.ts.map +1 -0
- package/interactions/share-state.js +123 -0
- package/map/feature-service-adapter.d.ts +138 -0
- package/map/feature-service-adapter.d.ts.map +1 -0
- package/map/feature-service-adapter.js +279 -0
- package/map/honua-map.d.ts +203 -0
- package/map/honua-map.d.ts.map +1 -0
- package/map/honua-map.js +347 -0
- package/map/index.d.ts +27 -0
- package/map/index.d.ts.map +1 -0
- package/map/index.js +22 -0
- package/map/maplibre-target.d.ts +103 -0
- package/map/maplibre-target.d.ts.map +1 -0
- package/map/maplibre-target.js +164 -0
- package/map/webmap-maplibre.d.ts +60 -0
- package/map/webmap-maplibre.d.ts.map +1 -0
- package/map/webmap-maplibre.js +212 -0
- package/package.json +37 -0
- package/react/context.d.ts +32 -0
- package/react/context.d.ts.map +1 -0
- package/react/context.js +19 -0
- package/react/honua-layer.d.ts +35 -0
- package/react/honua-layer.d.ts.map +1 -0
- package/react/honua-layer.js +47 -0
- package/react/honua-map.d.ts +83 -0
- package/react/honua-map.d.ts.map +1 -0
- package/react/honua-map.js +109 -0
- package/react/honua-popup.d.ts +26 -0
- package/react/honua-popup.d.ts.map +1 -0
- package/react/honua-popup.js +34 -0
- package/react/hooks.d.ts +127 -0
- package/react/hooks.d.ts.map +1 -0
- package/react/hooks.js +206 -0
- package/react/index.d.ts +42 -0
- package/react/index.d.ts.map +1 -0
- package/react/index.js +34 -0
- package/react/provider.d.ts +36 -0
- package/react/provider.d.ts.map +1 -0
- package/react/provider.js +35 -0
- package/react/query-cache.d.ts +76 -0
- package/react/query-cache.d.ts.map +1 -0
- package/react/query-cache.js +188 -0
- package/runtime/diff.d.ts +31 -0
- package/runtime/diff.d.ts.map +1 -0
- package/runtime/diff.js +143 -0
- package/runtime/errors.d.ts +40 -0
- package/runtime/errors.d.ts.map +1 -0
- package/runtime/errors.js +35 -0
- package/runtime/index.d.ts +59 -0
- package/runtime/index.d.ts.map +1 -0
- package/runtime/index.js +43 -0
- package/runtime/legend.d.ts +23 -0
- package/runtime/legend.d.ts.map +1 -0
- package/runtime/legend.js +38 -0
- package/runtime/load-package.d.ts +125 -0
- package/runtime/load-package.d.ts.map +1 -0
- package/runtime/load-package.js +264 -0
- package/runtime/map-package-fetch.d.ts +107 -0
- package/runtime/map-package-fetch.d.ts.map +1 -0
- package/runtime/map-package-fetch.js +336 -0
- package/runtime/map-package-realtime.d.ts +169 -0
- package/runtime/map-package-realtime.d.ts.map +1 -0
- package/runtime/map-package-realtime.js +350 -0
- package/runtime/map-package-validation.d.ts +43 -0
- package/runtime/map-package-validation.d.ts.map +1 -0
- package/runtime/map-package-validation.js +269 -0
- package/runtime/map-package-watch.d.ts +78 -0
- package/runtime/map-package-watch.d.ts.map +1 -0
- package/runtime/map-package-watch.js +695 -0
- package/runtime/map-package.d.ts +167 -0
- package/runtime/map-package.d.ts.map +1 -0
- package/runtime/map-package.js +15 -0
- package/runtime/ogc-styles.d.ts +110 -0
- package/runtime/ogc-styles.d.ts.map +1 -0
- package/runtime/ogc-styles.js +195 -0
- package/runtime/popups.d.ts +62 -0
- package/runtime/popups.d.ts.map +1 -0
- package/runtime/popups.js +95 -0
- package/runtime/query-tiles.d.ts +217 -0
- package/runtime/query-tiles.d.ts.map +1 -0
- package/runtime/query-tiles.js +801 -0
- package/runtime/runtime.d.ts +243 -0
- package/runtime/runtime.d.ts.map +1 -0
- package/runtime/runtime.js +1147 -0
- package/runtime/source-bridge.d.ts +99 -0
- package/runtime/source-bridge.d.ts.map +1 -0
- package/runtime/source-bridge.js +401 -0
- package/runtime/style-compose.d.ts +46 -0
- package/runtime/style-compose.d.ts.map +1 -0
- package/runtime/style-compose.js +144 -0
- package/runtime/style-interactions.d.ts +141 -0
- package/runtime/style-interactions.d.ts.map +1 -0
- package/runtime/style-interactions.js +574 -0
- package/runtime/style-spec-validation.d.ts +23 -0
- package/runtime/style-spec-validation.d.ts.map +1 -0
- package/runtime/style-spec-validation.js +357 -0
- package/studio/capability-manifest.d.ts +285 -0
- package/studio/capability-manifest.d.ts.map +1 -0
- package/studio/capability-manifest.js +59 -0
- package/studio/chart-spec.d.ts +85 -0
- package/studio/chart-spec.d.ts.map +1 -0
- package/studio/chart-spec.js +106 -0
- package/studio/index.d.ts +34 -0
- package/studio/index.d.ts.map +1 -0
- package/studio/index.js +27 -0
- package/studio/provenance.d.ts +131 -0
- package/studio/provenance.d.ts.map +1 -0
- package/studio/provenance.js +39 -0
- package/studio/publish.d.ts +64 -0
- package/studio/publish.d.ts.map +1 -0
- package/studio/publish.js +13 -0
- package/studio/types.d.ts +278 -0
- package/studio/types.d.ts.map +1 -0
- package/studio/types.js +71 -0
- package/studio/validate.d.ts +45 -0
- package/studio/validate.d.ts.map +1 -0
- package/studio/validate.js +255 -0
- package/studio/validation.d.ts +112 -0
- package/studio/validation.d.ts.map +1 -0
- package/studio/validation.js +42 -0
- package/style/factory.d.ts +30 -0
- package/style/factory.d.ts.map +1 -0
- package/style/factory.js +61 -0
- package/style/index.d.ts +25 -0
- package/style/index.d.ts.map +1 -0
- package/style/index.js +24 -0
- package/style/specification.d.ts +203 -0
- package/style/specification.d.ts.map +1 -0
- package/style/specification.js +178 -0
- package/style/wms-wmts-resolvers.d.ts +38 -0
- package/style/wms-wmts-resolvers.d.ts.map +1 -0
- package/style/wms-wmts-resolvers.js +92 -0
- package/webmap/contract.d.ts +28 -0
- package/webmap/contract.d.ts.map +1 -0
- package/webmap/contract.js +130 -0
- package/webmap/convert-basemap.d.ts +17 -0
- package/webmap/convert-basemap.d.ts.map +1 -0
- package/webmap/convert-basemap.js +78 -0
- package/webmap/convert-extent.d.ts +17 -0
- package/webmap/convert-extent.d.ts.map +1 -0
- package/webmap/convert-extent.js +114 -0
- package/webmap/convert-label.d.ts +13 -0
- package/webmap/convert-label.d.ts.map +1 -0
- package/webmap/convert-label.js +125 -0
- package/webmap/convert-layer.d.ts +22 -0
- package/webmap/convert-layer.d.ts.map +1 -0
- package/webmap/convert-layer.js +181 -0
- package/webmap/convert-popup.d.ts +34 -0
- package/webmap/convert-popup.d.ts.map +1 -0
- package/webmap/convert-popup.js +68 -0
- package/webmap/convert-renderer.d.ts +17 -0
- package/webmap/convert-renderer.d.ts.map +1 -0
- package/webmap/convert-renderer.js +161 -0
- package/webmap/convert-symbol.d.ts +17 -0
- package/webmap/convert-symbol.d.ts.map +1 -0
- package/webmap/convert-symbol.js +122 -0
- package/webmap/index.d.ts +44 -0
- package/webmap/index.d.ts.map +1 -0
- package/webmap/index.js +33 -0
- package/webmap/parse.d.ts +25 -0
- package/webmap/parse.d.ts.map +1 -0
- package/webmap/parse.js +83 -0
- package/webmap/types.d.ts +264 -0
- package/webmap/types.d.ts.map +1 -0
- package/webmap/types.js +13 -0
- package/webmap/warnings.d.ts +30 -0
- package/webmap/warnings.d.ts.map +1 -0
- package/webmap/warnings.js +37 -0
|
@@ -0,0 +1,695 @@
|
|
|
1
|
+
import { diffPackages } from "./diff.js";
|
|
2
|
+
import { HonuaMapPackageError } from "./errors.js";
|
|
3
|
+
import { fetchMapPackage, mapPackageFingerprint, resolveMapPackagePath, } from "./map-package-fetch.js";
|
|
4
|
+
import { MAP_PACKAGE_REALTIME_CHANNEL_V1, createMapPackageServerSentEventsTransport, readMapPackageRealtimeAdvertisement, redactMapPackageRealtimeUrl, } from "./map-package-realtime.js";
|
|
5
|
+
import { hasMapPackageDiagnosticErrors, validateMapPackage } from "./map-package-validation.js";
|
|
6
|
+
const DEFAULT_WATCH_INTERVAL_MS = 30_000;
|
|
7
|
+
const DEFAULT_RECONNECT_OPTIONS = {
|
|
8
|
+
maxAttempts: 3,
|
|
9
|
+
minDelayMs: 1_000,
|
|
10
|
+
maxDelayMs: 30_000,
|
|
11
|
+
factor: 2,
|
|
12
|
+
};
|
|
13
|
+
export function watchMapPackage(locator, options) {
|
|
14
|
+
let disposed = false;
|
|
15
|
+
let inFlight = false;
|
|
16
|
+
let timer;
|
|
17
|
+
let debounceTimer;
|
|
18
|
+
let reconnectTimer;
|
|
19
|
+
let staleTimer;
|
|
20
|
+
let pendingApply;
|
|
21
|
+
let previousPackage = options.initialPackage ?? options.runtime?.mapPackage;
|
|
22
|
+
let lastFetchedPackage = previousPackage;
|
|
23
|
+
let previousFingerprint = previousPackage ? mapPackageFingerprint(previousPackage) : undefined;
|
|
24
|
+
let currentAbort;
|
|
25
|
+
let realtimeAbort;
|
|
26
|
+
let realtimeLinkDispose;
|
|
27
|
+
let realtimeSubscription;
|
|
28
|
+
let activeRealtime;
|
|
29
|
+
let suppressRealtimeDisconnect = false;
|
|
30
|
+
let reconnectAttempt = 0;
|
|
31
|
+
let fallbackActive = false;
|
|
32
|
+
let unsupportedRealtimeNotified = false;
|
|
33
|
+
let lastRealtimeCheckpoint = previousPackage
|
|
34
|
+
? {
|
|
35
|
+
fingerprint: previousFingerprint,
|
|
36
|
+
updatedAt: previousPackage.updatedAt,
|
|
37
|
+
}
|
|
38
|
+
: undefined;
|
|
39
|
+
let lastAppliedRealtimeSequence;
|
|
40
|
+
const seenRealtimeEventIds = [];
|
|
41
|
+
const intervalMs = normalizeDelay(options.intervalMs, DEFAULT_WATCH_INTERVAL_MS);
|
|
42
|
+
const debounceMs = normalizeDelay(options.debounceMs, 0);
|
|
43
|
+
const emit = (event) => {
|
|
44
|
+
void options.onEvent?.(event);
|
|
45
|
+
if (event.type === "updated")
|
|
46
|
+
void options.onUpdate?.(event);
|
|
47
|
+
if (event.type === "error")
|
|
48
|
+
void options.onError?.(event.error);
|
|
49
|
+
};
|
|
50
|
+
const schedule = () => {
|
|
51
|
+
if (disposed || realtimeSubscription)
|
|
52
|
+
return;
|
|
53
|
+
timer = setTimeout(() => {
|
|
54
|
+
void poll({ scheduleAfter: true, discoverRealtime: true });
|
|
55
|
+
}, intervalMs);
|
|
56
|
+
};
|
|
57
|
+
const clearScheduled = () => {
|
|
58
|
+
if (timer)
|
|
59
|
+
clearTimeout(timer);
|
|
60
|
+
timer = undefined;
|
|
61
|
+
};
|
|
62
|
+
const clearRealtimeTimers = () => {
|
|
63
|
+
if (reconnectTimer)
|
|
64
|
+
clearTimeout(reconnectTimer);
|
|
65
|
+
if (staleTimer)
|
|
66
|
+
clearTimeout(staleTimer);
|
|
67
|
+
reconnectTimer = undefined;
|
|
68
|
+
staleTimer = undefined;
|
|
69
|
+
};
|
|
70
|
+
const queueApply = (result, reloadReason) => {
|
|
71
|
+
pendingApply = { result, ...(reloadReason ? { reloadReason } : {}) };
|
|
72
|
+
if (debounceMs === 0) {
|
|
73
|
+
void applyPending();
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
if (debounceTimer)
|
|
77
|
+
clearTimeout(debounceTimer);
|
|
78
|
+
debounceTimer = setTimeout(() => {
|
|
79
|
+
debounceTimer = undefined;
|
|
80
|
+
void applyPending();
|
|
81
|
+
}, debounceMs);
|
|
82
|
+
};
|
|
83
|
+
const applyPending = async () => {
|
|
84
|
+
try {
|
|
85
|
+
const pending = pendingApply;
|
|
86
|
+
pendingApply = undefined;
|
|
87
|
+
if (!pending || disposed)
|
|
88
|
+
return;
|
|
89
|
+
const { result, reloadReason } = pending;
|
|
90
|
+
const nextFingerprint = mapPackageFingerprint(result.mapPackage);
|
|
91
|
+
if (previousFingerprint === nextFingerprint) {
|
|
92
|
+
emit({ type: "unchanged", result });
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
const diff = previousPackage ? diffPackages(previousPackage, result.mapPackage) : undefined;
|
|
96
|
+
if (diff && (reloadReason || !diff.incremental)) {
|
|
97
|
+
emit({
|
|
98
|
+
type: "reload-required",
|
|
99
|
+
result,
|
|
100
|
+
diff,
|
|
101
|
+
reason: reloadReason ?? diff.structuralReason ?? "MapPackage update requires a full style reload.",
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
const shouldApply = Boolean(options.runtime) && options.applyUpdates !== false;
|
|
105
|
+
if (shouldApply) {
|
|
106
|
+
await options.runtime?.updatePackage(result.mapPackage);
|
|
107
|
+
}
|
|
108
|
+
previousPackage = result.mapPackage;
|
|
109
|
+
lastFetchedPackage = result.mapPackage;
|
|
110
|
+
previousFingerprint = nextFingerprint;
|
|
111
|
+
lastRealtimeCheckpoint = {
|
|
112
|
+
...lastRealtimeCheckpoint,
|
|
113
|
+
fingerprint: nextFingerprint,
|
|
114
|
+
updatedAt: result.mapPackage.updatedAt,
|
|
115
|
+
validator: result.cache.validator,
|
|
116
|
+
};
|
|
117
|
+
emit({ type: "updated", result, diff, applied: shouldApply });
|
|
118
|
+
}
|
|
119
|
+
catch (error) {
|
|
120
|
+
if (!disposed)
|
|
121
|
+
emit({ type: "error", error });
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
const poll = async (input = {}) => {
|
|
125
|
+
if (disposed || inFlight)
|
|
126
|
+
return;
|
|
127
|
+
inFlight = true;
|
|
128
|
+
currentAbort = new AbortController();
|
|
129
|
+
const link = linkAbortSignals(options.signal, currentAbort.signal);
|
|
130
|
+
try {
|
|
131
|
+
const result = await fetchMapPackage(input.locatorOverride ?? locator, {
|
|
132
|
+
...options,
|
|
133
|
+
signal: link.signal,
|
|
134
|
+
});
|
|
135
|
+
lastFetchedPackage = result.mapPackage;
|
|
136
|
+
emit({ type: "fetched", result });
|
|
137
|
+
if (result.cache.status === "not-modified") {
|
|
138
|
+
emit({ type: "unchanged", result });
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
queueApply(result);
|
|
142
|
+
}
|
|
143
|
+
if (input.discoverRealtime !== false && !realtimeSubscription && !fallbackActive) {
|
|
144
|
+
startRealtime();
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
catch (error) {
|
|
148
|
+
if (!disposed)
|
|
149
|
+
emit({ type: "error", error });
|
|
150
|
+
}
|
|
151
|
+
finally {
|
|
152
|
+
link.dispose();
|
|
153
|
+
inFlight = false;
|
|
154
|
+
currentAbort = undefined;
|
|
155
|
+
if (input.scheduleAfter !== false)
|
|
156
|
+
schedule();
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
const startRealtime = () => {
|
|
160
|
+
if (disposed || realtimeSubscription || options.realtime === false || fallbackActive)
|
|
161
|
+
return false;
|
|
162
|
+
const resolution = resolveRealtimeSource();
|
|
163
|
+
if (!resolution)
|
|
164
|
+
return false;
|
|
165
|
+
if (resolution.type === "unsupported") {
|
|
166
|
+
if (!unsupportedRealtimeNotified) {
|
|
167
|
+
unsupportedRealtimeNotified = true;
|
|
168
|
+
emit({ type: "fallback", mode: resolution.fallback, reason: resolution.reason });
|
|
169
|
+
}
|
|
170
|
+
return false;
|
|
171
|
+
}
|
|
172
|
+
const source = resolution.source;
|
|
173
|
+
const abort = new AbortController();
|
|
174
|
+
const link = linkAbortSignals(options.signal, abort.signal);
|
|
175
|
+
const signal = link.signal;
|
|
176
|
+
const path = resolveMapPackagePath(locator, options.resolvePath);
|
|
177
|
+
activeRealtime = source;
|
|
178
|
+
realtimeAbort = abort;
|
|
179
|
+
realtimeLinkDispose = link.dispose;
|
|
180
|
+
clearScheduled();
|
|
181
|
+
try {
|
|
182
|
+
const subscription = source.transport.subscribe({
|
|
183
|
+
locator,
|
|
184
|
+
packageId: packageIdFromLocator(locator) ?? previousPackage?.mapPackageId ?? lastFetchedPackage?.mapPackageId,
|
|
185
|
+
path,
|
|
186
|
+
client: options.client,
|
|
187
|
+
headers: options.headers,
|
|
188
|
+
signal,
|
|
189
|
+
resumeFrom: lastRealtimeCheckpoint,
|
|
190
|
+
}, {
|
|
191
|
+
connected: (info) => {
|
|
192
|
+
if (disposed)
|
|
193
|
+
return;
|
|
194
|
+
reconnectAttempt = 0;
|
|
195
|
+
armRealtimeStaleTimer(source);
|
|
196
|
+
const eventUrl = info.url ? redactMapPackageRealtimeUrl(info.url) : source.url;
|
|
197
|
+
emit({
|
|
198
|
+
type: "connected",
|
|
199
|
+
transport: info.transport,
|
|
200
|
+
advertised: source.advertised,
|
|
201
|
+
...(info.channel ? { channel: info.channel } : source.channel ? { channel: source.channel } : {}),
|
|
202
|
+
...(eventUrl ? { url: eventUrl } : {}),
|
|
203
|
+
...(lastRealtimeCheckpoint ? { resumedFrom: lastRealtimeCheckpoint } : {}),
|
|
204
|
+
});
|
|
205
|
+
},
|
|
206
|
+
message: (message) => {
|
|
207
|
+
if (!disposed)
|
|
208
|
+
void handleRealtimeMessage(message);
|
|
209
|
+
},
|
|
210
|
+
disconnected: (info) => {
|
|
211
|
+
if (disposed || suppressRealtimeDisconnect)
|
|
212
|
+
return;
|
|
213
|
+
handleRealtimeFailure(info?.reason ?? "disconnected", undefined, info?.retryAfterMs);
|
|
214
|
+
},
|
|
215
|
+
error: (error) => {
|
|
216
|
+
if (disposed)
|
|
217
|
+
return;
|
|
218
|
+
emit({ type: "error", error });
|
|
219
|
+
handleRealtimeFailure("error", error);
|
|
220
|
+
},
|
|
221
|
+
});
|
|
222
|
+
if (disposed || activeRealtime !== source || fallbackActive) {
|
|
223
|
+
suppressRealtimeDisconnect = true;
|
|
224
|
+
try {
|
|
225
|
+
subscription.close();
|
|
226
|
+
}
|
|
227
|
+
finally {
|
|
228
|
+
suppressRealtimeDisconnect = false;
|
|
229
|
+
}
|
|
230
|
+
return false;
|
|
231
|
+
}
|
|
232
|
+
realtimeSubscription = subscription;
|
|
233
|
+
return true;
|
|
234
|
+
}
|
|
235
|
+
catch (error) {
|
|
236
|
+
cleanupRealtime(true);
|
|
237
|
+
emit({ type: "error", error });
|
|
238
|
+
startFallback("realtime-unavailable", error, source);
|
|
239
|
+
return false;
|
|
240
|
+
}
|
|
241
|
+
};
|
|
242
|
+
const handleRealtimeMessage = async (message) => {
|
|
243
|
+
if (disposed)
|
|
244
|
+
return;
|
|
245
|
+
armRealtimeStaleTimer(activeRealtime);
|
|
246
|
+
updateRealtimeCheckpoint(message);
|
|
247
|
+
if (!isExpectedPackageMessage(message))
|
|
248
|
+
return;
|
|
249
|
+
switch (message.type) {
|
|
250
|
+
case "ready":
|
|
251
|
+
case "heartbeat":
|
|
252
|
+
return;
|
|
253
|
+
case "stale":
|
|
254
|
+
emit({
|
|
255
|
+
type: "stale",
|
|
256
|
+
reason: message.reason ?? "realtime-stale",
|
|
257
|
+
...(message.retryAfterMs !== undefined ? { retryAfterMs: message.retryAfterMs } : {}),
|
|
258
|
+
fallback: activeRealtime?.fallbackOnStale === true,
|
|
259
|
+
});
|
|
260
|
+
if (activeRealtime?.fallbackOnStale === true) {
|
|
261
|
+
const source = activeRealtime;
|
|
262
|
+
cleanupRealtime(true);
|
|
263
|
+
startFallback(message.reason ?? "realtime-stale", undefined, source);
|
|
264
|
+
}
|
|
265
|
+
return;
|
|
266
|
+
case "updated":
|
|
267
|
+
if (!rememberRealtimeMutation(message))
|
|
268
|
+
return;
|
|
269
|
+
await applyRealtimeUpdate(message.update);
|
|
270
|
+
return;
|
|
271
|
+
case "refetch-required":
|
|
272
|
+
if (!rememberRealtimeMutation(message))
|
|
273
|
+
return;
|
|
274
|
+
await refetchFromRealtime(message.path, message.reason);
|
|
275
|
+
return;
|
|
276
|
+
case "reload-required":
|
|
277
|
+
if (!rememberRealtimeMutation(message))
|
|
278
|
+
return;
|
|
279
|
+
if (message.update) {
|
|
280
|
+
await applyRealtimeUpdate(message.update, message.reason);
|
|
281
|
+
}
|
|
282
|
+
else {
|
|
283
|
+
await refetchFromRealtime(undefined, message.reason);
|
|
284
|
+
}
|
|
285
|
+
return;
|
|
286
|
+
case "error":
|
|
287
|
+
emit({ type: "error", error: message.error });
|
|
288
|
+
if (message.terminal) {
|
|
289
|
+
const source = activeRealtime;
|
|
290
|
+
cleanupRealtime(true);
|
|
291
|
+
startFallback(message.code ?? "realtime-terminal-error", message.error, source);
|
|
292
|
+
}
|
|
293
|
+
return;
|
|
294
|
+
case "disconnected":
|
|
295
|
+
handleRealtimeFailure(message.reason ?? "disconnected", undefined, message.retryAfterMs);
|
|
296
|
+
return;
|
|
297
|
+
}
|
|
298
|
+
};
|
|
299
|
+
const applyRealtimeUpdate = async (update, reloadReason) => {
|
|
300
|
+
if (update.kind === "package") {
|
|
301
|
+
queueApply(buildRealtimeFetchResult(update.mapPackage), reloadReason);
|
|
302
|
+
return;
|
|
303
|
+
}
|
|
304
|
+
if (update.kind === "refetch") {
|
|
305
|
+
await refetchFromRealtime(update.path, reloadReason ?? "realtime-refetch-required");
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
308
|
+
emit({ type: "fallback", mode: "polling", reason: "realtime-patch-refetch" });
|
|
309
|
+
await refetchFromRealtime(undefined, reloadReason ?? "realtime-patch-refetch");
|
|
310
|
+
};
|
|
311
|
+
const refetchFromRealtime = async (path, reloadReason) => {
|
|
312
|
+
if (disposed)
|
|
313
|
+
return;
|
|
314
|
+
inFlight = true;
|
|
315
|
+
currentAbort = new AbortController();
|
|
316
|
+
const link = linkAbortSignals(options.signal, currentAbort.signal);
|
|
317
|
+
try {
|
|
318
|
+
const result = await fetchMapPackage(path ? { path } : locator, {
|
|
319
|
+
...options,
|
|
320
|
+
signal: link.signal,
|
|
321
|
+
});
|
|
322
|
+
lastFetchedPackage = result.mapPackage;
|
|
323
|
+
emit({ type: "fetched", result });
|
|
324
|
+
if (result.cache.status === "not-modified") {
|
|
325
|
+
emit({ type: "unchanged", result });
|
|
326
|
+
}
|
|
327
|
+
else {
|
|
328
|
+
queueApply(result, reloadReason);
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
catch (error) {
|
|
332
|
+
if (!disposed)
|
|
333
|
+
emit({ type: "error", error });
|
|
334
|
+
}
|
|
335
|
+
finally {
|
|
336
|
+
link.dispose();
|
|
337
|
+
inFlight = false;
|
|
338
|
+
currentAbort = undefined;
|
|
339
|
+
}
|
|
340
|
+
};
|
|
341
|
+
const handleRealtimeFailure = (reason, error, retryAfterMs) => {
|
|
342
|
+
const source = activeRealtime;
|
|
343
|
+
if (!source || disposed)
|
|
344
|
+
return;
|
|
345
|
+
cleanupRealtime(true);
|
|
346
|
+
const reconnect = source.reconnect;
|
|
347
|
+
if (reconnect !== false && reconnectAttempt < reconnect.maxAttempts) {
|
|
348
|
+
reconnectAttempt += 1;
|
|
349
|
+
emit({
|
|
350
|
+
type: "disconnected",
|
|
351
|
+
transport: source.transportKind,
|
|
352
|
+
reason,
|
|
353
|
+
willReconnect: true,
|
|
354
|
+
reconnectAttempt,
|
|
355
|
+
});
|
|
356
|
+
const delayMs = retryAfterMs ?? reconnectDelayMs(reconnectAttempt, reconnect);
|
|
357
|
+
reconnectTimer = setTimeout(() => {
|
|
358
|
+
reconnectTimer = undefined;
|
|
359
|
+
startRealtime();
|
|
360
|
+
}, delayMs);
|
|
361
|
+
return;
|
|
362
|
+
}
|
|
363
|
+
emit({ type: "disconnected", transport: source.transportKind, reason, willReconnect: false });
|
|
364
|
+
startFallback(reason, error, source);
|
|
365
|
+
};
|
|
366
|
+
const startFallback = (reason, error, source = activeRealtime) => {
|
|
367
|
+
const mode = source?.fallback ?? "polling";
|
|
368
|
+
if (fallbackActive)
|
|
369
|
+
return;
|
|
370
|
+
fallbackActive = true;
|
|
371
|
+
emit({ type: "fallback", mode, reason, ...(error ? { error } : {}) });
|
|
372
|
+
if (mode === "polling") {
|
|
373
|
+
void poll({ scheduleAfter: true, discoverRealtime: false });
|
|
374
|
+
}
|
|
375
|
+
};
|
|
376
|
+
const cleanupRealtime = (close) => {
|
|
377
|
+
clearRealtimeTimers();
|
|
378
|
+
const subscription = realtimeSubscription;
|
|
379
|
+
realtimeSubscription = undefined;
|
|
380
|
+
realtimeAbort?.abort();
|
|
381
|
+
realtimeAbort = undefined;
|
|
382
|
+
realtimeLinkDispose?.();
|
|
383
|
+
realtimeLinkDispose = undefined;
|
|
384
|
+
activeRealtime = undefined;
|
|
385
|
+
if (close && subscription) {
|
|
386
|
+
suppressRealtimeDisconnect = true;
|
|
387
|
+
try {
|
|
388
|
+
subscription.close();
|
|
389
|
+
}
|
|
390
|
+
finally {
|
|
391
|
+
suppressRealtimeDisconnect = false;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
};
|
|
395
|
+
const armRealtimeStaleTimer = (source) => {
|
|
396
|
+
if (staleTimer)
|
|
397
|
+
clearTimeout(staleTimer);
|
|
398
|
+
staleTimer = undefined;
|
|
399
|
+
if (!source?.staleAfterMs || disposed)
|
|
400
|
+
return;
|
|
401
|
+
staleTimer = setTimeout(() => {
|
|
402
|
+
staleTimer = undefined;
|
|
403
|
+
if (disposed)
|
|
404
|
+
return;
|
|
405
|
+
emit({ type: "stale", reason: "heartbeat-timeout", fallback: source.fallbackOnStale });
|
|
406
|
+
if (source.fallbackOnStale) {
|
|
407
|
+
cleanupRealtime(true);
|
|
408
|
+
startFallback("heartbeat-timeout", undefined, source);
|
|
409
|
+
}
|
|
410
|
+
}, source.staleAfterMs);
|
|
411
|
+
};
|
|
412
|
+
const resolveRealtimeSource = () => {
|
|
413
|
+
if (options.realtime === false)
|
|
414
|
+
return undefined;
|
|
415
|
+
const realtime = options.realtime ?? {};
|
|
416
|
+
const fallback = realtime.fallback ?? "polling";
|
|
417
|
+
const reconnect = normalizeReconnectOptions(realtime.reconnect);
|
|
418
|
+
if (realtime.transport) {
|
|
419
|
+
return {
|
|
420
|
+
type: "available",
|
|
421
|
+
source: {
|
|
422
|
+
transport: realtime.transport,
|
|
423
|
+
transportKind: realtime.transport.kind ?? "custom",
|
|
424
|
+
advertised: false,
|
|
425
|
+
fallback,
|
|
426
|
+
reconnect,
|
|
427
|
+
...(realtime.staleAfterMs !== undefined ? { staleAfterMs: normalizeDelay(realtime.staleAfterMs, 0) } : {}),
|
|
428
|
+
fallbackOnStale: realtime.fallbackOnStale !== false,
|
|
429
|
+
},
|
|
430
|
+
};
|
|
431
|
+
}
|
|
432
|
+
if (realtime.url) {
|
|
433
|
+
return {
|
|
434
|
+
type: "available",
|
|
435
|
+
source: {
|
|
436
|
+
transport: createMapPackageServerSentEventsTransport({
|
|
437
|
+
url: realtime.url,
|
|
438
|
+
eventSourceFactory: realtime.eventSourceFactory,
|
|
439
|
+
eventTypes: realtime.eventTypes,
|
|
440
|
+
withCredentials: realtime.withCredentials ?? cookieCredentials(realtime),
|
|
441
|
+
auth: realtime.auth,
|
|
442
|
+
}),
|
|
443
|
+
transportKind: "sse",
|
|
444
|
+
advertised: false,
|
|
445
|
+
url: realtime.url,
|
|
446
|
+
channel: MAP_PACKAGE_REALTIME_CHANNEL_V1,
|
|
447
|
+
fallback,
|
|
448
|
+
reconnect,
|
|
449
|
+
...(realtime.staleAfterMs !== undefined ? { staleAfterMs: normalizeDelay(realtime.staleAfterMs, 0) } : {}),
|
|
450
|
+
fallbackOnStale: realtime.fallbackOnStale !== false,
|
|
451
|
+
},
|
|
452
|
+
};
|
|
453
|
+
}
|
|
454
|
+
if (realtime.advertise === false)
|
|
455
|
+
return undefined;
|
|
456
|
+
const advertisement = readMapPackageRealtimeAdvertisement(lastFetchedPackage ?? previousPackage);
|
|
457
|
+
if (!advertisement)
|
|
458
|
+
return undefined;
|
|
459
|
+
const advertisedFallback = realtime.fallback ?? advertisement.fallback ?? "polling";
|
|
460
|
+
const advertisedTransport = advertisement.transport ?? "sse";
|
|
461
|
+
if (advertisedTransport !== "sse") {
|
|
462
|
+
return {
|
|
463
|
+
type: "unsupported",
|
|
464
|
+
reason: `unsupported-realtime-transport:${advertisedTransport}`,
|
|
465
|
+
fallback: advertisedFallback,
|
|
466
|
+
};
|
|
467
|
+
}
|
|
468
|
+
const url = advertisement.href ?? advertisement.url ?? advertisement.path;
|
|
469
|
+
if (!url) {
|
|
470
|
+
return { type: "unsupported", reason: "missing-realtime-url", fallback: advertisedFallback };
|
|
471
|
+
}
|
|
472
|
+
const advertisedUrlGuard = validateAdvertisedRealtimeUrl(url, options.client.serverBaseUrl, realtime);
|
|
473
|
+
if (advertisedUrlGuard) {
|
|
474
|
+
return { type: "unsupported", reason: advertisedUrlGuard, fallback: advertisedFallback };
|
|
475
|
+
}
|
|
476
|
+
const publicUrl = redactMapPackageRealtimeUrl(url);
|
|
477
|
+
return {
|
|
478
|
+
type: "available",
|
|
479
|
+
source: {
|
|
480
|
+
transport: createMapPackageServerSentEventsTransport({
|
|
481
|
+
url,
|
|
482
|
+
eventSourceFactory: realtime.eventSourceFactory,
|
|
483
|
+
eventTypes: realtime.eventTypes,
|
|
484
|
+
withCredentials: realtime.withCredentials ?? advertisement.withCredentials ?? cookieCredentials(realtime),
|
|
485
|
+
auth: realtime.auth,
|
|
486
|
+
}),
|
|
487
|
+
transportKind: "sse",
|
|
488
|
+
advertised: true,
|
|
489
|
+
url: publicUrl,
|
|
490
|
+
channel: advertisement.channel ?? MAP_PACKAGE_REALTIME_CHANNEL_V1,
|
|
491
|
+
fallback: advertisedFallback,
|
|
492
|
+
reconnect,
|
|
493
|
+
...(realtime.staleAfterMs !== undefined
|
|
494
|
+
? { staleAfterMs: normalizeDelay(realtime.staleAfterMs, 0) }
|
|
495
|
+
: advertisement.staleAfterMs !== undefined
|
|
496
|
+
? { staleAfterMs: normalizeDelay(advertisement.staleAfterMs, 0) }
|
|
497
|
+
: {}),
|
|
498
|
+
fallbackOnStale: realtime.fallbackOnStale !== false,
|
|
499
|
+
},
|
|
500
|
+
};
|
|
501
|
+
};
|
|
502
|
+
const buildRealtimeFetchResult = (mapPackage) => {
|
|
503
|
+
const path = resolveMapPackagePath(locator, options.resolvePath);
|
|
504
|
+
const validation = validateMapPackage(mapPackage, {
|
|
505
|
+
maxAgeMs: options.maxAgeMs,
|
|
506
|
+
now: options.now,
|
|
507
|
+
});
|
|
508
|
+
if (hasMapPackageDiagnosticErrors(validation.diagnostics) && options.allowInvalid !== true) {
|
|
509
|
+
throw new HonuaMapPackageError("MapPackage validation failed", {
|
|
510
|
+
packageId: mapPackage.mapPackageId,
|
|
511
|
+
stage: "validate",
|
|
512
|
+
detail: { diagnostics: validation.diagnostics, path },
|
|
513
|
+
});
|
|
514
|
+
}
|
|
515
|
+
return {
|
|
516
|
+
mapPackage,
|
|
517
|
+
diagnostics: validation.diagnostics,
|
|
518
|
+
cache: {
|
|
519
|
+
status: "refreshed",
|
|
520
|
+
key: path,
|
|
521
|
+
fetchedAt: new Date().toISOString(),
|
|
522
|
+
...(lastRealtimeCheckpoint?.validator ? { validator: lastRealtimeCheckpoint.validator } : {}),
|
|
523
|
+
},
|
|
524
|
+
};
|
|
525
|
+
};
|
|
526
|
+
const isExpectedPackageMessage = (message) => {
|
|
527
|
+
if (!message.packageId)
|
|
528
|
+
return true;
|
|
529
|
+
const expected = previousPackage?.mapPackageId ?? lastFetchedPackage?.mapPackageId ?? packageIdFromLocator(locator);
|
|
530
|
+
if (!expected || expected === message.packageId)
|
|
531
|
+
return true;
|
|
532
|
+
emit({
|
|
533
|
+
type: "error",
|
|
534
|
+
error: new HonuaMapPackageError("MapPackage realtime message packageId does not match watcher locator", {
|
|
535
|
+
packageId: message.packageId,
|
|
536
|
+
stage: "fetch",
|
|
537
|
+
detail: { expectedPackageId: expected },
|
|
538
|
+
}),
|
|
539
|
+
});
|
|
540
|
+
return false;
|
|
541
|
+
};
|
|
542
|
+
const updateRealtimeCheckpoint = (message) => {
|
|
543
|
+
lastRealtimeCheckpoint = {
|
|
544
|
+
...lastRealtimeCheckpoint,
|
|
545
|
+
...(message.eventId ? { eventId: message.eventId } : {}),
|
|
546
|
+
...(message.sequence !== undefined ? { sequence: message.sequence } : {}),
|
|
547
|
+
...(message.fingerprint ? { fingerprint: message.fingerprint } : {}),
|
|
548
|
+
...(message.updatedAt ? { updatedAt: message.updatedAt } : {}),
|
|
549
|
+
...(message.validator ? { validator: message.validator } : {}),
|
|
550
|
+
};
|
|
551
|
+
};
|
|
552
|
+
const rememberRealtimeMutation = (message) => {
|
|
553
|
+
if (message.eventId && seenRealtimeEventIds.includes(message.eventId))
|
|
554
|
+
return false;
|
|
555
|
+
if (message.sequence !== undefined &&
|
|
556
|
+
lastAppliedRealtimeSequence !== undefined &&
|
|
557
|
+
message.sequence <= lastAppliedRealtimeSequence) {
|
|
558
|
+
return false;
|
|
559
|
+
}
|
|
560
|
+
if (message.eventId) {
|
|
561
|
+
seenRealtimeEventIds.push(message.eventId);
|
|
562
|
+
if (seenRealtimeEventIds.length > 100)
|
|
563
|
+
seenRealtimeEventIds.shift();
|
|
564
|
+
}
|
|
565
|
+
if (message.sequence !== undefined)
|
|
566
|
+
lastAppliedRealtimeSequence = message.sequence;
|
|
567
|
+
return true;
|
|
568
|
+
};
|
|
569
|
+
const abortFromOptions = () => {
|
|
570
|
+
handle.dispose();
|
|
571
|
+
};
|
|
572
|
+
const handle = {
|
|
573
|
+
get disposed() {
|
|
574
|
+
return disposed;
|
|
575
|
+
},
|
|
576
|
+
refresh: () => poll({ scheduleAfter: false, discoverRealtime: true }),
|
|
577
|
+
dispose() {
|
|
578
|
+
if (disposed)
|
|
579
|
+
return;
|
|
580
|
+
disposed = true;
|
|
581
|
+
clearScheduled();
|
|
582
|
+
clearRealtimeTimers();
|
|
583
|
+
if (debounceTimer)
|
|
584
|
+
clearTimeout(debounceTimer);
|
|
585
|
+
debounceTimer = undefined;
|
|
586
|
+
pendingApply = undefined;
|
|
587
|
+
currentAbort?.abort();
|
|
588
|
+
cleanupRealtime(true);
|
|
589
|
+
options.signal?.removeEventListener("abort", abortFromOptions);
|
|
590
|
+
emit({ type: "disposed" });
|
|
591
|
+
},
|
|
592
|
+
};
|
|
593
|
+
if (options.signal?.aborted) {
|
|
594
|
+
handle.dispose();
|
|
595
|
+
return handle;
|
|
596
|
+
}
|
|
597
|
+
options.signal?.addEventListener("abort", abortFromOptions, { once: true });
|
|
598
|
+
if (options.immediate !== false) {
|
|
599
|
+
void poll({ scheduleAfter: false, discoverRealtime: true }).finally(() => {
|
|
600
|
+
if (!disposed && !realtimeSubscription && !fallbackActive) {
|
|
601
|
+
startRealtime();
|
|
602
|
+
schedule();
|
|
603
|
+
}
|
|
604
|
+
});
|
|
605
|
+
}
|
|
606
|
+
else if (!startRealtime()) {
|
|
607
|
+
schedule();
|
|
608
|
+
}
|
|
609
|
+
return handle;
|
|
610
|
+
}
|
|
611
|
+
function normalizeDelay(value, fallback) {
|
|
612
|
+
if (typeof value !== "number" || !Number.isFinite(value))
|
|
613
|
+
return fallback;
|
|
614
|
+
return Math.max(0, Math.trunc(value));
|
|
615
|
+
}
|
|
616
|
+
function normalizeReconnectOptions(value) {
|
|
617
|
+
if (value === false)
|
|
618
|
+
return false;
|
|
619
|
+
return {
|
|
620
|
+
maxAttempts: normalizeReconnectAttempts(value?.maxAttempts, DEFAULT_RECONNECT_OPTIONS.maxAttempts),
|
|
621
|
+
minDelayMs: normalizeDelay(value?.minDelayMs, DEFAULT_RECONNECT_OPTIONS.minDelayMs),
|
|
622
|
+
maxDelayMs: normalizeDelay(value?.maxDelayMs, DEFAULT_RECONNECT_OPTIONS.maxDelayMs),
|
|
623
|
+
factor: normalizeReconnectFactor(value?.factor),
|
|
624
|
+
};
|
|
625
|
+
}
|
|
626
|
+
function normalizeReconnectAttempts(value, fallback) {
|
|
627
|
+
if (value === Number.POSITIVE_INFINITY)
|
|
628
|
+
return Number.POSITIVE_INFINITY;
|
|
629
|
+
if (typeof value !== "number" || !Number.isFinite(value))
|
|
630
|
+
return fallback;
|
|
631
|
+
return Math.max(0, Math.trunc(value));
|
|
632
|
+
}
|
|
633
|
+
function normalizeReconnectFactor(value) {
|
|
634
|
+
if (typeof value !== "number" || !Number.isFinite(value))
|
|
635
|
+
return DEFAULT_RECONNECT_OPTIONS.factor;
|
|
636
|
+
return Math.max(1, value);
|
|
637
|
+
}
|
|
638
|
+
function reconnectDelayMs(attempt, options) {
|
|
639
|
+
const delay = options.minDelayMs * options.factor ** Math.max(0, attempt - 1);
|
|
640
|
+
return Math.min(options.maxDelayMs, Math.max(0, Math.trunc(delay)));
|
|
641
|
+
}
|
|
642
|
+
function cookieCredentials(options) {
|
|
643
|
+
return options.auth?.kind === "cookie" ? options.auth.withCredentials : undefined;
|
|
644
|
+
}
|
|
645
|
+
function validateAdvertisedRealtimeUrl(value, baseUrl, options) {
|
|
646
|
+
if (options.auth?.kind !== "query-token" || !isAbsoluteHttpUrl(value))
|
|
647
|
+
return undefined;
|
|
648
|
+
if (!isAbsoluteHttpUrl(baseUrl))
|
|
649
|
+
return "advertised-query-token-url-requires-absolute-base";
|
|
650
|
+
try {
|
|
651
|
+
const advertisedOrigin = new URL(value).origin;
|
|
652
|
+
if (advertisedOrigin === new URL(baseUrl).origin)
|
|
653
|
+
return undefined;
|
|
654
|
+
if (options.allowedAdvertisedOrigins?.includes(advertisedOrigin))
|
|
655
|
+
return undefined;
|
|
656
|
+
return "advertised-query-token-url-cross-origin";
|
|
657
|
+
}
|
|
658
|
+
catch {
|
|
659
|
+
return "invalid-advertised-realtime-url";
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
function isAbsoluteHttpUrl(value) {
|
|
663
|
+
return value.startsWith("http://") || value.startsWith("https://");
|
|
664
|
+
}
|
|
665
|
+
function packageIdFromLocator(locator) {
|
|
666
|
+
if (typeof locator === "string") {
|
|
667
|
+
if (locator.startsWith("/") || locator.startsWith("http://") || locator.startsWith("https://"))
|
|
668
|
+
return undefined;
|
|
669
|
+
const prefix = "honua://map-packages/";
|
|
670
|
+
if (locator.startsWith(prefix))
|
|
671
|
+
return decodeURIComponent(locator.slice(prefix.length));
|
|
672
|
+
return locator;
|
|
673
|
+
}
|
|
674
|
+
return locator.packageId ?? locator.id;
|
|
675
|
+
}
|
|
676
|
+
function linkAbortSignals(a, b) {
|
|
677
|
+
if (!a)
|
|
678
|
+
return { signal: b, dispose: () => undefined };
|
|
679
|
+
if (a.aborted)
|
|
680
|
+
return { signal: a, dispose: () => undefined };
|
|
681
|
+
if (b.aborted)
|
|
682
|
+
return { signal: b, dispose: () => undefined };
|
|
683
|
+
const controller = new AbortController();
|
|
684
|
+
const dispose = () => {
|
|
685
|
+
a.removeEventListener("abort", abort);
|
|
686
|
+
b.removeEventListener("abort", abort);
|
|
687
|
+
};
|
|
688
|
+
const abort = () => {
|
|
689
|
+
dispose();
|
|
690
|
+
controller.abort();
|
|
691
|
+
};
|
|
692
|
+
a.addEventListener("abort", abort, { once: true });
|
|
693
|
+
b.addEventListener("abort", abort, { once: true });
|
|
694
|
+
return { signal: controller.signal, dispose };
|
|
695
|
+
}
|