Updates
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import type { IncomingMessage, ServerResponse } from "http";
|
||||
import { RequestOptions } from "https";
|
||||
import type { RequestOptions } from "https";
|
||||
|
||||
import { Editor } from "tinymce";
|
||||
export type DSQL_DatabaseFullName = string;
|
||||
@@ -41,7 +41,17 @@ export interface DSQL_ChildrenTablesType {
|
||||
tableNameFull?: string;
|
||||
}
|
||||
|
||||
export interface DSQL_FieldSchemaType {
|
||||
export const TextFieldTypesArray = [
|
||||
{ title: "Plain Text", value: "plain" },
|
||||
{ title: "Rich Text", value: "richText" },
|
||||
{ title: "JSON", value: "json" },
|
||||
{ title: "YAML", value: "yaml" },
|
||||
{ title: "HTML", value: "html" },
|
||||
{ title: "CSS", value: "css" },
|
||||
{ title: "Javascript", value: "javascript" },
|
||||
] as const;
|
||||
|
||||
export type DSQL_FieldSchemaType = {
|
||||
fieldName?: string;
|
||||
originName?: string;
|
||||
updatedField?: boolean;
|
||||
@@ -54,13 +64,6 @@ export interface DSQL_FieldSchemaType {
|
||||
defaultValue?: string | number;
|
||||
defaultValueLiteral?: string;
|
||||
foreignKey?: DSQL_ForeignKeyType;
|
||||
richText?: boolean;
|
||||
json?: boolean;
|
||||
yaml?: boolean;
|
||||
html?: boolean;
|
||||
css?: boolean;
|
||||
javascript?: boolean;
|
||||
shell?: boolean;
|
||||
newTempField?: boolean;
|
||||
defaultField?: boolean;
|
||||
plainText?: boolean;
|
||||
@@ -72,7 +75,11 @@ export interface DSQL_FieldSchemaType {
|
||||
onDelete?: string;
|
||||
onDeleteLiteral?: string;
|
||||
cssFiles?: string[];
|
||||
}
|
||||
integerLength?: string | number;
|
||||
decimals?: string | number;
|
||||
} & {
|
||||
[key in (typeof TextFieldTypesArray)[number]["value"]]?: boolean;
|
||||
};
|
||||
|
||||
export interface DSQL_ForeignKeyType {
|
||||
foreignKeyName?: string;
|
||||
@@ -185,6 +192,7 @@ export interface GetReqQueryObject {
|
||||
query: string;
|
||||
queryValues?: string;
|
||||
tableName?: string;
|
||||
debug?: boolean;
|
||||
}
|
||||
|
||||
export type DATASQUIREL_LoggedInUser = {
|
||||
@@ -288,6 +296,7 @@ export interface GetReturn {
|
||||
msg?: string;
|
||||
error?: string;
|
||||
schema?: DSQL_TableSchemaType;
|
||||
finalQuery?: string;
|
||||
}
|
||||
|
||||
export interface GetSchemaRequestQuery {
|
||||
@@ -921,6 +930,7 @@ export interface MYSQL_user_database_tables_table_def {
|
||||
table_slug?: string;
|
||||
table_description?: string;
|
||||
child_table?: number;
|
||||
active_data?: 0 | 1;
|
||||
child_table_parent_database?: string;
|
||||
child_table_parent_table?: string;
|
||||
date_created?: string;
|
||||
@@ -1082,19 +1092,22 @@ export type FetchApiReturn = {
|
||||
export const ServerQueryOperators = ["AND", "OR"] as const;
|
||||
export const ServerQueryEqualities = ["EQUAL", "LIKE", "NOT EQUAL"] as const;
|
||||
|
||||
export type ServerQueryParam = {
|
||||
export type ServerQueryParam<
|
||||
T extends { [k: string]: any } = { [k: string]: any }
|
||||
> = {
|
||||
selectFields?: string[];
|
||||
query?: ServerQueryQueryObject;
|
||||
query?: ServerQueryQueryObject<T>;
|
||||
limit?: number;
|
||||
page?: number;
|
||||
offset?: number;
|
||||
order?: {
|
||||
field: string;
|
||||
field: keyof T;
|
||||
strategy: "ASC" | "DESC";
|
||||
};
|
||||
searchOperator?: (typeof ServerQueryOperators)[number];
|
||||
searchEquality?: (typeof ServerQueryEqualities)[number];
|
||||
addUserId?: {
|
||||
fieldName: string;
|
||||
fieldName: keyof T;
|
||||
};
|
||||
join?: ServerQueryParamsJoin[];
|
||||
[key: string]: any;
|
||||
@@ -1208,7 +1221,6 @@ export type APILoginFunctionParams = {
|
||||
token?: boolean;
|
||||
skipPassword?: boolean;
|
||||
social?: boolean;
|
||||
useLocal?: boolean;
|
||||
dbUserId?: number | string;
|
||||
debug?: boolean;
|
||||
};
|
||||
@@ -1228,7 +1240,6 @@ export type APICreateUserFunctionParams = {
|
||||
payload: any;
|
||||
database: string;
|
||||
userId?: string | number;
|
||||
useLocal?: boolean;
|
||||
};
|
||||
|
||||
export type APICreateUserFunction = (
|
||||
@@ -1242,7 +1253,6 @@ export type APIGetUserFunctionParams = {
|
||||
fields: string[];
|
||||
dbFullName: string;
|
||||
userId: string | number;
|
||||
useLocal?: boolean;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -1250,9 +1260,10 @@ export type APIGetUserFunctionParams = {
|
||||
*/
|
||||
export type APIGoogleLoginFunctionParams = {
|
||||
token: string;
|
||||
database: string;
|
||||
database?: string;
|
||||
additionalFields?: string[];
|
||||
additionalData?: { [key: string]: string | number };
|
||||
debug?: boolean;
|
||||
};
|
||||
|
||||
export type APIGoogleLoginFunction = (
|
||||
@@ -1271,7 +1282,7 @@ export type HandleSocialDbFunctionParams = {
|
||||
invitation?: any;
|
||||
supEmail?: string;
|
||||
additionalFields?: string[];
|
||||
useLocal?: boolean;
|
||||
debug?: boolean;
|
||||
};
|
||||
|
||||
export type HandleSocialDbFunctionReturn = {
|
||||
@@ -1444,3 +1455,63 @@ export type HttpFunctionResponse<
|
||||
str?: string;
|
||||
requestedPath?: string;
|
||||
};
|
||||
|
||||
export type ApiGetQueryObject<
|
||||
T extends { [k: string]: any } = { [k: string]: any }
|
||||
> = {
|
||||
query: ServerQueryParam<T>;
|
||||
table: string;
|
||||
dbFullName?: string;
|
||||
};
|
||||
|
||||
export const DataCrudRequestMethods = ["GET", "POST", "PUT", "DELETE"] as const;
|
||||
|
||||
export type DsqlMethodCrudParam<
|
||||
T extends { [key: string]: any } = { [key: string]: any }
|
||||
> = {
|
||||
method: (typeof DataCrudRequestMethods)[number];
|
||||
body?: T;
|
||||
query?: DsqlCrudQueryObject<T>;
|
||||
tableName: string;
|
||||
addUser?: {
|
||||
field: keyof T;
|
||||
};
|
||||
user?: DATASQUIREL_LoggedInUser;
|
||||
extraData?: T;
|
||||
transform?: DsqlCrudTransformFunction<T>;
|
||||
existingData?: T;
|
||||
targetId?: string | number;
|
||||
sanitize?: (data?: T) => T;
|
||||
};
|
||||
|
||||
export type DsqlCrudTransformFunction<
|
||||
T extends { [key: string]: any } = { [key: string]: any }
|
||||
> = ({
|
||||
data,
|
||||
existingData,
|
||||
user,
|
||||
}: {
|
||||
user?: DATASQUIREL_LoggedInUser;
|
||||
data: T;
|
||||
existingData?: T;
|
||||
reqMethod: (typeof DataCrudRequestMethods)[number];
|
||||
}) => Promise<T>;
|
||||
|
||||
export const DsqlCrudActions = ["insert", "update", "delete", "get"] as const;
|
||||
|
||||
export type DsqlCrudQueryObject<
|
||||
T extends { [key: string]: any } = { [key: string]: any }
|
||||
> = ServerQueryParam<T> & {
|
||||
query?: ServerQueryQueryObject<T>;
|
||||
};
|
||||
|
||||
export type DsqlCrudParam<
|
||||
T extends { [key: string]: any } = { [key: string]: any }
|
||||
> = {
|
||||
action: (typeof DsqlCrudActions)[number];
|
||||
table: string;
|
||||
data?: T;
|
||||
targetId?: string | number;
|
||||
query?: DsqlCrudQueryObject<T>;
|
||||
sanitize?: (data?: T) => T;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user