tempest-react-sdk 0.78.0 → 0.80.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/README.md +6 -6
- package/bin/lib/openapi/generate.hostile.test.mjs +45 -4
- package/bin/lib/openapi/generate.mjs +303 -88
- package/bin/lib/openapi/generate.pagination.test.mjs +3 -2
- package/bin/lib/openapi/generate.test.mjs +462 -1
- package/bin/lib/openapi/schema-to-zod.mjs +4 -3
- package/dist/access/Can.cjs.map +1 -1
- package/dist/access/Can.js.map +1 -1
- package/dist/access/access-control-context.cjs.map +1 -1
- package/dist/access/access-control-context.js.map +1 -1
- package/dist/access/create-role-access-control.cjs.map +1 -1
- package/dist/access/create-role-access-control.js.map +1 -1
- package/dist/access/permissions-from-token.cjs.map +1 -1
- package/dist/access/permissions-from-token.js.map +1 -1
- package/dist/access/use-can.cjs.map +1 -1
- package/dist/access/use-can.js.map +1 -1
- package/dist/app/AppProviders.cjs.map +1 -1
- package/dist/app/AppProviders.js.map +1 -1
- package/dist/audio/audio-bus.cjs.map +1 -1
- package/dist/audio/audio-bus.js.map +1 -1
- package/dist/audio/audio-output.cjs.map +1 -1
- package/dist/audio/audio-output.js.map +1 -1
- package/dist/audio/audio-player.cjs.map +1 -1
- package/dist/audio/audio-player.js.map +1 -1
- package/dist/audio/audio-recorder.cjs.map +1 -1
- package/dist/audio/audio-recorder.js.map +1 -1
- package/dist/audio/duration.cjs.map +1 -1
- package/dist/audio/duration.js.map +1 -1
- package/dist/audio/level-meter.cjs.map +1 -1
- package/dist/audio/level-meter.js.map +1 -1
- package/dist/audio/media-access.cjs.map +1 -1
- package/dist/audio/media-access.js.map +1 -1
- package/dist/audio/noise-floor.cjs.map +1 -1
- package/dist/audio/noise-floor.js.map +1 -1
- package/dist/audio/sfx-pool.cjs.map +1 -1
- package/dist/audio/sfx-pool.js.map +1 -1
- package/dist/audio/use-audio-bus.cjs.map +1 -1
- package/dist/audio/use-audio-bus.js.map +1 -1
- package/dist/audio/use-audio-recorder.cjs.map +1 -1
- package/dist/audio/use-audio-recorder.js.map +1 -1
- package/dist/audio/use-audio.cjs.map +1 -1
- package/dist/audio/use-audio.js.map +1 -1
- package/dist/audio/use-microphone.cjs +1 -1
- package/dist/audio/use-microphone.cjs.map +1 -1
- package/dist/audio/use-microphone.js +1 -5
- package/dist/audio/use-microphone.js.map +1 -1
- package/dist/audio/use-sfx-pool.cjs.map +1 -1
- package/dist/audio/use-sfx-pool.js.map +1 -1
- package/dist/audio/voice-activity.cjs.map +1 -1
- package/dist/audio/voice-activity.js.map +1 -1
- package/dist/audio/voice-chain-stages.cjs.map +1 -1
- package/dist/audio/voice-chain-stages.js.map +1 -1
- package/dist/audio/voice-chain.cjs.map +1 -1
- package/dist/audio/voice-chain.js.map +1 -1
- package/dist/audio/wav.cjs.map +1 -1
- package/dist/audio/wav.js.map +1 -1
- package/dist/auth/AuthGuard.cjs.map +1 -1
- package/dist/auth/AuthGuard.js.map +1 -1
- package/dist/auth/create-auth-store.cjs.map +1 -1
- package/dist/auth/create-auth-store.js.map +1 -1
- package/dist/auth/create-tempest-auth.cjs +1 -1
- package/dist/auth/create-tempest-auth.cjs.map +1 -1
- package/dist/auth/create-tempest-auth.js +1 -3
- package/dist/auth/create-tempest-auth.js.map +1 -1
- package/dist/auth/jwt.cjs.map +1 -1
- package/dist/auth/jwt.js.map +1 -1
- package/dist/auth/lazy-with-retry.cjs.map +1 -1
- package/dist/auth/lazy-with-retry.js.map +1 -1
- package/dist/auth/passkey.cjs.map +1 -1
- package/dist/auth/passkey.js.map +1 -1
- package/dist/auth/refresh-queue.cjs.map +1 -1
- package/dist/auth/refresh-queue.js.map +1 -1
- package/dist/auth/use-passkey.cjs +1 -1
- package/dist/auth/use-passkey.cjs.map +1 -1
- package/dist/auth/use-passkey.js +1 -1
- package/dist/auth/use-passkey.js.map +1 -1
- package/dist/br/BrazilMap.cjs.map +1 -1
- package/dist/br/BrazilMap.js.map +1 -1
- package/dist/br/BrazilMap.module.cjs.map +1 -1
- package/dist/br/BrazilMap.module.js.map +1 -1
- package/dist/br/BrazilStateCitySelect.cjs.map +1 -1
- package/dist/br/BrazilStateCitySelect.js.map +1 -1
- package/dist/br/BrazilStateMap.cjs.map +1 -1
- package/dist/br/BrazilStateMap.js.map +1 -1
- package/dist/br/MapLegend.cjs.map +1 -1
- package/dist/br/MapLegend.js.map +1 -1
- package/dist/br/MapLegend.module.cjs.map +1 -1
- package/dist/br/MapLegend.module.js.map +1 -1
- package/dist/br/MapMarkers.cjs.map +1 -1
- package/dist/br/MapMarkers.js.map +1 -1
- package/dist/br/MapTooltip.cjs.map +1 -1
- package/dist/br/MapTooltip.js.map +1 -1
- package/dist/br/MunicipalitySearch.cjs +1 -1
- package/dist/br/MunicipalitySearch.cjs.map +1 -1
- package/dist/br/MunicipalitySearch.js +2 -5
- package/dist/br/MunicipalitySearch.js.map +1 -1
- package/dist/br/MunicipalitySearch.module.cjs.map +1 -1
- package/dist/br/MunicipalitySearch.module.js.map +1 -1
- package/dist/br/PixQRCode.cjs.map +1 -1
- package/dist/br/PixQRCode.js.map +1 -1
- package/dist/br/PixQRCode.module.cjs.map +1 -1
- package/dist/br/PixQRCode.module.js.map +1 -1
- package/dist/br/boleto.cjs.map +1 -1
- package/dist/br/boleto.js.map +1 -1
- package/dist/br/br-geo.cjs.map +1 -1
- package/dist/br/br-geo.js.map +1 -1
- package/dist/br/data/br-centroids.cjs.map +1 -1
- package/dist/br/data/br-centroids.js.map +1 -1
- package/dist/br/data/br-locations.cjs.map +1 -1
- package/dist/br/data/br-locations.js.map +1 -1
- package/dist/br/data/br-uf-geo.cjs.map +1 -1
- package/dist/br/data/br-uf-geo.js.map +1 -1
- package/dist/br/data/mun/AC.cjs.map +1 -1
- package/dist/br/data/mun/AC.js.map +1 -1
- package/dist/br/data/mun/AL.cjs.map +1 -1
- package/dist/br/data/mun/AL.js.map +1 -1
- package/dist/br/data/mun/AM.cjs.map +1 -1
- package/dist/br/data/mun/AM.js.map +1 -1
- package/dist/br/data/mun/AP.cjs.map +1 -1
- package/dist/br/data/mun/AP.js.map +1 -1
- package/dist/br/data/mun/BA.cjs.map +1 -1
- package/dist/br/data/mun/BA.js.map +1 -1
- package/dist/br/data/mun/CE.cjs.map +1 -1
- package/dist/br/data/mun/CE.js.map +1 -1
- package/dist/br/data/mun/DF.cjs.map +1 -1
- package/dist/br/data/mun/DF.js.map +1 -1
- package/dist/br/data/mun/ES.cjs.map +1 -1
- package/dist/br/data/mun/ES.js.map +1 -1
- package/dist/br/data/mun/GO.cjs.map +1 -1
- package/dist/br/data/mun/GO.js.map +1 -1
- package/dist/br/data/mun/MA.cjs.map +1 -1
- package/dist/br/data/mun/MA.js.map +1 -1
- package/dist/br/data/mun/MG.cjs.map +1 -1
- package/dist/br/data/mun/MG.js.map +1 -1
- package/dist/br/data/mun/MS.cjs.map +1 -1
- package/dist/br/data/mun/MS.js.map +1 -1
- package/dist/br/data/mun/MT.cjs.map +1 -1
- package/dist/br/data/mun/MT.js.map +1 -1
- package/dist/br/data/mun/PA.cjs.map +1 -1
- package/dist/br/data/mun/PA.js.map +1 -1
- package/dist/br/data/mun/PB.cjs.map +1 -1
- package/dist/br/data/mun/PB.js.map +1 -1
- package/dist/br/data/mun/PE.cjs.map +1 -1
- package/dist/br/data/mun/PE.js.map +1 -1
- package/dist/br/data/mun/PI.cjs.map +1 -1
- package/dist/br/data/mun/PI.js.map +1 -1
- package/dist/br/data/mun/PR.cjs.map +1 -1
- package/dist/br/data/mun/PR.js.map +1 -1
- package/dist/br/data/mun/RJ.cjs.map +1 -1
- package/dist/br/data/mun/RJ.js.map +1 -1
- package/dist/br/data/mun/RN.cjs.map +1 -1
- package/dist/br/data/mun/RN.js.map +1 -1
- package/dist/br/data/mun/RO.cjs.map +1 -1
- package/dist/br/data/mun/RO.js.map +1 -1
- package/dist/br/data/mun/RR.cjs.map +1 -1
- package/dist/br/data/mun/RR.js.map +1 -1
- package/dist/br/data/mun/RS.cjs.map +1 -1
- package/dist/br/data/mun/RS.js.map +1 -1
- package/dist/br/data/mun/SC.cjs.map +1 -1
- package/dist/br/data/mun/SC.js.map +1 -1
- package/dist/br/data/mun/SE.cjs.map +1 -1
- package/dist/br/data/mun/SE.js.map +1 -1
- package/dist/br/data/mun/SP.cjs.map +1 -1
- package/dist/br/data/mun/SP.js.map +1 -1
- package/dist/br/data/mun/TO.cjs.map +1 -1
- package/dist/br/data/mun/TO.js.map +1 -1
- package/dist/br/geocode.cjs.map +1 -1
- package/dist/br/geocode.js.map +1 -1
- package/dist/br/holidays.cjs.map +1 -1
- package/dist/br/holidays.js.map +1 -1
- package/dist/br/locations.cjs.map +1 -1
- package/dist/br/locations.js.map +1 -1
- package/dist/br/nfe.cjs.map +1 -1
- package/dist/br/nfe.js.map +1 -1
- package/dist/br/pix.cjs +1 -1
- package/dist/br/pix.cjs.map +1 -1
- package/dist/br/pix.js +108 -74
- package/dist/br/pix.js.map +1 -1
- package/dist/br/regions.cjs.map +1 -1
- package/dist/br/regions.js.map +1 -1
- package/dist/br/scales.cjs.map +1 -1
- package/dist/br/scales.js.map +1 -1
- package/dist/br/state-geo.cjs.map +1 -1
- package/dist/br/state-geo.js.map +1 -1
- package/dist/br/svg-utils.cjs.map +1 -1
- package/dist/br/svg-utils.js.map +1 -1
- package/dist/br/use-map-hover.cjs.map +1 -1
- package/dist/br/use-map-hover.js.map +1 -1
- package/dist/br/use-map-zoom.cjs.map +1 -1
- package/dist/br/use-map-zoom.js.map +1 -1
- package/dist/br/whatsapp.cjs.map +1 -1
- package/dist/br/whatsapp.js.map +1 -1
- package/dist/br.cjs.map +1 -1
- package/dist/br.d.ts +6 -2
- package/dist/br.js.map +1 -1
- package/dist/capture/barcode.cjs.map +1 -1
- package/dist/capture/barcode.js.map +1 -1
- package/dist/capture/media-recorder.cjs.map +1 -1
- package/dist/capture/media-recorder.js.map +1 -1
- package/dist/capture/use-barcode-scanner.cjs.map +1 -1
- package/dist/capture/use-barcode-scanner.js.map +1 -1
- package/dist/capture/use-screen-capture.cjs +1 -1
- package/dist/capture/use-screen-capture.cjs.map +1 -1
- package/dist/capture/use-screen-capture.js +1 -7
- package/dist/capture/use-screen-capture.js.map +1 -1
- package/dist/capture/use-speech-recognition.cjs +1 -1
- package/dist/capture/use-speech-recognition.cjs.map +1 -1
- package/dist/capture/use-speech-recognition.js +35 -36
- package/dist/capture/use-speech-recognition.js.map +1 -1
- package/dist/capture/use-torch.cjs.map +1 -1
- package/dist/capture/use-torch.js.map +1 -1
- package/dist/capture/use-video-recorder.cjs.map +1 -1
- package/dist/capture/use-video-recorder.js.map +1 -1
- package/dist/capture/video-recorder.cjs.map +1 -1
- package/dist/capture/video-recorder.js.map +1 -1
- package/dist/charts/AreaChart.cjs.map +1 -1
- package/dist/charts/AreaChart.js.map +1 -1
- package/dist/charts/BarChart.cjs.map +1 -1
- package/dist/charts/BarChart.js.map +1 -1
- package/dist/charts/LineChart.cjs.map +1 -1
- package/dist/charts/LineChart.js.map +1 -1
- package/dist/charts/PieChart.cjs.map +1 -1
- package/dist/charts/PieChart.js.map +1 -1
- package/dist/charts/RadarChart.cjs.map +1 -1
- package/dist/charts/RadarChart.js.map +1 -1
- package/dist/charts/palette.cjs.map +1 -1
- package/dist/charts/palette.js.map +1 -1
- package/dist/charts/scales.cjs.map +1 -1
- package/dist/charts/scales.js.map +1 -1
- package/dist/charts/types.cjs.map +1 -1
- package/dist/charts/types.js.map +1 -1
- package/dist/charts/use-chart-colors.cjs.map +1 -1
- package/dist/charts/use-chart-colors.js.map +1 -1
- package/dist/components/AIChat/AIChat.cjs +1 -1
- package/dist/components/AIChat/AIChat.cjs.map +1 -1
- package/dist/components/AIChat/AIChat.js +1 -5
- package/dist/components/AIChat/AIChat.js.map +1 -1
- package/dist/components/AIChat/AIChat.module.cjs.map +1 -1
- package/dist/components/AIChat/AIChat.module.js.map +1 -1
- package/dist/components/AIChat/AIChatComposer.cjs +1 -1
- package/dist/components/AIChat/AIChatComposer.cjs.map +1 -1
- package/dist/components/AIChat/AIChatComposer.js +1 -7
- package/dist/components/AIChat/AIChatComposer.js.map +1 -1
- package/dist/components/AIChat/AIChatTurn.cjs.map +1 -1
- package/dist/components/AIChat/AIChatTurn.js.map +1 -1
- package/dist/components/AIChat/ai-chat-turns.cjs.map +1 -1
- package/dist/components/AIChat/ai-chat-turns.js.map +1 -1
- package/dist/components/Accordion/Accordion.cjs.map +1 -1
- package/dist/components/Accordion/Accordion.js.map +1 -1
- package/dist/components/Accordion/Accordion.module.cjs.map +1 -1
- package/dist/components/Accordion/Accordion.module.js.map +1 -1
- package/dist/components/Alert/Alert.cjs.map +1 -1
- package/dist/components/Alert/Alert.js.map +1 -1
- package/dist/components/Alert/Alert.module.cjs.map +1 -1
- package/dist/components/Alert/Alert.module.js.map +1 -1
- package/dist/components/AppBar/AppBar.cjs.map +1 -1
- package/dist/components/AppBar/AppBar.js.map +1 -1
- package/dist/components/AppBar/AppBar.module.cjs.map +1 -1
- package/dist/components/AppBar/AppBar.module.js.map +1 -1
- package/dist/components/AppBar/use-sticky-body-warning.cjs +1 -1
- package/dist/components/AppBar/use-sticky-body-warning.cjs.map +1 -1
- package/dist/components/AppBar/use-sticky-body-warning.js +1 -1
- package/dist/components/AppBar/use-sticky-body-warning.js.map +1 -1
- package/dist/components/AppShell/AppShell.cjs.map +1 -1
- package/dist/components/AppShell/AppShell.js.map +1 -1
- package/dist/components/AppShell/AppShell.module.cjs.map +1 -1
- package/dist/components/AppShell/AppShell.module.js.map +1 -1
- package/dist/components/AspectRatio/AspectRatio.cjs.map +1 -1
- package/dist/components/AspectRatio/AspectRatio.js.map +1 -1
- package/dist/components/AspectRatio/AspectRatio.module.cjs.map +1 -1
- package/dist/components/AspectRatio/AspectRatio.module.js.map +1 -1
- package/dist/components/AudioPlayer/AudioPlayer.cjs +1 -1
- package/dist/components/AudioPlayer/AudioPlayer.cjs.map +1 -1
- package/dist/components/AudioPlayer/AudioPlayer.js +1 -7
- package/dist/components/AudioPlayer/AudioPlayer.js.map +1 -1
- package/dist/components/AudioPlayer/AudioPlayer.module.cjs.map +1 -1
- package/dist/components/AudioPlayer/AudioPlayer.module.js.map +1 -1
- package/dist/components/AudioRecorder/AudioRecorder.cjs +1 -1
- package/dist/components/AudioRecorder/AudioRecorder.cjs.map +1 -1
- package/dist/components/AudioRecorder/AudioRecorder.js +16 -21
- package/dist/components/AudioRecorder/AudioRecorder.js.map +1 -1
- package/dist/components/AudioRecorder/AudioRecorder.module.cjs.map +1 -1
- package/dist/components/AudioRecorder/AudioRecorder.module.js.map +1 -1
- package/dist/components/Avatar/Avatar.cjs.map +1 -1
- package/dist/components/Avatar/Avatar.js.map +1 -1
- package/dist/components/Avatar/Avatar.module.cjs.map +1 -1
- package/dist/components/Avatar/Avatar.module.js.map +1 -1
- package/dist/components/AvatarGroup/AvatarGroup.cjs.map +1 -1
- package/dist/components/AvatarGroup/AvatarGroup.js.map +1 -1
- package/dist/components/AvatarGroup/AvatarGroup.module.cjs.map +1 -1
- package/dist/components/AvatarGroup/AvatarGroup.module.js.map +1 -1
- package/dist/components/Badge/Badge.cjs.map +1 -1
- package/dist/components/Badge/Badge.js.map +1 -1
- package/dist/components/Badge/Badge.module.cjs.map +1 -1
- package/dist/components/Badge/Badge.module.js.map +1 -1
- package/dist/components/Banner/Banner.cjs.map +1 -1
- package/dist/components/Banner/Banner.js.map +1 -1
- package/dist/components/Banner/Banner.module.cjs.map +1 -1
- package/dist/components/Banner/Banner.module.js.map +1 -1
- package/dist/components/BarList/BarList.cjs.map +1 -1
- package/dist/components/BarList/BarList.js.map +1 -1
- package/dist/components/BarList/BarList.module.cjs.map +1 -1
- package/dist/components/BarList/BarList.module.js.map +1 -1
- package/dist/components/BarList/bar-list-model.cjs.map +1 -1
- package/dist/components/BarList/bar-list-model.js.map +1 -1
- package/dist/components/BarcodeScanner/BarcodeScanner.cjs.map +1 -1
- package/dist/components/BarcodeScanner/BarcodeScanner.js.map +1 -1
- package/dist/components/BarcodeScanner/BarcodeScanner.module.cjs.map +1 -1
- package/dist/components/BarcodeScanner/BarcodeScanner.module.js.map +1 -1
- package/dist/components/BottomNavigation/BottomNavigation.cjs.map +1 -1
- package/dist/components/BottomNavigation/BottomNavigation.js.map +1 -1
- package/dist/components/BottomNavigation/BottomNavigation.module.cjs.map +1 -1
- package/dist/components/BottomNavigation/BottomNavigation.module.js.map +1 -1
- package/dist/components/BottomSheet/BottomSheet.cjs.map +1 -1
- package/dist/components/BottomSheet/BottomSheet.js.map +1 -1
- package/dist/components/BottomSheet/BottomSheet.module.cjs.map +1 -1
- package/dist/components/BottomSheet/BottomSheet.module.js.map +1 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.cjs.map +1 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.js.map +1 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.module.cjs.map +1 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.module.js.map +1 -1
- package/dist/components/Button/Button.cjs.map +1 -1
- package/dist/components/Button/Button.js.map +1 -1
- package/dist/components/Button/Button.module.cjs.map +1 -1
- package/dist/components/Button/Button.module.js.map +1 -1
- package/dist/components/Button/ButtonContent.cjs.map +1 -1
- package/dist/components/Button/ButtonContent.js.map +1 -1
- package/dist/components/Button/ButtonSlot.cjs.map +1 -1
- package/dist/components/Button/ButtonSlot.js.map +1 -1
- package/dist/components/Button/button-class.cjs.map +1 -1
- package/dist/components/Button/button-class.js.map +1 -1
- package/dist/components/Button/link-rel.cjs.map +1 -1
- package/dist/components/Button/link-rel.js.map +1 -1
- package/dist/components/Button/slot.cjs.map +1 -1
- package/dist/components/Button/slot.js.map +1 -1
- package/dist/components/Calendar/Calendar.cjs.map +1 -1
- package/dist/components/Calendar/Calendar.js.map +1 -1
- package/dist/components/Calendar/Calendar.module.cjs.map +1 -1
- package/dist/components/Calendar/Calendar.module.js.map +1 -1
- package/dist/components/Card/Card.cjs.map +1 -1
- package/dist/components/Card/Card.js.map +1 -1
- package/dist/components/Card/Card.module.cjs.map +1 -1
- package/dist/components/Card/Card.module.js.map +1 -1
- package/dist/components/Carousel/Carousel.cjs.map +1 -1
- package/dist/components/Carousel/Carousel.js.map +1 -1
- package/dist/components/Carousel/Carousel.module.cjs.map +1 -1
- package/dist/components/Carousel/Carousel.module.js.map +1 -1
- package/dist/components/Center/Center.cjs.map +1 -1
- package/dist/components/Center/Center.js.map +1 -1
- package/dist/components/Center/Center.module.cjs.map +1 -1
- package/dist/components/Center/Center.module.js.map +1 -1
- package/dist/components/Chat/Chat.cjs.map +1 -1
- package/dist/components/Chat/Chat.js.map +1 -1
- package/dist/components/Chat/Chat.module.cjs.map +1 -1
- package/dist/components/Chat/Chat.module.js.map +1 -1
- package/dist/components/Chat/ChatActionsMenu.cjs.map +1 -1
- package/dist/components/Chat/ChatActionsMenu.js.map +1 -1
- package/dist/components/Chat/ChatAttachments.cjs.map +1 -1
- package/dist/components/Chat/ChatAttachments.js.map +1 -1
- package/dist/components/Chat/ChatBubble.cjs.map +1 -1
- package/dist/components/Chat/ChatBubble.js.map +1 -1
- package/dist/components/Chat/ChatComposer.cjs.map +1 -1
- package/dist/components/Chat/ChatComposer.js.map +1 -1
- package/dist/components/Chat/chat-groups.cjs +1 -1
- package/dist/components/Chat/chat-groups.cjs.map +1 -1
- package/dist/components/Chat/chat-groups.js +2 -6
- package/dist/components/Chat/chat-groups.js.map +1 -1
- package/dist/components/Chat/chat-receipt.cjs.map +1 -1
- package/dist/components/Chat/chat-receipt.js.map +1 -1
- package/dist/components/Checkbox/Checkbox.cjs.map +1 -1
- package/dist/components/Checkbox/Checkbox.js.map +1 -1
- package/dist/components/Checkbox/Checkbox.module.cjs.map +1 -1
- package/dist/components/Checkbox/Checkbox.module.js.map +1 -1
- package/dist/components/ChipInput/ChipInput.cjs +1 -1
- package/dist/components/ChipInput/ChipInput.cjs.map +1 -1
- package/dist/components/ChipInput/ChipInput.js +2 -12
- package/dist/components/ChipInput/ChipInput.js.map +1 -1
- package/dist/components/ChipInput/ChipInput.module.cjs.map +1 -1
- package/dist/components/ChipInput/ChipInput.module.js.map +1 -1
- package/dist/components/ClickOutside/ClickOutside.cjs.map +1 -1
- package/dist/components/ClickOutside/ClickOutside.js.map +1 -1
- package/dist/components/CodeBlock/CodeBlock.cjs.map +1 -1
- package/dist/components/CodeBlock/CodeBlock.js.map +1 -1
- package/dist/components/CodeBlock/CodeBlock.module.cjs.map +1 -1
- package/dist/components/CodeBlock/CodeBlock.module.js.map +1 -1
- package/dist/components/CodeBlock/tokenize.cjs.map +1 -1
- package/dist/components/CodeBlock/tokenize.js.map +1 -1
- package/dist/components/Collapsible/Collapsible.cjs.map +1 -1
- package/dist/components/Collapsible/Collapsible.js.map +1 -1
- package/dist/components/Collapsible/Collapsible.module.cjs.map +1 -1
- package/dist/components/Collapsible/Collapsible.module.js.map +1 -1
- package/dist/components/Combobox/Combobox.cjs.map +1 -1
- package/dist/components/Combobox/Combobox.js.map +1 -1
- package/dist/components/Combobox/Combobox.module.cjs.map +1 -1
- package/dist/components/Combobox/Combobox.module.js.map +1 -1
- package/dist/components/Combobox/use-listbox-dismiss.cjs.map +1 -1
- package/dist/components/Combobox/use-listbox-dismiss.js.map +1 -1
- package/dist/components/Command/Command.cjs +1 -1
- package/dist/components/Command/Command.cjs.map +1 -1
- package/dist/components/Command/Command.js +4 -11
- package/dist/components/Command/Command.js.map +1 -1
- package/dist/components/Command/Command.module.cjs.map +1 -1
- package/dist/components/Command/Command.module.js.map +1 -1
- package/dist/components/ConditionalWrapper/ConditionalWrapper.cjs.map +1 -1
- package/dist/components/ConditionalWrapper/ConditionalWrapper.js.map +1 -1
- package/dist/components/ConfirmDialog/ConfirmDialog.cjs.map +1 -1
- package/dist/components/ConfirmDialog/ConfirmDialog.js.map +1 -1
- package/dist/components/ContextMenu/ContextMenu.cjs +1 -1
- package/dist/components/ContextMenu/ContextMenu.cjs.map +1 -1
- package/dist/components/ContextMenu/ContextMenu.js +1 -1
- package/dist/components/ContextMenu/ContextMenu.js.map +1 -1
- package/dist/components/ContextMenu/ContextMenu.module.cjs.map +1 -1
- package/dist/components/ContextMenu/ContextMenu.module.js.map +1 -1
- package/dist/components/CopyButton/CopyButton.cjs.map +1 -1
- package/dist/components/CopyButton/CopyButton.js.map +1 -1
- package/dist/components/CopyButton/CopyButton.module.cjs.map +1 -1
- package/dist/components/CopyButton/CopyButton.module.js.map +1 -1
- package/dist/components/DataList/DataList.cjs.map +1 -1
- package/dist/components/DataList/DataList.js.map +1 -1
- package/dist/components/DataList/DataList.module.cjs.map +1 -1
- package/dist/components/DataList/DataList.module.js.map +1 -1
- package/dist/components/DataTable/DataTable.cjs +1 -1
- package/dist/components/DataTable/DataTable.cjs.map +1 -1
- package/dist/components/DataTable/DataTable.js +6 -14
- package/dist/components/DataTable/DataTable.js.map +1 -1
- package/dist/components/DataTable/DataTable.module.cjs.map +1 -1
- package/dist/components/DataTable/DataTable.module.js.map +1 -1
- package/dist/components/DataTable/EditableCell.cjs +1 -1
- package/dist/components/DataTable/EditableCell.cjs.map +1 -1
- package/dist/components/DataTable/EditableCell.js +1 -9
- package/dist/components/DataTable/EditableCell.js.map +1 -1
- package/dist/components/DataTable/LoadingRows.cjs.map +1 -1
- package/dist/components/DataTable/LoadingRows.js.map +1 -1
- package/dist/components/DataTable/edit-labels.cjs.map +1 -1
- package/dist/components/DataTable/edit-labels.js.map +1 -1
- package/dist/components/DataTable/use-dev-warnings.cjs.map +1 -1
- package/dist/components/DataTable/use-dev-warnings.js.map +1 -1
- package/dist/components/DatePicker/DatePicker.cjs.map +1 -1
- package/dist/components/DatePicker/DatePicker.js.map +1 -1
- package/dist/components/DateRangePicker/DateRangePicker.cjs.map +1 -1
- package/dist/components/DateRangePicker/DateRangePicker.js.map +1 -1
- package/dist/components/DateRangePicker/DateRangePicker.module.cjs.map +1 -1
- package/dist/components/DateRangePicker/DateRangePicker.module.js.map +1 -1
- package/dist/components/DescriptionList/DescriptionList.cjs.map +1 -1
- package/dist/components/DescriptionList/DescriptionList.js.map +1 -1
- package/dist/components/DescriptionList/DescriptionList.module.cjs.map +1 -1
- package/dist/components/DescriptionList/DescriptionList.module.js.map +1 -1
- package/dist/components/Divider/Divider.cjs.map +1 -1
- package/dist/components/Divider/Divider.js.map +1 -1
- package/dist/components/Divider/Divider.module.cjs.map +1 -1
- package/dist/components/Divider/Divider.module.js.map +1 -1
- package/dist/components/Drawer/Drawer.cjs.map +1 -1
- package/dist/components/Drawer/Drawer.js.map +1 -1
- package/dist/components/Drawer/Drawer.module.cjs.map +1 -1
- package/dist/components/Drawer/Drawer.module.js.map +1 -1
- package/dist/components/DropdownMenu/DropdownMenu.cjs +1 -1
- package/dist/components/DropdownMenu/DropdownMenu.cjs.map +1 -1
- package/dist/components/DropdownMenu/DropdownMenu.js +2 -14
- package/dist/components/DropdownMenu/DropdownMenu.js.map +1 -1
- package/dist/components/DropdownMenu/DropdownMenu.module.cjs.map +1 -1
- package/dist/components/DropdownMenu/DropdownMenu.module.js.map +1 -1
- package/dist/components/Dropzone/Dropzone.cjs.map +1 -1
- package/dist/components/Dropzone/Dropzone.js.map +1 -1
- package/dist/components/Dropzone/Dropzone.module.cjs.map +1 -1
- package/dist/components/Dropzone/Dropzone.module.js.map +1 -1
- package/dist/components/EmptyState/EmptyState.cjs.map +1 -1
- package/dist/components/EmptyState/EmptyState.js.map +1 -1
- package/dist/components/EmptyState/EmptyState.module.cjs.map +1 -1
- package/dist/components/EmptyState/EmptyState.module.js.map +1 -1
- package/dist/components/ErrorState/ErrorState.cjs.map +1 -1
- package/dist/components/ErrorState/ErrorState.js.map +1 -1
- package/dist/components/ErrorState/ErrorState.module.cjs.map +1 -1
- package/dist/components/ErrorState/ErrorState.module.js.map +1 -1
- package/dist/components/ErrorText/ErrorText.cjs.map +1 -1
- package/dist/components/ErrorText/ErrorText.js.map +1 -1
- package/dist/components/ErrorText/ErrorText.module.cjs.map +1 -1
- package/dist/components/ErrorText/ErrorText.module.js.map +1 -1
- package/dist/components/FileUpload/FileUpload.cjs +1 -1
- package/dist/components/FileUpload/FileUpload.cjs.map +1 -1
- package/dist/components/FileUpload/FileUpload.js +7 -17
- package/dist/components/FileUpload/FileUpload.js.map +1 -1
- package/dist/components/FileUpload/FileUpload.module.cjs.map +1 -1
- package/dist/components/FileUpload/FileUpload.module.js.map +1 -1
- package/dist/components/FilterBar/FilterBar.cjs.map +1 -1
- package/dist/components/FilterBar/FilterBar.js.map +1 -1
- package/dist/components/FilterBar/FilterBar.module.cjs.map +1 -1
- package/dist/components/FilterBar/FilterBar.module.js.map +1 -1
- package/dist/components/FilterBar/filter-apply.cjs.map +1 -1
- package/dist/components/FilterBar/filter-apply.js.map +1 -1
- package/dist/components/FilterBar/filter-model.cjs.map +1 -1
- package/dist/components/FilterBar/filter-model.js.map +1 -1
- package/dist/components/FilterBar/filter-query.cjs +1 -1
- package/dist/components/FilterBar/filter-query.cjs.map +1 -1
- package/dist/components/FilterBar/filter-query.js +2 -5
- package/dist/components/FilterBar/filter-query.js.map +1 -1
- package/dist/components/FilterPanel/FilterPanel.cjs.map +1 -1
- package/dist/components/FilterPanel/FilterPanel.js.map +1 -1
- package/dist/components/FilterPanel/FilterPanel.module.cjs.map +1 -1
- package/dist/components/FilterPanel/FilterPanel.module.js.map +1 -1
- package/dist/components/FloatingActionButton/FloatingActionButton.cjs.map +1 -1
- package/dist/components/FloatingActionButton/FloatingActionButton.js.map +1 -1
- package/dist/components/FloatingActionButton/FloatingActionButton.module.cjs.map +1 -1
- package/dist/components/FloatingActionButton/FloatingActionButton.module.js.map +1 -1
- package/dist/components/For/For.cjs.map +1 -1
- package/dist/components/For/For.js.map +1 -1
- package/dist/components/Form/Form.cjs.map +1 -1
- package/dist/components/Form/Form.js.map +1 -1
- package/dist/components/Form/Form.module.cjs.map +1 -1
- package/dist/components/Form/Form.module.js.map +1 -1
- package/dist/components/HoverCard/HoverCard.cjs.map +1 -1
- package/dist/components/HoverCard/HoverCard.js.map +1 -1
- package/dist/components/HoverCard/HoverCard.module.cjs.map +1 -1
- package/dist/components/HoverCard/HoverCard.module.js.map +1 -1
- package/dist/components/Image/Image.cjs.map +1 -1
- package/dist/components/Image/Image.js.map +1 -1
- package/dist/components/Image/Image.module.cjs.map +1 -1
- package/dist/components/Image/Image.module.js.map +1 -1
- package/dist/components/ImageCropper/ImageCropper.cjs +1 -1
- package/dist/components/ImageCropper/ImageCropper.cjs.map +1 -1
- package/dist/components/ImageCropper/ImageCropper.js +4 -8
- package/dist/components/ImageCropper/ImageCropper.js.map +1 -1
- package/dist/components/ImageCropper/ImageCropper.module.cjs.map +1 -1
- package/dist/components/ImageCropper/ImageCropper.module.js.map +1 -1
- package/dist/components/ImageCropper/crop-geometry.cjs.map +1 -1
- package/dist/components/ImageCropper/crop-geometry.js.map +1 -1
- package/dist/components/Input/Input.cjs.map +1 -1
- package/dist/components/Input/Input.js.map +1 -1
- package/dist/components/Input/Input.module.cjs.map +1 -1
- package/dist/components/Input/Input.module.js.map +1 -1
- package/dist/components/InstallBanner/InstallBanner.cjs.map +1 -1
- package/dist/components/InstallBanner/InstallBanner.js.map +1 -1
- package/dist/components/InstallBanner/InstallBanner.module.cjs.map +1 -1
- package/dist/components/InstallBanner/InstallBanner.module.js.map +1 -1
- package/dist/components/InstallButton/InstallButton.cjs.map +1 -1
- package/dist/components/InstallButton/InstallButton.js.map +1 -1
- package/dist/components/InstallButton/InstallButton.module.cjs.map +1 -1
- package/dist/components/InstallButton/InstallButton.module.js.map +1 -1
- package/dist/components/InstallButton/install-hints.cjs.map +1 -1
- package/dist/components/InstallButton/install-hints.js.map +1 -1
- package/dist/components/Kanban/Kanban.cjs.map +1 -1
- package/dist/components/Kanban/Kanban.js.map +1 -1
- package/dist/components/Kanban/Kanban.module.cjs.map +1 -1
- package/dist/components/Kanban/Kanban.module.js.map +1 -1
- package/dist/components/Kbd/Kbd.cjs.map +1 -1
- package/dist/components/Kbd/Kbd.js.map +1 -1
- package/dist/components/Kbd/Kbd.module.cjs.map +1 -1
- package/dist/components/Kbd/Kbd.module.js.map +1 -1
- package/dist/components/Label/Label.cjs.map +1 -1
- package/dist/components/Label/Label.js.map +1 -1
- package/dist/components/Label/Label.module.cjs.map +1 -1
- package/dist/components/Label/Label.module.js.map +1 -1
- package/dist/components/Layout/Layout.cjs.map +1 -1
- package/dist/components/Layout/Layout.js.map +1 -1
- package/dist/components/Layout/Layout.module.cjs.map +1 -1
- package/dist/components/Layout/Layout.module.js.map +1 -1
- package/dist/components/Lightbox/Lightbox.cjs +1 -1
- package/dist/components/Lightbox/Lightbox.cjs.map +1 -1
- package/dist/components/Lightbox/Lightbox.js +1 -1
- package/dist/components/Lightbox/Lightbox.js.map +1 -1
- package/dist/components/Lightbox/Lightbox.module.cjs.map +1 -1
- package/dist/components/Lightbox/Lightbox.module.js.map +1 -1
- package/dist/components/ListTile/ListTile.cjs.map +1 -1
- package/dist/components/ListTile/ListTile.js.map +1 -1
- package/dist/components/ListTile/ListTile.module.cjs.map +1 -1
- package/dist/components/ListTile/ListTile.module.js.map +1 -1
- package/dist/components/Markdown/Markdown.cjs.map +1 -1
- package/dist/components/Markdown/Markdown.js.map +1 -1
- package/dist/components/Markdown/Markdown.module.cjs.map +1 -1
- package/dist/components/Markdown/Markdown.module.js.map +1 -1
- package/dist/components/Markdown/markdown-parse.cjs +2 -2
- package/dist/components/Markdown/markdown-parse.cjs.map +1 -1
- package/dist/components/Markdown/markdown-parse.js +8 -27
- package/dist/components/Markdown/markdown-parse.js.map +1 -1
- package/dist/components/Masonry/Masonry.cjs.map +1 -1
- package/dist/components/Masonry/Masonry.js.map +1 -1
- package/dist/components/Masonry/Masonry.module.cjs.map +1 -1
- package/dist/components/Masonry/Masonry.module.js.map +1 -1
- package/dist/components/Masonry/masonry-layout.cjs.map +1 -1
- package/dist/components/Masonry/masonry-layout.js.map +1 -1
- package/dist/components/Menubar/Menubar.cjs.map +1 -1
- package/dist/components/Menubar/Menubar.js.map +1 -1
- package/dist/components/Menubar/Menubar.module.cjs.map +1 -1
- package/dist/components/Menubar/Menubar.module.js.map +1 -1
- package/dist/components/Modal/Modal.cjs.map +1 -1
- package/dist/components/Modal/Modal.js.map +1 -1
- package/dist/components/Modal/Modal.module.cjs.map +1 -1
- package/dist/components/Modal/Modal.module.js.map +1 -1
- package/dist/components/ModalsManager/ModalsManager.cjs.map +1 -1
- package/dist/components/ModalsManager/ModalsManager.js.map +1 -1
- package/dist/components/ModalsManager/ModalsManager.module.cjs.map +1 -1
- package/dist/components/ModalsManager/ModalsManager.module.js.map +1 -1
- package/dist/components/Money/Money.cjs.map +1 -1
- package/dist/components/Money/Money.js.map +1 -1
- package/dist/components/MultiSelect/MultiSelect.cjs.map +1 -1
- package/dist/components/MultiSelect/MultiSelect.js.map +1 -1
- package/dist/components/MultiSelect/MultiSelect.module.cjs.map +1 -1
- package/dist/components/MultiSelect/MultiSelect.module.js.map +1 -1
- package/dist/components/NProgress/NProgress.cjs.map +1 -1
- package/dist/components/NProgress/NProgress.js.map +1 -1
- package/dist/components/NProgress/NProgress.module.cjs.map +1 -1
- package/dist/components/NProgress/NProgress.module.js.map +1 -1
- package/dist/components/Navbar/Navbar.cjs.map +1 -1
- package/dist/components/Navbar/Navbar.js.map +1 -1
- package/dist/components/Navbar/Navbar.module.cjs.map +1 -1
- package/dist/components/Navbar/Navbar.module.js.map +1 -1
- package/dist/components/NavigationMenu/NavigationMenu.cjs.map +1 -1
- package/dist/components/NavigationMenu/NavigationMenu.js.map +1 -1
- package/dist/components/NavigationMenu/NavigationMenu.module.cjs.map +1 -1
- package/dist/components/NavigationMenu/NavigationMenu.module.js.map +1 -1
- package/dist/components/NavigationRail/NavigationRail.cjs.map +1 -1
- package/dist/components/NavigationRail/NavigationRail.js.map +1 -1
- package/dist/components/NavigationRail/NavigationRail.module.cjs.map +1 -1
- package/dist/components/NavigationRail/NavigationRail.module.js.map +1 -1
- package/dist/components/NotificationCenter/NotificationCenter.cjs.map +1 -1
- package/dist/components/NotificationCenter/NotificationCenter.js.map +1 -1
- package/dist/components/NotificationCenter/NotificationCenter.module.cjs.map +1 -1
- package/dist/components/NotificationCenter/NotificationCenter.module.js.map +1 -1
- package/dist/components/NotificationCenter/use-notification-inbox.cjs.map +1 -1
- package/dist/components/NotificationCenter/use-notification-inbox.js.map +1 -1
- package/dist/components/OfflineIndicator/OfflineIndicator.cjs.map +1 -1
- package/dist/components/OfflineIndicator/OfflineIndicator.js.map +1 -1
- package/dist/components/OfflineIndicator/OfflineIndicator.module.cjs.map +1 -1
- package/dist/components/OfflineIndicator/OfflineIndicator.module.js.map +1 -1
- package/dist/components/Page/Page.cjs.map +1 -1
- package/dist/components/Page/Page.js.map +1 -1
- package/dist/components/Page/Page.module.cjs.map +1 -1
- package/dist/components/Page/Page.module.js.map +1 -1
- package/dist/components/Pagination/Pagination.cjs.map +1 -1
- package/dist/components/Pagination/Pagination.js.map +1 -1
- package/dist/components/Pagination/Pagination.module.cjs.map +1 -1
- package/dist/components/Pagination/Pagination.module.js.map +1 -1
- package/dist/components/PasswordInput/PasswordInput.cjs.map +1 -1
- package/dist/components/PasswordInput/PasswordInput.js.map +1 -1
- package/dist/components/PasswordInput/PasswordInput.module.cjs.map +1 -1
- package/dist/components/PasswordInput/PasswordInput.module.js.map +1 -1
- package/dist/components/PinInput/PinInput.cjs.map +1 -1
- package/dist/components/PinInput/PinInput.js.map +1 -1
- package/dist/components/PinInput/PinInput.module.cjs.map +1 -1
- package/dist/components/PinInput/PinInput.module.js.map +1 -1
- package/dist/components/Popover/Popover.cjs.map +1 -1
- package/dist/components/Popover/Popover.js.map +1 -1
- package/dist/components/Popover/Popover.module.cjs.map +1 -1
- package/dist/components/Popover/Popover.module.js.map +1 -1
- package/dist/components/Portal/Portal.cjs.map +1 -1
- package/dist/components/Portal/Portal.js.map +1 -1
- package/dist/components/Portal/anchor-position.cjs.map +1 -1
- package/dist/components/Portal/anchor-position.js.map +1 -1
- package/dist/components/Portal/escape-layer.cjs.map +1 -1
- package/dist/components/Portal/escape-layer.js.map +1 -1
- package/dist/components/Portal/portal-host.cjs.map +1 -1
- package/dist/components/Portal/portal-host.js.map +1 -1
- package/dist/components/Portal/tab-bridge.cjs +1 -1
- package/dist/components/Portal/tab-bridge.cjs.map +1 -1
- package/dist/components/Portal/tab-bridge.js +1 -5
- package/dist/components/Portal/tab-bridge.js.map +1 -1
- package/dist/components/Progress/Progress.cjs.map +1 -1
- package/dist/components/Progress/Progress.js.map +1 -1
- package/dist/components/Progress/Progress.module.cjs.map +1 -1
- package/dist/components/Progress/Progress.module.js.map +1 -1
- package/dist/components/QRCode/QRCode.cjs.map +1 -1
- package/dist/components/QRCode/QRCode.js.map +1 -1
- package/dist/components/QRCode/QRCode.module.cjs.map +1 -1
- package/dist/components/QRCode/QRCode.module.js.map +1 -1
- package/dist/components/QRCode/qr-encode.cjs +1 -1
- package/dist/components/QRCode/qr-encode.cjs.map +1 -1
- package/dist/components/QRCode/qr-encode.js +7 -13
- package/dist/components/QRCode/qr-encode.js.map +1 -1
- package/dist/components/QRCode/qr-tables.cjs.map +1 -1
- package/dist/components/QRCode/qr-tables.js.map +1 -1
- package/dist/components/Radio/Radio.cjs.map +1 -1
- package/dist/components/Radio/Radio.js.map +1 -1
- package/dist/components/Radio/Radio.module.cjs.map +1 -1
- package/dist/components/Radio/Radio.module.js.map +1 -1
- package/dist/components/RangeSlider/RangeSlider.cjs.map +1 -1
- package/dist/components/RangeSlider/RangeSlider.js.map +1 -1
- package/dist/components/RangeSlider/RangeSlider.module.cjs.map +1 -1
- package/dist/components/RangeSlider/RangeSlider.module.js.map +1 -1
- package/dist/components/RatingStars/RatingStars.cjs.map +1 -1
- package/dist/components/RatingStars/RatingStars.js.map +1 -1
- package/dist/components/RatingStars/RatingStars.module.cjs.map +1 -1
- package/dist/components/RatingStars/RatingStars.module.js.map +1 -1
- package/dist/components/RefreshIndicator/RefreshIndicator.cjs +1 -1
- package/dist/components/RefreshIndicator/RefreshIndicator.cjs.map +1 -1
- package/dist/components/RefreshIndicator/RefreshIndicator.js +10 -18
- package/dist/components/RefreshIndicator/RefreshIndicator.js.map +1 -1
- package/dist/components/RefreshIndicator/RefreshIndicator.module.cjs.map +1 -1
- package/dist/components/RefreshIndicator/RefreshIndicator.module.js.map +1 -1
- package/dist/components/RelativeTime/RelativeTime.cjs.map +1 -1
- package/dist/components/RelativeTime/RelativeTime.js.map +1 -1
- package/dist/components/Resizable/Resizable.cjs +1 -1
- package/dist/components/Resizable/Resizable.cjs.map +1 -1
- package/dist/components/Resizable/Resizable.js +1 -9
- package/dist/components/Resizable/Resizable.js.map +1 -1
- package/dist/components/Resizable/Resizable.module.cjs.map +1 -1
- package/dist/components/Resizable/Resizable.module.js.map +1 -1
- package/dist/components/Responsive/Responsive.cjs.map +1 -1
- package/dist/components/Responsive/Responsive.js.map +1 -1
- package/dist/components/Reveal/Reveal.cjs.map +1 -1
- package/dist/components/Reveal/Reveal.js.map +1 -1
- package/dist/components/Reveal/Reveal.module.cjs.map +1 -1
- package/dist/components/Reveal/Reveal.module.js.map +1 -1
- package/dist/components/Reveal/reveal-threshold.cjs.map +1 -1
- package/dist/components/Reveal/reveal-threshold.js.map +1 -1
- package/dist/components/SafeArea/SafeArea.cjs.map +1 -1
- package/dist/components/SafeArea/SafeArea.js.map +1 -1
- package/dist/components/SafeArea/SafeArea.module.cjs.map +1 -1
- package/dist/components/SafeArea/SafeArea.module.js.map +1 -1
- package/dist/components/Scheduler/Scheduler.cjs.map +1 -1
- package/dist/components/Scheduler/Scheduler.js.map +1 -1
- package/dist/components/Scheduler/Scheduler.module.cjs.map +1 -1
- package/dist/components/Scheduler/Scheduler.module.js.map +1 -1
- package/dist/components/Scheduler/scheduler-layout.cjs.map +1 -1
- package/dist/components/Scheduler/scheduler-layout.js.map +1 -1
- package/dist/components/ScrollArea/ScrollArea.cjs.map +1 -1
- package/dist/components/ScrollArea/ScrollArea.js.map +1 -1
- package/dist/components/ScrollArea/ScrollArea.module.cjs.map +1 -1
- package/dist/components/ScrollArea/ScrollArea.module.js.map +1 -1
- package/dist/components/SearchBar/SearchBar.cjs.map +1 -1
- package/dist/components/SearchBar/SearchBar.js.map +1 -1
- package/dist/components/SearchBar/SearchBar.module.cjs.map +1 -1
- package/dist/components/SearchBar/SearchBar.module.js.map +1 -1
- package/dist/components/SectionHeader/SectionHeader.cjs.map +1 -1
- package/dist/components/SectionHeader/SectionHeader.js.map +1 -1
- package/dist/components/SectionHeader/SectionHeader.module.cjs.map +1 -1
- package/dist/components/SectionHeader/SectionHeader.module.js.map +1 -1
- package/dist/components/SegmentedControl/SegmentedControl.cjs.map +1 -1
- package/dist/components/SegmentedControl/SegmentedControl.js.map +1 -1
- package/dist/components/SegmentedControl/SegmentedControl.module.cjs.map +1 -1
- package/dist/components/SegmentedControl/SegmentedControl.module.js.map +1 -1
- package/dist/components/Select/CaretIcon.cjs.map +1 -1
- package/dist/components/Select/CaretIcon.js.map +1 -1
- package/dist/components/Select/Select.cjs.map +1 -1
- package/dist/components/Select/Select.js.map +1 -1
- package/dist/components/Select/Select.module.cjs.map +1 -1
- package/dist/components/Select/Select.module.js.map +1 -1
- package/dist/components/Select/options.cjs.map +1 -1
- package/dist/components/Select/options.js.map +1 -1
- package/dist/components/Sidebar/Sidebar.cjs +1 -1
- package/dist/components/Sidebar/Sidebar.cjs.map +1 -1
- package/dist/components/Sidebar/Sidebar.js +13 -23
- package/dist/components/Sidebar/Sidebar.js.map +1 -1
- package/dist/components/Sidebar/Sidebar.module.cjs.map +1 -1
- package/dist/components/Sidebar/Sidebar.module.js.map +1 -1
- package/dist/components/Sidebar/SidebarEntry.cjs.map +1 -1
- package/dist/components/Sidebar/SidebarEntry.js.map +1 -1
- package/dist/components/Sidebar/active-nav-key.cjs.map +1 -1
- package/dist/components/Sidebar/active-nav-key.js.map +1 -1
- package/dist/components/SignaturePad/SignaturePad.cjs +1 -1
- package/dist/components/SignaturePad/SignaturePad.cjs.map +1 -1
- package/dist/components/SignaturePad/SignaturePad.js +1 -5
- package/dist/components/SignaturePad/SignaturePad.js.map +1 -1
- package/dist/components/SignaturePad/SignaturePad.module.cjs.map +1 -1
- package/dist/components/SignaturePad/SignaturePad.module.js.map +1 -1
- package/dist/components/Skeleton/Skeleton.cjs.map +1 -1
- package/dist/components/Skeleton/Skeleton.js.map +1 -1
- package/dist/components/Skeleton/Skeleton.module.cjs.map +1 -1
- package/dist/components/Skeleton/Skeleton.module.js.map +1 -1
- package/dist/components/Slider/Slider.cjs.map +1 -1
- package/dist/components/Slider/Slider.js.map +1 -1
- package/dist/components/Slider/Slider.module.cjs.map +1 -1
- package/dist/components/Slider/Slider.module.js.map +1 -1
- package/dist/components/Spacer/Spacer.cjs.map +1 -1
- package/dist/components/Spacer/Spacer.js.map +1 -1
- package/dist/components/Spacer/Spacer.module.cjs.map +1 -1
- package/dist/components/Spacer/Spacer.module.js.map +1 -1
- package/dist/components/Sparkline/Sparkline.cjs.map +1 -1
- package/dist/components/Sparkline/Sparkline.js.map +1 -1
- package/dist/components/Sparkline/Sparkline.module.cjs.map +1 -1
- package/dist/components/Sparkline/Sparkline.module.js.map +1 -1
- package/dist/components/Sparkline/sparkline-geometry.cjs.map +1 -1
- package/dist/components/Sparkline/sparkline-geometry.js.map +1 -1
- package/dist/components/Spinner/Spinner.cjs.map +1 -1
- package/dist/components/Spinner/Spinner.js.map +1 -1
- package/dist/components/Spinner/Spinner.module.cjs.map +1 -1
- package/dist/components/Spinner/Spinner.module.js.map +1 -1
- package/dist/components/Stat/Stat.cjs.map +1 -1
- package/dist/components/Stat/Stat.js.map +1 -1
- package/dist/components/Stat/Stat.module.cjs.map +1 -1
- package/dist/components/Stat/Stat.module.js.map +1 -1
- package/dist/components/Stepper/Stepper.cjs.map +1 -1
- package/dist/components/Stepper/Stepper.js.map +1 -1
- package/dist/components/Stepper/Stepper.module.cjs.map +1 -1
- package/dist/components/Stepper/Stepper.module.js.map +1 -1
- package/dist/components/StepperInput/StepperInput.cjs.map +1 -1
- package/dist/components/StepperInput/StepperInput.js.map +1 -1
- package/dist/components/StepperInput/StepperInput.module.cjs.map +1 -1
- package/dist/components/StepperInput/StepperInput.module.js.map +1 -1
- package/dist/components/Switch/Switch.cjs.map +1 -1
- package/dist/components/Switch/Switch.js.map +1 -1
- package/dist/components/Switch/Switch.module.cjs.map +1 -1
- package/dist/components/Switch/Switch.module.js.map +1 -1
- package/dist/components/SyncStatusBadge/SyncStatusBadge.cjs.map +1 -1
- package/dist/components/SyncStatusBadge/SyncStatusBadge.js.map +1 -1
- package/dist/components/SyncStatusBadge/SyncStatusBadge.module.cjs.map +1 -1
- package/dist/components/SyncStatusBadge/SyncStatusBadge.module.js.map +1 -1
- package/dist/components/Table/Table.cjs.map +1 -1
- package/dist/components/Table/Table.js.map +1 -1
- package/dist/components/Table/Table.module.cjs.map +1 -1
- package/dist/components/Table/Table.module.js.map +1 -1
- package/dist/components/Tabs/Tabs.cjs.map +1 -1
- package/dist/components/Tabs/Tabs.js.map +1 -1
- package/dist/components/Tabs/Tabs.module.cjs.map +1 -1
- package/dist/components/Tabs/Tabs.module.js.map +1 -1
- package/dist/components/Tag/Tag.cjs.map +1 -1
- package/dist/components/Tag/Tag.js.map +1 -1
- package/dist/components/Tag/Tag.module.cjs.map +1 -1
- package/dist/components/Tag/Tag.module.js.map +1 -1
- package/dist/components/Textarea/Textarea.cjs.map +1 -1
- package/dist/components/Textarea/Textarea.js.map +1 -1
- package/dist/components/Textarea/Textarea.module.cjs.map +1 -1
- package/dist/components/Textarea/Textarea.module.js.map +1 -1
- package/dist/components/TimePicker/TimePicker.cjs.map +1 -1
- package/dist/components/TimePicker/TimePicker.js.map +1 -1
- package/dist/components/TimePicker/TimePicker.module.cjs.map +1 -1
- package/dist/components/TimePicker/TimePicker.module.js.map +1 -1
- package/dist/components/Timeline/Timeline.cjs.map +1 -1
- package/dist/components/Timeline/Timeline.js.map +1 -1
- package/dist/components/Timeline/Timeline.module.cjs.map +1 -1
- package/dist/components/Timeline/Timeline.module.js.map +1 -1
- package/dist/components/Toast/Toast.module.cjs.map +1 -1
- package/dist/components/Toast/Toast.module.js.map +1 -1
- package/dist/components/Toast/ToastProvider.cjs.map +1 -1
- package/dist/components/Toast/ToastProvider.js.map +1 -1
- package/dist/components/Toggle/Toggle.cjs.map +1 -1
- package/dist/components/Toggle/Toggle.js.map +1 -1
- package/dist/components/Toggle/Toggle.module.cjs.map +1 -1
- package/dist/components/Toggle/Toggle.module.js.map +1 -1
- package/dist/components/ToggleGroup/ToggleGroup.cjs.map +1 -1
- package/dist/components/ToggleGroup/ToggleGroup.js.map +1 -1
- package/dist/components/ToggleGroup/ToggleGroup.module.cjs.map +1 -1
- package/dist/components/ToggleGroup/ToggleGroup.module.js.map +1 -1
- package/dist/components/Tooltip/Tooltip.cjs.map +1 -1
- package/dist/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/components/Tooltip/Tooltip.module.cjs.map +1 -1
- package/dist/components/Tooltip/Tooltip.module.js.map +1 -1
- package/dist/components/Tour/Tour.cjs +1 -1
- package/dist/components/Tour/Tour.cjs.map +1 -1
- package/dist/components/Tour/Tour.js +1 -5
- package/dist/components/Tour/Tour.js.map +1 -1
- package/dist/components/Tour/Tour.module.cjs.map +1 -1
- package/dist/components/Tour/Tour.module.js.map +1 -1
- package/dist/components/Tour/tour-position.cjs.map +1 -1
- package/dist/components/Tour/tour-position.js.map +1 -1
- package/dist/components/Transfer/Transfer.cjs.map +1 -1
- package/dist/components/Transfer/Transfer.js.map +1 -1
- package/dist/components/Transfer/Transfer.module.cjs.map +1 -1
- package/dist/components/Transfer/Transfer.module.js.map +1 -1
- package/dist/components/Transfer/transfer-state.cjs.map +1 -1
- package/dist/components/Transfer/transfer-state.js.map +1 -1
- package/dist/components/TreeView/TreeView.cjs.map +1 -1
- package/dist/components/TreeView/TreeView.js.map +1 -1
- package/dist/components/TreeView/TreeView.module.cjs.map +1 -1
- package/dist/components/TreeView/TreeView.module.js.map +1 -1
- package/dist/components/TruncateText/TruncateText.cjs.map +1 -1
- package/dist/components/TruncateText/TruncateText.js.map +1 -1
- package/dist/components/TruncateText/TruncateText.module.cjs.map +1 -1
- package/dist/components/TruncateText/TruncateText.module.js.map +1 -1
- package/dist/components/UpdatePrompt/UpdatePrompt.cjs.map +1 -1
- package/dist/components/UpdatePrompt/UpdatePrompt.js.map +1 -1
- package/dist/components/UpdatePrompt/UpdatePrompt.module.cjs.map +1 -1
- package/dist/components/UpdatePrompt/UpdatePrompt.module.js.map +1 -1
- package/dist/components/VideoPlayer/VideoPlayer.cjs +1 -1
- package/dist/components/VideoPlayer/VideoPlayer.cjs.map +1 -1
- package/dist/components/VideoPlayer/VideoPlayer.js +1 -7
- package/dist/components/VideoPlayer/VideoPlayer.js.map +1 -1
- package/dist/components/VideoPlayer/VideoPlayer.module.cjs.map +1 -1
- package/dist/components/VideoPlayer/VideoPlayer.module.js.map +1 -1
- package/dist/components/VideoPlayer/playback-rates.cjs.map +1 -1
- package/dist/components/VideoPlayer/playback-rates.js.map +1 -1
- package/dist/components/VirtualList/VirtualList.cjs.map +1 -1
- package/dist/components/VirtualList/VirtualList.js.map +1 -1
- package/dist/components/VirtualList/VirtualList.module.cjs.map +1 -1
- package/dist/components/VirtualList/VirtualList.module.js.map +1 -1
- package/dist/components/VirtualTable/VirtualTable.cjs.map +1 -1
- package/dist/components/VirtualTable/VirtualTable.js.map +1 -1
- package/dist/components/VirtualTable/VirtualTable.module.cjs.map +1 -1
- package/dist/components/VirtualTable/VirtualTable.module.js.map +1 -1
- package/dist/components/VisuallyHidden/VisuallyHidden.cjs.map +1 -1
- package/dist/components/VisuallyHidden/VisuallyHidden.js.map +1 -1
- package/dist/components/VisuallyHidden/VisuallyHidden.module.cjs.map +1 -1
- package/dist/components/VisuallyHidden/VisuallyHidden.module.js.map +1 -1
- package/dist/components/Wizard/Wizard.cjs +1 -1
- package/dist/components/Wizard/Wizard.cjs.map +1 -1
- package/dist/components/Wizard/Wizard.js +4 -11
- package/dist/components/Wizard/Wizard.js.map +1 -1
- package/dist/components/Wizard/Wizard.module.cjs.map +1 -1
- package/dist/components/Wizard/Wizard.module.js.map +1 -1
- package/dist/data/create-data-provider.cjs.map +1 -1
- package/dist/data/create-data-provider.js.map +1 -1
- package/dist/data/data-provider-context.cjs.map +1 -1
- package/dist/data/data-provider-context.js.map +1 -1
- package/dist/data/use-resource.cjs.map +1 -1
- package/dist/data/use-resource.js.map +1 -1
- package/dist/editor/RichTextEditor.cjs.map +1 -1
- package/dist/editor/RichTextEditor.js.map +1 -1
- package/dist/editor/RichTextEditor.module.cjs.map +1 -1
- package/dist/editor/RichTextEditor.module.js.map +1 -1
- package/dist/editor.js +1 -2
- package/dist/error-boundary/ErrorBoundary.cjs.map +1 -1
- package/dist/error-boundary/ErrorBoundary.js.map +1 -1
- package/dist/error-boundary/use-error-handler.cjs.map +1 -1
- package/dist/error-boundary/use-error-handler.js.map +1 -1
- package/dist/feature-flags/FeatureFlagsProvider.cjs.map +1 -1
- package/dist/feature-flags/FeatureFlagsProvider.js.map +1 -1
- package/dist/feature-flags/growthbook-adapter.cjs.map +1 -1
- package/dist/feature-flags/growthbook-adapter.js.map +1 -1
- package/dist/feature-flags/in-memory-adapter.cjs.map +1 -1
- package/dist/feature-flags/in-memory-adapter.js.map +1 -1
- package/dist/feature-flags/launchdarkly-adapter.cjs.map +1 -1
- package/dist/feature-flags/launchdarkly-adapter.js.map +1 -1
- package/dist/forms/FormField.cjs.map +1 -1
- package/dist/forms/FormField.js.map +1 -1
- package/dist/forms/br-validators.cjs.map +1 -1
- package/dist/forms/br-validators.js.map +1 -1
- package/dist/forms/masked-inputs.cjs.map +1 -1
- package/dist/forms/masked-inputs.js.map +1 -1
- package/dist/forms/use-viacep.cjs.map +1 -1
- package/dist/forms/use-viacep.js.map +1 -1
- package/dist/forms/use-zod-form.cjs.map +1 -1
- package/dist/forms/use-zod-form.js.map +1 -1
- package/dist/forms/validate-form.cjs.map +1 -1
- package/dist/forms/validate-form.js.map +1 -1
- package/dist/forms/zod-resolver.cjs.map +1 -1
- package/dist/forms/zod-resolver.js.map +1 -1
- package/dist/geo/TrajectoryMap.cjs.map +1 -1
- package/dist/geo/TrajectoryMap.js.map +1 -1
- package/dist/geo/TrajectoryMap.module.cjs.map +1 -1
- package/dist/geo/TrajectoryMap.module.js.map +1 -1
- package/dist/geo/bounds.cjs.map +1 -1
- package/dist/geo/bounds.js.map +1 -1
- package/dist/geo/create-position-tracker.cjs +1 -1
- package/dist/geo/create-position-tracker.cjs.map +1 -1
- package/dist/geo/create-position-tracker.js +1 -7
- package/dist/geo/create-position-tracker.js.map +1 -1
- package/dist/geo/distance.cjs.map +1 -1
- package/dist/geo/distance.js.map +1 -1
- package/dist/geo/estimate.cjs.map +1 -1
- package/dist/geo/estimate.js.map +1 -1
- package/dist/geo/leaflet-map.cjs.map +1 -1
- package/dist/geo/leaflet-map.js.map +1 -1
- package/dist/geo/projection.cjs.map +1 -1
- package/dist/geo/projection.js.map +1 -1
- package/dist/geo/routing.cjs.map +1 -1
- package/dist/geo/routing.js.map +1 -1
- package/dist/geo/types.cjs.map +1 -1
- package/dist/geo/types.js.map +1 -1
- package/dist/geo/use-position-tracker.cjs.map +1 -1
- package/dist/geo/use-position-tracker.js.map +1 -1
- package/dist/hooks/pwa-env.cjs.map +1 -1
- package/dist/hooks/pwa-env.js.map +1 -1
- package/dist/hooks/tab-sequence.cjs.map +1 -1
- package/dist/hooks/tab-sequence.js.map +1 -1
- package/dist/hooks/use-announce.cjs +1 -1
- package/dist/hooks/use-announce.cjs.map +1 -1
- package/dist/hooks/use-announce.js +2 -2
- package/dist/hooks/use-announce.js.map +1 -1
- package/dist/hooks/use-async.cjs.map +1 -1
- package/dist/hooks/use-async.js.map +1 -1
- package/dist/hooks/use-before-install-prompt.cjs.map +1 -1
- package/dist/hooks/use-before-install-prompt.js.map +1 -1
- package/dist/hooks/use-breakpoint.cjs.map +1 -1
- package/dist/hooks/use-breakpoint.js.map +1 -1
- package/dist/hooks/use-click-outside.cjs.map +1 -1
- package/dist/hooks/use-click-outside.js.map +1 -1
- package/dist/hooks/use-client-filter.cjs.map +1 -1
- package/dist/hooks/use-client-filter.js.map +1 -1
- package/dist/hooks/use-clipboard.cjs.map +1 -1
- package/dist/hooks/use-clipboard.js.map +1 -1
- package/dist/hooks/use-countdown.cjs.map +1 -1
- package/dist/hooks/use-countdown.js.map +1 -1
- package/dist/hooks/use-counter.cjs.map +1 -1
- package/dist/hooks/use-counter.js.map +1 -1
- package/dist/hooks/use-debounce.cjs.map +1 -1
- package/dist/hooks/use-debounce.js.map +1 -1
- package/dist/hooks/use-deep-memo.cjs.map +1 -1
- package/dist/hooks/use-deep-memo.js.map +1 -1
- package/dist/hooks/use-disclosure.cjs.map +1 -1
- package/dist/hooks/use-disclosure.js.map +1 -1
- package/dist/hooks/use-document-title.cjs.map +1 -1
- package/dist/hooks/use-document-title.js.map +1 -1
- package/dist/hooks/use-document-visibility.cjs.map +1 -1
- package/dist/hooks/use-document-visibility.js.map +1 -1
- package/dist/hooks/use-draft-filters.cjs.map +1 -1
- package/dist/hooks/use-draft-filters.js.map +1 -1
- package/dist/hooks/use-event-listener.cjs.map +1 -1
- package/dist/hooks/use-event-listener.js.map +1 -1
- package/dist/hooks/use-favicon.cjs.map +1 -1
- package/dist/hooks/use-favicon.js.map +1 -1
- package/dist/hooks/use-focus-trap.cjs.map +1 -1
- package/dist/hooks/use-focus-trap.js.map +1 -1
- package/dist/hooks/use-fullscreen-element.cjs.map +1 -1
- package/dist/hooks/use-fullscreen-element.js.map +1 -1
- package/dist/hooks/use-fullscreen.cjs +1 -1
- package/dist/hooks/use-fullscreen.cjs.map +1 -1
- package/dist/hooks/use-fullscreen.js +7 -23
- package/dist/hooks/use-fullscreen.js.map +1 -1
- package/dist/hooks/use-geolocation.cjs.map +1 -1
- package/dist/hooks/use-geolocation.js.map +1 -1
- package/dist/hooks/use-hover.cjs.map +1 -1
- package/dist/hooks/use-hover.js.map +1 -1
- package/dist/hooks/use-idle.cjs.map +1 -1
- package/dist/hooks/use-idle.js.map +1 -1
- package/dist/hooks/use-install-prompt.cjs +1 -1
- package/dist/hooks/use-install-prompt.cjs.map +1 -1
- package/dist/hooks/use-install-prompt.js +1 -1
- package/dist/hooks/use-install-prompt.js.map +1 -1
- package/dist/hooks/use-intersection-observer.cjs.map +1 -1
- package/dist/hooks/use-intersection-observer.js.map +1 -1
- package/dist/hooks/use-interval.cjs.map +1 -1
- package/dist/hooks/use-interval.js.map +1 -1
- package/dist/hooks/use-is-first-render.cjs.map +1 -1
- package/dist/hooks/use-is-first-render.js.map +1 -1
- package/dist/hooks/use-keyboard-shortcut.cjs.map +1 -1
- package/dist/hooks/use-keyboard-shortcut.js.map +1 -1
- package/dist/hooks/use-latest-ref.cjs.map +1 -1
- package/dist/hooks/use-latest-ref.js.map +1 -1
- package/dist/hooks/use-list-state.cjs.map +1 -1
- package/dist/hooks/use-list-state.js.map +1 -1
- package/dist/hooks/use-local-storage.cjs +1 -1
- package/dist/hooks/use-local-storage.cjs.map +1 -1
- package/dist/hooks/use-local-storage.js +2 -5
- package/dist/hooks/use-local-storage.js.map +1 -1
- package/dist/hooks/use-long-press-handlers.cjs.map +1 -1
- package/dist/hooks/use-long-press-handlers.js.map +1 -1
- package/dist/hooks/use-long-press.cjs.map +1 -1
- package/dist/hooks/use-long-press.js.map +1 -1
- package/dist/hooks/use-map.cjs.map +1 -1
- package/dist/hooks/use-map.js.map +1 -1
- package/dist/hooks/use-media-devices.cjs.map +1 -1
- package/dist/hooks/use-media-devices.js.map +1 -1
- package/dist/hooks/use-media-permission.cjs +1 -1
- package/dist/hooks/use-media-permission.cjs.map +1 -1
- package/dist/hooks/use-media-permission.js +2 -5
- package/dist/hooks/use-media-permission.js.map +1 -1
- package/dist/hooks/use-media-query.cjs.map +1 -1
- package/dist/hooks/use-media-query.js.map +1 -1
- package/dist/hooks/use-object-url.cjs.map +1 -1
- package/dist/hooks/use-object-url.js.map +1 -1
- package/dist/hooks/use-online.cjs.map +1 -1
- package/dist/hooks/use-online.js.map +1 -1
- package/dist/hooks/use-pagination.cjs.map +1 -1
- package/dist/hooks/use-pagination.js.map +1 -1
- package/dist/hooks/use-previous.cjs.map +1 -1
- package/dist/hooks/use-previous.js.map +1 -1
- package/dist/hooks/use-push-to-talk.cjs.map +1 -1
- package/dist/hooks/use-push-to-talk.js.map +1 -1
- package/dist/hooks/use-queue.cjs.map +1 -1
- package/dist/hooks/use-queue.js.map +1 -1
- package/dist/hooks/use-resize-observer.cjs.map +1 -1
- package/dist/hooks/use-resize-observer.js.map +1 -1
- package/dist/hooks/use-scroll-lock.cjs.map +1 -1
- package/dist/hooks/use-scroll-lock.js.map +1 -1
- package/dist/hooks/use-scroll-overflow.cjs.map +1 -1
- package/dist/hooks/use-scroll-overflow.js.map +1 -1
- package/dist/hooks/use-service-worker-update.cjs.map +1 -1
- package/dist/hooks/use-service-worker-update.js.map +1 -1
- package/dist/hooks/use-set.cjs.map +1 -1
- package/dist/hooks/use-set.js.map +1 -1
- package/dist/hooks/use-sortable.cjs.map +1 -1
- package/dist/hooks/use-sortable.js.map +1 -1
- package/dist/hooks/use-stable-callback.cjs.map +1 -1
- package/dist/hooks/use-stable-callback.js.map +1 -1
- package/dist/hooks/use-storage-estimate.cjs.map +1 -1
- package/dist/hooks/use-storage-estimate.js.map +1 -1
- package/dist/hooks/use-throttle.cjs.map +1 -1
- package/dist/hooks/use-throttle.js.map +1 -1
- package/dist/hooks/use-timeout.cjs.map +1 -1
- package/dist/hooks/use-timeout.js.map +1 -1
- package/dist/hooks/use-toggle.cjs.map +1 -1
- package/dist/hooks/use-toggle.js.map +1 -1
- package/dist/hooks/use-typewriter.cjs.map +1 -1
- package/dist/hooks/use-typewriter.js.map +1 -1
- package/dist/hooks/use-window-size.cjs.map +1 -1
- package/dist/hooks/use-window-size.js.map +1 -1
- package/dist/http/api-client.cjs +1 -1
- package/dist/http/api-client.cjs.map +1 -1
- package/dist/http/api-client.js +5 -1
- package/dist/http/api-client.js.map +1 -1
- package/dist/http/build-url.cjs +1 -1
- package/dist/http/build-url.cjs.map +1 -1
- package/dist/http/build-url.js +3 -1
- package/dist/http/build-url.js.map +1 -1
- package/dist/http/credential-scope.cjs.map +1 -1
- package/dist/http/credential-scope.js.map +1 -1
- package/dist/http/csrf.cjs.map +1 -1
- package/dist/http/csrf.js.map +1 -1
- package/dist/http/decode-response.cjs.map +1 -1
- package/dist/http/decode-response.js.map +1 -1
- package/dist/http/describe-api-error.cjs.map +1 -1
- package/dist/http/describe-api-error.js.map +1 -1
- package/dist/http/errors.cjs.map +1 -1
- package/dist/http/errors.js.map +1 -1
- package/dist/http/idempotency.cjs.map +1 -1
- package/dist/http/idempotency.js.map +1 -1
- package/dist/http/parse-response.cjs.map +1 -1
- package/dist/http/parse-response.js.map +1 -1
- package/dist/http/presigned-post.cjs +2 -0
- package/dist/http/presigned-post.cjs.map +1 -0
- package/dist/http/presigned-post.js +73 -0
- package/dist/http/presigned-post.js.map +1 -0
- package/dist/http/resumable-upload.cjs.map +1 -1
- package/dist/http/resumable-upload.js.map +1 -1
- package/dist/http/retry.cjs.map +1 -1
- package/dist/http/retry.js.map +1 -1
- package/dist/http/timeout.cjs.map +1 -1
- package/dist/http/timeout.js.map +1 -1
- package/dist/http/upload-with-progress.cjs +1 -1
- package/dist/http/upload-with-progress.cjs.map +1 -1
- package/dist/http/upload-with-progress.js +2 -7
- package/dist/http/upload-with-progress.js.map +1 -1
- package/dist/http/use-describe-api-error.cjs.map +1 -1
- package/dist/http/use-describe-api-error.js.map +1 -1
- package/dist/http/use-poll.cjs +1 -1
- package/dist/http/use-poll.cjs.map +1 -1
- package/dist/http/use-poll.js +2 -5
- package/dist/http/use-poll.js.map +1 -1
- package/dist/i18n/I18nProvider.cjs.map +1 -1
- package/dist/i18n/I18nProvider.js.map +1 -1
- package/dist/i18n/create-i18n.cjs.map +1 -1
- package/dist/i18n/create-i18n.js.map +1 -1
- package/dist/icons/Icon.cjs.map +1 -1
- package/dist/icons/Icon.js.map +1 -1
- package/dist/icons/IconPicker.cjs.map +1 -1
- package/dist/icons/IconPicker.js.map +1 -1
- package/dist/icons/IconPicker.module.cjs.map +1 -1
- package/dist/icons/IconPicker.module.js.map +1 -1
- package/dist/icons/IconProvider.cjs.map +1 -1
- package/dist/icons/IconProvider.js.map +1 -1
- package/dist/icons/alias.cjs.map +1 -1
- package/dist/icons/alias.js.map +1 -1
- package/dist/icons/generated/aliases.cjs.map +1 -1
- package/dist/icons/generated/aliases.js.map +1 -1
- package/dist/icons/generated/icon-names.cjs.map +1 -1
- package/dist/icons/generated/icon-names.js.map +1 -1
- package/dist/icons/generated/loaders.cjs.map +1 -1
- package/dist/icons/generated/loaders.js.map +1 -1
- package/dist/icons/generated/shard-00.cjs.map +1 -1
- package/dist/icons/generated/shard-00.js.map +1 -1
- package/dist/icons/generated/shard-01.cjs.map +1 -1
- package/dist/icons/generated/shard-01.js.map +1 -1
- package/dist/icons/generated/shard-02.cjs.map +1 -1
- package/dist/icons/generated/shard-02.js.map +1 -1
- package/dist/icons/generated/shard-03.cjs.map +1 -1
- package/dist/icons/generated/shard-03.js.map +1 -1
- package/dist/icons/generated/shard-04.cjs.map +1 -1
- package/dist/icons/generated/shard-04.js.map +1 -1
- package/dist/icons/generated/shard-05.cjs.map +1 -1
- package/dist/icons/generated/shard-05.js.map +1 -1
- package/dist/icons/generated/shard-06.cjs.map +1 -1
- package/dist/icons/generated/shard-06.js.map +1 -1
- package/dist/icons/generated/shard-07.cjs.map +1 -1
- package/dist/icons/generated/shard-07.js.map +1 -1
- package/dist/icons/generated/shard-08.cjs.map +1 -1
- package/dist/icons/generated/shard-08.js.map +1 -1
- package/dist/icons/generated/shard-09.cjs.map +1 -1
- package/dist/icons/generated/shard-09.js.map +1 -1
- package/dist/icons/generated/shard-10.cjs.map +1 -1
- package/dist/icons/generated/shard-10.js.map +1 -1
- package/dist/icons/generated/shard-11.cjs.map +1 -1
- package/dist/icons/generated/shard-11.js.map +1 -1
- package/dist/icons/generated/shard-12.cjs.map +1 -1
- package/dist/icons/generated/shard-12.js.map +1 -1
- package/dist/icons/generated/shard-13.cjs.map +1 -1
- package/dist/icons/generated/shard-13.js.map +1 -1
- package/dist/icons/generated/shard-14.cjs.map +1 -1
- package/dist/icons/generated/shard-14.js.map +1 -1
- package/dist/icons/generated/shard-15.cjs.map +1 -1
- package/dist/icons/generated/shard-15.js.map +1 -1
- package/dist/icons/generated/shard-16.cjs.map +1 -1
- package/dist/icons/generated/shard-16.js.map +1 -1
- package/dist/icons/generated/shard-17.cjs.map +1 -1
- package/dist/icons/generated/shard-17.js.map +1 -1
- package/dist/icons/generated/shard-18.cjs.map +1 -1
- package/dist/icons/generated/shard-18.js.map +1 -1
- package/dist/icons/generated/shard-19.cjs.map +1 -1
- package/dist/icons/generated/shard-19.js.map +1 -1
- package/dist/icons/generated/shard-20.cjs.map +1 -1
- package/dist/icons/generated/shard-20.js.map +1 -1
- package/dist/icons/generated/shard-21.cjs.map +1 -1
- package/dist/icons/generated/shard-21.js.map +1 -1
- package/dist/icons/generated/shard-22.cjs.map +1 -1
- package/dist/icons/generated/shard-22.js.map +1 -1
- package/dist/icons/generated/shard-23.cjs.map +1 -1
- package/dist/icons/generated/shard-23.js.map +1 -1
- package/dist/icons/generated/shard-24.cjs.map +1 -1
- package/dist/icons/generated/shard-24.js.map +1 -1
- package/dist/icons/generated/shard-25.cjs.map +1 -1
- package/dist/icons/generated/shard-25.js.map +1 -1
- package/dist/icons/generated/shard-26.cjs.map +1 -1
- package/dist/icons/generated/shard-26.js.map +1 -1
- package/dist/icons/generated/shard-27.cjs.map +1 -1
- package/dist/icons/generated/shard-27.js.map +1 -1
- package/dist/icons/generated/shard-28.cjs.map +1 -1
- package/dist/icons/generated/shard-28.js.map +1 -1
- package/dist/icons/generated/shard-29.cjs.map +1 -1
- package/dist/icons/generated/shard-29.js.map +1 -1
- package/dist/icons/generated/shard-30.cjs.map +1 -1
- package/dist/icons/generated/shard-30.js.map +1 -1
- package/dist/icons/generated/shard-31.cjs.map +1 -1
- package/dist/icons/generated/shard-31.js.map +1 -1
- package/dist/icons/generated/shard-32.cjs.map +1 -1
- package/dist/icons/generated/shard-32.js.map +1 -1
- package/dist/icons/generated/shard-33.cjs.map +1 -1
- package/dist/icons/generated/shard-33.js.map +1 -1
- package/dist/icons/generated/shard-34.cjs.map +1 -1
- package/dist/icons/generated/shard-34.js.map +1 -1
- package/dist/icons/generated/shard-35.cjs.map +1 -1
- package/dist/icons/generated/shard-35.js.map +1 -1
- package/dist/icons/generated/shard-36.cjs.map +1 -1
- package/dist/icons/generated/shard-36.js.map +1 -1
- package/dist/icons/generated/shard-37.cjs.map +1 -1
- package/dist/icons/generated/shard-37.js.map +1 -1
- package/dist/icons/generated/shard-38.cjs.map +1 -1
- package/dist/icons/generated/shard-38.js.map +1 -1
- package/dist/icons/generated/shard-39.cjs.map +1 -1
- package/dist/icons/generated/shard-39.js.map +1 -1
- package/dist/icons/generated/shard-40.cjs.map +1 -1
- package/dist/icons/generated/shard-40.js.map +1 -1
- package/dist/icons/generated/shard-41.cjs.map +1 -1
- package/dist/icons/generated/shard-41.js.map +1 -1
- package/dist/icons/generated/shard-42.cjs.map +1 -1
- package/dist/icons/generated/shard-42.js.map +1 -1
- package/dist/icons/generated/shard-43.cjs.map +1 -1
- package/dist/icons/generated/shard-43.js.map +1 -1
- package/dist/icons/generated/shard-44.cjs.map +1 -1
- package/dist/icons/generated/shard-44.js.map +1 -1
- package/dist/icons/generated/shard-45.cjs.map +1 -1
- package/dist/icons/generated/shard-45.js.map +1 -1
- package/dist/icons/icon-context.cjs.map +1 -1
- package/dist/icons/icon-context.js.map +1 -1
- package/dist/icons/is-icon-name.cjs.map +1 -1
- package/dist/icons/is-icon-name.js.map +1 -1
- package/dist/icons/material-symbols.cjs.map +1 -1
- package/dist/icons/material-symbols.js.map +1 -1
- package/dist/icons/normalize-icon-name.cjs.map +1 -1
- package/dist/icons/normalize-icon-name.js.map +1 -1
- package/dist/icons/shard-cache.cjs +1 -1
- package/dist/icons/shard-cache.cjs.map +1 -1
- package/dist/icons/shard-cache.js +2 -5
- package/dist/icons/shard-cache.js.map +1 -1
- package/dist/icons/use-icon.cjs.map +1 -1
- package/dist/icons/use-icon.js.map +1 -1
- package/dist/icons/validate-icon-name.cjs.map +1 -1
- package/dist/icons/validate-icon-name.js.map +1 -1
- package/dist/icons-virtual.cjs.map +1 -1
- package/dist/icons-virtual.js.map +1 -1
- package/dist/imaging/canvas.cjs.map +1 -1
- package/dist/imaging/canvas.js.map +1 -1
- package/dist/imaging/compress.cjs.map +1 -1
- package/dist/imaging/compress.js.map +1 -1
- package/dist/imaging/decode.cjs.map +1 -1
- package/dist/imaging/decode.js.map +1 -1
- package/dist/imaging/encode.cjs.map +1 -1
- package/dist/imaging/encode.js.map +1 -1
- package/dist/imaging/exceptions.cjs.map +1 -1
- package/dist/imaging/exceptions.js.map +1 -1
- package/dist/imaging/frame.cjs.map +1 -1
- package/dist/imaging/frame.js.map +1 -1
- package/dist/imaging/thumbnails.cjs.map +1 -1
- package/dist/imaging/thumbnails.js.map +1 -1
- package/dist/imaging/transform.cjs.map +1 -1
- package/dist/imaging/transform.js.map +1 -1
- package/dist/imaging/use-image-processing.cjs.map +1 -1
- package/dist/imaging/use-image-processing.js.map +1 -1
- package/dist/logger/logger.cjs.map +1 -1
- package/dist/logger/logger.js.map +1 -1
- package/dist/neural.cjs.map +1 -1
- package/dist/neural.js.map +1 -1
- package/dist/oauth/GoogleSignIn.cjs +1 -1
- package/dist/oauth/GoogleSignIn.cjs.map +1 -1
- package/dist/oauth/GoogleSignIn.js +6 -9
- package/dist/oauth/GoogleSignIn.js.map +1 -1
- package/dist/oauth/callback.cjs.map +1 -1
- package/dist/oauth/callback.js.map +1 -1
- package/dist/oauth/use-oauth-callback.cjs.map +1 -1
- package/dist/oauth/use-oauth-callback.js.map +1 -1
- package/dist/offline/conflict.cjs.map +1 -1
- package/dist/offline/conflict.js.map +1 -1
- package/dist/offline/create-offline-database.cjs.map +1 -1
- package/dist/offline/create-offline-database.js.map +1 -1
- package/dist/offline/create-offline-store.cjs +1 -1
- package/dist/offline/create-offline-store.cjs.map +1 -1
- package/dist/offline/create-offline-store.js +1 -5
- package/dist/offline/create-offline-store.js.map +1 -1
- package/dist/offline/create-offline-sync.cjs +1 -1
- package/dist/offline/create-offline-sync.cjs.map +1 -1
- package/dist/offline/create-offline-sync.js +9 -14
- package/dist/offline/create-offline-sync.js.map +1 -1
- package/dist/offline/use-offline-sync.cjs.map +1 -1
- package/dist/offline/use-offline-sync.js.map +1 -1
- package/dist/perf/cache-size.cjs.map +1 -1
- package/dist/perf/cache-size.js.map +1 -1
- package/dist/perf/device.cjs.map +1 -1
- package/dist/perf/device.js.map +1 -1
- package/dist/perf/format.cjs.map +1 -1
- package/dist/perf/format.js.map +1 -1
- package/dist/perf/profiler.cjs.map +1 -1
- package/dist/perf/profiler.js.map +1 -1
- package/dist/push/use-push-subscription.cjs.map +1 -1
- package/dist/push/use-push-subscription.js.map +1 -1
- package/dist/push/utils.cjs.map +1 -1
- package/dist/push/utils.js.map +1 -1
- package/dist/push/web-push-client.cjs.map +1 -1
- package/dist/push/web-push-client.js.map +1 -1
- package/dist/query/QueryProvider.cjs.map +1 -1
- package/dist/query/QueryProvider.js.map +1 -1
- package/dist/query/constants.cjs.map +1 -1
- package/dist/query/constants.js.map +1 -1
- package/dist/query/create-query-keys.cjs.map +1 -1
- package/dist/query/create-query-keys.js.map +1 -1
- package/dist/query/foreign-client-warning.cjs.map +1 -1
- package/dist/query/foreign-client-warning.js.map +1 -1
- package/dist/query/offline-persistence.cjs +1 -1
- package/dist/query/offline-persistence.cjs.map +1 -1
- package/dist/query/offline-persistence.js +2 -10
- package/dist/query/offline-persistence.js.map +1 -1
- package/dist/query/optimistic.cjs.map +1 -1
- package/dist/query/optimistic.js.map +1 -1
- package/dist/query/pagination.cjs.map +1 -1
- package/dist/query/pagination.js.map +1 -1
- package/dist/query/retry-policy.cjs.map +1 -1
- package/dist/query/retry-policy.js.map +1 -1
- package/dist/query/use-cursor-query.cjs.map +1 -1
- package/dist/query/use-cursor-query.js.map +1 -1
- package/dist/query/use-offline-mutation.cjs.map +1 -1
- package/dist/query/use-offline-mutation.js.map +1 -1
- package/dist/query/use-paginated-query.cjs.map +1 -1
- package/dist/query/use-paginated-query.js.map +1 -1
- package/dist/router/AppRouter.cjs.map +1 -1
- package/dist/router/AppRouter.js.map +1 -1
- package/dist/router/RouteGuard.cjs.map +1 -1
- package/dist/router/RouteGuard.js.map +1 -1
- package/dist/router/index.js +2 -2
- package/dist/share/share-or-download.cjs.map +1 -1
- package/dist/share/share-or-download.js.map +1 -1
- package/dist/share/share.cjs.map +1 -1
- package/dist/share/share.js.map +1 -1
- package/dist/sse/create-event-stream.cjs +1 -1
- package/dist/sse/create-event-stream.cjs.map +1 -1
- package/dist/sse/create-event-stream.js +44 -30
- package/dist/sse/create-event-stream.js.map +1 -1
- package/dist/sse/ticket-event-stream.cjs +2 -0
- package/dist/sse/ticket-event-stream.cjs.map +1 -0
- package/dist/sse/ticket-event-stream.js +41 -0
- package/dist/sse/ticket-event-stream.js.map +1 -0
- package/dist/sse/use-event-stream.cjs +1 -1
- package/dist/sse/use-event-stream.cjs.map +1 -1
- package/dist/sse/use-event-stream.js +7 -4
- package/dist/sse/use-event-stream.js.map +1 -1
- package/dist/store/create-selectors.cjs.map +1 -1
- package/dist/store/create-selectors.js.map +1 -1
- package/dist/store/create-store.cjs.map +1 -1
- package/dist/store/create-store.js.map +1 -1
- package/dist/sw/background-sync.cjs.map +1 -1
- package/dist/sw/background-sync.js.map +1 -1
- package/dist/sw/cache-inspect.cjs.map +1 -1
- package/dist/sw/cache-inspect.js.map +1 -1
- package/dist/sw/cache.cjs +1 -1
- package/dist/sw/cache.cjs.map +1 -1
- package/dist/sw/cache.js +2 -6
- package/dist/sw/cache.js.map +1 -1
- package/dist/sw/create-push-handler.cjs.map +1 -1
- package/dist/sw/create-push-handler.js.map +1 -1
- package/dist/sw/credential-headers.cjs.map +1 -1
- package/dist/sw/credential-headers.js.map +1 -1
- package/dist/sw/periodic-sync.cjs.map +1 -1
- package/dist/sw/periodic-sync.js.map +1 -1
- package/dist/sw/register-service-worker.cjs.map +1 -1
- package/dist/sw/register-service-worker.js.map +1 -1
- package/dist/sw/session-data.cjs.map +1 -1
- package/dist/sw/session-data.js.map +1 -1
- package/dist/tabular/assets.cjs.map +1 -1
- package/dist/tabular/assets.js.map +1 -1
- package/dist/tabular/cache.cjs.map +1 -1
- package/dist/tabular/cache.js.map +1 -1
- package/dist/tabular/compact.cjs.map +1 -1
- package/dist/tabular/compact.js.map +1 -1
- package/dist/tabular/exceptions.cjs.map +1 -1
- package/dist/tabular/exceptions.js.map +1 -1
- package/dist/tabular/manifest.cjs.map +1 -1
- package/dist/tabular/manifest.js.map +1 -1
- package/dist/tabular/predictor.cjs.map +1 -1
- package/dist/tabular/predictor.js.map +1 -1
- package/dist/tabular/use-tabular-predictor.cjs.map +1 -1
- package/dist/tabular/use-tabular-predictor.js.map +1 -1
- package/dist/telemetry/TelemetryProvider.cjs.map +1 -1
- package/dist/telemetry/TelemetryProvider.js.map +1 -1
- package/dist/telemetry/app-error-adapter.cjs.map +1 -1
- package/dist/telemetry/app-error-adapter.js.map +1 -1
- package/dist/telemetry/app-error-queue.cjs.map +1 -1
- package/dist/telemetry/app-error-queue.js.map +1 -1
- package/dist/telemetry/app-error-reporter.cjs.map +1 -1
- package/dist/telemetry/app-error-reporter.js.map +1 -1
- package/dist/telemetry/app-error-schema.cjs.map +1 -1
- package/dist/telemetry/app-error-schema.js.map +1 -1
- package/dist/telemetry/app-error-transport.cjs.map +1 -1
- package/dist/telemetry/app-error-transport.js.map +1 -1
- package/dist/telemetry/console-adapter.cjs.map +1 -1
- package/dist/telemetry/console-adapter.js.map +1 -1
- package/dist/telemetry/describe-app-error.cjs.map +1 -1
- package/dist/telemetry/describe-app-error.js.map +1 -1
- package/dist/telemetry/posthog-adapter.cjs +1 -1
- package/dist/telemetry/posthog-adapter.cjs.map +1 -1
- package/dist/telemetry/posthog-adapter.js +1 -5
- package/dist/telemetry/posthog-adapter.js.map +1 -1
- package/dist/telemetry/sentry-adapter.cjs.map +1 -1
- package/dist/telemetry/sentry-adapter.js.map +1 -1
- package/dist/tempest-react-sdk.cjs +1 -1
- package/dist/tempest-react-sdk.d.ts +440 -7
- package/dist/tempest-react-sdk.js +122 -120
- package/dist/testing/create-mock-handlers.cjs.map +1 -1
- package/dist/testing/create-mock-handlers.js.map +1 -1
- package/dist/testing.js +1 -2
- package/dist/theme/ThemeProvider.cjs.map +1 -1
- package/dist/theme/ThemeProvider.js.map +1 -1
- package/dist/theme/apply-theme.cjs.map +1 -1
- package/dist/theme/apply-theme.js.map +1 -1
- package/dist/theme/color.cjs.map +1 -1
- package/dist/theme/color.js.map +1 -1
- package/dist/theme/create-theme.cjs.map +1 -1
- package/dist/theme/create-theme.js.map +1 -1
- package/dist/theme/data-viz-ramps.cjs.map +1 -1
- package/dist/theme/data-viz-ramps.js.map +1 -1
- package/dist/theme/initial-theme.cjs.map +1 -1
- package/dist/theme/initial-theme.js.map +1 -1
- package/dist/theme/inverse-render.cjs.map +1 -1
- package/dist/theme/inverse-render.js.map +1 -1
- package/dist/theme/inverse-restore.cjs.map +1 -1
- package/dist/theme/inverse-restore.js.map +1 -1
- package/dist/theme/inverse-surface.cjs.map +1 -1
- package/dist/theme/inverse-surface.js.map +1 -1
- package/dist/theme/status-tokens.cjs.map +1 -1
- package/dist/theme/status-tokens.js.map +1 -1
- package/dist/theme/theme-presets.cjs.map +1 -1
- package/dist/theme/theme-presets.js.map +1 -1
- package/dist/utils/absent.cjs.map +1 -1
- package/dist/utils/absent.js.map +1 -1
- package/dist/utils/arrays.cjs.map +1 -1
- package/dist/utils/arrays.js.map +1 -1
- package/dist/utils/base64.cjs.map +1 -1
- package/dist/utils/base64.js.map +1 -1
- package/dist/utils/cn.cjs.map +1 -1
- package/dist/utils/cn.js.map +1 -1
- package/dist/utils/compare-values.cjs.map +1 -1
- package/dist/utils/compare-values.js.map +1 -1
- package/dist/utils/compressed-storage.cjs.map +1 -1
- package/dist/utils/compressed-storage.js.map +1 -1
- package/dist/utils/csv.cjs.map +1 -1
- package/dist/utils/csv.js.map +1 -1
- package/dist/utils/dev-mode.cjs.map +1 -1
- package/dist/utils/dev-mode.js.map +1 -1
- package/dist/utils/duplicate-instance.cjs.map +1 -1
- package/dist/utils/duplicate-instance.js.map +1 -1
- package/dist/utils/format.cjs.map +1 -1
- package/dist/utils/format.js.map +1 -1
- package/dist/utils/functions.cjs +1 -1
- package/dist/utils/functions.cjs.map +1 -1
- package/dist/utils/functions.js +1 -1
- package/dist/utils/functions.js.map +1 -1
- package/dist/utils/guards.cjs.map +1 -1
- package/dist/utils/guards.js.map +1 -1
- package/dist/utils/ids.cjs.map +1 -1
- package/dist/utils/ids.js.map +1 -1
- package/dist/utils/intl-cache.cjs.map +1 -1
- package/dist/utils/intl-cache.js.map +1 -1
- package/dist/utils/json-frame.cjs.map +1 -1
- package/dist/utils/json-frame.js.map +1 -1
- package/dist/utils/numbers.cjs.map +1 -1
- package/dist/utils/numbers.js.map +1 -1
- package/dist/utils/objects.cjs.map +1 -1
- package/dist/utils/objects.js.map +1 -1
- package/dist/utils/owner-fingerprint.cjs.map +1 -1
- package/dist/utils/owner-fingerprint.js.map +1 -1
- package/dist/utils/promises.cjs.map +1 -1
- package/dist/utils/promises.js.map +1 -1
- package/dist/utils/relative-time.cjs.map +1 -1
- package/dist/utils/relative-time.js.map +1 -1
- package/dist/utils/safe-url.cjs.map +1 -1
- package/dist/utils/safe-url.js.map +1 -1
- package/dist/utils/schema-like.cjs.map +1 -1
- package/dist/utils/schema-like.js.map +1 -1
- package/dist/utils/storage.cjs +1 -1
- package/dist/utils/storage.cjs.map +1 -1
- package/dist/utils/storage.js +2 -2
- package/dist/utils/storage.js.map +1 -1
- package/dist/utils/strings.cjs.map +1 -1
- package/dist/utils/strings.js.map +1 -1
- package/dist/utils/xlsx.cjs.map +1 -1
- package/dist/utils/xlsx.js.map +1 -1
- package/dist/vision/core/canvas.cjs.map +1 -1
- package/dist/vision/core/canvas.js.map +1 -1
- package/dist/vision/core/dtypes.cjs.map +1 -1
- package/dist/vision/core/dtypes.js.map +1 -1
- package/dist/vision/core/exceptions.cjs.map +1 -1
- package/dist/vision/core/exceptions.js.map +1 -1
- package/dist/vision/core/graph.cjs.map +1 -1
- package/dist/vision/core/graph.js.map +1 -1
- package/dist/vision/core/metadata.cjs +1 -1
- package/dist/vision/core/metadata.cjs.map +1 -1
- package/dist/vision/core/metadata.js +9 -26
- package/dist/vision/core/metadata.js.map +1 -1
- package/dist/vision/core/providers.cjs.map +1 -1
- package/dist/vision/core/providers.js.map +1 -1
- package/dist/vision/core/session.cjs.map +1 -1
- package/dist/vision/core/session.js.map +1 -1
- package/dist/vision/core/timing.cjs.map +1 -1
- package/dist/vision/core/timing.js.map +1 -1
- package/dist/vision/fusion.cjs.map +1 -1
- package/dist/vision/fusion.js.map +1 -1
- package/dist/vision/index.cjs.map +1 -1
- package/dist/vision/index.js.map +1 -1
- package/dist/vision/io/image.cjs.map +1 -1
- package/dist/vision/io/image.js.map +1 -1
- package/dist/vision/labels.cjs.map +1 -1
- package/dist/vision/labels.js.map +1 -1
- package/dist/vision/luminance.cjs.map +1 -1
- package/dist/vision/luminance.js.map +1 -1
- package/dist/vision/normalization.cjs.map +1 -1
- package/dist/vision/normalization.js.map +1 -1
- package/dist/vision/postprocess/classification.cjs.map +1 -1
- package/dist/vision/postprocess/classification.js.map +1 -1
- package/dist/vision/postprocess/detection.cjs.map +1 -1
- package/dist/vision/postprocess/detection.js.map +1 -1
- package/dist/vision/postprocess/segmentation.cjs.map +1 -1
- package/dist/vision/postprocess/segmentation.js.map +1 -1
- package/dist/vision/preprocess/image.cjs.map +1 -1
- package/dist/vision/preprocess/image.js.map +1 -1
- package/dist/vision/preprocess/pipeline.cjs.map +1 -1
- package/dist/vision/preprocess/pipeline.js.map +1 -1
- package/dist/vision/results.cjs.map +1 -1
- package/dist/vision/results.js.map +1 -1
- package/dist/vision/tasks/base.cjs.map +1 -1
- package/dist/vision/tasks/base.js.map +1 -1
- package/dist/vision/tasks/classifier.cjs.map +1 -1
- package/dist/vision/tasks/classifier.js.map +1 -1
- package/dist/vision/tasks/detectClassify.cjs.map +1 -1
- package/dist/vision/tasks/detectClassify.js.map +1 -1
- package/dist/vision/tasks/detector.cjs.map +1 -1
- package/dist/vision/tasks/detector.js.map +1 -1
- package/dist/vision/tasks/segmenter.cjs.map +1 -1
- package/dist/vision/tasks/segmenter.js.map +1 -1
- package/dist/vision/types.cjs.map +1 -1
- package/dist/vision/types.js.map +1 -1
- package/dist/vision/use-camera-stream.cjs +1 -1
- package/dist/vision/use-camera-stream.cjs.map +1 -1
- package/dist/vision/use-camera-stream.js +3 -9
- package/dist/vision/use-camera-stream.js.map +1 -1
- package/dist/vision/use-live-luminance.cjs +1 -1
- package/dist/vision/use-live-luminance.cjs.map +1 -1
- package/dist/vision/use-live-luminance.js +1 -5
- package/dist/vision/use-live-luminance.js.map +1 -1
- package/dist/vite/base-url.cjs.map +1 -1
- package/dist/vite/base-url.js.map +1 -1
- package/dist/vite/create-vite-config.cjs.map +1 -1
- package/dist/vite/create-vite-config.js.map +1 -1
- package/dist/vite/narrow-tokens.cjs.map +1 -1
- package/dist/vite/narrow-tokens.js.map +1 -1
- package/dist/vite/tempest-csp.cjs +1 -1
- package/dist/vite/tempest-csp.cjs.map +1 -1
- package/dist/vite/tempest-csp.js +2 -10
- package/dist/vite/tempest-csp.js.map +1 -1
- package/dist/vite/tempest-icons.cjs.map +1 -1
- package/dist/vite/tempest-icons.js.map +1 -1
- package/dist/vite/tempest-pwa-dev-sw.cjs +1 -1
- package/dist/vite/tempest-pwa-dev-sw.cjs.map +1 -1
- package/dist/vite/tempest-pwa-dev-sw.js +9 -16
- package/dist/vite/tempest-pwa-dev-sw.js.map +1 -1
- package/dist/vite/tempest-pwa-icons.cjs.map +1 -1
- package/dist/vite/tempest-pwa-icons.js.map +1 -1
- package/dist/vite/tempest-pwa-manifest.cjs.map +1 -1
- package/dist/vite/tempest-pwa-manifest.js.map +1 -1
- package/dist/vite/tempest-styles.cjs.map +1 -1
- package/dist/vite/tempest-styles.js.map +1 -1
- package/dist/vite/tempest-vitest.cjs.map +1 -1
- package/dist/vite/tempest-vitest.js.map +1 -1
- package/dist/webrtc/link-stats.cjs.map +1 -1
- package/dist/webrtc/link-stats.js.map +1 -1
- package/dist/webrtc/mesh-quality.cjs.map +1 -1
- package/dist/webrtc/mesh-quality.js.map +1 -1
- package/dist/webrtc/opus-sdp.cjs.map +1 -1
- package/dist/webrtc/opus-sdp.js.map +1 -1
- package/dist/webrtc/peer-link.cjs +1 -1
- package/dist/webrtc/peer-link.cjs.map +1 -1
- package/dist/webrtc/peer-link.js +2 -5
- package/dist/webrtc/peer-link.js.map +1 -1
- package/dist/webrtc/peer-mesh.cjs +1 -1
- package/dist/webrtc/peer-mesh.cjs.map +1 -1
- package/dist/webrtc/peer-mesh.js +8 -24
- package/dist/webrtc/peer-mesh.js.map +1 -1
- package/dist/webrtc/sender-bitrate.cjs.map +1 -1
- package/dist/webrtc/sender-bitrate.js.map +1 -1
- package/dist/webrtc/use-link-stats.cjs.map +1 -1
- package/dist/webrtc/use-link-stats.js.map +1 -1
- package/dist/ws/create-web-socket.cjs +1 -1
- package/dist/ws/create-web-socket.cjs.map +1 -1
- package/dist/ws/create-web-socket.js +4 -22
- package/dist/ws/create-web-socket.js.map +1 -1
- package/dist/ws/resilience.cjs.map +1 -1
- package/dist/ws/resilience.js.map +1 -1
- package/dist/ws/use-web-socket.cjs.map +1 -1
- package/dist/ws/use-web-socket.js.map +1 -1
- package/package.json +9 -6
- package/template/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register-service-worker.cjs","names":[],"sources":["../../src/sw/register-service-worker.ts"],"sourcesContent":["export interface RegisterServiceWorkerOptions {\n /** Public URL of the compiled service worker file (e.g. `/sw.js`). */\n url: string;\n /** SW scope (default: SW directory). */\n scope?: string;\n /** Called once the registration is active. */\n onReady?: (registration: ServiceWorkerRegistration) => void;\n /**\n * Called when a new worker has finished installing while another worker\n * still controls the page. The host app typically prompts the user to\n * reload and then calls {@link skipWaiting} on the returned worker.\n *\n * Fires for a worker that was already `waiting` when `register()` resolved\n * — the state a user returning after a deploy actually finds — as well as\n * for one that installs during this session, and at most once per worker.\n */\n onUpdate?: (waiting: ServiceWorker, registration: ServiceWorkerRegistration) => void;\n /** Called on registration failure. */\n onError?: (error: unknown) => void;\n /**\n * When `true`, poll the server for a fresh service worker on an interval\n * (see {@link RegisterServiceWorkerOptions.updateIntervalMs}) and, unless\n * {@link RegisterServiceWorkerOptions.reloadOnActivate} is disabled, reload\n * the page as soon as a new worker takes control. Mirrors the auto-update\n * behaviour of `vite-plugin-pwa` without depending on it. Default `false`.\n */\n autoUpdate?: boolean;\n /**\n * How often, in ms, to call `registration.update()` while `autoUpdate` is\n * on. Browsers already re-check roughly every 24h; an hourly poll keeps\n * long-lived sessions current without flooding the network. Default\n * `3600000` (1 hour).\n */\n updateIntervalMs?: number;\n /**\n * When `autoUpdate` is on, reload the page once a new worker takes control\n * (`controllerchange`), guarded against reload loops. Set to `false` to\n * keep polling but leave the reload to the host app. Default `true`.\n */\n reloadOnActivate?: boolean;\n}\n\nconst DEFAULT_UPDATE_INTERVAL_MS = 60 * 60 * 1000;\n\n/**\n * Workers already handed to `onUpdate`, so no worker is announced twice.\n *\n * Two paths reach the same waiting worker and both are needed: `updatefound`\n * catches the worker that installs while the tab is open, and the `waiting`\n * read at registration catches the one that installed on an earlier visit. In\n * the session where a deploy lands *and* the tab stays open, both fire for the\n * same worker — without this the app prompts twice.\n *\n * Keyed by worker identity rather than by registration, so a second deploy in\n * the same session still announces: that is a different `ServiceWorker` object.\n * A `WeakSet` because the entry should die with the worker it names.\n */\nconst announcedWorkers = new WeakSet<ServiceWorker>();\n\n/**\n * Hand a waiting worker to `onUpdate`, at most once per worker.\n *\n * @param worker - The worker that finished installing.\n * @param registration - The registration it belongs to.\n * @param options - The caller's options, whose `onUpdate` is invoked.\n */\nfunction announceUpdate(\n worker: ServiceWorker,\n registration: ServiceWorkerRegistration,\n options: RegisterServiceWorkerOptions,\n): void {\n if (announcedWorkers.has(worker)) return;\n announcedWorkers.add(worker);\n options.onUpdate?.(worker, registration);\n}\n\nlet controllerReloadWired = false;\n\nfunction wireControllerReload(): void {\n if (controllerReloadWired) return;\n controllerReloadWired = true;\n let refreshing = false;\n navigator.serviceWorker.addEventListener(\"controllerchange\", () => {\n if (refreshing) return;\n refreshing = true;\n window.location.reload();\n });\n}\n\n/**\n * Register a service worker with consistent update-detection wiring.\n *\n * Skips silently when the runtime has no `serviceWorker` support. The host\n * app keeps full control over the SW file — this helper only handles the\n * boilerplate around `register()` and update detection.\n *\n * Two things can mean \"an update is ready\", and only one of them is an event.\n * `updatefound` covers the worker that installs while this tab is open. The\n * commoner case has no event at all: the user visited after a deploy, the new\n * worker installed and went to `waiting`, they closed the tab, and they are back\n * now. `install` already happened, so nothing fires — which is why `waiting` is\n * read directly once the registration resolves. Both routes go through the same\n * dedupe, so a worker is announced once even when both apply.\n *\n * Neither route fires without `navigator.serviceWorker.controller`: no\n * controller means this is the first install, which is `onReady` territory, not\n * an update the user should be prompted about.\n *\n * With `autoUpdate` enabled it additionally polls `registration.update()` on\n * an interval and (by default) reloads the page when a freshly activated worker\n * takes control — a framework-agnostic equivalent of `vite-plugin-pwa`'s\n * auto-update client, implemented directly on `navigator.serviceWorker`.\n *\n * @returns The registration when it succeeds, or `null` when unsupported.\n */\nexport async function registerServiceWorker(\n options: RegisterServiceWorkerOptions,\n): Promise<ServiceWorkerRegistration | null> {\n if (typeof navigator === \"undefined\" || !(\"serviceWorker\" in navigator)) {\n return null;\n }\n\n try {\n const registration = await navigator.serviceWorker.register(options.url, {\n scope: options.scope,\n });\n\n if (registration.active) options.onReady?.(registration);\n\n if (registration.waiting && navigator.serviceWorker.controller) {\n announceUpdate(registration.waiting, registration, options);\n }\n\n registration.addEventListener(\"updatefound\", () => {\n const installing = registration.installing;\n if (!installing) return;\n installing.addEventListener(\"statechange\", () => {\n if (installing.state === \"installed\" && navigator.serviceWorker.controller) {\n announceUpdate(installing, registration, options);\n }\n });\n });\n\n if (options.autoUpdate) {\n if (options.reloadOnActivate !== false) wireControllerReload();\n const intervalMs = options.updateIntervalMs ?? DEFAULT_UPDATE_INTERVAL_MS;\n window.setInterval(() => {\n void registration.update();\n }, intervalMs);\n }\n\n return registration;\n } catch (error) {\n options.onError?.(error);\n return null;\n }\n}\n\n/**\n * Tell a waiting worker to activate immediately. Pair with `onUpdate` to roll\n * out updates after the user confirms a reload prompt.\n */\nexport function skipWaiting(worker: ServiceWorker): void {\n worker.postMessage({ type: \"SKIP_WAITING\" });\n}\n\n/**\n * Unregister all registered service workers for this origin.\n *\n * @returns Number of workers that were unregistered.\n */\nexport async function unregisterAllServiceWorkers(): Promise<number> {\n if (typeof navigator === \"undefined\" || !(\"serviceWorker\" in navigator)) return 0;\n const registrations = await navigator.serviceWorker.getRegistrations();\n let count = 0;\n for (const registration of registrations) {\n const result = await registration.unregister();\n if (result) count += 1;\n }\n return count;\n}\n"],"mappings":"AA0CA,
|
|
1
|
+
{"version":3,"file":"register-service-worker.cjs","names":["announcedWorkers","announceUpdate","worker","options","registration","controllerReloadWired","wireControllerReload","refreshing","registerServiceWorker","installing","intervalMs","error","skipWaiting","unregisterAllServiceWorkers","registrations","count"],"sources":["../../src/sw/register-service-worker.ts"],"sourcesContent":["export interface RegisterServiceWorkerOptions {\n /** Public URL of the compiled service worker file (e.g. `/sw.js`). */\n url: string;\n /** SW scope (default: SW directory). */\n scope?: string;\n /** Called once the registration is active. */\n onReady?: (registration: ServiceWorkerRegistration) => void;\n /**\n * Called when a new worker has finished installing while another worker\n * still controls the page. The host app typically prompts the user to\n * reload and then calls {@link skipWaiting} on the returned worker.\n *\n * Fires for a worker that was already `waiting` when `register()` resolved\n * — the state a user returning after a deploy actually finds — as well as\n * for one that installs during this session, and at most once per worker.\n */\n onUpdate?: (waiting: ServiceWorker, registration: ServiceWorkerRegistration) => void;\n /** Called on registration failure. */\n onError?: (error: unknown) => void;\n /**\n * When `true`, poll the server for a fresh service worker on an interval\n * (see {@link RegisterServiceWorkerOptions.updateIntervalMs}) and, unless\n * {@link RegisterServiceWorkerOptions.reloadOnActivate} is disabled, reload\n * the page as soon as a new worker takes control. Mirrors the auto-update\n * behaviour of `vite-plugin-pwa` without depending on it. Default `false`.\n */\n autoUpdate?: boolean;\n /**\n * How often, in ms, to call `registration.update()` while `autoUpdate` is\n * on. Browsers already re-check roughly every 24h; an hourly poll keeps\n * long-lived sessions current without flooding the network. Default\n * `3600000` (1 hour).\n */\n updateIntervalMs?: number;\n /**\n * When `autoUpdate` is on, reload the page once a new worker takes control\n * (`controllerchange`), guarded against reload loops. Set to `false` to\n * keep polling but leave the reload to the host app. Default `true`.\n */\n reloadOnActivate?: boolean;\n}\n\nconst DEFAULT_UPDATE_INTERVAL_MS = 60 * 60 * 1000;\n\n/**\n * Workers already handed to `onUpdate`, so no worker is announced twice.\n *\n * Two paths reach the same waiting worker and both are needed: `updatefound`\n * catches the worker that installs while the tab is open, and the `waiting`\n * read at registration catches the one that installed on an earlier visit. In\n * the session where a deploy lands *and* the tab stays open, both fire for the\n * same worker — without this the app prompts twice.\n *\n * Keyed by worker identity rather than by registration, so a second deploy in\n * the same session still announces: that is a different `ServiceWorker` object.\n * A `WeakSet` because the entry should die with the worker it names.\n */\nconst announcedWorkers = new WeakSet<ServiceWorker>();\n\n/**\n * Hand a waiting worker to `onUpdate`, at most once per worker.\n *\n * @param worker - The worker that finished installing.\n * @param registration - The registration it belongs to.\n * @param options - The caller's options, whose `onUpdate` is invoked.\n */\nfunction announceUpdate(\n worker: ServiceWorker,\n registration: ServiceWorkerRegistration,\n options: RegisterServiceWorkerOptions,\n): void {\n if (announcedWorkers.has(worker)) return;\n announcedWorkers.add(worker);\n options.onUpdate?.(worker, registration);\n}\n\nlet controllerReloadWired = false;\n\nfunction wireControllerReload(): void {\n if (controllerReloadWired) return;\n controllerReloadWired = true;\n let refreshing = false;\n navigator.serviceWorker.addEventListener(\"controllerchange\", () => {\n if (refreshing) return;\n refreshing = true;\n window.location.reload();\n });\n}\n\n/**\n * Register a service worker with consistent update-detection wiring.\n *\n * Skips silently when the runtime has no `serviceWorker` support. The host\n * app keeps full control over the SW file — this helper only handles the\n * boilerplate around `register()` and update detection.\n *\n * Two things can mean \"an update is ready\", and only one of them is an event.\n * `updatefound` covers the worker that installs while this tab is open. The\n * commoner case has no event at all: the user visited after a deploy, the new\n * worker installed and went to `waiting`, they closed the tab, and they are back\n * now. `install` already happened, so nothing fires — which is why `waiting` is\n * read directly once the registration resolves. Both routes go through the same\n * dedupe, so a worker is announced once even when both apply.\n *\n * Neither route fires without `navigator.serviceWorker.controller`: no\n * controller means this is the first install, which is `onReady` territory, not\n * an update the user should be prompted about.\n *\n * With `autoUpdate` enabled it additionally polls `registration.update()` on\n * an interval and (by default) reloads the page when a freshly activated worker\n * takes control — a framework-agnostic equivalent of `vite-plugin-pwa`'s\n * auto-update client, implemented directly on `navigator.serviceWorker`.\n *\n * @returns The registration when it succeeds, or `null` when unsupported.\n */\nexport async function registerServiceWorker(\n options: RegisterServiceWorkerOptions,\n): Promise<ServiceWorkerRegistration | null> {\n if (typeof navigator === \"undefined\" || !(\"serviceWorker\" in navigator)) {\n return null;\n }\n\n try {\n const registration = await navigator.serviceWorker.register(options.url, {\n scope: options.scope,\n });\n\n if (registration.active) options.onReady?.(registration);\n\n if (registration.waiting && navigator.serviceWorker.controller) {\n announceUpdate(registration.waiting, registration, options);\n }\n\n registration.addEventListener(\"updatefound\", () => {\n const installing = registration.installing;\n if (!installing) return;\n installing.addEventListener(\"statechange\", () => {\n if (installing.state === \"installed\" && navigator.serviceWorker.controller) {\n announceUpdate(installing, registration, options);\n }\n });\n });\n\n if (options.autoUpdate) {\n if (options.reloadOnActivate !== false) wireControllerReload();\n const intervalMs = options.updateIntervalMs ?? DEFAULT_UPDATE_INTERVAL_MS;\n window.setInterval(() => {\n void registration.update();\n }, intervalMs);\n }\n\n return registration;\n } catch (error) {\n options.onError?.(error);\n return null;\n }\n}\n\n/**\n * Tell a waiting worker to activate immediately. Pair with `onUpdate` to roll\n * out updates after the user confirms a reload prompt.\n */\nexport function skipWaiting(worker: ServiceWorker): void {\n worker.postMessage({ type: \"SKIP_WAITING\" });\n}\n\n/**\n * Unregister all registered service workers for this origin.\n *\n * @returns Number of workers that were unregistered.\n */\nexport async function unregisterAllServiceWorkers(): Promise<number> {\n if (typeof navigator === \"undefined\" || !(\"serviceWorker\" in navigator)) return 0;\n const registrations = await navigator.serviceWorker.getRegistrations();\n let count = 0;\n for (const registration of registrations) {\n const result = await registration.unregister();\n if (result) count += 1;\n }\n return count;\n}\n"],"mappings":"AA0CA,IAeMA,EAAmB,IAAI,QAS7B,SAASC,EACL,EACA,EACA,EACI,CACAD,EAAiB,IAAIE,CAAM,IAC/BF,EAAiB,IAAIE,CAAM,EAC3BC,EAAQ,WAAWD,EAAQE,CAAY,EAC3C,CAEA,IAAIC,EAAwB,GAE5B,SAASC,GAA6B,CAClC,GAAID,EAAuB,OAC3B,EAAwB,GACxB,IAAIE,EAAa,GACjB,UAAU,cAAc,iBAAiB,uBAA0B,CAC3DA,IACJ,EAAa,GACb,OAAO,SAAS,OAAO,EAC3B,CAAC,CACL,CA4BA,eAAsBC,EAClB,EACyC,CACzC,GAAI,OAAO,UAAc,KAAe,EAAE,kBAAmB,WACzD,OAAO,KAGX,GAAI,CACA,IAAMJ,EAAe,MAAM,UAAU,cAAc,SAASD,EAAQ,IAAK,CACrE,MAAOA,EAAQ,KACnB,CAAC,EAkBD,GAhBIC,EAAa,QAAQD,EAAQ,UAAUC,CAAY,EAEnDA,EAAa,SAAW,UAAU,cAAc,YAChDH,EAAeG,EAAa,QAASA,EAAcD,CAAO,EAG9DC,EAAa,iBAAiB,kBAAqB,CAC/C,IAAMK,EAAaL,EAAa,WAC3BK,GACLA,EAAW,iBAAiB,kBAAqB,CACzCA,EAAW,QAAU,aAAe,UAAU,cAAc,YAC5DR,EAAeQ,EAAYL,EAAcD,CAAO,CAExD,CAAC,CACL,CAAC,EAEGA,EAAQ,WAAY,CAChBA,EAAQ,mBAAqB,IAAOG,EAAqB,EAC7D,IAAMI,EAAaP,EAAQ,kBAAoB,KAC/C,OAAO,gBAAkB,CACrBC,EAAkB,OAAO,CAC7B,EAAGM,CAAU,CACjB,CAEA,OAAON,CACX,OAASO,EAAO,CAEZ,OADAR,EAAQ,UAAUQ,CAAK,EAChB,IACX,CACJ,CAMA,SAAgBC,EAAY,EAA6B,CACrDV,EAAO,YAAY,CAAE,KAAM,cAAe,CAAC,CAC/C,CAOA,eAAsBW,GAA+C,CACjE,GAAI,OAAO,UAAc,KAAe,EAAE,kBAAmB,WAAY,MAAO,GAChF,IAAMC,EAAgB,MAAM,UAAU,cAAc,iBAAiB,EACjEC,EAAQ,EACZ,IAAK,IAAMX,KAAgBU,EAEnB,MADiBV,EAAa,WAAW,IACjC,GAAS,GAEzB,OAAOW,CACX,C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register-service-worker.js","names":[],"sources":["../../src/sw/register-service-worker.ts"],"sourcesContent":["export interface RegisterServiceWorkerOptions {\n /** Public URL of the compiled service worker file (e.g. `/sw.js`). */\n url: string;\n /** SW scope (default: SW directory). */\n scope?: string;\n /** Called once the registration is active. */\n onReady?: (registration: ServiceWorkerRegistration) => void;\n /**\n * Called when a new worker has finished installing while another worker\n * still controls the page. The host app typically prompts the user to\n * reload and then calls {@link skipWaiting} on the returned worker.\n *\n * Fires for a worker that was already `waiting` when `register()` resolved\n * — the state a user returning after a deploy actually finds — as well as\n * for one that installs during this session, and at most once per worker.\n */\n onUpdate?: (waiting: ServiceWorker, registration: ServiceWorkerRegistration) => void;\n /** Called on registration failure. */\n onError?: (error: unknown) => void;\n /**\n * When `true`, poll the server for a fresh service worker on an interval\n * (see {@link RegisterServiceWorkerOptions.updateIntervalMs}) and, unless\n * {@link RegisterServiceWorkerOptions.reloadOnActivate} is disabled, reload\n * the page as soon as a new worker takes control. Mirrors the auto-update\n * behaviour of `vite-plugin-pwa` without depending on it. Default `false`.\n */\n autoUpdate?: boolean;\n /**\n * How often, in ms, to call `registration.update()` while `autoUpdate` is\n * on. Browsers already re-check roughly every 24h; an hourly poll keeps\n * long-lived sessions current without flooding the network. Default\n * `3600000` (1 hour).\n */\n updateIntervalMs?: number;\n /**\n * When `autoUpdate` is on, reload the page once a new worker takes control\n * (`controllerchange`), guarded against reload loops. Set to `false` to\n * keep polling but leave the reload to the host app. Default `true`.\n */\n reloadOnActivate?: boolean;\n}\n\nconst DEFAULT_UPDATE_INTERVAL_MS = 60 * 60 * 1000;\n\n/**\n * Workers already handed to `onUpdate`, so no worker is announced twice.\n *\n * Two paths reach the same waiting worker and both are needed: `updatefound`\n * catches the worker that installs while the tab is open, and the `waiting`\n * read at registration catches the one that installed on an earlier visit. In\n * the session where a deploy lands *and* the tab stays open, both fire for the\n * same worker — without this the app prompts twice.\n *\n * Keyed by worker identity rather than by registration, so a second deploy in\n * the same session still announces: that is a different `ServiceWorker` object.\n * A `WeakSet` because the entry should die with the worker it names.\n */\nconst announcedWorkers = new WeakSet<ServiceWorker>();\n\n/**\n * Hand a waiting worker to `onUpdate`, at most once per worker.\n *\n * @param worker - The worker that finished installing.\n * @param registration - The registration it belongs to.\n * @param options - The caller's options, whose `onUpdate` is invoked.\n */\nfunction announceUpdate(\n worker: ServiceWorker,\n registration: ServiceWorkerRegistration,\n options: RegisterServiceWorkerOptions,\n): void {\n if (announcedWorkers.has(worker)) return;\n announcedWorkers.add(worker);\n options.onUpdate?.(worker, registration);\n}\n\nlet controllerReloadWired = false;\n\nfunction wireControllerReload(): void {\n if (controllerReloadWired) return;\n controllerReloadWired = true;\n let refreshing = false;\n navigator.serviceWorker.addEventListener(\"controllerchange\", () => {\n if (refreshing) return;\n refreshing = true;\n window.location.reload();\n });\n}\n\n/**\n * Register a service worker with consistent update-detection wiring.\n *\n * Skips silently when the runtime has no `serviceWorker` support. The host\n * app keeps full control over the SW file — this helper only handles the\n * boilerplate around `register()` and update detection.\n *\n * Two things can mean \"an update is ready\", and only one of them is an event.\n * `updatefound` covers the worker that installs while this tab is open. The\n * commoner case has no event at all: the user visited after a deploy, the new\n * worker installed and went to `waiting`, they closed the tab, and they are back\n * now. `install` already happened, so nothing fires — which is why `waiting` is\n * read directly once the registration resolves. Both routes go through the same\n * dedupe, so a worker is announced once even when both apply.\n *\n * Neither route fires without `navigator.serviceWorker.controller`: no\n * controller means this is the first install, which is `onReady` territory, not\n * an update the user should be prompted about.\n *\n * With `autoUpdate` enabled it additionally polls `registration.update()` on\n * an interval and (by default) reloads the page when a freshly activated worker\n * takes control — a framework-agnostic equivalent of `vite-plugin-pwa`'s\n * auto-update client, implemented directly on `navigator.serviceWorker`.\n *\n * @returns The registration when it succeeds, or `null` when unsupported.\n */\nexport async function registerServiceWorker(\n options: RegisterServiceWorkerOptions,\n): Promise<ServiceWorkerRegistration | null> {\n if (typeof navigator === \"undefined\" || !(\"serviceWorker\" in navigator)) {\n return null;\n }\n\n try {\n const registration = await navigator.serviceWorker.register(options.url, {\n scope: options.scope,\n });\n\n if (registration.active) options.onReady?.(registration);\n\n if (registration.waiting && navigator.serviceWorker.controller) {\n announceUpdate(registration.waiting, registration, options);\n }\n\n registration.addEventListener(\"updatefound\", () => {\n const installing = registration.installing;\n if (!installing) return;\n installing.addEventListener(\"statechange\", () => {\n if (installing.state === \"installed\" && navigator.serviceWorker.controller) {\n announceUpdate(installing, registration, options);\n }\n });\n });\n\n if (options.autoUpdate) {\n if (options.reloadOnActivate !== false) wireControllerReload();\n const intervalMs = options.updateIntervalMs ?? DEFAULT_UPDATE_INTERVAL_MS;\n window.setInterval(() => {\n void registration.update();\n }, intervalMs);\n }\n\n return registration;\n } catch (error) {\n options.onError?.(error);\n return null;\n }\n}\n\n/**\n * Tell a waiting worker to activate immediately. Pair with `onUpdate` to roll\n * out updates after the user confirms a reload prompt.\n */\nexport function skipWaiting(worker: ServiceWorker): void {\n worker.postMessage({ type: \"SKIP_WAITING\" });\n}\n\n/**\n * Unregister all registered service workers for this origin.\n *\n * @returns Number of workers that were unregistered.\n */\nexport async function unregisterAllServiceWorkers(): Promise<number> {\n if (typeof navigator === \"undefined\" || !(\"serviceWorker\" in navigator)) return 0;\n const registrations = await navigator.serviceWorker.getRegistrations();\n let count = 0;\n for (const registration of registrations) {\n const result = await registration.unregister();\n if (result) count += 1;\n }\n return count;\n}\n"],"mappings":";AA0CA,
|
|
1
|
+
{"version":3,"file":"register-service-worker.js","names":["announcedWorkers","announceUpdate","worker","options","registration","controllerReloadWired","wireControllerReload","refreshing","registerServiceWorker","installing","intervalMs","error","skipWaiting","unregisterAllServiceWorkers","registrations","count"],"sources":["../../src/sw/register-service-worker.ts"],"sourcesContent":["export interface RegisterServiceWorkerOptions {\n /** Public URL of the compiled service worker file (e.g. `/sw.js`). */\n url: string;\n /** SW scope (default: SW directory). */\n scope?: string;\n /** Called once the registration is active. */\n onReady?: (registration: ServiceWorkerRegistration) => void;\n /**\n * Called when a new worker has finished installing while another worker\n * still controls the page. The host app typically prompts the user to\n * reload and then calls {@link skipWaiting} on the returned worker.\n *\n * Fires for a worker that was already `waiting` when `register()` resolved\n * — the state a user returning after a deploy actually finds — as well as\n * for one that installs during this session, and at most once per worker.\n */\n onUpdate?: (waiting: ServiceWorker, registration: ServiceWorkerRegistration) => void;\n /** Called on registration failure. */\n onError?: (error: unknown) => void;\n /**\n * When `true`, poll the server for a fresh service worker on an interval\n * (see {@link RegisterServiceWorkerOptions.updateIntervalMs}) and, unless\n * {@link RegisterServiceWorkerOptions.reloadOnActivate} is disabled, reload\n * the page as soon as a new worker takes control. Mirrors the auto-update\n * behaviour of `vite-plugin-pwa` without depending on it. Default `false`.\n */\n autoUpdate?: boolean;\n /**\n * How often, in ms, to call `registration.update()` while `autoUpdate` is\n * on. Browsers already re-check roughly every 24h; an hourly poll keeps\n * long-lived sessions current without flooding the network. Default\n * `3600000` (1 hour).\n */\n updateIntervalMs?: number;\n /**\n * When `autoUpdate` is on, reload the page once a new worker takes control\n * (`controllerchange`), guarded against reload loops. Set to `false` to\n * keep polling but leave the reload to the host app. Default `true`.\n */\n reloadOnActivate?: boolean;\n}\n\nconst DEFAULT_UPDATE_INTERVAL_MS = 60 * 60 * 1000;\n\n/**\n * Workers already handed to `onUpdate`, so no worker is announced twice.\n *\n * Two paths reach the same waiting worker and both are needed: `updatefound`\n * catches the worker that installs while the tab is open, and the `waiting`\n * read at registration catches the one that installed on an earlier visit. In\n * the session where a deploy lands *and* the tab stays open, both fire for the\n * same worker — without this the app prompts twice.\n *\n * Keyed by worker identity rather than by registration, so a second deploy in\n * the same session still announces: that is a different `ServiceWorker` object.\n * A `WeakSet` because the entry should die with the worker it names.\n */\nconst announcedWorkers = new WeakSet<ServiceWorker>();\n\n/**\n * Hand a waiting worker to `onUpdate`, at most once per worker.\n *\n * @param worker - The worker that finished installing.\n * @param registration - The registration it belongs to.\n * @param options - The caller's options, whose `onUpdate` is invoked.\n */\nfunction announceUpdate(\n worker: ServiceWorker,\n registration: ServiceWorkerRegistration,\n options: RegisterServiceWorkerOptions,\n): void {\n if (announcedWorkers.has(worker)) return;\n announcedWorkers.add(worker);\n options.onUpdate?.(worker, registration);\n}\n\nlet controllerReloadWired = false;\n\nfunction wireControllerReload(): void {\n if (controllerReloadWired) return;\n controllerReloadWired = true;\n let refreshing = false;\n navigator.serviceWorker.addEventListener(\"controllerchange\", () => {\n if (refreshing) return;\n refreshing = true;\n window.location.reload();\n });\n}\n\n/**\n * Register a service worker with consistent update-detection wiring.\n *\n * Skips silently when the runtime has no `serviceWorker` support. The host\n * app keeps full control over the SW file — this helper only handles the\n * boilerplate around `register()` and update detection.\n *\n * Two things can mean \"an update is ready\", and only one of them is an event.\n * `updatefound` covers the worker that installs while this tab is open. The\n * commoner case has no event at all: the user visited after a deploy, the new\n * worker installed and went to `waiting`, they closed the tab, and they are back\n * now. `install` already happened, so nothing fires — which is why `waiting` is\n * read directly once the registration resolves. Both routes go through the same\n * dedupe, so a worker is announced once even when both apply.\n *\n * Neither route fires without `navigator.serviceWorker.controller`: no\n * controller means this is the first install, which is `onReady` territory, not\n * an update the user should be prompted about.\n *\n * With `autoUpdate` enabled it additionally polls `registration.update()` on\n * an interval and (by default) reloads the page when a freshly activated worker\n * takes control — a framework-agnostic equivalent of `vite-plugin-pwa`'s\n * auto-update client, implemented directly on `navigator.serviceWorker`.\n *\n * @returns The registration when it succeeds, or `null` when unsupported.\n */\nexport async function registerServiceWorker(\n options: RegisterServiceWorkerOptions,\n): Promise<ServiceWorkerRegistration | null> {\n if (typeof navigator === \"undefined\" || !(\"serviceWorker\" in navigator)) {\n return null;\n }\n\n try {\n const registration = await navigator.serviceWorker.register(options.url, {\n scope: options.scope,\n });\n\n if (registration.active) options.onReady?.(registration);\n\n if (registration.waiting && navigator.serviceWorker.controller) {\n announceUpdate(registration.waiting, registration, options);\n }\n\n registration.addEventListener(\"updatefound\", () => {\n const installing = registration.installing;\n if (!installing) return;\n installing.addEventListener(\"statechange\", () => {\n if (installing.state === \"installed\" && navigator.serviceWorker.controller) {\n announceUpdate(installing, registration, options);\n }\n });\n });\n\n if (options.autoUpdate) {\n if (options.reloadOnActivate !== false) wireControllerReload();\n const intervalMs = options.updateIntervalMs ?? DEFAULT_UPDATE_INTERVAL_MS;\n window.setInterval(() => {\n void registration.update();\n }, intervalMs);\n }\n\n return registration;\n } catch (error) {\n options.onError?.(error);\n return null;\n }\n}\n\n/**\n * Tell a waiting worker to activate immediately. Pair with `onUpdate` to roll\n * out updates after the user confirms a reload prompt.\n */\nexport function skipWaiting(worker: ServiceWorker): void {\n worker.postMessage({ type: \"SKIP_WAITING\" });\n}\n\n/**\n * Unregister all registered service workers for this origin.\n *\n * @returns Number of workers that were unregistered.\n */\nexport async function unregisterAllServiceWorkers(): Promise<number> {\n if (typeof navigator === \"undefined\" || !(\"serviceWorker\" in navigator)) return 0;\n const registrations = await navigator.serviceWorker.getRegistrations();\n let count = 0;\n for (const registration of registrations) {\n const result = await registration.unregister();\n if (result) count += 1;\n }\n return count;\n}\n"],"mappings":";AA0CA,IAeMA,oBAAmB,IAAI,QAAuB;AASpD,SAASC,EACL,GACA,GACA,GACI;CACJ,AAAID,EAAiB,IAAIE,CAAM,MAC/BF,EAAiB,IAAIE,CAAM,GAC3BC,EAAQ,WAAWD,GAAQE,CAAY;AAC3C;AAEA,IAAIC,IAAwB;AAE5B,SAASC,IAA6B;CAClC,IAAID,GAAuB;CAC3B,IAAwB;CACxB,IAAIE,IAAa;CACjB,UAAU,cAAc,iBAAiB,0BAA0B;EAC/D,AAAIA,MACJ,IAAa,IACb,OAAO,SAAS,OAAO;CAC3B,CAAC;AACL;AA4BA,eAAsBC,EAClB,GACyC;CACzC,IAAI,OAAO,YAAc,OAAe,EAAE,mBAAmB,YACzD,OAAO;CAGX,IAAI;EACA,IAAMJ,IAAe,MAAM,UAAU,cAAc,SAASD,EAAQ,KAAK,EACrE,OAAOA,EAAQ,MACnB,CAAC;EAkBD,IAhBIC,EAAa,UAAQD,EAAQ,UAAUC,CAAY,GAEnDA,EAAa,WAAW,UAAU,cAAc,cAChDH,EAAeG,EAAa,SAASA,GAAcD,CAAO,GAG9DC,EAAa,iBAAiB,qBAAqB;GAC/C,IAAMK,IAAaL,EAAa;GAChC,AAAKK,KACLA,EAAW,iBAAiB,qBAAqB;IAC7C,AAAIA,EAAW,UAAU,eAAe,UAAU,cAAc,cAC5DR,EAAeQ,GAAYL,GAAcD,CAAO;GAExD,CAAC;EACL,CAAC,GAEGA,EAAQ,YAAY;GACpB,AAAIA,EAAQ,qBAAqB,MAAOG,EAAqB;GAC7D,IAAMI,IAAaP,EAAQ,oBAAoB;GAC/C,OAAO,kBAAkB;IACrB,EAAkB,OAAO;GAC7B,GAAGO,CAAU;EACjB;EAEA,OAAON;CACX,SAASO,GAAO;EAEZ,OADAR,EAAQ,UAAUQ,CAAK,GAChB;CACX;AACJ;AAMA,SAAgBC,EAAY,GAA6B;CACrD,EAAO,YAAY,EAAE,MAAM,eAAe,CAAC;AAC/C;AAOA,eAAsBC,IAA+C;CACjE,IAAI,OAAO,YAAc,OAAe,EAAE,mBAAmB,YAAY,OAAO;CAChF,IAAMC,IAAgB,MAAM,UAAU,cAAc,iBAAiB,GACjEC,IAAQ;CACZ,KAAK,IAAMX,KAAgBU,GAEvB,AAAI,MADiBV,EAAa,WAAW,MACjC,KAAS;CAEzB,OAAOW;AACX"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-data.cjs","names":[],"sources":["../../src/sw/session-data.ts"],"sourcesContent":["import { clearBackgroundSyncQueue } from \"./background-sync\";\nimport { clearCaches } from \"./cache-inspect\";\nimport type { CacheFilter } from \"./cache-inspect\";\n\n/** Options for {@link clearSessionData}. */\nexport interface ClearSessionDataOptions {\n /**\n * Which Cache Storage buckets hold session data. Default: every bucket except\n * the app-shell precache (`tempest-precache-*`), so the app still launches\n * offline after logout while no runtime entry — whatever its `cacheName` —\n * survives into the next session.\n */\n caches?: CacheFilter;\n /** The background-sync `queueName` to clear. Default `tempest-bg-sync`. */\n queueName?: string;\n}\n\n/** What {@link clearSessionData} removed. */\nexport interface ClearSessionDataResult {\n /** Names of the Cache Storage buckets deleted. */\n caches: string[];\n /** Whether the background-sync queue was emptied. */\n queueCleared: boolean;\n}\n\n/** Default cache filter: everything but the versioned app-shell precache. */\nfunction isSessionCache(name: string): boolean {\n return !name.startsWith(\"tempest-precache-\");\n}\n\n/**\n * Remove everything the service-worker helpers keep on behalf of the signed-in\n * user: the runtime caches filled by `installRuntimeCache` and the queue of\n * mutations waiting in `installBackgroundSync`. Call it on logout, from the page.\n *\n * Both stores outlive the session and are shared by every account that signs in\n * on the browser. Measured in Chromium 153 (11/10/2026), before this existed:\n * the documented `clearCaches(\"tempest-\")` deleted nothing because the recipe's\n * runtime cache was named `api`, the next account read the previous account's\n * `GET /api/me` offline, and a mutation queued by the previous account was\n * replayed with its stored bearer after logout. A prefix filter cannot know the\n * names a recipe chose, so the default here inverts it: every bucket goes except\n * the precache, which holds only the build's static assets.\n *\n * Cache Storage and IndexedDB are origin storage, readable from the window, so\n * this needs no message to the worker.\n *\n * @param options - Narrow the caches to delete, or name a custom queue.\n * @returns The caches deleted and whether the queue was cleared.\n *\n * @example\n * import { clearSessionData } from \"tempest-react-sdk/sw\";\n *\n * async function logout() {\n * await clearSessionData();\n * }\n */\nexport async function clearSessionData(\n options: ClearSessionDataOptions = {},\n): Promise<ClearSessionDataResult> {\n const [caches, queueCleared] = await Promise.all([\n clearCaches(options.caches ?? isSessionCache),\n clearBackgroundSyncQueue(options.queueName),\n ]);\n return { caches, queueCleared };\n}\n"],"mappings":"0EA0BA,
|
|
1
|
+
{"version":3,"file":"session-data.cjs","names":["clearCaches","clearBackgroundSyncQueue","require_background_sync","require_cache_inspect","isSessionCache","name","clearSessionData","caches","queueCleared","options"],"sources":["../../src/sw/session-data.ts"],"sourcesContent":["import { clearBackgroundSyncQueue } from \"./background-sync\";\nimport { clearCaches } from \"./cache-inspect\";\nimport type { CacheFilter } from \"./cache-inspect\";\n\n/** Options for {@link clearSessionData}. */\nexport interface ClearSessionDataOptions {\n /**\n * Which Cache Storage buckets hold session data. Default: every bucket except\n * the app-shell precache (`tempest-precache-*`), so the app still launches\n * offline after logout while no runtime entry — whatever its `cacheName` —\n * survives into the next session.\n */\n caches?: CacheFilter;\n /** The background-sync `queueName` to clear. Default `tempest-bg-sync`. */\n queueName?: string;\n}\n\n/** What {@link clearSessionData} removed. */\nexport interface ClearSessionDataResult {\n /** Names of the Cache Storage buckets deleted. */\n caches: string[];\n /** Whether the background-sync queue was emptied. */\n queueCleared: boolean;\n}\n\n/** Default cache filter: everything but the versioned app-shell precache. */\nfunction isSessionCache(name: string): boolean {\n return !name.startsWith(\"tempest-precache-\");\n}\n\n/**\n * Remove everything the service-worker helpers keep on behalf of the signed-in\n * user: the runtime caches filled by `installRuntimeCache` and the queue of\n * mutations waiting in `installBackgroundSync`. Call it on logout, from the page.\n *\n * Both stores outlive the session and are shared by every account that signs in\n * on the browser. Measured in Chromium 153 (11/10/2026), before this existed:\n * the documented `clearCaches(\"tempest-\")` deleted nothing because the recipe's\n * runtime cache was named `api`, the next account read the previous account's\n * `GET /api/me` offline, and a mutation queued by the previous account was\n * replayed with its stored bearer after logout. A prefix filter cannot know the\n * names a recipe chose, so the default here inverts it: every bucket goes except\n * the precache, which holds only the build's static assets.\n *\n * Cache Storage and IndexedDB are origin storage, readable from the window, so\n * this needs no message to the worker.\n *\n * @param options - Narrow the caches to delete, or name a custom queue.\n * @returns The caches deleted and whether the queue was cleared.\n *\n * @example\n * import { clearSessionData } from \"tempest-react-sdk/sw\";\n *\n * async function logout() {\n * await clearSessionData();\n * }\n */\nexport async function clearSessionData(\n options: ClearSessionDataOptions = {},\n): Promise<ClearSessionDataResult> {\n const [caches, queueCleared] = await Promise.all([\n clearCaches(options.caches ?? isSessionCache),\n clearBackgroundSyncQueue(options.queueName),\n ]);\n return { caches, queueCleared };\n}\n"],"mappings":"A,0EA0BA,SAASI,EAAe,EAAuB,CAC3C,MAAO,CAACC,EAAK,WAAW,mBAAmB,CAC/C,CA6BA,eAAsBC,EAClB,EAAmC,CAAC,EACL,CAC/B,GAAM,CAACC,EAAQC,GAAgB,MAAM,QAAQ,IAAI,CAC7CR,EAAAA,YAAYS,EAAQ,QAAUL,CAAc,EAC5CH,EAAAA,yBAAyBQ,EAAQ,SAAS,CAC9C,CAAC,EACD,MAAO,CAAE,SAAQ,cAAa,CAClC,C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-data.js","names":[],"sources":["../../src/sw/session-data.ts"],"sourcesContent":["import { clearBackgroundSyncQueue } from \"./background-sync\";\nimport { clearCaches } from \"./cache-inspect\";\nimport type { CacheFilter } from \"./cache-inspect\";\n\n/** Options for {@link clearSessionData}. */\nexport interface ClearSessionDataOptions {\n /**\n * Which Cache Storage buckets hold session data. Default: every bucket except\n * the app-shell precache (`tempest-precache-*`), so the app still launches\n * offline after logout while no runtime entry — whatever its `cacheName` —\n * survives into the next session.\n */\n caches?: CacheFilter;\n /** The background-sync `queueName` to clear. Default `tempest-bg-sync`. */\n queueName?: string;\n}\n\n/** What {@link clearSessionData} removed. */\nexport interface ClearSessionDataResult {\n /** Names of the Cache Storage buckets deleted. */\n caches: string[];\n /** Whether the background-sync queue was emptied. */\n queueCleared: boolean;\n}\n\n/** Default cache filter: everything but the versioned app-shell precache. */\nfunction isSessionCache(name: string): boolean {\n return !name.startsWith(\"tempest-precache-\");\n}\n\n/**\n * Remove everything the service-worker helpers keep on behalf of the signed-in\n * user: the runtime caches filled by `installRuntimeCache` and the queue of\n * mutations waiting in `installBackgroundSync`. Call it on logout, from the page.\n *\n * Both stores outlive the session and are shared by every account that signs in\n * on the browser. Measured in Chromium 153 (11/10/2026), before this existed:\n * the documented `clearCaches(\"tempest-\")` deleted nothing because the recipe's\n * runtime cache was named `api`, the next account read the previous account's\n * `GET /api/me` offline, and a mutation queued by the previous account was\n * replayed with its stored bearer after logout. A prefix filter cannot know the\n * names a recipe chose, so the default here inverts it: every bucket goes except\n * the precache, which holds only the build's static assets.\n *\n * Cache Storage and IndexedDB are origin storage, readable from the window, so\n * this needs no message to the worker.\n *\n * @param options - Narrow the caches to delete, or name a custom queue.\n * @returns The caches deleted and whether the queue was cleared.\n *\n * @example\n * import { clearSessionData } from \"tempest-react-sdk/sw\";\n *\n * async function logout() {\n * await clearSessionData();\n * }\n */\nexport async function clearSessionData(\n options: ClearSessionDataOptions = {},\n): Promise<ClearSessionDataResult> {\n const [caches, queueCleared] = await Promise.all([\n clearCaches(options.caches ?? isSessionCache),\n clearBackgroundSyncQueue(options.queueName),\n ]);\n return { caches, queueCleared };\n}\n"],"mappings":";;;AA0BA,
|
|
1
|
+
{"version":3,"file":"session-data.js","names":["isSessionCache","name","clearSessionData","caches","queueCleared","clearCaches","options","clearBackgroundSyncQueue"],"sources":["../../src/sw/session-data.ts"],"sourcesContent":["import { clearBackgroundSyncQueue } from \"./background-sync\";\nimport { clearCaches } from \"./cache-inspect\";\nimport type { CacheFilter } from \"./cache-inspect\";\n\n/** Options for {@link clearSessionData}. */\nexport interface ClearSessionDataOptions {\n /**\n * Which Cache Storage buckets hold session data. Default: every bucket except\n * the app-shell precache (`tempest-precache-*`), so the app still launches\n * offline after logout while no runtime entry — whatever its `cacheName` —\n * survives into the next session.\n */\n caches?: CacheFilter;\n /** The background-sync `queueName` to clear. Default `tempest-bg-sync`. */\n queueName?: string;\n}\n\n/** What {@link clearSessionData} removed. */\nexport interface ClearSessionDataResult {\n /** Names of the Cache Storage buckets deleted. */\n caches: string[];\n /** Whether the background-sync queue was emptied. */\n queueCleared: boolean;\n}\n\n/** Default cache filter: everything but the versioned app-shell precache. */\nfunction isSessionCache(name: string): boolean {\n return !name.startsWith(\"tempest-precache-\");\n}\n\n/**\n * Remove everything the service-worker helpers keep on behalf of the signed-in\n * user: the runtime caches filled by `installRuntimeCache` and the queue of\n * mutations waiting in `installBackgroundSync`. Call it on logout, from the page.\n *\n * Both stores outlive the session and are shared by every account that signs in\n * on the browser. Measured in Chromium 153 (11/10/2026), before this existed:\n * the documented `clearCaches(\"tempest-\")` deleted nothing because the recipe's\n * runtime cache was named `api`, the next account read the previous account's\n * `GET /api/me` offline, and a mutation queued by the previous account was\n * replayed with its stored bearer after logout. A prefix filter cannot know the\n * names a recipe chose, so the default here inverts it: every bucket goes except\n * the precache, which holds only the build's static assets.\n *\n * Cache Storage and IndexedDB are origin storage, readable from the window, so\n * this needs no message to the worker.\n *\n * @param options - Narrow the caches to delete, or name a custom queue.\n * @returns The caches deleted and whether the queue was cleared.\n *\n * @example\n * import { clearSessionData } from \"tempest-react-sdk/sw\";\n *\n * async function logout() {\n * await clearSessionData();\n * }\n */\nexport async function clearSessionData(\n options: ClearSessionDataOptions = {},\n): Promise<ClearSessionDataResult> {\n const [caches, queueCleared] = await Promise.all([\n clearCaches(options.caches ?? isSessionCache),\n clearBackgroundSyncQueue(options.queueName),\n ]);\n return { caches, queueCleared };\n}\n"],"mappings":";;;AA0BA,SAASA,EAAe,GAAuB;CAC3C,OAAO,CAACC,EAAK,WAAW,mBAAmB;AAC/C;AA6BA,eAAsBC,EAClB,IAAmC,CAAC,GACL;CAC/B,IAAM,CAACC,GAAQC,KAAgB,MAAM,QAAQ,IAAI,CAC7CC,EAAYC,EAAQ,UAAUN,CAAc,GAC5CO,EAAyBD,EAAQ,SAAS,CAC9C,CAAC;CACD,OAAO;EAAE;EAAQ;CAAa;AAClC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assets.cjs","names":[],"sources":["../../src/tabular/assets.ts"],"sourcesContent":["/**\n * The runtime's own assets, which are the other half of working offline.\n *\n * ONNX Runtime Web does **not** embed its WebAssembly binary, not even in\n * the `.bundle` builds. Measured in Chromium: the default entry fetches\n * `ort-wasm-simd-threaded.jsep.wasm` at session creation, and serving the\n * app without that file fails with `Aborted(both async and sync fetching of\n * the wasm failed)` — an error that says nothing about the missing file.\n *\n * So an offline app has to ship those binaries and precache them. This\n * module names them and points the runtime at a local directory.\n *\n * It does **not** import `onnxruntime-web`. An app on the compact route\n * (`CompactPredictor`) has no runtime at all, and a module that imported\n * one at load time would force every consumer of this subpath to install\n * the peer — which is exactly the cost that route exists to avoid. The\n * configured path is remembered here and applied by the ONNX predictor,\n * which imports the runtime only when it actually loads a model.\n */\n\n/**\n * The WebAssembly binaries ONNX Runtime Web may request.\n *\n * Which one is fetched depends on the browser's threading and SIMD support,\n * so an app that must work everywhere ships all of them. Chromium with the\n * default entry point fetched the `jsep` build.\n */\nexport const ORT_WASM_ASSETS: readonly string[] = [\n \"ort-wasm-simd-threaded.wasm\",\n \"ort-wasm-simd-threaded.mjs\",\n \"ort-wasm-simd-threaded.jsep.wasm\",\n \"ort-wasm-simd-threaded.jsep.mjs\",\n];\n\nlet configuredPath: string | undefined;\n\n/**\n * Point ONNX Runtime Web at locally served WebAssembly binaries.\n *\n * Call once, before creating any predictor.\n *\n * @example\n * ```ts\n * configureOrtAssets(\"/ort/\");\n * const predictor = await TabularPredictor.create(\"/models/classifier.onnx\");\n * ```\n *\n * @param basePath Directory the binaries are served from, with a trailing\n * slash. Copy them there at build time — for Vite, from\n * `node_modules/onnxruntime-web/dist/`.\n */\nexport function configureOrtAssets(basePath: string): void {\n configuredPath = basePath.endsWith(\"/\") ? basePath : `${basePath}/`;\n}\n\n/**\n * Where the runtime's binaries were said to live.\n *\n * Read by the ONNX predictor just before it creates a session, which is\n * the first moment the runtime exists to be configured.\n *\n * @returns The configured directory, or `undefined` when none was set.\n */\nexport function configuredOrtAssetPath(): string | undefined {\n return configuredPath;\n}\n\n/**\n * The URLs a service worker should precache for offline inference.\n *\n * The model file is not included: it is cached by\n * {@link fetchModelBytes} on first use, under its own bucket.\n *\n * @example\n * ```ts\n * installPrecache([...ortAssetUrls(\"/ort/\"), \"/index.html\"]);\n * ```\n *\n * @param basePath Directory the binaries are served from.\n * @returns Absolute-from-root URLs for every runtime asset.\n */\nexport function ortAssetUrls(basePath: string): string[] {\n const prefix = basePath.endsWith(\"/\") ? basePath : `${basePath}/`;\n return ORT_WASM_ASSETS.map((asset) => `${prefix}${asset}`);\n}\n"],"mappings":"AA2BA,
|
|
1
|
+
{"version":3,"file":"assets.cjs","names":["ORT_WASM_ASSETS","configuredPath","configureOrtAssets","basePath","configuredOrtAssetPath","ortAssetUrls","prefix","asset"],"sources":["../../src/tabular/assets.ts"],"sourcesContent":["/**\n * The runtime's own assets, which are the other half of working offline.\n *\n * ONNX Runtime Web does **not** embed its WebAssembly binary, not even in\n * the `.bundle` builds. Measured in Chromium: the default entry fetches\n * `ort-wasm-simd-threaded.jsep.wasm` at session creation, and serving the\n * app without that file fails with `Aborted(both async and sync fetching of\n * the wasm failed)` — an error that says nothing about the missing file.\n *\n * So an offline app has to ship those binaries and precache them. This\n * module names them and points the runtime at a local directory.\n *\n * It does **not** import `onnxruntime-web`. An app on the compact route\n * (`CompactPredictor`) has no runtime at all, and a module that imported\n * one at load time would force every consumer of this subpath to install\n * the peer — which is exactly the cost that route exists to avoid. The\n * configured path is remembered here and applied by the ONNX predictor,\n * which imports the runtime only when it actually loads a model.\n */\n\n/**\n * The WebAssembly binaries ONNX Runtime Web may request.\n *\n * Which one is fetched depends on the browser's threading and SIMD support,\n * so an app that must work everywhere ships all of them. Chromium with the\n * default entry point fetched the `jsep` build.\n */\nexport const ORT_WASM_ASSETS: readonly string[] = [\n \"ort-wasm-simd-threaded.wasm\",\n \"ort-wasm-simd-threaded.mjs\",\n \"ort-wasm-simd-threaded.jsep.wasm\",\n \"ort-wasm-simd-threaded.jsep.mjs\",\n];\n\nlet configuredPath: string | undefined;\n\n/**\n * Point ONNX Runtime Web at locally served WebAssembly binaries.\n *\n * Call once, before creating any predictor.\n *\n * @example\n * ```ts\n * configureOrtAssets(\"/ort/\");\n * const predictor = await TabularPredictor.create(\"/models/classifier.onnx\");\n * ```\n *\n * @param basePath Directory the binaries are served from, with a trailing\n * slash. Copy them there at build time — for Vite, from\n * `node_modules/onnxruntime-web/dist/`.\n */\nexport function configureOrtAssets(basePath: string): void {\n configuredPath = basePath.endsWith(\"/\") ? basePath : `${basePath}/`;\n}\n\n/**\n * Where the runtime's binaries were said to live.\n *\n * Read by the ONNX predictor just before it creates a session, which is\n * the first moment the runtime exists to be configured.\n *\n * @returns The configured directory, or `undefined` when none was set.\n */\nexport function configuredOrtAssetPath(): string | undefined {\n return configuredPath;\n}\n\n/**\n * The URLs a service worker should precache for offline inference.\n *\n * The model file is not included: it is cached by\n * {@link fetchModelBytes} on first use, under its own bucket.\n *\n * @example\n * ```ts\n * installPrecache([...ortAssetUrls(\"/ort/\"), \"/index.html\"]);\n * ```\n *\n * @param basePath Directory the binaries are served from.\n * @returns Absolute-from-root URLs for every runtime asset.\n */\nexport function ortAssetUrls(basePath: string): string[] {\n const prefix = basePath.endsWith(\"/\") ? basePath : `${basePath}/`;\n return ORT_WASM_ASSETS.map((asset) => `${prefix}${asset}`);\n}\n"],"mappings":"AA2BA,IAAaA,EAAqC,CAC9C,8BACA,6BACA,mCACA,iCACJ,EAEIC,EAiBJ,SAAgBC,EAAmB,EAAwB,CACvD,EAAiBC,EAAS,SAAS,GAAG,EAAIA,EAAW,GAAGA,EAAS,EACrE,CAUA,SAAgBC,GAA6C,CACzD,OAAOH,CACX,CAgBA,SAAgBI,EAAa,EAA4B,CACrD,IAAMC,EAASH,EAAS,SAAS,GAAG,EAAIA,EAAW,GAAGA,EAAS,GAC/D,OAAOH,EAAgB,IAAK,GAAU,GAAGM,IAASC,GAAO,CAC7D,C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assets.js","names":[],"sources":["../../src/tabular/assets.ts"],"sourcesContent":["/**\n * The runtime's own assets, which are the other half of working offline.\n *\n * ONNX Runtime Web does **not** embed its WebAssembly binary, not even in\n * the `.bundle` builds. Measured in Chromium: the default entry fetches\n * `ort-wasm-simd-threaded.jsep.wasm` at session creation, and serving the\n * app without that file fails with `Aborted(both async and sync fetching of\n * the wasm failed)` — an error that says nothing about the missing file.\n *\n * So an offline app has to ship those binaries and precache them. This\n * module names them and points the runtime at a local directory.\n *\n * It does **not** import `onnxruntime-web`. An app on the compact route\n * (`CompactPredictor`) has no runtime at all, and a module that imported\n * one at load time would force every consumer of this subpath to install\n * the peer — which is exactly the cost that route exists to avoid. The\n * configured path is remembered here and applied by the ONNX predictor,\n * which imports the runtime only when it actually loads a model.\n */\n\n/**\n * The WebAssembly binaries ONNX Runtime Web may request.\n *\n * Which one is fetched depends on the browser's threading and SIMD support,\n * so an app that must work everywhere ships all of them. Chromium with the\n * default entry point fetched the `jsep` build.\n */\nexport const ORT_WASM_ASSETS: readonly string[] = [\n \"ort-wasm-simd-threaded.wasm\",\n \"ort-wasm-simd-threaded.mjs\",\n \"ort-wasm-simd-threaded.jsep.wasm\",\n \"ort-wasm-simd-threaded.jsep.mjs\",\n];\n\nlet configuredPath: string | undefined;\n\n/**\n * Point ONNX Runtime Web at locally served WebAssembly binaries.\n *\n * Call once, before creating any predictor.\n *\n * @example\n * ```ts\n * configureOrtAssets(\"/ort/\");\n * const predictor = await TabularPredictor.create(\"/models/classifier.onnx\");\n * ```\n *\n * @param basePath Directory the binaries are served from, with a trailing\n * slash. Copy them there at build time — for Vite, from\n * `node_modules/onnxruntime-web/dist/`.\n */\nexport function configureOrtAssets(basePath: string): void {\n configuredPath = basePath.endsWith(\"/\") ? basePath : `${basePath}/`;\n}\n\n/**\n * Where the runtime's binaries were said to live.\n *\n * Read by the ONNX predictor just before it creates a session, which is\n * the first moment the runtime exists to be configured.\n *\n * @returns The configured directory, or `undefined` when none was set.\n */\nexport function configuredOrtAssetPath(): string | undefined {\n return configuredPath;\n}\n\n/**\n * The URLs a service worker should precache for offline inference.\n *\n * The model file is not included: it is cached by\n * {@link fetchModelBytes} on first use, under its own bucket.\n *\n * @example\n * ```ts\n * installPrecache([...ortAssetUrls(\"/ort/\"), \"/index.html\"]);\n * ```\n *\n * @param basePath Directory the binaries are served from.\n * @returns Absolute-from-root URLs for every runtime asset.\n */\nexport function ortAssetUrls(basePath: string): string[] {\n const prefix = basePath.endsWith(\"/\") ? basePath : `${basePath}/`;\n return ORT_WASM_ASSETS.map((asset) => `${prefix}${asset}`);\n}\n"],"mappings":";AA2BA,
|
|
1
|
+
{"version":3,"file":"assets.js","names":["ORT_WASM_ASSETS","configuredPath","configureOrtAssets","basePath","configuredOrtAssetPath","ortAssetUrls","prefix","asset"],"sources":["../../src/tabular/assets.ts"],"sourcesContent":["/**\n * The runtime's own assets, which are the other half of working offline.\n *\n * ONNX Runtime Web does **not** embed its WebAssembly binary, not even in\n * the `.bundle` builds. Measured in Chromium: the default entry fetches\n * `ort-wasm-simd-threaded.jsep.wasm` at session creation, and serving the\n * app without that file fails with `Aborted(both async and sync fetching of\n * the wasm failed)` — an error that says nothing about the missing file.\n *\n * So an offline app has to ship those binaries and precache them. This\n * module names them and points the runtime at a local directory.\n *\n * It does **not** import `onnxruntime-web`. An app on the compact route\n * (`CompactPredictor`) has no runtime at all, and a module that imported\n * one at load time would force every consumer of this subpath to install\n * the peer — which is exactly the cost that route exists to avoid. The\n * configured path is remembered here and applied by the ONNX predictor,\n * which imports the runtime only when it actually loads a model.\n */\n\n/**\n * The WebAssembly binaries ONNX Runtime Web may request.\n *\n * Which one is fetched depends on the browser's threading and SIMD support,\n * so an app that must work everywhere ships all of them. Chromium with the\n * default entry point fetched the `jsep` build.\n */\nexport const ORT_WASM_ASSETS: readonly string[] = [\n \"ort-wasm-simd-threaded.wasm\",\n \"ort-wasm-simd-threaded.mjs\",\n \"ort-wasm-simd-threaded.jsep.wasm\",\n \"ort-wasm-simd-threaded.jsep.mjs\",\n];\n\nlet configuredPath: string | undefined;\n\n/**\n * Point ONNX Runtime Web at locally served WebAssembly binaries.\n *\n * Call once, before creating any predictor.\n *\n * @example\n * ```ts\n * configureOrtAssets(\"/ort/\");\n * const predictor = await TabularPredictor.create(\"/models/classifier.onnx\");\n * ```\n *\n * @param basePath Directory the binaries are served from, with a trailing\n * slash. Copy them there at build time — for Vite, from\n * `node_modules/onnxruntime-web/dist/`.\n */\nexport function configureOrtAssets(basePath: string): void {\n configuredPath = basePath.endsWith(\"/\") ? basePath : `${basePath}/`;\n}\n\n/**\n * Where the runtime's binaries were said to live.\n *\n * Read by the ONNX predictor just before it creates a session, which is\n * the first moment the runtime exists to be configured.\n *\n * @returns The configured directory, or `undefined` when none was set.\n */\nexport function configuredOrtAssetPath(): string | undefined {\n return configuredPath;\n}\n\n/**\n * The URLs a service worker should precache for offline inference.\n *\n * The model file is not included: it is cached by\n * {@link fetchModelBytes} on first use, under its own bucket.\n *\n * @example\n * ```ts\n * installPrecache([...ortAssetUrls(\"/ort/\"), \"/index.html\"]);\n * ```\n *\n * @param basePath Directory the binaries are served from.\n * @returns Absolute-from-root URLs for every runtime asset.\n */\nexport function ortAssetUrls(basePath: string): string[] {\n const prefix = basePath.endsWith(\"/\") ? basePath : `${basePath}/`;\n return ORT_WASM_ASSETS.map((asset) => `${prefix}${asset}`);\n}\n"],"mappings":";AA2BA,IAAaA,IAAqC;CAC9C;CACA;CACA;CACA;AACJ,GAEIC;AAiBJ,SAAgBC,EAAmB,GAAwB;CACvD,IAAiBC,EAAS,SAAS,GAAG,IAAIA,IAAW,GAAGA,EAAS;AACrE;AAUA,SAAgBC,IAA6C;CACzD,OAAOH;AACX;AAgBA,SAAgBI,EAAa,GAA4B;CACrD,IAAMC,IAASH,EAAS,SAAS,GAAG,IAAIA,IAAW,GAAGA,EAAS;CAC/D,OAAOH,EAAgB,KAAK,MAAU,GAAGM,IAASC,GAAO;AAC7D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cache.cjs","names":[],"sources":["../../src/tabular/cache.ts"],"sourcesContent":["/**\n * Keeping model bytes on the device, so the second visit works offline.\n *\n * A prediction that needs the network is not offline inference. The model\n * file is the one asset the app cannot re-derive, so it goes into Cache\n * Storage on first load and is read from there afterwards.\n *\n * Cache-first, not network-first, and deliberately: a model file is\n * immutable for a given version, so revalidating it on every load spends a\n * round trip to learn nothing. Publish a new version under a new URL (or\n * pass `revalidate`) when the model changes.\n */\n\nimport { ModelFetchError } from \"./exceptions\";\n\n/** Cache Storage bucket used when the caller does not name one. */\nexport const DEFAULT_MODEL_CACHE = \"tempest-tabular-models\";\n\n/** Options for {@link fetchModelBytes}. */\nexport interface ModelCacheOptions {\n /** Cache Storage bucket name. */\n readonly cacheName?: string;\n /**\n * Go to the network first and fall back to the cache.\n *\n * For a URL that serves \"whatever is current\" rather than a pinned\n * version. Costs a round trip on every load when online.\n */\n readonly revalidate?: boolean;\n /** `fetch` options, e.g. credentials for a private model endpoint. */\n readonly requestInit?: RequestInit;\n}\n\n/**\n * Whether Cache Storage is usable here.\n *\n * Absent in a non-secure context, in Node, and in some private-mode\n * browsers. The module degrades to a plain fetch rather than failing —\n * losing offline support is better than losing inference.\n *\n * @returns `true` when `caches` can be used.\n */\nfunction hasCacheStorage(): boolean {\n return typeof globalThis.caches !== \"undefined\";\n}\n\n/**\n * Fetch the model bytes, preferring the on-device copy.\n *\n * @example\n * ```ts\n * const bytes = await fetchModelBytes(\"/models/classifier-v3.onnx\");\n * const predictor = await TabularPredictor.create(bytes);\n * ```\n *\n * @param url Where the model lives.\n * @param options Cache bucket, revalidation and `fetch` options.\n * @returns The model bytes.\n * @throws {@link ModelFetchError} when the model is neither cached nor\n * reachable — which is the \"offline and never warmed\" case, and the\n * message says so.\n */\nexport async function fetchModelBytes(\n url: string,\n options: ModelCacheOptions = {},\n): Promise<Uint8Array> {\n const cacheName = options.cacheName ?? DEFAULT_MODEL_CACHE;\n\n if (!hasCacheStorage()) {\n return await downloadBytes(url, options.requestInit);\n }\n\n const cache = await globalThis.caches.open(cacheName);\n\n if (options.revalidate !== true) {\n const cached = await cache.match(url);\n if (cached !== undefined) return new Uint8Array(await cached.arrayBuffer());\n }\n\n try {\n const response = await fetch(url, options.requestInit);\n if (!response.ok) {\n throw new ModelFetchError(\n `Failed to download the model: ${response.status} ${response.statusText}`,\n );\n }\n await cache.put(url, response.clone());\n return new Uint8Array(await response.arrayBuffer());\n } catch (error) {\n const cached = await cache.match(url);\n if (cached !== undefined) return new Uint8Array(await cached.arrayBuffer());\n if (error instanceof ModelFetchError) throw error;\n throw new ModelFetchError(\n `The model is not cached and could not be downloaded: ${url}. ` +\n \"Warm the cache while online — prefetch it at install time, or \" +\n \"precache it in the service worker.\",\n { cause: error },\n );\n }\n}\n\n/**\n * Download without touching the cache.\n *\n * @param url Where the model lives.\n * @param requestInit `fetch` options.\n * @returns The model bytes.\n * @throws {@link ModelFetchError} when the request fails.\n */\nasync function downloadBytes(url: string, requestInit?: RequestInit): Promise<Uint8Array> {\n try {\n const response = await fetch(url, requestInit);\n if (!response.ok) {\n throw new ModelFetchError(\n `Failed to download the model: ${response.status} ${response.statusText}`,\n );\n }\n return new Uint8Array(await response.arrayBuffer());\n } catch (error) {\n if (error instanceof ModelFetchError) throw error;\n throw new ModelFetchError(`Failed to download the model: ${url}`, { cause: error });\n }\n}\n\n/**\n * Whether a model is already on the device.\n *\n * Useful for showing \"available offline\" in the UI, and for deciding\n * whether to prefetch on a metered connection.\n *\n * @param url The model URL.\n * @param cacheName Cache Storage bucket name.\n * @returns `true` when the bytes are cached.\n */\nexport async function isModelCached(\n url: string,\n cacheName: string = DEFAULT_MODEL_CACHE,\n): Promise<boolean> {\n if (!hasCacheStorage()) return false;\n const cache = await globalThis.caches.open(cacheName);\n return (await cache.match(url)) !== undefined;\n}\n\n/**\n * Store model bytes without downloading them.\n *\n * For an app that already has the bytes — from a file input, or from a\n * bundle it unpacked — and wants the next load to find them cached.\n *\n * @param url The URL to key the entry under.\n * @param bytes The model bytes.\n * @param cacheName Cache Storage bucket name.\n * @returns `true` when the entry was stored, `false` without Cache Storage.\n */\nexport async function cacheModelBytes(\n url: string,\n bytes: Uint8Array,\n cacheName: string = DEFAULT_MODEL_CACHE,\n): Promise<boolean> {\n if (!hasCacheStorage()) return false;\n const cache = await globalThis.caches.open(cacheName);\n const body = new Uint8Array(bytes).buffer as ArrayBuffer;\n await cache.put(\n url,\n new Response(body, {\n headers: { \"content-type\": \"application/octet-stream\" },\n }),\n );\n return true;\n}\n\n/**\n * Drop cached models.\n *\n * @param url A specific model to evict; omit to delete the whole bucket.\n * @param cacheName Cache Storage bucket name.\n * @returns `true` when something was deleted.\n */\nexport async function clearModelCache(\n url?: string,\n cacheName: string = DEFAULT_MODEL_CACHE,\n): Promise<boolean> {\n if (!hasCacheStorage()) return false;\n if (url === undefined) return await globalThis.caches.delete(cacheName);\n const cache = await globalThis.caches.open(cacheName);\n return await cache.delete(url);\n}\n"],"mappings":"oCAgBA,
|
|
1
|
+
{"version":3,"file":"cache.cjs","names":["ModelFetchError","require_exceptions","DEFAULT_MODEL_CACHE","hasCacheStorage","fetchModelBytes","cacheName","options","downloadBytes","url","cache","cached","response","error","requestInit","isModelCached","cacheModelBytes","body","bytes","clearModelCache"],"sources":["../../src/tabular/cache.ts"],"sourcesContent":["/**\n * Keeping model bytes on the device, so the second visit works offline.\n *\n * A prediction that needs the network is not offline inference. The model\n * file is the one asset the app cannot re-derive, so it goes into Cache\n * Storage on first load and is read from there afterwards.\n *\n * Cache-first, not network-first, and deliberately: a model file is\n * immutable for a given version, so revalidating it on every load spends a\n * round trip to learn nothing. Publish a new version under a new URL (or\n * pass `revalidate`) when the model changes.\n */\n\nimport { ModelFetchError } from \"./exceptions\";\n\n/** Cache Storage bucket used when the caller does not name one. */\nexport const DEFAULT_MODEL_CACHE = \"tempest-tabular-models\";\n\n/** Options for {@link fetchModelBytes}. */\nexport interface ModelCacheOptions {\n /** Cache Storage bucket name. */\n readonly cacheName?: string;\n /**\n * Go to the network first and fall back to the cache.\n *\n * For a URL that serves \"whatever is current\" rather than a pinned\n * version. Costs a round trip on every load when online.\n */\n readonly revalidate?: boolean;\n /** `fetch` options, e.g. credentials for a private model endpoint. */\n readonly requestInit?: RequestInit;\n}\n\n/**\n * Whether Cache Storage is usable here.\n *\n * Absent in a non-secure context, in Node, and in some private-mode\n * browsers. The module degrades to a plain fetch rather than failing —\n * losing offline support is better than losing inference.\n *\n * @returns `true` when `caches` can be used.\n */\nfunction hasCacheStorage(): boolean {\n return typeof globalThis.caches !== \"undefined\";\n}\n\n/**\n * Fetch the model bytes, preferring the on-device copy.\n *\n * @example\n * ```ts\n * const bytes = await fetchModelBytes(\"/models/classifier-v3.onnx\");\n * const predictor = await TabularPredictor.create(bytes);\n * ```\n *\n * @param url Where the model lives.\n * @param options Cache bucket, revalidation and `fetch` options.\n * @returns The model bytes.\n * @throws {@link ModelFetchError} when the model is neither cached nor\n * reachable — which is the \"offline and never warmed\" case, and the\n * message says so.\n */\nexport async function fetchModelBytes(\n url: string,\n options: ModelCacheOptions = {},\n): Promise<Uint8Array> {\n const cacheName = options.cacheName ?? DEFAULT_MODEL_CACHE;\n\n if (!hasCacheStorage()) {\n return await downloadBytes(url, options.requestInit);\n }\n\n const cache = await globalThis.caches.open(cacheName);\n\n if (options.revalidate !== true) {\n const cached = await cache.match(url);\n if (cached !== undefined) return new Uint8Array(await cached.arrayBuffer());\n }\n\n try {\n const response = await fetch(url, options.requestInit);\n if (!response.ok) {\n throw new ModelFetchError(\n `Failed to download the model: ${response.status} ${response.statusText}`,\n );\n }\n await cache.put(url, response.clone());\n return new Uint8Array(await response.arrayBuffer());\n } catch (error) {\n const cached = await cache.match(url);\n if (cached !== undefined) return new Uint8Array(await cached.arrayBuffer());\n if (error instanceof ModelFetchError) throw error;\n throw new ModelFetchError(\n `The model is not cached and could not be downloaded: ${url}. ` +\n \"Warm the cache while online — prefetch it at install time, or \" +\n \"precache it in the service worker.\",\n { cause: error },\n );\n }\n}\n\n/**\n * Download without touching the cache.\n *\n * @param url Where the model lives.\n * @param requestInit `fetch` options.\n * @returns The model bytes.\n * @throws {@link ModelFetchError} when the request fails.\n */\nasync function downloadBytes(url: string, requestInit?: RequestInit): Promise<Uint8Array> {\n try {\n const response = await fetch(url, requestInit);\n if (!response.ok) {\n throw new ModelFetchError(\n `Failed to download the model: ${response.status} ${response.statusText}`,\n );\n }\n return new Uint8Array(await response.arrayBuffer());\n } catch (error) {\n if (error instanceof ModelFetchError) throw error;\n throw new ModelFetchError(`Failed to download the model: ${url}`, { cause: error });\n }\n}\n\n/**\n * Whether a model is already on the device.\n *\n * Useful for showing \"available offline\" in the UI, and for deciding\n * whether to prefetch on a metered connection.\n *\n * @param url The model URL.\n * @param cacheName Cache Storage bucket name.\n * @returns `true` when the bytes are cached.\n */\nexport async function isModelCached(\n url: string,\n cacheName: string = DEFAULT_MODEL_CACHE,\n): Promise<boolean> {\n if (!hasCacheStorage()) return false;\n const cache = await globalThis.caches.open(cacheName);\n return (await cache.match(url)) !== undefined;\n}\n\n/**\n * Store model bytes without downloading them.\n *\n * For an app that already has the bytes — from a file input, or from a\n * bundle it unpacked — and wants the next load to find them cached.\n *\n * @param url The URL to key the entry under.\n * @param bytes The model bytes.\n * @param cacheName Cache Storage bucket name.\n * @returns `true` when the entry was stored, `false` without Cache Storage.\n */\nexport async function cacheModelBytes(\n url: string,\n bytes: Uint8Array,\n cacheName: string = DEFAULT_MODEL_CACHE,\n): Promise<boolean> {\n if (!hasCacheStorage()) return false;\n const cache = await globalThis.caches.open(cacheName);\n const body = new Uint8Array(bytes).buffer as ArrayBuffer;\n await cache.put(\n url,\n new Response(body, {\n headers: { \"content-type\": \"application/octet-stream\" },\n }),\n );\n return true;\n}\n\n/**\n * Drop cached models.\n *\n * @param url A specific model to evict; omit to delete the whole bucket.\n * @param cacheName Cache Storage bucket name.\n * @returns `true` when something was deleted.\n */\nexport async function clearModelCache(\n url?: string,\n cacheName: string = DEFAULT_MODEL_CACHE,\n): Promise<boolean> {\n if (!hasCacheStorage()) return false;\n if (url === undefined) return await globalThis.caches.delete(cacheName);\n const cache = await globalThis.caches.open(cacheName);\n return await cache.delete(url);\n}\n"],"mappings":"A,oCAgBA,IAAaE,EAAsB,yBA0BnC,SAASC,GAA2B,CAChC,OAAc,WAAW,SAAW,MACxC,CAkBA,eAAsBC,EAClB,EACA,EAA6B,CAAC,EACX,CACnB,IAAMC,EAAYC,EAAQ,WAAA,yBAE1B,GAAI,CAACH,EAAgB,EACjB,OAAO,MAAMI,EAAcC,EAAKF,EAAQ,WAAW,EAGvD,IAAMG,EAAQ,MAAM,WAAW,OAAO,KAAKJ,CAAS,EAEpD,GAAIC,EAAQ,aAAe,GAAM,CAC7B,IAAMI,EAAS,MAAMD,EAAM,MAAMD,CAAG,EACpC,GAAIE,IAAW,IAAA,GAAW,OAAO,IAAI,WAAW,MAAMA,EAAO,YAAY,CAAC,CAC9E,CAEA,GAAI,CACA,IAAMC,EAAW,MAAM,MAAMH,EAAKF,EAAQ,WAAW,EACrD,GAAI,CAACK,EAAS,GACV,MAAM,IAAIX,EAAAA,gBACN,iCAAiCW,EAAS,OAAO,GAAGA,EAAS,YACjE,EAGJ,OADA,MAAMF,EA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,EAAgB,EACjBK,IAAQ,IAAA,GAAkB,MAAM,WAAW,OAAO,OAAOH,CAAS,EAE/D,MAAM,MADO,WAAW,OAAO,KAAKA,CAAS,EAAA,CACjC,OAAOG,CAAG,EAHE,EAInC,C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cache.js","names":[],"sources":["../../src/tabular/cache.ts"],"sourcesContent":["/**\n * Keeping model bytes on the device, so the second visit works offline.\n *\n * A prediction that needs the network is not offline inference. The model\n * file is the one asset the app cannot re-derive, so it goes into Cache\n * Storage on first load and is read from there afterwards.\n *\n * Cache-first, not network-first, and deliberately: a model file is\n * immutable for a given version, so revalidating it on every load spends a\n * round trip to learn nothing. Publish a new version under a new URL (or\n * pass `revalidate`) when the model changes.\n */\n\nimport { ModelFetchError } from \"./exceptions\";\n\n/** Cache Storage bucket used when the caller does not name one. */\nexport const DEFAULT_MODEL_CACHE = \"tempest-tabular-models\";\n\n/** Options for {@link fetchModelBytes}. */\nexport interface ModelCacheOptions {\n /** Cache Storage bucket name. */\n readonly cacheName?: string;\n /**\n * Go to the network first and fall back to the cache.\n *\n * For a URL that serves \"whatever is current\" rather than a pinned\n * version. Costs a round trip on every load when online.\n */\n readonly revalidate?: boolean;\n /** `fetch` options, e.g. credentials for a private model endpoint. */\n readonly requestInit?: RequestInit;\n}\n\n/**\n * Whether Cache Storage is usable here.\n *\n * Absent in a non-secure context, in Node, and in some private-mode\n * browsers. The module degrades to a plain fetch rather than failing —\n * losing offline support is better than losing inference.\n *\n * @returns `true` when `caches` can be used.\n */\nfunction hasCacheStorage(): boolean {\n return typeof globalThis.caches !== \"undefined\";\n}\n\n/**\n * Fetch the model bytes, preferring the on-device copy.\n *\n * @example\n * ```ts\n * const bytes = await fetchModelBytes(\"/models/classifier-v3.onnx\");\n * const predictor = await TabularPredictor.create(bytes);\n * ```\n *\n * @param url Where the model lives.\n * @param options Cache bucket, revalidation and `fetch` options.\n * @returns The model bytes.\n * @throws {@link ModelFetchError} when the model is neither cached nor\n * reachable — which is the \"offline and never warmed\" case, and the\n * message says so.\n */\nexport async function fetchModelBytes(\n url: string,\n options: ModelCacheOptions = {},\n): Promise<Uint8Array> {\n const cacheName = options.cacheName ?? DEFAULT_MODEL_CACHE;\n\n if (!hasCacheStorage()) {\n return await downloadBytes(url, options.requestInit);\n }\n\n const cache = await globalThis.caches.open(cacheName);\n\n if (options.revalidate !== true) {\n const cached = await cache.match(url);\n if (cached !== undefined) return new Uint8Array(await cached.arrayBuffer());\n }\n\n try {\n const response = await fetch(url, options.requestInit);\n if (!response.ok) {\n throw new ModelFetchError(\n `Failed to download the model: ${response.status} ${response.statusText}`,\n );\n }\n await cache.put(url, response.clone());\n return new Uint8Array(await response.arrayBuffer());\n } catch (error) {\n const cached = await cache.match(url);\n if (cached !== undefined) return new Uint8Array(await cached.arrayBuffer());\n if (error instanceof ModelFetchError) throw error;\n throw new ModelFetchError(\n `The model is not cached and could not be downloaded: ${url}. ` +\n \"Warm the cache while online — prefetch it at install time, or \" +\n \"precache it in the service worker.\",\n { cause: error },\n );\n }\n}\n\n/**\n * Download without touching the cache.\n *\n * @param url Where the model lives.\n * @param requestInit `fetch` options.\n * @returns The model bytes.\n * @throws {@link ModelFetchError} when the request fails.\n */\nasync function downloadBytes(url: string, requestInit?: RequestInit): Promise<Uint8Array> {\n try {\n const response = await fetch(url, requestInit);\n if (!response.ok) {\n throw new ModelFetchError(\n `Failed to download the model: ${response.status} ${response.statusText}`,\n );\n }\n return new Uint8Array(await response.arrayBuffer());\n } catch (error) {\n if (error instanceof ModelFetchError) throw error;\n throw new ModelFetchError(`Failed to download the model: ${url}`, { cause: error });\n }\n}\n\n/**\n * Whether a model is already on the device.\n *\n * Useful for showing \"available offline\" in the UI, and for deciding\n * whether to prefetch on a metered connection.\n *\n * @param url The model URL.\n * @param cacheName Cache Storage bucket name.\n * @returns `true` when the bytes are cached.\n */\nexport async function isModelCached(\n url: string,\n cacheName: string = DEFAULT_MODEL_CACHE,\n): Promise<boolean> {\n if (!hasCacheStorage()) return false;\n const cache = await globalThis.caches.open(cacheName);\n return (await cache.match(url)) !== undefined;\n}\n\n/**\n * Store model bytes without downloading them.\n *\n * For an app that already has the bytes — from a file input, or from a\n * bundle it unpacked — and wants the next load to find them cached.\n *\n * @param url The URL to key the entry under.\n * @param bytes The model bytes.\n * @param cacheName Cache Storage bucket name.\n * @returns `true` when the entry was stored, `false` without Cache Storage.\n */\nexport async function cacheModelBytes(\n url: string,\n bytes: Uint8Array,\n cacheName: string = DEFAULT_MODEL_CACHE,\n): Promise<boolean> {\n if (!hasCacheStorage()) return false;\n const cache = await globalThis.caches.open(cacheName);\n const body = new Uint8Array(bytes).buffer as ArrayBuffer;\n await cache.put(\n url,\n new Response(body, {\n headers: { \"content-type\": \"application/octet-stream\" },\n }),\n );\n return true;\n}\n\n/**\n * Drop cached models.\n *\n * @param url A specific model to evict; omit to delete the whole bucket.\n * @param cacheName Cache Storage bucket name.\n * @returns `true` when something was deleted.\n */\nexport async function clearModelCache(\n url?: string,\n cacheName: string = DEFAULT_MODEL_CACHE,\n): Promise<boolean> {\n if (!hasCacheStorage()) return false;\n if (url === undefined) return await globalThis.caches.delete(cacheName);\n const cache = await globalThis.caches.open(cacheName);\n return await cache.delete(url);\n}\n"],"mappings":";;AAgBA,
|
|
1
|
+
{"version":3,"file":"cache.js","names":["DEFAULT_MODEL_CACHE","hasCacheStorage","fetchModelBytes","cacheName","options","downloadBytes","url","cache","cached","response","ModelFetchError","error","requestInit","isModelCached","cacheModelBytes","body","bytes","clearModelCache"],"sources":["../../src/tabular/cache.ts"],"sourcesContent":["/**\n * Keeping model bytes on the device, so the second visit works offline.\n *\n * A prediction that needs the network is not offline inference. The model\n * file is the one asset the app cannot re-derive, so it goes into Cache\n * Storage on first load and is read from there afterwards.\n *\n * Cache-first, not network-first, and deliberately: a model file is\n * immutable for a given version, so revalidating it on every load spends a\n * round trip to learn nothing. Publish a new version under a new URL (or\n * pass `revalidate`) when the model changes.\n */\n\nimport { ModelFetchError } from \"./exceptions\";\n\n/** Cache Storage bucket used when the caller does not name one. */\nexport const DEFAULT_MODEL_CACHE = \"tempest-tabular-models\";\n\n/** Options for {@link fetchModelBytes}. */\nexport interface ModelCacheOptions {\n /** Cache Storage bucket name. */\n readonly cacheName?: string;\n /**\n * Go to the network first and fall back to the cache.\n *\n * For a URL that serves \"whatever is current\" rather than a pinned\n * version. Costs a round trip on every load when online.\n */\n readonly revalidate?: boolean;\n /** `fetch` options, e.g. credentials for a private model endpoint. */\n readonly requestInit?: RequestInit;\n}\n\n/**\n * Whether Cache Storage is usable here.\n *\n * Absent in a non-secure context, in Node, and in some private-mode\n * browsers. The module degrades to a plain fetch rather than failing —\n * losing offline support is better than losing inference.\n *\n * @returns `true` when `caches` can be used.\n */\nfunction hasCacheStorage(): boolean {\n return typeof globalThis.caches !== \"undefined\";\n}\n\n/**\n * Fetch the model bytes, preferring the on-device copy.\n *\n * @example\n * ```ts\n * const bytes = await fetchModelBytes(\"/models/classifier-v3.onnx\");\n * const predictor = await TabularPredictor.create(bytes);\n * ```\n *\n * @param url Where the model lives.\n * @param options Cache bucket, revalidation and `fetch` options.\n * @returns The model bytes.\n * @throws {@link ModelFetchError} when the model is neither cached nor\n * reachable — which is the \"offline and never warmed\" case, and the\n * message says so.\n */\nexport async function fetchModelBytes(\n url: string,\n options: ModelCacheOptions = {},\n): Promise<Uint8Array> {\n const cacheName = options.cacheName ?? DEFAULT_MODEL_CACHE;\n\n if (!hasCacheStorage()) {\n return await downloadBytes(url, options.requestInit);\n }\n\n const cache = await globalThis.caches.open(cacheName);\n\n if (options.revalidate !== true) {\n const cached = await cache.match(url);\n if (cached !== undefined) return new Uint8Array(await cached.arrayBuffer());\n }\n\n try {\n const response = await fetch(url, options.requestInit);\n if (!response.ok) {\n throw new ModelFetchError(\n `Failed to download the model: ${response.status} ${response.statusText}`,\n );\n }\n await cache.put(url, response.clone());\n return new Uint8Array(await response.arrayBuffer());\n } catch (error) {\n const cached = await cache.match(url);\n if (cached !== undefined) return new Uint8Array(await cached.arrayBuffer());\n if (error instanceof ModelFetchError) throw error;\n throw new ModelFetchError(\n `The model is not cached and could not be downloaded: ${url}. ` +\n \"Warm the cache while online — prefetch it at install time, or \" +\n \"precache it in the service worker.\",\n { cause: error },\n );\n }\n}\n\n/**\n * Download without touching the cache.\n *\n * @param url Where the model lives.\n * @param requestInit `fetch` options.\n * @returns The model bytes.\n * @throws {@link ModelFetchError} when the request fails.\n */\nasync function downloadBytes(url: string, requestInit?: RequestInit): Promise<Uint8Array> {\n try {\n const response = await fetch(url, requestInit);\n if (!response.ok) {\n throw new ModelFetchError(\n `Failed to download the model: ${response.status} ${response.statusText}`,\n );\n }\n return new Uint8Array(await response.arrayBuffer());\n } catch (error) {\n if (error instanceof ModelFetchError) throw error;\n throw new ModelFetchError(`Failed to download the model: ${url}`, { cause: error });\n }\n}\n\n/**\n * Whether a model is already on the device.\n *\n * Useful for showing \"available offline\" in the UI, and for deciding\n * whether to prefetch on a metered connection.\n *\n * @param url The model URL.\n * @param cacheName Cache Storage bucket name.\n * @returns `true` when the bytes are cached.\n */\nexport async function isModelCached(\n url: string,\n cacheName: string = DEFAULT_MODEL_CACHE,\n): Promise<boolean> {\n if (!hasCacheStorage()) return false;\n const cache = await globalThis.caches.open(cacheName);\n return (await cache.match(url)) !== undefined;\n}\n\n/**\n * Store model bytes without downloading them.\n *\n * For an app that already has the bytes — from a file input, or from a\n * bundle it unpacked — and wants the next load to find them cached.\n *\n * @param url The URL to key the entry under.\n * @param bytes The model bytes.\n * @param cacheName Cache Storage bucket name.\n * @returns `true` when the entry was stored, `false` without Cache Storage.\n */\nexport async function cacheModelBytes(\n url: string,\n bytes: Uint8Array,\n cacheName: string = DEFAULT_MODEL_CACHE,\n): Promise<boolean> {\n if (!hasCacheStorage()) return false;\n const cache = await globalThis.caches.open(cacheName);\n const body = new Uint8Array(bytes).buffer as ArrayBuffer;\n await cache.put(\n url,\n new Response(body, {\n headers: { \"content-type\": \"application/octet-stream\" },\n }),\n );\n return true;\n}\n\n/**\n * Drop cached models.\n *\n * @param url A specific model to evict; omit to delete the whole bucket.\n * @param cacheName Cache Storage bucket name.\n * @returns `true` when something was deleted.\n */\nexport async function clearModelCache(\n url?: string,\n cacheName: string = DEFAULT_MODEL_CACHE,\n): Promise<boolean> {\n if (!hasCacheStorage()) return false;\n if (url === undefined) return await globalThis.caches.delete(cacheName);\n const cache = await globalThis.caches.open(cacheName);\n return await cache.delete(url);\n}\n"],"mappings":";;AAgBA,IAAaA,IAAsB;AA0BnC,SAASC,IAA2B;CAChC,OAAc,WAAW,WAAW;AACxC;AAkBA,eAAsBC,EAClB,GACA,IAA6B,CAAC,GACX;CACnB,IAAMC,IAAYC,EAAQ,aAAA;CAE1B,IAAI,CAACH,EAAgB,GACjB,OAAO,MAAMI,EAAcC,GAAKF,EAAQ,WAAW;CAGvD,IAAMG,IAAQ,MAAM,WAAW,OAAO,KAAKJ,CAAS;CAEpD,IAAIC,EAAQ,eAAe,IAAM;EAC7B,IAAMI,IAAS,MAAMD,EAAM,MAAMD,CAAG;EACpC,IAAIE,MAAW,KAAA,GAAW,OAAO,IAAI,WAAW,MAAMA,EAAO,YAAY,CAAC;CAC9E;CAEA,IAAI;EACA,IAAMC,IAAW,MAAM,MAAMH,GAAKF,EAAQ,WAAW;EACrD,IAAI,CAACK,EAAS,IACV,MAAM,IAAIC,EACN,iCAAiCD,EAAS,OAAO,GAAGA,EAAS,YACjE;EAGJ,OADA,MAAMF,EAAM,IAAID,GAAKG,EAAS,MAAM,CAAC,GAC9B,IAAI,WAAW,MAAMA,EAAS,YAAY,CAAC;CACtD,SAASE,GAAO;EACZ,IAAMH,IAAS,MAAMD,EAAM,MAAMD,CAAG;EACpC,IAAIE,MAAW,KAAA,GAAW,OAAO,IAAI,WAAW,MAAMA,EAAO,YAAY,CAAC;EAE1E,MADIG,aAAiBD,IAAuBC,IACtC,IAAID,EACN,wDAAwDJ,EAAI,qGAG5D,EAAE,OAAOK,EAAM,CACnB;CACJ;AACJ;AAUA,eAAeN,EAAc,GAAa,GAAgD;CACtF,IAAI;EACA,IAAMI,IAAW,MAAM,MAAMH,GAAKM,CAAW;EAC7C,IAAI,CAACH,EAAS,IACV,MAAM,IAAIC,EACN,iCAAiCD,EAAS,OAAO,GAAGA,EAAS,YACjE;EAEJ,OAAO,IAAI,WAAW,MAAMA,EAAS,YAAY,CAAC;CACtD,SAASE,GAAO;EAEZ,MADIA,aAAiBD,IAAuBC,IACtC,IAAID,EAAgB,iCAAiCJ,KAAO,EAAE,OAAOK,EAAM,CAAC;CACtF;AACJ;AAYA,eAAsBE,EAClB,GACA,IAAoBb,GACJ;CAGhB,OAFKC,EAAgB,IAEb,OAAM,MADM,WAAW,OAAO,KAAKE,CAAS,EAAA,CAChC,MAAMG,CAAG,MAAO,KAAA,IAFL;AAGnC;AAaA,eAAsBQ,EAClB,GACA,GACA,IAAoBd,GACJ;CAChB,IAAI,CAACC,EAAgB,GAAG,OAAO;CAC/B,IAAMM,IAAQ,MAAM,WAAW,OAAO,KAAKJ,CAAS,GAC9CY,IAAO,IAAI,WAAWC,CAAK,CAAC,CAAC;CAOnC,OANA,MAAMT,EAAM,IACRD,GACA,IAAI,SAASS,GAAM,EACf,SAAS,EAAE,gBAAgB,2BAA2B,EAC1D,CAAC,CACL,GACO;AACX;AASA,eAAsBE,EAClB,GACA,IAAoBjB,GACJ;CAIhB,OAHKC,EAAgB,IACjBK,MAAQ,KAAA,IAAkB,MAAM,WAAW,OAAO,OAAOH,CAAS,IAE/D,OAAM,MADO,WAAW,OAAO,KAAKA,CAAS,EAAA,CACjC,OAAOG,CAAG,IAHE;AAInC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compact.cjs","names":[],"sources":["../../src/tabular/compact.ts"],"sourcesContent":["/**\n * @tempest-limits file-lines — the compact model format: the header, the column\n * dictionary, the quantised weights and the decoder that reads them back. Writer and\n * reader in one file because a format whose two halves live apart drifts.\n */\n/**\n * Running a model with no inference runtime at all.\n *\n * ONNX in the browser costs a **25.6 MB WebAssembly runtime** (6.0 MB\n * gzipped) before the first prediction, while the model itself is a few\n * hundred kilobytes. For an app whose only model is tabular, that runtime\n * *is* the download — so this reader replaces it with 1.49 KB of\n * arithmetic (measured, brotli).\n *\n * A linear model is a dot product. A tree is a chain of comparisons. That\n * is the whole implementation; there is nothing here that a WebAssembly\n * kernel would do better at this size.\n *\n * The file it reads (`.tmc`, magic `TMC1`) is written by\n * `tempest-fastapi-sdk`'s `export_sklearn_to_compact`, which verifies the\n * bytes against scikit-learn's own predictions and refuses to write a file\n * that disagrees. **It is data, not code**: no `eval`, no generated\n * JavaScript, nothing a strict CSP forbids.\n *\n * The trade against {@link TabularPredictor}: ONNX covers every estimator,\n * this covers linear models and tree ensembles. Pick by what your app\n * already ships — a page that loads ONNX for vision pays nothing extra for\n * tabular ONNX.\n */\n\nimport { CompactFormatError, FeatureShapeError, ModelFetchError } from \"./exceptions\";\nimport type { FeatureRow, PredictedLabel, TabularPrediction } from \"./types\";\n\n/** Magic bytes opening every compact file. */\nconst MAGIC = \"TMC1\";\n\n/** Layout version this reader understands. */\nexport const SUPPORTED_COMPACT_SCHEMA = 1;\n\n/** What the file holds. */\nexport type CompactKind = \"linear\" | \"tree_ensemble\";\n\n/** How raw scores become probabilities. */\ntype CompactLink = \"softmax\" | \"sigmoid\" | \"normalize\" | \"identity\";\n\n/** One array stored after the header. */\ninterface CompactSection {\n readonly name: string;\n readonly dtype: \"float32\" | \"int32\";\n readonly length: number;\n}\n\n/** The parsed header. */\ninterface CompactHeader {\n readonly schema_version: number;\n readonly kind: CompactKind;\n readonly task: \"classification\" | \"regression\";\n readonly link: CompactLink;\n readonly classes: readonly string[];\n /** How scikit-learn typed those labels: ``int``, ``float`` or ``str``. */\n readonly class_type?: \"int\" | \"float\" | \"str\";\n readonly n_features: number;\n readonly n_outputs: number;\n readonly n_trees?: number;\n readonly estimator: string;\n readonly feature_names: readonly string[];\n readonly preprocess: { readonly offset: number[]; readonly scale: number[] } | null;\n readonly sections: readonly CompactSection[];\n}\n\n/** What a loaded compact model is. */\nexport interface CompactPredictorInfo {\n /** Which reader path the file uses. */\n readonly kind: CompactKind;\n /** Class labels in score-column order; empty for a regressor. */\n readonly classes: readonly string[];\n /** Values expected per row. */\n readonly numFeatures: number;\n /** Column order recorded at training time, when the export had one. */\n readonly featureNames: readonly string[];\n /** Trees in the ensemble; `0` for a linear model. */\n readonly numTrees: number;\n /** Whether the model produces class scores. */\n readonly isClassifier: boolean;\n /** Class name of the exported estimator. */\n readonly estimator: string;\n}\n\n/**\n * A compact model, loaded and ready to answer.\n *\n * @example\n * ```ts\n * const predictor = await CompactPredictor.create(\"/models/risk.tmc\");\n * const { labels, probabilities } = await predictor.predict([[5.1, 3.5, 1.4, 0.2]]);\n * ```\n */\nexport class CompactPredictor {\n private constructor(\n private readonly header: CompactHeader,\n private readonly arrays: Record<string, Float32Array | Int32Array>,\n /** What is loaded. */\n public readonly info: CompactPredictorInfo,\n ) {}\n\n /**\n * Load a `.tmc` file.\n *\n * @param source A URL, or the bytes when the app already has them.\n * @param requestInit `fetch` options, when `source` is a URL.\n * @returns The loaded predictor.\n * @throws {@link ModelFetchError} when a URL cannot be read.\n * @throws {@link CompactFormatError} when the bytes are not a compact\n * model, or use a layout newer than this reader.\n */\n static async create(\n source: string | ArrayBuffer | Uint8Array,\n requestInit?: RequestInit,\n ): Promise<CompactPredictor> {\n const buffer = await toBuffer(source, requestInit);\n const bytes = new Uint8Array(buffer);\n\n if (String.fromCharCode(...bytes.subarray(0, 4)) !== MAGIC) {\n throw new CompactFormatError(\n \"This is not a compact model file: it does not start with \" +\n `\"${MAGIC}\". A .onnx file goes through TabularPredictor instead.`,\n );\n }\n\n const view = new DataView(buffer);\n const headerLength = view.getUint32(4, true);\n const header = JSON.parse(\n new TextDecoder().decode(bytes.subarray(8, 8 + headerLength)),\n ) as CompactHeader;\n\n if (header.schema_version > SUPPORTED_COMPACT_SCHEMA) {\n throw new CompactFormatError(\n `This file uses compact layout ${header.schema_version}, and this ` +\n `SDK understands ${SUPPORTED_COMPACT_SCHEMA}. Upgrade ` +\n \"tempest-react-sdk before serving it.\",\n );\n }\n\n const arrays: Record<string, Float32Array | Int32Array> = {};\n let cursor = 8 + headerLength;\n for (const section of header.sections) {\n arrays[section.name] =\n section.dtype === \"float32\"\n ? new Float32Array(buffer, cursor, section.length)\n : new Int32Array(buffer, cursor, section.length);\n cursor += section.length * 4;\n }\n\n return new CompactPredictor(header, arrays, {\n kind: header.kind,\n classes: header.classes,\n numFeatures: header.n_features,\n featureNames: header.feature_names,\n numTrees: header.n_trees ?? 0,\n isClassifier: header.task === \"classification\",\n estimator: header.estimator,\n });\n }\n\n /**\n * Predict for a batch of rows.\n *\n * @param rows One array of feature values per row, in training column\n * order. A single row is still wrapped: `[[...]]`.\n * @returns Labels, class scores when the model is a classifier, and the\n * call's duration.\n * @throws {@link FeatureShapeError} when the batch is empty, ragged, or\n * the wrong width.\n */\n async predict(rows: readonly FeatureRow[]): Promise<TabularPrediction> {\n const width = validateRows(rows, this.header.n_features);\n const started = performance.now();\n\n const scores: number[][] = [];\n for (const row of rows) {\n const prepared = this.preprocess(row, width);\n scores.push(\n this.header.kind === \"linear\"\n ? this.linearScores(prepared)\n : this.treeScores(prepared),\n );\n }\n\n const { labels, probabilities } = this.finish(scores);\n return {\n labels,\n probabilities,\n numRows: rows.length,\n ms: performance.now() - started,\n };\n }\n\n /** Releasing nothing, so callers can swap predictors without branching. */\n async dispose(): Promise<void> {\n /* no runtime, nothing to release */\n }\n\n /**\n * Apply the folded scaler, when the export had one.\n *\n * @param row The raw feature values.\n * @param width How many there are.\n * @returns The values the model was trained on.\n */\n private preprocess(row: FeatureRow, width: number): number[] {\n const preprocess = this.header.preprocess;\n if (preprocess === null) return row as number[];\n const scaled = new Array<number>(width);\n for (let index = 0; index < width; index += 1) {\n scaled[index] =\n ((row[index] as number) - (preprocess.offset[index] as number)) /\n (preprocess.scale[index] as number);\n }\n return scaled;\n }\n\n /**\n * Score one row against the coefficient matrix.\n *\n * @param row The prepared feature values.\n * @returns One raw score per output.\n */\n private linearScores(row: readonly number[]): number[] {\n const coef = this.arrays.coef as Float32Array;\n const intercept = this.arrays.intercept as Float32Array;\n const features = this.header.n_features;\n const outputs = this.header.n_outputs;\n\n const scores = new Array<number>(outputs);\n for (let output = 0; output < outputs; output += 1) {\n let total = intercept[output] as number;\n const base = output * features;\n for (let index = 0; index < features; index += 1) {\n total += (coef[base + index] as number) * (row[index] as number);\n }\n scores[output] = total;\n }\n return scores;\n }\n\n /**\n * Walk every tree and average what the leaves hold.\n *\n * A leaf is marked by a negative `feature` entry, which also carries\n * its slot in the value array — so the walk needs no second lookup and\n * the file stores values only for leaves.\n *\n * **The comparison runs in float32** (`Math.fround`), because that is\n * what scikit-learn does: it casts its input to float32 before\n * traversing, so a threshold like 5.099999904632568 — a float32 value\n * widened for storage — and an input of 5.1 compare *equal* and go\n * left. Comparing in float64 sends that row right instead, which on an\n * iris forest changed one tree's vote and moved a probability by 0.05.\n *\n * @param row The prepared feature values.\n * @returns One averaged score per output.\n */\n private treeScores(row: readonly number[]): number[] {\n const feature = this.arrays.node_feature as Int32Array;\n const threshold = this.arrays.node_threshold as Float32Array;\n const left = this.arrays.node_left as Int32Array;\n const right = this.arrays.node_right as Int32Array;\n const leaf = this.arrays.leaf_value as Float32Array;\n const offsets = this.arrays.tree_offset as Int32Array;\n const outputs = this.header.n_outputs;\n const trees = offsets.length - 1;\n\n const totals = new Array<number>(outputs).fill(0);\n for (let tree = 0; tree < trees; tree += 1) {\n let node = offsets[tree] as number;\n let column = feature[node] as number;\n while (column >= 0) {\n node =\n Math.fround(row[column] as number) <= (threshold[node] as number)\n ? (left[node] as number)\n : (right[node] as number);\n column = feature[node] as number;\n }\n const slot = (-1 - column) * outputs;\n for (let output = 0; output < outputs; output += 1) {\n totals[output] += leaf[slot + output] as number;\n }\n }\n for (let output = 0; output < outputs; output += 1) {\n totals[output] = (totals[output] as number) / trees;\n }\n return totals;\n }\n\n /**\n * Turn raw scores into labels and probabilities.\n *\n * @param scores One score array per row.\n * @returns Labels and probabilities in the shape the ONNX route uses,\n * so an app can swap runtimes without touching its own code. That\n * includes the label's **type**: an integer class comes back as a\n * number here exactly as ONNX returns it, because two routes over one\n * model that disagree on `0` versus `\"0\"` break the day someone\n * switches.\n */\n private finish(scores: readonly number[][]): {\n labels: PredictedLabel[];\n probabilities: number[][];\n } {\n const link = this.header.link;\n const classes = this.header.classes;\n\n if (link === \"identity\") {\n return { labels: scores.map((row) => row[0] as number), probabilities: [] };\n }\n\n const probabilities = scores.map((row) => {\n if (link === \"sigmoid\") {\n const positive = 1 / (1 + Math.exp(-(row[0] as number)));\n return [1 - positive, positive];\n }\n if (link === \"softmax\") {\n const highest = Math.max(...row);\n const exponentiated = row.map((value) => Math.exp(value - highest));\n const total = exponentiated.reduce((sum, value) => sum + value, 0);\n return exponentiated.map((value) => value / total);\n }\n const total = row.reduce((sum, value) => sum + value, 0);\n return total === 0 ? [...row] : row.map((value) => value / total);\n });\n\n const numeric = this.header.class_type !== \"str\";\n const labels = probabilities.map((row) => {\n let best = 0;\n for (let index = 1; index < row.length; index += 1) {\n if ((row[index] as number) > (row[best] as number)) best = index;\n }\n const label = classes[best];\n if (label === undefined) return best;\n return numeric ? Number(label) : label;\n });\n\n return { labels, probabilities };\n }\n}\n\n/**\n * Read a source into an `ArrayBuffer`.\n *\n * @param source A URL or the bytes.\n * @param requestInit `fetch` options.\n * @returns The bytes.\n * @throws {@link ModelFetchError} when the URL cannot be read.\n */\nasync function toBuffer(\n source: string | ArrayBuffer | Uint8Array,\n requestInit?: RequestInit,\n): Promise<ArrayBuffer> {\n if (typeof source === \"string\") {\n let response: Response;\n try {\n response = await fetch(source, requestInit);\n } catch (error) {\n throw new ModelFetchError(`Could not download the model: ${source}`, {\n cause: error,\n });\n }\n if (!response.ok) {\n throw new ModelFetchError(\n `Could not download the model: ${response.status} ${response.statusText}`,\n );\n }\n return await response.arrayBuffer();\n }\n if (source instanceof Uint8Array) {\n return source.buffer.slice(\n source.byteOffset,\n source.byteOffset + source.byteLength,\n ) as ArrayBuffer;\n }\n return source;\n}\n\n/**\n * Check a batch before predicting on it.\n *\n * @param rows The batch.\n * @param expected Features the model wants per row.\n * @returns The batch width.\n * @throws {@link FeatureShapeError} when the batch cannot be predicted on.\n */\nfunction validateRows(rows: readonly FeatureRow[], expected: number): number {\n if (!Array.isArray(rows) || rows.length === 0) {\n throw new FeatureShapeError(\"predict() needs at least one row, shaped [[f1, f2, ...]].\");\n }\n const width = rows[0]?.length ?? 0;\n const ragged = rows.findIndex((row) => row.length !== width);\n if (ragged !== -1) {\n throw new FeatureShapeError(\n `All rows must have the same width; row ${ragged} has ` +\n `${rows[ragged]?.length} values, expected ${width}.`,\n );\n }\n if (width !== expected) {\n throw new FeatureShapeError(\n `The model expects ${expected} features per row, got ${width}.`,\n );\n }\n return width;\n}\n"],"mappings":"oCAkCA,IAAM,EAAQ,OA+DD,EAAb,MAAa,CAAiB,CAEL,OACA,OAED,KAJpB,YACI,EACA,EAEA,EACF,CAJmB,KAAA,OAAA,EACA,KAAA,OAAA,EAED,KAAA,KAAA,CACjB,CAYH,aAAa,OACT,EACA,EACyB,CACzB,IAAM,EAAS,MAAM,EAAS,EAAQ,CAAW,EAC3C,EAAQ,IAAI,WAAW,CAAM,EAEnC,GAAI,OAAO,aAAa,GAAG,EAAM,SAAS,EAAG,CAAC,CAAC,IAAM,EACjD,MAAM,IAAI,EAAA,mBACN,6DACQ,EAAM,uDAClB,EAIJ,IAAM,EAAe,IADJ,SAAS,CACL,CAAA,CAAK,UAAU,EAAG,EAAI,EACrC,EAAS,KAAK,MAChB,IAAI,YAAY,CAAC,CAAC,OAAO,EAAM,SAAS,EAAG,EAAI,CAAY,CAAC,CAChE,EAEA,GAAI,EAAO,eAAA,EACP,MAAM,IAAI,EAAA,mBACN,iCAAiC,EAAO,eAAe,2EAG3D,EAGJ,IAAM,EAA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C,MAAM,QAAQ,CAAI,GAAK,EAAK,SAAW,EACxC,MAAM,IAAI,EAAA,kBAAkB,2DAA2D,EAE3F,IAAM,EAAQ,EAAK,EAAE,EAAE,QAAU,EAC3B,EAAS,EAAK,UAAW,GAAQ,EAAI,SAAW,CAAK,EAC3D,GAAI,IAAW,GACX,MAAM,IAAI,EAAA,kBACN,0CAA0C,EAAO,OAC1C,EAAK,EAAO,EAAE,OAAO,oBAAoB,EAAM,EAC1D,EAEJ,GAAI,IAAU,EACV,MAAM,IAAI,EAAA,kBACN,qBAAqB,EAAS,yBAAyB,EAAM,EACjE,EAEJ,OAAO,CACX"}
|
|
1
|
+
{"version":3,"file":"compact.cjs","names":["CompactFormatError","ModelFetchError","FeatureShapeError","require_exceptions","MAGIC","CompactPredictor","header","arrays","info","buffer","toBuffer","source","requestInit","bytes","headerLength","cursor","section","width","validateRows","rows","started","scores","row","prepared","preprocess","scaled","index","coef","intercept","features","outputs","output","total","base","feature","threshold","left","right","leaf","offsets","trees","totals","tree","node","column","slot","link","classes","probabilities","positive","highest","exponentiated","value","sum","numeric","best","label","response","error","ragged","expected"],"sources":["../../src/tabular/compact.ts"],"sourcesContent":["/**\n * @tempest-limits file-lines — the compact model format: the header, the column\n * dictionary, the quantised weights and the decoder that reads them back. Writer and\n * reader in one file because a format whose two halves live apart drifts.\n */\n/**\n * Running a model with no inference runtime at all.\n *\n * ONNX in the browser costs a **25.6 MB WebAssembly runtime** (6.0 MB\n * gzipped) before the first prediction, while the model itself is a few\n * hundred kilobytes. For an app whose only model is tabular, that runtime\n * *is* the download — so this reader replaces it with 1.49 KB of\n * arithmetic (measured, brotli).\n *\n * A linear model is a dot product. A tree is a chain of comparisons. That\n * is the whole implementation; there is nothing here that a WebAssembly\n * kernel would do better at this size.\n *\n * The file it reads (`.tmc`, magic `TMC1`) is written by\n * `tempest-fastapi-sdk`'s `export_sklearn_to_compact`, which verifies the\n * bytes against scikit-learn's own predictions and refuses to write a file\n * that disagrees. **It is data, not code**: no `eval`, no generated\n * JavaScript, nothing a strict CSP forbids.\n *\n * The trade against {@link TabularPredictor}: ONNX covers every estimator,\n * this covers linear models and tree ensembles. Pick by what your app\n * already ships — a page that loads ONNX for vision pays nothing extra for\n * tabular ONNX.\n */\n\nimport { CompactFormatError, FeatureShapeError, ModelFetchError } from \"./exceptions\";\nimport type { FeatureRow, PredictedLabel, TabularPrediction } from \"./types\";\n\n/** Magic bytes opening every compact file. */\nconst MAGIC = \"TMC1\";\n\n/** Layout version this reader understands. */\nexport const SUPPORTED_COMPACT_SCHEMA = 1;\n\n/** What the file holds. */\nexport type CompactKind = \"linear\" | \"tree_ensemble\";\n\n/** How raw scores become probabilities. */\ntype CompactLink = \"softmax\" | \"sigmoid\" | \"normalize\" | \"identity\";\n\n/** One array stored after the header. */\ninterface CompactSection {\n readonly name: string;\n readonly dtype: \"float32\" | \"int32\";\n readonly length: number;\n}\n\n/** The parsed header. */\ninterface CompactHeader {\n readonly schema_version: number;\n readonly kind: CompactKind;\n readonly task: \"classification\" | \"regression\";\n readonly link: CompactLink;\n readonly classes: readonly string[];\n /** How scikit-learn typed those labels: ``int``, ``float`` or ``str``. */\n readonly class_type?: \"int\" | \"float\" | \"str\";\n readonly n_features: number;\n readonly n_outputs: number;\n readonly n_trees?: number;\n readonly estimator: string;\n readonly feature_names: readonly string[];\n readonly preprocess: { readonly offset: number[]; readonly scale: number[] } | null;\n readonly sections: readonly CompactSection[];\n}\n\n/** What a loaded compact model is. */\nexport interface CompactPredictorInfo {\n /** Which reader path the file uses. */\n readonly kind: CompactKind;\n /** Class labels in score-column order; empty for a regressor. */\n readonly classes: readonly string[];\n /** Values expected per row. */\n readonly numFeatures: number;\n /** Column order recorded at training time, when the export had one. */\n readonly featureNames: readonly string[];\n /** Trees in the ensemble; `0` for a linear model. */\n readonly numTrees: number;\n /** Whether the model produces class scores. */\n readonly isClassifier: boolean;\n /** Class name of the exported estimator. */\n readonly estimator: string;\n}\n\n/**\n * A compact model, loaded and ready to answer.\n *\n * @example\n * ```ts\n * const predictor = await CompactPredictor.create(\"/models/risk.tmc\");\n * const { labels, probabilities } = await predictor.predict([[5.1, 3.5, 1.4, 0.2]]);\n * ```\n */\nexport class CompactPredictor {\n private constructor(\n private readonly header: CompactHeader,\n private readonly arrays: Record<string, Float32Array | Int32Array>,\n /** What is loaded. */\n public readonly info: CompactPredictorInfo,\n ) {}\n\n /**\n * Load a `.tmc` file.\n *\n * @param source A URL, or the bytes when the app already has them.\n * @param requestInit `fetch` options, when `source` is a URL.\n * @returns The loaded predictor.\n * @throws {@link ModelFetchError} when a URL cannot be read.\n * @throws {@link CompactFormatError} when the bytes are not a compact\n * model, or use a layout newer than this reader.\n */\n static async create(\n source: string | ArrayBuffer | Uint8Array,\n requestInit?: RequestInit,\n ): Promise<CompactPredictor> {\n const buffer = await toBuffer(source, requestInit);\n const bytes = new Uint8Array(buffer);\n\n if (String.fromCharCode(...bytes.subarray(0, 4)) !== MAGIC) {\n throw new CompactFormatError(\n \"This is not a compact model file: it does not start with \" +\n `\"${MAGIC}\". A .onnx file goes through TabularPredictor instead.`,\n );\n }\n\n const view = new DataView(buffer);\n const headerLength = view.getUint32(4, true);\n const header = JSON.parse(\n new TextDecoder().decode(bytes.subarray(8, 8 + headerLength)),\n ) as CompactHeader;\n\n if (header.schema_version > SUPPORTED_COMPACT_SCHEMA) {\n throw new CompactFormatError(\n `This file uses compact layout ${header.schema_version}, and this ` +\n `SDK understands ${SUPPORTED_COMPACT_SCHEMA}. Upgrade ` +\n \"tempest-react-sdk before serving it.\",\n );\n }\n\n const arrays: Record<string, Float32Array | Int32Array> = {};\n let cursor = 8 + headerLength;\n for (const section of header.sections) {\n arrays[section.name] =\n section.dtype === \"float32\"\n ? new Float32Array(buffer, cursor, section.length)\n : new Int32Array(buffer, cursor, section.length);\n cursor += section.length * 4;\n }\n\n return new CompactPredictor(header, arrays, {\n kind: header.kind,\n classes: header.classes,\n numFeatures: header.n_features,\n featureNames: header.feature_names,\n numTrees: header.n_trees ?? 0,\n isClassifier: header.task === \"classification\",\n estimator: header.estimator,\n });\n }\n\n /**\n * Predict for a batch of rows.\n *\n * @param rows One array of feature values per row, in training column\n * order. A single row is still wrapped: `[[...]]`.\n * @returns Labels, class scores when the model is a classifier, and the\n * call's duration.\n * @throws {@link FeatureShapeError} when the batch is empty, ragged, or\n * the wrong width.\n */\n async predict(rows: readonly FeatureRow[]): Promise<TabularPrediction> {\n const width = validateRows(rows, this.header.n_features);\n const started = performance.now();\n\n const scores: number[][] = [];\n for (const row of rows) {\n const prepared = this.preprocess(row, width);\n scores.push(\n this.header.kind === \"linear\"\n ? this.linearScores(prepared)\n : this.treeScores(prepared),\n );\n }\n\n const { labels, probabilities } = this.finish(scores);\n return {\n labels,\n probabilities,\n numRows: rows.length,\n ms: performance.now() - started,\n };\n }\n\n /** Releasing nothing, so callers can swap predictors without branching. */\n async dispose(): Promise<void> {\n /* no runtime, nothing to release */\n }\n\n /**\n * Apply the folded scaler, when the export had one.\n *\n * @param row The raw feature values.\n * @param width How many there are.\n * @returns The values the model was trained on.\n */\n private preprocess(row: FeatureRow, width: number): number[] {\n const preprocess = this.header.preprocess;\n if (preprocess === null) return row as number[];\n const scaled = new Array<number>(width);\n for (let index = 0; index < width; index += 1) {\n scaled[index] =\n ((row[index] as number) - (preprocess.offset[index] as number)) /\n (preprocess.scale[index] as number);\n }\n return scaled;\n }\n\n /**\n * Score one row against the coefficient matrix.\n *\n * @param row The prepared feature values.\n * @returns One raw score per output.\n */\n private linearScores(row: readonly number[]): number[] {\n const coef = this.arrays.coef as Float32Array;\n const intercept = this.arrays.intercept as Float32Array;\n const features = this.header.n_features;\n const outputs = this.header.n_outputs;\n\n const scores = new Array<number>(outputs);\n for (let output = 0; output < outputs; output += 1) {\n let total = intercept[output] as number;\n const base = output * features;\n for (let index = 0; index < features; index += 1) {\n total += (coef[base + index] as number) * (row[index] as number);\n }\n scores[output] = total;\n }\n return scores;\n }\n\n /**\n * Walk every tree and average what the leaves hold.\n *\n * A leaf is marked by a negative `feature` entry, which also carries\n * its slot in the value array — so the walk needs no second lookup and\n * the file stores values only for leaves.\n *\n * **The comparison runs in float32** (`Math.fround`), because that is\n * what scikit-learn does: it casts its input to float32 before\n * traversing, so a threshold like 5.099999904632568 — a float32 value\n * widened for storage — and an input of 5.1 compare *equal* and go\n * left. Comparing in float64 sends that row right instead, which on an\n * iris forest changed one tree's vote and moved a probability by 0.05.\n *\n * @param row The prepared feature values.\n * @returns One averaged score per output.\n */\n private treeScores(row: readonly number[]): number[] {\n const feature = this.arrays.node_feature as Int32Array;\n const threshold = this.arrays.node_threshold as Float32Array;\n const left = this.arrays.node_left as Int32Array;\n const right = this.arrays.node_right as Int32Array;\n const leaf = this.arrays.leaf_value as Float32Array;\n const offsets = this.arrays.tree_offset as Int32Array;\n const outputs = this.header.n_outputs;\n const trees = offsets.length - 1;\n\n const totals = new Array<number>(outputs).fill(0);\n for (let tree = 0; tree < trees; tree += 1) {\n let node = offsets[tree] as number;\n let column = feature[node] as number;\n while (column >= 0) {\n node =\n Math.fround(row[column] as number) <= (threshold[node] as number)\n ? (left[node] as number)\n : (right[node] as number);\n column = feature[node] as number;\n }\n const slot = (-1 - column) * outputs;\n for (let output = 0; output < outputs; output += 1) {\n totals[output] += leaf[slot + output] as number;\n }\n }\n for (let output = 0; output < outputs; output += 1) {\n totals[output] = (totals[output] as number) / trees;\n }\n return totals;\n }\n\n /**\n * Turn raw scores into labels and probabilities.\n *\n * @param scores One score array per row.\n * @returns Labels and probabilities in the shape the ONNX route uses,\n * so an app can swap runtimes without touching its own code. That\n * includes the label's **type**: an integer class comes back as a\n * number here exactly as ONNX returns it, because two routes over one\n * model that disagree on `0` versus `\"0\"` break the day someone\n * switches.\n */\n private finish(scores: readonly number[][]): {\n labels: PredictedLabel[];\n probabilities: number[][];\n } {\n const link = this.header.link;\n const classes = this.header.classes;\n\n if (link === \"identity\") {\n return { labels: scores.map((row) => row[0] as number), probabilities: [] };\n }\n\n const probabilities = scores.map((row) => {\n if (link === \"sigmoid\") {\n const positive = 1 / (1 + Math.exp(-(row[0] as number)));\n return [1 - positive, positive];\n }\n if (link === \"softmax\") {\n const highest = Math.max(...row);\n const exponentiated = row.map((value) => Math.exp(value - highest));\n const total = exponentiated.reduce((sum, value) => sum + value, 0);\n return exponentiated.map((value) => value / total);\n }\n const total = row.reduce((sum, value) => sum + value, 0);\n return total === 0 ? [...row] : row.map((value) => value / total);\n });\n\n const numeric = this.header.class_type !== \"str\";\n const labels = probabilities.map((row) => {\n let best = 0;\n for (let index = 1; index < row.length; index += 1) {\n if ((row[index] as number) > (row[best] as number)) best = index;\n }\n const label = classes[best];\n if (label === undefined) return best;\n return numeric ? Number(label) : label;\n });\n\n return { labels, probabilities };\n }\n}\n\n/**\n * Read a source into an `ArrayBuffer`.\n *\n * @param source A URL or the bytes.\n * @param requestInit `fetch` options.\n * @returns The bytes.\n * @throws {@link ModelFetchError} when the URL cannot be read.\n */\nasync function toBuffer(\n source: string | ArrayBuffer | Uint8Array,\n requestInit?: RequestInit,\n): Promise<ArrayBuffer> {\n if (typeof source === \"string\") {\n let response: Response;\n try {\n response = await fetch(source, requestInit);\n } catch (error) {\n throw new ModelFetchError(`Could not download the model: ${source}`, {\n cause: error,\n });\n }\n if (!response.ok) {\n throw new ModelFetchError(\n `Could not download the model: ${response.status} ${response.statusText}`,\n );\n }\n return await response.arrayBuffer();\n }\n if (source instanceof Uint8Array) {\n return source.buffer.slice(\n source.byteOffset,\n source.byteOffset + source.byteLength,\n ) as ArrayBuffer;\n }\n return source;\n}\n\n/**\n * Check a batch before predicting on it.\n *\n * @param rows The batch.\n * @param expected Features the model wants per row.\n * @returns The batch width.\n * @throws {@link FeatureShapeError} when the batch cannot be predicted on.\n */\nfunction validateRows(rows: readonly FeatureRow[], expected: number): number {\n if (!Array.isArray(rows) || rows.length === 0) {\n throw new FeatureShapeError(\"predict() needs at least one row, shaped [[f1, f2, ...]].\");\n }\n const width = rows[0]?.length ?? 0;\n const ragged = rows.findIndex((row) => row.length !== width);\n if (ragged !== -1) {\n throw new FeatureShapeError(\n `All rows must have the same width; row ${ragged} has ` +\n `${rows[ragged]?.length} values, expected ${width}.`,\n );\n }\n if (width !== expected) {\n throw new FeatureShapeError(\n `The model expects ${expected} features per row, got ${width}.`,\n );\n }\n return width;\n}\n"],"mappings":"A,oCAkCA,IAAMI,EAAQ,OA+DDC,EAAb,MAAaA,CAAiB,CAEL,OACA,OAED,KAJpB,YACI,EACA,EAEA,EACF,CAJmB,KAAA,OAAAC,EACA,KAAA,OAAAC,EAED,KAAA,KAAAC,CACjB,CAYH,aAAa,OACT,EACA,EACyB,CACzB,IAAMC,EAAS,MAAMC,EAASC,EAAQC,CAAW,EAC3CC,EAAQ,IAAI,WAAWJ,CAAM,EAEnC,GAAI,OAAO,aAAa,GAAGI,EAAM,SAAS,EAAG,CAAC,CAAC,IAAMT,EACjD,MAAM,IAAIJ,EAAAA,mBACN,6DACQI,EAAM,uDAClB,EAIJ,IAAMU,EAAe,IADJ,SAASL,CACL,CAAA,CAAK,UAAU,EAAG,EAAI,EACrCH,EAAS,KAAK,MAChB,IAAI,YAAY,CAAC,CAAC,OAAOO,EAAM,SAAS,EAAG,EAAIC,CAAY,CAAC,CAChE,EAEA,GAAIR,EAAO,eAAA,EACP,MAAM,IAAIN,EAAAA,mBACN,iCAAiCM,EAAO,eAAe,2EAG3D,EAGJ,IAAMC,EAAoD,CAAC,EACvDQ,EAAS,EAAID,EACjB,IAAK,IAAME,KAAWV,EAAO,SACzB,EAAOU,EAAQ,MACXA,EAAQ,QAAU,UACZ,IAAI,aAAaP,EAAQM,EAAQC,EAAQ,MAAM,EAC/C,IAAI,WAAWP,EAAQM,EAAQC,EAAQ,MAAM,EACvD,GAAUA,EAAQ,OAAS,EAG/B,OAAO,IAAIX,EAAiBC,EAAQC,EAAQ,CACxC,KAAMD,EAAO,KACb,QAASA,EAAO,QAChB,YAAaA,EAAO,WACpB,aAAcA,EAAO,cACrB,SAAUA,EAAO,S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EAAE,EAAE,QAAU,EAC3BwC,EAASxC,EAAK,UAAW,GAAQG,EAAI,SAAWL,CAAK,EAC3D,GAAI0C,IAAW,GACX,MAAM,IAAIzD,EAAAA,kBACN,0CAA0CyD,EAAO,OAC1CxC,EAAKwC,EAAO,EAAE,OAAO,oBAAoB1C,EAAM,EAC1D,EAEJ,GAAIA,IAAU2C,EACV,MAAM,IAAI1D,EAAAA,kBACN,qBAAqB0D,EAAS,yBAAyB3C,EAAM,EACjE,EAEJ,OAAOA,CACX,C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compact.js","names":[],"sources":["../../src/tabular/compact.ts"],"sourcesContent":["/**\n * @tempest-limits file-lines — the compact model format: the header, the column\n * dictionary, the quantised weights and the decoder that reads them back. Writer and\n * reader in one file because a format whose two halves live apart drifts.\n */\n/**\n * Running a model with no inference runtime at all.\n *\n * ONNX in the browser costs a **25.6 MB WebAssembly runtime** (6.0 MB\n * gzipped) before the first prediction, while the model itself is a few\n * hundred kilobytes. For an app whose only model is tabular, that runtime\n * *is* the download — so this reader replaces it with 1.49 KB of\n * arithmetic (measured, brotli).\n *\n * A linear model is a dot product. A tree is a chain of comparisons. That\n * is the whole implementation; there is nothing here that a WebAssembly\n * kernel would do better at this size.\n *\n * The file it reads (`.tmc`, magic `TMC1`) is written by\n * `tempest-fastapi-sdk`'s `export_sklearn_to_compact`, which verifies the\n * bytes against scikit-learn's own predictions and refuses to write a file\n * that disagrees. **It is data, not code**: no `eval`, no generated\n * JavaScript, nothing a strict CSP forbids.\n *\n * The trade against {@link TabularPredictor}: ONNX covers every estimator,\n * this covers linear models and tree ensembles. Pick by what your app\n * already ships — a page that loads ONNX for vision pays nothing extra for\n * tabular ONNX.\n */\n\nimport { CompactFormatError, FeatureShapeError, ModelFetchError } from \"./exceptions\";\nimport type { FeatureRow, PredictedLabel, TabularPrediction } from \"./types\";\n\n/** Magic bytes opening every compact file. */\nconst MAGIC = \"TMC1\";\n\n/** Layout version this reader understands. */\nexport const SUPPORTED_COMPACT_SCHEMA = 1;\n\n/** What the file holds. */\nexport type CompactKind = \"linear\" | \"tree_ensemble\";\n\n/** How raw scores become probabilities. */\ntype CompactLink = \"softmax\" | \"sigmoid\" | \"normalize\" | \"identity\";\n\n/** One array stored after the header. */\ninterface CompactSection {\n readonly name: string;\n readonly dtype: \"float32\" | \"int32\";\n readonly length: number;\n}\n\n/** The parsed header. */\ninterface CompactHeader {\n readonly schema_version: number;\n readonly kind: CompactKind;\n readonly task: \"classification\" | \"regression\";\n readonly link: CompactLink;\n readonly classes: readonly string[];\n /** How scikit-learn typed those labels: ``int``, ``float`` or ``str``. */\n readonly class_type?: \"int\" | \"float\" | \"str\";\n readonly n_features: number;\n readonly n_outputs: number;\n readonly n_trees?: number;\n readonly estimator: string;\n readonly feature_names: readonly string[];\n readonly preprocess: { readonly offset: number[]; readonly scale: number[] } | null;\n readonly sections: readonly CompactSection[];\n}\n\n/** What a loaded compact model is. */\nexport interface CompactPredictorInfo {\n /** Which reader path the file uses. */\n readonly kind: CompactKind;\n /** Class labels in score-column order; empty for a regressor. */\n readonly classes: readonly string[];\n /** Values expected per row. */\n readonly numFeatures: number;\n /** Column order recorded at training time, when the export had one. */\n readonly featureNames: readonly string[];\n /** Trees in the ensemble; `0` for a linear model. */\n readonly numTrees: number;\n /** Whether the model produces class scores. */\n readonly isClassifier: boolean;\n /** Class name of the exported estimator. */\n readonly estimator: string;\n}\n\n/**\n * A compact model, loaded and ready to answer.\n *\n * @example\n * ```ts\n * const predictor = await CompactPredictor.create(\"/models/risk.tmc\");\n * const { labels, probabilities } = await predictor.predict([[5.1, 3.5, 1.4, 0.2]]);\n * ```\n */\nexport class CompactPredictor {\n private constructor(\n private readonly header: CompactHeader,\n private readonly arrays: Record<string, Float32Array | Int32Array>,\n /** What is loaded. */\n public readonly info: CompactPredictorInfo,\n ) {}\n\n /**\n * Load a `.tmc` file.\n *\n * @param source A URL, or the bytes when the app already has them.\n * @param requestInit `fetch` options, when `source` is a URL.\n * @returns The loaded predictor.\n * @throws {@link ModelFetchError} when a URL cannot be read.\n * @throws {@link CompactFormatError} when the bytes are not a compact\n * model, or use a layout newer than this reader.\n */\n static async create(\n source: string | ArrayBuffer | Uint8Array,\n requestInit?: RequestInit,\n ): Promise<CompactPredictor> {\n const buffer = await toBuffer(source, requestInit);\n const bytes = new Uint8Array(buffer);\n\n if (String.fromCharCode(...bytes.subarray(0, 4)) !== MAGIC) {\n throw new CompactFormatError(\n \"This is not a compact model file: it does not start with \" +\n `\"${MAGIC}\". A .onnx file goes through TabularPredictor instead.`,\n );\n }\n\n const view = new DataView(buffer);\n const headerLength = view.getUint32(4, true);\n const header = JSON.parse(\n new TextDecoder().decode(bytes.subarray(8, 8 + headerLength)),\n ) as CompactHeader;\n\n if (header.schema_version > SUPPORTED_COMPACT_SCHEMA) {\n throw new CompactFormatError(\n `This file uses compact layout ${header.schema_version}, and this ` +\n `SDK understands ${SUPPORTED_COMPACT_SCHEMA}. Upgrade ` +\n \"tempest-react-sdk before serving it.\",\n );\n }\n\n const arrays: Record<string, Float32Array | Int32Array> = {};\n let cursor = 8 + headerLength;\n for (const section of header.sections) {\n arrays[section.name] =\n section.dtype === \"float32\"\n ? new Float32Array(buffer, cursor, section.length)\n : new Int32Array(buffer, cursor, section.length);\n cursor += section.length * 4;\n }\n\n return new CompactPredictor(header, arrays, {\n kind: header.kind,\n classes: header.classes,\n numFeatures: header.n_features,\n featureNames: header.feature_names,\n numTrees: header.n_trees ?? 0,\n isClassifier: header.task === \"classification\",\n estimator: header.estimator,\n });\n }\n\n /**\n * Predict for a batch of rows.\n *\n * @param rows One array of feature values per row, in training column\n * order. A single row is still wrapped: `[[...]]`.\n * @returns Labels, class scores when the model is a classifier, and the\n * call's duration.\n * @throws {@link FeatureShapeError} when the batch is empty, ragged, or\n * the wrong width.\n */\n async predict(rows: readonly FeatureRow[]): Promise<TabularPrediction> {\n const width = validateRows(rows, this.header.n_features);\n const started = performance.now();\n\n const scores: number[][] = [];\n for (const row of rows) {\n const prepared = this.preprocess(row, width);\n scores.push(\n this.header.kind === \"linear\"\n ? this.linearScores(prepared)\n : this.treeScores(prepared),\n );\n }\n\n const { labels, probabilities } = this.finish(scores);\n return {\n labels,\n probabilities,\n numRows: rows.length,\n ms: performance.now() - started,\n };\n }\n\n /** Releasing nothing, so callers can swap predictors without branching. */\n async dispose(): Promise<void> {\n /* no runtime, nothing to release */\n }\n\n /**\n * Apply the folded scaler, when the export had one.\n *\n * @param row The raw feature values.\n * @param width How many there are.\n * @returns The values the model was trained on.\n */\n private preprocess(row: FeatureRow, width: number): number[] {\n const preprocess = this.header.preprocess;\n if (preprocess === null) return row as number[];\n const scaled = new Array<number>(width);\n for (let index = 0; index < width; index += 1) {\n scaled[index] =\n ((row[index] as number) - (preprocess.offset[index] as number)) /\n (preprocess.scale[index] as number);\n }\n return scaled;\n }\n\n /**\n * Score one row against the coefficient matrix.\n *\n * @param row The prepared feature values.\n * @returns One raw score per output.\n */\n private linearScores(row: readonly number[]): number[] {\n const coef = this.arrays.coef as Float32Array;\n const intercept = this.arrays.intercept as Float32Array;\n const features = this.header.n_features;\n const outputs = this.header.n_outputs;\n\n const scores = new Array<number>(outputs);\n for (let output = 0; output < outputs; output += 1) {\n let total = intercept[output] as number;\n const base = output * features;\n for (let index = 0; index < features; index += 1) {\n total += (coef[base + index] as number) * (row[index] as number);\n }\n scores[output] = total;\n }\n return scores;\n }\n\n /**\n * Walk every tree and average what the leaves hold.\n *\n * A leaf is marked by a negative `feature` entry, which also carries\n * its slot in the value array — so the walk needs no second lookup and\n * the file stores values only for leaves.\n *\n * **The comparison runs in float32** (`Math.fround`), because that is\n * what scikit-learn does: it casts its input to float32 before\n * traversing, so a threshold like 5.099999904632568 — a float32 value\n * widened for storage — and an input of 5.1 compare *equal* and go\n * left. Comparing in float64 sends that row right instead, which on an\n * iris forest changed one tree's vote and moved a probability by 0.05.\n *\n * @param row The prepared feature values.\n * @returns One averaged score per output.\n */\n private treeScores(row: readonly number[]): number[] {\n const feature = this.arrays.node_feature as Int32Array;\n const threshold = this.arrays.node_threshold as Float32Array;\n const left = this.arrays.node_left as Int32Array;\n const right = this.arrays.node_right as Int32Array;\n const leaf = this.arrays.leaf_value as Float32Array;\n const offsets = this.arrays.tree_offset as Int32Array;\n const outputs = this.header.n_outputs;\n const trees = offsets.length - 1;\n\n const totals = new Array<number>(outputs).fill(0);\n for (let tree = 0; tree < trees; tree += 1) {\n let node = offsets[tree] as number;\n let column = feature[node] as number;\n while (column >= 0) {\n node =\n Math.fround(row[column] as number) <= (threshold[node] as number)\n ? (left[node] as number)\n : (right[node] as number);\n column = feature[node] as number;\n }\n const slot = (-1 - column) * outputs;\n for (let output = 0; output < outputs; output += 1) {\n totals[output] += leaf[slot + output] as number;\n }\n }\n for (let output = 0; output < outputs; output += 1) {\n totals[output] = (totals[output] as number) / trees;\n }\n return totals;\n }\n\n /**\n * Turn raw scores into labels and probabilities.\n *\n * @param scores One score array per row.\n * @returns Labels and probabilities in the shape the ONNX route uses,\n * so an app can swap runtimes without touching its own code. That\n * includes the label's **type**: an integer class comes back as a\n * number here exactly as ONNX returns it, because two routes over one\n * model that disagree on `0` versus `\"0\"` break the day someone\n * switches.\n */\n private finish(scores: readonly number[][]): {\n labels: PredictedLabel[];\n probabilities: number[][];\n } {\n const link = this.header.link;\n const classes = this.header.classes;\n\n if (link === \"identity\") {\n return { labels: scores.map((row) => row[0] as number), probabilities: [] };\n }\n\n const probabilities = scores.map((row) => {\n if (link === \"sigmoid\") {\n const positive = 1 / (1 + Math.exp(-(row[0] as number)));\n return [1 - positive, positive];\n }\n if (link === \"softmax\") {\n const highest = Math.max(...row);\n const exponentiated = row.map((value) => Math.exp(value - highest));\n const total = exponentiated.reduce((sum, value) => sum + value, 0);\n return exponentiated.map((value) => value / total);\n }\n const total = row.reduce((sum, value) => sum + value, 0);\n return total === 0 ? [...row] : row.map((value) => value / total);\n });\n\n const numeric = this.header.class_type !== \"str\";\n const labels = probabilities.map((row) => {\n let best = 0;\n for (let index = 1; index < row.length; index += 1) {\n if ((row[index] as number) > (row[best] as number)) best = index;\n }\n const label = classes[best];\n if (label === undefined) return best;\n return numeric ? Number(label) : label;\n });\n\n return { labels, probabilities };\n }\n}\n\n/**\n * Read a source into an `ArrayBuffer`.\n *\n * @param source A URL or the bytes.\n * @param requestInit `fetch` options.\n * @returns The bytes.\n * @throws {@link ModelFetchError} when the URL cannot be read.\n */\nasync function toBuffer(\n source: string | ArrayBuffer | Uint8Array,\n requestInit?: RequestInit,\n): Promise<ArrayBuffer> {\n if (typeof source === \"string\") {\n let response: Response;\n try {\n response = await fetch(source, requestInit);\n } catch (error) {\n throw new ModelFetchError(`Could not download the model: ${source}`, {\n cause: error,\n });\n }\n if (!response.ok) {\n throw new ModelFetchError(\n `Could not download the model: ${response.status} ${response.statusText}`,\n );\n }\n return await response.arrayBuffer();\n }\n if (source instanceof Uint8Array) {\n return source.buffer.slice(\n source.byteOffset,\n source.byteOffset + source.byteLength,\n ) as ArrayBuffer;\n }\n return source;\n}\n\n/**\n * Check a batch before predicting on it.\n *\n * @param rows The batch.\n * @param expected Features the model wants per row.\n * @returns The batch width.\n * @throws {@link FeatureShapeError} when the batch cannot be predicted on.\n */\nfunction validateRows(rows: readonly FeatureRow[], expected: number): number {\n if (!Array.isArray(rows) || rows.length === 0) {\n throw new FeatureShapeError(\"predict() needs at least one row, shaped [[f1, f2, ...]].\");\n }\n const width = rows[0]?.length ?? 0;\n const ragged = rows.findIndex((row) => row.length !== width);\n if (ragged !== -1) {\n throw new FeatureShapeError(\n `All rows must have the same width; row ${ragged} has ` +\n `${rows[ragged]?.length} values, expected ${width}.`,\n );\n }\n if (width !== expected) {\n throw new FeatureShapeError(\n `The model expects ${expected} features per row, got ${width}.`,\n );\n }\n return width;\n}\n"],"mappings":";;AAkCA,IAAM,IAAQ,QA+DD,IAAb,MAAa,EAAiB;CAEL;CACA;CAED;CAJpB,YACI,GACA,GAEA,GACF;EADkB,AAHC,KAAA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IAAU,OAAO,CAAK,IAAI;GACrC,CAES;GAAQ;EAAc;CACnC;AACJ;AAUA,eAAe,EACX,GACA,GACoB;CACpB,IAAI,OAAO,KAAW,UAAU;EAC5B,IAAI;EACJ,IAAI;GACA,IAAW,MAAM,MAAM,GAAQ,CAAW;EAC9C,SAAS,GAAO;GACZ,MAAM,IAAI,EAAgB,iCAAiC,KAAU,EACjE,OAAO,EACX,CAAC;EACL;EACA,IAAI,CAAC,EAAS,IACV,MAAM,IAAI,EACN,iCAAiC,EAAS,OAAO,GAAG,EAAS,YACjE;EAEJ,OAAO,MAAM,EAAS,YAAY;CACtC;CAOA,OANI,aAAkB,aACX,EAAO,OAAO,MACjB,EAAO,YACP,EAAO,aAAa,EAAO,UAC/B,IAEG;AACX;AAUA,SAAS,EAAa,GAA6B,GAA0B;CACzE,IAAI,CAAC,MAAM,QAAQ,CAAI,KAAK,EAAK,WAAW,GACxC,MAAM,IAAI,EAAkB,2DAA2D;CAE3F,IAAM,IAAQ,EAAK,EAAE,EAAE,UAAU,GAC3B,IAAS,EAAK,WAAW,MAAQ,EAAI,WAAW,CAAK;CAC3D,IAAI,MAAW,IACX,MAAM,IAAI,EACN,0CAA0C,EAAO,OAC1C,EAAK,EAAO,EAAE,OAAO,oBAAoB,EAAM,EAC1D;CAEJ,IAAI,MAAU,GACV,MAAM,IAAI,EACN,qBAAqB,EAAS,yBAAyB,EAAM,EACjE;CAEJ,OAAO;AACX"}
|
|
1
|
+
{"version":3,"file":"compact.js","names":["MAGIC","CompactPredictor","header","arrays","info","buffer","toBuffer","source","requestInit","bytes","CompactFormatError","headerLength","cursor","section","width","validateRows","rows","started","scores","row","prepared","preprocess","scaled","index","coef","intercept","features","outputs","output","total","base","feature","threshold","left","right","leaf","offsets","trees","totals","tree","node","column","slot","link","classes","probabilities","positive","highest","exponentiated","value","sum","numeric","best","label","response","error","ModelFetchError","FeatureShapeError","ragged","expected"],"sources":["../../src/tabular/compact.ts"],"sourcesContent":["/**\n * @tempest-limits file-lines — the compact model format: the header, the column\n * dictionary, the quantised weights and the decoder that reads them back. Writer and\n * reader in one file because a format whose two halves live apart drifts.\n */\n/**\n * Running a model with no inference runtime at all.\n *\n * ONNX in the browser costs a **25.6 MB WebAssembly runtime** (6.0 MB\n * gzipped) before the first prediction, while the model itself is a few\n * hundred kilobytes. For an app whose only model is tabular, that runtime\n * *is* the download — so this reader replaces it with 1.49 KB of\n * arithmetic (measured, brotli).\n *\n * A linear model is a dot product. A tree is a chain of comparisons. That\n * is the whole implementation; there is nothing here that a WebAssembly\n * kernel would do better at this size.\n *\n * The file it reads (`.tmc`, magic `TMC1`) is written by\n * `tempest-fastapi-sdk`'s `export_sklearn_to_compact`, which verifies the\n * bytes against scikit-learn's own predictions and refuses to write a file\n * that disagrees. **It is data, not code**: no `eval`, no generated\n * JavaScript, nothing a strict CSP forbids.\n *\n * The trade against {@link TabularPredictor}: ONNX covers every estimator,\n * this covers linear models and tree ensembles. Pick by what your app\n * already ships — a page that loads ONNX for vision pays nothing extra for\n * tabular ONNX.\n */\n\nimport { CompactFormatError, FeatureShapeError, ModelFetchError } from \"./exceptions\";\nimport type { FeatureRow, PredictedLabel, TabularPrediction } from \"./types\";\n\n/** Magic bytes opening every compact file. */\nconst MAGIC = \"TMC1\";\n\n/** Layout version this reader understands. */\nexport const SUPPORTED_COMPACT_SCHEMA = 1;\n\n/** What the file holds. */\nexport type CompactKind = \"linear\" | \"tree_ensemble\";\n\n/** How raw scores become probabilities. */\ntype CompactLink = \"softmax\" | \"sigmoid\" | \"normalize\" | \"identity\";\n\n/** One array stored after the header. */\ninterface CompactSection {\n readonly name: string;\n readonly dtype: \"float32\" | \"int32\";\n readonly length: number;\n}\n\n/** The parsed header. */\ninterface CompactHeader {\n readonly schema_version: number;\n readonly kind: CompactKind;\n readonly task: \"classification\" | \"regression\";\n readonly link: CompactLink;\n readonly classes: readonly string[];\n /** How scikit-learn typed those labels: ``int``, ``float`` or ``str``. */\n readonly class_type?: \"int\" | \"float\" | \"str\";\n readonly n_features: number;\n readonly n_outputs: number;\n readonly n_trees?: number;\n readonly estimator: string;\n readonly feature_names: readonly string[];\n readonly preprocess: { readonly offset: number[]; readonly scale: number[] } | null;\n readonly sections: readonly CompactSection[];\n}\n\n/** What a loaded compact model is. */\nexport interface CompactPredictorInfo {\n /** Which reader path the file uses. */\n readonly kind: CompactKind;\n /** Class labels in score-column order; empty for a regressor. */\n readonly classes: readonly string[];\n /** Values expected per row. */\n readonly numFeatures: number;\n /** Column order recorded at training time, when the export had one. */\n readonly featureNames: readonly string[];\n /** Trees in the ensemble; `0` for a linear model. */\n readonly numTrees: number;\n /** Whether the model produces class scores. */\n readonly isClassifier: boolean;\n /** Class name of the exported estimator. */\n readonly estimator: string;\n}\n\n/**\n * A compact model, loaded and ready to answer.\n *\n * @example\n * ```ts\n * const predictor = await CompactPredictor.create(\"/models/risk.tmc\");\n * const { labels, probabilities } = await predictor.predict([[5.1, 3.5, 1.4, 0.2]]);\n * ```\n */\nexport class CompactPredictor {\n private constructor(\n private readonly header: CompactHeader,\n private readonly arrays: Record<string, Float32Array | Int32Array>,\n /** What is loaded. */\n public readonly info: CompactPredictorInfo,\n ) {}\n\n /**\n * Load a `.tmc` file.\n *\n * @param source A URL, or the bytes when the app already has them.\n * @param requestInit `fetch` options, when `source` is a URL.\n * @returns The loaded predictor.\n * @throws {@link ModelFetchError} when a URL cannot be read.\n * @throws {@link CompactFormatError} when the bytes are not a compact\n * model, or use a layout newer than this reader.\n */\n static async create(\n source: string | ArrayBuffer | Uint8Array,\n requestInit?: RequestInit,\n ): Promise<CompactPredictor> {\n const buffer = await toBuffer(source, requestInit);\n const bytes = new Uint8Array(buffer);\n\n if (String.fromCharCode(...bytes.subarray(0, 4)) !== MAGIC) {\n throw new CompactFormatError(\n \"This is not a compact model file: it does not start with \" +\n `\"${MAGIC}\". A .onnx file goes through TabularPredictor instead.`,\n );\n }\n\n const view = new DataView(buffer);\n const headerLength = view.getUint32(4, true);\n const header = JSON.parse(\n new TextDecoder().decode(bytes.subarray(8, 8 + headerLength)),\n ) as CompactHeader;\n\n if (header.schema_version > SUPPORTED_COMPACT_SCHEMA) {\n throw new CompactFormatError(\n `This file uses compact layout ${header.schema_version}, and this ` +\n `SDK understands ${SUPPORTED_COMPACT_SCHEMA}. Upgrade ` +\n \"tempest-react-sdk before serving it.\",\n );\n }\n\n const arrays: Record<string, Float32Array | Int32Array> = {};\n let cursor = 8 + headerLength;\n for (const section of header.sections) {\n arrays[section.name] =\n section.dtype === \"float32\"\n ? new Float32Array(buffer, cursor, section.length)\n : new Int32Array(buffer, cursor, section.length);\n cursor += section.length * 4;\n }\n\n return new CompactPredictor(header, arrays, {\n kind: header.kind,\n classes: header.classes,\n numFeatures: header.n_features,\n featureNames: header.feature_names,\n numTrees: header.n_trees ?? 0,\n isClassifier: header.task === \"classification\",\n estimator: header.estimator,\n });\n }\n\n /**\n * Predict for a batch of rows.\n *\n * @param rows One array of feature values per row, in training column\n * order. A single row is still wrapped: `[[...]]`.\n * @returns Labels, class scores when the model is a classifier, and the\n * call's duration.\n * @throws {@link FeatureShapeError} when the batch is empty, ragged, or\n * the wrong width.\n */\n async predict(rows: readonly FeatureRow[]): Promise<TabularPrediction> {\n const width = validateRows(rows, this.header.n_features);\n const started = performance.now();\n\n const scores: number[][] = [];\n for (const row of rows) {\n const prepared = this.preprocess(row, width);\n scores.push(\n this.header.kind === \"linear\"\n ? this.linearScores(prepared)\n : this.treeScores(prepared),\n );\n }\n\n const { labels, probabilities } = this.finish(scores);\n return {\n labels,\n probabilities,\n numRows: rows.length,\n ms: performance.now() - started,\n };\n }\n\n /** Releasing nothing, so callers can swap predictors without branching. */\n async dispose(): Promise<void> {\n /* no runtime, nothing to release */\n }\n\n /**\n * Apply the folded scaler, when the export had one.\n *\n * @param row The raw feature values.\n * @param width How many there are.\n * @returns The values the model was trained on.\n */\n private preprocess(row: FeatureRow, width: number): number[] {\n const preprocess = this.header.preprocess;\n if (preprocess === null) return row as number[];\n const scaled = new Array<number>(width);\n for (let index = 0; index < width; index += 1) {\n scaled[index] =\n ((row[index] as number) - (preprocess.offset[index] as number)) /\n (preprocess.scale[index] as number);\n }\n return scaled;\n }\n\n /**\n * Score one row against the coefficient matrix.\n *\n * @param row The prepared feature values.\n * @returns One raw score per output.\n */\n private linearScores(row: readonly number[]): number[] {\n const coef = this.arrays.coef as Float32Array;\n const intercept = this.arrays.intercept as Float32Array;\n const features = this.header.n_features;\n const outputs = this.header.n_outputs;\n\n const scores = new Array<number>(outputs);\n for (let output = 0; output < outputs; output += 1) {\n let total = intercept[output] as number;\n const base = output * features;\n for (let index = 0; index < features; index += 1) {\n total += (coef[base + index] as number) * (row[index] as number);\n }\n scores[output] = total;\n }\n return scores;\n }\n\n /**\n * Walk every tree and average what the leaves hold.\n *\n * A leaf is marked by a negative `feature` entry, which also carries\n * its slot in the value array — so the walk needs no second lookup and\n * the file stores values only for leaves.\n *\n * **The comparison runs in float32** (`Math.fround`), because that is\n * what scikit-learn does: it casts its input to float32 before\n * traversing, so a threshold like 5.099999904632568 — a float32 value\n * widened for storage — and an input of 5.1 compare *equal* and go\n * left. Comparing in float64 sends that row right instead, which on an\n * iris forest changed one tree's vote and moved a probability by 0.05.\n *\n * @param row The prepared feature values.\n * @returns One averaged score per output.\n */\n private treeScores(row: readonly number[]): number[] {\n const feature = this.arrays.node_feature as Int32Array;\n const threshold = this.arrays.node_threshold as Float32Array;\n const left = this.arrays.node_left as Int32Array;\n const right = this.arrays.node_right as Int32Array;\n const leaf = this.arrays.leaf_value as Float32Array;\n const offsets = this.arrays.tree_offset as Int32Array;\n const outputs = this.header.n_outputs;\n const trees = offsets.length - 1;\n\n const totals = new Array<number>(outputs).fill(0);\n for (let tree = 0; tree < trees; tree += 1) {\n let node = offsets[tree] as number;\n let column = feature[node] as number;\n while (column >= 0) {\n node =\n Math.fround(row[column] as number) <= (threshold[node] as number)\n ? (left[node] as number)\n : (right[node] as number);\n column = feature[node] as number;\n }\n const slot = (-1 - column) * outputs;\n for (let output = 0; output < outputs; output += 1) {\n totals[output] += leaf[slot + output] as number;\n }\n }\n for (let output = 0; output < outputs; output += 1) {\n totals[output] = (totals[output] as number) / trees;\n }\n return totals;\n }\n\n /**\n * Turn raw scores into labels and probabilities.\n *\n * @param scores One score array per row.\n * @returns Labels and probabilities in the shape the ONNX route uses,\n * so an app can swap runtimes without touching its own code. That\n * includes the label's **type**: an integer class comes back as a\n * number here exactly as ONNX returns it, because two routes over one\n * model that disagree on `0` versus `\"0\"` break the day someone\n * switches.\n */\n private finish(scores: readonly number[][]): {\n labels: PredictedLabel[];\n probabilities: number[][];\n } {\n const link = this.header.link;\n const classes = this.header.classes;\n\n if (link === \"identity\") {\n return { labels: scores.map((row) => row[0] as number), probabilities: [] };\n }\n\n const probabilities = scores.map((row) => {\n if (link === \"sigmoid\") {\n const positive = 1 / (1 + Math.exp(-(row[0] as number)));\n return [1 - positive, positive];\n }\n if (link === \"softmax\") {\n const highest = Math.max(...row);\n const exponentiated = row.map((value) => Math.exp(value - highest));\n const total = exponentiated.reduce((sum, value) => sum + value, 0);\n return exponentiated.map((value) => value / total);\n }\n const total = row.reduce((sum, value) => sum + value, 0);\n return total === 0 ? [...row] : row.map((value) => value / total);\n });\n\n const numeric = this.header.class_type !== \"str\";\n const labels = probabilities.map((row) => {\n let best = 0;\n for (let index = 1; index < row.length; index += 1) {\n if ((row[index] as number) > (row[best] as number)) best = index;\n }\n const label = classes[best];\n if (label === undefined) return best;\n return numeric ? Number(label) : label;\n });\n\n return { labels, probabilities };\n }\n}\n\n/**\n * Read a source into an `ArrayBuffer`.\n *\n * @param source A URL or the bytes.\n * @param requestInit `fetch` options.\n * @returns The bytes.\n * @throws {@link ModelFetchError} when the URL cannot be read.\n */\nasync function toBuffer(\n source: string | ArrayBuffer | Uint8Array,\n requestInit?: RequestInit,\n): Promise<ArrayBuffer> {\n if (typeof source === \"string\") {\n let response: Response;\n try {\n response = await fetch(source, requestInit);\n } catch (error) {\n throw new ModelFetchError(`Could not download the model: ${source}`, {\n cause: error,\n });\n }\n if (!response.ok) {\n throw new ModelFetchError(\n `Could not download the model: ${response.status} ${response.statusText}`,\n );\n }\n return await response.arrayBuffer();\n }\n if (source instanceof Uint8Array) {\n return source.buffer.slice(\n source.byteOffset,\n source.byteOffset + source.byteLength,\n ) as ArrayBuffer;\n }\n return source;\n}\n\n/**\n * Check a batch before predicting on it.\n *\n * @param rows The batch.\n * @param expected Features the model wants per row.\n * @returns The batch width.\n * @throws {@link FeatureShapeError} when the batch cannot be predicted on.\n */\nfunction validateRows(rows: readonly FeatureRow[], expected: number): number {\n if (!Array.isArray(rows) || rows.length === 0) {\n throw new FeatureShapeError(\"predict() needs at least one row, shaped [[f1, f2, ...]].\");\n }\n const width = rows[0]?.length ?? 0;\n const ragged = rows.findIndex((row) => row.length !== width);\n if (ragged !== -1) {\n throw new FeatureShapeError(\n `All rows must have the same width; row ${ragged} has ` +\n `${rows[ragged]?.length} values, expected ${width}.`,\n );\n }\n if (width !== expected) {\n throw new FeatureShapeError(\n `The model expects ${expected} features per row, got ${width}.`,\n );\n }\n return width;\n}\n"],"mappings":";;AAkCA,IAAMA,IAAQ,QA+DDC,IAAb,MAAaA,EAAiB;CAEL;CACA;CAED;CAJpB,YACI,GACA,GAEA,GACF;EADkB,AAHC,KAAA,SAAAC,GACA,KAAA,SAAAC,GAED,KAAA,OAAAC;CACjB;CAYH,aAAa,OACT,GACA,GACyB;EACzB,IAAMC,IAAS,MAAMC,EAASC,GAAQC,CAAW,GAC3CC,IAAQ,IAAI,WAAWJ,CAAM;EAEnC,IAAI,OAAO,aAAa,GAAGI,EAAM,SAAS,GAAG,CAAC,CAAC,MAAMT,GACjD,MAAM,IAAIU,EACN,6DACQV,EAAM,uDAClB;EAIJ,IAAMW,IAAe,IADJ,SAASN,CACL,CAAA,CAAK,UAAU,GAAG,EAAI,GACrCH,IAAS,KAAK,MAChB,IAAI,YAAY,CAAC,CAAC,OAAOO,EAAM,SAAS,GAAG,IAAIE,C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AC9C,SAAS+C,GAAO;GACZ,MAAM,IAAIC,EAAgB,iCAAiCjD,KAAU,EACjE,OAAOgD,EACX,CAAC;EACL;EACA,IAAI,CAACD,EAAS,IACV,MAAM,IAAIE,EACN,iCAAiCF,EAAS,OAAO,GAAGA,EAAS,YACjE;EAEJ,OAAO,MAAMA,EAAS,YAAY;CACtC;CAOA,OANI/C,aAAkB,aACXA,EAAO,OAAO,MACjBA,EAAO,YACPA,EAAO,aAAaA,EAAO,UAC/B,IAEGA;AACX;AAUA,SAASQ,EAAa,GAA6B,GAA0B;CACzE,IAAI,CAAC,MAAM,QAAQC,CAAI,KAAKA,EAAK,WAAW,GACxC,MAAM,IAAIyC,EAAkB,2DAA2D;CAE3F,IAAM3C,IAAQE,EAAK,EAAE,EAAE,UAAU,GAC3B0C,IAAS1C,EAAK,WAAW,MAAQG,EAAI,WAAWL,CAAK;CAC3D,IAAI4C,MAAW,IACX,MAAM,IAAID,EACN,0CAA0CC,EAAO,OAC1C1C,EAAK0C,EAAO,EAAE,OAAO,oBAAoB5C,EAAM,EAC1D;CAEJ,IAAIA,MAAU6C,GACV,MAAM,IAAIF,EACN,qBAAqBE,EAAS,yBAAyB7C,EAAM,EACjE;CAEJ,OAAOA;AACX"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exceptions.cjs","names":[],"sources":["../../src/tabular/exceptions.ts"],"sourcesContent":["/**\n * Errors thrown by the tabular inference module.\n *\n * Each one exists because the underlying failure is unreadable on its own:\n * ONNX Runtime reports a missing operator registration, and the actual cause\n * is an import path chosen three files away.\n *\n * Every subclass sets `name` to a **literal** string rather than to\n * `new.target.name`. Measured in a real build: the minifier renames the\n * class, so the derived form ships as `error.name === \"t\"` — useless in a\n * log and in any consumer that branches on the name.\n */\n\n/** Base class for every error this module throws. */\nexport class TabularError extends Error {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = \"TabularError\";\n }\n}\n\n/** The model bytes could not be loaded into a session. */\nexport class ModelLoadError extends TabularError {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = \"ModelLoadError\";\n }\n}\n\n/**\n * The runtime has no kernels for this graph's operators.\n *\n * Measured, and the reason this class exists: importing\n * `onnxruntime-web/webgpu` loads a WebAssembly build without the\n * `ai.onnx.ml` domain, so creating a session over any scikit-learn export\n * fails with `No Op registered for TreeEnsembleClassifier`. The message\n * names the fix, because the raw error points at the model instead of at\n * the import.\n */\nexport class UnsupportedGraphError extends TabularError {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = \"UnsupportedGraphError\";\n }\n}\n\n/**\n * The bytes are not a compact model, or use a newer layout.\n *\n * Separate from {@link ModelLoadError} because the fix is different: a\n * `.onnx` file handed to the compact reader is a wiring mistake, not a\n * broken model.\n */\nexport class CompactFormatError extends TabularError {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = \"CompactFormatError\";\n }\n}\n\n/** The rows do not match what the model expects. */\nexport class FeatureShapeError extends TabularError {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = \"FeatureShapeError\";\n }\n}\n\n/** The session ran but its outputs could not be read. */\nexport class InferenceError extends TabularError {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = \"InferenceError\";\n }\n}\n\n/**\n * The model bytes could not be fetched or read from the cache.\n *\n * Distinct from {@link ModelLoadError}: this one means the app is offline\n * and nothing was cached, which is a deployment problem, not a model\n * problem.\n */\nexport class ModelFetchError extends TabularError {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = \"ModelFetchError\";\n }\n}\n"],"mappings":"AAcA,
|
|
1
|
+
{"version":3,"file":"exceptions.cjs","names":["TabularError","message","options","ModelLoadError","UnsupportedGraphError","CompactFormatError","FeatureShapeError","InferenceError","ModelFetchError"],"sources":["../../src/tabular/exceptions.ts"],"sourcesContent":["/**\n * Errors thrown by the tabular inference module.\n *\n * Each one exists because the underlying failure is unreadable on its own:\n * ONNX Runtime reports a missing operator registration, and the actual cause\n * is an import path chosen three files away.\n *\n * Every subclass sets `name` to a **literal** string rather than to\n * `new.target.name`. Measured in a real build: the minifier renames the\n * class, so the derived form ships as `error.name === \"t\"` — useless in a\n * log and in any consumer that branches on the name.\n */\n\n/** Base class for every error this module throws. */\nexport class TabularError extends Error {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = \"TabularError\";\n }\n}\n\n/** The model bytes could not be loaded into a session. */\nexport class ModelLoadError extends TabularError {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = \"ModelLoadError\";\n }\n}\n\n/**\n * The runtime has no kernels for this graph's operators.\n *\n * Measured, and the reason this class exists: importing\n * `onnxruntime-web/webgpu` loads a WebAssembly build without the\n * `ai.onnx.ml` domain, so creating a session over any scikit-learn export\n * fails with `No Op registered for TreeEnsembleClassifier`. The message\n * names the fix, because the raw error points at the model instead of at\n * the import.\n */\nexport class UnsupportedGraphError extends TabularError {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = \"UnsupportedGraphError\";\n }\n}\n\n/**\n * The bytes are not a compact model, or use a newer layout.\n *\n * Separate from {@link ModelLoadError} because the fix is different: a\n * `.onnx` file handed to the compact reader is a wiring mistake, not a\n * broken model.\n */\nexport class CompactFormatError extends TabularError {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = \"CompactFormatError\";\n }\n}\n\n/** The rows do not match what the model expects. */\nexport class FeatureShapeError extends TabularError {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = \"FeatureShapeError\";\n }\n}\n\n/** The session ran but its outputs could not be read. */\nexport class InferenceError extends TabularError {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = \"InferenceError\";\n }\n}\n\n/**\n * The model bytes could not be fetched or read from the cache.\n *\n * Distinct from {@link ModelLoadError}: this one means the app is offline\n * and nothing was cached, which is a deployment problem, not a model\n * problem.\n */\nexport class ModelFetchError extends TabularError {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = \"ModelFetchError\";\n }\n}\n"],"mappings":"AAcA,IAAaA,EAAb,cAAkC,KAAM,CACpC,YAAY,EAAiB,EAAwB,CACjD,MAAMC,EAASC,CAAO,EACtB,KAAK,KAAO,cAChB,CACJ,EAGaC,EAAb,cAAoCH,CAAa,CAC7C,YAAY,EAAiB,EAAwB,CACjD,MAAMC,EAASC,CAAO,EACtB,KAAK,KAAO,gBAChB,CACJ,EAYaE,EAAb,cAA2CJ,CAAa,CACpD,YAAY,EAAiB,EAAwB,CACjD,MAAMC,EAASC,CAAO,EACtB,KAAK,KAAO,uBAChB,CACJ,EASaG,EAAb,cAAwCL,CAAa,CACjD,YAAY,EAAiB,EAAwB,CACjD,MAAMC,EAASC,CAAO,EACtB,KAAK,KAAO,oBAChB,CACJ,EAGaI,EAAb,cAAuCN,CAAa,CAChD,YAAY,EAAiB,EAAwB,CACjD,MAAMC,EAASC,CAAO,EACtB,KAAK,KAAO,mBAChB,CACJ,EAGaK,EAAb,cAAoCP,CAAa,CAC7C,YAAY,EAAiB,EAAwB,CACjD,MAAMC,EAASC,CAAO,EACtB,KAAK,KAAO,gBAChB,CACJ,EASaM,EAAb,cAAqCR,CAAa,CAC9C,YAAY,EAAiB,EAAwB,CACjD,MAAMC,EAASC,CAAO,EACtB,KAAK,KAAO,iBAChB,CACJ,E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exceptions.js","names":[],"sources":["../../src/tabular/exceptions.ts"],"sourcesContent":["/**\n * Errors thrown by the tabular inference module.\n *\n * Each one exists because the underlying failure is unreadable on its own:\n * ONNX Runtime reports a missing operator registration, and the actual cause\n * is an import path chosen three files away.\n *\n * Every subclass sets `name` to a **literal** string rather than to\n * `new.target.name`. Measured in a real build: the minifier renames the\n * class, so the derived form ships as `error.name === \"t\"` — useless in a\n * log and in any consumer that branches on the name.\n */\n\n/** Base class for every error this module throws. */\nexport class TabularError extends Error {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = \"TabularError\";\n }\n}\n\n/** The model bytes could not be loaded into a session. */\nexport class ModelLoadError extends TabularError {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = \"ModelLoadError\";\n }\n}\n\n/**\n * The runtime has no kernels for this graph's operators.\n *\n * Measured, and the reason this class exists: importing\n * `onnxruntime-web/webgpu` loads a WebAssembly build without the\n * `ai.onnx.ml` domain, so creating a session over any scikit-learn export\n * fails with `No Op registered for TreeEnsembleClassifier`. The message\n * names the fix, because the raw error points at the model instead of at\n * the import.\n */\nexport class UnsupportedGraphError extends TabularError {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = \"UnsupportedGraphError\";\n }\n}\n\n/**\n * The bytes are not a compact model, or use a newer layout.\n *\n * Separate from {@link ModelLoadError} because the fix is different: a\n * `.onnx` file handed to the compact reader is a wiring mistake, not a\n * broken model.\n */\nexport class CompactFormatError extends TabularError {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = \"CompactFormatError\";\n }\n}\n\n/** The rows do not match what the model expects. */\nexport class FeatureShapeError extends TabularError {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = \"FeatureShapeError\";\n }\n}\n\n/** The session ran but its outputs could not be read. */\nexport class InferenceError extends TabularError {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = \"InferenceError\";\n }\n}\n\n/**\n * The model bytes could not be fetched or read from the cache.\n *\n * Distinct from {@link ModelLoadError}: this one means the app is offline\n * and nothing was cached, which is a deployment problem, not a model\n * problem.\n */\nexport class ModelFetchError extends TabularError {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = \"ModelFetchError\";\n }\n}\n"],"mappings":";AAcA,
|
|
1
|
+
{"version":3,"file":"exceptions.js","names":["TabularError","message","options","ModelLoadError","UnsupportedGraphError","CompactFormatError","FeatureShapeError","InferenceError","ModelFetchError"],"sources":["../../src/tabular/exceptions.ts"],"sourcesContent":["/**\n * Errors thrown by the tabular inference module.\n *\n * Each one exists because the underlying failure is unreadable on its own:\n * ONNX Runtime reports a missing operator registration, and the actual cause\n * is an import path chosen three files away.\n *\n * Every subclass sets `name` to a **literal** string rather than to\n * `new.target.name`. Measured in a real build: the minifier renames the\n * class, so the derived form ships as `error.name === \"t\"` — useless in a\n * log and in any consumer that branches on the name.\n */\n\n/** Base class for every error this module throws. */\nexport class TabularError extends Error {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = \"TabularError\";\n }\n}\n\n/** The model bytes could not be loaded into a session. */\nexport class ModelLoadError extends TabularError {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = \"ModelLoadError\";\n }\n}\n\n/**\n * The runtime has no kernels for this graph's operators.\n *\n * Measured, and the reason this class exists: importing\n * `onnxruntime-web/webgpu` loads a WebAssembly build without the\n * `ai.onnx.ml` domain, so creating a session over any scikit-learn export\n * fails with `No Op registered for TreeEnsembleClassifier`. The message\n * names the fix, because the raw error points at the model instead of at\n * the import.\n */\nexport class UnsupportedGraphError extends TabularError {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = \"UnsupportedGraphError\";\n }\n}\n\n/**\n * The bytes are not a compact model, or use a newer layout.\n *\n * Separate from {@link ModelLoadError} because the fix is different: a\n * `.onnx` file handed to the compact reader is a wiring mistake, not a\n * broken model.\n */\nexport class CompactFormatError extends TabularError {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = \"CompactFormatError\";\n }\n}\n\n/** The rows do not match what the model expects. */\nexport class FeatureShapeError extends TabularError {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = \"FeatureShapeError\";\n }\n}\n\n/** The session ran but its outputs could not be read. */\nexport class InferenceError extends TabularError {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = \"InferenceError\";\n }\n}\n\n/**\n * The model bytes could not be fetched or read from the cache.\n *\n * Distinct from {@link ModelLoadError}: this one means the app is offline\n * and nothing was cached, which is a deployment problem, not a model\n * problem.\n */\nexport class ModelFetchError extends TabularError {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = \"ModelFetchError\";\n }\n}\n"],"mappings":";AAcA,IAAaA,IAAb,cAAkC,MAAM;CACpC,YAAY,GAAiB,GAAwB;EAEjD,AADA,MAAMC,GAASC,CAAO,GACtB,KAAK,OAAO;CAChB;AACJ,GAGaC,IAAb,cAAoCH,EAAa;CAC7C,YAAY,GAAiB,GAAwB;EAEjD,AADA,MAAMC,GAASC,CAAO,GACtB,KAAK,OAAO;CAChB;AACJ,GAYaE,IAAb,cAA2CJ,EAAa;CACpD,YAAY,GAAiB,GAAwB;EAEjD,AADA,MAAMC,GAASC,CAAO,GACtB,KAAK,OAAO;CAChB;AACJ,GASaG,IAAb,cAAwCL,EAAa;CACjD,YAAY,GAAiB,GAAwB;EAEjD,AADA,MAAMC,GAASC,CAAO,GACtB,KAAK,OAAO;CAChB;AACJ,GAGaI,IAAb,cAAuCN,EAAa;CAChD,YAAY,GAAiB,GAAwB;EAEjD,AADA,MAAMC,GAASC,CAAO,GACtB,KAAK,OAAO;CAChB;AACJ,GAGaK,IAAb,cAAoCP,EAAa;CAC7C,YAAY,GAAiB,GAAwB;EAEjD,AADA,MAAMC,GAASC,CAAO,GACtB,KAAK,OAAO;CAChB;AACJ,GASaM,IAAb,cAAqCR,EAAa;CAC9C,YAAY,GAAiB,GAAwB;EAEjD,AADA,MAAMC,GAASC,CAAO,GACtB,KAAK,OAAO;CAChB;AACJ"}
|