From de1054720b9280efeb5cb74001eafcb6bff38290 Mon Sep 17 00:00:00 2001 From: Alessandro Magionami Date: Mon, 31 Mar 2025 17:15:36 +0200 Subject: [PATCH] feat(workspaces): member by role counts --- .../typedefs/workspaceSeats.graphql | 3 + .../typedefs/workspaces.graphql | 14 +++ .../modules/core/graph/generated/graphql.ts | 32 ++++++ .../graph/generated/graphql.ts | 13 +++ .../workspaces/graph/resolvers/workspaces.ts | 33 ++++++- .../workspaces/tests/helpers/graphql.ts | 20 ++++ .../integration/workspaces.graph.spec.ts | 97 ++++++++++++++++++- .../server/test/graphql/generated/graphql.ts | 21 ++++ 8 files changed, 230 insertions(+), 3 deletions(-) diff --git a/packages/server/assets/gatekeeperCore/typedefs/workspaceSeats.graphql b/packages/server/assets/gatekeeperCore/typedefs/workspaceSeats.graphql index 69a0d50d0..731979c01 100644 --- a/packages/server/assets/gatekeeperCore/typedefs/workspaceSeats.graphql +++ b/packages/server/assets/gatekeeperCore/typedefs/workspaceSeats.graphql @@ -20,6 +20,9 @@ extend type Workspace { """ seatType: WorkspaceSeatType seatsByType: WorkspaceSeatsByType + @hasServerRole(role: SERVER_USER) + @hasScope(scope: "workspace:read") + @hasWorkspaceRole(role: ADMIN) } type WorkspaceSeatsByType { diff --git a/packages/server/assets/workspacesCore/typedefs/workspaces.graphql b/packages/server/assets/workspacesCore/typedefs/workspaces.graphql index b65c0efa7..67ed60d66 100644 --- a/packages/server/assets/workspacesCore/typedefs/workspaces.graphql +++ b/packages/server/assets/workspacesCore/typedefs/workspaces.graphql @@ -318,6 +318,20 @@ type Workspace { @hasServerRole(role: SERVER_USER) @hasScope(scope: "workspace:read") @hasWorkspaceRole(role: ADMIN) + membersByRole: WorkspaceMembersByRole + @hasServerRole(role: SERVER_USER) + @hasScope(scope: "workspace:read") + @hasWorkspaceRole(role: ADMIN) +} + +type WorkspaceMembersByRole { + admins: WorkspaceRoleCollection + members: WorkspaceRoleCollection + guests: WorkspaceRoleCollection +} + +type WorkspaceRoleCollection { + totalCount: Int! } type WorkspaceCreationState { diff --git a/packages/server/modules/core/graph/generated/graphql.ts b/packages/server/modules/core/graph/generated/graphql.ts index 5bc8e5910..3cab547c2 100644 --- a/packages/server/modules/core/graph/generated/graphql.ts +++ b/packages/server/modules/core/graph/generated/graphql.ts @@ -4345,6 +4345,7 @@ export type Workspace = { invitedTeam?: Maybe>; /** Logo image as base64-encoded string */ logo?: Maybe; + membersByRole?: Maybe; name: Scalars['String']['output']; plan?: Maybe; projects: ProjectCollection; @@ -4602,6 +4603,13 @@ export const WorkspaceJoinRequestStatus = { } as const; export type WorkspaceJoinRequestStatus = typeof WorkspaceJoinRequestStatus[keyof typeof WorkspaceJoinRequestStatus]; +export type WorkspaceMembersByRole = { + __typename?: 'WorkspaceMembersByRole'; + admins?: Maybe; + guests?: Maybe; + members?: Maybe; +}; + export type WorkspaceMutations = { __typename?: 'WorkspaceMutations'; addDomain: Workspace; @@ -4833,6 +4841,11 @@ export const WorkspaceRole = { } as const; export type WorkspaceRole = typeof WorkspaceRole[keyof typeof WorkspaceRole]; +export type WorkspaceRoleCollection = { + __typename?: 'WorkspaceRoleCollection'; + totalCount: Scalars['Int']['output']; +}; + export type WorkspaceRoleDeleteInput = { userId: Scalars['String']['input']; workspaceId: Scalars['String']['input']; @@ -5301,6 +5314,7 @@ export type ResolversTypes = { WorkspaceJoinRequestFilter: WorkspaceJoinRequestFilter; WorkspaceJoinRequestMutations: ResolverTypeWrapper; WorkspaceJoinRequestStatus: WorkspaceJoinRequestStatus; + WorkspaceMembersByRole: ResolverTypeWrapper; WorkspaceMutations: ResolverTypeWrapper; WorkspacePaymentMethod: WorkspacePaymentMethod; WorkspacePlan: ResolverTypeWrapper; @@ -5315,6 +5329,7 @@ export type ResolversTypes = { WorkspaceProjectsUpdatedMessageType: WorkspaceProjectsUpdatedMessageType; WorkspaceRequestToJoinInput: WorkspaceRequestToJoinInput; WorkspaceRole: WorkspaceRole; + WorkspaceRoleCollection: ResolverTypeWrapper; WorkspaceRoleDeleteInput: WorkspaceRoleDeleteInput; WorkspaceRoleUpdateInput: WorkspaceRoleUpdateInput; WorkspaceSeatCollection: ResolverTypeWrapper; @@ -5595,6 +5610,7 @@ export type ResolversParentTypes = { WorkspaceJoinRequestCollection: Omit & { items: Array }; WorkspaceJoinRequestFilter: WorkspaceJoinRequestFilter; WorkspaceJoinRequestMutations: WorkspaceJoinRequestMutationsGraphQLReturn; + WorkspaceMembersByRole: WorkspaceMembersByRole; WorkspaceMutations: WorkspaceMutationsGraphQLReturn; WorkspacePlan: WorkspacePlan; WorkspacePlanPrice: Omit & { monthly?: Maybe, yearly?: Maybe }; @@ -5604,6 +5620,7 @@ export type ResolversParentTypes = { WorkspaceProjectsFilter: WorkspaceProjectsFilter; WorkspaceProjectsUpdatedMessage: Omit & { project?: Maybe }; WorkspaceRequestToJoinInput: WorkspaceRequestToJoinInput; + WorkspaceRoleCollection: WorkspaceRoleCollection; WorkspaceRoleDeleteInput: WorkspaceRoleDeleteInput; WorkspaceRoleUpdateInput: WorkspaceRoleUpdateInput; WorkspaceSeatCollection: WorkspaceSeatCollection; @@ -7101,6 +7118,7 @@ export type WorkspaceResolvers; invitedTeam?: Resolver>, ParentType, ContextType, Partial>; logo?: Resolver, ParentType, ContextType>; + membersByRole?: Resolver, ParentType, ContextType>; name?: Resolver; plan?: Resolver, ParentType, ContextType>; projects?: Resolver>; @@ -7190,6 +7208,13 @@ export type WorkspaceJoinRequestMutationsResolvers; }; +export type WorkspaceMembersByRoleResolvers = { + admins?: Resolver, ParentType, ContextType>; + guests?: Resolver, ParentType, ContextType>; + members?: Resolver, ParentType, ContextType>; + __isTypeOf?: IsTypeOfResolverFn; +}; + export type WorkspaceMutationsResolvers = { addDomain?: Resolver>; billing?: Resolver; @@ -7242,6 +7267,11 @@ export type WorkspaceProjectsUpdatedMessageResolvers; }; +export type WorkspaceRoleCollectionResolvers = { + totalCount?: Resolver; + __isTypeOf?: IsTypeOfResolverFn; +}; + export type WorkspaceSeatCollectionResolvers = { totalCount?: Resolver; __isTypeOf?: IsTypeOfResolverFn; @@ -7451,11 +7481,13 @@ export type Resolvers = { WorkspaceJoinRequest?: WorkspaceJoinRequestResolvers; WorkspaceJoinRequestCollection?: WorkspaceJoinRequestCollectionResolvers; WorkspaceJoinRequestMutations?: WorkspaceJoinRequestMutationsResolvers; + WorkspaceMembersByRole?: WorkspaceMembersByRoleResolvers; WorkspaceMutations?: WorkspaceMutationsResolvers; WorkspacePlan?: WorkspacePlanResolvers; WorkspacePlanPrice?: WorkspacePlanPriceResolvers; WorkspaceProjectMutations?: WorkspaceProjectMutationsResolvers; WorkspaceProjectsUpdatedMessage?: WorkspaceProjectsUpdatedMessageResolvers; + WorkspaceRoleCollection?: WorkspaceRoleCollectionResolvers; WorkspaceSeatCollection?: WorkspaceSeatCollectionResolvers; WorkspaceSeatsByType?: WorkspaceSeatsByTypeResolvers; WorkspaceSso?: WorkspaceSsoResolvers; diff --git a/packages/server/modules/cross-server-sync/graph/generated/graphql.ts b/packages/server/modules/cross-server-sync/graph/generated/graphql.ts index 71d1178d7..af7f36184 100644 --- a/packages/server/modules/cross-server-sync/graph/generated/graphql.ts +++ b/packages/server/modules/cross-server-sync/graph/generated/graphql.ts @@ -4325,6 +4325,7 @@ export type Workspace = { invitedTeam?: Maybe>; /** Logo image as base64-encoded string */ logo?: Maybe; + membersByRole?: Maybe; name: Scalars['String']['output']; plan?: Maybe; projects: ProjectCollection; @@ -4582,6 +4583,13 @@ export const WorkspaceJoinRequestStatus = { } as const; export type WorkspaceJoinRequestStatus = typeof WorkspaceJoinRequestStatus[keyof typeof WorkspaceJoinRequestStatus]; +export type WorkspaceMembersByRole = { + __typename?: 'WorkspaceMembersByRole'; + admins?: Maybe; + guests?: Maybe; + members?: Maybe; +}; + export type WorkspaceMutations = { __typename?: 'WorkspaceMutations'; addDomain: Workspace; @@ -4813,6 +4821,11 @@ export const WorkspaceRole = { } as const; export type WorkspaceRole = typeof WorkspaceRole[keyof typeof WorkspaceRole]; +export type WorkspaceRoleCollection = { + __typename?: 'WorkspaceRoleCollection'; + totalCount: Scalars['Int']['output']; +}; + export type WorkspaceRoleDeleteInput = { userId: Scalars['String']['input']; workspaceId: Scalars['String']['input']; diff --git a/packages/server/modules/workspaces/graph/resolvers/workspaces.ts b/packages/server/modules/workspaces/graph/resolvers/workspaces.ts index 131607323..4f13f43ce 100644 --- a/packages/server/modules/workspaces/graph/resolvers/workspaces.ts +++ b/packages/server/modules/workspaces/graph/resolvers/workspaces.ts @@ -73,7 +73,8 @@ import { getWorkspaceCreationStateFactory, upsertWorkspaceCreationStateFactory, queryWorkspacesFactory, - countWorkspacesFactory + countWorkspacesFactory, + countWorkspaceRoleWithOptionalProjectRoleFactory } from '@/modules/workspaces/repositories/workspaces' import { buildWorkspaceInviteEmailContentsFactory, @@ -209,6 +210,7 @@ import { getWorkspaceRolesAndSeatsFactory, getWorkspaceUserSeatFactory } from '@/modules/gatekeeper/repositories/workspaceSeat' +import { WorkspaceMembersByRole } from '@/test/graphql/generated/graphql' const eventBus = getEventBus() const getServerInfo = getServerInfoFactory({ db }) @@ -1206,7 +1208,34 @@ export = FF_WORKSPACES_MODULE_ENABLED return await getWorkspaceSsoProviderRecordFactory({ db })({ workspaceId: parent.id }) - } + }, + membersByRole: (parent) => + ({ + admins: async () => ({ + totalCount: await countWorkspaceRoleWithOptionalProjectRoleFactory({ + db + })({ + workspaceId: parent.id, + workspaceRole: Roles.Workspace.Admin + }) + }), + members: async () => ({ + totalCount: await countWorkspaceRoleWithOptionalProjectRoleFactory({ + db + })({ + workspaceId: parent.id, + workspaceRole: Roles.Workspace.Member + }) + }), + guests: async () => ({ + totalCount: await countWorkspaceRoleWithOptionalProjectRoleFactory({ + db + })({ + workspaceId: parent.id, + workspaceRole: Roles.Workspace.Guest + }) + }) + } as unknown as WorkspaceMembersByRole) }, WorkspaceSso: { provider: async ({ workspaceId }) => { diff --git a/packages/server/modules/workspaces/tests/helpers/graphql.ts b/packages/server/modules/workspaces/tests/helpers/graphql.ts index 41824eca7..e671aa16e 100644 --- a/packages/server/modules/workspaces/tests/helpers/graphql.ts +++ b/packages/server/modules/workspaces/tests/helpers/graphql.ts @@ -402,6 +402,26 @@ export const getWorkspaceWithSeatsByType = gql` ${basicWorkspaceFragment} ` +export const getWorkspaceWithMembersByRole = gql` + query GetWorkspaceWithMembersByRole($workspaceId: String!) { + workspace(id: $workspaceId) { + ...BasicWorkspace + membersByRole { + admins { + totalCount + } + members { + totalCount + } + guests { + totalCount + } + } + } + } + ${basicWorkspaceFragment} +` + export const updateWorkspaceProjectRoleMutation = gql` mutation UpdateWorkspaceProjectRole($input: ProjectUpdateRoleInput!) { workspaceMutations { diff --git a/packages/server/modules/workspaces/tests/integration/workspaces.graph.spec.ts b/packages/server/modules/workspaces/tests/integration/workspaces.graph.spec.ts index aa3b28709..84f222ee8 100644 --- a/packages/server/modules/workspaces/tests/integration/workspaces.graph.spec.ts +++ b/packages/server/modules/workspaces/tests/integration/workspaces.graph.spec.ts @@ -29,7 +29,8 @@ import { DeleteWorkspaceDomainDocument, CreateWorkspaceProjectDocument, DismissWorkspaceDocument, - GetActiveUserDiscoverableWorkspacesDocument + GetActiveUserDiscoverableWorkspacesDocument, + GetWorkspaceWithMembersByRoleDocument } from '@/test/graphql/generated/graphql' import { beforeEachContext } from '@/test/hooks' import { AllScopes } from '@/modules/core/helpers/mainConstants' @@ -57,6 +58,7 @@ import { WorkspaceNotFoundError } from '@/modules/workspaces/errors/workspace' import { getFeatureFlags } from '@/modules/shared/helpers/envHelper' import { assignWorkspaceSeatFactory } from '@/modules/workspaces/services/workspaceSeat' import { createWorkspaceSeatFactory } from '@/modules/gatekeeper/repositories/workspaceSeat' +import { WorkspaceSeatType } from '@/modules/gatekeeper/domain/billing' const grantStreamPermissions = grantStreamPermissionsFactory({ db }) const { FF_GATEKEEPER_FORCE_FREE_PLAN } = getFeatureFlags() @@ -767,6 +769,99 @@ describe('Workspaces GQL CRUD', () => { expect(res2.data?.workspace?.projects.totalCount).to.equal(0) }) }) + + describe('workspace.membersByRole', () => { + it('should return admins and members and guests in the workspace', async () => { + const user = await createTestUser({ + name: createRandomString(), + email: createRandomEmail(), + role: Roles.Server.Admin, + verified: true + }) + const workspace = { + id: createRandomString(), + name: createRandomString(), + slug: cryptoRandomString({ length: 10 }), + ownerId: user.id + } + await createTestWorkspace(workspace, user, { + addPlan: { name: 'pro', status: 'valid' } + }) + const guest1 = await createTestUser({ + name: createRandomString(), + email: createRandomEmail(), + role: Roles.Server.User, + verified: true + }) + await assignToWorkspace( + workspace, + guest1, + Roles.Workspace.Guest, + WorkspaceSeatType.Viewer + ) + const guest2 = await createTestUser({ + name: createRandomString(), + email: createRandomEmail(), + role: Roles.Server.User, + verified: true + }) + await assignToWorkspace( + workspace, + guest2, + Roles.Workspace.Guest, + WorkspaceSeatType.Viewer + ) + + const member1 = await createTestUser({ + name: createRandomString(), + email: createRandomEmail(), + role: Roles.Server.User, + verified: true + }) + await assignToWorkspace( + workspace, + member1, + Roles.Workspace.Member, + WorkspaceSeatType.Editor + ) + const member2 = await createTestUser({ + name: createRandomString(), + email: createRandomEmail(), + role: Roles.Server.User, + verified: true + }) + await assignToWorkspace( + workspace, + member2, + Roles.Workspace.Member, + WorkspaceSeatType.Editor + ) + const member3 = await createTestUser({ + name: createRandomString(), + email: createRandomEmail(), + role: Roles.Server.User, + verified: true + }) + await assignToWorkspace( + workspace, + member3, + Roles.Workspace.Member, + WorkspaceSeatType.Editor + ) + + const session = await login(user) + + const res = await session.execute(GetWorkspaceWithMembersByRoleDocument, { + workspaceId: workspace.id + }) + + expect(res).to.not.haveGraphQLErrors() + const seats = res.data?.workspace.membersByRole + expect(seats?.guests?.totalCount).to.eq(2) + expect(seats?.members?.totalCount).to.eq(3) + expect(seats?.admins?.totalCount).to.eq(1) + }) + }) }) describe('management operations', () => { diff --git a/packages/server/test/graphql/generated/graphql.ts b/packages/server/test/graphql/generated/graphql.ts index a0a8c3023..bde37c807 100644 --- a/packages/server/test/graphql/generated/graphql.ts +++ b/packages/server/test/graphql/generated/graphql.ts @@ -4326,6 +4326,7 @@ export type Workspace = { invitedTeam?: Maybe>; /** Logo image as base64-encoded string */ logo?: Maybe; + membersByRole?: Maybe; name: Scalars['String']['output']; plan?: Maybe; projects: ProjectCollection; @@ -4583,6 +4584,13 @@ export const WorkspaceJoinRequestStatus = { } as const; export type WorkspaceJoinRequestStatus = typeof WorkspaceJoinRequestStatus[keyof typeof WorkspaceJoinRequestStatus]; +export type WorkspaceMembersByRole = { + __typename?: 'WorkspaceMembersByRole'; + admins?: Maybe; + guests?: Maybe; + members?: Maybe; +}; + export type WorkspaceMutations = { __typename?: 'WorkspaceMutations'; addDomain: Workspace; @@ -4814,6 +4822,11 @@ export const WorkspaceRole = { } as const; export type WorkspaceRole = typeof WorkspaceRole[keyof typeof WorkspaceRole]; +export type WorkspaceRoleCollection = { + __typename?: 'WorkspaceRoleCollection'; + totalCount: Scalars['Int']['output']; +}; + export type WorkspaceRoleDeleteInput = { userId: Scalars['String']['input']; workspaceId: Scalars['String']['input']; @@ -5218,6 +5231,13 @@ export type GetWorkspaceWithSeatsByTypeQueryVariables = Exact<{ export type GetWorkspaceWithSeatsByTypeQuery = { __typename?: 'Query', workspace: { __typename?: 'Workspace', id: string, name: string, slug: string, updatedAt: string, createdAt: string, role?: string | null, readOnly: boolean, seatsByType?: { __typename?: 'WorkspaceSeatsByType', editors?: { __typename?: 'WorkspaceSeatCollection', totalCount: number } | null, viewers?: { __typename?: 'WorkspaceSeatCollection', totalCount: number } | null } | null } }; +export type GetWorkspaceWithMembersByRoleQueryVariables = Exact<{ + workspaceId: Scalars['String']['input']; +}>; + + +export type GetWorkspaceWithMembersByRoleQuery = { __typename?: 'Query', workspace: { __typename?: 'Workspace', id: string, name: string, slug: string, updatedAt: string, createdAt: string, role?: string | null, readOnly: boolean, membersByRole?: { __typename?: 'WorkspaceMembersByRole', admins?: { __typename?: 'WorkspaceRoleCollection', totalCount: number } | null, members?: { __typename?: 'WorkspaceRoleCollection', totalCount: number } | null, guests?: { __typename?: 'WorkspaceRoleCollection', totalCount: number } | null } | null } }; + export type UpdateWorkspaceProjectRoleMutationVariables = Exact<{ input: ProjectUpdateRoleInput; }>; @@ -6060,6 +6080,7 @@ export const RequestToJoinWorkspaceDocument = {"kind":"Document","definitions":[ export const GetWorkspaceWithJoinRequestsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetWorkspaceWithJoinRequests"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"workspaceId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"filter"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"AdminWorkspaceJoinRequestFilter"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"cursor"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"limit"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"workspace"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"workspaceId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"BasicWorkspace"}},{"kind":"Field","name":{"kind":"Name","value":"adminWorkspacesJoinRequests"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"filter"},"value":{"kind":"Variable","name":{"kind":"Name","value":"filter"}}},{"kind":"Argument","name":{"kind":"Name","value":"cursor"},"value":{"kind":"Variable","name":{"kind":"Name","value":"cursor"}}},{"kind":"Argument","name":{"kind":"Name","value":"limit"},"value":{"kind":"Variable","name":{"kind":"Name","value":"limit"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"user"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"workspace"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"cursor"}},{"kind":"Field","name":{"kind":"Name","value":"totalCount"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"BasicWorkspace"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Workspace"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"role"}},{"kind":"Field","name":{"kind":"Name","value":"readOnly"}}]}}]} as unknown as DocumentNode; export const GetWorkspaceWithSubscriptionDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetWorkspaceWithSubscription"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"workspaceId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"workspace"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"workspaceId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"BasicWorkspace"}},{"kind":"Field","name":{"kind":"Name","value":"subscription"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"currentBillingCycleEnd"}},{"kind":"Field","name":{"kind":"Name","value":"billingInterval"}},{"kind":"Field","name":{"kind":"Name","value":"seats"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"guest"}},{"kind":"Field","name":{"kind":"Name","value":"plan"}},{"kind":"Field","name":{"kind":"Name","value":"assigned"}},{"kind":"Field","name":{"kind":"Name","value":"totalCount"}},{"kind":"Field","name":{"kind":"Name","value":"viewersCount"}}]}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"BasicWorkspace"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Workspace"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"role"}},{"kind":"Field","name":{"kind":"Name","value":"readOnly"}}]}}]} as unknown as DocumentNode; export const GetWorkspaceWithSeatsByTypeDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetWorkspaceWithSeatsByType"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"workspaceId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"workspace"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"workspaceId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"BasicWorkspace"}},{"kind":"Field","name":{"kind":"Name","value":"seatsByType"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"editors"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"totalCount"}}]}},{"kind":"Field","name":{"kind":"Name","value":"viewers"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"totalCount"}}]}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"BasicWorkspace"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Workspace"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"role"}},{"kind":"Field","name":{"kind":"Name","value":"readOnly"}}]}}]} as unknown as DocumentNode; +export const GetWorkspaceWithMembersByRoleDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetWorkspaceWithMembersByRole"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"workspaceId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"workspace"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"workspaceId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"BasicWorkspace"}},{"kind":"Field","name":{"kind":"Name","value":"membersByRole"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"admins"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"totalCount"}}]}},{"kind":"Field","name":{"kind":"Name","value":"members"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"totalCount"}}]}},{"kind":"Field","name":{"kind":"Name","value":"guests"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"totalCount"}}]}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"BasicWorkspace"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Workspace"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"role"}},{"kind":"Field","name":{"kind":"Name","value":"readOnly"}}]}}]} as unknown as DocumentNode; export const UpdateWorkspaceProjectRoleDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdateWorkspaceProjectRole"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ProjectUpdateRoleInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"workspaceMutations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"projects"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updateRole"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"BasicProjectFields"}}]}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"BasicProjectFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Project"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"visibility"}},{"kind":"Field","name":{"kind":"Name","value":"allowPublicComments"}},{"kind":"Field","name":{"kind":"Name","value":"role"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]} as unknown as DocumentNode; export const UpdateWorkspaceSeatTypeDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdateWorkspaceSeatType"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"WorkspaceUpdateSeatTypeInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"workspaceMutations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updateSeatType"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"team"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"role"}},{"kind":"Field","name":{"kind":"Name","value":"seatType"}}]}}]}}]}}]}}]}}]} as unknown as DocumentNode; export const CreateStreamAccessRequestDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"CreateStreamAccessRequest"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"streamId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"streamAccessRequestCreate"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"streamId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"streamId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"BasicStreamAccessRequestFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"BasicStreamAccessRequestFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"StreamAccessRequest"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"requester"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"requesterId"}},{"kind":"Field","name":{"kind":"Name","value":"streamId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}}]}}]} as unknown as DocumentNode;