9368d77bc8
Implements the `latestSchema` query to fetch the latest schema updates for an organization. This change enhances the GraphQL API by allowing clients to retrieve the most recent schema version and its associated subgraphs. The resolver performs necessary access checks, logs relevant information, and generates the Cosmo router configuration from fetched subgraph SDLs, returning structured schema update details.
88 lines
1.5 KiB
GraphQL
88 lines
1.5 KiB
GraphQL
type Query {
|
|
organizations: [Organization!]! @auth(user: true)
|
|
supergraph(ref: String!, isAfter: String): Supergraph! @auth(organization: true)
|
|
latestSchema(ref: String!): SchemaUpdate! @auth(organization: true)
|
|
}
|
|
|
|
type Mutation {
|
|
addOrganization(name: String!): Organization! @auth(user: true)
|
|
addAPIKey(input: InputAPIKey): APIKey! @auth(user: true)
|
|
updateSubGraph(input: InputSubGraph!): SubGraph! @auth(organization: true)
|
|
}
|
|
|
|
type Subscription {
|
|
schemaUpdates(ref: String!): SchemaUpdate! @auth(organization: true)
|
|
}
|
|
|
|
type Organization {
|
|
id: ID!
|
|
name: String!
|
|
users: [User!]!
|
|
apiKeys: [APIKey!]!
|
|
}
|
|
|
|
type User {
|
|
id: String!
|
|
}
|
|
|
|
type APIKey {
|
|
id: ID!
|
|
name: String!
|
|
key: String
|
|
organization: Organization!
|
|
refs: [String!]!
|
|
read: Boolean!
|
|
publish: Boolean!
|
|
}
|
|
|
|
union Supergraph = Unchanged | SubGraphs
|
|
|
|
type Unchanged {
|
|
id: ID!
|
|
minDelaySeconds: Int!
|
|
}
|
|
|
|
type SubGraphs {
|
|
id: ID!
|
|
minDelaySeconds: Int!
|
|
sdl: String!
|
|
subGraphs: [SubGraph!]!
|
|
}
|
|
|
|
type SubGraph {
|
|
id: ID!
|
|
service: String!
|
|
url: String
|
|
wsUrl: String
|
|
sdl: String!
|
|
changedBy: String!
|
|
changedAt: Time!
|
|
}
|
|
|
|
type SchemaUpdate {
|
|
ref: String!
|
|
id: ID!
|
|
subGraphs: [SubGraph!]!
|
|
cosmoRouterConfig: String
|
|
}
|
|
|
|
input InputAPIKey {
|
|
name: String!
|
|
organizationId: ID!
|
|
refs: [String!]!
|
|
read: Boolean!
|
|
publish: Boolean!
|
|
}
|
|
|
|
input InputSubGraph {
|
|
ref: String!
|
|
service: String!
|
|
url: String
|
|
wsUrl: String
|
|
sdl: String!
|
|
}
|
|
|
|
scalar Time
|
|
|
|
directive @auth(user: Boolean, organization: Boolean) on FIELD_DEFINITION
|