This commit is contained in:
Benjamin Toby 2025-07-05 16:53:58 +01:00
parent 23d1b28354
commit d80d876ac1
5 changed files with 41 additions and 21 deletions

View File

@ -48,13 +48,14 @@ function queryDSQLAPI(_a) {
const queryString = (0, serialize_query_1.default)(query);
finalPath += `${queryString}`;
}
const httpsRequest = scheme.request({
const requestOptions = {
method: method || "GET",
headers,
port,
hostname: host,
path: finalPath,
},
};
const httpsRequest = scheme.request(requestOptions,
/**
* Callback Function
*
@ -73,7 +74,9 @@ function queryDSQLAPI(_a) {
resolve({
success: false,
payload: undefined,
msg: error.message,
msg: `An error occurred while parsing the response`,
error: error.message,
errorData: requestOptions,
});
}
});
@ -81,7 +84,9 @@ function queryDSQLAPI(_a) {
resolve({
success: false,
payload: undefined,
msg: err.message,
msg: `An error occurred on the response`,
error: err.message,
errorData: requestOptions,
});
});
});
@ -89,7 +94,9 @@ function queryDSQLAPI(_a) {
resolve({
success: false,
payload: undefined,
msg: err.message,
msg: `An error occurred while making the request`,
error: err.message,
errorData: requestOptions,
});
});
if (reqPayload) {
@ -103,7 +110,8 @@ function queryDSQLAPI(_a) {
return {
success: false,
payload: undefined,
msg: error.message,
msg: `Request Failed`,
error: error.message,
};
}
});

View File

@ -1389,6 +1389,7 @@ export type APIResponseObject<T extends any = any> = {
errors?: DSQLErrorObject[];
debug?: any;
batchPayload?: any[][] | null;
errorData?: any;
};
export declare const UserTypes: readonly ["su", "admin"];
export declare const SignUpParadigms: readonly [{

View File

@ -8,6 +8,7 @@ import {
} from "../../types";
import grabHostNames from "../../utils/grab-host-names";
import serializeQuery from "../../utils/serialize-query";
import { RequestOptions } from "https";
type Param<T = { [k: string]: any }> = {
body?: T;
@ -68,14 +69,16 @@ export default async function queryDSQLAPI<
finalPath += `${queryString}`;
}
const requestOptions: RequestOptions = {
method: method || "GET",
headers,
port,
hostname: host,
path: finalPath,
};
const httpsRequest = scheme.request(
{
method: method || "GET",
headers,
port,
hostname: host,
path: finalPath,
},
requestOptions,
/**
* Callback Function
@ -96,8 +99,10 @@ export default async function queryDSQLAPI<
resolve({
success: false,
payload: undefined,
msg: error.message,
});
msg: `An error occurred while parsing the response`,
error: error.message,
errorData: requestOptions,
} as APIResponseObject);
}
});
@ -105,8 +110,10 @@ export default async function queryDSQLAPI<
resolve({
success: false,
payload: undefined,
msg: err.message,
});
msg: `An error occurred on the response`,
error: err.message,
errorData: requestOptions,
} as APIResponseObject);
});
}
);
@ -115,8 +122,10 @@ export default async function queryDSQLAPI<
resolve({
success: false,
payload: undefined,
msg: err.message,
});
msg: `An error occurred while making the request`,
error: err.message,
errorData: requestOptions,
} as APIResponseObject);
});
if (reqPayload) {
@ -130,7 +139,8 @@ export default async function queryDSQLAPI<
return {
success: false,
payload: undefined,
msg: error.message,
msg: `Request Failed`,
error: error.message,
};
}
}

View File

@ -1608,6 +1608,7 @@ export type APIResponseObject<T extends any = any> = {
errors?: DSQLErrorObject[];
debug?: any;
batchPayload?: any[][] | null;
errorData?: any;
};
export const UserTypes = ["su", "admin"] as const;

View File

@ -1,6 +1,6 @@
{
"name": "@moduletrace/datasquirel",
"version": "4.8.2",
"version": "4.8.3",
"description": "Cloud-based SQL data management tool",
"main": "dist/index.js",
"bin": {