This commit is contained in:
Benjamin Toby
2025-08-13 11:16:28 +01:00
parent a1e56bb1b0
commit 700a704abd
24 changed files with 400 additions and 260 deletions
+56
View File
@@ -0,0 +1,56 @@
import path from "path";
import queryDSQLAPI from "../../functions/api/query-dsql-api";
import {
APIConnectionOptions,
APIResponseObject,
DSQL_DatabaseSchemaType,
DSQL_FieldSchemaType,
DSQL_TableSchemaType,
} from "../../types";
import grabAPIBasePath from "../../utils/grab-api-base-path";
import { GrabHostNamesReturn } from "../../utils/grab-host-names";
type Params = {
dbName: string;
tableName?: string;
fieldName?: string;
apiKey?: string;
apiConnectionConfig?: APIConnectionOptions;
grabbedHostnames?: GrabHostNamesReturn;
useDefault?: boolean;
};
export default async function <
T extends
| DSQL_DatabaseSchemaType
| DSQL_TableSchemaType
| DSQL_FieldSchemaType = DSQL_DatabaseSchemaType
>({
dbName,
tableName,
apiKey,
useDefault,
fieldName,
apiConnectionConfig,
grabbedHostnames,
}: Params): Promise<APIResponseObject<T>> {
const basePath = grabAPIBasePath({ paradigm: "schema" });
const finalPath = path.join(
basePath,
dbName,
tableName || "",
fieldName || ""
);
const GET_RES = await queryDSQLAPI<any, T>({
method: "GET",
path: finalPath,
apiKey,
useDefault,
apiConnectionConfig,
grabbedHostnames,
});
return GET_RES;
}
+7
View File
@@ -0,0 +1,7 @@
import get from "./get";
const schema = {
get,
};
export default schema;