feat(admin): add self-host setup and user management page (#7537)

This commit is contained in:
JimmFly
2024-08-13 14:11:03 +08:00
committed by GitHub
parent dc519348c5
commit ccf225c8f9
47 changed files with 2793 additions and 551 deletions
+186
View File
@@ -453,6 +453,13 @@ export interface ListUserInput {
skip: InputMaybe<Scalars['Int']['input']>;
}
export interface ManageUserInput {
/** User email */
email: Scalars['String']['input'];
/** User name */
name: InputMaybe<Scalars['String']['input']>;
}
export interface MissingOauthQueryParameterDataType {
__typename?: 'MissingOauthQueryParameterDataType';
name: Scalars['String']['output'];
@@ -469,6 +476,8 @@ export interface Mutation {
changePassword: UserType;
/** Cleanup sessions */
cleanupCopilotSession: Array<Scalars['String']['output']>;
/** Create change password url */
createChangePasswordUrl: Scalars['String']['output'];
/** Create a subscription checkout link of stripe */
createCheckoutSession: Scalars['String']['output'];
/** Create a chat message */
@@ -494,6 +503,7 @@ export interface Mutation {
leaveWorkspace: Scalars['Boolean']['output'];
publishPage: WorkspacePage;
recoverDoc: Scalars['DateTime']['output'];
removeAdminister: Scalars['Boolean']['output'];
/** Remove user avatar */
removeAvatar: RemoveAvatar;
removeEarlyAccess: Scalars['Int']['output'];
@@ -520,6 +530,8 @@ export interface Mutation {
/** update multiple server runtime configurable settings */
updateRuntimeConfigs: Array<ServerRuntimeConfigType>;
updateSubscriptionRecurring: UserSubscription;
/** Update a user */
updateUser: UserType;
/** Update workspace */
updateWorkspace: WorkspaceType;
/** Upload user avatar */
@@ -566,6 +578,11 @@ export interface MutationCleanupCopilotSessionArgs {
options: DeleteSessionInput;
}
export interface MutationCreateChangePasswordUrlArgs {
callbackUrl: Scalars['String']['input'];
userId: Scalars['String']['input'];
}
export interface MutationCreateCheckoutSessionArgs {
input: CreateCheckoutSessionInput;
}
@@ -632,8 +649,13 @@ export interface MutationRecoverDocArgs {
workspaceId: Scalars['String']['input'];
}
export interface MutationRemoveAdministerArgs {
email: Scalars['String']['input'];
}
export interface MutationRemoveEarlyAccessArgs {
email: Scalars['String']['input'];
type: EarlyAccessType;
}
export interface MutationRemoveWorkspaceFeatureArgs {
@@ -726,6 +748,11 @@ export interface MutationUpdateSubscriptionRecurringArgs {
recurring: SubscriptionRecurring;
}
export interface MutationUpdateUserArgs {
id: Scalars['String']['input'];
input: ManageUserInput;
}
export interface MutationUpdateWorkspaceArgs {
input: UpdateWorkspaceInput;
}
@@ -799,10 +826,14 @@ export interface Query {
serverServiceConfigs: Array<ServerServiceConfig>;
/** Get user by email */
user: Maybe<UserOrLimitedUser>;
/** Get user by email for admin */
userByEmail: Maybe<UserType>;
/** Get user by id */
userById: UserType;
/** List registered users */
users: Array<UserType>;
/** Get users count */
usersCount: Scalars['Int']['output'];
/** Get workspace by id */
workspace: WorkspaceType;
/** Get all accessible workspaces for current user */
@@ -838,6 +869,10 @@ export interface QueryUserArgs {
email: Scalars['String']['input'];
}
export interface QueryUserByEmailArgs {
email: Scalars['String']['input'];
}
export interface QueryUserByIdArgs {
id: Scalars['String']['input'];
}
@@ -1219,6 +1254,15 @@ export interface TokenType {
token: Scalars['String']['output'];
}
export type AddToAdminMutationVariables = Exact<{
email: Scalars['String']['input'];
}>;
export type AddToAdminMutation = {
__typename?: 'Mutation';
addAdminister: boolean;
};
export type DeleteBlobMutationVariables = Exact<{
workspaceId: Scalars['String']['input'];
hash: Scalars['String']['input'];
@@ -1268,6 +1312,16 @@ export type ChangeEmailMutation = {
changeEmail: { __typename?: 'UserType'; id: string; email: string };
};
export type CreateChangePasswordUrlMutationVariables = Exact<{
callbackUrl: Scalars['String']['input'];
userId: Scalars['String']['input'];
}>;
export type CreateChangePasswordUrlMutation = {
__typename?: 'Mutation';
createChangePasswordUrl: string;
};
export type ChangePasswordMutationVariables = Exact<{
token: Scalars['String']['input'];
newPassword: Scalars['String']['input'];
@@ -1340,6 +1394,15 @@ export type CreateCustomerPortalMutation = {
createCustomerPortal: string;
};
export type CreateUserMutationVariables = Exact<{
input: CreateUserInput;
}>;
export type CreateUserMutation = {
__typename?: 'Mutation';
createUser: { __typename?: 'UserType'; id: string };
};
export type CreateWorkspaceMutationVariables = Exact<{ [key: string]: never }>;
export type CreateWorkspaceMutation = {
@@ -1359,6 +1422,15 @@ export type DeleteAccountMutation = {
deleteAccount: { __typename?: 'DeleteAccount'; success: boolean };
};
export type DeleteUserMutationVariables = Exact<{
id: Scalars['String']['input'];
}>;
export type DeleteUserMutation = {
__typename?: 'Mutation';
deleteUser: { __typename?: 'DeleteAccount'; success: boolean };
};
export type DeleteWorkspaceMutationVariables = Exact<{
id: Scalars['String']['input'];
}>;
@@ -1368,6 +1440,16 @@ export type DeleteWorkspaceMutation = {
deleteWorkspace: boolean;
};
export type AddToEarlyAccessMutationVariables = Exact<{
email: Scalars['String']['input'];
type: EarlyAccessType;
}>;
export type AddToEarlyAccessMutation = {
__typename?: 'Mutation';
addToEarlyAccess: number;
};
export type EarlyAccessUsersQueryVariables = Exact<{ [key: string]: never }>;
export type EarlyAccessUsersQuery = {
@@ -1392,6 +1474,7 @@ export type EarlyAccessUsersQuery = {
export type RemoveEarlyAccessMutationVariables = Exact<{
email: Scalars['String']['input'];
type: EarlyAccessType;
}>;
export type RemoveEarlyAccessMutation = {
@@ -1619,6 +1702,35 @@ export type GetServerRuntimeConfigQuery = {
}>;
};
export type GetUserByEmailQueryVariables = Exact<{
email: Scalars['String']['input'];
}>;
export type GetUserByEmailQuery = {
__typename?: 'Query';
userByEmail: {
__typename?: 'UserType';
id: string;
name: string;
email: string;
features: Array<FeatureType>;
hasPassword: boolean | null;
emailVerified: boolean;
avatarUrl: string | null;
quota: {
__typename?: 'UserQuota';
humanReadable: {
__typename?: 'UserQuotaHumanReadable';
blobLimit: string;
historyPeriod: string;
memberLimit: string;
name: string;
storageQuota: string;
};
} | null;
} | null;
};
export type GetUserFeaturesQueryVariables = Exact<{ [key: string]: never }>;
export type GetUserFeaturesQuery = {
@@ -1653,6 +1765,10 @@ export type GetUserQuery = {
| null;
};
export type GetUsersCountQueryVariables = Exact<{ [key: string]: never }>;
export type GetUsersCountQuery = { __typename?: 'Query'; usersCount: number };
export type GetWorkspaceFeaturesQueryVariables = Exact<{
workspaceId: Scalars['String']['input'];
}>;
@@ -1883,6 +1999,15 @@ export type RecoverDocMutation = {
recoverDoc: string;
};
export type RemoveAdminMutationVariables = Exact<{
email: Scalars['String']['input'];
}>;
export type RemoveAdminMutation = {
__typename?: 'Mutation';
removeAdminister: boolean;
};
export type RemoveAvatarMutationVariables = Exact<{ [key: string]: never }>;
export type RemoveAvatarMutation = {
@@ -1990,6 +2115,7 @@ export type ServerConfigQuery = {
name: string;
features: Array<ServerFeature>;
type: ServerDeploymentType;
initialized: boolean;
credentialsRequirement: {
__typename?: 'CredentialsRequirementType';
password: {
@@ -2032,6 +2158,21 @@ export type SubscriptionQuery = {
} | null;
};
export type UpdateAccountMutationVariables = Exact<{
id: Scalars['String']['input'];
input: ManageUserInput;
}>;
export type UpdateAccountMutation = {
__typename?: 'Mutation';
updateUser: {
__typename?: 'UserType';
id: string;
name: string;
email: string;
};
};
export type UpdateServerRuntimeConfigsMutationVariables = Exact<{
updates: Scalars['JSONObject']['input'];
}>;
@@ -2283,6 +2424,11 @@ export type Queries =
variables: GetServerRuntimeConfigQueryVariables;
response: GetServerRuntimeConfigQuery;
}
| {
name: 'getUserByEmailQuery';
variables: GetUserByEmailQueryVariables;
response: GetUserByEmailQuery;
}
| {
name: 'getUserFeaturesQuery';
variables: GetUserFeaturesQueryVariables;
@@ -2293,6 +2439,11 @@ export type Queries =
variables: GetUserQueryVariables;
response: GetUserQuery;
}
| {
name: 'getUsersCountQuery';
variables: GetUsersCountQueryVariables;
response: GetUsersCountQuery;
}
| {
name: 'getWorkspaceFeaturesQuery';
variables: GetWorkspaceFeaturesQueryVariables;
@@ -2385,6 +2536,11 @@ export type Queries =
};
export type Mutations =
| {
name: 'addToAdminMutation';
variables: AddToAdminMutationVariables;
response: AddToAdminMutation;
}
| {
name: 'deleteBlobMutation';
variables: DeleteBlobMutationVariables;
@@ -2405,6 +2561,11 @@ export type Mutations =
variables: ChangeEmailMutationVariables;
response: ChangeEmailMutation;
}
| {
name: 'createChangePasswordUrlMutation';
variables: CreateChangePasswordUrlMutationVariables;
response: CreateChangePasswordUrlMutation;
}
| {
name: 'changePasswordMutation';
variables: ChangePasswordMutationVariables;
@@ -2435,6 +2596,11 @@ export type Mutations =
variables: CreateCustomerPortalMutationVariables;
response: CreateCustomerPortalMutation;
}
| {
name: 'createUserMutation';
variables: CreateUserMutationVariables;
response: CreateUserMutation;
}
| {
name: 'createWorkspaceMutation';
variables: CreateWorkspaceMutationVariables;
@@ -2445,11 +2611,21 @@ export type Mutations =
variables: DeleteAccountMutationVariables;
response: DeleteAccountMutation;
}
| {
name: 'deleteUserMutation';
variables: DeleteUserMutationVariables;
response: DeleteUserMutation;
}
| {
name: 'deleteWorkspaceMutation';
variables: DeleteWorkspaceMutationVariables;
response: DeleteWorkspaceMutation;
}
| {
name: 'addToEarlyAccessMutation';
variables: AddToEarlyAccessMutationVariables;
response: AddToEarlyAccessMutation;
}
| {
name: 'removeEarlyAccessMutation';
variables: RemoveEarlyAccessMutationVariables;
@@ -2475,6 +2651,11 @@ export type Mutations =
variables: RecoverDocMutationVariables;
response: RecoverDocMutation;
}
| {
name: 'removeAdminMutation';
variables: RemoveAdminMutationVariables;
response: RemoveAdminMutation;
}
| {
name: 'removeAvatarMutation';
variables: RemoveAvatarMutationVariables;
@@ -2525,6 +2706,11 @@ export type Mutations =
variables: SetWorkspacePublicByIdMutationVariables;
response: SetWorkspacePublicByIdMutation;
}
| {
name: 'updateAccountMutation';
variables: UpdateAccountMutationVariables;
response: UpdateAccountMutation;
}
| {
name: 'updateServerRuntimeConfigsMutation';
variables: UpdateServerRuntimeConfigsMutationVariables;