prismcast 1.10.3 → 1.11.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/dist/app.d.ts +1 -0
- package/dist/app.d.ts.map +1 -0
- package/dist/app.js +103 -50
- package/dist/app.js.map +1 -1
- package/dist/browser/blockedPage.d.ts +80 -0
- package/dist/browser/blockedPage.d.ts.map +1 -0
- package/dist/browser/blockedPage.js +209 -0
- package/dist/browser/blockedPage.js.map +1 -0
- package/dist/browser/browserSupervisor.d.ts +80 -0
- package/dist/browser/browserSupervisor.d.ts.map +1 -0
- package/dist/browser/browserSupervisor.js +186 -0
- package/dist/browser/browserSupervisor.js.map +1 -0
- package/dist/browser/cdp.d.ts +1 -0
- package/dist/browser/cdp.d.ts.map +1 -0
- package/dist/browser/cdp.js +6 -5
- package/dist/browser/cdp.js.map +1 -1
- package/dist/browser/channelSelection.d.ts +45 -14
- package/dist/browser/channelSelection.d.ts.map +1 -0
- package/dist/browser/channelSelection.js +81 -18
- package/dist/browser/channelSelection.js.map +1 -1
- package/dist/browser/consent.d.ts +152 -0
- package/dist/browser/consent.d.ts.map +1 -0
- package/dist/browser/consent.js +418 -0
- package/dist/browser/consent.js.map +1 -0
- package/dist/browser/display.d.ts +1 -0
- package/dist/browser/display.d.ts.map +1 -0
- package/dist/browser/hlsPlaylistObserver.d.ts +23 -6
- package/dist/browser/hlsPlaylistObserver.d.ts.map +1 -0
- package/dist/browser/hlsPlaylistObserver.js +27 -8
- package/dist/browser/hlsPlaylistObserver.js.map +1 -1
- package/dist/browser/index.d.ts +44 -27
- package/dist/browser/index.d.ts.map +1 -0
- package/dist/browser/index.js +427 -244
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/launchGovernor.d.ts +89 -0
- package/dist/browser/launchGovernor.d.ts.map +1 -0
- package/dist/browser/launchGovernor.js +96 -0
- package/dist/browser/launchGovernor.js.map +1 -0
- package/dist/browser/login.d.ts +10 -2
- package/dist/browser/login.d.ts.map +1 -0
- package/dist/browser/login.js +36 -5
- package/dist/browser/login.js.map +1 -1
- package/dist/browser/manifestInterceptor.d.ts +88 -35
- package/dist/browser/manifestInterceptor.d.ts.map +1 -0
- package/dist/browser/manifestInterceptor.js +165 -77
- package/dist/browser/manifestInterceptor.js.map +1 -1
- package/dist/browser/pageStaleness.d.ts +30 -0
- package/dist/browser/pageStaleness.d.ts.map +1 -0
- package/dist/browser/pageStaleness.js +76 -0
- package/dist/browser/pageStaleness.js.map +1 -0
- package/dist/browser/precaching.d.ts +95 -3
- package/dist/browser/precaching.d.ts.map +1 -0
- package/dist/browser/precaching.js +499 -65
- package/dist/browser/precaching.js.map +1 -1
- package/dist/browser/tabNetworkObserver.d.ts +2 -1
- package/dist/browser/tabNetworkObserver.d.ts.map +1 -0
- package/dist/browser/tabNetworkObserver.js +7 -3
- package/dist/browser/tabNetworkObserver.js.map +1 -1
- package/dist/browser/tuning/cache.d.ts +61 -0
- package/dist/browser/tuning/cache.d.ts.map +1 -0
- package/dist/browser/tuning/cache.js +62 -0
- package/dist/browser/tuning/cache.js.map +1 -0
- package/dist/browser/tuning/comcastPolymer.d.ts +3 -2
- package/dist/browser/tuning/comcastPolymer.d.ts.map +1 -0
- package/dist/browser/tuning/comcastPolymer.js +79 -102
- package/dist/browser/tuning/comcastPolymer.js.map +1 -1
- package/dist/browser/tuning/cox.d.ts +1 -0
- package/dist/browser/tuning/cox.d.ts.map +1 -0
- package/dist/browser/tuning/directv.d.ts +1 -0
- package/dist/browser/tuning/directv.d.ts.map +1 -0
- package/dist/browser/tuning/directv.js +52 -46
- package/dist/browser/tuning/directv.js.map +1 -1
- package/dist/browser/tuning/fox.d.ts +1 -0
- package/dist/browser/tuning/fox.d.ts.map +1 -0
- package/dist/browser/tuning/fox.js +13 -12
- package/dist/browser/tuning/fox.js.map +1 -1
- package/dist/browser/tuning/gridSearch.d.ts +68 -0
- package/dist/browser/tuning/gridSearch.d.ts.map +1 -0
- package/dist/browser/tuning/gridSearch.js +85 -0
- package/dist/browser/tuning/gridSearch.js.map +1 -0
- package/dist/browser/tuning/hbo.d.ts +1 -0
- package/dist/browser/tuning/hbo.d.ts.map +1 -0
- package/dist/browser/tuning/hbo.js +73 -45
- package/dist/browser/tuning/hbo.js.map +1 -1
- package/dist/browser/tuning/hulu.d.ts +1 -0
- package/dist/browser/tuning/hulu.d.ts.map +1 -0
- package/dist/browser/tuning/hulu.js +128 -173
- package/dist/browser/tuning/hulu.js.map +1 -1
- package/dist/browser/tuning/shared.d.ts +75 -5
- package/dist/browser/tuning/shared.d.ts.map +1 -0
- package/dist/browser/tuning/shared.js +216 -6
- package/dist/browser/tuning/shared.js.map +1 -1
- package/dist/browser/tuning/sling.d.ts +1 -0
- package/dist/browser/tuning/sling.d.ts.map +1 -0
- package/dist/browser/tuning/sling.js +105 -126
- package/dist/browser/tuning/sling.js.map +1 -1
- package/dist/browser/tuning/spectrum.d.ts +1 -0
- package/dist/browser/tuning/spectrum.d.ts.map +1 -0
- package/dist/browser/tuning/spectrum.js +80 -125
- package/dist/browser/tuning/spectrum.js.map +1 -1
- package/dist/browser/tuning/thumbnailRow.d.ts +1 -0
- package/dist/browser/tuning/thumbnailRow.d.ts.map +1 -0
- package/dist/browser/tuning/thumbnailRow.js +8 -2
- package/dist/browser/tuning/thumbnailRow.js.map +1 -1
- package/dist/browser/tuning/tileClick.d.ts +1 -0
- package/dist/browser/tuning/tileClick.d.ts.map +1 -0
- package/dist/browser/tuning/tileClick.js +3 -2
- package/dist/browser/tuning/tileClick.js.map +1 -1
- package/dist/browser/tuning/xfinity.d.ts +1 -0
- package/dist/browser/tuning/xfinity.d.ts.map +1 -0
- package/dist/browser/tuning/youtubeTv.d.ts +1 -0
- package/dist/browser/tuning/youtubeTv.d.ts.map +1 -0
- package/dist/browser/tuning/youtubeTv.js +74 -127
- package/dist/browser/tuning/youtubeTv.js.map +1 -1
- package/dist/browser/video.d.ts +54 -14
- package/dist/browser/video.d.ts.map +1 -0
- package/dist/browser/video.js +296 -138
- package/dist/browser/video.js.map +1 -1
- package/dist/channels/index.d.ts +1 -0
- package/dist/channels/index.d.ts.map +1 -0
- package/dist/channels/index.js +12 -9
- package/dist/channels/index.js.map +1 -1
- package/dist/config/channelForm.d.ts +15 -1
- package/dist/config/channelForm.d.ts.map +1 -0
- package/dist/config/channelForm.js +28 -12
- package/dist/config/channelForm.js.map +1 -1
- package/dist/config/consistencyProbe.d.ts +1 -0
- package/dist/config/consistencyProbe.d.ts.map +1 -0
- package/dist/config/consistencyProbe.js +15 -11
- package/dist/config/consistencyProbe.js.map +1 -1
- package/dist/config/health.d.ts +41 -8
- package/dist/config/health.d.ts.map +1 -0
- package/dist/config/health.js +189 -38
- package/dist/config/health.js.map +1 -1
- package/dist/config/index.d.ts +55 -3
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +320 -69
- package/dist/config/index.js.map +1 -1
- package/dist/config/paths.d.ts +7 -1
- package/dist/config/paths.d.ts.map +1 -0
- package/dist/config/paths.js +8 -1
- package/dist/config/paths.js.map +1 -1
- package/dist/config/persistence.context.d.ts +1 -0
- package/dist/config/persistence.context.d.ts.map +1 -0
- package/dist/config/persistence.d.ts +13 -10
- package/dist/config/persistence.d.ts.map +1 -0
- package/dist/config/persistence.js +40 -21
- package/dist/config/persistence.js.map +1 -1
- package/dist/config/presets.d.ts +1 -0
- package/dist/config/presets.d.ts.map +1 -0
- package/dist/config/profiles.d.ts +21 -14
- package/dist/config/profiles.d.ts.map +1 -0
- package/dist/config/profiles.js +77 -43
- package/dist/config/profiles.js.map +1 -1
- package/dist/config/providerLineups.d.ts +47 -0
- package/dist/config/providerLineups.d.ts.map +1 -0
- package/dist/config/providerLineups.js +137 -0
- package/dist/config/providerLineups.js.map +1 -0
- package/dist/config/reactivity.d.ts +84 -0
- package/dist/config/reactivity.d.ts.map +1 -0
- package/dist/config/reactivity.js +226 -0
- package/dist/config/reactivity.js.map +1 -0
- package/dist/config/servicePacks.d.ts +18 -2
- package/dist/config/servicePacks.d.ts.map +1 -0
- package/dist/config/servicePacks.js +53 -11
- package/dist/config/servicePacks.js.map +1 -1
- package/dist/config/services.d.ts +16 -10
- package/dist/config/services.d.ts.map +1 -0
- package/dist/config/services.js +27 -16
- package/dist/config/services.js.map +1 -1
- package/dist/config/sites.d.ts +4 -2
- package/dist/config/sites.d.ts.map +1 -0
- package/dist/config/sites.js +9 -5
- package/dist/config/sites.js.map +1 -1
- package/dist/config/userChannels.d.ts +23 -18
- package/dist/config/userChannels.d.ts.map +1 -0
- package/dist/config/userChannels.js +45 -34
- package/dist/config/userChannels.js.map +1 -1
- package/dist/config/userConfig.d.ts +14 -9
- package/dist/config/userConfig.d.ts.map +1 -0
- package/dist/config/userConfig.js +87 -25
- package/dist/config/userConfig.js.map +1 -1
- package/dist/config/userProfiles.d.ts +8 -4
- package/dist/config/userProfiles.d.ts.map +1 -0
- package/dist/config/userProfiles.js +48 -23
- package/dist/config/userProfiles.js.map +1 -1
- package/dist/hdhr/channelMap.d.ts +1 -0
- package/dist/hdhr/channelMap.d.ts.map +1 -0
- package/dist/hdhr/deviceId.d.ts +1 -0
- package/dist/hdhr/deviceId.d.ts.map +1 -0
- package/dist/hdhr/discover.d.ts +1 -0
- package/dist/hdhr/discover.d.ts.map +1 -0
- package/dist/hdhr/discover.js +48 -47
- package/dist/hdhr/discover.js.map +1 -1
- package/dist/hdhr/getHandlers.d.ts +29 -0
- package/dist/hdhr/getHandlers.d.ts.map +1 -0
- package/dist/hdhr/getHandlers.js +196 -0
- package/dist/hdhr/getHandlers.js.map +1 -0
- package/dist/hdhr/identity.d.ts +36 -0
- package/dist/hdhr/identity.d.ts.map +1 -0
- package/dist/hdhr/identity.js +51 -0
- package/dist/hdhr/identity.js.map +1 -0
- package/dist/hdhr/index.d.ts +22 -4
- package/dist/hdhr/index.d.ts.map +1 -0
- package/dist/hdhr/index.js +229 -54
- package/dist/hdhr/index.js.map +1 -1
- package/dist/hdhr/protocol.d.ts +75 -0
- package/dist/hdhr/protocol.d.ts.map +1 -0
- package/dist/hdhr/protocol.js +264 -0
- package/dist/hdhr/protocol.js.map +1 -0
- package/dist/hdhr/tunerState.d.ts +24 -0
- package/dist/hdhr/tunerState.d.ts.map +1 -0
- package/dist/hdhr/tunerState.js +67 -0
- package/dist/hdhr/tunerState.js.map +1 -0
- package/dist/hdhr/udp.d.ts +43 -0
- package/dist/hdhr/udp.d.ts.map +1 -0
- package/dist/hdhr/udp.js +277 -0
- package/dist/hdhr/udp.js.map +1 -0
- package/dist/identity.d.ts +1 -0
- package/dist/identity.d.ts.map +1 -0
- package/dist/identity.js +13 -11
- package/dist/identity.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -3
- package/dist/index.js.map +1 -1
- package/dist/native/codecInference.d.ts +1 -0
- package/dist/native/codecInference.d.ts.map +1 -0
- package/dist/native/codecInference.js +50 -5
- package/dist/native/codecInference.js.map +1 -1
- package/dist/native/decrypt.d.ts +6 -2
- package/dist/native/decrypt.d.ts.map +1 -0
- package/dist/native/decrypt.js +15 -8
- package/dist/native/decrypt.js.map +1 -1
- package/dist/native/index.d.ts +39 -16
- package/dist/native/index.d.ts.map +1 -0
- package/dist/native/index.js +273 -103
- package/dist/native/index.js.map +1 -1
- package/dist/native/probe.d.ts +114 -18
- package/dist/native/probe.d.ts.map +1 -0
- package/dist/native/probe.js +452 -115
- package/dist/native/probe.js.map +1 -1
- package/dist/native/proxy.d.ts +56 -1
- package/dist/native/proxy.d.ts.map +1 -0
- package/dist/native/proxy.js +604 -161
- package/dist/native/proxy.js.map +1 -1
- package/dist/native/tokenExpiry.d.ts +1 -0
- package/dist/native/tokenExpiry.d.ts.map +1 -0
- package/dist/native/tokenExpiry.js +1 -1
- package/dist/routes/assets.d.ts +1 -0
- package/dist/routes/assets.d.ts.map +1 -0
- package/dist/routes/assets.js +4 -2
- package/dist/routes/assets.js.map +1 -1
- package/dist/routes/auth.d.ts +1 -0
- package/dist/routes/auth.d.ts.map +1 -0
- package/dist/routes/auth.js +0 -1
- package/dist/routes/auth.js.map +1 -1
- package/dist/routes/cdp.d.ts +5 -5
- package/dist/routes/cdp.d.ts.map +1 -0
- package/dist/routes/cdp.js +59 -20
- package/dist/routes/cdp.js.map +1 -1
- package/dist/routes/channels.d.ts +1 -0
- package/dist/routes/channels.d.ts.map +1 -0
- package/dist/routes/channels.js +2 -1
- package/dist/routes/channels.js.map +1 -1
- package/dist/routes/clientActions.d.ts +4 -3
- package/dist/routes/clientActions.d.ts.map +1 -0
- package/dist/routes/components.d.ts +1 -0
- package/dist/routes/components.d.ts.map +1 -0
- package/dist/routes/components.js +2 -2
- package/dist/routes/components.js.map +1 -1
- package/dist/routes/config/channels/endpoints/browse.d.ts +1 -0
- package/dist/routes/config/channels/endpoints/browse.d.ts.map +1 -0
- package/dist/routes/config/channels/endpoints/browse.js +23 -10
- package/dist/routes/config/channels/endpoints/browse.js.map +1 -1
- package/dist/routes/config/channels/endpoints/bulk.d.ts +1 -0
- package/dist/routes/config/channels/endpoints/bulk.d.ts.map +1 -0
- package/dist/routes/config/channels/endpoints/bulk.js +5 -3
- package/dist/routes/config/channels/endpoints/bulk.js.map +1 -1
- package/dist/routes/config/channels/endpoints/crud.d.ts +1 -0
- package/dist/routes/config/channels/endpoints/crud.d.ts.map +1 -0
- package/dist/routes/config/channels/endpoints/crud.js +49 -22
- package/dist/routes/config/channels/endpoints/crud.js.map +1 -1
- package/dist/routes/config/channels/endpoints/importExport.d.ts +1 -0
- package/dist/routes/config/channels/endpoints/importExport.d.ts.map +1 -0
- package/dist/routes/config/channels/endpoints/importExport.js +6 -3
- package/dist/routes/config/channels/endpoints/importExport.js.map +1 -1
- package/dist/routes/config/channels/endpoints/predefined.d.ts +1 -0
- package/dist/routes/config/channels/endpoints/predefined.d.ts.map +1 -0
- package/dist/routes/config/channels/endpoints/prefs.d.ts +1 -0
- package/dist/routes/config/channels/endpoints/prefs.d.ts.map +1 -0
- package/dist/routes/config/channels/endpoints/prefs.js +2 -1
- package/dist/routes/config/channels/endpoints/prefs.js.map +1 -1
- package/dist/routes/config/channels/endpoints/service.d.ts +2 -1
- package/dist/routes/config/channels/endpoints/service.d.ts.map +1 -0
- package/dist/routes/config/channels/endpoints/service.js +3 -1
- package/dist/routes/config/channels/endpoints/service.js.map +1 -1
- package/dist/routes/config/channels/endpoints/tags.d.ts +1 -0
- package/dist/routes/config/channels/endpoints/tags.d.ts.map +1 -0
- package/dist/routes/config/channels/endpoints/tags.js +13 -7
- package/dist/routes/config/channels/endpoints/tags.js.map +1 -1
- package/dist/routes/config/channels/healthBridge.d.ts +1 -0
- package/dist/routes/config/channels/healthBridge.d.ts.map +1 -0
- package/dist/routes/config/channels/healthBridge.js +2 -2
- package/dist/routes/config/channels/http/handler.d.ts +1 -0
- package/dist/routes/config/channels/http/handler.d.ts.map +1 -0
- package/dist/routes/config/channels/http/playlistHint.d.ts +2 -1
- package/dist/routes/config/channels/http/playlistHint.d.ts.map +1 -0
- package/dist/routes/config/channels/http/playlistHint.js +16 -2
- package/dist/routes/config/channels/http/playlistHint.js.map +1 -1
- package/dist/routes/config/channels/http/serviceWarning.d.ts +4 -2
- package/dist/routes/config/channels/http/serviceWarning.d.ts.map +1 -0
- package/dist/routes/config/channels/http/serviceWarning.js +3 -2
- package/dist/routes/config/channels/http/serviceWarning.js.map +1 -1
- package/dist/routes/config/channels/index.d.ts +1 -0
- package/dist/routes/config/channels/index.d.ts.map +1 -0
- package/dist/routes/config/channels/setup.d.ts +1 -0
- package/dist/routes/config/channels/setup.d.ts.map +1 -0
- package/dist/routes/config/channels/table.d.ts +3 -3
- package/dist/routes/config/channels/table.d.ts.map +1 -0
- package/dist/routes/config/channels/table.js +55 -27
- package/dist/routes/config/channels/table.js.map +1 -1
- package/dist/routes/config/http/envelope.d.ts +1 -0
- package/dist/routes/config/http/envelope.d.ts.map +1 -0
- package/dist/routes/config/index.d.ts +35 -3
- package/dist/routes/config/index.d.ts.map +1 -0
- package/dist/routes/config/index.js +51 -2
- package/dist/routes/config/index.js.map +1 -1
- package/dist/routes/config/services.d.ts +5 -4
- package/dist/routes/config/services.d.ts.map +1 -0
- package/dist/routes/config/services.js +35 -24
- package/dist/routes/config/services.js.map +1 -1
- package/dist/routes/config/settings.d.ts +1 -0
- package/dist/routes/config/settings.d.ts.map +1 -0
- package/dist/routes/config/settings.js +89 -43
- package/dist/routes/config/settings.js.map +1 -1
- package/dist/routes/debug.d.ts +1 -0
- package/dist/routes/debug.d.ts.map +1 -0
- package/dist/routes/debug.js +2 -2
- package/dist/routes/debug.js.map +1 -1
- package/dist/routes/health.d.ts +39 -1
- package/dist/routes/health.d.ts.map +1 -0
- package/dist/routes/health.js +33 -27
- package/dist/routes/health.js.map +1 -1
- package/dist/routes/hls.d.ts +1 -0
- package/dist/routes/hls.d.ts.map +1 -0
- package/dist/routes/icons.d.ts +1 -0
- package/dist/routes/icons.d.ts.map +1 -0
- package/dist/routes/icons.js +1 -1
- package/dist/routes/index.d.ts +1 -0
- package/dist/routes/index.d.ts.map +1 -0
- package/dist/routes/logs.d.ts +1 -0
- package/dist/routes/logs.d.ts.map +1 -0
- package/dist/routes/logs.js +13 -3
- package/dist/routes/logs.js.map +1 -1
- package/dist/routes/mpegts.d.ts +1 -0
- package/dist/routes/mpegts.d.ts.map +1 -0
- package/dist/routes/play.d.ts +1 -0
- package/dist/routes/play.d.ts.map +1 -0
- package/dist/routes/playlist.d.ts +1 -0
- package/dist/routes/playlist.d.ts.map +1 -0
- package/dist/routes/playlist.js +7 -2
- package/dist/routes/playlist.js.map +1 -1
- package/dist/routes/root/content.d.ts +8 -5
- package/dist/routes/root/content.d.ts.map +1 -0
- package/dist/routes/root/content.js +11 -12
- package/dist/routes/root/content.js.map +1 -1
- package/dist/routes/root/index.d.ts +2 -1
- package/dist/routes/root/index.d.ts.map +1 -0
- package/dist/routes/root/index.js +10 -8
- package/dist/routes/root/index.js.map +1 -1
- package/dist/routes/root/scripts/channels.d.ts +6 -0
- package/dist/routes/root/scripts/channels.d.ts.map +1 -0
- package/dist/routes/root/scripts/channels.js +147 -97
- package/dist/routes/root/scripts/channels.js.map +1 -1
- package/dist/routes/root/scripts/clientEscape.d.ts +22 -0
- package/dist/routes/root/scripts/clientEscape.d.ts.map +1 -0
- package/dist/routes/root/scripts/clientEscape.js +41 -0
- package/dist/routes/root/scripts/clientEscape.js.map +1 -0
- package/dist/routes/root/scripts/clientUrl.d.ts +23 -0
- package/dist/routes/root/scripts/clientUrl.d.ts.map +1 -0
- package/dist/routes/root/scripts/clientUrl.js +44 -0
- package/dist/routes/root/scripts/clientUrl.js.map +1 -0
- package/dist/routes/root/scripts/config.d.ts +6 -0
- package/dist/routes/root/scripts/config.d.ts.map +1 -0
- package/dist/routes/root/scripts/config.js +39 -22
- package/dist/routes/root/scripts/config.js.map +1 -1
- package/dist/routes/root/scripts/index.d.ts +1 -0
- package/dist/routes/root/scripts/index.d.ts.map +1 -0
- package/dist/routes/root/scripts/shared.d.ts +1 -0
- package/dist/routes/root/scripts/shared.d.ts.map +1 -0
- package/dist/routes/root/scripts/shared.js +52 -26
- package/dist/routes/root/scripts/shared.js.map +1 -1
- package/dist/routes/root/scripts/status.d.ts +1 -0
- package/dist/routes/root/scripts/status.d.ts.map +1 -0
- package/dist/routes/root/scripts/status.handlers.d.ts +18 -6
- package/dist/routes/root/scripts/status.handlers.d.ts.map +1 -0
- package/dist/routes/root/scripts/status.handlers.js +38 -32
- package/dist/routes/root/scripts/status.handlers.js.map +1 -1
- package/dist/routes/root/scripts/status.js +15 -7
- package/dist/routes/root/scripts/status.js.map +1 -1
- package/dist/routes/root/styles.d.ts +1 -0
- package/dist/routes/root/styles.d.ts.map +1 -0
- package/dist/routes/root/styles.js +7 -4
- package/dist/routes/root/styles.js.map +1 -1
- package/dist/routes/services.d.ts +13 -1
- package/dist/routes/services.d.ts.map +1 -0
- package/dist/routes/services.js +81 -68
- package/dist/routes/services.js.map +1 -1
- package/dist/routes/sse.d.ts +1 -0
- package/dist/routes/sse.d.ts.map +1 -0
- package/dist/routes/sse.js +1 -1
- package/dist/routes/sse.js.map +1 -1
- package/dist/routes/streams.d.ts +2 -1
- package/dist/routes/streams.d.ts.map +1 -0
- package/dist/routes/streams.js +1 -1
- package/dist/routes/theme.d.ts +3 -2
- package/dist/routes/theme.d.ts.map +1 -0
- package/dist/routes/theme.js +6 -5
- package/dist/routes/theme.js.map +1 -1
- package/dist/routes/ui.d.ts +3 -1
- package/dist/routes/ui.d.ts.map +1 -0
- package/dist/routes/ui.js +16 -4
- package/dist/routes/ui.js.map +1 -1
- package/dist/routes/upgrade.d.ts +1 -0
- package/dist/routes/upgrade.d.ts.map +1 -0
- package/dist/routes/upgrade.js +6 -2
- package/dist/routes/upgrade.js.map +1 -1
- package/dist/service/commands.context.d.ts +1 -0
- package/dist/service/commands.context.d.ts.map +1 -0
- package/dist/service/commands.context.js +3 -2
- package/dist/service/commands.context.js.map +1 -1
- package/dist/service/commands.d.ts +1 -0
- package/dist/service/commands.d.ts.map +1 -0
- package/dist/service/commands.js +10 -13
- package/dist/service/commands.js.map +1 -1
- package/dist/service/generators.context.d.ts +1 -0
- package/dist/service/generators.context.d.ts.map +1 -0
- package/dist/service/generators.d.ts +3 -2
- package/dist/service/generators.d.ts.map +1 -0
- package/dist/service/generators.js +108 -20
- package/dist/service/generators.js.map +1 -1
- package/dist/service/index.d.ts +1 -0
- package/dist/service/index.d.ts.map +1 -0
- package/dist/streaming/captureLock.d.ts +44 -0
- package/dist/streaming/captureLock.d.ts.map +1 -0
- package/dist/streaming/captureLock.js +95 -0
- package/dist/streaming/captureLock.js.map +1 -0
- package/dist/streaming/captureSession.d.ts +31 -0
- package/dist/streaming/captureSession.d.ts.map +1 -0
- package/dist/streaming/captureSession.js +54 -0
- package/dist/streaming/captureSession.js.map +1 -0
- package/dist/streaming/clients.d.ts +1 -0
- package/dist/streaming/clients.d.ts.map +1 -0
- package/dist/streaming/codec.d.ts +1 -0
- package/dist/streaming/codec.d.ts.map +1 -0
- package/dist/streaming/fmp4Segmenter.d.ts +29 -2
- package/dist/streaming/fmp4Segmenter.d.ts.map +1 -0
- package/dist/streaming/fmp4Segmenter.js +79 -26
- package/dist/streaming/fmp4Segmenter.js.map +1 -1
- package/dist/streaming/hls.d.ts +18 -7
- package/dist/streaming/hls.d.ts.map +1 -0
- package/dist/streaming/hls.js +219 -115
- package/dist/streaming/hls.js.map +1 -1
- package/dist/streaming/hlsResume.d.ts +1 -0
- package/dist/streaming/hlsResume.d.ts.map +1 -0
- package/dist/streaming/hlsResume.js +1 -1
- package/dist/streaming/hlsResume.js.map +1 -1
- package/dist/streaming/hlsSegments.d.ts +58 -1
- package/dist/streaming/hlsSegments.d.ts.map +1 -0
- package/dist/streaming/hlsSegments.js +147 -17
- package/dist/streaming/hlsSegments.js.map +1 -1
- package/dist/streaming/lifecycle.d.ts +4 -1
- package/dist/streaming/lifecycle.d.ts.map +1 -0
- package/dist/streaming/lifecycle.js +65 -85
- package/dist/streaming/lifecycle.js.map +1 -1
- package/dist/streaming/monitor.d.ts +6 -4
- package/dist/streaming/monitor.d.ts.map +1 -0
- package/dist/streaming/monitor.js +343 -145
- package/dist/streaming/monitor.js.map +1 -1
- package/dist/streaming/mp4Parser.d.ts +5 -4
- package/dist/streaming/mp4Parser.d.ts.map +1 -0
- package/dist/streaming/mp4Parser.js +36 -13
- package/dist/streaming/mp4Parser.js.map +1 -1
- package/dist/streaming/mpegts.d.ts +16 -0
- package/dist/streaming/mpegts.d.ts.map +1 -0
- package/dist/streaming/mpegts.js +61 -17
- package/dist/streaming/mpegts.js.map +1 -1
- package/dist/streaming/playlistBuilder.d.ts +1 -0
- package/dist/streaming/playlistBuilder.d.ts.map +1 -0
- package/dist/streaming/preroll.d.ts +31 -4
- package/dist/streaming/preroll.d.ts.map +1 -0
- package/dist/streaming/preroll.js +69 -27
- package/dist/streaming/preroll.js.map +1 -1
- package/dist/streaming/pretune.d.ts +26 -1
- package/dist/streaming/pretune.d.ts.map +1 -0
- package/dist/streaming/pretune.js +22 -24
- package/dist/streaming/pretune.js.map +1 -1
- package/dist/streaming/pretuneTimers.d.ts +24 -0
- package/dist/streaming/pretuneTimers.d.ts.map +1 -0
- package/dist/streaming/pretuneTimers.js +56 -0
- package/dist/streaming/pretuneTimers.js.map +1 -0
- package/dist/streaming/recovery.d.ts +139 -5
- package/dist/streaming/recovery.d.ts.map +1 -0
- package/dist/streaming/recovery.js +160 -16
- package/dist/streaming/recovery.js.map +1 -1
- package/dist/streaming/registry.d.ts +27 -9
- package/dist/streaming/registry.d.ts.map +1 -0
- package/dist/streaming/registry.js +21 -3
- package/dist/streaming/registry.js.map +1 -1
- package/dist/streaming/setup.d.ts +157 -29
- package/dist/streaming/setup.d.ts.map +1 -0
- package/dist/streaming/setup.js +1034 -458
- package/dist/streaming/setup.js.map +1 -1
- package/dist/streaming/showInfo.d.ts +21 -1
- package/dist/streaming/showInfo.d.ts.map +1 -0
- package/dist/streaming/showInfo.js +31 -16
- package/dist/streaming/showInfo.js.map +1 -1
- package/dist/streaming/statusEmitter.d.ts +5 -2
- package/dist/streaming/statusEmitter.d.ts.map +1 -0
- package/dist/streaming/statusEmitter.js +5 -3
- package/dist/streaming/statusEmitter.js.map +1 -1
- package/dist/types/channels.d.ts +15 -12
- package/dist/types/channels.d.ts.map +1 -0
- package/dist/types/channels.js +4 -2
- package/dist/types/channels.js.map +1 -1
- package/dist/types/config.d.ts +16 -5
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/index.d.ts +3 -2
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/profiles.d.ts +4 -2
- package/dist/types/profiles.d.ts.map +1 -0
- package/dist/types/selection.d.ts +31 -3
- package/dist/types/selection.d.ts.map +1 -0
- package/dist/types/selection.js +4 -2
- package/dist/types/selection.js.map +1 -1
- package/dist/types/shared.d.ts +1 -0
- package/dist/types/shared.d.ts.map +1 -0
- package/dist/types/streaming.d.ts +8 -0
- package/dist/types/streaming.d.ts.map +1 -0
- package/dist/upgrade/commands.context.d.ts +1 -0
- package/dist/upgrade/commands.context.d.ts.map +1 -0
- package/dist/upgrade/commands.d.ts +1 -0
- package/dist/upgrade/commands.d.ts.map +1 -0
- package/dist/upgrade/commands.js +1 -1
- package/dist/upgrade/commands.js.map +1 -1
- package/dist/upgrade/detection.context.d.ts +1 -0
- package/dist/upgrade/detection.context.d.ts.map +1 -0
- package/dist/upgrade/detection.context.js +2 -0
- package/dist/upgrade/detection.context.js.map +1 -1
- package/dist/upgrade/detection.d.ts +7 -6
- package/dist/upgrade/detection.d.ts.map +1 -0
- package/dist/upgrade/detection.js +4 -4
- package/dist/upgrade/index.d.ts +1 -0
- package/dist/upgrade/index.d.ts.map +1 -0
- package/dist/upgrade/lifecycle.context.d.ts +1 -0
- package/dist/upgrade/lifecycle.context.d.ts.map +1 -0
- package/dist/upgrade/lifecycle.d.ts +7 -7
- package/dist/upgrade/lifecycle.d.ts.map +1 -0
- package/dist/upgrade/lifecycle.js +9 -10
- package/dist/upgrade/lifecycle.js.map +1 -1
- package/dist/upgrade/pathHandle.d.ts +5 -3
- package/dist/upgrade/pathHandle.d.ts.map +1 -0
- package/dist/upgrade/pathHandle.js +3 -2
- package/dist/upgrade/pathHandle.js.map +1 -1
- package/dist/utils/bootSession.context.d.ts +1 -0
- package/dist/utils/bootSession.context.d.ts.map +1 -0
- package/dist/utils/bootSession.context.js +6 -5
- package/dist/utils/bootSession.context.js.map +1 -1
- package/dist/utils/bootSession.d.ts +1 -0
- package/dist/utils/bootSession.d.ts.map +1 -0
- package/dist/utils/bootSession.js.map +1 -1
- package/dist/utils/chromeFetch.d.ts +1 -0
- package/dist/utils/chromeFetch.d.ts.map +1 -0
- package/dist/utils/cliOutput.d.ts +1 -0
- package/dist/utils/cliOutput.d.ts.map +1 -0
- package/dist/utils/clock.d.ts +5 -4
- package/dist/utils/clock.d.ts.map +1 -0
- package/dist/utils/clock.js +19 -16
- package/dist/utils/clock.js.map +1 -1
- package/dist/utils/debugFilter.d.ts +9 -1
- package/dist/utils/debugFilter.d.ts.map +1 -0
- package/dist/utils/debugFilter.js +60 -33
- package/dist/utils/debugFilter.js.map +1 -1
- package/dist/utils/delay.d.ts +48 -15
- package/dist/utils/delay.d.ts.map +1 -0
- package/dist/utils/delay.js +73 -20
- package/dist/utils/delay.js.map +1 -1
- package/dist/utils/errors.d.ts +32 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +45 -4
- package/dist/utils/errors.js.map +1 -1
- package/dist/utils/evaluate.d.ts +1 -0
- package/dist/utils/evaluate.d.ts.map +1 -0
- package/dist/utils/evaluate.js +29 -23
- package/dist/utils/evaluate.js.map +1 -1
- package/dist/utils/ffmpeg.context.d.ts +1 -0
- package/dist/utils/ffmpeg.context.d.ts.map +1 -0
- package/dist/utils/ffmpeg.context.js.map +1 -1
- package/dist/utils/ffmpeg.d.ts +29 -7
- package/dist/utils/ffmpeg.d.ts.map +1 -0
- package/dist/utils/ffmpeg.js +31 -13
- package/dist/utils/ffmpeg.js.map +1 -1
- package/dist/utils/fileLogger.d.ts +3 -1
- package/dist/utils/fileLogger.d.ts.map +1 -0
- package/dist/utils/fileLogger.js +64 -29
- package/dist/utils/fileLogger.js.map +1 -1
- package/dist/utils/format.d.ts +14 -1
- package/dist/utils/format.d.ts.map +1 -0
- package/dist/utils/format.js +19 -5
- package/dist/utils/format.js.map +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/logEmitter.d.ts +1 -0
- package/dist/utils/logEmitter.d.ts.map +1 -0
- package/dist/utils/logger.d.ts +1 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +10 -6
- package/dist/utils/logger.js.map +1 -1
- package/dist/utils/m3u.d.ts +3 -2
- package/dist/utils/m3u.d.ts.map +1 -0
- package/dist/utils/m3u.js +4 -3
- package/dist/utils/m3u.js.map +1 -1
- package/dist/utils/markup.d.ts +4 -2
- package/dist/utils/markup.d.ts.map +1 -0
- package/dist/utils/markup.js +6 -5
- package/dist/utils/markup.js.map +1 -1
- package/dist/utils/memo.d.ts +3 -2
- package/dist/utils/memo.d.ts.map +1 -0
- package/dist/utils/memo.js +3 -3
- package/dist/utils/morganStream.d.ts +1 -0
- package/dist/utils/morganStream.d.ts.map +1 -0
- package/dist/utils/network.d.ts +1 -0
- package/dist/utils/network.d.ts.map +1 -0
- package/dist/utils/network.js +2 -2
- package/dist/utils/pid.d.ts +1 -0
- package/dist/utils/pid.d.ts.map +1 -0
- package/dist/utils/pid.js +3 -3
- package/dist/utils/platform.d.ts +3 -1
- package/dist/utils/platform.d.ts.map +1 -0
- package/dist/utils/platform.js +2 -1
- package/dist/utils/platform.js.map +1 -1
- package/dist/utils/processInspector.context.d.ts +1 -0
- package/dist/utils/processInspector.context.d.ts.map +1 -0
- package/dist/utils/processInspector.context.js +3 -1
- package/dist/utils/processInspector.context.js.map +1 -1
- package/dist/utils/processInspector.d.ts +4 -3
- package/dist/utils/processInspector.d.ts.map +1 -0
- package/dist/utils/processInspector.js +2 -0
- package/dist/utils/processInspector.js.map +1 -1
- package/dist/utils/retry.d.ts +24 -1
- package/dist/utils/retry.d.ts.map +1 -0
- package/dist/utils/retry.js +32 -5
- package/dist/utils/retry.js.map +1 -1
- package/dist/utils/runtimeIdentity.context.d.ts +1 -0
- package/dist/utils/runtimeIdentity.context.d.ts.map +1 -0
- package/dist/utils/runtimeIdentity.context.js +30 -0
- package/dist/utils/runtimeIdentity.context.js.map +1 -1
- package/dist/utils/runtimeIdentity.d.ts +6 -4
- package/dist/utils/runtimeIdentity.d.ts.map +1 -0
- package/dist/utils/runtimeIdentity.js +15 -5
- package/dist/utils/runtimeIdentity.js.map +1 -1
- package/dist/utils/sanitize.d.ts +1 -0
- package/dist/utils/sanitize.d.ts.map +1 -0
- package/dist/utils/streamContext.d.ts +2 -1
- package/dist/utils/streamContext.d.ts.map +1 -0
- package/dist/utils/streamContext.js +1 -1
- package/dist/utils/timing.d.ts +1 -0
- package/dist/utils/timing.d.ts.map +1 -0
- package/dist/utils/version.d.ts +1 -0
- package/dist/utils/version.d.ts.map +1 -0
- package/dist/utils/version.js +7 -3
- package/dist/utils/version.js.map +1 -1
- package/package.json +26 -20
package/dist/utils/errors.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
*
|
|
3
3
|
* errors.ts: Error formatting and handling utilities for PrismCast.
|
|
4
4
|
*/
|
|
5
|
-
/* These
|
|
6
|
-
*
|
|
5
|
+
/* These helpers group the error-handling primitives shared across the application: one normalizes arbitrary errors into log-ready text, the others classify
|
|
6
|
+
* browser-state failures so callers can abort a retry loop early, tell a dead page apart from a bad subject, or escalate an unrecoverable capture.
|
|
7
7
|
*/
|
|
8
8
|
/**
|
|
9
9
|
* Formats an error for logging by extracting the message if available, falling back to string conversion for non-Error objects. Trailing punctuation is stripped
|
|
@@ -29,12 +29,53 @@ export function formatError(error) {
|
|
|
29
29
|
* Checks whether an error indicates that the browser page or session has been closed or is otherwise unrecoverable. These errors should cause immediate abort of
|
|
30
30
|
* any retry loops rather than continuing to retry an operation that will never succeed. Common unrecoverable errors include closed targets, closed sessions, and
|
|
31
31
|
* detached frames (which occur when the page has been closed mid-operation).
|
|
32
|
+
*
|
|
33
|
+
* Matching ignores case. The same dead state reaches callers with different capitalization depending on which Puppeteer or CDP surface raised it, and a
|
|
34
|
+
* differently-capitalized closed target is the same closed target.
|
|
32
35
|
* @param error - The error to check.
|
|
33
36
|
* @returns True if the error indicates a closed or unrecoverable state.
|
|
34
37
|
*/
|
|
35
38
|
export function isSessionClosedError(error) {
|
|
36
|
-
const message = formatError(error);
|
|
37
|
-
const unrecoverablePatterns = ["
|
|
39
|
+
const message = formatError(error).toLowerCase();
|
|
40
|
+
const unrecoverablePatterns = ["target closed", "session closed", "detached frame"];
|
|
38
41
|
return unrecoverablePatterns.some((pattern) => message.includes(pattern));
|
|
39
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Checks whether an error means the DOM world an operation ran in ceased to exist. Two failure families union here: the page, target, or session is gone (what
|
|
45
|
+
* isSessionClosedError already covers), and the execution context or frame was torn down by a navigation or a teardown while the page itself may live on.
|
|
46
|
+
*
|
|
47
|
+
* The question this answers is about the world, not the work. An operation that failed this way reached no verdict on its own subject, so a caller deciding
|
|
48
|
+
* whether to discard cached state about that subject learns nothing from it and must keep the state.
|
|
49
|
+
*
|
|
50
|
+
* The context and frame wordings are matched as exact phrases rather than single words. A lone "destroyed" or "detached" turns up in errors that have nothing to
|
|
51
|
+
* do with page death - a DOM node detached from its document, an object destroyed by an unrelated teardown - and matching those would route ordinary failures
|
|
52
|
+
* into page-death handling. The phrases are the CDP error family; each one does not reach every call surface, since the evaluate wrapper rewrites the
|
|
53
|
+
* cannot-find-context wording into the context-destroyed one, but other Puppeteer surfaces still emit it directly.
|
|
54
|
+
*
|
|
55
|
+
* Composing isSessionClosedError formats the message twice on a call that matches neither family. That trade is deliberate: the session-closed patterns stay
|
|
56
|
+
* stated in exactly one place, and this runs only on an error path.
|
|
57
|
+
* @param error - The error to check.
|
|
58
|
+
* @returns True if the error indicates the page, execution context, or frame the operation ran in is gone.
|
|
59
|
+
*/
|
|
60
|
+
export function isPageDeathError(error) {
|
|
61
|
+
if (isSessionClosedError(error)) {
|
|
62
|
+
return true;
|
|
63
|
+
}
|
|
64
|
+
const message = formatError(error).toLowerCase();
|
|
65
|
+
const contextDeathPatterns = ["cannot find context with specified id", "execution context is not available", "execution context was destroyed",
|
|
66
|
+
"frame got detached", "frame was detached"];
|
|
67
|
+
return contextDeathPatterns.some((pattern) => message.includes(pattern));
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Checks whether an error is the stale-capture-mutex signal: Chrome's tabCapture extension rejects a second concurrent getStream() with "Cannot capture a tab with
|
|
71
|
+
* an active stream", and that rejection leaks puppeteer-stream's module-level mutex permanently, so the only recovery is a full process restart. This is the single
|
|
72
|
+
* home for that one literal - every site that must decide the process-exit escalation reads it from here. The predicate is deliberately narrow: session-closed-shaped
|
|
73
|
+
* rejections are common and benign, so widening it would exit the process on ordinary browser crashes. The related, broader capture-infrastructure classifier
|
|
74
|
+
* (isCaptureInfrastructureError in recovery.ts) matches this message too, but the process-exit decision this predicate gates stays its own distinct check.
|
|
75
|
+
* @param error - The error or message to check.
|
|
76
|
+
* @returns True if the error carries the stale-capture-mutex signature.
|
|
77
|
+
*/
|
|
78
|
+
export function isStaleCaptureMutexError(error) {
|
|
79
|
+
return formatError(error).includes("Cannot capture a tab with an active stream");
|
|
80
|
+
}
|
|
40
81
|
//# sourceMappingURL=errors.js.map
|
package/dist/utils/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/utils/errors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AAEH;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CAAC,KAAc;IAExC,IAAI,OAAe,CAAC;IAEpB,IAAG,KAAK,YAAY,KAAK,EAAE,CAAC;QAE1B,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;IAC1B,CAAC;SAAM,IAAG,KAAK,IAAI,CAAC,OAAQ,KAA+B,CAAC,OAAO,KAAK,QAAQ,CAAC,EAAE,CAAC;QAElF,OAAO,GAAI,KAA6B,CAAC,OAAO,CAAC;IACnD,CAAC;SAAM,CAAC;QAEN,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAC1B,CAAC;IAED,uFAAuF;IACvF,OAAO,OAAO,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;AACxC,CAAC;AAED
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/utils/errors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AAEH;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CAAC,KAAc;IAExC,IAAI,OAAe,CAAC;IAEpB,IAAG,KAAK,YAAY,KAAK,EAAE,CAAC;QAE1B,OAAO,GAAG,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W,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,4CAA4C,CAAC,CAAC;AACnF,CAAC"}
|
package/dist/utils/evaluate.d.ts
CHANGED
|
@@ -49,3 +49,4 @@ export declare class EvaluateAbortError extends Error {
|
|
|
49
49
|
* @throws Any error from the underlying evaluate call.
|
|
50
50
|
*/
|
|
51
51
|
export declare function evaluateWithAbort<T, Args extends unknown[]>(context: Frame | Page, pageFunction: (...args: Args) => T, args?: Args, timeoutMs?: number): Promise<T>;
|
|
52
|
+
//# sourceMappingURL=evaluate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evaluate.d.ts","sourceRoot":"","sources":["../../src/utils/evaluate.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AA8BlD;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,eAAe,GAAG,IAAI,CAG9F;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAGnE;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CAG3E;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS,CAGnF;AAED;;GAEG;AACH,qBAAa,oBAAqB,SAAQ,KAAK;gBAEjC,SAAS,EAAE,MAAM;CAM9B;AAED;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,KAAK;;CAQ5C;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,iBAAiB,CAAC,CAAC,EAAE,IAAI,SAAS,OAAO,EAAE,EAC/D,OAAO,EAAE,KAAK,GAAG,IAAI,EACrB,YAAY,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,CAAC,EAClC,IAAI,CAAC,EAAE,IAAI,EACX,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,CAAC,CAAC,CA2CZ"}
|
package/dist/utils/evaluate.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { composeSignals, waitWithSignal } from "homebridge-plugin-utils";
|
|
1
2
|
import { getStreamId } from "./streamContext.js";
|
|
2
|
-
import {
|
|
3
|
-
/* This module provides a wrapper around Puppeteer's page.evaluate() and frame.evaluate() that adds two
|
|
3
|
+
import { timeoutSignal } from "./delay.js";
|
|
4
|
+
/* This module provides a wrapper around Puppeteer's page.evaluate() and frame.evaluate() that adds two safety mechanisms:
|
|
4
5
|
*
|
|
5
6
|
* 1. Abort signal: When a stream is terminated, its AbortController is triggered, immediately rejecting all pending evaluate calls for that stream. This prevents zombie
|
|
6
7
|
* CDP calls from hanging for 180 seconds (Puppeteer's default protocolTimeout) when the browser becomes unresponsive.
|
|
@@ -11,8 +12,12 @@ import { raceWithTimeout } from "./delay.js";
|
|
|
11
12
|
* The wrapper automatically retrieves the abort signal from this module's local AbortController map using the stream context from AsyncLocalStorage. If no
|
|
12
13
|
* stream context is available (e.g., during browser initialization), it falls back to timeout-only behavior.
|
|
13
14
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
15
|
+
* Both interrupts are one kind of thing - an abort signal - so they compose into a single signal and the wait is one race rather than a race of races. That
|
|
16
|
+
* composition is also what keeps the long-lived per-stream signal clean: the composed signal is built per call and registers its dependency internally, so no
|
|
17
|
+
* user-visible listener ever accumulates on the stream's own signal no matter how many evaluate calls a stream makes.
|
|
18
|
+
*
|
|
19
|
+
* When aborting or timing out, the underlying CDP call is still pending in Puppeteer - we just stop waiting for it locally. Waiting through waitWithSignal
|
|
20
|
+
* observes the evaluate promise on every path, which marks it handled so a CDP call that rejects after we have moved on raises no unhandled rejection.
|
|
16
21
|
*/
|
|
17
22
|
// Default timeout for evaluate calls in milliseconds.
|
|
18
23
|
const DEFAULT_EVALUATE_TIMEOUT = 15000;
|
|
@@ -85,9 +90,9 @@ export async function evaluateWithAbort(context, pageFunction, args, timeoutMs)
|
|
|
85
90
|
const timeout = timeoutMs ?? DEFAULT_EVALUATE_TIMEOUT;
|
|
86
91
|
// Get stream context to find the abort signal.
|
|
87
92
|
const streamIdStr = getStreamId();
|
|
88
|
-
const
|
|
89
|
-
// Check if already aborted before starting.
|
|
90
|
-
if (
|
|
93
|
+
const streamSignal = streamIdStr !== undefined ? getAbortSignal(streamIdStr) : undefined;
|
|
94
|
+
// Check if already aborted before starting, so a stream that is already gone never issues a CDP call at all.
|
|
95
|
+
if (streamSignal?.aborted) {
|
|
91
96
|
throw new EvaluateAbortError();
|
|
92
97
|
}
|
|
93
98
|
// Start the evaluate call. We use 'as unknown as' to bypass TypeScript's strict function signature checking since Puppeteer's evaluate accepts various function
|
|
@@ -95,23 +100,24 @@ export async function evaluateWithAbort(context, pageFunction, args, timeoutMs)
|
|
|
95
100
|
const evaluatePromise = args ?
|
|
96
101
|
context.evaluate(pageFunction, ...args) :
|
|
97
102
|
context.evaluate(pageFunction);
|
|
98
|
-
//
|
|
99
|
-
//
|
|
100
|
-
|
|
101
|
-
//
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
signal.addEventListener("abort", () => { rejectAbort(new EvaluateAbortError()); }, { once: true });
|
|
103
|
+
// Hold the timeout's reason in a local so the translation below can compare against it by reference. Composing the stream signal with the timeout signal
|
|
104
|
+
// yields one interrupt source whose reason names which side fired: our own timeoutReason, or - since lifecycle.ts aborts a stream with no argument - the
|
|
105
|
+
// platform's AbortError for a stream termination. Those two can never be confused, and an evaluate rejection is never the signal's reason at all, so it falls
|
|
106
|
+
// through verbatim. When there is no stream signal, composeSignals hands back the timeout signal unwrapped and the bound is the whole story.
|
|
107
|
+
const timeoutReason = new EvaluateTimeoutError(timeout);
|
|
108
|
+
const timeoutHandle = timeoutSignal(timeout, timeoutReason);
|
|
109
|
+
const signal = composeSignals(streamSignal, timeoutHandle.signal);
|
|
110
|
+
try {
|
|
111
|
+
return await waitWithSignal(evaluatePromise, signal);
|
|
112
|
+
}
|
|
113
|
+
catch (error) {
|
|
114
|
+
if ((error === signal.reason) && (error !== timeoutReason)) {
|
|
115
|
+
throw new EvaluateAbortError();
|
|
112
116
|
}
|
|
113
|
-
|
|
117
|
+
throw error;
|
|
118
|
+
}
|
|
119
|
+
finally {
|
|
120
|
+
timeoutHandle.cancel();
|
|
114
121
|
}
|
|
115
|
-
return timeoutRace;
|
|
116
122
|
}
|
|
117
123
|
//# sourceMappingURL=evaluate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evaluate.js","sourceRoot":"","sources":["../../src/utils/evaluate.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"evaluate.js","sourceRoot":"","sources":["../../src/utils/evaluate.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C;;;;;;;;;;;;;;;;;GAiBG;AAEH,sDAAsD;AACtD,MAAM,wBAAwB,GAAG,KAAK,CAAC;AAEvC,gKAAgK;AAChK,MAAM,gBAAgB,GAAG,IAAI,GAAG,EAA2B,CAAC;AAE5D;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CAAC,WAAmB,EAAE,UAA2B;IAEtF,gBAAgB,CAAC,GAAG,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;AAChD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,yBAAyB,CAAC,WAAmB;IAE3D,gBAAgB,CAAC,MAAM,CAAC,WAAW,CAAC,CA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,CAAC;QACjF,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;IAEjC,yJAAyJ;IACzJ,yJAAyJ;IACzJ,8JAA8J;IAC9J,6IAA6I;IAC7I,MAAM,aAAa,GAAG,IAAI,oBAAoB,CAAC,OAAO,CAAC,CAAC;IACxD,MAAM,aAAa,GAAG,aAAa,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;IAC5D,MAAM,MAAM,GAAG,cAAc,CAAC,YAAY,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAElE,IAAI,CAAC;QAEH,OAAO,MAAM,cAAc,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC;IACvD,CAAC;IAAC,OAAM,KAAK,EAAE,CAAC;QAEd,IAAG,CAAC,KAAK,KAAK,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,KAAK,aAAa,CAAC,EAAE,CAAC;YAE1D,MAAM,IAAI,kBAAkB,EAAE,CAAC;QACjC,CAAC;QAED,MAAM,KAAK,CAAC;IACd,CAAC;YAAS,CAAC;QAET,aAAa,CAAC,MAAM,EAAE,CAAC;IACzB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ffmpeg.context.d.ts","sourceRoot":"","sources":["../../src/utils/ffmpeg.context.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAuBjD;;;GAGG;AACH,wBAAgB,0BAA0B,IAAI,aAAa,CAU1D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ffmpeg.context.js","sourceRoot":"","sources":["../../src/utils/ffmpeg.context.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ffmpeg.context.js","sourceRoot":"","sources":["../../src/utils/ffmpeg.context.ts"],"names":[],"mappings":"AAQA,OAAO,iBAAiB,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C;;;;;GAKG;AACH,KAAK,UAAU,iBAAiB,CAAC,WAAmB;IAElD,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,aAAa,EAAW,CAAC;IAC9D,MAAM,MAAM,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,EAAE,EAAE,KAAK,EAAE,CAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAE,EAAE,CAAC,CAAC;IAE7F,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9C,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,GAAG,OAAO,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAEtD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,0BAA0B;IAExC,OAAO;QAEL,WAAW,EAAE,iBAAiB;QAC9B,MAAM,EAAE,UAAU;QAClB,OAAO;QACP,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,KAAK,EAAE,iBAAiB;KACzB,CAAC;AACJ,CAAC"}
|
package/dist/utils/ffmpeg.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { Readable, Writable } from "node:stream";
|
|
2
2
|
import type { ChildProcess } from "node:child_process";
|
|
3
3
|
/**
|
|
4
|
-
* The runtime context
|
|
5
|
-
* detected platform, the spawn-based probe, and the bundled FFmpeg path from the ffmpeg-for-homebridge npm package. Production wires
|
|
6
|
-
* createDefaultFFmpegContext (in ffmpeg.context.ts); tests pass a context literal.
|
|
4
|
+
* The runtime context probeFFmpegPath (and getBundledFFmpegPath) consume. Models the I/O boundary used by path resolution: filesystem existence checks, the
|
|
5
|
+
* user's home directory, the detected platform, the spawn-based probe, and the bundled FFmpeg path from the ffmpeg-for-homebridge npm package. Production wires
|
|
6
|
+
* it through createDefaultFFmpegContext (in ffmpeg.context.ts); tests pass a context literal.
|
|
7
7
|
*/
|
|
8
8
|
export interface FFmpegContext {
|
|
9
9
|
readonly bundledPath: string | undefined;
|
|
@@ -41,8 +41,8 @@ export declare function probeFFmpegPath(ctx?: FFmpegContext): Promise<string | u
|
|
|
41
41
|
/**
|
|
42
42
|
* Resolves the FFmpeg executable path against the production filesystem. Memoized via memoizeAsync: first call probes; subsequent calls return the cached
|
|
43
43
|
* result. Used by production code paths (server startup, health checks, stream setup). Tests should use probeFFmpegPath against synthetic contexts instead -
|
|
44
|
-
* this function intentionally
|
|
45
|
-
* concurrent-caller dedup, sticky rejection) is exercised by memo.test.ts against the underlying primitive.
|
|
44
|
+
* this function intentionally takes no parameters, so tests have no way to substitute its dependencies and the caching contract stays sealed. The
|
|
45
|
+
* memoization correctness (single-shot probe, concurrent-caller dedup, sticky rejection) is exercised by memo.test.ts against the underlying primitive.
|
|
46
46
|
*
|
|
47
47
|
* Sticky-rejection caveat: memoizeAsync caches a probe rejection for the lifetime of the process - all future callers receive the same rejected promise
|
|
48
48
|
* without re-probing. probeFFmpegPath today returns undefined for the "not found" case rather than throwing, so this branch never fires in practice. Future
|
|
@@ -61,6 +61,27 @@ export interface FFmpegProcess {
|
|
|
61
61
|
stdin: Writable;
|
|
62
62
|
stdout: Readable;
|
|
63
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* The outcome of classifying an FFmpeg process exit event. A discriminated union on outcome so callers can branch without inspecting an optional message field.
|
|
66
|
+
*/
|
|
67
|
+
export type FfmpegExitOutcome = {
|
|
68
|
+
outcome: "error";
|
|
69
|
+
message: string;
|
|
70
|
+
} | {
|
|
71
|
+
outcome: "normal";
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Classifies an FFmpeg process exit from its reported code and signal. Pure: the shuttingDown suppression happens in the caller before this function is ever
|
|
75
|
+
* invoked, so this function only ever classifies exits the caller actually wants judged. SIGTERM is graceful termination via kill() and always classifies as
|
|
76
|
+
* normal regardless of the exit code, because a killed process can still report whatever code it happened to be mid-exit with. A non-zero code is checked before
|
|
77
|
+
* signal presence, so a non-zero code accompanied by a signal still yields the code-based message; a truthy signal that is not SIGTERM (e.g. SIGKILL, SIGSEGV)
|
|
78
|
+
* only produces its own message when the code was null.
|
|
79
|
+
* @param code - The process exit code, or null if the process was terminated by a signal.
|
|
80
|
+
* @param signal - The signal that terminated the process, or null if it exited via a normal code.
|
|
81
|
+
* @param label - Descriptive label for the error message (e.g., "FFmpeg", "MPEG-TS remuxer").
|
|
82
|
+
* @returns The classified outcome: normal, or error with a formatted message.
|
|
83
|
+
*/
|
|
84
|
+
export declare function classifyFfmpegExit(code: number | null, signal: NodeJS.Signals | null, label: string): FfmpegExitOutcome;
|
|
64
85
|
/**
|
|
65
86
|
* Options for buildSpawnFFmpegArgs. Keeping the platform as an injected option (defaulting to process.platform) lets tests verify both the macOS and non-macOS
|
|
66
87
|
* branches independently rather than re-asserting whatever branch the host happens to take.
|
|
@@ -116,8 +137,9 @@ export declare function spawnFFmpeg(ffmpegBin: string, audioBitrate: number, onE
|
|
|
116
137
|
export declare function spawnMpegTsRemuxer(ffmpegBin: string, onError: (error: Error) => void, streamId?: string): FFmpegProcess;
|
|
117
138
|
/**
|
|
118
139
|
* Checks if FFmpeg is available on the system. Wraps the production-cached resolveFFmpegPath, so first call probes the filesystem and subsequent calls return
|
|
119
|
-
* the memoized result. Tests should use probeFFmpegPath against synthetic contexts instead - this function delegates to the singleton resolver and
|
|
120
|
-
*
|
|
140
|
+
* the memoized result. Tests should use probeFFmpegPath against synthetic contexts instead - this function delegates to the singleton resolver and offers no
|
|
141
|
+
* way for tests to substitute its dependencies.
|
|
121
142
|
* @returns Promise resolving to true if FFmpeg is available, false otherwise.
|
|
122
143
|
*/
|
|
123
144
|
export declare function isFFmpegAvailable(): Promise<boolean>;
|
|
145
|
+
//# sourceMappingURL=ffmpeg.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ffmpeg.d.ts","sourceRoot":"","sources":["../../src/utils/ffmpeg.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAWvD;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAG5B,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAGzC,QAAQ,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;IAG3C,QAAQ,CAAC,OAAO,EAAE,MAAM,MAAM,CAAC;IAG/B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC;IAGnC,QAAQ,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CACpD;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,GAAE,aAA4C,GAAG,MAAM,GAAG,SAAS,CAQ1G;AAaD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,eAAe,CAAC,GAAG,GAAE,aAA4C,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CA0DpH;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,iBAAiB,mCAAkE,CAAC;AAIjG;;GAEG;AACH,MAAM,WAAW,aAAa;IAG5B,IAAI,EAAE,MAAM,IAAI,CAAC;IAGjB,OAAO,EAAE,YAAY,CAAC;IAGtB,KAAK,EAAE,QAAQ,CAAC;IAGhB,MAAM,EAAE,QAAQ,CAAC;CAClB;AAqBD;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAAE,OAAO,EAAE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g executable path against the production filesystem. Memoized via memoizeAsync: first call probes; subsequent calls return the cached
|
|
92
92
|
* result. Used by production code paths (server startup, health checks, stream setup). Tests should use probeFFmpegPath against synthetic contexts instead -
|
|
93
|
-
* this function intentionally
|
|
94
|
-
* concurrent-caller dedup, sticky rejection) is exercised by memo.test.ts against the underlying primitive.
|
|
93
|
+
* this function intentionally takes no parameters, so tests have no way to substitute its dependencies and the caching contract stays sealed. The
|
|
94
|
+
* memoization correctness (single-shot probe, concurrent-caller dedup, sticky rejection) is exercised by memo.test.ts against the underlying primitive.
|
|
95
95
|
*
|
|
96
96
|
* Sticky-rejection caveat: memoizeAsync caches a probe rejection for the lifetime of the process - all future callers receive the same rejected promise
|
|
97
97
|
* without re-probing. probeFFmpegPath today returns undefined for the "not found" case rather than throwing, so this branch never fires in practice. Future
|
|
@@ -116,6 +116,30 @@ const MPEGTS_OUTPUT_FLAGS = [
|
|
|
116
116
|
"-pcr_period", "40",
|
|
117
117
|
"-flush_packets", "1"
|
|
118
118
|
];
|
|
119
|
+
/**
|
|
120
|
+
* Classifies an FFmpeg process exit from its reported code and signal. Pure: the shuttingDown suppression happens in the caller before this function is ever
|
|
121
|
+
* invoked, so this function only ever classifies exits the caller actually wants judged. SIGTERM is graceful termination via kill() and always classifies as
|
|
122
|
+
* normal regardless of the exit code, because a killed process can still report whatever code it happened to be mid-exit with. A non-zero code is checked before
|
|
123
|
+
* signal presence, so a non-zero code accompanied by a signal still yields the code-based message; a truthy signal that is not SIGTERM (e.g. SIGKILL, SIGSEGV)
|
|
124
|
+
* only produces its own message when the code was null.
|
|
125
|
+
* @param code - The process exit code, or null if the process was terminated by a signal.
|
|
126
|
+
* @param signal - The signal that terminated the process, or null if it exited via a normal code.
|
|
127
|
+
* @param label - Descriptive label for the error message (e.g., "FFmpeg", "MPEG-TS remuxer").
|
|
128
|
+
* @returns The classified outcome: normal, or error with a formatted message.
|
|
129
|
+
*/
|
|
130
|
+
export function classifyFfmpegExit(code, signal, label) {
|
|
131
|
+
if (signal === "SIGTERM") {
|
|
132
|
+
// Normal termination via kill() - do not treat as error.
|
|
133
|
+
return { outcome: "normal" };
|
|
134
|
+
}
|
|
135
|
+
if ((code !== null) && (code !== 0)) {
|
|
136
|
+
return { message: label + " exited with code " + String(code) + ".", outcome: "error" };
|
|
137
|
+
}
|
|
138
|
+
if (signal) {
|
|
139
|
+
return { message: label + " killed by signal " + signal + ".", outcome: "error" };
|
|
140
|
+
}
|
|
141
|
+
return { outcome: "normal" };
|
|
142
|
+
}
|
|
119
143
|
// Internal Helper.
|
|
120
144
|
/**
|
|
121
145
|
* Spawns an FFmpeg process with shared lifecycle management. Handles stderr logging with noise filtering, exit and error callbacks, and graceful shutdown for all
|
|
@@ -150,15 +174,9 @@ function spawnFFmpegProcess({ args, ffmpegBin, label, onError, streamId }) {
|
|
|
150
174
|
if (shuttingDown) {
|
|
151
175
|
return;
|
|
152
176
|
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
}
|
|
157
|
-
if ((code !== null) && (code !== 0)) {
|
|
158
|
-
onError(new Error(label + " exited with code " + String(code) + "."));
|
|
159
|
-
}
|
|
160
|
-
else if (signal) {
|
|
161
|
-
onError(new Error(label + " killed by signal " + signal + "."));
|
|
177
|
+
const result = classifyFfmpegExit(code, signal, label);
|
|
178
|
+
if (result.outcome === "error") {
|
|
179
|
+
onError(new Error(result.message));
|
|
162
180
|
}
|
|
163
181
|
});
|
|
164
182
|
// Handle spawn errors (e.g., FFmpeg not found).
|
|
@@ -284,8 +302,8 @@ export function spawnMpegTsRemuxer(ffmpegBin, onError, streamId) {
|
|
|
284
302
|
}
|
|
285
303
|
/**
|
|
286
304
|
* Checks if FFmpeg is available on the system. Wraps the production-cached resolveFFmpegPath, so first call probes the filesystem and subsequent calls return
|
|
287
|
-
* the memoized result. Tests should use probeFFmpegPath against synthetic contexts instead - this function delegates to the singleton resolver and
|
|
288
|
-
*
|
|
305
|
+
* the memoized result. Tests should use probeFFmpegPath against synthetic contexts instead - this function delegates to the singleton resolver and offers no
|
|
306
|
+
* way for tests to substitute its dependencies.
|
|
289
307
|
* @returns Promise resolving to true if FFmpeg is available, false otherwise.
|
|
290
308
|
*/
|
|
291
309
|
export async function isFFmpegAvailable() {
|
package/dist/utils/ffmpeg.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ffmpeg.js","sourceRoot":"","sources":["../../src/utils/ffmpeg.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,iKAAiK;AACjK,2EAA2E;AAC3E,MAAM,qBAAqB,GAAG,CAAE,mBAAmB,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,CAAE,CAAC;AAyBxG;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAAqB,0BAA0B,EAAE;IAEpF,IAAG,GAAG,CAAC,WAAW,IAAI,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC;QAElD,OAAO,GAAG,CAAC,WAAW,CAAC;IACzB,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,iKAAiK;AACjK,4JAA4J;AAC5J,MAAM,kBAAkB,GAAsB;IAC5C,cAAc;IACd,UAAU;IACV,WAAW,EAAE,SAAS;IACtB,SAAS,EAAE,iBAAiB;IAC5B,aAAa,EAAE,YAAY;IAC3B,YAAY,EAAE,OAAO;CACtB,CAAC;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,MAAqB,0BAA0B,EAAE;IAEr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CAAC,QAAQ,CAAC,CAAC;IAE1B,OAAO,UAAU,CAAC;AACpB,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,sBAAsB;IAEpC,OAAO;QACL,GAAG,kBAAkB;QACrB,oFAAoF;QACpF,IAAI,EAAE,KAAK;QACX,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,MAAM;QACZ,GAAG,mBAAmB;QACtB,2BAA2B;QAC3B,QAAQ;KACT,CAAC;AACJ,CAAC;AAED,0BAA0B;AAE1B;;;;;;;;;;GAUG;AACH,MAAM,UAAU,WAAW,CAAC,SAAiB,EAAE,YAAoB,EAAE,OAA+B,EAAE,QAAiB,EAAE,OAAgB;IAEvI,OAAO,kBAAkB,CAAC;QAExB,IAAI,EAAE,oBAAoB,CAAC,YAAY,EAAE,EAAE,OAAO,EAAE,CAAC;QACrD,SAAS;QACT,KAAK,EAAE,QAAQ;QACf,OAAO;QACP,QAAQ;KACT,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,kBAAkB,CAAC,SAAiB,EAAE,OAA+B,EAAE,QAAiB;IAEtG,OAAO,kBAAkB,CAAC;QAExB,IAAI,EAAE,sBAAsB,EAAE;QAC9B,SAAS;QACT,KAAK,EAAE,iBAAiB;QACxB,OAAO;QACP,QAAQ;KACT,CAAC,CAAC;AACL,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB;IAErC,OAAO,CAAC,MAAM,iBAAiB,EAAE,CAAC,KAAK,SAAS,CAAC;AACnD,CAAC"}
|
|
@@ -15,7 +15,8 @@ export declare function initializeFileLogger(logPath: string, maxSize: number):
|
|
|
15
15
|
*/
|
|
16
16
|
export declare function writeLogEntry(level: string, message: string, color: LogColor, categoryTag?: string): void;
|
|
17
17
|
/**
|
|
18
|
-
* Flushes the write buffer to disk asynchronously. Called periodically by the flush timer.
|
|
18
|
+
* Flushes the write buffer to disk asynchronously. Called periodically by the flush timer. The append is routed through the write-ordering chain so it cannot
|
|
19
|
+
* interleave with an in-flight trim, which would otherwise discard the appended lines when the trim renames its stale snapshot over the file.
|
|
19
20
|
*/
|
|
20
21
|
export declare function flushLogBuffer(): Promise<void>;
|
|
21
22
|
/**
|
|
@@ -40,3 +41,4 @@ export declare function computeTrimmedLogContent(content: string, maxSize: numbe
|
|
|
40
41
|
* Shuts down the file logger, flushing any remaining buffer synchronously.
|
|
41
42
|
*/
|
|
42
43
|
export declare function shutdownFileLogger(): void;
|
|
44
|
+
//# sourceMappingURL=fileLogger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fileLogger.d.ts","sourceRoot":"","sources":["../../src/utils/fileLogger.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAYlD,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,IAAI,CAAC;AAsExD;;;;GAIG;AACH,wBAAsB,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA0C1F;AAID;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAqCzG;AAwBD;;;GAGG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CAgCpD;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,IAAI,CAoBzC;AAwCD;;;;;;;;;;;;GAYG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,CA4B3F;AAiDD;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,IAAI,CA6BzC"}
|
package/dist/utils/fileLogger.js
CHANGED
|
@@ -34,6 +34,13 @@ let writeCount = 0;
|
|
|
34
34
|
let flushTimer = null;
|
|
35
35
|
// Flag indicating whether the file logger is initialized and operational.
|
|
36
36
|
let isInitialized = false;
|
|
37
|
+
/* Tail of the write-ordering chain. Every asynchronous mutation of the log file (buffer flushes and trims) is appended to this promise so that the operations run
|
|
38
|
+
* strictly one after another. Without this serialization a flush's appendFile could land between a trim's readFile and its rename, and the rename would then
|
|
39
|
+
* overwrite the just-appended lines with stale trimmed content - silently dropping log entries. Routing both paths through a single ordering primitive makes
|
|
40
|
+
* "read-modify-rename" and "append" mutually exclusive without an explicit lock. The tail never rejects: the helper that enqueues work swallows the settled
|
|
41
|
+
* outcome before chaining the next operation, so one failing operation cannot poison the chain for subsequent writes.
|
|
42
|
+
*/
|
|
43
|
+
let writeChain = Promise.resolve();
|
|
37
44
|
// Flag to temporarily disable logging on write errors, preventing error cascades.
|
|
38
45
|
let isDisabled = false;
|
|
39
46
|
// Timestamp when logging was disabled due to error, for retry timing.
|
|
@@ -122,29 +129,48 @@ export function writeLogEntry(level, message, color, categoryTag) {
|
|
|
122
129
|
void checkAndTrimFile();
|
|
123
130
|
}
|
|
124
131
|
}
|
|
132
|
+
// Write Ordering.
|
|
133
|
+
/**
|
|
134
|
+
* Serializes an asynchronous log-file mutation against every other such mutation. The supplied operation is appended to the module-scoped write chain so that
|
|
135
|
+
* flushes and trims execute one at a time, never interleaving their read/append/rename steps. The returned promise resolves when this specific operation has
|
|
136
|
+
* settled. The chain itself is advanced with the settled (caught) result so a rejecting operation cannot poison subsequent writes - each operation is responsible
|
|
137
|
+
* for its own error handling, exactly as the inline try/catch blocks did before serialization.
|
|
138
|
+
* @param operation - The async mutation to run after all previously enqueued mutations have completed.
|
|
139
|
+
*/
|
|
140
|
+
async function serializeWrite(operation) {
|
|
141
|
+
// Chain this operation after the current tail, then advance the tail to a promise that always resolves so a single failure does not break ordering for the next
|
|
142
|
+
// caller. We capture the run promise to return it, while the tail intentionally swallows the outcome.
|
|
143
|
+
const run = writeChain.then(operation);
|
|
144
|
+
writeChain = run.then(() => undefined, () => undefined);
|
|
145
|
+
return run;
|
|
146
|
+
}
|
|
125
147
|
// Buffer Flushing.
|
|
126
148
|
/**
|
|
127
|
-
* Flushes the write buffer to disk asynchronously. Called periodically by the flush timer.
|
|
149
|
+
* Flushes the write buffer to disk asynchronously. Called periodically by the flush timer. The append is routed through the write-ordering chain so it cannot
|
|
150
|
+
* interleave with an in-flight trim, which would otherwise discard the appended lines when the trim renames its stale snapshot over the file.
|
|
128
151
|
*/
|
|
129
152
|
export async function flushLogBuffer() {
|
|
130
153
|
if (!isInitialized || !logFilePath || (writeBuffer.length === 0)) {
|
|
131
154
|
return;
|
|
132
155
|
}
|
|
133
|
-
// Take the current buffer and reset.
|
|
156
|
+
// Take the current buffer and reset. We snapshot the path as well so the serialized operation is not affected by a concurrent shutdown clearing logFilePath.
|
|
134
157
|
const entries = writeBuffer;
|
|
158
|
+
const targetPath = logFilePath;
|
|
135
159
|
writeBuffer = [];
|
|
136
160
|
const content = entries.join("");
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
161
|
+
return serializeWrite(async () => {
|
|
162
|
+
try {
|
|
163
|
+
await fsPromises.appendFile(targetPath, content, "utf-8");
|
|
164
|
+
}
|
|
165
|
+
catch (error) {
|
|
166
|
+
// Disable logging temporarily to prevent error cascade.
|
|
167
|
+
isDisabled = true;
|
|
168
|
+
disabledAt = Date.now();
|
|
169
|
+
// Log to console as fallback.
|
|
170
|
+
// eslint-disable-next-line no-console
|
|
171
|
+
console.error("Failed to write to log file: %s. File logging disabled for %s seconds.", (error instanceof Error) ? error.message : String(error), ERROR_RETRY_DELAY_MS / 1000);
|
|
172
|
+
}
|
|
173
|
+
});
|
|
148
174
|
}
|
|
149
175
|
/**
|
|
150
176
|
* Flushes the write buffer to disk synchronously. Used during shutdown to ensure final logs are written.
|
|
@@ -228,28 +254,35 @@ export function computeTrimmedLogContent(content, maxSize) {
|
|
|
228
254
|
/**
|
|
229
255
|
* Trims the log file to half the maximum size, keeping only complete lines. The most recent logs are preserved. Pure cut logic lives in
|
|
230
256
|
* computeTrimmedLogContent; this function is the I/O orchestration shell around it.
|
|
257
|
+
*
|
|
258
|
+
* The entire read/write/rename critical section runs inside the write-ordering chain so it is serialized against buffer flushes. This closes the trim/flush race:
|
|
259
|
+
* an appendFile cannot land between this function's readFile and its rename, so the rename never overwrites freshly appended lines with a stale snapshot.
|
|
231
260
|
*/
|
|
232
261
|
async function trimLogFile() {
|
|
233
262
|
if (!logFilePath) {
|
|
234
263
|
return;
|
|
235
264
|
}
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
265
|
+
// Snapshot the path so a concurrent shutdown clearing logFilePath cannot redirect the rename target mid-operation.
|
|
266
|
+
const targetPath = logFilePath;
|
|
267
|
+
return serializeWrite(async () => {
|
|
268
|
+
try {
|
|
269
|
+
const content = await fsPromises.readFile(targetPath, "utf-8");
|
|
270
|
+
const trimmedContent = computeTrimmedLogContent(content, maxLogSize);
|
|
271
|
+
if (trimmedContent === null) {
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
// Write to temp file, then rename (atomic replace).
|
|
275
|
+
const tempPath = targetPath + ".tmp";
|
|
276
|
+
await fsPromises.writeFile(tempPath, trimmedContent, "utf-8");
|
|
277
|
+
await fsPromises.rename(tempPath, targetPath);
|
|
278
|
+
approximateSize = trimmedContent.length;
|
|
241
279
|
}
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
}
|
|
248
|
-
catch (error) {
|
|
249
|
-
// Log to console but continue operating - trim will be retried on next check.
|
|
250
|
-
// eslint-disable-next-line no-console
|
|
251
|
-
console.warn("Error trimming log file: %s.", (error instanceof Error) ? error.message : String(error));
|
|
252
|
-
}
|
|
280
|
+
catch (error) {
|
|
281
|
+
// Log to console but continue operating - trim will be retried on next check.
|
|
282
|
+
// eslint-disable-next-line no-console
|
|
283
|
+
console.warn("Error trimming log file: %s.", (error instanceof Error) ? error.message : String(error));
|
|
284
|
+
}
|
|
285
|
+
});
|
|
253
286
|
}
|
|
254
287
|
// Shutdown.
|
|
255
288
|
/**
|
|
@@ -275,5 +308,7 @@ export function shutdownFileLogger() {
|
|
|
275
308
|
approximateSize = 0;
|
|
276
309
|
writeCount = 0;
|
|
277
310
|
logFilePath = null;
|
|
311
|
+
// Reset the write-ordering chain so the next run starts from a fresh, already-resolved tail rather than chaining onto the previous run's last operation.
|
|
312
|
+
writeChain = Promise.resolve();
|
|
278
313
|
}
|
|
279
314
|
//# sourceMappingURL=fileLogger.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fileLogger.js","sourceRoot":"","sources":["../../src/utils/fileLogger.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC;AAOpC;;;;;;;;;;;;;;GAcG;AAEH;;GAEG;AAEH,mDAAmD;AACnD,IAAI,WAAW,GAAqB,IAAI,CAAC;AAEzC,6DAA6D;AAC7D,IAAI,WAAW,GAAa,EAAE,CAAC;AAE/B,2EAA2E;AAC3E,IAAI,eAAe,GAAG,CAAC,CAAC;AAExB,0DAA0D;AAC1D,IAAI,UAAU,GAAG,CAAC,CAAC;AAEnB,sCAAsC;AACtC,IAAI,UAAU,GAA6C,IAAI,CAAC;AAEhE,0EAA0E;AAC1E,IAAI,aA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AAG,EAAE,CAAC;IACjB,eAAe,GAAG,CAAC,CAAC;IACpB,UAAU,GAAG,CAAC,CAAC;IACf,WAAW,GAAG,IAAI,CAAC;IAEnB,yJAAyJ;IACzJ,UAAU,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;AACjC,CAAC"}
|
package/dist/utils/format.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import type { Nullable } from "../types/index.ts";
|
|
1
2
|
/**
|
|
2
3
|
* Formats the current date and time as a log timestamp string: `yyyy/mm/dd hh:mm:ss.mmm AM/PM`. Uses 12-hour time with decimalized seconds and AM/PM.
|
|
3
|
-
* Single source of truth for all log timestamp formatting - used by the console wrapper in app.ts, the file logger,
|
|
4
|
+
* Single source of truth for all log timestamp formatting - used by the console wrapper in app.ts, the file logger, the Morgan HTTP request logger, and the SSE log
|
|
5
|
+
* emitter.
|
|
4
6
|
* @returns Formatted timestamp string.
|
|
5
7
|
*/
|
|
6
8
|
export declare function formatTimestamp(): string;
|
|
@@ -30,6 +32,16 @@ export declare function formatTimeAgo(timestamp: number): string;
|
|
|
30
32
|
* @returns The concise domain, or the original URL if parsing fails.
|
|
31
33
|
*/
|
|
32
34
|
export declare function extractDomain(url: string): string;
|
|
35
|
+
/**
|
|
36
|
+
* Extracts the pathname portion of a URL - everything from the leading slash up to but excluding the query string and fragment - or null when the URL cannot be
|
|
37
|
+
* parsed. Placed beside extractDomain as the shared home for URL-part extraction, but with the opposite parse-failure contract: extractDomain returns the original
|
|
38
|
+
* string as a display fallback, while extractPathname returns null so a caller can tell could-not-parse apart from a genuinely parsed pathname. Membership
|
|
39
|
+
* comparisons need that distinction - treating an unparseable URL as a non-matching pathname would be actively wrong, so null lets the caller stay
|
|
40
|
+
* member-conservative instead.
|
|
41
|
+
* @param url - The URL to extract the pathname from.
|
|
42
|
+
* @returns The pathname, or null when parsing fails.
|
|
43
|
+
*/
|
|
44
|
+
export declare function extractPathname(url: string): Nullable<string>;
|
|
33
45
|
/**
|
|
34
46
|
* Capitalizes the first letter of a string.
|
|
35
47
|
* @param str - The string to capitalize.
|
|
@@ -44,3 +56,4 @@ export declare function capitalize(str: string): string;
|
|
|
44
56
|
* @returns The JSON string.
|
|
45
57
|
*/
|
|
46
58
|
export declare function stringifySorted(data: unknown, indent?: number): string;
|
|
59
|
+
//# sourceMappingURL=format.d.ts.map
|