This commit is contained in:
2026-01-03 05:34:24 +01:00
parent f0d44092e5
commit 290dfe303c
49 changed files with 1497 additions and 1016 deletions
+58 -1
View File
@@ -6,6 +6,7 @@ import type DataTypes from "../data/data-types";
import type { IncomingMessage, ServerResponse } from "http";
import type { CookieNames } from "../dict/cookie-names";
import { ConnectionConfig } from "mariadb";
import { DbContextsArray } from "../functions/backend/db/runQuery";
export type DSQL_DatabaseFullName = string;
export type DSQL_DATASQUIREL_USER_BACKUPS_JOIN = DSQL_DATASQUIREL_BACKUPS & {
[k in (typeof UserSelectFields)[number]["alias"]]?: string;
@@ -51,6 +52,7 @@ export interface DSQL_TableSchemaType {
tableDescription?: string;
fields: DSQL_FieldSchemaType[];
indexes?: DSQL_IndexSchemaType[];
uniqueConstraints?: DSQL_UniqueConstraintSchemaType[];
childrenTables?: DSQL_ChildrenTablesType[];
childTable?: boolean;
updateData?: boolean;
@@ -144,6 +146,15 @@ export interface DSQL_IndexSchemaType {
alias?: string;
newTempIndex?: boolean;
}
export interface DSQL_UniqueConstraintSchemaType {
id?: string | number;
constraintName?: string;
alias?: string;
constraintTableFields?: DSQL_UniqueConstraintFieldType[];
}
export interface DSQL_UniqueConstraintFieldType {
value: string;
}
export interface DSQL_IndexTableFieldType {
value: string;
dataType: string;
@@ -166,6 +177,21 @@ export interface DSQL_MYSQL_SHOW_COLUMNS_Type {
Default: string;
Extra: string;
}
export interface DSQL_MARIADB_SHOW_INDEXES_TYPE {
Table: string;
Non_unique: 0 | 1;
Key_name: string;
Seq_in_index: number;
Column_name: string;
Collation: string;
Cardinality: number;
Sub_part?: string;
Packed?: string;
Index_type?: "BTREE";
Comment?: string;
Index_comment?: string;
Ignored?: "YES" | "NO";
}
export interface DSQL_MYSQL_FOREIGN_KEYS_Type {
CONSTRAINT_NAME: string;
CONSTRAINT_SCHEMA: string;
@@ -1314,6 +1340,7 @@ export type DsqlCrudParam<T extends {
dbName?: string;
tableSchema?: DSQL_TableSchemaType;
dbConfig?: ConnectionConfig;
onDuplicate?: AddDbEntryParamOnDuplicate;
};
export type DsqlCrudParamWhereClause = {
clause: string;
@@ -1594,11 +1621,13 @@ export type MediaUploadDataType = ImageObjectType & FileObjectType & {
export declare const ImageMimeTypes: (keyof sharp.FormatEnum)[];
export declare const VideoMimeTypes: readonly ["mp4", "wav"];
export declare const FileMimeTypes: readonly [...(keyof sharp.FormatEnum)[], "mp4", "wav", "pdf", "csv", "json", "sql", "xlsx", "txt", "zip", "tar.xz", "xz", "yaml", "yml", "sh", "jsx", "js", "tsx", "ts", "html", "css", "md"];
export declare const CurrentlyEditedFieldActions: readonly ["edit-field", "edit-index", "delete-field", "delete-index", "new-field", "new-index", "move-up", "move-down", "complete"];
export declare const CurrentlyEditedFieldActions: readonly ["edit-field", "edit-index", "edit-unique-constraint", "delete-field", "delete-index", "delete-unique-constraint", "new-field", "new-index", "new-unique-constraint", "move-up", "move-down", "complete"];
export type CurrentlyEditedTableSchemaType = {
action: (typeof CurrentlyEditedFieldActions)[number];
field?: DSQL_FieldSchemaType;
fieldIndex?: number;
uniqueConstraint?: DSQL_UniqueConstraintSchemaType;
uniqueConstraintIndex?: number;
index?: DSQL_IndexSchemaType;
indexIndex?: number;
spliceIndex?: number;
@@ -2327,3 +2356,31 @@ export type DSQLFetchApiOptions<T extends {
csrfKey?: string;
fetchOptions?: RequestInit;
};
export type AddDbEntryParam<T extends {
[k: string]: any;
} = any, K extends string = string> = {
dbContext?: (typeof DbContextsArray)[number];
paradigm?: "Read Only" | "Full Access";
dbFullName?: string;
tableName: K;
data?: T;
batchData?: T[];
tableSchema?: DSQL_TableSchemaType;
duplicateColumnName?: keyof T;
duplicateColumnValue?: string | number;
/**
* Update Entry if a duplicate is found.
* Requires `duplicateColumnName` and `duplicateColumnValue` parameters
*/
update?: boolean;
encryptionKey?: string;
encryptionSalt?: string;
forceLocal?: boolean;
debug?: boolean;
dbConfig?: ConnectionConfig;
onDuplicate?: AddDbEntryParamOnDuplicate;
};
export type AddDbEntryParamOnDuplicate = {
sql: string;
values?: string[];
};
+3
View File
@@ -177,10 +177,13 @@ exports.FileMimeTypes = [
exports.CurrentlyEditedFieldActions = [
"edit-field",
"edit-index",
"edit-unique-constraint",
"delete-field",
"delete-index",
"delete-unique-constraint",
"new-field",
"new-index",
"new-unique-constraint",
"move-up",
"move-down",
"complete",