Update types

This commit is contained in:
Benjamin Toby 2024-10-23 07:08:06 +01:00
parent fdb1501588
commit 1b6504ab93
3 changed files with 34 additions and 10 deletions

View File

@ -316,24 +316,25 @@ export interface GetReturn {
schema?: DSQL_TableSchemaType; schema?: DSQL_TableSchemaType;
} }
interface GetSchemaRequestQuery { export interface GetSchemaRequestQuery {
database?: string; database?: string;
table?: string; table?: string;
field?: string; field?: string;
} }
interface GetSchemaAPICredentialsParam { export interface GetSchemaAPICredentialsParam {
key: string; key: string;
} }
type GetSchemaAPIParam = GetSchemaRequestQuery & GetSchemaAPICredentialsParam; export type GetSchemaAPIParam = GetSchemaRequestQuery &
GetSchemaAPICredentialsParam;
interface PostReturn { export interface PostReturn {
success: boolean; success: boolean;
payload?: Object[] | string; payload?: Object[] | string | PostInsertReturn;
} }
interface PostDataPayload { export interface PostDataPayload {
action: "insert" | "update" | "delete"; action: "insert" | "update" | "delete";
table: string; table: string;
data?: object; data?: object;
@ -344,15 +345,26 @@ interface PostDataPayload {
update?: boolean; update?: boolean;
} }
interface LocalPostReturn { export interface LocalPostReturn {
success: boolean; success: boolean;
payload?: any; payload?: any;
msg?: string; msg?: string;
error?: string; error?: string;
} }
interface LocalPostQueryObject { export interface LocalPostQueryObject {
query: string | PostDataPayload; query: string | PostDataPayload;
tableName?: string; tableName?: string;
queryValues?: string[]; queryValues?: string[];
} }
export interface PostInsertReturn {
fieldCount: number;
affectedRows: number;
insertId: number;
serverStatus: number;
warningCount: number;
message: string;
protocol41: boolean;
changedRows: number;
}

View File

@ -373,7 +373,7 @@ const http = require("http");
/** /**
* @typedef {Object} PostReturn * @typedef {Object} PostReturn
* @property {boolean} success - Did the function run successfully? * @property {boolean} success - Did the function run successfully?
* @property {(Object[]|string)} [payload=[]] - The Y Coordinate * @property {PostInsertReturn | Object[] | string} [payload] - The Y Coordinate
*/ */
/** /**
@ -406,3 +406,15 @@ const http = require("http");
* @property {string} [tableName] - Table Name * @property {string} [tableName] - Table Name
* @property {string[]} [queryValues] - GET request results * @property {string[]} [queryValues] - GET request results
*/ */
/**
* @typedef {object} PostInsertReturn
* @property {number} fieldCount
* @property {number} affectedRows
* @property {number} insertId
* @property {number} serverStatus
* @property {number} warningCount
* @property {string} message
* @property {boolean} protocol41
* @property {number} changedRows
*/

View File

@ -1,6 +1,6 @@
{ {
"name": "datasquirel", "name": "datasquirel",
"version": "2.3.2", "version": "2.3.3",
"description": "Cloud-based SQL data management tool", "description": "Cloud-based SQL data management tool",
"main": "index.js", "main": "index.js",
"bin": { "bin": {