import type { CodegenConfig } from "@graphql-codegen/cli"; const frontendConfig = { dedupeFragments: true, enumType: "native", nonOptionalTypename: true, skipTypeNameForRoot: true, scalars: { Date: "string", DateTime: "string", JSONObject: "any", Time: "string", Timestamp: "number", }, }; const config: CodegenConfig = { schema: { "apps/backend/src/graphql/definitions/*.ts": { noRequire: true, }, }, documents: ["apps/frontend/src/**/*.tsx", "apps/frontend/src/**/*.ts"], ignoreNoDocuments: true, // for better experience with the watcher generates: { "apps/backend/src/graphql/__generated__/schema.gql": { plugins: ["schema-ast"], }, "apps/backend/src/graphql/__generated__/resolver-types.ts": { plugins: ["typescript", "typescript-resolvers"], config: { useIndexSignature: true, contextType: "../context.js#Context", useTypeImports: true, typesPrefix: "I", scalars: { DateTime: "Date", Date: "Date", Timestamp: "Number", }, mappers: { AccountAvatar: "../../database/models/index.js#AccountAvatar", AccountSubscription: "../../database/models/index.js#Subscription", AutoInvite: "../../database/services/team-domain.js#AutoInvite", AuditTrail: "../../database/models/index.js#AuditTrail", AuthorizedApp: "../../database/models/index.js#OAuthGrant", AutomationRule: "../../database/models/index.js#AutomationRule", AutomationRun: "../../database/models/index.js#AutomationRun", AutomationActionRun: "../../database/models/index.js#AutomationActionRun", Build: "../../database/models/index.js#Build", BuildReview: "../../database/models/index.js#BuildReview", Comment: "../../database/models/index.js#Comment", CommentReactionGroup: "../../comment/reactions.js#CommentReactionGroup", Deployment: "../../database/models/index.js#Deployment", DiscordWebhook: "../../database/models/index.js#DiscordWebhook", GhApiInstallation: "../../github/index.js#GhApiInstallation", GhApiRepository: "../../github/index.js#GhApiRepository", GithubAccount: "../../database/models/index.js#GithubAccount", GithubInstallation: "../../database/models/index.js#GithubInstallation", GithubPullRequest: "../../database/models/index.js#GithubPullRequest", GithubRepository: "../../database/models/index.js#GithubRepository", GitlabProject: "../../database/models/index.js#GitlabProject", OriginInstallation: "../../database/models/index.js#OriginInstallation", OriginPullRequest: "../../database/models/index.js#OriginPullRequest", OriginRepository: "../../database/models/index.js#OriginRepository", GitlabUser: "../../database/models/index.js#GitlabUser", GlApiNamespace: "../../gitlab/index.js#GlApiNamespace", GlApiProject: "../../gitlab/index.js#GlApiProject", GoogleUser: "../../database/models/index.js#GoogleUser", Invoice: "../../database/models/index.js#StripeInvoice", UpcomingInvoice: "../../stripe/upcoming-invoice.js#UpcomingInvoice", Media: "../../database/models/index.js#Media", MediaDiff: "../../database/models/index.js#MediaDiff", MediaVersion: "../../database/models/index.js#MediaVersion", // Not a model: a grouped row, so the resolvers receive what the query // actually selected rather than a shape nothing produces. MsTeamsWebhook: "../../database/models/index.js#MsTeamsWebhook", OAuthClient: "../../database/models/index.js#OAuthClient", Plan: "../../database/models/index.js#Plan", ProjectContributor: "../../database/models/index.js#ProjectUser", Screenshot: "../../database/models/index.js#Screenshot", ScreenshotBucket: "../../database/models/index.js#ScreenshotBucket", ScreenshotDiff: "../../database/models/index.js#ScreenshotDiff", ScreenshotMetadataSDK: "@argos/schemas/screenshot-metadata#ScreenshotMetadataSDK", SlackInstallation: "../../database/models/index.js#SlackInstallation", TeamStaffInfo: "../../database/models/index.js#Account", TeamStaffPeriodUsage: "../../database/models/index.js#Account", TeamStaffContact: "../../database/models/index.js#StaffTeamContact", StaffCancellation: "../../database/models/index.js#Subscription", Project: "../../database/models/index.js#Project", ProjectCustomDomain: "../../database/models/index.js#ProjectDomain", Team: "../../database/models/index.js#Account", TeamDomain: "../../database/models/index.js#TeamDomain", TeamInvite: "../../database/models/index.js#TeamInvite", TeamSamlConfig: "../../database/models/index.js#TeamSamlConfig", TeamScimToken: "../../database/models/index.js#TeamScimToken", TeamMember: "../../database/models/index.js#TeamUser", TeamGithubMember: "../../database/models/index.js#GithubAccountMember", Test: "../../database/models/index.js#Test", TestMetrics: "../../graphql/definitions/Test.js#TestMetrics", TestChange: "../../graphql/definitions/TestChange.js#TestChangeObject", User: "../../database/models/index.js#Account", UserAccessToken: "../../database/models/index.js#UserAccessToken", UserPasskey: "../../database/models/index.js#UserPasskey", UserSession: "../../database/models/index.js#UserSession", }, }, }, "apps/frontend/src/gql/schema.ts": { plugins: ["typescript"], config: frontendConfig, }, "apps/frontend/src/gql/": { preset: "client", plugins: [{ add: { content: 'export * from "./schema";' } }], config: frontendConfig, presetConfig: { fragmentMasking: false, }, }, "apps/frontend/src/gql-fragments.json": { plugins: ["fragment-matcher"], }, }, }; export default config;