feat: update MarkdownView render (#13387)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **New Features**
* Introduced support for managing context blobs, including adding and
removing blobs within contexts.
  * Added the ability to generate and revoke user access tokens.
  * Implemented queries to list user access tokens and context blobs.

* **Improvements**
* Enhanced context object queries to include blobs and updated related
data structures.
* Updated type references for improved schema alignment and consistency.

* **Bug Fixes**
* Removed obsolete or incorrect error fields from certain context and
document queries.

* **Chores**
  * Upgraded the MarkdownView dependency to version 3.4.1.
  * Updated internal type names for better clarity and maintainability.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
Lakr
2025-08-01 12:38:10 +08:00
committed by GitHub
parent 916887e9dc
commit 19790c1b9e
19 changed files with 384 additions and 21 deletions

View File

@@ -0,0 +1,53 @@
// @generated
// This file was automatically generated and should not be edited.
@_exported import ApolloAPI
public class AddContextBlobMutation: GraphQLMutation {
public static let operationName: String = "addContextBlob"
public static let operationDocument: ApolloAPI.OperationDocument = .init(
definition: .init(
#"mutation addContextBlob($options: AddContextBlobInput!) { addContextBlob(options: $options) { __typename id createdAt status } }"#
))
public var options: AddContextBlobInput
public init(options: AddContextBlobInput) {
self.options = options
}
public var __variables: Variables? { ["options": options] }
public struct Data: AffineGraphQL.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.Mutation }
public static var __selections: [ApolloAPI.Selection] { [
.field("addContextBlob", AddContextBlob.self, arguments: ["options": .variable("options")]),
] }
/// add a blob to context
public var addContextBlob: AddContextBlob { __data["addContextBlob"] }
/// AddContextBlob
///
/// Parent Type: `CopilotContextBlob`
public struct AddContextBlob: AffineGraphQL.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.CopilotContextBlob }
public static var __selections: [ApolloAPI.Selection] { [
.field("__typename", String.self),
.field("id", AffineGraphQL.ID.self),
.field("createdAt", AffineGraphQL.SafeInt.self),
.field("status", GraphQLEnum<AffineGraphQL.ContextEmbedStatus>?.self),
] }
public var id: AffineGraphQL.ID { __data["id"] }
public var createdAt: AffineGraphQL.SafeInt { __data["createdAt"] }
public var status: GraphQLEnum<AffineGraphQL.ContextEmbedStatus>? { __data["status"] }
}
}
}

View File

@@ -53,12 +53,12 @@ public class AddContextCategoryMutation: GraphQLMutation {
/// AddContextCategory.Doc
///
/// Parent Type: `CopilotDocType`
/// Parent Type: `CopilotContextDoc`
public struct Doc: AffineGraphQL.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.CopilotDocType }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.CopilotContextDoc }
public static var __selections: [ApolloAPI.Selection] { [
.field("__typename", String.self),
.field("id", AffineGraphQL.ID.self),

View File

@@ -7,7 +7,7 @@ public class AddContextDocMutation: GraphQLMutation {
public static let operationName: String = "addContextDoc"
public static let operationDocument: ApolloAPI.OperationDocument = .init(
definition: .init(
#"mutation addContextDoc($options: AddContextDocInput!) { addContextDoc(options: $options) { __typename id createdAt status error } }"#
#"mutation addContextDoc($options: AddContextDocInput!) { addContextDoc(options: $options) { __typename id createdAt status } }"#
))
public var options: AddContextDocInput
@@ -43,13 +43,11 @@ public class AddContextDocMutation: GraphQLMutation {
.field("id", AffineGraphQL.ID.self),
.field("createdAt", AffineGraphQL.SafeInt.self),
.field("status", GraphQLEnum<AffineGraphQL.ContextEmbedStatus>?.self),
.field("error", String?.self),
] }
public var id: AffineGraphQL.ID { __data["id"] }
public var createdAt: AffineGraphQL.SafeInt { __data["createdAt"] }
public var status: GraphQLEnum<AffineGraphQL.ContextEmbedStatus>? { __data["status"] }
public var error: String? { __data["error"] }
}
}
}

View File

@@ -0,0 +1,56 @@
// @generated
// This file was automatically generated and should not be edited.
@_exported import ApolloAPI
public class GenerateUserAccessTokenMutation: GraphQLMutation {
public static let operationName: String = "generateUserAccessToken"
public static let operationDocument: ApolloAPI.OperationDocument = .init(
definition: .init(
#"mutation generateUserAccessToken($input: GenerateAccessTokenInput!) { generateUserAccessToken(input: $input) { __typename id name token createdAt expiresAt } }"#
))
public var input: GenerateAccessTokenInput
public init(input: GenerateAccessTokenInput) {
self.input = input
}
public var __variables: Variables? { ["input": input] }
public struct Data: AffineGraphQL.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.Mutation }
public static var __selections: [ApolloAPI.Selection] { [
.field("generateUserAccessToken", GenerateUserAccessToken.self, arguments: ["input": .variable("input")]),
] }
public var generateUserAccessToken: GenerateUserAccessToken { __data["generateUserAccessToken"] }
/// GenerateUserAccessToken
///
/// Parent Type: `RevealedAccessToken`
public struct GenerateUserAccessToken: AffineGraphQL.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.RevealedAccessToken }
public static var __selections: [ApolloAPI.Selection] { [
.field("__typename", String.self),
.field("id", String.self),
.field("name", String.self),
.field("token", String.self),
.field("createdAt", AffineGraphQL.DateTime.self),
.field("expiresAt", AffineGraphQL.DateTime?.self),
] }
public var id: String { __data["id"] }
public var name: String { __data["name"] }
public var token: String { __data["token"] }
public var createdAt: AffineGraphQL.DateTime { __data["createdAt"] }
public var expiresAt: AffineGraphQL.DateTime? { __data["expiresAt"] }
}
}
}

View File

@@ -0,0 +1,33 @@
// @generated
// This file was automatically generated and should not be edited.
@_exported import ApolloAPI
public class RemoveContextBlobMutation: GraphQLMutation {
public static let operationName: String = "removeContextBlob"
public static let operationDocument: ApolloAPI.OperationDocument = .init(
definition: .init(
#"mutation removeContextBlob($options: RemoveContextBlobInput!) { removeContextBlob(options: $options) }"#
))
public var options: RemoveContextBlobInput
public init(options: RemoveContextBlobInput) {
self.options = options
}
public var __variables: Variables? { ["options": options] }
public struct Data: AffineGraphQL.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.Mutation }
public static var __selections: [ApolloAPI.Selection] { [
.field("removeContextBlob", Bool.self, arguments: ["options": .variable("options")]),
] }
/// remove a blob from context
public var removeContextBlob: Bool { __data["removeContextBlob"] }
}
}

View File

@@ -0,0 +1,32 @@
// @generated
// This file was automatically generated and should not be edited.
@_exported import ApolloAPI
public class RevokeUserAccessTokenMutation: GraphQLMutation {
public static let operationName: String = "revokeUserAccessToken"
public static let operationDocument: ApolloAPI.OperationDocument = .init(
definition: .init(
#"mutation revokeUserAccessToken($id: String!) { revokeUserAccessToken(id: $id) }"#
))
public var id: String
public init(id: String) {
self.id = id
}
public var __variables: Variables? { ["id": id] }
public struct Data: AffineGraphQL.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.Mutation }
public static var __selections: [ApolloAPI.Selection] { [
.field("revokeUserAccessToken", Bool.self, arguments: ["id": .variable("id")]),
] }
public var revokeUserAccessToken: Bool { __data["revokeUserAccessToken"] }
}
}

View File

@@ -7,7 +7,7 @@ public class ListContextObjectQuery: GraphQLQuery {
public static let operationName: String = "listContextObject"
public static let operationDocument: ApolloAPI.OperationDocument = .init(
definition: .init(
#"query listContextObject($workspaceId: String!, $sessionId: String!, $contextId: String!) { currentUser { __typename copilot(workspaceId: $workspaceId) { __typename contexts(sessionId: $sessionId, contextId: $contextId) { __typename docs { __typename id status error createdAt } files { __typename id name mimeType blobId chunkSize error status createdAt } tags { __typename type id docs { __typename id status createdAt } createdAt } collections { __typename type id docs { __typename id status createdAt } createdAt } } } } }"#
#"query listContextObject($workspaceId: String!, $sessionId: String!, $contextId: String!) { currentUser { __typename copilot(workspaceId: $workspaceId) { __typename contexts(sessionId: $sessionId, contextId: $contextId) { __typename blobs { __typename id status createdAt } docs { __typename id status createdAt } files { __typename id name mimeType blobId chunkSize error status createdAt } tags { __typename type id docs { __typename id status createdAt } createdAt } collections { __typename type id docs { __typename id status createdAt } createdAt } } } } }"#
))
public var workspaceId: String
@@ -86,12 +86,15 @@ public class ListContextObjectQuery: GraphQLQuery {
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.CopilotContext }
public static var __selections: [ApolloAPI.Selection] { [
.field("__typename", String.self),
.field("blobs", [Blob].self),
.field("docs", [Doc].self),
.field("files", [File].self),
.field("tags", [Tag].self),
.field("collections", [Collection].self),
] }
/// list blobs in context
public var blobs: [Blob] { __data["blobs"] }
/// list files in context
public var docs: [Doc] { __data["docs"] }
/// list files in context
@@ -101,6 +104,26 @@ public class ListContextObjectQuery: GraphQLQuery {
/// list collections in context
public var collections: [Collection] { __data["collections"] }
/// CurrentUser.Copilot.Context.Blob
///
/// Parent Type: `CopilotContextBlob`
public struct Blob: AffineGraphQL.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.CopilotContextBlob }
public static var __selections: [ApolloAPI.Selection] { [
.field("__typename", String.self),
.field("id", AffineGraphQL.ID.self),
.field("status", GraphQLEnum<AffineGraphQL.ContextEmbedStatus>?.self),
.field("createdAt", AffineGraphQL.SafeInt.self),
] }
public var id: AffineGraphQL.ID { __data["id"] }
public var status: GraphQLEnum<AffineGraphQL.ContextEmbedStatus>? { __data["status"] }
public var createdAt: AffineGraphQL.SafeInt { __data["createdAt"] }
}
/// CurrentUser.Copilot.Context.Doc
///
/// Parent Type: `CopilotContextDoc`
@@ -113,13 +136,11 @@ public class ListContextObjectQuery: GraphQLQuery {
.field("__typename", String.self),
.field("id", AffineGraphQL.ID.self),
.field("status", GraphQLEnum<AffineGraphQL.ContextEmbedStatus>?.self),
.field("error", String?.self),
.field("createdAt", AffineGraphQL.SafeInt.self),
] }
public var id: AffineGraphQL.ID { __data["id"] }
public var status: GraphQLEnum<AffineGraphQL.ContextEmbedStatus>? { __data["status"] }
public var error: String? { __data["error"] }
public var createdAt: AffineGraphQL.SafeInt { __data["createdAt"] }
}
@@ -176,12 +197,12 @@ public class ListContextObjectQuery: GraphQLQuery {
/// CurrentUser.Copilot.Context.Tag.Doc
///
/// Parent Type: `CopilotDocType`
/// Parent Type: `CopilotContextDoc`
public struct Doc: AffineGraphQL.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.CopilotDocType }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.CopilotContextDoc }
public static var __selections: [ApolloAPI.Selection] { [
.field("__typename", String.self),
.field("id", AffineGraphQL.ID.self),
@@ -218,12 +239,12 @@ public class ListContextObjectQuery: GraphQLQuery {
/// CurrentUser.Copilot.Context.Collection.Doc
///
/// Parent Type: `CopilotDocType`
/// Parent Type: `CopilotContextDoc`
public struct Doc: AffineGraphQL.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.CopilotDocType }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.CopilotContextDoc }
public static var __selections: [ApolloAPI.Selection] { [
.field("__typename", String.self),
.field("id", AffineGraphQL.ID.self),

View File

@@ -0,0 +1,48 @@
// @generated
// This file was automatically generated and should not be edited.
@_exported import ApolloAPI
public class ListUserAccessTokensQuery: GraphQLQuery {
public static let operationName: String = "listUserAccessTokens"
public static let operationDocument: ApolloAPI.OperationDocument = .init(
definition: .init(
#"query listUserAccessTokens { accessTokens { __typename id name createdAt expiresAt } }"#
))
public init() {}
public struct Data: AffineGraphQL.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.Query }
public static var __selections: [ApolloAPI.Selection] { [
.field("accessTokens", [AccessToken].self),
] }
public var accessTokens: [AccessToken] { __data["accessTokens"] }
/// AccessToken
///
/// Parent Type: `AccessToken`
public struct AccessToken: AffineGraphQL.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: any ApolloAPI.ParentType { AffineGraphQL.Objects.AccessToken }
public static var __selections: [ApolloAPI.Selection] { [
.field("__typename", String.self),
.field("id", String.self),
.field("name", String.self),
.field("createdAt", AffineGraphQL.DateTime.self),
.field("expiresAt", AffineGraphQL.DateTime?.self),
] }
public var id: String { __data["id"] }
public var name: String { __data["name"] }
public var createdAt: AffineGraphQL.DateTime { __data["createdAt"] }
public var expiresAt: AffineGraphQL.DateTime? { __data["expiresAt"] }
}
}
}

View File

@@ -0,0 +1,32 @@
// @generated
// This file was automatically generated and should not be edited.
import ApolloAPI
public struct AddContextBlobInput: InputObject {
public private(set) var __data: InputDict
public init(_ data: InputDict) {
__data = data
}
public init(
blobId: String,
contextId: String
) {
__data = InputDict([
"blobId": blobId,
"contextId": contextId
])
}
public var blobId: String {
get { __data["blobId"] }
set { __data["blobId"] = newValue }
}
public var contextId: String {
get { __data["contextId"] }
set { __data["contextId"] = newValue }
}
}

View File

@@ -0,0 +1,32 @@
// @generated
// This file was automatically generated and should not be edited.
import ApolloAPI
public struct GenerateAccessTokenInput: InputObject {
public private(set) var __data: InputDict
public init(_ data: InputDict) {
__data = data
}
public init(
expiresAt: GraphQLNullable<DateTime> = nil,
name: String
) {
__data = InputDict([
"expiresAt": expiresAt,
"name": name
])
}
public var expiresAt: GraphQLNullable<DateTime> {
get { __data["expiresAt"] }
set { __data["expiresAt"] = newValue }
}
public var name: String {
get { __data["name"] }
set { __data["name"] = newValue }
}
}

View File

@@ -0,0 +1,32 @@
// @generated
// This file was automatically generated and should not be edited.
import ApolloAPI
public struct RemoveContextBlobInput: InputObject {
public private(set) var __data: InputDict
public init(_ data: InputDict) {
__data = data
}
public init(
blobId: String,
contextId: String
) {
__data = InputDict([
"blobId": blobId,
"contextId": contextId
])
}
public var blobId: String {
get { __data["blobId"] }
set { __data["blobId"] = newValue }
}
public var contextId: String {
get { __data["contextId"] }
set { __data["contextId"] = newValue }
}
}

View File

@@ -4,8 +4,8 @@
import ApolloAPI
public extension Objects {
static let CopilotDocType = ApolloAPI.Object(
typename: "CopilotDocType",
static let AccessToken = ApolloAPI.Object(
typename: "AccessToken",
implementedInterfaces: [],
keyFields: nil
)

View File

@@ -0,0 +1,12 @@
// @generated
// This file was automatically generated and should not be edited.
import ApolloAPI
public extension Objects {
static let CopilotContextBlob = ApolloAPI.Object(
typename: "CopilotContextBlob",
implementedInterfaces: [],
keyFields: nil
)
}

View File

@@ -0,0 +1,12 @@
// @generated
// This file was automatically generated and should not be edited.
import ApolloAPI
public extension Objects {
static let RevealedAccessToken = ApolloAPI.Object(
typename: "RevealedAccessToken",
implementedInterfaces: [],
keyFields: nil
)
}

View File

@@ -20,6 +20,7 @@ public enum SchemaMetadata: ApolloAPI.SchemaMetadata {
public static func objectType(forTypename typename: String) -> ApolloAPI.Object? {
switch typename {
case "AccessToken": return AffineGraphQL.Objects.AccessToken
case "AggregateBucketHitsObjectType": return AffineGraphQL.Objects.AggregateBucketHitsObjectType
case "AggregateBucketObjectType": return AffineGraphQL.Objects.AggregateBucketObjectType
case "AggregateResultObjectType": return AffineGraphQL.Objects.AggregateResultObjectType
@@ -34,10 +35,10 @@ public enum SchemaMetadata: ApolloAPI.SchemaMetadata {
case "ContextWorkspaceEmbeddingStatus": return AffineGraphQL.Objects.ContextWorkspaceEmbeddingStatus
case "Copilot": return AffineGraphQL.Objects.Copilot
case "CopilotContext": return AffineGraphQL.Objects.CopilotContext
case "CopilotContextBlob": return AffineGraphQL.Objects.CopilotContextBlob
case "CopilotContextCategory": return AffineGraphQL.Objects.CopilotContextCategory
case "CopilotContextDoc": return AffineGraphQL.Objects.CopilotContextDoc
case "CopilotContextFile": return AffineGraphQL.Objects.CopilotContextFile
case "CopilotDocType": return AffineGraphQL.Objects.CopilotDocType
case "CopilotHistories": return AffineGraphQL.Objects.CopilotHistories
case "CopilotHistoriesTypeEdge": return AffineGraphQL.Objects.CopilotHistoriesTypeEdge
case "CopilotPromptConfigType": return AffineGraphQL.Objects.CopilotPromptConfigType
@@ -85,6 +86,7 @@ public enum SchemaMetadata: ApolloAPI.SchemaMetadata {
case "ReleaseVersionType": return AffineGraphQL.Objects.ReleaseVersionType
case "RemoveAvatar": return AffineGraphQL.Objects.RemoveAvatar
case "ReplyObjectType": return AffineGraphQL.Objects.ReplyObjectType
case "RevealedAccessToken": return AffineGraphQL.Objects.RevealedAccessToken
case "SearchDocObjectType": return AffineGraphQL.Objects.SearchDocObjectType
case "SearchNodeObjectType": return AffineGraphQL.Objects.SearchNodeObjectType
case "SearchResultObjectType": return AffineGraphQL.Objects.SearchResultObjectType