prismcast 1.10.2 → 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 +6 -3
- package/dist/app.d.ts.map +1 -0
- package/dist/app.js +140 -86
- 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 +55 -0
- package/dist/browser/hlsPlaylistObserver.d.ts.map +1 -0
- package/dist/browser/hlsPlaylistObserver.js +132 -0
- package/dist/browser/hlsPlaylistObserver.js.map +1 -0
- package/dist/browser/index.d.ts +67 -40
- package/dist/browser/index.d.ts.map +1 -0
- package/dist/browser/index.js +508 -300
- 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 +102 -49
- package/dist/browser/manifestInterceptor.d.ts.map +1 -0
- package/dist/browser/manifestInterceptor.js +219 -237
- 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 +49 -0
- package/dist/browser/tabNetworkObserver.d.ts.map +1 -0
- package/dist/browser/tabNetworkObserver.js +144 -0
- package/dist/browser/tabNetworkObserver.js.map +1 -0
- 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 +27 -21
- 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 +10 -9
- package/dist/config/paths.d.ts.map +1 -0
- package/dist/config/paths.js +11 -11
- 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 +22 -15
- package/dist/config/profiles.d.ts.map +1 -0
- package/dist/config/profiles.js +81 -47
- 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 +21 -15
- package/dist/config/services.d.ts.map +1 -0
- package/dist/config/services.js +35 -24
- package/dist/config/services.js.map +1 -1
- package/dist/config/sites.d.ts +6 -4
- package/dist/config/sites.d.ts.map +1 -0
- package/dist/config/sites.js +15 -11
- package/dist/config/sites.js.map +1 -1
- package/dist/config/userChannels.d.ts +129 -30
- package/dist/config/userChannels.d.ts.map +1 -0
- package/dist/config/userChannels.js +333 -68
- 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 +10 -6
- package/dist/config/userProfiles.d.ts.map +1 -0
- package/dist/config/userProfiles.js +64 -39
- 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 +11 -12
- 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 +40 -17
- package/dist/native/index.d.ts.map +1 -0
- package/dist/native/index.js +281 -120
- 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 +57 -5
- package/dist/native/proxy.d.ts.map +1 -0
- package/dist/native/proxy.js +604 -170
- 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 +98 -0
- package/dist/routes/clientActions.d.ts.map +1 -0
- package/dist/routes/clientActions.js +113 -0
- package/dist/routes/clientActions.js.map +1 -0
- package/dist/routes/components.d.ts +5 -3
- package/dist/routes/components.d.ts.map +1 -0
- package/dist/routes/components.js +36 -39
- 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 +85 -93
- 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 +24 -0
- package/dist/routes/config/channels/healthBridge.d.ts.map +1 -0
- package/dist/routes/config/channels/healthBridge.js +71 -0
- package/dist/routes/config/channels/healthBridge.js.map +1 -0
- 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 +148 -107
- 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 +57 -43
- 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 +98 -49
- 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 +277 -139
- 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 +14 -4
- 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 +29 -26
- 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 +26 -21
- 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 +197 -118
- 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 +110 -24
- 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 +112 -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 +23 -33
- package/dist/routes/root/scripts/status.handlers.d.ts.map +1 -0
- package/dist/routes/root/scripts/status.handlers.js +46 -92
- package/dist/routes/root/scripts/status.handlers.js.map +1 -1
- package/dist/routes/root/scripts/status.js +21 -8
- 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 +6 -4
- package/dist/routes/streams.js.map +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 +4 -3
- 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.context.js +1 -1
- package/dist/service/generators.context.js.map +1 -1
- package/dist/service/generators.d.ts +4 -3
- package/dist/service/generators.d.ts.map +1 -0
- package/dist/service/generators.js +111 -31
- 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 +220 -120
- 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 +59 -2
- 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 +32 -5
- package/dist/streaming/preroll.d.ts.map +1 -0
- package/dist/streaming/preroll.js +70 -32
- 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 +10 -10
- package/dist/streaming/statusEmitter.d.ts.map +1 -0
- package/dist/streaming/statusEmitter.js +5 -8
- package/dist/streaming/statusEmitter.js.map +1 -1
- package/dist/types/channels.d.ts +16 -4
- 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 +6 -4
- 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.context.js +14 -10
- package/dist/upgrade/commands.context.js.map +1 -1
- package/dist/upgrade/commands.d.ts +8 -15
- package/dist/upgrade/commands.d.ts.map +1 -0
- package/dist/upgrade/commands.js +27 -28
- 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 +4 -1
- package/dist/upgrade/detection.context.js.map +1 -1
- package/dist/upgrade/detection.d.ts +9 -7
- package/dist/upgrade/detection.d.ts.map +1 -0
- package/dist/upgrade/detection.js +23 -54
- package/dist/upgrade/detection.js.map +1 -1
- package/dist/upgrade/index.d.ts +2 -0
- package/dist/upgrade/index.d.ts.map +1 -0
- package/dist/upgrade/index.js +1 -0
- package/dist/upgrade/index.js.map +1 -1
- package/dist/upgrade/lifecycle.context.d.ts +20 -0
- package/dist/upgrade/lifecycle.context.d.ts.map +1 -0
- package/dist/upgrade/lifecycle.context.js +47 -0
- package/dist/upgrade/lifecycle.context.js.map +1 -0
- package/dist/upgrade/lifecycle.d.ts +72 -0
- package/dist/upgrade/lifecycle.d.ts.map +1 -0
- package/dist/upgrade/lifecycle.js +175 -0
- package/dist/upgrade/lifecycle.js.map +1 -0
- package/dist/upgrade/pathHandle.d.ts +30 -0
- package/dist/upgrade/pathHandle.d.ts.map +1 -0
- package/dist/upgrade/pathHandle.js +102 -0
- package/dist/upgrade/pathHandle.js.map +1 -0
- package/dist/utils/bootSession.context.d.ts +16 -0
- package/dist/utils/bootSession.context.d.ts.map +1 -0
- package/dist/utils/bootSession.context.js +60 -0
- package/dist/utils/bootSession.context.js.map +1 -0
- package/dist/utils/bootSession.d.ts +17 -0
- package/dist/utils/bootSession.d.ts.map +1 -0
- package/dist/utils/bootSession.js +20 -0
- package/dist/utils/bootSession.js.map +1 -0
- 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 +32 -14
- 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 +4 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +3 -0
- package/dist/utils/index.js.map +1 -1
- 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 +13 -1
- package/dist/utils/markup.d.ts.map +1 -0
- package/dist/utils/markup.js +28 -4
- 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 +3 -25
- package/dist/utils/pid.d.ts.map +1 -0
- package/dist/utils/pid.js +10 -49
- package/dist/utils/pid.js.map +1 -1
- 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 +8 -0
- package/dist/utils/processInspector.context.d.ts.map +1 -0
- package/dist/utils/processInspector.context.js +106 -0
- package/dist/utils/processInspector.context.js.map +1 -0
- package/dist/utils/processInspector.d.ts +55 -0
- package/dist/utils/processInspector.d.ts.map +1 -0
- package/dist/utils/processInspector.js +127 -0
- package/dist/utils/processInspector.js.map +1 -0
- package/dist/utils/retry.d.ts +25 -2
- package/dist/utils/retry.d.ts.map +1 -0
- package/dist/utils/retry.js +33 -6
- package/dist/utils/retry.js.map +1 -1
- package/dist/utils/runtimeIdentity.context.d.ts +7 -0
- package/dist/utils/runtimeIdentity.context.d.ts.map +1 -0
- package/dist/utils/runtimeIdentity.context.js +43 -0
- package/dist/utils/runtimeIdentity.context.js.map +1 -0
- package/dist/utils/runtimeIdentity.d.ts +98 -0
- package/dist/utils/runtimeIdentity.d.ts.map +1 -0
- package/dist/utils/runtimeIdentity.js +181 -0
- package/dist/utils/runtimeIdentity.js.map +1 -0
- 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 +2 -1
- package/dist/utils/timing.d.ts.map +1 -0
- package/dist/utils/timing.js +0 -5
- package/dist/utils/timing.js.map +1 -1
- package/dist/utils/version.d.ts +1 -0
- package/dist/utils/version.d.ts.map +1 -0
- package/dist/utils/version.js +47 -13
- package/dist/utils/version.js.map +1 -1
- package/package.json +26 -20
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detection.d.ts","sourceRoot":"","sources":["../../src/upgrade/detection.ts"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAGlD;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAK/B,QAAQ,CAAC,WAAW,EAAE,UAAU,CAAC;IAGjC,QAAQ,CAAC,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;IAG/C,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAI9B,QAAQ,CAAC,UAAU,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAC;CACrD;AAED;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAI/B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED;;;;;GAKG;AACH,UAAU,mBAAmB,CA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AS,eAAe,CAAC,gBAAgB,CAAC,EAAmB,CAAC;AAE/F;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,gBAAgB,GAAG,SAAS,CAAC;AAEzD;;;GAGG;AACH,UAAU,eAAgB,SAAQ,gBAAgB;IAIhD,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAG7B,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAG/B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;CACjC;AAED;;GAEG;AACH,MAAM,WAAW,sBAAuB,SAAQ,eAAe;IAE7D,QAAQ,CAAC,WAAW,EAAE,IAAI,CAAC;CAC5B;AAED;;;;GAIG;AACH,MAAM,WAAW,yBAA0B,SAAQ,eAAe;IAIhE,QAAQ,CAAC,oBAAoB,EAAE,SAAS,MAAM,EAAE,CAAC;IAEjD,QAAQ,CAAC,WAAW,EAAE,KAAK,CAAC;CAC7B;AAED;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG,sBAAsB,GAAG,yBAAyB,CAAC;AAE7E;;;;GAIG;AACH,eAAO,MAAM,eAAe,EAAE,yBAO7B,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,GAAE,gBAAkD,GAAG,WAAW,CA0BxG"}
|
|
@@ -1,40 +1,4 @@
|
|
|
1
|
-
/* Copyright(C) 2024-2026, HJD (https://github.com/hjdhjd). All rights reserved.
|
|
2
|
-
*
|
|
3
|
-
* detection.ts: Installation method detection for PrismCast upgrade.
|
|
4
|
-
*
|
|
5
|
-
* The architecture is ports-and-adapters with a strategy registry whose entries are the single source of truth for everything PrismCast knows about its
|
|
6
|
-
* installation methods - including the InstallMethod type, which is derived from the registry rather than declared in parallel with it.
|
|
7
|
-
*
|
|
8
|
-
* - DetectionContext (this file) - the runtime-input port; what every strategy needs to make its decision
|
|
9
|
-
* - ResolvableFields (this file) - the narrow set of InstallInfo fields a strategy's resolver may compute (today: packageDir)
|
|
10
|
-
* - InstallStrategy<M> (this file) - a discriminated union over `upgradeable`; non-upgradeable variants carry manualUpgradeMessage
|
|
11
|
-
* - INSTALL_STRATEGIES (this file) - the registry; the SSOT for what install methods PrismCast recognizes, in priority order
|
|
12
|
-
* - RegisteredMethod, InstallMethod (derived) - the literal-union types produced from the registry; cannot drift from the strategies
|
|
13
|
-
* - InstallInfo (this file) - the dispatcher's output; mirrors the strategy union so non-upgradeable infos carry the message
|
|
14
|
-
* - detectInstallMethod (this file) - the dispatcher; a fold over the registry that builds the right InstallInfo variant
|
|
15
|
-
* - createDefaultDetectionContext (detection.context) - the adapter; the only place that reads import.meta.url, runs subprocesses, or touches the FS
|
|
16
|
-
*
|
|
17
|
-
* Adding a new install method is appending one record to INSTALL_STRATEGIES. The InstallMethod type updates automatically. The dispatcher and the adapter never
|
|
18
|
-
* change. Tests construct DetectionContext literals inline; production calls detectInstallMethod() with no arguments and the default-argument wires through to
|
|
19
|
-
* createDefaultDetectionContext.
|
|
20
|
-
*
|
|
21
|
-
* Why the discriminated union on `upgradeable`. Boolean flags that gate the presence of other fields are a smell - they let callers ask for fields that are not
|
|
22
|
-
* meaningful in the current state, and they push the responsibility for "is this field present?" onto every consumer's runtime check. Splitting the strategy
|
|
23
|
-
* (and its corresponding InstallInfo) into upgradeable vs non-upgradeable variants lets TypeScript enforce that manualUpgradeMessage exists exactly when
|
|
24
|
-
* upgradeable is false. Consumers narrow on `if(!info.upgradeable)` and read the message field with full type safety; the structural impossibility of an
|
|
25
|
-
* upgradeable strategy carrying manual instructions, or a non-upgradeable one omitting them, is enforced at the type level rather than by convention.
|
|
26
|
-
*/
|
|
27
1
|
import { createDefaultDetectionContext } from "./detection.context.js";
|
|
28
|
-
import path from "node:path";
|
|
29
|
-
// Path marker that distinguishes Homebrew formula installs from npm-on-Homebrew installs. The npm global directory under Homebrew lives at /opt/homebrew/lib/
|
|
30
|
-
// node_modules/prismcast/ on Apple Silicon, which would otherwise produce a false-positive homebrew match; checking for /Cellar/prismcast/ specifically avoids
|
|
31
|
-
// that.
|
|
32
|
-
const HOMEBREW_MARKER = "/Cellar/prismcast/";
|
|
33
|
-
// Path marker for npm local installs. The package's source files live under <project>/node_modules/prismcast/...; the npm-local resolver extracts the project
|
|
34
|
-
// root by slicing the path before this marker. The npm-global strategy also uses the broader "/node_modules/" substring as a cheap prefilter to skip the
|
|
35
|
-
// subprocess call when the path could not possibly be an npm install.
|
|
36
|
-
const NPM_LOCAL_MARKER = "/node_modules/prismcast/";
|
|
37
|
-
const ANY_NODE_MODULES = "/node_modules/";
|
|
38
2
|
/**
|
|
39
3
|
* Docker strategy. Matched via the container-environment probe rather than the path - inside a container, path-based detection is irrelevant because the path
|
|
40
4
|
* looks like any other npm install but the upgrade flow is fundamentally different (recreate the container, not run a package manager). Carries the manual
|
|
@@ -52,50 +16,55 @@ const DOCKER_STRATEGY = {
|
|
|
52
16
|
upgradeable: false
|
|
53
17
|
};
|
|
54
18
|
/**
|
|
55
|
-
* Homebrew strategy. Matched via the
|
|
56
|
-
*
|
|
19
|
+
* Homebrew strategy. Matched via the "Cellar" + "prismcast" segment chain. Homebrew formula installs always live under <prefix>/Cellar/<formula>/<version>/, so
|
|
20
|
+
* the pair reliably identifies Homebrew installs on both Intel (/usr/local/Cellar) and Apple Silicon (/opt/homebrew/Cellar) layouts. The chain is deliberately the pair
|
|
21
|
+
* rather than just "Cellar" so an npm-on-Homebrew install at /opt/homebrew/lib/node_modules/prismcast/ does not false-positive...that path contains "homebrew"
|
|
22
|
+
* but not "Cellar/prismcast".
|
|
57
23
|
*/
|
|
58
24
|
const HOMEBREW_STRATEGY = {
|
|
59
25
|
displayName: "Homebrew",
|
|
60
26
|
id: "homebrew",
|
|
61
|
-
matches: (ctx) => ctx.currentFile.
|
|
27
|
+
matches: (ctx) => ctx.currentFile.hasSegmentChain("Cellar", "prismcast"),
|
|
62
28
|
upgradeCommand: "brew update && brew upgrade prismcast",
|
|
63
29
|
upgradeable: true
|
|
64
30
|
};
|
|
65
31
|
/**
|
|
66
|
-
* npm global strategy. Matched in two stages: a cheap path prefilter (the running file must
|
|
67
|
-
* call to `npm prefix -g
|
|
68
|
-
* path), keeping the matches predicate inexpensive in the common no-match case.
|
|
32
|
+
* npm global strategy. Matched in two stages: a cheap path prefilter (the running file must contain a "node_modules" segment), then the authoritative subprocess
|
|
33
|
+
* call to `npm prefix -g` followed by a structural is-under check against the reported prefix. The prefilter avoids spawning npm for paths that obviously cannot
|
|
34
|
+
* be an npm install (e.g., a development checkout, a Homebrew Cellar path), keeping the matches predicate inexpensive in the common no-match case. Both checks
|
|
35
|
+
* flow through PathHandle so the predicate is platform-agnostic by construction.
|
|
69
36
|
*/
|
|
70
37
|
const NPM_GLOBAL_STRATEGY = {
|
|
71
38
|
displayName: "npm (global)",
|
|
72
39
|
id: "npm-global",
|
|
73
40
|
matches: (ctx) => {
|
|
74
|
-
if (!ctx.currentFile.
|
|
41
|
+
if (!ctx.currentFile.hasSegmentChain("node_modules")) {
|
|
75
42
|
return false;
|
|
76
43
|
}
|
|
77
44
|
const globalPrefix = ctx.runCommand("npm prefix -g");
|
|
78
45
|
if (!globalPrefix) {
|
|
79
46
|
return false;
|
|
80
47
|
}
|
|
81
|
-
return ctx.currentFile.
|
|
48
|
+
return ctx.currentFile.isUnder(globalPrefix);
|
|
82
49
|
},
|
|
83
50
|
upgradeCommand: "npm install -g prismcast@latest",
|
|
84
51
|
upgradeable: true
|
|
85
52
|
};
|
|
86
53
|
/**
|
|
87
|
-
* npm local strategy. Matched via the
|
|
88
|
-
*
|
|
89
|
-
* for npm install
|
|
54
|
+
* npm local strategy. Matched via the "node_modules" + "prismcast" segment chain; the resolver walks the same chain via parentBefore to recover the consumer's
|
|
55
|
+
* project root (the directory above node_modules) and confirms the manifest is actually there via fileExists. Some unusual layouts have an orphaned node_modules
|
|
56
|
+
* without a manifest, and the upgrade runner needs the right cwd for `npm install`, so we only surface packageDir when we can prove the manifest exists.
|
|
90
57
|
*/
|
|
91
58
|
const NPM_LOCAL_STRATEGY = {
|
|
92
59
|
displayName: "npm (local)",
|
|
93
60
|
id: "npm-local",
|
|
94
|
-
matches: (ctx) => ctx.currentFile.
|
|
61
|
+
matches: (ctx) => ctx.currentFile.hasSegmentChain("node_modules", "prismcast"),
|
|
95
62
|
resolve: (ctx) => {
|
|
96
|
-
const
|
|
97
|
-
|
|
98
|
-
|
|
63
|
+
const projectRoot = ctx.currentFile.parentBefore("node_modules", "prismcast");
|
|
64
|
+
if (!projectRoot) {
|
|
65
|
+
return {};
|
|
66
|
+
}
|
|
67
|
+
return ctx.fileExists(projectRoot.join("package.json")) ? { packageDir: projectRoot.raw } : {};
|
|
99
68
|
},
|
|
100
69
|
upgradeCommand: "npm install prismcast@latest",
|
|
101
70
|
upgradeable: true
|
|
@@ -131,9 +100,9 @@ export const UNKNOWN_INSTALL = {
|
|
|
131
100
|
};
|
|
132
101
|
/**
|
|
133
102
|
* Detects the installation method. Walks INSTALL_STRATEGIES in priority order; on the first match, builds an InstallInfo by composing the strategy's optional
|
|
134
|
-
* resolver output with the strategy's constant fields. The resolver's return type is restricted to ResolvableFields, so it cannot override
|
|
135
|
-
*
|
|
136
|
-
*
|
|
103
|
+
* resolver output with the strategy's constant fields. The resolver's return type is restricted to ResolvableFields, so it cannot override method, displayName,
|
|
104
|
+
* or upgradeCommand; the spread order also places constants after the resolved fields as belt-and-suspenders. The strategy's `upgradeable`
|
|
105
|
+
* field selects which InstallInfo variant the dispatcher emits, carrying manualUpgradeMessage through for the non-upgradeable case.
|
|
137
106
|
*
|
|
138
107
|
* Pure function of DetectionContext - all I/O happens inside the context's runCommand and fileExists callbacks, which the default adapter wires to real system
|
|
139
108
|
* calls and tests stub inline. Falls back to UNKNOWN_INSTALL when no strategy matches.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"detection.js","sourceRoot":"","sources":["../../src/upgrade/detection.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"detection.js","sourceRoot":"","sources":["../../src/upgrade/detection.ts"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AAG,CAAC;YAC1B,WAAW,EAAE,QAAQ,CAAC,WAAW;YACjC,MAAM,EAAE,QAAQ,CAAC,EAAE;YACnB,cAAc,EAAE,QAAQ,CAAC,cAAc;SACxC,CAAC;QAEF,IAAG,QAAQ,CAAC,WAAW,EAAE,CAAC;YAExB,OAAO,EAAE,GAAG,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;QACxC,CAAC;QAED,OAAO,EAAE,GAAG,IAAI,EAAE,oBAAoB,EAAE,QAAQ,CAAC,oBAAoB,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC;IAC9F,CAAC;IAED,OAAO,eAAe,CAAC;AACzB,CAAC"}
|
package/dist/upgrade/index.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/upgrade/index.ts"],"names":[],"mappings":"AAIA,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC"}
|
package/dist/upgrade/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/upgrade/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/upgrade/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { UpgradeLifecycleContext } from "./lifecycle.ts";
|
|
2
|
+
/**
|
|
3
|
+
* Builds the default UpgradeLifecycleContext from real runtime I/O.
|
|
4
|
+
*
|
|
5
|
+
* runCommand inherits the user's terminal so npm/brew output flows live; it captures only the exit outcome, not the captured stdio. spawnDetached launches a
|
|
6
|
+
* fully decoupled child process - detached, stdio ignored, windowsHide on - then unref's so the child can outlive the parent. The Windows handoff strategy is
|
|
7
|
+
* the sole caller; on POSIX the strategy never invokes it.
|
|
8
|
+
*
|
|
9
|
+
* serviceTaskName resolves to the documented PrismCast service identifier when running on Windows. It is the empty string on other platforms because the field
|
|
10
|
+
* is only consumed by the Windows handoff helper. We always send the identifier (rather than gating on isRunningAsService) because the helper itself probes
|
|
11
|
+
* Get-ScheduledTask for the running task and skips the stop/start steps cleanly when none is registered...the user may be running a global npm install of
|
|
12
|
+
* prismcast on Windows without having registered a service yet, and the upgrade flow must still work.
|
|
13
|
+
*
|
|
14
|
+
* upgradeLogPath sits inside the PrismCast data directory at `upgrade.log`. The helper appends timestamped lines and the upgrade command's captured stdout to
|
|
15
|
+
* this file; the user is told its location in the "handed-off" UpgradeStep so they can tail or read it.
|
|
16
|
+
*
|
|
17
|
+
* @returns An UpgradeLifecycleContext populated from the live process.
|
|
18
|
+
*/
|
|
19
|
+
export declare function createDefaultLifecycleContext(): UpgradeLifecycleContext;
|
|
20
|
+
//# sourceMappingURL=lifecycle.context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lifecycle.context.d.ts","sourceRoot":"","sources":["../../src/upgrade/lifecycle.context.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,uBAAuB,EAAoB,MAAM,gBAAgB,CAAC;AAMhF;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,6BAA6B,IAAI,uBAAuB,CAgCvE"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { execSync, spawn } from "node:child_process";
|
|
2
|
+
import { SERVICE_NAME } from "../identity.js";
|
|
3
|
+
import { getDataDir } from "../config/paths.js";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
/**
|
|
6
|
+
* Builds the default UpgradeLifecycleContext from real runtime I/O.
|
|
7
|
+
*
|
|
8
|
+
* runCommand inherits the user's terminal so npm/brew output flows live; it captures only the exit outcome, not the captured stdio. spawnDetached launches a
|
|
9
|
+
* fully decoupled child process - detached, stdio ignored, windowsHide on - then unref's so the child can outlive the parent. The Windows handoff strategy is
|
|
10
|
+
* the sole caller; on POSIX the strategy never invokes it.
|
|
11
|
+
*
|
|
12
|
+
* serviceTaskName resolves to the documented PrismCast service identifier when running on Windows. It is the empty string on other platforms because the field
|
|
13
|
+
* is only consumed by the Windows handoff helper. We always send the identifier (rather than gating on isRunningAsService) because the helper itself probes
|
|
14
|
+
* Get-ScheduledTask for the running task and skips the stop/start steps cleanly when none is registered...the user may be running a global npm install of
|
|
15
|
+
* prismcast on Windows without having registered a service yet, and the upgrade flow must still work.
|
|
16
|
+
*
|
|
17
|
+
* upgradeLogPath sits inside the PrismCast data directory at `upgrade.log`. The helper appends timestamped lines and the upgrade command's captured stdout to
|
|
18
|
+
* this file; the user is told its location in the "handed-off" UpgradeStep so they can tail or read it.
|
|
19
|
+
*
|
|
20
|
+
* @returns An UpgradeLifecycleContext populated from the live process.
|
|
21
|
+
*/
|
|
22
|
+
export function createDefaultLifecycleContext() {
|
|
23
|
+
return {
|
|
24
|
+
parentPid: process.pid,
|
|
25
|
+
platform: process.platform,
|
|
26
|
+
runCommand: (cmd, options) => {
|
|
27
|
+
try {
|
|
28
|
+
execSync(cmd, { cwd: options.cwd, encoding: "utf-8", stdio: "inherit" });
|
|
29
|
+
return { success: true };
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
return { success: false };
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
serviceTaskName: (process.platform === "win32") ? SERVICE_NAME : "",
|
|
36
|
+
spawnDetached: (command, args) => {
|
|
37
|
+
const child = spawn(command, [...args], {
|
|
38
|
+
detached: true,
|
|
39
|
+
stdio: "ignore",
|
|
40
|
+
windowsHide: true
|
|
41
|
+
});
|
|
42
|
+
child.unref();
|
|
43
|
+
},
|
|
44
|
+
upgradeLogPath: path.join(getDataDir(), "upgrade.log")
|
|
45
|
+
};
|
|
46
|
+
}
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,EAAE,CAAC;QAChB,CAAC;QACD,cAAc,EAAE,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE,aAAa,CAAC;KACvD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { InstallInfo } from "./detection.ts";
|
|
2
|
+
/**
|
|
3
|
+
* Outcome of a single upgrade attempt. Discriminated union over `kind`. Consumers narrow on it to choose between "the upgrade ran in-process, here is the
|
|
4
|
+
* outcome" and "a detached helper is taking it from here, exit immediately and trust the helper to finish the job."
|
|
5
|
+
*
|
|
6
|
+
* The "handed-off" variant is structurally permissible only because the strategy that produced it has already spawned the helper before returning; the field
|
|
7
|
+
* `logPath` is the path the helper writes its progress to so the user has a place to look while the upgrade is running.
|
|
8
|
+
*/
|
|
9
|
+
export type UpgradeStep = {
|
|
10
|
+
readonly kind: "ran";
|
|
11
|
+
readonly success: boolean;
|
|
12
|
+
} | {
|
|
13
|
+
readonly kind: "handed-off";
|
|
14
|
+
readonly logPath: string;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Result of running an upgrade subprocess. The in-process strategy passes this through verbatim into the UpgradeStep "ran" variant, so its success flag is what
|
|
18
|
+
* commands.ts narrows on and the outcome shape stays consistent across the two layers. The success flag distinguishes ran-without-error from
|
|
19
|
+
* threw-or-exited-non-zero; the runner does not surface the actual error because the user sees subprocess stderr directly on the terminal.
|
|
20
|
+
*/
|
|
21
|
+
export interface UpgradeRunResult {
|
|
22
|
+
readonly success: boolean;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Runtime context the lifecycle strategies consume. Each field is one narrow capability some strategy needs. POSIX strategies use only `runCommand`; the
|
|
26
|
+
* Windows handoff strategy uses `parentPid`, `serviceTaskName`, `spawnDetached`, `upgradeLogPath`. Splitting them onto one struct keeps the adapter (and the
|
|
27
|
+
* UpgradeLifecycleContext interface it satisfies for tests) a single object, even though no strategy uses every field.
|
|
28
|
+
*/
|
|
29
|
+
export interface UpgradeLifecycleContext {
|
|
30
|
+
readonly parentPid: number;
|
|
31
|
+
readonly platform: NodeJS.Platform;
|
|
32
|
+
readonly runCommand: (cmd: string, options: {
|
|
33
|
+
readonly cwd?: string;
|
|
34
|
+
}) => UpgradeRunResult;
|
|
35
|
+
readonly serviceTaskName: string;
|
|
36
|
+
readonly spawnDetached: (command: string, args: readonly string[]) => void;
|
|
37
|
+
readonly upgradeLogPath: string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* A platform-strategy record. The registry is a flat tuple of these; the dispatcher picks the first whose `platforms` list includes the current OS. Pure
|
|
41
|
+
* function over UpgradeLifecycleContext + InstallInfo; no state is owned by the strategy itself.
|
|
42
|
+
*/
|
|
43
|
+
export interface UpgradeLifecycleStrategy {
|
|
44
|
+
readonly id: string;
|
|
45
|
+
readonly platforms: readonly NodeJS.Platform[];
|
|
46
|
+
readonly perform: (ctx: UpgradeLifecycleContext, info: InstallInfo) => UpgradeStep;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* The upgrade-lifecycle strategy registry. Same runtime data as STRATEGY_TUPLE; the public name carries the wide UpgradeLifecycleStrategy type so consumers
|
|
50
|
+
* and tests see one uniform shape. Adding a new platform-specific strategy is appending an entry to STRATEGY_TUPLE; the dispatcher and the adapter never
|
|
51
|
+
* change.
|
|
52
|
+
*/
|
|
53
|
+
export declare const UPGRADE_LIFECYCLES: readonly UpgradeLifecycleStrategy[];
|
|
54
|
+
/**
|
|
55
|
+
* Selects the lifecycle strategy for a given platform. Falls back to the POSIX in-process strategy when no strategy lists the platform...this covers any
|
|
56
|
+
* Unix-like host that is not specifically called out and keeps the function total (no thrown error from a one-off platform name).
|
|
57
|
+
*
|
|
58
|
+
* @param platform - The OS platform identifier.
|
|
59
|
+
* @returns The matching strategy, or the POSIX default when no strategy serves the platform.
|
|
60
|
+
*/
|
|
61
|
+
export declare function selectLifecycle(platform: NodeJS.Platform): UpgradeLifecycleStrategy;
|
|
62
|
+
/**
|
|
63
|
+
* Performs an upgrade by selecting the platform-appropriate strategy and invoking its `perform` callback. Pure dispatcher; all I/O happens inside the
|
|
64
|
+
* strategy's own callbacks (which themselves receive an UpgradeLifecycleContext that the adapter wires from real I/O). Tests inject context literals and
|
|
65
|
+
* exercise each strategy through this entry point.
|
|
66
|
+
*
|
|
67
|
+
* @param ctx - The lifecycle context.
|
|
68
|
+
* @param info - The detected install info.
|
|
69
|
+
* @returns The upgrade outcome.
|
|
70
|
+
*/
|
|
71
|
+
export declare function performUpgrade(ctx: UpgradeLifecycleContext, info: InstallInfo): UpgradeStep;
|
|
72
|
+
//# sourceMappingURL=lifecycle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lifecycle.d.ts","sourceRoot":"","sources":["../../src/upgrade/lifecycle.ts"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD;;;;;;GAMG;AACH,MAAM,MAAM,WAAW,GAAG;IAIxB,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;IACrB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC3B,GAAG;IAKF,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAE/B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC3B;AAED;;;;GAIG;AACH,MAAM,WAAW,uBAAuB;IAItC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAI3B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC;IAInC,QAAQ,CAAC,UAAU,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE;QAAE,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,gBAAgB,CAAC;IAK3F,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IAKjC,QAAQ,CAAC,aAAa,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,MAAM,EAAE,KAAK,IAAI,CAAC;IAI3E,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;CACjC;AAED;;;GAGG;AACH,MAAM,WAAW,wBAAwB;IAIvC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAIpB,QAAQ,CAAC,SAAS,EAAE,SAAS,MAAM,CAAC,QAAQ,EAAE,CAAC;IAI/C,QAAQ,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,uBAAuB,EAAE,IAAI,EAAE,WAAW,KAAK,WAAW,CAAC;CACpF;AA0KD;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,EAAE,SAAS,wBAAwB,EAAmB,CAAC;AAEtF;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,CAAC,QAAQ,GAAG,wBAAwB,CAGnF;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,uBAAuB,EAAE,IAAI,EAAE,WAAW,GAAG,WAAW,CAG3F"}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The PowerShell helper that the Windows handoff strategy spawns. Reads five positional parameters: the parent process ID, the optional service task name
|
|
3
|
+
* (empty string when no service is registered), the upgrade command exactly as detection.ts produced it, the optional working directory for npm-local
|
|
4
|
+
* installs (empty string for npm-global), and the log path the helper appends its progress to.
|
|
5
|
+
*
|
|
6
|
+
* Sequence:
|
|
7
|
+
*
|
|
8
|
+
* 1. Wait for the parent process to exit. Wait-Process with -ErrorAction SilentlyContinue tolerates the (theoretical) case where the parent has already exited
|
|
9
|
+
* between us being spawned and this line running.
|
|
10
|
+
* 2. If a service task is registered, disable it (so RestartOnFailure does not interfere) and stop it. Stop-ScheduledTask is non-blocking, so we
|
|
11
|
+
* poll for the task to transition out of Running with a 30-second ceiling - the same poll pattern as service/generators.ts's WINDOWS_REGISTER_SCRIPT.
|
|
12
|
+
* 3. Run the upgrade command via cmd.exe /c so npm/brew shell-style command lines parse correctly. Output is captured for the log; the exit code is captured
|
|
13
|
+
* so we can re-raise it as our own exit code at the very end.
|
|
14
|
+
* 4. If a service task is registered, re-enable it and start it. The re-enable is necessary because Disable-ScheduledTask persists across restarts; without
|
|
15
|
+
* this step, the next reboot would silently leave the service disabled.
|
|
16
|
+
* 5. Exit with the upgrade's exit code so the helper's own exit reflects the upgrade outcome (visible in the log via $LASTEXITCODE).
|
|
17
|
+
*
|
|
18
|
+
* Logging is best-effort: a failed Add-Content call (e.g., the directory does not exist) is swallowed by SilentlyContinue so the helper still completes its
|
|
19
|
+
* primary job. The log itself is the only user-facing artifact of the helper, and we surface its path back to commands.ts as part of the UpgradeStep.
|
|
20
|
+
*/
|
|
21
|
+
const WINDOWS_HANDOFF_SCRIPT = [
|
|
22
|
+
"param($ParentPid, $TaskName, $UpgradeCommand, $WorkingDir, $LogPath)",
|
|
23
|
+
"function Write-UpgradeLog($message) {",
|
|
24
|
+
" $stamp = Get-Date -Format 'yyyy-MM-dd HH:mm:ss'",
|
|
25
|
+
" try { Add-Content -Path $LogPath -Value ('[' + $stamp + '] ' + $message) -Encoding utf8 -ErrorAction SilentlyContinue } catch {}",
|
|
26
|
+
"}",
|
|
27
|
+
"Write-UpgradeLog ('Helper started; waiting for parent PID ' + $ParentPid + ' to exit.')",
|
|
28
|
+
"try { Wait-Process -Id $ParentPid -ErrorAction SilentlyContinue } catch {}",
|
|
29
|
+
"Write-UpgradeLog 'Parent exited.'",
|
|
30
|
+
"if($TaskName) {",
|
|
31
|
+
" $existing = Get-ScheduledTask -TaskName $TaskName -ErrorAction SilentlyContinue",
|
|
32
|
+
" if($existing) {",
|
|
33
|
+
" Write-UpgradeLog ('Disabling and stopping task ' + $TaskName + '.')",
|
|
34
|
+
" Disable-ScheduledTask -TaskName $TaskName -ErrorAction SilentlyContinue | Out-Null",
|
|
35
|
+
" Stop-ScheduledTask -TaskName $TaskName -ErrorAction SilentlyContinue | Out-Null",
|
|
36
|
+
" $deadline = (Get-Date).AddSeconds(30)",
|
|
37
|
+
" while((Get-Date) -lt $deadline) {",
|
|
38
|
+
" $state = (Get-ScheduledTask -TaskName $TaskName -ErrorAction SilentlyContinue).State",
|
|
39
|
+
" if(($null -eq $state) -or ($state -ne 'Running')) { break }",
|
|
40
|
+
" Start-Sleep -Milliseconds 250",
|
|
41
|
+
" }",
|
|
42
|
+
" Write-UpgradeLog ('Task state after stop: ' + $state + '.')",
|
|
43
|
+
" } else {",
|
|
44
|
+
" Write-UpgradeLog 'No matching scheduled task found; skipping stop/start.'",
|
|
45
|
+
" }",
|
|
46
|
+
"}",
|
|
47
|
+
"if($WorkingDir) { Set-Location -Path $WorkingDir }",
|
|
48
|
+
"Write-UpgradeLog ('Running upgrade command: ' + $UpgradeCommand)",
|
|
49
|
+
"$upgradeOutput = (& cmd.exe /c $UpgradeCommand 2>&1) | Out-String",
|
|
50
|
+
"$upgradeExit = $LASTEXITCODE",
|
|
51
|
+
"try { Add-Content -Path $LogPath -Value $upgradeOutput -Encoding utf8 -ErrorAction SilentlyContinue } catch {}",
|
|
52
|
+
"Write-UpgradeLog ('Upgrade exit code: ' + $upgradeExit + '.')",
|
|
53
|
+
"if($TaskName) {",
|
|
54
|
+
" $existing = Get-ScheduledTask -TaskName $TaskName -ErrorAction SilentlyContinue",
|
|
55
|
+
" if($existing) {",
|
|
56
|
+
" Write-UpgradeLog ('Re-enabling and starting task ' + $TaskName + '.')",
|
|
57
|
+
" Enable-ScheduledTask -TaskName $TaskName -ErrorAction SilentlyContinue | Out-Null",
|
|
58
|
+
" Start-ScheduledTask -TaskName $TaskName -ErrorAction SilentlyContinue | Out-Null",
|
|
59
|
+
" }",
|
|
60
|
+
"}",
|
|
61
|
+
"Write-UpgradeLog 'Helper finished.'",
|
|
62
|
+
"exit $upgradeExit"
|
|
63
|
+
].join("\n");
|
|
64
|
+
/**
|
|
65
|
+
* Escapes a value for embedding inside a single-quoted PowerShell string. PowerShell's single-quoted strings are literal (no interpolation, no backslash
|
|
66
|
+
* escapes); the only character that requires escaping is the single quote itself, written as two consecutive single quotes. Mirrors the same helper in
|
|
67
|
+
* service/generators.ts so the two PowerShell-emitting modules agree on the one escape rule that matters.
|
|
68
|
+
*
|
|
69
|
+
* @param value - The value to escape.
|
|
70
|
+
* @returns The value with internal single quotes doubled.
|
|
71
|
+
*/
|
|
72
|
+
function escapeSingleQuoted(value) {
|
|
73
|
+
return value.replaceAll("'", "''");
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Wraps a value in a PowerShell single-quoted literal.
|
|
77
|
+
* @param value - The value to quote.
|
|
78
|
+
* @returns The literal including its surrounding quotes.
|
|
79
|
+
*/
|
|
80
|
+
function powerShellLiteral(value) {
|
|
81
|
+
return "'" + escapeSingleQuoted(value) + "'";
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Builds the PowerShell command string that the Windows handoff strategy passes to powershell.exe via -Command. The script body is wrapped in `& { ... }` and
|
|
85
|
+
* the positional arguments are appended after the closing brace, exactly as PowerShell's parser expects. Each argument is single-quote-escaped via
|
|
86
|
+
* powerShellLiteral, so there is one - and only one - escape surface (the single-quote doubling rule).
|
|
87
|
+
*
|
|
88
|
+
* @param args - The positional arguments to pass to the helper script's param() block, in declaration order.
|
|
89
|
+
* @returns The fully composed `-Command` string.
|
|
90
|
+
*/
|
|
91
|
+
function buildHandoffCommand(args) {
|
|
92
|
+
const quoted = args.map((value) => powerShellLiteral(value)).join(" ");
|
|
93
|
+
return "& { " + WINDOWS_HANDOFF_SCRIPT + " } " + quoted;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* POSIX in-process strategy. macOS and Linux can run `npm install -g` (or `brew upgrade`) directly from inside the running prismcast process because POSIX
|
|
97
|
+
* filesystems do not lock open files against directory rename. The strategy is a thin pass-through over ctx.runCommand. The caller (commands.ts) decides
|
|
98
|
+
* whether to exit afterward so the service manager (launchd KeepAlive, systemd Restart=) brings PrismCast back up.
|
|
99
|
+
*/
|
|
100
|
+
const POSIX_IN_PROCESS_LIFECYCLE = {
|
|
101
|
+
id: "posix-in-process",
|
|
102
|
+
perform: (ctx, info) => {
|
|
103
|
+
const result = ctx.runCommand(info.upgradeCommand, { cwd: info.packageDir });
|
|
104
|
+
return { kind: "ran", success: result.success };
|
|
105
|
+
},
|
|
106
|
+
platforms: ["darwin", "linux"]
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* Windows handoff strategy. Composes the PowerShell helper command line, hands it to ctx.spawnDetached, and returns "handed-off." The helper waits for the
|
|
110
|
+
* current process to exit (so the prismcast directory's file locks release), runs the upgrade, then restarts the scheduled task if one exists. This is the
|
|
111
|
+
* Windows EBUSY + auto-restart fix: the parent process exits cleanly with an "upgrade running in the background" message; the detached helper handles the rest.
|
|
112
|
+
*
|
|
113
|
+
* The PowerShell launch is identical to the rest of the codebase: -NoProfile / -NonInteractive for a clean shell, -ExecutionPolicy Bypass so installer-style
|
|
114
|
+
* scripted scenarios are not gated by the interactive-use policy, -WindowStyle Hidden so the user sees no console window pop up, and -Command with our
|
|
115
|
+
* single-quote-escaped script string. The launcher is spawned detached, with stdio ignored and windowsHide set, so it survives the parent's exit.
|
|
116
|
+
*/
|
|
117
|
+
const WINDOWS_HANDOFF_LIFECYCLE = {
|
|
118
|
+
id: "windows-handoff",
|
|
119
|
+
perform: (ctx, info) => {
|
|
120
|
+
const handoffCommand = buildHandoffCommand([
|
|
121
|
+
String(ctx.parentPid),
|
|
122
|
+
ctx.serviceTaskName,
|
|
123
|
+
info.upgradeCommand,
|
|
124
|
+
info.packageDir ?? "",
|
|
125
|
+
ctx.upgradeLogPath
|
|
126
|
+
]);
|
|
127
|
+
ctx.spawnDetached("powershell.exe", [
|
|
128
|
+
"-NoProfile",
|
|
129
|
+
"-NonInteractive",
|
|
130
|
+
"-ExecutionPolicy", "Bypass",
|
|
131
|
+
"-WindowStyle", "Hidden",
|
|
132
|
+
"-Command", handoffCommand
|
|
133
|
+
]);
|
|
134
|
+
return { kind: "handed-off", logPath: ctx.upgradeLogPath };
|
|
135
|
+
},
|
|
136
|
+
platforms: ["win32"]
|
|
137
|
+
};
|
|
138
|
+
/* The strategy registry as a narrow tuple. Declared `as const` so each entry retains its literal shape...the dispatcher walks this in order and picks the
|
|
139
|
+
* first match. POSIX comes first because it serves more platforms; Windows comes second because it serves only one. The default-fallback semantics live in
|
|
140
|
+
* selectLifecycle so an unknown platform (e.g., freebsd) falls back to the POSIX strategy because it serves the broadest platform set and keeps the
|
|
141
|
+
* dispatcher total.
|
|
142
|
+
*/
|
|
143
|
+
const STRATEGY_TUPLE = [
|
|
144
|
+
POSIX_IN_PROCESS_LIFECYCLE,
|
|
145
|
+
WINDOWS_HANDOFF_LIFECYCLE
|
|
146
|
+
];
|
|
147
|
+
/**
|
|
148
|
+
* The upgrade-lifecycle strategy registry. Same runtime data as STRATEGY_TUPLE; the public name carries the wide UpgradeLifecycleStrategy type so consumers
|
|
149
|
+
* and tests see one uniform shape. Adding a new platform-specific strategy is appending an entry to STRATEGY_TUPLE; the dispatcher and the adapter never
|
|
150
|
+
* change.
|
|
151
|
+
*/
|
|
152
|
+
export const UPGRADE_LIFECYCLES = STRATEGY_TUPLE;
|
|
153
|
+
/**
|
|
154
|
+
* Selects the lifecycle strategy for a given platform. Falls back to the POSIX in-process strategy when no strategy lists the platform...this covers any
|
|
155
|
+
* Unix-like host that is not specifically called out and keeps the function total (no thrown error from a one-off platform name).
|
|
156
|
+
*
|
|
157
|
+
* @param platform - The OS platform identifier.
|
|
158
|
+
* @returns The matching strategy, or the POSIX default when no strategy serves the platform.
|
|
159
|
+
*/
|
|
160
|
+
export function selectLifecycle(platform) {
|
|
161
|
+
return UPGRADE_LIFECYCLES.find((strategy) => strategy.platforms.includes(platform)) ?? POSIX_IN_PROCESS_LIFECYCLE;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Performs an upgrade by selecting the platform-appropriate strategy and invoking its `perform` callback. Pure dispatcher; all I/O happens inside the
|
|
165
|
+
* strategy's own callbacks (which themselves receive an UpgradeLifecycleContext that the adapter wires from real I/O). Tests inject context literals and
|
|
166
|
+
* exercise each strategy through this entry point.
|
|
167
|
+
*
|
|
168
|
+
* @param ctx - The lifecycle context.
|
|
169
|
+
* @param info - The detected install info.
|
|
170
|
+
* @returns The upgrade outcome.
|
|
171
|
+
*/
|
|
172
|
+
export function performUpgrade(ctx, info) {
|
|
173
|
+
return selectLifecycle(ctx.platform).perform(ctx, info);
|
|
174
|
+
}
|
|
175
|
+
//# sourceMappingURL=lifecycle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lifecycle.js","sourceRoot":"","sources":["../../src/upgrade/lifecycle.ts"],"names":[],"mappings":"AAkHA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,sBAAsB,GAAG;IAE7B,sEAAsE;IACtE,uCAAuC;IACvC,mDAAmD;IACnD,oIAAoI;IACpI,GAAG;IACH,yFAAyF;IACzF,4EAA4E;IAC5E,mCAAmC;IACnC,iBAAiB;IACjB,mFAAmF;IACnF,mBAAmB;IACnB,yEAAyE;IACzE,wFAAwF;IACxF,qFAAqF;IACrF,2CAA2C;IAC3C,uCAAuC;IACvC,4FAA4F;IAC5F,mEAAmE;IACnE,qCAAqC;IACrC,OAAO;IACP,iEAAiE;IACjE,YAAY;IACZ,+EAA+E;IAC/E,KAAK;IACL,GAAG;IACH,oDAAoD;IACpD,kEAAkE;IAClE,mEAAmE;IACnE,8BAA8B;IAC9B,gHAAgH;IAChH,+DAA+D;IAC/D,iBAAiB;IACjB,mFAAmF;IACnF,mBAAmB;IACnB,2EAA2E;IAC3E,uFAAuF;IACvF,sFAAsF;IACtF,KAAK;IACL,GAAG;IACH,qCAAqC;IACrC,mBAAmB;CACpB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAEb;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;YACrB,GAAG,CAAC,cAAc;SACnB,CAAC,CAAC;QAEH,GAAG,CAAC,aAAa,CAAC,gBAAgB,EAAE;YAElC,YAAY;YACZ,iBAAiB;YACjB,kBAAkB,EAAE,QAAQ;YAC5B,cAAc,EAAE,QAAQ;YACxB,UAAU,EAAE,cAAc;SAC3B,CAAC,CAAC;QAEH,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,GAAG,CAAC,cAAc,EAAE,CAAC;IAC7D,CAAC;IACD,SAAS,EAAE,CAAC,OAAO,CAAC;CACrB,CAAC;AAEF;;;;GAIG;AACH,MAAM,cAAc,GAAG;IAErB,0BAA0B;IAC1B,yBAAyB;CACjB,CAAC;AAEX;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAwC,cAAc,CAAC;AAEtF;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAAC,QAAyB;IAEvD,OAAO,kBAAkB,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,IAAI,0BAA0B,CAAC;AACpH,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,cAAc,CAAC,GAA4B,EAAE,IAAiB;IAE5E,OAAO,eAAe,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;AAC1D,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A platform-aware handle on an absolute filesystem path. Strategies reason about install layout exclusively through this type; the underlying separator,
|
|
3
|
+
* case-folding rules, and segment topology are encapsulated. Adding a new structural query is an additive edit to this interface; the factory below is the only
|
|
4
|
+
* implementation site.
|
|
5
|
+
*/
|
|
6
|
+
export interface PathHandle {
|
|
7
|
+
readonly raw: string;
|
|
8
|
+
hasSegmentChain(...segments: readonly string[]): boolean;
|
|
9
|
+
isUnder(prefix: string): boolean;
|
|
10
|
+
join(...segments: readonly string[]): string;
|
|
11
|
+
parentBefore(...segments: readonly string[]): PathHandle | null;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Options accepted by createPathHandle. The platform override lets tests produce Windows-flavored handles on a Linux host.
|
|
15
|
+
*/
|
|
16
|
+
export interface PathHandleOptions {
|
|
17
|
+
readonly platform?: NodeJS.Platform;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Constructs a PathHandle from an absolute path string. The factory captures the platform once and dispatches every subsequent query through `path.win32` or
|
|
21
|
+
* `path.posix` accordingly, so behavior is independent of where the host process runs. The handle is logically immutable...returned fields are typed readonly
|
|
22
|
+
* and the closed-over state is never mutated.
|
|
23
|
+
*
|
|
24
|
+
* @param raw - The OS-native absolute path string. Empty input produces a degenerate handle whose queries return false/null; a relative input is not rejected
|
|
25
|
+
* (hasSegmentChain still matches its segments), so callers must supply an absolute path.
|
|
26
|
+
* @param options - Optional overrides; the platform override lets tests exercise cross-platform behavior deterministically.
|
|
27
|
+
* @returns A platform-aware PathHandle.
|
|
28
|
+
*/
|
|
29
|
+
export declare function createPathHandle(raw: string, options?: PathHandleOptions): PathHandle;
|
|
30
|
+
//# sourceMappingURL=pathHandle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pathHandle.d.ts","sourceRoot":"","sources":["../../src/upgrade/pathHandle.ts"],"names":[],"mappings":"AAoBA;;;;GAIG;AACH,MAAM,WAAW,UAAU;IAIzB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAIrB,eAAe,CAAC,GAAG,QAAQ,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC;IAKzD,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;IAIjC,IAAI,CAAC,GAAG,QAAQ,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAAC;IAK7C,YAAY,CAAC,GAAG,QAAQ,EAAE,SAAS,MAAM,EAAE,GAAG,UAAU,GAAG,IAAI,CAAC;CACjE;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAIhC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC;CACrC;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,GAAE,iBAAsB,GAAG,UAAU,CA0GzF"}
|