Updates
This commit is contained in:
@@ -53,6 +53,8 @@ export default async function queryDSQLAPI<T = { [k: string]: any }>({
|
||||
process.env.DSQL_FULL_ACCESS_API_KEY ||
|
||||
process.env.DSQL_API_KEY;
|
||||
|
||||
let requestOptions: RequestOptions | undefined;
|
||||
|
||||
try {
|
||||
/**
|
||||
* Make https request
|
||||
@@ -78,7 +80,7 @@ export default async function queryDSQLAPI<T = { [k: string]: any }>({
|
||||
finalPath += `${queryString}`;
|
||||
}
|
||||
|
||||
const requestOptions: RequestOptions = {
|
||||
requestOptions = {
|
||||
method: method || "GET",
|
||||
headers,
|
||||
port,
|
||||
@@ -106,6 +108,7 @@ export default async function queryDSQLAPI<T = { [k: string]: any }>({
|
||||
const responseObj = JSON.parse(
|
||||
str
|
||||
) as APIResponseObject;
|
||||
|
||||
if (!responseObj.success) {
|
||||
// console.log("responseObj", responseObj);
|
||||
// console.log(
|
||||
@@ -117,7 +120,7 @@ export default async function queryDSQLAPI<T = { [k: string]: any }>({
|
||||
// httpsRequest.getHeaders()
|
||||
// );
|
||||
}
|
||||
resolve(responseObj);
|
||||
resolve({ ...responseObj, requestOptions });
|
||||
} catch (error: any) {
|
||||
resolve({
|
||||
success: false,
|
||||
@@ -141,6 +144,7 @@ export default async function queryDSQLAPI<T = { [k: string]: any }>({
|
||||
msg: `An error occurred on the response`,
|
||||
error: err.message,
|
||||
errorData: { requestOptions, grabedHostNames },
|
||||
requestOptions,
|
||||
} as APIResponseObject);
|
||||
});
|
||||
}
|
||||
@@ -156,6 +160,7 @@ export default async function queryDSQLAPI<T = { [k: string]: any }>({
|
||||
requestOptions,
|
||||
grabedHostNames: _.omit(grabedHostNames, ["scheme"]),
|
||||
},
|
||||
requestOptions,
|
||||
} as APIResponseObject);
|
||||
});
|
||||
|
||||
@@ -172,6 +177,7 @@ export default async function queryDSQLAPI<T = { [k: string]: any }>({
|
||||
singleRes: undefined,
|
||||
msg: `Request Failed`,
|
||||
error: error.message,
|
||||
requestOptions,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1712,6 +1712,7 @@ export type APIResponseObject<
|
||||
code?: string;
|
||||
createdAt?: number;
|
||||
email?: string;
|
||||
requestOptions?: RequestOptions;
|
||||
};
|
||||
|
||||
export const UserTypes = ["su", "admin"] as const;
|
||||
|
||||
Reference in New Issue
Block a user