refactor(server): config system (#11081)

This commit is contained in:
forehalo
2025-03-27 12:32:28 +00:00
parent 7091111f85
commit 0ea38680fa
274 changed files with 7583 additions and 5841 deletions

View File

@@ -0,0 +1,3 @@
query appConfig {
appConfig
}

View File

@@ -1,11 +0,0 @@
query getServerRuntimeConfig {
serverRuntimeConfig {
id
module
key
description
value
type
updatedAt
}
}

View File

@@ -1,6 +0,0 @@
query getServerServiceConfigs {
serverServiceConfigs {
name
config
}
}

View File

@@ -0,0 +1,3 @@
mutation updateAppConfig($updates: [UpdateAppConfigInput!]!) {
updateAppConfig(updates: $updates)
}

View File

@@ -1,6 +0,0 @@
mutation updateServerRuntimeConfigs($updates: JSONObject!) {
updateRuntimeConfigs(updates: $updates) {
key
value
}
}

View File

@@ -61,6 +61,14 @@ export const createChangePasswordUrlMutation = {
}`,
};
export const appConfigQuery = {
id: 'appConfigQuery' as const,
op: 'appConfig',
query: `query appConfig {
appConfig
}`,
};
export const getPromptsQuery = {
id: 'getPromptsQuery' as const,
op: 'getPrompts',
@@ -151,33 +159,6 @@ export const enableUserMutation = {
}`,
};
export const getServerRuntimeConfigQuery = {
id: 'getServerRuntimeConfigQuery' as const,
op: 'getServerRuntimeConfig',
query: `query getServerRuntimeConfig {
serverRuntimeConfig {
id
module
key
description
value
type
updatedAt
}
}`,
};
export const getServerServiceConfigsQuery = {
id: 'getServerServiceConfigsQuery' as const,
op: 'getServerServiceConfigs',
query: `query getServerServiceConfigs {
serverServiceConfigs {
name
config
}
}`,
};
export const getUserByEmailQuery = {
id: 'getUserByEmailQuery' as const,
op: 'getUserByEmail',
@@ -259,14 +240,11 @@ export const updateAccountMutation = {
}`,
};
export const updateServerRuntimeConfigsMutation = {
id: 'updateServerRuntimeConfigsMutation' as const,
op: 'updateServerRuntimeConfigs',
query: `mutation updateServerRuntimeConfigs($updates: JSONObject!) {
updateRuntimeConfigs(updates: $updates) {
key
value
}
export const updateAppConfigMutation = {
id: 'updateAppConfigMutation' as const,
op: 'updateAppConfig',
query: `mutation updateAppConfig($updates: [UpdateAppConfigInput!]!) {
updateAppConfig(updates: $updates)
}`,
};

View File

@@ -603,6 +603,7 @@ export enum ErrorNames {
GRAPHQL_BAD_REQUEST = 'GRAPHQL_BAD_REQUEST',
HTTP_REQUEST_ERROR = 'HTTP_REQUEST_ERROR',
INTERNAL_SERVER_ERROR = 'INTERNAL_SERVER_ERROR',
INVALID_APP_CONFIG = 'INVALID_APP_CONFIG',
INVALID_AUTH_STATE = 'INVALID_AUTH_STATE',
INVALID_CHECKOUT_PARAMETERS = 'INVALID_CHECKOUT_PARAMETERS',
INVALID_EMAIL = 'INVALID_EMAIL',
@@ -1114,6 +1115,8 @@ export interface Mutation {
sendVerifyEmail: Scalars['Boolean']['output'];
setBlob: Scalars['String']['output'];
submitAudioTranscription: Maybe<TranscriptionResultType>;
/** update app configuration */
updateAppConfig: Scalars['JSONObject']['output'];
/** Update a copilot prompt */
updateCopilotPrompt: CopilotPromptType;
/** Update a chat session */
@@ -1121,10 +1124,6 @@ export interface Mutation {
updateDocDefaultRole: Scalars['Boolean']['output'];
updateDocUserRole: Scalars['Boolean']['output'];
updateProfile: UserType;
/** update server runtime configurable setting */
updateRuntimeConfig: ServerRuntimeConfigType;
/** update multiple server runtime configurable settings */
updateRuntimeConfigs: Array<ServerRuntimeConfigType>;
/** Update user settings */
updateSettings: Scalars['Boolean']['output'];
updateSubscriptionRecurring: SubscriptionType;
@@ -1426,6 +1425,10 @@ export interface MutationSubmitAudioTranscriptionArgs {
workspaceId: Scalars['String']['input'];
}
export interface MutationUpdateAppConfigArgs {
updates: Array<UpdateAppConfigInput>;
}
export interface MutationUpdateCopilotPromptArgs {
messages: Array<CopilotPromptMessageInput>;
name: Scalars['String']['input'];
@@ -1447,15 +1450,6 @@ export interface MutationUpdateProfileArgs {
input: UpdateUserInput;
}
export interface MutationUpdateRuntimeConfigArgs {
id: Scalars['String']['input'];
value: Scalars['JSON']['input'];
}
export interface MutationUpdateRuntimeConfigsArgs {
updates: Scalars['JSONObject']['input'];
}
export interface MutationUpdateSettingsArgs {
input: UpdateUserSettingsInput;
}
@@ -1615,6 +1609,8 @@ export interface PublicUserType {
export interface Query {
__typename?: 'Query';
/** get the whole app configuration */
appConfig: Scalars['JSONObject']['output'];
/** @deprecated use `user.quotaUsage` instead */
collectAllBlobSizes: WorkspaceBlobSizes;
/** Get current user */
@@ -1641,9 +1637,6 @@ export interface Query {
queryWorkspaceEmbeddingStatus: ContextWorkspaceEmbeddingStatus;
/** server config */
serverConfig: ServerConfigType;
/** get all server runtime configurable settings */
serverRuntimeConfig: Array<ServerRuntimeConfigType>;
serverServiceConfigs: Array<ServerServiceConfig>;
/** Get user by email */
user: Maybe<UserOrLimitedUser>;
/** Get user by email for admin */
@@ -1773,14 +1766,6 @@ export interface RuntimeConfigNotFoundDataType {
key: Scalars['String']['output'];
}
export enum RuntimeConfigType {
Array = 'Array',
Boolean = 'Boolean',
Number = 'Number',
Object = 'Object',
String = 'String',
}
export interface SameSubscriptionRecurringDataType {
__typename?: 'SameSubscriptionRecurringDataType';
recurring: Scalars['String']['output'];
@@ -1789,24 +1774,15 @@ export interface SameSubscriptionRecurringDataType {
export interface ServerConfigType {
__typename?: 'ServerConfigType';
/** fetch latest available upgradable release of server */
availableUpgrade: ReleaseVersionType;
availableUpgrade: Maybe<ReleaseVersionType>;
/** Features for user that can be configured */
availableUserFeatures: Array<FeatureType>;
/** server base url */
baseUrl: Scalars['String']['output'];
/** credentials requirement */
credentialsRequirement: CredentialsRequirementType;
/** enable telemetry */
enableTelemetry: Scalars['Boolean']['output'];
/** enabled server features */
features: Array<ServerFeature>;
/** server flags */
flags: ServerFlagsType;
/**
* server flavor
* @deprecated use `features`
*/
flavor: Scalars['String']['output'];
/** whether server has been initialized */
initialized: Scalars['Boolean']['output'];
/** server identical name could be shown as badge on user interface */
@@ -1830,29 +1806,6 @@ export enum ServerFeature {
Payment = 'Payment',
}
export interface ServerFlagsType {
__typename?: 'ServerFlagsType';
earlyAccessControl: Scalars['Boolean']['output'];
syncClientVersionCheck: Scalars['Boolean']['output'];
}
export interface ServerRuntimeConfigType {
__typename?: 'ServerRuntimeConfigType';
description: Scalars['String']['output'];
id: Scalars['String']['output'];
key: Scalars['String']['output'];
module: Scalars['String']['output'];
type: RuntimeConfigType;
updatedAt: Scalars['DateTime']['output'];
value: Scalars['JSON']['output'];
}
export interface ServerServiceConfig {
__typename?: 'ServerServiceConfig';
config: Scalars['JSONObject']['output'];
name: Scalars['String']['output'];
}
export interface SpaceAccessDeniedDataType {
__typename?: 'SpaceAccessDeniedDataType';
spaceId: Scalars['String']['output'];
@@ -1995,6 +1948,12 @@ export interface UnsupportedSubscriptionPlanDataType {
plan: Scalars['String']['output'];
}
export interface UpdateAppConfigInput {
key: Scalars['String']['input'];
module: Scalars['String']['input'];
value: Scalars['JSON']['input'];
}
export interface UpdateChatSessionInput {
/** The prompt name to use for the session */
promptName: Scalars['String']['input'];
@@ -2387,7 +2346,7 @@ export type AdminServerConfigQuery = {
version: string;
publishedAt: string;
url: string;
};
} | null;
};
};
@@ -2401,6 +2360,10 @@ export type CreateChangePasswordUrlMutation = {
createChangePasswordUrl: string;
};
export type AppConfigQueryVariables = Exact<{ [key: string]: never }>;
export type AppConfigQuery = { __typename?: 'Query'; appConfig: any };
export type GetPromptsQueryVariables = Exact<{ [key: string]: never }>;
export type GetPromptsQuery = {
@@ -2492,37 +2455,6 @@ export type EnableUserMutation = {
enableUser: { __typename?: 'UserType'; email: string; disabled: boolean };
};
export type GetServerRuntimeConfigQueryVariables = Exact<{
[key: string]: never;
}>;
export type GetServerRuntimeConfigQuery = {
__typename?: 'Query';
serverRuntimeConfig: Array<{
__typename?: 'ServerRuntimeConfigType';
id: string;
module: string;
key: string;
description: string;
value: Record<string, string>;
type: RuntimeConfigType;
updatedAt: string;
}>;
};
export type GetServerServiceConfigsQueryVariables = Exact<{
[key: string]: never;
}>;
export type GetServerServiceConfigsQuery = {
__typename?: 'Query';
serverServiceConfigs: Array<{
__typename?: 'ServerServiceConfig';
name: string;
config: any;
}>;
};
export type GetUserByEmailQueryVariables = Exact<{
email: Scalars['String']['input'];
}>;
@@ -2602,17 +2534,13 @@ export type UpdateAccountMutation = {
};
};
export type UpdateServerRuntimeConfigsMutationVariables = Exact<{
updates: Scalars['JSONObject']['input'];
export type UpdateAppConfigMutationVariables = Exact<{
updates: Array<UpdateAppConfigInput> | UpdateAppConfigInput;
}>;
export type UpdateServerRuntimeConfigsMutation = {
export type UpdateAppConfigMutation = {
__typename?: 'Mutation';
updateRuntimeConfigs: Array<{
__typename?: 'ServerRuntimeConfigType';
key: string;
value: Record<string, string>;
}>;
updateAppConfig: any;
};
export type DeleteBlobMutationVariables = Exact<{
@@ -4347,21 +4275,16 @@ export type Queries =
variables: AdminServerConfigQueryVariables;
response: AdminServerConfigQuery;
}
| {
name: 'appConfigQuery';
variables: AppConfigQueryVariables;
response: AppConfigQuery;
}
| {
name: 'getPromptsQuery';
variables: GetPromptsQueryVariables;
response: GetPromptsQuery;
}
| {
name: 'getServerRuntimeConfigQuery';
variables: GetServerRuntimeConfigQueryVariables;
response: GetServerRuntimeConfigQuery;
}
| {
name: 'getServerServiceConfigsQuery';
variables: GetServerServiceConfigsQueryVariables;
response: GetServerServiceConfigsQuery;
}
| {
name: 'getUserByEmailQuery';
variables: GetUserByEmailQueryVariables;
@@ -4675,9 +4598,9 @@ export type Mutations =
response: UpdateAccountMutation;
}
| {
name: 'updateServerRuntimeConfigsMutation';
variables: UpdateServerRuntimeConfigsMutationVariables;
response: UpdateServerRuntimeConfigsMutation;
name: 'updateAppConfigMutation';
variables: UpdateAppConfigMutationVariables;
response: UpdateAppConfigMutation;
}
| {
name: 'deleteBlobMutation';