import { Operation } from "@autorest/codemodel" ; import { cloneDeep } from "lodash" ; import { getLanguageMetadata } from "./languageHelpers" ; param operation param operationName param operationDescription export function cloneOperation ( operation , operationName , operationDescription ) { const operationInitializer = cloneDeep ( operation ) ; for ( const key of Object . keys ( operationInitializer ) ) { if ( typeof ( operationInitializer as any ) [ key ] === "function" ) { delete ( operationInitializer as any ) [ key ] ; } } const newOperation = new Operation ( operationName , operationDescription , operationInitializer ) ; const operationMetadata = getLanguageMetadata ( newOperation . language ) ; operationMetadata . name = operationName ; operationMetadata . description = operationName ; return newOperation ; }