import { ODataVersion } from '@sap-cloud-sdk/util' ; import { EdmTypeShared , isEdmType } from '../edm-types' ; import { Constructable , EntityBase } from '../entity-base' ; import { DeSerializers } from '../de-serializers' ; import { Field , FieldOptions } from './field' ; import { ComplexTypeNamespace } from './complex-type-namespace' ; import type { ConstructorOrField } from './constructor-or-field' ; typeparam typeparam typeparam typeparam typeparam internal export abstract class ComplexTypeField < EntityT extends EntityBase , DeSerializersT extends DeSerializers , ComplexT = any , NullableT extends boolean = false , SelectableT extends boolean = false > extends Field < EntityT , NullableT , SelectableT > { internal readonly complexTypeName ? : string ; param fieldName param fieldOf param deSerializers param _complexType param fieldOptions constructor ( fieldName , readonly fieldOf , readonly deSerializers , readonly _complexType , fieldOptions ? ) { super ( fieldName , getEntityConstructor ( fieldOf ) , fieldOptions ) ; } returns fieldPath ( ) { return this . fieldOf instanceof ComplexTypeField ? `${ this . fieldOf . fieldPath ( ) }/${ this . _fieldName }` : this . _fieldName ; } } param fieldOf returns internal export function getEntityConstructor < EntityT extends EntityBase , ComplexT > ( fieldOf ) { return fieldOf instanceof ComplexTypeField ? fieldOf . _entityConstructor : fieldOf ; } param complexTypeNameOrEdmType param edmTypeOrUndefined returns internal export function getEdmType < VersionT extends ODataVersion | 'any' > ( complexTypeNameOrEdmType , edmTypeOrUndefined ? ) { if ( edmTypeOrUndefined ) { if ( typeof complexTypeNameOrEdmType === 'string' && ! isEdmType ( complexTypeNameOrEdmType ) && isEdmType ( edmTypeOrUndefined ) ) { return edmTypeOrUndefined ; } } else if ( isEdmType ( complexTypeNameOrEdmType ) ) { return complexTypeNameOrEdmType ; } throw new Error ( `Failed to get EDM type based on '${ complexTypeNameOrEdmType }' and '${ edmTypeOrUndefined }'.` ) ; }