datasquirel/package-shared/types/index.d.ts

1215 lines
35 KiB
TypeScript
Raw Normal View History

2024-11-06 06:26:23 +00:00
import { Editor } from "tinymce";
2024-10-18 05:48:45 +00:00
export type DSQL_DatabaseFullName = string;
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-11-06 06:26:23 +00:00
id: number;
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-11-06 06:26:23 +00:00
remote_connected?: number;
remote_db_full_name?: string;
remote_connection_host?: string;
remote_connection_key?: string;
remote_connection_type?: string;
user_priviledge?: string;
date_created?: string;
image_thumbnail?: string;
first_name?: string;
last_name?: string;
email?: string;
2024-10-18 05:45:25 +00:00
}
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-12-06 10:31:24 +00:00
skipPassword?: boolean;
2024-10-18 05:45:25 +00:00
}
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;
2024-12-06 10:31:24 +00:00
skipPassword?: boolean;
2024-10-18 05:45:25 +00:00
}
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;
}
2024-12-12 13:43:25 +00:00
export type SerializeQueryFnType = (query: any) => string;
2024-12-06 10:31:24 +00:00
export type DATASQUIREL_LoggedInUser = {
2024-12-08 08:58:57 +00:00
id: number;
uuid?: string;
2024-10-18 05:45:25 +00:00
first_name: string;
last_name: string;
email: string;
phone?: string;
user_type?: string;
username?: string;
image?: string;
image_thumbnail?: string;
social_login?: number;
social_platform?: string;
social_id?: string;
verification_status?: number;
2024-12-08 08:58:57 +00:00
csrf_k: string;
logged_in_status: boolean;
date: number;
2024-12-06 10:31:24 +00:00
} & {
[key: string]: 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-12-08 08:58:57 +00:00
cookieNames?: any;
2024-10-18 05:45:25 +00:00
}
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-24 07:08:22 +00:00
export type UserDataPayload = {
2024-10-18 05:45:25 +00:00
first_name: string;
last_name: string;
email: string;
2024-12-09 11:45:39 +00:00
password?: string;
username?: string;
2024-10-24 07:08:22 +00:00
} & {
[key: string]: any;
};
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-12-06 10:31:24 +00:00
} | null;
2024-10-18 05:45:25 +00:00
}
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;
}
2024-10-23 06:08:06 +00:00
export interface GetSchemaRequestQuery {
2024-10-22 17:17:59 +00:00
database?: string;
table?: string;
field?: string;
user_id?: string | number;
2024-10-21 07:05:18 +00:00
}
2024-10-23 06:08:06 +00:00
export interface GetSchemaAPICredentialsParam {
2024-10-22 17:17:59 +00:00
key: string;
2024-10-21 07:05:18 +00:00
}
2024-12-06 10:44:26 +00:00
export type GetSchemaAPIParam = GetSchemaRequestQuery & GetSchemaAPICredentialsParam;
2024-10-23 06:08:06 +00:00
export interface PostReturn {
2024-10-23 05:55:53 +00:00
success: boolean;
2024-10-23 06:08:06 +00:00
payload?: Object[] | string | PostInsertReturn;
2024-12-06 10:31:24 +00:00
msg?: string;
error?: any;
schema?: DSQL_TableSchemaType;
2024-10-23 05:55:53 +00:00
}
2024-10-23 06:08:06 +00:00
export interface PostDataPayload {
2024-10-23 05:55:53 +00:00
action: "insert" | "update" | "delete";
table: string;
data?: object;
identifierColumnName?: string;
identifierValue?: string;
duplicateColumnName?: string;
duplicateColumnValue?: string;
update?: boolean;
}
2024-10-23 06:08:06 +00:00
export interface LocalPostReturn {
2024-10-23 05:55:53 +00:00
success: boolean;
payload?: any;
msg?: string;
error?: string;
}
2024-10-23 06:08:06 +00:00
export interface LocalPostQueryObject {
2024-10-23 05:55:53 +00:00
query: string | PostDataPayload;
tableName?: string;
queryValues?: string[];
}
2024-10-23 06:08:06 +00:00
export interface PostInsertReturn {
fieldCount: number;
affectedRows: number;
insertId: number;
serverStatus: number;
warningCount: number;
message: string;
protocol41: boolean;
changedRows: number;
}
2024-12-08 08:58:57 +00:00
export type UserType = DATASQUIREL_LoggedInUser;
2024-11-06 06:26:23 +00:00
export interface ApiKeyDef {
name: string;
scope: string;
date_created: string;
apiKeyPayload: string;
}
export interface MetricsType {
dbCount: number;
tablesCount: number;
mediaCount: number;
apiKeysCount: number;
}
export interface DashboardContextType {
user?: UserType;
databases?: DSQL_MYSQL_user_databases_Type[];
2024-12-06 10:44:26 +00:00
setTargetDatabase?: React.Dispatch<React.SetStateAction<DSQL_MYSQL_user_databases_Type>>;
2024-11-06 06:26:23 +00:00
targetDatabase?: DSQL_MYSQL_user_databases_Type;
metrics?: MetricsType;
}
export interface AddDbContextType {
user?: UserType;
databases?: DSQL_MYSQL_user_databases_Type[];
dbImage?: string | null | ImageObjectType;
2024-12-06 10:44:26 +00:00
setDbImage?: React.Dispatch<React.SetStateAction<string | null | ImageObjectType>>;
2024-11-06 06:26:23 +00:00
query?: any;
duplicateDb?: DSQL_MYSQL_user_databases_Type;
}
export interface EditDbContextType {
user?: UserType;
database?: DSQL_MYSQL_user_databases_Type;
dbImage?: string | null | ImageObjectType;
2024-12-06 10:44:26 +00:00
setDbImage?: React.Dispatch<React.SetStateAction<string | null | ImageObjectType>>;
2024-11-06 06:26:23 +00:00
}
export interface RichTextEditorsRefArray {
fieldName: string;
ref: React.MutableRefObject<Editor>;
}
export interface JSONTextEditorsRefArray {
fieldName: string;
ref: React.MutableRefObject<AceAjax.Editor>;
}
export interface TableEntriesContextType {
user: UserType;
database: DSQL_MYSQL_user_databases_Type;
table: DSQL_TableSchemaType;
dbSchemaData: DSQL_DatabaseSchemaType[];
entries: any[];
targetEntry?: any;
setTargetEntry: React.Dispatch<React.SetStateAction<any>>;
richTextEditors: React.MutableRefObject<RichTextEditorsRefArray[]>;
jsonTextEditors: React.MutableRefObject<JSONTextEditorsRefArray[]>;
query?: any;
confirmedDelegetedUser?: any;
activeEntries: any[] | null;
setActiveEntries: React.Dispatch<React.SetStateAction<any[] | null>>;
targetField: React.MutableRefObject<string>;
searchTerm: React.MutableRefObject<string | null>;
entriesCount: number;
}
export interface AddEntryContextType {
user: UserType;
database: DSQL_MYSQL_user_databases_Type;
table: DSQL_TableSchemaType;
dbSchemaData: DSQL_DatabaseSchemaType[];
richTextEditors: React.MutableRefObject<RichTextEditorsRefArray[]>;
jsonTextEditors: React.MutableRefObject<JSONTextEditorsRefArray[]>;
query: any;
duplicateEntry?: any;
confirmedDelegetedUser: any;
}
export interface UserDatabasesContextType {
user: UserType;
users: any[];
targetUser: any;
setTargetUser: React.Dispatch<React.SetStateAction<any>>;
databases: DSQL_MYSQL_user_databases_Type[];
}
export interface SettingsPageContextType {
user: UserType;
image: any;
setImage: React.Dispatch<React.SetStateAction<any>>;
activeUser: any;
}
export interface MediaFolderPageContextType {
user: UserType;
media: any[];
targetMedia: any;
setTargetMedia: React.Dispatch<React.SetStateAction<any>>;
folders: any[];
query: any;
staticHost: string;
folder: string;
}
export interface TablesContextType {
user: UserType;
database: DSQL_MYSQL_user_databases_Type;
tables: MYSQL_user_database_tables_table_def[];
targetTable: MYSQL_user_database_tables_table_def | null;
2024-12-06 10:44:26 +00:00
setTargetTable: React.Dispatch<React.SetStateAction<MYSQL_user_database_tables_table_def | null>>;
2024-11-06 06:26:23 +00:00
query: any;
confirmedDelegetedUser: any;
}
export interface EditTableContextType {
user: UserType;
database: DSQL_MYSQL_user_databases_Type;
table: DSQL_TableSchemaType;
tableFields: DSQL_FieldSchemaType[];
2024-12-06 10:44:26 +00:00
setTableFields: React.Dispatch<React.SetStateAction<DSQL_FieldSchemaType[]>>;
2024-11-06 06:26:23 +00:00
targetField: DSQL_FieldSchemaType | null;
2024-12-06 10:44:26 +00:00
setTargetField: React.Dispatch<React.SetStateAction<DSQL_FieldSchemaType | null>>;
2024-11-06 06:26:23 +00:00
pageRefresh: number;
setPageRefresh: React.Dispatch<React.SetStateAction<number>>;
2024-12-06 10:44:26 +00:00
refreshFieldsListRef: React.MutableRefObject<React.Dispatch<React.SetStateAction<number>> | undefined>;
2024-11-06 06:26:23 +00:00
dbSchemaData: DSQL_DatabaseSchemaType[];
query: any;
confirmedDelegetedUser: any;
}
export interface SingleDatabaseContextType {
user: UserType;
database: DSQL_MYSQL_user_databases_Type;
tables: MYSQL_user_database_tables_table_def[];
targetTable: MYSQL_user_database_tables_table_def | null;
2024-12-06 10:44:26 +00:00
setTargetTable: React.Dispatch<React.SetStateAction<MYSQL_user_database_tables_table_def | null>>;
2024-11-06 06:26:23 +00:00
query: any;
confirmedDelegetedUser: any;
}
export interface ApiKeysContextType {
user: UserType;
apiKeys: any[];
setApiKeys: React.Dispatch<React.SetStateAction<any[]>>;
targetApiKey: any | null;
setTargetApiKey: React.Dispatch<React.SetStateAction<any | null>>;
newApiKey: any | null;
setNewApiKey: React.Dispatch<React.SetStateAction<any | null>>;
}
export interface LoginFormContextType {
user?: UserType | null;
loading: boolean;
setLoading: React.Dispatch<React.SetStateAction<boolean>>;
alert: string | boolean;
setAlert: React.Dispatch<React.SetStateAction<string | boolean>>;
}
export interface CreateAccountContextType {
user?: UserType | null;
query: CreateAccountQueryType;
invitingUser: any;
}
export interface CreateAccountQueryType {
invite?: number;
database_access?: string;
priviledge?: string;
email?: string;
}
export interface DocsAsidePageObject {
id: number;
title: string;
slug: string;
parent_id?: number;
level?: number;
}
export interface AllUserUsersContextType {
user: UserType;
users: MYSQL_delegated_users_table_def[];
targetUser: MYSQL_user_users_table_def | null;
2024-12-06 10:44:26 +00:00
setTargetUser: React.Dispatch<React.SetStateAction<MYSQL_user_users_table_def | null>>;
2024-11-06 06:26:23 +00:00
databases: DSQL_MYSQL_user_databases_Type[];
pendingInvitations: MYSQL_invitations_table_def[];
pendingInvitationsReceived: any[];
adminUsers: any[];
invitedAccounts: any[];
}
export interface AddSocialLoginContextType {
user: UserType;
database: DSQL_MYSQL_user_databases_Type;
query: any;
socialLogins: SocialLoginObjectType[];
}
export interface DelegatedDbContextType {
user: UserType;
users: MYSQL_user_users_table_def[];
targetUser: MYSQL_user_users_table_def | null;
2024-12-06 10:44:26 +00:00
setTargetUser: React.Dispatch<React.SetStateAction<MYSQL_user_users_table_def | null>>;
2024-11-06 06:26:23 +00:00
database: DSQL_MYSQL_user_databases_Type;
}
export interface AddUserUserContextType {
user: UserType;
database: DSQL_MYSQL_user_databases_Type;
table: DSQL_TableSchemaType;
query: any;
confirmedDelegetedUser: any;
}
export interface UserUsersContextType {
user: UserType;
users: MYSQL_user_users_table_def[];
targetUser: MYSQL_user_users_table_def;
2024-12-06 10:44:26 +00:00
setTargetUser: React.Dispatch<React.SetStateAction<MYSQL_user_users_table_def | null>>;
2024-11-06 06:26:23 +00:00
database: DSQL_MYSQL_user_databases_Type;
table: DSQL_TableSchemaType;
dbSchemaData: DSQL_DatabaseSchemaType[];
query: any;
confirmedDelegetedUser: any;
}
export interface DatabaseSingleUserContextType {
user: UserType;
database: DSQL_MYSQL_user_databases_Type;
singleUser: MYSQL_user_users_table_def;
table: DSQL_TableSchemaType;
dbSchemaData: DSQL_DatabaseSchemaType[];
query: any;
confirmedDelegetedUser: any;
}
export interface SingleUserUserContextType {
user: UserType;
singleUser: MYSQL_user_users_table_def;
}
export interface AddUserContextType {
user: UserType;
users: MYSQL_delegated_users_table_def[];
databases: DSQL_MYSQL_user_databases_Type[];
query: any;
}
export interface MediaContextType {
user: UserType;
media: MYSQL_user_media_table_def[];
targetMedia: MYSQL_user_media_table_def | null;
2024-12-06 10:44:26 +00:00
setTargetMedia: React.Dispatch<React.SetStateAction<MYSQL_user_media_table_def | null>>;
2024-11-06 06:26:23 +00:00
folders: string[];
staticHost: string;
}
export interface MediaSubFolderContextType {
user: UserType;
media: MYSQL_user_media_table_def[];
targetMedia: MYSQL_user_media_table_def | null;
2024-12-06 10:44:26 +00:00
setTargetMedia: React.Dispatch<React.SetStateAction<MYSQL_user_media_table_def | null>>;
2024-11-06 06:26:23 +00:00
folders: string[];
query: any;
folder: string;
staticHost: string;
}
export interface FieldsContextType {
user: UserType;
database: DSQL_MYSQL_user_databases_Type;
table: DSQL_TableSchemaType;
dbSchemaData: DSQL_DatabaseSchemaType[];
targetField: DSQL_FieldSchemaType | null;
2024-12-06 10:44:26 +00:00
setTargetField: React.Dispatch<React.SetStateAction<DSQL_FieldSchemaType | null>>;
refreshFieldsListRef: React.MutableRefObject<React.Dispatch<React.SetStateAction<number>> | undefined>;
2024-11-06 06:26:23 +00:00
tableFields: DSQL_FieldSchemaType[];
2024-12-06 10:44:26 +00:00
setTableFields: React.Dispatch<React.SetStateAction<DSQL_FieldSchemaType[]>>;
2024-11-06 06:26:23 +00:00
updateTableAfterFieldsUpdateFunction: () => void;
query: any;
confirmedDelegetedUser: any;
}
export interface SingleTableContextType {
user: UserType;
database: DSQL_MYSQL_user_databases_Type;
table: DSQL_TableSchemaType;
tableRecord: MYSQL_user_database_tables_table_def;
tableFields: DSQL_FieldSchemaType[];
2024-12-06 10:44:26 +00:00
setTableFields: React.Dispatch<React.SetStateAction<DSQL_FieldSchemaType[]>>;
2024-11-06 06:26:23 +00:00
tableIndexes: DSQL_IndexSchemaType[];
2024-12-06 10:44:26 +00:00
setTableIndexes: React.Dispatch<React.SetStateAction<DSQL_IndexSchemaType[]>>;
2024-11-06 06:26:23 +00:00
dbSchemaData: DSQL_DatabaseSchemaType[];
entries: any[];
targetEntry: any;
setTargetEntry: React.Dispatch<React.SetStateAction<any>>;
richTextEditors: React.MutableRefObject<RichTextEditorsRefArray[]>;
jsonTextEditors: React.MutableRefObject<JSONTextEditorsRefArray[]>;
query: any;
confirmedDelegetedUser: any;
targetField: DSQL_FieldSchemaType | null;
2024-12-06 10:44:26 +00:00
setTargetField: React.Dispatch<React.SetStateAction<DSQL_FieldSchemaType | null>>;
refreshFieldsListRef: React.MutableRefObject<React.Dispatch<React.SetStateAction<number>>>;
2024-11-06 06:26:23 +00:00
updateTableAfterFieldsUpdateFunction: () => void;
entriesCount: number;
}
export interface SingleEntryContextType {
user: UserType;
database: DSQL_MYSQL_user_databases_Type;
table: DSQL_TableSchemaType;
dbSchemaData: DSQL_DatabaseSchemaType[];
entry: any;
targetEntry: any;
setTargetEntry: React.Dispatch<React.SetStateAction<any>>;
richTextEditors: React.MutableRefObject<RichTextEditorsRefArray[]>;
jsonTextEditors: React.MutableRefObject<JSONTextEditorsRefArray[]>;
query: any;
confirmedDelegetedUser: any;
prevEntry: any;
nextEntry: any;
}
export interface UserSchemaContextType {
user: UserType;
dbSchemaData: DSQL_DatabaseSchemaType[];
}
export interface ConnectContextType {
user: UserType;
query: any;
mariadbUserCred: MariaDBUserCredType;
mariadbUsers: MYSQL_mariadb_users_table_def[];
targetMariadbUser: MYSQL_mariadb_users_table_def | null;
2024-12-06 10:44:26 +00:00
setTargetMariadbUser: React.Dispatch<React.SetStateAction<MYSQL_mariadb_users_table_def | null>>;
2024-11-06 06:26:23 +00:00
refresh: number;
setRefresh: React.Dispatch<React.SetStateAction<number>>;
}
export interface MYSQL_mariadb_users_table_def {
id?: number;
user_id?: number;
username?: string;
host?: string;
password?: string;
primary?: number;
grants?: string;
date_created?: string;
date_created_code?: number;
date_created_timestamp?: string;
date_updated?: string;
date_updated_code?: number;
date_updated_timestamp?: string;
}
export interface DbContextType {
user?: UserType;
databases?: DSQL_MYSQL_user_databases_Type[];
targetDatabase?: DSQL_MYSQL_user_databases_Type;
2024-12-06 10:44:26 +00:00
setTargetDatabase?: React.Dispatch<React.SetStateAction<DSQL_MYSQL_user_databases_Type>>;
2024-11-06 06:26:23 +00:00
}
export interface MariaDBUserCredType {
mariadb_user?: string;
mariadb_host?: string;
mariadb_pass?: string;
}
export interface AddTableContextType {
user: UserType;
dbSchemaData: DSQL_DatabaseSchemaType[];
database: DSQL_MYSQL_user_databases_Type;
tables: DSQL_TableSchemaType[];
tableFields: DSQL_FieldSchemaType[];
2024-12-06 10:44:26 +00:00
setTableFields: React.Dispatch<React.SetStateAction<DSQL_FieldSchemaType[]>>;
2024-11-06 06:26:23 +00:00
targetField: DSQL_FieldSchemaType | null;
2024-12-06 10:44:26 +00:00
setTargetField: React.Dispatch<React.SetStateAction<DSQL_FieldSchemaType | null>>;
2024-11-06 06:26:23 +00:00
pageRefresh: number | null;
setPageRefresh: React.Dispatch<React.SetStateAction<number>>;
2024-12-06 10:44:26 +00:00
refreshFieldsListRef: React.MutableRefObject<React.Dispatch<React.SetStateAction<number>>>;
2024-11-06 06:26:23 +00:00
query: any;
}
export interface DbSchemaContextType {
user: UserType;
database: DSQL_MYSQL_user_databases_Type;
dbImage: string;
setDbImage: React.Dispatch<React.SetStateAction<string>>;
dbSchemaData: DSQL_DatabaseSchemaType[];
tables: any[];
}
export interface DbShellContextType {
user?: UserType;
database?: DSQL_MYSQL_user_databases_Type;
dbImage?: string;
setDbImage?: React.Dispatch<React.SetStateAction<string>>;
dbSchemaData?: DSQL_DatabaseSchemaType[];
tables?: any[];
}
export interface DbConnectContextType {
user: UserType;
database: DSQL_MYSQL_user_databases_Type;
targetDbSchema: DSQL_DatabaseSchemaType;
query: any;
}
export interface ImageObjectType {
imageName?: string;
mimeType?: string;
imageSize?: number;
private?: boolean;
imageBase64?: string;
imageBase64Full?: string;
}
export interface FileObjectType {
fileName?: string;
private?: boolean;
fileType?: string;
fileSize?: number;
fileBase64?: string;
fileBase64Full?: string;
}
export interface SocialLoginObjectType {
platform?: string;
paradigm?: string;
clientId?: string;
clientSecret?: string;
callbackUrl?: string;
domain1?: string;
domain2?: string;
domain3?: string;
}
export interface DbConnectType {
url: string;
key: string;
database: DSQL_MYSQL_user_databases_Type;
dbSchema: DSQL_DatabaseSchemaType;
type: "pull" | "push";
remoteDbs?: DSQL_DatabaseSchemaType[];
targetDb?: DSQL_DatabaseSchemaType;
}
export interface MYSQL_MediaType {
id?: number;
user_id?: number;
media_name?: string;
folder?: string;
media_url?: string;
media_thumbnail_url?: string;
media_type?: string;
width?: string;
height?: string;
size?: string;
private?: string;
}
export interface UserFileObject {
title?: string;
path?: string;
data?: string;
}
export interface UserFileObject2 {
type?: string;
name?: string;
root?: string;
content?: UserFileObject2[];
}
export interface MYSQL_user_users_table_def {
id?: number;
user_id?: number;
invited_user_id?: number;
database?: string;
database_access?: string;
first_name?: string;
last_name?: string;
email?: string;
username?: string;
password?: string;
phone?: string;
user_type?: string;
user_priviledge?: string;
image?: string;
image_thumbnail?: string;
city?: string;
state?: string;
country?: string;
zip_code?: string;
address?: string;
social_login?: number;
social_platform?: string;
social_id?: string;
verification_status?: number;
more_user_data?: string;
date_created?: string;
date_created_code?: number;
date_created_timestamp?: string;
date_updated?: string;
date_updated_code?: number;
date_updated_timestamp?: string;
inviteeFirstName?: string;
inviteeLastName?: string;
inviteeEmail?: string;
inviteeImage?: string;
}
export interface MYSQL_user_database_tables_table_def {
id?: number;
user_id?: number;
db_id?: number;
db_slug?: string;
table_name?: string;
table_slug?: string;
table_description?: string;
child_table?: number;
child_table_parent_database?: string;
child_table_parent_table?: string;
date_created?: string;
date_created_code?: number;
date_created_timestamp?: string;
date_updated?: string;
date_updated_code?: number;
date_updated_timestamp?: string;
}
export interface MYSQL_user_media_table_def {
id?: number;
user_id?: number;
media_name?: string;
folder?: string;
media_url?: string;
media_thumbnail_url?: string;
media_path?: string;
media_thumbnail_path?: string;
media_type?: string;
width?: number;
height?: number;
size?: number;
private?: number;
date_created?: string;
date_created_code?: number;
date_created_timestamp?: string;
date_updated?: string;
date_updated_code?: number;
date_updated_timestamp?: string;
}
export interface MYSQL_delegated_users_table_def {
id?: number;
user_id?: number;
delegated_user_id?: number;
permissions?: string;
permission_level_code?: number;
date_created?: string;
date_created_code?: number;
date_created_timestamp?: string;
date_updated?: string;
date_updated_code?: number;
date_updated_timestamp?: string;
}
export interface MYSQL_invitations_table_def {
id?: number;
inviting_user_id?: number;
invited_user_email?: string;
invitation_status?: string;
database_access?: string;
priviledge?: string;
db_tables_data?: string;
date_created?: string;
date_created_code?: number;
date_created_timestamp?: string;
date_updated?: string;
date_updated_code?: number;
date_updated_timestamp?: string;
}
export interface MYSQL_docs_pages_table_def {
id?: number;
title?: string;
slug?: string;
description?: string;
content?: string;
text_content?: string;
level?: number;
page_order?: number;
parent_id?: number;
date_created?: string;
date_created_code?: number;
date_created_timestamp?: string;
date_updated?: string;
date_updated_code?: number;
date_updated_timestamp?: string;
}
export interface MYSQL_delegated_user_tables_table_def {
id?: number;
delegated_user_id?: number;
root_user_id?: number;
database?: string;
table?: string;
priviledge?: string;
date_created?: string;
date_created_code?: number;
date_created_timestamp?: string;
date_updated?: string;
date_updated_code?: number;
date_updated_timestamp?: string;
}
export type ApiKeyObject = {
2024-12-17 17:39:50 +00:00
user_id?: string | number;
2024-11-06 06:26:23 +00:00
full_access?: boolean;
2024-12-17 17:39:50 +00:00
sign?: string;
date_code?: number;
2024-11-06 06:26:23 +00:00
target_database?: string;
target_table?: string;
2024-12-17 17:39:50 +00:00
error?: string;
2024-11-06 06:26:23 +00:00
};
export type AddApiKeyRequestBody = {
api_key_name: string;
api_key_slug: string;
api_key_scope?: "fullAccess" | "readOnly";
target_database?: string;
target_table?: string;
};
2024-12-06 10:44:26 +00:00
export type CheckApiCredentialsFn = (param: CheckApiCredentialsFnParam) => ApiKeyObject | null | undefined;
2024-11-06 06:26:23 +00:00
export type CheckApiCredentialsFnParam = {
2024-11-06 11:58:41 +00:00
key?: string;
2024-11-06 06:26:23 +00:00
database?: string;
table?: string;
user_id?: string | number;
2024-12-17 17:39:50 +00:00
media?: boolean;
2024-11-06 06:26:23 +00:00
};
2024-12-14 15:23:16 +00:00
export type FetchApiFn = (url: string, options?: FetchApiOptions, csrf?: boolean) => Promise<any>;
2024-11-08 17:28:55 +00:00
export type FetchApiOptions = RequestInit & {
2024-12-06 10:44:26 +00:00
method: "POST" | "GET" | "DELETE" | "PUT" | "PATCH" | "post" | "get" | "delete" | "put" | "patch";
2024-11-08 15:41:22 +00:00
body?: object | string;
headers?: FetchHeader;
2024-12-06 10:44:26 +00:00
query?: {
[key: string]: any;
};
2024-11-08 15:41:22 +00:00
};
export type AuthCsrfHeaderName = "x-csrf-auth";
type FetchHeader = HeadersInit & {
[key in AuthCsrfHeaderName]?: string | null;
2024-11-08 17:28:55 +00:00
} & {
[key: string]: any;
2024-11-08 15:41:22 +00:00
};
export type FetchApiReturn = {
success: boolean;
payload: any;
msg?: string;
[key: string]: any;
};
2024-11-08 18:54:14 +00:00
export type ServerQueryParam = {
selectFields?: string[];
query?: ServerQueryQueryObject;
limit?: number;
order?: {
field: string;
strategy: "ASC" | "DESC";
};
searchOperator?: "AND" | "OR";
searchEquality?: "EQUAL" | "LIKE";
addUserId?: {
fieldName: string;
};
join?: ServerQueryParamsJoin[];
} & {
[key: string]: any;
};
2024-12-06 10:44:26 +00:00
export type ServerQueryQueryObject<T extends object = {
[key: string]: any;
}> = {
[key in keyof T]: {
value: string | string[];
operator?: "AND" | "OR";
equality?: "EQUAL" | "LIKE";
tableName?: string;
2024-11-08 18:54:14 +00:00
};
2024-12-06 10:44:26 +00:00
};
2024-11-08 18:54:14 +00:00
export type FetchDataParams = {
path: string;
method?: "GET" | "POST" | "PATCH" | "PUT" | "DELETE";
body?: object | string;
query?: AuthFetchQuery;
2024-11-12 05:47:31 +00:00
tableName?: string;
2024-11-08 18:54:14 +00:00
};
export type AuthFetchQuery = ServerQueryParam & {
[key: string]: any;
2024-11-08 18:54:14 +00:00
};
2024-12-06 10:44:26 +00:00
export type ServerQueryParamsJoin<Table extends string = string, Field extends object = {
[key: string]: any;
}> = {
2024-11-08 18:54:14 +00:00
joinType: "INNER JOIN" | "JOIN" | "LEFT JOIN" | "RIGHT JOIN";
2024-12-19 20:37:34 +00:00
alias?: string;
2024-11-09 06:09:00 +00:00
tableName: Table;
2024-12-06 10:44:26 +00:00
match?: ServerQueryParamsJoinMatchObject<Field> | ServerQueryParamsJoinMatchObject<Field>[];
selectFields?: (keyof Field | {
field: keyof Field;
alias?: string;
})[];
2024-11-08 18:54:14 +00:00
};
2024-12-06 10:44:26 +00:00
export type ServerQueryParamsJoinMatchObject<Field extends object = {
[key: string]: any;
}> = {
2024-11-08 18:54:14 +00:00
/** Field name from the **Root Table** */
2024-11-12 05:47:56 +00:00
source: string | ServerQueryParamsJoinMatchSourceTargetObject;
2024-11-08 18:54:14 +00:00
/** Field name from the **Join Table** */
2024-11-12 05:47:31 +00:00
target?: keyof Field | ServerQueryParamsJoinMatchSourceTargetObject;
/** A literal value: No source and target Needed! */
targetLiteral?: string;
2024-11-08 18:54:14 +00:00
};
export type ServerQueryParamsJoinMatchSourceTargetObject = {
tableName: string;
fieldName: string;
};
export type SqlGeneratorFn = (Param0: {
genObject?: ServerQueryParam;
tableName: string;
2024-12-06 10:44:26 +00:00
}) => {
string: string;
values: string[];
} | undefined;
export type ApiConnectBody = {
url: string;
key: string;
database: DSQL_MYSQL_user_databases_Type;
dbSchema: DSQL_DatabaseSchemaType;
type: "pull" | "push";
user_id?: string | number;
};
2024-12-04 05:38:30 +00:00
export type SuUserType = {
email: string;
password: string;
authKey: string;
logged_in_status: boolean;
date: number;
};
export type MariadbRemoteServerObject = {
host: string;
port: number;
primary?: boolean;
loadBalanced?: boolean;
users?: MariadbRemoteServerUserObject[];
};
export type MariadbRemoteServerUserObject = {
name: string;
password: string;
host: string;
};
2024-12-06 10:31:24 +00:00
export type APILoginFunctionParams = {
encryptionKey: string;
email: string;
username?: string;
password?: string;
database: string;
additionalFields?: string[];
email_login?: boolean;
email_login_code?: string;
email_login_field?: string;
token?: boolean;
skipPassword?: boolean;
social?: boolean;
2024-12-06 11:55:03 +00:00
useLocal?: boolean;
2024-12-06 10:31:24 +00:00
};
export type APILoginFunctionReturn = {
success: boolean;
msg?: string;
payload?: DATASQUIREL_LoggedInUser | null;
userId?: number | string;
2024-12-08 08:58:57 +00:00
key?: string;
token?: string;
csrf?: string;
cookieNames?: any;
2024-12-06 10:31:24 +00:00
};
2024-12-06 10:44:26 +00:00
export type APILoginFunction = (params: APILoginFunctionParams) => Promise<APILoginFunctionReturn>;
2024-12-06 10:31:24 +00:00
export type APICreateUserFunctionParams = {
2024-12-06 11:55:03 +00:00
encryptionKey?: string;
2024-12-06 10:31:24 +00:00
payload: any;
database: string;
userId?: string | number;
2024-12-06 11:55:03 +00:00
useLocal?: boolean;
2024-12-06 10:31:24 +00:00
};
2024-12-06 10:44:26 +00:00
export type APICreateUserFunction = (params: APICreateUserFunctionParams) => Promise<AddUserFunctionReturn>;
2024-12-06 10:31:24 +00:00
/**
* API Get User Function
*/
export type APIGetUserFunctionParams = {
fields: string[];
dbFullName: string;
userId: string | number;
2024-12-06 11:55:03 +00:00
useLocal?: boolean;
2024-12-06 10:31:24 +00:00
};
2024-12-06 10:44:26 +00:00
export type APIGetUserFunction = (params: APIGetUserFunctionParams) => Promise<GetUserFunctionReturn>;
2024-12-06 10:31:24 +00:00
/**
* API Google Login Function
*/
export type APIGoogleLoginFunctionParams = {
token: string;
database: string;
2024-12-08 08:58:57 +00:00
additionalFields?: string[];
2024-12-06 10:31:24 +00:00
};
2024-12-10 18:51:02 +00:00
export type APIGoogleLoginFunction = (params: APIGoogleLoginFunctionParams) => Promise<APILoginFunctionReturn>;
2024-12-06 10:31:24 +00:00
/**
* Handle Social DB Function
*/
export type HandleSocialDbFunctionParams = {
database?: string;
social_id: string | number;
email: string;
social_platform: string;
payload: any;
invitation?: any;
supEmail?: string;
2024-12-08 08:58:57 +00:00
additionalFields?: string[];
2024-12-06 11:55:03 +00:00
useLocal?: boolean;
2024-12-06 10:31:24 +00:00
};
export type HandleSocialDbFunctionReturn = {
success: boolean;
2024-12-08 08:58:57 +00:00
user?: DATASQUIREL_LoggedInUser | null;
2024-12-06 10:31:24 +00:00
msg?: string;
social_id?: string | number;
social_platform?: string;
payload?: any;
alert?: boolean;
newUser?: any;
error?: any;
} | null;
/**
* Handle Social User Auth on Datasquirel Database
* ==============================================================================
*
* @description This function handles all social login logic after the social user
* has been authenticated and userpayload is present. The payload MUST contain the
* specified fields because this funciton will create a new user if the authenticated
* user does not exist.
*
* @param {HandleSocialDbFunctionParams} params - function parameters inside an object
*
* @returns {Promise<HandleSocialDbFunctionReturn>} - Response object
*/
2024-12-08 08:58:57 +00:00
export type HandleSocialDbFunction = (params: HandleSocialDbFunctionParams) => Promise<APILoginFunctionReturn>;
2024-12-06 10:31:24 +00:00
export type ApiReauthUserReturn = {
success: boolean;
2024-12-06 10:44:26 +00:00
payload?: {
[key: string]: any;
} | null;
2024-12-06 10:31:24 +00:00
msg?: string;
userId?: string | number;
};
2024-12-08 08:58:57 +00:00
export type GoogleAccessTokenObject = {
access_token: string;
token_type: "Bearer";
expires_in: number;
scope: string;
authuser: string;
prompt: string;
};
export type GoogleOauth2User = {
sub: string;
name: string;
given_name: string;
family_name: string;
picture: string;
email: string;
email_verified: boolean;
};
export interface AceEditorOptions {
animatedScroll?: boolean;
autoScrollEditorIntoView?: boolean;
behavioursEnabled?: boolean;
copyWithEmptySelection?: boolean;
cursorStyle?: "ace" | "slim" | "smooth" | "wide";
customScrollbar?: boolean;
displayIndentGuides?: boolean;
dragDelay?: number;
dragEnabled?: boolean;
enableAutoIndent?: boolean;
enableBasicAutocompletion?: boolean | any[];
enableKeyboardAccessibility?: boolean;
enableLiveAutocompletion?: boolean | any[];
enableMobileMenu?: boolean;
enableMultiselect?: boolean;
enableSnippets?: boolean;
fadeFoldWidgets?: boolean;
firstLineNumber?: number;
fixedWidthGutter?: boolean;
focusTimeout?: number;
foldStyle?: "markbegin" | "markbeginend" | "manual";
fontFamily?: string;
fontSize?: number;
hScrollBarAlwaysVisible?: boolean;
hasCssTransforms?: boolean;
highlightActiveLine?: boolean;
highlightGutterLine?: boolean;
highlightIndentGuides?: boolean;
highlightSelectedWord?: boolean;
indentedSoftWrap?: boolean;
keyboardHandler?: string;
liveAutocompletionDelay?: number;
liveAutocompletionThreshold?: number;
maxLines?: number;
maxPixelHeight?: number;
mergeUndoDeltas?: boolean | "always";
minLines?: number;
mode?: string;
navigateWithinSoftTabs?: boolean;
newLineMode?: AceAjax.NewLineMode;
overwrite?: boolean;
placeholder?: string;
printMargin?: number | boolean;
printMarginColumn?: number;
readOnly?: boolean;
relativeLineNumbers?: boolean;
scrollPastEnd?: number;
scrollSpeed?: number;
selectionStyle?: string;
session?: any;
showFoldWidgets?: boolean;
showFoldedAnnotations?: boolean;
showGutter?: boolean;
showInvisibles?: boolean;
showLineNumbers?: boolean;
showPrintMargin?: boolean;
tabSize?: number;
textInputAriaLabel?: string;
theme?: string;
tooltipFollowsMouse?: boolean;
useSoftTabs?: boolean;
useSvgGutterIcons?: boolean;
useWorker?: boolean;
vScrollBarAlwaysVisible?: boolean;
value?: string;
wrap?: number | boolean | "off" | "free" | "printmargin";
wrapBehavioursEnabled?: boolean;
wrapMethod?: "code" | "text" | "auto";
}
2024-12-10 14:10:32 +00:00
export type SendOneTimeCodeEmailResponse = {
success: boolean;
code?: string;
createdAt?: number;
email?: string;
msg?: string;
};
2024-12-11 03:45:29 +00:00
export type CookieObject = {
name: string;
value: string;
domain?: string;
path?: string;
expires?: Date;
maxAge?: number;
secure?: boolean;
httpOnly?: boolean;
sameSite?: "Strict" | "Lax" | "None";
priority?: "Low" | "Medium" | "High";
};
2024-12-06 10:44:26 +00:00
export {};