import { ServiceNameFormatter } from '../../service-name-formatter' ; import { transformFunctionImportBase , parseFunctionImportReturnTypes } from '../common' ; import { VdmComplexType , VdmEntity , VdmFunctionImport } from '../../vdm-types' ; import { swaggerDefinitionForFunctionImport } from '../../swagger-parser' ; import { parseFunctionImportsV2 } from '../../edmx-parser/v2' ; import { ServiceMetadata } from '../../edmx-parser' ; import { hasUnsupportedParameterTypes } from '../edmx-to-vdm-util' ; const extractResponse = ( functionName ) => ( response ) => `${ response }.${ functionName }` ; internal export function generateFunctionImportsV2 ( serviceMetadata , serviceName , entities , complexTypes , formatter ) { const edmxFunctionImports = parseFunctionImportsV2 ( serviceMetadata . edmx . root ) ; return ( edmxFunctionImports . filter ( functionImport => ! hasUnsupportedParameterTypes ( functionImport ) ) . map ( f => { const httpMethod = f [ 'm:HttpMethod' ] . toLowerCase ( ) ; const swaggerDefinition = swaggerDefinitionForFunctionImport ( f . Name , httpMethod , serviceMetadata . swagger ) ; return { ... transformFunctionImportBase ( f , f . Parameter , swaggerDefinition , formatter ) , httpMethod , returnType : parseFunctionImportReturnTypes ( f . ReturnType ? { Type : f . ReturnType , Nullable : 'false' } : undefined , entities , complexTypes , extractResponse ( f . Name ) , serviceName ) } ; } ) ) ; }