console/integration-tests/testkit/flow.ts

1530 lines
32 KiB
TypeScript
Raw Normal View History

import { graphql } from './gql';
2022-05-18 07:26:57 +00:00
import type {
AddAlertChannelInput,
AddAlertInput,
2022-12-28 19:22:54 +00:00
AnswerOrganizationTransferRequestInput,
2023-12-05 10:54:03 +00:00
AssignMemberRoleInput,
ClientStatsInput,
2023-12-05 10:54:03 +00:00
CreateMemberRoleInput,
CreateOrganizationAccessTokenInput,
2022-05-18 07:26:57 +00:00
CreateOrganizationInput,
CreateProjectInput,
2022-12-28 19:22:54 +00:00
CreateTargetInput,
2022-05-18 07:26:57 +00:00
CreateTokenInput,
2023-12-05 10:54:03 +00:00
DeleteMemberRoleInput,
DeleteTokensInput,
2022-12-28 19:22:54 +00:00
EnableExternalSchemaCompositionInput,
Experimental__UpdateTargetSchemaCompositionInput,
2022-12-28 19:22:54 +00:00
InviteToOrganizationByEmailInput,
OperationsStatsSelectorInput,
OrganizationSelectorInput,
OrganizationTransferRequestSelector,
RateLimitInput,
RequestOrganizationTransferInput,
SchemaCheckInput,
SchemaDeleteInput,
2022-12-28 19:22:54 +00:00
SchemaPublishInput,
SetTargetValidationInput,
2022-05-18 07:26:57 +00:00
TargetSelectorInput,
2022-12-28 19:22:54 +00:00
UpdateBaseSchemaInput,
2023-12-05 10:54:03 +00:00
UpdateMemberRoleInput,
UpdateOrganizationSlugInput,
UpdateProjectSlugInput,
UpdateTargetSlugInput,
2022-12-28 19:22:54 +00:00
UpdateTargetValidationSettingsInput,
2022-05-18 07:26:57 +00:00
} from './gql/graphql';
import { execute } from './graphql';
export function waitFor(ms: number) {
return new Promise(resolve => setTimeout(resolve, ms));
2022-05-18 07:26:57 +00:00
}
export function createOrganization(input: CreateOrganizationInput, authToken: string) {
2022-05-18 07:26:57 +00:00
return execute({
document: graphql(`
2022-05-18 07:26:57 +00:00
mutation createOrganization($input: CreateOrganizationInput!) {
createOrganization(input: $input) {
New redesign (#4) * New redesign * Use latest nextjs and bob It fixes the start command * fix: text overflow issue in the organization switcher dropdown (#14) * fix: text overflow issue in the organization switcher dropdown * feat: strict children typings * Force dark mode (#15) If somebody used the light mode before, Hive App displays light version of tailwind classes * Fix dev, GH app optional, project type instead of Connected (#16) * Make Github integration optional * Show project type instead of Connected * Fix dev command * Small changes to the version card (#17) * Small changes to the version card * Apply suggestions from code review * Polish (#18) * Make the design a bit more clean * Add a bit of separation * Apply suggestions from code review Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru> Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru> * fix: do not access properties on potential undefined variable (#33) * fix: renaming not being added during rebase (#32) * feat: add Mutation.createToken validation (#30) * Remove `#` from organization pages, polish subcription page (#34) * Remove `#` from project/target pages (#38) * fix: add missing service names for multi service projects (#35) * Re-design subscription (#40) * Missing list of changes in the schema diff view (#41) * Missing list of changes in the schema diff view Closes #19 * Apply suggestions from code review Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru> * Move titleMap outside of the component Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru> * Blurred fixed header + new `404` page + use `@theguild/prettier-config` (#44) * fix header * make things amazing * Update packages/web/app/pages/404.tsx * fix build * remove unused styles * Add --fix to lint-staged (#43) * Fix access (#45) * Fix access on organization level * Fix access on project level * Fix access on target level * Align with main * Bring back schema view (#49) * Add missing Mark as Valid button (#50) * Update the design of the operations view (#51) * Update doc link Co-authored-by: Dotan Simha <dotansimha@gmail.com> Co-authored-by: Kamil Kisiela <kamil.kisiela@gmail.com> Co-authored-by: Laurin Quast <laurinquast@googlemail.com>
2022-05-24 07:41:53 +00:00
ok {
createdOrganizationPayload {
organization {
id
slug
New redesign (#4) * New redesign * Use latest nextjs and bob It fixes the start command * fix: text overflow issue in the organization switcher dropdown (#14) * fix: text overflow issue in the organization switcher dropdown * feat: strict children typings * Force dark mode (#15) If somebody used the light mode before, Hive App displays light version of tailwind classes * Fix dev, GH app optional, project type instead of Connected (#16) * Make Github integration optional * Show project type instead of Connected * Fix dev command * Small changes to the version card (#17) * Small changes to the version card * Apply suggestions from code review * Polish (#18) * Make the design a bit more clean * Add a bit of separation * Apply suggestions from code review Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru> Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru> * fix: do not access properties on potential undefined variable (#33) * fix: renaming not being added during rebase (#32) * feat: add Mutation.createToken validation (#30) * Remove `#` from organization pages, polish subcription page (#34) * Remove `#` from project/target pages (#38) * fix: add missing service names for multi service projects (#35) * Re-design subscription (#40) * Missing list of changes in the schema diff view (#41) * Missing list of changes in the schema diff view Closes #19 * Apply suggestions from code review Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru> * Move titleMap outside of the component Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru> * Blurred fixed header + new `404` page + use `@theguild/prettier-config` (#44) * fix header * make things amazing * Update packages/web/app/pages/404.tsx * fix build * remove unused styles * Add --fix to lint-staged (#43) * Fix access (#45) * Fix access on organization level * Fix access on project level * Fix access on target level * Align with main * Bring back schema view (#49) * Add missing Mark as Valid button (#50) * Update the design of the operations view (#51) * Update doc link Co-authored-by: Dotan Simha <dotansimha@gmail.com> Co-authored-by: Kamil Kisiela <kamil.kisiela@gmail.com> Co-authored-by: Laurin Quast <laurinquast@googlemail.com>
2022-05-24 07:41:53 +00:00
owner {
id
role {
id
permissions
}
New redesign (#4) * New redesign * Use latest nextjs and bob It fixes the start command * fix: text overflow issue in the organization switcher dropdown (#14) * fix: text overflow issue in the organization switcher dropdown * feat: strict children typings * Force dark mode (#15) If somebody used the light mode before, Hive App displays light version of tailwind classes * Fix dev, GH app optional, project type instead of Connected (#16) * Make Github integration optional * Show project type instead of Connected * Fix dev command * Small changes to the version card (#17) * Small changes to the version card * Apply suggestions from code review * Polish (#18) * Make the design a bit more clean * Add a bit of separation * Apply suggestions from code review Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru> Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru> * fix: do not access properties on potential undefined variable (#33) * fix: renaming not being added during rebase (#32) * feat: add Mutation.createToken validation (#30) * Remove `#` from organization pages, polish subcription page (#34) * Remove `#` from project/target pages (#38) * fix: add missing service names for multi service projects (#35) * Re-design subscription (#40) * Missing list of changes in the schema diff view (#41) * Missing list of changes in the schema diff view Closes #19 * Apply suggestions from code review Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru> * Move titleMap outside of the component Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru> * Blurred fixed header + new `404` page + use `@theguild/prettier-config` (#44) * fix header * make things amazing * Update packages/web/app/pages/404.tsx * fix build * remove unused styles * Add --fix to lint-staged (#43) * Fix access (#45) * Fix access on organization level * Fix access on project level * Fix access on target level * Align with main * Bring back schema view (#49) * Add missing Mark as Valid button (#50) * Update the design of the operations view (#51) * Update doc link Co-authored-by: Dotan Simha <dotansimha@gmail.com> Co-authored-by: Kamil Kisiela <kamil.kisiela@gmail.com> Co-authored-by: Laurin Quast <laurinquast@googlemail.com>
2022-05-24 07:41:53 +00:00
}
2023-12-05 10:54:03 +00:00
memberRoles {
id
name
locked
}
rateLimit {
retentionInDays
}
New redesign (#4) * New redesign * Use latest nextjs and bob It fixes the start command * fix: text overflow issue in the organization switcher dropdown (#14) * fix: text overflow issue in the organization switcher dropdown * feat: strict children typings * Force dark mode (#15) If somebody used the light mode before, Hive App displays light version of tailwind classes * Fix dev, GH app optional, project type instead of Connected (#16) * Make Github integration optional * Show project type instead of Connected * Fix dev command * Small changes to the version card (#17) * Small changes to the version card * Apply suggestions from code review * Polish (#18) * Make the design a bit more clean * Add a bit of separation * Apply suggestions from code review Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru> Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru> * fix: do not access properties on potential undefined variable (#33) * fix: renaming not being added during rebase (#32) * feat: add Mutation.createToken validation (#30) * Remove `#` from organization pages, polish subcription page (#34) * Remove `#` from project/target pages (#38) * fix: add missing service names for multi service projects (#35) * Re-design subscription (#40) * Missing list of changes in the schema diff view (#41) * Missing list of changes in the schema diff view Closes #19 * Apply suggestions from code review Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru> * Move titleMap outside of the component Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru> * Blurred fixed header + new `404` page + use `@theguild/prettier-config` (#44) * fix header * make things amazing * Update packages/web/app/pages/404.tsx * fix build * remove unused styles * Add --fix to lint-staged (#43) * Fix access (#45) * Fix access on organization level * Fix access on project level * Fix access on target level * Align with main * Bring back schema view (#49) * Add missing Mark as Valid button (#50) * Update the design of the operations view (#51) * Update doc link Co-authored-by: Dotan Simha <dotansimha@gmail.com> Co-authored-by: Kamil Kisiela <kamil.kisiela@gmail.com> Co-authored-by: Laurin Quast <laurinquast@googlemail.com>
2022-05-24 07:41:53 +00:00
}
}
}
error {
message
inputErrors {
slug
2022-05-18 07:26:57 +00:00
}
}
}
}
`),
authToken,
variables: {
input,
},
});
}
export function getOrganization(organizationSlug: string, authToken: string) {
2022-07-11 16:22:07 +00:00
return execute({
document: graphql(`
query getOrganization($organizationSlug: String!) {
organization(selector: { organizationSlug: $organizationSlug }) {
2022-07-11 16:22:07 +00:00
organization {
id
slug
2022-07-11 16:22:07 +00:00
getStarted {
creatingProject
publishingSchema
checkingSchema
invitingMembers
reportingOperations
enablingUsageBasedBreakingChanges
}
}
}
}
`),
authToken,
variables: {
organizationSlug,
2022-07-11 16:22:07 +00:00
},
});
}
export function inviteToOrganization(input: InviteToOrganizationByEmailInput, authToken: string) {
return execute({
document: graphql(`
mutation inviteToOrganization($input: InviteToOrganizationByEmailInput!) {
inviteToOrganizationByEmail(input: $input) {
ok {
id
createdAt
expiresAt
email
code
}
error {
message
}
}
}
`),
variables: {
input,
},
authToken,
});
}
export function updateOrganizationSlug(input: UpdateOrganizationSlugInput, authToken: string) {
return execute({
document: graphql(`
mutation updateOrganizationSlug($input: UpdateOrganizationSlugInput!) {
updateOrganizationSlug(input: $input) {
ok {
updatedOrganizationPayload {
selector {
organizationSlug
}
organization {
id
name
slug
}
}
}
error {
message
}
}
}
`),
variables: {
input,
},
authToken,
});
}
2022-05-18 07:26:57 +00:00
export function joinOrganization(code: string, authToken: string) {
return execute({
document: graphql(`
2022-05-18 07:26:57 +00:00
mutation joinOrganization($code: String!) {
joinOrganization(code: $code) {
__typename
... on OrganizationPayload {
organization {
id
slug
2022-05-18 07:26:57 +00:00
me {
id
2024-05-22 07:55:27 +00:00
user {
id
}
role {
id
name
permissions
}
2022-05-18 07:26:57 +00:00
}
}
}
... on OrganizationInvitationError {
message
}
}
}
`),
authToken,
variables: {
code,
},
});
}
export function getOrganizationMembers(selector: OrganizationSelectorInput, authToken: string) {
return execute({
document: graphql(`
query getOrganizationMembers($selector: OrganizationSelectorInput!) {
organization(selector: $selector) {
organization {
members {
nodes {
id
user {
2023-12-05 10:54:03 +00:00
id
email
}
2023-12-05 10:54:03 +00:00
role {
id
name
permissions
2023-12-05 10:54:03 +00:00
}
}
}
}
}
}
`),
authToken,
variables: {
selector,
},
});
}
export function getOrganizationProjects(selector: OrganizationSelectorInput, authToken: string) {
return execute({
document: graphql(`
query getOrganizationProjects($selector: OrganizationSelectorInput!) {
organization(selector: $selector) {
organization {
projects {
nodes {
id
slug
name
}
}
}
}
}
`),
authToken,
variables: {
selector,
},
});
}
export function getOrganizationTransferRequest(
selector: OrganizationTransferRequestSelector,
authToken: string,
) {
return execute({
document: graphql(`
query getOrganizationTransferRequest($selector: OrganizationTransferRequestSelector!) {
organizationTransferRequest(selector: $selector) {
organization {
id
}
}
}
`),
authToken,
variables: {
selector,
},
});
}
export function requestOrganizationTransfer(
input: RequestOrganizationTransferInput,
authToken: string,
) {
return execute({
document: graphql(`
mutation requestOrganizationTransfer($input: RequestOrganizationTransferInput!) {
requestOrganizationTransfer(input: $input) {
ok {
email
code
}
error {
message
}
}
}
`),
authToken,
variables: {
input,
},
});
}
export function answerOrganizationTransferRequest(
input: AnswerOrganizationTransferRequestInput,
authToken: string,
) {
return execute({
document: graphql(`
mutation answerOrganizationTransferRequest($input: AnswerOrganizationTransferRequestInput!) {
answerOrganizationTransferRequest(input: $input) {
ok {
accepted
}
error {
message
}
}
}
`),
authToken,
variables: {
input,
},
});
}
2022-05-18 07:26:57 +00:00
export function createProject(input: CreateProjectInput, authToken: string) {
return execute({
document: graphql(`
2022-05-18 07:26:57 +00:00
mutation createProject($input: CreateProjectInput!) {
createProject(input: $input) {
New redesign (#4) * New redesign * Use latest nextjs and bob It fixes the start command * fix: text overflow issue in the organization switcher dropdown (#14) * fix: text overflow issue in the organization switcher dropdown * feat: strict children typings * Force dark mode (#15) If somebody used the light mode before, Hive App displays light version of tailwind classes * Fix dev, GH app optional, project type instead of Connected (#16) * Make Github integration optional * Show project type instead of Connected * Fix dev command * Small changes to the version card (#17) * Small changes to the version card * Apply suggestions from code review * Polish (#18) * Make the design a bit more clean * Add a bit of separation * Apply suggestions from code review Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru> Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru> * fix: do not access properties on potential undefined variable (#33) * fix: renaming not being added during rebase (#32) * feat: add Mutation.createToken validation (#30) * Remove `#` from organization pages, polish subcription page (#34) * Remove `#` from project/target pages (#38) * fix: add missing service names for multi service projects (#35) * Re-design subscription (#40) * Missing list of changes in the schema diff view (#41) * Missing list of changes in the schema diff view Closes #19 * Apply suggestions from code review Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru> * Move titleMap outside of the component Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru> * Blurred fixed header + new `404` page + use `@theguild/prettier-config` (#44) * fix header * make things amazing * Update packages/web/app/pages/404.tsx * fix build * remove unused styles * Add --fix to lint-staged (#43) * Fix access (#45) * Fix access on organization level * Fix access on project level * Fix access on target level * Align with main * Bring back schema view (#49) * Add missing Mark as Valid button (#50) * Update the design of the operations view (#51) * Update doc link Co-authored-by: Dotan Simha <dotansimha@gmail.com> Co-authored-by: Kamil Kisiela <kamil.kisiela@gmail.com> Co-authored-by: Laurin Quast <laurinquast@googlemail.com>
2022-05-24 07:41:53 +00:00
ok {
createdProject {
id
slug
name
New redesign (#4) * New redesign * Use latest nextjs and bob It fixes the start command * fix: text overflow issue in the organization switcher dropdown (#14) * fix: text overflow issue in the organization switcher dropdown * feat: strict children typings * Force dark mode (#15) If somebody used the light mode before, Hive App displays light version of tailwind classes * Fix dev, GH app optional, project type instead of Connected (#16) * Make Github integration optional * Show project type instead of Connected * Fix dev command * Small changes to the version card (#17) * Small changes to the version card * Apply suggestions from code review * Polish (#18) * Make the design a bit more clean * Add a bit of separation * Apply suggestions from code review Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru> Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru> * fix: do not access properties on potential undefined variable (#33) * fix: renaming not being added during rebase (#32) * feat: add Mutation.createToken validation (#30) * Remove `#` from organization pages, polish subcription page (#34) * Remove `#` from project/target pages (#38) * fix: add missing service names for multi service projects (#35) * Re-design subscription (#40) * Missing list of changes in the schema diff view (#41) * Missing list of changes in the schema diff view Closes #19 * Apply suggestions from code review Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru> * Move titleMap outside of the component Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru> * Blurred fixed header + new `404` page + use `@theguild/prettier-config` (#44) * fix header * make things amazing * Update packages/web/app/pages/404.tsx * fix build * remove unused styles * Add --fix to lint-staged (#43) * Fix access (#45) * Fix access on organization level * Fix access on project level * Fix access on target level * Align with main * Bring back schema view (#49) * Add missing Mark as Valid button (#50) * Update the design of the operations view (#51) * Update doc link Co-authored-by: Dotan Simha <dotansimha@gmail.com> Co-authored-by: Kamil Kisiela <kamil.kisiela@gmail.com> Co-authored-by: Laurin Quast <laurinquast@googlemail.com>
2022-05-24 07:41:53 +00:00
}
createdTargets {
New redesign (#4) * New redesign * Use latest nextjs and bob It fixes the start command * fix: text overflow issue in the organization switcher dropdown (#14) * fix: text overflow issue in the organization switcher dropdown * feat: strict children typings * Force dark mode (#15) If somebody used the light mode before, Hive App displays light version of tailwind classes * Fix dev, GH app optional, project type instead of Connected (#16) * Make Github integration optional * Show project type instead of Connected * Fix dev command * Small changes to the version card (#17) * Small changes to the version card * Apply suggestions from code review * Polish (#18) * Make the design a bit more clean * Add a bit of separation * Apply suggestions from code review Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru> Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru> * fix: do not access properties on potential undefined variable (#33) * fix: renaming not being added during rebase (#32) * feat: add Mutation.createToken validation (#30) * Remove `#` from organization pages, polish subcription page (#34) * Remove `#` from project/target pages (#38) * fix: add missing service names for multi service projects (#35) * Re-design subscription (#40) * Missing list of changes in the schema diff view (#41) * Missing list of changes in the schema diff view Closes #19 * Apply suggestions from code review Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru> * Move titleMap outside of the component Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru> * Blurred fixed header + new `404` page + use `@theguild/prettier-config` (#44) * fix header * make things amazing * Update packages/web/app/pages/404.tsx * fix build * remove unused styles * Add --fix to lint-staged (#43) * Fix access (#45) * Fix access on organization level * Fix access on project level * Fix access on target level * Align with main * Bring back schema view (#49) * Add missing Mark as Valid button (#50) * Update the design of the operations view (#51) * Update doc link Co-authored-by: Dotan Simha <dotansimha@gmail.com> Co-authored-by: Kamil Kisiela <kamil.kisiela@gmail.com> Co-authored-by: Laurin Quast <laurinquast@googlemail.com>
2022-05-24 07:41:53 +00:00
id
slug
name
New redesign (#4) * New redesign * Use latest nextjs and bob It fixes the start command * fix: text overflow issue in the organization switcher dropdown (#14) * fix: text overflow issue in the organization switcher dropdown * feat: strict children typings * Force dark mode (#15) If somebody used the light mode before, Hive App displays light version of tailwind classes * Fix dev, GH app optional, project type instead of Connected (#16) * Make Github integration optional * Show project type instead of Connected * Fix dev command * Small changes to the version card (#17) * Small changes to the version card * Apply suggestions from code review * Polish (#18) * Make the design a bit more clean * Add a bit of separation * Apply suggestions from code review Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru> Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru> * fix: do not access properties on potential undefined variable (#33) * fix: renaming not being added during rebase (#32) * feat: add Mutation.createToken validation (#30) * Remove `#` from organization pages, polish subcription page (#34) * Remove `#` from project/target pages (#38) * fix: add missing service names for multi service projects (#35) * Re-design subscription (#40) * Missing list of changes in the schema diff view (#41) * Missing list of changes in the schema diff view Closes #19 * Apply suggestions from code review Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru> * Move titleMap outside of the component Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru> * Blurred fixed header + new `404` page + use `@theguild/prettier-config` (#44) * fix header * make things amazing * Update packages/web/app/pages/404.tsx * fix build * remove unused styles * Add --fix to lint-staged (#43) * Fix access (#45) * Fix access on organization level * Fix access on project level * Fix access on target level * Align with main * Bring back schema view (#49) * Add missing Mark as Valid button (#50) * Update the design of the operations view (#51) * Update doc link Co-authored-by: Dotan Simha <dotansimha@gmail.com> Co-authored-by: Kamil Kisiela <kamil.kisiela@gmail.com> Co-authored-by: Laurin Quast <laurinquast@googlemail.com>
2022-05-24 07:41:53 +00:00
}
2022-05-18 07:26:57 +00:00
}
}
}
`),
authToken,
variables: {
input,
},
});
}
export function updateProjectSlug(input: UpdateProjectSlugInput, authToken: string) {
return execute({
document: graphql(`
mutation updateProjectSlug($input: UpdateProjectSlugInput!) {
updateProjectSlug(input: $input) {
ok {
selector {
organizationSlug
projectSlug
}
project {
id
name
slug
}
}
error {
message
}
}
}
`),
authToken,
variables: {
input,
},
});
}
2022-05-18 07:26:57 +00:00
export function createTarget(input: CreateTargetInput, authToken: string) {
return execute({
document: graphql(`
2022-05-18 07:26:57 +00:00
mutation createTarget($input: CreateTargetInput!) {
createTarget(input: $input) {
New redesign (#4) * New redesign * Use latest nextjs and bob It fixes the start command * fix: text overflow issue in the organization switcher dropdown (#14) * fix: text overflow issue in the organization switcher dropdown * feat: strict children typings * Force dark mode (#15) If somebody used the light mode before, Hive App displays light version of tailwind classes * Fix dev, GH app optional, project type instead of Connected (#16) * Make Github integration optional * Show project type instead of Connected * Fix dev command * Small changes to the version card (#17) * Small changes to the version card * Apply suggestions from code review * Polish (#18) * Make the design a bit more clean * Add a bit of separation * Apply suggestions from code review Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru> Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru> * fix: do not access properties on potential undefined variable (#33) * fix: renaming not being added during rebase (#32) * feat: add Mutation.createToken validation (#30) * Remove `#` from organization pages, polish subcription page (#34) * Remove `#` from project/target pages (#38) * fix: add missing service names for multi service projects (#35) * Re-design subscription (#40) * Missing list of changes in the schema diff view (#41) * Missing list of changes in the schema diff view Closes #19 * Apply suggestions from code review Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru> * Move titleMap outside of the component Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru> * Blurred fixed header + new `404` page + use `@theguild/prettier-config` (#44) * fix header * make things amazing * Update packages/web/app/pages/404.tsx * fix build * remove unused styles * Add --fix to lint-staged (#43) * Fix access (#45) * Fix access on organization level * Fix access on project level * Fix access on target level * Align with main * Bring back schema view (#49) * Add missing Mark as Valid button (#50) * Update the design of the operations view (#51) * Update doc link Co-authored-by: Dotan Simha <dotansimha@gmail.com> Co-authored-by: Kamil Kisiela <kamil.kisiela@gmail.com> Co-authored-by: Laurin Quast <laurinquast@googlemail.com>
2022-05-24 07:41:53 +00:00
ok {
createdTarget {
id
slug
New redesign (#4) * New redesign * Use latest nextjs and bob It fixes the start command * fix: text overflow issue in the organization switcher dropdown (#14) * fix: text overflow issue in the organization switcher dropdown * feat: strict children typings * Force dark mode (#15) If somebody used the light mode before, Hive App displays light version of tailwind classes * Fix dev, GH app optional, project type instead of Connected (#16) * Make Github integration optional * Show project type instead of Connected * Fix dev command * Small changes to the version card (#17) * Small changes to the version card * Apply suggestions from code review * Polish (#18) * Make the design a bit more clean * Add a bit of separation * Apply suggestions from code review Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru> Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru> * fix: do not access properties on potential undefined variable (#33) * fix: renaming not being added during rebase (#32) * feat: add Mutation.createToken validation (#30) * Remove `#` from organization pages, polish subcription page (#34) * Remove `#` from project/target pages (#38) * fix: add missing service names for multi service projects (#35) * Re-design subscription (#40) * Missing list of changes in the schema diff view (#41) * Missing list of changes in the schema diff view Closes #19 * Apply suggestions from code review Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru> * Move titleMap outside of the component Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru> * Blurred fixed header + new `404` page + use `@theguild/prettier-config` (#44) * fix header * make things amazing * Update packages/web/app/pages/404.tsx * fix build * remove unused styles * Add --fix to lint-staged (#43) * Fix access (#45) * Fix access on organization level * Fix access on project level * Fix access on target level * Align with main * Bring back schema view (#49) * Add missing Mark as Valid button (#50) * Update the design of the operations view (#51) * Update doc link Co-authored-by: Dotan Simha <dotansimha@gmail.com> Co-authored-by: Kamil Kisiela <kamil.kisiela@gmail.com> Co-authored-by: Laurin Quast <laurinquast@googlemail.com>
2022-05-24 07:41:53 +00:00
}
2022-05-18 07:26:57 +00:00
}
error {
message
}
2022-05-18 07:26:57 +00:00
}
}
`),
authToken,
variables: {
input,
},
});
}
export function updateTargetSlug(input: UpdateTargetSlugInput, authToken: string) {
return execute({
document: graphql(`
mutation updateTargetSlug($input: UpdateTargetSlugInput!) {
updateTargetSlug(input: $input) {
ok {
selector {
organizationSlug
projectSlug
targetSlug
}
target {
id
slug
name
}
}
error {
message
}
}
}
`),
authToken,
variables: {
input,
},
});
}
2022-05-18 07:26:57 +00:00
export function createToken(input: CreateTokenInput, authToken: string) {
return execute({
document: graphql(`
2022-05-18 07:26:57 +00:00
mutation createToken($input: CreateTokenInput!) {
createToken(input: $input) {
New redesign (#4) * New redesign * Use latest nextjs and bob It fixes the start command * fix: text overflow issue in the organization switcher dropdown (#14) * fix: text overflow issue in the organization switcher dropdown * feat: strict children typings * Force dark mode (#15) If somebody used the light mode before, Hive App displays light version of tailwind classes * Fix dev, GH app optional, project type instead of Connected (#16) * Make Github integration optional * Show project type instead of Connected * Fix dev command * Small changes to the version card (#17) * Small changes to the version card * Apply suggestions from code review * Polish (#18) * Make the design a bit more clean * Add a bit of separation * Apply suggestions from code review Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru> Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru> * fix: do not access properties on potential undefined variable (#33) * fix: renaming not being added during rebase (#32) * feat: add Mutation.createToken validation (#30) * Remove `#` from organization pages, polish subcription page (#34) * Remove `#` from project/target pages (#38) * fix: add missing service names for multi service projects (#35) * Re-design subscription (#40) * Missing list of changes in the schema diff view (#41) * Missing list of changes in the schema diff view Closes #19 * Apply suggestions from code review Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru> * Move titleMap outside of the component Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru> * Blurred fixed header + new `404` page + use `@theguild/prettier-config` (#44) * fix header * make things amazing * Update packages/web/app/pages/404.tsx * fix build * remove unused styles * Add --fix to lint-staged (#43) * Fix access (#45) * Fix access on organization level * Fix access on project level * Fix access on target level * Align with main * Bring back schema view (#49) * Add missing Mark as Valid button (#50) * Update the design of the operations view (#51) * Update doc link Co-authored-by: Dotan Simha <dotansimha@gmail.com> Co-authored-by: Kamil Kisiela <kamil.kisiela@gmail.com> Co-authored-by: Laurin Quast <laurinquast@googlemail.com>
2022-05-24 07:41:53 +00:00
ok {
secret
createdToken {
id
}
New redesign (#4) * New redesign * Use latest nextjs and bob It fixes the start command * fix: text overflow issue in the organization switcher dropdown (#14) * fix: text overflow issue in the organization switcher dropdown * feat: strict children typings * Force dark mode (#15) If somebody used the light mode before, Hive App displays light version of tailwind classes * Fix dev, GH app optional, project type instead of Connected (#16) * Make Github integration optional * Show project type instead of Connected * Fix dev command * Small changes to the version card (#17) * Small changes to the version card * Apply suggestions from code review * Polish (#18) * Make the design a bit more clean * Add a bit of separation * Apply suggestions from code review Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru> Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru> * fix: do not access properties on potential undefined variable (#33) * fix: renaming not being added during rebase (#32) * feat: add Mutation.createToken validation (#30) * Remove `#` from organization pages, polish subcription page (#34) * Remove `#` from project/target pages (#38) * fix: add missing service names for multi service projects (#35) * Re-design subscription (#40) * Missing list of changes in the schema diff view (#41) * Missing list of changes in the schema diff view Closes #19 * Apply suggestions from code review Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru> * Move titleMap outside of the component Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru> * Blurred fixed header + new `404` page + use `@theguild/prettier-config` (#44) * fix header * make things amazing * Update packages/web/app/pages/404.tsx * fix build * remove unused styles * Add --fix to lint-staged (#43) * Fix access (#45) * Fix access on organization level * Fix access on project level * Fix access on target level * Align with main * Bring back schema view (#49) * Add missing Mark as Valid button (#50) * Update the design of the operations view (#51) * Update doc link Co-authored-by: Dotan Simha <dotansimha@gmail.com> Co-authored-by: Kamil Kisiela <kamil.kisiela@gmail.com> Co-authored-by: Laurin Quast <laurinquast@googlemail.com>
2022-05-24 07:41:53 +00:00
}
2022-05-18 07:26:57 +00:00
}
}
`),
authToken,
variables: {
input,
},
});
}
export function deleteTokens(input: DeleteTokensInput, authToken: string) {
return execute({
document: graphql(`
mutation deleteTokens($input: DeleteTokensInput!) {
deleteTokens(input: $input) {
deletedTokens
}
}
`),
authToken,
variables: {
input,
},
});
}
export function readTokenInfo(token: string) {
return execute({
document: graphql(`
query readTokenInfo {
tokenInfo {
__typename
... on TokenInfo {
hasOrganizationRead: hasOrganizationScope(scope: READ)
hasOrganizationDelete: hasOrganizationScope(scope: DELETE)
hasOrganizationSettings: hasOrganizationScope(scope: SETTINGS)
hasOrganizationIntegrations: hasOrganizationScope(scope: INTEGRATIONS)
hasOrganizationMembers: hasOrganizationScope(scope: MEMBERS)
hasProjectRead: hasProjectScope(scope: READ)
hasProjectDelete: hasProjectScope(scope: DELETE)
hasProjectSettings: hasProjectScope(scope: SETTINGS)
hasProjectAlerts: hasProjectScope(scope: ALERTS)
hasProjectOperationsStoreRead: hasProjectScope(scope: OPERATIONS_STORE_READ)
hasProjectOperationsStoreWrite: hasProjectScope(scope: OPERATIONS_STORE_WRITE)
hasTargetRead: hasTargetScope(scope: READ)
hasTargetDelete: hasTargetScope(scope: DELETE)
hasTargetSettings: hasTargetScope(scope: SETTINGS)
hasTargetRegistryRead: hasTargetScope(scope: REGISTRY_READ)
hasTargetRegistryWrite: hasTargetScope(scope: REGISTRY_WRITE)
hasTargetTokensRead: hasTargetScope(scope: TOKENS_READ)
hasTargetTokensWrite: hasTargetScope(scope: TOKENS_WRITE)
}
... on TokenNotFoundError {
message
}
}
}
`),
token,
});
}
export function addAlertChannel(input: AddAlertChannelInput, authToken: string) {
return execute({
document: graphql(`
mutation IntegrationTests_AddAlertChannel($input: AddAlertChannelInput!) {
addAlertChannel(input: $input) {
ok {
addedAlertChannel {
id
name
type
... on AlertSlackChannel {
channel
}
... on AlertWebhookChannel {
endpoint
}
... on TeamsWebhookChannel {
endpoint
}
}
}
error {
message
inputErrors {
webhookEndpoint
slackChannel
name
}
}
}
}
`),
variables: {
input,
},
authToken,
});
}
export function addAlert(input: AddAlertInput, authToken: string) {
return execute({
document: graphql(`
mutation IntegrationTests_AddAlert($input: AddAlertInput!) {
addAlert(input: $input) {
ok {
addedAlert {
id
type
channel {
id
name
type
}
target {
id
slug
}
}
}
error {
message
}
}
}
`),
variables: {
input,
},
authToken,
});
}
export function readOrganizationInfo(
selector: {
organizationSlug: string;
},
authToken: string,
) {
return execute({
document: graphql(`
query readOrganizationInfo($selector: OrganizationSelectorInput!) {
organization(selector: $selector) {
organization {
id
slug
}
}
}
`),
authToken,
variables: {
selector,
},
});
}
export function readProjectInfo(
selector: {
organizationSlug: string;
projectSlug: string;
},
authToken: string,
) {
return execute({
document: graphql(`
query readProjectInfo($selector: ProjectSelectorInput!) {
project(selector: $selector) {
id
slug
}
}
`),
authToken,
variables: {
selector,
},
});
}
export function readTargetInfo(
selector: {
organizationSlug: string;
projectSlug: string;
targetSlug: string;
},
authToken: string,
) {
return execute({
document: graphql(`
query readTargetInfo($selector: TargetSelectorInput!) {
target(selector: $selector) {
id
slug
}
}
`),
authToken,
variables: {
selector,
},
});
}
2023-12-05 10:54:03 +00:00
export function createMemberRole(input: CreateMemberRoleInput, authToken: string) {
2022-05-18 07:26:57 +00:00
return execute({
document: graphql(`
2023-12-05 10:54:03 +00:00
mutation createMemberRole($input: CreateMemberRoleInput!) {
createMemberRole(input: $input) {
ok {
updatedOrganization {
id
slug
2023-12-05 10:54:03 +00:00
memberRoles {
2022-05-18 07:26:57 +00:00
id
2023-12-05 10:54:03 +00:00
name
description
locked
permissions
2022-05-18 07:26:57 +00:00
}
}
2023-12-05 10:54:03 +00:00
}
error {
message
inputErrors {
name
description
}
}
}
}
`),
authToken,
variables: {
input,
},
});
}
export function assignMemberRole(input: AssignMemberRoleInput, authToken: string) {
return execute({
document: graphql(`
mutation assignMemberRole($input: AssignMemberRoleInput!) {
assignMemberRole(input: $input) {
ok {
updatedMember {
2022-05-18 07:26:57 +00:00
id
}
}
2023-12-05 10:54:03 +00:00
error {
message
}
}
}
`),
authToken,
variables: {
input,
},
});
}
export function deleteMemberRole(input: DeleteMemberRoleInput, authToken: string) {
return execute({
document: graphql(`
mutation deleteMemberRole($input: DeleteMemberRoleInput!) {
deleteMemberRole(input: $input) {
ok {
updatedOrganization {
id
slug
2023-12-05 10:54:03 +00:00
memberRoles {
id
name
description
locked
permissions
2023-12-05 10:54:03 +00:00
}
}
}
error {
message
}
}
}
`),
authToken,
variables: {
input,
},
});
}
export function updateMemberRole(input: UpdateMemberRoleInput, authToken: string) {
return execute({
document: graphql(`
mutation updateMemberRole($input: UpdateMemberRoleInput!) {
updateMemberRole(input: $input) {
ok {
updatedRole {
id
name
description
locked
permissions
2023-12-05 10:54:03 +00:00
}
}
error {
message
inputErrors {
name
description
}
}
2022-05-18 07:26:57 +00:00
}
}
`),
authToken,
variables: {
input,
},
});
}
export function publishSchema(
input: SchemaPublishInput,
token: string,
authHeader?: 'x-api-token' | 'authorization',
) {
2022-05-18 07:26:57 +00:00
return execute({
document: graphql(`
2022-05-18 07:26:57 +00:00
mutation schemaPublish($input: SchemaPublishInput!) {
schemaPublish(input: $input) {
__typename
... on SchemaPublishSuccess {
initial
valid
message
linkToWebsite
2022-05-18 07:26:57 +00:00
changes {
nodes {
message
criticality
}
total
}
}
... on SchemaPublishError {
valid
linkToWebsite
2022-05-18 07:26:57 +00:00
changes {
nodes {
message
criticality
}
total
}
errors {
nodes {
message
}
total
}
}
}
}
`),
token,
variables: {
input,
},
legacyAuthorizationMode: authHeader === 'x-api-token',
2022-05-18 07:26:57 +00:00
});
}
export function checkSchema(input: SchemaCheckInput, token: string) {
return execute({
document: graphql(`
2022-05-18 07:26:57 +00:00
mutation schemaCheck($input: SchemaCheckInput!) {
schemaCheck(input: $input) {
... on SchemaCheckSuccess {
__typename
valid
changes {
nodes {
message
criticality
}
total
}
schemaCheck {
id
}
2022-05-18 07:26:57 +00:00
}
... on SchemaCheckError {
__typename
valid
changes {
nodes {
message
criticality
}
total
}
errors {
nodes {
message
}
total
}
schemaCheck {
id
}
2022-05-18 07:26:57 +00:00
}
}
}
`),
token,
variables: {
input,
},
});
}
export function deleteSchema(
input: SchemaDeleteInput,
token: string,
authHeader?: 'x-api-token' | 'authorization',
) {
return execute({
document: graphql(`
mutation schemaDelete($input: SchemaDeleteInput!) {
schemaDelete(input: $input) {
__typename
... on SchemaDeleteSuccess {
valid
changes {
nodes {
criticality
message
}
total
}
errors {
nodes {
message
}
total
}
}
... on SchemaDeleteError {
valid
errors {
nodes {
message
}
total
}
}
}
}
`),
token,
variables: {
input,
},
legacyAuthorizationMode: authHeader === 'x-api-token',
});
}
2022-05-18 07:26:57 +00:00
export function setTargetValidation(
input: SetTargetValidationInput,
access:
| {
token: string;
}
| {
authToken: string;
},
2022-05-18 07:26:57 +00:00
) {
return execute({
document: graphql(`
2022-05-18 07:26:57 +00:00
mutation setTargetValidation($input: SetTargetValidationInput!) {
setTargetValidation(input: $input) {
id
validationSettings {
enabled
period
percentage
excludedClients
}
2022-05-18 07:26:57 +00:00
}
}
`),
...access,
variables: {
input,
},
});
}
export function updateTargetValidationSettings(
input: UpdateTargetValidationSettingsInput,
access:
| {
token: string;
}
| {
authToken: string;
},
2022-05-18 07:26:57 +00:00
) {
return execute({
document: graphql(`
mutation updateTargetValidationSettings($input: UpdateTargetValidationSettingsInput!) {
2022-05-18 07:26:57 +00:00
updateTargetValidationSettings(input: $input) {
New redesign (#4) * New redesign * Use latest nextjs and bob It fixes the start command * fix: text overflow issue in the organization switcher dropdown (#14) * fix: text overflow issue in the organization switcher dropdown * feat: strict children typings * Force dark mode (#15) If somebody used the light mode before, Hive App displays light version of tailwind classes * Fix dev, GH app optional, project type instead of Connected (#16) * Make Github integration optional * Show project type instead of Connected * Fix dev command * Small changes to the version card (#17) * Small changes to the version card * Apply suggestions from code review * Polish (#18) * Make the design a bit more clean * Add a bit of separation * Apply suggestions from code review Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru> Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru> * fix: do not access properties on potential undefined variable (#33) * fix: renaming not being added during rebase (#32) * feat: add Mutation.createToken validation (#30) * Remove `#` from organization pages, polish subcription page (#34) * Remove `#` from project/target pages (#38) * fix: add missing service names for multi service projects (#35) * Re-design subscription (#40) * Missing list of changes in the schema diff view (#41) * Missing list of changes in the schema diff view Closes #19 * Apply suggestions from code review Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru> * Move titleMap outside of the component Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru> * Blurred fixed header + new `404` page + use `@theguild/prettier-config` (#44) * fix header * make things amazing * Update packages/web/app/pages/404.tsx * fix build * remove unused styles * Add --fix to lint-staged (#43) * Fix access (#45) * Fix access on organization level * Fix access on project level * Fix access on target level * Align with main * Bring back schema view (#49) * Add missing Mark as Valid button (#50) * Update the design of the operations view (#51) * Update doc link Co-authored-by: Dotan Simha <dotansimha@gmail.com> Co-authored-by: Kamil Kisiela <kamil.kisiela@gmail.com> Co-authored-by: Laurin Quast <laurinquast@googlemail.com>
2022-05-24 07:41:53 +00:00
ok {
target {
New redesign (#4) * New redesign * Use latest nextjs and bob It fixes the start command * fix: text overflow issue in the organization switcher dropdown (#14) * fix: text overflow issue in the organization switcher dropdown * feat: strict children typings * Force dark mode (#15) If somebody used the light mode before, Hive App displays light version of tailwind classes * Fix dev, GH app optional, project type instead of Connected (#16) * Make Github integration optional * Show project type instead of Connected * Fix dev command * Small changes to the version card (#17) * Small changes to the version card * Apply suggestions from code review * Polish (#18) * Make the design a bit more clean * Add a bit of separation * Apply suggestions from code review Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru> Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru> * fix: do not access properties on potential undefined variable (#33) * fix: renaming not being added during rebase (#32) * feat: add Mutation.createToken validation (#30) * Remove `#` from organization pages, polish subcription page (#34) * Remove `#` from project/target pages (#38) * fix: add missing service names for multi service projects (#35) * Re-design subscription (#40) * Missing list of changes in the schema diff view (#41) * Missing list of changes in the schema diff view Closes #19 * Apply suggestions from code review Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru> * Move titleMap outside of the component Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru> * Blurred fixed header + new `404` page + use `@theguild/prettier-config` (#44) * fix header * make things amazing * Update packages/web/app/pages/404.tsx * fix build * remove unused styles * Add --fix to lint-staged (#43) * Fix access (#45) * Fix access on organization level * Fix access on project level * Fix access on target level * Align with main * Bring back schema view (#49) * Add missing Mark as Valid button (#50) * Update the design of the operations view (#51) * Update doc link Co-authored-by: Dotan Simha <dotansimha@gmail.com> Co-authored-by: Kamil Kisiela <kamil.kisiela@gmail.com> Co-authored-by: Laurin Quast <laurinquast@googlemail.com>
2022-05-24 07:41:53 +00:00
id
validationSettings {
enabled
period
percentage
targets {
id
}
excludedClients
New redesign (#4) * New redesign * Use latest nextjs and bob It fixes the start command * fix: text overflow issue in the organization switcher dropdown (#14) * fix: text overflow issue in the organization switcher dropdown * feat: strict children typings * Force dark mode (#15) If somebody used the light mode before, Hive App displays light version of tailwind classes * Fix dev, GH app optional, project type instead of Connected (#16) * Make Github integration optional * Show project type instead of Connected * Fix dev command * Small changes to the version card (#17) * Small changes to the version card * Apply suggestions from code review * Polish (#18) * Make the design a bit more clean * Add a bit of separation * Apply suggestions from code review Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru> Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru> * fix: do not access properties on potential undefined variable (#33) * fix: renaming not being added during rebase (#32) * feat: add Mutation.createToken validation (#30) * Remove `#` from organization pages, polish subcription page (#34) * Remove `#` from project/target pages (#38) * fix: add missing service names for multi service projects (#35) * Re-design subscription (#40) * Missing list of changes in the schema diff view (#41) * Missing list of changes in the schema diff view Closes #19 * Apply suggestions from code review Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru> * Move titleMap outside of the component Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru> * Blurred fixed header + new `404` page + use `@theguild/prettier-config` (#44) * fix header * make things amazing * Update packages/web/app/pages/404.tsx * fix build * remove unused styles * Add --fix to lint-staged (#43) * Fix access (#45) * Fix access on organization level * Fix access on project level * Fix access on target level * Align with main * Bring back schema view (#49) * Add missing Mark as Valid button (#50) * Update the design of the operations view (#51) * Update doc link Co-authored-by: Dotan Simha <dotansimha@gmail.com> Co-authored-by: Kamil Kisiela <kamil.kisiela@gmail.com> Co-authored-by: Laurin Quast <laurinquast@googlemail.com>
2022-05-24 07:41:53 +00:00
}
}
2022-05-18 07:26:57 +00:00
}
error {
message
inputErrors {
percentage
period
}
}
2022-05-18 07:26:57 +00:00
}
}
`),
...access,
variables: {
input,
},
});
}
export function updateBaseSchema(input: UpdateBaseSchemaInput, token: string) {
return execute({
document: graphql(`
2022-05-18 07:26:57 +00:00
mutation updateBaseSchema($input: UpdateBaseSchemaInput!) {
updateBaseSchema(input: $input) {
__typename
}
}
`),
token,
variables: {
input,
},
});
}
export function readClientStats(selector: ClientStatsInput, token: string) {
return execute({
document: graphql(`
query IntegrationTests_ClientStat($selector: ClientStatsInput!) {
clientStats(selector: $selector) {
totalRequests
totalVersions
operations {
nodes {
id
name
operationHash
count
}
}
versions(limit: 25) {
version
count
}
}
}
`),
token,
variables: {
selector,
},
});
}
export function readOperationsStats(input: OperationsStatsSelectorInput, token: string) {
2022-05-18 07:26:57 +00:00
return execute({
document: graphql(`
2022-05-18 07:26:57 +00:00
query readOperationsStats($input: OperationsStatsSelectorInput!) {
operationsStats(selector: $input) {
totalOperations
operations {
nodes {
id
operationHash
kind
name
count
percentage
duration {
p75
p90
p95
p99
}
}
}
clients {
nodes {
name
versions {
version
count
}
count
}
}
2022-05-18 07:26:57 +00:00
}
}
`),
token,
variables: {
input,
},
});
}
export function readOperationBody(
selector: {
organizationSlug: string;
projectSlug: string;
targetSlug: string;
hash: string;
},
token: string,
) {
return execute({
document: graphql(`
query readOperationBody($selector: TargetSelectorInput!, $hash: String!) {
target(selector: $selector) {
id
operation(hash: $hash) {
body
}
}
}
`),
token,
variables: {
selector: {
organizationSlug: selector.organizationSlug,
projectSlug: selector.projectSlug,
targetSlug: selector.targetSlug,
},
hash: selector.hash,
},
});
}
2022-05-18 07:26:57 +00:00
export function fetchLatestSchema(token: string) {
return execute({
document: graphql(`
2022-05-18 07:26:57 +00:00
query latestVersion {
latestVersion {
baseSchema
log {
... on PushedSchemaLog {
__typename
commit
service
}
... on DeletedSchemaLog {
__typename
deletedService
}
}
2022-05-18 07:26:57 +00:00
schemas {
nodes {
... on SingleSchema {
source
commit
}
... on CompositeSchema {
source
commit
url
}
2022-05-18 07:26:57 +00:00
}
total
}
errors: schemaCompositionErrors {
nodes {
message
}
total
}
2022-05-18 07:26:57 +00:00
}
}
`),
token,
});
}
export function fetchLatestValidSchema(token: string) {
return execute({
document: graphql(`
2022-05-18 07:26:57 +00:00
query latestValidVersion {
latestValidVersion {
id
baseSchema
log {
... on PushedSchemaLog {
__typename
commit
service
}
... on DeletedSchemaLog {
__typename
deletedService
}
}
tags
2022-05-18 07:26:57 +00:00
schemas {
nodes {
... on SingleSchema {
__typename
source
commit
}
... on CompositeSchema {
__typename
source
commit
url
}
2022-05-18 07:26:57 +00:00
}
total
}
}
}
`),
token,
});
}
export function fetchVersions(selector: TargetSelectorInput, first: number, token: string) {
2022-05-18 07:26:57 +00:00
return execute({
document: graphql(`
query schemaVersions($first: Int!, $selector: TargetSelectorInput!) {
target(selector: $selector) {
schemaVersions(first: $first) {
edges {
node {
id
valid
date
log {
... on PushedSchemaLog {
__typename
commit
service
}
... on DeletedSchemaLog {
__typename
deletedService
}
}
baseSchema
schemas {
nodes {
... on SingleSchema {
__typename
source
commit
}
... on CompositeSchema {
__typename
source
commit
url
}
}
}
2022-05-18 07:26:57 +00:00
}
}
}
}
}
`),
token,
variables: {
selector,
first,
2022-05-18 07:26:57 +00:00
},
});
}
export function compareToPreviousVersion(
selector: {
organizationSlug: string;
projectSlug: string;
targetSlug: string;
version: string;
},
token: string,
) {
return execute({
document: graphql(`
query compareToPreviousVersion(
$organizationSlug: String!
$projectSlug: String!
$targetSlug: String!
$version: ID!
) {
target(
selector: {
organizationSlug: $organizationSlug
projectSlug: $projectSlug
targetSlug: $targetSlug
}
) {
id
schemaVersion(id: $version) {
id
sdl
supergraph
log {
... on PushedSchemaLog {
id
author
service
commit
serviceSdl
previousServiceSdl
}
... on DeletedSchemaLog {
id
deletedService
previousServiceSdl
}
}
schemaCompositionErrors {
nodes {
message
}
}
isFirstComposableVersion
breakingSchemaChanges {
nodes {
message(withSafeBasedOnUsageNote: false)
criticality
criticalityReason
path
approval {
approvedBy {
id
displayName
}
approvedAt
schemaCheckId
}
isSafeBasedOnUsage
}
}
safeSchemaChanges {
nodes {
message(withSafeBasedOnUsageNote: false)
criticality
criticalityReason
path
approval {
approvedBy {
id
displayName
}
approvedAt
schemaCheckId
}
isSafeBasedOnUsage
}
}
previousDiffableSchemaVersion {
id
supergraph
sdl
}
}
}
}
`),
token,
variables: {
...selector,
},
});
}
2022-05-18 07:26:57 +00:00
export function createCdnAccess(selector: TargetSelectorInput, token: string) {
return execute({
document: graphql(`
2023-01-27 11:59:09 +00:00
mutation createCdnAccessToken($input: CreateCdnAccessTokenInput!) {
createCdnAccessToken(input: $input) {
ok {
secretAccessToken
cdnUrl
}
error {
message
}
2022-05-18 07:26:57 +00:00
}
}
`),
token,
variables: {
2023-01-27 11:59:09 +00:00
input: { selector, alias: 'CDN Access Token' },
2022-05-18 07:26:57 +00:00
},
});
}
export async function fetchSchemaFromCDN(cdnUrl: string, secretAccessToken: string) {
const res = await fetch(cdnUrl + '/sdl', {
2022-05-18 07:26:57 +00:00
headers: {
'X-Hive-CDN-Key': secretAccessToken,
2022-05-18 07:26:57 +00:00
},
});
return {
body: await res.text(),
2022-05-18 07:26:57 +00:00
status: res.status,
};
}
export async function fetchSupergraphFromCDN(cdnUrl: string, secretAccessToken: string) {
const res = await fetch(cdnUrl + '/supergraph', {
headers: {
'X-Hive-CDN-Key': secretAccessToken,
},
});
const textBody = await res.text();
return {
body: textBody,
status: res.status,
};
}
export async function fetchMetadataFromCDN(cdnUrl: string, secretAccessToken: string) {
const res = await fetch(cdnUrl + '/metadata', {
2022-05-18 07:26:57 +00:00
headers: {
Accept: 'application/json',
'X-Hive-CDN-Key': secretAccessToken,
2022-05-18 07:26:57 +00:00
},
});
const jsonBody = await res.json();
2022-05-18 07:26:57 +00:00
return {
body: jsonBody,
2022-05-18 07:26:57 +00:00
status: res.status,
};
}
export async function updateOrgRateLimit(
selector: OrganizationSelectorInput,
monthlyLimits: RateLimitInput,
authToken: string,
) {
return execute({
document: graphql(`
mutation updateOrgRateLimit(
$selector: OrganizationSelectorInput!
$monthlyLimits: RateLimitInput!
) {
updateOrgRateLimit(selector: $selector, monthlyLimits: $monthlyLimits) {
id
}
}
`),
variables: {
selector,
monthlyLimits,
},
authToken,
});
}
2022-09-16 11:30:50 +00:00
export async function enableExternalSchemaComposition(
input: EnableExternalSchemaCompositionInput,
token: string,
) {
2022-09-16 11:30:50 +00:00
return execute({
document: graphql(`
2022-09-16 11:30:50 +00:00
mutation enableExternalSchemaComposition($input: EnableExternalSchemaCompositionInput!) {
enableExternalSchemaComposition(input: $input) {
ok {
id
externalSchemaComposition {
endpoint
}
2022-09-16 11:30:50 +00:00
}
error {
message
inputErrors {
endpoint
secret
}
}
}
}
`),
variables: {
input,
},
token,
});
}
export async function updateTargetSchemaComposition(
input: Experimental__UpdateTargetSchemaCompositionInput,
token: string,
) {
return execute({
document: graphql(`
mutation experimental__updateTargetSchemaComposition(
$input: Experimental__UpdateTargetSchemaCompositionInput!
) {
experimental__updateTargetSchemaComposition(input: $input) {
id
}
}
`),
variables: {
input,
},
token,
});
}
export function createOrganizationAccessToken(
input: CreateOrganizationAccessTokenInput,
authToken: string,
) {
return execute({
document: graphql(`
mutation CreateOrganizationAccessToken($input: CreateOrganizationAccessTokenInput!) {
createOrganizationAccessToken(input: $input) {
ok {
privateAccessKey
createdOrganizationAccessToken {
id
title
description
permissions
createdAt
}
}
error {
message
details {
title
description
}
}
}
}
`),
authToken,
variables: {
input,
},
});
}