Updates
This commit is contained in:
+20
-2
@@ -1,5 +1,3 @@
|
||||
// @ts-check
|
||||
|
||||
import https from "node:https";
|
||||
import path from "path";
|
||||
import fs from "fs";
|
||||
@@ -16,6 +14,7 @@ type Param = {
|
||||
tableName?: string;
|
||||
useLocal?: boolean;
|
||||
user_id?: string | number;
|
||||
debug?: boolean;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -29,6 +28,7 @@ export default async function get({
|
||||
tableName,
|
||||
useLocal,
|
||||
user_id,
|
||||
debug,
|
||||
}: Param): Promise<GetReturn> {
|
||||
const grabedHostNames = grabHostNames();
|
||||
const { host, port, scheme } = grabedHostNames;
|
||||
@@ -61,6 +61,10 @@ export default async function get({
|
||||
dbSchema = JSON.parse(fs.readFileSync(localDbSchemaPath, "utf8"));
|
||||
} catch (error) {}
|
||||
|
||||
if (debug) {
|
||||
console.log("apiGet:Running Locally ...");
|
||||
}
|
||||
|
||||
return await apiGet({
|
||||
dbFullName: DSQL_DB_NAME,
|
||||
query,
|
||||
@@ -68,6 +72,7 @@ export default async function get({
|
||||
tableName,
|
||||
dbSchema,
|
||||
useLocal,
|
||||
debug,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -87,14 +92,27 @@ export default async function get({
|
||||
? JSON.stringify(queryValues)
|
||||
: undefined,
|
||||
tableName,
|
||||
debug,
|
||||
};
|
||||
|
||||
if (debug) {
|
||||
console.log("apiGet:queryObject", queryObject);
|
||||
}
|
||||
|
||||
const queryString = serializeQuery({ ...queryObject });
|
||||
|
||||
if (debug) {
|
||||
console.log("apiGet:queryString", queryString);
|
||||
}
|
||||
|
||||
let path = `/api/query/${
|
||||
user_id || grabedHostNames.user_id
|
||||
}/get${queryString}`;
|
||||
|
||||
if (debug) {
|
||||
console.log("apiGet:path", path);
|
||||
}
|
||||
|
||||
const requestObject: https.RequestOptions = {
|
||||
method: "GET",
|
||||
headers: {
|
||||
|
||||
Reference in New Issue
Block a user