convex
Version:
Client for the Convex Cloud
21 lines (20 loc) • 874 B
JavaScript
;
export function performSyscall(op, arg) {
if (typeof Convex === "undefined" || Convex.syscall === void 0) {
throw new Error(
"The Convex database and auth objects are being used outside of a Convex backend. Did you mean to use `useQuery` or `useMutation` to call a Convex function?"
);
}
const resultStr = Convex.syscall(op, JSON.stringify(arg));
return JSON.parse(resultStr);
}
export async function performAsyncSyscall(op, arg) {
if (typeof Convex === "undefined" || Convex.syscall === void 0) {
throw new Error(
"The Convex database and auth objects are being used outside of a Convex backend. Did you mean to use `useQuery` or `useMutation` to call a Convex function?"
);
}
const resultStr = await Convex.asyncSyscall(op, JSON.stringify(arg));
return JSON.parse(resultStr);
}
//# sourceMappingURL=syscall.js.map