import { RegoPlaygroundPolicy } from '../types' ; interface RegoData { [ key ] : any ; } const prepareRegoPolicyForPlayground = ( policy , data , userAlias ) : RegoPlaygroundPolicy => { let formattedPolicy ; try { formattedPolicy = policy . replaceAll ( '(\\r|\\n|\\r\\n)+' , '\\\\n' ) ; } catch { formattedPolicy = policy ; } return { rego_modules : { 'policy.rego' : formattedPolicy , } , input : { user : userAlias , } , data : data , } ; } ; export default prepareRegoPolicyForPlayground ;