import { EdmTypeShared, OrderableEdmType } from '../edm-types'; import { Constructable, Entity } from '../entity'; import { ComplexTypeField } from './complex-type-field'; import { EdmTypeField } from './edm-type-field'; import { OrderableEdmTypeField } from './orderable-edm-type-field'; import { CollectionField, CollectionFieldType } from './collection-field'; import { ConstructorOrField } from './constructor-or-field'; import { FieldOptions } from './field'; import { EnumField } from './enum-field'; declare type ComplexTypeFieldConstructor, EntityT extends Entity, ComplexT, NullableT extends boolean, SelectableT extends boolean> = new (fieldName: string, fieldOf: ConstructorOrField, fieldOptions?: FieldOptions) => ComplexTypeFieldT; /** * Convenience type to determine whether a field should be selectable. If the given `FieldOfT` is the type of an entity, it is selectable. * @typeparam FieldOfT - Type of the entity or complex type field this field belongs to. */ export declare type IsSelectableField> = FieldOfT extends Constructable ? true : false; /** * Convenience type to determine whether a field should be orderable. If the given `EdmT` is of type `OrderableEdmTypes`, it is orderable. * @typeparam EdmT - EDM type of the field. */ export declare type IsOrderableField> = EdmT extends OrderableEdmType ? true : false; declare type EntityTypeFromFieldOf> = FieldOfT extends ConstructorOrField ? EntityT : never; /** * Field builder to orchestrate the creation of the different kinds of fields. * @typeparam FieldOfT - Type of the entity or complex type field this field belongs to. */ export declare class FieldBuilder> { fieldOf: FieldOfT; /** * Creates an instance of `FieldBuilder`. * @param fieldOf - Entity or complex type field, for which the field builder shall create fields. */ constructor(fieldOf: FieldOfT); buildEdmTypeField(fieldName: string, edmType: EdmT, isNullable: NullableT): OrderableEdmTypeField, EdmT, NullableT, IsSelectableField>; buildEdmTypeField, OrderableEdmType>, NullableT extends boolean>(fieldName: string, edmType: EdmT, isNullable: NullableT): EdmTypeField, EdmT, NullableT, IsSelectableField>; /** * Build a field for a property with a complex type. * Fields of entities are selectable; fields of complex types are not selectable. * @param fieldName - Name of the field. * @param complexTypeFieldCtor - Constructor of the complex type field. * @param isNullable - Whether the field is nullable. * @returns A complex type field of the given type. */ buildComplexTypeField, any, NullableT, IsSelectableField>, ComplexT, NullableT extends boolean>(fieldName: string, complexTypeFieldCtor: ComplexTypeFieldConstructor, ComplexT, NullableT, IsSelectableField>, isNullable: NullableT): ComplexTypeFieldT; /** * Build a field for a property with a collection type. * The type of the field can either be an EDM type or a complex type. * Fields of entities are selectable; fields of complex types are not selectable. * @param fieldName - Name of the field. * @param collectionFieldType - Type of the collection. Can either be an EDM type or complex type (not complex type field). * @param isNullable - Whether the field is nullable. * @returns A collection field with the given collection type. */ buildCollectionField | Record, NullableT extends boolean>(fieldName: string, collectionFieldType: CollectionFieldType, isNullable: NullableT): CollectionField, CollectionFieldT, NullableT, IsSelectableField>; /** * Build a field for a property with a enum type. * @param fieldName - Name of the field. * @param enumType - Enum type of this field. * @param isNullable - Whether the field is nullable. * @returns A collection field with the given collection type. */ buildEnumField(fieldName: string, enumType: Record, isNullable: NullableT): EnumField, EnumT, NullableT, IsSelectableField>; } export {}; //# sourceMappingURL=field-builder.d.ts.map