import { Block } from '../core/index.ts'; import type { BlockOutput, IBaseBlockConfig, IRunContext } from '../types/index.ts'; /** * @public * * Configuration object for action blocks */ export interface IActionConfig extends IBaseBlockConfig { /** * This callback will be executed when an automation runs this block */ callback: ((context: IRunContext) => TOutput) | ((context: IRunContext) => Promise); } export declare class Action extends Block implements Block { readonly config: IActionConfig; readonly name: string; constructor(config: IActionConfig); readonly type: string; run(context: IRunContext): Promise>; } /** * @public * * A generic block that represents some kind of action * * @example * ```TypeScript * * import { action } from "@hass-blocks/core" * * const turnOnLivingRoomLights = action({ * name: `Turn on lights`, * callback: async (hass) => { * await hass.callService({ * domain: 'light', * service: 'turn_on', * target: { * entity_id: 'light.living_room' * } * }) * }, * }); * ``` * * @param config - configuration for the action */ export declare const action: (config: IActionConfig) => Block; //# sourceMappingURL=action.d.ts.map