This commit is contained in:
Benjamin Toby
2025-07-05 15:16:31 +01:00
parent 7e8bb37c09
commit 3730e4722e
25 changed files with 58 additions and 22 deletions
+2 -2
View File
@@ -2,12 +2,12 @@ import { APIResponseObject, DataCrudRequestMethods, DataCrudRequestMethodsLowerC
type Param<T = {
[k: string]: any;
}> = {
key?: string;
body?: T;
query?: T;
useDefault?: boolean;
path: string;
method?: (typeof DataCrudRequestMethods)[number] | (typeof DataCrudRequestMethodsLowerCase)[number];
apiKey?: string;
};
/**
* # Query DSQL API
@@ -16,5 +16,5 @@ export default function queryDSQLAPI<T = {
[k: string]: any;
}, P = {
[k: string]: any;
}>({ key, body, query, useDefault, path: passedPath, method, }: Param<T>): Promise<APIResponseObject<P>>;
}>({ body, query, useDefault, path: passedPath, method, apiKey, }: Param<T>): Promise<APIResponseObject<P>>;
export {};
+2 -2
View File
@@ -4,7 +4,7 @@ import serializeQuery from "../../utils/serialize-query";
/**
* # Query DSQL API
*/
export default async function queryDSQLAPI({ key, body, query, useDefault, path: passedPath, method, }) {
export default async function queryDSQLAPI({ body, query, useDefault, path: passedPath, method, apiKey, }) {
const grabedHostNames = grabHostNames({ useDefault });
const { host, port, scheme } = grabedHostNames;
try {
@@ -17,7 +17,7 @@ export default async function queryDSQLAPI({ key, body, query, useDefault, path:
const reqPayload = body ? JSON.stringify(body) : undefined;
let headers = {
"Content-Type": "application/json",
Authorization: key ||
Authorization: apiKey ||
(!method || method == "GET" || method == "get"
? process.env.DSQL_READ_ONLY_API_KEY
: undefined) ||