This commit is contained in:
Rizky 2024-04-18 15:20:03 +07:00
parent 631f69e6fc
commit 9a4354d80f
2 changed files with 11 additions and 2 deletions

View File

@ -1,5 +1,6 @@
import hash_sum from "hash-sum";
import { fetchViaProxy } from "../../../nova/vi/load/proxy";
import { fetchViaProxy } from "../proxy";
import pako from "pako";
export const dbClient = (name: string, dburl: string) => {
return new Proxy(
@ -36,13 +37,20 @@ export const dbClient = (name: string, dburl: string) => {
if (table.startsWith("$")) {
return (...params: any[]) => {
const bytes = pako.gzip(JSON.stringify(params));
return fetchSendDb(
name,
{
name,
action: "query",
table,
params,
params: btoa(
bytes.reduce(
(acc, current) => acc + String.fromCharCode(current),
""
)
),
},
dburl
);

View File

@ -30,6 +30,7 @@ export const execQuery = async (args: DBArg, prisma: any) => {
}
}
return [];
} catch (e) {
console.log(e);
return e;