@rocket.chat/apps-engine
Version:
The engine code for the Rocket.Chat Apps which manages, runs, translates, coordinates and all of that.
21 lines (17 loc) • 625 B
text/typescript
import { fixBrokenSynchronousAPICalls } from "./ast/mod.ts";
function hasPotentialDeprecatedUsage(source: string) {
return (
// potential usage of Room.usernames getter
source.includes('.usernames') ||
// potential usage of LivechatRead.isOnline method
source.includes('.isOnline(') ||
// potential usage of LivechatCreator.createToken method
source.includes('.createToken(')
)
}
export function sanitizeDeprecatedUsage(source: string) {
if (!hasPotentialDeprecatedUsage(source)) {
return source;
}
return fixBrokenSynchronousAPICalls(source);
}