Files
AFFiNE-Mirror/packages/backend/server/src/schema.gql
2024-07-03 03:10:09 +00:00

864 lines
19 KiB
GraphQL

# ------------------------------------------------------
# THIS FILE WAS AUTOMATICALLY GENERATED (DO NOT MODIFY)
# ------------------------------------------------------
type BlobNotFoundDataType {
blobId: String!
workspaceId: String!
}
type ChatMessage {
attachments: [String!]
content: String!
createdAt: DateTime!
id: ID
params: JSON
role: String!
}
type Copilot {
"""Get the session list of actions in the workspace"""
actions: [String!]!
"""Get the session list of chats in the workspace"""
chats: [String!]!
histories(docId: String, options: QueryChatHistoriesInput): [CopilotHistories!]!
"""Get the quota of the user in the workspace"""
quota: CopilotQuota!
workspaceId: ID
}
type CopilotHistories {
"""An mark identifying which view to use to display the session"""
action: String
createdAt: DateTime!
messages: [ChatMessage!]!
sessionId: String!
"""The number of tokens used in the session"""
tokens: Int!
}
type CopilotMessageNotFoundDataType {
messageId: String!
}
enum CopilotModels {
DallE3
Gpt4Omni
Gpt4TurboPreview
Gpt4VisionPreview
Gpt35Turbo
TextEmbedding3Large
TextEmbedding3Small
TextEmbeddingAda002
TextModerationLatest
TextModerationStable
}
input CopilotPromptMessageInput {
content: String!
params: JSON
role: CopilotPromptMessageRole!
}
enum CopilotPromptMessageRole {
assistant
system
user
}
type CopilotPromptMessageType {
content: String!
params: JSON
role: CopilotPromptMessageRole!
}
type CopilotPromptNotFoundDataType {
name: String!
}
type CopilotPromptType {
action: String
messages: [CopilotPromptMessageType!]!
model: CopilotModels!
name: String!
}
type CopilotProviderSideErrorDataType {
kind: String!
message: String!
provider: String!
}
type CopilotQuota {
limit: SafeInt
used: SafeInt!
}
input CreateChatMessageInput {
attachments: [String!]
blobs: [Upload!]
content: String
params: JSON
sessionId: String!
}
input CreateChatSessionInput {
docId: String!
"""The prompt name to use for the session"""
promptName: String!
workspaceId: String!
}
input CreateCheckoutSessionInput {
coupon: String
idempotencyKey: String!
plan: SubscriptionPlan = Pro
recurring: SubscriptionRecurring = Yearly
successCallbackLink: String!
}
input CreateCopilotPromptInput {
action: String
messages: [CopilotPromptMessageInput!]!
model: CopilotModels!
name: String!
}
input CreateUserInput {
email: String!
name: String
password: String
}
type CredentialsRequirementType {
password: PasswordLimitsType!
}
"""
A date-time string at UTC, such as 2019-12-03T09:54:33Z, compliant with the date-time format.
"""
scalar DateTime
type DeleteAccount {
success: Boolean!
}
input DeleteSessionInput {
docId: String!
sessionIds: [String!]!
workspaceId: String!
}
type DocAccessDeniedDataType {
docId: String!
workspaceId: String!
}
type DocHistoryNotFoundDataType {
docId: String!
timestamp: Int!
workspaceId: String!
}
type DocHistoryType {
id: String!
timestamp: DateTime!
workspaceId: String!
}
type DocNotFoundDataType {
docId: String!
workspaceId: String!
}
enum EarlyAccessType {
AI
App
}
union ErrorDataUnion = BlobNotFoundDataType | CopilotMessageNotFoundDataType | CopilotPromptNotFoundDataType | CopilotProviderSideErrorDataType | DocAccessDeniedDataType | DocHistoryNotFoundDataType | DocNotFoundDataType | InvalidHistoryTimestampDataType | InvalidPasswordLengthDataType | InvalidRuntimeConfigTypeDataType | MissingOauthQueryParameterDataType | NotInWorkspaceDataType | RuntimeConfigNotFoundDataType | SameSubscriptionRecurringDataType | SubscriptionAlreadyExistsDataType | SubscriptionNotExistsDataType | SubscriptionPlanNotFoundDataType | UnknownOauthProviderDataType | VersionRejectedDataType | WorkspaceAccessDeniedDataType | WorkspaceNotFoundDataType | WorkspaceOwnerNotFoundDataType
enum ErrorNames {
ACCESS_DENIED
ACTION_FORBIDDEN
AUTHENTICATION_REQUIRED
BLOB_NOT_FOUND
BLOB_QUOTA_EXCEEDED
CANT_CHANGE_WORKSPACE_OWNER
COPILOT_ACTION_TAKEN
COPILOT_FAILED_TO_CREATE_MESSAGE
COPILOT_FAILED_TO_GENERATE_TEXT
COPILOT_MESSAGE_NOT_FOUND
COPILOT_PROMPT_INVALID
COPILOT_PROMPT_NOT_FOUND
COPILOT_PROVIDER_SIDE_ERROR
COPILOT_QUOTA_EXCEEDED
COPILOT_SESSION_DELETED
COPILOT_SESSION_NOT_FOUND
CUSTOMER_PORTAL_CREATE_FAILED
DOC_ACCESS_DENIED
DOC_HISTORY_NOT_FOUND
DOC_NOT_FOUND
EARLY_ACCESS_REQUIRED
EMAIL_ALREADY_USED
EMAIL_TOKEN_NOT_FOUND
EMAIL_VERIFICATION_REQUIRED
EXPECT_TO_PUBLISH_PAGE
EXPECT_TO_REVOKE_PUBLIC_PAGE
FAILED_TO_CHECKOUT
INTERNAL_SERVER_ERROR
INVALID_EMAIL
INVALID_EMAIL_TOKEN
INVALID_HISTORY_TIMESTAMP
INVALID_OAUTH_CALLBACK_STATE
INVALID_PASSWORD_LENGTH
INVALID_RUNTIME_CONFIG_TYPE
MAILER_SERVICE_IS_NOT_CONFIGURED
MEMBER_QUOTA_EXCEEDED
MISSING_OAUTH_QUERY_PARAMETER
NOT_IN_WORKSPACE
NO_COPILOT_PROVIDER_AVAILABLE
OAUTH_ACCOUNT_ALREADY_CONNECTED
OAUTH_STATE_EXPIRED
PAGE_IS_NOT_PUBLIC
RUNTIME_CONFIG_NOT_FOUND
SAME_EMAIL_PROVIDED
SAME_SUBSCRIPTION_RECURRING
SIGN_UP_FORBIDDEN
SUBSCRIPTION_ALREADY_EXISTS
SUBSCRIPTION_EXPIRED
SUBSCRIPTION_HAS_BEEN_CANCELED
SUBSCRIPTION_NOT_EXISTS
SUBSCRIPTION_PLAN_NOT_FOUND
TOO_MANY_REQUEST
UNKNOWN_OAUTH_PROVIDER
UNSPLASH_IS_NOT_CONFIGURED
USER_AVATAR_NOT_FOUND
USER_NOT_FOUND
VERSION_REJECTED
WORKSPACE_ACCESS_DENIED
WORKSPACE_NOT_FOUND
WORKSPACE_OWNER_NOT_FOUND
WRONG_SIGN_IN_CREDENTIALS
WRONG_SIGN_IN_METHOD
}
"""The type of workspace feature"""
enum FeatureType {
AIEarlyAccess
Admin
Copilot
EarlyAccess
UnlimitedCopilot
UnlimitedWorkspace
}
input ForkChatSessionInput {
docId: String!
"""
Identify a message in the array and keep it with all previous messages into a forked session.
"""
latestMessageId: String!
sessionId: String!
workspaceId: String!
}
type HumanReadableQuotaType {
blobLimit: String!
copilotActionLimit: String
historyPeriod: String!
memberLimit: String!
name: String!
storageQuota: String!
}
type InvalidHistoryTimestampDataType {
timestamp: String!
}
type InvalidPasswordLengthDataType {
max: Int!
min: Int!
}
type InvalidRuntimeConfigTypeDataType {
get: String!
key: String!
want: String!
}
type InvitationType {
"""Invitee information"""
invitee: UserType!
"""User information"""
user: UserType!
"""Workspace information"""
workspace: InvitationWorkspaceType!
}
type InvitationWorkspaceType {
"""Base64 encoded avatar"""
avatar: String!
id: ID!
"""Workspace name"""
name: String!
}
type InviteUserType {
"""User accepted"""
accepted: Boolean!
"""User avatar url"""
avatarUrl: String
"""User email verified"""
createdAt: DateTime @deprecated(reason: "useless")
"""User email"""
email: String
"""User email verified"""
emailVerified: Boolean
"""User password has been set"""
hasPassword: Boolean
id: ID!
"""Invite id"""
inviteId: String!
"""User name"""
name: String
"""User permission in workspace"""
permission: Permission!
}
enum InvoiceStatus {
Draft
Open
Paid
Uncollectible
Void
}
"""
The `JSON` scalar type represents JSON values as specified by [ECMA-404](http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf).
"""
scalar JSON @specifiedBy(url: "http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf")
"""
The `JSONObject` scalar type represents JSON objects as specified by [ECMA-404](http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf).
"""
scalar JSONObject @specifiedBy(url: "http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf")
type LimitedUserType {
"""User email"""
email: String!
"""User password has been set"""
hasPassword: Boolean
}
input ListUserInput {
first: Int = 20
skip: Int = 0
}
type MissingOauthQueryParameterDataType {
name: String!
}
type Mutation {
acceptInviteById(inviteId: String!, sendAcceptMail: Boolean, workspaceId: String!): Boolean!
addAdminister(email: String!): Boolean!
addToEarlyAccess(email: String!, type: EarlyAccessType!): Int!
addWorkspaceFeature(feature: FeatureType!, workspaceId: String!): Int!
cancelSubscription(idempotencyKey: String!, plan: SubscriptionPlan = Pro): UserSubscription!
changeEmail(email: String!, token: String!): UserType!
changePassword(newPassword: String!, token: String!): UserType!
"""Cleanup sessions"""
cleanupCopilotSession(options: DeleteSessionInput!): [String!]!
"""Create a subscription checkout link of stripe"""
createCheckoutSession(input: CreateCheckoutSessionInput!): String!
"""Create a chat message"""
createCopilotMessage(options: CreateChatMessageInput!): String!
"""Create a copilot prompt"""
createCopilotPrompt(input: CreateCopilotPromptInput!): CopilotPromptType!
"""Create a chat session"""
createCopilotSession(options: CreateChatSessionInput!): String!
"""Create a stripe customer portal to manage payment methods"""
createCustomerPortal: String!
"""Create a new user"""
createUser(input: CreateUserInput!): UserType!
"""Create a new workspace"""
createWorkspace(init: Upload): WorkspaceType!
deleteAccount: DeleteAccount!
deleteBlob(hash: String!, workspaceId: String!): Boolean!
"""Delete a user account"""
deleteUser(id: String!): DeleteAccount!
deleteWorkspace(id: String!): Boolean!
"""Create a chat session"""
forkCopilotSession(options: ForkChatSessionInput!): String!
invite(email: String!, permission: Permission!, sendInviteMail: Boolean, workspaceId: String!): String!
leaveWorkspace(sendLeaveMail: Boolean, workspaceId: String!, workspaceName: String!): Boolean!
publishPage(mode: PublicPageMode = Page, pageId: String!, workspaceId: String!): WorkspacePage!
recoverDoc(guid: String!, timestamp: DateTime!, workspaceId: String!): DateTime!
"""Remove user avatar"""
removeAvatar: RemoveAvatar!
removeEarlyAccess(email: String!): Int!
removeWorkspaceFeature(feature: FeatureType!, workspaceId: String!): Int!
resumeSubscription(idempotencyKey: String!, plan: SubscriptionPlan = Pro): UserSubscription!
revoke(userId: String!, workspaceId: String!): Boolean!
revokePage(pageId: String!, workspaceId: String!): Boolean! @deprecated(reason: "use revokePublicPage")
revokePublicPage(pageId: String!, workspaceId: String!): WorkspacePage!
sendChangeEmail(callbackUrl: String!, email: String): Boolean!
sendChangePasswordEmail(callbackUrl: String!, email: String): Boolean!
sendSetPasswordEmail(callbackUrl: String!, email: String): Boolean!
sendVerifyChangeEmail(callbackUrl: String!, email: String!, token: String!): Boolean!
sendVerifyEmail(callbackUrl: String!): Boolean!
setBlob(blob: Upload!, workspaceId: String!): String!
setWorkspaceExperimentalFeature(enable: Boolean!, feature: FeatureType!, workspaceId: String!): Boolean!
sharePage(pageId: String!, workspaceId: String!): Boolean! @deprecated(reason: "renamed to publishPage")
"""Update a copilot prompt"""
updateCopilotPrompt(messages: [CopilotPromptMessageInput!]!, name: String!): CopilotPromptType!
updateProfile(input: UpdateUserInput!): UserType!
"""update server runtime configurable setting"""
updateRuntimeConfig(id: String!, value: JSON!): ServerRuntimeConfigType!
"""update multiple server runtime configurable settings"""
updateRuntimeConfigs(updates: JSONObject!): [ServerRuntimeConfigType!]!
updateSubscriptionRecurring(idempotencyKey: String!, plan: SubscriptionPlan = Pro, recurring: SubscriptionRecurring!): UserSubscription!
"""Update workspace"""
updateWorkspace(input: UpdateWorkspaceInput!): WorkspaceType!
"""Upload user avatar"""
uploadAvatar(avatar: Upload!): UserType!
verifyEmail(token: String!): Boolean!
}
type NotInWorkspaceDataType {
workspaceId: String!
}
enum OAuthProviderType {
GitHub
Google
OIDC
}
type PasswordLimitsType {
maxLength: Int!
minLength: Int!
}
"""User permission in workspace"""
enum Permission {
Admin
Owner
Read
Write
}
"""The mode which the public page default in"""
enum PublicPageMode {
Edgeless
Page
}
type Query {
checkBlobSize(size: SafeInt!, workspaceId: String!): WorkspaceBlobSizes! @deprecated(reason: "no more needed")
collectAllBlobSizes: WorkspaceBlobSizes! @deprecated(reason: "use `user.storageUsage` instead")
"""Get current user"""
currentUser: UserType
earlyAccessUsers: [UserType!]!
error(name: ErrorNames!): ErrorDataUnion!
"""send workspace invitation"""
getInviteInfo(inviteId: String!): InvitationType!
"""Get is owner of workspace"""
isOwner(workspaceId: String!): Boolean!
"""List blobs of workspace"""
listBlobs(workspaceId: String!): [String!]! @deprecated(reason: "use `workspace.blobs` instead")
"""List all copilot prompts"""
listCopilotPrompts: [CopilotPromptType!]!
listWorkspaceFeatures(feature: FeatureType!): [WorkspaceType!]!
prices: [SubscriptionPrice!]!
"""server config"""
serverConfig: ServerConfigType!
"""get all server runtime configurable settings"""
serverRuntimeConfig: [ServerRuntimeConfigType!]!
"""Get user by email"""
user(email: String!): UserOrLimitedUser
"""Get user by id"""
userById(id: String!): UserType!
"""List registered users"""
users(filter: ListUserInput!): [UserType!]!
"""Get workspace by id"""
workspace(id: String!): WorkspaceType!
"""Get all accessible workspaces for current user"""
workspaces: [WorkspaceType!]!
}
input QueryChatHistoriesInput {
action: Boolean
limit: Int
sessionId: String
skip: Int
}
type QuotaQueryType {
blobLimit: SafeInt!
copilotActionLimit: SafeInt
historyPeriod: SafeInt!
humanReadable: HumanReadableQuotaType!
memberLimit: SafeInt!
name: String!
storageQuota: SafeInt!
usedSize: SafeInt!
}
type RemoveAvatar {
success: Boolean!
}
type RuntimeConfigNotFoundDataType {
key: String!
}
enum RuntimeConfigType {
Array
Boolean
Number
Object
String
}
"""
The `SafeInt` scalar type represents non-fractional signed whole numeric values that are considered safe as defined by the ECMAScript specification.
"""
scalar SafeInt @specifiedBy(url: "https://www.ecma-international.org/ecma-262/#sec-number.issafeinteger")
type SameSubscriptionRecurringDataType {
recurring: String!
}
type ServerConfigType {
"""server base url"""
baseUrl: String!
"""credentials requirement"""
credentialsRequirement: CredentialsRequirementType!
"""enable telemetry"""
enableTelemetry: Boolean!
"""enabled server features"""
features: [ServerFeature!]!
"""server flags"""
flags: ServerFlagsType!
"""server flavor"""
flavor: String! @deprecated(reason: "use `features`")
"""server identical name could be shown as badge on user interface"""
name: String!
oauthProviders: [OAuthProviderType!]!
"""server type"""
type: ServerDeploymentType!
"""server version"""
version: String!
}
enum ServerDeploymentType {
Affine
Selfhosted
}
enum ServerFeature {
Copilot
OAuth
Payment
}
type ServerFlagsType {
earlyAccessControl: Boolean!
syncClientVersionCheck: Boolean!
}
type ServerRuntimeConfigType {
description: String!
id: String!
key: String!
module: String!
type: RuntimeConfigType!
updatedAt: DateTime!
value: JSON!
}
type SubscriptionAlreadyExistsDataType {
plan: String!
}
type SubscriptionNotExistsDataType {
plan: String!
}
enum SubscriptionPlan {
AI
Enterprise
Free
Pro
SelfHosted
Team
}
type SubscriptionPlanNotFoundDataType {
plan: String!
recurring: String!
}
type SubscriptionPrice {
amount: Int
currency: String!
plan: SubscriptionPlan!
type: String!
yearlyAmount: Int
}
enum SubscriptionRecurring {
Monthly
Yearly
}
enum SubscriptionStatus {
Active
Canceled
Incomplete
IncompleteExpired
PastDue
Paused
Trialing
Unpaid
}
type UnknownOauthProviderDataType {
name: String!
}
input UpdateUserInput {
"""User name"""
name: String
}
input UpdateWorkspaceInput {
id: ID!
"""is Public workspace"""
public: Boolean
}
"""The `Upload` scalar type represents a file upload."""
scalar Upload
type UserInvoice {
amount: Int!
createdAt: DateTime!
currency: String!
id: String!
lastPaymentError: String
link: String
plan: SubscriptionPlan!
reason: String!
recurring: SubscriptionRecurring!
status: InvoiceStatus!
updatedAt: DateTime!
}
union UserOrLimitedUser = LimitedUserType | UserType
type UserQuota {
blobLimit: SafeInt!
historyPeriod: SafeInt!
humanReadable: UserQuotaHumanReadable!
memberLimit: Int!
name: String!
storageQuota: SafeInt!
}
type UserQuotaHumanReadable {
blobLimit: String!
historyPeriod: String!
memberLimit: String!
name: String!
storageQuota: String!
}
type UserSubscription {
canceledAt: DateTime
createdAt: DateTime!
end: DateTime!
id: String!
nextBillAt: DateTime
"""
The 'Free' plan just exists to be a placeholder and for the type convenience of frontend.
There won't actually be a subscription with plan 'Free'
"""
plan: SubscriptionPlan!
recurring: SubscriptionRecurring!
start: DateTime!
status: SubscriptionStatus!
trialEnd: DateTime
trialStart: DateTime
updatedAt: DateTime!
}
type UserType {
"""User avatar url"""
avatarUrl: String
copilot(workspaceId: String): Copilot!
"""User email verified"""
createdAt: DateTime @deprecated(reason: "useless")
"""User email"""
email: String!
"""User email verified"""
emailVerified: Boolean!
"""Enabled features of a user"""
features: [FeatureType!]!
"""User password has been set"""
hasPassword: Boolean
id: ID!
"""Get user invoice count"""
invoiceCount: Int!
invoices(skip: Int, take: Int = 8): [UserInvoice!]!
"""User name"""
name: String!
quota: UserQuota
subscription(plan: SubscriptionPlan = Pro): UserSubscription @deprecated(reason: "use `UserType.subscriptions`")
subscriptions: [UserSubscription!]!
token: tokenType! @deprecated(reason: "use [/api/auth/authorize]")
}
type VersionRejectedDataType {
serverVersion: String!
version: String!
}
type WorkspaceAccessDeniedDataType {
workspaceId: String!
}
type WorkspaceBlobSizes {
size: SafeInt!
}
type WorkspaceNotFoundDataType {
workspaceId: String!
}
type WorkspaceOwnerNotFoundDataType {
workspaceId: String!
}
type WorkspacePage {
id: String!
mode: PublicPageMode!
public: Boolean!
workspaceId: String!
}
type WorkspaceType {
"""Available features of workspace"""
availableFeatures: [FeatureType!]!
"""List blobs of workspace"""
blobs: [String!]!
"""Blobs size of workspace"""
blobsSize: Int!
"""Workspace created date"""
createdAt: DateTime!
"""Enabled features of workspace"""
features: [FeatureType!]!
histories(before: DateTime, guid: String!, take: Int): [DocHistoryType!]!
id: ID!
"""member count of workspace"""
memberCount: Int!
"""Members of workspace"""
members(skip: Int, take: Int): [InviteUserType!]!
"""Owner of workspace"""
owner: UserType!
"""Permission of current signed in user in workspace"""
permission: Permission!
"""is Public workspace"""
public: Boolean!
"""Get public page of a workspace by page id."""
publicPage(pageId: String!): WorkspacePage
"""Public pages of a workspace"""
publicPages: [WorkspacePage!]!
"""quota of workspace"""
quota: QuotaQueryType!
"""Shared pages of workspace"""
sharedPages: [String!]! @deprecated(reason: "use WorkspaceType.publicPages")
}
type tokenType {
refresh: String!
sessionToken: String
token: String!
}