fix
This commit is contained in:
parent
631f69e6fc
commit
9a4354d80f
|
|
@ -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
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue