import { SchemaBase } from './dsl.js'; import type { DtoField, DtoMessage, DtoArrayField, DtoObjectField } from './dto.js'; import type { RefSchema } from './ref.js'; import type { ControllerMethodSchema } from './controller.js'; /** An action a user can perform on a page (e.g. submit, approve, reject). * Subclasses use `type` as the discriminator. */ export interface PageActionSchema extends SchemaBase { type: string; } export declare function definePageAction(name: string, description?: string): PageActionSchema; /** Parameter data source for a call argument. */ export type DataRef = { type: 'route'; key: string; } | { type: 'data'; key: string; } | { type: 'value'; value: unknown; }; /** Create a route-parameter reference. */ export declare function route(key: string): DataRef; /** Create a page-data reference. */ export declare function data(key: string): DataRef; export interface CallAction extends PageActionSchema { type: 'call'; func: ControllerMethodSchema; args?: Record; } export declare function call(func: ControllerMethodSchema, args?: Record): CallAction; /** Assign a call's result to a page data field. * React: setState({ [field]: await ... }). Mini-program: this.setData({ [field]: ... }). */ export interface SetDataAction extends PageActionSchema { type: 'setData'; call: CallAction; field: DtoField; } export declare function setData(call: CallAction, field: DtoField): SetDataAction;