@honua/app-platform 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 +11 -0
- package/app/index.d.ts +164 -0
- package/app/index.d.ts.map +1 -0
- package/app/index.js +424 -0
- package/app-controller/controller.d.ts +425 -0
- package/app-controller/controller.d.ts.map +1 -0
- package/app-controller/controller.js +1173 -0
- package/app-controller/index.d.ts +14 -0
- package/app-controller/index.d.ts.map +1 -0
- package/app-controller/index.js +12 -0
- package/app-workspace/index.d.ts +421 -0
- package/app-workspace/index.d.ts.map +1 -0
- package/app-workspace/index.js +722 -0
- package/collaboration/client.d.ts +40 -0
- package/collaboration/client.d.ts.map +1 -0
- package/collaboration/client.js +299 -0
- package/collaboration/errors.d.ts +15 -0
- package/collaboration/errors.d.ts.map +1 -0
- package/collaboration/errors.js +17 -0
- package/collaboration/fixture.d.ts +41 -0
- package/collaboration/fixture.d.ts.map +1 -0
- package/collaboration/fixture.js +362 -0
- package/collaboration/index.d.ts +18 -0
- package/collaboration/index.d.ts.map +1 -0
- package/collaboration/index.js +14 -0
- package/collaboration/types.d.ts +240 -0
- package/collaboration/types.d.ts.map +1 -0
- package/collaboration/types.js +1 -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 +63 -0
- package/contract/index.d.ts.map +1 -0
- package/contract/index.js +52 -0
- package/contract/jobs.d.ts +149 -0
- package/contract/jobs.d.ts.map +1 -0
- package/contract/jobs.js +40 -0
- package/contract/pmtiles.d.ts +162 -0
- package/contract/pmtiles.d.ts.map +1 -0
- package/contract/pmtiles.js +155 -0
- package/contract/source.d.ts +447 -0
- package/contract/source.d.ts.map +1 -0
- package/contract/source.js +3909 -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 +694 -0
- package/contract/types.d.ts.map +1 -0
- package/contract/types.js +183 -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/controls/basemap-style-binding.d.ts +54 -0
- package/controls/basemap-style-binding.d.ts.map +1 -0
- package/controls/basemap-style-binding.js +199 -0
- package/controls/basemap-switcher.d.ts +95 -0
- package/controls/basemap-switcher.d.ts.map +1 -0
- package/controls/basemap-switcher.js +379 -0
- package/controls/element-utils.d.ts +48 -0
- package/controls/element-utils.d.ts.map +1 -0
- package/controls/element-utils.js +78 -0
- package/controls/index.d.ts +33 -0
- package/controls/index.d.ts.map +1 -0
- package/controls/index.js +30 -0
- package/controls/layer-list.d.ts +98 -0
- package/controls/layer-list.d.ts.map +1 -0
- package/controls/layer-list.js +375 -0
- package/controls/legend-derive.d.ts +53 -0
- package/controls/legend-derive.d.ts.map +1 -0
- package/controls/legend-derive.js +196 -0
- package/controls/legend.d.ts +104 -0
- package/controls/legend.d.ts.map +1 -0
- package/controls/legend.js +381 -0
- package/controls/swipe-control.d.ts +80 -0
- package/controls/swipe-control.d.ts.map +1 -0
- package/controls/swipe-control.js +368 -0
- package/controls/types.d.ts +227 -0
- package/controls/types.d.ts.map +1 -0
- package/controls/types.js +11 -0
- 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/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 +607 -0
- package/core/client.d.ts.map +1 -0
- package/core/client.js +1716 -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 +139 -0
- package/core/errors.d.ts.map +1 -0
- package/core/errors.js +176 -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/geoparquet-sql.d.ts +162 -0
- package/core/geoparquet-sql.d.ts.map +1 -0
- package/core/geoparquet-sql.js +333 -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-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 +23 -0
- package/core/ogc-features.d.ts.map +1 -0
- package/core/ogc-features.js +129 -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-static.d.ts +51 -0
- package/core/stac-static.d.ts.map +1 -0
- package/core/stac-static.js +195 -0
- package/core/stac.d.ts +67 -0
- package/core/stac.d.ts.map +1 -0
- package/core/stac.js +259 -0
- package/core/surfaces.d.ts +540 -0
- package/core/surfaces.d.ts.map +1 -0
- package/core/surfaces.js +1964 -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 +1404 -0
- package/core/types.d.ts.map +1 -0
- package/core/types.js +13 -0
- package/core/wfs-capabilities.d.ts +153 -0
- package/core/wfs-capabilities.d.ts.map +1 -0
- package/core/wfs-capabilities.js +490 -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 +232 -0
- package/core/wfs.d.ts.map +1 -0
- package/core/wfs.js +426 -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 +74 -0
- package/esri-compat/identity-manager.d.ts.map +1 -0
- package/esri-compat/identity-manager.js +245 -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 +50 -0
- package/esri-compat/oauth-info.d.ts.map +1 -0
- package/esri-compat/oauth-info.js +142 -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/filter-registry/index.d.ts +145 -0
- package/filter-registry/index.d.ts.map +1 -0
- package/filter-registry/index.js +531 -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/geocoding/index.d.ts +106 -0
- package/geocoding/index.d.ts.map +1 -0
- package/geocoding/index.js +278 -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/operate/client.d.ts +94 -0
- package/operate/client.d.ts.map +1 -0
- package/operate/client.js +361 -0
- package/operate/index.d.ts +22 -0
- package/operate/index.d.ts.map +1 -0
- package/operate/index.js +19 -0
- package/operate/types.d.ts +397 -0
- package/operate/types.d.ts.map +1 -0
- package/operate/types.js +17 -0
- package/operator/client.d.ts +60 -0
- package/operator/client.d.ts.map +1 -0
- package/operator/client.js +20 -0
- package/operator/controllers/approval.d.ts +52 -0
- package/operator/controllers/approval.d.ts.map +1 -0
- package/operator/controllers/approval.js +123 -0
- package/operator/controllers/base.d.ts +27 -0
- package/operator/controllers/base.d.ts.map +1 -0
- package/operator/controllers/base.js +53 -0
- package/operator/controllers/builder-workspace.d.ts +55 -0
- package/operator/controllers/builder-workspace.d.ts.map +1 -0
- package/operator/controllers/builder-workspace.js +108 -0
- package/operator/controllers/chat.d.ts +61 -0
- package/operator/controllers/chat.d.ts.map +1 -0
- package/operator/controllers/chat.js +154 -0
- package/operator/controllers/clarification.d.ts +52 -0
- package/operator/controllers/clarification.d.ts.map +1 -0
- package/operator/controllers/clarification.js +121 -0
- package/operator/controllers/execution.d.ts +60 -0
- package/operator/controllers/execution.d.ts.map +1 -0
- package/operator/controllers/execution.js +286 -0
- package/operator/controllers/index.d.ts +23 -0
- package/operator/controllers/index.d.ts.map +1 -0
- package/operator/controllers/index.js +15 -0
- package/operator/controllers/map-workspace.d.ts +85 -0
- package/operator/controllers/map-workspace.d.ts.map +1 -0
- package/operator/controllers/map-workspace.js +296 -0
- package/operator/controllers/plan-review.d.ts +66 -0
- package/operator/controllers/plan-review.d.ts.map +1 -0
- package/operator/controllers/plan-review.js +124 -0
- package/operator/errors.d.ts +62 -0
- package/operator/errors.d.ts.map +1 -0
- package/operator/errors.js +75 -0
- package/operator/i18n/index.d.ts +10 -0
- package/operator/i18n/index.d.ts.map +1 -0
- package/operator/i18n/index.js +8 -0
- package/operator/i18n/messages.d.ts +19 -0
- package/operator/i18n/messages.d.ts.map +1 -0
- package/operator/i18n/messages.js +54 -0
- package/operator/index.d.ts +19 -0
- package/operator/index.d.ts.map +1 -0
- package/operator/index.js +15 -0
- package/operator/telemetry.d.ts +26 -0
- package/operator/telemetry.d.ts.map +1 -0
- package/operator/telemetry.js +9 -0
- package/operator/theming/index.d.ts +12 -0
- package/operator/theming/index.d.ts.map +1 -0
- package/operator/theming/index.js +9 -0
- package/operator/theming/provider.d.ts +27 -0
- package/operator/theming/provider.d.ts.map +1 -0
- package/operator/theming/provider.js +26 -0
- package/operator/theming/tokens.d.ts +28 -0
- package/operator/theming/tokens.d.ts.map +1 -0
- package/operator/theming/tokens.js +65 -0
- package/operator/workspace/events.d.ts +70 -0
- package/operator/workspace/events.d.ts.map +1 -0
- package/operator/workspace/events.js +9 -0
- package/operator/workspace/index.d.ts +12 -0
- package/operator/workspace/index.d.ts.map +1 -0
- package/operator/workspace/index.js +8 -0
- package/operator/workspace/types.d.ts +178 -0
- package/operator/workspace/types.d.ts.map +1 -0
- package/operator/workspace/types.js +47 -0
- package/operator/workspace/workspace.d.ts +58 -0
- package/operator/workspace/workspace.d.ts.map +1 -0
- package/operator/workspace/workspace.js +339 -0
- package/package.json +105 -0
- package/realtime/exploration.d.ts +16 -0
- package/realtime/exploration.d.ts.map +1 -0
- package/realtime/exploration.js +32 -0
- package/realtime/honua-server.d.ts +123 -0
- package/realtime/honua-server.d.ts.map +1 -0
- package/realtime/honua-server.js +188 -0
- package/realtime/index.d.ts +20 -0
- package/realtime/index.d.ts.map +1 -0
- package/realtime/index.js +14 -0
- package/realtime/projections.d.ts +30 -0
- package/realtime/projections.d.ts.map +1 -0
- package/realtime/projections.js +51 -0
- package/realtime/reducer.d.ts +14 -0
- package/realtime/reducer.d.ts.map +1 -0
- package/realtime/reducer.js +351 -0
- package/realtime/sse.d.ts +23 -0
- package/realtime/sse.d.ts.map +1 -0
- package/realtime/sse.js +143 -0
- package/realtime/store.d.ts +18 -0
- package/realtime/store.d.ts.map +1 -0
- package/realtime/store.js +63 -0
- package/realtime/types.d.ts +190 -0
- package/realtime/types.d.ts.map +1 -0
- package/realtime/types.js +10 -0
- package/replica-sync/client.d.ts +32 -0
- package/replica-sync/client.d.ts.map +1 -0
- package/replica-sync/client.js +52 -0
- package/replica-sync/errors.d.ts +22 -0
- package/replica-sync/errors.d.ts.map +1 -0
- package/replica-sync/errors.js +29 -0
- package/replica-sync/fixture.d.ts +40 -0
- package/replica-sync/fixture.d.ts.map +1 -0
- package/replica-sync/fixture.js +364 -0
- package/replica-sync/index.d.ts +22 -0
- package/replica-sync/index.d.ts.map +1 -0
- package/replica-sync/index.js +17 -0
- package/replica-sync/types.d.ts +270 -0
- package/replica-sync/types.d.ts.map +1 -0
- package/replica-sync/types.js +13 -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 +40 -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 +272 -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 +30 -0
- package/runtime/map-package-validation.d.ts.map +1 -0
- package/runtime/map-package-validation.js +257 -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/pmtiles-protocol.d.ts +77 -0
- package/runtime/pmtiles-protocol.d.ts.map +1 -0
- package/runtime/pmtiles-protocol.js +120 -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 +428 -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/scene-workspace/analysis-widgets.d.ts +334 -0
- package/scene-workspace/analysis-widgets.d.ts.map +1 -0
- package/scene-workspace/analysis-widgets.js +424 -0
- package/scene-workspace/cesium-adapter.d.ts +438 -0
- package/scene-workspace/cesium-adapter.d.ts.map +1 -0
- package/scene-workspace/cesium-adapter.js +493 -0
- package/scene-workspace/index.d.ts +21 -0
- package/scene-workspace/index.d.ts.map +1 -0
- package/scene-workspace/index.js +14 -0
- package/scene-workspace/primitives.d.ts +162 -0
- package/scene-workspace/primitives.d.ts.map +1 -0
- package/scene-workspace/primitives.js +255 -0
- package/scene-workspace/scene-discovery.d.ts +196 -0
- package/scene-workspace/scene-discovery.d.ts.map +1 -0
- package/scene-workspace/scene-discovery.js +228 -0
- package/scene-workspace/scene-view.d.ts +209 -0
- package/scene-workspace/scene-view.d.ts.map +1 -0
- package/scene-workspace/scene-view.js +267 -0
- package/scene-workspace/types.d.ts +229 -0
- package/scene-workspace/types.d.ts.map +1 -0
- package/scene-workspace/types.js +23 -0
- package/scene-workspace/workspace.d.ts +13 -0
- package/scene-workspace/workspace.d.ts.map +1 -0
- package/scene-workspace/workspace.js +391 -0
- package/share/denial.d.ts +78 -0
- package/share/denial.d.ts.map +1 -0
- package/share/denial.js +61 -0
- package/share/embed-token.d.ts +71 -0
- package/share/embed-token.d.ts.map +1 -0
- package/share/embed-token.js +99 -0
- package/share/index.d.ts +35 -0
- package/share/index.d.ts.map +1 -0
- package/share/index.js +30 -0
- package/share/open-data.d.ts +114 -0
- package/share/open-data.d.ts.map +1 -0
- package/share/open-data.js +81 -0
- package/share/types.d.ts +163 -0
- package/share/types.d.ts.map +1 -0
- package/share/types.js +17 -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/web-components/controller.d.ts +39 -0
- package/web-components/controller.d.ts.map +1 -0
- package/web-components/controller.js +640 -0
- package/web-components/elements.d.ts +210 -0
- package/web-components/elements.d.ts.map +1 -0
- package/web-components/elements.js +1651 -0
- package/web-components/index.d.ts +24 -0
- package/web-components/index.d.ts.map +1 -0
- package/web-components/index.js +22 -0
- package/web-components/maplibre-renderer.d.ts +22 -0
- package/web-components/maplibre-renderer.d.ts.map +1 -0
- package/web-components/maplibre-renderer.js +474 -0
- package/web-components/types.d.ts +397 -0
- package/web-components/types.d.ts.map +1 -0
- package/web-components/types.js +1 -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,351 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure reducer helpers for realtime feature state.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
const DEFAULT_MAX_SEEN_EVENT_IDS = 256;
|
|
7
|
+
const DEFAULT_MAX_TOMBSTONES = 1024;
|
|
8
|
+
export function emptyRealtimeFeatureState() {
|
|
9
|
+
return {
|
|
10
|
+
status: "idle",
|
|
11
|
+
records: {},
|
|
12
|
+
tombstones: {},
|
|
13
|
+
ignoredEventCount: 0,
|
|
14
|
+
seenEventIds: [],
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export function realtimeFeatureKey(sourceId, id) {
|
|
18
|
+
return `${sourceId ?? ""}:${String(id)}`;
|
|
19
|
+
}
|
|
20
|
+
export function realtimeSubscriptionKey(request) {
|
|
21
|
+
return [
|
|
22
|
+
request.requestId ?? "",
|
|
23
|
+
request.sourceId,
|
|
24
|
+
request.layerId === undefined ? "" : String(request.layerId),
|
|
25
|
+
request.where ?? "",
|
|
26
|
+
request.fields?.join(",") ?? "",
|
|
27
|
+
encodeIdentityPart(request.spatialFilter),
|
|
28
|
+
].join("\u0000");
|
|
29
|
+
}
|
|
30
|
+
export function realtimeResumeCheckpoint(state) {
|
|
31
|
+
if (!state.checkpoint)
|
|
32
|
+
return undefined;
|
|
33
|
+
return { ...state.checkpoint };
|
|
34
|
+
}
|
|
35
|
+
export function reduceRealtimeFeatureState(state, event, options = {}) {
|
|
36
|
+
if (isDuplicateOrOutOfOrder(state, event)) {
|
|
37
|
+
return {
|
|
38
|
+
...state,
|
|
39
|
+
ignoredEventCount: state.ignoredEventCount + 1,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
const receivedAt = event.receivedAt ?? options.now?.() ?? Date.now();
|
|
43
|
+
const base = withEventMetadata(state, event, receivedAt, options.maxSeenEventIds ?? DEFAULT_MAX_SEEN_EVENT_IDS);
|
|
44
|
+
const metadata = mutationMetadata(event, receivedAt);
|
|
45
|
+
switch (event.type) {
|
|
46
|
+
case "snapshot":
|
|
47
|
+
return applySnapshot(base, event.features, {
|
|
48
|
+
replace: event.replace ?? true,
|
|
49
|
+
...metadata,
|
|
50
|
+
});
|
|
51
|
+
case "upsert":
|
|
52
|
+
return applyUpsert(base, event.feature, metadata);
|
|
53
|
+
case "delete":
|
|
54
|
+
return boundTombstones(applyDelete(base, {
|
|
55
|
+
id: event.id,
|
|
56
|
+
sourceId: event.sourceId,
|
|
57
|
+
cursor: metadata.cursor,
|
|
58
|
+
sequence: metadata.sequence,
|
|
59
|
+
version: event.version,
|
|
60
|
+
updatedAt: event.updatedAt,
|
|
61
|
+
deletedAt: event.deletedAt ?? receivedAt,
|
|
62
|
+
}), options, receivedAt);
|
|
63
|
+
case "delta":
|
|
64
|
+
return boundTombstones(applyDelta(base, event.upserts ?? [], event.deletes ?? [], metadata), options, receivedAt);
|
|
65
|
+
case "heartbeat":
|
|
66
|
+
return {
|
|
67
|
+
...base,
|
|
68
|
+
status: base.status === "closed" || base.status === "error" ? base.status : "live",
|
|
69
|
+
lastHeartbeatAt: receivedAt,
|
|
70
|
+
staleSince: undefined,
|
|
71
|
+
error: base.status === "error" ? base.error : undefined,
|
|
72
|
+
statusReason: base.status === "error" ? base.statusReason : undefined,
|
|
73
|
+
retryAfterMs: base.status === "error" ? base.retryAfterMs : undefined,
|
|
74
|
+
reconnectAttempt: base.status === "error" ? base.reconnectAttempt : undefined,
|
|
75
|
+
};
|
|
76
|
+
case "status":
|
|
77
|
+
return {
|
|
78
|
+
...base,
|
|
79
|
+
status: event.status,
|
|
80
|
+
lastStatusAt: receivedAt,
|
|
81
|
+
staleSince: event.status === "stale" ? (event.staleSince ?? receivedAt) : undefined,
|
|
82
|
+
error: event.status === "error" ? base.error : undefined,
|
|
83
|
+
statusReason: event.reason,
|
|
84
|
+
retryAfterMs: event.retryAfterMs,
|
|
85
|
+
reconnectAttempt: event.reconnectAttempt,
|
|
86
|
+
terminalError: event.status === "error" ? base.terminalError : undefined,
|
|
87
|
+
};
|
|
88
|
+
case "error":
|
|
89
|
+
return {
|
|
90
|
+
...base,
|
|
91
|
+
status: event.terminal ? "error" : "reconnecting",
|
|
92
|
+
lastStatusAt: receivedAt,
|
|
93
|
+
error: event.error,
|
|
94
|
+
statusReason: event.code,
|
|
95
|
+
retryAfterMs: event.retryAfterMs,
|
|
96
|
+
terminalError: event.terminal === true,
|
|
97
|
+
staleSince: event.terminal ? base.staleSince : receivedAt,
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
export function reconcileRealtimeStaleness(state, options) {
|
|
102
|
+
const now = options.now ?? Date.now();
|
|
103
|
+
const lastLiveAt = state.lastHeartbeatAt ?? state.lastEventAt;
|
|
104
|
+
if (!lastLiveAt || now - lastLiveAt <= options.staleAfterMs)
|
|
105
|
+
return state;
|
|
106
|
+
if (state.status === "closed" || state.status === "error" || state.status === "offline")
|
|
107
|
+
return state;
|
|
108
|
+
return {
|
|
109
|
+
...state,
|
|
110
|
+
status: "stale",
|
|
111
|
+
staleSince: state.staleSince ?? lastLiveAt + options.staleAfterMs,
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
function isDuplicateOrOutOfOrder(state, event) {
|
|
115
|
+
if (event.eventId && state.seenEventIds.includes(event.eventId))
|
|
116
|
+
return true;
|
|
117
|
+
const sequence = eventSequence(event);
|
|
118
|
+
return typeof sequence === "number" && typeof state.lastSequence === "number" && sequence <= state.lastSequence;
|
|
119
|
+
}
|
|
120
|
+
function withEventMetadata(state, event, receivedAt, maxSeenEventIds) {
|
|
121
|
+
const seenEventIds = event.eventId
|
|
122
|
+
? [...state.seenEventIds, event.eventId].slice(-Math.max(1, maxSeenEventIds))
|
|
123
|
+
: state.seenEventIds;
|
|
124
|
+
const sequence = eventSequence(event);
|
|
125
|
+
const checkpoint = mergeCheckpoint(state.checkpoint, event);
|
|
126
|
+
const cursor = eventCursor(event) ?? state.cursor;
|
|
127
|
+
const watermark = eventWatermark(event) ?? state.watermark;
|
|
128
|
+
const timestamp = eventTimestamp(event) ?? state.timestamp;
|
|
129
|
+
const deltaToken = eventDeltaToken(event) ?? state.deltaToken;
|
|
130
|
+
const status = isRecoverableStatus(state.status) ? "live" : state.status;
|
|
131
|
+
return {
|
|
132
|
+
...state,
|
|
133
|
+
status,
|
|
134
|
+
cursor,
|
|
135
|
+
watermark,
|
|
136
|
+
timestamp,
|
|
137
|
+
deltaToken,
|
|
138
|
+
checkpoint,
|
|
139
|
+
lastSequence: typeof sequence === "number" ? sequence : state.lastSequence,
|
|
140
|
+
lastEventAt: receivedAt,
|
|
141
|
+
staleSince: undefined,
|
|
142
|
+
error: status === "live" ? undefined : state.error,
|
|
143
|
+
seenEventIds,
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
function applySnapshot(state, features, metadata) {
|
|
147
|
+
const records = metadata.replace ? {} : { ...state.records };
|
|
148
|
+
const tombstones = metadata.replace ? {} : { ...state.tombstones };
|
|
149
|
+
for (const feature of features) {
|
|
150
|
+
const key = realtimeFeatureKey(feature.sourceId, feature.id);
|
|
151
|
+
records[key] = {
|
|
152
|
+
...feature,
|
|
153
|
+
key,
|
|
154
|
+
cursor: metadata.cursor,
|
|
155
|
+
sequence: metadata.sequence,
|
|
156
|
+
receivedAt: metadata.receivedAt,
|
|
157
|
+
};
|
|
158
|
+
delete tombstones[key];
|
|
159
|
+
}
|
|
160
|
+
return {
|
|
161
|
+
...state,
|
|
162
|
+
records,
|
|
163
|
+
tombstones,
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
function applyDelta(state, upserts, deletes, metadata) {
|
|
167
|
+
if (upserts.length === 0 && deletes.length === 0) {
|
|
168
|
+
return state;
|
|
169
|
+
}
|
|
170
|
+
// Build the next records/tombstones maps once and mutate them across every
|
|
171
|
+
// item in the batch. The previous implementation delegated to
|
|
172
|
+
// applyUpsert/applyDelete per item, each of which spread the entire records
|
|
173
|
+
// (and tombstones) dictionary — O(deltaSize x stateSize): a 100-mutation
|
|
174
|
+
// delta over a 10k-feature state copied ~1M entries.
|
|
175
|
+
const records = { ...state.records };
|
|
176
|
+
const tombstones = { ...state.tombstones };
|
|
177
|
+
for (const feature of upserts) {
|
|
178
|
+
const key = realtimeFeatureKey(feature.sourceId, feature.id);
|
|
179
|
+
delete tombstones[key];
|
|
180
|
+
records[key] = {
|
|
181
|
+
...feature,
|
|
182
|
+
key,
|
|
183
|
+
cursor: metadata.cursor,
|
|
184
|
+
sequence: metadata.sequence,
|
|
185
|
+
receivedAt: metadata.receivedAt,
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
for (const tombstone of deletes) {
|
|
189
|
+
const key = realtimeFeatureKey(tombstone.sourceId, tombstone.id);
|
|
190
|
+
delete records[key];
|
|
191
|
+
tombstones[key] = {
|
|
192
|
+
id: tombstone.id,
|
|
193
|
+
sourceId: tombstone.sourceId,
|
|
194
|
+
cursor: metadata.cursor,
|
|
195
|
+
sequence: metadata.sequence,
|
|
196
|
+
version: tombstone.version,
|
|
197
|
+
updatedAt: tombstone.updatedAt,
|
|
198
|
+
deletedAt: tombstone.deletedAt ?? metadata.receivedAt,
|
|
199
|
+
key,
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
return {
|
|
203
|
+
...state,
|
|
204
|
+
records,
|
|
205
|
+
tombstones,
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Evict tombstones that exceed the configured age (`tombstoneTtlMs`) or count
|
|
210
|
+
* (`maxTombstones`, default {@link DEFAULT_MAX_TOMBSTONES}) bound. Returns the
|
|
211
|
+
* input state unchanged when nothing is pruned so reducers stay referentially
|
|
212
|
+
* stable on the common path.
|
|
213
|
+
*/
|
|
214
|
+
function boundTombstones(state, options, now) {
|
|
215
|
+
const maxTombstones = options.maxTombstones ?? DEFAULT_MAX_TOMBSTONES;
|
|
216
|
+
const ttlMs = options.tombstoneTtlMs;
|
|
217
|
+
const hasTtl = typeof ttlMs === "number" && ttlMs >= 0;
|
|
218
|
+
const entries = Object.values(state.tombstones);
|
|
219
|
+
const overCount = maxTombstones > 0 && entries.length > maxTombstones;
|
|
220
|
+
if (!overCount && !hasTtl) {
|
|
221
|
+
return state;
|
|
222
|
+
}
|
|
223
|
+
let kept = entries;
|
|
224
|
+
if (hasTtl) {
|
|
225
|
+
kept = kept.filter((tombstone) => now - (tombstone.deletedAt ?? 0) <= ttlMs);
|
|
226
|
+
}
|
|
227
|
+
if (maxTombstones > 0 && kept.length > maxTombstones) {
|
|
228
|
+
// Retain the most-recently-deleted entries.
|
|
229
|
+
kept = [...kept].sort((a, b) => (a.deletedAt ?? 0) - (b.deletedAt ?? 0)).slice(kept.length - maxTombstones);
|
|
230
|
+
}
|
|
231
|
+
if (kept.length === entries.length) {
|
|
232
|
+
return state;
|
|
233
|
+
}
|
|
234
|
+
const tombstones = {};
|
|
235
|
+
for (const tombstone of kept) {
|
|
236
|
+
tombstones[tombstone.key] = tombstone;
|
|
237
|
+
}
|
|
238
|
+
return { ...state, tombstones };
|
|
239
|
+
}
|
|
240
|
+
function applyUpsert(state, feature, metadata) {
|
|
241
|
+
const key = realtimeFeatureKey(feature.sourceId, feature.id);
|
|
242
|
+
const tombstones = { ...state.tombstones };
|
|
243
|
+
delete tombstones[key];
|
|
244
|
+
return {
|
|
245
|
+
...state,
|
|
246
|
+
records: {
|
|
247
|
+
...state.records,
|
|
248
|
+
[key]: {
|
|
249
|
+
...feature,
|
|
250
|
+
key,
|
|
251
|
+
cursor: metadata.cursor,
|
|
252
|
+
sequence: metadata.sequence,
|
|
253
|
+
receivedAt: metadata.receivedAt,
|
|
254
|
+
},
|
|
255
|
+
},
|
|
256
|
+
tombstones,
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
function applyDelete(state, tombstone) {
|
|
260
|
+
const key = realtimeFeatureKey(tombstone.sourceId, tombstone.id);
|
|
261
|
+
const records = { ...state.records };
|
|
262
|
+
delete records[key];
|
|
263
|
+
return {
|
|
264
|
+
...state,
|
|
265
|
+
records,
|
|
266
|
+
tombstones: {
|
|
267
|
+
...state.tombstones,
|
|
268
|
+
[key]: {
|
|
269
|
+
...tombstone,
|
|
270
|
+
key,
|
|
271
|
+
},
|
|
272
|
+
},
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
function eventCursor(event) {
|
|
276
|
+
return event.checkpoint?.cursor ?? event.cursor;
|
|
277
|
+
}
|
|
278
|
+
function eventWatermark(event) {
|
|
279
|
+
return event.checkpoint?.watermark ?? event.watermark;
|
|
280
|
+
}
|
|
281
|
+
function eventTimestamp(event) {
|
|
282
|
+
return event.checkpoint?.timestamp ?? event.timestamp;
|
|
283
|
+
}
|
|
284
|
+
function eventDeltaToken(event) {
|
|
285
|
+
return event.checkpoint?.deltaToken ?? event.deltaToken;
|
|
286
|
+
}
|
|
287
|
+
function eventSequence(event) {
|
|
288
|
+
return event.sequence ?? event.checkpoint?.sequence;
|
|
289
|
+
}
|
|
290
|
+
function mutationMetadata(event, receivedAt) {
|
|
291
|
+
return {
|
|
292
|
+
cursor: eventCursor(event),
|
|
293
|
+
sequence: eventSequence(event),
|
|
294
|
+
receivedAt,
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
function mergeCheckpoint(previous, event) {
|
|
298
|
+
const cursor = eventCursor(event);
|
|
299
|
+
const watermark = eventWatermark(event);
|
|
300
|
+
const timestamp = eventTimestamp(event);
|
|
301
|
+
const sequence = eventSequence(event);
|
|
302
|
+
const deltaToken = eventDeltaToken(event);
|
|
303
|
+
if (previous === undefined &&
|
|
304
|
+
cursor === undefined &&
|
|
305
|
+
watermark === undefined &&
|
|
306
|
+
timestamp === undefined &&
|
|
307
|
+
sequence === undefined &&
|
|
308
|
+
deltaToken === undefined) {
|
|
309
|
+
return undefined;
|
|
310
|
+
}
|
|
311
|
+
return {
|
|
312
|
+
...(previous ?? {}),
|
|
313
|
+
...(cursor !== undefined ? { cursor } : {}),
|
|
314
|
+
...(watermark !== undefined ? { watermark } : {}),
|
|
315
|
+
...(timestamp !== undefined ? { timestamp } : {}),
|
|
316
|
+
...(sequence !== undefined ? { sequence } : {}),
|
|
317
|
+
...(deltaToken !== undefined ? { deltaToken } : {}),
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
function isRecoverableStatus(status) {
|
|
321
|
+
return (status === "idle" ||
|
|
322
|
+
status === "connecting" ||
|
|
323
|
+
status === "reconnecting" ||
|
|
324
|
+
status === "stale" ||
|
|
325
|
+
status === "offline");
|
|
326
|
+
}
|
|
327
|
+
function encodeIdentityPart(value) {
|
|
328
|
+
if (value === undefined)
|
|
329
|
+
return "";
|
|
330
|
+
if (typeof value !== "object" || value === null)
|
|
331
|
+
return String(value);
|
|
332
|
+
try {
|
|
333
|
+
return JSON.stringify(sortIdentityValue(value));
|
|
334
|
+
}
|
|
335
|
+
catch {
|
|
336
|
+
return String(value);
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
function sortIdentityValue(value) {
|
|
340
|
+
if (value instanceof Date)
|
|
341
|
+
return value.toISOString();
|
|
342
|
+
if (Array.isArray(value))
|
|
343
|
+
return value.map(sortIdentityValue);
|
|
344
|
+
if (typeof value !== "object" || value === null)
|
|
345
|
+
return value;
|
|
346
|
+
const sorted = {};
|
|
347
|
+
for (const key of Object.keys(value).sort()) {
|
|
348
|
+
sorted[key] = sortIdentityValue(value[key]);
|
|
349
|
+
}
|
|
350
|
+
return sorted;
|
|
351
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { RealtimeFeatureEvent, RealtimeFeatureTransport, RealtimeSubscriptionRequest } from "./types.js";
|
|
2
|
+
export interface RealtimeServerSentEventSource {
|
|
3
|
+
readonly readyState?: number;
|
|
4
|
+
onopen: ((event: Event) => void) | null;
|
|
5
|
+
onmessage: ((event: MessageEvent<string>) => void) | null;
|
|
6
|
+
onerror: ((event: Event) => void) | null;
|
|
7
|
+
close(): void;
|
|
8
|
+
addEventListener?(type: string, listener: (event: MessageEvent<string>) => void): void;
|
|
9
|
+
removeEventListener?(type: string, listener: (event: MessageEvent<string>) => void): void;
|
|
10
|
+
}
|
|
11
|
+
export type RealtimeServerSentEventSourceFactory = (url: string, init?: EventSourceInit) => RealtimeServerSentEventSource;
|
|
12
|
+
export interface RealtimeServerSentEventsTransportOptions<TFeature = unknown> {
|
|
13
|
+
readonly url: string;
|
|
14
|
+
readonly eventSourceFactory?: RealtimeServerSentEventSourceFactory;
|
|
15
|
+
readonly withCredentials?: boolean;
|
|
16
|
+
readonly eventTypes?: ReadonlyArray<string>;
|
|
17
|
+
readonly encodeRequest?: (url: URL, request: RealtimeSubscriptionRequest) => void;
|
|
18
|
+
readonly decodeEvent?: (payload: unknown) => RealtimeFeatureEvent<TFeature>;
|
|
19
|
+
}
|
|
20
|
+
export declare function createRealtimeServerSentEventsTransport<TFeature = unknown>(options: RealtimeServerSentEventsTransportOptions<TFeature>): RealtimeFeatureTransport<TFeature>;
|
|
21
|
+
export declare function encodeDefaultRealtimeRequest(url: URL, request: RealtimeSubscriptionRequest): URL;
|
|
22
|
+
export declare function decodeRealtimeServerSentEvent<TFeature = unknown>(payload: unknown): RealtimeFeatureEvent<TFeature>;
|
|
23
|
+
//# sourceMappingURL=sse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sse.d.ts","sourceRoot":"","sources":["../../../src/realtime/sse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EAEpB,wBAAwB,EAExB,2BAA2B,EAC5B,MAAM,YAAY,CAAC;AAEpB,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,MAAM,EAAE,CAAC,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC;IACxC,SAAS,EAAE,CAAC,CAAC,KAAK,EAAE,YAAY,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC;IAC1D,OAAO,EAAE,CAAC,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC;IACzC,KAAK,IAAI,IAAI,CAAC;IACd,gBAAgB,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,YAAY,CAAC,MAAM,CAAC,KAAK,IAAI,GAAG,IAAI,CAAC;IACvF,mBAAmB,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,YAAY,CAAC,MAAM,CAAC,KAAK,IAAI,GAAG,IAAI,CAAC;CAC3F;AAED,MAAM,MAAM,oCAAoC,GAAG,CACjD,GAAG,EAAE,MAAM,EACX,IAAI,CAAC,EAAE,eAAe,KACnB,6BAA6B,CAAC;AAEnC,MAAM,WAAW,wCAAwC,CAAC,QAAQ,GAAG,OAAO;IAC1E,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,kBAAkB,CAAC,EAAE,oCAAoC,CAAC;IACnE,QAAQ,CAAC,eAAe,CAAC,EAAE,OAAO,CAAC;IACnC,QAAQ,CAAC,UAAU,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAC5C,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,2BAA2B,KAAK,IAAI,CAAC;IAClF,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,oBAAoB,CAAC,QAAQ,CAAC,CAAC;CAC7E;AAID,wBAAgB,uCAAuC,CAAC,QAAQ,GAAG,OAAO,EACxE,OAAO,EAAE,wCAAwC,CAAC,QAAQ,CAAC,GAC1D,wBAAwB,CAAC,QAAQ,CAAC,CAyEpC;AAED,wBAAgB,4BAA4B,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,2BAA2B,GAAG,GAAG,CAsBhG;AAED,wBAAgB,6BAA6B,CAAC,QAAQ,GAAG,OAAO,EAAE,OAAO,EAAE,OAAO,GAAG,oBAAoB,CAAC,QAAQ,CAAC,CAUlH"}
|
package/realtime/sse.js
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
const DEFAULT_EVENT_TYPES = ["snapshot", "upsert", "delete", "delta", "heartbeat", "status", "error"];
|
|
2
|
+
export function createRealtimeServerSentEventsTransport(options) {
|
|
3
|
+
return {
|
|
4
|
+
capabilities: {
|
|
5
|
+
kind: "sse",
|
|
6
|
+
resumeModes: ["cursor", "watermark", "timestamp", "sequence", "delta-token"],
|
|
7
|
+
emitsHeartbeats: true,
|
|
8
|
+
emitsWatermarks: true,
|
|
9
|
+
},
|
|
10
|
+
subscribe(request, observer) {
|
|
11
|
+
// If the caller's signal is already aborted at subscribe time, the
|
|
12
|
+
// "abort" event has already fired and will never fire again, so the
|
|
13
|
+
// listener registered below would never run and the EventSource would
|
|
14
|
+
// leak (open connection + auto-reconnect + attached listeners). Bail
|
|
15
|
+
// out synchronously before constructing anything, mirroring the
|
|
16
|
+
// up-front `signal?.aborted` guard used elsewhere (e.g. core/batch.ts).
|
|
17
|
+
if (request.signal?.aborted) {
|
|
18
|
+
observer.complete();
|
|
19
|
+
return { close: () => { } };
|
|
20
|
+
}
|
|
21
|
+
const url = new URL(options.url, "http://honua.local");
|
|
22
|
+
encodeDefaultRealtimeRequest(url, request);
|
|
23
|
+
options.encodeRequest?.(url, request);
|
|
24
|
+
const source = createEventSource(resolveEventSourceUrl(options.url, url), options);
|
|
25
|
+
let closed = false;
|
|
26
|
+
const listeners = [];
|
|
27
|
+
const emitPayload = (payload) => {
|
|
28
|
+
if (closed || payload.trim() === "")
|
|
29
|
+
return;
|
|
30
|
+
try {
|
|
31
|
+
observer.next((options.decodeEvent ?? (decodeRealtimeServerSentEvent))(JSON.parse(payload)));
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
observer.error(error);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
const messageListener = (event) => emitPayload(event.data);
|
|
38
|
+
source.onopen = () => {
|
|
39
|
+
if (!closed)
|
|
40
|
+
observer.next({ type: "status", status: "live", receivedAt: Date.now() });
|
|
41
|
+
};
|
|
42
|
+
source.onmessage = messageListener;
|
|
43
|
+
source.onerror = (event) => {
|
|
44
|
+
if (!closed)
|
|
45
|
+
observer.next({ type: "status", status: "reconnecting", reason: "sse-error", receivedAt: Date.now() });
|
|
46
|
+
if (isEventSourceClosed(source))
|
|
47
|
+
observer.error(event);
|
|
48
|
+
};
|
|
49
|
+
for (const type of options.eventTypes ?? DEFAULT_EVENT_TYPES) {
|
|
50
|
+
if (!source.addEventListener)
|
|
51
|
+
break;
|
|
52
|
+
const listener = (event) => emitPayload(event.data);
|
|
53
|
+
source.addEventListener(type, listener);
|
|
54
|
+
listeners.push([type, listener]);
|
|
55
|
+
}
|
|
56
|
+
const abortListener = () => closeSource();
|
|
57
|
+
request.signal?.addEventListener("abort", abortListener, { once: true });
|
|
58
|
+
function closeSource() {
|
|
59
|
+
if (closed)
|
|
60
|
+
return;
|
|
61
|
+
closed = true;
|
|
62
|
+
request.signal?.removeEventListener("abort", abortListener);
|
|
63
|
+
for (const [type, listener] of listeners)
|
|
64
|
+
source.removeEventListener?.(type, listener);
|
|
65
|
+
source.onopen = null;
|
|
66
|
+
source.onmessage = null;
|
|
67
|
+
source.onerror = null;
|
|
68
|
+
source.close();
|
|
69
|
+
observer.complete();
|
|
70
|
+
}
|
|
71
|
+
return {
|
|
72
|
+
close: closeSource,
|
|
73
|
+
};
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
export function encodeDefaultRealtimeRequest(url, request) {
|
|
78
|
+
url.searchParams.set("sourceId", String(request.sourceId));
|
|
79
|
+
if (request.layerId !== undefined)
|
|
80
|
+
url.searchParams.set("layerId", String(request.layerId));
|
|
81
|
+
if (request.requestId)
|
|
82
|
+
url.searchParams.set("requestId", request.requestId);
|
|
83
|
+
if (request.mode)
|
|
84
|
+
url.searchParams.set("mode", request.mode);
|
|
85
|
+
if (request.where)
|
|
86
|
+
url.searchParams.set("where", request.where);
|
|
87
|
+
if (request.fields?.length)
|
|
88
|
+
url.searchParams.set("fields", request.fields.join(","));
|
|
89
|
+
if (request.cursor ?? request.resumeFrom?.cursor)
|
|
90
|
+
url.searchParams.set("cursor", request.cursor ?? request.resumeFrom?.cursor ?? "");
|
|
91
|
+
if (request.watermark ?? request.resumeFrom?.watermark) {
|
|
92
|
+
url.searchParams.set("watermark", request.watermark ?? request.resumeFrom?.watermark ?? "");
|
|
93
|
+
}
|
|
94
|
+
if (request.timestamp ?? request.resumeFrom?.timestamp) {
|
|
95
|
+
url.searchParams.set("timestamp", request.timestamp ?? request.resumeFrom?.timestamp ?? "");
|
|
96
|
+
}
|
|
97
|
+
if (request.deltaToken ?? request.resumeFrom?.deltaToken) {
|
|
98
|
+
url.searchParams.set("deltaToken", request.deltaToken ?? request.resumeFrom?.deltaToken ?? "");
|
|
99
|
+
}
|
|
100
|
+
if (request.resumeFrom?.sequence !== undefined)
|
|
101
|
+
url.searchParams.set("sequence", String(request.resumeFrom.sequence));
|
|
102
|
+
if (request.spatialFilter !== undefined)
|
|
103
|
+
url.searchParams.set("spatialFilter", JSON.stringify(request.spatialFilter));
|
|
104
|
+
if (request.metadata !== undefined)
|
|
105
|
+
url.searchParams.set("metadata", JSON.stringify(request.metadata));
|
|
106
|
+
return url;
|
|
107
|
+
}
|
|
108
|
+
export function decodeRealtimeServerSentEvent(payload) {
|
|
109
|
+
if (!isRecord(payload))
|
|
110
|
+
throw new Error("Realtime SSE payload must be a JSON object.");
|
|
111
|
+
if (typeof payload.type === "string")
|
|
112
|
+
return payload;
|
|
113
|
+
if (isRecord(payload.event) && typeof payload.event.type === "string") {
|
|
114
|
+
return payload.event;
|
|
115
|
+
}
|
|
116
|
+
if (typeof payload.kind === "string") {
|
|
117
|
+
return { ...payload, type: payload.kind };
|
|
118
|
+
}
|
|
119
|
+
throw new Error("Realtime SSE payload is missing an event type.");
|
|
120
|
+
}
|
|
121
|
+
function createEventSource(url, options) {
|
|
122
|
+
if (options.eventSourceFactory) {
|
|
123
|
+
return options.eventSourceFactory(url, { withCredentials: options.withCredentials });
|
|
124
|
+
}
|
|
125
|
+
// The global `EventSource` is a constructor: calling it as a plain
|
|
126
|
+
// function (`EventSource(url, init)`) throws a TypeError in browsers,
|
|
127
|
+
// so the default path must construct with `new`.
|
|
128
|
+
const EventSourceCtor = globalThis.EventSource;
|
|
129
|
+
if (!EventSourceCtor)
|
|
130
|
+
throw new Error("EventSource is not available; provide eventSourceFactory for this runtime.");
|
|
131
|
+
return new EventSourceCtor(url, { withCredentials: options.withCredentials });
|
|
132
|
+
}
|
|
133
|
+
function resolveEventSourceUrl(input, url) {
|
|
134
|
+
if (input.startsWith("http://") || input.startsWith("https://"))
|
|
135
|
+
return url.toString();
|
|
136
|
+
return `${url.pathname}${url.search}`;
|
|
137
|
+
}
|
|
138
|
+
function isEventSourceClosed(source) {
|
|
139
|
+
return source.readyState === 2;
|
|
140
|
+
}
|
|
141
|
+
function isRecord(value) {
|
|
142
|
+
return typeof value === "object" && value !== null;
|
|
143
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Store and transport bridge for realtime feature state.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import type { RealtimeFeatureEvent, RealtimeFeatureState, RealtimeFeatureTransport, RealtimeReducerOptions, RealtimeStalenessOptions, RealtimeStateListener, RealtimeSubscriptionHandle, RealtimeSubscriptionRequest } from "./types.js";
|
|
7
|
+
export interface RealtimeFeatureStore<TFeature = unknown> {
|
|
8
|
+
readonly state: RealtimeFeatureState<TFeature>;
|
|
9
|
+
apply(event: RealtimeFeatureEvent<TFeature>): RealtimeFeatureState<TFeature>;
|
|
10
|
+
checkStale(options: RealtimeStalenessOptions): RealtimeFeatureState<TFeature>;
|
|
11
|
+
subscribe(listener: RealtimeStateListener<TFeature>, options?: {
|
|
12
|
+
readonly fireImmediately?: boolean;
|
|
13
|
+
}): () => void;
|
|
14
|
+
connect(transport: RealtimeFeatureTransport<TFeature>, request: RealtimeSubscriptionRequest): RealtimeSubscriptionHandle;
|
|
15
|
+
close(): void;
|
|
16
|
+
}
|
|
17
|
+
export declare function createRealtimeFeatureStore<TFeature = unknown>(initialState?: RealtimeFeatureState<TFeature>, options?: RealtimeReducerOptions): RealtimeFeatureStore<TFeature>;
|
|
18
|
+
//# sourceMappingURL=store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../../src/realtime/store.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EACV,oBAAoB,EACpB,oBAAoB,EACpB,wBAAwB,EACxB,sBAAsB,EACtB,wBAAwB,EACxB,qBAAqB,EACrB,0BAA0B,EAC1B,2BAA2B,EAC5B,MAAM,YAAY,CAAC;AAEpB,MAAM,WAAW,oBAAoB,CAAC,QAAQ,GAAG,OAAO;IACtD,QAAQ,CAAC,KAAK,EAAE,oBAAoB,CAAC,QAAQ,CAAC,CAAC;IAC/C,KAAK,CAAC,KAAK,EAAE,oBAAoB,CAAC,QAAQ,CAAC,GAAG,oBAAoB,CAAC,QAAQ,CAAC,CAAC;IAC7E,UAAU,CAAC,OAAO,EAAE,wBAAwB,GAAG,oBAAoB,CAAC,QAAQ,CAAC,CAAC;IAC9E,SAAS,CAAC,QAAQ,EAAE,qBAAqB,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,eAAe,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,MAAM,IAAI,CAAC;IACnH,OAAO,CACL,SAAS,EAAE,wBAAwB,CAAC,QAAQ,CAAC,EAC7C,OAAO,EAAE,2BAA2B,GACnC,0BAA0B,CAAC;IAC9B,KAAK,IAAI,IAAI,CAAC;CACf;AAED,wBAAgB,0BAA0B,CAAC,QAAQ,GAAG,OAAO,EAC3D,YAAY,GAAE,oBAAoB,CAAC,QAAQ,CAAyC,EACpF,OAAO,GAAE,sBAA2B,GACnC,oBAAoB,CAAC,QAAQ,CAAC,CA2DhC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Store and transport bridge for realtime feature state.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import { emptyRealtimeFeatureState, reconcileRealtimeStaleness, reduceRealtimeFeatureState } from "./reducer.js";
|
|
7
|
+
export function createRealtimeFeatureStore(initialState = emptyRealtimeFeatureState(), options = {}) {
|
|
8
|
+
let state = initialState;
|
|
9
|
+
let activeHandle;
|
|
10
|
+
const listeners = new Set();
|
|
11
|
+
function emit(event) {
|
|
12
|
+
for (const listener of [...listeners])
|
|
13
|
+
listener(state, event);
|
|
14
|
+
}
|
|
15
|
+
function setState(next, event) {
|
|
16
|
+
if (Object.is(state, next))
|
|
17
|
+
return state;
|
|
18
|
+
state = next;
|
|
19
|
+
emit(event);
|
|
20
|
+
return state;
|
|
21
|
+
}
|
|
22
|
+
return {
|
|
23
|
+
get state() {
|
|
24
|
+
return state;
|
|
25
|
+
},
|
|
26
|
+
apply(event) {
|
|
27
|
+
return setState(reduceRealtimeFeatureState(state, event, options), event);
|
|
28
|
+
},
|
|
29
|
+
checkStale(stalenessOptions) {
|
|
30
|
+
return setState(reconcileRealtimeStaleness(state, stalenessOptions), undefined);
|
|
31
|
+
},
|
|
32
|
+
subscribe(listener, subscribeOptions = {}) {
|
|
33
|
+
listeners.add(listener);
|
|
34
|
+
if (subscribeOptions.fireImmediately)
|
|
35
|
+
listener(state, undefined);
|
|
36
|
+
return () => {
|
|
37
|
+
listeners.delete(listener);
|
|
38
|
+
};
|
|
39
|
+
},
|
|
40
|
+
connect(transport, request) {
|
|
41
|
+
activeHandle?.close();
|
|
42
|
+
this.apply({ type: "status", status: "connecting" });
|
|
43
|
+
activeHandle = transport.subscribe(request, {
|
|
44
|
+
next: (event) => this.apply(event),
|
|
45
|
+
error: (error) => this.apply({ type: "error", error }),
|
|
46
|
+
complete: () => this.apply({ type: "status", status: "closed" }),
|
|
47
|
+
});
|
|
48
|
+
return {
|
|
49
|
+
close: () => {
|
|
50
|
+
activeHandle?.close();
|
|
51
|
+
activeHandle = undefined;
|
|
52
|
+
this.apply({ type: "status", status: "closed" });
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
},
|
|
56
|
+
close() {
|
|
57
|
+
activeHandle?.close();
|
|
58
|
+
activeHandle = undefined;
|
|
59
|
+
setState({ ...state, status: "closed" }, { type: "status", status: "closed" });
|
|
60
|
+
listeners.clear();
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
}
|