@baeta/plugin-graphql 0.0.34 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @baeta/plugin-graphql
2
2
 
3
+ ## 0.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#156](https://github.com/andreisergiu98/baeta/pull/156) [`01f3c20`](https://github.com/andreisergiu98/baeta/commit/01f3c20365539fad6e8a8694c59a8e86c95784e8) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - raise engine requirement to node >= 22
8
+
9
+ ### Patch Changes
10
+
11
+ - [#152](https://github.com/andreisergiu98/baeta/pull/152) [`d538c79`](https://github.com/andreisergiu98/baeta/commit/d538c7905e6ba96d9f294e2d528f9252e83acbe7) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - update formatter
12
+
13
+ - [#145](https://github.com/andreisergiu98/baeta/pull/145) [`08428d4`](https://github.com/andreisergiu98/baeta/commit/08428d4f03b79cab9c116ff7b3a3cf9a0b2620f2) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - update dependencies
14
+
15
+ - Updated dependencies [[`01f3c20`](https://github.com/andreisergiu98/baeta/commit/01f3c20365539fad6e8a8694c59a8e86c95784e8), [`d538c79`](https://github.com/andreisergiu98/baeta/commit/d538c7905e6ba96d9f294e2d528f9252e83acbe7), [`08428d4`](https://github.com/andreisergiu98/baeta/commit/08428d4f03b79cab9c116ff7b3a3cf9a0b2620f2)]:
16
+ - @baeta/generator-sdk@0.1.0
17
+ - @baeta/util-path@0.1.0
18
+
3
19
  ## 0.0.34
4
20
 
5
21
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -35,15 +35,17 @@ var _gitloader = require('@graphql-tools/git-loader');
35
35
  var _githubloader = require('@graphql-tools/github-loader');
36
36
  var _graphqlfileloader = require('@graphql-tools/graphql-file-loader');
37
37
  var _jsonfileloader = require('@graphql-tools/json-file-loader');
38
+
39
+
38
40
  var _load = require('@graphql-tools/load');
39
41
  var _prismaloader = require('@graphql-tools/prisma-loader');
40
42
  var _urlloader = require('@graphql-tools/url-loader');
41
43
  var _graphql = require('graphql');
42
44
 
43
45
  // utils/hash.ts
46
+ var _crypto = require('crypto');
44
47
 
45
48
 
46
- var _crypto = require('crypto');
47
49
  function hashContent(content) {
48
50
  return _crypto.createHash.call(void 0, "sha256").update(content).digest("hex");
49
51
  }
@@ -140,12 +142,12 @@ var _changecaseall = require('change-case-all');
140
142
 
141
143
 
142
144
  // lib/modules/utils.ts
145
+ var _os = require('os');
143
146
 
144
147
 
145
148
 
146
149
 
147
150
 
148
- var _os = require('os');
149
151
  var _parsefilepath = require('parse-filepath'); var _parsefilepath2 = _interopRequireDefault(_parsefilepath);
150
152
  var sep = "/";
151
153
  function collectUsedTypes(doc) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../index.ts","../lib/codegen.ts","../utils/cache.ts","../utils/load.ts","../utils/hash.ts","../lib/context/index.ts","../lib/modules/index.ts","../lib/modules/builder.ts","../lib/modules/utils.ts"],"names":["getCachedDocumentNodeFromSchema","isScalarType","Kind","name","content","sources","unionsDefinition","types","typePicks","result"],"mappings":";;;;;;;AAAA,SAAS,gBAAgB,eAA4B;;;ACCrD,SAAS,WAAW,kBAAkB;AACtC,SAAS,iBAAiB,gCAAgC;AAC1D,YAAY,sBAAsB;;;ACH3B,SAAS,cAIA;AACd,QAAM,QAAQ,oBAAI,IAA8B;AAEhD,SAAO,SAAS,OAAU,WAAmB,KAAa,SAAuC;AAC/F,UAAM,WAAW,GAAG,SAAS,IAAI,GAAG;AAEpC,UAAM,cAAc,MAAM,IAAI,QAAQ;AAEtC,QAAI,aAAa;AACf,aAAO;AAAA,IACT;AAEA,UAAM,QAAQ,QAAQ;AACtB,UAAM,IAAI,UAAU,KAAK;AAEzB,WAAO;AAAA,EACT;AACF;;;ACrBA,SAAS,mCAAAA,wCAAuC;AAChD,SAAS,0BAA0B;AACnC,S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AAA,MAChB,SAAS;AAAA,QACP,GAAG,WAAW;AAAA,MAChB;AAAA,IACF;AAAA,EACF,CAAC;AAED,QAAM,WAAW,QAAQ,IAAI,OAAO,WAAW;AAC7C,UAAMI,UAAS,MAAM,WAAW;AAAA,MAC9B,GAAG;AAAA,MACH;AAAA,IACF,CAAC;AAED,WAAO;AAAA,MACL,UAAU,OAAO;AAAA,MACjB,SAASA;AAAA,IACX;AAAA,EACF,CAAC;AAED,SAAO,QAAQ,IAAI,QAAQ;AAC7B;;;AD1EO,SAAS,gBAAgB;AAC9B,SAAO,eAAe;AAAA,IACpB,MAAM;AAAA,IACN,YAAY;AAAA,IACZ,OAAO,CAAC,SAAS,SAAS,WAAW;AACnC,YAAM,eAAe,CAAC,SAAsB;AAC1C,YAAI,QAAQ,KAAK,cAAc,QAAQ,OAAO,GAAG;AAC/C,iBAAO,IAAI;AAAA,QACb;AAAA,MACF;AAEA,cAAQ,GAAG,UAAU,YAAY;AACjC,cAAQ,GAAG,UAAU,YAAY;AAAA,IACnC;AAAA,IACA,UAAU,OAAO,KAAK,SAAS;AAC7B,YAAM,QAAQ,MAAM,SAAS,IAAI,gBAAgB;AAEjD,iBAAW,QAAQ,OAAO;AACxB,YAAI,YAAY,aAAa,KAAK,UAAU,KAAK,SAAS,SAAS;AAAA,MACrE;AAEA,aAAO,KAAK;AAAA,IACd;AAAA,EACF,CAAC;AACH","sourcesContent":["import { createPluginV1, isMatch, WatcherFile } from '@baeta/generator-sdk';\nimport { generate } from './lib/codegen';\n\nexport function graphqlPlugin() {\n return createPluginV1({\n name: 'graphql',\n actionName: 'GraphQL modules',\n watch: (options, watcher, reload) => {\n const handleChange = (file: WatcherFile) => {\n if (isMatch(file.relativePath, options.schemas)) {\n reload(file);\n }\n };\n\n watcher.on('update', handleChange);\n watcher.on('delete', handleChange);\n },\n generate: async (ctx, next) => {\n const items = await generate(ctx.generatorOptions);\n\n for (const item of items) {\n ctx.fileManager.createAndAdd(item.filename, item.content, 'graphql');\n }\n\n return next();\n },\n });\n}\n","import { NormalizedGeneratorOptions } from '@baeta/generator-sdk';\nimport { codegen as gqlCodegen } from '@graphql-codegen/core';\nimport { normalizeConfig, normalizeInstanceOrArray } from '@graphql-codegen/plugin-helpers';\nimport * as typescriptPlugin from '@graphql-codegen/typescript';\nimport { UnnormalizedTypeDefPointer } from '@graphql-tools/load';\nimport { createCache } from '../utils/cache';\nimport { loadSchema } from '../utils/load';\nimport * as contextPlugin from './context';\nimport * as modules from './modules';\n\nexport async function generate(options: NormalizedGeneratorOptions) {\n const rootConfig = {\n schemas: normalizeInstanceOrArray(options.schemas),\n modulesDir: options.modulesDir,\n baseTypesPath: options.baseTypesPath,\n contextType: options.contextType,\n moduleDefinitionName: options.moduleDefinitionName,\n scalars: options.scalars,\n plugins: normalizeConfig(['typescript', 'context']),\n pluginMap: {\n typescript: typescriptPlugin,\n context: contextPlugin,\n },\n };\n\n const cache = createCache();\n\n const schemaPointerMap: UnnormalizedTypeDefPointer = {};\n for (const ptr of rootConfig.schemas) {\n if (typeof ptr === 'string') {\n schemaPointerMap[ptr] = {};\n } else if (typeof ptr === 'object') {\n Object.assign(schemaPointerMap, ptr);\n }\n }\n\n const hash = JSON.stringify(schemaPointerMap);\n const result = await cache('schema', hash, async () => {\n return loadSchema(schemaPointerMap, options.cwd);\n });\n\n const outputs = await modules.preset.buildGeneratesSection({\n baseOutputDir: options.modulesDir,\n presetConfig: {\n baseTypesPath: rootConfig.baseTypesPath,\n filename: rootConfig.moduleDefinitionName,\n encapsulateModuleTypes: 'none',\n extensionsPath: options.extensions,\n },\n schema: result.outputSchema,\n schemaAst: result.outputSchemaAst,\n documents: [],\n pluginMap: rootConfig.pluginMap,\n plugins: rootConfig.plugins,\n config: {\n inputMaybeValue: 'T | undefined',\n contextType: rootConfig.contextType,\n useTypeImports: true,\n scalars: {\n ...rootConfig.scalars,\n },\n },\n });\n\n const promises = outputs.map(async (output) => {\n const result = await gqlCodegen({\n ...output,\n cache,\n });\n\n return {\n filename: output.filename,\n content: result,\n };\n });\n\n return Promise.all(promises);\n}\n","export function createCache(): <T>(\n namespace: string,\n key: string,\n factory: () => Promise<T>,\n) => Promise<T> {\n const cache = new Map<string, Promise<unknown>>();\n\n return function ensure<T>(namespace: string, key: string, factory: () => Promise<T>): Promise<T> {\n const cacheKey = `${namespace}:${key}`;\n\n const cachedValue = cache.get(cacheKey);\n\n if (cachedValue) {\n return cachedValue as Promise<T>;\n }\n\n const value = factory();\n cache.set(cacheKey, value);\n\n return value;\n };\n}\n","import { getCachedDocumentNodeFromSchema } from '@graphql-codegen/plugin-helpers';\nimport { ApolloEngineLoader } from '@graphql-tools/apollo-engine-loader';\nimport { CodeFileLoader } from '@graphql-tools/code-file-loader';\nimport { GitLoader } from '@graphql-tools/git-loader';\nimport { GithubLoader } from '@graphql-tools/github-loader';\nimport { GraphQLFileLoader } from '@graphql-tools/graphql-file-loader';\nimport { JsonFileLoader } from '@graphql-tools/json-file-loader';\nimport { loadSchema as loadSchemaToolkit, UnnormalizedTypeDefPointer } from '@graphql-tools/load';\nimport { PrismaLoader } from '@graphql-tools/prisma-loader';\nimport { UrlLoader } from '@graphql-tools/url-loader';\nimport { GraphQLSchemaExtensions, validateSchema } from 'graphql';\nimport { hashSchema } from './hash';\n\nexport async function loadSchema(schemaPointerMap: UnnormalizedTypeDefPointer, cwd: string) {\n const outputSchemaAst = await loadSchemaToolkit(schemaPointerMap, {\n loaders: [\n new CodeFileLoader(),\n new GitLoader(),\n new GithubLoader(),\n new GraphQLFileLoader(),\n new JsonFileLoader(),\n new UrlLoader(),\n new ApolloEngineLoader(),\n new PrismaLoader(),\n ],\n cwd,\n includeSources: true,\n });\n\n const errors = validateSchema(outputSchemaAst);\n\n if (errors.length > 0) {\n const messages = errors.map((e) => e.toString()).join('\\n\\n--------------------\\n\\n');\n const subject = errors.length === 1 ? 'error' : 'errors';\n throw new Error(`Invalid schema. Found ${errors.length} ${subject}:\\n\\n${messages}`);\n }\n\n if (!outputSchemaAst.extensions) {\n outputSchemaAst.extensions = {};\n }\n\n (outputSchemaAst.extensions as GraphQLSchemaExtensions)['hash'] = hashSchema(outputSchemaAst);\n\n return {\n outputSchemaAst,\n outputSchema: getCachedDocumentNodeFromSchema(outputSchemaAst),\n };\n}\n","import { getCachedDocumentNodeFromSchema } from '@graphql-codegen/plugin-helpers';\nimport { GraphQLSchema, print } from 'graphql';\nimport { createHash } from 'node:crypto';\n\nexport function hashContent(content: string): string {\n return createHash('sha256').update(content).digest('hex');\n}\n\nexport function hashSchema(schema: GraphQLSchema): string {\n return hashContent(print(getCachedDocumentNodeFromSchema(schema)));\n}\n","import { PluginFunction, Types } from '@graphql-codegen/plugin-helpers';\nimport { buildMapperImport, parseMapper } from '@graphql-codegen/visitor-plugin-common';\nimport { GraphQLSchema } from 'graphql';\n\ninterface Config {\n contextType: string | undefined;\n}\n\nexport const plugin: PluginFunction<Config> = async (\n schema: GraphQLSchema,\n documents: Types.DocumentFile[],\n config: Config,\n): Promise<Types.PluginOutput> => {\n const prepend: string[] = [];\n const mapper = parseMapper(config.contextType || 'any');\n\n if (mapper.isExternal && mapper.source) {\n const identifier = mapper.default ? 'ContextType' : `${mapper.import} as ContextType`;\n\n const result = buildMapperImport(\n mapper.source,\n [\n {\n identifier,\n asDefault: mapper.default,\n },\n ],\n true,\n );\n\n if (result) {\n prepend.push(result);\n }\n } else {\n prepend.push(`type ContextType = ${mapper.type}`);\n }\n\n prepend.push('export type { ContextType }');\n\n return {\n content: '',\n prepend: prepend,\n };\n};\n\nexport default { plugin };\n","import { join, relative, resolve } from '@baeta/util-path';\nimport { Types } from '@graphql-codegen/plugin-helpers';\nimport { BaseVisitor, getConfigValue } from '@graphql-codegen/visitor-plugin-common';\nimport { Source } from '@graphql-tools/utils';\nimport {\n DocumentNode,\n ObjectTypeDefinitionNode,\n UnionTypeDefinitionNode,\n UnionTypeExtensionNode,\n concatAST,\n isScalarType,\n} from 'graphql';\nimport { buildModule } from './builder';\nimport { ModulesConfig } from './config';\nimport {\n collectObjectFieldTypesAndArguments,\n groupSourcesByModule,\n isGraphQLPrimitive,\n normalize,\n stripFilename,\n} from './utils';\n\nexport const preset: Types.OutputPreset<ModulesConfig> = {\n buildGeneratesSection: (options) => {\n const { baseOutputDir } = options;\n const { baseTypesPath, extensionsPath, encapsulateModuleTypes } = options.presetConfig;\n\n const requireRootResolvers = getConfigValue(options?.presetConfig.requireRootResolvers, false);\n\n const cwd = resolve(options.presetConfig.cwd || process.cwd());\n const importTypesNamespace = options.presetConfig.importTypesNamespace || 'Types';\n\n if (!baseTypesPath) {\n throw new Error(\n `Preset \"graphql-modules\" requires you to specify \"baseTypesPath\" configuration and point it to your base types file (generated by \"typescript\" plugin)!`,\n );\n }\n\n if (!options.schemaAst?.extensions.sources) {\n throw new Error(`Preset \"graphql-modules\" requires to use GraphQL SDL`);\n }\n\n const extensions = options.schemaAst?.extensions;\n const sources = (extensions?.extendedSources ?? []) as Source[];\n const sourcesByModuleMap = groupSourcesByModule(sources, baseOutputDir);\n const modules = Object.keys(sourcesByModuleMap);\n\n const baseVisitor = new BaseVisitor(options.config, {});\n const { fieldTypes, fieldArguments } = collectObjectFieldTypesAndArguments(options.schemaAst);\n\n // One file with an output from all plugins\n const baseOutput: Types.GenerateOptions = {\n filename: resolve(cwd, baseOutputDir, baseTypesPath),\n schema: options.schema,\n documents: options.documents,\n plugins: [\n ...options.plugins,\n {\n 'modules-exported-scalars': {},\n },\n {\n 'modules-exported-picks': {},\n },\n ],\n pluginMap: {\n ...options.pluginMap,\n 'modules-exported-scalars': {\n plugin: (schema) => {\n const typeMap = schema.getTypeMap();\n\n return Object.keys(typeMap)\n .map((t) => {\n if (t && typeMap[t] && isScalarType(typeMap[t]) && !isGraphQLPrimitive(t)) {\n const convertedName = baseVisitor.convertName(t);\n return `export type ${convertedName} = Scalars[\"${t}\"];`;\n }\n\n return null;\n })\n .filter(Boolean)\n .join('\\n');\n },\n },\n 'modules-exported-picks': {\n plugin: (schema) => {\n const typePicks: string[] = [];\n const unionPicks: string[] = [];\n const unionResults: string[] = [];\n const interfacePicks: string[] = [];\n const interfaceResults: string[] = [];\n\n const unionTypesMap: Record<string, string[] | undefined> = {};\n const interfacesTypesMap: Record<string, string[] | undefined> = {};\n\n for (const moduleName of modules) {\n const sources = sourcesByModuleMap[moduleName];\n const documents = sources.map((source) => source.document) as DocumentNode[];\n const moduleDocument = concatAST(documents);\n\n const types = moduleDocument.definitions.filter(\n (def) => def.kind === 'ObjectTypeDefinition',\n ) as ObjectTypeDefinitionNode[];\n\n const unionsDefinition = moduleDocument.definitions.filter(\n (def) => def.kind === 'UnionTypeDefinition',\n ) as UnionTypeDefinitionNode[];\n\n const unionsExtensions = moduleDocument.definitions.filter(\n (def) => def.kind === 'UnionTypeExtension',\n ) as UnionTypeExtensionNode[];\n\n const unions = [...unionsDefinition, ...unionsExtensions];\n\n for (const type of types) {\n const name = type.name.value;\n\n for (const interfaceNode of type.interfaces ?? []) {\n const interfaceName = interfaceNode.name.value;\n\n if (interfacesTypesMap[interfaceName] == null) {\n interfacesTypesMap[interfaceName] = [];\n }\n\n interfacesTypesMap[interfaceName]?.push(name);\n }\n\n if (name === 'Query' || name === 'Mutation' || name === 'Subscription') {\n continue;\n }\n\n const fields = type.fields ?? [];\n\n if (fields.length === 0) {\n continue;\n }\n\n const fieldNames = fields.map((f) => `\"${f.name.value}\"`).join(' | ');\n\n typePicks.push(` ${name}: ${fieldNames};`);\n }\n\n for (const union of unions) {\n const types = union.types?.map((t) => t.name.value) ?? [];\n\n if (unionTypesMap[union.name.value] == null) {\n unionTypesMap[union.name.value] = [];\n }\n\n unionTypesMap[union.name.value]?.push(...types);\n }\n }\n\n for (const unionName in unionTypesMap) {\n const types = unionTypesMap[unionName];\n\n if (types == null || types.length === 0) {\n unionPicks.push(` ${unionName}: never;`);\n unionResults.push(` ${unionName}: null;`);\n continue;\n }\n\n const typePicks = types.map((t) => {\n const normalizedTypeName = baseVisitor.convertName(t, {\n useTypesSuffix: true,\n useTypesPrefix: true,\n });\n return `Pick<${normalizedTypeName}, DefinedFieldsWithoutExtensions[\"${t}\"] | \"__typename\">`;\n });\n\n const resultPicks = types.map((t) => `\"${t}\"`);\n\n unionPicks.push(` ${unionName}: ${typePicks.join(' | ')};`);\n unionResults.push(` ${unionName}: ${resultPicks.join(' | ')} | null;`);\n }\n\n for (const interfaceName in interfacesTypesMap) {\n const types = interfacesTypesMap[interfaceName];\n\n if (types == null || types.length === 0) {\n interfacePicks.push(` ${interfaceName}: never;`);\n interfaceResults.push(` ${interfaceName}: null;`);\n continue;\n }\n\n const typePicks = types.map((t) => {\n const normalizedTypeName = baseVisitor.convertName(t, {\n useTypesSuffix: true,\n useTypesPrefix: true,\n });\n return `Pick<${normalizedTypeName}, DefinedFieldsWithoutExtensions[\"${t}\"] | \"__typename\">`;\n });\n\n const resultPicks = types.map((t) => `\"${t}\"`);\n\n interfacePicks.push(` ${interfaceName}: ${typePicks.join(' | ')};`);\n interfaceResults.push(` ${interfaceName}: ${resultPicks.join(' | ')} | null;`);\n }\n\n const fieldsDefinition = `export type DefinedFieldsWithoutExtensions = {\\n${typePicks.join('\\n')}\\n};`;\n const unionsDefinition = `export type DefinedUnionsWithoutExtensions = {\\n${unionPicks.join('\\n')}\\n};`;\n const unionsResultsDefinition = `export type DefinedUnionsResults = {\\n${unionResults.join('\\n')}\\n};`;\n const interfacesDefinition = `export type DefinedInterfacesWithoutExtensions = {\\n${interfacePicks.join('\\n')}\\n};`;\n const interfacesResultsDefinition = `export type DefinedInterfacesResults = {\\n${interfaceResults.join(\n '\\n',\n )}\\n};`;\n\n const result = [\n fieldsDefinition,\n unionsDefinition,\n unionsResultsDefinition,\n interfacesDefinition,\n interfacesResultsDefinition,\n ].join('\\n\\n');\n\n return `\\n${result}\\n`;\n },\n },\n },\n config: {\n ...options.config,\n enumsAsTypes: true,\n },\n schemaAst: options.schemaAst,\n };\n\n const baseTypesFilename = baseTypesPath.replace(/\\.(js|ts|d.ts)$/, '');\n const baseTypesDir = stripFilename(baseOutput.filename);\n\n // One file per each module\n const outputs: Types.GenerateOptions[] = modules.map((moduleName) => {\n const filename = resolve(cwd, baseOutputDir, moduleName, options.presetConfig.filename);\n const dirpath = stripFilename(filename);\n const relativePath = relative(dirpath, baseTypesDir);\n const importPath =\n options.presetConfig.importBaseTypesFrom ||\n normalize(join(relativePath, baseTypesFilename));\n const sources = sourcesByModuleMap[moduleName];\n\n const documents = sources.map((source) => source.document) as DocumentNode[];\n\n const moduleDocument = concatAST(documents);\n\n const shouldDeclare = filename.endsWith('.d.ts');\n\n return {\n filename,\n schema: options.schema,\n documents: [],\n plugins: [\n ...options.plugins.filter((p) => typeof p === 'object' && !!p.add),\n {\n 'graphql-modules-plugin': {},\n },\n ],\n pluginMap: {\n ...options.pluginMap,\n 'graphql-modules-plugin': {\n plugin: (schema) =>\n buildModule(moduleName, moduleDocument, {\n importNamespace: importTypesNamespace,\n importPath,\n encapsulate: encapsulateModuleTypes || 'namespace',\n requireRootResolvers,\n shouldDeclare,\n schema,\n baseVisitor,\n useGraphQLModules: false,\n fieldTypes,\n fieldArguments,\n extensionsPath,\n rootTypes: [\n schema.getQueryType()?.name || '',\n schema.getMutationType()?.name || '',\n schema.getSubscriptionType()?.name || '',\n ].filter(Boolean),\n }),\n },\n },\n config: options.config,\n schemaAst: options.schemaAst,\n };\n });\n\n return [baseOutput].concat(outputs);\n },\n};\n\nexport default preset;\n","import { BaseVisitor } from '@graphql-codegen/visitor-plugin-common';\nimport { pascalCase } from 'change-case-all';\nimport {\n DocumentNode,\n EnumTypeDefinitionNode,\n EnumTypeExtensionNode,\n GraphQLSchema,\n InputObjectTypeDefinitionNode,\n InputObjectTypeExtensionNode,\n InterfaceTypeDefinitionNode,\n InterfaceTypeExtensionNode,\n isInterfaceType,\n isScalarType,\n isUnionType,\n Kind,\n ObjectTypeDefinitionNode,\n ObjectTypeExtensionNode,\n TypeDefinitionNode,\n TypeExtensionNode,\n UnionTypeDefinitionNode,\n visit,\n} from 'graphql';\nimport { ModulesConfig } from './config';\nimport {\n buildBlock,\n collectUsedTypes,\n concatByKey,\n createObject,\n indent,\n pushUnique,\n unique,\n uniqueByKey,\n withQuotes,\n} from './utils';\n\ntype RegistryKeys = 'objects' | 'inputs' | 'interfaces' | 'scalars' | 'unions' | 'enums';\ntype Registry = Record<RegistryKeys, string[]>;\nconst registryKeys: RegistryKeys[] = [\n 'objects',\n 'inputs',\n 'interfaces',\n 'scalars',\n 'unions',\n 'enums',\n];\nconst resolverKeys: Extract<RegistryKeys, 'objects' | 'enums' | 'scalars'>[] = [\n 'scalars',\n 'objects',\n 'enums',\n];\n\nexport function buildModule(\n name: string,\n doc: DocumentNode,\n {\n importNamespace,\n importPath,\n encapsulate,\n requireRootResolvers,\n shouldDeclare,\n rootTypes,\n schema,\n baseVisitor,\n fieldTypes,\n fieldArguments,\n extensionsPath,\n }: {\n importNamespace: string;\n importPath: string;\n encapsulate: ModulesConfig['encapsulateModuleTypes'];\n requireRootResolvers: ModulesConfig['requireRootResolvers'];\n shouldDeclare: boolean;\n rootTypes: string[];\n baseVisitor: BaseVisitor;\n schema?: GraphQLSchema;\n useGraphQLModules: boolean;\n fieldTypes: Record<string, Record<string, string>>;\n fieldArguments: Record<string, Record<string, boolean>>;\n extensionsPath?: string;\n },\n): string {\n const picks: Record<RegistryKeys, Record<string, string[]>> = createObject(\n registryKeys,\n () => ({}),\n );\n const defined: Registry = createObject(registryKeys, () => []);\n const extended: Registry = createObject(registryKeys, () => []);\n\n // List of types used in objects, fields, arguments etc\n const usedTypes = collectUsedTypes(doc);\n\n visit(doc, {\n ObjectTypeDefinition(node) {\n collectTypeDefinition(node);\n },\n ObjectTypeExtension(node) {\n collectTypeExtension(node);\n },\n InputObjectTypeDefinition(node) {\n collectTypeDefinition(node);\n },\n InputObjectTypeExtension(node) {\n collectTypeExtension(node);\n },\n InterfaceTypeDefinition(node) {\n collectTypeDefinition(node);\n },\n InterfaceTypeExtension(node) {\n collectTypeExtension(node);\n },\n ScalarTypeDefinition(node) {\n collectTypeDefinition(node);\n },\n UnionTypeDefinition(node) {\n collectTypeDefinition(node);\n },\n UnionTypeExtension(node) {\n collectTypeExtension(node);\n },\n EnumTypeDefinition(node) {\n collectTypeDefinition(node);\n },\n EnumTypeExtension(node) {\n collectTypeExtension(node);\n },\n });\n\n // Defined and Extended types\n const visited: Registry = createObject(registryKeys, (key) =>\n concatByKey(defined, extended, key),\n );\n\n // Types that are not defined or extended in a module, they come from other modules\n const external: Registry = createObject(registryKeys, (key) =>\n uniqueByKey(extended, defined, key),\n );\n\n //\n //\n //\n // Prints\n //\n //\n //\n\n // An actual output\n const imports = [\n `import * as ${importNamespace} from \"${importPath}\";`,\n 'import { DocumentNode } from \"graphql\";',\n 'import * as Baeta from \"@baeta/core/sdk\";',\n ];\n\n if (extensionsPath) {\n imports.push(`import baetaExtensions from \"${extensionsPath}\";`);\n }\n\n imports.push('\\n');\n\n let content = [\n printDefinedFields(),\n printDefinedEnumValues(),\n printDefinedInputFields(),\n printSchemaTypes(usedTypes),\n printMetadata(),\n ]\n .filter(Boolean)\n .join('\\n\\n');\n\n const moduleNamespace = baseVisitor.convertName(name, {\n suffix: 'Module',\n useTypesPrefix: false,\n useTypesSuffix: false,\n });\n\n if (encapsulate === 'namespace') {\n content = `${shouldDeclare ? 'declare' : 'export'} namespace ${baseVisitor.convertName(name, {\n suffix: 'Module',\n useTypesPrefix: false,\n useTypesSuffix: false,\n })} {\\n${shouldDeclare ? `${indent(2)(imports.join('\\n'))}\\n` : ''}${indent(2)(content)}\\n}`;\n }\n\n return [...(shouldDeclare ? [] : imports), content, printFactoryMethod()]\n .filter(Boolean)\n .join('\\n');\n\n function printMetadata() {\n return `export namespace ModuleMetadata {\n export const id = '${name}';\n export const dirname = './${name}';\n export const typedef = ${JSON.stringify(doc)} as unknown as DocumentNode;\n ${printBaetaManager()}\n}`;\n }\n\n /**\n * A dictionary of fields to pick from an object\n */\n function printDefinedFields() {\n return buildBlock({\n name: 'interface DefinedFields',\n lines: [...visited.objects, ...visited.interfaces].map(\n (typeName) =>\n `${typeName}: ${printPicks(typeName, {\n ...picks.objects,\n ...picks.interfaces,\n })};`,\n ),\n });\n }\n\n function printFactoryMethod() {\n const name = moduleNamespace.slice(0, moduleNamespace.length - 6);\n const createModuleFn = `create${name}Module`;\n const getModuleFn = `get${name}Module`;\n const extensionsArg = extensionsPath ? ', baetaExtensions' : '';\n\n return `\nexport const ${createModuleFn} = () => Baeta.createModuleManager(ModuleMetadata${extensionsArg});\nexport const ${getModuleFn} = Baeta.createSingletonModule(${createModuleFn});\n`;\n }\n\n /**\n * Baeta manager\n */\n\n function printObjectFieldResolverBuilder(typeName: string, field: string) {\n const parentType = getParentType(typeName);\n const resultType = getResultType(typeName, field);\n const argumentsType = getArgsType(typeName, field);\n const contextType = getContextType();\n return `${field}: module.createResolverBuilder<${resultType}, ${parentType}, ${contextType}, ${argumentsType}>(\"${typeName}\", \"${field}\"),`;\n }\n\n function printObjectResolverBuilder(typeName: string, objects: Record<string, string[]>) {\n const fields =\n objects[typeName]\n ?.filter(unique)\n .map((field) => printObjectFieldResolverBuilder(typeName, field)) ?? [];\n\n if (fields.length === 0) {\n return '';\n }\n\n const parentType = getParentType(typeName);\n const contextType = getContextType();\n\n const addons = [`...module.createTypeMethods<${parentType}, ${contextType}>(\"${typeName}\"),`];\n const contentBody = [...addons, ...fields].map(indent(2)).join('\\n');\n const content = `{\\n${contentBody}\\n}`;\n return `${typeName}: ${content},`;\n }\n\n function printSubscriptionFieldBuilder(field: string) {\n const parentType = getParentType('Subscription');\n const resultType = getResultType('Subscription', field);\n const argumentsType = getArgsType('Subscription', field);\n const contextType = getContextType();\n return `${field}: module.createSubscriptionBuilder<${resultType}, ${parentType}, ${contextType}, ${argumentsType}>(\"${field}\"),`;\n }\n\n function printSubscriptionObjectBuilder() {\n const subscriptions = picks.objects.Subscription?.filter(unique) ?? [];\n\n if (subscriptions.length === 0) {\n return '';\n }\n\n const fields = subscriptions.map((subscription) => printSubscriptionFieldBuilder(subscription));\n\n const parentType = getParentType('Subscription');\n const contextType = getContextType();\n const addons = [`...module.createSubscriptionMethods<${parentType}, ${contextType}>(),`];\n const contentBody = [...addons, ...fields].map(indent(2)).join('\\n');\n\n const content = `{\\n${contentBody}\\n}`;\n return `Subscription: ${content},`;\n }\n\n function printScalarBuilder() {\n const scalars = visited.scalars;\n if (scalars.length === 0) {\n return '';\n }\n\n const fields = scalars.map((scalar) => `${scalar}: module.createScalarBuilder(\"${scalar}\"),`);\n const content = fields.map(indent(2)).join('\\n');\n return `Scalar: {\\n${content}\\n},`;\n }\n\n function printTypenameResolverBuilder(\n name: string,\n resultNamespace: string,\n valueNamespace: string,\n ) {\n const resultType = `${importNamespace}.${resultNamespace}[\"${name}\"]`;\n const valueType = `${importNamespace}.${valueNamespace}[\"${name}\"]`;\n const contextType = getContextType();\n const resolver = `$resolveType: module.createResolveType<${resultType}, ${valueType}, ${contextType}>(\"${name}\"),`;\n return `${name}: {\\n${indent(2)(resolver)}\\n},`;\n }\n\n function printInterfaceBuilder() {\n const interfaces = defined.interfaces;\n\n if (interfaces.length === 0) {\n return '';\n }\n\n return interfaces\n .map((interfaceName) =>\n printTypenameResolverBuilder(\n interfaceName,\n 'DefinedInterfacesResults',\n 'DefinedInterfacesWithoutExtensions',\n ),\n )\n .join('\\n');\n }\n\n function printUnionBuilder() {\n const unions = defined.unions;\n\n if (unions.length === 0) {\n return '';\n }\n\n return unions\n .map((unionName) =>\n printTypenameResolverBuilder(\n unionName,\n 'DefinedUnionsResults',\n 'DefinedUnionsWithoutExtensions',\n ),\n )\n .join('\\n');\n }\n\n function printBaetaManager() {\n const objects = visited.objects\n .filter((type) => type !== 'Subscription')\n .map((typeName) => printObjectResolverBuilder(typeName, picks.objects))\n .filter(Boolean);\n\n const contextType = getContextType();\n const addons = [`...module.createModuleMethods<${contextType}>(),`];\n\n const bodyFields = [\n ...addons,\n ...objects,\n printScalarBuilder(),\n printSubscriptionObjectBuilder(),\n printInterfaceBuilder(),\n printUnionBuilder(),\n ];\n\n const body = bodyFields.filter(Boolean).map(indent(6)).join('\\n');\n const content = `{\\n${body}\\n }`;\n\n return `\n export function createManager(module: Baeta.ModuleBuilder) {\n return ${content};\n }`;\n }\n\n /**\n * A dictionary of values to pick from an enum\n */\n function printDefinedEnumValues() {\n return buildBlock({\n name: 'interface DefinedEnumValues',\n lines: visited.enums.map((typeName) => `${typeName}: ${printPicks(typeName, picks.enums)};`),\n });\n }\n\n function encapsulateTypeName(typeName: string): string {\n if (encapsulate === 'prefix') {\n return `${pascalCase(name)}_${typeName}`;\n }\n\n return typeName;\n }\n\n /**\n * A dictionary of fields to pick from an input\n */\n function printDefinedInputFields() {\n return buildBlock({\n name: 'interface DefinedInputFields',\n lines: visited.inputs.map(\n (typeName) => `${typeName}: ${printPicks(typeName, picks.inputs)};`,\n ),\n });\n }\n\n /**\n * Prints signatures of schema types with picks\n */\n function printSchemaTypes(types: string[]) {\n return types\n .filter((type) => !visited.scalars.includes(type))\n .map(printExportType)\n .join('\\n');\n }\n\n function printPicks(typeName: string, records: Record<string, string[]>): string {\n return records[typeName].filter(unique).map(withQuotes).join(' | ');\n }\n\n function printTypeBody(typeName: string): string {\n const normalizedTypeName = baseVisitor.convertName(typeName, {\n useTypesSuffix: true,\n useTypesPrefix: true,\n });\n\n const coreType = `${importNamespace}.${normalizedTypeName}`;\n\n if (external.enums.includes(typeName) || external.objects.includes(typeName)) {\n if (schema && isScalarType(schema.getType(typeName))) {\n return `${importNamespace}.Scalars['${typeName}']`;\n }\n\n return `Pick<${coreType}, ${importNamespace}.DefinedFieldsWithoutExtensions[\"${typeName}\"]>`;\n }\n\n if (external.unions.includes(typeName)) {\n return `${importNamespace}.DefinedUnionsWithoutExtensions[\"${typeName}\"]`;\n }\n\n if (external.interfaces.includes(typeName)) {\n return `Pick<${coreType}, ${importNamespace}.DefinedFieldsWithoutExtensions[\"${typeName}\"]>`;\n }\n\n if (defined.enums.includes(typeName) && picks.enums[typeName]) {\n return `DefinedEnumValues['${typeName}']`;\n }\n\n if (defined.unions.includes(typeName) && picks.unions[typeName]) {\n return `${importNamespace}.DefinedUnionsWithoutExtensions[\"${typeName}\"]`;\n }\n\n if (defined.objects.includes(typeName) && picks.objects[typeName]) {\n return `Pick<${coreType}, DefinedFields['${typeName}']>`;\n }\n\n if (defined.interfaces.includes(typeName) && picks.interfaces[typeName]) {\n return `${importNamespace}.DefinedInterfacesWithoutExtensions[\"${typeName}\"]`;\n }\n\n if (defined.inputs.includes(typeName) && picks.inputs[typeName]) {\n return `Pick<${coreType}, DefinedInputFields['${typeName}']>`;\n }\n\n if (isScalarType(schema?.getType(typeName))) {\n return coreType;\n }\n\n if (isInterfaceType(schema?.getType(typeName))) {\n return `${importNamespace}.DefinedInterfacesWithoutExtensions[\"${typeName}\"]`;\n }\n\n if (isUnionType(schema?.getType(typeName))) {\n return `${importNamespace}.DefinedUnionsWithoutExtensions[\"${typeName}\"]`;\n }\n\n return `Pick<${coreType}, ${importNamespace}.DefinedFieldsWithoutExtensions[\"${typeName}\"]>`;\n }\n\n function printExportType(typeName: string): string {\n return `export type ${encapsulateTypeName(typeName)} = ${printTypeBody(typeName)};`;\n }\n\n //\n //\n //\n // Utils\n //\n //\n //\n\n function collectFields(\n node:\n | ObjectTypeDefinitionNode\n | ObjectTypeExtensionNode\n | InterfaceTypeDefinitionNode\n | InterfaceTypeExtensionNode\n | InputObjectTypeDefinitionNode\n | InputObjectTypeExtensionNode,\n picksObj: Record<string, string[]>,\n ) {\n const name = node.name.value;\n\n if (node.fields) {\n if (!picksObj[name]) {\n picksObj[name] = [];\n }\n\n for (const field of node.fields) {\n picksObj[name].push(field.name.value);\n }\n }\n }\n\n function collectValuesFromEnum(node: EnumTypeDefinitionNode | EnumTypeExtensionNode) {\n const name = node.name.value;\n\n if (node.values) {\n if (!picks.enums[name]) {\n picks.enums[name] = [];\n }\n\n for (const field of node.values) {\n picks.enums[name].push(field.name.value);\n }\n }\n }\n\n function collectUnionTypes(node: UnionTypeDefinitionNode) {\n const name = node.name.value;\n\n if (node.types) {\n if (!picks.unions[name]) {\n picks.unions[name] = [];\n }\n\n for (const type of node.types) {\n picks.unions[name].push(type.name.value);\n }\n }\n }\n\n function collectTypeDefinition(node: TypeDefinitionNode) {\n const name = node.name.value;\n\n switch (node.kind) {\n case Kind.OBJECT_TYPE_DEFINITION: {\n defined.objects.push(name);\n collectFields(node, picks.objects);\n break;\n }\n\n case Kind.ENUM_TYPE_DEFINITION: {\n defined.enums.push(name);\n collectValuesFromEnum(node);\n break;\n }\n\n case Kind.INPUT_OBJECT_TYPE_DEFINITION: {\n defined.inputs.push(name);\n collectFields(node, picks.inputs);\n break;\n }\n\n case Kind.SCALAR_TYPE_DEFINITION: {\n defined.scalars.push(name);\n break;\n }\n\n case Kind.INTERFACE_TYPE_DEFINITION: {\n defined.interfaces.push(name);\n collectFields(node, picks.interfaces);\n break;\n }\n\n case Kind.UNION_TYPE_DEFINITION: {\n defined.unions.push(name);\n collectUnionTypes(node);\n break;\n }\n }\n }\n\n function collectTypeExtension(node: TypeExtensionNode) {\n const name = node.name.value;\n\n switch (node.kind) {\n case Kind.OBJECT_TYPE_EXTENSION: {\n collectFields(node, picks.objects);\n // Do not include root types as extensions\n // so we can use them in DefinedFields\n if (rootTypes.includes(name)) {\n pushUnique(defined.objects, name);\n return;\n }\n\n pushUnique(extended.objects, name);\n\n break;\n }\n\n case Kind.ENUM_TYPE_EXTENSION: {\n collectValuesFromEnum(node);\n pushUnique(extended.enums, name);\n break;\n }\n\n case Kind.INPUT_OBJECT_TYPE_EXTENSION: {\n collectFields(node, picks.inputs);\n pushUnique(extended.inputs, name);\n break;\n }\n\n case Kind.INTERFACE_TYPE_EXTENSION: {\n collectFields(node, picks.interfaces);\n pushUnique(extended.interfaces, name);\n break;\n }\n\n case Kind.UNION_TYPE_EXTENSION: {\n pushUnique(extended.unions, name);\n break;\n }\n }\n }\n\n function getParentType(type: string) {\n if (['Query', 'Mutation', 'Subscription'].includes(type)) {\n return '{}';\n }\n return type;\n }\n\n function getResultType(type: string, field: string) {\n return fieldTypes?.[type]?.[field] || '{}';\n }\n\n function getArgsType(type: string, field: string) {\n const hasArgs = fieldArguments?.[type]?.[field] ?? false;\n if (!hasArgs) {\n return '{}';\n }\n const fieldUpper = field[0].toUpperCase() + field.slice(1);\n return `Types.${type}${fieldUpper}Args`;\n }\n\n function getContextType() {\n return 'Types.ContextType';\n }\n}\n","import { getBaseType } from '@graphql-codegen/plugin-helpers';\nimport { DEFAULT_SCALARS, wrapTypeWithModifiers } from '@graphql-codegen/visitor-plugin-common';\nimport { Source } from '@graphql-tools/utils';\nimport {\n DefinitionNode,\n DocumentNode,\n FieldDefinitionNode,\n GraphQLFieldMap,\n GraphQLObjectType,\n GraphQLSchema,\n InputValueDefinitionNode,\n Kind,\n NamedTypeNode,\n ObjectTypeDefinitionNode,\n TypeNode,\n} from 'graphql';\nimport { platform } from 'node:os';\nimport parse from 'parse-filepath';\n\nconst sep = '/';\n\n/**\n * Searches every node to collect used types\n */\nexport function collectUsedTypes(doc: DocumentNode): string[] {\n const used: string[] = [];\n\n for (const definition of doc.definitions) {\n findRelated(definition);\n }\n\n function markAsUsed(type: string) {\n pushUnique(used, type);\n }\n\n function findRelated(\n node: DefinitionNode | FieldDefinitionNode | InputValueDefinitionNode | NamedTypeNode,\n ) {\n if (node.kind === Kind.OBJECT_TYPE_DEFINITION || node.kind === Kind.OBJECT_TYPE_EXTENSION) {\n // Object\n markAsUsed(node.name.value);\n\n if (node.fields) {\n for (const field of node.fields) {\n findRelated(field);\n }\n }\n\n if (node.interfaces) {\n for (const _interface of node.interfaces) {\n findRelated(_interface);\n }\n }\n } else if (\n node.kind === Kind.INPUT_OBJECT_TYPE_DEFINITION ||\n node.kind === Kind.INPUT_OBJECT_TYPE_EXTENSION\n ) {\n // Input\n markAsUsed(node.name.value);\n\n if (node.fields) {\n for (const field of node.fields) {\n findRelated(field);\n }\n }\n } else if (\n node.kind === Kind.INTERFACE_TYPE_DEFINITION ||\n node.kind === Kind.INTERFACE_TYPE_EXTENSION\n ) {\n // Interface\n markAsUsed(node.name.value);\n\n if (node.fields) {\n for (const field of node.fields) {\n findRelated(field);\n }\n }\n\n if (node.interfaces) {\n for (const _interface of node.interfaces) {\n findRelated(_interface);\n }\n }\n } else if (\n node.kind === Kind.UNION_TYPE_DEFINITION ||\n node.kind === Kind.UNION_TYPE_EXTENSION\n ) {\n // Union\n markAsUsed(node.name.value);\n\n if (node.types) {\n for (const type of node.types) {\n findRelated(type);\n }\n }\n } else if (node.kind === Kind.ENUM_TYPE_DEFINITION || node.kind === Kind.ENUM_TYPE_EXTENSION) {\n // Enum\n markAsUsed(node.name.value);\n } else if (\n node.kind === Kind.SCALAR_TYPE_DEFINITION ||\n node.kind === Kind.SCALAR_TYPE_EXTENSION\n ) {\n // Scalar\n if (!isGraphQLPrimitive(node.name.value)) {\n markAsUsed(node.name.value);\n }\n } else if (node.kind === Kind.INPUT_VALUE_DEFINITION) {\n // Argument\n findRelated(resolveTypeNode(node.type));\n } else if (node.kind === Kind.FIELD_DEFINITION) {\n // Field\n findRelated(resolveTypeNode(node.type));\n\n if (node.arguments) {\n for (const argument of node.arguments) {\n findRelated(argument);\n }\n }\n } else if (\n node.kind === Kind.NAMED_TYPE &&\n // Named type\n !isGraphQLPrimitive(node.name.value)\n ) {\n markAsUsed(node.name.value);\n }\n }\n\n return used;\n}\n\nfunction collectObjectFieldType(\n node: ObjectTypeDefinitionNode,\n fieldDefinition: FieldDefinitionNode,\n fieldsMap: GraphQLFieldMap<unknown, unknown>,\n fieldTypes: Record<string, Record<string, string>>,\n) {\n const objectName = node.name.value;\n const fieldName = fieldDefinition.name.value;\n\n const field = fieldsMap[fieldDefinition.name.value];\n const baseName = getBaseType(field.type).name;\n const isDefaultScalar = DEFAULT_SCALARS[baseName] != null;\n const name = isDefaultScalar ? `Types.Scalars[\"${baseName}\"][\"output\"]` : baseName;\n\n const type = wrapTypeWithModifiers(name, field.type, {\n wrapOptional: (str: string) => {\n return `Types.Maybe<${str}>`;\n },\n wrapArray: (str: string) => {\n return `Array<${str}>`;\n },\n });\n\n if (fieldTypes[objectName] == null) {\n fieldTypes[objectName] = {};\n }\n fieldTypes[objectName][fieldName] = type;\n}\n\nfunction collectObjectFieldArguments(\n node: ObjectTypeDefinitionNode,\n fieldDefinition: FieldDefinitionNode,\n fieldArguments: Record<string, Record<string, boolean>>,\n) {\n const objectName = node.name.value;\n const fieldName = fieldDefinition.name.value;\n const hasArguments = fieldDefinition.arguments != null && fieldDefinition.arguments.length > 0;\n\n if (fieldArguments[objectName] == null) {\n fieldArguments[objectName] = {};\n }\n fieldArguments[objectName][fieldName] = hasArguments;\n}\n\nexport function collectObjectFieldTypesAndArguments(schema?: GraphQLSchema) {\n const fieldTypes: Record<string, Record<string, string>> = {};\n const fieldArguments: Record<string, Record<string, boolean>> = {};\n\n if (!schema) {\n return { fieldTypes, fieldArguments };\n }\n\n const schemaTypes = schema.getTypeMap();\n\n for (const type of Object.values(schemaTypes)) {\n if (type.astNode?.kind !== Kind.OBJECT_TYPE_DEFINITION) {\n continue;\n }\n\n const schemaType = schemaTypes[type.name] as GraphQLObjectType;\n const fieldsMap = schemaType.getFields();\n\n for (const field of type.astNode.fields ?? []) {\n collectObjectFieldArguments(type.astNode, field, fieldArguments);\n collectObjectFieldType(type.astNode, field, fieldsMap, fieldTypes);\n }\n }\n\n return { fieldTypes, fieldArguments };\n}\n\nexport function resolveTypeNode(node: TypeNode): NamedTypeNode {\n if (node.kind === Kind.LIST_TYPE) {\n return resolveTypeNode(node.type);\n }\n\n if (node.kind === Kind.NON_NULL_TYPE) {\n return resolveTypeNode(node.type);\n }\n\n return node;\n}\n\nexport function isGraphQLPrimitive(name: string): boolean {\n return ['String', 'Boolean', 'ID', 'Float', 'Int'].includes(name);\n}\n\nexport function unique<T>(val: T, i: number, all: T[]): boolean {\n return i === all.indexOf(val);\n}\n\nexport function withQuotes(val: string): string {\n return `'${val}'`;\n}\n\nexport function indent(size: number) {\n const space = new Array(size).fill(' ').join('');\n\n function indentInner(val: string): string {\n return val\n .split('\\n')\n .map((line) => `${space}${line}`)\n .join('\\n');\n }\n\n return indentInner;\n}\n\nexport function buildBlock({ name, lines }: { name: string; lines: string[] }): string {\n if (!lines.length) {\n return '';\n }\n\n return [`${name} {`, ...lines.map(indent(2)), '};'].join('\\n');\n}\n\nconst getRelativePath = (filepath: string, basePath: string) => {\n const normalizedFilepath = normalize(filepath);\n const normalizedBasePath = ensureStartsWithSeparator(\n normalize(ensureEndsWithSeparator(basePath)),\n );\n const [, relativePath] = normalizedFilepath.split(normalizedBasePath);\n return relativePath;\n};\n\nexport function groupSourcesByModule(\n sources: Source[],\n basePath: string,\n): Record<string, Source[]> {\n const grouped: Record<string, Source[]> = {};\n\n for (const source of sources) {\n if (!source.location) {\n continue;\n }\n\n const relativePath = getRelativePath(source.location, basePath);\n\n if (relativePath) {\n // PERF: we could guess the module by matching source.location with a list of already resolved paths\n const mod = extractModuleDirectory(source.location, basePath);\n\n if (!grouped[mod]) {\n grouped[mod] = [];\n }\n\n grouped[mod].push(source);\n }\n }\n\n return grouped;\n}\n\nfunction extractModuleDirectory(filepath: string, basePath: string): string {\n const relativePath = getRelativePath(filepath, basePath);\n\n const [moduleDirectory] = relativePath.split(sep);\n\n return moduleDirectory;\n}\n\nexport function stripFilename(path: string) {\n const parsedPath = parse(path);\n return normalize(parsedPath.dir);\n}\n\nexport function normalize(path: string) {\n return path.replace(/\\\\/g, '/');\n}\n\nfunction ensureEndsWithSeparator(path: string) {\n return path.endsWith(sep) ? path : path + sep;\n}\n\nfunction ensureStartsWithSeparator(path: string) {\n if (platform() === 'win32') {\n return path;\n }\n\n return path.startsWith('.')\n ? path.replace(/^(..\\/)|(.\\/)/, '/')\n : path.startsWith('/')\n ? path\n : `/${path}`;\n}\n\n/**\n * Pushes an item to a list only if the list doesn't include the item\n */\nexport function pushUnique<T>(list: T[], item: T): void {\n if (!list.includes(item)) {\n list.push(item);\n }\n}\n\nexport function concatByKey<T extends Record<string, string[]>, K extends keyof T>(\n left: T,\n right: T,\n key: K,\n) {\n // Remove duplicate, if an element is in right & left, it will be only once in the returned array.\n //@ts-expect-error check compiler settings\n return [...new Set([...left[key], ...right[key]])];\n}\n\nexport function uniqueByKey<T extends Record<string, string[]>, K extends keyof T>(\n left: T,\n right: T,\n key: K,\n) {\n return left[key].filter((item) => !right[key].includes(item));\n}\n\nexport function createObject<K extends string, T>(keys: K[], valueFn: (key: K) => T) {\n const obj: Record<K, T> = {} as Record<K, T>;\n\n for (const key of keys) {\n obj[key] = valueFn(key);\n }\n\n return obj;\n}\n"]}
1
+ {"version":3,"sources":["/home/runner/work/baeta/baeta/packages/plugin-graphql/dist/index.cjs","../index.ts","../lib/codegen.ts","../utils/cache.ts","../utils/load.ts","../utils/hash.ts","../lib/context/index.ts","../lib/modules/index.ts","../lib/modules/builder.ts","../lib/modules/utils.ts"],"names":["getCachedDocumentNodeFromSchema","isScalarType","Kind","name","sources","unionsDefinition","types","typePicks","result"],"mappings":"AAAA,uiCAAI,UAAU,EAAE,MAAM,CAAC,cAAc;AACrC,IAAI,SAAS,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG;AAChC,EAAE,IAAI,CAAC,IAAI,KAAK,GAAG,GAAG;AACtB,IAAI,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,GAAG,CAAC,IAAI,CAAC,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC;AACjE,CAAC;AACD;AACA;ACNA,oDAA0D;ADQ1D;AACA;AERA,6CAAsC;AACtC,gEAA0D;AAC1D,sHAAkC;AFUlC;AACA;AGdO,SAAS,WAAA,CAAA,EAIA;AACf,EAAA,MAAM,MAAA,kBAAQ,IAAI,GAAA,CAA8B,CAAA;AAEhD,EAAA,OAAO,SAAS,MAAA,CAAU,SAAA,EAAmB,GAAA,EAAa,OAAA,EAAuC;AAChG,IAAA,MAAM,SAAA,EAAW,CAAA,EAAA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AA;AACD,IAAA;AACE,MAAA;AACL,MAAA;AACV,MAAA;AACgB,MAAA;AACjB,IAAA;AACe,IAAA;AACG,IAAA;AACN,IAAA;AACD,IAAA;AACF,IAAA;AACD,IAAA;AACP,MAAA;AACa,MAAA;AACG,MAAA;AACP,MAAA;AACM,QAAA;AACf,MAAA;AACD,IAAA;AACA,EAAA;AAEgB,EAAA;AACD,IAAA;AACX,MAAA;AACH,MAAA;AACA,IAAA;AAEM,IAAA;AACI,MAAA;AACDI,MAAAA;AACV,IAAA;AACA,EAAA;AAEkB,EAAA;AACpB;AFo/BsB;AACA;AC/jCN;AACR,EAAA;AACA,IAAA;AACM,IAAA;AACK,IAAA;AACV,MAAA;AACO,QAAA;AACA,UAAA;AACZ,QAAA;AACD,MAAA;AAEW,MAAA;AACA,MAAA;AACZ,IAAA;AACiB,IAAA;AACF,MAAA;AAEH,MAAA;AACN,QAAA;AACL,MAAA;AAEY,MAAA;AACb,IAAA;AACA,EAAA;AACF;AD8jCsB;AACA;AACA","file":"/home/runner/work/baeta/baeta/packages/plugin-graphql/dist/index.cjs","sourcesContent":[null,"import { type WatcherFile, createPluginV1, isMatch } from '@baeta/generator-sdk';\nimport { generate } from './lib/codegen.ts';\n\nexport function graphqlPlugin() {\n\treturn createPluginV1({\n\t\tname: 'graphql',\n\t\tactionName: 'GraphQL modules',\n\t\twatch: (options, watcher, reload) => {\n\t\t\tconst handleChange = (file: WatcherFile) => {\n\t\t\t\tif (isMatch(file.relativePath, options.schemas)) {\n\t\t\t\t\treload(file);\n\t\t\t\t}\n\t\t\t};\n\n\t\t\twatcher.on('update', handleChange);\n\t\t\twatcher.on('delete', handleChange);\n\t\t},\n\t\tgenerate: async (ctx, next) => {\n\t\t\tconst items = await generate(ctx.generatorOptions);\n\n\t\t\tfor (const item of items) {\n\t\t\t\tctx.fileManager.createAndAdd(item.filename, item.content, 'graphql');\n\t\t\t}\n\n\t\t\treturn next();\n\t\t},\n\t});\n}\n","import type { NormalizedGeneratorOptions } from '@baeta/generator-sdk';\nimport { codegen as gqlCodegen } from '@graphql-codegen/core';\nimport { normalizeConfig, normalizeInstanceOrArray } from '@graphql-codegen/plugin-helpers';\nimport * as typescriptPlugin from '@graphql-codegen/typescript';\nimport type { UnnormalizedTypeDefPointer } from '@graphql-tools/load';\nimport { createCache } from '../utils/cache.ts';\nimport { loadSchema } from '../utils/load.ts';\nimport * as contextPlugin from './context/index.ts';\nimport * as modules from './modules/index.ts';\n\nexport async function generate(options: NormalizedGeneratorOptions) {\n\tconst rootConfig = {\n\t\tschemas: normalizeInstanceOrArray(options.schemas),\n\t\tmodulesDir: options.modulesDir,\n\t\tbaseTypesPath: options.baseTypesPath,\n\t\tcontextType: options.contextType,\n\t\tmoduleDefinitionName: options.moduleDefinitionName,\n\t\tscalars: options.scalars,\n\t\tplugins: normalizeConfig(['typescript', 'context']),\n\t\tpluginMap: {\n\t\t\ttypescript: typescriptPlugin,\n\t\t\tcontext: contextPlugin,\n\t\t},\n\t};\n\n\tconst cache = createCache();\n\n\tconst schemaPointerMap: UnnormalizedTypeDefPointer = {};\n\tfor (const ptr of rootConfig.schemas) {\n\t\tif (typeof ptr === 'string') {\n\t\t\tschemaPointerMap[ptr] = {};\n\t\t} else if (typeof ptr === 'object') {\n\t\t\tObject.assign(schemaPointerMap, ptr);\n\t\t}\n\t}\n\n\tconst hash = JSON.stringify(schemaPointerMap);\n\tconst result = await cache('schema', hash, async () => {\n\t\treturn loadSchema(schemaPointerMap, options.cwd);\n\t});\n\n\tconst outputs = await modules.preset.buildGeneratesSection({\n\t\tbaseOutputDir: options.modulesDir,\n\t\tpresetConfig: {\n\t\t\tbaseTypesPath: rootConfig.baseTypesPath,\n\t\t\tfilename: rootConfig.moduleDefinitionName,\n\t\t\tencapsulateModuleTypes: 'none',\n\t\t\textensionsPath: options.extensions,\n\t\t},\n\t\tschema: result.outputSchema,\n\t\tschemaAst: result.outputSchemaAst,\n\t\tdocuments: [],\n\t\tpluginMap: rootConfig.pluginMap,\n\t\tplugins: rootConfig.plugins,\n\t\tconfig: {\n\t\t\tinputMaybeValue: 'T | undefined',\n\t\t\tcontextType: rootConfig.contextType,\n\t\t\tuseTypeImports: true,\n\t\t\tscalars: {\n\t\t\t\t...rootConfig.scalars,\n\t\t\t},\n\t\t},\n\t});\n\n\tconst promises = outputs.map(async (output) => {\n\t\tconst result = await gqlCodegen({\n\t\t\t...output,\n\t\t\tcache,\n\t\t});\n\n\t\treturn {\n\t\t\tfilename: output.filename,\n\t\t\tcontent: result,\n\t\t};\n\t});\n\n\treturn Promise.all(promises);\n}\n","export function createCache(): <T>(\n\tnamespace: string,\n\tkey: string,\n\tfactory: () => Promise<T>,\n) => Promise<T> {\n\tconst cache = new Map<string, Promise<unknown>>();\n\n\treturn function ensure<T>(namespace: string, key: string, factory: () => Promise<T>): Promise<T> {\n\t\tconst cacheKey = `${namespace}:${key}`;\n\n\t\tconst cachedValue = cache.get(cacheKey);\n\n\t\tif (cachedValue) {\n\t\t\treturn cachedValue as Promise<T>;\n\t\t}\n\n\t\tconst value = factory();\n\t\tcache.set(cacheKey, value);\n\n\t\treturn value;\n\t};\n}\n","import { getCachedDocumentNodeFromSchema } from '@graphql-codegen/plugin-helpers';\nimport { ApolloEngineLoader } from '@graphql-tools/apollo-engine-loader';\nimport { CodeFileLoader } from '@graphql-tools/code-file-loader';\nimport { GitLoader } from '@graphql-tools/git-loader';\nimport { GithubLoader } from '@graphql-tools/github-loader';\nimport { GraphQLFileLoader } from '@graphql-tools/graphql-file-loader';\nimport { JsonFileLoader } from '@graphql-tools/json-file-loader';\nimport {\n\ttype UnnormalizedTypeDefPointer,\n\tloadSchema as loadSchemaToolkit,\n} from '@graphql-tools/load';\nimport { PrismaLoader } from '@graphql-tools/prisma-loader';\nimport { UrlLoader } from '@graphql-tools/url-loader';\nimport { type GraphQLSchemaExtensions, validateSchema } from 'graphql';\nimport { hashSchema } from './hash.ts';\n\nexport async function loadSchema(schemaPointerMap: UnnormalizedTypeDefPointer, cwd: string) {\n\tconst outputSchemaAst = await loadSchemaToolkit(schemaPointerMap, {\n\t\tloaders: [\n\t\t\tnew CodeFileLoader(),\n\t\t\tnew GitLoader(),\n\t\t\tnew GithubLoader(),\n\t\t\tnew GraphQLFileLoader(),\n\t\t\tnew JsonFileLoader(),\n\t\t\tnew UrlLoader(),\n\t\t\tnew ApolloEngineLoader(),\n\t\t\tnew PrismaLoader(),\n\t\t],\n\t\tcwd,\n\t\tincludeSources: true,\n\t});\n\n\tconst errors = validateSchema(outputSchemaAst);\n\n\tif (errors.length > 0) {\n\t\tconst messages = errors.map((e) => e.toString()).join('\\n\\n--------------------\\n\\n');\n\t\tconst subject = errors.length === 1 ? 'error' : 'errors';\n\t\tthrow new Error(`Invalid schema. Found ${errors.length} ${subject}:\\n\\n${messages}`);\n\t}\n\n\tif (!outputSchemaAst.extensions) {\n\t\toutputSchemaAst.extensions = {};\n\t}\n\n\t(outputSchemaAst.extensions as GraphQLSchemaExtensions)['hash'] = hashSchema(outputSchemaAst);\n\n\treturn {\n\t\toutputSchemaAst,\n\t\toutputSchema: getCachedDocumentNodeFromSchema(outputSchemaAst),\n\t};\n}\n","import { createHash } from 'node:crypto';\nimport { getCachedDocumentNodeFromSchema } from '@graphql-codegen/plugin-helpers';\nimport { type GraphQLSchema, print } from 'graphql';\n\nexport function hashContent(content: string): string {\n\treturn createHash('sha256').update(content).digest('hex');\n}\n\nexport function hashSchema(schema: GraphQLSchema): string {\n\treturn hashContent(print(getCachedDocumentNodeFromSchema(schema)));\n}\n","import type { PluginFunction, Types } from '@graphql-codegen/plugin-helpers';\nimport { buildMapperImport, parseMapper } from '@graphql-codegen/visitor-plugin-common';\nimport type { GraphQLSchema } from 'graphql';\n\ninterface Config {\n\tcontextType: string | undefined;\n}\n\nexport const plugin: PluginFunction<Config> = async (\n\tschema: GraphQLSchema,\n\tdocuments: Types.DocumentFile[],\n\tconfig: Config,\n): Promise<Types.PluginOutput> => {\n\tconst prepend: string[] = [];\n\tconst mapper = parseMapper(config.contextType || 'any');\n\n\tif (mapper.isExternal && mapper.source) {\n\t\tconst identifier = mapper.default ? 'ContextType' : `${mapper.import} as ContextType`;\n\n\t\tconst result = buildMapperImport(\n\t\t\tmapper.source,\n\t\t\t[\n\t\t\t\t{\n\t\t\t\t\tidentifier,\n\t\t\t\t\tasDefault: mapper.default,\n\t\t\t\t},\n\t\t\t],\n\t\t\ttrue,\n\t\t);\n\n\t\tif (result) {\n\t\t\tprepend.push(result);\n\t\t}\n\t} else {\n\t\tprepend.push(`type ContextType = ${mapper.type}`);\n\t}\n\n\tprepend.push('export type { ContextType }');\n\n\treturn {\n\t\tcontent: '',\n\t\tprepend: prepend,\n\t};\n};\n\nexport default { plugin };\n","import { join, relative, resolve } from '@baeta/util-path';\nimport type { Types } from '@graphql-codegen/plugin-helpers';\nimport { BaseVisitor, getConfigValue } from '@graphql-codegen/visitor-plugin-common';\nimport type { Source } from '@graphql-tools/utils';\nimport {\n\ttype DocumentNode,\n\ttype ObjectTypeDefinitionNode,\n\ttype UnionTypeDefinitionNode,\n\ttype UnionTypeExtensionNode,\n\tconcatAST,\n\tisScalarType,\n} from 'graphql';\nimport { buildModule } from './builder.ts';\nimport type { ModulesConfig } from './config.ts';\nimport {\n\tcollectObjectFieldTypesAndArguments,\n\tgroupSourcesByModule,\n\tisGraphQLPrimitive,\n\tnormalize,\n\tstripFilename,\n} from './utils.ts';\n\nexport const preset: Types.OutputPreset<ModulesConfig> = {\n\tbuildGeneratesSection: (options) => {\n\t\tconst { baseOutputDir } = options;\n\t\tconst { baseTypesPath, extensionsPath, encapsulateModuleTypes } = options.presetConfig;\n\n\t\tconst requireRootResolvers = getConfigValue(options?.presetConfig.requireRootResolvers, false);\n\n\t\tconst cwd = resolve(options.presetConfig.cwd || process.cwd());\n\t\tconst importTypesNamespace = options.presetConfig.importTypesNamespace || 'Types';\n\n\t\tif (!baseTypesPath) {\n\t\t\tthrow new Error(\n\t\t\t\t`Preset \"graphql-modules\" requires you to specify \"baseTypesPath\" configuration and point it to your base types file (generated by \"typescript\" plugin)!`,\n\t\t\t);\n\t\t}\n\n\t\tif (!options.schemaAst?.extensions.sources) {\n\t\t\tthrow new Error(`Preset \"graphql-modules\" requires to use GraphQL SDL`);\n\t\t}\n\n\t\tconst extensions = options.schemaAst?.extensions;\n\t\tconst sources = (extensions?.extendedSources ?? []) as Source[];\n\t\tconst sourcesByModuleMap = groupSourcesByModule(sources, baseOutputDir);\n\t\tconst modules = Object.keys(sourcesByModuleMap);\n\n\t\tconst baseVisitor = new BaseVisitor(options.config, {});\n\t\tconst { fieldTypes, fieldArguments } = collectObjectFieldTypesAndArguments(options.schemaAst);\n\n\t\t// One file with an output from all plugins\n\t\tconst baseOutput: Types.GenerateOptions = {\n\t\t\tfilename: resolve(cwd, baseOutputDir, baseTypesPath),\n\t\t\tschema: options.schema,\n\t\t\tdocuments: options.documents,\n\t\t\tplugins: [\n\t\t\t\t...options.plugins,\n\t\t\t\t{\n\t\t\t\t\t'modules-exported-scalars': {},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t'modules-exported-picks': {},\n\t\t\t\t},\n\t\t\t],\n\t\t\tpluginMap: {\n\t\t\t\t...options.pluginMap,\n\t\t\t\t'modules-exported-scalars': {\n\t\t\t\t\tplugin: (schema) => {\n\t\t\t\t\t\tconst typeMap = schema.getTypeMap();\n\n\t\t\t\t\t\treturn Object.keys(typeMap)\n\t\t\t\t\t\t\t.map((t) => {\n\t\t\t\t\t\t\t\tif (t && typeMap[t] && isScalarType(typeMap[t]) && !isGraphQLPrimitive(t)) {\n\t\t\t\t\t\t\t\t\tconst convertedName = baseVisitor.convertName(t);\n\t\t\t\t\t\t\t\t\treturn `export type ${convertedName} = Scalars[\"${t}\"];`;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\treturn null;\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t.filter(Boolean)\n\t\t\t\t\t\t\t.join('\\n');\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t'modules-exported-picks': {\n\t\t\t\t\tplugin: (schema) => {\n\t\t\t\t\t\tconst typePicks: string[] = [];\n\t\t\t\t\t\tconst unionPicks: string[] = [];\n\t\t\t\t\t\tconst unionResults: string[] = [];\n\t\t\t\t\t\tconst interfacePicks: string[] = [];\n\t\t\t\t\t\tconst interfaceResults: string[] = [];\n\n\t\t\t\t\t\tconst unionTypesMap: Record<string, string[] | undefined> = {};\n\t\t\t\t\t\tconst interfacesTypesMap: Record<string, string[] | undefined> = {};\n\n\t\t\t\t\t\tfor (const moduleName of modules) {\n\t\t\t\t\t\t\tconst sources = sourcesByModuleMap[moduleName];\n\t\t\t\t\t\t\tconst documents = sources.map((source) => source.document) as DocumentNode[];\n\t\t\t\t\t\t\tconst moduleDocument = concatAST(documents);\n\n\t\t\t\t\t\t\tconst types = moduleDocument.definitions.filter(\n\t\t\t\t\t\t\t\t(def) => def.kind === 'ObjectTypeDefinition',\n\t\t\t\t\t\t\t) as ObjectTypeDefinitionNode[];\n\n\t\t\t\t\t\t\tconst unionsDefinition = moduleDocument.definitions.filter(\n\t\t\t\t\t\t\t\t(def) => def.kind === 'UnionTypeDefinition',\n\t\t\t\t\t\t\t) as UnionTypeDefinitionNode[];\n\n\t\t\t\t\t\t\tconst unionsExtensions = moduleDocument.definitions.filter(\n\t\t\t\t\t\t\t\t(def) => def.kind === 'UnionTypeExtension',\n\t\t\t\t\t\t\t) as UnionTypeExtensionNode[];\n\n\t\t\t\t\t\t\tconst unions = [...unionsDefinition, ...unionsExtensions];\n\n\t\t\t\t\t\t\tfor (const type of types) {\n\t\t\t\t\t\t\t\tconst name = type.name.value;\n\n\t\t\t\t\t\t\t\tfor (const interfaceNode of type.interfaces ?? []) {\n\t\t\t\t\t\t\t\t\tconst interfaceName = interfaceNode.name.value;\n\n\t\t\t\t\t\t\t\t\tif (interfacesTypesMap[interfaceName] == null) {\n\t\t\t\t\t\t\t\t\t\tinterfacesTypesMap[interfaceName] = [];\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tinterfacesTypesMap[interfaceName]?.push(name);\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tif (name === 'Query' || name === 'Mutation' || name === 'Subscription') {\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tconst fields = type.fields ?? [];\n\n\t\t\t\t\t\t\t\tif (fields.length === 0) {\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tconst fieldNames = fields.map((f) => `\"${f.name.value}\"`).join(' | ');\n\n\t\t\t\t\t\t\t\ttypePicks.push(` ${name}: ${fieldNames};`);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tfor (const union of unions) {\n\t\t\t\t\t\t\t\tconst types = union.types?.map((t) => t.name.value) ?? [];\n\n\t\t\t\t\t\t\t\tif (unionTypesMap[union.name.value] == null) {\n\t\t\t\t\t\t\t\t\tunionTypesMap[union.name.value] = [];\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tunionTypesMap[union.name.value]?.push(...types);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tfor (const unionName in unionTypesMap) {\n\t\t\t\t\t\t\tconst types = unionTypesMap[unionName];\n\n\t\t\t\t\t\t\tif (types == null || types.length === 0) {\n\t\t\t\t\t\t\t\tunionPicks.push(` ${unionName}: never;`);\n\t\t\t\t\t\t\t\tunionResults.push(` ${unionName}: null;`);\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst typePicks = types.map((t) => {\n\t\t\t\t\t\t\t\tconst normalizedTypeName = baseVisitor.convertName(t, {\n\t\t\t\t\t\t\t\t\tuseTypesSuffix: true,\n\t\t\t\t\t\t\t\t\tuseTypesPrefix: true,\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\treturn `Pick<${normalizedTypeName}, DefinedFieldsWithoutExtensions[\"${t}\"] | \"__typename\">`;\n\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\tconst resultPicks = types.map((t) => `\"${t}\"`);\n\n\t\t\t\t\t\t\tunionPicks.push(` ${unionName}: ${typePicks.join(' | ')};`);\n\t\t\t\t\t\t\tunionResults.push(` ${unionName}: ${resultPicks.join(' | ')} | null;`);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tfor (const interfaceName in interfacesTypesMap) {\n\t\t\t\t\t\t\tconst types = interfacesTypesMap[interfaceName];\n\n\t\t\t\t\t\t\tif (types == null || types.length === 0) {\n\t\t\t\t\t\t\t\tinterfacePicks.push(` ${interfaceName}: never;`);\n\t\t\t\t\t\t\t\tinterfaceResults.push(` ${interfaceName}: null;`);\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst typePicks = types.map((t) => {\n\t\t\t\t\t\t\t\tconst normalizedTypeName = baseVisitor.convertName(t, {\n\t\t\t\t\t\t\t\t\tuseTypesSuffix: true,\n\t\t\t\t\t\t\t\t\tuseTypesPrefix: true,\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\treturn `Pick<${normalizedTypeName}, DefinedFieldsWithoutExtensions[\"${t}\"] | \"__typename\">`;\n\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\tconst resultPicks = types.map((t) => `\"${t}\"`);\n\n\t\t\t\t\t\t\tinterfacePicks.push(` ${interfaceName}: ${typePicks.join(' | ')};`);\n\t\t\t\t\t\t\tinterfaceResults.push(` ${interfaceName}: ${resultPicks.join(' | ')} | null;`);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst fieldsDefinition = `export type DefinedFieldsWithoutExtensions = {\\n${typePicks.join('\\n')}\\n};`;\n\t\t\t\t\t\tconst unionsDefinition = `export type DefinedUnionsWithoutExtensions = {\\n${unionPicks.join('\\n')}\\n};`;\n\t\t\t\t\t\tconst unionsResultsDefinition = `export type DefinedUnionsResults = {\\n${unionResults.join('\\n')}\\n};`;\n\t\t\t\t\t\tconst interfacesDefinition = `export type DefinedInterfacesWithoutExtensions = {\\n${interfacePicks.join('\\n')}\\n};`;\n\t\t\t\t\t\tconst interfacesResultsDefinition = `export type DefinedInterfacesResults = {\\n${interfaceResults.join(\n\t\t\t\t\t\t\t'\\n',\n\t\t\t\t\t\t)}\\n};`;\n\n\t\t\t\t\t\tconst result = [\n\t\t\t\t\t\t\tfieldsDefinition,\n\t\t\t\t\t\t\tunionsDefinition,\n\t\t\t\t\t\t\tunionsResultsDefinition,\n\t\t\t\t\t\t\tinterfacesDefinition,\n\t\t\t\t\t\t\tinterfacesResultsDefinition,\n\t\t\t\t\t\t].join('\\n\\n');\n\n\t\t\t\t\t\treturn `\\n${result}\\n`;\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\tconfig: {\n\t\t\t\t...options.config,\n\t\t\t\tenumsAsTypes: true,\n\t\t\t},\n\t\t\tschemaAst: options.schemaAst,\n\t\t};\n\n\t\tconst baseTypesFilename = baseTypesPath.replace(/\\.(js|ts|d.ts)$/, '');\n\t\tconst baseTypesDir = stripFilename(baseOutput.filename);\n\n\t\t// One file per each module\n\t\tconst outputs: Types.GenerateOptions[] = modules.map((moduleName) => {\n\t\t\tconst filename = resolve(cwd, baseOutputDir, moduleName, options.presetConfig.filename);\n\t\t\tconst dirpath = stripFilename(filename);\n\t\t\tconst relativePath = relative(dirpath, baseTypesDir);\n\t\t\tconst importPath =\n\t\t\t\toptions.presetConfig.importBaseTypesFrom ||\n\t\t\t\tnormalize(join(relativePath, baseTypesFilename));\n\t\t\tconst sources = sourcesByModuleMap[moduleName];\n\n\t\t\tconst documents = sources.map((source) => source.document) as DocumentNode[];\n\n\t\t\tconst moduleDocument = concatAST(documents);\n\n\t\t\tconst shouldDeclare = filename.endsWith('.d.ts');\n\n\t\t\treturn {\n\t\t\t\tfilename,\n\t\t\t\tschema: options.schema,\n\t\t\t\tdocuments: [],\n\t\t\t\tplugins: [\n\t\t\t\t\t...options.plugins.filter((p) => typeof p === 'object' && !!p.add),\n\t\t\t\t\t{\n\t\t\t\t\t\t'graphql-modules-plugin': {},\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tpluginMap: {\n\t\t\t\t\t...options.pluginMap,\n\t\t\t\t\t'graphql-modules-plugin': {\n\t\t\t\t\t\tplugin: (schema) =>\n\t\t\t\t\t\t\tbuildModule(moduleName, moduleDocument, {\n\t\t\t\t\t\t\t\timportNamespace: importTypesNamespace,\n\t\t\t\t\t\t\t\timportPath,\n\t\t\t\t\t\t\t\tencapsulate: encapsulateModuleTypes || 'namespace',\n\t\t\t\t\t\t\t\trequireRootResolvers,\n\t\t\t\t\t\t\t\tshouldDeclare,\n\t\t\t\t\t\t\t\tschema,\n\t\t\t\t\t\t\t\tbaseVisitor,\n\t\t\t\t\t\t\t\tuseGraphQLModules: false,\n\t\t\t\t\t\t\t\tfieldTypes,\n\t\t\t\t\t\t\t\tfieldArguments,\n\t\t\t\t\t\t\t\textensionsPath,\n\t\t\t\t\t\t\t\trootTypes: [\n\t\t\t\t\t\t\t\t\tschema.getQueryType()?.name || '',\n\t\t\t\t\t\t\t\t\tschema.getMutationType()?.name || '',\n\t\t\t\t\t\t\t\t\tschema.getSubscriptionType()?.name || '',\n\t\t\t\t\t\t\t\t].filter(Boolean),\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tconfig: options.config,\n\t\t\t\tschemaAst: options.schemaAst,\n\t\t\t};\n\t\t});\n\n\t\treturn [baseOutput].concat(outputs);\n\t},\n};\n\nexport default preset;\n","import type { BaseVisitor } from '@graphql-codegen/visitor-plugin-common';\nimport { pascalCase } from 'change-case-all';\nimport {\n\ttype DocumentNode,\n\ttype EnumTypeDefinitionNode,\n\ttype EnumTypeExtensionNode,\n\ttype GraphQLSchema,\n\ttype InputObjectTypeDefinitionNode,\n\ttype InputObjectTypeExtensionNode,\n\ttype InterfaceTypeDefinitionNode,\n\ttype InterfaceTypeExtensionNode,\n\tKind,\n\ttype ObjectTypeDefinitionNode,\n\ttype ObjectTypeExtensionNode,\n\ttype TypeDefinitionNode,\n\ttype TypeExtensionNode,\n\ttype UnionTypeDefinitionNode,\n\tisInterfaceType,\n\tisScalarType,\n\tisUnionType,\n\tvisit,\n} from 'graphql';\nimport type { ModulesConfig } from './config.ts';\nimport {\n\tbuildBlock,\n\tcollectUsedTypes,\n\tconcatByKey,\n\tcreateObject,\n\tindent,\n\tpushUnique,\n\tunique,\n\tuniqueByKey,\n\twithQuotes,\n} from './utils.ts';\n\ntype RegistryKeys = 'objects' | 'inputs' | 'interfaces' | 'scalars' | 'unions' | 'enums';\ntype Registry = Record<RegistryKeys, string[]>;\nconst registryKeys: RegistryKeys[] = [\n\t'objects',\n\t'inputs',\n\t'interfaces',\n\t'scalars',\n\t'unions',\n\t'enums',\n];\nconst resolverKeys: Extract<RegistryKeys, 'objects' | 'enums' | 'scalars'>[] = [\n\t'scalars',\n\t'objects',\n\t'enums',\n];\n\nexport function buildModule(\n\tname: string,\n\tdoc: DocumentNode,\n\t{\n\t\timportNamespace,\n\t\timportPath,\n\t\tencapsulate,\n\t\trequireRootResolvers,\n\t\tshouldDeclare,\n\t\trootTypes,\n\t\tschema,\n\t\tbaseVisitor,\n\t\tfieldTypes,\n\t\tfieldArguments,\n\t\textensionsPath,\n\t}: {\n\t\timportNamespace: string;\n\t\timportPath: string;\n\t\tencapsulate: ModulesConfig['encapsulateModuleTypes'];\n\t\trequireRootResolvers: ModulesConfig['requireRootResolvers'];\n\t\tshouldDeclare: boolean;\n\t\trootTypes: string[];\n\t\tbaseVisitor: BaseVisitor;\n\t\tschema?: GraphQLSchema;\n\t\tuseGraphQLModules: boolean;\n\t\tfieldTypes: Record<string, Record<string, string>>;\n\t\tfieldArguments: Record<string, Record<string, boolean>>;\n\t\textensionsPath?: string;\n\t},\n): string {\n\tconst picks: Record<RegistryKeys, Record<string, string[]>> = createObject(\n\t\tregistryKeys,\n\t\t() => ({}),\n\t);\n\tconst defined: Registry = createObject(registryKeys, () => []);\n\tconst extended: Registry = createObject(registryKeys, () => []);\n\n\t// List of types used in objects, fields, arguments etc\n\tconst usedTypes = collectUsedTypes(doc);\n\n\tvisit(doc, {\n\t\tObjectTypeDefinition(node) {\n\t\t\tcollectTypeDefinition(node);\n\t\t},\n\t\tObjectTypeExtension(node) {\n\t\t\tcollectTypeExtension(node);\n\t\t},\n\t\tInputObjectTypeDefinition(node) {\n\t\t\tcollectTypeDefinition(node);\n\t\t},\n\t\tInputObjectTypeExtension(node) {\n\t\t\tcollectTypeExtension(node);\n\t\t},\n\t\tInterfaceTypeDefinition(node) {\n\t\t\tcollectTypeDefinition(node);\n\t\t},\n\t\tInterfaceTypeExtension(node) {\n\t\t\tcollectTypeExtension(node);\n\t\t},\n\t\tScalarTypeDefinition(node) {\n\t\t\tcollectTypeDefinition(node);\n\t\t},\n\t\tUnionTypeDefinition(node) {\n\t\t\tcollectTypeDefinition(node);\n\t\t},\n\t\tUnionTypeExtension(node) {\n\t\t\tcollectTypeExtension(node);\n\t\t},\n\t\tEnumTypeDefinition(node) {\n\t\t\tcollectTypeDefinition(node);\n\t\t},\n\t\tEnumTypeExtension(node) {\n\t\t\tcollectTypeExtension(node);\n\t\t},\n\t});\n\n\t// Defined and Extended types\n\tconst visited: Registry = createObject(registryKeys, (key) =>\n\t\tconcatByKey(defined, extended, key),\n\t);\n\n\t// Types that are not defined or extended in a module, they come from other modules\n\tconst external: Registry = createObject(registryKeys, (key) =>\n\t\tuniqueByKey(extended, defined, key),\n\t);\n\n\t//\n\t//\n\t//\n\t// Prints\n\t//\n\t//\n\t//\n\n\t// An actual output\n\tconst imports = [\n\t\t`import * as ${importNamespace} from \"${importPath}\";`,\n\t\t'import { DocumentNode } from \"graphql\";',\n\t\t'import * as Baeta from \"@baeta/core/sdk\";',\n\t];\n\n\tif (extensionsPath) {\n\t\timports.push(`import baetaExtensions from \"${extensionsPath}\";`);\n\t}\n\n\timports.push('\\n');\n\n\tlet content = [\n\t\tprintDefinedFields(),\n\t\tprintDefinedEnumValues(),\n\t\tprintDefinedInputFields(),\n\t\tprintSchemaTypes(usedTypes),\n\t\tprintMetadata(),\n\t]\n\t\t.filter(Boolean)\n\t\t.join('\\n\\n');\n\n\tconst moduleNamespace = baseVisitor.convertName(name, {\n\t\tsuffix: 'Module',\n\t\tuseTypesPrefix: false,\n\t\tuseTypesSuffix: false,\n\t});\n\n\tif (encapsulate === 'namespace') {\n\t\tcontent = `${shouldDeclare ? 'declare' : 'export'} namespace ${baseVisitor.convertName(name, {\n\t\t\tsuffix: 'Module',\n\t\t\tuseTypesPrefix: false,\n\t\t\tuseTypesSuffix: false,\n\t\t})} {\\n${shouldDeclare ? `${indent(2)(imports.join('\\n'))}\\n` : ''}${indent(2)(content)}\\n}`;\n\t}\n\n\treturn [...(shouldDeclare ? [] : imports), content, printFactoryMethod()]\n\t\t.filter(Boolean)\n\t\t.join('\\n');\n\n\tfunction printMetadata() {\n\t\treturn `export namespace ModuleMetadata {\n export const id = '${name}';\n export const dirname = './${name}';\n export const typedef = ${JSON.stringify(doc)} as unknown as DocumentNode;\n ${printBaetaManager()}\n}`;\n\t}\n\n\t/**\n\t * A dictionary of fields to pick from an object\n\t */\n\tfunction printDefinedFields() {\n\t\treturn buildBlock({\n\t\t\tname: 'interface DefinedFields',\n\t\t\tlines: [...visited.objects, ...visited.interfaces].map(\n\t\t\t\t(typeName) =>\n\t\t\t\t\t`${typeName}: ${printPicks(typeName, {\n\t\t\t\t\t\t...picks.objects,\n\t\t\t\t\t\t...picks.interfaces,\n\t\t\t\t\t})};`,\n\t\t\t),\n\t\t});\n\t}\n\n\tfunction printFactoryMethod() {\n\t\tconst name = moduleNamespace.slice(0, moduleNamespace.length - 6);\n\t\tconst createModuleFn = `create${name}Module`;\n\t\tconst getModuleFn = `get${name}Module`;\n\t\tconst extensionsArg = extensionsPath ? ', baetaExtensions' : '';\n\n\t\treturn `\nexport const ${createModuleFn} = () => Baeta.createModuleManager(ModuleMetadata${extensionsArg});\nexport const ${getModuleFn} = Baeta.createSingletonModule(${createModuleFn});\n`;\n\t}\n\n\t/**\n\t * Baeta manager\n\t */\n\n\tfunction printObjectFieldResolverBuilder(typeName: string, field: string) {\n\t\tconst parentType = getParentType(typeName);\n\t\tconst resultType = getResultType(typeName, field);\n\t\tconst argumentsType = getArgsType(typeName, field);\n\t\tconst contextType = getContextType();\n\t\treturn `${field}: module.createResolverBuilder<${resultType}, ${parentType}, ${contextType}, ${argumentsType}>(\"${typeName}\", \"${field}\"),`;\n\t}\n\n\tfunction printObjectResolverBuilder(typeName: string, objects: Record<string, string[]>) {\n\t\tconst fields =\n\t\t\tobjects[typeName]\n\t\t\t\t?.filter(unique)\n\t\t\t\t.map((field) => printObjectFieldResolverBuilder(typeName, field)) ?? [];\n\n\t\tif (fields.length === 0) {\n\t\t\treturn '';\n\t\t}\n\n\t\tconst parentType = getParentType(typeName);\n\t\tconst contextType = getContextType();\n\n\t\tconst addons = [`...module.createTypeMethods<${parentType}, ${contextType}>(\"${typeName}\"),`];\n\t\tconst contentBody = [...addons, ...fields].map(indent(2)).join('\\n');\n\t\tconst content = `{\\n${contentBody}\\n}`;\n\t\treturn `${typeName}: ${content},`;\n\t}\n\n\tfunction printSubscriptionFieldBuilder(field: string) {\n\t\tconst parentType = getParentType('Subscription');\n\t\tconst resultType = getResultType('Subscription', field);\n\t\tconst argumentsType = getArgsType('Subscription', field);\n\t\tconst contextType = getContextType();\n\t\treturn `${field}: module.createSubscriptionBuilder<${resultType}, ${parentType}, ${contextType}, ${argumentsType}>(\"${field}\"),`;\n\t}\n\n\tfunction printSubscriptionObjectBuilder() {\n\t\tconst subscriptions = picks.objects.Subscription?.filter(unique) ?? [];\n\n\t\tif (subscriptions.length === 0) {\n\t\t\treturn '';\n\t\t}\n\n\t\tconst fields = subscriptions.map((subscription) => printSubscriptionFieldBuilder(subscription));\n\n\t\tconst parentType = getParentType('Subscription');\n\t\tconst contextType = getContextType();\n\t\tconst addons = [`...module.createSubscriptionMethods<${parentType}, ${contextType}>(),`];\n\t\tconst contentBody = [...addons, ...fields].map(indent(2)).join('\\n');\n\n\t\tconst content = `{\\n${contentBody}\\n}`;\n\t\treturn `Subscription: ${content},`;\n\t}\n\n\tfunction printScalarBuilder() {\n\t\tconst scalars = visited.scalars;\n\t\tif (scalars.length === 0) {\n\t\t\treturn '';\n\t\t}\n\n\t\tconst fields = scalars.map((scalar) => `${scalar}: module.createScalarBuilder(\"${scalar}\"),`);\n\t\tconst content = fields.map(indent(2)).join('\\n');\n\t\treturn `Scalar: {\\n${content}\\n},`;\n\t}\n\n\tfunction printTypenameResolverBuilder(\n\t\tname: string,\n\t\tresultNamespace: string,\n\t\tvalueNamespace: string,\n\t) {\n\t\tconst resultType = `${importNamespace}.${resultNamespace}[\"${name}\"]`;\n\t\tconst valueType = `${importNamespace}.${valueNamespace}[\"${name}\"]`;\n\t\tconst contextType = getContextType();\n\t\tconst resolver = `$resolveType: module.createResolveType<${resultType}, ${valueType}, ${contextType}>(\"${name}\"),`;\n\t\treturn `${name}: {\\n${indent(2)(resolver)}\\n},`;\n\t}\n\n\tfunction printInterfaceBuilder() {\n\t\tconst interfaces = defined.interfaces;\n\n\t\tif (interfaces.length === 0) {\n\t\t\treturn '';\n\t\t}\n\n\t\treturn interfaces\n\t\t\t.map((interfaceName) =>\n\t\t\t\tprintTypenameResolverBuilder(\n\t\t\t\t\tinterfaceName,\n\t\t\t\t\t'DefinedInterfacesResults',\n\t\t\t\t\t'DefinedInterfacesWithoutExtensions',\n\t\t\t\t),\n\t\t\t)\n\t\t\t.join('\\n');\n\t}\n\n\tfunction printUnionBuilder() {\n\t\tconst unions = defined.unions;\n\n\t\tif (unions.length === 0) {\n\t\t\treturn '';\n\t\t}\n\n\t\treturn unions\n\t\t\t.map((unionName) =>\n\t\t\t\tprintTypenameResolverBuilder(\n\t\t\t\t\tunionName,\n\t\t\t\t\t'DefinedUnionsResults',\n\t\t\t\t\t'DefinedUnionsWithoutExtensions',\n\t\t\t\t),\n\t\t\t)\n\t\t\t.join('\\n');\n\t}\n\n\tfunction printBaetaManager() {\n\t\tconst objects = visited.objects\n\t\t\t.filter((type) => type !== 'Subscription')\n\t\t\t.map((typeName) => printObjectResolverBuilder(typeName, picks.objects))\n\t\t\t.filter(Boolean);\n\n\t\tconst contextType = getContextType();\n\t\tconst addons = [`...module.createModuleMethods<${contextType}>(),`];\n\n\t\tconst bodyFields = [\n\t\t\t...addons,\n\t\t\t...objects,\n\t\t\tprintScalarBuilder(),\n\t\t\tprintSubscriptionObjectBuilder(),\n\t\t\tprintInterfaceBuilder(),\n\t\t\tprintUnionBuilder(),\n\t\t];\n\n\t\tconst body = bodyFields.filter(Boolean).map(indent(6)).join('\\n');\n\t\tconst content = `{\\n${body}\\n }`;\n\n\t\treturn `\n export function createManager(module: Baeta.ModuleBuilder) {\n return ${content};\n }`;\n\t}\n\n\t/**\n\t * A dictionary of values to pick from an enum\n\t */\n\tfunction printDefinedEnumValues() {\n\t\treturn buildBlock({\n\t\t\tname: 'interface DefinedEnumValues',\n\t\t\tlines: visited.enums.map((typeName) => `${typeName}: ${printPicks(typeName, picks.enums)};`),\n\t\t});\n\t}\n\n\tfunction encapsulateTypeName(typeName: string): string {\n\t\tif (encapsulate === 'prefix') {\n\t\t\treturn `${pascalCase(name)}_${typeName}`;\n\t\t}\n\n\t\treturn typeName;\n\t}\n\n\t/**\n\t * A dictionary of fields to pick from an input\n\t */\n\tfunction printDefinedInputFields() {\n\t\treturn buildBlock({\n\t\t\tname: 'interface DefinedInputFields',\n\t\t\tlines: visited.inputs.map(\n\t\t\t\t(typeName) => `${typeName}: ${printPicks(typeName, picks.inputs)};`,\n\t\t\t),\n\t\t});\n\t}\n\n\t/**\n\t * Prints signatures of schema types with picks\n\t */\n\tfunction printSchemaTypes(types: string[]) {\n\t\treturn types\n\t\t\t.filter((type) => !visited.scalars.includes(type))\n\t\t\t.map(printExportType)\n\t\t\t.join('\\n');\n\t}\n\n\tfunction printPicks(typeName: string, records: Record<string, string[]>): string {\n\t\treturn records[typeName].filter(unique).map(withQuotes).join(' | ');\n\t}\n\n\tfunction printTypeBody(typeName: string): string {\n\t\tconst normalizedTypeName = baseVisitor.convertName(typeName, {\n\t\t\tuseTypesSuffix: true,\n\t\t\tuseTypesPrefix: true,\n\t\t});\n\n\t\tconst coreType = `${importNamespace}.${normalizedTypeName}`;\n\n\t\tif (external.enums.includes(typeName) || external.objects.includes(typeName)) {\n\t\t\tif (schema && isScalarType(schema.getType(typeName))) {\n\t\t\t\treturn `${importNamespace}.Scalars['${typeName}']`;\n\t\t\t}\n\n\t\t\treturn `Pick<${coreType}, ${importNamespace}.DefinedFieldsWithoutExtensions[\"${typeName}\"]>`;\n\t\t}\n\n\t\tif (external.unions.includes(typeName)) {\n\t\t\treturn `${importNamespace}.DefinedUnionsWithoutExtensions[\"${typeName}\"]`;\n\t\t}\n\n\t\tif (external.interfaces.includes(typeName)) {\n\t\t\treturn `Pick<${coreType}, ${importNamespace}.DefinedFieldsWithoutExtensions[\"${typeName}\"]>`;\n\t\t}\n\n\t\tif (defined.enums.includes(typeName) && picks.enums[typeName]) {\n\t\t\treturn `DefinedEnumValues['${typeName}']`;\n\t\t}\n\n\t\tif (defined.unions.includes(typeName) && picks.unions[typeName]) {\n\t\t\treturn `${importNamespace}.DefinedUnionsWithoutExtensions[\"${typeName}\"]`;\n\t\t}\n\n\t\tif (defined.objects.includes(typeName) && picks.objects[typeName]) {\n\t\t\treturn `Pick<${coreType}, DefinedFields['${typeName}']>`;\n\t\t}\n\n\t\tif (defined.interfaces.includes(typeName) && picks.interfaces[typeName]) {\n\t\t\treturn `${importNamespace}.DefinedInterfacesWithoutExtensions[\"${typeName}\"]`;\n\t\t}\n\n\t\tif (defined.inputs.includes(typeName) && picks.inputs[typeName]) {\n\t\t\treturn `Pick<${coreType}, DefinedInputFields['${typeName}']>`;\n\t\t}\n\n\t\tif (isScalarType(schema?.getType(typeName))) {\n\t\t\treturn coreType;\n\t\t}\n\n\t\tif (isInterfaceType(schema?.getType(typeName))) {\n\t\t\treturn `${importNamespace}.DefinedInterfacesWithoutExtensions[\"${typeName}\"]`;\n\t\t}\n\n\t\tif (isUnionType(schema?.getType(typeName))) {\n\t\t\treturn `${importNamespace}.DefinedUnionsWithoutExtensions[\"${typeName}\"]`;\n\t\t}\n\n\t\treturn `Pick<${coreType}, ${importNamespace}.DefinedFieldsWithoutExtensions[\"${typeName}\"]>`;\n\t}\n\n\tfunction printExportType(typeName: string): string {\n\t\treturn `export type ${encapsulateTypeName(typeName)} = ${printTypeBody(typeName)};`;\n\t}\n\n\t//\n\t//\n\t//\n\t// Utils\n\t//\n\t//\n\t//\n\n\tfunction collectFields(\n\t\tnode:\n\t\t\t| ObjectTypeDefinitionNode\n\t\t\t| ObjectTypeExtensionNode\n\t\t\t| InterfaceTypeDefinitionNode\n\t\t\t| InterfaceTypeExtensionNode\n\t\t\t| InputObjectTypeDefinitionNode\n\t\t\t| InputObjectTypeExtensionNode,\n\t\tpicksObj: Record<string, string[]>,\n\t) {\n\t\tconst name = node.name.value;\n\n\t\tif (node.fields) {\n\t\t\tif (!picksObj[name]) {\n\t\t\t\tpicksObj[name] = [];\n\t\t\t}\n\n\t\t\tfor (const field of node.fields) {\n\t\t\t\tpicksObj[name].push(field.name.value);\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction collectValuesFromEnum(node: EnumTypeDefinitionNode | EnumTypeExtensionNode) {\n\t\tconst name = node.name.value;\n\n\t\tif (node.values) {\n\t\t\tif (!picks.enums[name]) {\n\t\t\t\tpicks.enums[name] = [];\n\t\t\t}\n\n\t\t\tfor (const field of node.values) {\n\t\t\t\tpicks.enums[name].push(field.name.value);\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction collectUnionTypes(node: UnionTypeDefinitionNode) {\n\t\tconst name = node.name.value;\n\n\t\tif (node.types) {\n\t\t\tif (!picks.unions[name]) {\n\t\t\t\tpicks.unions[name] = [];\n\t\t\t}\n\n\t\t\tfor (const type of node.types) {\n\t\t\t\tpicks.unions[name].push(type.name.value);\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction collectTypeDefinition(node: TypeDefinitionNode) {\n\t\tconst name = node.name.value;\n\n\t\tswitch (node.kind) {\n\t\t\tcase Kind.OBJECT_TYPE_DEFINITION: {\n\t\t\t\tdefined.objects.push(name);\n\t\t\t\tcollectFields(node, picks.objects);\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase Kind.ENUM_TYPE_DEFINITION: {\n\t\t\t\tdefined.enums.push(name);\n\t\t\t\tcollectValuesFromEnum(node);\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase Kind.INPUT_OBJECT_TYPE_DEFINITION: {\n\t\t\t\tdefined.inputs.push(name);\n\t\t\t\tcollectFields(node, picks.inputs);\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase Kind.SCALAR_TYPE_DEFINITION: {\n\t\t\t\tdefined.scalars.push(name);\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase Kind.INTERFACE_TYPE_DEFINITION: {\n\t\t\t\tdefined.interfaces.push(name);\n\t\t\t\tcollectFields(node, picks.interfaces);\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase Kind.UNION_TYPE_DEFINITION: {\n\t\t\t\tdefined.unions.push(name);\n\t\t\t\tcollectUnionTypes(node);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction collectTypeExtension(node: TypeExtensionNode) {\n\t\tconst name = node.name.value;\n\n\t\tswitch (node.kind) {\n\t\t\tcase Kind.OBJECT_TYPE_EXTENSION: {\n\t\t\t\tcollectFields(node, picks.objects);\n\t\t\t\t// Do not include root types as extensions\n\t\t\t\t// so we can use them in DefinedFields\n\t\t\t\tif (rootTypes.includes(name)) {\n\t\t\t\t\tpushUnique(defined.objects, name);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tpushUnique(extended.objects, name);\n\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase Kind.ENUM_TYPE_EXTENSION: {\n\t\t\t\tcollectValuesFromEnum(node);\n\t\t\t\tpushUnique(extended.enums, name);\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase Kind.INPUT_OBJECT_TYPE_EXTENSION: {\n\t\t\t\tcollectFields(node, picks.inputs);\n\t\t\t\tpushUnique(extended.inputs, name);\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase Kind.INTERFACE_TYPE_EXTENSION: {\n\t\t\t\tcollectFields(node, picks.interfaces);\n\t\t\t\tpushUnique(extended.interfaces, name);\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase Kind.UNION_TYPE_EXTENSION: {\n\t\t\t\tpushUnique(extended.unions, name);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction getParentType(type: string) {\n\t\tif (['Query', 'Mutation', 'Subscription'].includes(type)) {\n\t\t\treturn '{}';\n\t\t}\n\t\treturn type;\n\t}\n\n\tfunction getResultType(type: string, field: string) {\n\t\treturn fieldTypes?.[type]?.[field] || '{}';\n\t}\n\n\tfunction getArgsType(type: string, field: string) {\n\t\tconst hasArgs = fieldArguments?.[type]?.[field] ?? false;\n\t\tif (!hasArgs) {\n\t\t\treturn '{}';\n\t\t}\n\t\tconst fieldUpper = field[0].toUpperCase() + field.slice(1);\n\t\treturn `Types.${type}${fieldUpper}Args`;\n\t}\n\n\tfunction getContextType() {\n\t\treturn 'Types.ContextType';\n\t}\n}\n","import { platform } from 'node:os';\nimport { getBaseType } from '@graphql-codegen/plugin-helpers';\nimport { DEFAULT_SCALARS, wrapTypeWithModifiers } from '@graphql-codegen/visitor-plugin-common';\nimport type { Source } from '@graphql-tools/utils';\nimport {\n\ttype DefinitionNode,\n\ttype DocumentNode,\n\ttype FieldDefinitionNode,\n\ttype GraphQLFieldMap,\n\ttype GraphQLObjectType,\n\ttype GraphQLSchema,\n\ttype InputValueDefinitionNode,\n\tKind,\n\ttype NamedTypeNode,\n\ttype ObjectTypeDefinitionNode,\n\ttype TypeNode,\n} from 'graphql';\nimport parse from 'parse-filepath';\n\nconst sep = '/';\n\n/**\n * Searches every node to collect used types\n */\nexport function collectUsedTypes(doc: DocumentNode): string[] {\n\tconst used: string[] = [];\n\n\tfor (const definition of doc.definitions) {\n\t\tfindRelated(definition);\n\t}\n\n\tfunction markAsUsed(type: string) {\n\t\tpushUnique(used, type);\n\t}\n\n\tfunction findRelated(\n\t\tnode: DefinitionNode | FieldDefinitionNode | InputValueDefinitionNode | NamedTypeNode,\n\t) {\n\t\tif (node.kind === Kind.OBJECT_TYPE_DEFINITION || node.kind === Kind.OBJECT_TYPE_EXTENSION) {\n\t\t\t// Object\n\t\t\tmarkAsUsed(node.name.value);\n\n\t\t\tif (node.fields) {\n\t\t\t\tfor (const field of node.fields) {\n\t\t\t\t\tfindRelated(field);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (node.interfaces) {\n\t\t\t\tfor (const _interface of node.interfaces) {\n\t\t\t\t\tfindRelated(_interface);\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (\n\t\t\tnode.kind === Kind.INPUT_OBJECT_TYPE_DEFINITION ||\n\t\t\tnode.kind === Kind.INPUT_OBJECT_TYPE_EXTENSION\n\t\t) {\n\t\t\t// Input\n\t\t\tmarkAsUsed(node.name.value);\n\n\t\t\tif (node.fields) {\n\t\t\t\tfor (const field of node.fields) {\n\t\t\t\t\tfindRelated(field);\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (\n\t\t\tnode.kind === Kind.INTERFACE_TYPE_DEFINITION ||\n\t\t\tnode.kind === Kind.INTERFACE_TYPE_EXTENSION\n\t\t) {\n\t\t\t// Interface\n\t\t\tmarkAsUsed(node.name.value);\n\n\t\t\tif (node.fields) {\n\t\t\t\tfor (const field of node.fields) {\n\t\t\t\t\tfindRelated(field);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (node.interfaces) {\n\t\t\t\tfor (const _interface of node.interfaces) {\n\t\t\t\t\tfindRelated(_interface);\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (\n\t\t\tnode.kind === Kind.UNION_TYPE_DEFINITION ||\n\t\t\tnode.kind === Kind.UNION_TYPE_EXTENSION\n\t\t) {\n\t\t\t// Union\n\t\t\tmarkAsUsed(node.name.value);\n\n\t\t\tif (node.types) {\n\t\t\t\tfor (const type of node.types) {\n\t\t\t\t\tfindRelated(type);\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (node.kind === Kind.ENUM_TYPE_DEFINITION || node.kind === Kind.ENUM_TYPE_EXTENSION) {\n\t\t\t// Enum\n\t\t\tmarkAsUsed(node.name.value);\n\t\t} else if (\n\t\t\tnode.kind === Kind.SCALAR_TYPE_DEFINITION ||\n\t\t\tnode.kind === Kind.SCALAR_TYPE_EXTENSION\n\t\t) {\n\t\t\t// Scalar\n\t\t\tif (!isGraphQLPrimitive(node.name.value)) {\n\t\t\t\tmarkAsUsed(node.name.value);\n\t\t\t}\n\t\t} else if (node.kind === Kind.INPUT_VALUE_DEFINITION) {\n\t\t\t// Argument\n\t\t\tfindRelated(resolveTypeNode(node.type));\n\t\t} else if (node.kind === Kind.FIELD_DEFINITION) {\n\t\t\t// Field\n\t\t\tfindRelated(resolveTypeNode(node.type));\n\n\t\t\tif (node.arguments) {\n\t\t\t\tfor (const argument of node.arguments) {\n\t\t\t\t\tfindRelated(argument);\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (\n\t\t\tnode.kind === Kind.NAMED_TYPE &&\n\t\t\t// Named type\n\t\t\t!isGraphQLPrimitive(node.name.value)\n\t\t) {\n\t\t\tmarkAsUsed(node.name.value);\n\t\t}\n\t}\n\n\treturn used;\n}\n\nfunction collectObjectFieldType(\n\tnode: ObjectTypeDefinitionNode,\n\tfieldDefinition: FieldDefinitionNode,\n\tfieldsMap: GraphQLFieldMap<unknown, unknown>,\n\tfieldTypes: Record<string, Record<string, string>>,\n) {\n\tconst objectName = node.name.value;\n\tconst fieldName = fieldDefinition.name.value;\n\n\tconst field = fieldsMap[fieldDefinition.name.value];\n\tconst baseName = getBaseType(field.type).name;\n\tconst isDefaultScalar = DEFAULT_SCALARS[baseName] != null;\n\tconst name = isDefaultScalar ? `Types.Scalars[\"${baseName}\"][\"output\"]` : baseName;\n\n\tconst type = wrapTypeWithModifiers(name, field.type, {\n\t\twrapOptional: (str: string) => {\n\t\t\treturn `Types.Maybe<${str}>`;\n\t\t},\n\t\twrapArray: (str: string) => {\n\t\t\treturn `Array<${str}>`;\n\t\t},\n\t});\n\n\tif (fieldTypes[objectName] == null) {\n\t\tfieldTypes[objectName] = {};\n\t}\n\tfieldTypes[objectName][fieldName] = type;\n}\n\nfunction collectObjectFieldArguments(\n\tnode: ObjectTypeDefinitionNode,\n\tfieldDefinition: FieldDefinitionNode,\n\tfieldArguments: Record<string, Record<string, boolean>>,\n) {\n\tconst objectName = node.name.value;\n\tconst fieldName = fieldDefinition.name.value;\n\tconst hasArguments = fieldDefinition.arguments != null && fieldDefinition.arguments.length > 0;\n\n\tif (fieldArguments[objectName] == null) {\n\t\tfieldArguments[objectName] = {};\n\t}\n\tfieldArguments[objectName][fieldName] = hasArguments;\n}\n\nexport function collectObjectFieldTypesAndArguments(schema?: GraphQLSchema) {\n\tconst fieldTypes: Record<string, Record<string, string>> = {};\n\tconst fieldArguments: Record<string, Record<string, boolean>> = {};\n\n\tif (!schema) {\n\t\treturn { fieldTypes, fieldArguments };\n\t}\n\n\tconst schemaTypes = schema.getTypeMap();\n\n\tfor (const type of Object.values(schemaTypes)) {\n\t\tif (type.astNode?.kind !== Kind.OBJECT_TYPE_DEFINITION) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst schemaType = schemaTypes[type.name] as GraphQLObjectType;\n\t\tconst fieldsMap = schemaType.getFields();\n\n\t\tfor (const field of type.astNode.fields ?? []) {\n\t\t\tcollectObjectFieldArguments(type.astNode, field, fieldArguments);\n\t\t\tcollectObjectFieldType(type.astNode, field, fieldsMap, fieldTypes);\n\t\t}\n\t}\n\n\treturn { fieldTypes, fieldArguments };\n}\n\nexport function resolveTypeNode(node: TypeNode): NamedTypeNode {\n\tif (node.kind === Kind.LIST_TYPE) {\n\t\treturn resolveTypeNode(node.type);\n\t}\n\n\tif (node.kind === Kind.NON_NULL_TYPE) {\n\t\treturn resolveTypeNode(node.type);\n\t}\n\n\treturn node;\n}\n\nexport function isGraphQLPrimitive(name: string): boolean {\n\treturn ['String', 'Boolean', 'ID', 'Float', 'Int'].includes(name);\n}\n\nexport function unique<T>(val: T, i: number, all: T[]): boolean {\n\treturn i === all.indexOf(val);\n}\n\nexport function withQuotes(val: string): string {\n\treturn `'${val}'`;\n}\n\nexport function indent(size: number) {\n\tconst space = new Array(size).fill(' ').join('');\n\n\tfunction indentInner(val: string): string {\n\t\treturn val\n\t\t\t.split('\\n')\n\t\t\t.map((line) => `${space}${line}`)\n\t\t\t.join('\\n');\n\t}\n\n\treturn indentInner;\n}\n\nexport function buildBlock({ name, lines }: { name: string; lines: string[] }): string {\n\tif (!lines.length) {\n\t\treturn '';\n\t}\n\n\treturn [`${name} {`, ...lines.map(indent(2)), '};'].join('\\n');\n}\n\nconst getRelativePath = (filepath: string, basePath: string) => {\n\tconst normalizedFilepath = normalize(filepath);\n\tconst normalizedBasePath = ensureStartsWithSeparator(\n\t\tnormalize(ensureEndsWithSeparator(basePath)),\n\t);\n\tconst [, relativePath] = normalizedFilepath.split(normalizedBasePath);\n\treturn relativePath;\n};\n\nexport function groupSourcesByModule(\n\tsources: Source[],\n\tbasePath: string,\n): Record<string, Source[]> {\n\tconst grouped: Record<string, Source[]> = {};\n\n\tfor (const source of sources) {\n\t\tif (!source.location) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst relativePath = getRelativePath(source.location, basePath);\n\n\t\tif (relativePath) {\n\t\t\t// PERF: we could guess the module by matching source.location with a list of already resolved paths\n\t\t\tconst mod = extractModuleDirectory(source.location, basePath);\n\n\t\t\tif (!grouped[mod]) {\n\t\t\t\tgrouped[mod] = [];\n\t\t\t}\n\n\t\t\tgrouped[mod].push(source);\n\t\t}\n\t}\n\n\treturn grouped;\n}\n\nfunction extractModuleDirectory(filepath: string, basePath: string): string {\n\tconst relativePath = getRelativePath(filepath, basePath);\n\n\tconst [moduleDirectory] = relativePath.split(sep);\n\n\treturn moduleDirectory;\n}\n\nexport function stripFilename(path: string) {\n\tconst parsedPath = parse(path);\n\treturn normalize(parsedPath.dir);\n}\n\nexport function normalize(path: string) {\n\treturn path.replace(/\\\\/g, '/');\n}\n\nfunction ensureEndsWithSeparator(path: string) {\n\treturn path.endsWith(sep) ? path : path + sep;\n}\n\nfunction ensureStartsWithSeparator(path: string) {\n\tif (platform() === 'win32') {\n\t\treturn path;\n\t}\n\n\treturn path.startsWith('.')\n\t\t? path.replace(/^(..\\/)|(.\\/)/, '/')\n\t\t: path.startsWith('/')\n\t\t\t? path\n\t\t\t: `/${path}`;\n}\n\n/**\n * Pushes an item to a list only if the list doesn't include the item\n */\nexport function pushUnique<T>(list: T[], item: T): void {\n\tif (!list.includes(item)) {\n\t\tlist.push(item);\n\t}\n}\n\nexport function concatByKey<T extends Record<string, string[]>, K extends keyof T>(\n\tleft: T,\n\tright: T,\n\tkey: K,\n) {\n\t// Remove duplicate, if an element is in right & left, it will be only once in the returned array.\n\treturn [...new Set([...left[key], ...right[key]])];\n}\n\nexport function uniqueByKey<T extends Record<string, string[]>, K extends keyof T>(\n\tleft: T,\n\tright: T,\n\tkey: K,\n) {\n\treturn left[key].filter((item) => !right[key].includes(item));\n}\n\nexport function createObject<K extends string, T>(keys: K[], valueFn: (key: K) => T) {\n\tconst obj: Record<K, T> = {} as Record<K, T>;\n\n\tfor (const key of keys) {\n\t\tobj[key] = valueFn(key);\n\t}\n\n\treturn obj;\n}\n"]}
package/dist/index.js CHANGED
@@ -35,15 +35,17 @@ import { GitLoader } from "@graphql-tools/git-loader";
35
35
  import { GithubLoader } from "@graphql-tools/github-loader";
36
36
  import { GraphQLFileLoader } from "@graphql-tools/graphql-file-loader";
37
37
  import { JsonFileLoader } from "@graphql-tools/json-file-loader";
38
- import { loadSchema as loadSchemaToolkit } from "@graphql-tools/load";
38
+ import {
39
+ loadSchema as loadSchemaToolkit
40
+ } from "@graphql-tools/load";
39
41
  import { PrismaLoader } from "@graphql-tools/prisma-loader";
40
42
  import { UrlLoader } from "@graphql-tools/url-loader";
41
43
  import { validateSchema } from "graphql";
42
44
 
43
45
  // utils/hash.ts
46
+ import { createHash } from "node:crypto";
44
47
  import { getCachedDocumentNodeFromSchema } from "@graphql-codegen/plugin-helpers";
45
48
  import { print } from "graphql";
46
- import { createHash } from "node:crypto";
47
49
  function hashContent(content) {
48
50
  return createHash("sha256").update(content).digest("hex");
49
51
  }
@@ -132,20 +134,20 @@ import {
132
134
  // lib/modules/builder.ts
133
135
  import { pascalCase } from "change-case-all";
134
136
  import {
137
+ Kind as Kind2,
135
138
  isInterfaceType,
136
139
  isScalarType,
137
140
  isUnionType,
138
- Kind as Kind2,
139
141
  visit
140
142
  } from "graphql";
141
143
 
142
144
  // lib/modules/utils.ts
145
+ import { platform } from "node:os";
143
146
  import { getBaseType } from "@graphql-codegen/plugin-helpers";
144
147
  import { DEFAULT_SCALARS, wrapTypeWithModifiers } from "@graphql-codegen/visitor-plugin-common";
145
148
  import {
146
149
  Kind
147
150
  } from "graphql";
148
- import { platform } from "node:os";
149
151
  import parse from "parse-filepath";
150
152
  var sep = "/";
151
153
  function collectUsedTypes(doc) {
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../index.ts","../lib/codegen.ts","../utils/cache.ts","../utils/load.ts","../utils/hash.ts","../lib/context/index.ts","../lib/modules/index.ts","../lib/modules/builder.ts","../lib/modules/utils.ts"],"sourcesContent":["import { createPluginV1, isMatch, WatcherFile } from '@baeta/generator-sdk';\nimport { generate } from './lib/codegen';\n\nexport function graphqlPlugin() {\n return createPluginV1({\n name: 'graphql',\n actionName: 'GraphQL modules',\n watch: (options, watcher, reload) => {\n const handleChange = (file: WatcherFile) => {\n if (isMatch(file.relativePath, options.schemas)) {\n reload(file);\n }\n };\n\n watcher.on('update', handleChange);\n watcher.on('delete', handleChange);\n },\n generate: async (ctx, next) => {\n const items = await generate(ctx.generatorOptions);\n\n for (const item of items) {\n ctx.fileManager.createAndAdd(item.filename, item.content, 'graphql');\n }\n\n return next();\n },\n });\n}\n","import { NormalizedGeneratorOptions } from '@baeta/generator-sdk';\nimport { codegen as gqlCodegen } from '@graphql-codegen/core';\nimport { normalizeConfig, normalizeInstanceOrArray } from '@graphql-codegen/plugin-helpers';\nimport * as typescriptPlugin from '@graphql-codegen/typescript';\nimport { UnnormalizedTypeDefPointer } from '@graphql-tools/load';\nimport { createCache } from '../utils/cache';\nimport { loadSchema } from '../utils/load';\nimport * as contextPlugin from './context';\nimport * as modules from './modules';\n\nexport async function generate(options: NormalizedGeneratorOptions) {\n const rootConfig = {\n schemas: normalizeInstanceOrArray(options.schemas),\n modulesDir: options.modulesDir,\n baseTypesPath: options.baseTypesPath,\n contextType: options.contextType,\n moduleDefinitionName: options.moduleDefinitionName,\n scalars: options.scalars,\n plugins: normalizeConfig(['typescript', 'context']),\n pluginMap: {\n typescript: typescriptPlugin,\n context: contextPlugin,\n },\n };\n\n const cache = createCache();\n\n const schemaPointerMap: UnnormalizedTypeDefPointer = {};\n for (const ptr of rootConfig.schemas) {\n if (typeof ptr === 'string') {\n schemaPointerMap[ptr] = {};\n } else if (typeof ptr === 'object') {\n Object.assign(schemaPointerMap, ptr);\n }\n }\n\n const hash = JSON.stringify(schemaPointerMap);\n const result = await cache('schema', hash, async () => {\n return loadSchema(schemaPointerMap, options.cwd);\n });\n\n const outputs = await modules.preset.buildGeneratesSection({\n baseOutputDir: options.modulesDir,\n presetConfig: {\n baseTypesPath: rootConfig.baseTypesPath,\n filename: rootConfig.moduleDefinitionName,\n encapsulateModuleTypes: 'none',\n extensionsPath: options.extensions,\n },\n schema: result.outputSchema,\n schemaAst: result.outputSchemaAst,\n documents: [],\n pluginMap: rootConfig.pluginMap,\n plugins: rootConfig.plugins,\n config: {\n inputMaybeValue: 'T | undefined',\n contextType: rootConfig.contextType,\n useTypeImports: true,\n scalars: {\n ...rootConfig.scalars,\n },\n },\n });\n\n const promises = outputs.map(async (output) => {\n const result = await gqlCodegen({\n ...output,\n cache,\n });\n\n return {\n filename: output.filename,\n content: result,\n };\n });\n\n return Promise.all(promises);\n}\n","export function createCache(): <T>(\n namespace: string,\n key: string,\n factory: () => Promise<T>,\n) => Promise<T> {\n const cache = new Map<string, Promise<unknown>>();\n\n return function ensure<T>(namespace: string, key: string, factory: () => Promise<T>): Promise<T> {\n const cacheKey = `${namespace}:${key}`;\n\n const cachedValue = cache.get(cacheKey);\n\n if (cachedValue) {\n return cachedValue as Promise<T>;\n }\n\n const value = factory();\n cache.set(cacheKey, value);\n\n return value;\n };\n}\n","import { getCachedDocumentNodeFromSchema } from '@graphql-codegen/plugin-helpers';\nimport { ApolloEngineLoader } from '@graphql-tools/apollo-engine-loader';\nimport { CodeFileLoader } from '@graphql-tools/code-file-loader';\nimport { GitLoader } from '@graphql-tools/git-loader';\nimport { GithubLoader } from '@graphql-tools/github-loader';\nimport { GraphQLFileLoader } from '@graphql-tools/graphql-file-loader';\nimport { JsonFileLoader } from '@graphql-tools/json-file-loader';\nimport { loadSchema as loadSchemaToolkit, UnnormalizedTypeDefPointer } from '@graphql-tools/load';\nimport { PrismaLoader } from '@graphql-tools/prisma-loader';\nimport { UrlLoader } from '@graphql-tools/url-loader';\nimport { GraphQLSchemaExtensions, validateSchema } from 'graphql';\nimport { hashSchema } from './hash';\n\nexport async function loadSchema(schemaPointerMap: UnnormalizedTypeDefPointer, cwd: string) {\n const outputSchemaAst = await loadSchemaToolkit(schemaPointerMap, {\n loaders: [\n new CodeFileLoader(),\n new GitLoader(),\n new GithubLoader(),\n new GraphQLFileLoader(),\n new JsonFileLoader(),\n new UrlLoader(),\n new ApolloEngineLoader(),\n new PrismaLoader(),\n ],\n cwd,\n includeSources: true,\n });\n\n const errors = validateSchema(outputSchemaAst);\n\n if (errors.length > 0) {\n const messages = errors.map((e) => e.toString()).join('\\n\\n--------------------\\n\\n');\n const subject = errors.length === 1 ? 'error' : 'errors';\n throw new Error(`Invalid schema. Found ${errors.length} ${subject}:\\n\\n${messages}`);\n }\n\n if (!outputSchemaAst.extensions) {\n outputSchemaAst.extensions = {};\n }\n\n (outputSchemaAst.extensions as GraphQLSchemaExtensions)['hash'] = hashSchema(outputSchemaAst);\n\n return {\n outputSchemaAst,\n outputSchema: getCachedDocumentNodeFromSchema(outputSchemaAst),\n };\n}\n","import { getCachedDocumentNodeFromSchema } from '@graphql-codegen/plugin-helpers';\nimport { GraphQLSchema, print } from 'graphql';\nimport { createHash } from 'node:crypto';\n\nexport function hashContent(content: string): string {\n return createHash('sha256').update(content).digest('hex');\n}\n\nexport function hashSchema(schema: GraphQLSchema): string {\n return hashContent(print(getCachedDocumentNodeFromSchema(schema)));\n}\n","import { PluginFunction, Types } from '@graphql-codegen/plugin-helpers';\nimport { buildMapperImport, parseMapper } from '@graphql-codegen/visitor-plugin-common';\nimport { GraphQLSchema } from 'graphql';\n\ninterface Config {\n contextType: string | undefined;\n}\n\nexport const plugin: PluginFunction<Config> = async (\n schema: GraphQLSchema,\n documents: Types.DocumentFile[],\n config: Config,\n): Promise<Types.PluginOutput> => {\n const prepend: string[] = [];\n const mapper = parseMapper(config.contextType || 'any');\n\n if (mapper.isExternal && mapper.source) {\n const identifier = mapper.default ? 'ContextType' : `${mapper.import} as ContextType`;\n\n const result = buildMapperImport(\n mapper.source,\n [\n {\n identifier,\n asDefault: mapper.default,\n },\n ],\n true,\n );\n\n if (result) {\n prepend.push(result);\n }\n } else {\n prepend.push(`type ContextType = ${mapper.type}`);\n }\n\n prepend.push('export type { ContextType }');\n\n return {\n content: '',\n prepend: prepend,\n };\n};\n\nexport default { plugin };\n","import { join, relative, resolve } from '@baeta/util-path';\nimport { Types } from '@graphql-codegen/plugin-helpers';\nimport { BaseVisitor, getConfigValue } from '@graphql-codegen/visitor-plugin-common';\nimport { Source } from '@graphql-tools/utils';\nimport {\n DocumentNode,\n ObjectTypeDefinitionNode,\n UnionTypeDefinitionNode,\n UnionTypeExtensionNode,\n concatAST,\n isScalarType,\n} from 'graphql';\nimport { buildModule } from './builder';\nimport { ModulesConfig } from './config';\nimport {\n collectObjectFieldTypesAndArguments,\n groupSourcesByModule,\n isGraphQLPrimitive,\n normalize,\n stripFilename,\n} from './utils';\n\nexport const preset: Types.OutputPreset<ModulesConfig> = {\n buildGeneratesSection: (options) => {\n const { baseOutputDir } = options;\n const { baseTypesPath, extensionsPath, encapsulateModuleTypes } = options.presetConfig;\n\n const requireRootResolvers = getConfigValue(options?.presetConfig.requireRootResolvers, false);\n\n const cwd = resolve(options.presetConfig.cwd || process.cwd());\n const importTypesNamespace = options.presetConfig.importTypesNamespace || 'Types';\n\n if (!baseTypesPath) {\n throw new Error(\n `Preset \"graphql-modules\" requires you to specify \"baseTypesPath\" configuration and point it to your base types file (generated by \"typescript\" plugin)!`,\n );\n }\n\n if (!options.schemaAst?.extensions.sources) {\n throw new Error(`Preset \"graphql-modules\" requires to use GraphQL SDL`);\n }\n\n const extensions = options.schemaAst?.extensions;\n const sources = (extensions?.extendedSources ?? []) as Source[];\n const sourcesByModuleMap = groupSourcesByModule(sources, baseOutputDir);\n const modules = Object.keys(sourcesByModuleMap);\n\n const baseVisitor = new BaseVisitor(options.config, {});\n const { fieldTypes, fieldArguments } = collectObjectFieldTypesAndArguments(options.schemaAst);\n\n // One file with an output from all plugins\n const baseOutput: Types.GenerateOptions = {\n filename: resolve(cwd, baseOutputDir, baseTypesPath),\n schema: options.schema,\n documents: options.documents,\n plugins: [\n ...options.plugins,\n {\n 'modules-exported-scalars': {},\n },\n {\n 'modules-exported-picks': {},\n },\n ],\n pluginMap: {\n ...options.pluginMap,\n 'modules-exported-scalars': {\n plugin: (schema) => {\n const typeMap = schema.getTypeMap();\n\n return Object.keys(typeMap)\n .map((t) => {\n if (t && typeMap[t] && isScalarType(typeMap[t]) && !isGraphQLPrimitive(t)) {\n const convertedName = baseVisitor.convertName(t);\n return `export type ${convertedName} = Scalars[\"${t}\"];`;\n }\n\n return null;\n })\n .filter(Boolean)\n .join('\\n');\n },\n },\n 'modules-exported-picks': {\n plugin: (schema) => {\n const typePicks: string[] = [];\n const unionPicks: string[] = [];\n const unionResults: string[] = [];\n const interfacePicks: string[] = [];\n const interfaceResults: string[] = [];\n\n const unionTypesMap: Record<string, string[] | undefined> = {};\n const interfacesTypesMap: Record<string, string[] | undefined> = {};\n\n for (const moduleName of modules) {\n const sources = sourcesByModuleMap[moduleName];\n const documents = sources.map((source) => source.document) as DocumentNode[];\n const moduleDocument = concatAST(documents);\n\n const types = moduleDocument.definitions.filter(\n (def) => def.kind === 'ObjectTypeDefinition',\n ) as ObjectTypeDefinitionNode[];\n\n const unionsDefinition = moduleDocument.definitions.filter(\n (def) => def.kind === 'UnionTypeDefinition',\n ) as UnionTypeDefinitionNode[];\n\n const unionsExtensions = moduleDocument.definitions.filter(\n (def) => def.kind === 'UnionTypeExtension',\n ) as UnionTypeExtensionNode[];\n\n const unions = [...unionsDefinition, ...unionsExtensions];\n\n for (const type of types) {\n const name = type.name.value;\n\n for (const interfaceNode of type.interfaces ?? []) {\n const interfaceName = interfaceNode.name.value;\n\n if (interfacesTypesMap[interfaceName] == null) {\n interfacesTypesMap[interfaceName] = [];\n }\n\n interfacesTypesMap[interfaceName]?.push(name);\n }\n\n if (name === 'Query' || name === 'Mutation' || name === 'Subscription') {\n continue;\n }\n\n const fields = type.fields ?? [];\n\n if (fields.length === 0) {\n continue;\n }\n\n const fieldNames = fields.map((f) => `\"${f.name.value}\"`).join(' | ');\n\n typePicks.push(` ${name}: ${fieldNames};`);\n }\n\n for (const union of unions) {\n const types = union.types?.map((t) => t.name.value) ?? [];\n\n if (unionTypesMap[union.name.value] == null) {\n unionTypesMap[union.name.value] = [];\n }\n\n unionTypesMap[union.name.value]?.push(...types);\n }\n }\n\n for (const unionName in unionTypesMap) {\n const types = unionTypesMap[unionName];\n\n if (types == null || types.length === 0) {\n unionPicks.push(` ${unionName}: never;`);\n unionResults.push(` ${unionName}: null;`);\n continue;\n }\n\n const typePicks = types.map((t) => {\n const normalizedTypeName = baseVisitor.convertName(t, {\n useTypesSuffix: true,\n useTypesPrefix: true,\n });\n return `Pick<${normalizedTypeName}, DefinedFieldsWithoutExtensions[\"${t}\"] | \"__typename\">`;\n });\n\n const resultPicks = types.map((t) => `\"${t}\"`);\n\n unionPicks.push(` ${unionName}: ${typePicks.join(' | ')};`);\n unionResults.push(` ${unionName}: ${resultPicks.join(' | ')} | null;`);\n }\n\n for (const interfaceName in interfacesTypesMap) {\n const types = interfacesTypesMap[interfaceName];\n\n if (types == null || types.length === 0) {\n interfacePicks.push(` ${interfaceName}: never;`);\n interfaceResults.push(` ${interfaceName}: null;`);\n continue;\n }\n\n const typePicks = types.map((t) => {\n const normalizedTypeName = baseVisitor.convertName(t, {\n useTypesSuffix: true,\n useTypesPrefix: true,\n });\n return `Pick<${normalizedTypeName}, DefinedFieldsWithoutExtensions[\"${t}\"] | \"__typename\">`;\n });\n\n const resultPicks = types.map((t) => `\"${t}\"`);\n\n interfacePicks.push(` ${interfaceName}: ${typePicks.join(' | ')};`);\n interfaceResults.push(` ${interfaceName}: ${resultPicks.join(' | ')} | null;`);\n }\n\n const fieldsDefinition = `export type DefinedFieldsWithoutExtensions = {\\n${typePicks.join('\\n')}\\n};`;\n const unionsDefinition = `export type DefinedUnionsWithoutExtensions = {\\n${unionPicks.join('\\n')}\\n};`;\n const unionsResultsDefinition = `export type DefinedUnionsResults = {\\n${unionResults.join('\\n')}\\n};`;\n const interfacesDefinition = `export type DefinedInterfacesWithoutExtensions = {\\n${interfacePicks.join('\\n')}\\n};`;\n const interfacesResultsDefinition = `export type DefinedInterfacesResults = {\\n${interfaceResults.join(\n '\\n',\n )}\\n};`;\n\n const result = [\n fieldsDefinition,\n unionsDefinition,\n unionsResultsDefinition,\n interfacesDefinition,\n interfacesResultsDefinition,\n ].join('\\n\\n');\n\n return `\\n${result}\\n`;\n },\n },\n },\n config: {\n ...options.config,\n enumsAsTypes: true,\n },\n schemaAst: options.schemaAst,\n };\n\n const baseTypesFilename = baseTypesPath.replace(/\\.(js|ts|d.ts)$/, '');\n const baseTypesDir = stripFilename(baseOutput.filename);\n\n // One file per each module\n const outputs: Types.GenerateOptions[] = modules.map((moduleName) => {\n const filename = resolve(cwd, baseOutputDir, moduleName, options.presetConfig.filename);\n const dirpath = stripFilename(filename);\n const relativePath = relative(dirpath, baseTypesDir);\n const importPath =\n options.presetConfig.importBaseTypesFrom ||\n normalize(join(relativePath, baseTypesFilename));\n const sources = sourcesByModuleMap[moduleName];\n\n const documents = sources.map((source) => source.document) as DocumentNode[];\n\n const moduleDocument = concatAST(documents);\n\n const shouldDeclare = filename.endsWith('.d.ts');\n\n return {\n filename,\n schema: options.schema,\n documents: [],\n plugins: [\n ...options.plugins.filter((p) => typeof p === 'object' && !!p.add),\n {\n 'graphql-modules-plugin': {},\n },\n ],\n pluginMap: {\n ...options.pluginMap,\n 'graphql-modules-plugin': {\n plugin: (schema) =>\n buildModule(moduleName, moduleDocument, {\n importNamespace: importTypesNamespace,\n importPath,\n encapsulate: encapsulateModuleTypes || 'namespace',\n requireRootResolvers,\n shouldDeclare,\n schema,\n baseVisitor,\n useGraphQLModules: false,\n fieldTypes,\n fieldArguments,\n extensionsPath,\n rootTypes: [\n schema.getQueryType()?.name || '',\n schema.getMutationType()?.name || '',\n schema.getSubscriptionType()?.name || '',\n ].filter(Boolean),\n }),\n },\n },\n config: options.config,\n schemaAst: options.schemaAst,\n };\n });\n\n return [baseOutput].concat(outputs);\n },\n};\n\nexport default preset;\n","import { BaseVisitor } from '@graphql-codegen/visitor-plugin-common';\nimport { pascalCase } from 'change-case-all';\nimport {\n DocumentNode,\n EnumTypeDefinitionNode,\n EnumTypeExtensionNode,\n GraphQLSchema,\n InputObjectTypeDefinitionNode,\n InputObjectTypeExtensionNode,\n InterfaceTypeDefinitionNode,\n InterfaceTypeExtensionNode,\n isInterfaceType,\n isScalarType,\n isUnionType,\n Kind,\n ObjectTypeDefinitionNode,\n ObjectTypeExtensionNode,\n TypeDefinitionNode,\n TypeExtensionNode,\n UnionTypeDefinitionNode,\n visit,\n} from 'graphql';\nimport { ModulesConfig } from './config';\nimport {\n buildBlock,\n collectUsedTypes,\n concatByKey,\n createObject,\n indent,\n pushUnique,\n unique,\n uniqueByKey,\n withQuotes,\n} from './utils';\n\ntype RegistryKeys = 'objects' | 'inputs' | 'interfaces' | 'scalars' | 'unions' | 'enums';\ntype Registry = Record<RegistryKeys, string[]>;\nconst registryKeys: RegistryKeys[] = [\n 'objects',\n 'inputs',\n 'interfaces',\n 'scalars',\n 'unions',\n 'enums',\n];\nconst resolverKeys: Extract<RegistryKeys, 'objects' | 'enums' | 'scalars'>[] = [\n 'scalars',\n 'objects',\n 'enums',\n];\n\nexport function buildModule(\n name: string,\n doc: DocumentNode,\n {\n importNamespace,\n importPath,\n encapsulate,\n requireRootResolvers,\n shouldDeclare,\n rootTypes,\n schema,\n baseVisitor,\n fieldTypes,\n fieldArguments,\n extensionsPath,\n }: {\n importNamespace: string;\n importPath: string;\n encapsulate: ModulesConfig['encapsulateModuleTypes'];\n requireRootResolvers: ModulesConfig['requireRootResolvers'];\n shouldDeclare: boolean;\n rootTypes: string[];\n baseVisitor: BaseVisitor;\n schema?: GraphQLSchema;\n useGraphQLModules: boolean;\n fieldTypes: Record<string, Record<string, string>>;\n fieldArguments: Record<string, Record<string, boolean>>;\n extensionsPath?: string;\n },\n): string {\n const picks: Record<RegistryKeys, Record<string, string[]>> = createObject(\n registryKeys,\n () => ({}),\n );\n const defined: Registry = createObject(registryKeys, () => []);\n const extended: Registry = createObject(registryKeys, () => []);\n\n // List of types used in objects, fields, arguments etc\n const usedTypes = collectUsedTypes(doc);\n\n visit(doc, {\n ObjectTypeDefinition(node) {\n collectTypeDefinition(node);\n },\n ObjectTypeExtension(node) {\n collectTypeExtension(node);\n },\n InputObjectTypeDefinition(node) {\n collectTypeDefinition(node);\n },\n InputObjectTypeExtension(node) {\n collectTypeExtension(node);\n },\n InterfaceTypeDefinition(node) {\n collectTypeDefinition(node);\n },\n InterfaceTypeExtension(node) {\n collectTypeExtension(node);\n },\n ScalarTypeDefinition(node) {\n collectTypeDefinition(node);\n },\n UnionTypeDefinition(node) {\n collectTypeDefinition(node);\n },\n UnionTypeExtension(node) {\n collectTypeExtension(node);\n },\n EnumTypeDefinition(node) {\n collectTypeDefinition(node);\n },\n EnumTypeExtension(node) {\n collectTypeExtension(node);\n },\n });\n\n // Defined and Extended types\n const visited: Registry = createObject(registryKeys, (key) =>\n concatByKey(defined, extended, key),\n );\n\n // Types that are not defined or extended in a module, they come from other modules\n const external: Registry = createObject(registryKeys, (key) =>\n uniqueByKey(extended, defined, key),\n );\n\n //\n //\n //\n // Prints\n //\n //\n //\n\n // An actual output\n const imports = [\n `import * as ${importNamespace} from \"${importPath}\";`,\n 'import { DocumentNode } from \"graphql\";',\n 'import * as Baeta from \"@baeta/core/sdk\";',\n ];\n\n if (extensionsPath) {\n imports.push(`import baetaExtensions from \"${extensionsPath}\";`);\n }\n\n imports.push('\\n');\n\n let content = [\n printDefinedFields(),\n printDefinedEnumValues(),\n printDefinedInputFields(),\n printSchemaTypes(usedTypes),\n printMetadata(),\n ]\n .filter(Boolean)\n .join('\\n\\n');\n\n const moduleNamespace = baseVisitor.convertName(name, {\n suffix: 'Module',\n useTypesPrefix: false,\n useTypesSuffix: false,\n });\n\n if (encapsulate === 'namespace') {\n content = `${shouldDeclare ? 'declare' : 'export'} namespace ${baseVisitor.convertName(name, {\n suffix: 'Module',\n useTypesPrefix: false,\n useTypesSuffix: false,\n })} {\\n${shouldDeclare ? `${indent(2)(imports.join('\\n'))}\\n` : ''}${indent(2)(content)}\\n}`;\n }\n\n return [...(shouldDeclare ? [] : imports), content, printFactoryMethod()]\n .filter(Boolean)\n .join('\\n');\n\n function printMetadata() {\n return `export namespace ModuleMetadata {\n export const id = '${name}';\n export const dirname = './${name}';\n export const typedef = ${JSON.stringify(doc)} as unknown as DocumentNode;\n ${printBaetaManager()}\n}`;\n }\n\n /**\n * A dictionary of fields to pick from an object\n */\n function printDefinedFields() {\n return buildBlock({\n name: 'interface DefinedFields',\n lines: [...visited.objects, ...visited.interfaces].map(\n (typeName) =>\n `${typeName}: ${printPicks(typeName, {\n ...picks.objects,\n ...picks.interfaces,\n })};`,\n ),\n });\n }\n\n function printFactoryMethod() {\n const name = moduleNamespace.slice(0, moduleNamespace.length - 6);\n const createModuleFn = `create${name}Module`;\n const getModuleFn = `get${name}Module`;\n const extensionsArg = extensionsPath ? ', baetaExtensions' : '';\n\n return `\nexport const ${createModuleFn} = () => Baeta.createModuleManager(ModuleMetadata${extensionsArg});\nexport const ${getModuleFn} = Baeta.createSingletonModule(${createModuleFn});\n`;\n }\n\n /**\n * Baeta manager\n */\n\n function printObjectFieldResolverBuilder(typeName: string, field: string) {\n const parentType = getParentType(typeName);\n const resultType = getResultType(typeName, field);\n const argumentsType = getArgsType(typeName, field);\n const contextType = getContextType();\n return `${field}: module.createResolverBuilder<${resultType}, ${parentType}, ${contextType}, ${argumentsType}>(\"${typeName}\", \"${field}\"),`;\n }\n\n function printObjectResolverBuilder(typeName: string, objects: Record<string, string[]>) {\n const fields =\n objects[typeName]\n ?.filter(unique)\n .map((field) => printObjectFieldResolverBuilder(typeName, field)) ?? [];\n\n if (fields.length === 0) {\n return '';\n }\n\n const parentType = getParentType(typeName);\n const contextType = getContextType();\n\n const addons = [`...module.createTypeMethods<${parentType}, ${contextType}>(\"${typeName}\"),`];\n const contentBody = [...addons, ...fields].map(indent(2)).join('\\n');\n const content = `{\\n${contentBody}\\n}`;\n return `${typeName}: ${content},`;\n }\n\n function printSubscriptionFieldBuilder(field: string) {\n const parentType = getParentType('Subscription');\n const resultType = getResultType('Subscription', field);\n const argumentsType = getArgsType('Subscription', field);\n const contextType = getContextType();\n return `${field}: module.createSubscriptionBuilder<${resultType}, ${parentType}, ${contextType}, ${argumentsType}>(\"${field}\"),`;\n }\n\n function printSubscriptionObjectBuilder() {\n const subscriptions = picks.objects.Subscription?.filter(unique) ?? [];\n\n if (subscriptions.length === 0) {\n return '';\n }\n\n const fields = subscriptions.map((subscription) => printSubscriptionFieldBuilder(subscription));\n\n const parentType = getParentType('Subscription');\n const contextType = getContextType();\n const addons = [`...module.createSubscriptionMethods<${parentType}, ${contextType}>(),`];\n const contentBody = [...addons, ...fields].map(indent(2)).join('\\n');\n\n const content = `{\\n${contentBody}\\n}`;\n return `Subscription: ${content},`;\n }\n\n function printScalarBuilder() {\n const scalars = visited.scalars;\n if (scalars.length === 0) {\n return '';\n }\n\n const fields = scalars.map((scalar) => `${scalar}: module.createScalarBuilder(\"${scalar}\"),`);\n const content = fields.map(indent(2)).join('\\n');\n return `Scalar: {\\n${content}\\n},`;\n }\n\n function printTypenameResolverBuilder(\n name: string,\n resultNamespace: string,\n valueNamespace: string,\n ) {\n const resultType = `${importNamespace}.${resultNamespace}[\"${name}\"]`;\n const valueType = `${importNamespace}.${valueNamespace}[\"${name}\"]`;\n const contextType = getContextType();\n const resolver = `$resolveType: module.createResolveType<${resultType}, ${valueType}, ${contextType}>(\"${name}\"),`;\n return `${name}: {\\n${indent(2)(resolver)}\\n},`;\n }\n\n function printInterfaceBuilder() {\n const interfaces = defined.interfaces;\n\n if (interfaces.length === 0) {\n return '';\n }\n\n return interfaces\n .map((interfaceName) =>\n printTypenameResolverBuilder(\n interfaceName,\n 'DefinedInterfacesResults',\n 'DefinedInterfacesWithoutExtensions',\n ),\n )\n .join('\\n');\n }\n\n function printUnionBuilder() {\n const unions = defined.unions;\n\n if (unions.length === 0) {\n return '';\n }\n\n return unions\n .map((unionName) =>\n printTypenameResolverBuilder(\n unionName,\n 'DefinedUnionsResults',\n 'DefinedUnionsWithoutExtensions',\n ),\n )\n .join('\\n');\n }\n\n function printBaetaManager() {\n const objects = visited.objects\n .filter((type) => type !== 'Subscription')\n .map((typeName) => printObjectResolverBuilder(typeName, picks.objects))\n .filter(Boolean);\n\n const contextType = getContextType();\n const addons = [`...module.createModuleMethods<${contextType}>(),`];\n\n const bodyFields = [\n ...addons,\n ...objects,\n printScalarBuilder(),\n printSubscriptionObjectBuilder(),\n printInterfaceBuilder(),\n printUnionBuilder(),\n ];\n\n const body = bodyFields.filter(Boolean).map(indent(6)).join('\\n');\n const content = `{\\n${body}\\n }`;\n\n return `\n export function createManager(module: Baeta.ModuleBuilder) {\n return ${content};\n }`;\n }\n\n /**\n * A dictionary of values to pick from an enum\n */\n function printDefinedEnumValues() {\n return buildBlock({\n name: 'interface DefinedEnumValues',\n lines: visited.enums.map((typeName) => `${typeName}: ${printPicks(typeName, picks.enums)};`),\n });\n }\n\n function encapsulateTypeName(typeName: string): string {\n if (encapsulate === 'prefix') {\n return `${pascalCase(name)}_${typeName}`;\n }\n\n return typeName;\n }\n\n /**\n * A dictionary of fields to pick from an input\n */\n function printDefinedInputFields() {\n return buildBlock({\n name: 'interface DefinedInputFields',\n lines: visited.inputs.map(\n (typeName) => `${typeName}: ${printPicks(typeName, picks.inputs)};`,\n ),\n });\n }\n\n /**\n * Prints signatures of schema types with picks\n */\n function printSchemaTypes(types: string[]) {\n return types\n .filter((type) => !visited.scalars.includes(type))\n .map(printExportType)\n .join('\\n');\n }\n\n function printPicks(typeName: string, records: Record<string, string[]>): string {\n return records[typeName].filter(unique).map(withQuotes).join(' | ');\n }\n\n function printTypeBody(typeName: string): string {\n const normalizedTypeName = baseVisitor.convertName(typeName, {\n useTypesSuffix: true,\n useTypesPrefix: true,\n });\n\n const coreType = `${importNamespace}.${normalizedTypeName}`;\n\n if (external.enums.includes(typeName) || external.objects.includes(typeName)) {\n if (schema && isScalarType(schema.getType(typeName))) {\n return `${importNamespace}.Scalars['${typeName}']`;\n }\n\n return `Pick<${coreType}, ${importNamespace}.DefinedFieldsWithoutExtensions[\"${typeName}\"]>`;\n }\n\n if (external.unions.includes(typeName)) {\n return `${importNamespace}.DefinedUnionsWithoutExtensions[\"${typeName}\"]`;\n }\n\n if (external.interfaces.includes(typeName)) {\n return `Pick<${coreType}, ${importNamespace}.DefinedFieldsWithoutExtensions[\"${typeName}\"]>`;\n }\n\n if (defined.enums.includes(typeName) && picks.enums[typeName]) {\n return `DefinedEnumValues['${typeName}']`;\n }\n\n if (defined.unions.includes(typeName) && picks.unions[typeName]) {\n return `${importNamespace}.DefinedUnionsWithoutExtensions[\"${typeName}\"]`;\n }\n\n if (defined.objects.includes(typeName) && picks.objects[typeName]) {\n return `Pick<${coreType}, DefinedFields['${typeName}']>`;\n }\n\n if (defined.interfaces.includes(typeName) && picks.interfaces[typeName]) {\n return `${importNamespace}.DefinedInterfacesWithoutExtensions[\"${typeName}\"]`;\n }\n\n if (defined.inputs.includes(typeName) && picks.inputs[typeName]) {\n return `Pick<${coreType}, DefinedInputFields['${typeName}']>`;\n }\n\n if (isScalarType(schema?.getType(typeName))) {\n return coreType;\n }\n\n if (isInterfaceType(schema?.getType(typeName))) {\n return `${importNamespace}.DefinedInterfacesWithoutExtensions[\"${typeName}\"]`;\n }\n\n if (isUnionType(schema?.getType(typeName))) {\n return `${importNamespace}.DefinedUnionsWithoutExtensions[\"${typeName}\"]`;\n }\n\n return `Pick<${coreType}, ${importNamespace}.DefinedFieldsWithoutExtensions[\"${typeName}\"]>`;\n }\n\n function printExportType(typeName: string): string {\n return `export type ${encapsulateTypeName(typeName)} = ${printTypeBody(typeName)};`;\n }\n\n //\n //\n //\n // Utils\n //\n //\n //\n\n function collectFields(\n node:\n | ObjectTypeDefinitionNode\n | ObjectTypeExtensionNode\n | InterfaceTypeDefinitionNode\n | InterfaceTypeExtensionNode\n | InputObjectTypeDefinitionNode\n | InputObjectTypeExtensionNode,\n picksObj: Record<string, string[]>,\n ) {\n const name = node.name.value;\n\n if (node.fields) {\n if (!picksObj[name]) {\n picksObj[name] = [];\n }\n\n for (const field of node.fields) {\n picksObj[name].push(field.name.value);\n }\n }\n }\n\n function collectValuesFromEnum(node: EnumTypeDefinitionNode | EnumTypeExtensionNode) {\n const name = node.name.value;\n\n if (node.values) {\n if (!picks.enums[name]) {\n picks.enums[name] = [];\n }\n\n for (const field of node.values) {\n picks.enums[name].push(field.name.value);\n }\n }\n }\n\n function collectUnionTypes(node: UnionTypeDefinitionNode) {\n const name = node.name.value;\n\n if (node.types) {\n if (!picks.unions[name]) {\n picks.unions[name] = [];\n }\n\n for (const type of node.types) {\n picks.unions[name].push(type.name.value);\n }\n }\n }\n\n function collectTypeDefinition(node: TypeDefinitionNode) {\n const name = node.name.value;\n\n switch (node.kind) {\n case Kind.OBJECT_TYPE_DEFINITION: {\n defined.objects.push(name);\n collectFields(node, picks.objects);\n break;\n }\n\n case Kind.ENUM_TYPE_DEFINITION: {\n defined.enums.push(name);\n collectValuesFromEnum(node);\n break;\n }\n\n case Kind.INPUT_OBJECT_TYPE_DEFINITION: {\n defined.inputs.push(name);\n collectFields(node, picks.inputs);\n break;\n }\n\n case Kind.SCALAR_TYPE_DEFINITION: {\n defined.scalars.push(name);\n break;\n }\n\n case Kind.INTERFACE_TYPE_DEFINITION: {\n defined.interfaces.push(name);\n collectFields(node, picks.interfaces);\n break;\n }\n\n case Kind.UNION_TYPE_DEFINITION: {\n defined.unions.push(name);\n collectUnionTypes(node);\n break;\n }\n }\n }\n\n function collectTypeExtension(node: TypeExtensionNode) {\n const name = node.name.value;\n\n switch (node.kind) {\n case Kind.OBJECT_TYPE_EXTENSION: {\n collectFields(node, picks.objects);\n // Do not include root types as extensions\n // so we can use them in DefinedFields\n if (rootTypes.includes(name)) {\n pushUnique(defined.objects, name);\n return;\n }\n\n pushUnique(extended.objects, name);\n\n break;\n }\n\n case Kind.ENUM_TYPE_EXTENSION: {\n collectValuesFromEnum(node);\n pushUnique(extended.enums, name);\n break;\n }\n\n case Kind.INPUT_OBJECT_TYPE_EXTENSION: {\n collectFields(node, picks.inputs);\n pushUnique(extended.inputs, name);\n break;\n }\n\n case Kind.INTERFACE_TYPE_EXTENSION: {\n collectFields(node, picks.interfaces);\n pushUnique(extended.interfaces, name);\n break;\n }\n\n case Kind.UNION_TYPE_EXTENSION: {\n pushUnique(extended.unions, name);\n break;\n }\n }\n }\n\n function getParentType(type: string) {\n if (['Query', 'Mutation', 'Subscription'].includes(type)) {\n return '{}';\n }\n return type;\n }\n\n function getResultType(type: string, field: string) {\n return fieldTypes?.[type]?.[field] || '{}';\n }\n\n function getArgsType(type: string, field: string) {\n const hasArgs = fieldArguments?.[type]?.[field] ?? false;\n if (!hasArgs) {\n return '{}';\n }\n const fieldUpper = field[0].toUpperCase() + field.slice(1);\n return `Types.${type}${fieldUpper}Args`;\n }\n\n function getContextType() {\n return 'Types.ContextType';\n }\n}\n","import { getBaseType } from '@graphql-codegen/plugin-helpers';\nimport { DEFAULT_SCALARS, wrapTypeWithModifiers } from '@graphql-codegen/visitor-plugin-common';\nimport { Source } from '@graphql-tools/utils';\nimport {\n DefinitionNode,\n DocumentNode,\n FieldDefinitionNode,\n GraphQLFieldMap,\n GraphQLObjectType,\n GraphQLSchema,\n InputValueDefinitionNode,\n Kind,\n NamedTypeNode,\n ObjectTypeDefinitionNode,\n TypeNode,\n} from 'graphql';\nimport { platform } from 'node:os';\nimport parse from 'parse-filepath';\n\nconst sep = '/';\n\n/**\n * Searches every node to collect used types\n */\nexport function collectUsedTypes(doc: DocumentNode): string[] {\n const used: string[] = [];\n\n for (const definition of doc.definitions) {\n findRelated(definition);\n }\n\n function markAsUsed(type: string) {\n pushUnique(used, type);\n }\n\n function findRelated(\n node: DefinitionNode | FieldDefinitionNode | InputValueDefinitionNode | NamedTypeNode,\n ) {\n if (node.kind === Kind.OBJECT_TYPE_DEFINITION || node.kind === Kind.OBJECT_TYPE_EXTENSION) {\n // Object\n markAsUsed(node.name.value);\n\n if (node.fields) {\n for (const field of node.fields) {\n findRelated(field);\n }\n }\n\n if (node.interfaces) {\n for (const _interface of node.interfaces) {\n findRelated(_interface);\n }\n }\n } else if (\n node.kind === Kind.INPUT_OBJECT_TYPE_DEFINITION ||\n node.kind === Kind.INPUT_OBJECT_TYPE_EXTENSION\n ) {\n // Input\n markAsUsed(node.name.value);\n\n if (node.fields) {\n for (const field of node.fields) {\n findRelated(field);\n }\n }\n } else if (\n node.kind === Kind.INTERFACE_TYPE_DEFINITION ||\n node.kind === Kind.INTERFACE_TYPE_EXTENSION\n ) {\n // Interface\n markAsUsed(node.name.value);\n\n if (node.fields) {\n for (const field of node.fields) {\n findRelated(field);\n }\n }\n\n if (node.interfaces) {\n for (const _interface of node.interfaces) {\n findRelated(_interface);\n }\n }\n } else if (\n node.kind === Kind.UNION_TYPE_DEFINITION ||\n node.kind === Kind.UNION_TYPE_EXTENSION\n ) {\n // Union\n markAsUsed(node.name.value);\n\n if (node.types) {\n for (const type of node.types) {\n findRelated(type);\n }\n }\n } else if (node.kind === Kind.ENUM_TYPE_DEFINITION || node.kind === Kind.ENUM_TYPE_EXTENSION) {\n // Enum\n markAsUsed(node.name.value);\n } else if (\n node.kind === Kind.SCALAR_TYPE_DEFINITION ||\n node.kind === Kind.SCALAR_TYPE_EXTENSION\n ) {\n // Scalar\n if (!isGraphQLPrimitive(node.name.value)) {\n markAsUsed(node.name.value);\n }\n } else if (node.kind === Kind.INPUT_VALUE_DEFINITION) {\n // Argument\n findRelated(resolveTypeNode(node.type));\n } else if (node.kind === Kind.FIELD_DEFINITION) {\n // Field\n findRelated(resolveTypeNode(node.type));\n\n if (node.arguments) {\n for (const argument of node.arguments) {\n findRelated(argument);\n }\n }\n } else if (\n node.kind === Kind.NAMED_TYPE &&\n // Named type\n !isGraphQLPrimitive(node.name.value)\n ) {\n markAsUsed(node.name.value);\n }\n }\n\n return used;\n}\n\nfunction collectObjectFieldType(\n node: ObjectTypeDefinitionNode,\n fieldDefinition: FieldDefinitionNode,\n fieldsMap: GraphQLFieldMap<unknown, unknown>,\n fieldTypes: Record<string, Record<string, string>>,\n) {\n const objectName = node.name.value;\n const fieldName = fieldDefinition.name.value;\n\n const field = fieldsMap[fieldDefinition.name.value];\n const baseName = getBaseType(field.type).name;\n const isDefaultScalar = DEFAULT_SCALARS[baseName] != null;\n const name = isDefaultScalar ? `Types.Scalars[\"${baseName}\"][\"output\"]` : baseName;\n\n const type = wrapTypeWithModifiers(name, field.type, {\n wrapOptional: (str: string) => {\n return `Types.Maybe<${str}>`;\n },\n wrapArray: (str: string) => {\n return `Array<${str}>`;\n },\n });\n\n if (fieldTypes[objectName] == null) {\n fieldTypes[objectName] = {};\n }\n fieldTypes[objectName][fieldName] = type;\n}\n\nfunction collectObjectFieldArguments(\n node: ObjectTypeDefinitionNode,\n fieldDefinition: FieldDefinitionNode,\n fieldArguments: Record<string, Record<string, boolean>>,\n) {\n const objectName = node.name.value;\n const fieldName = fieldDefinition.name.value;\n const hasArguments = fieldDefinition.arguments != null && fieldDefinition.arguments.length > 0;\n\n if (fieldArguments[objectName] == null) {\n fieldArguments[objectName] = {};\n }\n fieldArguments[objectName][fieldName] = hasArguments;\n}\n\nexport function collectObjectFieldTypesAndArguments(schema?: GraphQLSchema) {\n const fieldTypes: Record<string, Record<string, string>> = {};\n const fieldArguments: Record<string, Record<string, boolean>> = {};\n\n if (!schema) {\n return { fieldTypes, fieldArguments };\n }\n\n const schemaTypes = schema.getTypeMap();\n\n for (const type of Object.values(schemaTypes)) {\n if (type.astNode?.kind !== Kind.OBJECT_TYPE_DEFINITION) {\n continue;\n }\n\n const schemaType = schemaTypes[type.name] as GraphQLObjectType;\n const fieldsMap = schemaType.getFields();\n\n for (const field of type.astNode.fields ?? []) {\n collectObjectFieldArguments(type.astNode, field, fieldArguments);\n collectObjectFieldType(type.astNode, field, fieldsMap, fieldTypes);\n }\n }\n\n return { fieldTypes, fieldArguments };\n}\n\nexport function resolveTypeNode(node: TypeNode): NamedTypeNode {\n if (node.kind === Kind.LIST_TYPE) {\n return resolveTypeNode(node.type);\n }\n\n if (node.kind === Kind.NON_NULL_TYPE) {\n return resolveTypeNode(node.type);\n }\n\n return node;\n}\n\nexport function isGraphQLPrimitive(name: string): boolean {\n return ['String', 'Boolean', 'ID', 'Float', 'Int'].includes(name);\n}\n\nexport function unique<T>(val: T, i: number, all: T[]): boolean {\n return i === all.indexOf(val);\n}\n\nexport function withQuotes(val: string): string {\n return `'${val}'`;\n}\n\nexport function indent(size: number) {\n const space = new Array(size).fill(' ').join('');\n\n function indentInner(val: string): string {\n return val\n .split('\\n')\n .map((line) => `${space}${line}`)\n .join('\\n');\n }\n\n return indentInner;\n}\n\nexport function buildBlock({ name, lines }: { name: string; lines: string[] }): string {\n if (!lines.length) {\n return '';\n }\n\n return [`${name} {`, ...lines.map(indent(2)), '};'].join('\\n');\n}\n\nconst getRelativePath = (filepath: string, basePath: string) => {\n const normalizedFilepath = normalize(filepath);\n const normalizedBasePath = ensureStartsWithSeparator(\n normalize(ensureEndsWithSeparator(basePath)),\n );\n const [, relativePath] = normalizedFilepath.split(normalizedBasePath);\n return relativePath;\n};\n\nexport function groupSourcesByModule(\n sources: Source[],\n basePath: string,\n): Record<string, Source[]> {\n const grouped: Record<string, Source[]> = {};\n\n for (const source of sources) {\n if (!source.location) {\n continue;\n }\n\n const relativePath = getRelativePath(source.location, basePath);\n\n if (relativePath) {\n // PERF: we could guess the module by matching source.location with a list of already resolved paths\n const mod = extractModuleDirectory(source.location, basePath);\n\n if (!grouped[mod]) {\n grouped[mod] = [];\n }\n\n grouped[mod].push(source);\n }\n }\n\n return grouped;\n}\n\nfunction extractModuleDirectory(filepath: string, basePath: string): string {\n const relativePath = getRelativePath(filepath, basePath);\n\n const [moduleDirectory] = relativePath.split(sep);\n\n return moduleDirectory;\n}\n\nexport function stripFilename(path: string) {\n const parsedPath = parse(path);\n return normalize(parsedPath.dir);\n}\n\nexport function normalize(path: string) {\n return path.replace(/\\\\/g, '/');\n}\n\nfunction ensureEndsWithSeparator(path: string) {\n return path.endsWith(sep) ? path : path + sep;\n}\n\nfunction ensureStartsWithSeparator(path: string) {\n if (platform() === 'win32') {\n return path;\n }\n\n return path.startsWith('.')\n ? path.replace(/^(..\\/)|(.\\/)/, '/')\n : path.startsWith('/')\n ? path\n : `/${path}`;\n}\n\n/**\n * Pushes an item to a list only if the list doesn't include the item\n */\nexport function pushUnique<T>(list: T[], item: T): void {\n if (!list.includes(item)) {\n list.push(item);\n }\n}\n\nexport function concatByKey<T extends Record<string, string[]>, K extends keyof T>(\n left: T,\n right: T,\n key: K,\n) {\n // Remove duplicate, if an element is in right & left, it will be only once in the returned array.\n //@ts-expect-error check compiler settings\n return [...new Set([...left[key], ...right[key]])];\n}\n\nexport function uniqueByKey<T extends Record<string, string[]>, K extends keyof T>(\n left: T,\n right: T,\n key: K,\n) {\n return left[key].filter((item) => !right[key].includes(item));\n}\n\nexport function createObject<K extends string, T>(keys: K[], valueFn: (key: K) => T) {\n const obj: Record<K, T> = {} as Record<K, T>;\n\n for (const key of keys) {\n obj[key] = valueFn(key);\n }\n\n return obj;\n}\n"],"mappings":";;;;;;;AAAA,SAAS,gBAAgB,eAA4B;;;ACCrD,SAAS,WAAW,kBAAkB;AACtC,SAAS,iBAAiB,gCAAgC;AAC1D,YAAY,sBAAsB;;;ACH3B,SAAS,cAIA;AACd,QAAM,QAAQ,oBAAI,IAA8B;AAEhD,SAAO,SAAS,OAAU,WAAmB,KAAa,SAAuC;AAC/F,UAAM,WAAW,GAAG,SAAS,IAAI,GAAG;AAEpC,UAAM,cAAc,MAAM,IAAI,QAAQ;AAEtC,QAAI,aAAa;AACf,aAAO;AAAA,IACT;AAEA,UAAM,QAAQ,QAAQ;AACtB,UAAM,IAAI,UAAU,KAAK;AAEzB,WAAO;AAAA,EACT;AACF;;;ACrBA,SAAS,mCAAAA,wCAAuC;AAChD,SAAS,0BAA0B;AACnC,SAAS,sBAAsB;AAC/B,SAAS,iBAAiB;AAC1B,SAAS,oBAAoB;AAC7B,SAAS,yBAAyB;AAClC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,QAAM,WAAW,QAAQ,IAAI,OAAO,WAAW;AAC7C,UAAMI,UAAS,MAAM,WAAW;AAAA,MAC9B,GAAG;AAAA,MACH;AAAA,IACF,CAAC;AAED,WAAO;AAAA,MACL,UAAU,OAAO;AAAA,MACjB,SAASA;AAAA,IACX;AAAA,EACF,CAAC;AAED,SAAO,QAAQ,IAAI,QAAQ;AAC7B;;;AD1EO,SAAS,gBAAgB;AAC9B,SAAO,eAAe;AAAA,IACpB,MAAM;AAAA,IACN,YAAY;AAAA,IACZ,OAAO,CAAC,SAAS,SAAS,WAAW;AACnC,YAAM,eAAe,CAAC,SAAsB;AAC1C,YAAI,QAAQ,KAAK,cAAc,QAAQ,OAAO,GAAG;AAC/C,iBAAO,IAAI;AAAA,QACb;AAAA,MACF;AAEA,cAAQ,GAAG,UAAU,YAAY;AACjC,cAAQ,GAAG,UAAU,YAAY;AAAA,IACnC;AAAA,IACA,UAAU,OAAO,KAAK,SAAS;AAC7B,YAAM,QAAQ,MAAM,SAAS,IAAI,gBAAgB;AAEjD,iBAAW,QAAQ,OAAO;AACxB,YAAI,YAAY,aAAa,KAAK,UAAU,KAAK,SAAS,SAAS;AAAA,MACrE;AAEA,aAAO,KAAK;AAAA,IACd;AAAA,EACF,CAAC;AACH;","names":["getCachedDocumentNodeFromSchema","getCachedDocumentNodeFromSchema","isScalarType","Kind","name","content","Kind","isScalarType","sources","unionsDefinition","types","typePicks","result"]}
1
+ {"version":3,"sources":["../index.ts","../lib/codegen.ts","../utils/cache.ts","../utils/load.ts","../utils/hash.ts","../lib/context/index.ts","../lib/modules/index.ts","../lib/modules/builder.ts","../lib/modules/utils.ts"],"sourcesContent":["import { type WatcherFile, createPluginV1, isMatch } from '@baeta/generator-sdk';\nimport { generate } from './lib/codegen.ts';\n\nexport function graphqlPlugin() {\n\treturn createPluginV1({\n\t\tname: 'graphql',\n\t\tactionName: 'GraphQL modules',\n\t\twatch: (options, watcher, reload) => {\n\t\t\tconst handleChange = (file: WatcherFile) => {\n\t\t\t\tif (isMatch(file.relativePath, options.schemas)) {\n\t\t\t\t\treload(file);\n\t\t\t\t}\n\t\t\t};\n\n\t\t\twatcher.on('update', handleChange);\n\t\t\twatcher.on('delete', handleChange);\n\t\t},\n\t\tgenerate: async (ctx, next) => {\n\t\t\tconst items = await generate(ctx.generatorOptions);\n\n\t\t\tfor (const item of items) {\n\t\t\t\tctx.fileManager.createAndAdd(item.filename, item.content, 'graphql');\n\t\t\t}\n\n\t\t\treturn next();\n\t\t},\n\t});\n}\n","import type { NormalizedGeneratorOptions } from '@baeta/generator-sdk';\nimport { codegen as gqlCodegen } from '@graphql-codegen/core';\nimport { normalizeConfig, normalizeInstanceOrArray } from '@graphql-codegen/plugin-helpers';\nimport * as typescriptPlugin from '@graphql-codegen/typescript';\nimport type { UnnormalizedTypeDefPointer } from '@graphql-tools/load';\nimport { createCache } from '../utils/cache.ts';\nimport { loadSchema } from '../utils/load.ts';\nimport * as contextPlugin from './context/index.ts';\nimport * as modules from './modules/index.ts';\n\nexport async function generate(options: NormalizedGeneratorOptions) {\n\tconst rootConfig = {\n\t\tschemas: normalizeInstanceOrArray(options.schemas),\n\t\tmodulesDir: options.modulesDir,\n\t\tbaseTypesPath: options.baseTypesPath,\n\t\tcontextType: options.contextType,\n\t\tmoduleDefinitionName: options.moduleDefinitionName,\n\t\tscalars: options.scalars,\n\t\tplugins: normalizeConfig(['typescript', 'context']),\n\t\tpluginMap: {\n\t\t\ttypescript: typescriptPlugin,\n\t\t\tcontext: contextPlugin,\n\t\t},\n\t};\n\n\tconst cache = createCache();\n\n\tconst schemaPointerMap: UnnormalizedTypeDefPointer = {};\n\tfor (const ptr of rootConfig.schemas) {\n\t\tif (typeof ptr === 'string') {\n\t\t\tschemaPointerMap[ptr] = {};\n\t\t} else if (typeof ptr === 'object') {\n\t\t\tObject.assign(schemaPointerMap, ptr);\n\t\t}\n\t}\n\n\tconst hash = JSON.stringify(schemaPointerMap);\n\tconst result = await cache('schema', hash, async () => {\n\t\treturn loadSchema(schemaPointerMap, options.cwd);\n\t});\n\n\tconst outputs = await modules.preset.buildGeneratesSection({\n\t\tbaseOutputDir: options.modulesDir,\n\t\tpresetConfig: {\n\t\t\tbaseTypesPath: rootConfig.baseTypesPath,\n\t\t\tfilename: rootConfig.moduleDefinitionName,\n\t\t\tencapsulateModuleTypes: 'none',\n\t\t\textensionsPath: options.extensions,\n\t\t},\n\t\tschema: result.outputSchema,\n\t\tschemaAst: result.outputSchemaAst,\n\t\tdocuments: [],\n\t\tpluginMap: rootConfig.pluginMap,\n\t\tplugins: rootConfig.plugins,\n\t\tconfig: {\n\t\t\tinputMaybeValue: 'T | undefined',\n\t\t\tcontextType: rootConfig.contextType,\n\t\t\tuseTypeImports: true,\n\t\t\tscalars: {\n\t\t\t\t...rootConfig.scalars,\n\t\t\t},\n\t\t},\n\t});\n\n\tconst promises = outputs.map(async (output) => {\n\t\tconst result = await gqlCodegen({\n\t\t\t...output,\n\t\t\tcache,\n\t\t});\n\n\t\treturn {\n\t\t\tfilename: output.filename,\n\t\t\tcontent: result,\n\t\t};\n\t});\n\n\treturn Promise.all(promises);\n}\n","export function createCache(): <T>(\n\tnamespace: string,\n\tkey: string,\n\tfactory: () => Promise<T>,\n) => Promise<T> {\n\tconst cache = new Map<string, Promise<unknown>>();\n\n\treturn function ensure<T>(namespace: string, key: string, factory: () => Promise<T>): Promise<T> {\n\t\tconst cacheKey = `${namespace}:${key}`;\n\n\t\tconst cachedValue = cache.get(cacheKey);\n\n\t\tif (cachedValue) {\n\t\t\treturn cachedValue as Promise<T>;\n\t\t}\n\n\t\tconst value = factory();\n\t\tcache.set(cacheKey, value);\n\n\t\treturn value;\n\t};\n}\n","import { getCachedDocumentNodeFromSchema } from '@graphql-codegen/plugin-helpers';\nimport { ApolloEngineLoader } from '@graphql-tools/apollo-engine-loader';\nimport { CodeFileLoader } from '@graphql-tools/code-file-loader';\nimport { GitLoader } from '@graphql-tools/git-loader';\nimport { GithubLoader } from '@graphql-tools/github-loader';\nimport { GraphQLFileLoader } from '@graphql-tools/graphql-file-loader';\nimport { JsonFileLoader } from '@graphql-tools/json-file-loader';\nimport {\n\ttype UnnormalizedTypeDefPointer,\n\tloadSchema as loadSchemaToolkit,\n} from '@graphql-tools/load';\nimport { PrismaLoader } from '@graphql-tools/prisma-loader';\nimport { UrlLoader } from '@graphql-tools/url-loader';\nimport { type GraphQLSchemaExtensions, validateSchema } from 'graphql';\nimport { hashSchema } from './hash.ts';\n\nexport async function loadSchema(schemaPointerMap: UnnormalizedTypeDefPointer, cwd: string) {\n\tconst outputSchemaAst = await loadSchemaToolkit(schemaPointerMap, {\n\t\tloaders: [\n\t\t\tnew CodeFileLoader(),\n\t\t\tnew GitLoader(),\n\t\t\tnew GithubLoader(),\n\t\t\tnew GraphQLFileLoader(),\n\t\t\tnew JsonFileLoader(),\n\t\t\tnew UrlLoader(),\n\t\t\tnew ApolloEngineLoader(),\n\t\t\tnew PrismaLoader(),\n\t\t],\n\t\tcwd,\n\t\tincludeSources: true,\n\t});\n\n\tconst errors = validateSchema(outputSchemaAst);\n\n\tif (errors.length > 0) {\n\t\tconst messages = errors.map((e) => e.toString()).join('\\n\\n--------------------\\n\\n');\n\t\tconst subject = errors.length === 1 ? 'error' : 'errors';\n\t\tthrow new Error(`Invalid schema. Found ${errors.length} ${subject}:\\n\\n${messages}`);\n\t}\n\n\tif (!outputSchemaAst.extensions) {\n\t\toutputSchemaAst.extensions = {};\n\t}\n\n\t(outputSchemaAst.extensions as GraphQLSchemaExtensions)['hash'] = hashSchema(outputSchemaAst);\n\n\treturn {\n\t\toutputSchemaAst,\n\t\toutputSchema: getCachedDocumentNodeFromSchema(outputSchemaAst),\n\t};\n}\n","import { createHash } from 'node:crypto';\nimport { getCachedDocumentNodeFromSchema } from '@graphql-codegen/plugin-helpers';\nimport { type GraphQLSchema, print } from 'graphql';\n\nexport function hashContent(content: string): string {\n\treturn createHash('sha256').update(content).digest('hex');\n}\n\nexport function hashSchema(schema: GraphQLSchema): string {\n\treturn hashContent(print(getCachedDocumentNodeFromSchema(schema)));\n}\n","import type { PluginFunction, Types } from '@graphql-codegen/plugin-helpers';\nimport { buildMapperImport, parseMapper } from '@graphql-codegen/visitor-plugin-common';\nimport type { GraphQLSchema } from 'graphql';\n\ninterface Config {\n\tcontextType: string | undefined;\n}\n\nexport const plugin: PluginFunction<Config> = async (\n\tschema: GraphQLSchema,\n\tdocuments: Types.DocumentFile[],\n\tconfig: Config,\n): Promise<Types.PluginOutput> => {\n\tconst prepend: string[] = [];\n\tconst mapper = parseMapper(config.contextType || 'any');\n\n\tif (mapper.isExternal && mapper.source) {\n\t\tconst identifier = mapper.default ? 'ContextType' : `${mapper.import} as ContextType`;\n\n\t\tconst result = buildMapperImport(\n\t\t\tmapper.source,\n\t\t\t[\n\t\t\t\t{\n\t\t\t\t\tidentifier,\n\t\t\t\t\tasDefault: mapper.default,\n\t\t\t\t},\n\t\t\t],\n\t\t\ttrue,\n\t\t);\n\n\t\tif (result) {\n\t\t\tprepend.push(result);\n\t\t}\n\t} else {\n\t\tprepend.push(`type ContextType = ${mapper.type}`);\n\t}\n\n\tprepend.push('export type { ContextType }');\n\n\treturn {\n\t\tcontent: '',\n\t\tprepend: prepend,\n\t};\n};\n\nexport default { plugin };\n","import { join, relative, resolve } from '@baeta/util-path';\nimport type { Types } from '@graphql-codegen/plugin-helpers';\nimport { BaseVisitor, getConfigValue } from '@graphql-codegen/visitor-plugin-common';\nimport type { Source } from '@graphql-tools/utils';\nimport {\n\ttype DocumentNode,\n\ttype ObjectTypeDefinitionNode,\n\ttype UnionTypeDefinitionNode,\n\ttype UnionTypeExtensionNode,\n\tconcatAST,\n\tisScalarType,\n} from 'graphql';\nimport { buildModule } from './builder.ts';\nimport type { ModulesConfig } from './config.ts';\nimport {\n\tcollectObjectFieldTypesAndArguments,\n\tgroupSourcesByModule,\n\tisGraphQLPrimitive,\n\tnormalize,\n\tstripFilename,\n} from './utils.ts';\n\nexport const preset: Types.OutputPreset<ModulesConfig> = {\n\tbuildGeneratesSection: (options) => {\n\t\tconst { baseOutputDir } = options;\n\t\tconst { baseTypesPath, extensionsPath, encapsulateModuleTypes } = options.presetConfig;\n\n\t\tconst requireRootResolvers = getConfigValue(options?.presetConfig.requireRootResolvers, false);\n\n\t\tconst cwd = resolve(options.presetConfig.cwd || process.cwd());\n\t\tconst importTypesNamespace = options.presetConfig.importTypesNamespace || 'Types';\n\n\t\tif (!baseTypesPath) {\n\t\t\tthrow new Error(\n\t\t\t\t`Preset \"graphql-modules\" requires you to specify \"baseTypesPath\" configuration and point it to your base types file (generated by \"typescript\" plugin)!`,\n\t\t\t);\n\t\t}\n\n\t\tif (!options.schemaAst?.extensions.sources) {\n\t\t\tthrow new Error(`Preset \"graphql-modules\" requires to use GraphQL SDL`);\n\t\t}\n\n\t\tconst extensions = options.schemaAst?.extensions;\n\t\tconst sources = (extensions?.extendedSources ?? []) as Source[];\n\t\tconst sourcesByModuleMap = groupSourcesByModule(sources, baseOutputDir);\n\t\tconst modules = Object.keys(sourcesByModuleMap);\n\n\t\tconst baseVisitor = new BaseVisitor(options.config, {});\n\t\tconst { fieldTypes, fieldArguments } = collectObjectFieldTypesAndArguments(options.schemaAst);\n\n\t\t// One file with an output from all plugins\n\t\tconst baseOutput: Types.GenerateOptions = {\n\t\t\tfilename: resolve(cwd, baseOutputDir, baseTypesPath),\n\t\t\tschema: options.schema,\n\t\t\tdocuments: options.documents,\n\t\t\tplugins: [\n\t\t\t\t...options.plugins,\n\t\t\t\t{\n\t\t\t\t\t'modules-exported-scalars': {},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t'modules-exported-picks': {},\n\t\t\t\t},\n\t\t\t],\n\t\t\tpluginMap: {\n\t\t\t\t...options.pluginMap,\n\t\t\t\t'modules-exported-scalars': {\n\t\t\t\t\tplugin: (schema) => {\n\t\t\t\t\t\tconst typeMap = schema.getTypeMap();\n\n\t\t\t\t\t\treturn Object.keys(typeMap)\n\t\t\t\t\t\t\t.map((t) => {\n\t\t\t\t\t\t\t\tif (t && typeMap[t] && isScalarType(typeMap[t]) && !isGraphQLPrimitive(t)) {\n\t\t\t\t\t\t\t\t\tconst convertedName = baseVisitor.convertName(t);\n\t\t\t\t\t\t\t\t\treturn `export type ${convertedName} = Scalars[\"${t}\"];`;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\treturn null;\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t.filter(Boolean)\n\t\t\t\t\t\t\t.join('\\n');\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t'modules-exported-picks': {\n\t\t\t\t\tplugin: (schema) => {\n\t\t\t\t\t\tconst typePicks: string[] = [];\n\t\t\t\t\t\tconst unionPicks: string[] = [];\n\t\t\t\t\t\tconst unionResults: string[] = [];\n\t\t\t\t\t\tconst interfacePicks: string[] = [];\n\t\t\t\t\t\tconst interfaceResults: string[] = [];\n\n\t\t\t\t\t\tconst unionTypesMap: Record<string, string[] | undefined> = {};\n\t\t\t\t\t\tconst interfacesTypesMap: Record<string, string[] | undefined> = {};\n\n\t\t\t\t\t\tfor (const moduleName of modules) {\n\t\t\t\t\t\t\tconst sources = sourcesByModuleMap[moduleName];\n\t\t\t\t\t\t\tconst documents = sources.map((source) => source.document) as DocumentNode[];\n\t\t\t\t\t\t\tconst moduleDocument = concatAST(documents);\n\n\t\t\t\t\t\t\tconst types = moduleDocument.definitions.filter(\n\t\t\t\t\t\t\t\t(def) => def.kind === 'ObjectTypeDefinition',\n\t\t\t\t\t\t\t) as ObjectTypeDefinitionNode[];\n\n\t\t\t\t\t\t\tconst unionsDefinition = moduleDocument.definitions.filter(\n\t\t\t\t\t\t\t\t(def) => def.kind === 'UnionTypeDefinition',\n\t\t\t\t\t\t\t) as UnionTypeDefinitionNode[];\n\n\t\t\t\t\t\t\tconst unionsExtensions = moduleDocument.definitions.filter(\n\t\t\t\t\t\t\t\t(def) => def.kind === 'UnionTypeExtension',\n\t\t\t\t\t\t\t) as UnionTypeExtensionNode[];\n\n\t\t\t\t\t\t\tconst unions = [...unionsDefinition, ...unionsExtensions];\n\n\t\t\t\t\t\t\tfor (const type of types) {\n\t\t\t\t\t\t\t\tconst name = type.name.value;\n\n\t\t\t\t\t\t\t\tfor (const interfaceNode of type.interfaces ?? []) {\n\t\t\t\t\t\t\t\t\tconst interfaceName = interfaceNode.name.value;\n\n\t\t\t\t\t\t\t\t\tif (interfacesTypesMap[interfaceName] == null) {\n\t\t\t\t\t\t\t\t\t\tinterfacesTypesMap[interfaceName] = [];\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tinterfacesTypesMap[interfaceName]?.push(name);\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tif (name === 'Query' || name === 'Mutation' || name === 'Subscription') {\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tconst fields = type.fields ?? [];\n\n\t\t\t\t\t\t\t\tif (fields.length === 0) {\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tconst fieldNames = fields.map((f) => `\"${f.name.value}\"`).join(' | ');\n\n\t\t\t\t\t\t\t\ttypePicks.push(` ${name}: ${fieldNames};`);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tfor (const union of unions) {\n\t\t\t\t\t\t\t\tconst types = union.types?.map((t) => t.name.value) ?? [];\n\n\t\t\t\t\t\t\t\tif (unionTypesMap[union.name.value] == null) {\n\t\t\t\t\t\t\t\t\tunionTypesMap[union.name.value] = [];\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tunionTypesMap[union.name.value]?.push(...types);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tfor (const unionName in unionTypesMap) {\n\t\t\t\t\t\t\tconst types = unionTypesMap[unionName];\n\n\t\t\t\t\t\t\tif (types == null || types.length === 0) {\n\t\t\t\t\t\t\t\tunionPicks.push(` ${unionName}: never;`);\n\t\t\t\t\t\t\t\tunionResults.push(` ${unionName}: null;`);\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst typePicks = types.map((t) => {\n\t\t\t\t\t\t\t\tconst normalizedTypeName = baseVisitor.convertName(t, {\n\t\t\t\t\t\t\t\t\tuseTypesSuffix: true,\n\t\t\t\t\t\t\t\t\tuseTypesPrefix: true,\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\treturn `Pick<${normalizedTypeName}, DefinedFieldsWithoutExtensions[\"${t}\"] | \"__typename\">`;\n\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\tconst resultPicks = types.map((t) => `\"${t}\"`);\n\n\t\t\t\t\t\t\tunionPicks.push(` ${unionName}: ${typePicks.join(' | ')};`);\n\t\t\t\t\t\t\tunionResults.push(` ${unionName}: ${resultPicks.join(' | ')} | null;`);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tfor (const interfaceName in interfacesTypesMap) {\n\t\t\t\t\t\t\tconst types = interfacesTypesMap[interfaceName];\n\n\t\t\t\t\t\t\tif (types == null || types.length === 0) {\n\t\t\t\t\t\t\t\tinterfacePicks.push(` ${interfaceName}: never;`);\n\t\t\t\t\t\t\t\tinterfaceResults.push(` ${interfaceName}: null;`);\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst typePicks = types.map((t) => {\n\t\t\t\t\t\t\t\tconst normalizedTypeName = baseVisitor.convertName(t, {\n\t\t\t\t\t\t\t\t\tuseTypesSuffix: true,\n\t\t\t\t\t\t\t\t\tuseTypesPrefix: true,\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\treturn `Pick<${normalizedTypeName}, DefinedFieldsWithoutExtensions[\"${t}\"] | \"__typename\">`;\n\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\tconst resultPicks = types.map((t) => `\"${t}\"`);\n\n\t\t\t\t\t\t\tinterfacePicks.push(` ${interfaceName}: ${typePicks.join(' | ')};`);\n\t\t\t\t\t\t\tinterfaceResults.push(` ${interfaceName}: ${resultPicks.join(' | ')} | null;`);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst fieldsDefinition = `export type DefinedFieldsWithoutExtensions = {\\n${typePicks.join('\\n')}\\n};`;\n\t\t\t\t\t\tconst unionsDefinition = `export type DefinedUnionsWithoutExtensions = {\\n${unionPicks.join('\\n')}\\n};`;\n\t\t\t\t\t\tconst unionsResultsDefinition = `export type DefinedUnionsResults = {\\n${unionResults.join('\\n')}\\n};`;\n\t\t\t\t\t\tconst interfacesDefinition = `export type DefinedInterfacesWithoutExtensions = {\\n${interfacePicks.join('\\n')}\\n};`;\n\t\t\t\t\t\tconst interfacesResultsDefinition = `export type DefinedInterfacesResults = {\\n${interfaceResults.join(\n\t\t\t\t\t\t\t'\\n',\n\t\t\t\t\t\t)}\\n};`;\n\n\t\t\t\t\t\tconst result = [\n\t\t\t\t\t\t\tfieldsDefinition,\n\t\t\t\t\t\t\tunionsDefinition,\n\t\t\t\t\t\t\tunionsResultsDefinition,\n\t\t\t\t\t\t\tinterfacesDefinition,\n\t\t\t\t\t\t\tinterfacesResultsDefinition,\n\t\t\t\t\t\t].join('\\n\\n');\n\n\t\t\t\t\t\treturn `\\n${result}\\n`;\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\tconfig: {\n\t\t\t\t...options.config,\n\t\t\t\tenumsAsTypes: true,\n\t\t\t},\n\t\t\tschemaAst: options.schemaAst,\n\t\t};\n\n\t\tconst baseTypesFilename = baseTypesPath.replace(/\\.(js|ts|d.ts)$/, '');\n\t\tconst baseTypesDir = stripFilename(baseOutput.filename);\n\n\t\t// One file per each module\n\t\tconst outputs: Types.GenerateOptions[] = modules.map((moduleName) => {\n\t\t\tconst filename = resolve(cwd, baseOutputDir, moduleName, options.presetConfig.filename);\n\t\t\tconst dirpath = stripFilename(filename);\n\t\t\tconst relativePath = relative(dirpath, baseTypesDir);\n\t\t\tconst importPath =\n\t\t\t\toptions.presetConfig.importBaseTypesFrom ||\n\t\t\t\tnormalize(join(relativePath, baseTypesFilename));\n\t\t\tconst sources = sourcesByModuleMap[moduleName];\n\n\t\t\tconst documents = sources.map((source) => source.document) as DocumentNode[];\n\n\t\t\tconst moduleDocument = concatAST(documents);\n\n\t\t\tconst shouldDeclare = filename.endsWith('.d.ts');\n\n\t\t\treturn {\n\t\t\t\tfilename,\n\t\t\t\tschema: options.schema,\n\t\t\t\tdocuments: [],\n\t\t\t\tplugins: [\n\t\t\t\t\t...options.plugins.filter((p) => typeof p === 'object' && !!p.add),\n\t\t\t\t\t{\n\t\t\t\t\t\t'graphql-modules-plugin': {},\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tpluginMap: {\n\t\t\t\t\t...options.pluginMap,\n\t\t\t\t\t'graphql-modules-plugin': {\n\t\t\t\t\t\tplugin: (schema) =>\n\t\t\t\t\t\t\tbuildModule(moduleName, moduleDocument, {\n\t\t\t\t\t\t\t\timportNamespace: importTypesNamespace,\n\t\t\t\t\t\t\t\timportPath,\n\t\t\t\t\t\t\t\tencapsulate: encapsulateModuleTypes || 'namespace',\n\t\t\t\t\t\t\t\trequireRootResolvers,\n\t\t\t\t\t\t\t\tshouldDeclare,\n\t\t\t\t\t\t\t\tschema,\n\t\t\t\t\t\t\t\tbaseVisitor,\n\t\t\t\t\t\t\t\tuseGraphQLModules: false,\n\t\t\t\t\t\t\t\tfieldTypes,\n\t\t\t\t\t\t\t\tfieldArguments,\n\t\t\t\t\t\t\t\textensionsPath,\n\t\t\t\t\t\t\t\trootTypes: [\n\t\t\t\t\t\t\t\t\tschema.getQueryType()?.name || '',\n\t\t\t\t\t\t\t\t\tschema.getMutationType()?.name || '',\n\t\t\t\t\t\t\t\t\tschema.getSubscriptionType()?.name || '',\n\t\t\t\t\t\t\t\t].filter(Boolean),\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tconfig: options.config,\n\t\t\t\tschemaAst: options.schemaAst,\n\t\t\t};\n\t\t});\n\n\t\treturn [baseOutput].concat(outputs);\n\t},\n};\n\nexport default preset;\n","import type { BaseVisitor } from '@graphql-codegen/visitor-plugin-common';\nimport { pascalCase } from 'change-case-all';\nimport {\n\ttype DocumentNode,\n\ttype EnumTypeDefinitionNode,\n\ttype EnumTypeExtensionNode,\n\ttype GraphQLSchema,\n\ttype InputObjectTypeDefinitionNode,\n\ttype InputObjectTypeExtensionNode,\n\ttype InterfaceTypeDefinitionNode,\n\ttype InterfaceTypeExtensionNode,\n\tKind,\n\ttype ObjectTypeDefinitionNode,\n\ttype ObjectTypeExtensionNode,\n\ttype TypeDefinitionNode,\n\ttype TypeExtensionNode,\n\ttype UnionTypeDefinitionNode,\n\tisInterfaceType,\n\tisScalarType,\n\tisUnionType,\n\tvisit,\n} from 'graphql';\nimport type { ModulesConfig } from './config.ts';\nimport {\n\tbuildBlock,\n\tcollectUsedTypes,\n\tconcatByKey,\n\tcreateObject,\n\tindent,\n\tpushUnique,\n\tunique,\n\tuniqueByKey,\n\twithQuotes,\n} from './utils.ts';\n\ntype RegistryKeys = 'objects' | 'inputs' | 'interfaces' | 'scalars' | 'unions' | 'enums';\ntype Registry = Record<RegistryKeys, string[]>;\nconst registryKeys: RegistryKeys[] = [\n\t'objects',\n\t'inputs',\n\t'interfaces',\n\t'scalars',\n\t'unions',\n\t'enums',\n];\nconst resolverKeys: Extract<RegistryKeys, 'objects' | 'enums' | 'scalars'>[] = [\n\t'scalars',\n\t'objects',\n\t'enums',\n];\n\nexport function buildModule(\n\tname: string,\n\tdoc: DocumentNode,\n\t{\n\t\timportNamespace,\n\t\timportPath,\n\t\tencapsulate,\n\t\trequireRootResolvers,\n\t\tshouldDeclare,\n\t\trootTypes,\n\t\tschema,\n\t\tbaseVisitor,\n\t\tfieldTypes,\n\t\tfieldArguments,\n\t\textensionsPath,\n\t}: {\n\t\timportNamespace: string;\n\t\timportPath: string;\n\t\tencapsulate: ModulesConfig['encapsulateModuleTypes'];\n\t\trequireRootResolvers: ModulesConfig['requireRootResolvers'];\n\t\tshouldDeclare: boolean;\n\t\trootTypes: string[];\n\t\tbaseVisitor: BaseVisitor;\n\t\tschema?: GraphQLSchema;\n\t\tuseGraphQLModules: boolean;\n\t\tfieldTypes: Record<string, Record<string, string>>;\n\t\tfieldArguments: Record<string, Record<string, boolean>>;\n\t\textensionsPath?: string;\n\t},\n): string {\n\tconst picks: Record<RegistryKeys, Record<string, string[]>> = createObject(\n\t\tregistryKeys,\n\t\t() => ({}),\n\t);\n\tconst defined: Registry = createObject(registryKeys, () => []);\n\tconst extended: Registry = createObject(registryKeys, () => []);\n\n\t// List of types used in objects, fields, arguments etc\n\tconst usedTypes = collectUsedTypes(doc);\n\n\tvisit(doc, {\n\t\tObjectTypeDefinition(node) {\n\t\t\tcollectTypeDefinition(node);\n\t\t},\n\t\tObjectTypeExtension(node) {\n\t\t\tcollectTypeExtension(node);\n\t\t},\n\t\tInputObjectTypeDefinition(node) {\n\t\t\tcollectTypeDefinition(node);\n\t\t},\n\t\tInputObjectTypeExtension(node) {\n\t\t\tcollectTypeExtension(node);\n\t\t},\n\t\tInterfaceTypeDefinition(node) {\n\t\t\tcollectTypeDefinition(node);\n\t\t},\n\t\tInterfaceTypeExtension(node) {\n\t\t\tcollectTypeExtension(node);\n\t\t},\n\t\tScalarTypeDefinition(node) {\n\t\t\tcollectTypeDefinition(node);\n\t\t},\n\t\tUnionTypeDefinition(node) {\n\t\t\tcollectTypeDefinition(node);\n\t\t},\n\t\tUnionTypeExtension(node) {\n\t\t\tcollectTypeExtension(node);\n\t\t},\n\t\tEnumTypeDefinition(node) {\n\t\t\tcollectTypeDefinition(node);\n\t\t},\n\t\tEnumTypeExtension(node) {\n\t\t\tcollectTypeExtension(node);\n\t\t},\n\t});\n\n\t// Defined and Extended types\n\tconst visited: Registry = createObject(registryKeys, (key) =>\n\t\tconcatByKey(defined, extended, key),\n\t);\n\n\t// Types that are not defined or extended in a module, they come from other modules\n\tconst external: Registry = createObject(registryKeys, (key) =>\n\t\tuniqueByKey(extended, defined, key),\n\t);\n\n\t//\n\t//\n\t//\n\t// Prints\n\t//\n\t//\n\t//\n\n\t// An actual output\n\tconst imports = [\n\t\t`import * as ${importNamespace} from \"${importPath}\";`,\n\t\t'import { DocumentNode } from \"graphql\";',\n\t\t'import * as Baeta from \"@baeta/core/sdk\";',\n\t];\n\n\tif (extensionsPath) {\n\t\timports.push(`import baetaExtensions from \"${extensionsPath}\";`);\n\t}\n\n\timports.push('\\n');\n\n\tlet content = [\n\t\tprintDefinedFields(),\n\t\tprintDefinedEnumValues(),\n\t\tprintDefinedInputFields(),\n\t\tprintSchemaTypes(usedTypes),\n\t\tprintMetadata(),\n\t]\n\t\t.filter(Boolean)\n\t\t.join('\\n\\n');\n\n\tconst moduleNamespace = baseVisitor.convertName(name, {\n\t\tsuffix: 'Module',\n\t\tuseTypesPrefix: false,\n\t\tuseTypesSuffix: false,\n\t});\n\n\tif (encapsulate === 'namespace') {\n\t\tcontent = `${shouldDeclare ? 'declare' : 'export'} namespace ${baseVisitor.convertName(name, {\n\t\t\tsuffix: 'Module',\n\t\t\tuseTypesPrefix: false,\n\t\t\tuseTypesSuffix: false,\n\t\t})} {\\n${shouldDeclare ? `${indent(2)(imports.join('\\n'))}\\n` : ''}${indent(2)(content)}\\n}`;\n\t}\n\n\treturn [...(shouldDeclare ? [] : imports), content, printFactoryMethod()]\n\t\t.filter(Boolean)\n\t\t.join('\\n');\n\n\tfunction printMetadata() {\n\t\treturn `export namespace ModuleMetadata {\n export const id = '${name}';\n export const dirname = './${name}';\n export const typedef = ${JSON.stringify(doc)} as unknown as DocumentNode;\n ${printBaetaManager()}\n}`;\n\t}\n\n\t/**\n\t * A dictionary of fields to pick from an object\n\t */\n\tfunction printDefinedFields() {\n\t\treturn buildBlock({\n\t\t\tname: 'interface DefinedFields',\n\t\t\tlines: [...visited.objects, ...visited.interfaces].map(\n\t\t\t\t(typeName) =>\n\t\t\t\t\t`${typeName}: ${printPicks(typeName, {\n\t\t\t\t\t\t...picks.objects,\n\t\t\t\t\t\t...picks.interfaces,\n\t\t\t\t\t})};`,\n\t\t\t),\n\t\t});\n\t}\n\n\tfunction printFactoryMethod() {\n\t\tconst name = moduleNamespace.slice(0, moduleNamespace.length - 6);\n\t\tconst createModuleFn = `create${name}Module`;\n\t\tconst getModuleFn = `get${name}Module`;\n\t\tconst extensionsArg = extensionsPath ? ', baetaExtensions' : '';\n\n\t\treturn `\nexport const ${createModuleFn} = () => Baeta.createModuleManager(ModuleMetadata${extensionsArg});\nexport const ${getModuleFn} = Baeta.createSingletonModule(${createModuleFn});\n`;\n\t}\n\n\t/**\n\t * Baeta manager\n\t */\n\n\tfunction printObjectFieldResolverBuilder(typeName: string, field: string) {\n\t\tconst parentType = getParentType(typeName);\n\t\tconst resultType = getResultType(typeName, field);\n\t\tconst argumentsType = getArgsType(typeName, field);\n\t\tconst contextType = getContextType();\n\t\treturn `${field}: module.createResolverBuilder<${resultType}, ${parentType}, ${contextType}, ${argumentsType}>(\"${typeName}\", \"${field}\"),`;\n\t}\n\n\tfunction printObjectResolverBuilder(typeName: string, objects: Record<string, string[]>) {\n\t\tconst fields =\n\t\t\tobjects[typeName]\n\t\t\t\t?.filter(unique)\n\t\t\t\t.map((field) => printObjectFieldResolverBuilder(typeName, field)) ?? [];\n\n\t\tif (fields.length === 0) {\n\t\t\treturn '';\n\t\t}\n\n\t\tconst parentType = getParentType(typeName);\n\t\tconst contextType = getContextType();\n\n\t\tconst addons = [`...module.createTypeMethods<${parentType}, ${contextType}>(\"${typeName}\"),`];\n\t\tconst contentBody = [...addons, ...fields].map(indent(2)).join('\\n');\n\t\tconst content = `{\\n${contentBody}\\n}`;\n\t\treturn `${typeName}: ${content},`;\n\t}\n\n\tfunction printSubscriptionFieldBuilder(field: string) {\n\t\tconst parentType = getParentType('Subscription');\n\t\tconst resultType = getResultType('Subscription', field);\n\t\tconst argumentsType = getArgsType('Subscription', field);\n\t\tconst contextType = getContextType();\n\t\treturn `${field}: module.createSubscriptionBuilder<${resultType}, ${parentType}, ${contextType}, ${argumentsType}>(\"${field}\"),`;\n\t}\n\n\tfunction printSubscriptionObjectBuilder() {\n\t\tconst subscriptions = picks.objects.Subscription?.filter(unique) ?? [];\n\n\t\tif (subscriptions.length === 0) {\n\t\t\treturn '';\n\t\t}\n\n\t\tconst fields = subscriptions.map((subscription) => printSubscriptionFieldBuilder(subscription));\n\n\t\tconst parentType = getParentType('Subscription');\n\t\tconst contextType = getContextType();\n\t\tconst addons = [`...module.createSubscriptionMethods<${parentType}, ${contextType}>(),`];\n\t\tconst contentBody = [...addons, ...fields].map(indent(2)).join('\\n');\n\n\t\tconst content = `{\\n${contentBody}\\n}`;\n\t\treturn `Subscription: ${content},`;\n\t}\n\n\tfunction printScalarBuilder() {\n\t\tconst scalars = visited.scalars;\n\t\tif (scalars.length === 0) {\n\t\t\treturn '';\n\t\t}\n\n\t\tconst fields = scalars.map((scalar) => `${scalar}: module.createScalarBuilder(\"${scalar}\"),`);\n\t\tconst content = fields.map(indent(2)).join('\\n');\n\t\treturn `Scalar: {\\n${content}\\n},`;\n\t}\n\n\tfunction printTypenameResolverBuilder(\n\t\tname: string,\n\t\tresultNamespace: string,\n\t\tvalueNamespace: string,\n\t) {\n\t\tconst resultType = `${importNamespace}.${resultNamespace}[\"${name}\"]`;\n\t\tconst valueType = `${importNamespace}.${valueNamespace}[\"${name}\"]`;\n\t\tconst contextType = getContextType();\n\t\tconst resolver = `$resolveType: module.createResolveType<${resultType}, ${valueType}, ${contextType}>(\"${name}\"),`;\n\t\treturn `${name}: {\\n${indent(2)(resolver)}\\n},`;\n\t}\n\n\tfunction printInterfaceBuilder() {\n\t\tconst interfaces = defined.interfaces;\n\n\t\tif (interfaces.length === 0) {\n\t\t\treturn '';\n\t\t}\n\n\t\treturn interfaces\n\t\t\t.map((interfaceName) =>\n\t\t\t\tprintTypenameResolverBuilder(\n\t\t\t\t\tinterfaceName,\n\t\t\t\t\t'DefinedInterfacesResults',\n\t\t\t\t\t'DefinedInterfacesWithoutExtensions',\n\t\t\t\t),\n\t\t\t)\n\t\t\t.join('\\n');\n\t}\n\n\tfunction printUnionBuilder() {\n\t\tconst unions = defined.unions;\n\n\t\tif (unions.length === 0) {\n\t\t\treturn '';\n\t\t}\n\n\t\treturn unions\n\t\t\t.map((unionName) =>\n\t\t\t\tprintTypenameResolverBuilder(\n\t\t\t\t\tunionName,\n\t\t\t\t\t'DefinedUnionsResults',\n\t\t\t\t\t'DefinedUnionsWithoutExtensions',\n\t\t\t\t),\n\t\t\t)\n\t\t\t.join('\\n');\n\t}\n\n\tfunction printBaetaManager() {\n\t\tconst objects = visited.objects\n\t\t\t.filter((type) => type !== 'Subscription')\n\t\t\t.map((typeName) => printObjectResolverBuilder(typeName, picks.objects))\n\t\t\t.filter(Boolean);\n\n\t\tconst contextType = getContextType();\n\t\tconst addons = [`...module.createModuleMethods<${contextType}>(),`];\n\n\t\tconst bodyFields = [\n\t\t\t...addons,\n\t\t\t...objects,\n\t\t\tprintScalarBuilder(),\n\t\t\tprintSubscriptionObjectBuilder(),\n\t\t\tprintInterfaceBuilder(),\n\t\t\tprintUnionBuilder(),\n\t\t];\n\n\t\tconst body = bodyFields.filter(Boolean).map(indent(6)).join('\\n');\n\t\tconst content = `{\\n${body}\\n }`;\n\n\t\treturn `\n export function createManager(module: Baeta.ModuleBuilder) {\n return ${content};\n }`;\n\t}\n\n\t/**\n\t * A dictionary of values to pick from an enum\n\t */\n\tfunction printDefinedEnumValues() {\n\t\treturn buildBlock({\n\t\t\tname: 'interface DefinedEnumValues',\n\t\t\tlines: visited.enums.map((typeName) => `${typeName}: ${printPicks(typeName, picks.enums)};`),\n\t\t});\n\t}\n\n\tfunction encapsulateTypeName(typeName: string): string {\n\t\tif (encapsulate === 'prefix') {\n\t\t\treturn `${pascalCase(name)}_${typeName}`;\n\t\t}\n\n\t\treturn typeName;\n\t}\n\n\t/**\n\t * A dictionary of fields to pick from an input\n\t */\n\tfunction printDefinedInputFields() {\n\t\treturn buildBlock({\n\t\t\tname: 'interface DefinedInputFields',\n\t\t\tlines: visited.inputs.map(\n\t\t\t\t(typeName) => `${typeName}: ${printPicks(typeName, picks.inputs)};`,\n\t\t\t),\n\t\t});\n\t}\n\n\t/**\n\t * Prints signatures of schema types with picks\n\t */\n\tfunction printSchemaTypes(types: string[]) {\n\t\treturn types\n\t\t\t.filter((type) => !visited.scalars.includes(type))\n\t\t\t.map(printExportType)\n\t\t\t.join('\\n');\n\t}\n\n\tfunction printPicks(typeName: string, records: Record<string, string[]>): string {\n\t\treturn records[typeName].filter(unique).map(withQuotes).join(' | ');\n\t}\n\n\tfunction printTypeBody(typeName: string): string {\n\t\tconst normalizedTypeName = baseVisitor.convertName(typeName, {\n\t\t\tuseTypesSuffix: true,\n\t\t\tuseTypesPrefix: true,\n\t\t});\n\n\t\tconst coreType = `${importNamespace}.${normalizedTypeName}`;\n\n\t\tif (external.enums.includes(typeName) || external.objects.includes(typeName)) {\n\t\t\tif (schema && isScalarType(schema.getType(typeName))) {\n\t\t\t\treturn `${importNamespace}.Scalars['${typeName}']`;\n\t\t\t}\n\n\t\t\treturn `Pick<${coreType}, ${importNamespace}.DefinedFieldsWithoutExtensions[\"${typeName}\"]>`;\n\t\t}\n\n\t\tif (external.unions.includes(typeName)) {\n\t\t\treturn `${importNamespace}.DefinedUnionsWithoutExtensions[\"${typeName}\"]`;\n\t\t}\n\n\t\tif (external.interfaces.includes(typeName)) {\n\t\t\treturn `Pick<${coreType}, ${importNamespace}.DefinedFieldsWithoutExtensions[\"${typeName}\"]>`;\n\t\t}\n\n\t\tif (defined.enums.includes(typeName) && picks.enums[typeName]) {\n\t\t\treturn `DefinedEnumValues['${typeName}']`;\n\t\t}\n\n\t\tif (defined.unions.includes(typeName) && picks.unions[typeName]) {\n\t\t\treturn `${importNamespace}.DefinedUnionsWithoutExtensions[\"${typeName}\"]`;\n\t\t}\n\n\t\tif (defined.objects.includes(typeName) && picks.objects[typeName]) {\n\t\t\treturn `Pick<${coreType}, DefinedFields['${typeName}']>`;\n\t\t}\n\n\t\tif (defined.interfaces.includes(typeName) && picks.interfaces[typeName]) {\n\t\t\treturn `${importNamespace}.DefinedInterfacesWithoutExtensions[\"${typeName}\"]`;\n\t\t}\n\n\t\tif (defined.inputs.includes(typeName) && picks.inputs[typeName]) {\n\t\t\treturn `Pick<${coreType}, DefinedInputFields['${typeName}']>`;\n\t\t}\n\n\t\tif (isScalarType(schema?.getType(typeName))) {\n\t\t\treturn coreType;\n\t\t}\n\n\t\tif (isInterfaceType(schema?.getType(typeName))) {\n\t\t\treturn `${importNamespace}.DefinedInterfacesWithoutExtensions[\"${typeName}\"]`;\n\t\t}\n\n\t\tif (isUnionType(schema?.getType(typeName))) {\n\t\t\treturn `${importNamespace}.DefinedUnionsWithoutExtensions[\"${typeName}\"]`;\n\t\t}\n\n\t\treturn `Pick<${coreType}, ${importNamespace}.DefinedFieldsWithoutExtensions[\"${typeName}\"]>`;\n\t}\n\n\tfunction printExportType(typeName: string): string {\n\t\treturn `export type ${encapsulateTypeName(typeName)} = ${printTypeBody(typeName)};`;\n\t}\n\n\t//\n\t//\n\t//\n\t// Utils\n\t//\n\t//\n\t//\n\n\tfunction collectFields(\n\t\tnode:\n\t\t\t| ObjectTypeDefinitionNode\n\t\t\t| ObjectTypeExtensionNode\n\t\t\t| InterfaceTypeDefinitionNode\n\t\t\t| InterfaceTypeExtensionNode\n\t\t\t| InputObjectTypeDefinitionNode\n\t\t\t| InputObjectTypeExtensionNode,\n\t\tpicksObj: Record<string, string[]>,\n\t) {\n\t\tconst name = node.name.value;\n\n\t\tif (node.fields) {\n\t\t\tif (!picksObj[name]) {\n\t\t\t\tpicksObj[name] = [];\n\t\t\t}\n\n\t\t\tfor (const field of node.fields) {\n\t\t\t\tpicksObj[name].push(field.name.value);\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction collectValuesFromEnum(node: EnumTypeDefinitionNode | EnumTypeExtensionNode) {\n\t\tconst name = node.name.value;\n\n\t\tif (node.values) {\n\t\t\tif (!picks.enums[name]) {\n\t\t\t\tpicks.enums[name] = [];\n\t\t\t}\n\n\t\t\tfor (const field of node.values) {\n\t\t\t\tpicks.enums[name].push(field.name.value);\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction collectUnionTypes(node: UnionTypeDefinitionNode) {\n\t\tconst name = node.name.value;\n\n\t\tif (node.types) {\n\t\t\tif (!picks.unions[name]) {\n\t\t\t\tpicks.unions[name] = [];\n\t\t\t}\n\n\t\t\tfor (const type of node.types) {\n\t\t\t\tpicks.unions[name].push(type.name.value);\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction collectTypeDefinition(node: TypeDefinitionNode) {\n\t\tconst name = node.name.value;\n\n\t\tswitch (node.kind) {\n\t\t\tcase Kind.OBJECT_TYPE_DEFINITION: {\n\t\t\t\tdefined.objects.push(name);\n\t\t\t\tcollectFields(node, picks.objects);\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase Kind.ENUM_TYPE_DEFINITION: {\n\t\t\t\tdefined.enums.push(name);\n\t\t\t\tcollectValuesFromEnum(node);\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase Kind.INPUT_OBJECT_TYPE_DEFINITION: {\n\t\t\t\tdefined.inputs.push(name);\n\t\t\t\tcollectFields(node, picks.inputs);\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase Kind.SCALAR_TYPE_DEFINITION: {\n\t\t\t\tdefined.scalars.push(name);\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase Kind.INTERFACE_TYPE_DEFINITION: {\n\t\t\t\tdefined.interfaces.push(name);\n\t\t\t\tcollectFields(node, picks.interfaces);\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase Kind.UNION_TYPE_DEFINITION: {\n\t\t\t\tdefined.unions.push(name);\n\t\t\t\tcollectUnionTypes(node);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction collectTypeExtension(node: TypeExtensionNode) {\n\t\tconst name = node.name.value;\n\n\t\tswitch (node.kind) {\n\t\t\tcase Kind.OBJECT_TYPE_EXTENSION: {\n\t\t\t\tcollectFields(node, picks.objects);\n\t\t\t\t// Do not include root types as extensions\n\t\t\t\t// so we can use them in DefinedFields\n\t\t\t\tif (rootTypes.includes(name)) {\n\t\t\t\t\tpushUnique(defined.objects, name);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tpushUnique(extended.objects, name);\n\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase Kind.ENUM_TYPE_EXTENSION: {\n\t\t\t\tcollectValuesFromEnum(node);\n\t\t\t\tpushUnique(extended.enums, name);\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase Kind.INPUT_OBJECT_TYPE_EXTENSION: {\n\t\t\t\tcollectFields(node, picks.inputs);\n\t\t\t\tpushUnique(extended.inputs, name);\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase Kind.INTERFACE_TYPE_EXTENSION: {\n\t\t\t\tcollectFields(node, picks.interfaces);\n\t\t\t\tpushUnique(extended.interfaces, name);\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase Kind.UNION_TYPE_EXTENSION: {\n\t\t\t\tpushUnique(extended.unions, name);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction getParentType(type: string) {\n\t\tif (['Query', 'Mutation', 'Subscription'].includes(type)) {\n\t\t\treturn '{}';\n\t\t}\n\t\treturn type;\n\t}\n\n\tfunction getResultType(type: string, field: string) {\n\t\treturn fieldTypes?.[type]?.[field] || '{}';\n\t}\n\n\tfunction getArgsType(type: string, field: string) {\n\t\tconst hasArgs = fieldArguments?.[type]?.[field] ?? false;\n\t\tif (!hasArgs) {\n\t\t\treturn '{}';\n\t\t}\n\t\tconst fieldUpper = field[0].toUpperCase() + field.slice(1);\n\t\treturn `Types.${type}${fieldUpper}Args`;\n\t}\n\n\tfunction getContextType() {\n\t\treturn 'Types.ContextType';\n\t}\n}\n","import { platform } from 'node:os';\nimport { getBaseType } from '@graphql-codegen/plugin-helpers';\nimport { DEFAULT_SCALARS, wrapTypeWithModifiers } from '@graphql-codegen/visitor-plugin-common';\nimport type { Source } from '@graphql-tools/utils';\nimport {\n\ttype DefinitionNode,\n\ttype DocumentNode,\n\ttype FieldDefinitionNode,\n\ttype GraphQLFieldMap,\n\ttype GraphQLObjectType,\n\ttype GraphQLSchema,\n\ttype InputValueDefinitionNode,\n\tKind,\n\ttype NamedTypeNode,\n\ttype ObjectTypeDefinitionNode,\n\ttype TypeNode,\n} from 'graphql';\nimport parse from 'parse-filepath';\n\nconst sep = '/';\n\n/**\n * Searches every node to collect used types\n */\nexport function collectUsedTypes(doc: DocumentNode): string[] {\n\tconst used: string[] = [];\n\n\tfor (const definition of doc.definitions) {\n\t\tfindRelated(definition);\n\t}\n\n\tfunction markAsUsed(type: string) {\n\t\tpushUnique(used, type);\n\t}\n\n\tfunction findRelated(\n\t\tnode: DefinitionNode | FieldDefinitionNode | InputValueDefinitionNode | NamedTypeNode,\n\t) {\n\t\tif (node.kind === Kind.OBJECT_TYPE_DEFINITION || node.kind === Kind.OBJECT_TYPE_EXTENSION) {\n\t\t\t// Object\n\t\t\tmarkAsUsed(node.name.value);\n\n\t\t\tif (node.fields) {\n\t\t\t\tfor (const field of node.fields) {\n\t\t\t\t\tfindRelated(field);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (node.interfaces) {\n\t\t\t\tfor (const _interface of node.interfaces) {\n\t\t\t\t\tfindRelated(_interface);\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (\n\t\t\tnode.kind === Kind.INPUT_OBJECT_TYPE_DEFINITION ||\n\t\t\tnode.kind === Kind.INPUT_OBJECT_TYPE_EXTENSION\n\t\t) {\n\t\t\t// Input\n\t\t\tmarkAsUsed(node.name.value);\n\n\t\t\tif (node.fields) {\n\t\t\t\tfor (const field of node.fields) {\n\t\t\t\t\tfindRelated(field);\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (\n\t\t\tnode.kind === Kind.INTERFACE_TYPE_DEFINITION ||\n\t\t\tnode.kind === Kind.INTERFACE_TYPE_EXTENSION\n\t\t) {\n\t\t\t// Interface\n\t\t\tmarkAsUsed(node.name.value);\n\n\t\t\tif (node.fields) {\n\t\t\t\tfor (const field of node.fields) {\n\t\t\t\t\tfindRelated(field);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (node.interfaces) {\n\t\t\t\tfor (const _interface of node.interfaces) {\n\t\t\t\t\tfindRelated(_interface);\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (\n\t\t\tnode.kind === Kind.UNION_TYPE_DEFINITION ||\n\t\t\tnode.kind === Kind.UNION_TYPE_EXTENSION\n\t\t) {\n\t\t\t// Union\n\t\t\tmarkAsUsed(node.name.value);\n\n\t\t\tif (node.types) {\n\t\t\t\tfor (const type of node.types) {\n\t\t\t\t\tfindRelated(type);\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (node.kind === Kind.ENUM_TYPE_DEFINITION || node.kind === Kind.ENUM_TYPE_EXTENSION) {\n\t\t\t// Enum\n\t\t\tmarkAsUsed(node.name.value);\n\t\t} else if (\n\t\t\tnode.kind === Kind.SCALAR_TYPE_DEFINITION ||\n\t\t\tnode.kind === Kind.SCALAR_TYPE_EXTENSION\n\t\t) {\n\t\t\t// Scalar\n\t\t\tif (!isGraphQLPrimitive(node.name.value)) {\n\t\t\t\tmarkAsUsed(node.name.value);\n\t\t\t}\n\t\t} else if (node.kind === Kind.INPUT_VALUE_DEFINITION) {\n\t\t\t// Argument\n\t\t\tfindRelated(resolveTypeNode(node.type));\n\t\t} else if (node.kind === Kind.FIELD_DEFINITION) {\n\t\t\t// Field\n\t\t\tfindRelated(resolveTypeNode(node.type));\n\n\t\t\tif (node.arguments) {\n\t\t\t\tfor (const argument of node.arguments) {\n\t\t\t\t\tfindRelated(argument);\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (\n\t\t\tnode.kind === Kind.NAMED_TYPE &&\n\t\t\t// Named type\n\t\t\t!isGraphQLPrimitive(node.name.value)\n\t\t) {\n\t\t\tmarkAsUsed(node.name.value);\n\t\t}\n\t}\n\n\treturn used;\n}\n\nfunction collectObjectFieldType(\n\tnode: ObjectTypeDefinitionNode,\n\tfieldDefinition: FieldDefinitionNode,\n\tfieldsMap: GraphQLFieldMap<unknown, unknown>,\n\tfieldTypes: Record<string, Record<string, string>>,\n) {\n\tconst objectName = node.name.value;\n\tconst fieldName = fieldDefinition.name.value;\n\n\tconst field = fieldsMap[fieldDefinition.name.value];\n\tconst baseName = getBaseType(field.type).name;\n\tconst isDefaultScalar = DEFAULT_SCALARS[baseName] != null;\n\tconst name = isDefaultScalar ? `Types.Scalars[\"${baseName}\"][\"output\"]` : baseName;\n\n\tconst type = wrapTypeWithModifiers(name, field.type, {\n\t\twrapOptional: (str: string) => {\n\t\t\treturn `Types.Maybe<${str}>`;\n\t\t},\n\t\twrapArray: (str: string) => {\n\t\t\treturn `Array<${str}>`;\n\t\t},\n\t});\n\n\tif (fieldTypes[objectName] == null) {\n\t\tfieldTypes[objectName] = {};\n\t}\n\tfieldTypes[objectName][fieldName] = type;\n}\n\nfunction collectObjectFieldArguments(\n\tnode: ObjectTypeDefinitionNode,\n\tfieldDefinition: FieldDefinitionNode,\n\tfieldArguments: Record<string, Record<string, boolean>>,\n) {\n\tconst objectName = node.name.value;\n\tconst fieldName = fieldDefinition.name.value;\n\tconst hasArguments = fieldDefinition.arguments != null && fieldDefinition.arguments.length > 0;\n\n\tif (fieldArguments[objectName] == null) {\n\t\tfieldArguments[objectName] = {};\n\t}\n\tfieldArguments[objectName][fieldName] = hasArguments;\n}\n\nexport function collectObjectFieldTypesAndArguments(schema?: GraphQLSchema) {\n\tconst fieldTypes: Record<string, Record<string, string>> = {};\n\tconst fieldArguments: Record<string, Record<string, boolean>> = {};\n\n\tif (!schema) {\n\t\treturn { fieldTypes, fieldArguments };\n\t}\n\n\tconst schemaTypes = schema.getTypeMap();\n\n\tfor (const type of Object.values(schemaTypes)) {\n\t\tif (type.astNode?.kind !== Kind.OBJECT_TYPE_DEFINITION) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst schemaType = schemaTypes[type.name] as GraphQLObjectType;\n\t\tconst fieldsMap = schemaType.getFields();\n\n\t\tfor (const field of type.astNode.fields ?? []) {\n\t\t\tcollectObjectFieldArguments(type.astNode, field, fieldArguments);\n\t\t\tcollectObjectFieldType(type.astNode, field, fieldsMap, fieldTypes);\n\t\t}\n\t}\n\n\treturn { fieldTypes, fieldArguments };\n}\n\nexport function resolveTypeNode(node: TypeNode): NamedTypeNode {\n\tif (node.kind === Kind.LIST_TYPE) {\n\t\treturn resolveTypeNode(node.type);\n\t}\n\n\tif (node.kind === Kind.NON_NULL_TYPE) {\n\t\treturn resolveTypeNode(node.type);\n\t}\n\n\treturn node;\n}\n\nexport function isGraphQLPrimitive(name: string): boolean {\n\treturn ['String', 'Boolean', 'ID', 'Float', 'Int'].includes(name);\n}\n\nexport function unique<T>(val: T, i: number, all: T[]): boolean {\n\treturn i === all.indexOf(val);\n}\n\nexport function withQuotes(val: string): string {\n\treturn `'${val}'`;\n}\n\nexport function indent(size: number) {\n\tconst space = new Array(size).fill(' ').join('');\n\n\tfunction indentInner(val: string): string {\n\t\treturn val\n\t\t\t.split('\\n')\n\t\t\t.map((line) => `${space}${line}`)\n\t\t\t.join('\\n');\n\t}\n\n\treturn indentInner;\n}\n\nexport function buildBlock({ name, lines }: { name: string; lines: string[] }): string {\n\tif (!lines.length) {\n\t\treturn '';\n\t}\n\n\treturn [`${name} {`, ...lines.map(indent(2)), '};'].join('\\n');\n}\n\nconst getRelativePath = (filepath: string, basePath: string) => {\n\tconst normalizedFilepath = normalize(filepath);\n\tconst normalizedBasePath = ensureStartsWithSeparator(\n\t\tnormalize(ensureEndsWithSeparator(basePath)),\n\t);\n\tconst [, relativePath] = normalizedFilepath.split(normalizedBasePath);\n\treturn relativePath;\n};\n\nexport function groupSourcesByModule(\n\tsources: Source[],\n\tbasePath: string,\n): Record<string, Source[]> {\n\tconst grouped: Record<string, Source[]> = {};\n\n\tfor (const source of sources) {\n\t\tif (!source.location) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst relativePath = getRelativePath(source.location, basePath);\n\n\t\tif (relativePath) {\n\t\t\t// PERF: we could guess the module by matching source.location with a list of already resolved paths\n\t\t\tconst mod = extractModuleDirectory(source.location, basePath);\n\n\t\t\tif (!grouped[mod]) {\n\t\t\t\tgrouped[mod] = [];\n\t\t\t}\n\n\t\t\tgrouped[mod].push(source);\n\t\t}\n\t}\n\n\treturn grouped;\n}\n\nfunction extractModuleDirectory(filepath: string, basePath: string): string {\n\tconst relativePath = getRelativePath(filepath, basePath);\n\n\tconst [moduleDirectory] = relativePath.split(sep);\n\n\treturn moduleDirectory;\n}\n\nexport function stripFilename(path: string) {\n\tconst parsedPath = parse(path);\n\treturn normalize(parsedPath.dir);\n}\n\nexport function normalize(path: string) {\n\treturn path.replace(/\\\\/g, '/');\n}\n\nfunction ensureEndsWithSeparator(path: string) {\n\treturn path.endsWith(sep) ? path : path + sep;\n}\n\nfunction ensureStartsWithSeparator(path: string) {\n\tif (platform() === 'win32') {\n\t\treturn path;\n\t}\n\n\treturn path.startsWith('.')\n\t\t? path.replace(/^(..\\/)|(.\\/)/, '/')\n\t\t: path.startsWith('/')\n\t\t\t? path\n\t\t\t: `/${path}`;\n}\n\n/**\n * Pushes an item to a list only if the list doesn't include the item\n */\nexport function pushUnique<T>(list: T[], item: T): void {\n\tif (!list.includes(item)) {\n\t\tlist.push(item);\n\t}\n}\n\nexport function concatByKey<T extends Record<string, string[]>, K extends keyof T>(\n\tleft: T,\n\tright: T,\n\tkey: K,\n) {\n\t// Remove duplicate, if an element is in right & left, it will be only once in the returned array.\n\treturn [...new Set([...left[key], ...right[key]])];\n}\n\nexport function uniqueByKey<T extends Record<string, string[]>, K extends keyof T>(\n\tleft: T,\n\tright: T,\n\tkey: K,\n) {\n\treturn left[key].filter((item) => !right[key].includes(item));\n}\n\nexport function createObject<K extends string, T>(keys: K[], valueFn: (key: K) => T) {\n\tconst obj: Record<K, T> = {} as Record<K, T>;\n\n\tfor (const key of keys) {\n\t\tobj[key] = valueFn(key);\n\t}\n\n\treturn obj;\n}\n"],"mappings":";;;;;;;AAAA,SAA2B,gBAAgB,eAAe;;;ACC1D,SAAS,WAAW,kBAAkB;AACtC,SAAS,iBAAiB,gCAAgC;AAC1D,YAAY,sBAAsB;;;ACH3B,SAAS,cAIA;AACf,QAAM,QAAQ,oBAAI,IAA8B;AAEhD,SAAO,SAAS,OAAU,WAAmB,KAAa,SAAuC;AAChG,UAAM,WAAW,GAAG,SAAS,IAAI,GAAG;AAEpC,UAAM,cAAc,MAAM,IAAI,QAAQ;AAEtC,QAAI,aAAa;AAChB,aAAO;AAAA,IACR;AAEA,UAAM,QAAQ,QAAQ;AACtB,UAAM,IAAI,UAAU,KAAK;AAEzB,WAAO;AAAA,EACR;AACD;;;ACrBA,SAAS,mCAAAA,wCAAuC;AAChD,SAAS,0BAA0B;AACnC,SAAS,sBAAsB;AAC/B,SAAS,iBAAiB;AAC1B,SAAS,oBAAoB;AAC7B,SAAS,yBAAyB;AAClC,SAAS,sBAAsB;AAC/B;AAAA,EAEC,cAAc;AAAA,OACR;AACP,SAAS,oBAAoB;AAC7B,SAAS,iBAAiB;AAC1B,SAAuC,sBAAsB;;;ACb7D,SAAS,kBAAkB;AAC3B,SAAS,uCAAuC;AAChD,SAA6B,aAAa;AAEnC,SAAS,YAAY,SAAyB;AACpD,SAAO,WAAW,QAAQ,EAAE,OAAO,OAAO,EAAE,OAAO,KAAK;AACzD;AAEO,SAAS,WAAW,QAA+B;AACzD,SAAO,YAAY,MAAM,gCAAgC,MAAM,CAAC,CAAC;AAClE;;;ADMA,eAAsB,WAAW,kBAA8C,KAAa;A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AK,cAAc,QAAQ,OAAO,GAAG;AAChD,iBAAO,IAAI;AAAA,QACZ;AAAA,MACD;AAEA,cAAQ,GAAG,UAAU,YAAY;AACjC,cAAQ,GAAG,UAAU,YAAY;AAAA,IAClC;AAAA,IACA,UAAU,OAAO,KAAK,SAAS;AAC9B,YAAM,QAAQ,MAAM,SAAS,IAAI,gBAAgB;AAEjD,iBAAW,QAAQ,OAAO;AACzB,YAAI,YAAY,aAAa,KAAK,UAAU,KAAK,SAAS,SAAS;AAAA,MACpE;AAEA,aAAO,KAAK;AAAA,IACb;AAAA,EACD,CAAC;AACF;","names":["getCachedDocumentNodeFromSchema","getCachedDocumentNodeFromSchema","isScalarType","Kind","name","content","Kind","isScalarType","sources","unionsDefinition","types","typePicks","result"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@baeta/plugin-graphql",
3
- "version": "0.0.34",
3
+ "version": "0.1.0",
4
4
  "keywords": [
5
5
  "baeta",
6
6
  "graphql",
@@ -44,22 +44,22 @@
44
44
  "types": "tsc --noEmit"
45
45
  },
46
46
  "dependencies": {
47
- "@baeta/generator-sdk": "^0.0.14",
48
- "@baeta/util-path": "^0.0.6",
47
+ "@baeta/generator-sdk": "^0.1.0",
48
+ "@baeta/util-path": "^0.1.0",
49
49
  "@graphql-codegen/core": "^4.0.2",
50
50
  "@graphql-codegen/plugin-helpers": "^5.0.4",
51
51
  "@graphql-codegen/typescript": "^4.0.9",
52
52
  "@graphql-codegen/visitor-plugin-common": "5.3.1",
53
53
  "@graphql-tools/apollo-engine-loader": "^8.0.1",
54
- "@graphql-tools/code-file-loader": "^8.1.2",
55
- "@graphql-tools/git-loader": "^8.0.6",
54
+ "@graphql-tools/code-file-loader": "^8.1.3",
55
+ "@graphql-tools/git-loader": "^8.0.7",
56
56
  "@graphql-tools/github-loader": "^8.0.1",
57
57
  "@graphql-tools/graphql-file-loader": "^8.0.1",
58
58
  "@graphql-tools/json-file-loader": "^8.0.1",
59
59
  "@graphql-tools/load": "^8.0.2",
60
60
  "@graphql-tools/prisma-loader": "^8.0.4",
61
61
  "@graphql-tools/url-loader": "^8.0.2",
62
- "@graphql-tools/utils": "^10.3.1",
62
+ "@graphql-tools/utils": "^10.5.4",
63
63
  "auto-bind": "^5.0.1",
64
64
  "change-case-all": "2.1.0",
65
65
  "parse-filepath": "^1.0.2"
@@ -67,18 +67,27 @@
67
67
  "devDependencies": {
68
68
  "@baeta/builder": "^0.0.0",
69
69
  "@baeta/tsconfig": "^0.0.0",
70
- "@types/node": "^20.14.10",
70
+ "@types/node": "^22.7.4",
71
71
  "@types/parse-filepath": "1.0.2",
72
72
  "graphql": "^16.9.0",
73
- "typescript": "^5.5.3"
73
+ "typescript": "^5.6.2"
74
74
  },
75
75
  "peerDependencies": {
76
76
  "graphql": "^16.6.0"
77
77
  },
78
78
  "engines": {
79
- "node": ">=20.0.0"
79
+ "node": ">=22.0.0"
80
80
  },
81
81
  "publishConfig": {
82
82
  "access": "public"
83
+ },
84
+ "ava": {
85
+ "extensions": {
86
+ "ts": "module"
87
+ },
88
+ "nodeArguments": [
89
+ "--no-warnings",
90
+ "--experimental-transform-types"
91
+ ]
83
92
  }
84
93
  }