prismcast 1.7.0 → 1.9.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.
Files changed (208) hide show
  1. package/README.md +6 -6
  2. package/dist/app.js +24 -13
  3. package/dist/app.js.map +1 -1
  4. package/dist/browser/cdp.d.ts +4 -6
  5. package/dist/browser/cdp.js +13 -17
  6. package/dist/browser/cdp.js.map +1 -1
  7. package/dist/browser/index.js +3 -3
  8. package/dist/browser/index.js.map +1 -1
  9. package/dist/browser/login.js +11 -8
  10. package/dist/browser/login.js.map +1 -1
  11. package/dist/browser/precaching.d.ts +1 -1
  12. package/dist/browser/precaching.js +23 -23
  13. package/dist/browser/precaching.js.map +1 -1
  14. package/dist/browser/tuning/directv.js +4 -7
  15. package/dist/browser/tuning/directv.js.map +1 -1
  16. package/dist/browser/tuning/fox.js +1 -1
  17. package/dist/browser/tuning/fox.js.map +1 -1
  18. package/dist/browser/tuning/hbo.js +1 -1
  19. package/dist/browser/tuning/hbo.js.map +1 -1
  20. package/dist/browser/tuning/hulu.js +3 -3
  21. package/dist/browser/tuning/hulu.js.map +1 -1
  22. package/dist/browser/tuning/sling.js +2 -2
  23. package/dist/browser/tuning/sling.js.map +1 -1
  24. package/dist/channels/index.d.ts +2 -0
  25. package/dist/channels/index.js +438 -252
  26. package/dist/channels/index.js.map +1 -1
  27. package/dist/config/health.d.ts +3 -3
  28. package/dist/config/health.js +13 -18
  29. package/dist/config/health.js.map +1 -1
  30. package/dist/config/index.js +11 -2
  31. package/dist/config/index.js.map +1 -1
  32. package/dist/config/persistence.d.ts +59 -0
  33. package/dist/config/persistence.js +127 -0
  34. package/dist/config/persistence.js.map +1 -0
  35. package/dist/config/profiles.js +10 -10
  36. package/dist/config/profiles.js.map +1 -1
  37. package/dist/config/servicePacks.d.ts +46 -0
  38. package/dist/config/{providerPacks.js → servicePacks.js} +28 -31
  39. package/dist/config/servicePacks.js.map +1 -0
  40. package/dist/config/services.d.ts +202 -0
  41. package/dist/config/services.js +758 -0
  42. package/dist/config/services.js.map +1 -0
  43. package/dist/config/sites.js +61 -61
  44. package/dist/config/sites.js.map +1 -1
  45. package/dist/config/userChannels.d.ts +89 -27
  46. package/dist/config/userChannels.js +400 -184
  47. package/dist/config/userChannels.js.map +1 -1
  48. package/dist/config/userConfig.d.ts +13 -9
  49. package/dist/config/userConfig.js +78 -60
  50. package/dist/config/userConfig.js.map +1 -1
  51. package/dist/config/userProfiles.d.ts +31 -15
  52. package/dist/config/userProfiles.js +154 -123
  53. package/dist/config/userProfiles.js.map +1 -1
  54. package/dist/hdhr/channelMap.d.ts +1 -1
  55. package/dist/hdhr/channelMap.js +4 -7
  56. package/dist/hdhr/channelMap.js.map +1 -1
  57. package/dist/hdhr/discover.js +7 -15
  58. package/dist/hdhr/discover.js.map +1 -1
  59. package/dist/hdhr/index.js +6 -9
  60. package/dist/hdhr/index.js.map +1 -1
  61. package/dist/native/index.d.ts +2 -2
  62. package/dist/native/index.js +17 -27
  63. package/dist/native/index.js.map +1 -1
  64. package/dist/native/intercept.js +86 -89
  65. package/dist/native/intercept.js.map +1 -1
  66. package/dist/native/probe.js +2 -2
  67. package/dist/native/probe.js.map +1 -1
  68. package/dist/native/proxy.d.ts +2 -2
  69. package/dist/native/proxy.js +4 -4
  70. package/dist/native/proxy.js.map +1 -1
  71. package/dist/routes/assets.js +29 -51
  72. package/dist/routes/assets.js.map +1 -1
  73. package/dist/routes/auth.js +3 -3
  74. package/dist/routes/auth.js.map +1 -1
  75. package/dist/routes/channels.js +5 -11
  76. package/dist/routes/channels.js.map +1 -1
  77. package/dist/routes/components.d.ts +0 -8
  78. package/dist/routes/components.js +0 -19
  79. package/dist/routes/components.js.map +1 -1
  80. package/dist/routes/config/channels/index.d.ts +1 -1
  81. package/dist/routes/config/channels/index.js +1 -1
  82. package/dist/routes/config/channels/index.js.map +1 -1
  83. package/dist/routes/config/channels/routes.js +748 -420
  84. package/dist/routes/config/channels/routes.js.map +1 -1
  85. package/dist/routes/config/channels/table.d.ts +21 -6
  86. package/dist/routes/config/channels/table.js +456 -193
  87. package/dist/routes/config/channels/table.js.map +1 -1
  88. package/dist/routes/config/index.d.ts +2 -2
  89. package/dist/routes/config/index.js +3 -3
  90. package/dist/routes/config/index.js.map +1 -1
  91. package/dist/routes/config/{providers.js → services.js} +47 -42
  92. package/dist/routes/config/services.js.map +1 -0
  93. package/dist/routes/config/settings.js +88 -49
  94. package/dist/routes/config/settings.js.map +1 -1
  95. package/dist/routes/debug.js +5 -7
  96. package/dist/routes/debug.js.map +1 -1
  97. package/dist/routes/health.js +1 -1
  98. package/dist/routes/health.js.map +1 -1
  99. package/dist/routes/icons.d.ts +16 -0
  100. package/dist/routes/icons.js +44 -0
  101. package/dist/routes/icons.js.map +1 -0
  102. package/dist/routes/index.js +2 -2
  103. package/dist/routes/index.js.map +1 -1
  104. package/dist/routes/logs.js +4 -4
  105. package/dist/routes/logs.js.map +1 -1
  106. package/dist/routes/playlist.d.ts +6 -4
  107. package/dist/routes/playlist.js +98 -45
  108. package/dist/routes/playlist.js.map +1 -1
  109. package/dist/routes/root/content.js +94 -55
  110. package/dist/routes/root/content.js.map +1 -1
  111. package/dist/routes/root/scripts/channels.js +620 -478
  112. package/dist/routes/root/scripts/channels.js.map +1 -1
  113. package/dist/routes/root/scripts/config.js +884 -964
  114. package/dist/routes/root/scripts/config.js.map +1 -1
  115. package/dist/routes/root/scripts/shared.js +468 -188
  116. package/dist/routes/root/scripts/shared.js.map +1 -1
  117. package/dist/routes/root/scripts/status.js +252 -207
  118. package/dist/routes/root/scripts/status.js.map +1 -1
  119. package/dist/routes/root/styles.js +57 -8
  120. package/dist/routes/root/styles.js.map +1 -1
  121. package/dist/routes/services.d.ts +6 -0
  122. package/dist/routes/{providers.js → services.js} +43 -43
  123. package/dist/routes/services.js.map +1 -0
  124. package/dist/routes/ui.d.ts +1 -1
  125. package/dist/routes/ui.js +3 -1
  126. package/dist/routes/ui.js.map +1 -1
  127. package/dist/service/commands.js +8 -43
  128. package/dist/service/commands.js.map +1 -1
  129. package/dist/service/generators.d.ts +1 -1
  130. package/dist/service/generators.js +143 -41
  131. package/dist/service/generators.js.map +1 -1
  132. package/dist/streaming/codec.d.ts +20 -0
  133. package/dist/streaming/codec.js +68 -0
  134. package/dist/streaming/codec.js.map +1 -0
  135. package/dist/streaming/fmp4Segmenter.d.ts +2 -2
  136. package/dist/streaming/fmp4Segmenter.js.map +1 -1
  137. package/dist/streaming/hls.d.ts +4 -4
  138. package/dist/streaming/hls.js +35 -29
  139. package/dist/streaming/hls.js.map +1 -1
  140. package/dist/streaming/hlsResume.js +3 -3
  141. package/dist/streaming/hlsResume.js.map +1 -1
  142. package/dist/streaming/monitor.d.ts +2 -2
  143. package/dist/streaming/monitor.js +19 -13
  144. package/dist/streaming/monitor.js.map +1 -1
  145. package/dist/streaming/preroll.d.ts +15 -14
  146. package/dist/streaming/preroll.js +32 -12
  147. package/dist/streaming/preroll.js.map +1 -1
  148. package/dist/streaming/registry.d.ts +2 -2
  149. package/dist/streaming/registry.js +4 -8
  150. package/dist/streaming/registry.js.map +1 -1
  151. package/dist/streaming/setup.d.ts +4 -4
  152. package/dist/streaming/setup.js +28 -34
  153. package/dist/streaming/setup.js.map +1 -1
  154. package/dist/streaming/showInfo.js +8 -10
  155. package/dist/streaming/showInfo.js.map +1 -1
  156. package/dist/streaming/statusEmitter.d.ts +4 -3
  157. package/dist/streaming/statusEmitter.js +3 -3
  158. package/dist/streaming/statusEmitter.js.map +1 -1
  159. package/dist/types/channels.d.ts +18 -11
  160. package/dist/types/config.d.ts +3 -2
  161. package/dist/types/index.d.ts +4 -3
  162. package/dist/types/index.js +1 -0
  163. package/dist/types/index.js.map +1 -1
  164. package/dist/types/profiles.d.ts +9 -9
  165. package/dist/types/selection.d.ts +1 -1
  166. package/dist/types/shared.d.ts +1 -1
  167. package/dist/types/streaming.d.ts +8 -16
  168. package/dist/types/streaming.js +5 -1
  169. package/dist/types/streaming.js.map +1 -1
  170. package/dist/upgrade/commands.js +1 -16
  171. package/dist/upgrade/commands.js.map +1 -1
  172. package/dist/utils/chromeFetch.js +1 -1
  173. package/dist/utils/cliOutput.d.ts +10 -0
  174. package/dist/utils/cliOutput.js +17 -0
  175. package/dist/utils/cliOutput.js.map +1 -0
  176. package/dist/utils/debugFilter.js +3 -3
  177. package/dist/utils/debugFilter.js.map +1 -1
  178. package/dist/utils/fileLogger.js +4 -3
  179. package/dist/utils/fileLogger.js.map +1 -1
  180. package/dist/utils/format.d.ts +21 -4
  181. package/dist/utils/format.js +45 -7
  182. package/dist/utils/format.js.map +1 -1
  183. package/dist/utils/index.d.ts +1 -0
  184. package/dist/utils/index.js +1 -0
  185. package/dist/utils/index.js.map +1 -1
  186. package/dist/utils/logger.js +17 -27
  187. package/dist/utils/logger.js.map +1 -1
  188. package/dist/utils/morganStream.js +2 -2
  189. package/dist/utils/morganStream.js.map +1 -1
  190. package/dist/utils/platform.js +3 -2
  191. package/dist/utils/platform.js.map +1 -1
  192. package/dist/utils/retry.js +2 -4
  193. package/dist/utils/retry.js.map +1 -1
  194. package/dist/utils/streamContext.d.ts +7 -0
  195. package/dist/utils/streamContext.js +10 -1
  196. package/dist/utils/streamContext.js.map +1 -1
  197. package/dist/utils/version.js +4 -4
  198. package/dist/utils/version.js.map +1 -1
  199. package/package.json +5 -7
  200. package/dist/config/providerPacks.d.ts +0 -46
  201. package/dist/config/providerPacks.js.map +0 -1
  202. package/dist/config/providers.d.ts +0 -175
  203. package/dist/config/providers.js +0 -678
  204. package/dist/config/providers.js.map +0 -1
  205. package/dist/routes/config/providers.js.map +0 -1
  206. package/dist/routes/providers.d.ts +0 -6
  207. package/dist/routes/providers.js.map +0 -1
  208. /package/dist/routes/config/{providers.d.ts → services.d.ts} +0 -0
@@ -0,0 +1,202 @@
1
+ import type { Channel, ChannelMap, ChannelSortField, ServiceGroup, SortDirection } from "../types/index.js";
2
+ /**
3
+ * Gets the service tag for a channel key. For channels in a service group, reads the pre-computed tag from the group variant entry (computed at group-building
4
+ * time by buildServiceGroups). For standalone channels not in any group, derives the tag from the channel's URL domain. This function should not be called with
5
+ * :predefined synthetic keys — those only exist inside service groups and their tags are available via the group's variant entries.
6
+ * @param key - The channel key.
7
+ * @returns The service tag string.
8
+ */
9
+ export declare function getServiceTagForChannel(key: string): string;
10
+ /**
11
+ * Returns the auth domain for a channel key. Domain is the natural auth boundary — browser cookies and sessions scope to it. Multi-channel services work correctly
12
+ * because all their channels share one domain, and canonical channels work correctly because each has its own domain.
13
+ * @param key - The channel key.
14
+ * @returns The extracted domain from the channel's URL, or empty string if the channel or URL cannot be resolved.
15
+ */
16
+ export declare function getAuthDomainForChannel(key: string): string;
17
+ /**
18
+ * Returns all service tags for a channel (canonical tag + all variant suffix tags). Used to determine which services offer this channel.
19
+ * @param canonicalKey - The canonical channel key.
20
+ * @returns Array of service tag strings.
21
+ */
22
+ export declare function getChannelServiceTags(canonicalKey: string): string[];
23
+ /**
24
+ * Scans all service groups and collects unique service tags with display names. Display names are derived from the service field in DOMAIN_CONFIG entries that
25
+ * have a serviceTag.
26
+ * @returns Array of { displayName, domain, iconUrl, tag } objects sorted alphabetically by display name, with "direct" always first.
27
+ */
28
+ export declare function getAllServiceTags(): {
29
+ displayName: string;
30
+ domain?: string;
31
+ iconUrl?: string;
32
+ tag: string;
33
+ }[];
34
+ /**
35
+ * Gets the current enabled service tags.
36
+ * @returns Copy of the enabled services array. Empty means no filter (all shown).
37
+ */
38
+ export declare function getEnabledServices(): string[];
39
+ /**
40
+ * Sets the enabled service tags. Empty array means "no filter" (all services shown).
41
+ * @param tags - The service tags to enable.
42
+ */
43
+ export declare function setEnabledServices(tags: string[]): void;
44
+ /**
45
+ * Checks if a service tag is currently enabled. Returns true if the tag is enabled, if no filter is active (empty set), or if the tag is "direct".
46
+ * @param tag - The service tag to check.
47
+ * @returns True if the service is available.
48
+ */
49
+ export declare function isServiceTagEnabled(tag: string): boolean;
50
+ /**
51
+ * Centralized availability check for the service filter. Returns true if the channel has at least one variant whose service tag is enabled.
52
+ * @param canonicalKey - The canonical channel key.
53
+ * @returns True if the channel passes the service filter.
54
+ */
55
+ export declare function isChannelAvailableByService(canonicalKey: string): boolean;
56
+ /**
57
+ * Builds service groups by scanning all channels and grouping by canonicalKey. Variant entries declare their canonical via the canonicalKey field (set by the
58
+ * flattener for predefined channels, by the browse modal for user channels, and by the one-time migration for pre-existing user entries). This is a single
59
+ * pass over the merged channel map — one field, one mechanism for both predefined and user-defined variant relationships.
60
+ *
61
+ * User overrides of predefined channels (same key, different object reference) produce a two-entry group with "Custom" and the original predefined version,
62
+ * even for single-service channels that don't have canonicalKey-based variants.
63
+ *
64
+ * After building groups, validates stored service selections against the new variant structure and reverts any stale selections to the canonical default. This
65
+ * catches all staleness sources in one place: service key renames across versions, variant removal in code, user-deleted custom variants, and reverted
66
+ * predefined overrides.
67
+ * @param channels - The merged channel map (predefined + user channels).
68
+ * @returns Canonical keys whose service selections were stale and reverted. Empty array if all selections are valid. The caller decides whether to persist.
69
+ */
70
+ export declare function buildServiceGroups(channels: ChannelMap): string[];
71
+ interface PredefinedChannelSummary {
72
+ canonicalKey: string;
73
+ name: string;
74
+ serviceCount: number;
75
+ }
76
+ /**
77
+ * Returns predefined channels whose canonical URL domain matches the given URL's domain. Used by the manual add form to show an inline hint when the user
78
+ * enters a URL that has predefined channels available. Returns an empty array when no predefined channels match.
79
+ * @param url - The URL to match against predefined channel domains.
80
+ * @returns Array of matching predefined channel summaries with canonical key, display name, and available service count.
81
+ */
82
+ export declare function findPredefinedByDomain(url: string): PredefinedChannelSummary[];
83
+ /**
84
+ * Returns the full domain-to-predefined-channel index for client-side embedding. Used by the channels panel to embed predefined match data so the manual add
85
+ * form can show inline hints without a server round-trip. The returned object is keyed by concise domain with arrays of channel summaries as values.
86
+ * @returns Record mapping domains to predefined channel summaries.
87
+ */
88
+ export declare function getPredefinedDomainMap(): Record<string, PredefinedChannelSummary[]>;
89
+ /**
90
+ * Resolves a URL to a friendly service display name. Checks built-in DOMAIN_CONFIG first for a stable, well-known service name, then falls back to
91
+ * getDomainConfig() which includes user domain mappings. This ordering prevents user domain overrides from corrupting display labels for predefined channel
92
+ * variants — a user mapping a built-in domain to a custom profile should not rename every service dropdown entry that uses that domain.
93
+ * @param url - The URL to resolve a service display name for.
94
+ * @returns The service display name, or the concise domain if no service name is configured.
95
+ */
96
+ export declare function getServiceDisplayName(url: string): string;
97
+ /**
98
+ * Resolves the service display label for a channel. Checks in order: explicit `service` field on the channel, the channel's explicit profile resolved via
99
+ * user domain mappings, then URL-based built-in display name. This ensures channels assigned to user-defined profiles show the profile's service name rather
100
+ * than the built-in name for the URL domain.
101
+ * @param channel - The channel to resolve a label for.
102
+ * @returns The service display label.
103
+ */
104
+ export declare function getChannelServiceLabel(channel: Channel): string;
105
+ export declare const VALID_SORT_FIELDS: Set<ChannelSortField>;
106
+ /**
107
+ * Extracts a sortable string value from a channel for the specified sort field. Channel numbers are zero-padded to 6 digits for correct numeric ordering within a
108
+ * string comparison. Service values use the display label for human-meaningful sort order. This is the single source of truth for channel sort key extraction,
109
+ * shared by both the server-side table renderer and the M3U playlist generator.
110
+ * @param channel - Fallback channel definition, used only when the selected service variant cannot be resolved (e.g., key not in the merged channel map).
111
+ * @param key - The canonical channel key. Used for key-based sorting and to resolve the selected service variant internally.
112
+ * @param field - The sort field to extract.
113
+ * @returns A lowercase string suitable for comparison-based sorting.
114
+ */
115
+ export declare function getChannelSortKey(channel: Channel, key: string, field: ChannelSortField): string;
116
+ /**
117
+ * Compares two channels for sorting by the specified field and direction with a built-in channel name tiebreaker. The tiebreaker is always ascending so that rows
118
+ * within each group maintain a consistent alphabetical order regardless of the primary sort direction. This is the single comparator for all sort sites — server HTML
119
+ * render, client re-sort, and M3U playlist — to prevent ordering divergence.
120
+ * @param channelA - First channel definition.
121
+ * @param keyA - First channel key.
122
+ * @param channelB - Second channel definition.
123
+ * @param keyB - Second channel key.
124
+ * @param field - The sort field to compare.
125
+ * @param direction - Sort direction for the primary field.
126
+ * @returns A negative, zero, or positive number for sort ordering.
127
+ */
128
+ export declare function compareChannelSort(channelA: Channel, keyA: string, channelB: Channel, keyB: string, field: ChannelSortField, direction: SortDirection): number;
129
+ /**
130
+ * Gets the service group for a channel key. Works with both canonical and variant keys.
131
+ * @param key - Any channel key in the group.
132
+ * @returns The service group if the channel is part of a multi-service group, undefined otherwise.
133
+ */
134
+ export declare function getServiceGroup(key: string): ServiceGroup | undefined;
135
+ /**
136
+ * Checks if a channel key is a non-canonical service variant. Used to filter variants from channel listings.
137
+ * @param key - The channel key to check.
138
+ * @returns True if the key is a variant (not canonical) in a service group.
139
+ */
140
+ export declare function isServiceVariant(key: string): boolean;
141
+ /**
142
+ * Checks if a channel has multiple service options. Used to determine whether to show a service dropdown in the UI.
143
+ * @param key - The channel key to check.
144
+ * @returns True if the channel has more than one service variant.
145
+ */
146
+ export declare function hasMultipleServices(key: string): boolean;
147
+ /**
148
+ * Gets the canonical key for any channel key. For variant keys, returns the canonical key. For non-grouped or canonical keys, returns the input unchanged.
149
+ * Handles the PREDEFINED_SUFFIX used when a user has overridden a predefined channel.
150
+ * @param key - Any channel key.
151
+ * @returns The canonical key for the channel's service group, or the input key if not part of a group.
152
+ */
153
+ export declare function getCanonicalKey(key: string): string;
154
+ /**
155
+ * Sets the user's service selections. Called when loading from channels.json.
156
+ * @param selections - Service selections keyed by canonical channel key.
157
+ */
158
+ export declare function setServiceSelections(selections: Record<string, string>): void;
159
+ /**
160
+ * Gets all service selections.
161
+ * @returns Copy of the service selections object.
162
+ */
163
+ export declare function getServiceSelections(): Record<string, string>;
164
+ /**
165
+ * Gets the service selection for a specific channel.
166
+ * @param canonicalKey - The canonical channel key.
167
+ * @returns The selected service key, or undefined if using the default.
168
+ */
169
+ export declare function getServiceSelection(canonicalKey: string): string | undefined;
170
+ /**
171
+ * Sets the service selection for a channel.
172
+ * @param canonicalKey - The canonical channel key.
173
+ * @param serviceKey - The selected service key.
174
+ */
175
+ export declare function setServiceSelection(canonicalKey: string, serviceKey: string): void;
176
+ /**
177
+ * Resolves a canonical channel key to the actual channel key based on user selection. If the user has selected a specific service for this channel, returns that
178
+ * service's key. Otherwise returns the canonical key (default service). When the service filter is active, falls back to the first enabled variant if the stored
179
+ * selection's service is filtered out.
180
+ *
181
+ * This function is a pure resolver with no side effects. Stale selection cleanup is handled by buildServiceGroups(), which validates all stored selections
182
+ * against the rebuilt variant structure every time groups are rebuilt - both at startup and after runtime channel mutations.
183
+ * @param canonicalKey - The canonical channel key.
184
+ * @returns The resolved service key to use for streaming.
185
+ */
186
+ export declare function resolveServiceKey(canonicalKey: string): string;
187
+ /**
188
+ * Gets a channel with inheritance applied. For service variants, this merges the variant's properties with inherited properties from the canonical entry
189
+ * using the live channel data (which includes user overrides). Use `resolvePredefinedVariant()` when you need resolution against pure predefined data.
190
+ * @param key - The channel key (canonical or variant).
191
+ * @returns The complete channel with inheritance applied, or undefined if the channel doesn't exist.
192
+ */
193
+ export declare function getResolvedChannel(key: string): Channel | undefined;
194
+ /**
195
+ * Resolves a variant channel key against pure predefined data (ignoring user overrides). This is used for revert detection — when the user's edits match a
196
+ * variant's predefined definition, the custom override can be removed and the service selection switched to that variant. For canonical keys, returns the raw
197
+ * predefined channel. For variant keys, applies the same inheritance rules as `getResolvedChannel()` but against `PREDEFINED_CHANNELS` instead of `channelsRef`.
198
+ * @param key - The channel key (canonical or variant).
199
+ * @returns The channel with inheritance applied against predefined data, or undefined if the key has no predefined definition.
200
+ */
201
+ export declare function resolvePredefinedVariant(key: string): Channel | undefined;
202
+ export {};