mirror of
https://github.com/graphql-hive/console
synced 2026-04-21 14:37:17 +00:00
Integrate Server Preset v0.13 and latest Codegen versions (#7063)
This commit is contained in:
parent
5c8b47241a
commit
8d554dd65b
35 changed files with 571 additions and 357 deletions
14
package.json
14
package.json
|
|
@ -59,13 +59,13 @@
|
|||
"@actions/core": "1.11.1",
|
||||
"@changesets/changelog-github": "0.5.1",
|
||||
"@changesets/cli": "2.29.7",
|
||||
"@eddeee888/gcg-typescript-resolver-files": "0.12.2",
|
||||
"@graphql-codegen/add": "5.0.3",
|
||||
"@graphql-codegen/cli": "5.0.7",
|
||||
"@graphql-codegen/client-preset": "4.8.3",
|
||||
"@graphql-codegen/typescript": "4.1.6",
|
||||
"@graphql-codegen/typescript-operations": "4.6.1",
|
||||
"@graphql-codegen/typescript-resolvers": "4.5.2",
|
||||
"@eddeee888/gcg-typescript-resolver-files": "0.13.0",
|
||||
"@graphql-codegen/add": "6.0.0",
|
||||
"@graphql-codegen/cli": "6.0.0",
|
||||
"@graphql-codegen/client-preset": "5.0.2",
|
||||
"@graphql-codegen/typescript": "5.0.1",
|
||||
"@graphql-codegen/typescript-operations": "5.0.1",
|
||||
"@graphql-codegen/typescript-resolvers": "5.0.1",
|
||||
"@graphql-codegen/urql-introspection": "3.0.1",
|
||||
"@graphql-eslint/eslint-plugin": "3.20.1",
|
||||
"@graphql-inspector/cli": "4.0.3",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { AlertsManager } from '../providers/alerts-manager';
|
||||
import type { ProjectResolvers } from './../../../__generated__/types';
|
||||
|
||||
export const Project: Pick<ProjectResolvers, 'alertChannels' | 'alerts' | '__isTypeOf'> = {
|
||||
export const Project: Pick<ProjectResolvers, 'alertChannels' | 'alerts'> = {
|
||||
alerts: async (project, _, { injector }) => {
|
||||
return injector.get(AlertsManager).getAlerts({
|
||||
organizationId: project.orgId,
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import type { OrganizationResolvers } from './../../../__generated__/types';
|
|||
*
|
||||
* 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' | '__isTypeOf'> = {
|
||||
export const Organization: Pick<OrganizationResolvers, 'isAppDeploymentsEnabled'> = {
|
||||
/* Implement Organization resolver logic here */
|
||||
isAppDeploymentsEnabled(organization, _, { injector }) {
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ import type { TargetResolvers } from './../../../__generated__/types';
|
|||
*/
|
||||
export const Target: Pick<
|
||||
TargetResolvers,
|
||||
'appDeployment' | 'appDeployments' | 'viewerCanViewAppDeployments' | '__isTypeOf'
|
||||
'appDeployment' | 'appDeployments' | 'viewerCanViewAppDeployments'
|
||||
> = {
|
||||
/* Implement Target resolver logic here */
|
||||
appDeployment: async (target, args, { injector }) => {
|
||||
|
|
|
|||
|
|
@ -2,5 +2,5 @@ import type { UserResolvers } from './../../../__generated__/types';
|
|||
|
||||
export const User: Pick<
|
||||
UserResolvers,
|
||||
'displayName' | 'email' | 'fullName' | 'id' | 'isAdmin' | 'provider' | '__isTypeOf'
|
||||
'displayName' | 'email' | 'fullName' | 'id' | 'isAdmin' | 'provider'
|
||||
> = {};
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { CdnProvider } from '../providers/cdn.provider';
|
||||
import type { ContractResolvers } from './../../../__generated__/types';
|
||||
|
||||
export const Contract: Pick<ContractResolvers, 'cdnUrl' | '__isTypeOf'> = {
|
||||
export const Contract: Pick<ContractResolvers, 'cdnUrl'> = {
|
||||
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';
|
||||
|
||||
export const Target: Pick<TargetResolvers, 'cdnAccessTokens' | 'cdnUrl' | '__isTypeOf'> = {
|
||||
export const Target: Pick<TargetResolvers, 'cdnAccessTokens' | 'cdnUrl'> = {
|
||||
cdnAccessTokens: async (target, args, context) => {
|
||||
const result = await context.injector.get(CdnProvider).getPaginatedCDNAccessTokensForTarget({
|
||||
targetId: target.id,
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ export const Target: Pick<
|
|||
| 'viewerCanModifyLaboratory'
|
||||
| 'viewerCanModifyPreflightScript'
|
||||
| 'viewerCanViewLaboratory'
|
||||
| '__isTypeOf'
|
||||
> = {
|
||||
documentCollections: (target, args, { injector }) =>
|
||||
injector.get(CollectionProvider).getCollections(target, args.first, args.after),
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ export const Organization: Pick<
|
|||
| 'rateLimit'
|
||||
| 'viewerCanDescribeBilling'
|
||||
| 'viewerCanModifyBilling'
|
||||
| '__isTypeOf'
|
||||
> = {
|
||||
plan: org => (org.billingPlan || 'HOBBY') as BillingPlanType,
|
||||
billingConfiguration: async (org, _args, { injector }) => {
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ export const Organization: Pick<
|
|||
| 'hasSlackIntegration'
|
||||
| 'viewerCanModifyGitHubIntegration'
|
||||
| 'viewerCanModifySlackIntegration'
|
||||
| '__isTypeOf'
|
||||
> = {
|
||||
gitHubIntegration: async (organization, _, { injector }) => {
|
||||
const repositories = await injector.get(GitHubIntegrationManager).getRepositories({
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import type { ProjectResolvers } from './../../../__generated__/types';
|
||||
|
||||
export const Project: Pick<ProjectResolvers, 'isProjectNameInGitHubCheckEnabled' | '__isTypeOf'> = {
|
||||
export const Project: Pick<ProjectResolvers, 'isProjectNameInGitHubCheckEnabled'> = {
|
||||
isProjectNameInGitHubCheckEnabled: project => {
|
||||
return project.useProjectNameInGithubCheck;
|
||||
},
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import { PreflightScriptProvider } from '../providers/preflight-script.provider'
|
|||
*
|
||||
* 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, 'preflightScript' | '__isTypeOf'> = {
|
||||
export const Target: Pick<TargetResolvers, 'preflightScript'> = {
|
||||
preflightScript: (parent, _args, { injector }) =>
|
||||
injector.get(PreflightScriptProvider).getPreflightScript(parent.id),
|
||||
};
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import type { OrganizationResolvers } from './../../../__generated__/types';
|
|||
|
||||
export const Organization: Pick<
|
||||
OrganizationResolvers,
|
||||
'oidcIntegration' | 'viewerCanManageOIDCIntegration' | '__isTypeOf'
|
||||
'oidcIntegration' | 'viewerCanManageOIDCIntegration'
|
||||
> = {
|
||||
oidcIntegration: async (organization, _, { injector }) => {
|
||||
if (injector.get(OIDCIntegrationsProvider).isEnabled() === false) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import type { UserResolvers } from './../../../__generated__/types';
|
||||
|
||||
export const User: Pick<UserResolvers, 'canSwitchOrganization' | '__isTypeOf'> = {
|
||||
export const User: Pick<UserResolvers, 'canSwitchOrganization'> = {
|
||||
canSwitchOrganization: user => !user.oidcIntegrationId,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,17 +1,15 @@
|
|||
import { OperationsManager } from '../providers/operations-manager';
|
||||
import type { OrganizationGetStartedResolvers } from './../../../__generated__/types';
|
||||
|
||||
export const OrganizationGetStarted: Pick<
|
||||
OrganizationGetStartedResolvers,
|
||||
'reportingOperations' | '__isTypeOf'
|
||||
> = {
|
||||
reportingOperations: async (organization, _, { injector }) => {
|
||||
if (organization.reportingOperations === true) {
|
||||
return organization.reportingOperations;
|
||||
}
|
||||
export const OrganizationGetStarted: Pick<OrganizationGetStartedResolvers, 'reportingOperations'> =
|
||||
{
|
||||
reportingOperations: async (organization, _, { injector }) => {
|
||||
if (organization.reportingOperations === true) {
|
||||
return organization.reportingOperations;
|
||||
}
|
||||
|
||||
return injector.get(OperationsManager).hasOperationsForOrganization({
|
||||
organizationId: organization.id,
|
||||
});
|
||||
},
|
||||
};
|
||||
return injector.get(OperationsManager).hasOperationsForOrganization({
|
||||
organizationId: organization.id,
|
||||
});
|
||||
},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -2,21 +2,20 @@ import { parseDateRangeInput } from '../../../shared/helpers';
|
|||
import { OperationsManager } from '../providers/operations-manager';
|
||||
import type { ProjectResolvers } from './../../../__generated__/types';
|
||||
|
||||
export const Project: Pick<ProjectResolvers, 'requestsOverTime' | 'totalRequests' | '__isTypeOf'> =
|
||||
{
|
||||
totalRequests: (project, { period }, { injector }) => {
|
||||
return injector.get(OperationsManager).countRequestsOfProject({
|
||||
projectId: project.id,
|
||||
organizationId: project.orgId,
|
||||
period: parseDateRangeInput(period),
|
||||
});
|
||||
},
|
||||
requestsOverTime: (project, { resolution, period }, { injector }) => {
|
||||
return injector.get(OperationsManager).readRequestsOverTimeOfProject({
|
||||
projectId: project.id,
|
||||
organizationId: project.orgId,
|
||||
period: parseDateRangeInput(period),
|
||||
resolution,
|
||||
});
|
||||
},
|
||||
};
|
||||
export const Project: Pick<ProjectResolvers, 'requestsOverTime' | 'totalRequests'> = {
|
||||
totalRequests: (project, { period }, { injector }) => {
|
||||
return injector.get(OperationsManager).countRequestsOfProject({
|
||||
projectId: project.id,
|
||||
organizationId: project.orgId,
|
||||
period: parseDateRangeInput(period),
|
||||
});
|
||||
},
|
||||
requestsOverTime: (project, { resolution, period }, { injector }) => {
|
||||
return injector.get(OperationsManager).readRequestsOverTimeOfProject({
|
||||
projectId: project.id,
|
||||
organizationId: project.orgId,
|
||||
period: parseDateRangeInput(period),
|
||||
resolution,
|
||||
});
|
||||
},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import { OperationsReader } from '../providers/operations-reader';
|
|||
|
||||
export const SchemaChangeUsageStatisticsAffectedOperation: Pick<
|
||||
SchemaChangeUsageStatisticsAffectedOperationResolvers,
|
||||
'operation' | '__isTypeOf'
|
||||
'operation'
|
||||
> = {
|
||||
operation: (affectedOperation, _, { injector }) => {
|
||||
return injector.get(OperationsReader).readOperation({
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import type { SchemaCoordinateStatsResolvers } from './../../../__generated__/ty
|
|||
|
||||
export const SchemaCoordinateStats: Pick<
|
||||
SchemaCoordinateStatsResolvers,
|
||||
'clients' | 'operations' | 'requestsOverTime' | 'totalRequests' | '__isTypeOf'
|
||||
'clients' | 'operations' | 'requestsOverTime' | 'totalRequests'
|
||||
> = {
|
||||
totalRequests: ({ organization, project, target, period, schemaCoordinate }, _, { injector }) => {
|
||||
return injector.get(OperationsManager).countRequestsWithSchemaCoordinate({
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ export const Target: Pick<
|
|||
| 'requestsOverTime'
|
||||
| 'schemaCoordinateStats'
|
||||
| 'totalRequests'
|
||||
| '__isTypeOf'
|
||||
> = {
|
||||
totalRequests: (target, { period }, { injector }) => {
|
||||
return injector.get(OperationsManager).countRequests({
|
||||
|
|
|
|||
|
|
@ -34,11 +34,7 @@ export const Organization: Pick<
|
|||
| 'viewerCanModifySlug'
|
||||
| 'viewerCanSeeMembers'
|
||||
| 'viewerCanTransferOwnership'
|
||||
| '__isTypeOf'
|
||||
> = {
|
||||
__isTypeOf: organization => {
|
||||
return !!organization.id;
|
||||
},
|
||||
owner: async (organization, _, { injector }) => {
|
||||
const owner = await injector.get(OrganizationManager).findOrganizationOwner(organization);
|
||||
if (!owner) {
|
||||
|
|
|
|||
|
|
@ -7,5 +7,4 @@ export const OrganizationGetStarted: Pick<
|
|||
| 'enablingUsageBasedBreakingChanges'
|
||||
| 'invitingMembers'
|
||||
| 'publishingSchema'
|
||||
| '__isTypeOf'
|
||||
> = {};
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import type { OrganizationResolvers } from './../../../__generated__/types';
|
|||
|
||||
export const Organization: Pick<
|
||||
OrganizationResolvers,
|
||||
'schemaPolicy' | 'viewerCanModifySchemaPolicy' | '__isTypeOf'
|
||||
'schemaPolicy' | 'viewerCanModifySchemaPolicy'
|
||||
> = {
|
||||
schemaPolicy: async (org, _, { injector }) =>
|
||||
injector.get(SchemaPolicyProvider).getOrganizationPolicy({
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import type { ProjectResolvers } from './../../../__generated__/types';
|
|||
|
||||
export const Project: Pick<
|
||||
ProjectResolvers,
|
||||
'parentSchemaPolicy' | 'schemaPolicy' | 'viewerCanModifySchemaPolicy' | '__isTypeOf'
|
||||
'parentSchemaPolicy' | 'schemaPolicy' | 'viewerCanModifySchemaPolicy'
|
||||
> = {
|
||||
schemaPolicy: async (project, _, { injector }) =>
|
||||
injector.get(SchemaPolicyProvider).getProjectPolicy({
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import type { OrganizationResolvers } from './../../../__generated__/types';
|
|||
|
||||
export const Organization: Pick<
|
||||
OrganizationResolvers,
|
||||
'projectBySlug' | 'projects' | 'viewerCanCreateProject' | '__isTypeOf'
|
||||
'projectBySlug' | 'projects' | 'viewerCanCreateProject'
|
||||
> = {
|
||||
projects: async (organization, _, { injector }) => {
|
||||
const projects = await injector
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ export const Project: Pick<
|
|||
| 'viewerCanDelete'
|
||||
| 'viewerCanModifyAlerts'
|
||||
| 'viewerCanModifySettings'
|
||||
| '__isTypeOf'
|
||||
> = {
|
||||
experimental_nativeCompositionPerTarget: async (project, _, { injector }) => {
|
||||
if (project.type !== ProjectType.FEDERATION) {
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ export const Contract: Pick<
|
|||
| 'removeUnreachableTypesFromPublicApiSchema'
|
||||
| 'target'
|
||||
| 'viewerCanDisableContract'
|
||||
| '__isTypeOf'
|
||||
> = {
|
||||
target: (contract, _, context) => {
|
||||
return context.injector.get(TargetManager).getTargetById({
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ export const Project: Pick<
|
|||
| 'isNativeFederationEnabled'
|
||||
| 'nativeFederationCompatibility'
|
||||
| 'schemaVersionsCount'
|
||||
| '__isTypeOf'
|
||||
> = {
|
||||
externalSchemaComposition: project => {
|
||||
if (project.externalComposition.enabled && project.externalComposition.endpoint) {
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import type { SchemaChangeUsageStatisticsAffectedOperationResolvers } from './..
|
|||
*/
|
||||
export const SchemaChangeUsageStatisticsAffectedOperation: Pick<
|
||||
SchemaChangeUsageStatisticsAffectedOperationResolvers,
|
||||
'count' | 'countFormatted' | 'hash' | 'name' | 'percentage' | 'percentageFormatted' | '__isTypeOf'
|
||||
'count' | 'countFormatted' | 'hash' | 'name' | 'percentage' | 'percentageFormatted'
|
||||
> = {
|
||||
countFormatted: async (operation, _arg, _ctx) => {
|
||||
return formatNumber(operation.count);
|
||||
|
|
|
|||
|
|
@ -3,10 +3,7 @@ import { SchemaManager } from '../providers/schema-manager';
|
|||
import { SchemaVersionHelper } from '../providers/schema-version-helper';
|
||||
import type { SchemaCoordinateStatsResolvers } from './../../../__generated__/types';
|
||||
|
||||
export const SchemaCoordinateStats: Pick<
|
||||
SchemaCoordinateStatsResolvers,
|
||||
'supergraphMetadata' | '__isTypeOf'
|
||||
> = {
|
||||
export const SchemaCoordinateStats: Pick<SchemaCoordinateStatsResolvers, 'supergraphMetadata'> = {
|
||||
supergraphMetadata: async (
|
||||
{ organization, project, target, schemaCoordinate },
|
||||
_,
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ export const Target: Pick<
|
|||
| 'schemaVersion'
|
||||
| 'schemaVersions'
|
||||
| 'schemaVersionsCount'
|
||||
| '__isTypeOf'
|
||||
> = {
|
||||
schemaVersions: async (target, args, { injector }) => {
|
||||
return injector.get(SchemaManager).getPaginatedSchemaVersionsForTargetId({
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import type { OrganizationResolvers } from './../../../__generated__/types';
|
|||
|
||||
export const Organization: Pick<
|
||||
OrganizationResolvers,
|
||||
'supportTicket' | 'supportTickets' | 'viewerCanManageSupportTickets' | '__isTypeOf'
|
||||
'supportTicket' | 'supportTickets' | 'viewerCanManageSupportTickets'
|
||||
> = {
|
||||
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';
|
||||
|
||||
export const Project: Pick<ProjectResolvers, 'targetBySlug' | 'targets' | '__isTypeOf'> = {
|
||||
export const Project: Pick<ProjectResolvers, 'targetBySlug' | 'targets'> = {
|
||||
targets: async (project, _, { injector }) => {
|
||||
const targets = await injector.get(TargetManager).getTargets({
|
||||
projectId: project.id,
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ export const Target: Pick<
|
|||
| 'viewerCanModifyCDNAccessToken'
|
||||
| 'viewerCanModifySettings'
|
||||
| 'viewerCanModifyTargetAccessToken'
|
||||
| '__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';
|
||||
|
||||
export const Target: Pick<TargetResolvers, 'tokens' | '__isTypeOf'> = {
|
||||
export const Target: Pick<TargetResolvers, 'tokens'> = {
|
||||
tokens(target, _, { injector }) {
|
||||
return injector.get(TokenManager).getTokens({
|
||||
targetId: target.id,
|
||||
|
|
|
|||
798
pnpm-lock.yaml
798
pnpm-lock.yaml
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue