Skip to content

Commit d6ef069

Browse files
committed
wip: api
1 parent a0fe909 commit d6ef069

File tree

2 files changed

+22
-8
lines changed

2 files changed

+22
-8
lines changed

packages/blueprints-integration/src/api/showStyle.ts

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ import type { ExpectedPackage } from '../package'
4848
import type { ABResolverConfiguration } from '../abPlayback'
4949
import type { SofieIngestSegment } from '../ingest-types'
5050
import { PackageStatusMessage } from '@sofie-automation/shared-lib/dist/packageStatusMessages'
51+
import { BlueprintPlayoutPersistentStore } from '../context/playoutStore'
5152

5253
export { PackageStatusMessage }
5354

@@ -122,6 +123,7 @@ export interface ShowStyleBlueprintManifest<TRawConfig = IBlueprintConfig, TProc
122123
*/
123124
executeDataStoreAction?: (
124125
context: IDataStoreActionExecutionContext,
126+
playoutPersistentState: BlueprintPlayoutPersistentStore<TimelinePersistentState>,
125127
actionId: string,
126128
userData: ActionUserData,
127129
triggerMode?: string
@@ -130,12 +132,13 @@ export interface ShowStyleBlueprintManifest<TRawConfig = IBlueprintConfig, TProc
130132
/** Execute an action defined by an IBlueprintActionManifest */
131133
executeAction?: (
132134
context: IActionExecutionContext,
135+
playoutPersistentState: BlueprintPlayoutPersistentStore<TimelinePersistentState>,
133136
actionId: string,
134137
userData: ActionUserData,
135138
triggerMode: string | undefined,
136-
privateData?: unknown,
137-
publicData?: unknown,
138-
actionOptions?: { [key: string]: any }
139+
privateData: unknown | undefined,
140+
publicData: unknown | undefined,
141+
actionOptions: { [key: string]: any } | undefined
139142
) => Promise<{ validationErrors: any } | void>
140143

141144
/** Generate adlib piece from ingest data */
@@ -204,21 +207,27 @@ export interface ShowStyleBlueprintManifest<TRawConfig = IBlueprintConfig, TProc
204207
* Called during a Take action.
205208
* Allows for part modification or aborting the take.
206209
*/
207-
onTake?: (context: IOnTakeContext) => Promise<void>
210+
onTake?: (
211+
context: IOnTakeContext,
212+
playoutPersistentState: BlueprintPlayoutPersistentStore<TimelinePersistentState>
213+
) => Promise<void>
208214
/** Called after a Take action */
209215
onPostTake?: (context: IPartEventContext) => Promise<void>
210216

211217
/**
212218
* Called when a part is set as Next, including right after a Take.
213219
* Allows for part modification.
214220
*/
215-
onSetAsNext?: (context: IOnSetAsNextContext) => Promise<void>
221+
onSetAsNext?: (
222+
context: IOnSetAsNextContext,
223+
playoutPersistentState: BlueprintPlayoutPersistentStore<TimelinePersistentState>
224+
) => Promise<void>
216225

217226
/** Called after the timeline has been generated, used to manipulate the timeline */
218227
onTimelineGenerate?: (
219228
context: ITimelineEventContext,
220229
timeline: OnGenerateTimelineObj<TSR.TSRTimelineContent>[],
221-
previousPersistentState: TimelinePersistentState | undefined,
230+
playoutPersistentState: BlueprintPlayoutPersistentStore<TimelinePersistentState>,
222231
previousPartEndState: PartEndState | undefined,
223232
resolvedPieces: IBlueprintResolvedPieceInstance[]
224233
) => Promise<BlueprintResultTimeline>
@@ -229,7 +238,7 @@ export interface ShowStyleBlueprintManifest<TRawConfig = IBlueprintConfig, TProc
229238
/** Called just before taking the next part. This generates some persisted data used by onTimelineGenerate to modify the timeline based on the previous part (eg, persist audio levels) */
230239
getEndStateForPart?: (
231240
context: IRundownContext,
232-
previousPersistentState: TimelinePersistentState | undefined,
241+
playoutPersistentState: BlueprintPlayoutPersistentStore<TimelinePersistentState>,
233242
partInstance: IBlueprintPartInstance,
234243
resolvedPieces: IBlueprintResolvedPieceInstance[],
235244
time: number
@@ -249,7 +258,6 @@ export interface ShowStyleBlueprintManifest<TRawConfig = IBlueprintConfig, TProc
249258

250259
export interface BlueprintResultTimeline {
251260
timeline: OnGenerateTimelineObj<TSR.TSRTimelineContent>[]
252-
persistentState: TimelinePersistentState
253261
}
254262
export interface BlueprintResultBaseline {
255263
timelineObjects: TimelineObjectCoreExt<TSR.TSRTimelineContent>[]
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export interface BlueprintPlayoutPersistentStore<T = unknown> {
2+
getAll(): Partial<T>
3+
getKey<K extends keyof T>(k: K): T[K] | undefined
4+
setKey<K extends keyof T>(k: K, v: T[K]): void
5+
setAll(obj: T): void
6+
}

0 commit comments

Comments
 (0)