@omnia/fx
Version:
Provide Omnia Fx typings and tooling for clientside Omnia development.
37 lines (36 loc) • 2.41 kB
TypeScript
import { PropertyDataSourceId, PropertyDefinition } from "@omnia/fx-models";
import { PropertyDataSourceBase, DataSourcePropertyDefinitionHandler } from "@omnia/fx/services";
import { DataSourceProperty } from "internal/fx/models/properties/datasource/DataSourceProperty";
import { PropertyDefinitionId } from "./Properties";
export interface IPropertyDataSourceRegistrationApi extends IRegisteredPropertyDataSourceApi {
/**
* Register a property data source
* */
registerDataSource2<TDataSourceProperty extends DataSourceProperty>(registration: new () => PropertyDataSourceBase<TDataSourceProperty>): void;
/**
* Register a property handler for the specific datasource, such a handler looks at the TDataSourceProperty and checks if this should be converted to the property defintion this handler is created/registered to handle
* */
registerDataSourcePropertyDefintionHandler2<TDataSourceProperty extends DataSourceProperty, TPropertyDefinition extends PropertyDefinition<any, any, any>>(dataSource: new () => PropertyDataSourceBase<TDataSourceProperty>, propertyDefinitionHandlerCtor: new () => DataSourcePropertyDefinitionHandler<TPropertyDefinition, TDataSourceProperty, any, any>): any;
}
/**
* We work on registered datasources without any care about implementing type, i.e. none generic for getting
* */
export interface IRegisteredPropertyDataSourceApi {
getDataSources(): Promise<(new () => PropertyDataSourceBase<DataSourceProperty>)[]>;
getDataSource(dataSourceId: PropertyDataSourceId): Promise<new () => PropertyDataSourceBase<DataSourceProperty>>;
getDataSourceDefinitionHandlers(dataSourceId: PropertyDataSourceId): Promise<Array<{
propertyDefintionId: PropertyDefinitionId;
handlerCtor: new () => DataSourcePropertyDefinitionHandler<PropertyDefinition<any, any, any>, DataSourceProperty, any, any>;
}>>;
}
export interface IPropertyDataSourceProvider {
}
export declare class PropertyDataSourceProviderRegistration {
typeId: PropertyDataSourceId;
provider: new () => IPropertyDataSourceProvider;
constructor(typeId: PropertyDataSourceId, provider: new () => IPropertyDataSourceProvider);
}
export interface IPropertyDataSourceProviderApi {
register(registration: PropertyDataSourceProviderRegistration): void;
getProvider(typeId: PropertyDataSourceId): Promise<new () => IPropertyDataSourceProvider>;
}