From 553c45e1247231ce9e858270d4ae0c3498883805 Mon Sep 17 00:00:00 2001 From: Vivian Phung Date: Sat, 22 Jun 2024 18:56:53 -0400 Subject: [PATCH] addProjectFromTemplate on backend --- packages/backend/src/resolvers.ts | 21 ++ packages/backend/src/schema.gql | 12 + packages/backend/src/service.ts | 52 ++- packages/backend/src/types.ts | 10 +- .../projects/create/template/index.tsx | 42 +-- packages/gql-client/dist/index.d.mts | 13 +- packages/gql-client/dist/index.d.ts | 13 +- packages/gql-client/dist/index.js | 143 +++++--- packages/gql-client/dist/index.js.map | 2 +- packages/gql-client/dist/index.mjs | 143 +++++--- packages/gql-client/dist/index.mjs.map | 2 +- packages/gql-client/src/client.ts | 15 + packages/gql-client/src/mutations.ts | 134 ++++--- packages/gql-client/src/types.ts | 347 +++++++++--------- 14 files changed, 579 insertions(+), 370 deletions(-) diff --git a/packages/backend/src/resolvers.ts b/packages/backend/src/resolvers.ts index 9ddfed0a..971ee73a 100644 --- a/packages/backend/src/resolvers.ts +++ b/packages/backend/src/resolvers.ts @@ -6,6 +6,7 @@ import { Permission } from './entity/ProjectMember'; import { Domain } from './entity/Domain'; import { Project } from './entity/Project'; import { EnvironmentVariable } from './entity/EnvironmentVariable'; +import { AddProjectFromTemplateInput } from './types'; const log = debug('snowball:resolver'); @@ -197,6 +198,26 @@ export const createResolvers = async (service: Service): Promise => { } }, + addProjectFromTemplate: async ( + _: any, + { + organizationSlug, + data, + }: { organizationSlug: string; data: AddProjectFromTemplateInput }, + context: any, + ) => { + try { + return await service.addProjectFromTemplate( + context.user, + organizationSlug, + data, + ); + } catch (err) { + log(err); + throw err; + } + }, + addProject: async ( _: any, { diff --git a/packages/backend/src/schema.gql b/packages/backend/src/schema.gql index 7aa47991..e7e9d4bd 100644 --- a/packages/backend/src/schema.gql +++ b/packages/backend/src/schema.gql @@ -130,6 +130,14 @@ input AddEnvironmentVariableInput { value: String! } +input AddProjectFromTemplateInput { + templateOwner: String! + templateRepo: String! + owner: String! + name: String! + isPrivate: Boolean! +} + input AddProjectInput { name: String! repository: String! @@ -204,6 +212,10 @@ type Mutation { ): Boolean! removeEnvironmentVariable(environmentVariableId: String!): Boolean! updateDeploymentToProd(deploymentId: String!): Boolean! + addProjectFromTemplate( + organizationSlug: String! + data: AddProjectFromTemplateInput + ): Project! addProject(organizationSlug: String!, data: AddProjectInput): Project! updateProject(projectId: String!, data: UpdateProjectInput): Boolean! redeployToProd(deploymentId: String!): Boolean! diff --git a/packages/backend/src/service.ts b/packages/backend/src/service.ts index 692ee577..6eba446d 100644 --- a/packages/backend/src/service.ts +++ b/packages/backend/src/service.ts @@ -16,6 +16,7 @@ import { User } from './entity/User'; import { Registry } from './registry'; import { GitHubConfig, RegistryConfig } from './config'; import { + AddProjectFromTemplateInput, AppDeploymentRecord, AppDeploymentRemovalRecord, GitPushEventPayload, @@ -643,6 +644,53 @@ export class Service { return newDeployment; } + async addProjectFromTemplate( + user: User, + organizationSlug: string, + data: AddProjectFromTemplateInput, + ): Promise { + try { + const octokit = await this.getOctokit(user.id); + + const gitRepo = await octokit?.rest.repos.createUsingTemplate({ + template_owner: data.templateOwner, + template_repo: data.templateRepo, + owner: data.owner, + name: data.name, + include_all_branches: false, + private: data.isPrivate, + }); + + if (!gitRepo) { + throw new Error('Failed to create repository from template'); + } + + const createdTemplateRepo = await octokit.rest.repos.get({ + owner: data.owner, + repo: data.name, + }); + + const prodBranch = createdTemplateRepo.data.default_branch ?? 'main'; + + const project = await this.addProject(user, organizationSlug, { + name: `${gitRepo.data.owner!.login}-${gitRepo.data.name}`, + prodBranch, + repository: gitRepo.data.full_name, + // TODO: Set selected template + template: 'webapp', + }); + + if (!project || !project.id) { + throw new Error('Failed to create project from template'); + } + + return project; + } catch (error) { + console.error('Error creating project from template:', error); + throw error; + } + } + async addProject( user: User, organizationSlug: string, @@ -672,7 +720,7 @@ export class Service { }); // Create deployment with prod branch and latest commit - await this.createDeployment(user.id, octokit, { + const deployment = await this.createDeployment(user.id, octokit, { project, branch: project.prodBranch, environment: Environment.Production, @@ -683,6 +731,8 @@ export class Service { await this.createRepoHook(octokit, project); + console.log('projectid is', project.id); + return project; } diff --git a/packages/backend/src/types.ts b/packages/backend/src/types.ts index fecb4a61..12a02776 100644 --- a/packages/backend/src/types.ts +++ b/packages/backend/src/types.ts @@ -41,7 +41,7 @@ export interface AppDeploymentRecordAttributes { export interface AppDeploymentRemovalRecordAttributes { deployment: string; request: string; - type: "ApplicationDeploymentRemovalRecord"; + type: 'ApplicationDeploymentRemovalRecord'; version: string; } @@ -61,3 +61,11 @@ export interface AppDeploymentRecord extends RegistryRecord { export interface AppDeploymentRemovalRecord extends RegistryRecord { attributes: AppDeploymentRemovalRecordAttributes; } + +export interface AddProjectFromTemplateInput { + templateOwner: string; + templateRepo: string; + owner: string; + name: string; + isPrivate: boolean; +} diff --git a/packages/frontend/src/pages/org-slug/projects/create/template/index.tsx b/packages/frontend/src/pages/org-slug/projects/create/template/index.tsx index 0d598af6..63a22051 100644 --- a/packages/frontend/src/pages/org-slug/projects/create/template/index.tsx +++ b/packages/frontend/src/pages/org-slug/projects/create/template/index.tsx @@ -50,36 +50,22 @@ const CreateRepo = () => { assert(template.repoFullName, 'Template URL not provided'); const [owner, repo] = template.repoFullName.split('/'); - // TODO: Handle this functionality in backend - const gitRepo = await octokit?.rest.repos.createUsingTemplate({ - template_owner: owner, - template_repo: repo, - owner: data.account, - name: data.repoName, - include_all_branches: false, - private: data.isPrivate, - }); + setIsLoading(true); - if (!gitRepo) { - return; - } + const { addProjectFromTemplate } = await client.addProjectFromTemplate( + orgSlug!, + { + templateOwner: owner, + templateRepo: repo, + owner: data.account, + name: data.repoName, + isPrivate: false, + }, + ); - // Refetch to always get correct default branch - const templateRepo = await octokit.rest.repos.get({ - owner: template.repoFullName.split('/')[0], - repo: template.repoFullName.split('/')[1], - }); - const prodBranch = templateRepo.data.default_branch ?? 'main'; - - const { addProject } = await client.addProject(orgSlug!, { - name: `${gitRepo.data.owner!.login}-${gitRepo.data.name}`, - prodBranch, - repository: gitRepo.data.full_name, - // TODO: Set selected template - template: 'webapp', - }); - - navigate(`deploy?projectId=${addProject.id}&templateId=${template.id}`); + navigate( + `deploy?projectId=${addProjectFromTemplate.id}&templateId=${template.id}`, + ); } catch (err) { setIsLoading(false); diff --git a/packages/gql-client/dist/index.d.mts b/packages/gql-client/dist/index.d.mts index 1e299f8a..ee46a614 100644 --- a/packages/gql-client/dist/index.d.mts +++ b/packages/gql-client/dist/index.d.mts @@ -185,6 +185,9 @@ type RemoveEnvironmentVariableResponse = { type UpdateDeploymentToProdResponse = { updateDeploymentToProd: boolean; }; +type AddProjectFromTemplateResponse = { + addProjectFromTemplate: Project; +}; type AddProjectResponse = { addProject: Project; }; @@ -200,6 +203,13 @@ type DeleteProjectResponse = { type DeleteDomainResponse = { deleteDomain: boolean; }; +type AddProjectFromTemplateInput = { + templateOwner: string; + templateRepo: string; + owner: string; + name: string; + isPrivate: boolean; +}; type AddProjectInput = { name: string; repository: string; @@ -267,6 +277,7 @@ declare class GQLClient { updateEnvironmentVariable(environmentVariableId: string, data: UpdateEnvironmentVariableInput): Promise; removeEnvironmentVariable(environmentVariableId: string): Promise; updateDeploymentToProd(deploymentId: string): Promise; + addProjectFromTemplate(organizationSlug: string, data: AddProjectFromTemplateInput): Promise; addProject(organizationSlug: string, data: AddProjectInput): Promise; updateProject(projectId: string, data: UpdateProjectInput): Promise; updateDomain(domainId: string, data: UpdateDomainInput): Promise; @@ -281,4 +292,4 @@ declare class GQLClient { unauthenticateGithub(): Promise; } -export { type AddDomainInput, type AddDomainResponse, type AddEnvironmentVariableInput, type AddEnvironmentVariablesResponse, type AddProjectInput, type AddProjectMemberInput, type AddProjectMemberResponse, type AddProjectResponse, type AuthenticateGitHubResponse, type DeleteDeploymentResponse, type DeleteDomainResponse, type DeleteProjectResponse, type Deployment, DeploymentStatus, type Domain, DomainStatus, Environment, type EnvironmentVariable, type FilterDomainInput, GQLClient, type GetDeploymentsResponse, type GetDomainsResponse, type GetEnvironmentVariablesResponse, type GetOrganizationsResponse, type GetProjectMembersResponse, type GetProjectResponse, type GetProjectsInOrganizationResponse, type GetUserResponse, type GraphQLConfig, type Organization, type OrganizationMember, type OrganizationProject, Permission, type Project, type ProjectMember, type RedeployToProdResponse, type RemoveEnvironmentVariableResponse, type RemoveProjectMemberResponse, Role, type RollbackDeploymentResponse, type SearchProjectsResponse, type UnauthenticateGitHubResponse, type UpdateDeploymentToProdResponse, type UpdateDomainInput, type UpdateDomainResponse, type UpdateEnvironmentVariableInput, type UpdateEnvironmentVariableResponse, type UpdateProjectInput, type UpdateProjectMemberInput, type UpdateProjectMemberResponse, type UpdateProjectResponse, type User }; +export { type AddDomainInput, type AddDomainResponse, type AddEnvironmentVariableInput, type AddEnvironmentVariablesResponse, type AddProjectFromTemplateInput, type AddProjectFromTemplateResponse, type AddProjectInput, type AddProjectMemberInput, type AddProjectMemberResponse, type AddProjectResponse, type AuthenticateGitHubResponse, type DeleteDeploymentResponse, type DeleteDomainResponse, type DeleteProjectResponse, type Deployment, DeploymentStatus, type Domain, DomainStatus, Environment, type EnvironmentVariable, type FilterDomainInput, GQLClient, type GetDeploymentsResponse, type GetDomainsResponse, type GetEnvironmentVariablesResponse, type GetOrganizationsResponse, type GetProjectMembersResponse, type GetProjectResponse, type GetProjectsInOrganizationResponse, type GetUserResponse, type GraphQLConfig, type Organization, type OrganizationMember, type OrganizationProject, Permission, type Project, type ProjectMember, type RedeployToProdResponse, type RemoveEnvironmentVariableResponse, type RemoveProjectMemberResponse, Role, type RollbackDeploymentResponse, type SearchProjectsResponse, type UnauthenticateGitHubResponse, type UpdateDeploymentToProdResponse, type UpdateDomainInput, type UpdateDomainResponse, type UpdateEnvironmentVariableInput, type UpdateEnvironmentVariableResponse, type UpdateProjectInput, type UpdateProjectMemberInput, type UpdateProjectMemberResponse, type UpdateProjectResponse, type User }; diff --git a/packages/gql-client/dist/index.d.ts b/packages/gql-client/dist/index.d.ts index 1e299f8a..ee46a614 100644 --- a/packages/gql-client/dist/index.d.ts +++ b/packages/gql-client/dist/index.d.ts @@ -185,6 +185,9 @@ type RemoveEnvironmentVariableResponse = { type UpdateDeploymentToProdResponse = { updateDeploymentToProd: boolean; }; +type AddProjectFromTemplateResponse = { + addProjectFromTemplate: Project; +}; type AddProjectResponse = { addProject: Project; }; @@ -200,6 +203,13 @@ type DeleteProjectResponse = { type DeleteDomainResponse = { deleteDomain: boolean; }; +type AddProjectFromTemplateInput = { + templateOwner: string; + templateRepo: string; + owner: string; + name: string; + isPrivate: boolean; +}; type AddProjectInput = { name: string; repository: string; @@ -267,6 +277,7 @@ declare class GQLClient { updateEnvironmentVariable(environmentVariableId: string, data: UpdateEnvironmentVariableInput): Promise; removeEnvironmentVariable(environmentVariableId: string): Promise; updateDeploymentToProd(deploymentId: string): Promise; + addProjectFromTemplate(organizationSlug: string, data: AddProjectFromTemplateInput): Promise; addProject(organizationSlug: string, data: AddProjectInput): Promise; updateProject(projectId: string, data: UpdateProjectInput): Promise; updateDomain(domainId: string, data: UpdateDomainInput): Promise; @@ -281,4 +292,4 @@ declare class GQLClient { unauthenticateGithub(): Promise; } -export { type AddDomainInput, type AddDomainResponse, type AddEnvironmentVariableInput, type AddEnvironmentVariablesResponse, type AddProjectInput, type AddProjectMemberInput, type AddProjectMemberResponse, type AddProjectResponse, type AuthenticateGitHubResponse, type DeleteDeploymentResponse, type DeleteDomainResponse, type DeleteProjectResponse, type Deployment, DeploymentStatus, type Domain, DomainStatus, Environment, type EnvironmentVariable, type FilterDomainInput, GQLClient, type GetDeploymentsResponse, type GetDomainsResponse, type GetEnvironmentVariablesResponse, type GetOrganizationsResponse, type GetProjectMembersResponse, type GetProjectResponse, type GetProjectsInOrganizationResponse, type GetUserResponse, type GraphQLConfig, type Organization, type OrganizationMember, type OrganizationProject, Permission, type Project, type ProjectMember, type RedeployToProdResponse, type RemoveEnvironmentVariableResponse, type RemoveProjectMemberResponse, Role, type RollbackDeploymentResponse, type SearchProjectsResponse, type UnauthenticateGitHubResponse, type UpdateDeploymentToProdResponse, type UpdateDomainInput, type UpdateDomainResponse, type UpdateEnvironmentVariableInput, type UpdateEnvironmentVariableResponse, type UpdateProjectInput, type UpdateProjectMemberInput, type UpdateProjectMemberResponse, type UpdateProjectResponse, type User }; +export { type AddDomainInput, type AddDomainResponse, type AddEnvironmentVariableInput, type AddEnvironmentVariablesResponse, type AddProjectFromTemplateInput, type AddProjectFromTemplateResponse, type AddProjectInput, type AddProjectMemberInput, type AddProjectMemberResponse, type AddProjectResponse, type AuthenticateGitHubResponse, type DeleteDeploymentResponse, type DeleteDomainResponse, type DeleteProjectResponse, type Deployment, DeploymentStatus, type Domain, DomainStatus, Environment, type EnvironmentVariable, type FilterDomainInput, GQLClient, type GetDeploymentsResponse, type GetDomainsResponse, type GetEnvironmentVariablesResponse, type GetOrganizationsResponse, type GetProjectMembersResponse, type GetProjectResponse, type GetProjectsInOrganizationResponse, type GetUserResponse, type GraphQLConfig, type Organization, type OrganizationMember, type OrganizationProject, Permission, type Project, type ProjectMember, type RedeployToProdResponse, type RemoveEnvironmentVariableResponse, type RemoveProjectMemberResponse, Role, type RollbackDeploymentResponse, type SearchProjectsResponse, type UnauthenticateGitHubResponse, type UpdateDeploymentToProdResponse, type UpdateDomainInput, type UpdateDomainResponse, type UpdateEnvironmentVariableInput, type UpdateEnvironmentVariableResponse, type UpdateProjectInput, type UpdateProjectMemberInput, type UpdateProjectMemberResponse, type UpdateProjectResponse, type User }; diff --git a/packages/gql-client/dist/index.js b/packages/gql-client/dist/index.js index 0e162256..3cdbb860 100644 --- a/packages/gql-client/dist/index.js +++ b/packages/gql-client/dist/index.js @@ -267,93 +267,112 @@ query ($projectId: String!, $filter: FilterDomainsInput) { // src/mutations.ts var import_client2 = require("@apollo/client"); var removeProjectMember = import_client2.gql` -mutation ($projectMemberId: String!) { - removeProjectMember(projectMemberId: $projectMemberId) -} + mutation ($projectMemberId: String!) { + removeProjectMember(projectMemberId: $projectMemberId) + } `; var updateProjectMember = import_client2.gql` -mutation ($projectMemberId: String!, $data: UpdateProjectMemberInput) { - updateProjectMember(projectMemberId: $projectMemberId, data: $data) -} + mutation ($projectMemberId: String!, $data: UpdateProjectMemberInput) { + updateProjectMember(projectMemberId: $projectMemberId, data: $data) + } `; var addProjectMember = import_client2.gql` -mutation ($projectId: String!, $data: AddProjectMemberInput) { - addProjectMember(projectId: $projectId, data: $data) -} + mutation ($projectId: String!, $data: AddProjectMemberInput) { + addProjectMember(projectId: $projectId, data: $data) + } `; var addEnvironmentVariables = import_client2.gql` -mutation ($projectId: String!, $data: [AddEnvironmentVariableInput!]) { - addEnvironmentVariables(projectId: $projectId, data: $data) -} + mutation ($projectId: String!, $data: [AddEnvironmentVariableInput!]) { + addEnvironmentVariables(projectId: $projectId, data: $data) + } `; var updateEnvironmentVariable = import_client2.gql` -mutation ($environmentVariableId: String!, $data: UpdateEnvironmentVariableInput!) { - updateEnvironmentVariable(environmentVariableId: $environmentVariableId, data: $data) -} + mutation ( + $environmentVariableId: String! + $data: UpdateEnvironmentVariableInput! + ) { + updateEnvironmentVariable( + environmentVariableId: $environmentVariableId + data: $data + ) + } `; var removeEnvironmentVariable = import_client2.gql` -mutation ($environmentVariableId: String!) { - removeEnvironmentVariable(environmentVariableId: $environmentVariableId) -} + mutation ($environmentVariableId: String!) { + removeEnvironmentVariable(environmentVariableId: $environmentVariableId) + } `; var updateDeploymentToProd = import_client2.gql` -mutation ($deploymentId: String!) { - updateDeploymentToProd(deploymentId: $deploymentId) -} + mutation ($deploymentId: String!) { + updateDeploymentToProd(deploymentId: $deploymentId) + } +`; +var addProjectFromTemplate = import_client2.gql` + mutation ($organizationSlug: String!, $data: AddProjectFromTemplateInput) { + addProjectFromTemplate(organizationSlug: $organizationSlug, data: $data) { + id + } + } `; var addProject = import_client2.gql` -mutation ($organizationSlug: String!, $data: AddProjectInput) { - addProject(organizationSlug: $organizationSlug, data: $data) { - id + mutation ($organizationSlug: String!, $data: AddProjectInput) { + addProject(organizationSlug: $organizationSlug, data: $data) { + id + } } -}`; +`; var updateProjectMutation = import_client2.gql` -mutation ($projectId: String!, $data: UpdateProjectInput) { - updateProject(projectId: $projectId, data: $data) -}`; + mutation ($projectId: String!, $data: UpdateProjectInput) { + updateProject(projectId: $projectId, data: $data) + } +`; var updateDomainMutation = import_client2.gql` -mutation ($domainId: String!, $data: UpdateDomainInput!) { - updateDomain(domainId: $domainId, data: $data) -}`; + mutation ($domainId: String!, $data: UpdateDomainInput!) { + updateDomain(domainId: $domainId, data: $data) + } +`; var redeployToProd = import_client2.gql` -mutation ($deploymentId: String!) { - redeployToProd(deploymentId: $deploymentId) -} + mutation ($deploymentId: String!) { + redeployToProd(deploymentId: $deploymentId) + } `; var deleteProject = import_client2.gql` -mutation ($projectId: String!) { - deleteProject(projectId: $projectId) -} + mutation ($projectId: String!) { + deleteProject(projectId: $projectId) + } `; var deleteDomain = import_client2.gql` -mutation ($domainId: String!) { - deleteDomain(domainId: $domainId) -}`; + mutation ($domainId: String!) { + deleteDomain(domainId: $domainId) + } +`; var rollbackDeployment = import_client2.gql` -mutation ($projectId: String! ,$deploymentId: String!) { - rollbackDeployment(projectId: $projectId, deploymentId: $deploymentId) -} + mutation ($projectId: String!, $deploymentId: String!) { + rollbackDeployment(projectId: $projectId, deploymentId: $deploymentId) + } `; var deleteDeployment = import_client2.gql` -mutation ($deploymentId: String!) { - deleteDeployment(deploymentId: $deploymentId) -} + mutation ($deploymentId: String!) { + deleteDeployment(deploymentId: $deploymentId) + } `; var addDomain = import_client2.gql` -mutation ($projectId: String!, $data: AddDomainInput!) { - addDomain(projectId: $projectId, data: $data) -} + mutation ($projectId: String!, $data: AddDomainInput!) { + addDomain(projectId: $projectId, data: $data) + } `; var authenticateGitHub = import_client2.gql` -mutation ($code: String!) { - authenticateGitHub(code: $code) { - token + mutation ($code: String!) { + authenticateGitHub(code: $code) { + token + } } -}`; +`; var unauthenticateGitHub = import_client2.gql` -mutation { - unauthenticateGitHub -}`; + mutation { + unauthenticateGitHub + } +`; // src/client.ts var defaultOptions = { @@ -538,6 +557,18 @@ var GQLClient = class { return data; }); } + addProjectFromTemplate(organizationSlug, data) { + return __async(this, null, function* () { + const result = yield this.client.mutate({ + mutation: addProjectFromTemplate, + variables: { + organizationSlug, + data + } + }); + return result.data; + }); + } addProject(organizationSlug, data) { return __async(this, null, function* () { const result = yield this.client.mutate({ diff --git a/packages/gql-client/dist/index.js.map b/packages/gql-client/dist/index.js.map index 36d83c02..17a478b4 100644 --- a/packages/gql-client/dist/index.js.map +++ b/packages/gql-client/dist/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/index.ts","../src/client.ts","../src/queries.ts","../src/mutations.ts","../src/types.ts"],"sourcesContent":["export * from \"./client\";\nexport * from \"./types\";\n","import {\n ApolloClient,\n DefaultOptions,\n InMemoryCache,\n NormalizedCacheObject,\n} from \"@apollo/client\";\n\nimport * as queries from \"./queries\";\nimport * as types from \"./types\";\nimport * as mutations from \"./mutations\";\n\nexport interface GraphQLConfig {\n gqlEndpoint: string;\n}\n\n// TODO: check options\nconst defaultOptions: DefaultOptions = {\n watchQuery: {\n fetchPolicy: \"no-cache\",\n errorPolicy: \"ignore\",\n },\n query: {\n fetchPolicy: \"no-cache\",\n errorPolicy: \"all\",\n },\n};\n\nexport class GQLClient {\n private client: ApolloClient;\n\n constructor(config: GraphQLConfig) {\n this.client = new ApolloClient({\n uri: config.gqlEndpoint,\n cache: new InMemoryCache(),\n defaultOptions,\n credentials: \"include\",\n });\n }\n\n async getUser(): Promise {\n const { data } = await this.client.query({\n query: queries.getUser,\n });\n\n return data;\n }\n\n async getProject(projectId: string): Promise {\n const { data } = await this.client.query({\n query: queries.getProject,\n variables: {\n projectId,\n },\n });\n\n return data;\n }\n\n async getProjectsInOrganization(\n organizationSlug: string\n ): Promise {\n const { data } = await this.client.query({\n query: queries.getProjectsInOrganization,\n variables: {\n organizationSlug,\n },\n });\n\n return data;\n }\n\n async getOrganizations(): Promise {\n const { data } = await this.client.query({\n query: queries.getOrganizations,\n });\n\n return data;\n }\n\n async getDeployments(\n projectId: string\n ): Promise {\n const { data } = await this.client.query({\n query: queries.getDeployments,\n variables: {\n projectId,\n },\n });\n\n return data;\n }\n\n async getEnvironmentVariables(\n projectId: string\n ): Promise {\n const { data } = await this.client.query({\n query: queries.getEnvironmentVariables,\n variables: {\n projectId,\n },\n });\n\n return data;\n }\n\n async getProjectMembers(\n projectId: string\n ): Promise {\n const result = await this.client.query({\n query: queries.getProjectMembers,\n variables: {\n projectId,\n },\n });\n\n return result.data;\n }\n\n async addProjectMember(\n projectId: string,\n data: types.AddProjectMemberInput\n ): Promise {\n const result = await this.client.mutate({\n mutation: mutations.addProjectMember,\n variables: {\n projectId,\n data,\n },\n });\n\n return result.data;\n }\n\n async updateProjectMember(\n projectMemberId: string,\n data: types.UpdateProjectMemberInput\n ): Promise {\n const result = await this.client.mutate({\n mutation: mutations.updateProjectMember,\n variables: {\n projectMemberId,\n data,\n },\n });\n\n return result.data;\n }\n\n async removeProjectMember(\n projectMemberId: string\n ): Promise {\n const result = await this.client.mutate({\n mutation: mutations.removeProjectMember,\n variables: {\n projectMemberId,\n },\n });\n\n return result.data;\n }\n\n async searchProjects(\n searchText: string\n ): Promise {\n const { data } = await this.client.query({\n query: queries.searchProjects,\n variables: {\n searchText,\n },\n });\n\n return data;\n }\n\n async addEnvironmentVariables(\n projectId: string,\n data: types.AddEnvironmentVariableInput[]\n ): Promise {\n const result = await this.client.mutate({\n mutation: mutations.addEnvironmentVariables,\n variables: {\n projectId,\n data,\n },\n });\n\n return result.data;\n }\n\n async updateEnvironmentVariable(\n environmentVariableId: string,\n data: types.UpdateEnvironmentVariableInput\n ): Promise {\n const result = await this.client.mutate({\n mutation: mutations.updateEnvironmentVariable,\n variables: {\n environmentVariableId,\n data,\n },\n });\n\n return result.data;\n }\n\n async removeEnvironmentVariable(\n environmentVariableId: string\n ): Promise {\n const { data } = await this.client.mutate({\n mutation: mutations.removeEnvironmentVariable,\n variables: {\n environmentVariableId,\n },\n });\n\n return data;\n }\n\n async updateDeploymentToProd(\n deploymentId: string\n ): Promise {\n const { data } = await this.client.mutate({\n mutation: mutations.updateDeploymentToProd,\n variables: {\n deploymentId,\n },\n });\n\n return data;\n }\n\n async addProject(\n organizationSlug: string,\n data: types.AddProjectInput\n ): Promise {\n const result = await this.client.mutate({\n mutation: mutations.addProject,\n variables: {\n organizationSlug,\n data,\n },\n });\n\n return result.data;\n }\n\n async updateProject(\n projectId: string,\n data: types.UpdateProjectInput\n ): Promise {\n const result = await this.client.mutate({\n mutation: mutations.updateProjectMutation,\n variables: {\n projectId,\n data,\n },\n });\n\n return result.data;\n }\n\n async updateDomain(\n domainId: string,\n data: types.UpdateDomainInput\n ): Promise {\n const result = await this.client.mutate({\n mutation: mutations.updateDomainMutation,\n variables: {\n domainId,\n data,\n },\n });\n\n return result.data;\n }\n\n async redeployToProd(\n deploymentId: string\n ): Promise {\n const { data } = await this.client.mutate({\n mutation: mutations.redeployToProd,\n variables: {\n deploymentId,\n },\n });\n\n return data;\n }\n\n async deleteProject(projectId: string): Promise {\n const { data } = await this.client.mutate({\n mutation: mutations.deleteProject,\n variables: {\n projectId,\n },\n });\n\n return data;\n }\n\n async deleteDomain(domainId: string): Promise {\n const { data } = await this.client.mutate({\n mutation: mutations.deleteDomain,\n variables: {\n domainId,\n },\n });\n\n return data;\n }\n\n async rollbackDeployment(\n projectId: string,\n deploymentId: string\n ): Promise {\n const { data } = await this.client.mutate({\n mutation: mutations.rollbackDeployment,\n variables: {\n projectId,\n deploymentId,\n },\n });\n\n return data;\n }\n\n async deleteDeployment(\n deploymentId: string\n ): Promise {\n const { data } = await this.client.mutate({\n mutation: mutations.deleteDeployment,\n variables: {\n deploymentId,\n },\n });\n\n return data;\n }\n\n async addDomain(\n projectId: string,\n data: types.AddDomainInput\n ): Promise {\n const result = await this.client.mutate({\n mutation: mutations.addDomain,\n variables: {\n projectId,\n data,\n },\n });\n\n return result.data;\n }\n\n async getDomains(\n projectId: string,\n filter?: types.FilterDomainInput\n ): Promise {\n const { data } = await this.client.query({\n query: queries.getDomains,\n variables: {\n projectId,\n filter,\n },\n });\n\n return data;\n }\n\n async authenticateGitHub(\n code: string\n ): Promise {\n const { data } = await this.client.mutate({\n mutation: mutations.authenticateGitHub,\n variables: {\n code,\n },\n });\n\n return data;\n }\n\n async unauthenticateGithub(): Promise {\n const { data } = await this.client.mutate({\n mutation: mutations.unauthenticateGitHub,\n });\n\n return data;\n }\n}\n","import { gql } from '@apollo/client';\n\nexport const getUser = gql`\nquery {\n user {\n id\n name\n email\n createdAt\n updatedAt\n gitHubToken\n }\n}\n`;\n\nexport const getProject = gql`\nquery ($projectId: String!) {\n project(projectId: $projectId) {\n createdAt\n description\n id\n name\n template\n updatedAt\n prodBranch\n framework\n repository\n webhooks\n icon\n subDomain\n organization {\n id\n name\n }\n owner {\n id\n name\n email\n }\n deployments {\n id\n branch\n isCurrent\n status\n updatedAt\n commitHash\n createdAt\n environment\n domain {\n status\n branch\n createdAt\n updatedAt\n id\n name\n }\n createdBy {\n id\n name\n }\n }\n }\n}\n`;\n\nexport const getProjectsInOrganization = gql`\nquery ($organizationSlug: String!) {\n projectsInOrganization(organizationSlug: $organizationSlug) {\n id\n name\n createdAt\n description\n framework\n prodBranch\n webhooks\n repository\n updatedAt\n icon\n subDomain\n deployments {\n id\n branch\n isCurrent\n status\n updatedAt\n commitHash\n commitMessage\n createdAt\n environment\n domain {\n status\n branch\n createdAt\n updatedAt\n id\n name\n }\n }\n }\n}\n`;\n\nexport const getOrganizations = gql`\nquery {\n organizations {\n id\n name\n slug\n createdAt\n updatedAt\n }\n}\n`;\n\nexport const getDeployments = gql`\nquery ($projectId: String!) {\n deployments(projectId: $projectId) {\n id\n domain{\n branch\n createdAt\n id\n name\n status\n updatedAt\n }\n branch\n commitHash\n commitMessage\n url\n environment\n isCurrent\n status\n createdAt\n updatedAt\n createdBy {\n id\n name\n email\n }\n }\n}\n`;\n\nexport const getEnvironmentVariables = gql`\nquery ($projectId: String!) {\n environmentVariables(projectId: $projectId) {\n createdAt\n environment\n id\n key\n updatedAt\n value\n }\n}\n`;\n\nexport const getProjectMembers = gql`\nquery ($projectId: String!) {\n projectMembers(projectId: $projectId) {\n id\n member {\n id\n name\n email\n isVerified\n }\n isPending\n createdAt\n updatedAt\n permissions\n }\n}\n`;\n\nexport const searchProjects = gql`\nquery ($searchText: String!) {\n searchProjects(searchText: $searchText) {\n id\n name\n prodBranch\n repository\n createdAt\n description\n framework\n prodBranch\n webhooks\n updatedAt\n template\n repository\n organization {\n id\n name\n slug\n createdAt\n updatedAt\n }\n }\n}\n`;\n\nexport const getDomains = gql`\nquery ($projectId: String!, $filter: FilterDomainsInput) {\n domains(projectId: $projectId, filter: $filter) {\n branch\n createdAt\n redirectTo {\n id\n name\n branch\n status\n }\n id\n name\n status\n updatedAt\n }\n}\n`;\n","import { gql } from '@apollo/client';\n\nexport const removeProjectMember = gql`\nmutation ($projectMemberId: String!) {\n removeProjectMember(projectMemberId: $projectMemberId)\n}\n`;\n\nexport const updateProjectMember = gql`\nmutation ($projectMemberId: String!, $data: UpdateProjectMemberInput) {\n updateProjectMember(projectMemberId: $projectMemberId, data: $data)\n}\n`;\n\nexport const addProjectMember = gql`\nmutation ($projectId: String!, $data: AddProjectMemberInput) {\n addProjectMember(projectId: $projectId, data: $data)\n}\n`;\n\nexport const addEnvironmentVariables = gql`\nmutation ($projectId: String!, $data: [AddEnvironmentVariableInput!]) {\n addEnvironmentVariables(projectId: $projectId, data: $data)\n}\n`;\n\nexport const updateEnvironmentVariable = gql`\nmutation ($environmentVariableId: String!, $data: UpdateEnvironmentVariableInput!) {\n updateEnvironmentVariable(environmentVariableId: $environmentVariableId, data: $data)\n}\n`;\n\nexport const removeEnvironmentVariable = gql`\nmutation ($environmentVariableId: String!) {\n removeEnvironmentVariable(environmentVariableId: $environmentVariableId)\n}\n`;\n\nexport const updateDeploymentToProd = gql`\nmutation ($deploymentId: String!) {\n updateDeploymentToProd(deploymentId: $deploymentId)\n}\n`;\n\nexport const addProject = gql`\nmutation ($organizationSlug: String!, $data: AddProjectInput) {\n addProject(organizationSlug: $organizationSlug, data: $data) {\n id\n }\n}`;\n\nexport const updateProjectMutation = gql`\nmutation ($projectId: String!, $data: UpdateProjectInput) {\n updateProject(projectId: $projectId, data: $data)\n}`;\n\nexport const updateDomainMutation = gql`\nmutation ($domainId: String!, $data: UpdateDomainInput!) {\n updateDomain(domainId: $domainId, data: $data)\n}`;\n\nexport const redeployToProd = gql`\nmutation ($deploymentId: String!) {\n redeployToProd(deploymentId: $deploymentId)\n}\n`;\n\nexport const deleteProject = gql`\nmutation ($projectId: String!) {\n deleteProject(projectId: $projectId)\n}\n`;\n\nexport const deleteDomain = gql`\nmutation ($domainId: String!) {\n deleteDomain(domainId: $domainId)\n}`;\n\nexport const rollbackDeployment = gql`\nmutation ($projectId: String! ,$deploymentId: String!) {\n rollbackDeployment(projectId: $projectId, deploymentId: $deploymentId)\n}\n`;\n\nexport const deleteDeployment = gql`\nmutation ($deploymentId: String!) {\n deleteDeployment(deploymentId: $deploymentId)\n}\n`;\n\nexport const addDomain = gql`\nmutation ($projectId: String!, $data: AddDomainInput!) {\n addDomain(projectId: $projectId, data: $data)\n}\n`;\n\nexport const authenticateGitHub = gql`\nmutation ($code: String!) {\n authenticateGitHub(code: $code) {\n token\n }\n}`;\n\nexport const unauthenticateGitHub = gql`\nmutation {\n unauthenticateGitHub\n}`;\n","// Note: equivalent to types present in GQL schema\n\nexport enum Role {\n Owner = 'Owner',\n Maintainer = 'Maintainer',\n Reader = 'Reader',\n}\n\nexport enum Permission {\n View = 'View',\n Edit = 'Edit',\n}\n\nexport enum Environment {\n Production = 'Production',\n Preview = 'Preview',\n Development = 'Development',\n}\n\nexport enum DeploymentStatus {\n Building = 'Building',\n Ready = 'Ready',\n Error = 'Error',\n Deleting = 'Deleting'\n}\n\nexport enum DomainStatus {\n Live = 'Live',\n Pending = 'Pending',\n}\n\nexport type EnvironmentVariable = {\n id: string\n environment: Environment\n key: string\n value: string\n createdAt: string\n updatedAt: string\n}\n\nexport type Domain = {\n id: string\n branch: string\n name: string\n status: DomainStatus\n redirectTo: Domain | null\n createdAt: string\n updatedAt: string\n}\n\nexport type User = {\n id: string\n name: string | null\n email: string\n isVerified: boolean\n createdAt: string\n updatedAt: string\n gitHubToken: string | null\n}\n\nexport type Deployment = {\n id: string\n domain: Domain\n branch: string\n commitHash: string\n commitMessage: string\n url?: string\n environment: Environment\n isCurrent: boolean\n status: DeploymentStatus\n createdBy: User\n createdAt: string\n updatedAt: string\n}\n\nexport type OrganizationMember = {\n id: string\n member: User\n role: Role\n createdAt: string\n updatedAt: string\n}\n\nexport type ProjectMember = {\n id: string\n member: User\n permissions: Permission[]\n isPending: boolean\n createdAt: string\n updatedAt: string\n}\n\nexport type OrganizationProject = {\n id: string\n owner: User\n deployments: Deployment[]\n name: string\n repository: string\n prodBranch: string\n description: string\n template: string\n framework: string\n webhooks: string[]\n members: ProjectMember[]\n environmentVariables: EnvironmentVariable[]\n createdAt: string\n updatedAt: string\n}\n\nexport type Organization = {\n id: string\n name: string\n slug: string\n projects: OrganizationProject[]\n createdAt: string\n updatedAt: string\n members: OrganizationMember[]\n}\n\nexport type Project = {\n id: string\n owner: User\n deployments: Deployment[]\n name: string\n repository: string\n prodBranch: string\n description: string\n template: string\n framework: string\n webhooks: string[]\n members: ProjectMember[]\n environmentVariables: EnvironmentVariable[]\n createdAt: string\n updatedAt: string\n organization: Organization\n icon: string\n subDomain: string\n}\n\nexport type GetProjectMembersResponse = {\n projectMembers: ProjectMember[]\n}\n\nexport type AddProjectMemberResponse = {\n addProjectMember: boolean\n}\n\nexport type RemoveProjectMemberResponse = {\n removeProjectMember: boolean;\n}\n\nexport type UpdateProjectMemberResponse = {\n updateProjectMember: boolean;\n}\n\nexport type GetDeploymentsResponse = {\n deployments: Deployment[]\n}\n\nexport type GetEnvironmentVariablesResponse = {\n environmentVariables: EnvironmentVariable[]\n}\n\nexport type GetOrganizationsResponse = {\n organizations: Organization[]\n}\n\nexport type GetUserResponse = {\n user: User\n}\n\nexport type GetProjectResponse = {\n project: Project | null\n}\n\nexport type GetProjectsInOrganizationResponse = {\n projectsInOrganization: Project[]\n}\n\nexport type GetDomainsResponse = {\n domains: Domain[]\n}\n\nexport type SearchProjectsResponse = {\n searchProjects: Project[]\n}\n\nexport type AddEnvironmentVariablesResponse = {\n addEnvironmentVariables: boolean;\n}\n\nexport type AddEnvironmentVariableInput = {\n environments: string[];\n key: string;\n value: string;\n}\n\nexport type UpdateEnvironmentVariableInput = {\n key: string;\n value: string;\n}\n\nexport type UpdateProjectMemberInput = {\n permissions: Permission[];\n}\n\nexport type AddProjectMemberInput = {\n email: string;\n permissions: Permission[]\n}\n\nexport type UpdateEnvironmentVariableResponse = {\n updateEnvironmentVariable: boolean;\n}\n\nexport type RemoveEnvironmentVariableResponse = {\n removeEnvironmentVariable: boolean;\n}\n\nexport type UpdateDeploymentToProdResponse = {\n updateDeploymentToProd: boolean;\n}\n\nexport type AddProjectResponse = {\n addProject: Project\n}\n\nexport type UpdateProjectResponse = {\n updateProject: boolean;\n}\n\nexport type UpdateDomainResponse = {\n updateDomain: boolean;\n}\n\nexport type DeleteProjectResponse = {\n deleteProject: boolean;\n}\n\nexport type DeleteDomainResponse = {\n deleteDomain: boolean;\n}\n\nexport type AddProjectInput = {\n name: string;\n repository: string;\n prodBranch: string;\n template?: string;\n}\n\nexport type UpdateProjectInput = {\n name?: string\n description?: string\n prodBranch?: string\n webhooks?: string[]\n organizationId?: string\n}\n\nexport type UpdateDomainInput = {\n name?: string;\n branch?: string;\n redirectToId?: string | null;\n}\n\nexport type RedeployToProdResponse = {\n redeployToProd: boolean\n}\n\nexport type RollbackDeploymentResponse = {\n rollbackDeployment: boolean\n}\n\nexport type DeleteDeploymentResponse = {\n deleteDeployment: boolean\n}\n\nexport type AddDomainInput = {\n name: string\n}\n\nexport type FilterDomainInput = {\n branch?: string\n status?: DomainStatus\n}\n\nexport type AddDomainResponse = {\n addDomain: true\n}\n\nexport type AuthenticateGitHubResponse = {\n authenticateGitHub: {\n token: string\n }\n}\n\nexport type UnauthenticateGitHubResponse = {\n unauthenticateGitHub: boolean\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,iBAKO;;;ACLP,oBAAoB;AAEb,IAAM,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAahB,IAAM,aAAa;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAkDnB,IAAM,4BAA4B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAqClC,IAAM,mBAAmB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAYzB,IAAM,iBAAiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA8BvB,IAAM,0BAA0B;AAAA;AAAA;AAAA;AAAA;AAAA;AAA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AEM,WACJ,WACA,QACmC;AAAA;AACnC,YAAM,EAAE,KAAK,IAAI,MAAM,KAAK,OAAO,MAAM;AAAA,QACvC,OAAe;AAAA,QACf,WAAW;AAAA,UACT;AAAA,UACA;AAAA,QACF;AAAA,MACF,CAAC;AAED,aAAO;AAAA,IACT;AAAA;AAAA,EAEM,mBACJ,MAC2C;AAAA;AAC3C,YAAM,EAAE,KAAK,IAAI,MAAM,KAAK,OAAO,OAAO;AAAA,QACxC,UAAoB;AAAA,QACpB,WAAW;AAAA,UACT;AAAA,QACF;AAAA,MACF,CAAC;AAED,aAAO;AAAA,IACT;AAAA;AAAA,EAEM,uBAAoE;AAAA;AACxE,YAAM,EAAE,KAAK,IAAI,MAAM,KAAK,OAAO,OAAO;AAAA,QACxC,UAAoB;AAAA,MACtB,CAAC;AAED,aAAO;AAAA,IACT;AAAA;AACF;;;AGlYO,IAAK,OAAL,kBAAKC,UAAL;AACL,EAAAA,MAAA,WAAQ;AACR,EAAAA,MAAA,gBAAa;AACb,EAAAA,MAAA,YAAS;AAHC,SAAAA;AAAA,GAAA;AAML,IAAK,aAAL,kBAAKC,gBAAL;AACL,EAAAA,YAAA,UAAO;AACP,EAAAA,YAAA,UAAO;AAFG,SAAAA;AAAA,GAAA;AAKL,IAAK,cAAL,kBAAKC,iBAAL;AACL,EAAAA,aAAA,gBAAa;AACb,EAAAA,aAAA,aAAU;AACV,EAAAA,aAAA,iBAAc;AAHJ,SAAAA;AAAA,GAAA;AAML,IAAK,mBAAL,kBAAKC,sBAAL;AACL,EAAAA,kBAAA,cAAW;AACX,EAAAA,kBAAA,WAAQ;AACR,EAAAA,kBAAA,WAAQ;AACR,EAAAA,kBAAA,cAAW;AAJD,SAAAA;AAAA,GAAA;AAOL,IAAK,eAAL,kBAAKC,kBAAL;AACL,EAAAA,cAAA,UAAO;AACP,EAAAA,cAAA,aAAU;AAFA,SAAAA;AAAA,GAAA;","names":["import_client","import_client","Role","Permission","Environment","DeploymentStatus","DomainStatus"]} \ No newline at end of file +{"version":3,"sources":["../src/index.ts","../src/client.ts","../src/queries.ts","../src/mutations.ts","../src/types.ts"],"sourcesContent":["export * from \"./client\";\nexport * from \"./types\";\n","import {\n ApolloClient,\n DefaultOptions,\n InMemoryCache,\n NormalizedCacheObject,\n} from \"@apollo/client\";\n\nimport * as queries from \"./queries\";\nimport * as types from \"./types\";\nimport * as mutations from \"./mutations\";\n\nexport interface GraphQLConfig {\n gqlEndpoint: string;\n}\n\n// TODO: check options\nconst defaultOptions: DefaultOptions = {\n watchQuery: {\n fetchPolicy: \"no-cache\",\n errorPolicy: \"ignore\",\n },\n query: {\n fetchPolicy: \"no-cache\",\n errorPolicy: \"all\",\n },\n};\n\nexport class GQLClient {\n private client: ApolloClient;\n\n constructor(config: GraphQLConfig) {\n this.client = new ApolloClient({\n uri: config.gqlEndpoint,\n cache: new InMemoryCache(),\n defaultOptions,\n credentials: \"include\",\n });\n }\n\n async getUser(): Promise {\n const { data } = await this.client.query({\n query: queries.getUser,\n });\n\n return data;\n }\n\n async getProject(projectId: string): Promise {\n const { data } = await this.client.query({\n query: queries.getProject,\n variables: {\n projectId,\n },\n });\n\n return data;\n }\n\n async getProjectsInOrganization(\n organizationSlug: string\n ): Promise {\n const { data } = await this.client.query({\n query: queries.getProjectsInOrganization,\n variables: {\n organizationSlug,\n },\n });\n\n return data;\n }\n\n async getOrganizations(): Promise {\n const { data } = await this.client.query({\n query: queries.getOrganizations,\n });\n\n return data;\n }\n\n async getDeployments(\n projectId: string\n ): Promise {\n const { data } = await this.client.query({\n query: queries.getDeployments,\n variables: {\n projectId,\n },\n });\n\n return data;\n }\n\n async getEnvironmentVariables(\n projectId: string\n ): Promise {\n const { data } = await this.client.query({\n query: queries.getEnvironmentVariables,\n variables: {\n projectId,\n },\n });\n\n return data;\n }\n\n async getProjectMembers(\n projectId: string\n ): Promise {\n const result = await this.client.query({\n query: queries.getProjectMembers,\n variables: {\n projectId,\n },\n });\n\n return result.data;\n }\n\n async addProjectMember(\n projectId: string,\n data: types.AddProjectMemberInput\n ): Promise {\n const result = await this.client.mutate({\n mutation: mutations.addProjectMember,\n variables: {\n projectId,\n data,\n },\n });\n\n return result.data;\n }\n\n async updateProjectMember(\n projectMemberId: string,\n data: types.UpdateProjectMemberInput\n ): Promise {\n const result = await this.client.mutate({\n mutation: mutations.updateProjectMember,\n variables: {\n projectMemberId,\n data,\n },\n });\n\n return result.data;\n }\n\n async removeProjectMember(\n projectMemberId: string\n ): Promise {\n const result = await this.client.mutate({\n mutation: mutations.removeProjectMember,\n variables: {\n projectMemberId,\n },\n });\n\n return result.data;\n }\n\n async searchProjects(\n searchText: string\n ): Promise {\n const { data } = await this.client.query({\n query: queries.searchProjects,\n variables: {\n searchText,\n },\n });\n\n return data;\n }\n\n async addEnvironmentVariables(\n projectId: string,\n data: types.AddEnvironmentVariableInput[]\n ): Promise {\n const result = await this.client.mutate({\n mutation: mutations.addEnvironmentVariables,\n variables: {\n projectId,\n data,\n },\n });\n\n return result.data;\n }\n\n async updateEnvironmentVariable(\n environmentVariableId: string,\n data: types.UpdateEnvironmentVariableInput\n ): Promise {\n const result = await this.client.mutate({\n mutation: mutations.updateEnvironmentVariable,\n variables: {\n environmentVariableId,\n data,\n },\n });\n\n return result.data;\n }\n\n async removeEnvironmentVariable(\n environmentVariableId: string\n ): Promise {\n const { data } = await this.client.mutate({\n mutation: mutations.removeEnvironmentVariable,\n variables: {\n environmentVariableId,\n },\n });\n\n return data;\n }\n\n async updateDeploymentToProd(\n deploymentId: string\n ): Promise {\n const { data } = await this.client.mutate({\n mutation: mutations.updateDeploymentToProd,\n variables: {\n deploymentId,\n },\n });\n\n return data;\n }\n\n async addProjectFromTemplate(\n organizationSlug: string,\n data: types.AddProjectFromTemplateInput\n ): Promise {\n const result = await this.client.mutate({\n mutation: mutations.addProjectFromTemplate,\n variables: {\n organizationSlug,\n data,\n },\n });\n\n return result.data;\n }\n\n async addProject(\n organizationSlug: string,\n data: types.AddProjectInput\n ): Promise {\n const result = await this.client.mutate({\n mutation: mutations.addProject,\n variables: {\n organizationSlug,\n data,\n },\n });\n\n return result.data;\n }\n\n async updateProject(\n projectId: string,\n data: types.UpdateProjectInput\n ): Promise {\n const result = await this.client.mutate({\n mutation: mutations.updateProjectMutation,\n variables: {\n projectId,\n data,\n },\n });\n\n return result.data;\n }\n\n async updateDomain(\n domainId: string,\n data: types.UpdateDomainInput\n ): Promise {\n const result = await this.client.mutate({\n mutation: mutations.updateDomainMutation,\n variables: {\n domainId,\n data,\n },\n });\n\n return result.data;\n }\n\n async redeployToProd(\n deploymentId: string\n ): Promise {\n const { data } = await this.client.mutate({\n mutation: mutations.redeployToProd,\n variables: {\n deploymentId,\n },\n });\n\n return data;\n }\n\n async deleteProject(projectId: string): Promise {\n const { data } = await this.client.mutate({\n mutation: mutations.deleteProject,\n variables: {\n projectId,\n },\n });\n\n return data;\n }\n\n async deleteDomain(domainId: string): Promise {\n const { data } = await this.client.mutate({\n mutation: mutations.deleteDomain,\n variables: {\n domainId,\n },\n });\n\n return data;\n }\n\n async rollbackDeployment(\n projectId: string,\n deploymentId: string\n ): Promise {\n const { data } = await this.client.mutate({\n mutation: mutations.rollbackDeployment,\n variables: {\n projectId,\n deploymentId,\n },\n });\n\n return data;\n }\n\n async deleteDeployment(\n deploymentId: string\n ): Promise {\n const { data } = await this.client.mutate({\n mutation: mutations.deleteDeployment,\n variables: {\n deploymentId,\n },\n });\n\n return data;\n }\n\n async addDomain(\n projectId: string,\n data: types.AddDomainInput\n ): Promise {\n const result = await this.client.mutate({\n mutation: mutations.addDomain,\n variables: {\n projectId,\n data,\n },\n });\n\n return result.data;\n }\n\n async getDomains(\n projectId: string,\n filter?: types.FilterDomainInput\n ): Promise {\n const { data } = await this.client.query({\n query: queries.getDomains,\n variables: {\n projectId,\n filter,\n },\n });\n\n return data;\n }\n\n async authenticateGitHub(\n code: string\n ): Promise {\n const { data } = await this.client.mutate({\n mutation: mutations.authenticateGitHub,\n variables: {\n code,\n },\n });\n\n return data;\n }\n\n async unauthenticateGithub(): Promise {\n const { data } = await this.client.mutate({\n mutation: mutations.unauthenticateGitHub,\n });\n\n return data;\n }\n}\n","import { gql } from '@apollo/client';\n\nexport const getUser = gql`\nquery {\n user {\n id\n name\n email\n createdAt\n updatedAt\n gitHubToken\n }\n}\n`;\n\nexport const getProject = gql`\nquery ($projectId: String!) {\n project(projectId: $projectId) {\n createdAt\n description\n id\n name\n template\n updatedAt\n prodBranch\n framework\n repository\n webhooks\n icon\n subDomain\n organization {\n id\n name\n }\n owner {\n id\n name\n email\n }\n deployments {\n id\n branch\n isCurrent\n status\n updatedAt\n commitHash\n createdAt\n environment\n domain {\n status\n branch\n createdAt\n updatedAt\n id\n name\n }\n createdBy {\n id\n name\n }\n }\n }\n}\n`;\n\nexport const getProjectsInOrganization = gql`\nquery ($organizationSlug: String!) {\n projectsInOrganization(organizationSlug: $organizationSlug) {\n id\n name\n createdAt\n description\n framework\n prodBranch\n webhooks\n repository\n updatedAt\n icon\n subDomain\n deployments {\n id\n branch\n isCurrent\n status\n updatedAt\n commitHash\n commitMessage\n createdAt\n environment\n domain {\n status\n branch\n createdAt\n updatedAt\n id\n name\n }\n }\n }\n}\n`;\n\nexport const getOrganizations = gql`\nquery {\n organizations {\n id\n name\n slug\n createdAt\n updatedAt\n }\n}\n`;\n\nexport const getDeployments = gql`\nquery ($projectId: String!) {\n deployments(projectId: $projectId) {\n id\n domain{\n branch\n createdAt\n id\n name\n status\n updatedAt\n }\n branch\n commitHash\n commitMessage\n url\n environment\n isCurrent\n status\n createdAt\n updatedAt\n createdBy {\n id\n name\n email\n }\n }\n}\n`;\n\nexport const getEnvironmentVariables = gql`\nquery ($projectId: String!) {\n environmentVariables(projectId: $projectId) {\n createdAt\n environment\n id\n key\n updatedAt\n value\n }\n}\n`;\n\nexport const getProjectMembers = gql`\nquery ($projectId: String!) {\n projectMembers(projectId: $projectId) {\n id\n member {\n id\n name\n email\n isVerified\n }\n isPending\n createdAt\n updatedAt\n permissions\n }\n}\n`;\n\nexport const searchProjects = gql`\nquery ($searchText: String!) {\n searchProjects(searchText: $searchText) {\n id\n name\n prodBranch\n repository\n createdAt\n description\n framework\n prodBranch\n webhooks\n updatedAt\n template\n repository\n organization {\n id\n name\n slug\n createdAt\n updatedAt\n }\n }\n}\n`;\n\nexport const getDomains = gql`\nquery ($projectId: String!, $filter: FilterDomainsInput) {\n domains(projectId: $projectId, filter: $filter) {\n branch\n createdAt\n redirectTo {\n id\n name\n branch\n status\n }\n id\n name\n status\n updatedAt\n }\n}\n`;\n","import { gql } from \"@apollo/client\";\n\nexport const removeProjectMember = gql`\n mutation ($projectMemberId: String!) {\n removeProjectMember(projectMemberId: $projectMemberId)\n }\n`;\n\nexport const updateProjectMember = gql`\n mutation ($projectMemberId: String!, $data: UpdateProjectMemberInput) {\n updateProjectMember(projectMemberId: $projectMemberId, data: $data)\n }\n`;\n\nexport const addProjectMember = gql`\n mutation ($projectId: String!, $data: AddProjectMemberInput) {\n addProjectMember(projectId: $projectId, data: $data)\n }\n`;\n\nexport const addEnvironmentVariables = gql`\n mutation ($projectId: String!, $data: [AddEnvironmentVariableInput!]) {\n addEnvironmentVariables(projectId: $projectId, data: $data)\n }\n`;\n\nexport const updateEnvironmentVariable = gql`\n mutation (\n $environmentVariableId: String!\n $data: UpdateEnvironmentVariableInput!\n ) {\n updateEnvironmentVariable(\n environmentVariableId: $environmentVariableId\n data: $data\n )\n }\n`;\n\nexport const removeEnvironmentVariable = gql`\n mutation ($environmentVariableId: String!) {\n removeEnvironmentVariable(environmentVariableId: $environmentVariableId)\n }\n`;\n\nexport const updateDeploymentToProd = gql`\n mutation ($deploymentId: String!) {\n updateDeploymentToProd(deploymentId: $deploymentId)\n }\n`;\n\nexport const addProjectFromTemplate = gql`\n mutation ($organizationSlug: String!, $data: AddProjectFromTemplateInput) {\n addProjectFromTemplate(organizationSlug: $organizationSlug, data: $data) {\n id\n }\n }\n`;\n\nexport const addProject = gql`\n mutation ($organizationSlug: String!, $data: AddProjectInput) {\n addProject(organizationSlug: $organizationSlug, data: $data) {\n id\n }\n }\n`;\n\nexport const updateProjectMutation = gql`\n mutation ($projectId: String!, $data: UpdateProjectInput) {\n updateProject(projectId: $projectId, data: $data)\n }\n`;\n\nexport const updateDomainMutation = gql`\n mutation ($domainId: String!, $data: UpdateDomainInput!) {\n updateDomain(domainId: $domainId, data: $data)\n }\n`;\n\nexport const redeployToProd = gql`\n mutation ($deploymentId: String!) {\n redeployToProd(deploymentId: $deploymentId)\n }\n`;\n\nexport const deleteProject = gql`\n mutation ($projectId: String!) {\n deleteProject(projectId: $projectId)\n }\n`;\n\nexport const deleteDomain = gql`\n mutation ($domainId: String!) {\n deleteDomain(domainId: $domainId)\n }\n`;\n\nexport const rollbackDeployment = gql`\n mutation ($projectId: String!, $deploymentId: String!) {\n rollbackDeployment(projectId: $projectId, deploymentId: $deploymentId)\n }\n`;\n\nexport const deleteDeployment = gql`\n mutation ($deploymentId: String!) {\n deleteDeployment(deploymentId: $deploymentId)\n }\n`;\n\nexport const addDomain = gql`\n mutation ($projectId: String!, $data: AddDomainInput!) {\n addDomain(projectId: $projectId, data: $data)\n }\n`;\n\nexport const authenticateGitHub = gql`\n mutation ($code: String!) {\n authenticateGitHub(code: $code) {\n token\n }\n }\n`;\n\nexport const unauthenticateGitHub = gql`\n mutation {\n unauthenticateGitHub\n }\n`;\n","import { addProjectFromTemplate } from \"./mutations\";\n// Note: equivalent to types present in GQL schema\n\nexport enum Role {\n Owner = \"Owner\",\n Maintainer = \"Maintainer\",\n Reader = \"Reader\",\n}\n\nexport enum Permission {\n View = \"View\",\n Edit = \"Edit\",\n}\n\nexport enum Environment {\n Production = \"Production\",\n Preview = \"Preview\",\n Development = \"Development\",\n}\n\nexport enum DeploymentStatus {\n Building = \"Building\",\n Ready = \"Ready\",\n Error = \"Error\",\n Deleting = \"Deleting\",\n}\n\nexport enum DomainStatus {\n Live = \"Live\",\n Pending = \"Pending\",\n}\n\nexport type EnvironmentVariable = {\n id: string;\n environment: Environment;\n key: string;\n value: string;\n createdAt: string;\n updatedAt: string;\n};\n\nexport type Domain = {\n id: string;\n branch: string;\n name: string;\n status: DomainStatus;\n redirectTo: Domain | null;\n createdAt: string;\n updatedAt: string;\n};\n\nexport type User = {\n id: string;\n name: string | null;\n email: string;\n isVerified: boolean;\n createdAt: string;\n updatedAt: string;\n gitHubToken: string | null;\n};\n\nexport type Deployment = {\n id: string;\n domain: Domain;\n branch: string;\n commitHash: string;\n commitMessage: string;\n url?: string;\n environment: Environment;\n isCurrent: boolean;\n status: DeploymentStatus;\n createdBy: User;\n createdAt: string;\n updatedAt: string;\n};\n\nexport type OrganizationMember = {\n id: string;\n member: User;\n role: Role;\n createdAt: string;\n updatedAt: string;\n};\n\nexport type ProjectMember = {\n id: string;\n member: User;\n permissions: Permission[];\n isPending: boolean;\n createdAt: string;\n updatedAt: string;\n};\n\nexport type OrganizationProject = {\n id: string;\n owner: User;\n deployments: Deployment[];\n name: string;\n repository: string;\n prodBranch: string;\n description: string;\n template: string;\n framework: string;\n webhooks: string[];\n members: ProjectMember[];\n environmentVariables: EnvironmentVariable[];\n createdAt: string;\n updatedAt: string;\n};\n\nexport type Organization = {\n id: string;\n name: string;\n slug: string;\n projects: OrganizationProject[];\n createdAt: string;\n updatedAt: string;\n members: OrganizationMember[];\n};\n\nexport type Project = {\n id: string;\n owner: User;\n deployments: Deployment[];\n name: string;\n repository: string;\n prodBranch: string;\n description: string;\n template: string;\n framework: string;\n webhooks: string[];\n members: ProjectMember[];\n environmentVariables: EnvironmentVariable[];\n createdAt: string;\n updatedAt: string;\n organization: Organization;\n icon: string;\n subDomain: string;\n};\n\nexport type GetProjectMembersResponse = {\n projectMembers: ProjectMember[];\n};\n\nexport type AddProjectMemberResponse = {\n addProjectMember: boolean;\n};\n\nexport type RemoveProjectMemberResponse = {\n removeProjectMember: boolean;\n};\n\nexport type UpdateProjectMemberResponse = {\n updateProjectMember: boolean;\n};\n\nexport type GetDeploymentsResponse = {\n deployments: Deployment[];\n};\n\nexport type GetEnvironmentVariablesResponse = {\n environmentVariables: EnvironmentVariable[];\n};\n\nexport type GetOrganizationsResponse = {\n organizations: Organization[];\n};\n\nexport type GetUserResponse = {\n user: User;\n};\n\nexport type GetProjectResponse = {\n project: Project | null;\n};\n\nexport type GetProjectsInOrganizationResponse = {\n projectsInOrganization: Project[];\n};\n\nexport type GetDomainsResponse = {\n domains: Domain[];\n};\n\nexport type SearchProjectsResponse = {\n searchProjects: Project[];\n};\n\nexport type AddEnvironmentVariablesResponse = {\n addEnvironmentVariables: boolean;\n};\n\nexport type AddEnvironmentVariableInput = {\n environments: string[];\n key: string;\n value: string;\n};\n\nexport type UpdateEnvironmentVariableInput = {\n key: string;\n value: string;\n};\n\nexport type UpdateProjectMemberInput = {\n permissions: Permission[];\n};\n\nexport type AddProjectMemberInput = {\n email: string;\n permissions: Permission[];\n};\n\nexport type UpdateEnvironmentVariableResponse = {\n updateEnvironmentVariable: boolean;\n};\n\nexport type RemoveEnvironmentVariableResponse = {\n removeEnvironmentVariable: boolean;\n};\n\nexport type UpdateDeploymentToProdResponse = {\n updateDeploymentToProd: boolean;\n};\n\nexport type AddProjectFromTemplateResponse = {\n addProjectFromTemplate: Project;\n};\n\nexport type AddProjectResponse = {\n addProject: Project;\n};\n\nexport type UpdateProjectResponse = {\n updateProject: boolean;\n};\n\nexport type UpdateDomainResponse = {\n updateDomain: boolean;\n};\n\nexport type DeleteProjectResponse = {\n deleteProject: boolean;\n};\n\nexport type DeleteDomainResponse = {\n deleteDomain: boolean;\n};\n\nexport type AddProjectFromTemplateInput = {\n templateOwner: string;\n templateRepo: string;\n owner: string;\n name: string;\n isPrivate: boolean;\n};\n\nexport type AddProjectInput = {\n name: string;\n repository: string;\n prodBranch: string;\n template?: string;\n};\n\nexport type UpdateProjectInput = {\n name?: string;\n description?: string;\n prodBranch?: string;\n webhooks?: string[];\n organizationId?: string;\n};\n\nexport type UpdateDomainInput = {\n name?: string;\n branch?: string;\n redirectToId?: string | null;\n};\n\nexport type RedeployToProdResponse = {\n redeployToProd: boolean;\n};\n\nexport type RollbackDeploymentResponse = {\n rollbackDeployment: boolean;\n};\n\nexport type DeleteDeploymentResponse = {\n deleteDeployment: boolean;\n};\n\nexport type AddDomainInput = {\n name: string;\n};\n\nexport type FilterDomainInput = {\n branch?: string;\n status?: DomainStatus;\n};\n\nexport type AddDomainResponse = {\n addDomain: true;\n};\n\nexport type AuthenticateGitHubResponse = {\n authenticateGitHub: {\n token: string;\n };\n};\n\nexport type UnauthenticateGitHubResponse = {\n unauthenticateGitHub: boolean;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,iBAKO;;;ACLP,oBAAoB;AAEb,IAAM,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAahB,IAAM,aAAa;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAkDnB,IAAM,4BAA4B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAqClC,IAAM,mBAAmB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAYz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AAA;AAAA,GAAA;AAML,IAAK,aAAL,kBAAKC,gBAAL;AACL,EAAAA,YAAA,UAAO;AACP,EAAAA,YAAA,UAAO;AAFG,SAAAA;AAAA,GAAA;AAKL,IAAK,cAAL,kBAAKC,iBAAL;AACL,EAAAA,aAAA,gBAAa;AACb,EAAAA,aAAA,aAAU;AACV,EAAAA,aAAA,iBAAc;AAHJ,SAAAA;AAAA,GAAA;AAML,IAAK,mBAAL,kBAAKC,sBAAL;AACL,EAAAA,kBAAA,cAAW;AACX,EAAAA,kBAAA,WAAQ;AACR,EAAAA,kBAAA,WAAQ;AACR,EAAAA,kBAAA,cAAW;AAJD,SAAAA;AAAA,GAAA;AAOL,IAAK,eAAL,kBAAKC,kBAAL;AACL,EAAAA,cAAA,UAAO;AACP,EAAAA,cAAA,aAAU;AAFA,SAAAA;AAAA,GAAA;","names":["import_client","import_client","Role","Permission","Environment","DeploymentStatus","DomainStatus"]} \ No newline at end of file diff --git a/packages/gql-client/dist/index.mjs b/packages/gql-client/dist/index.mjs index acae66b7..8c30dd75 100644 --- a/packages/gql-client/dist/index.mjs +++ b/packages/gql-client/dist/index.mjs @@ -240,93 +240,112 @@ query ($projectId: String!, $filter: FilterDomainsInput) { // src/mutations.ts import { gql as gql2 } from "@apollo/client"; var removeProjectMember = gql2` -mutation ($projectMemberId: String!) { - removeProjectMember(projectMemberId: $projectMemberId) -} + mutation ($projectMemberId: String!) { + removeProjectMember(projectMemberId: $projectMemberId) + } `; var updateProjectMember = gql2` -mutation ($projectMemberId: String!, $data: UpdateProjectMemberInput) { - updateProjectMember(projectMemberId: $projectMemberId, data: $data) -} + mutation ($projectMemberId: String!, $data: UpdateProjectMemberInput) { + updateProjectMember(projectMemberId: $projectMemberId, data: $data) + } `; var addProjectMember = gql2` -mutation ($projectId: String!, $data: AddProjectMemberInput) { - addProjectMember(projectId: $projectId, data: $data) -} + mutation ($projectId: String!, $data: AddProjectMemberInput) { + addProjectMember(projectId: $projectId, data: $data) + } `; var addEnvironmentVariables = gql2` -mutation ($projectId: String!, $data: [AddEnvironmentVariableInput!]) { - addEnvironmentVariables(projectId: $projectId, data: $data) -} + mutation ($projectId: String!, $data: [AddEnvironmentVariableInput!]) { + addEnvironmentVariables(projectId: $projectId, data: $data) + } `; var updateEnvironmentVariable = gql2` -mutation ($environmentVariableId: String!, $data: UpdateEnvironmentVariableInput!) { - updateEnvironmentVariable(environmentVariableId: $environmentVariableId, data: $data) -} + mutation ( + $environmentVariableId: String! + $data: UpdateEnvironmentVariableInput! + ) { + updateEnvironmentVariable( + environmentVariableId: $environmentVariableId + data: $data + ) + } `; var removeEnvironmentVariable = gql2` -mutation ($environmentVariableId: String!) { - removeEnvironmentVariable(environmentVariableId: $environmentVariableId) -} + mutation ($environmentVariableId: String!) { + removeEnvironmentVariable(environmentVariableId: $environmentVariableId) + } `; var updateDeploymentToProd = gql2` -mutation ($deploymentId: String!) { - updateDeploymentToProd(deploymentId: $deploymentId) -} + mutation ($deploymentId: String!) { + updateDeploymentToProd(deploymentId: $deploymentId) + } +`; +var addProjectFromTemplate = gql2` + mutation ($organizationSlug: String!, $data: AddProjectFromTemplateInput) { + addProjectFromTemplate(organizationSlug: $organizationSlug, data: $data) { + id + } + } `; var addProject = gql2` -mutation ($organizationSlug: String!, $data: AddProjectInput) { - addProject(organizationSlug: $organizationSlug, data: $data) { - id + mutation ($organizationSlug: String!, $data: AddProjectInput) { + addProject(organizationSlug: $organizationSlug, data: $data) { + id + } } -}`; +`; var updateProjectMutation = gql2` -mutation ($projectId: String!, $data: UpdateProjectInput) { - updateProject(projectId: $projectId, data: $data) -}`; + mutation ($projectId: String!, $data: UpdateProjectInput) { + updateProject(projectId: $projectId, data: $data) + } +`; var updateDomainMutation = gql2` -mutation ($domainId: String!, $data: UpdateDomainInput!) { - updateDomain(domainId: $domainId, data: $data) -}`; + mutation ($domainId: String!, $data: UpdateDomainInput!) { + updateDomain(domainId: $domainId, data: $data) + } +`; var redeployToProd = gql2` -mutation ($deploymentId: String!) { - redeployToProd(deploymentId: $deploymentId) -} + mutation ($deploymentId: String!) { + redeployToProd(deploymentId: $deploymentId) + } `; var deleteProject = gql2` -mutation ($projectId: String!) { - deleteProject(projectId: $projectId) -} + mutation ($projectId: String!) { + deleteProject(projectId: $projectId) + } `; var deleteDomain = gql2` -mutation ($domainId: String!) { - deleteDomain(domainId: $domainId) -}`; + mutation ($domainId: String!) { + deleteDomain(domainId: $domainId) + } +`; var rollbackDeployment = gql2` -mutation ($projectId: String! ,$deploymentId: String!) { - rollbackDeployment(projectId: $projectId, deploymentId: $deploymentId) -} + mutation ($projectId: String!, $deploymentId: String!) { + rollbackDeployment(projectId: $projectId, deploymentId: $deploymentId) + } `; var deleteDeployment = gql2` -mutation ($deploymentId: String!) { - deleteDeployment(deploymentId: $deploymentId) -} + mutation ($deploymentId: String!) { + deleteDeployment(deploymentId: $deploymentId) + } `; var addDomain = gql2` -mutation ($projectId: String!, $data: AddDomainInput!) { - addDomain(projectId: $projectId, data: $data) -} + mutation ($projectId: String!, $data: AddDomainInput!) { + addDomain(projectId: $projectId, data: $data) + } `; var authenticateGitHub = gql2` -mutation ($code: String!) { - authenticateGitHub(code: $code) { - token + mutation ($code: String!) { + authenticateGitHub(code: $code) { + token + } } -}`; +`; var unauthenticateGitHub = gql2` -mutation { - unauthenticateGitHub -}`; + mutation { + unauthenticateGitHub + } +`; // src/client.ts var defaultOptions = { @@ -511,6 +530,18 @@ var GQLClient = class { return data; }); } + addProjectFromTemplate(organizationSlug, data) { + return __async(this, null, function* () { + const result = yield this.client.mutate({ + mutation: addProjectFromTemplate, + variables: { + organizationSlug, + data + } + }); + return result.data; + }); + } addProject(organizationSlug, data) { return __async(this, null, function* () { const result = yield this.client.mutate({ diff --git a/packages/gql-client/dist/index.mjs.map b/packages/gql-client/dist/index.mjs.map index edba632f..27047d6d 100644 --- a/packages/gql-client/dist/index.mjs.map +++ b/packages/gql-client/dist/index.mjs.map @@ -1 +1 @@ -{"version":3,"sources":["../src/client.ts","../src/queries.ts","../src/mutations.ts","../src/types.ts"],"sourcesContent":["import {\n ApolloClient,\n DefaultOptions,\n InMemoryCache,\n NormalizedCacheObject,\n} from \"@apollo/client\";\n\nimport * as queries from \"./queries\";\nimport * as types from \"./types\";\nimport * as mutations from \"./mutations\";\n\nexport interface GraphQLConfig {\n gqlEndpoint: string;\n}\n\n// TODO: check options\nconst defaultOptions: DefaultOptions = {\n watchQuery: {\n fetchPolicy: \"no-cache\",\n errorPolicy: \"ignore\",\n },\n query: {\n fetchPolicy: \"no-cache\",\n errorPolicy: \"all\",\n },\n};\n\nexport class GQLClient {\n private client: ApolloClient;\n\n constructor(config: GraphQLConfig) {\n this.client = new ApolloClient({\n uri: config.gqlEndpoint,\n cache: new InMemoryCache(),\n defaultOptions,\n credentials: \"include\",\n });\n }\n\n async getUser(): Promise {\n const { data } = await this.client.query({\n query: queries.getUser,\n });\n\n return data;\n }\n\n async getProject(projectId: string): Promise {\n const { data } = await this.client.query({\n query: queries.getProject,\n variables: {\n projectId,\n },\n });\n\n return data;\n }\n\n async getProjectsInOrganization(\n organizationSlug: string\n ): Promise {\n const { data } = await this.client.query({\n query: queries.getProjectsInOrganization,\n variables: {\n organizationSlug,\n },\n });\n\n return data;\n }\n\n async getOrganizations(): Promise {\n const { data } = await this.client.query({\n query: queries.getOrganizations,\n });\n\n return data;\n }\n\n async getDeployments(\n projectId: string\n ): Promise {\n const { data } = await this.client.query({\n query: queries.getDeployments,\n variables: {\n projectId,\n },\n });\n\n return data;\n }\n\n async getEnvironmentVariables(\n projectId: string\n ): Promise {\n const { data } = await this.client.query({\n query: queries.getEnvironmentVariables,\n variables: {\n projectId,\n },\n });\n\n return data;\n }\n\n async getProjectMembers(\n projectId: string\n ): Promise {\n const result = await this.client.query({\n query: queries.getProjectMembers,\n variables: {\n projectId,\n },\n });\n\n return result.data;\n }\n\n async addProjectMember(\n projectId: string,\n data: types.AddProjectMemberInput\n ): Promise {\n const result = await this.client.mutate({\n mutation: mutations.addProjectMember,\n variables: {\n projectId,\n data,\n },\n });\n\n return result.data;\n }\n\n async updateProjectMember(\n projectMemberId: string,\n data: types.UpdateProjectMemberInput\n ): Promise {\n const result = await this.client.mutate({\n mutation: mutations.updateProjectMember,\n variables: {\n projectMemberId,\n data,\n },\n });\n\n return result.data;\n }\n\n async removeProjectMember(\n projectMemberId: string\n ): Promise {\n const result = await this.client.mutate({\n mutation: mutations.removeProjectMember,\n variables: {\n projectMemberId,\n },\n });\n\n return result.data;\n }\n\n async searchProjects(\n searchText: string\n ): Promise {\n const { data } = await this.client.query({\n query: queries.searchProjects,\n variables: {\n searchText,\n },\n });\n\n return data;\n }\n\n async addEnvironmentVariables(\n projectId: string,\n data: types.AddEnvironmentVariableInput[]\n ): Promise {\n const result = await this.client.mutate({\n mutation: mutations.addEnvironmentVariables,\n variables: {\n projectId,\n data,\n },\n });\n\n return result.data;\n }\n\n async updateEnvironmentVariable(\n environmentVariableId: string,\n data: types.UpdateEnvironmentVariableInput\n ): Promise {\n const result = await this.client.mutate({\n mutation: mutations.updateEnvironmentVariable,\n variables: {\n environmentVariableId,\n data,\n },\n });\n\n return result.data;\n }\n\n async removeEnvironmentVariable(\n environmentVariableId: string\n ): Promise {\n const { data } = await this.client.mutate({\n mutation: mutations.removeEnvironmentVariable,\n variables: {\n environmentVariableId,\n },\n });\n\n return data;\n }\n\n async updateDeploymentToProd(\n deploymentId: string\n ): Promise {\n const { data } = await this.client.mutate({\n mutation: mutations.updateDeploymentToProd,\n variables: {\n deploymentId,\n },\n });\n\n return data;\n }\n\n async addProject(\n organizationSlug: string,\n data: types.AddProjectInput\n ): Promise {\n const result = await this.client.mutate({\n mutation: mutations.addProject,\n variables: {\n organizationSlug,\n data,\n },\n });\n\n return result.data;\n }\n\n async updateProject(\n projectId: string,\n data: types.UpdateProjectInput\n ): Promise {\n const result = await this.client.mutate({\n mutation: mutations.updateProjectMutation,\n variables: {\n projectId,\n data,\n },\n });\n\n return result.data;\n }\n\n async updateDomain(\n domainId: string,\n data: types.UpdateDomainInput\n ): Promise {\n const result = await this.client.mutate({\n mutation: mutations.updateDomainMutation,\n variables: {\n domainId,\n data,\n },\n });\n\n return result.data;\n }\n\n async redeployToProd(\n deploymentId: string\n ): Promise {\n const { data } = await this.client.mutate({\n mutation: mutations.redeployToProd,\n variables: {\n deploymentId,\n },\n });\n\n return data;\n }\n\n async deleteProject(projectId: string): Promise {\n const { data } = await this.client.mutate({\n mutation: mutations.deleteProject,\n variables: {\n projectId,\n },\n });\n\n return data;\n }\n\n async deleteDomain(domainId: string): Promise {\n const { data } = await this.client.mutate({\n mutation: mutations.deleteDomain,\n variables: {\n domainId,\n },\n });\n\n return data;\n }\n\n async rollbackDeployment(\n projectId: string,\n deploymentId: string\n ): Promise {\n const { data } = await this.client.mutate({\n mutation: mutations.rollbackDeployment,\n variables: {\n projectId,\n deploymentId,\n },\n });\n\n return data;\n }\n\n async deleteDeployment(\n deploymentId: string\n ): Promise {\n const { data } = await this.client.mutate({\n mutation: mutations.deleteDeployment,\n variables: {\n deploymentId,\n },\n });\n\n return data;\n }\n\n async addDomain(\n projectId: string,\n data: types.AddDomainInput\n ): Promise {\n const result = await this.client.mutate({\n mutation: mutations.addDomain,\n variables: {\n projectId,\n data,\n },\n });\n\n return result.data;\n }\n\n async getDomains(\n projectId: string,\n filter?: types.FilterDomainInput\n ): Promise {\n const { data } = await this.client.query({\n query: queries.getDomains,\n variables: {\n projectId,\n filter,\n },\n });\n\n return data;\n }\n\n async authenticateGitHub(\n code: string\n ): Promise {\n const { data } = await this.client.mutate({\n mutation: mutations.authenticateGitHub,\n variables: {\n code,\n },\n });\n\n return data;\n }\n\n async unauthenticateGithub(): Promise {\n const { data } = await this.client.mutate({\n mutation: mutations.unauthenticateGitHub,\n });\n\n return data;\n }\n}\n","import { gql } from '@apollo/client';\n\nexport const getUser = gql`\nquery {\n user {\n id\n name\n email\n createdAt\n updatedAt\n gitHubToken\n }\n}\n`;\n\nexport const getProject = gql`\nquery ($projectId: String!) {\n project(projectId: $projectId) {\n createdAt\n description\n id\n name\n template\n updatedAt\n prodBranch\n framework\n repository\n webhooks\n icon\n subDomain\n organization {\n id\n name\n }\n owner {\n id\n name\n email\n }\n deployments {\n id\n branch\n isCurrent\n status\n updatedAt\n commitHash\n createdAt\n environment\n domain {\n status\n branch\n createdAt\n updatedAt\n id\n name\n }\n createdBy {\n id\n name\n }\n }\n }\n}\n`;\n\nexport const getProjectsInOrganization = gql`\nquery ($organizationSlug: String!) {\n projectsInOrganization(organizationSlug: $organizationSlug) {\n id\n name\n createdAt\n description\n framework\n prodBranch\n webhooks\n repository\n updatedAt\n icon\n subDomain\n deployments {\n id\n branch\n isCurrent\n status\n updatedAt\n commitHash\n commitMessage\n createdAt\n environment\n domain {\n status\n branch\n createdAt\n updatedAt\n id\n name\n }\n }\n }\n}\n`;\n\nexport const getOrganizations = gql`\nquery {\n organizations {\n id\n name\n slug\n createdAt\n updatedAt\n }\n}\n`;\n\nexport const getDeployments = gql`\nquery ($projectId: String!) {\n deployments(projectId: $projectId) {\n id\n domain{\n branch\n createdAt\n id\n name\n status\n updatedAt\n }\n branch\n commitHash\n commitMessage\n url\n environment\n isCurrent\n status\n createdAt\n updatedAt\n createdBy {\n id\n name\n email\n }\n }\n}\n`;\n\nexport const getEnvironmentVariables = gql`\nquery ($projectId: String!) {\n environmentVariables(projectId: $projectId) {\n createdAt\n environment\n id\n key\n updatedAt\n value\n }\n}\n`;\n\nexport const getProjectMembers = gql`\nquery ($projectId: String!) {\n projectMembers(projectId: $projectId) {\n id\n member {\n id\n name\n email\n isVerified\n }\n isPending\n createdAt\n updatedAt\n permissions\n }\n}\n`;\n\nexport const searchProjects = gql`\nquery ($searchText: String!) {\n searchProjects(searchText: $searchText) {\n id\n name\n prodBranch\n repository\n createdAt\n description\n framework\n prodBranch\n webhooks\n updatedAt\n template\n repository\n organization {\n id\n name\n slug\n createdAt\n updatedAt\n }\n }\n}\n`;\n\nexport const getDomains = gql`\nquery ($projectId: String!, $filter: FilterDomainsInput) {\n domains(projectId: $projectId, filter: $filter) {\n branch\n createdAt\n redirectTo {\n id\n name\n branch\n status\n }\n id\n name\n status\n updatedAt\n }\n}\n`;\n","import { gql } from '@apollo/client';\n\nexport const removeProjectMember = gql`\nmutation ($projectMemberId: String!) {\n removeProjectMember(projectMemberId: $projectMemberId)\n}\n`;\n\nexport const updateProjectMember = gql`\nmutation ($projectMemberId: String!, $data: UpdateProjectMemberInput) {\n updateProjectMember(projectMemberId: $projectMemberId, data: $data)\n}\n`;\n\nexport const addProjectMember = gql`\nmutation ($projectId: String!, $data: AddProjectMemberInput) {\n addProjectMember(projectId: $projectId, data: $data)\n}\n`;\n\nexport const addEnvironmentVariables = gql`\nmutation ($projectId: String!, $data: [AddEnvironmentVariableInput!]) {\n addEnvironmentVariables(projectId: $projectId, data: $data)\n}\n`;\n\nexport const updateEnvironmentVariable = gql`\nmutation ($environmentVariableId: String!, $data: UpdateEnvironmentVariableInput!) {\n updateEnvironmentVariable(environmentVariableId: $environmentVariableId, data: $data)\n}\n`;\n\nexport const removeEnvironmentVariable = gql`\nmutation ($environmentVariableId: String!) {\n removeEnvironmentVariable(environmentVariableId: $environmentVariableId)\n}\n`;\n\nexport const updateDeploymentToProd = gql`\nmutation ($deploymentId: String!) {\n updateDeploymentToProd(deploymentId: $deploymentId)\n}\n`;\n\nexport const addProject = gql`\nmutation ($organizationSlug: String!, $data: AddProjectInput) {\n addProject(organizationSlug: $organizationSlug, data: $data) {\n id\n }\n}`;\n\nexport const updateProjectMutation = gql`\nmutation ($projectId: String!, $data: UpdateProjectInput) {\n updateProject(projectId: $projectId, data: $data)\n}`;\n\nexport const updateDomainMutation = gql`\nmutation ($domainId: String!, $data: UpdateDomainInput!) {\n updateDomain(domainId: $domainId, data: $data)\n}`;\n\nexport const redeployToProd = gql`\nmutation ($deploymentId: String!) {\n redeployToProd(deploymentId: $deploymentId)\n}\n`;\n\nexport const deleteProject = gql`\nmutation ($projectId: String!) {\n deleteProject(projectId: $projectId)\n}\n`;\n\nexport const deleteDomain = gql`\nmutation ($domainId: String!) {\n deleteDomain(domainId: $domainId)\n}`;\n\nexport const rollbackDeployment = gql`\nmutation ($projectId: String! ,$deploymentId: String!) {\n rollbackDeployment(projectId: $projectId, deploymentId: $deploymentId)\n}\n`;\n\nexport const deleteDeployment = gql`\nmutation ($deploymentId: String!) {\n deleteDeployment(deploymentId: $deploymentId)\n}\n`;\n\nexport const addDomain = gql`\nmutation ($projectId: String!, $data: AddDomainInput!) {\n addDomain(projectId: $projectId, data: $data)\n}\n`;\n\nexport const authenticateGitHub = gql`\nmutation ($code: String!) {\n authenticateGitHub(code: $code) {\n token\n }\n}`;\n\nexport const unauthenticateGitHub = gql`\nmutation {\n unauthenticateGitHub\n}`;\n","// Note: equivalent to types present in GQL schema\n\nexport enum Role {\n Owner = 'Owner',\n Maintainer = 'Maintainer',\n Reader = 'Reader',\n}\n\nexport enum Permission {\n View = 'View',\n Edit = 'Edit',\n}\n\nexport enum Environment {\n Production = 'Production',\n Preview = 'Preview',\n Development = 'Development',\n}\n\nexport enum DeploymentStatus {\n Building = 'Building',\n Ready = 'Ready',\n Error = 'Error',\n Deleting = 'Deleting'\n}\n\nexport enum DomainStatus {\n Live = 'Live',\n Pending = 'Pending',\n}\n\nexport type EnvironmentVariable = {\n id: string\n environment: Environment\n key: string\n value: string\n createdAt: string\n updatedAt: string\n}\n\nexport type Domain = {\n id: string\n branch: string\n name: string\n status: DomainStatus\n redirectTo: Domain | null\n createdAt: string\n updatedAt: string\n}\n\nexport type User = {\n id: string\n name: string | null\n email: string\n isVerified: boolean\n createdAt: string\n updatedAt: string\n gitHubToken: string | null\n}\n\nexport type Deployment = {\n id: string\n domain: Domain\n branch: string\n commitHash: string\n commitMessage: string\n url?: string\n environment: Environment\n isCurrent: boolean\n status: DeploymentStatus\n createdBy: User\n createdAt: string\n updatedAt: string\n}\n\nexport type OrganizationMember = {\n id: string\n member: User\n role: Role\n createdAt: string\n updatedAt: string\n}\n\nexport type ProjectMember = {\n id: string\n member: User\n permissions: Permission[]\n isPending: boolean\n createdAt: string\n updatedAt: string\n}\n\nexport type OrganizationProject = {\n id: string\n owner: User\n deployments: Deployment[]\n name: string\n repository: string\n prodBranch: string\n description: string\n template: string\n framework: string\n webhooks: string[]\n members: ProjectMember[]\n environmentVariables: EnvironmentVariable[]\n createdAt: string\n updatedAt: string\n}\n\nexport type Organization = {\n id: string\n name: string\n slug: string\n projects: OrganizationProject[]\n createdAt: string\n updatedAt: string\n members: OrganizationMember[]\n}\n\nexport type Project = {\n id: string\n owner: User\n deployments: Deployment[]\n name: string\n repository: string\n prodBranch: string\n description: string\n template: string\n framework: string\n webhooks: string[]\n members: ProjectMember[]\n environmentVariables: EnvironmentVariable[]\n createdAt: string\n updatedAt: string\n organization: Organization\n icon: string\n subDomain: string\n}\n\nexport type GetProjectMembersResponse = {\n projectMembers: ProjectMember[]\n}\n\nexport type AddProjectMemberResponse = {\n addProjectMember: boolean\n}\n\nexport type RemoveProjectMemberResponse = {\n removeProjectMember: boolean;\n}\n\nexport type UpdateProjectMemberResponse = {\n updateProjectMember: boolean;\n}\n\nexport type GetDeploymentsResponse = {\n deployments: Deployment[]\n}\n\nexport type GetEnvironmentVariablesResponse = {\n environmentVariables: EnvironmentVariable[]\n}\n\nexport type GetOrganizationsResponse = {\n organizations: Organization[]\n}\n\nexport type GetUserResponse = {\n user: User\n}\n\nexport type GetProjectResponse = {\n project: Project | null\n}\n\nexport type GetProjectsInOrganizationResponse = {\n projectsInOrganization: Project[]\n}\n\nexport type GetDomainsResponse = {\n domains: Domain[]\n}\n\nexport type SearchProjectsResponse = {\n searchProjects: Project[]\n}\n\nexport type AddEnvironmentVariablesResponse = {\n addEnvironmentVariables: boolean;\n}\n\nexport type AddEnvironmentVariableInput = {\n environments: string[];\n key: string;\n value: string;\n}\n\nexport type UpdateEnvironmentVariableInput = {\n key: string;\n value: string;\n}\n\nexport type UpdateProjectMemberInput = {\n permissions: Permission[];\n}\n\nexport type AddProjectMemberInput = {\n email: string;\n permissions: Permission[]\n}\n\nexport type UpdateEnvironmentVariableResponse = {\n updateEnvironmentVariable: boolean;\n}\n\nexport type RemoveEnvironmentVariableResponse = {\n removeEnvironmentVariable: boolean;\n}\n\nexport type UpdateDeploymentToProdResponse = {\n updateDeploymentToProd: boolean;\n}\n\nexport type AddProjectResponse = {\n addProject: Project\n}\n\nexport type UpdateProjectResponse = {\n updateProject: boolean;\n}\n\nexport type UpdateDomainResponse = {\n updateDomain: boolean;\n}\n\nexport type DeleteProjectResponse = {\n deleteProject: boolean;\n}\n\nexport type DeleteDomainResponse = {\n deleteDomain: boolean;\n}\n\nexport type AddProjectInput = {\n name: string;\n repository: string;\n prodBranch: string;\n template?: string;\n}\n\nexport type UpdateProjectInput = {\n name?: string\n description?: string\n prodBranch?: string\n webhooks?: string[]\n organizationId?: string\n}\n\nexport type UpdateDomainInput = {\n name?: string;\n branch?: string;\n redirectToId?: string | null;\n}\n\nexport type RedeployToProdResponse = {\n redeployToProd: boolean\n}\n\nexport type RollbackDeploymentResponse = {\n rollbackDeployment: boolean\n}\n\nexport type DeleteDeploymentResponse = {\n deleteDeployment: boolean\n}\n\nexport type AddDomainInput = {\n name: string\n}\n\nexport type FilterDomainInput = {\n branch?: string\n status?: DomainStatus\n}\n\nexport type AddDomainResponse = {\n addDomain: true\n}\n\nexport type AuthenticateGitHubResponse = {\n authenticateGitHub: {\n token: string\n }\n}\n\nexport type UnauthenticateGitHubResponse = {\n unauthenticateGitHub: boolean\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA,EACE;AAAA,EAEA;AAAA,OAEK;;;ACLP,SAAS,WAAW;AAEb,IAAM,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAahB,IAAM,aAAa;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA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OAAO;AAAA,QACxC,UAAoB;AAAA,MACtB,CAAC;AAED,aAAO;AAAA,IACT;AAAA;AACF;;;AGlYO,IAAK,OAAL,kBAAKC,UAAL;AACL,EAAAA,MAAA,WAAQ;AACR,EAAAA,MAAA,gBAAa;AACb,EAAAA,MAAA,YAAS;AAHC,SAAAA;AAAA,GAAA;AAML,IAAK,aAAL,kBAAKC,gBAAL;AACL,EAAAA,YAAA,UAAO;AACP,EAAAA,YAAA,UAAO;AAFG,SAAAA;AAAA,GAAA;AAKL,IAAK,cAAL,kBAAKC,iBAAL;AACL,EAAAA,aAAA,gBAAa;AACb,EAAAA,aAAA,aAAU;AACV,EAAAA,aAAA,iBAAc;AAHJ,SAAAA;AAAA,GAAA;AAML,IAAK,mBAAL,kBAAKC,sBAAL;AACL,EAAAA,kBAAA,cAAW;AACX,EAAAA,kBAAA,WAAQ;AACR,EAAAA,kBAAA,WAAQ;AACR,EAAAA,kBAAA,cAAW;AAJD,SAAAA;AAAA,GAAA;AAOL,IAAK,eAAL,kBAAKC,kBAAL;AACL,EAAAA,cAAA,UAAO;AACP,EAAAA,cAAA,aAAU;AAFA,SAAAA;AAAA,GAAA;","names":["gql","Role","Permission","Environment","DeploymentStatus","DomainStatus"]} \ No newline at end of file +{"version":3,"sources":["../src/client.ts","../src/queries.ts","../src/mutations.ts","../src/types.ts"],"sourcesContent":["import {\n ApolloClient,\n DefaultOptions,\n InMemoryCache,\n NormalizedCacheObject,\n} from \"@apollo/client\";\n\nimport * as queries from \"./queries\";\nimport * as types from \"./types\";\nimport * as mutations from \"./mutations\";\n\nexport interface GraphQLConfig {\n gqlEndpoint: string;\n}\n\n// TODO: check options\nconst defaultOptions: DefaultOptions = {\n watchQuery: {\n fetchPolicy: \"no-cache\",\n errorPolicy: \"ignore\",\n },\n query: {\n fetchPolicy: \"no-cache\",\n errorPolicy: \"all\",\n },\n};\n\nexport class GQLClient {\n private client: ApolloClient;\n\n constructor(config: GraphQLConfig) {\n this.client = new ApolloClient({\n uri: config.gqlEndpoint,\n cache: new InMemoryCache(),\n defaultOptions,\n credentials: \"include\",\n });\n }\n\n async getUser(): Promise {\n const { data } = await this.client.query({\n query: queries.getUser,\n });\n\n return data;\n }\n\n async getProject(projectId: string): Promise {\n const { data } = await this.client.query({\n query: queries.getProject,\n variables: {\n projectId,\n },\n });\n\n return data;\n }\n\n async getProjectsInOrganization(\n organizationSlug: string\n ): Promise {\n const { data } = await this.client.query({\n query: queries.getProjectsInOrganization,\n variables: {\n organizationSlug,\n },\n });\n\n return data;\n }\n\n async getOrganizations(): Promise {\n const { data } = await this.client.query({\n query: queries.getOrganizations,\n });\n\n return data;\n }\n\n async getDeployments(\n projectId: string\n ): Promise {\n const { data } = await this.client.query({\n query: queries.getDeployments,\n variables: {\n projectId,\n },\n });\n\n return data;\n }\n\n async getEnvironmentVariables(\n projectId: string\n ): Promise {\n const { data } = await this.client.query({\n query: queries.getEnvironmentVariables,\n variables: {\n projectId,\n },\n });\n\n return data;\n }\n\n async getProjectMembers(\n projectId: string\n ): Promise {\n const result = await this.client.query({\n query: queries.getProjectMembers,\n variables: {\n projectId,\n },\n });\n\n return result.data;\n }\n\n async addProjectMember(\n projectId: string,\n data: types.AddProjectMemberInput\n ): Promise {\n const result = await this.client.mutate({\n mutation: mutations.addProjectMember,\n variables: {\n projectId,\n data,\n },\n });\n\n return result.data;\n }\n\n async updateProjectMember(\n projectMemberId: string,\n data: types.UpdateProjectMemberInput\n ): Promise {\n const result = await this.client.mutate({\n mutation: mutations.updateProjectMember,\n variables: {\n projectMemberId,\n data,\n },\n });\n\n return result.data;\n }\n\n async removeProjectMember(\n projectMemberId: string\n ): Promise {\n const result = await this.client.mutate({\n mutation: mutations.removeProjectMember,\n variables: {\n projectMemberId,\n },\n });\n\n return result.data;\n }\n\n async searchProjects(\n searchText: string\n ): Promise {\n const { data } = await this.client.query({\n query: queries.searchProjects,\n variables: {\n searchText,\n },\n });\n\n return data;\n }\n\n async addEnvironmentVariables(\n projectId: string,\n data: types.AddEnvironmentVariableInput[]\n ): Promise {\n const result = await this.client.mutate({\n mutation: mutations.addEnvironmentVariables,\n variables: {\n projectId,\n data,\n },\n });\n\n return result.data;\n }\n\n async updateEnvironmentVariable(\n environmentVariableId: string,\n data: types.UpdateEnvironmentVariableInput\n ): Promise {\n const result = await this.client.mutate({\n mutation: mutations.updateEnvironmentVariable,\n variables: {\n environmentVariableId,\n data,\n },\n });\n\n return result.data;\n }\n\n async removeEnvironmentVariable(\n environmentVariableId: string\n ): Promise {\n const { data } = await this.client.mutate({\n mutation: mutations.removeEnvironmentVariable,\n variables: {\n environmentVariableId,\n },\n });\n\n return data;\n }\n\n async updateDeploymentToProd(\n deploymentId: string\n ): Promise {\n const { data } = await this.client.mutate({\n mutation: mutations.updateDeploymentToProd,\n variables: {\n deploymentId,\n },\n });\n\n return data;\n }\n\n async addProjectFromTemplate(\n organizationSlug: string,\n data: types.AddProjectFromTemplateInput\n ): Promise {\n const result = await this.client.mutate({\n mutation: mutations.addProjectFromTemplate,\n variables: {\n organizationSlug,\n data,\n },\n });\n\n return result.data;\n }\n\n async addProject(\n organizationSlug: string,\n data: types.AddProjectInput\n ): Promise {\n const result = await this.client.mutate({\n mutation: mutations.addProject,\n variables: {\n organizationSlug,\n data,\n },\n });\n\n return result.data;\n }\n\n async updateProject(\n projectId: string,\n data: types.UpdateProjectInput\n ): Promise {\n const result = await this.client.mutate({\n mutation: mutations.updateProjectMutation,\n variables: {\n projectId,\n data,\n },\n });\n\n return result.data;\n }\n\n async updateDomain(\n domainId: string,\n data: types.UpdateDomainInput\n ): Promise {\n const result = await this.client.mutate({\n mutation: mutations.updateDomainMutation,\n variables: {\n domainId,\n data,\n },\n });\n\n return result.data;\n }\n\n async redeployToProd(\n deploymentId: string\n ): Promise {\n const { data } = await this.client.mutate({\n mutation: mutations.redeployToProd,\n variables: {\n deploymentId,\n },\n });\n\n return data;\n }\n\n async deleteProject(projectId: string): Promise {\n const { data } = await this.client.mutate({\n mutation: mutations.deleteProject,\n variables: {\n projectId,\n },\n });\n\n return data;\n }\n\n async deleteDomain(domainId: string): Promise {\n const { data } = await this.client.mutate({\n mutation: mutations.deleteDomain,\n variables: {\n domainId,\n },\n });\n\n return data;\n }\n\n async rollbackDeployment(\n projectId: string,\n deploymentId: string\n ): Promise {\n const { data } = await this.client.mutate({\n mutation: mutations.rollbackDeployment,\n variables: {\n projectId,\n deploymentId,\n },\n });\n\n return data;\n }\n\n async deleteDeployment(\n deploymentId: string\n ): Promise {\n const { data } = await this.client.mutate({\n mutation: mutations.deleteDeployment,\n variables: {\n deploymentId,\n },\n });\n\n return data;\n }\n\n async addDomain(\n projectId: string,\n data: types.AddDomainInput\n ): Promise {\n const result = await this.client.mutate({\n mutation: mutations.addDomain,\n variables: {\n projectId,\n data,\n },\n });\n\n return result.data;\n }\n\n async getDomains(\n projectId: string,\n filter?: types.FilterDomainInput\n ): Promise {\n const { data } = await this.client.query({\n query: queries.getDomains,\n variables: {\n projectId,\n filter,\n },\n });\n\n return data;\n }\n\n async authenticateGitHub(\n code: string\n ): Promise {\n const { data } = await this.client.mutate({\n mutation: mutations.authenticateGitHub,\n variables: {\n code,\n },\n });\n\n return data;\n }\n\n async unauthenticateGithub(): Promise {\n const { data } = await this.client.mutate({\n mutation: mutations.unauthenticateGitHub,\n });\n\n return data;\n }\n}\n","import { gql } from '@apollo/client';\n\nexport const getUser = gql`\nquery {\n user {\n id\n name\n email\n createdAt\n updatedAt\n gitHubToken\n }\n}\n`;\n\nexport const getProject = gql`\nquery ($projectId: String!) {\n project(projectId: $projectId) {\n createdAt\n description\n id\n name\n template\n updatedAt\n prodBranch\n framework\n repository\n webhooks\n icon\n subDomain\n organization {\n id\n name\n }\n owner {\n id\n name\n email\n }\n deployments {\n id\n branch\n isCurrent\n status\n updatedAt\n commitHash\n createdAt\n environment\n domain {\n status\n branch\n createdAt\n updatedAt\n id\n name\n }\n createdBy {\n id\n name\n }\n }\n }\n}\n`;\n\nexport const getProjectsInOrganization = gql`\nquery ($organizationSlug: String!) {\n projectsInOrganization(organizationSlug: $organizationSlug) {\n id\n name\n createdAt\n description\n framework\n prodBranch\n webhooks\n repository\n updatedAt\n icon\n subDomain\n deployments {\n id\n branch\n isCurrent\n status\n updatedAt\n commitHash\n commitMessage\n createdAt\n environment\n domain {\n status\n branch\n createdAt\n updatedAt\n id\n name\n }\n }\n }\n}\n`;\n\nexport const getOrganizations = gql`\nquery {\n organizations {\n id\n name\n slug\n createdAt\n updatedAt\n }\n}\n`;\n\nexport const getDeployments = gql`\nquery ($projectId: String!) {\n deployments(projectId: $projectId) {\n id\n domain{\n branch\n createdAt\n id\n name\n status\n updatedAt\n }\n branch\n commitHash\n commitMessage\n url\n environment\n isCurrent\n status\n createdAt\n updatedAt\n createdBy {\n id\n name\n email\n }\n }\n}\n`;\n\nexport const getEnvironmentVariables = gql`\nquery ($projectId: String!) {\n environmentVariables(projectId: $projectId) {\n createdAt\n environment\n id\n key\n updatedAt\n value\n }\n}\n`;\n\nexport const getProjectMembers = gql`\nquery ($projectId: String!) {\n projectMembers(projectId: $projectId) {\n id\n member {\n id\n name\n email\n isVerified\n }\n isPending\n createdAt\n updatedAt\n permissions\n }\n}\n`;\n\nexport const searchProjects = gql`\nquery ($searchText: String!) {\n searchProjects(searchText: $searchText) {\n id\n name\n prodBranch\n repository\n createdAt\n description\n framework\n prodBranch\n webhooks\n updatedAt\n template\n repository\n organization {\n id\n name\n slug\n createdAt\n updatedAt\n }\n }\n}\n`;\n\nexport const getDomains = gql`\nquery ($projectId: String!, $filter: FilterDomainsInput) {\n domains(projectId: $projectId, filter: $filter) {\n branch\n createdAt\n redirectTo {\n id\n name\n branch\n status\n }\n id\n name\n status\n updatedAt\n }\n}\n`;\n","import { gql } from \"@apollo/client\";\n\nexport const removeProjectMember = gql`\n mutation ($projectMemberId: String!) {\n removeProjectMember(projectMemberId: $projectMemberId)\n }\n`;\n\nexport const updateProjectMember = gql`\n mutation ($projectMemberId: String!, $data: UpdateProjectMemberInput) {\n updateProjectMember(projectMemberId: $projectMemberId, data: $data)\n }\n`;\n\nexport const addProjectMember = gql`\n mutation ($projectId: String!, $data: AddProjectMemberInput) {\n addProjectMember(projectId: $projectId, data: $data)\n }\n`;\n\nexport const addEnvironmentVariables = gql`\n mutation ($projectId: String!, $data: [AddEnvironmentVariableInput!]) {\n addEnvironmentVariables(projectId: $projectId, data: $data)\n }\n`;\n\nexport const updateEnvironmentVariable = gql`\n mutation (\n $environmentVariableId: String!\n $data: UpdateEnvironmentVariableInput!\n ) {\n updateEnvironmentVariable(\n environmentVariableId: $environmentVariableId\n data: $data\n )\n }\n`;\n\nexport const removeEnvironmentVariable = gql`\n mutation ($environmentVariableId: String!) {\n removeEnvironmentVariable(environmentVariableId: $environmentVariableId)\n }\n`;\n\nexport const updateDeploymentToProd = gql`\n mutation ($deploymentId: String!) {\n updateDeploymentToProd(deploymentId: $deploymentId)\n }\n`;\n\nexport const addProjectFromTemplate = gql`\n mutation ($organizationSlug: String!, $data: AddProjectFromTemplateInput) {\n addProjectFromTemplate(organizationSlug: $organizationSlug, data: $data) {\n id\n }\n }\n`;\n\nexport const addProject = gql`\n mutation ($organizationSlug: String!, $data: AddProjectInput) {\n addProject(organizationSlug: $organizationSlug, data: $data) {\n id\n }\n }\n`;\n\nexport const updateProjectMutation = gql`\n mutation ($projectId: String!, $data: UpdateProjectInput) {\n updateProject(projectId: $projectId, data: $data)\n }\n`;\n\nexport const updateDomainMutation = gql`\n mutation ($domainId: String!, $data: UpdateDomainInput!) {\n updateDomain(domainId: $domainId, data: $data)\n }\n`;\n\nexport const redeployToProd = gql`\n mutation ($deploymentId: String!) {\n redeployToProd(deploymentId: $deploymentId)\n }\n`;\n\nexport const deleteProject = gql`\n mutation ($projectId: String!) {\n deleteProject(projectId: $projectId)\n }\n`;\n\nexport const deleteDomain = gql`\n mutation ($domainId: String!) {\n deleteDomain(domainId: $domainId)\n }\n`;\n\nexport const rollbackDeployment = gql`\n mutation ($projectId: String!, $deploymentId: String!) {\n rollbackDeployment(projectId: $projectId, deploymentId: $deploymentId)\n }\n`;\n\nexport const deleteDeployment = gql`\n mutation ($deploymentId: String!) {\n deleteDeployment(deploymentId: $deploymentId)\n }\n`;\n\nexport const addDomain = gql`\n mutation ($projectId: String!, $data: AddDomainInput!) {\n addDomain(projectId: $projectId, data: $data)\n }\n`;\n\nexport const authenticateGitHub = gql`\n mutation ($code: String!) {\n authenticateGitHub(code: $code) {\n token\n }\n }\n`;\n\nexport const unauthenticateGitHub = gql`\n mutation {\n unauthenticateGitHub\n }\n`;\n","import { addProjectFromTemplate } from \"./mutations\";\n// Note: equivalent to types present in GQL schema\n\nexport enum Role {\n Owner = \"Owner\",\n Maintainer = \"Maintainer\",\n Reader = \"Reader\",\n}\n\nexport enum Permission {\n View = \"View\",\n Edit = \"Edit\",\n}\n\nexport enum Environment {\n Production = \"Production\",\n Preview = \"Preview\",\n Development = \"Development\",\n}\n\nexport enum DeploymentStatus {\n Building = \"Building\",\n Ready = \"Ready\",\n Error = \"Error\",\n Deleting = \"Deleting\",\n}\n\nexport enum DomainStatus {\n Live = \"Live\",\n Pending = \"Pending\",\n}\n\nexport type EnvironmentVariable = {\n id: string;\n environment: Environment;\n key: string;\n value: string;\n createdAt: string;\n updatedAt: string;\n};\n\nexport type Domain = {\n id: string;\n branch: string;\n name: string;\n status: DomainStatus;\n redirectTo: Domain | null;\n createdAt: string;\n updatedAt: string;\n};\n\nexport type User = {\n id: string;\n name: string | null;\n email: string;\n isVerified: boolean;\n createdAt: string;\n updatedAt: string;\n gitHubToken: string | null;\n};\n\nexport type Deployment = {\n id: string;\n domain: Domain;\n branch: string;\n commitHash: string;\n commitMessage: string;\n url?: string;\n environment: Environment;\n isCurrent: boolean;\n status: DeploymentStatus;\n createdBy: User;\n createdAt: string;\n updatedAt: string;\n};\n\nexport type OrganizationMember = {\n id: string;\n member: User;\n role: Role;\n createdAt: string;\n updatedAt: string;\n};\n\nexport type ProjectMember = {\n id: string;\n member: User;\n permissions: Permission[];\n isPending: boolean;\n createdAt: string;\n updatedAt: string;\n};\n\nexport type OrganizationProject = {\n id: string;\n owner: User;\n deployments: Deployment[];\n name: string;\n repository: string;\n prodBranch: string;\n description: string;\n template: string;\n framework: string;\n webhooks: string[];\n members: ProjectMember[];\n environmentVariables: EnvironmentVariable[];\n createdAt: string;\n updatedAt: string;\n};\n\nexport type Organization = {\n id: string;\n name: string;\n slug: string;\n projects: OrganizationProject[];\n createdAt: string;\n updatedAt: string;\n members: OrganizationMember[];\n};\n\nexport type Project = {\n id: string;\n owner: User;\n deployments: Deployment[];\n name: string;\n repository: string;\n prodBranch: string;\n description: string;\n template: string;\n framework: string;\n webhooks: string[];\n members: ProjectMember[];\n environmentVariables: EnvironmentVariable[];\n createdAt: string;\n updatedAt: string;\n organization: Organization;\n icon: string;\n subDomain: string;\n};\n\nexport type GetProjectMembersResponse = {\n projectMembers: ProjectMember[];\n};\n\nexport type AddProjectMemberResponse = {\n addProjectMember: boolean;\n};\n\nexport type RemoveProjectMemberResponse = {\n removeProjectMember: boolean;\n};\n\nexport type UpdateProjectMemberResponse = {\n updateProjectMember: boolean;\n};\n\nexport type GetDeploymentsResponse = {\n deployments: Deployment[];\n};\n\nexport type GetEnvironmentVariablesResponse = {\n environmentVariables: EnvironmentVariable[];\n};\n\nexport type GetOrganizationsResponse = {\n organizations: Organization[];\n};\n\nexport type GetUserResponse = {\n user: User;\n};\n\nexport type GetProjectResponse = {\n project: Project | null;\n};\n\nexport type GetProjectsInOrganizationResponse = {\n projectsInOrganization: Project[];\n};\n\nexport type GetDomainsResponse = {\n domains: Domain[];\n};\n\nexport type SearchProjectsResponse = {\n searchProjects: Project[];\n};\n\nexport type AddEnvironmentVariablesResponse = {\n addEnvironmentVariables: boolean;\n};\n\nexport type AddEnvironmentVariableInput = {\n environments: string[];\n key: string;\n value: string;\n};\n\nexport type UpdateEnvironmentVariableInput = {\n key: string;\n value: string;\n};\n\nexport type UpdateProjectMemberInput = {\n permissions: Permission[];\n};\n\nexport type AddProjectMemberInput = {\n email: string;\n permissions: Permission[];\n};\n\nexport type UpdateEnvironmentVariableResponse = {\n updateEnvironmentVariable: boolean;\n};\n\nexport type RemoveEnvironmentVariableResponse = {\n removeEnvironmentVariable: boolean;\n};\n\nexport type UpdateDeploymentToProdResponse = {\n updateDeploymentToProd: boolean;\n};\n\nexport type AddProjectFromTemplateResponse = {\n addProjectFromTemplate: Project;\n};\n\nexport type AddProjectResponse = {\n addProject: Project;\n};\n\nexport type UpdateProjectResponse = {\n updateProject: boolean;\n};\n\nexport type UpdateDomainResponse = {\n updateDomain: boolean;\n};\n\nexport type DeleteProjectResponse = {\n deleteProject: boolean;\n};\n\nexport type DeleteDomainResponse = {\n deleteDomain: boolean;\n};\n\nexport type AddProjectFromTemplateInput = {\n templateOwner: string;\n templateRepo: string;\n owner: string;\n name: string;\n isPrivate: boolean;\n};\n\nexport type AddProjectInput = {\n name: string;\n repository: string;\n prodBranch: string;\n template?: string;\n};\n\nexport type UpdateProjectInput = {\n name?: string;\n description?: string;\n prodBranch?: string;\n webhooks?: string[];\n organizationId?: string;\n};\n\nexport type UpdateDomainInput = {\n name?: string;\n branch?: string;\n redirectToId?: string | null;\n};\n\nexport type RedeployToProdResponse = {\n redeployToProd: boolean;\n};\n\nexport type RollbackDeploymentResponse = {\n rollbackDeployment: boolean;\n};\n\nexport type DeleteDeploymentResponse = {\n deleteDeployment: boolean;\n};\n\nexport type AddDomainInput = {\n name: string;\n};\n\nexport type FilterDomainInput = {\n branch?: string;\n status?: DomainStatus;\n};\n\nexport type AddDomainResponse = {\n addDomain: true;\n};\n\nexport type AuthenticateGitHubResponse = {\n authenticateGitHub: {\n token: string;\n };\n};\n\nexport type UnauthenticateGitHubResponse = {\n unauthenticateGitHub: boolean;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA,EACE;AAAA,EAEA;AAAA,OAEK;;;ACLP,SAAS,WAAW;AAEb,IAAM,UAAU;AAAA;AAAA;AAAA;AAAA;A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permission","Environment","DeploymentStatus","DomainStatus"]} \ No newline at end of file diff --git a/packages/gql-client/src/client.ts b/packages/gql-client/src/client.ts index 00f3b2ba..01920dd3 100644 --- a/packages/gql-client/src/client.ts +++ b/packages/gql-client/src/client.ts @@ -228,6 +228,21 @@ export class GQLClient { return data; } + async addProjectFromTemplate( + organizationSlug: string, + data: types.AddProjectFromTemplateInput + ): Promise { + const result = await this.client.mutate({ + mutation: mutations.addProjectFromTemplate, + variables: { + organizationSlug, + data, + }, + }); + + return result.data; + } + async addProject( organizationSlug: string, data: types.AddProjectInput diff --git a/packages/gql-client/src/mutations.ts b/packages/gql-client/src/mutations.ts index be8d96d9..007c2183 100644 --- a/packages/gql-client/src/mutations.ts +++ b/packages/gql-client/src/mutations.ts @@ -1,107 +1,127 @@ -import { gql } from '@apollo/client'; +import { gql } from "@apollo/client"; export const removeProjectMember = gql` -mutation ($projectMemberId: String!) { - removeProjectMember(projectMemberId: $projectMemberId) -} + mutation ($projectMemberId: String!) { + removeProjectMember(projectMemberId: $projectMemberId) + } `; export const updateProjectMember = gql` -mutation ($projectMemberId: String!, $data: UpdateProjectMemberInput) { - updateProjectMember(projectMemberId: $projectMemberId, data: $data) -} + mutation ($projectMemberId: String!, $data: UpdateProjectMemberInput) { + updateProjectMember(projectMemberId: $projectMemberId, data: $data) + } `; export const addProjectMember = gql` -mutation ($projectId: String!, $data: AddProjectMemberInput) { - addProjectMember(projectId: $projectId, data: $data) -} + mutation ($projectId: String!, $data: AddProjectMemberInput) { + addProjectMember(projectId: $projectId, data: $data) + } `; export const addEnvironmentVariables = gql` -mutation ($projectId: String!, $data: [AddEnvironmentVariableInput!]) { - addEnvironmentVariables(projectId: $projectId, data: $data) -} + mutation ($projectId: String!, $data: [AddEnvironmentVariableInput!]) { + addEnvironmentVariables(projectId: $projectId, data: $data) + } `; export const updateEnvironmentVariable = gql` -mutation ($environmentVariableId: String!, $data: UpdateEnvironmentVariableInput!) { - updateEnvironmentVariable(environmentVariableId: $environmentVariableId, data: $data) -} + mutation ( + $environmentVariableId: String! + $data: UpdateEnvironmentVariableInput! + ) { + updateEnvironmentVariable( + environmentVariableId: $environmentVariableId + data: $data + ) + } `; export const removeEnvironmentVariable = gql` -mutation ($environmentVariableId: String!) { - removeEnvironmentVariable(environmentVariableId: $environmentVariableId) -} + mutation ($environmentVariableId: String!) { + removeEnvironmentVariable(environmentVariableId: $environmentVariableId) + } `; export const updateDeploymentToProd = gql` -mutation ($deploymentId: String!) { - updateDeploymentToProd(deploymentId: $deploymentId) -} + mutation ($deploymentId: String!) { + updateDeploymentToProd(deploymentId: $deploymentId) + } +`; + +export const addProjectFromTemplate = gql` + mutation ($organizationSlug: String!, $data: AddProjectFromTemplateInput) { + addProjectFromTemplate(organizationSlug: $organizationSlug, data: $data) { + id + } + } `; export const addProject = gql` -mutation ($organizationSlug: String!, $data: AddProjectInput) { - addProject(organizationSlug: $organizationSlug, data: $data) { - id + mutation ($organizationSlug: String!, $data: AddProjectInput) { + addProject(organizationSlug: $organizationSlug, data: $data) { + id + } } -}`; +`; export const updateProjectMutation = gql` -mutation ($projectId: String!, $data: UpdateProjectInput) { - updateProject(projectId: $projectId, data: $data) -}`; + mutation ($projectId: String!, $data: UpdateProjectInput) { + updateProject(projectId: $projectId, data: $data) + } +`; export const updateDomainMutation = gql` -mutation ($domainId: String!, $data: UpdateDomainInput!) { - updateDomain(domainId: $domainId, data: $data) -}`; + mutation ($domainId: String!, $data: UpdateDomainInput!) { + updateDomain(domainId: $domainId, data: $data) + } +`; export const redeployToProd = gql` -mutation ($deploymentId: String!) { - redeployToProd(deploymentId: $deploymentId) -} + mutation ($deploymentId: String!) { + redeployToProd(deploymentId: $deploymentId) + } `; export const deleteProject = gql` -mutation ($projectId: String!) { - deleteProject(projectId: $projectId) -} + mutation ($projectId: String!) { + deleteProject(projectId: $projectId) + } `; export const deleteDomain = gql` -mutation ($domainId: String!) { - deleteDomain(domainId: $domainId) -}`; + mutation ($domainId: String!) { + deleteDomain(domainId: $domainId) + } +`; export const rollbackDeployment = gql` -mutation ($projectId: String! ,$deploymentId: String!) { - rollbackDeployment(projectId: $projectId, deploymentId: $deploymentId) -} + mutation ($projectId: String!, $deploymentId: String!) { + rollbackDeployment(projectId: $projectId, deploymentId: $deploymentId) + } `; export const deleteDeployment = gql` -mutation ($deploymentId: String!) { - deleteDeployment(deploymentId: $deploymentId) -} + mutation ($deploymentId: String!) { + deleteDeployment(deploymentId: $deploymentId) + } `; export const addDomain = gql` -mutation ($projectId: String!, $data: AddDomainInput!) { - addDomain(projectId: $projectId, data: $data) -} + mutation ($projectId: String!, $data: AddDomainInput!) { + addDomain(projectId: $projectId, data: $data) + } `; export const authenticateGitHub = gql` -mutation ($code: String!) { - authenticateGitHub(code: $code) { - token + mutation ($code: String!) { + authenticateGitHub(code: $code) { + token + } } -}`; +`; export const unauthenticateGitHub = gql` -mutation { - unauthenticateGitHub -}`; + mutation { + unauthenticateGitHub + } +`; diff --git a/packages/gql-client/src/types.ts b/packages/gql-client/src/types.ts index ac6481e0..1ef0db14 100644 --- a/packages/gql-client/src/types.ts +++ b/packages/gql-client/src/types.ts @@ -1,298 +1,311 @@ +import { addProjectFromTemplate } from "./mutations"; // Note: equivalent to types present in GQL schema export enum Role { - Owner = 'Owner', - Maintainer = 'Maintainer', - Reader = 'Reader', + Owner = "Owner", + Maintainer = "Maintainer", + Reader = "Reader", } export enum Permission { - View = 'View', - Edit = 'Edit', + View = "View", + Edit = "Edit", } export enum Environment { - Production = 'Production', - Preview = 'Preview', - Development = 'Development', + Production = "Production", + Preview = "Preview", + Development = "Development", } export enum DeploymentStatus { - Building = 'Building', - Ready = 'Ready', - Error = 'Error', - Deleting = 'Deleting' + Building = "Building", + Ready = "Ready", + Error = "Error", + Deleting = "Deleting", } export enum DomainStatus { - Live = 'Live', - Pending = 'Pending', + Live = "Live", + Pending = "Pending", } export type EnvironmentVariable = { - id: string - environment: Environment - key: string - value: string - createdAt: string - updatedAt: string -} + id: string; + environment: Environment; + key: string; + value: string; + createdAt: string; + updatedAt: string; +}; export type Domain = { - id: string - branch: string - name: string - status: DomainStatus - redirectTo: Domain | null - createdAt: string - updatedAt: string -} + id: string; + branch: string; + name: string; + status: DomainStatus; + redirectTo: Domain | null; + createdAt: string; + updatedAt: string; +}; export type User = { - id: string - name: string | null - email: string - isVerified: boolean - createdAt: string - updatedAt: string - gitHubToken: string | null -} + id: string; + name: string | null; + email: string; + isVerified: boolean; + createdAt: string; + updatedAt: string; + gitHubToken: string | null; +}; export type Deployment = { - id: string - domain: Domain - branch: string - commitHash: string - commitMessage: string - url?: string - environment: Environment - isCurrent: boolean - status: DeploymentStatus - createdBy: User - createdAt: string - updatedAt: string -} + id: string; + domain: Domain; + branch: string; + commitHash: string; + commitMessage: string; + url?: string; + environment: Environment; + isCurrent: boolean; + status: DeploymentStatus; + createdBy: User; + createdAt: string; + updatedAt: string; +}; export type OrganizationMember = { - id: string - member: User - role: Role - createdAt: string - updatedAt: string -} + id: string; + member: User; + role: Role; + createdAt: string; + updatedAt: string; +}; export type ProjectMember = { - id: string - member: User - permissions: Permission[] - isPending: boolean - createdAt: string - updatedAt: string -} + id: string; + member: User; + permissions: Permission[]; + isPending: boolean; + createdAt: string; + updatedAt: string; +}; export type OrganizationProject = { - id: string - owner: User - deployments: Deployment[] - name: string - repository: string - prodBranch: string - description: string - template: string - framework: string - webhooks: string[] - members: ProjectMember[] - environmentVariables: EnvironmentVariable[] - createdAt: string - updatedAt: string -} + id: string; + owner: User; + deployments: Deployment[]; + name: string; + repository: string; + prodBranch: string; + description: string; + template: string; + framework: string; + webhooks: string[]; + members: ProjectMember[]; + environmentVariables: EnvironmentVariable[]; + createdAt: string; + updatedAt: string; +}; export type Organization = { - id: string - name: string - slug: string - projects: OrganizationProject[] - createdAt: string - updatedAt: string - members: OrganizationMember[] -} + id: string; + name: string; + slug: string; + projects: OrganizationProject[]; + createdAt: string; + updatedAt: string; + members: OrganizationMember[]; +}; export type Project = { - id: string - owner: User - deployments: Deployment[] - name: string - repository: string - prodBranch: string - description: string - template: string - framework: string - webhooks: string[] - members: ProjectMember[] - environmentVariables: EnvironmentVariable[] - createdAt: string - updatedAt: string - organization: Organization - icon: string - subDomain: string -} + id: string; + owner: User; + deployments: Deployment[]; + name: string; + repository: string; + prodBranch: string; + description: string; + template: string; + framework: string; + webhooks: string[]; + members: ProjectMember[]; + environmentVariables: EnvironmentVariable[]; + createdAt: string; + updatedAt: string; + organization: Organization; + icon: string; + subDomain: string; +}; export type GetProjectMembersResponse = { - projectMembers: ProjectMember[] -} + projectMembers: ProjectMember[]; +}; export type AddProjectMemberResponse = { - addProjectMember: boolean -} + addProjectMember: boolean; +}; export type RemoveProjectMemberResponse = { removeProjectMember: boolean; -} +}; export type UpdateProjectMemberResponse = { updateProjectMember: boolean; -} +}; export type GetDeploymentsResponse = { - deployments: Deployment[] -} + deployments: Deployment[]; +}; export type GetEnvironmentVariablesResponse = { - environmentVariables: EnvironmentVariable[] -} + environmentVariables: EnvironmentVariable[]; +}; export type GetOrganizationsResponse = { - organizations: Organization[] -} + organizations: Organization[]; +}; export type GetUserResponse = { - user: User -} + user: User; +}; export type GetProjectResponse = { - project: Project | null -} + project: Project | null; +}; export type GetProjectsInOrganizationResponse = { - projectsInOrganization: Project[] -} + projectsInOrganization: Project[]; +}; export type GetDomainsResponse = { - domains: Domain[] -} + domains: Domain[]; +}; export type SearchProjectsResponse = { - searchProjects: Project[] -} + searchProjects: Project[]; +}; export type AddEnvironmentVariablesResponse = { addEnvironmentVariables: boolean; -} +}; export type AddEnvironmentVariableInput = { environments: string[]; key: string; value: string; -} +}; export type UpdateEnvironmentVariableInput = { key: string; value: string; -} +}; export type UpdateProjectMemberInput = { permissions: Permission[]; -} +}; export type AddProjectMemberInput = { email: string; - permissions: Permission[] -} + permissions: Permission[]; +}; export type UpdateEnvironmentVariableResponse = { updateEnvironmentVariable: boolean; -} +}; export type RemoveEnvironmentVariableResponse = { removeEnvironmentVariable: boolean; -} +}; export type UpdateDeploymentToProdResponse = { updateDeploymentToProd: boolean; -} +}; + +export type AddProjectFromTemplateResponse = { + addProjectFromTemplate: Project; +}; export type AddProjectResponse = { - addProject: Project -} + addProject: Project; +}; export type UpdateProjectResponse = { updateProject: boolean; -} +}; export type UpdateDomainResponse = { updateDomain: boolean; -} +}; export type DeleteProjectResponse = { deleteProject: boolean; -} +}; export type DeleteDomainResponse = { deleteDomain: boolean; -} +}; + +export type AddProjectFromTemplateInput = { + templateOwner: string; + templateRepo: string; + owner: string; + name: string; + isPrivate: boolean; +}; export type AddProjectInput = { name: string; repository: string; prodBranch: string; template?: string; -} +}; export type UpdateProjectInput = { - name?: string - description?: string - prodBranch?: string - webhooks?: string[] - organizationId?: string -} + name?: string; + description?: string; + prodBranch?: string; + webhooks?: string[]; + organizationId?: string; +}; export type UpdateDomainInput = { name?: string; branch?: string; redirectToId?: string | null; -} +}; export type RedeployToProdResponse = { - redeployToProd: boolean -} + redeployToProd: boolean; +}; export type RollbackDeploymentResponse = { - rollbackDeployment: boolean -} + rollbackDeployment: boolean; +}; export type DeleteDeploymentResponse = { - deleteDeployment: boolean -} + deleteDeployment: boolean; +}; export type AddDomainInput = { - name: string -} + name: string; +}; export type FilterDomainInput = { - branch?: string - status?: DomainStatus -} + branch?: string; + status?: DomainStatus; +}; export type AddDomainResponse = { - addDomain: true -} + addDomain: true; +}; export type AuthenticateGitHubResponse = { authenticateGitHub: { - token: string - } -} + token: string; + }; +}; export type UnauthenticateGitHubResponse = { - unauthenticateGitHub: boolean -} + unauthenticateGitHub: boolean; +};