@omnia/fx
Version:
Provide Omnia Fx typings and tooling for clientside Omnia development.
36 lines (35 loc) • 2.17 kB
TypeScript
import { DataSourceProperty, GuidValue, PropertyConfiguration, PropertyDefinition, PropertyValueType, PropertyDefinitionId } from "../../../models";
export type DataSourcePropertyDefintionHandlerId = GuidValue;
/**
*
* A plugin module for handling the different property definitions/values that can be created from the data source properties
*
* */
export declare abstract class DataSourcePropertyDefinitionHandler<TPropertyDefinition extends PropertyDefinition<any, any, any>, TDataSourceProperty extends DataSourceProperty, DataSourceReadDataType, DataSourceWriteBackType> {
/**
* A unique constant id for this converter
* */
abstract readonly Id: DataSourcePropertyDefintionHandlerId;
/**
* Handler title, will be used if more than one handler exists for any given propertyDefinition
* E.g "Ticks to DateTimeProperty", and one other handler nemed "String to DateTimeProperty", i.e "TDataSourceData To TPropertyDefinition" or so.
* */
abstract readonly title: string;
/**
* The property defintion this handler is intended to handle
* */
readonly propertyDefintionId: PropertyDefinitionId;
/**
* The ctor for the definition which this handler is defined for, only used to link with definitionId in a typesafe way
* */
constructor(propertyDefinitionCtor: new () => TPropertyDefinition);
propertyConfiguration?: PropertyConfiguration<TPropertyDefinition>;
/**
* This method should convert from the data source value to PropertyValue matching the TPropertyDefinition
* */
abstract propertyValueCreator(dataSourceProperty: TDataSourceProperty, valueFromSource: DataSourceReadDataType, propertyconfiguration?: PropertyConfiguration<PropertyDefinition<any, any, any>>): Promise<PropertyValueType<TPropertyDefinition>>;
/**
* This method should convert from PropertyValue matching the TPropertyDefinition to the write back data type expected for data source to be able to writeback
* */
abstract propertyWriteBackDataCreator(dataSourceProperty: TDataSourceProperty, propertyValue: PropertyValueType<TPropertyDefinition>): Promise<DataSourceWriteBackType>;
}