This commit is contained in:
Benjamin Toby
2025-06-01 07:05:45 +01:00
parent b3353b8b70
commit a68d1c1d3f
12 changed files with 350 additions and 230 deletions
+179 -2
View File
@@ -1,5 +1,5 @@
import type { IncomingMessage, ServerResponse } from "http";
import type { RequestOptions } from "https";
import { DSQL_DATASQUIREL_PROCESS_QUEUE } from "@/package-shared/types/dsql";
import { Editor } from "tinymce";
export type DSQL_DatabaseFullName = string;
@@ -358,7 +358,7 @@ export interface PostInsertReturn {
changedRows: number;
}
export type UserType = DATASQUIREL_LoggedInUser;
export type UserType = DATASQUIREL_LoggedInUser & {};
export interface ApiKeyDef {
name: string;
@@ -1595,3 +1595,180 @@ export interface MariaDBUser {
default_role: string;
max_statement_time: number;
}
export type PagePropsType = {
user?: UserType | null;
pageUrl?: string | null;
query?: any;
};
export type APIResponseObject<T extends any = any> = {
success: boolean;
payload?: T;
error?: any;
msg?: string;
queryRes?: any;
status?: number;
};
export const UserTypes = ["su", "admin"] as const;
export const SignUpParadigms = [
{
name: "email",
},
{
name: "google",
},
] as const;
export const QueueJobTypes = ["dummy", "import-database"] as const;
export const WebSocketEvents = [
/**
* # Client Events
* @description Events sent from Client to Server
*/
"client:check-queue",
"client:dev:queue",
"client:delete-queue",
"client:pty-shell",
/**
* # Server Events
* @description Events sent from Server to Client
*/
"server:error",
"server:message",
"server:ready",
"server:success",
"server:update",
"server:queue",
"server:dev:queue",
"server:queue-deleted",
"server:pty-shell",
] as const;
export type WebSocketDataType = {
event: (typeof WebSocketEvents)[number];
data?: {
queue?: DSQL_DATASQUIREL_PROCESS_QUEUE;
};
error?: string;
message?: string;
};
export const DatasquirelWindowEvents = [
"queue-started",
"queue-complete",
"queue-running",
] as const;
export type DatasquirelWindowEventPayloadType = {
event: (typeof DatasquirelWindowEvents)[number];
data?: {
queue?: DSQL_DATASQUIREL_PROCESS_QUEUE;
};
error?: string;
message?: string;
};
/**
* # Docker Compose Types
*/
export type DockerCompose = {
services: DockerComposeServices;
networks: DockerComposeNetworks;
name: string;
};
export const DockerComposeServices = [
"setup",
"cron",
"reverse-proxy",
"webapp",
"websocket",
"static",
"db",
"db-load-balancer",
"post-db-setup",
] as const;
export type DockerComposeServices = {
[key in (typeof DockerComposeServices)[number]]: DockerComposeServiceWithBuildObject;
};
export type DockerComposeNetworks = {
datasquirel: {
driver: "bridge";
ipam: {
config: DockerComposeNetworkConfigObject[];
};
};
};
export type DockerComposeNetworkConfigObject = {
subnet: string;
gateway: string;
};
export type DockerComposeServiceWithBuildObject = {
build: DockerComposeServicesBuildObject;
env_file: string;
container_name: string;
hostname: string;
volumes: string[];
environment: string[];
networks?: DockerComposeServiceNetworkObject;
restart?: string;
depends_on?: {
[k: string]: {
condition: string;
};
};
user?: string;
};
export type DockerComposeServiceWithImage = Omit<
DockerComposeServiceWithBuildObject,
"build"
> & {
image: string;
};
export type DockerComposeServicesBuildObject = {
context: string;
dockerfile: string;
};
export type DockerComposeServiceNetworkObject = {
datasquirel: {
ipv4_address: string;
};
};
/**
* # Site Setup Types
*/
export type SiteSetup = {
docker: {
network: {
subnet: string;
};
};
};
export type AppRefObject = {};
export type DsqlAppData = {
DSQL_REMOTE_SQL_HOST?: string;
DSQL_SU_USER_ID?: string;
DSQL_HOST_ENV?: string;
DSQL_HOST?: string;
DSQL_STATIC_HOST?: string;
DSQL_GOOGLE_CLIENT_ID?: string;
DSQL_TINY_MCE_API_KEY?: string;
DSQL_WEBSOCKET_URL?: string;
DSQL_FACEBOOK_APP_ID?: string;
DSQL_GITHUB_ID?: string;
};