feat(core): add public user service (#10695)

This commit is contained in:
EYHN
2025-03-07 08:00:27 +00:00
parent a08e76c3b5
commit 4677049b5c
10 changed files with 375 additions and 9 deletions

View File

@@ -0,0 +1,7 @@
query getPublicUserById($id: String!) {
publicUserById(id: $id) {
id
avatarUrl
name
}
}

View File

@@ -643,6 +643,18 @@ export const getPageGrantedUsersListQuery = {
}`,
};
export const getPublicUserByIdQuery = {
id: 'getPublicUserByIdQuery' as const,
op: 'getPublicUserById',
query: `query getPublicUserById($id: String!) {
publicUserById(id: $id) {
id
avatarUrl
name
}
}`,
};
export const getServerRuntimeConfigQuery = {
id: 'getServerRuntimeConfigQuery' as const,
op: 'getServerRuntimeConfig',

View File

@@ -438,6 +438,7 @@ export type ErrorDataUnion =
| InvalidPasswordLengthDataType
| InvalidRuntimeConfigTypeDataType
| MemberNotFoundInSpaceDataType
| MentionUserDocAccessDeniedDataType
| MissingOauthQueryParameterDataType
| NotInSpaceDataType
| QueryTooLongDataType
@@ -453,6 +454,7 @@ export type ErrorDataUnion =
| UnknownOauthProviderDataType
| UnsupportedClientVersionDataType
| UnsupportedSubscriptionPlanDataType
| ValidationErrorDataType
| VersionRejectedDataType
| WorkspaceMembersExceedLimitToDowngradeDataType
| WorkspacePermissionNotFoundDataType
@@ -527,7 +529,11 @@ export enum ErrorNames {
MAILER_SERVICE_IS_NOT_CONFIGURED = 'MAILER_SERVICE_IS_NOT_CONFIGURED',
MEMBER_NOT_FOUND_IN_SPACE = 'MEMBER_NOT_FOUND_IN_SPACE',
MEMBER_QUOTA_EXCEEDED = 'MEMBER_QUOTA_EXCEEDED',
MENTION_USER_DOC_ACCESS_DENIED = 'MENTION_USER_DOC_ACCESS_DENIED',
MENTION_USER_ONESELF_DENIED = 'MENTION_USER_ONESELF_DENIED',
MISSING_OAUTH_QUERY_PARAMETER = 'MISSING_OAUTH_QUERY_PARAMETER',
NETWORK_ERROR = 'NETWORK_ERROR',
NOTIFICATION_NOT_FOUND = 'NOTIFICATION_NOT_FOUND',
NOT_FOUND = 'NOT_FOUND',
NOT_IN_SPACE = 'NOT_IN_SPACE',
NO_COPILOT_PROVIDER_AVAILABLE = 'NO_COPILOT_PROVIDER_AVAILABLE',
@@ -557,6 +563,7 @@ export enum ErrorNames {
UNSUPPORTED_SUBSCRIPTION_PLAN = 'UNSUPPORTED_SUBSCRIPTION_PLAN',
USER_AVATAR_NOT_FOUND = 'USER_AVATAR_NOT_FOUND',
USER_NOT_FOUND = 'USER_NOT_FOUND',
VALIDATION_ERROR = 'VALIDATION_ERROR',
VERSION_REJECTED = 'VERSION_REJECTED',
WORKSPACE_ID_REQUIRED_FOR_TEAM_SUBSCRIPTION = 'WORKSPACE_ID_REQUIRED_FOR_TEAM_SUBSCRIPTION',
WORKSPACE_ID_REQUIRED_TO_UPDATE_TEAM_SUBSCRIPTION = 'WORKSPACE_ID_REQUIRED_TO_UPDATE_TEAM_SUBSCRIPTION',
@@ -615,7 +622,7 @@ export interface GrantDocUserRolesInput {
export interface GrantedDocUserType {
__typename?: 'GrantedDocUserType';
role: DocRole;
user: PublicUserType;
user: WorkspaceUserType;
}
export interface GrantedDocUserTypeEdge {
@@ -664,6 +671,36 @@ export interface InvalidRuntimeConfigTypeDataType {
want: Scalars['String']['output'];
}
export interface InvitationAcceptedNotificationBodyType {
__typename?: 'InvitationAcceptedNotificationBodyType';
/** The user who created the notification, maybe null when user is deleted or sent by system */
createdByUser: Maybe<PublicUserType>;
inviteId: Scalars['String']['output'];
/** The type of the notification */
type: NotificationType;
workspace: Maybe<NotificationWorkspaceType>;
}
export interface InvitationBlockedNotificationBodyType {
__typename?: 'InvitationBlockedNotificationBodyType';
/** The user who created the notification, maybe null when user is deleted or sent by system */
createdByUser: Maybe<PublicUserType>;
inviteId: Scalars['String']['output'];
/** The type of the notification */
type: NotificationType;
workspace: Maybe<NotificationWorkspaceType>;
}
export interface InvitationNotificationBodyType {
__typename?: 'InvitationNotificationBodyType';
/** The user who created the notification, maybe null when user is deleted or sent by system */
createdByUser: Maybe<PublicUserType>;
inviteId: Scalars['ID']['output'];
/** The type of the notification */
type: NotificationType;
workspace: Maybe<NotificationWorkspaceType>;
}
export interface InvitationType {
__typename?: 'InvitationType';
/** Invitee information */
@@ -804,6 +841,44 @@ export interface MemberNotFoundInSpaceDataType {
spaceId: Scalars['String']['output'];
}
export interface MentionDocInput {
/** The block id in the doc */
blockId?: InputMaybe<Scalars['String']['input']>;
/** The element id in the doc */
elementId?: InputMaybe<Scalars['String']['input']>;
id: Scalars['String']['input'];
title: Scalars['String']['input'];
}
export interface MentionDocType {
__typename?: 'MentionDocType';
blockId: Maybe<Scalars['String']['output']>;
elementId: Maybe<Scalars['String']['output']>;
id: Scalars['String']['output'];
title: Scalars['String']['output'];
}
export interface MentionInput {
doc: MentionDocInput;
userId: Scalars['String']['input'];
workspaceId: Scalars['String']['input'];
}
export interface MentionNotificationBodyType {
__typename?: 'MentionNotificationBodyType';
/** The user who created the notification, maybe null when user is deleted or sent by system */
createdByUser: Maybe<PublicUserType>;
doc: MentionDocType;
/** The type of the notification */
type: NotificationType;
workspace: Maybe<NotificationWorkspaceType>;
}
export interface MentionUserDocAccessDeniedDataType {
__typename?: 'MentionUserDocAccessDeniedDataType';
docId: Scalars['String']['output'];
}
export interface MissingOauthQueryParameterDataType {
__typename?: 'MissingOauthQueryParameterDataType';
name: Scalars['String']['output'];
@@ -856,9 +931,13 @@ export interface Mutation {
invite: Scalars['String']['output'];
inviteBatch: Array<InviteResult>;
leaveWorkspace: Scalars['Boolean']['output'];
/** mention user in a doc */
mentionUser: Scalars['ID']['output'];
publishDoc: DocType;
/** @deprecated use publishDoc instead */
publishPage: DocType;
/** mark notification as read */
readNotification: Scalars['Boolean']['output'];
recoverDoc: Scalars['DateTime']['output'];
releaseDeletedBlobs: Scalars['Boolean']['output'];
/** Remove user avatar */
@@ -1047,6 +1126,10 @@ export interface MutationLeaveWorkspaceArgs {
workspaceName?: InputMaybe<Scalars['String']['input']>;
}
export interface MutationMentionUserArgs {
input: MentionInput;
}
export interface MutationPublishDocArgs {
docId: Scalars['String']['input'];
mode?: InputMaybe<PublicDocMode>;
@@ -1059,6 +1142,10 @@ export interface MutationPublishPageArgs {
workspaceId: Scalars['String']['input'];
}
export interface MutationReadNotificationArgs {
id: Scalars['String']['input'];
}
export interface MutationRecoverDocArgs {
guid: Scalars['String']['input'];
timestamp: Scalars['DateTime']['input'];
@@ -1201,6 +1288,58 @@ export interface NotInSpaceDataType {
spaceId: Scalars['String']['output'];
}
/** Notification level */
export enum NotificationLevel {
Default = 'Default',
High = 'High',
Low = 'Low',
Min = 'Min',
None = 'None',
}
export interface NotificationObjectType {
__typename?: 'NotificationObjectType';
/** Just a placeholder to export UnionNotificationBodyType, don't use it */
_placeholderForUnionNotificationBodyType: UnionNotificationBodyType;
/** The body of the notification, different types have different fields, see UnionNotificationBodyType */
body: Scalars['JSONObject']['output'];
/** The created at time of the notification */
createdAt: Scalars['DateTime']['output'];
id: Scalars['ID']['output'];
/** The level of the notification */
level: NotificationLevel;
/** Whether the notification has been read */
read: Scalars['Boolean']['output'];
/** The type of the notification */
type: NotificationType;
/** The updated at time of the notification */
updatedAt: Scalars['DateTime']['output'];
}
export interface NotificationObjectTypeEdge {
__typename?: 'NotificationObjectTypeEdge';
cursor: Scalars['String']['output'];
node: NotificationObjectType;
}
/** Notification type */
export enum NotificationType {
Invitation = 'Invitation',
InvitationAccepted = 'InvitationAccepted',
InvitationBlocked = 'InvitationBlocked',
InvitationRejected = 'InvitationRejected',
Mention = 'Mention',
}
export interface NotificationWorkspaceType {
__typename?: 'NotificationWorkspaceType';
/** Workspace avatar url */
avatarUrl: Maybe<Scalars['String']['output']>;
id: Scalars['ID']['output'];
/** Workspace name */
name: Scalars['String']['output'];
}
export enum OAuthProviderType {
GitHub = 'GitHub',
Google = 'Google',
@@ -1222,6 +1361,13 @@ export interface PaginatedGrantedDocUserType {
totalCount: Scalars['Int']['output'];
}
export interface PaginatedNotificationObjectType {
__typename?: 'PaginatedNotificationObjectType';
edges: Array<NotificationObjectTypeEdge>;
pageInfo: PageInfo;
totalCount: Scalars['Int']['output'];
}
export interface PaginationInput {
/** returns the elements in the list that come after the specified cursor. */
after?: InputMaybe<Scalars['String']['input']>;
@@ -1254,7 +1400,6 @@ export enum PublicDocMode {
export interface PublicUserType {
__typename?: 'PublicUserType';
avatarUrl: Maybe<Scalars['String']['output']>;
email: Scalars['String']['output'];
id: Scalars['String']['output'];
name: Scalars['String']['output'];
}
@@ -1281,6 +1426,8 @@ export interface Query {
/** List all copilot prompts */
listCopilotPrompts: Array<CopilotPromptType>;
prices: Array<SubscriptionPrice>;
/** Get public user by id */
publicUserById: Maybe<PublicUserType>;
/** server config */
serverConfig: ServerConfigType;
/** get all server runtime configurable settings */
@@ -1323,6 +1470,10 @@ export interface QueryIsOwnerArgs {
workspaceId: Scalars['String']['input'];
}
export interface QueryPublicUserByIdArgs {
id: Scalars['String']['input'];
}
export interface QueryUserArgs {
email: Scalars['String']['input'];
}
@@ -1566,6 +1717,12 @@ export enum SubscriptionVariant {
Onetime = 'Onetime',
}
export type UnionNotificationBodyType =
| InvitationAcceptedNotificationBodyType
| InvitationBlockedNotificationBodyType
| InvitationNotificationBodyType
| MentionNotificationBodyType;
export interface UnknownOauthProviderDataType {
__typename?: 'UnknownOauthProviderDataType';
name: Scalars['String']['output'];
@@ -1671,6 +1828,10 @@ export interface UserType {
invoices: Array<InvoiceType>;
/** User name */
name: Scalars['String']['output'];
/** Get user notification count */
notificationCount: Scalars['Int']['output'];
/** Get current user notifications */
notifications: PaginatedNotificationObjectType;
quota: UserQuotaType;
quotaUsage: UserQuotaUsageType;
subscriptions: Array<SubscriptionType>;
@@ -1687,6 +1848,15 @@ export interface UserTypeInvoicesArgs {
take?: InputMaybe<Scalars['Int']['input']>;
}
export interface UserTypeNotificationsArgs {
pagination: PaginationInput;
}
export interface ValidationErrorDataType {
__typename?: 'ValidationErrorDataType';
errors: Scalars['String']['output'];
}
export interface VersionRejectedDataType {
__typename?: 'VersionRejectedDataType';
serverVersion: Scalars['String']['output'];
@@ -1873,6 +2043,14 @@ export interface WorkspaceTypePublicPageArgs {
pageId: Scalars['String']['input'];
}
export interface WorkspaceUserType {
__typename?: 'WorkspaceUserType';
avatarUrl: Maybe<Scalars['String']['output']>;
email: Scalars['String']['output'];
id: Scalars['String']['output'];
name: Scalars['String']['output'];
}
export interface WrongSignInCredentialsDataType {
__typename?: 'WrongSignInCredentialsDataType';
email: Scalars['String']['output'];
@@ -2599,7 +2777,7 @@ export type GetPageGrantedUsersListQuery = {
__typename?: 'GrantedDocUserType';
role: DocRole;
user: {
__typename?: 'PublicUserType';
__typename?: 'WorkspaceUserType';
id: string;
name: string;
email: string;
@@ -2612,6 +2790,20 @@ export type GetPageGrantedUsersListQuery = {
};
};
export type GetPublicUserByIdQueryVariables = Exact<{
id: Scalars['String']['input'];
}>;
export type GetPublicUserByIdQuery = {
__typename?: 'Query';
publicUserById: {
__typename?: 'PublicUserType';
id: string;
avatarUrl: string | null;
name: string;
} | null;
};
export type GetServerRuntimeConfigQueryVariables = Exact<{
[key: string]: never;
}>;
@@ -3586,6 +3778,11 @@ export type Queries =
variables: GetPageGrantedUsersListQueryVariables;
response: GetPageGrantedUsersListQuery;
}
| {
name: 'getPublicUserByIdQuery';
variables: GetPublicUserByIdQueryVariables;
response: GetPublicUserByIdQuery;
}
| {
name: 'getServerRuntimeConfigQuery';
variables: GetServerRuntimeConfigQueryVariables;