import { ConditionOp, Rule, WorkflowDefinition } from '../../core/types.js'; /** * The rules editor's flat view of a workflow rule — ServiceNow UI policies * (show / hide / mandatory / read-only), simple "set value" client scripts, * and the workflow "If" that skips an approval — as rows a form can edit. * Conditions are one level: all or any of a list of field comparisons. */ interface RuleCondition { field: string; op: ConditionOp; value: string; } export type RuleAction = { action: 'show' | 'hide' | 'required' | 'optional' | 'readonly'; field: string; } | { action: 'setValue'; field: string; value: string; } | { action: 'skipForm'; form: string; }; export interface RuleRow { id: string; match: 'all' | 'any'; conditions: RuleCondition[]; actions: RuleAction[]; /** Parts the editor cannot show (else-branches, nested conditions): kept as they were. */ extra?: { else?: Rule['else'] | undefined; priority?: number | undefined; flag?: string | undefined; }; /** Not representable at all: shown read-only and written back untouched. */ raw?: Rule; } export declare const CONDITION_OPS: readonly { op: ConditionOp; label: string; needsValue: boolean; }[]; export declare const ACTIONS: readonly { action: RuleAction['action']; label: string; }[]; /** Every input field across the workflow, as `Form_Name.key` with a readable label. */ export declare const fieldChoices: (draft: WorkflowDefinition) => { ref: string; label: string; type: string; }[]; export declare const toRows: (rules: readonly Rule[]) => RuleRow[]; export declare const toRules: (rows: readonly RuleRow[], draft: WorkflowDefinition) => Rule[]; export {};