import { SelectOption } from '@prefecthq/prefect-design'; import { Component } from 'vue'; import { SchemaPropertyComponentWithProps } from '../../../services/schemas/utilities'; import { SchemaProperty, SchemaPropertyInputAttrs, SchemaPropertyMeta, SchemaValue } from '../../../types/schemas'; import { Require } from '../../../types/utilities'; import { ValidationMethod, ValidationMethodFactory } from '../../../utilities/validation'; export type SchemaPropertyServiceSource = { property: SchemaProperty; level: number; }; export type SchemaPropertyServiceConstructor = new (source: SchemaPropertyServiceSource) => SchemaPropertyService; export declare abstract class SchemaPropertyService { /** * Converts a schema value from the ui into the correct value for the api */ protected abstract request(value: SchemaValue): SchemaValue; /** * Converts a schema value from the api into the correct value for the ui */ protected abstract response(value: SchemaValue): SchemaValue; /** * Returns the vue component and any props necessary to render the property in the schema form */ protected abstract get component(): SchemaPropertyComponentWithProps; /** * Returns the value needed for the @property {PropertyComponentWithProps} property to be * rendered when no value exists or the value is invalid */ protected abstract get default(): SchemaValue; /** * Can be extended to add property specific validation rules. Implemented here because this is not required */ protected get validators(): ValidationMethodFactory[]; /** * Can be extended to add property specific attrs rules. Implemented here because this is not required */ protected get attrs(): SchemaPropertyInputAttrs; protected property: SchemaProperty; protected level: number; protected withProps: (...args: Omit>, "modelValue"> extends Omit, "modelValue"> ? [component: T, props?: (Omit, "modelValue"> & Record) | undefined] : [component: T, props: Omit, "modelValue"> & Record]) => Omit>, "modelValue"> extends Omit, "modelValue"> ? { component: T; props?: (Omit, "modelValue"> & Record) | undefined; } : { component: T; props: Omit, "modelValue"> & Record; }; constructor({ property, level }: SchemaPropertyServiceSource); mapResponseValue(value: SchemaValue): SchemaValue; mapRequestValue(value: SchemaValue): SchemaValue | undefined; getDefaultValue(): SchemaValue; getComponent(): SchemaPropertyComponentWithProps; getValidators(required: boolean): ValidationMethod[]; getAttrs(): SchemaPropertyInputAttrs; getMeta(required: boolean): SchemaPropertyMeta | null; protected componentIs(component: Component): boolean; protected invalid(): void; protected has(key: T): this is { property: SchemaProperty & Require; }; protected getSelectOptions(): SelectOption[]; protected isDefaultValue(value: SchemaValue): boolean; }