import { Trigger } from './trigger' ; import { TriggerContract } from './trigger_contract' ; import { UiActionsService } from '../service' ; import { TriggerId , TriggerContextMapping } from '../types' ; /**
 * Internal representation of a trigger kept for consumption only internally
 * within `ui_actions` plugin.
 */ export class TriggerInternal < T extends TriggerId > { public readonly contract = new TriggerContract < T > ( this ) ; constructor ( public readonly service , public readonly trigger ) { } public async execute ( context ) { const triggerId = this . trigger . id ; const actions = await this . service . getTriggerCompatibleActions ! ( triggerId , context ) ; await Promise . all ( [ actions . map ( ( action ) => this . service . executionService . execute ( { action , context , trigger : this . trigger , } ) ) , ] ) ; } }