Skip to content

Commit 78b15af

Browse files
authored
Merge pull request Sofie-Automation#1662 from evs-broadcast/contribute/ReadonlyDeep-updates
Fix: Update for new TSR mapping types
2 parents cd3cd9d + 26a20c0 commit 78b15af

5 files changed

Lines changed: 11 additions & 9 deletions

File tree

meteor/server/publications/packageManager/expectedPackages/util.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { MappingExt, MappingsExt, StudioRouteSet } from '@sofie-automation/corel
33
import { ReadonlyDeep } from 'type-fest'
44
import { getActiveRoutes, getRoutedMappings } from '@sofie-automation/meteor-lib/dist/collections/Studios'
55

6-
type MappingExtWithOriginalName = MappingExt & { originalLayerName: string }
6+
type MappingExtWithOriginalName = ReadonlyDeep<MappingExt> & { originalLayerName: string }
77
type MappingsExtWithOriginalName = {
88
[layerName: string]: MappingExtWithOriginalName
99
}
@@ -13,7 +13,7 @@ export function buildMappingsToDeviceIdMap(
1313
): Map<string, PeripheralDeviceId[]> {
1414
// Map the expectedPackages onto their specified layer:
1515
const mappingsWithPackages: MappingsExtWithOriginalName = {}
16-
for (const [layerName, mapping] of Object.entries<MappingExt>(studioMappings)) {
16+
for (const [layerName, mapping] of Object.entries<ReadonlyDeep<MappingExt>>(studioMappings)) {
1717
mappingsWithPackages[layerName] = {
1818
...mapping,
1919
originalLayerName: layerName,

meteor/server/publications/pieceContentStatusUI/checkPieceContentStatus.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1184,7 +1184,7 @@ function routeExpectedPackage(
11841184
expectedPackage: ExpectedPackage.Base
11851185
): Set<PeripheralDeviceId> {
11861186
// Collect the relevant mappings
1187-
const mappingsWithPackages: MappingsExt = {}
1187+
const mappingsWithPackages: { [layerName: string]: ReadonlyDeep<MappingExt> } = {}
11881188
for (const layerName of expectedPackage.layers) {
11891189
const mapping = studioMappings[layerName]
11901190

@@ -1199,5 +1199,5 @@ function routeExpectedPackage(
11991199
const routedMappings = getRoutedMappings(mappingsWithPackages, routes)
12001200

12011201
// Find the referenced deviceIds
1202-
return new Set(Object.values<MappingExt>(routedMappings).map((mapping) => mapping.deviceId))
1202+
return new Set(Object.values<ReadonlyDeep<MappingExt>>(routedMappings).map((mapping) => mapping.deviceId))
12031203
}

packages/job-worker/src/playout/lookahead/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function parseSearchDistance(rawVal: number | undefined): number {
3535
}
3636
}
3737

38-
function findLargestLookaheadDistance(mappings: Array<[string, MappingExt]>): number {
38+
function findLargestLookaheadDistance(mappings: Array<[string, ReadonlyDeep<MappingExt>]>): number {
3939
const values = mappings.map(([_id, m]) => parseSearchDistance(m.lookaheadMaxSearchDistance))
4040
return _.max(values)
4141
}
@@ -79,7 +79,7 @@ export async function getLookeaheadObjects(
7979
): Promise<Array<TimelineObjRundown & OnGenerateTimelineObjExt>> {
8080
const span = context.startSpan('getLookeaheadObjects')
8181
const allMappings = context.studio.mappings
82-
const mappingsToConsider = Object.entries<MappingExt>(allMappings).filter(
82+
const mappingsToConsider = Object.entries<ReadonlyDeep<MappingExt>>(allMappings).filter(
8383
([_id, map]) => map.lookahead !== LookaheadMode.NONE && map.lookahead !== undefined
8484
)
8585
if (mappingsToConsider.length === 0) {

packages/meteor-lib/src/collections/Studios.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
} from '@sofie-automation/corelib/dist/dataModel/Studio'
88
import { omit } from '@sofie-automation/corelib/dist/lib'
99
import { protectString } from '@sofie-automation/corelib/dist/protectedString'
10+
import { ReadonlyDeep } from 'type-fest'
1011

1112
export function getActiveRoutes(routeSets: Record<string, StudioRouteSet>): ResultingMappingRoutes {
1213
const routes: ResultingMappingRoutes = {
@@ -47,7 +48,7 @@ export function getActiveRoutes(routeSets: Record<string, StudioRouteSet>): Resu
4748

4849
return routes
4950
}
50-
export function getRoutedMappings<M extends MappingExt>(
51+
export function getRoutedMappings<M extends ReadonlyDeep<MappingExt>>(
5152
inputMappings: { [layerName: string]: M },
5253
mappingRoutes: ResultingMappingRoutes
5354
): { [layerName: string]: M } {

packages/webui/src/client/ui/Settings/Studio/Mappings.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ import {
4444
translateStringIfHasNamespaces,
4545
} from '../../../lib/forms/schemaFormUtil.js'
4646
import { Studios } from '../../../collections/index.js'
47+
import { ReadonlyDeep } from 'type-fest'
4748

4849
export interface MappingsSettingsManifest {
4950
displayName: string
@@ -189,7 +190,7 @@ interface DeletedEntryProps {
189190
manifestNames: Record<string | number, string>
190191
translationNamespaces: string[]
191192

192-
mapping: MappingExt
193+
mapping: ReadonlyDeep<MappingExt>
193194
layerId: string
194195
doUndelete: (itemId: string) => void
195196
}
@@ -531,7 +532,7 @@ function StudioMappingsEntry({
531532
interface MappingSummaryProps {
532533
translationNamespaces: string[]
533534
fields: SchemaSummaryField[]
534-
mapping: MappingExt
535+
mapping: ReadonlyDeep<MappingExt>
535536
}
536537
function MappingSummary({ translationNamespaces, fields, mapping }: Readonly<MappingSummaryProps>) {
537538
if (fields.length > 0) {

0 commit comments

Comments
 (0)