| 1234567891011 |
- import {readFileSync} from 'node:fs';
- export function buildAppointmentDeletionGateway(company,windows=[]){
- const code=readFileSync(new URL('../cloud/legacy-appointment-deletions.js',import.meta.url),'utf8').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<handler)throw Error('Unknown direct sync handler');
- return code.slice(0,at)+" if(p.action==='status'){const result=await directControl(p,co,u);return response.json({success:true,data:{...result,appointmentDeletionVersion:'confirmed-ids-v1'}});}\n"+code.slice(at);
- }
|