import type { ActionUserData, IBlueprintActionManifest } from '../action'; import type { IActionExecutionContext, ISyncIngestUpdateToPartInstanceContext, IPartEventContext, IRundownContext, IStudioUserContext, ISegmentUserContext, IShowStyleUserContext, ICommonContext, ITimelineEventContext, IRundownDataChangedEventContext, IRundownTimingEventContext, IGetRundownContext, IDataStoreActionExecutionContext, IRundownActivationContext, IShowStyleContext, IFixUpConfigContext, IOnTakeContext, IOnSetAsNextContext } from '../context'; import type { IngestAdlib, ExtendedIngestRundown, IngestRundown } from '../ingest'; import type { IBlueprintExternalMessageQueueObj } from '../message'; import type { IBlueprintAdLibPiece, IBlueprintResolvedPieceInstance, IBlueprintPartInstance, PartEndState, IBlueprintPieceInstance, IBlueprintPartDB, IBlueprintAdLibPieceDB, IBlueprintRundown, ExpectedPlayoutItemGeneric, IBlueprintSegment, IBlueprintPiece, IBlueprintPart } from '../documents'; import type { IBlueprintShowStyleVariant, IOutputLayer, ISourceLayer } from '../showStyle'; import type { TSR, OnGenerateTimelineObj, TimelineObjectCoreExt } from '../timeline'; import type { IBlueprintConfig } from '../common'; import type { ReadonlyDeep } from 'type-fest'; import type { JSONSchema } from '@sofie-automation/shared-lib/dist/lib/JSONSchemaTypes'; import type { JSONBlob } from '@sofie-automation/shared-lib/dist/lib/JSONBlob'; import type { BlueprintConfigCoreConfig, BlueprintManifestBase, BlueprintManifestType, IConfigMessage } from './base'; import type { IBlueprintTriggeredActions } from '../triggers'; import type { ExpectedPackage } from '../package'; import type { ABResolverConfiguration } from '../abPlayback'; import type { SofieIngestSegment } from '../ingest-types'; import { PackageStatusMessage } from '@sofie-automation/shared-lib/dist/packageStatusMessages'; export { PackageStatusMessage }; export type TimelinePersistentState = unknown; export interface ShowStyleBlueprintManifest extends BlueprintManifestBase { blueprintType: BlueprintManifestType.SHOWSTYLE; /** A list of config items this blueprint expects to be available on the ShowStyle */ showStyleConfigSchema: JSONBlob; /** The config presets exposed by this blueprint */ configPresets: Record>; /** Alternate package status messages, to override the builtin ones produced by Sofie */ packageStatusMessages?: Partial>; /** Translations connected to the studio (as stringified JSON) */ translations?: string; /** Returns the id of the show style variant to use for a rundown, return null to ignore that rundown */ getShowStyleVariantId: (context: IStudioUserContext, showStyleVariants: ReadonlyDeep>, ingestRundown: ExtendedIngestRundown) => string | null; /** Generate rundown from ingest data. return null to ignore that rundown */ getRundown: (context: IGetRundownContext, ingestRundown: ExtendedIngestRundown) => BlueprintResultRundown | null | Promise; /** Generate segment from ingest data */ getSegment: (context: ISegmentUserContext, ingestSegment: SofieIngestSegment) => BlueprintResultSegment | Promise; /** * Generate an Adlib Testing IngestRundown for the specified ShowStyleVariant. * This is used to generate a rundown which can be used for testing adlibs, or minimal use of Sofie without a rundown from an NRCS. */ generateAdlibTestingIngestRundown?: (context: IShowStyleUserContext, showStyleVariant: IBlueprintShowStyleVariant) => IngestRundown | Promise; /** * Allows the blueprint to custom-modify the PartInstance, on ingest data update (this is run after getSegment()) * * `playStatus: previous` means that the currentPartInstance is `orphaned: adlib-part` and thus possibly depends on an already past PartInstance for some of it's properties. Therefore the blueprint is allowed to modify the most recently played non-adlibbed PartInstance using ingested data. * * `newData.part` will be `undefined` when the PartInstance is orphaned. Generally, it's useful to differentiate the behavior of the implementation of this function based on `existingPartInstance.partInstance.orphaned` state */ syncIngestUpdateToPartInstance?: (context: ISyncIngestUpdateToPartInstanceContext, existingPartInstance: BlueprintSyncIngestPartInstance, newData: BlueprintSyncIngestNewData, playoutStatus: 'previous' | 'current' | 'next') => void; /** * Execute an action defined by an IBlueprintActionManifest. * * This callback allows an action to perform operations only on the Timeline Datastore. This allows for a _fast-path_ for rapid-fire actions, before the full `executeAction` callback resolves. For more information on how to use this callback, see "Timeline Datastore" in Sofie TV Automation Documentation for Blueprint Developers. */ executeDataStoreAction?: (context: IDataStoreActionExecutionContext, actionId: string, userData: ActionUserData, triggerMode?: string) => Promise; /** Execute an action defined by an IBlueprintActionManifest */ executeAction?: (context: IActionExecutionContext, actionId: string, userData: ActionUserData, triggerMode: string | undefined, privateData?: unknown, publicData?: unknown, actionOptions?: { [key: string]: any; }) => Promise<{ validationErrors: any; } | void>; /** Generate adlib piece from ingest data */ getAdlibItem?: (context: IShowStyleUserContext, ingestItem: IngestAdlib) => Promise | IBlueprintAdLibPiece | IBlueprintActionManifest | null; /** * Apply automatic upgrades to the structure of user specified config overrides * This lets you apply various changes to the user's values in an abstract way */ fixUpConfig?: (context: IFixUpConfigContext) => void; /** * Validate the config passed to this blueprint * In this you should do various sanity checks of the config and return a list of messages to display to the user. * These messages do not stop `applyConfig` from being called. */ validateConfig?: (context: ICommonContext, config: TRawConfig) => Array; /** * Apply the config by generating the data to be saved into the db. * This should be written to give a predictable and stable result, it can be called with the same config multiple times */ applyConfig?: (context: ICommonContext, config: TRawConfig) => BlueprintResultApplyShowStyleConfig; /** Preprocess config before storing it by core to later be returned by context's getShowStyleConfig. If not provided, getShowStyleConfig will return unprocessed blueprint config */ preprocessConfig?: (context: ICommonContext, config: TRawConfig, coreConfig: BlueprintConfigCoreConfig) => TProcessedConfig; /** * Optional method to validate the blueprint config passed to this blueprint according to the API schema. * Returns a list of messages to the caller that are used for logging or to throw if errors have been found. */ validateConfigFromAPI?: (context: ICommonContext, apiConfig: object) => Array; /** * Optional method to transform from an API blueprint config to the database blueprint config if these are required to be different. * If this method is not defined the config object will be used directly */ blueprintConfigFromAPI?: (context: ICommonContext, config: object) => TRawConfig; /** * Optional method to transform from a database blueprint config to the API blueprint config if these are required to be different. * If this method is not defined the config object will be used directly */ blueprintConfigToAPI?: (context: ICommonContext, config: TRawConfig) => object; onRundownActivate?: (context: IRundownActivationContext, wasActive: boolean) => Promise; onRundownFirstTake?: (context: IPartEventContext) => Promise; onRundownDeActivate?: (context: IRundownActivationContext) => Promise; /** Called before a Take action */ onPreTake?: (context: IPartEventContext) => Promise; /** * Called during a Take action. * Allows for part modification or aborting the take. */ onTake?: (context: IOnTakeContext) => Promise; /** Called after a Take action */ onPostTake?: (context: IPartEventContext) => Promise; /** * Called when a part is set as Next, including right after a Take. * Allows for part modification. */ onSetAsNext?: (context: IOnSetAsNextContext) => Promise; /** Called after the timeline has been generated, used to manipulate the timeline */ onTimelineGenerate?: (context: ITimelineEventContext, timeline: OnGenerateTimelineObj[], previousPersistentState: TimelinePersistentState | undefined, previousPartEndState: PartEndState | undefined, resolvedPieces: IBlueprintResolvedPieceInstance[]) => Promise; /** Called just before `onTimelineGenerate` to perform AB-playback for the timeline */ getAbResolverConfiguration?: (context: IShowStyleContext) => ABResolverConfiguration; /** 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) */ getEndStateForPart?: (context: IRundownContext, previousPersistentState: TimelinePersistentState | undefined, partInstance: IBlueprintPartInstance, resolvedPieces: IBlueprintResolvedPieceInstance[], time: number) => PartEndState; /** Called when the Rundown data changes, to be able to update any queued external messages */ onRundownDataChangedEvent?: (context: IRundownDataChangedEventContext) => Promise; /** * Called when the timing for a PartInstance or its content changes. * This will often be batched (via a short debounce), but is called for each part when either the part or a piece timing changes. */ onRundownTimingEvent?: (context: IRundownTimingEventContext) => Promise; } export interface BlueprintResultTimeline { timeline: OnGenerateTimelineObj[]; persistentState: TimelinePersistentState; } export interface BlueprintResultBaseline { timelineObjects: TimelineObjectCoreExt[]; expectedPlayoutItems?: ExpectedPlayoutItemGeneric[]; expectedPackages?: ExpectedPackage.Any[]; } export interface BlueprintResultRundown { rundown: IBlueprintRundown; globalAdLibPieces: IBlueprintAdLibPiece[]; globalActions: IBlueprintActionManifest[]; baseline: BlueprintResultBaseline; } export interface BlueprintResultSegment { segment: IBlueprintSegment; parts: BlueprintResultPart[]; } export interface BlueprintResultPart { part: IBlueprintPart; pieces: IBlueprintPiece[]; adLibPieces: IBlueprintAdLibPiece[]; actions: IBlueprintActionManifest[]; } export interface BlueprintSyncIngestNewData { /** The new part */ part: IBlueprintPartDB | undefined; /** A list of pieces (including infinites) that would be present in a fresh copy of this partInstance */ pieceInstances: IBlueprintPieceInstance[]; /** The adlib pieces belonging to this part */ adLibPieces: IBlueprintAdLibPieceDB[]; /** The adlib actions belonging to this part */ actions: IBlueprintActionManifest[]; /** A list of adlibs that have pieceInstances in the partInstance in question */ referencedAdlibs: IBlueprintAdLibPieceDB[]; } export interface BlueprintSyncIngestPartInstance { partInstance: IBlueprintPartInstance; pieceInstances: IBlueprintPieceInstance[]; } export interface BlueprintResultApplyShowStyleConfig { sourceLayers: ISourceLayer[]; outputLayers: IOutputLayer[]; triggeredActions: IBlueprintTriggeredActions[]; } export interface IShowStyleConfigPreset { name: string; config: TConfig; variants: Record>; } export interface IShowStyleVariantConfigPreset { name: string; config: Partial; } //# sourceMappingURL=showStyle.d.ts.map