import type { Prisma, GlobalRole } from "@prisma/client";
export type AppThemeScheme = "light" | "dark";
export type WithThemeSchemeProp = {
themeScheme: AppThemeScheme;
};
export interface AppSessionData extends Prisma.JsonObject {
sessionId: null | string;
authenticated: boolean;
flash_message: null | string;
flash_message_shown_once: boolean;
curr_user_avatar_uri: null | string;
curr_user_uid: null | string;
curr_user_username: null | string;
curr_user_role: null | GlobalRole;
two_factor_lock: boolean;
two_factor_complete: boolean;
}
export interface CommonViewProps {
authenticated: boolean;
currentUserAvatarUri: string | null;
currentUserId: string | null;
currentUserRole: GlobalRole | null;
currentUserUsername: string | null;
flashMessage: string | null;
themeScheme: AppThemeScheme;
title?: string;
}
export type CommonProps = { commonProps: CommonViewProps };
export interface LanguageDetectFn {
(path: string, callback: (err: Error, language: string | null) => void): void;
sync: (path: string | null) => string | null;
contents: (path: string, content: string) => string | null;
filename: (path: string) => string | null;
shebang: (content: string) => string | null;
classify: (content: string) => string | null;
}
export interface LanguagesMap {
[languageName: string]: {
aceMode: string;
aliases?: string[];
color?: string;
codemirrorMode?: string;
codemirrorMimeType?: string;
extensions?: string[];
filenames?: string[];
group?: string;
interpreters?: string[];
languageId: number;
tmScope: string;
type: string;
wrap?: boolean;
};
}
export interface RepositoryHead {
treeId: string;
parentId: null | string;
author: {
name: string;
email: string;
timestamp: number;
timezone: string;
};
committer: {
name: string;
email: string;
timestamp: number;
timezone: string;
};
commitMessage: string;
}
export interface RepositoryFile {
id: string;
name: string;
permissions: string;
type: "blob" | "tree";
}
export interface RepositoryFileContent {
content: string;
mimeType: string;
}
export interface RepositoryFileDiffChunkChange {
type: string;
del: boolean;
oldLine?: number;
newLine?: number;
position: number;
content: string;
}
export interface RepositoryFileDiffChunk {
content: string;
changes: RepositoryFileDiffChunkChange[];
oldStart: number;
oldLines: number;
newStart: number;
newLines: number;
}
export interface RepositoryFileDiff {
additions: number;
deletions: number;
index: string[];
from: string;
to: string;
chunks: RepositoryFileDiffChunk[];
}
export interface RepositoryLog {
commit: string;
abbreviated_commit: string;
tree: string;
abbreviated_tree: string;
parent: string;
abbreviated_parent: string;
refs: string;
encoding: string;
subject: string;
sanitized_subject_line: string;
body: string;
commit_notes: string;
verification_flag: string;
signer: string;
signer_key: string;
author: {
name: string;
email: string;
date: string;
};
commiter: {
name: string;
email: string;
date: string;
};
}