forked from Sofie-Automation/sofie-core
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathonSetAsNextContext.ts
More file actions
97 lines (89 loc) · 4.33 KB
/
onSetAsNextContext.ts
File metadata and controls
97 lines (89 loc) · 4.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
import {
IBlueprintMutatablePart,
IBlueprintPart,
IBlueprintPartInstance,
IBlueprintPiece,
IBlueprintPieceDB,
IBlueprintPieceInstance,
IBlueprintResolvedPieceInstance,
IBlueprintSegmentDB,
IEventContext,
IShowStyleUserContext,
} from '../index.js'
import { ITriggerIngestChangeContext } from './executeTsrActionContext.js'
import { BlueprintQuickLookInfo } from './quickLoopInfo.js'
import { ReadonlyDeep } from 'type-fest'
import type { ITTimersContext } from './tTimersContext.js'
/**
* Context in which 'current' is the part currently on air, and 'next' is the partInstance being set as Next
* This is similar to `IPartAndPieceActionContext`, but has more limits on what is allowed to be changed.
*/
export interface IOnSetAsNextContext
extends IShowStyleUserContext, IEventContext, ITriggerIngestChangeContext, ITTimersContext {
/** Information about the current loop, if there is one */
readonly quickLoopInfo: BlueprintQuickLookInfo | null
/** Whether the part being set as next was selected as a result of user's actions */
readonly manuallySelected: boolean
/**
* Data fetching
*/
/** Get a PartInstance which can be modified */
getPartInstance(part: 'current' | 'next'): Promise<IBlueprintPartInstance | undefined>
/** Get the PieceInstances for a modifiable PartInstance */
getPieceInstances(part: 'current' | 'next'): Promise<IBlueprintPieceInstance[]>
/** Get the resolved PieceInstances for a modifiable PartInstance */
getResolvedPieceInstances(part: 'current' | 'next'): Promise<IBlueprintResolvedPieceInstance[]>
/** Get the last active piece on given layer */
findLastPieceOnLayer(
sourceLayerId: string | string[],
options?: {
excludeCurrentPart?: boolean
originalOnly?: boolean
piecePrivateDataFilter?: any // Mongo query against properties inside of piece.privateData
}
): Promise<IBlueprintPieceInstance | undefined>
/** Get the previous scripted piece on a given layer, looking backwards from the current part. */
findLastScriptedPieceOnLayer(
sourceLayerId: string | string[],
options?: {
excludeCurrentPart?: boolean
piecePrivateDataFilter?: any
}
): Promise<IBlueprintPiece | undefined>
/** Gets the PartInstance for a PieceInstance retrieved from findLastPieceOnLayer. This primarily allows for accessing metadata of the PartInstance */
getPartInstanceForPreviousPiece(piece: IBlueprintPieceInstance): Promise<IBlueprintPartInstance>
/** Gets the Part for a Piece retrieved from findLastScriptedPieceOnLayer. This primarily allows for accessing metadata of the Part */
getPartForPreviousPiece(piece: IBlueprintPieceDB): Promise<IBlueprintPart | undefined>
/** Gets the Segment. This primarily allows for accessing metadata */
getSegment(segment: 'current' | 'next'): Promise<IBlueprintSegmentDB | undefined>
/** Get a list of the upcoming Parts in the Rundown, in the order that they will be Taken
*
* @param limit The max number of parts returned. Default is 5.
* @returns An array of Parts. If there is no next part, the array will be empty.
*/
getUpcomingParts(limit?: number): Promise<ReadonlyDeep<IBlueprintPart[]>>
/**
* Creative actions
*/
/** Insert a pieceInstance. Returns id of new PieceInstance. Any timelineObjects will have their ids changed, so are not safe to reference from another piece */
insertPiece(part: 'next', piece: IBlueprintPiece): Promise<IBlueprintPieceInstance>
/** Update a piecesInstance */
updatePieceInstance(pieceInstanceId: string, piece: Partial<IBlueprintPiece>): Promise<IBlueprintPieceInstance>
/** Update a partInstance */
updatePartInstance(
part: 'current' | 'next',
props: Partial<IBlueprintMutatablePart>
): Promise<IBlueprintPartInstance>
/**
* Destructive actions
*/
/** Remove piecesInstances by id. Returns ids of piecesInstances that were removed. */
removePieceInstances(part: 'current' | 'next', pieceInstanceIds: string[]): Promise<string[]>
/**
* Move the next part through the rundown. Can move by either a number of parts, or segments in either direction.
* This will result in the `onSetAsNext` callback being called again following the current call, with the new PartInstance.
* Multiple calls of this inside one call to `onSetAsNext` will replace earlier calls.
* @returns Whether a new Part was found using the provided offset
*/
moveNextPart(partDelta: number, segmentDelta: number, ignoreQuickLoop?: boolean): Promise<boolean>
}