mirror of
https://github.com/graphql-hive/console
synced 2026-05-23 09:08:34 +00:00
chore: codegen updates (#5378)
This commit is contained in:
parent
098355c7d2
commit
78bdcdab5a
22 changed files with 40 additions and 30 deletions
|
|
@ -1,7 +1,7 @@
|
|||
import { AlertsManager } from '../providers/alerts-manager';
|
||||
import type { ProjectResolvers } from './../../../__generated__/types.next';
|
||||
|
||||
export const Project: Pick<ProjectResolvers, 'alertChannels' | 'alerts'> = {
|
||||
export const Project: Pick<ProjectResolvers, 'alertChannels' | 'alerts' | '__isTypeOf'> = {
|
||||
alerts: async (project, _, { injector }) => {
|
||||
return injector.get(AlertsManager).getAlerts({
|
||||
organization: project.orgId,
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import type { OrganizationResolvers } from './../../../__generated__/types.next'
|
|||
*
|
||||
* If you want to skip this file generation, remove the mapper or update the pattern in the `resolverGeneration.object` config.
|
||||
*/
|
||||
export const Organization: Pick<OrganizationResolvers, 'isAppDeploymentsEnabled'> = {
|
||||
export const Organization: Pick<OrganizationResolvers, 'isAppDeploymentsEnabled' | '__isTypeOf'> = {
|
||||
/* Implement Organization resolver logic here */
|
||||
isAppDeploymentsEnabled(appDeployment) {
|
||||
return appDeployment.featureFlags.appDeployments;
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import type { TargetResolvers } from './../../../__generated__/types.next';
|
|||
*
|
||||
* If you want to skip this file generation, remove the mapper or update the pattern in the `resolverGeneration.object` config.
|
||||
*/
|
||||
export const Target: Pick<TargetResolvers, 'appDeployment' | 'appDeployments'> = {
|
||||
export const Target: Pick<TargetResolvers, 'appDeployment' | 'appDeployments' | '__isTypeOf'> = {
|
||||
/* Implement Target resolver logic here */
|
||||
appDeployment: async (target, args, { injector }) => {
|
||||
return injector.get(AppDeploymentsManager).getAppDeploymentForTarget(target, {
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ export const Member: Pick<
|
|||
| 'projectAccessScopes'
|
||||
| 'targetAccessScopes'
|
||||
| 'user'
|
||||
| '__isTypeOf'
|
||||
> = {
|
||||
organizationAccessScopes: (member, _, { injector }) => {
|
||||
return injector.get(AuthManager).getMemberOrganizationScopes({
|
||||
|
|
|
|||
|
|
@ -2,5 +2,5 @@ import type { UserResolvers } from './../../../__generated__/types.next';
|
|||
|
||||
export const User: Pick<
|
||||
UserResolvers,
|
||||
'displayName' | 'email' | 'fullName' | 'id' | 'isAdmin' | 'provider'
|
||||
'displayName' | 'email' | 'fullName' | 'id' | 'isAdmin' | 'provider' | '__isTypeOf'
|
||||
> = {};
|
||||
|
|
|
|||
|
|
@ -1,7 +1,10 @@
|
|||
import { BillingProvider } from '../providers/billing.provider';
|
||||
import type { BillingPlanType, OrganizationResolvers } from './../../../__generated__/types.next';
|
||||
|
||||
export const Organization: Pick<OrganizationResolvers, 'billingConfiguration' | 'plan'> = {
|
||||
export const Organization: Pick<
|
||||
OrganizationResolvers,
|
||||
'billingConfiguration' | 'plan' | '__isTypeOf'
|
||||
> = {
|
||||
plan: org => (org.billingPlan || 'HOBBY') as BillingPlanType,
|
||||
billingConfiguration: async (org, _args, { injector }) => {
|
||||
if (org.billingPlan === 'ENTERPRISE') {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { CdnProvider } from '../providers/cdn.provider';
|
||||
import type { ContractResolvers } from './../../../__generated__/types.next';
|
||||
|
||||
export const Contract: Pick<ContractResolvers, 'cdnUrl'> = {
|
||||
export const Contract: Pick<ContractResolvers, 'cdnUrl' | '__isTypeOf'> = {
|
||||
cdnUrl: (contract, _, context) => {
|
||||
return context.injector.get(CdnProvider).getCdnUrlForContract(contract);
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { CdnProvider } from '../providers/cdn.provider';
|
||||
import type { TargetResolvers } from './../../../__generated__/types.next';
|
||||
|
||||
export const Target: Pick<TargetResolvers, 'cdnAccessTokens' | 'cdnUrl'> = {
|
||||
export const Target: Pick<TargetResolvers, 'cdnAccessTokens' | 'cdnUrl' | '__isTypeOf'> = {
|
||||
cdnAccessTokens: async (target, args, context) => {
|
||||
const result = await context.injector.get(CdnProvider).getPaginatedCDNAccessTokensForTarget({
|
||||
targetId: target.id,
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import type { OrganizationResolvers } from './../../../__generated__/types.next'
|
|||
|
||||
export const Organization: Pick<
|
||||
OrganizationResolvers,
|
||||
'gitHubIntegration' | 'hasGitHubIntegration' | 'hasSlackIntegration'
|
||||
'gitHubIntegration' | 'hasGitHubIntegration' | 'hasSlackIntegration' | '__isTypeOf'
|
||||
> = {
|
||||
gitHubIntegration: async (organization, _, { injector }) => {
|
||||
const repositories = await injector.get(GitHubIntegrationManager).getRepositories({
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import type { ProjectResolvers } from './../../../__generated__/types.next';
|
||||
|
||||
export const Project: Pick<ProjectResolvers, 'isProjectNameInGitHubCheckEnabled'> = {
|
||||
export const Project: Pick<ProjectResolvers, 'isProjectNameInGitHubCheckEnabled' | '__isTypeOf'> = {
|
||||
isProjectNameInGitHubCheckEnabled: project => {
|
||||
return project.useProjectNameInGithubCheck;
|
||||
},
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import type { OrganizationResolvers } from './../../../__generated__/types.next'
|
|||
|
||||
export const Organization: Pick<
|
||||
OrganizationResolvers,
|
||||
'oidcIntegration' | 'viewerCanManageOIDCIntegration'
|
||||
'oidcIntegration' | 'viewerCanManageOIDCIntegration' | '__isTypeOf'
|
||||
> = {
|
||||
oidcIntegration: async (organization, _, { injector }) => {
|
||||
if (injector.get(OIDCIntegrationsProvider).isEnabled() === false) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import type { UserResolvers } from './../../../__generated__/types.next';
|
||||
|
||||
export const User: Pick<UserResolvers, 'canSwitchOrganization'> = {
|
||||
export const User: Pick<UserResolvers, 'canSwitchOrganization' | '__isTypeOf'> = {
|
||||
canSwitchOrganization: user => !user.oidcIntegrationId,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { SchemaPolicyProvider } from '../providers/schema-policy.provider';
|
||||
import type { OrganizationResolvers } from './../../../__generated__/types.next';
|
||||
|
||||
export const Organization: Pick<OrganizationResolvers, 'schemaPolicy'> = {
|
||||
export const Organization: Pick<OrganizationResolvers, 'schemaPolicy' | '__isTypeOf'> = {
|
||||
schemaPolicy: async (org, _, { injector }) =>
|
||||
injector.get(SchemaPolicyProvider).getOrganizationPolicy({
|
||||
organization: org.id,
|
||||
|
|
|
|||
|
|
@ -1,15 +1,16 @@
|
|||
import { SchemaPolicyProvider } from '../providers/schema-policy.provider';
|
||||
import type { ProjectResolvers } from './../../../__generated__/types.next';
|
||||
|
||||
export const Project: Pick<ProjectResolvers, 'parentSchemaPolicy' | 'schemaPolicy'> = {
|
||||
schemaPolicy: async (project, _, { injector }) =>
|
||||
injector.get(SchemaPolicyProvider).getProjectPolicy({
|
||||
project: project.id,
|
||||
organization: project.orgId,
|
||||
}),
|
||||
parentSchemaPolicy: async (project, _, { injector }) =>
|
||||
injector.get(SchemaPolicyProvider).getOrganizationPolicyForProject({
|
||||
project: project.id,
|
||||
organization: project.orgId,
|
||||
}),
|
||||
};
|
||||
export const Project: Pick<ProjectResolvers, 'parentSchemaPolicy' | 'schemaPolicy' | '__isTypeOf'> =
|
||||
{
|
||||
schemaPolicy: async (project, _, { injector }) =>
|
||||
injector.get(SchemaPolicyProvider).getProjectPolicy({
|
||||
project: project.id,
|
||||
organization: project.orgId,
|
||||
}),
|
||||
parentSchemaPolicy: async (project, _, { injector }) =>
|
||||
injector.get(SchemaPolicyProvider).getOrganizationPolicyForProject({
|
||||
project: project.id,
|
||||
organization: project.orgId,
|
||||
}),
|
||||
};
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import { SchemaPolicyProvider } from '../providers/schema-policy.provider';
|
|||
import { serializeSeverity } from '../utils';
|
||||
import type { TargetResolvers } from './../../../__generated__/types.next';
|
||||
|
||||
export const Target: Pick<TargetResolvers, 'schemaPolicy'> = {
|
||||
export const Target: Pick<TargetResolvers, 'schemaPolicy' | '__isTypeOf'> = {
|
||||
schemaPolicy: async (target, _, { injector }) => {
|
||||
const { mergedPolicy, orgLevel, projectLevel } = await injector
|
||||
.get(SchemaPolicyProvider)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { ProjectManager } from '../providers/project-manager';
|
||||
import type { OrganizationResolvers } from './../../../__generated__/types.next';
|
||||
|
||||
export const Organization: Pick<OrganizationResolvers, 'projects'> = {
|
||||
export const Organization: Pick<OrganizationResolvers, 'projects' | '__isTypeOf'> = {
|
||||
projects: (organization, _, { injector }) => {
|
||||
return injector.get(ProjectManager).getProjects({ organization: organization.id });
|
||||
},
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ export const Project: Pick<
|
|||
| 'name'
|
||||
| 'type'
|
||||
| 'validationUrl'
|
||||
| '__isTypeOf'
|
||||
> = {
|
||||
experimental_nativeCompositionPerTarget: async (project, _, { injector }) => {
|
||||
if (project.type !== ProjectType.FEDERATION) {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import { Logger } from '../../shared/providers/logger';
|
|||
import { RateLimitProvider } from '../providers/rate-limit.provider';
|
||||
import type { OrganizationResolvers } from './../../../__generated__/types.next';
|
||||
|
||||
export const Organization: Pick<OrganizationResolvers, 'rateLimit'> = {
|
||||
export const Organization: Pick<OrganizationResolvers, 'rateLimit' | '__isTypeOf'> = {
|
||||
rateLimit: async (org, _args, { injector }) => {
|
||||
let limitedForOperations = false;
|
||||
const logger = injector.get(Logger);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,10 @@
|
|||
import { SupportManager } from '../providers/support-manager';
|
||||
import type { OrganizationResolvers } from './../../../__generated__/types.next';
|
||||
|
||||
export const Organization: Pick<OrganizationResolvers, 'supportTicket' | 'supportTickets'> = {
|
||||
export const Organization: Pick<
|
||||
OrganizationResolvers,
|
||||
'supportTicket' | 'supportTickets' | '__isTypeOf'
|
||||
> = {
|
||||
supportTickets: async (org, args, { injector }) => {
|
||||
const response = await injector.get(SupportManager).getTickets(org.id);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { TargetManager } from '../providers/target-manager';
|
||||
import type { ProjectResolvers } from './../../../__generated__/types.next';
|
||||
|
||||
export const Project: Pick<ProjectResolvers, 'targets'> = {
|
||||
export const Project: Pick<ProjectResolvers, 'targets' | '__isTypeOf'> = {
|
||||
targets: (project, _, { injector }) => {
|
||||
return injector.get(TargetManager).getTargets({
|
||||
project: project.id,
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ export const Target: Pick<
|
|||
| 'name'
|
||||
| 'project'
|
||||
| 'validationSettings'
|
||||
| '__isTypeOf'
|
||||
> = {
|
||||
project: (target, _args, { injector }) =>
|
||||
injector.get(ProjectManager).getProject({
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { TokenManager } from '../providers/token-manager';
|
||||
import type { TargetResolvers } from './../../../__generated__/types.next';
|
||||
|
||||
export const Target: Pick<TargetResolvers, 'tokens'> = {
|
||||
export const Target: Pick<TargetResolvers, 'tokens' | '__isTypeOf'> = {
|
||||
tokens(target, _, { injector }) {
|
||||
return injector.get(TokenManager).getTokens({
|
||||
target: target.id,
|
||||
|
|
|
|||
Loading…
Reference in a new issue