2024-10-18 05:45:25 +00:00
|
|
|
import http from "http";
|
|
|
|
|
2024-10-18 05:48:45 +00:00
|
|
|
export type DSQL_DatabaseFullName = string;
|
2024-10-18 05:45:25 +00:00
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2024-10-18 05:48:45 +00:00
|
|
|
export interface DSQL_DatabaseSchemaType {
|
2024-10-18 05:45:25 +00:00
|
|
|
dbName: string;
|
|
|
|
dbSlug: string;
|
|
|
|
dbFullName: string;
|
|
|
|
dbDescription?: string;
|
|
|
|
dbImage?: string;
|
|
|
|
tables: DSQL_TableSchemaType[];
|
|
|
|
childrenDatabases?: DSQL_ChildrenDatabaseObject[];
|
|
|
|
childDatabase?: boolean;
|
|
|
|
childDatabaseDbFullName?: string;
|
|
|
|
updateData?: boolean;
|
|
|
|
}
|
|
|
|
|
2024-10-18 05:48:45 +00:00
|
|
|
export interface DSQL_ChildrenDatabaseObject {
|
2024-10-18 05:45:25 +00:00
|
|
|
dbFullName: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////
|
|
|
|
|
2024-10-18 05:48:45 +00:00
|
|
|
export interface DSQL_TableSchemaType {
|
2024-10-18 05:45:25 +00:00
|
|
|
tableName: string;
|
|
|
|
tableFullName: string;
|
|
|
|
tableDescription?: string;
|
|
|
|
fields: DSQL_FieldSchemaType[];
|
|
|
|
indexes?: DSQL_IndexSchemaType[];
|
|
|
|
childrenTables?: DSQL_ChildrenTablesType[];
|
|
|
|
childTable?: boolean;
|
|
|
|
updateData?: boolean;
|
|
|
|
childTableName?: string;
|
|
|
|
childTableDbFullName?: string;
|
|
|
|
tableNameOld?: string;
|
|
|
|
}
|
|
|
|
|
2024-10-18 05:48:45 +00:00
|
|
|
export interface DSQL_ChildrenTablesType {
|
2024-10-18 05:45:25 +00:00
|
|
|
dbNameFull: string;
|
|
|
|
tableName: string;
|
|
|
|
tableNameFull?: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////
|
|
|
|
|
2024-10-18 05:48:45 +00:00
|
|
|
export interface DSQL_FieldSchemaType {
|
2024-10-18 05:45:25 +00:00
|
|
|
fieldName?: string;
|
|
|
|
originName?: string;
|
|
|
|
updatedField?: boolean;
|
|
|
|
dataType?: string;
|
|
|
|
nullValue?: boolean;
|
|
|
|
notNullValue?: boolean;
|
|
|
|
primaryKey?: boolean;
|
|
|
|
encrypted?: boolean;
|
|
|
|
autoIncrement?: boolean;
|
|
|
|
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;
|
|
|
|
unique?: boolean;
|
|
|
|
pattern?: string;
|
|
|
|
patternFlags?: string;
|
|
|
|
onUpdate?: string;
|
|
|
|
onUpdateLiteral?: string;
|
|
|
|
onDelete?: string;
|
|
|
|
onDeleteLiteral?: string;
|
|
|
|
cssFiles?: string[];
|
|
|
|
}
|
|
|
|
|
2024-10-18 05:48:45 +00:00
|
|
|
export interface DSQL_ForeignKeyType {
|
2024-10-18 05:45:25 +00:00
|
|
|
foreignKeyName?: string;
|
|
|
|
destinationTableName?: string;
|
|
|
|
destinationTableColumnName?: string;
|
|
|
|
destinationTableColumnType?: string;
|
|
|
|
cascadeDelete?: boolean;
|
|
|
|
cascadeUpdate?: boolean;
|
|
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////
|
|
|
|
|
2024-10-18 05:48:45 +00:00
|
|
|
export interface DSQL_IndexSchemaType {
|
2024-10-18 05:45:25 +00:00
|
|
|
indexName?: string;
|
|
|
|
indexType?: string;
|
|
|
|
indexTableFields?: DSQL_IndexTableFieldType[];
|
|
|
|
alias?: string;
|
|
|
|
newTempIndex?: boolean;
|
|
|
|
}
|
|
|
|
|
2024-10-18 05:48:45 +00:00
|
|
|
export interface DSQL_IndexTableFieldType {
|
2024-10-18 05:45:25 +00:00
|
|
|
value: string;
|
|
|
|
dataType: string;
|
|
|
|
}
|
|
|
|
|
2024-10-18 05:48:45 +00:00
|
|
|
export interface DSQL_MYSQL_SHOW_INDEXES_Type {
|
2024-10-18 05:45:25 +00:00
|
|
|
Key_name: string;
|
|
|
|
Table: string;
|
|
|
|
Column_name: string;
|
|
|
|
Collation: string;
|
|
|
|
Index_type: string;
|
|
|
|
Cardinality: string;
|
|
|
|
Index_comment: string;
|
|
|
|
Comment: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////
|
|
|
|
|
2024-10-18 05:48:45 +00:00
|
|
|
export interface DSQL_MYSQL_SHOW_COLUMNS_Type {
|
2024-10-18 05:45:25 +00:00
|
|
|
Field: string;
|
|
|
|
Type: string;
|
|
|
|
Null: string;
|
|
|
|
Key: string;
|
|
|
|
Default: string;
|
|
|
|
Extra: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////
|
|
|
|
|
2024-10-18 05:48:45 +00:00
|
|
|
export interface DSQL_MYSQL_FOREIGN_KEYS_Type {
|
2024-10-18 05:45:25 +00:00
|
|
|
CONSTRAINT_NAME: string;
|
|
|
|
CONSTRAINT_SCHEMA: string;
|
|
|
|
TABLE_NAME: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////
|
|
|
|
|
2024-10-18 05:48:45 +00:00
|
|
|
export interface DSQL_MYSQL_user_databases_Type {
|
2024-10-18 05:45:25 +00:00
|
|
|
user_id: number;
|
|
|
|
db_full_name: string;
|
|
|
|
db_name: string;
|
|
|
|
db_slug: string;
|
|
|
|
db_image: string;
|
|
|
|
db_description: string;
|
|
|
|
active_clone: number;
|
|
|
|
active_clone_parent_db: string;
|
|
|
|
}
|
|
|
|
|
2024-10-18 05:48:45 +00:00
|
|
|
export interface PackageUserLoginRequestBody {
|
2024-10-18 05:45:25 +00:00
|
|
|
encryptionKey: string;
|
|
|
|
payload: any;
|
|
|
|
database: string;
|
|
|
|
additionalFields?: string[];
|
|
|
|
email_login?: boolean;
|
|
|
|
email_login_code?: string;
|
|
|
|
email_login_field?: string;
|
|
|
|
token?: boolean;
|
|
|
|
social?: boolean;
|
|
|
|
dbSchema?: DSQL_DatabaseSchemaType;
|
|
|
|
}
|
|
|
|
|
2024-10-18 05:48:45 +00:00
|
|
|
export interface PackageUserLoginLocalBody {
|
2024-10-18 05:45:25 +00:00
|
|
|
payload: any;
|
|
|
|
additionalFields?: string[];
|
|
|
|
email_login?: boolean;
|
|
|
|
email_login_code?: string;
|
|
|
|
email_login_field?: string;
|
|
|
|
token?: boolean;
|
|
|
|
social?: boolean;
|
|
|
|
dbSchema?: DSQL_DatabaseSchemaType;
|
|
|
|
}
|
|
|
|
|
|
|
|
type Request = http.IncomingMessage;
|
|
|
|
|
|
|
|
type Response = http.ServerResponse;
|
|
|
|
|
|
|
|
type ImageInputFileToBase64FunctionReturn = {
|
|
|
|
imageBase64: string;
|
|
|
|
imageBase64Full: string;
|
|
|
|
imageName: string;
|
|
|
|
imageSize: number;
|
|
|
|
};
|
|
|
|
|
2024-10-18 05:48:45 +00:00
|
|
|
export interface GetReqQueryObject {
|
2024-10-18 05:45:25 +00:00
|
|
|
db: string;
|
|
|
|
query: string;
|
|
|
|
queryValues?: string;
|
|
|
|
tableName?: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
type SerializeQueryFnType = (param0: SerializeQueryParams) => string;
|
|
|
|
|
2024-10-18 05:48:45 +00:00
|
|
|
export interface SerializeQueryParams {
|
2024-10-18 05:45:25 +00:00
|
|
|
query: any;
|
|
|
|
}
|
|
|
|
|
|
|
|
// @ts-check
|
|
|
|
|
2024-10-18 05:48:45 +00:00
|
|
|
export interface DATASQUIREL_LoggedInUser {
|
2024-10-18 05:45:25 +00:00
|
|
|
id?: number;
|
|
|
|
first_name: string;
|
|
|
|
last_name: string;
|
|
|
|
email: string;
|
|
|
|
phone?: string;
|
|
|
|
user_type?: string;
|
|
|
|
username?: string;
|
|
|
|
password: string;
|
|
|
|
image?: string;
|
|
|
|
image_thumbnail?: string;
|
|
|
|
address?: string;
|
|
|
|
city?: string;
|
|
|
|
state?: string;
|
|
|
|
country?: string;
|
|
|
|
zip_code?: string;
|
|
|
|
social_login?: number;
|
|
|
|
social_platform?: string;
|
|
|
|
social_id?: string;
|
|
|
|
more_user_data?: string;
|
|
|
|
verification_status?: number;
|
|
|
|
loan_officer_id?: number;
|
|
|
|
is_admin?: number;
|
|
|
|
admin_level?: number;
|
|
|
|
admin_permissions?: string;
|
|
|
|
uuid: string;
|
|
|
|
temp_login_code?: string;
|
|
|
|
date_created?: string;
|
|
|
|
date_created_code?: number;
|
|
|
|
date_created_timestamp?: string;
|
|
|
|
date_updated?: string;
|
|
|
|
date_updated_code?: number;
|
|
|
|
date_updated_timestamp?: string;
|
|
|
|
csrf_k?: string;
|
|
|
|
logged_in_status?: boolean;
|
|
|
|
date?: number;
|
|
|
|
more_data?: any;
|
|
|
|
}
|
|
|
|
|
2024-10-18 05:48:45 +00:00
|
|
|
export interface AuthenticatedUser {
|
2024-10-18 05:45:25 +00:00
|
|
|
success: boolean;
|
|
|
|
payload: DATASQUIREL_LoggedInUser | null;
|
|
|
|
msg?: string;
|
|
|
|
userId?: number;
|
|
|
|
}
|
|
|
|
|
2024-10-18 05:48:45 +00:00
|
|
|
export interface SuccessUserObject {
|
2024-10-18 05:45:25 +00:00
|
|
|
id: number;
|
|
|
|
first_name: string;
|
|
|
|
last_name: string;
|
|
|
|
email: string;
|
|
|
|
}
|
|
|
|
|
2024-10-18 05:48:45 +00:00
|
|
|
export interface AddUserFunctionReturn {
|
2024-10-18 05:45:25 +00:00
|
|
|
success: boolean;
|
|
|
|
payload?: SuccessUserObject | null;
|
|
|
|
msg?: string;
|
|
|
|
sqlResult?: any;
|
|
|
|
}
|
|
|
|
|
2024-10-18 05:48:45 +00:00
|
|
|
export interface GoogleIdentityPromptNotification {
|
2024-10-18 05:45:25 +00:00
|
|
|
getMomentType: () => string;
|
|
|
|
getDismissedReason: () => string;
|
|
|
|
getNotDisplayedReason: () => string;
|
|
|
|
getSkippedReason: () => string;
|
|
|
|
isDismissedMoment: () => boolean;
|
|
|
|
isDisplayMoment: () => boolean;
|
|
|
|
isDisplayed: () => boolean;
|
|
|
|
isNotDisplayed: () => boolean;
|
|
|
|
isSkippedMoment: () => boolean;
|
|
|
|
}
|
|
|
|
|
2024-10-18 05:48:45 +00:00
|
|
|
export interface UserDataPayload {
|
2024-10-18 05:45:25 +00:00
|
|
|
first_name: string;
|
|
|
|
last_name: string;
|
|
|
|
email: string;
|
|
|
|
password: string;
|
|
|
|
username: string;
|
|
|
|
}
|
|
|
|
|
2024-10-18 05:48:45 +00:00
|
|
|
export interface GetUserFunctionReturn {
|
2024-10-18 05:45:25 +00:00
|
|
|
success: boolean;
|
|
|
|
payload: {
|
|
|
|
id: number;
|
|
|
|
first_name: string;
|
|
|
|
last_name: string;
|
|
|
|
username: string;
|
|
|
|
email: string;
|
|
|
|
phone: string;
|
|
|
|
social_id: [string];
|
|
|
|
image: string;
|
|
|
|
image_thumbnail: string;
|
|
|
|
verification_status: [number];
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2024-10-18 05:48:45 +00:00
|
|
|
export interface ReauthUserFunctionReturn {
|
2024-10-18 05:45:25 +00:00
|
|
|
success: boolean;
|
|
|
|
payload: DATASQUIREL_LoggedInUser | null;
|
|
|
|
msg?: string;
|
|
|
|
userId?: number;
|
|
|
|
token?: string;
|
|
|
|
}
|
|
|
|
|
2024-10-18 05:48:45 +00:00
|
|
|
export interface UpdateUserFunctionReturn {
|
2024-10-18 05:45:25 +00:00
|
|
|
success: boolean;
|
|
|
|
payload?: Object[] | string;
|
|
|
|
}
|
|
|
|
|
2024-10-18 05:48:45 +00:00
|
|
|
export interface GetReturn {
|
2024-10-18 05:45:25 +00:00
|
|
|
success: boolean;
|
|
|
|
payload?: any;
|
|
|
|
msg?: string;
|
|
|
|
error?: string;
|
|
|
|
schema?: DSQL_TableSchemaType;
|
|
|
|
}
|