Skip to content

Commit 3122f23

Browse files
committed
Merge branch 'bbc-local/upstream/set-next-from-here' into nrk/test/set-next-from-here
2 parents 0df7692 + 028e64c commit 3122f23

File tree

28 files changed

+1740
-473
lines changed

28 files changed

+1740
-473
lines changed

meteor/server/api/userActions.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ import { IngestJobs } from '@sofie-automation/corelib/dist/worker/ingest'
4949
import { UserPermissions } from '@sofie-automation/meteor-lib/dist/userPermissions'
5050
import { assertConnectionHasOneOfPermissions } from '../security/auth'
5151
import { checkAccessToRundown } from '../security/check'
52+
import { protectString, unprotectString } from '@sofie-automation/corelib/dist/protectedString'
5253

5354
const PERMISSIONS_FOR_PLAYOUT_USERACTION: Array<keyof UserPermissions> = ['studio']
5455
const PERMISSIONS_FOR_BUCKET_MODIFICATION: Array<keyof UserPermissions> = ['studio']
@@ -121,8 +122,9 @@ class ServerUserActionAPI
121122
userEvent: string,
122123
eventTime: Time,
123124
rundownPlaylistId: RundownPlaylistId,
124-
nextPartId: PartId,
125-
timeOffset: number | null
125+
nextPartOrInstanceId: PartId | PartInstanceId,
126+
timeOffset: number | null,
127+
isInstance: boolean | null
126128
) {
127129
return ServerClientAPI.runUserActionInLogForPlaylistOnWorker(
128130
this,
@@ -131,12 +133,15 @@ class ServerUserActionAPI
131133
rundownPlaylistId,
132134
() => {
133135
check(rundownPlaylistId, String)
134-
check(nextPartId, String)
136+
check(nextPartOrInstanceId, String)
135137
},
136138
StudioJobs.SetNextPart,
137139
{
138140
playlistId: rundownPlaylistId,
139-
nextPartId,
141+
nextPartId: isInstance ? undefined : protectString<PartId>(unprotectString(nextPartOrInstanceId)),
142+
nextPartInstanceId: isInstance
143+
? protectString<PartInstanceId>(unprotectString(nextPartOrInstanceId))
144+
: undefined,
140145
setManually: true,
141146
nextTimeOffset: timeOffset ?? undefined,
142147
}

meteor/yarn.lock

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1245,7 +1245,7 @@ __metadata:
12451245
dependencies:
12461246
"@mos-connection/model": "npm:^5.0.0-alpha.0"
12471247
kairos-lib: "npm:^0.2.3"
1248-
timeline-state-resolver-types: "npm:10.0.0-nightly-release53-20251217-143607-df590aa96.0"
1248+
timeline-state-resolver-types: "npm:10.0.0-nightly-release53-20260123-151128-04b075e87.0"
12491249
tslib: "npm:^2.8.1"
12501250
type-fest: "npm:^4.33.0"
12511251
languageName: node
@@ -9976,12 +9976,12 @@ __metadata:
99769976
languageName: node
99779977
linkType: hard
99789978

9979-
"timeline-state-resolver-types@npm:10.0.0-nightly-release53-20251217-143607-df590aa96.0":
9980-
version: 10.0.0-nightly-release53-20251217-143607-df590aa96.0
9981-
resolution: "timeline-state-resolver-types@npm:10.0.0-nightly-release53-20251217-143607-df590aa96.0"
9979+
"timeline-state-resolver-types@npm:10.0.0-nightly-release53-20260123-151128-04b075e87.0":
9980+
version: 10.0.0-nightly-release53-20260123-151128-04b075e87.0
9981+
resolution: "timeline-state-resolver-types@npm:10.0.0-nightly-release53-20260123-151128-04b075e87.0"
99829982
dependencies:
99839983
tslib: "npm:^2.8.1"
9984-
checksum: 10/6f17030e9f10568757b3ebaae40a54ce5220ce5c2f37d9b5d8a5d286704e4779c80fbfddae500e1952a6efdf6e76b67bc18d0151211c84eb194ae3b52f78c7bf
9984+
checksum: 10/7322e958a35bc9deaa332c201414248b097c5894b556e481c5a97d51e292cb61c017d3d373fe1ae3bf19383965535dbfe104d8c38ca7c109eadbffc781a08ed9
99859985
languageName: node
99869986
linkType: hard
99879987

packages/corelib/src/worker/studio.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,8 @@ export interface ActivateRundownPlaylistProps extends RundownPlayoutPropsBase {
254254
}
255255
export type DeactivateRundownPlaylistProps = RundownPlayoutPropsBase
256256
export interface SetNextPartProps extends RundownPlayoutPropsBase {
257-
nextPartId: PartId
257+
nextPartId?: PartId
258+
nextPartInstanceId?: PartInstanceId
258259
setManually?: boolean
259260
nextTimeOffset?: number
260261
}

packages/job-worker/src/playout/lookahead/__tests__/findForLayer.test.ts

Lines changed: 0 additions & 207 deletions
This file was deleted.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
jest.mock('../../findObjects')
2+
import { context, TfindLookaheadObjectsForPart } from './helpers/mockSetup.js'
3+
import { findLookaheadForLayer } from '../../findForLayer.js'
4+
import { expectInstancesToMatch } from '../utils.js'
5+
import { findForLayerTestConstants } from './constants.js'
6+
import { findLookaheadObjectsForPart } from '../../findObjects.js'
7+
8+
const findLookaheadObjectsForPartMockBase = findLookaheadObjectsForPart as TfindLookaheadObjectsForPart
9+
const findLookaheadObjectsForPartMock = findLookaheadObjectsForPartMockBase.mockImplementation(() => []) // Default mock
10+
11+
beforeEach(() => {
12+
findLookaheadObjectsForPartMock.mockReset()
13+
})
14+
15+
const current = findForLayerTestConstants.current
16+
const nextFuture = findForLayerTestConstants.nextFuture
17+
const layer = findForLayerTestConstants.layer
18+
19+
describe('findLookaheadForLayer – basic behavior', () => {
20+
test('no parts', () => {
21+
const res = findLookaheadForLayer(context, {}, [], 'abc', 1, 1)
22+
23+
expect(res.timed).toHaveLength(0)
24+
expect(res.future).toHaveLength(0)
25+
})
26+
test('if the previous part is unset', () => {
27+
findLookaheadObjectsForPartMock.mockReturnValue([])
28+
29+
findLookaheadForLayer(context, { previous: undefined, current, next: nextFuture }, [], layer, 1, 1)
30+
31+
expect(findLookaheadObjectsForPartMock).toHaveBeenCalledTimes(2)
32+
expectInstancesToMatch(findLookaheadObjectsForPartMock, 1, layer, current, undefined)
33+
})
34+
})
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import { getRandomString } from '@sofie-automation/corelib/dist/lib'
2+
import { PartInstanceAndPieceInstances, PartAndPieces } from '../../util.js'
3+
import { createFakePiece } from '../utils.js'
4+
5+
const layer: string = getRandomString()
6+
7+
export const findForLayerTestConstants = {
8+
previous: {
9+
part: { _id: 'pPrev', part: 'prev' },
10+
allPieces: [createFakePiece('1'), createFakePiece('2'), createFakePiece('3')],
11+
onTimeline: true,
12+
nowInPart: 2000,
13+
} as any as PartInstanceAndPieceInstances,
14+
current: {
15+
part: { _id: 'pCur', part: 'cur' },
16+
allPieces: [createFakePiece('4'), createFakePiece('5'), createFakePiece('6')],
17+
onTimeline: true,
18+
nowInPart: 1000,
19+
} as any as PartInstanceAndPieceInstances,
20+
nextTimed: {
21+
part: { _id: 'pNextTimed', part: 'nextT' },
22+
allPieces: [createFakePiece('7'), createFakePiece('8'), createFakePiece('9')],
23+
onTimeline: true,
24+
} as any as PartInstanceAndPieceInstances,
25+
nextFuture: {
26+
part: { _id: 'pNextFuture', part: 'nextF' },
27+
allPieces: [createFakePiece('10'), createFakePiece('11'), createFakePiece('12')],
28+
onTimeline: false,
29+
} as any as PartInstanceAndPieceInstances,
30+
31+
orderedParts: [{ _id: 'p1' }, { _id: 'p2', invalid: true }, { _id: 'p3' }, { _id: 'p4' }, { _id: 'p5' }].map(
32+
(p) => ({
33+
part: p as any,
34+
usesInTransition: true,
35+
pieces: [{ _id: p._id + '_p1' } as any],
36+
})
37+
) as PartAndPieces[],
38+
39+
layer,
40+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { setupDefaultJobEnvironment } from '../../../../../__mocks__/context.js'
2+
import { findLookaheadObjectsForPart } from '../../../../../playout/lookahead/findObjects.js'
3+
4+
export type TfindLookaheadObjectsForPart = jest.MockedFunction<typeof findLookaheadObjectsForPart>
5+
6+
export const context = setupDefaultJobEnvironment()

0 commit comments

Comments
 (0)