@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,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared helpers for talking to an OAuth2 token endpoint and turning responses
|
|
3
|
+
* into {@link StoredCredential}s. Used by both the PKCE and client-credentials
|
|
4
|
+
* providers.
|
|
5
|
+
*
|
|
6
|
+
* @packageDocumentation
|
|
7
|
+
*/
|
|
8
|
+
import { HonuaAuthError } from "../errors.js";
|
|
9
|
+
/**
|
|
10
|
+
* Project a {@link StoredCredential} into the {@link HonuaAuthCredentials} shape
|
|
11
|
+
* the client attaches to requests. Non-`Bearer` token types are emitted as a
|
|
12
|
+
* full `Authorization` value; the expiry drives the client's own refresh skew.
|
|
13
|
+
*/
|
|
14
|
+
export function toHonuaCredentials(credential) {
|
|
15
|
+
const result = {};
|
|
16
|
+
if (credential.tokenType && credential.tokenType.toLowerCase() !== "bearer") {
|
|
17
|
+
result.authorization = `${credential.tokenType} ${credential.accessToken}`;
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
result.bearerToken = credential.accessToken;
|
|
21
|
+
}
|
|
22
|
+
if (credential.expiresAt !== undefined) {
|
|
23
|
+
result.expiresAt = credential.expiresAt;
|
|
24
|
+
}
|
|
25
|
+
return result;
|
|
26
|
+
}
|
|
27
|
+
/** Resolve `serviceKey`, defaulting to `${clientId}@${endpoint origin}`. */
|
|
28
|
+
export function resolveServiceKey(serviceKey, clientId, endpoint) {
|
|
29
|
+
if (serviceKey) {
|
|
30
|
+
return serviceKey;
|
|
31
|
+
}
|
|
32
|
+
let origin = endpoint;
|
|
33
|
+
try {
|
|
34
|
+
origin = new URL(endpoint).origin;
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
// Non-absolute endpoint (tests) — fall back to the raw string.
|
|
38
|
+
}
|
|
39
|
+
return `${clientId}@${origin}`;
|
|
40
|
+
}
|
|
41
|
+
/** Default clock-skew tolerance (ms) applied to credential expiry checks. */
|
|
42
|
+
export const DEFAULT_CLOCK_SKEW_MS = 60_000;
|
|
43
|
+
/** True when a credential is missing or within `skewMs` of (or past) expiry. */
|
|
44
|
+
export function isCredentialExpiring(credential, skewMs) {
|
|
45
|
+
if (!credential) {
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
48
|
+
if (credential.expiresAt === undefined) {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
return credential.expiresAt - Date.now() <= skewMs;
|
|
52
|
+
}
|
|
53
|
+
/** Map a token response into a {@link StoredCredential} (clock-skew tolerant). */
|
|
54
|
+
export function credentialFromTokenResponse(response, previous) {
|
|
55
|
+
const credential = {
|
|
56
|
+
accessToken: response.access_token,
|
|
57
|
+
};
|
|
58
|
+
if (response.token_type) {
|
|
59
|
+
credential.tokenType = response.token_type;
|
|
60
|
+
}
|
|
61
|
+
// Some authorization servers omit a rotated refresh token on refresh; keep
|
|
62
|
+
// the previous one so silent refresh keeps working (RFC 6749 §6).
|
|
63
|
+
const refreshToken = response.refresh_token ?? previous?.refreshToken;
|
|
64
|
+
if (refreshToken) {
|
|
65
|
+
credential.refreshToken = refreshToken;
|
|
66
|
+
}
|
|
67
|
+
if (typeof response.expires_in === "number" && Number.isFinite(response.expires_in)) {
|
|
68
|
+
credential.expiresAt = Date.now() + response.expires_in * 1000;
|
|
69
|
+
}
|
|
70
|
+
const scope = response.scope ?? previous?.scope;
|
|
71
|
+
if (scope) {
|
|
72
|
+
credential.scope = scope;
|
|
73
|
+
}
|
|
74
|
+
if (response.id_token) {
|
|
75
|
+
credential.idToken = response.id_token;
|
|
76
|
+
}
|
|
77
|
+
return credential;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* POST an `application/x-www-form-urlencoded` grant to the token endpoint and
|
|
81
|
+
* return the parsed {@link StoredCredential}.
|
|
82
|
+
*
|
|
83
|
+
* Errors are normalized to {@link HonuaAuthError}: an `invalid_grant` OAuth
|
|
84
|
+
* error (expired/revoked/invalid grant → re-auth needed) maps to code
|
|
85
|
+
* `invalid_grant`; every other transport/HTTP/parse failure maps to
|
|
86
|
+
* `refresh_failed` (transient, retry may succeed).
|
|
87
|
+
*/
|
|
88
|
+
export async function requestToken(options) {
|
|
89
|
+
const body = new URLSearchParams(options.params);
|
|
90
|
+
let response;
|
|
91
|
+
try {
|
|
92
|
+
response = await options.fetchFn(options.tokenEndpoint, {
|
|
93
|
+
method: "POST",
|
|
94
|
+
headers: {
|
|
95
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
96
|
+
Accept: "application/json",
|
|
97
|
+
},
|
|
98
|
+
body: body.toString(),
|
|
99
|
+
...(options.signal ? { signal: options.signal } : {}),
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
catch (cause) {
|
|
103
|
+
throw new HonuaAuthError("refresh_failed", "Token request failed at the transport layer.", { cause });
|
|
104
|
+
}
|
|
105
|
+
const text = await response.text();
|
|
106
|
+
let payload;
|
|
107
|
+
try {
|
|
108
|
+
payload = text ? JSON.parse(text) : {};
|
|
109
|
+
}
|
|
110
|
+
catch (cause) {
|
|
111
|
+
throw new HonuaAuthError("refresh_failed", `Token endpoint returned a non-JSON response (HTTP ${response.status}).`, {
|
|
112
|
+
cause,
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
if (!response.ok) {
|
|
116
|
+
const oauthError = isObject(payload) && typeof payload.error === "string" ? payload.error : undefined;
|
|
117
|
+
const description = isObject(payload) && typeof payload.error_description === "string" ? payload.error_description : undefined;
|
|
118
|
+
const message = `Token endpoint rejected the grant (HTTP ${response.status}${oauthError ? `, ${oauthError}` : ""})${description ? `: ${description}` : ""}`;
|
|
119
|
+
if (oauthError === "invalid_grant") {
|
|
120
|
+
throw new HonuaAuthError("invalid_grant", message, { cause: payload });
|
|
121
|
+
}
|
|
122
|
+
throw new HonuaAuthError("refresh_failed", message, { cause: payload });
|
|
123
|
+
}
|
|
124
|
+
if (!isObject(payload) || typeof payload.access_token !== "string") {
|
|
125
|
+
throw new HonuaAuthError("refresh_failed", "Token endpoint response is missing an access_token.", {
|
|
126
|
+
cause: payload,
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
return credentialFromTokenResponse(payload, options.previous);
|
|
130
|
+
}
|
|
131
|
+
function isObject(value) {
|
|
132
|
+
return typeof value === "object" && value !== null;
|
|
133
|
+
}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared types for the built-in {@link HonuaAuthProvider} implementations
|
|
3
|
+
* (`oauth2`, `clientCredentials`, `apiKeyAuth`, `bearerTokenAuth`) and the
|
|
4
|
+
* pluggable {@link CredentialStore}.
|
|
5
|
+
*
|
|
6
|
+
* @packageDocumentation
|
|
7
|
+
*/
|
|
8
|
+
import type { HonuaAuthError } from "../errors.js";
|
|
9
|
+
/**
|
|
10
|
+
* A persisted OAuth2 credential. Access/refresh tokens plus expiry are stored
|
|
11
|
+
* in a {@link CredentialStore}; the SDK only ever attaches `accessToken` as a
|
|
12
|
+
* bearer credential and uses `refreshToken`/`expiresAt` to drive silent
|
|
13
|
+
* refresh.
|
|
14
|
+
*/
|
|
15
|
+
export interface StoredCredential {
|
|
16
|
+
/** The bearer access token attached to outgoing requests. */
|
|
17
|
+
accessToken: string;
|
|
18
|
+
/** Token type from the token response; defaults to `Bearer`. */
|
|
19
|
+
tokenType?: string;
|
|
20
|
+
/** Refresh token, when the authorization server issued one. */
|
|
21
|
+
refreshToken?: string;
|
|
22
|
+
/** Absolute expiry as epoch milliseconds (from `expires_in`). */
|
|
23
|
+
expiresAt?: number;
|
|
24
|
+
/** Granted scope string, if the token response narrowed it. */
|
|
25
|
+
scope?: string;
|
|
26
|
+
/** OpenID Connect ID token, when present (never sent to resource servers). */
|
|
27
|
+
idToken?: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Pluggable credential persistence. The default is an in-memory store scoped to
|
|
31
|
+
* the provider instance. Browser adapters (`sessionStorageCredentialStore`,
|
|
32
|
+
* `localStorageCredentialStore`) are explicit opt-in because Web Storage is
|
|
33
|
+
* readable by any script on the origin (XSS exfiltration risk) — see
|
|
34
|
+
* `docs/auth.md`.
|
|
35
|
+
*
|
|
36
|
+
* Keys are namespaced per origin/service by the provider so tokens for one
|
|
37
|
+
* service are never returned for another.
|
|
38
|
+
*/
|
|
39
|
+
export interface CredentialStore {
|
|
40
|
+
get(key: string): StoredCredential | undefined | Promise<StoredCredential | undefined>;
|
|
41
|
+
set(key: string, value: StoredCredential): void | Promise<void>;
|
|
42
|
+
delete(key: string): void | Promise<void>;
|
|
43
|
+
}
|
|
44
|
+
/** Lifecycle events emitted by the OAuth2 / client-credentials providers. */
|
|
45
|
+
export type HonuaAuthEvent = {
|
|
46
|
+
type: "signed-in";
|
|
47
|
+
credential: StoredCredential;
|
|
48
|
+
} | {
|
|
49
|
+
type: "token-refreshed";
|
|
50
|
+
credential: StoredCredential;
|
|
51
|
+
} | {
|
|
52
|
+
type: "refresh-failed";
|
|
53
|
+
error: HonuaAuthError;
|
|
54
|
+
} | {
|
|
55
|
+
type: "signed-out";
|
|
56
|
+
};
|
|
57
|
+
/** Listener registered with `provider.on(...)`. */
|
|
58
|
+
export type HonuaAuthEventListener = (event: HonuaAuthEvent) => void;
|
|
59
|
+
/** Handle returned by `provider.on(...)`; call `remove()` to unsubscribe. */
|
|
60
|
+
export interface HonuaAuthEventHandle {
|
|
61
|
+
remove(): void;
|
|
62
|
+
}
|
|
63
|
+
/** Interactive sign-in mode for the OAuth2 authorization-code + PKCE flow. */
|
|
64
|
+
export type OAuth2SignInMode = "redirect" | "popup";
|
|
65
|
+
/**
|
|
66
|
+
* Configuration for the OAuth2 authorization-code + PKCE provider produced by
|
|
67
|
+
* {@link oauth2}. Only WebCrypto is used for PKCE (Node ≥20 exposes
|
|
68
|
+
* `globalThis.crypto`); no new hard dependencies are introduced.
|
|
69
|
+
*/
|
|
70
|
+
export interface OAuth2Config {
|
|
71
|
+
/** Authorization endpoint (where the browser is redirected to sign in). */
|
|
72
|
+
authorizationEndpoint: string;
|
|
73
|
+
/** Token endpoint (code exchange + refresh). */
|
|
74
|
+
tokenEndpoint: string;
|
|
75
|
+
/** Public client identifier. */
|
|
76
|
+
clientId: string;
|
|
77
|
+
/** Registered redirect URI that receives the authorization `code`+`state`. */
|
|
78
|
+
redirectUri: string;
|
|
79
|
+
/** Requested scopes. */
|
|
80
|
+
scopes?: readonly string[];
|
|
81
|
+
/** Interactive mode. Defaults to `redirect`. */
|
|
82
|
+
mode?: OAuth2SignInMode;
|
|
83
|
+
/**
|
|
84
|
+
* Credential store. Defaults to an in-memory store. Scoped per
|
|
85
|
+
* origin/service via {@link OAuth2Config.serviceKey}.
|
|
86
|
+
*/
|
|
87
|
+
store?: CredentialStore;
|
|
88
|
+
/**
|
|
89
|
+
* Stable key that scopes stored credentials to this service. Defaults to
|
|
90
|
+
* `${clientId}@${origin of tokenEndpoint}` so tokens are never shared across
|
|
91
|
+
* services or origins.
|
|
92
|
+
*/
|
|
93
|
+
serviceKey?: string;
|
|
94
|
+
/**
|
|
95
|
+
* Clock-skew tolerance in milliseconds. A credential is treated as expiring
|
|
96
|
+
* this long before its real expiry so a refresh happens before requests fail.
|
|
97
|
+
* Defaults to 60_000.
|
|
98
|
+
*/
|
|
99
|
+
clockSkewMs?: number;
|
|
100
|
+
/** Optional revocation endpoint (RFC 7009) called on `signOut()`. */
|
|
101
|
+
revocationEndpoint?: string;
|
|
102
|
+
/** Extra query params appended to the authorization request. */
|
|
103
|
+
extraAuthorizationParams?: Record<string, string>;
|
|
104
|
+
/** Extra body params appended to token/refresh requests. */
|
|
105
|
+
extraTokenParams?: Record<string, string>;
|
|
106
|
+
/** Popup window features string (popup mode). */
|
|
107
|
+
popupFeatures?: string;
|
|
108
|
+
/** Override `fetch` (Node/tests). Defaults to `globalThis.fetch`. */
|
|
109
|
+
fetchFn?: typeof fetch;
|
|
110
|
+
/**
|
|
111
|
+
* Window used for redirect/popup + transaction persistence. Defaults to
|
|
112
|
+
* `globalThis.window`. Injectable for tests / non-DOM hosts.
|
|
113
|
+
*/
|
|
114
|
+
windowRef?: Window;
|
|
115
|
+
/** Auth lifecycle listener. */
|
|
116
|
+
onEvent?: HonuaAuthEventListener;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Configuration for the OAuth2 client-credentials provider produced by
|
|
120
|
+
* {@link clientCredentials}. Intended for confidential Node clients — the
|
|
121
|
+
* client secret must never ship to a browser.
|
|
122
|
+
*/
|
|
123
|
+
export interface ClientCredentialsConfig {
|
|
124
|
+
tokenEndpoint: string;
|
|
125
|
+
clientId: string;
|
|
126
|
+
clientSecret: string;
|
|
127
|
+
scopes?: readonly string[];
|
|
128
|
+
store?: CredentialStore;
|
|
129
|
+
serviceKey?: string;
|
|
130
|
+
clockSkewMs?: number;
|
|
131
|
+
extraTokenParams?: Record<string, string>;
|
|
132
|
+
fetchFn?: typeof fetch;
|
|
133
|
+
onEvent?: HonuaAuthEventListener;
|
|
134
|
+
}
|
|
135
|
+
/** Raw OAuth2 token endpoint response shape (RFC 6749 §5.1). */
|
|
136
|
+
export interface OAuth2TokenResponse {
|
|
137
|
+
access_token: string;
|
|
138
|
+
token_type?: string;
|
|
139
|
+
expires_in?: number;
|
|
140
|
+
refresh_token?: string;
|
|
141
|
+
scope?: string;
|
|
142
|
+
id_token?: string;
|
|
143
|
+
}
|
|
144
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/core/auth/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAC/B,6DAA6D;IAC7D,WAAW,EAAE,MAAM,CAAC;IACpB,gEAAgE;IAChE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,+DAA+D;IAC/D,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iEAAiE;IACjE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,+DAA+D;IAC/D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8EAA8E;IAC9E,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;GASG;AACH,MAAM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AM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB"}
|
package/core/batch.d.ts
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { HonuaClient } from "./client.js";
|
|
2
|
+
import type { HonuaQueryResponse, MapLayerQueryRequest, QueryFeaturesRequest } from "./types.js";
|
|
3
|
+
/** A single query item in a batch. */
|
|
4
|
+
export interface BatchQueryItem {
|
|
5
|
+
/** When `"map-layer"`, calls `client.queryMapLayer()`; default is `"feature"`. */
|
|
6
|
+
type?: "feature" | "map-layer";
|
|
7
|
+
/** The query request payload. */
|
|
8
|
+
request: QueryFeaturesRequest | MapLayerQueryRequest;
|
|
9
|
+
/** Optional label to identify this query in the results. */
|
|
10
|
+
label?: string;
|
|
11
|
+
}
|
|
12
|
+
/** The result of a single query within a batch. */
|
|
13
|
+
export interface BatchQueryResult {
|
|
14
|
+
/** The label from the corresponding `BatchQueryItem`, if provided. */
|
|
15
|
+
label?: string;
|
|
16
|
+
/** The successful query response, or `undefined` if the query failed. */
|
|
17
|
+
response?: HonuaQueryResponse;
|
|
18
|
+
/** The error thrown by the query, or `undefined` if the query succeeded. */
|
|
19
|
+
error?: Error;
|
|
20
|
+
}
|
|
21
|
+
/** Options for controlling batch query execution. */
|
|
22
|
+
export interface BatchQueryOptions {
|
|
23
|
+
/** Maximum number of concurrent queries. Default: `5`. */
|
|
24
|
+
concurrency?: number;
|
|
25
|
+
/** An `AbortSignal` that, when aborted, skips all remaining unstarted queries. */
|
|
26
|
+
signal?: AbortSignal;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Execute multiple queries in parallel with bounded concurrency.
|
|
30
|
+
*
|
|
31
|
+
* Results are returned in the same order as the input `items`.
|
|
32
|
+
* Each result contains either a `response` (on success) or an `error` (on failure).
|
|
33
|
+
* If an `AbortSignal` is provided and aborted, remaining unstarted queries are
|
|
34
|
+
* skipped and their results will have an `error` set to an `AbortError`.
|
|
35
|
+
*/
|
|
36
|
+
export declare function batchQuery(client: HonuaClient, items: readonly BatchQueryItem[], options?: BatchQueryOptions): Promise<BatchQueryResult[]>;
|
|
37
|
+
//# sourceMappingURL=batch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"batch.d.ts","sourceRoot":"","sources":["../../../src/core/batch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,KAAK,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAEjG,sCAAsC;AACtC,MAAM,WAAW,cAAc;IAC7B,kFAAkF;IAClF,IAAI,CAAC,EAAE,SAAS,GAAG,WAAW,CAAC;IAC/B,iCAAiC;IACjC,OAAO,EAAE,oBAAoB,GAAG,oBAAoB,CAAC;IACrD,4DAA4D;IAC5D,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,mDAAmD;AACnD,MAAM,WAAW,gBAAgB;IAC/B,sEAAsE;IACtE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yEAAyE;IACzE,QAAQ,CAAC,EAAE,kBAAkB,CAAC;IAC9B,4EAA4E;IAC5E,KAAK,CAAC,EAAE,KAAK,CAAC;CACf;AAED,qDAAqD;AACrD,MAAM,WAAW,iBAAiB;IAChC,0DAA0D;IAC1D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kFAAkF;IAClF,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED;;;;;;;GAOG;AACH,wBAAsB,UAAU,CAC9B,MAAM,EAAE,WAAW,EACnB,KAAK,EAAE,SAAS,cAAc,EAAE,EAChC,OAAO,CAAC,EAAE,iBAAiB,GAC1B,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAiF7B"}
|
package/core/batch.js
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { HonuaAbortError } from "./errors.js";
|
|
2
|
+
/**
|
|
3
|
+
* Execute multiple queries in parallel with bounded concurrency.
|
|
4
|
+
*
|
|
5
|
+
* Results are returned in the same order as the input `items`.
|
|
6
|
+
* Each result contains either a `response` (on success) or an `error` (on failure).
|
|
7
|
+
* If an `AbortSignal` is provided and aborted, remaining unstarted queries are
|
|
8
|
+
* skipped and their results will have an `error` set to an `AbortError`.
|
|
9
|
+
*/
|
|
10
|
+
export async function batchQuery(client, items, options) {
|
|
11
|
+
const concurrency = Math.max(1, options?.concurrency ?? 5);
|
|
12
|
+
const signal = options?.signal;
|
|
13
|
+
const results = new Array(items.length);
|
|
14
|
+
// Simple semaphore: track how many queries are currently in-flight.
|
|
15
|
+
let running = 0;
|
|
16
|
+
const queue = [];
|
|
17
|
+
function release() {
|
|
18
|
+
running--;
|
|
19
|
+
const next = queue.shift();
|
|
20
|
+
if (next) {
|
|
21
|
+
next();
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function acquire() {
|
|
25
|
+
if (running < concurrency) {
|
|
26
|
+
running++;
|
|
27
|
+
return Promise.resolve();
|
|
28
|
+
}
|
|
29
|
+
return new Promise((resolve) => {
|
|
30
|
+
queue.push(() => {
|
|
31
|
+
running++;
|
|
32
|
+
resolve();
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
const promises = [];
|
|
37
|
+
for (let i = 0; i < items.length; i++) {
|
|
38
|
+
const index = i;
|
|
39
|
+
const item = items[index];
|
|
40
|
+
const task = async () => {
|
|
41
|
+
// Check abort before acquiring a semaphore slot.
|
|
42
|
+
if (signal?.aborted) {
|
|
43
|
+
results[index] = {
|
|
44
|
+
label: item.label,
|
|
45
|
+
error: new HonuaAbortError("Batch query aborted before completion."),
|
|
46
|
+
};
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
await acquire();
|
|
50
|
+
// Check abort again after acquiring the slot.
|
|
51
|
+
if (signal?.aborted) {
|
|
52
|
+
release();
|
|
53
|
+
results[index] = {
|
|
54
|
+
label: item.label,
|
|
55
|
+
error: new HonuaAbortError("Batch query aborted before completion."),
|
|
56
|
+
};
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
try {
|
|
60
|
+
const response = item.type === "map-layer"
|
|
61
|
+
? await client.queryMapLayer(item.request)
|
|
62
|
+
: await client.queryFeatures(item.request);
|
|
63
|
+
results[index] = { label: item.label, response };
|
|
64
|
+
}
|
|
65
|
+
catch (err) {
|
|
66
|
+
results[index] = {
|
|
67
|
+
label: item.label,
|
|
68
|
+
error: err instanceof Error ? err : new Error(String(err)),
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
finally {
|
|
72
|
+
release();
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
promises.push(task());
|
|
76
|
+
}
|
|
77
|
+
await Promise.all(promises);
|
|
78
|
+
return results;
|
|
79
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
export type HonuaCacheScope = "metadata" | "materialized-result";
|
|
2
|
+
export type HonuaCacheStatus = "hit" | "miss" | "stale" | "refreshed" | "bypass";
|
|
3
|
+
export type HonuaCacheReadMode = "default" | "bypass";
|
|
4
|
+
export interface HonuaCacheValidator {
|
|
5
|
+
readonly etag?: string;
|
|
6
|
+
readonly lastModified?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface HonuaCacheState {
|
|
9
|
+
readonly scope: HonuaCacheScope;
|
|
10
|
+
readonly status: HonuaCacheStatus;
|
|
11
|
+
readonly keyFingerprint: string;
|
|
12
|
+
readonly ageMs?: number;
|
|
13
|
+
readonly ttlMs?: number;
|
|
14
|
+
readonly staleIfErrorMs?: number;
|
|
15
|
+
readonly revalidatedAt?: string;
|
|
16
|
+
readonly sourceUpdatedAt?: string;
|
|
17
|
+
readonly validator?: HonuaCacheValidator;
|
|
18
|
+
readonly invalidationReason?: string;
|
|
19
|
+
readonly refreshErrorId?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface HonuaMetadataRequestOptions {
|
|
22
|
+
readonly signal?: AbortSignal;
|
|
23
|
+
/**
|
|
24
|
+
* Revalidate even when an SDK-local metadata entry is present. Adapters send
|
|
25
|
+
* conditional validators when available and report `refreshed` on success.
|
|
26
|
+
*/
|
|
27
|
+
readonly refresh?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* `default` reads and writes the adapter metadata cache. `bypass` skips cache
|
|
30
|
+
* lookup and write-through for endpoints that support SDK-local caching.
|
|
31
|
+
*/
|
|
32
|
+
readonly cache?: HonuaCacheReadMode;
|
|
33
|
+
/**
|
|
34
|
+
* Allow a cached metadata entry to be returned as `stale` when refresh fails.
|
|
35
|
+
* Defaults to `true`; ignored when no cached metadata entry exists.
|
|
36
|
+
*/
|
|
37
|
+
readonly staleIfError?: boolean;
|
|
38
|
+
/** Optional freshness budget surfaced to callers in `HonuaCacheState`. */
|
|
39
|
+
readonly ttlMs?: number;
|
|
40
|
+
/** Optional stale fallback window surfaced to callers in `HonuaCacheState`. */
|
|
41
|
+
readonly staleIfErrorMs?: number;
|
|
42
|
+
}
|
|
43
|
+
export interface NormalizedHonuaMetadataRequestOptions {
|
|
44
|
+
readonly signal?: AbortSignal;
|
|
45
|
+
readonly refresh: boolean;
|
|
46
|
+
readonly cache: HonuaCacheReadMode;
|
|
47
|
+
readonly staleIfError: boolean;
|
|
48
|
+
readonly ttlMs?: number;
|
|
49
|
+
readonly staleIfErrorMs?: number;
|
|
50
|
+
}
|
|
51
|
+
export declare const HONUA_DEFAULT_METADATA_CACHE_TTL_MS: number;
|
|
52
|
+
export declare const HONUA_DEFAULT_METADATA_STALE_IF_ERROR_MS: number;
|
|
53
|
+
export interface HonuaCacheStateInit {
|
|
54
|
+
readonly scope: HonuaCacheScope;
|
|
55
|
+
readonly status: HonuaCacheStatus;
|
|
56
|
+
readonly keyFingerprint: string;
|
|
57
|
+
readonly ageMs?: number;
|
|
58
|
+
readonly ttlMs?: number;
|
|
59
|
+
readonly staleIfErrorMs?: number;
|
|
60
|
+
readonly revalidatedAt?: string;
|
|
61
|
+
readonly sourceUpdatedAt?: string;
|
|
62
|
+
readonly validator?: HonuaCacheValidator;
|
|
63
|
+
readonly invalidationReason?: string;
|
|
64
|
+
readonly refreshErrorId?: string;
|
|
65
|
+
}
|
|
66
|
+
export declare function createHonuaCacheState(init: HonuaCacheStateInit): HonuaCacheState;
|
|
67
|
+
export declare function normalizeHonuaMetadataRequestOptions(options?: HonuaMetadataRequestOptions): NormalizedHonuaMetadataRequestOptions;
|
|
68
|
+
export declare function isHonuaCacheEntryFresh(cachedAtMs: number, now: number, ttlMs: number | undefined): boolean;
|
|
69
|
+
export declare function isHonuaCacheStatus(value: unknown): value is HonuaCacheStatus;
|
|
70
|
+
export declare function honuaCacheValidatorFromHeaders(headers: Headers): HonuaCacheValidator | undefined;
|
|
71
|
+
export declare function honuaMetadataRequestHeaders(options: {
|
|
72
|
+
readonly accept?: string;
|
|
73
|
+
readonly refresh?: boolean;
|
|
74
|
+
readonly bypass?: boolean;
|
|
75
|
+
readonly validator?: HonuaCacheValidator;
|
|
76
|
+
}): Record<string, string>;
|
|
77
|
+
export declare function withHonuaCacheState<T>(value: T, cache: HonuaCacheState): T;
|
|
78
|
+
export declare function withoutHonuaCacheState<T>(value: T): T;
|
|
79
|
+
//# sourceMappingURL=cache-state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache-state.d.ts","sourceRoot":"","sources":["../../../src/core/cache-state.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG,UAAU,GAAG,qBAAqB,CAAC;AAEjE,MAAM,MAAM,gBAAgB,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,WAAW,GAAG,QAAQ,CAAC;AAEjF,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,QAAQ,CAAC;AAEtD,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;CAChC;AAED,MAAM,WAAW,e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;IAC3B,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,SAAS,CAAC,EAAE,mBAAmB,CAAC;CAC1C,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAsBzB;AAED,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,eAAe,GAAG,CAAC,CAQ1E;AAED,wBAAgB,sBAAsB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAMrD"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
export const HONUA_DEFAULT_METADATA_CACHE_TTL_MS = 5 * 60 * 1000;
|
|
2
|
+
export const HONUA_DEFAULT_METADATA_STALE_IF_ERROR_MS = 60 * 60 * 1000;
|
|
3
|
+
export function createHonuaCacheState(init) {
|
|
4
|
+
return {
|
|
5
|
+
scope: init.scope,
|
|
6
|
+
status: init.status,
|
|
7
|
+
keyFingerprint: init.keyFingerprint,
|
|
8
|
+
...(init.ageMs !== undefined ? { ageMs: Math.max(0, Math.trunc(init.ageMs)) } : {}),
|
|
9
|
+
...(init.ttlMs !== undefined ? { ttlMs: Math.max(0, Math.trunc(init.ttlMs)) } : {}),
|
|
10
|
+
...(init.staleIfErrorMs !== undefined ? { staleIfErrorMs: Math.max(0, Math.trunc(init.staleIfErrorMs)) } : {}),
|
|
11
|
+
...(init.revalidatedAt ? { revalidatedAt: init.revalidatedAt } : {}),
|
|
12
|
+
...(init.sourceUpdatedAt ? { sourceUpdatedAt: init.sourceUpdatedAt } : {}),
|
|
13
|
+
...(hasHonuaCacheValidator(init.validator) ? { validator: init.validator } : {}),
|
|
14
|
+
...(init.invalidationReason ? { invalidationReason: init.invalidationReason } : {}),
|
|
15
|
+
...(init.refreshErrorId ? { refreshErrorId: init.refreshErrorId } : {}),
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export function normalizeHonuaMetadataRequestOptions(options = {}) {
|
|
19
|
+
const ttlMs = normalizeNonNegativeInteger(options.ttlMs) ?? HONUA_DEFAULT_METADATA_CACHE_TTL_MS;
|
|
20
|
+
const staleIfErrorMs = normalizeNonNegativeInteger(options.staleIfErrorMs) ?? HONUA_DEFAULT_METADATA_STALE_IF_ERROR_MS;
|
|
21
|
+
return {
|
|
22
|
+
...(options.signal ? { signal: options.signal } : {}),
|
|
23
|
+
refresh: options.refresh === true,
|
|
24
|
+
cache: options.cache === "bypass" ? "bypass" : "default",
|
|
25
|
+
staleIfError: options.staleIfError !== false,
|
|
26
|
+
ttlMs,
|
|
27
|
+
staleIfErrorMs,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
export function isHonuaCacheEntryFresh(cachedAtMs, now, ttlMs) {
|
|
31
|
+
return ttlMs === undefined || Math.max(0, now - cachedAtMs) < ttlMs;
|
|
32
|
+
}
|
|
33
|
+
export function isHonuaCacheStatus(value) {
|
|
34
|
+
return value === "hit" || value === "miss" || value === "stale" || value === "refreshed" || value === "bypass";
|
|
35
|
+
}
|
|
36
|
+
export function honuaCacheValidatorFromHeaders(headers) {
|
|
37
|
+
const etag = headers.get("etag") ?? undefined;
|
|
38
|
+
const lastModified = headers.get("last-modified") ?? undefined;
|
|
39
|
+
return hasHonuaCacheValidator({ etag, lastModified })
|
|
40
|
+
? { ...(etag ? { etag } : {}), ...(lastModified ? { lastModified } : {}) }
|
|
41
|
+
: undefined;
|
|
42
|
+
}
|
|
43
|
+
export function honuaMetadataRequestHeaders(options) {
|
|
44
|
+
const headers = {
|
|
45
|
+
Accept: options.accept ?? "application/json",
|
|
46
|
+
};
|
|
47
|
+
if (options.bypass) {
|
|
48
|
+
headers["Cache-Control"] = "no-store";
|
|
49
|
+
headers.Pragma = "no-cache";
|
|
50
|
+
return headers;
|
|
51
|
+
}
|
|
52
|
+
if (options.refresh) {
|
|
53
|
+
headers["Cache-Control"] = "no-cache";
|
|
54
|
+
if (options.validator?.etag) {
|
|
55
|
+
headers["If-None-Match"] = options.validator.etag;
|
|
56
|
+
}
|
|
57
|
+
if (options.validator?.lastModified) {
|
|
58
|
+
headers["If-Modified-Since"] = options.validator.lastModified;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return headers;
|
|
62
|
+
}
|
|
63
|
+
export function withHonuaCacheState(value, cache) {
|
|
64
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
65
|
+
return value;
|
|
66
|
+
}
|
|
67
|
+
return {
|
|
68
|
+
...value,
|
|
69
|
+
cache,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
export function withoutHonuaCacheState(value) {
|
|
73
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
74
|
+
return value;
|
|
75
|
+
}
|
|
76
|
+
const { cache: _cache, ...rest } = value;
|
|
77
|
+
return rest;
|
|
78
|
+
}
|
|
79
|
+
function hasHonuaCacheValidator(value) {
|
|
80
|
+
return Boolean(value?.etag || value?.lastModified);
|
|
81
|
+
}
|
|
82
|
+
function normalizeNonNegativeInteger(value) {
|
|
83
|
+
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
84
|
+
return undefined;
|
|
85
|
+
}
|
|
86
|
+
return Math.max(0, Math.trunc(value));
|
|
87
|
+
}
|