The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 04:45 UTC
| 1 | import * as Effect from "effect/Effect"; |
| 2 | import { PrismaClient, type PrismaManagementClient } from "./Client.ts"; |
| 3 | import * as LogsClient from "./internal/LogsClient.ts"; |
| 4 | import type { |
| 5 | AppCreateInput, |
| 6 | AppDeploymentTarget, |
| 7 | AppUpdateInput, |
| 8 | BranchCreateInput, |
| 9 | BranchUpdateInput, |
| 10 | BucketCreateInput, |
| 11 | BucketKeyCreateInput, |
| 12 | BuildLogsQuery, |
| 13 | DatabaseConnectionCreateInput, |
| 14 | DeploymentCreateInput, |
| 15 | DeploymentLogsQuery, |
| 16 | ConnectionCreateInput, |
| 17 | CustomDomainCreateInput, |
| 18 | DatabaseCreateInput, |
| 19 | DatabaseUpdateInput, |
| 20 | EnvironmentVariableCreateInput, |
| 21 | EnvironmentVariableUpdateInput, |
| 22 | PrismaBranchIdFilter, |
| 23 | ProjectCreateInput, |
| 24 | ProjectDatabaseCreateInput, |
| 25 | ProjectTransferInput, |
| 26 | ProjectUpdateInput, |
| 27 | RestoreDatabaseInput, |
| 28 | ScmInstallIntentCreateInput, |
| 29 | SourceRepositoryCreateInput, |
| 30 | } from "./Types.ts"; |
| 31 | |
| 32 | const withClient = <A, E, R>(f: (client: PrismaManagementClient) => Effect.Effect<A, E, R>) => |
| 33 | Effect.flatMap(PrismaClient, f); |
| 34 | |
| 35 | export const listWorkspaces = (query?: { cursor?: string | null; limit?: number }) => |
| 36 | withClient((client) => client.listWorkspaces(query)); |
| 37 | export const getWorkspace = (id: string) => withClient((client) => client.getWorkspace(id)); |
| 38 | export const getCurrentPrincipal = () => withClient((client) => client.getCurrentPrincipal()); |
| 39 | |
| 40 | export const listRegions = (query?: { product?: "postgres" | "accelerate" }) => |
| 41 | withClient((client) => client.listRegions(query)); |
| 42 | export const listPostgresRegions = () => withClient((client) => client.listPostgresRegions()); |
| 43 | export const listAccelerateRegions = () => withClient((client) => client.listAccelerateRegions()); |
| 44 | |
| 45 | export const listProjects = (query?: { cursor?: string | null; limit?: number }) => |
| 46 | withClient((client) => client.listProjects(query)); |
| 47 | export const getProject = (id: string) => withClient((client) => client.getProject(id)); |
| 48 | export const createProject = (input: ProjectCreateInput) => |
| 49 | withClient((client) => client.createProject(input)); |
| 50 | export const updateProject = (id: string, input: ProjectUpdateInput) => |
| 51 | withClient((client) => client.updateProject(id, input)); |
| 52 | export const deleteProject = (id: string) => withClient((client) => client.deleteProject(id)); |
| 53 | export const transferProject = (id: string, input: ProjectTransferInput) => |
| 54 | withClient((client) => client.transferProject(id, input)); |
| 55 | |
| 56 | export const listDatabases = (query?: { |
| 57 | cursor?: string | null; |
| 58 | limit?: number; |
| 59 | projectId?: string; |
| 60 | branchId?: PrismaBranchIdFilter; |
| 61 | branchGitName?: string; |
| 62 | }) => withClient((client) => client.listDatabases(query)); |
| 63 | export const listProjectDatabases = ( |
| 64 | projectId: string, |
| 65 | query?: { cursor?: string | null; limit?: number }, |
| 66 | ) => withClient((client) => client.listProjectDatabases(projectId, query)); |
| 67 | export const getDatabase = (id: string) => withClient((client) => client.getDatabase(id)); |
| 68 | export const createDatabase = (input: DatabaseCreateInput) => |
| 69 | withClient((client) => client.createDatabase(input)); |
| 70 | export const createProjectDatabase = (projectId: string, input: ProjectDatabaseCreateInput) => |
| 71 | withClient((client) => client.createProjectDatabase(projectId, input)); |
| 72 | export const updateDatabase = (id: string, input: DatabaseUpdateInput) => |
| 73 | withClient((client) => client.updateDatabase(id, input)); |
| 74 | export const deleteDatabase = (id: string) => withClient((client) => client.deleteDatabase(id)); |
| 75 | export const listBackups = (databaseId: string, query?: { limit?: number }) => |
| 76 | withClient((client) => client.listBackups(databaseId, query)); |
| 77 | export const restoreDatabase = (targetDatabaseId: string, input: RestoreDatabaseInput) => |
| 78 | withClient((client) => client.restoreDatabase(targetDatabaseId, input)); |
| 79 | export const getDatabaseUsage = ( |
| 80 | databaseId: string, |
| 81 | query?: { startDate?: string; endDate?: string }, |
| 82 | ) => withClient((client) => client.getDatabaseUsage(databaseId, query)); |
| 83 | |
| 84 | export const listConnections = (query?: { |
| 85 | cursor?: string | null; |
| 86 | limit?: number; |
| 87 | databaseId?: string; |
| 88 | }) => withClient((client) => client.listConnections(query)); |
| 89 | export const listDatabaseConnections = ( |
| 90 | databaseId: string, |
| 91 | query?: { cursor?: string | null; limit?: number }, |
| 92 | ) => withClient((client) => client.listDatabaseConnections(databaseId, query)); |
| 93 | export const getConnection = (id: string) => withClient((client) => client.getConnection(id)); |
| 94 | export const createConnection = (input: ConnectionCreateInput) => |
| 95 | withClient((client) => client.createConnection(input)); |
| 96 | export const createDatabaseConnection = ( |
| 97 | databaseId: string, |
| 98 | input: DatabaseConnectionCreateInput, |
| 99 | ) => withClient((client) => client.createDatabaseConnection(databaseId, input)); |
| 100 | export const deleteConnection = (id: string) => withClient((client) => client.deleteConnection(id)); |
| 101 | export const rotateConnection = (id: string) => withClient((client) => client.rotateConnection(id)); |
| 102 | |
| 103 | export const listBranches = ( |
| 104 | projectId: string, |
| 105 | query?: { |
| 106 | cursor?: string | null; |
| 107 | limit?: number; |
| 108 | gitName?: string; |
| 109 | gitNameContains?: string; |
| 110 | }, |
| 111 | ) => withClient((client) => client.listBranches(projectId, query)); |
| 112 | export const getBranch = (id: string) => withClient((client) => client.getBranch(id)); |
| 113 | export const createBranch = (projectId: string, input: BranchCreateInput) => |
| 114 | withClient((client) => client.createBranch(projectId, input)); |
| 115 | export const updateBranch = (id: string, input: BranchUpdateInput) => |
| 116 | withClient((client) => client.updateBranch(id, input)); |
| 117 | export const deleteBranch = (id: string) => withClient((client) => client.deleteBranch(id)); |
| 118 | |
| 119 | export const listBuckets = (query?: { |
| 120 | cursor?: string | null; |
| 121 | limit?: number; |
| 122 | projectId?: string; |
| 123 | branchId?: PrismaBranchIdFilter; |
| 124 | branchGitName?: string; |
| 125 | }) => withClient((client) => client.listBuckets(query)); |
| 126 | export const getBucket = (id: string) => withClient((client) => client.getBucket(id)); |
| 127 | export const createBucket = (input: BucketCreateInput) => |
| 128 | withClient((client) => client.createBucket(input)); |
| 129 | export const deleteBucket = (id: string) => withClient((client) => client.deleteBucket(id)); |
| 130 | export const listBucketKeys = ( |
| 131 | bucketId: string, |
| 132 | query?: { cursor?: string | null; limit?: number }, |
| 133 | ) => withClient((client) => client.listBucketKeys(bucketId, query)); |
| 134 | export const createBucketKey = (bucketId: string, input: BucketKeyCreateInput) => |
| 135 | withClient((client) => client.createBucketKey(bucketId, input)); |
| 136 | export const deleteBucketKey = (bucketId: string, keyId: string) => |
| 137 | withClient((client) => client.deleteBucketKey(bucketId, keyId)); |
| 138 | |
| 139 | export const getCustomDomain = (id: string) => withClient((client) => client.getCustomDomain(id)); |
| 140 | export const deleteCustomDomain = (id: string) => |
| 141 | withClient((client) => client.deleteCustomDomain(id)); |
| 142 | export const retryCustomDomain = (id: string) => |
| 143 | withClient((client) => client.retryCustomDomain(id)); |
| 144 | |
| 145 | export const listApps = (query?: { |
| 146 | cursor?: string | null; |
| 147 | limit?: number; |
| 148 | projectId?: string; |
| 149 | branchId?: PrismaBranchIdFilter; |
| 150 | branchGitName?: string; |
| 151 | }) => withClient((client) => client.listApps(query)); |
| 152 | export const getApp = (id: string) => withClient((client) => client.getApp(id)); |
| 153 | export const createApp = (input: AppCreateInput) => withClient((client) => client.createApp(input)); |
| 154 | export const updateApp = (id: string, input: AppUpdateInput) => |
| 155 | withClient((client) => client.updateApp(id, input)); |
| 156 | export const deleteApp = (id: string) => withClient((client) => client.deleteApp(id)); |
| 157 | export const promoteApp = (id: string, target: AppDeploymentTarget) => |
| 158 | withClient((client) => client.promoteApp(id, target)); |
| 159 | export const rollbackApp = (id: string, target: AppDeploymentTarget) => |
| 160 | withClient((client) => client.rollbackApp(id, target)); |
| 161 | export const listAppDomains = (appId: string) => |
| 162 | withClient((client) => client.listAppDomains(appId)); |
| 163 | export const createAppDomain = (appId: string, input: CustomDomainCreateInput) => |
| 164 | withClient((client) => client.createAppDomain(appId, input)); |
| 165 | export const listAppDeployments = ( |
| 166 | appId: string, |
| 167 | query?: { cursor?: string | null; limit?: number }, |
| 168 | ) => withClient((client) => client.listAppDeployments(appId, query)); |
| 169 | export const createAppDeployment = (appId: string, input?: DeploymentCreateInput) => |
| 170 | withClient((client) => client.createAppDeployment(appId, input)); |
| 171 | export const getDeployment = (id: string) => withClient((client) => client.getDeployment(id)); |
| 172 | export const deleteDeployment = (id: string) => withClient((client) => client.deleteDeployment(id)); |
| 173 | export const startDeployment = (id: string) => withClient((client) => client.startDeployment(id)); |
| 174 | export const stopDeployment = (id: string) => withClient((client) => client.stopDeployment(id)); |
| 175 | export const getDeploymentLogsRequest = (id: string, query?: DeploymentLogsQuery) => |
| 176 | LogsClient.getDeploymentLogsRequest(id, query); |
| 177 | export const getBuildLogsRequest = (buildId: string, query?: BuildLogsQuery) => |
| 178 | LogsClient.getBuildLogsRequest(buildId, query); |
| 179 | |
| 180 | export const listEnvironmentVariables = (query?: { |
| 181 | cursor?: string | null; |
| 182 | limit?: number; |
| 183 | projectId?: string; |
| 184 | class?: "production" | "preview"; |
| 185 | key?: string; |
| 186 | branchId?: string; |
| 187 | }) => withClient((client) => client.listEnvironmentVariables(query)); |
| 188 | export const getEnvironmentVariable = (id: string) => |
| 189 | withClient((client) => client.getEnvironmentVariable(id)); |
| 190 | export const createEnvironmentVariable = (input: EnvironmentVariableCreateInput) => |
| 191 | withClient((client) => client.createEnvironmentVariable(input)); |
| 192 | export const updateEnvironmentVariable = (id: string, input: EnvironmentVariableUpdateInput) => |
| 193 | withClient((client) => client.updateEnvironmentVariable(id, input)); |
| 194 | export const deleteEnvironmentVariable = (id: string) => |
| 195 | withClient((client) => client.deleteEnvironmentVariable(id)); |
| 196 | |
| 197 | export const listIntegrations = (query: { |
| 198 | workspaceId: string; |
| 199 | cursor?: string | null; |
| 200 | limit?: number; |
| 201 | }) => withClient((client) => client.listIntegrations(query)); |
| 202 | export const listWorkspaceIntegrations = ( |
| 203 | workspaceId: string, |
| 204 | query?: { cursor?: string | null; limit?: number }, |
| 205 | ) => withClient((client) => client.listWorkspaceIntegrations(workspaceId, query)); |
| 206 | export const getIntegration = (id: string) => withClient((client) => client.getIntegration(id)); |
| 207 | export const deleteIntegration = (id: string) => |
| 208 | withClient((client) => client.deleteIntegration(id)); |
| 209 | export const revokeWorkspaceIntegration = (workspaceId: string, clientId: string) => |
| 210 | withClient((client) => client.revokeWorkspaceIntegration(workspaceId, clientId)); |
| 211 | |
| 212 | export const listScmInstallations = (query: { |
| 213 | workspaceId: string; |
| 214 | cursor?: string | null; |
| 215 | limit?: number; |
| 216 | }) => withClient((client) => client.listScmInstallations(query)); |
| 217 | export const createScmInstallIntent = (input: ScmInstallIntentCreateInput) => |
| 218 | withClient((client) => client.createScmInstallIntent(input)); |
| 219 | export const listScmInstallationRepositories = ( |
| 220 | installationId: string, |
| 221 | query?: { cursor?: string | null; limit?: number }, |
| 222 | ) => withClient((client) => client.listScmInstallationRepositories(installationId, query)); |
| 223 | |
| 224 | export const listSourceRepositories = (query: { |
| 225 | projectId: string; |
| 226 | cursor?: string | null; |
| 227 | limit?: number; |
| 228 | }) => withClient((client) => client.listSourceRepositories(query)); |
| 229 | export const getSourceRepository = (id: string) => |
| 230 | withClient((client) => client.getSourceRepository(id)); |
| 231 | export const createSourceRepository = (input: SourceRepositoryCreateInput) => |
| 232 | withClient((client) => client.createSourceRepository(input)); |
| 233 | export const deleteSourceRepository = (id: string) => |
| 234 | withClient((client) => client.deleteSourceRepository(id)); |