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 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) => { export const dbClient = (name: string, dburl: string) => {
return new Proxy( return new Proxy(
@ -36,13 +37,20 @@ export const dbClient = (name: string, dburl: string) => {
if (table.startsWith("$")) { if (table.startsWith("$")) {
return (...params: any[]) => { return (...params: any[]) => {
const bytes = pako.gzip(JSON.stringify(params));
return fetchSendDb( return fetchSendDb(
name, name,
{ {
name, name,
action: "query", action: "query",
table, table,
params, params: btoa(
bytes.reduce(
(acc, current) => acc + String.fromCharCode(current),
""
)
),
}, },
dburl dburl
); );

View File

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