import { AppServerForm, AuthRequest, FormInterface, InterpolatedError } from "@formio/appserver"; import { Component, Submission, DataObject, ComponentPaths } from "@formio/core"; import { UAGForm } from "./config"; import { ParentInfo } from "./tools"; export type UAGComponentInfo = { path: string; label: string; type: string; format: string; description: string; validation: any; options?: { label: string; value: string; }[]; prompt?: string; nested?: boolean; rule?: string; }; export type UAGData = Array<{ label: string; value: any; path: string; prefix?: string; }>; export type UAGSubmission = { _id?: string; data: UAGData; created?: string | Date; modified?: string | Date; }; export type FormFieldError = { label: string; path: string; error: string; }; export type FormFieldInfo = { rowIndex: number; total: number; totalRequired: number; totalRequiredCollected: number; errors: FormFieldError[]; required: { rules: Record; components: UAGComponentInfo[]; }; optional: { rules: Record; components: UAGComponentInfo[]; }; }; export type UAGFields = { persona: string; criteria: string; components: Record; }; export declare class UAGFormInterface extends FormInterface { uag: UAGForm | null; uagFields: Record; setComponent(form: AppServerForm, component: Component, path: string, components: Component[] | undefined, parent: Component | undefined, paths: ComponentPaths | undefined): void; getComponentFormat(component: Component): string; getComponentInfo(component: Component, path: string): UAGComponentInfo; isMultiple(component: Component | undefined): boolean; getParentInfoFromComponent(parent: Component | undefined, parent_path?: string): ParentInfo | undefined; getParentInfo(parent_path?: string): ParentInfo | undefined; getParentLabel(parent?: ParentInfo): string; getParentDataPath(parent: ParentInfo | undefined, rowIndex?: number): string; getParentToolDescription(parent: ParentInfo | undefined): string; getComponentValueRule(component: Component, data_path?: string): string; /** * Determine if the component is a nested data components. For these components, the UAG treats them as * separate data collection units where the agent will explicitely call out to collect data for these components. * * @import { Component } from "@formio/core"; * @param component { Component } - The component to check. * @returns { boolean } - True if the component is a nested data component, false otherwise. */ isNestedComponent(component: Component): boolean; /** * Determine if the component is a non-input component that should be skipped when collecting fields. * * @import { Component } from "@formio/core"; * @param component { Component } - The component to check. * @returns { boolean } - True if the component is an input component, false otherwise. */ inputComponent(component: Component): boolean; getEmptyValue(component: Component): {}[] | { data: {}; }[] | { data: {}; } | { data?: undefined; } | null; /** * Override the process methods for the UAG. */ process(submission: Submission, auth: AuthRequest, headers?: any, findQuery?: any, additional?: any[]): Promise; /** * Get the relevant fields from the current form. This will return any non-nested input components whose * values have not already been set within the data model. This allows the agent to know what fields still need to be * collected from the user, as well as provides a mechanism to break up large forms into smaller chunks of data collection * using the 'nested' components (datagrid, editgrid, nested form, etc.). * * @import { Submission } from "@formio/core"; * @import { AuthRequest } from "@formio/appserver"; * @param submission { Submission } - The current submission data model. * @param authInfo { AuthRequest } - The current authentication information. * @param within { string | string[] } - Optional data path or array of data paths to limit the field extraction within. * - If within is an array, then it works like "includes". * - If within is a string, then it is a single path to limit components within (non-inclusive). * @returns { Promise } - The extracted form field information. */ getFields(submission: Submission, authInfo: AuthRequest, within?: string | string[]): Promise; /** * Return the component at the specified data path. * @param path { string } - The data path of the component to retrieve. * @returns { Component | undefined } - The component at the specified path, or undefined if not found. */ getComponent(path: string): Component | undefined; /** * Convert a list of InterpolatedErrors into FormFieldErrors. * @param errors * @returns */ convertToFormFieldErrors(errors: InterpolatedError[]): FormFieldError[]; /** * Perform a validation process on the collected form data. * @param data * @param auth * @returns */ validateData(submission: Submission, auth: AuthRequest): Promise; convertToSubmission(data?: Record): Submission; formatData(data?: DataObject): UAGData; formatSubmission(submission: Submission): UAGSubmission; htmlToMarkdown(html: string): string; }