import {readFileSync} from 'node:fs'; export function buildAppointmentDeletionGateway(company,windows=[]){ const read=name=>readFileSync(new URL('../cloud/'+name+'.js',import.meta.url),'utf8'); const code=(read('legacy-writing-sync-ownership')+'\n'+read('legacy-appointment-deletions')).replaceAll('__COMPANY_ID__',JSON.stringify(company)).replaceAll('__WINDOWS__',JSON.stringify(windows)); new Function(code);return code; } export function patchAppointmentDeletionCapability(code){ if(code.includes("appointmentDeletionVersion:'confirmed-ids-v1'"))return code; const handler=code.indexOf('async function handler(request,response)'),at=code.indexOf(" if(p.action===",handler); if(handler<0||at