- Add projectDir field to Project model for workspace directory management - Implement workspace directory creation, validation and Git initialization - Add workspace status query endpoint with directory info and Git status - Create GitManager for Git repository operations (clone, branch, commit info) - Add PathValidator for secure path validation and traversal attack prevention - Implement execution queue with concurrency control for build tasks - Refactor project list UI to remove edit/delete actions from cards - Add project settings tab in detail page with edit/delete functionality - Add icons to all tabs (History, Code, Settings) - Implement time formatting with dayjs in YYYY-MM-DD HH:mm:ss format - Display all timestamps using browser's local timezone - Update PipelineRunner to use workspace directory for command execution - Add workspace status card showing directory path, size, Git info - Enhance CreateProjectModal with repository URL validation
231 lines
15 KiB
TypeScript
231 lines
15 KiB
TypeScript
|
||
/* !!! This is code generated by Prisma. Do not edit directly. !!! */
|
||
/* eslint-disable */
|
||
// biome-ignore-all lint: generated file
|
||
// @ts-nocheck
|
||
/*
|
||
* WARNING: This is an internal file that is subject to change!
|
||
*
|
||
* 🛑 Under no circumstances should you import this file directly! 🛑
|
||
*
|
||
* Please import the `PrismaClient` class from the `client.ts` file instead.
|
||
*/
|
||
|
||
import * as runtime from "@prisma/client/runtime/client"
|
||
import type * as Prisma from "./prismaNamespace.ts"
|
||
|
||
|
||
const config: runtime.GetPrismaClientConfig = {
|
||
"previewFeatures": [],
|
||
"clientVersion": "7.0.0",
|
||
"engineVersion": "0c19ccc313cf9911a90d99d2ac2eb0280c76c513",
|
||
"activeProvider": "sqlite",
|
||
"inlineSchema": "// This is your Prisma schema file,\n// learn more about it in the docs: https://pris.ly/d/prisma-schema\n\ngenerator client {\n provider = \"prisma-client\"\n output = \"../generated\"\n}\n\ndatasource db {\n provider = \"sqlite\"\n}\n\nmodel Project {\n id Int @id @default(autoincrement())\n name String\n description String?\n repository String\n projectDir String @unique // 项目工作目录路径(必填)\n // Relations\n deployments Deployment[]\n pipelines Pipeline[]\n\n valid Int @default(1)\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n createdBy String\n updatedBy String\n}\n\nmodel User {\n id Int @id @default(autoincrement())\n username String\n login String\n email String\n avatar_url String?\n active Boolean @default(true)\n valid Int @default(1)\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n createdBy String @default(\"system\")\n updatedBy String @default(\"system\")\n}\n\nmodel Pipeline {\n id Int @id @default(autoincrement())\n name String\n description String?\n valid Int @default(1)\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n createdBy String\n updatedBy String\n\n // Relations\n projectId Int?\n Project Project? @relation(fields: [projectId], references: [id])\n steps Step[]\n}\n\nmodel Step {\n id Int @id @default(autoincrement())\n name String\n order Int\n script String // 执行的脚本命令\n valid Int @default(1)\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n createdBy String\n updatedBy String\n\n pipelineId Int\n pipeline Pipeline @relation(fields: [pipelineId], references: [id])\n}\n\nmodel Deployment {\n id Int @id @default(autoincrement())\n branch String\n env String?\n status String // pending, running, success, failed, cancelled\n commitHash String?\n commitMessage String?\n buildLog String?\n sparseCheckoutPaths String? // 稀疏检出路径,用于monorepo项目\n startedAt DateTime @default(now())\n finishedAt DateTime?\n valid Int @default(1)\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n createdBy String\n updatedBy String\n\n projectId Int\n Project Project? @relation(fields: [projectId], references: [id])\n pipelineId Int\n}\n",
|
||
"runtimeDataModel": {
|
||
"models": {},
|
||
"enums": {},
|
||
"types": {}
|
||
}
|
||
}
|
||
|
||
config.runtimeDataModel = JSON.parse("{\"models\":{\"Project\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"description\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"repository\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"projectDir\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"deployments\",\"kind\":\"object\",\"type\":\"Deployment\",\"relationName\":\"DeploymentToProject\"},{\"name\":\"pipelines\",\"kind\":\"object\",\"type\":\"Pipeline\",\"relationName\":\"PipelineToProject\"},{\"name\":\"valid\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"createdBy\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"updatedBy\",\"kind\":\"scalar\",\"type\":\"String\"}],\"dbName\":null},\"User\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"username\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"login\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"email\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"avatar_url\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"active\",\"kind\":\"scalar\",\"type\":\"Boolean\"},{\"name\":\"valid\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"createdBy\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"updatedBy\",\"kind\":\"scalar\",\"type\":\"String\"}],\"dbName\":null},\"Pipeline\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"description\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"valid\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"createdBy\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"updatedBy\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"projectId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"Project\",\"kind\":\"object\",\"type\":\"Project\",\"relationName\":\"PipelineToProject\"},{\"name\":\"steps\",\"kind\":\"object\",\"type\":\"Step\",\"relationName\":\"PipelineToStep\"}],\"dbName\":null},\"Step\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"order\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"script\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"valid\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"createdBy\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"updatedBy\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"pipelineId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"pipeline\",\"kind\":\"object\",\"type\":\"Pipeline\",\"relationName\":\"PipelineToStep\"}],\"dbName\":null},\"Deployment\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"branch\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"env\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"status\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"commitHash\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"commitMessage\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"buildLog\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"sparseCheckoutPaths\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"startedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"finishedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"valid\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"createdBy\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"updatedBy\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"projectId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"Project\",\"kind\":\"object\",\"type\":\"Project\",\"relationName\":\"DeploymentToProject\"},{\"name\":\"pipelineId\",\"kind\":\"scalar\",\"type\":\"Int\"}],\"dbName\":null}},\"enums\":{},\"types\":{}}")
|
||
|
||
async function decodeBase64AsWasm(wasmBase64: string): Promise<WebAssembly.Module> {
|
||
const { Buffer } = await import('node:buffer')
|
||
const wasmArray = Buffer.from(wasmBase64, 'base64')
|
||
return new WebAssembly.Module(wasmArray)
|
||
}
|
||
|
||
config.compilerWasm = {
|
||
getRuntime: async () => await import("@prisma/client/runtime/query_compiler_bg.sqlite.mjs"),
|
||
|
||
getQueryCompilerWasmModule: async () => {
|
||
const { wasm } = await import("@prisma/client/runtime/query_compiler_bg.sqlite.wasm-base64.mjs")
|
||
return await decodeBase64AsWasm(wasm)
|
||
}
|
||
}
|
||
|
||
|
||
|
||
export type LogOptions<ClientOptions extends Prisma.PrismaClientOptions> =
|
||
'log' extends keyof ClientOptions ? ClientOptions['log'] extends Array<Prisma.LogLevel | Prisma.LogDefinition> ? Prisma.GetEvents<ClientOptions['log']> : never : never
|
||
|
||
export interface PrismaClientConstructor {
|
||
/**
|
||
* ## Prisma Client
|
||
*
|
||
* Type-safe database client for TypeScript
|
||
* @example
|
||
* ```
|
||
* const prisma = new PrismaClient()
|
||
* // Fetch zero or more Projects
|
||
* const projects = await prisma.project.findMany()
|
||
* ```
|
||
*
|
||
* Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client).
|
||
*/
|
||
|
||
new <
|
||
Options extends Prisma.PrismaClientOptions = Prisma.PrismaClientOptions,
|
||
LogOpts extends LogOptions<Options> = LogOptions<Options>,
|
||
OmitOpts extends Prisma.PrismaClientOptions['omit'] = Options extends { omit: infer U } ? U : Prisma.PrismaClientOptions['omit'],
|
||
ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs
|
||
>(options: Prisma.Subset<Options, Prisma.PrismaClientOptions> ): PrismaClient<LogOpts, OmitOpts, ExtArgs>
|
||
}
|
||
|
||
/**
|
||
* ## Prisma Client
|
||
*
|
||
* Type-safe database client for TypeScript
|
||
* @example
|
||
* ```
|
||
* const prisma = new PrismaClient()
|
||
* // Fetch zero or more Projects
|
||
* const projects = await prisma.project.findMany()
|
||
* ```
|
||
*
|
||
* Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client).
|
||
*/
|
||
|
||
export interface PrismaClient<
|
||
in LogOpts extends Prisma.LogLevel = never,
|
||
in out OmitOpts extends Prisma.PrismaClientOptions['omit'] = undefined,
|
||
in out ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs
|
||
> {
|
||
[K: symbol]: { types: Prisma.TypeMap<ExtArgs>['other'] }
|
||
|
||
$on<V extends LogOpts>(eventType: V, callback: (event: V extends 'query' ? Prisma.QueryEvent : Prisma.LogEvent) => void): PrismaClient;
|
||
|
||
/**
|
||
* Connect with the database
|
||
*/
|
||
$connect(): runtime.Types.Utils.JsPromise<void>;
|
||
|
||
/**
|
||
* Disconnect from the database
|
||
*/
|
||
$disconnect(): runtime.Types.Utils.JsPromise<void>;
|
||
|
||
/**
|
||
* Executes a prepared raw query and returns the number of affected rows.
|
||
* @example
|
||
* ```
|
||
* const result = await prisma.$executeRaw`UPDATE User SET cool = ${true} WHERE email = ${'user@email.com'};`
|
||
* ```
|
||
*
|
||
* Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/raw-database-access).
|
||
*/
|
||
$executeRaw<T = unknown>(query: TemplateStringsArray | Prisma.Sql, ...values: any[]): Prisma.PrismaPromise<number>;
|
||
|
||
/**
|
||
* Executes a raw query and returns the number of affected rows.
|
||
* Susceptible to SQL injections, see documentation.
|
||
* @example
|
||
* ```
|
||
* const result = await prisma.$executeRawUnsafe('UPDATE User SET cool = $1 WHERE email = $2 ;', true, 'user@email.com')
|
||
* ```
|
||
*
|
||
* Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/raw-database-access).
|
||
*/
|
||
$executeRawUnsafe<T = unknown>(query: string, ...values: any[]): Prisma.PrismaPromise<number>;
|
||
|
||
/**
|
||
* Performs a prepared raw query and returns the `SELECT` data.
|
||
* @example
|
||
* ```
|
||
* const result = await prisma.$queryRaw`SELECT * FROM User WHERE id = ${1} OR email = ${'user@email.com'};`
|
||
* ```
|
||
*
|
||
* Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/raw-database-access).
|
||
*/
|
||
$queryRaw<T = unknown>(query: TemplateStringsArray | Prisma.Sql, ...values: any[]): Prisma.PrismaPromise<T>;
|
||
|
||
/**
|
||
* Performs a raw query and returns the `SELECT` data.
|
||
* Susceptible to SQL injections, see documentation.
|
||
* @example
|
||
* ```
|
||
* const result = await prisma.$queryRawUnsafe('SELECT * FROM User WHERE id = $1 OR email = $2;', 1, 'user@email.com')
|
||
* ```
|
||
*
|
||
* Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/raw-database-access).
|
||
*/
|
||
$queryRawUnsafe<T = unknown>(query: string, ...values: any[]): Prisma.PrismaPromise<T>;
|
||
|
||
|
||
/**
|
||
* Allows the running of a sequence of read/write operations that are guaranteed to either succeed or fail as a whole.
|
||
* @example
|
||
* ```
|
||
* const [george, bob, alice] = await prisma.$transaction([
|
||
* prisma.user.create({ data: { name: 'George' } }),
|
||
* prisma.user.create({ data: { name: 'Bob' } }),
|
||
* prisma.user.create({ data: { name: 'Alice' } }),
|
||
* ])
|
||
* ```
|
||
*
|
||
* Read more in our [docs](https://www.prisma.io/docs/concepts/components/prisma-client/transactions).
|
||
*/
|
||
$transaction<P extends Prisma.PrismaPromise<any>[]>(arg: [...P], options?: { isolationLevel?: Prisma.TransactionIsolationLevel }): runtime.Types.Utils.JsPromise<runtime.Types.Utils.UnwrapTuple<P>>
|
||
|
||
$transaction<R>(fn: (prisma: Omit<PrismaClient, runtime.ITXClientDenyList>) => runtime.Types.Utils.JsPromise<R>, options?: { maxWait?: number, timeout?: number, isolationLevel?: Prisma.TransactionIsolationLevel }): runtime.Types.Utils.JsPromise<R>
|
||
|
||
$extends: runtime.Types.Extensions.ExtendsHook<"extends", Prisma.TypeMapCb<OmitOpts>, ExtArgs, runtime.Types.Utils.Call<Prisma.TypeMapCb<OmitOpts>, {
|
||
extArgs: ExtArgs
|
||
}>>
|
||
|
||
/**
|
||
* `prisma.project`: Exposes CRUD operations for the **Project** model.
|
||
* Example usage:
|
||
* ```ts
|
||
* // Fetch zero or more Projects
|
||
* const projects = await prisma.project.findMany()
|
||
* ```
|
||
*/
|
||
get project(): Prisma.ProjectDelegate<ExtArgs, { omit: OmitOpts }>;
|
||
|
||
/**
|
||
* `prisma.user`: Exposes CRUD operations for the **User** model.
|
||
* Example usage:
|
||
* ```ts
|
||
* // Fetch zero or more Users
|
||
* const users = await prisma.user.findMany()
|
||
* ```
|
||
*/
|
||
get user(): Prisma.UserDelegate<ExtArgs, { omit: OmitOpts }>;
|
||
|
||
/**
|
||
* `prisma.pipeline`: Exposes CRUD operations for the **Pipeline** model.
|
||
* Example usage:
|
||
* ```ts
|
||
* // Fetch zero or more Pipelines
|
||
* const pipelines = await prisma.pipeline.findMany()
|
||
* ```
|
||
*/
|
||
get pipeline(): Prisma.PipelineDelegate<ExtArgs, { omit: OmitOpts }>;
|
||
|
||
/**
|
||
* `prisma.step`: Exposes CRUD operations for the **Step** model.
|
||
* Example usage:
|
||
* ```ts
|
||
* // Fetch zero or more Steps
|
||
* const steps = await prisma.step.findMany()
|
||
* ```
|
||
*/
|
||
get step(): Prisma.StepDelegate<ExtArgs, { omit: OmitOpts }>;
|
||
|
||
/**
|
||
* `prisma.deployment`: Exposes CRUD operations for the **Deployment** model.
|
||
* Example usage:
|
||
* ```ts
|
||
* // Fetch zero or more Deployments
|
||
* const deployments = await prisma.deployment.findMany()
|
||
* ```
|
||
*/
|
||
get deployment(): Prisma.DeploymentDelegate<ExtArgs, { omit: OmitOpts }>;
|
||
}
|
||
|
||
export function getPrismaClientClass(): PrismaClientConstructor {
|
||
return runtime.getPrismaClient(config) as unknown as PrismaClientConstructor
|
||
}
|