@soda-gql/codegen 0.10.0 → 0.10.1
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/dist/{generator-HOw0EOk_.cjs → generator-CO6Ta7fM.cjs} +1 -1
- package/dist/generator-CT7FuDog.mjs +3 -0
- package/dist/{generator-DnaEVxKH.mjs → generator-D-6bctxT.mjs} +12 -20
- package/dist/generator-D-6bctxT.mjs.map +1 -0
- package/dist/{generator-B-ATtEt4.cjs → generator-w9tj5XXW.cjs} +12 -20
- package/dist/generator-w9tj5XXW.cjs.map +1 -0
- package/dist/index.cjs +3 -110
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -6
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +0 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +4 -111
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/generator-B-ATtEt4.cjs.map +0 -1
- package/dist/generator-DnaEVxKH.mjs.map +0 -1
- package/dist/generator-_yjlHz2T.mjs +0 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_generator = require('./generator-
|
|
1
|
+
const require_generator = require('./generator-w9tj5XXW.cjs');
|
|
2
2
|
|
|
3
3
|
exports.createSchemaIndex = require_generator.createSchemaIndex;
|
|
4
4
|
exports.generateMultiSchemaModule = require_generator.generateMultiSchemaModule;
|
|
@@ -517,24 +517,17 @@ ${typeExports.join("\n")}`);
|
|
|
517
517
|
schemaBlocks.push(`const ${gqlVarName} = createGqlElementComposer${typeParams}(${schemaVar}, { inputTypeMethods: ${inputTypeMethodsVar}, directiveMethods: ${customDirectivesVar} });`);
|
|
518
518
|
}
|
|
519
519
|
schemaBlocks.push(`export type Context_${name} = Parameters<typeof ${gqlVarName}>[0] extends (ctx: infer C) => unknown ? C : never;`);
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
const customDirectivesVar = `customDirectives_${name}`;
|
|
528
|
-
const adapterVar = adapterAliases.get(name);
|
|
529
|
-
prebuiltExports.push(`export { ${schemaVar} as __schema_${name} };`);
|
|
530
|
-
prebuiltExports.push(`export { ${inputTypeMethodsVar} as __inputTypeMethods_${name} };`);
|
|
531
|
-
prebuiltExports.push(`export { ${customDirectivesVar} as __directiveMethods_${name} };`);
|
|
532
|
-
if (adapterVar) {
|
|
533
|
-
prebuiltExports.push(`export { ${adapterVar} as __adapter_${name} };`);
|
|
534
|
-
}
|
|
520
|
+
const prebuiltExports = [
|
|
521
|
+
`export { ${schemaVar} as __schema_${name} }`,
|
|
522
|
+
`export { ${inputTypeMethodsVar} as __inputTypeMethods_${name} }`,
|
|
523
|
+
`export { ${customDirectivesVar} as __directiveMethods_${name} }`
|
|
524
|
+
];
|
|
525
|
+
if (adapterVar) {
|
|
526
|
+
prebuiltExports.push(`export { ${adapterVar} as __adapter_${name} }`);
|
|
535
527
|
}
|
|
528
|
+
schemaBlocks.push(`${prebuiltExports.join(";\n")};`);
|
|
529
|
+
gqlEntries.push(` ${name}: ${gqlVarName}`);
|
|
536
530
|
}
|
|
537
|
-
const prebuiltExportsBlock = prebuiltExports.length > 0 ? `\n\n// Exports for prebuilt module\n${prebuiltExports.join("\n")}` : "";
|
|
538
531
|
return `\
|
|
539
532
|
import {
|
|
540
533
|
defineEnum,
|
|
@@ -550,7 +543,7 @@ ${schemaBlocks.join("\n")}
|
|
|
550
543
|
|
|
551
544
|
export const gql = {
|
|
552
545
|
${gqlEntries.join(",\n")}
|
|
553
|
-
}
|
|
546
|
+
};
|
|
554
547
|
`;
|
|
555
548
|
};
|
|
556
549
|
const generateMultiSchemaModule = (schemas, options) => {
|
|
@@ -650,8 +643,7 @@ const generateMultiSchemaModule = (schemas, options) => {
|
|
|
650
643
|
} : { mode: "inline" };
|
|
651
644
|
const code = multiRuntimeTemplate({
|
|
652
645
|
schemas: schemaConfigs,
|
|
653
|
-
injection
|
|
654
|
-
exportForPrebuilt: options?.exportForPrebuilt
|
|
646
|
+
injection
|
|
655
647
|
});
|
|
656
648
|
return {
|
|
657
649
|
code,
|
|
@@ -661,4 +653,4 @@ const generateMultiSchemaModule = (schemas, options) => {
|
|
|
661
653
|
|
|
662
654
|
//#endregion
|
|
663
655
|
export { generateMultiSchemaModule as n, createSchemaIndex as t };
|
|
664
|
-
//# sourceMappingURL=generator-
|
|
656
|
+
//# sourceMappingURL=generator-D-6bctxT.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator-D-6bctxT.mjs","names":["operationTypes: OperationTypeNames","kind: \"scalar\" | \"enum\" | \"input\"","kind: \"scalar\" | \"enum\" | \"union\" | \"object\"","imports: string[]","schemaBlocks: string[]","gqlEntries: string[]","prebuiltExports: string[]","schemaConfigs: Record<string, any>","scalarVars: string[]","enumVars: string[]","inputVars: string[]","objectVars: string[]","unionVars: string[]","injection: RuntimeTemplateInjection"],"sources":["../src/generator.ts"],"sourcesContent":["import {\n type ConstDirectiveNode,\n type ConstValueNode,\n type DocumentNode,\n type EnumValueDefinitionNode,\n type FieldDefinitionNode,\n type InputValueDefinitionNode,\n Kind,\n type NamedTypeNode,\n type SchemaDefinitionNode,\n type SchemaExtensionNode,\n type TypeNode,\n} from \"graphql\";\n\nconst builtinScalarTypes = new Map<string, { readonly input: string; readonly output: string }>([\n [\"ID\", { input: \"string\", output: \"string\" }],\n [\"String\", { input: \"string\", output: \"string\" }],\n [\"Int\", { input: \"number\", output: \"number\" }],\n [\"Float\", { input: \"number\", output: \"number\" }],\n [\"Boolean\", { input: \"boolean\", output: \"boolean\" }],\n]);\n\ntype OperationTypeNames = {\n query?: string;\n mutation?: string;\n subscription?: string;\n};\n\ntype ObjectRecord = {\n readonly name: string;\n readonly fields: Map<string, FieldDefinitionNode>;\n directives: ConstDirectiveNode[];\n};\n\ntype InputRecord = {\n readonly name: string;\n readonly fields: Map<string, InputValueDefinitionNode>;\n directives: ConstDirectiveNode[];\n};\n\ntype EnumRecord = {\n readonly name: string;\n readonly values: Map<string, EnumValueDefinitionNode>;\n directives: ConstDirectiveNode[];\n};\n\ntype UnionRecord = {\n readonly name: string;\n readonly members: Map<string, NamedTypeNode>;\n directives: ConstDirectiveNode[];\n};\n\ntype ScalarRecord = {\n readonly name: string;\n directives: ConstDirectiveNode[];\n};\n\ntype DirectiveRecord = {\n readonly name: string;\n readonly locations: readonly string[];\n readonly args: Map<string, InputValueDefinitionNode>;\n readonly isRepeatable: boolean;\n};\n\ntype SchemaIndex = {\n readonly objects: Map<string, ObjectRecord>;\n readonly inputs: Map<string, InputRecord>;\n readonly enums: Map<string, EnumRecord>;\n readonly unions: Map<string, UnionRecord>;\n readonly scalars: Map<string, ScalarRecord>;\n readonly directives: Map<string, DirectiveRecord>;\n readonly operationTypes: OperationTypeNames;\n};\n\nconst ensureRecord = <T>(collection: Map<string, T>, key: string, factory: (name: string) => T): T => {\n const existing = collection.get(key);\n if (existing) {\n return existing;\n }\n\n const created = factory(key);\n collection.set(key, created);\n return created;\n};\n\nconst addObjectFields = (target: Map<string, FieldDefinitionNode>, fields: readonly FieldDefinitionNode[] | undefined): void => {\n if (!fields) {\n return;\n }\n\n for (const field of fields) {\n target.set(field.name.value, field);\n }\n};\n\nconst addInputFields = (\n target: Map<string, InputValueDefinitionNode>,\n fields: readonly InputValueDefinitionNode[] | undefined,\n): void => {\n if (!fields) {\n return;\n }\n\n for (const field of fields) {\n target.set(field.name.value, field);\n }\n};\n\nconst addEnumValues = (\n target: Map<string, EnumValueDefinitionNode>,\n values: readonly EnumValueDefinitionNode[] | undefined,\n): void => {\n if (!values) {\n return;\n }\n\n for (const value of values) {\n target.set(value.name.value, value);\n }\n};\n\nconst addUnionMembers = (target: Map<string, NamedTypeNode>, members: readonly NamedTypeNode[] | undefined): void => {\n if (!members) {\n return;\n }\n\n for (const member of members) {\n target.set(member.name.value, member);\n }\n};\n\nconst mergeDirectives = (\n existing: ConstDirectiveNode[] | undefined,\n incoming: readonly ConstDirectiveNode[] | undefined,\n precedence: \"definition\" | \"extension\",\n): ConstDirectiveNode[] => {\n const current = existing ?? [];\n const next = incoming ? Array.from(incoming) : [];\n return precedence === \"definition\" ? [...next, ...current] : [...current, ...next];\n};\n\nconst updateOperationTypes = (\n operationTypes: OperationTypeNames,\n definition: SchemaDefinitionNode | SchemaExtensionNode,\n): void => {\n for (const operation of definition.operationTypes ?? []) {\n const typeName = operation.type.name.value;\n switch (operation.operation) {\n case \"query\":\n operationTypes.query = typeName;\n break;\n case \"mutation\":\n operationTypes.mutation = typeName;\n break;\n case \"subscription\":\n operationTypes.subscription = typeName;\n break;\n default:\n break;\n }\n }\n};\n\nconst addDirectiveArgs = (\n target: Map<string, InputValueDefinitionNode>,\n args: readonly InputValueDefinitionNode[] | undefined,\n): void => {\n if (!args) {\n return;\n }\n for (const arg of args) {\n target.set(arg.name.value, arg);\n }\n};\n\nexport const createSchemaIndex = (document: DocumentNode): SchemaIndex => {\n const objects = new Map<string, ObjectRecord>();\n const inputs = new Map<string, InputRecord>();\n const enums = new Map<string, EnumRecord>();\n const unions = new Map<string, UnionRecord>();\n const scalars = new Map<string, ScalarRecord>();\n const directives = new Map<string, DirectiveRecord>();\n const operationTypes: OperationTypeNames = {};\n\n for (const definition of document.definitions) {\n switch (definition.kind) {\n case Kind.OBJECT_TYPE_DEFINITION:\n case Kind.OBJECT_TYPE_EXTENSION: {\n const precedence = definition.kind === Kind.OBJECT_TYPE_DEFINITION ? \"definition\" : \"extension\";\n const record = ensureRecord(objects, definition.name.value, (name) => ({\n name,\n fields: new Map<string, FieldDefinitionNode>(),\n directives: [],\n }));\n addObjectFields(record.fields, definition.fields);\n record.directives = mergeDirectives(record.directives, definition.directives, precedence);\n break;\n }\n case Kind.INPUT_OBJECT_TYPE_DEFINITION:\n case Kind.INPUT_OBJECT_TYPE_EXTENSION: {\n const precedence = definition.kind === Kind.INPUT_OBJECT_TYPE_DEFINITION ? \"definition\" : \"extension\";\n const record = ensureRecord(inputs, definition.name.value, (name) => ({\n name,\n fields: new Map<string, InputValueDefinitionNode>(),\n directives: [],\n }));\n addInputFields(record.fields, definition.fields);\n record.directives = mergeDirectives(record.directives, definition.directives, precedence);\n break;\n }\n case Kind.ENUM_TYPE_DEFINITION:\n case Kind.ENUM_TYPE_EXTENSION: {\n const precedence = definition.kind === Kind.ENUM_TYPE_DEFINITION ? \"definition\" : \"extension\";\n const record = ensureRecord(enums, definition.name.value, (name) => ({\n name,\n values: new Map<string, EnumValueDefinitionNode>(),\n directives: [],\n }));\n addEnumValues(record.values, definition.values);\n record.directives = mergeDirectives(record.directives, definition.directives, precedence);\n break;\n }\n case Kind.UNION_TYPE_DEFINITION:\n case Kind.UNION_TYPE_EXTENSION: {\n const precedence = definition.kind === Kind.UNION_TYPE_DEFINITION ? \"definition\" : \"extension\";\n const record = ensureRecord(unions, definition.name.value, (name) => ({\n name,\n members: new Map<string, NamedTypeNode>(),\n directives: [],\n }));\n addUnionMembers(record.members, definition.types);\n record.directives = mergeDirectives(record.directives, definition.directives, precedence);\n break;\n }\n case Kind.SCALAR_TYPE_DEFINITION:\n case Kind.SCALAR_TYPE_EXTENSION: {\n const precedence = definition.kind === Kind.SCALAR_TYPE_DEFINITION ? \"definition\" : \"extension\";\n const record = ensureRecord(scalars, definition.name.value, (name) => ({\n name,\n directives: [],\n }));\n record.directives = mergeDirectives(record.directives, definition.directives, precedence);\n break;\n }\n case Kind.DIRECTIVE_DEFINITION: {\n // Skip built-in directives that are already provided by createStandardDirectives\n const name = definition.name.value;\n if (name === \"skip\" || name === \"include\" || name === \"deprecated\" || name === \"specifiedBy\") {\n break;\n }\n const args = new Map<string, InputValueDefinitionNode>();\n addDirectiveArgs(args, definition.arguments);\n directives.set(name, {\n name,\n locations: definition.locations.map((loc) => loc.value),\n args,\n isRepeatable: definition.repeatable,\n });\n break;\n }\n case Kind.SCHEMA_DEFINITION:\n case Kind.SCHEMA_EXTENSION:\n updateOperationTypes(operationTypes, definition);\n break;\n default:\n break;\n }\n }\n\n if (!operationTypes.query && objects.has(\"Query\")) {\n operationTypes.query = \"Query\";\n }\n if (!operationTypes.mutation && objects.has(\"Mutation\")) {\n operationTypes.mutation = \"Mutation\";\n }\n if (!operationTypes.subscription && objects.has(\"Subscription\")) {\n operationTypes.subscription = \"Subscription\";\n }\n\n return {\n objects,\n inputs,\n enums,\n unions,\n scalars,\n directives,\n operationTypes,\n } satisfies SchemaIndex;\n};\n\ntype TypeLevel = {\n readonly kind: \"list\" | \"named\";\n readonly nonNull: boolean;\n};\n\nconst collectTypeLevels = (\n type: TypeNode,\n nonNull = false,\n levels: TypeLevel[] = [],\n): { readonly name: string; readonly levels: TypeLevel[] } => {\n if (type.kind === Kind.NON_NULL_TYPE) {\n return collectTypeLevels(type.type, true, levels);\n }\n\n if (type.kind === Kind.LIST_TYPE) {\n levels.push({ kind: \"list\", nonNull });\n return collectTypeLevels(type.type, false, levels);\n }\n\n levels.push({ kind: \"named\", nonNull });\n return { name: type.name.value, levels };\n};\n\nconst buildTypeModifier = (levels: TypeLevel[]): string => {\n let modifier = \"?\";\n\n for (const level of levels.slice().reverse()) {\n if (level.kind === \"named\") {\n // Inner type: always explicit nullable marker\n modifier = level.nonNull ? \"!\" : \"?\";\n continue;\n }\n\n // List type: append []? or []! based on list's nullability\n const listSuffix = level.nonNull ? \"[]!\" : \"[]?\";\n modifier = `${modifier}${listSuffix}`;\n }\n\n return modifier;\n};\n\nconst parseTypeReference = (type: TypeNode): { readonly name: string; readonly modifier: string } => {\n const { name, levels } = collectTypeLevels(type);\n return { name, modifier: buildTypeModifier(levels) };\n};\n\nconst isScalarName = (schema: SchemaIndex, name: string): boolean => builtinScalarTypes.has(name) || schema.scalars.has(name);\nconst isEnumName = (schema: SchemaIndex, name: string): boolean => schema.enums.has(name);\nconst _isInputName = (schema: SchemaIndex, name: string): boolean => schema.inputs.has(name);\nconst isUnionName = (schema: SchemaIndex, name: string): boolean => schema.unions.has(name);\nconst isObjectName = (schema: SchemaIndex, name: string): boolean => schema.objects.has(name);\n\nconst renderConstValue = (value: ConstValueNode): string => {\n switch (value.kind) {\n case Kind.NULL:\n return \"null\";\n case Kind.INT:\n case Kind.FLOAT:\n return value.value;\n case Kind.STRING:\n case Kind.ENUM:\n return JSON.stringify(value.value);\n case Kind.BOOLEAN:\n return value.value ? \"true\" : \"false\";\n case Kind.LIST:\n return `[${value.values.map((item) => renderConstValue(item)).join(\", \")}]`;\n case Kind.OBJECT: {\n if (value.fields.length === 0) {\n return \"{}\";\n }\n const entries = value.fields.map((field) => `${field.name.value}: ${renderConstValue(field.value)}`);\n return `{ ${entries.join(\", \")} }`;\n }\n }\n};\n\nconst renderInputRef = (schema: SchemaIndex, definition: InputValueDefinitionNode): string => {\n const { name, modifier } = parseTypeReference(definition.type);\n const defaultValue = definition.defaultValue;\n\n let kind: \"scalar\" | \"enum\" | \"input\";\n if (isScalarName(schema, name)) {\n kind = \"scalar\";\n } else if (isEnumName(schema, name)) {\n kind = \"enum\";\n } else {\n kind = \"input\";\n }\n\n // Only include defaultValue when it has a value (reduces file size significantly)\n if (defaultValue) {\n return `{ kind: \"${kind}\", name: \"${name}\", modifier: \"${modifier}\", defaultValue: { default: ${renderConstValue(defaultValue)} } }`;\n }\n return `{ kind: \"${kind}\", name: \"${name}\", modifier: \"${modifier}\" }`;\n};\n\nconst renderArgumentMap = (schema: SchemaIndex, args: readonly InputValueDefinitionNode[] | undefined): string => {\n const entries = [...(args ?? [])]\n .sort((left, right) => left.name.value.localeCompare(right.name.value))\n .map((arg) => `${arg.name.value}: ${renderInputRef(schema, arg)}`);\n\n return renderPropertyLines({ entries, indentSize: 8 });\n};\n\nconst renderOutputRef = (schema: SchemaIndex, type: TypeNode, args: readonly InputValueDefinitionNode[] | undefined): string => {\n const { name, modifier } = parseTypeReference(type);\n const argumentMap = renderArgumentMap(schema, args);\n\n let kind: \"scalar\" | \"enum\" | \"union\" | \"object\";\n if (isScalarName(schema, name)) {\n kind = \"scalar\";\n } else if (isEnumName(schema, name)) {\n kind = \"enum\";\n } else if (isUnionName(schema, name)) {\n kind = \"union\";\n } else if (isObjectName(schema, name)) {\n kind = \"object\";\n } else {\n kind = \"scalar\"; // fallback for unknown types\n }\n\n return `{ kind: \"${kind}\", name: \"${name}\", modifier: \"${modifier}\", arguments: ${argumentMap} }`;\n};\n\nconst renderPropertyLines = ({ entries, indentSize }: { entries: string[]; indentSize: number }) => {\n if (entries.length === 0) {\n return \"{}\";\n }\n\n const indent = \" \".repeat(indentSize);\n const lastIndent = \" \".repeat(indentSize - 2);\n return [\"{\", `${indent}${entries.join(`,\\n${indent}`)},`, `${lastIndent}}`].join(`\\n`);\n};\n\nconst renderObjectFields = (schema: SchemaIndex, fields: Map<string, FieldDefinitionNode>): string => {\n const entries = Array.from(fields.values())\n .sort((left, right) => left.name.value.localeCompare(right.name.value))\n .map((field) => `${field.name.value}: ${renderOutputRef(schema, field.type, field.arguments)}`);\n\n return renderPropertyLines({ entries, indentSize: 6 });\n};\n\nconst renderInputFields = (schema: SchemaIndex, fields: Map<string, InputValueDefinitionNode>): string => {\n const entries = Array.from(fields.values())\n .sort((left, right) => left.name.value.localeCompare(right.name.value))\n .map((field) => `${field.name.value}: ${renderInputRef(schema, field)}`);\n\n return renderPropertyLines({ entries, indentSize: 6 });\n};\n\n// Granular render functions - each type as its own const variable\nconst renderScalarVar = (schemaName: string, record: ScalarRecord): string => {\n const typeInfo = builtinScalarTypes.get(record.name) ?? { input: \"string\", output: \"string\" };\n return `const scalar_${schemaName}_${record.name} = { name: \"${record.name}\", $type: {} as { input: ${typeInfo.input}; output: ${typeInfo.output}; inputProfile: { kind: \"scalar\"; name: \"${record.name}\"; value: ${typeInfo.input} }; outputProfile: { kind: \"scalar\"; name: \"${record.name}\"; value: ${typeInfo.output} } } } as const;`;\n};\n\nconst renderEnumVar = (schemaName: string, record: EnumRecord): string => {\n const valueNames = Array.from(record.values.values())\n .sort((left, right) => left.name.value.localeCompare(right.name.value))\n .map((value) => value.name.value);\n const valuesObj = valueNames.length === 0 ? \"{}\" : `{ ${valueNames.map((v) => `${v}: true`).join(\", \")} }`;\n const valueUnion = valueNames.length === 0 ? \"never\" : valueNames.map((v) => `\"${v}\"`).join(\" | \");\n return `const enum_${schemaName}_${record.name} = defineEnum<\"${record.name}\", ${valueUnion}>(\"${record.name}\", ${valuesObj});`;\n};\n\nconst renderInputVar = (schemaName: string, schema: SchemaIndex, record: InputRecord): string => {\n const fields = renderInputFields(schema, record.fields);\n return `const input_${schemaName}_${record.name} = { name: \"${record.name}\", fields: ${fields} } as const;`;\n};\n\nconst renderObjectVar = (schemaName: string, schema: SchemaIndex, record: ObjectRecord): string => {\n const fields = renderObjectFields(schema, record.fields);\n return `const object_${schemaName}_${record.name} = { name: \"${record.name}\", fields: ${fields} } as const;`;\n};\n\nconst renderUnionVar = (schemaName: string, record: UnionRecord): string => {\n const memberNames = Array.from(record.members.values())\n .sort((left, right) => left.name.value.localeCompare(right.name.value))\n .map((member) => member.name.value);\n const typesObj = memberNames.length === 0 ? \"{}\" : `{ ${memberNames.map((m) => `${m}: true`).join(\", \")} }`;\n return `const union_${schemaName}_${record.name} = { name: \"${record.name}\", types: ${typesObj} } as const;`;\n};\n\nconst collectObjectTypeNames = (schema: SchemaIndex): string[] =>\n Array.from(schema.objects.keys())\n .filter((name) => !name.startsWith(\"__\"))\n .sort((left, right) => left.localeCompare(right));\n\nconst renderFragmentBuildersType = (objectTypeNames: string[], schemaName: string, adapterTypeName?: string): string => {\n if (objectTypeNames.length === 0) {\n return `type FragmentBuilders_${schemaName} = Record<string, never>;`;\n }\n\n const adapterPart = adapterTypeName ? `, ExtractMetadataAdapter<${adapterTypeName}>` : \"\";\n const entries = objectTypeNames.map(\n (name) => ` readonly ${name}: FragmentBuilderFor<Schema_${schemaName}, \"${name}\"${adapterPart}>`,\n );\n return `type FragmentBuilders_${schemaName} = {\\n${entries.join(\";\\n\")};\\n};`;\n};\n\nconst collectInputTypeNames = (schema: SchemaIndex): string[] =>\n Array.from(schema.inputs.keys())\n .filter((name) => !name.startsWith(\"__\"))\n .sort((left, right) => left.localeCompare(right));\n\nconst collectEnumTypeNames = (schema: SchemaIndex): string[] =>\n Array.from(schema.enums.keys())\n .filter((name) => !name.startsWith(\"__\"))\n .sort((left, right) => left.localeCompare(right));\n\nconst collectUnionTypeNames = (schema: SchemaIndex): string[] =>\n Array.from(schema.unions.keys())\n .filter((name) => !name.startsWith(\"__\"))\n .sort((left, right) => left.localeCompare(right));\n\nconst collectScalarNames = (schema: SchemaIndex): string[] =>\n Array.from(schema.scalars.keys())\n .filter((name) => !name.startsWith(\"__\"))\n .sort((left, right) => left.localeCompare(right));\n\nconst collectDirectiveNames = (schema: SchemaIndex): string[] =>\n Array.from(schema.directives.keys()).sort((left, right) => left.localeCompare(right));\n\nconst renderInputTypeMethod = (factoryVar: string, kind: \"scalar\" | \"enum\" | \"input\", typeName: string): string =>\n `${typeName}: ${factoryVar}(\"${kind}\", \"${typeName}\")`;\n\nconst renderInputTypeMethods = (schema: SchemaIndex, factoryVar: string): string => {\n const scalarMethods = Array.from(builtinScalarTypes.keys())\n .concat(collectScalarNames(schema).filter((name) => !builtinScalarTypes.has(name)))\n .map((name) => renderInputTypeMethod(factoryVar, \"scalar\", name));\n\n const enumMethods = collectEnumTypeNames(schema).map((name) => renderInputTypeMethod(factoryVar, \"enum\", name));\n\n const inputMethods = collectInputTypeNames(schema).map((name) => renderInputTypeMethod(factoryVar, \"input\", name));\n\n const allMethods = [...scalarMethods, ...enumMethods, ...inputMethods].sort((left, right) => {\n const leftName = left.split(\":\")[0] ?? \"\";\n const rightName = right.split(\":\")[0] ?? \"\";\n return leftName.localeCompare(rightName);\n });\n\n return renderPropertyLines({ entries: allMethods, indentSize: 2 });\n};\n\nconst renderDirectiveMethod = (record: DirectiveRecord): string => {\n const locationsJson = JSON.stringify(record.locations);\n return `${record.name}: createDirectiveMethod(\"${record.name}\", ${locationsJson} as const)`;\n};\n\nconst renderDirectiveMethods = (schema: SchemaIndex): string => {\n const directiveNames = collectDirectiveNames(schema);\n if (directiveNames.length === 0) {\n return \"{}\";\n }\n\n const methods = directiveNames\n .map((name) => {\n const record = schema.directives.get(name);\n return record ? renderDirectiveMethod(record) : null;\n })\n .filter((method): method is string => method !== null);\n\n return renderPropertyLines({ entries: methods, indentSize: 2 });\n};\n\nexport type GeneratedModule = {\n readonly code: string;\n readonly stats: {\n readonly objects: number;\n readonly enums: number;\n readonly inputs: number;\n readonly unions: number;\n };\n};\n\ntype PerSchemaInjection = {\n readonly scalarImportPath: string;\n readonly adapterImportPath?: string;\n};\n\ntype RuntimeTemplateInjection =\n | { readonly mode: \"inline\" }\n | {\n readonly mode: \"inject\";\n readonly perSchema: Map<string, PerSchemaInjection>;\n };\n\nexport type RuntimeGenerationOptions = {\n readonly injection?: Map<string, PerSchemaInjection>;\n readonly defaultInputDepth?: Map<string, number>;\n readonly inputDepthOverrides?: Map<string, Readonly<Record<string, number>>>;\n};\n\ntype MultiRuntimeTemplateOptions = {\n readonly schemas: Record<\n string,\n {\n readonly queryType: string;\n readonly mutationType: string;\n readonly subscriptionType: string;\n // Granular: individual variable declarations\n readonly scalarVars: string[];\n readonly enumVars: string[];\n readonly inputVars: string[];\n readonly objectVars: string[];\n readonly unionVars: string[];\n // Granular: type name lists for assembly\n readonly scalarNames: string[];\n readonly enumNames: string[];\n readonly inputNames: string[];\n readonly objectNames: string[];\n readonly unionNames: string[];\n readonly inputTypeMethodsBlock: string;\n readonly directiveMethodsBlock: string;\n readonly fragmentBuildersTypeBlock: string;\n readonly defaultInputDepth?: number;\n readonly inputDepthOverrides?: Readonly<Record<string, number>>;\n }\n >;\n readonly injection: RuntimeTemplateInjection;\n};\n\nconst multiRuntimeTemplate = ($$: MultiRuntimeTemplateOptions) => {\n // Build imports based on injection mode\n const imports: string[] = [];\n const scalarAliases = new Map<string, string>();\n const adapterAliases = new Map<string, string>();\n\n if ($$.injection.mode === \"inject\") {\n // Group imports by file path\n const importsByPath = new Map<string, string[]>();\n\n for (const [schemaName, injection] of $$.injection.perSchema) {\n const scalarAlias = `scalar_${schemaName}`;\n scalarAliases.set(schemaName, scalarAlias);\n\n // Group scalar import\n const scalarSpecifiers = importsByPath.get(injection.scalarImportPath) ?? [];\n if (!importsByPath.has(injection.scalarImportPath)) {\n importsByPath.set(injection.scalarImportPath, scalarSpecifiers);\n }\n scalarSpecifiers.push(`scalar as ${scalarAlias}`);\n\n // Group adapter import (optional)\n if (injection.adapterImportPath) {\n const adapterAlias = `adapter_${schemaName}`;\n adapterAliases.set(schemaName, adapterAlias);\n const adapterSpecifiers = importsByPath.get(injection.adapterImportPath) ?? [];\n if (!importsByPath.has(injection.adapterImportPath)) {\n importsByPath.set(injection.adapterImportPath, adapterSpecifiers);\n }\n adapterSpecifiers.push(`adapter as ${adapterAlias}`);\n }\n }\n\n // Generate grouped imports\n for (const [path, specifiers] of importsByPath) {\n if (specifiers.length === 1) {\n imports.push(`import { ${specifiers[0]} } from \"${path}\";`);\n } else {\n imports.push(`import {\\n ${specifiers.join(\",\\n \")},\\n} from \"${path}\";`);\n }\n }\n }\n\n const extraImports = imports.length > 0 ? `${imports.join(\"\\n\")}\\n` : \"\";\n\n // Generate per-schema definitions (granular pattern)\n const schemaBlocks: string[] = [];\n const gqlEntries: string[] = [];\n\n for (const [name, config] of Object.entries($$.schemas)) {\n const schemaVar = `${name}Schema`;\n\n // Get optional adapter\n const adapterVar = adapterAliases.get(name);\n\n // Build type exports with fragment builders type\n const typeExports = [`export type Schema_${name} = typeof ${schemaVar} & { _?: never };`];\n if (adapterVar) {\n typeExports.push(`export type Adapter_${name} = typeof ${adapterVar} & { _?: never };`);\n }\n typeExports.push(config.fragmentBuildersTypeBlock);\n\n const inputTypeMethodsVar = `inputTypeMethods_${name}`;\n const factoryVar = `createMethod_${name}`;\n const customDirectivesVar = `customDirectives_${name}`;\n\n // Generate __defaultInputDepth block if non-default value\n const defaultDepthBlock =\n config.defaultInputDepth !== undefined && config.defaultInputDepth !== 3\n ? `\\n __defaultInputDepth: ${config.defaultInputDepth},`\n : \"\";\n\n // Generate __inputDepthOverrides block if there are overrides\n const depthOverridesBlock =\n config.inputDepthOverrides && Object.keys(config.inputDepthOverrides).length > 0\n ? `\\n __inputDepthOverrides: ${JSON.stringify(config.inputDepthOverrides)},`\n : \"\";\n\n // Granular: generate individual variable declarations\n const scalarVarsBlock = config.scalarVars.join(\"\\n\");\n const enumVarsBlock = config.enumVars.length > 0 ? config.enumVars.join(\"\\n\") : \"// (no enums)\";\n const inputVarsBlock = config.inputVars.length > 0 ? config.inputVars.join(\"\\n\") : \"// (no inputs)\";\n const objectVarsBlock = config.objectVars.length > 0 ? config.objectVars.join(\"\\n\") : \"// (no objects)\";\n const unionVarsBlock = config.unionVars.length > 0 ? config.unionVars.join(\"\\n\") : \"// (no unions)\";\n\n // Granular: generate assembly references\n // For injection mode, use imported scalar object; otherwise assemble from individual vars\n const scalarAssembly =\n $$.injection.mode === \"inject\"\n ? (scalarAliases.get(name) ?? \"{}\")\n : config.scalarNames.length > 0\n ? `{ ${config.scalarNames.map((n) => `${n}: scalar_${name}_${n}`).join(\", \")} }`\n : \"{}\";\n const enumAssembly =\n config.enumNames.length > 0 ? `{ ${config.enumNames.map((n) => `${n}: enum_${name}_${n}`).join(\", \")} }` : \"{}\";\n const inputAssembly =\n config.inputNames.length > 0 ? `{ ${config.inputNames.map((n) => `${n}: input_${name}_${n}`).join(\", \")} }` : \"{}\";\n const objectAssembly =\n config.objectNames.length > 0 ? `{ ${config.objectNames.map((n) => `${n}: object_${name}_${n}`).join(\", \")} }` : \"{}\";\n const unionAssembly =\n config.unionNames.length > 0 ? `{ ${config.unionNames.map((n) => `${n}: union_${name}_${n}`).join(\", \")} }` : \"{}\";\n\n // Granular: skip individual scalar vars when using injection (scalars come from import)\n const scalarVarsSection = $$.injection.mode === \"inject\" ? \"// (scalars imported)\" : scalarVarsBlock;\n\n // When injecting scalars, use the imported alias directly; otherwise use the assembled category object\n const scalarAssemblyLine =\n $$.injection.mode === \"inject\"\n ? `// scalar_${name} is imported directly`\n : `const scalar_${name} = ${scalarAssembly} as const;`;\n const scalarRef = $$.injection.mode === \"inject\" ? (scalarAliases.get(name) ?? `scalar_${name}`) : `scalar_${name}`;\n\n schemaBlocks.push(`\n// Individual scalar definitions\n${scalarVarsSection}\n\n// Individual enum definitions\n${enumVarsBlock}\n\n// Individual input definitions\n${inputVarsBlock}\n\n// Individual object definitions\n${objectVarsBlock}\n\n// Individual union definitions\n${unionVarsBlock}\n\n// Category assembly\n${scalarAssemblyLine}\nconst enum_${name} = ${enumAssembly} as const;\nconst input_${name} = ${inputAssembly} as const;\nconst object_${name} = ${objectAssembly} as const;\nconst union_${name} = ${unionAssembly} as const;\n\n// Schema assembly\nconst ${schemaVar} = {\n label: \"${name}\" as const,\n operations: { query: \"${config.queryType}\", mutation: \"${config.mutationType}\", subscription: \"${config.subscriptionType}\" } as const,\n scalar: ${scalarRef},\n enum: enum_${name},\n input: input_${name},\n object: object_${name},\n union: union_${name},${defaultDepthBlock}${depthOverridesBlock}\n} as const;\n\nconst ${factoryVar} = createVarMethodFactory<typeof ${schemaVar}>();\nconst ${inputTypeMethodsVar} = ${config.inputTypeMethodsBlock};\nconst ${customDirectivesVar} = { ...createStandardDirectives(), ...${config.directiveMethodsBlock} };\n\n${typeExports.join(\"\\n\")}`);\n\n // Build gql composer as a named variable for Context type extraction\n const gqlVarName = `gql_${name}`;\n if (adapterVar) {\n const typeParams = `<Schema_${name}, FragmentBuilders_${name}, typeof ${customDirectivesVar}, Adapter_${name}>`;\n schemaBlocks.push(\n `const ${gqlVarName} = createGqlElementComposer${typeParams}(${schemaVar}, { adapter: ${adapterVar}, inputTypeMethods: ${inputTypeMethodsVar}, directiveMethods: ${customDirectivesVar} });`,\n );\n } else {\n const typeParams = `<Schema_${name}, FragmentBuilders_${name}, typeof ${customDirectivesVar}>`;\n schemaBlocks.push(\n `const ${gqlVarName} = createGqlElementComposer${typeParams}(${schemaVar}, { inputTypeMethods: ${inputTypeMethodsVar}, directiveMethods: ${customDirectivesVar} });`,\n );\n }\n\n // Export Context type extracted from the gql composer\n schemaBlocks.push(\n `export type Context_${name} = Parameters<typeof ${gqlVarName}>[0] extends (ctx: infer C) => unknown ? C : never;`,\n );\n\n // Prebuilt module exports (for typegen)\n const prebuiltExports: string[] = [\n `export { ${schemaVar} as __schema_${name} }`,\n `export { ${inputTypeMethodsVar} as __inputTypeMethods_${name} }`,\n `export { ${customDirectivesVar} as __directiveMethods_${name} }`,\n ];\n if (adapterVar) {\n prebuiltExports.push(`export { ${adapterVar} as __adapter_${name} }`);\n }\n schemaBlocks.push(`${prebuiltExports.join(\";\\n\")};`);\n\n gqlEntries.push(` ${name}: ${gqlVarName}`);\n }\n\n return `\\\nimport {\n defineEnum,\n type ExtractMetadataAdapter,\n type FragmentBuilderFor,\n createDirectiveMethod,\n createGqlElementComposer,\n createStandardDirectives,\n createVarMethodFactory,\n} from \"@soda-gql/core\";\n${extraImports}\n${schemaBlocks.join(\"\\n\")}\n\nexport const gql = {\n${gqlEntries.join(\",\\n\")}\n};\n`;\n};\n\nexport const generateMultiSchemaModule = (\n schemas: Map<string, DocumentNode>,\n options?: RuntimeGenerationOptions,\n): GeneratedModule => {\n // biome-ignore lint/suspicious/noExplicitAny: complex schema config type\n const schemaConfigs: Record<string, any> = {};\n const allStats = {\n objects: 0,\n enums: 0,\n inputs: 0,\n unions: 0,\n };\n\n for (const [name, document] of schemas.entries()) {\n const schema = createSchemaIndex(document);\n\n // Collect type names\n const objectTypeNames = collectObjectTypeNames(schema);\n const enumTypeNames = collectEnumTypeNames(schema);\n const inputTypeNames = collectInputTypeNames(schema);\n const unionTypeNames = collectUnionTypeNames(schema);\n const customScalarNames = collectScalarNames(schema).filter((n) => !builtinScalarTypes.has(n));\n\n // Generate individual variable declarations (granular pattern)\n const scalarVars: string[] = [];\n const enumVars: string[] = [];\n const inputVars: string[] = [];\n const objectVars: string[] = [];\n const unionVars: string[] = [];\n\n // Builtin scalars\n for (const scalarName of builtinScalarTypes.keys()) {\n const record = schema.scalars.get(scalarName) ?? { name: scalarName, directives: [] };\n scalarVars.push(renderScalarVar(name, record));\n }\n\n // Custom scalars\n for (const scalarName of customScalarNames) {\n const record = schema.scalars.get(scalarName);\n if (record) {\n scalarVars.push(renderScalarVar(name, record));\n }\n }\n\n // Enums\n for (const enumName of enumTypeNames) {\n const record = schema.enums.get(enumName);\n if (record) {\n enumVars.push(renderEnumVar(name, record));\n }\n }\n\n // Inputs\n for (const inputName of inputTypeNames) {\n const record = schema.inputs.get(inputName);\n if (record) {\n inputVars.push(renderInputVar(name, schema, record));\n }\n }\n\n // Objects\n for (const objectName of objectTypeNames) {\n const record = schema.objects.get(objectName);\n if (record) {\n objectVars.push(renderObjectVar(name, schema, record));\n }\n }\n\n // Unions\n for (const unionName of unionTypeNames) {\n const record = schema.unions.get(unionName);\n if (record) {\n unionVars.push(renderUnionVar(name, record));\n }\n }\n\n // Type name lists for assembly\n const allScalarNames = [...builtinScalarTypes.keys(), ...customScalarNames];\n\n const factoryVar = `createMethod_${name}`;\n const inputTypeMethodsBlock = renderInputTypeMethods(schema, factoryVar);\n const directiveMethodsBlock = renderDirectiveMethods(schema);\n // Pass adapter type name if injection has adapter for this schema\n const adapterTypeName = options?.injection?.get(name)?.adapterImportPath ? `Adapter_${name}` : undefined;\n const fragmentBuildersTypeBlock = renderFragmentBuildersType(objectTypeNames, name, adapterTypeName);\n\n const queryType = schema.operationTypes.query ?? \"Query\";\n const mutationType = schema.operationTypes.mutation ?? \"Mutation\";\n const subscriptionType = schema.operationTypes.subscription ?? \"Subscription\";\n\n schemaConfigs[name] = {\n queryType,\n mutationType,\n subscriptionType,\n // Granular: individual variable declarations\n scalarVars,\n enumVars,\n inputVars,\n objectVars,\n unionVars,\n // Granular: type name lists for assembly\n scalarNames: allScalarNames,\n enumNames: enumTypeNames,\n inputNames: inputTypeNames,\n objectNames: objectTypeNames,\n unionNames: unionTypeNames,\n inputTypeMethodsBlock,\n directiveMethodsBlock,\n fragmentBuildersTypeBlock,\n defaultInputDepth: options?.defaultInputDepth?.get(name),\n inputDepthOverrides: options?.inputDepthOverrides?.get(name),\n };\n\n // Accumulate stats\n allStats.objects += objectVars.length;\n allStats.enums += enumVars.length;\n allStats.inputs += inputVars.length;\n allStats.unions += unionVars.length;\n }\n\n const injection: RuntimeTemplateInjection = options?.injection\n ? { mode: \"inject\", perSchema: options.injection }\n : { mode: \"inline\" };\n\n const code = multiRuntimeTemplate({\n schemas: schemaConfigs,\n injection,\n });\n\n return {\n code,\n stats: allStats,\n };\n};\n"],"mappings":";;;AAcA,MAAM,qBAAqB,IAAI,IAAiE;CAC9F,CAAC,MAAM;EAAE,OAAO;EAAU,QAAQ;EAAU,CAAC;CAC7C,CAAC,UAAU;EAAE,OAAO;EAAU,QAAQ;EAAU,CAAC;CACjD,CAAC,OAAO;EAAE,OAAO;EAAU,QAAQ;EAAU,CAAC;CAC9C,CAAC,SAAS;EAAE,OAAO;EAAU,QAAQ;EAAU,CAAC;CAChD,CAAC,WAAW;EAAE,OAAO;EAAW,QAAQ;EAAW,CAAC;CACrD,CAAC;AAsDF,MAAM,gBAAmB,YAA4B,KAAa,YAAoC;CACpG,MAAM,WAAW,WAAW,IAAI,IAAI;AACpC,KAAI,UAAU;AACZ,SAAO;;CAGT,MAAM,UAAU,QAAQ,IAAI;AAC5B,YAAW,IAAI,KAAK,QAAQ;AAC5B,QAAO;;AAGT,MAAM,mBAAmB,QAA0C,WAA6D;AAC9H,KAAI,CAAC,QAAQ;AACX;;AAGF,MAAK,MAAM,SAAS,QAAQ;AAC1B,SAAO,IAAI,MAAM,KAAK,OAAO,MAAM;;;AAIvC,MAAM,kBACJ,QACA,WACS;AACT,KAAI,CAAC,QAAQ;AACX;;AAGF,MAAK,MAAM,SAAS,QAAQ;AAC1B,SAAO,IAAI,MAAM,KAAK,OAAO,MAAM;;;AAIvC,MAAM,iBACJ,QACA,WACS;AACT,KAAI,CAAC,QAAQ;AACX;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GAEA,aAAa;GACb,WAAW;GACX,YAAY;GACZ,aAAa;GACb,YAAY;GACZ;GACA;GACA;GACA,mBAAmB,SAAS,mBAAmB,IAAI,KAAK;GACxD,qBAAqB,SAAS,qBAAqB,IAAI,KAAK;GAC7D;AAGD,WAAS,WAAW,WAAW;AAC/B,WAAS,SAAS,SAAS;AAC3B,WAAS,UAAU,UAAU;AAC7B,WAAS,UAAU,UAAU;;CAG/B,MAAMC,YAAsC,SAAS,YACjD;EAAE,MAAM;EAAU,WAAW,QAAQ;EAAW,GAChD,EAAE,MAAM,UAAU;CAEtB,MAAM,OAAO,qBAAqB;EAChC,SAAS;EACT;EACD,CAAC;AAEF,QAAO;EACL;EACA,OAAO;EACR"}
|
|
@@ -517,24 +517,17 @@ ${typeExports.join("\n")}`);
|
|
|
517
517
|
schemaBlocks.push(`const ${gqlVarName} = createGqlElementComposer${typeParams}(${schemaVar}, { inputTypeMethods: ${inputTypeMethodsVar}, directiveMethods: ${customDirectivesVar} });`);
|
|
518
518
|
}
|
|
519
519
|
schemaBlocks.push(`export type Context_${name} = Parameters<typeof ${gqlVarName}>[0] extends (ctx: infer C) => unknown ? C : never;`);
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
const customDirectivesVar = `customDirectives_${name}`;
|
|
528
|
-
const adapterVar = adapterAliases.get(name);
|
|
529
|
-
prebuiltExports.push(`export { ${schemaVar} as __schema_${name} };`);
|
|
530
|
-
prebuiltExports.push(`export { ${inputTypeMethodsVar} as __inputTypeMethods_${name} };`);
|
|
531
|
-
prebuiltExports.push(`export { ${customDirectivesVar} as __directiveMethods_${name} };`);
|
|
532
|
-
if (adapterVar) {
|
|
533
|
-
prebuiltExports.push(`export { ${adapterVar} as __adapter_${name} };`);
|
|
534
|
-
}
|
|
520
|
+
const prebuiltExports = [
|
|
521
|
+
`export { ${schemaVar} as __schema_${name} }`,
|
|
522
|
+
`export { ${inputTypeMethodsVar} as __inputTypeMethods_${name} }`,
|
|
523
|
+
`export { ${customDirectivesVar} as __directiveMethods_${name} }`
|
|
524
|
+
];
|
|
525
|
+
if (adapterVar) {
|
|
526
|
+
prebuiltExports.push(`export { ${adapterVar} as __adapter_${name} }`);
|
|
535
527
|
}
|
|
528
|
+
schemaBlocks.push(`${prebuiltExports.join(";\n")};`);
|
|
529
|
+
gqlEntries.push(` ${name}: ${gqlVarName}`);
|
|
536
530
|
}
|
|
537
|
-
const prebuiltExportsBlock = prebuiltExports.length > 0 ? `\n\n// Exports for prebuilt module\n${prebuiltExports.join("\n")}` : "";
|
|
538
531
|
return `\
|
|
539
532
|
import {
|
|
540
533
|
defineEnum,
|
|
@@ -550,7 +543,7 @@ ${schemaBlocks.join("\n")}
|
|
|
550
543
|
|
|
551
544
|
export const gql = {
|
|
552
545
|
${gqlEntries.join(",\n")}
|
|
553
|
-
}
|
|
546
|
+
};
|
|
554
547
|
`;
|
|
555
548
|
};
|
|
556
549
|
const generateMultiSchemaModule = (schemas, options) => {
|
|
@@ -650,8 +643,7 @@ const generateMultiSchemaModule = (schemas, options) => {
|
|
|
650
643
|
} : { mode: "inline" };
|
|
651
644
|
const code = multiRuntimeTemplate({
|
|
652
645
|
schemas: schemaConfigs,
|
|
653
|
-
injection
|
|
654
|
-
exportForPrebuilt: options?.exportForPrebuilt
|
|
646
|
+
injection
|
|
655
647
|
});
|
|
656
648
|
return {
|
|
657
649
|
code,
|
|
@@ -672,4 +664,4 @@ Object.defineProperty(exports, 'generateMultiSchemaModule', {
|
|
|
672
664
|
return generateMultiSchemaModule;
|
|
673
665
|
}
|
|
674
666
|
});
|
|
675
|
-
//# sourceMappingURL=generator-
|
|
667
|
+
//# sourceMappingURL=generator-w9tj5XXW.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator-w9tj5XXW.cjs","names":["operationTypes: OperationTypeNames","Kind","kind: \"scalar\" | \"enum\" | \"input\"","kind: \"scalar\" | \"enum\" | \"union\" | \"object\"","imports: string[]","schemaBlocks: string[]","gqlEntries: string[]","prebuiltExports: string[]","schemaConfigs: Record<string, any>","scalarVars: string[]","enumVars: string[]","inputVars: string[]","objectVars: string[]","unionVars: string[]","injection: RuntimeTemplateInjection"],"sources":["../src/generator.ts"],"sourcesContent":["import {\n type ConstDirectiveNode,\n type ConstValueNode,\n type DocumentNode,\n type EnumValueDefinitionNode,\n type FieldDefinitionNode,\n type InputValueDefinitionNode,\n Kind,\n type NamedTypeNode,\n type SchemaDefinitionNode,\n type SchemaExtensionNode,\n type TypeNode,\n} from \"graphql\";\n\nconst builtinScalarTypes = new Map<string, { readonly input: string; readonly output: string }>([\n [\"ID\", { input: \"string\", output: \"string\" }],\n [\"String\", { input: \"string\", output: \"string\" }],\n [\"Int\", { input: \"number\", output: \"number\" }],\n [\"Float\", { input: \"number\", output: \"number\" }],\n [\"Boolean\", { input: \"boolean\", output: \"boolean\" }],\n]);\n\ntype OperationTypeNames = {\n query?: string;\n mutation?: string;\n subscription?: string;\n};\n\ntype ObjectRecord = {\n readonly name: string;\n readonly fields: Map<string, FieldDefinitionNode>;\n directives: ConstDirectiveNode[];\n};\n\ntype InputRecord = {\n readonly name: string;\n readonly fields: Map<string, InputValueDefinitionNode>;\n directives: ConstDirectiveNode[];\n};\n\ntype EnumRecord = {\n readonly name: string;\n readonly values: Map<string, EnumValueDefinitionNode>;\n directives: ConstDirectiveNode[];\n};\n\ntype UnionRecord = {\n readonly name: string;\n readonly members: Map<string, NamedTypeNode>;\n directives: ConstDirectiveNode[];\n};\n\ntype ScalarRecord = {\n readonly name: string;\n directives: ConstDirectiveNode[];\n};\n\ntype DirectiveRecord = {\n readonly name: string;\n readonly locations: readonly string[];\n readonly args: Map<string, InputValueDefinitionNode>;\n readonly isRepeatable: boolean;\n};\n\ntype SchemaIndex = {\n readonly objects: Map<string, ObjectRecord>;\n readonly inputs: Map<string, InputRecord>;\n readonly enums: Map<string, EnumRecord>;\n readonly unions: Map<string, UnionRecord>;\n readonly scalars: Map<string, ScalarRecord>;\n readonly directives: Map<string, DirectiveRecord>;\n readonly operationTypes: OperationTypeNames;\n};\n\nconst ensureRecord = <T>(collection: Map<string, T>, key: string, factory: (name: string) => T): T => {\n const existing = collection.get(key);\n if (existing) {\n return existing;\n }\n\n const created = factory(key);\n collection.set(key, created);\n return created;\n};\n\nconst addObjectFields = (target: Map<string, FieldDefinitionNode>, fields: readonly FieldDefinitionNode[] | undefined): void => {\n if (!fields) {\n return;\n }\n\n for (const field of fields) {\n target.set(field.name.value, field);\n }\n};\n\nconst addInputFields = (\n target: Map<string, InputValueDefinitionNode>,\n fields: readonly InputValueDefinitionNode[] | undefined,\n): void => {\n if (!fields) {\n return;\n }\n\n for (const field of fields) {\n target.set(field.name.value, field);\n }\n};\n\nconst addEnumValues = (\n target: Map<string, EnumValueDefinitionNode>,\n values: readonly EnumValueDefinitionNode[] | undefined,\n): void => {\n if (!values) {\n return;\n }\n\n for (const value of values) {\n target.set(value.name.value, value);\n }\n};\n\nconst addUnionMembers = (target: Map<string, NamedTypeNode>, members: readonly NamedTypeNode[] | undefined): void => {\n if (!members) {\n return;\n }\n\n for (const member of members) {\n target.set(member.name.value, member);\n }\n};\n\nconst mergeDirectives = (\n existing: ConstDirectiveNode[] | undefined,\n incoming: readonly ConstDirectiveNode[] | undefined,\n precedence: \"definition\" | \"extension\",\n): ConstDirectiveNode[] => {\n const current = existing ?? [];\n const next = incoming ? Array.from(incoming) : [];\n return precedence === \"definition\" ? [...next, ...current] : [...current, ...next];\n};\n\nconst updateOperationTypes = (\n operationTypes: OperationTypeNames,\n definition: SchemaDefinitionNode | SchemaExtensionNode,\n): void => {\n for (const operation of definition.operationTypes ?? []) {\n const typeName = operation.type.name.value;\n switch (operation.operation) {\n case \"query\":\n operationTypes.query = typeName;\n break;\n case \"mutation\":\n operationTypes.mutation = typeName;\n break;\n case \"subscription\":\n operationTypes.subscription = typeName;\n break;\n default:\n break;\n }\n }\n};\n\nconst addDirectiveArgs = (\n target: Map<string, InputValueDefinitionNode>,\n args: readonly InputValueDefinitionNode[] | undefined,\n): void => {\n if (!args) {\n return;\n }\n for (const arg of args) {\n target.set(arg.name.value, arg);\n }\n};\n\nexport const createSchemaIndex = (document: DocumentNode): SchemaIndex => {\n const objects = new Map<string, ObjectRecord>();\n const inputs = new Map<string, InputRecord>();\n const enums = new Map<string, EnumRecord>();\n const unions = new Map<string, UnionRecord>();\n const scalars = new Map<string, ScalarRecord>();\n const directives = new Map<string, DirectiveRecord>();\n const operationTypes: OperationTypeNames = {};\n\n for (const definition of document.definitions) {\n switch (definition.kind) {\n case Kind.OBJECT_TYPE_DEFINITION:\n case Kind.OBJECT_TYPE_EXTENSION: {\n const precedence = definition.kind === Kind.OBJECT_TYPE_DEFINITION ? \"definition\" : \"extension\";\n const record = ensureRecord(objects, definition.name.value, (name) => ({\n name,\n fields: new Map<string, FieldDefinitionNode>(),\n directives: [],\n }));\n addObjectFields(record.fields, definition.fields);\n record.directives = mergeDirectives(record.directives, definition.directives, precedence);\n break;\n }\n case Kind.INPUT_OBJECT_TYPE_DEFINITION:\n case Kind.INPUT_OBJECT_TYPE_EXTENSION: {\n const precedence = definition.kind === Kind.INPUT_OBJECT_TYPE_DEFINITION ? \"definition\" : \"extension\";\n const record = ensureRecord(inputs, definition.name.value, (name) => ({\n name,\n fields: new Map<string, InputValueDefinitionNode>(),\n directives: [],\n }));\n addInputFields(record.fields, definition.fields);\n record.directives = mergeDirectives(record.directives, definition.directives, precedence);\n break;\n }\n case Kind.ENUM_TYPE_DEFINITION:\n case Kind.ENUM_TYPE_EXTENSION: {\n const precedence = definition.kind === Kind.ENUM_TYPE_DEFINITION ? \"definition\" : \"extension\";\n const record = ensureRecord(enums, definition.name.value, (name) => ({\n name,\n values: new Map<string, EnumValueDefinitionNode>(),\n directives: [],\n }));\n addEnumValues(record.values, definition.values);\n record.directives = mergeDirectives(record.directives, definition.directives, precedence);\n break;\n }\n case Kind.UNION_TYPE_DEFINITION:\n case Kind.UNION_TYPE_EXTENSION: {\n const precedence = definition.kind === Kind.UNION_TYPE_DEFINITION ? \"definition\" : \"extension\";\n const record = ensureRecord(unions, definition.name.value, (name) => ({\n name,\n members: new Map<string, NamedTypeNode>(),\n directives: [],\n }));\n addUnionMembers(record.members, definition.types);\n record.directives = mergeDirectives(record.directives, definition.directives, precedence);\n break;\n }\n case Kind.SCALAR_TYPE_DEFINITION:\n case Kind.SCALAR_TYPE_EXTENSION: {\n const precedence = definition.kind === Kind.SCALAR_TYPE_DEFINITION ? \"definition\" : \"extension\";\n const record = ensureRecord(scalars, definition.name.value, (name) => ({\n name,\n directives: [],\n }));\n record.directives = mergeDirectives(record.directives, definition.directives, precedence);\n break;\n }\n case Kind.DIRECTIVE_DEFINITION: {\n // Skip built-in directives that are already provided by createStandardDirectives\n const name = definition.name.value;\n if (name === \"skip\" || name === \"include\" || name === \"deprecated\" || name === \"specifiedBy\") {\n break;\n }\n const args = new Map<string, InputValueDefinitionNode>();\n addDirectiveArgs(args, definition.arguments);\n directives.set(name, {\n name,\n locations: definition.locations.map((loc) => loc.value),\n args,\n isRepeatable: definition.repeatable,\n });\n break;\n }\n case Kind.SCHEMA_DEFINITION:\n case Kind.SCHEMA_EXTENSION:\n updateOperationTypes(operationTypes, definition);\n break;\n default:\n break;\n }\n }\n\n if (!operationTypes.query && objects.has(\"Query\")) {\n operationTypes.query = \"Query\";\n }\n if (!operationTypes.mutation && objects.has(\"Mutation\")) {\n operationTypes.mutation = \"Mutation\";\n }\n if (!operationTypes.subscription && objects.has(\"Subscription\")) {\n operationTypes.subscription = \"Subscription\";\n }\n\n return {\n objects,\n inputs,\n enums,\n unions,\n scalars,\n directives,\n operationTypes,\n } satisfies SchemaIndex;\n};\n\ntype TypeLevel = {\n readonly kind: \"list\" | \"named\";\n readonly nonNull: boolean;\n};\n\nconst collectTypeLevels = (\n type: TypeNode,\n nonNull = false,\n levels: TypeLevel[] = [],\n): { readonly name: string; readonly levels: TypeLevel[] } => {\n if (type.kind === Kind.NON_NULL_TYPE) {\n return collectTypeLevels(type.type, true, levels);\n }\n\n if (type.kind === Kind.LIST_TYPE) {\n levels.push({ kind: \"list\", nonNull });\n return collectTypeLevels(type.type, false, levels);\n }\n\n levels.push({ kind: \"named\", nonNull });\n return { name: type.name.value, levels };\n};\n\nconst buildTypeModifier = (levels: TypeLevel[]): string => {\n let modifier = \"?\";\n\n for (const level of levels.slice().reverse()) {\n if (level.kind === \"named\") {\n // Inner type: always explicit nullable marker\n modifier = level.nonNull ? \"!\" : \"?\";\n continue;\n }\n\n // List type: append []? or []! based on list's nullability\n const listSuffix = level.nonNull ? \"[]!\" : \"[]?\";\n modifier = `${modifier}${listSuffix}`;\n }\n\n return modifier;\n};\n\nconst parseTypeReference = (type: TypeNode): { readonly name: string; readonly modifier: string } => {\n const { name, levels } = collectTypeLevels(type);\n return { name, modifier: buildTypeModifier(levels) };\n};\n\nconst isScalarName = (schema: SchemaIndex, name: string): boolean => builtinScalarTypes.has(name) || schema.scalars.has(name);\nconst isEnumName = (schema: SchemaIndex, name: string): boolean => schema.enums.has(name);\nconst _isInputName = (schema: SchemaIndex, name: string): boolean => schema.inputs.has(name);\nconst isUnionName = (schema: SchemaIndex, name: string): boolean => schema.unions.has(name);\nconst isObjectName = (schema: SchemaIndex, name: string): boolean => schema.objects.has(name);\n\nconst renderConstValue = (value: ConstValueNode): string => {\n switch (value.kind) {\n case Kind.NULL:\n return \"null\";\n case Kind.INT:\n case Kind.FLOAT:\n return value.value;\n case Kind.STRING:\n case Kind.ENUM:\n return JSON.stringify(value.value);\n case Kind.BOOLEAN:\n return value.value ? \"true\" : \"false\";\n case Kind.LIST:\n return `[${value.values.map((item) => renderConstValue(item)).join(\", \")}]`;\n case Kind.OBJECT: {\n if (value.fields.length === 0) {\n return \"{}\";\n }\n const entries = value.fields.map((field) => `${field.name.value}: ${renderConstValue(field.value)}`);\n return `{ ${entries.join(\", \")} }`;\n }\n }\n};\n\nconst renderInputRef = (schema: SchemaIndex, definition: InputValueDefinitionNode): string => {\n const { name, modifier } = parseTypeReference(definition.type);\n const defaultValue = definition.defaultValue;\n\n let kind: \"scalar\" | \"enum\" | \"input\";\n if (isScalarName(schema, name)) {\n kind = \"scalar\";\n } else if (isEnumName(schema, name)) {\n kind = \"enum\";\n } else {\n kind = \"input\";\n }\n\n // Only include defaultValue when it has a value (reduces file size significantly)\n if (defaultValue) {\n return `{ kind: \"${kind}\", name: \"${name}\", modifier: \"${modifier}\", defaultValue: { default: ${renderConstValue(defaultValue)} } }`;\n }\n return `{ kind: \"${kind}\", name: \"${name}\", modifier: \"${modifier}\" }`;\n};\n\nconst renderArgumentMap = (schema: SchemaIndex, args: readonly InputValueDefinitionNode[] | undefined): string => {\n const entries = [...(args ?? [])]\n .sort((left, right) => left.name.value.localeCompare(right.name.value))\n .map((arg) => `${arg.name.value}: ${renderInputRef(schema, arg)}`);\n\n return renderPropertyLines({ entries, indentSize: 8 });\n};\n\nconst renderOutputRef = (schema: SchemaIndex, type: TypeNode, args: readonly InputValueDefinitionNode[] | undefined): string => {\n const { name, modifier } = parseTypeReference(type);\n const argumentMap = renderArgumentMap(schema, args);\n\n let kind: \"scalar\" | \"enum\" | \"union\" | \"object\";\n if (isScalarName(schema, name)) {\n kind = \"scalar\";\n } else if (isEnumName(schema, name)) {\n kind = \"enum\";\n } else if (isUnionName(schema, name)) {\n kind = \"union\";\n } else if (isObjectName(schema, name)) {\n kind = \"object\";\n } else {\n kind = \"scalar\"; // fallback for unknown types\n }\n\n return `{ kind: \"${kind}\", name: \"${name}\", modifier: \"${modifier}\", arguments: ${argumentMap} }`;\n};\n\nconst renderPropertyLines = ({ entries, indentSize }: { entries: string[]; indentSize: number }) => {\n if (entries.length === 0) {\n return \"{}\";\n }\n\n const indent = \" \".repeat(indentSize);\n const lastIndent = \" \".repeat(indentSize - 2);\n return [\"{\", `${indent}${entries.join(`,\\n${indent}`)},`, `${lastIndent}}`].join(`\\n`);\n};\n\nconst renderObjectFields = (schema: SchemaIndex, fields: Map<string, FieldDefinitionNode>): string => {\n const entries = Array.from(fields.values())\n .sort((left, right) => left.name.value.localeCompare(right.name.value))\n .map((field) => `${field.name.value}: ${renderOutputRef(schema, field.type, field.arguments)}`);\n\n return renderPropertyLines({ entries, indentSize: 6 });\n};\n\nconst renderInputFields = (schema: SchemaIndex, fields: Map<string, InputValueDefinitionNode>): string => {\n const entries = Array.from(fields.values())\n .sort((left, right) => left.name.value.localeCompare(right.name.value))\n .map((field) => `${field.name.value}: ${renderInputRef(schema, field)}`);\n\n return renderPropertyLines({ entries, indentSize: 6 });\n};\n\n// Granular render functions - each type as its own const variable\nconst renderScalarVar = (schemaName: string, record: ScalarRecord): string => {\n const typeInfo = builtinScalarTypes.get(record.name) ?? { input: \"string\", output: \"string\" };\n return `const scalar_${schemaName}_${record.name} = { name: \"${record.name}\", $type: {} as { input: ${typeInfo.input}; output: ${typeInfo.output}; inputProfile: { kind: \"scalar\"; name: \"${record.name}\"; value: ${typeInfo.input} }; outputProfile: { kind: \"scalar\"; name: \"${record.name}\"; value: ${typeInfo.output} } } } as const;`;\n};\n\nconst renderEnumVar = (schemaName: string, record: EnumRecord): string => {\n const valueNames = Array.from(record.values.values())\n .sort((left, right) => left.name.value.localeCompare(right.name.value))\n .map((value) => value.name.value);\n const valuesObj = valueNames.length === 0 ? \"{}\" : `{ ${valueNames.map((v) => `${v}: true`).join(\", \")} }`;\n const valueUnion = valueNames.length === 0 ? \"never\" : valueNames.map((v) => `\"${v}\"`).join(\" | \");\n return `const enum_${schemaName}_${record.name} = defineEnum<\"${record.name}\", ${valueUnion}>(\"${record.name}\", ${valuesObj});`;\n};\n\nconst renderInputVar = (schemaName: string, schema: SchemaIndex, record: InputRecord): string => {\n const fields = renderInputFields(schema, record.fields);\n return `const input_${schemaName}_${record.name} = { name: \"${record.name}\", fields: ${fields} } as const;`;\n};\n\nconst renderObjectVar = (schemaName: string, schema: SchemaIndex, record: ObjectRecord): string => {\n const fields = renderObjectFields(schema, record.fields);\n return `const object_${schemaName}_${record.name} = { name: \"${record.name}\", fields: ${fields} } as const;`;\n};\n\nconst renderUnionVar = (schemaName: string, record: UnionRecord): string => {\n const memberNames = Array.from(record.members.values())\n .sort((left, right) => left.name.value.localeCompare(right.name.value))\n .map((member) => member.name.value);\n const typesObj = memberNames.length === 0 ? \"{}\" : `{ ${memberNames.map((m) => `${m}: true`).join(\", \")} }`;\n return `const union_${schemaName}_${record.name} = { name: \"${record.name}\", types: ${typesObj} } as const;`;\n};\n\nconst collectObjectTypeNames = (schema: SchemaIndex): string[] =>\n Array.from(schema.objects.keys())\n .filter((name) => !name.startsWith(\"__\"))\n .sort((left, right) => left.localeCompare(right));\n\nconst renderFragmentBuildersType = (objectTypeNames: string[], schemaName: string, adapterTypeName?: string): string => {\n if (objectTypeNames.length === 0) {\n return `type FragmentBuilders_${schemaName} = Record<string, never>;`;\n }\n\n const adapterPart = adapterTypeName ? `, ExtractMetadataAdapter<${adapterTypeName}>` : \"\";\n const entries = objectTypeNames.map(\n (name) => ` readonly ${name}: FragmentBuilderFor<Schema_${schemaName}, \"${name}\"${adapterPart}>`,\n );\n return `type FragmentBuilders_${schemaName} = {\\n${entries.join(\";\\n\")};\\n};`;\n};\n\nconst collectInputTypeNames = (schema: SchemaIndex): string[] =>\n Array.from(schema.inputs.keys())\n .filter((name) => !name.startsWith(\"__\"))\n .sort((left, right) => left.localeCompare(right));\n\nconst collectEnumTypeNames = (schema: SchemaIndex): string[] =>\n Array.from(schema.enums.keys())\n .filter((name) => !name.startsWith(\"__\"))\n .sort((left, right) => left.localeCompare(right));\n\nconst collectUnionTypeNames = (schema: SchemaIndex): string[] =>\n Array.from(schema.unions.keys())\n .filter((name) => !name.startsWith(\"__\"))\n .sort((left, right) => left.localeCompare(right));\n\nconst collectScalarNames = (schema: SchemaIndex): string[] =>\n Array.from(schema.scalars.keys())\n .filter((name) => !name.startsWith(\"__\"))\n .sort((left, right) => left.localeCompare(right));\n\nconst collectDirectiveNames = (schema: SchemaIndex): string[] =>\n Array.from(schema.directives.keys()).sort((left, right) => left.localeCompare(right));\n\nconst renderInputTypeMethod = (factoryVar: string, kind: \"scalar\" | \"enum\" | \"input\", typeName: string): string =>\n `${typeName}: ${factoryVar}(\"${kind}\", \"${typeName}\")`;\n\nconst renderInputTypeMethods = (schema: SchemaIndex, factoryVar: string): string => {\n const scalarMethods = Array.from(builtinScalarTypes.keys())\n .concat(collectScalarNames(schema).filter((name) => !builtinScalarTypes.has(name)))\n .map((name) => renderInputTypeMethod(factoryVar, \"scalar\", name));\n\n const enumMethods = collectEnumTypeNames(schema).map((name) => renderInputTypeMethod(factoryVar, \"enum\", name));\n\n const inputMethods = collectInputTypeNames(schema).map((name) => renderInputTypeMethod(factoryVar, \"input\", name));\n\n const allMethods = [...scalarMethods, ...enumMethods, ...inputMethods].sort((left, right) => {\n const leftName = left.split(\":\")[0] ?? \"\";\n const rightName = right.split(\":\")[0] ?? \"\";\n return leftName.localeCompare(rightName);\n });\n\n return renderPropertyLines({ entries: allMethods, indentSize: 2 });\n};\n\nconst renderDirectiveMethod = (record: DirectiveRecord): string => {\n const locationsJson = JSON.stringify(record.locations);\n return `${record.name}: createDirectiveMethod(\"${record.name}\", ${locationsJson} as const)`;\n};\n\nconst renderDirectiveMethods = (schema: SchemaIndex): string => {\n const directiveNames = collectDirectiveNames(schema);\n if (directiveNames.length === 0) {\n return \"{}\";\n }\n\n const methods = directiveNames\n .map((name) => {\n const record = schema.directives.get(name);\n return record ? renderDirectiveMethod(record) : null;\n })\n .filter((method): method is string => method !== null);\n\n return renderPropertyLines({ entries: methods, indentSize: 2 });\n};\n\nexport type GeneratedModule = {\n readonly code: string;\n readonly stats: {\n readonly objects: number;\n readonly enums: number;\n readonly inputs: number;\n readonly unions: number;\n };\n};\n\ntype PerSchemaInjection = {\n readonly scalarImportPath: string;\n readonly adapterImportPath?: string;\n};\n\ntype RuntimeTemplateInjection =\n | { readonly mode: \"inline\" }\n | {\n readonly mode: \"inject\";\n readonly perSchema: Map<string, PerSchemaInjection>;\n };\n\nexport type RuntimeGenerationOptions = {\n readonly injection?: Map<string, PerSchemaInjection>;\n readonly defaultInputDepth?: Map<string, number>;\n readonly inputDepthOverrides?: Map<string, Readonly<Record<string, number>>>;\n};\n\ntype MultiRuntimeTemplateOptions = {\n readonly schemas: Record<\n string,\n {\n readonly queryType: string;\n readonly mutationType: string;\n readonly subscriptionType: string;\n // Granular: individual variable declarations\n readonly scalarVars: string[];\n readonly enumVars: string[];\n readonly inputVars: string[];\n readonly objectVars: string[];\n readonly unionVars: string[];\n // Granular: type name lists for assembly\n readonly scalarNames: string[];\n readonly enumNames: string[];\n readonly inputNames: string[];\n readonly objectNames: string[];\n readonly unionNames: string[];\n readonly inputTypeMethodsBlock: string;\n readonly directiveMethodsBlock: string;\n readonly fragmentBuildersTypeBlock: string;\n readonly defaultInputDepth?: number;\n readonly inputDepthOverrides?: Readonly<Record<string, number>>;\n }\n >;\n readonly injection: RuntimeTemplateInjection;\n};\n\nconst multiRuntimeTemplate = ($$: MultiRuntimeTemplateOptions) => {\n // Build imports based on injection mode\n const imports: string[] = [];\n const scalarAliases = new Map<string, string>();\n const adapterAliases = new Map<string, string>();\n\n if ($$.injection.mode === \"inject\") {\n // Group imports by file path\n const importsByPath = new Map<string, string[]>();\n\n for (const [schemaName, injection] of $$.injection.perSchema) {\n const scalarAlias = `scalar_${schemaName}`;\n scalarAliases.set(schemaName, scalarAlias);\n\n // Group scalar import\n const scalarSpecifiers = importsByPath.get(injection.scalarImportPath) ?? [];\n if (!importsByPath.has(injection.scalarImportPath)) {\n importsByPath.set(injection.scalarImportPath, scalarSpecifiers);\n }\n scalarSpecifiers.push(`scalar as ${scalarAlias}`);\n\n // Group adapter import (optional)\n if (injection.adapterImportPath) {\n const adapterAlias = `adapter_${schemaName}`;\n adapterAliases.set(schemaName, adapterAlias);\n const adapterSpecifiers = importsByPath.get(injection.adapterImportPath) ?? [];\n if (!importsByPath.has(injection.adapterImportPath)) {\n importsByPath.set(injection.adapterImportPath, adapterSpecifiers);\n }\n adapterSpecifiers.push(`adapter as ${adapterAlias}`);\n }\n }\n\n // Generate grouped imports\n for (const [path, specifiers] of importsByPath) {\n if (specifiers.length === 1) {\n imports.push(`import { ${specifiers[0]} } from \"${path}\";`);\n } else {\n imports.push(`import {\\n ${specifiers.join(\",\\n \")},\\n} from \"${path}\";`);\n }\n }\n }\n\n const extraImports = imports.length > 0 ? `${imports.join(\"\\n\")}\\n` : \"\";\n\n // Generate per-schema definitions (granular pattern)\n const schemaBlocks: string[] = [];\n const gqlEntries: string[] = [];\n\n for (const [name, config] of Object.entries($$.schemas)) {\n const schemaVar = `${name}Schema`;\n\n // Get optional adapter\n const adapterVar = adapterAliases.get(name);\n\n // Build type exports with fragment builders type\n const typeExports = [`export type Schema_${name} = typeof ${schemaVar} & { _?: never };`];\n if (adapterVar) {\n typeExports.push(`export type Adapter_${name} = typeof ${adapterVar} & { _?: never };`);\n }\n typeExports.push(config.fragmentBuildersTypeBlock);\n\n const inputTypeMethodsVar = `inputTypeMethods_${name}`;\n const factoryVar = `createMethod_${name}`;\n const customDirectivesVar = `customDirectives_${name}`;\n\n // Generate __defaultInputDepth block if non-default value\n const defaultDepthBlock =\n config.defaultInputDepth !== undefined && config.defaultInputDepth !== 3\n ? `\\n __defaultInputDepth: ${config.defaultInputDepth},`\n : \"\";\n\n // Generate __inputDepthOverrides block if there are overrides\n const depthOverridesBlock =\n config.inputDepthOverrides && Object.keys(config.inputDepthOverrides).length > 0\n ? `\\n __inputDepthOverrides: ${JSON.stringify(config.inputDepthOverrides)},`\n : \"\";\n\n // Granular: generate individual variable declarations\n const scalarVarsBlock = config.scalarVars.join(\"\\n\");\n const enumVarsBlock = config.enumVars.length > 0 ? config.enumVars.join(\"\\n\") : \"// (no enums)\";\n const inputVarsBlock = config.inputVars.length > 0 ? config.inputVars.join(\"\\n\") : \"// (no inputs)\";\n const objectVarsBlock = config.objectVars.length > 0 ? config.objectVars.join(\"\\n\") : \"// (no objects)\";\n const unionVarsBlock = config.unionVars.length > 0 ? config.unionVars.join(\"\\n\") : \"// (no unions)\";\n\n // Granular: generate assembly references\n // For injection mode, use imported scalar object; otherwise assemble from individual vars\n const scalarAssembly =\n $$.injection.mode === \"inject\"\n ? (scalarAliases.get(name) ?? \"{}\")\n : config.scalarNames.length > 0\n ? `{ ${config.scalarNames.map((n) => `${n}: scalar_${name}_${n}`).join(\", \")} }`\n : \"{}\";\n const enumAssembly =\n config.enumNames.length > 0 ? `{ ${config.enumNames.map((n) => `${n}: enum_${name}_${n}`).join(\", \")} }` : \"{}\";\n const inputAssembly =\n config.inputNames.length > 0 ? `{ ${config.inputNames.map((n) => `${n}: input_${name}_${n}`).join(\", \")} }` : \"{}\";\n const objectAssembly =\n config.objectNames.length > 0 ? `{ ${config.objectNames.map((n) => `${n}: object_${name}_${n}`).join(\", \")} }` : \"{}\";\n const unionAssembly =\n config.unionNames.length > 0 ? `{ ${config.unionNames.map((n) => `${n}: union_${name}_${n}`).join(\", \")} }` : \"{}\";\n\n // Granular: skip individual scalar vars when using injection (scalars come from import)\n const scalarVarsSection = $$.injection.mode === \"inject\" ? \"// (scalars imported)\" : scalarVarsBlock;\n\n // When injecting scalars, use the imported alias directly; otherwise use the assembled category object\n const scalarAssemblyLine =\n $$.injection.mode === \"inject\"\n ? `// scalar_${name} is imported directly`\n : `const scalar_${name} = ${scalarAssembly} as const;`;\n const scalarRef = $$.injection.mode === \"inject\" ? (scalarAliases.get(name) ?? `scalar_${name}`) : `scalar_${name}`;\n\n schemaBlocks.push(`\n// Individual scalar definitions\n${scalarVarsSection}\n\n// Individual enum definitions\n${enumVarsBlock}\n\n// Individual input definitions\n${inputVarsBlock}\n\n// Individual object definitions\n${objectVarsBlock}\n\n// Individual union definitions\n${unionVarsBlock}\n\n// Category assembly\n${scalarAssemblyLine}\nconst enum_${name} = ${enumAssembly} as const;\nconst input_${name} = ${inputAssembly} as const;\nconst object_${name} = ${objectAssembly} as const;\nconst union_${name} = ${unionAssembly} as const;\n\n// Schema assembly\nconst ${schemaVar} = {\n label: \"${name}\" as const,\n operations: { query: \"${config.queryType}\", mutation: \"${config.mutationType}\", subscription: \"${config.subscriptionType}\" } as const,\n scalar: ${scalarRef},\n enum: enum_${name},\n input: input_${name},\n object: object_${name},\n union: union_${name},${defaultDepthBlock}${depthOverridesBlock}\n} as const;\n\nconst ${factoryVar} = createVarMethodFactory<typeof ${schemaVar}>();\nconst ${inputTypeMethodsVar} = ${config.inputTypeMethodsBlock};\nconst ${customDirectivesVar} = { ...createStandardDirectives(), ...${config.directiveMethodsBlock} };\n\n${typeExports.join(\"\\n\")}`);\n\n // Build gql composer as a named variable for Context type extraction\n const gqlVarName = `gql_${name}`;\n if (adapterVar) {\n const typeParams = `<Schema_${name}, FragmentBuilders_${name}, typeof ${customDirectivesVar}, Adapter_${name}>`;\n schemaBlocks.push(\n `const ${gqlVarName} = createGqlElementComposer${typeParams}(${schemaVar}, { adapter: ${adapterVar}, inputTypeMethods: ${inputTypeMethodsVar}, directiveMethods: ${customDirectivesVar} });`,\n );\n } else {\n const typeParams = `<Schema_${name}, FragmentBuilders_${name}, typeof ${customDirectivesVar}>`;\n schemaBlocks.push(\n `const ${gqlVarName} = createGqlElementComposer${typeParams}(${schemaVar}, { inputTypeMethods: ${inputTypeMethodsVar}, directiveMethods: ${customDirectivesVar} });`,\n );\n }\n\n // Export Context type extracted from the gql composer\n schemaBlocks.push(\n `export type Context_${name} = Parameters<typeof ${gqlVarName}>[0] extends (ctx: infer C) => unknown ? C : never;`,\n );\n\n // Prebuilt module exports (for typegen)\n const prebuiltExports: string[] = [\n `export { ${schemaVar} as __schema_${name} }`,\n `export { ${inputTypeMethodsVar} as __inputTypeMethods_${name} }`,\n `export { ${customDirectivesVar} as __directiveMethods_${name} }`,\n ];\n if (adapterVar) {\n prebuiltExports.push(`export { ${adapterVar} as __adapter_${name} }`);\n }\n schemaBlocks.push(`${prebuiltExports.join(\";\\n\")};`);\n\n gqlEntries.push(` ${name}: ${gqlVarName}`);\n }\n\n return `\\\nimport {\n defineEnum,\n type ExtractMetadataAdapter,\n type FragmentBuilderFor,\n createDirectiveMethod,\n createGqlElementComposer,\n createStandardDirectives,\n createVarMethodFactory,\n} from \"@soda-gql/core\";\n${extraImports}\n${schemaBlocks.join(\"\\n\")}\n\nexport const gql = {\n${gqlEntries.join(\",\\n\")}\n};\n`;\n};\n\nexport const generateMultiSchemaModule = (\n schemas: Map<string, DocumentNode>,\n options?: RuntimeGenerationOptions,\n): GeneratedModule => {\n // biome-ignore lint/suspicious/noExplicitAny: complex schema config type\n const schemaConfigs: Record<string, any> = {};\n const allStats = {\n objects: 0,\n enums: 0,\n inputs: 0,\n unions: 0,\n };\n\n for (const [name, document] of schemas.entries()) {\n const schema = createSchemaIndex(document);\n\n // Collect type names\n const objectTypeNames = collectObjectTypeNames(schema);\n const enumTypeNames = collectEnumTypeNames(schema);\n const inputTypeNames = collectInputTypeNames(schema);\n const unionTypeNames = collectUnionTypeNames(schema);\n const customScalarNames = collectScalarNames(schema).filter((n) => !builtinScalarTypes.has(n));\n\n // Generate individual variable declarations (granular pattern)\n const scalarVars: string[] = [];\n const enumVars: string[] = [];\n const inputVars: string[] = [];\n const objectVars: string[] = [];\n const unionVars: string[] = [];\n\n // Builtin scalars\n for (const scalarName of builtinScalarTypes.keys()) {\n const record = schema.scalars.get(scalarName) ?? { name: scalarName, directives: [] };\n scalarVars.push(renderScalarVar(name, record));\n }\n\n // Custom scalars\n for (const scalarName of customScalarNames) {\n const record = schema.scalars.get(scalarName);\n if (record) {\n scalarVars.push(renderScalarVar(name, record));\n }\n }\n\n // Enums\n for (const enumName of enumTypeNames) {\n const record = schema.enums.get(enumName);\n if (record) {\n enumVars.push(renderEnumVar(name, record));\n }\n }\n\n // Inputs\n for (const inputName of inputTypeNames) {\n const record = schema.inputs.get(inputName);\n if (record) {\n inputVars.push(renderInputVar(name, schema, record));\n }\n }\n\n // Objects\n for (const objectName of objectTypeNames) {\n const record = schema.objects.get(objectName);\n if (record) {\n objectVars.push(renderObjectVar(name, schema, record));\n }\n }\n\n // Unions\n for (const unionName of unionTypeNames) {\n const record = schema.unions.get(unionName);\n if (record) {\n unionVars.push(renderUnionVar(name, record));\n }\n }\n\n // Type name lists for assembly\n const allScalarNames = [...builtinScalarTypes.keys(), ...customScalarNames];\n\n const factoryVar = `createMethod_${name}`;\n const inputTypeMethodsBlock = renderInputTypeMethods(schema, factoryVar);\n const directiveMethodsBlock = renderDirectiveMethods(schema);\n // Pass adapter type name if injection has adapter for this schema\n const adapterTypeName = options?.injection?.get(name)?.adapterImportPath ? `Adapter_${name}` : undefined;\n const fragmentBuildersTypeBlock = renderFragmentBuildersType(objectTypeNames, name, adapterTypeName);\n\n const queryType = schema.operationTypes.query ?? \"Query\";\n const mutationType = schema.operationTypes.mutation ?? \"Mutation\";\n const subscriptionType = schema.operationTypes.subscription ?? \"Subscription\";\n\n schemaConfigs[name] = {\n queryType,\n mutationType,\n subscriptionType,\n // Granular: individual variable declarations\n scalarVars,\n enumVars,\n inputVars,\n objectVars,\n unionVars,\n // Granular: type name lists for assembly\n scalarNames: allScalarNames,\n enumNames: enumTypeNames,\n inputNames: inputTypeNames,\n objectNames: objectTypeNames,\n unionNames: unionTypeNames,\n inputTypeMethodsBlock,\n directiveMethodsBlock,\n fragmentBuildersTypeBlock,\n defaultInputDepth: options?.defaultInputDepth?.get(name),\n inputDepthOverrides: options?.inputDepthOverrides?.get(name),\n };\n\n // Accumulate stats\n allStats.objects += objectVars.length;\n allStats.enums += enumVars.length;\n allStats.inputs += inputVars.length;\n allStats.unions += unionVars.length;\n }\n\n const injection: RuntimeTemplateInjection = options?.injection\n ? { mode: \"inject\", perSchema: options.injection }\n : { mode: \"inline\" };\n\n const code = multiRuntimeTemplate({\n schemas: schemaConfigs,\n injection,\n });\n\n return {\n code,\n stats: allStats,\n };\n};\n"],"mappings":";;;AAcA,MAAM,qBAAqB,IAAI,IAAiE;CAC9F,CAAC,MAAM;EA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AC;AAEF,QAAO;EACL;EACA,OAAO;EACR"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
const require_generator = require('./generator-
|
|
1
|
+
const require_generator = require('./generator-w9tj5XXW.cjs');
|
|
2
2
|
let node_fs = require("node:fs");
|
|
3
3
|
let node_path = require("node:path");
|
|
4
4
|
let neverthrow = require("neverthrow");
|
|
5
|
-
let node_fs_promises = require("node:fs/promises");
|
|
6
5
|
let esbuild = require("esbuild");
|
|
7
6
|
let graphql = require("graphql");
|
|
8
7
|
let node_crypto = require("node:crypto");
|
|
@@ -92,85 +91,6 @@ const writeModule = (outPath, contents) => {
|
|
|
92
91
|
}
|
|
93
92
|
};
|
|
94
93
|
|
|
95
|
-
//#endregion
|
|
96
|
-
//#region packages/codegen/src/prebuilt-generator.ts
|
|
97
|
-
/**
|
|
98
|
-
* Generate the prebuilt module code.
|
|
99
|
-
*
|
|
100
|
-
* This generates:
|
|
101
|
-
* - prebuilt/index.ts: Uses createPrebuiltGqlElementComposer with types from PrebuiltTypes
|
|
102
|
-
* - prebuilt/types.ts: Placeholder types that builder will populate
|
|
103
|
-
*/
|
|
104
|
-
const generatePrebuiltModule = (schemas, options) => {
|
|
105
|
-
const schemaNames = Array.from(schemas.keys());
|
|
106
|
-
const typeImports = [];
|
|
107
|
-
const runtimeImports = [];
|
|
108
|
-
for (const name of schemaNames) {
|
|
109
|
-
typeImports.push(`Schema_${name}`, `FragmentBuilders_${name}`, `Context_${name}`);
|
|
110
|
-
runtimeImports.push(`__schema_${name}`, `__inputTypeMethods_${name}`, `__directiveMethods_${name}`);
|
|
111
|
-
const hasAdapter = options.injection?.get(name)?.adapterImportPath !== undefined;
|
|
112
|
-
if (hasAdapter) {
|
|
113
|
-
typeImports.push(`Adapter_${name}`);
|
|
114
|
-
runtimeImports.push(`__adapter_${name}`);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
const gqlEntries = [];
|
|
118
|
-
for (const name of schemaNames) {
|
|
119
|
-
const document = schemas.get(name);
|
|
120
|
-
if (!document) continue;
|
|
121
|
-
const hasAdapter = options.injection?.get(name)?.adapterImportPath !== undefined;
|
|
122
|
-
if (hasAdapter) {
|
|
123
|
-
gqlEntries.push(` ${name}: createPrebuiltGqlElementComposer<Schema_${name}, PrebuiltTypes_${name}, FragmentBuilders_${name}, typeof __directiveMethods_${name}, Context_${name}, Adapter_${name}>(__schema_${name}, { adapter: __adapter_${name}, inputTypeMethods: __inputTypeMethods_${name}, directiveMethods: __directiveMethods_${name} })`);
|
|
124
|
-
} else {
|
|
125
|
-
gqlEntries.push(` ${name}: createPrebuiltGqlElementComposer<Schema_${name}, PrebuiltTypes_${name}, FragmentBuilders_${name}, typeof __directiveMethods_${name}, Context_${name}>(__schema_${name}, { inputTypeMethods: __inputTypeMethods_${name}, directiveMethods: __directiveMethods_${name} })`);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
const indexCode = `\
|
|
129
|
-
/**
|
|
130
|
-
* Prebuilt GQL module for bundler-compatible type resolution.
|
|
131
|
-
*
|
|
132
|
-
* This module uses createPrebuiltGqlElementComposer which looks up types
|
|
133
|
-
* from PrebuiltTypes instead of using complex type inference.
|
|
134
|
-
*
|
|
135
|
-
* @module
|
|
136
|
-
* @generated by @soda-gql/codegen
|
|
137
|
-
*/
|
|
138
|
-
|
|
139
|
-
import { createPrebuiltGqlElementComposer } from "@soda-gql/core";
|
|
140
|
-
import {
|
|
141
|
-
${runtimeImports.join(",\n ")},
|
|
142
|
-
type ${typeImports.join(",\n type ")},
|
|
143
|
-
} from "${options.mainModulePath}";
|
|
144
|
-
import type { ${schemaNames.map((name) => `PrebuiltTypes_${name}`).join(", ")} } from "./types";
|
|
145
|
-
|
|
146
|
-
export const gql = {
|
|
147
|
-
${gqlEntries.join(",\n")}
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
// Re-export types from main module
|
|
151
|
-
export type { ${typeImports.join(", ")} };
|
|
152
|
-
`;
|
|
153
|
-
const typesCode = `\
|
|
154
|
-
/**
|
|
155
|
-
* Prebuilt type registry.
|
|
156
|
-
*
|
|
157
|
-
* This file contains placeholder types that will be populated by the builder
|
|
158
|
-
* when running \`soda-gql build\` command.
|
|
159
|
-
*
|
|
160
|
-
* @module
|
|
161
|
-
* @generated by @soda-gql/codegen
|
|
162
|
-
*/
|
|
163
|
-
|
|
164
|
-
import type { EmptyPrebuiltTypeRegistry } from "@soda-gql/core";
|
|
165
|
-
|
|
166
|
-
${schemaNames.map((name) => `// Placeholder for ${name} schema - populated by builder\nexport type PrebuiltTypes_${name} = EmptyPrebuiltTypeRegistry;`).join("\n\n")}
|
|
167
|
-
`;
|
|
168
|
-
return {
|
|
169
|
-
indexCode,
|
|
170
|
-
typesCode
|
|
171
|
-
};
|
|
172
|
-
};
|
|
173
|
-
|
|
174
94
|
//#endregion
|
|
175
95
|
//#region packages/codegen/src/schema.ts
|
|
176
96
|
/**
|
|
@@ -309,11 +229,10 @@ const runCodegen = async (options) => {
|
|
|
309
229
|
const { code } = require_generator.generateMultiSchemaModule(schemas, {
|
|
310
230
|
injection: injectionConfig,
|
|
311
231
|
defaultInputDepth: defaultInputDepthConfig.size > 0 ? defaultInputDepthConfig : undefined,
|
|
312
|
-
inputDepthOverrides: inputDepthOverridesConfig.size > 0 ? inputDepthOverridesConfig : undefined
|
|
313
|
-
exportForPrebuilt: options.prebuilt
|
|
232
|
+
inputDepthOverrides: inputDepthOverridesConfig.size > 0 ? inputDepthOverridesConfig : undefined
|
|
314
233
|
});
|
|
315
234
|
for (const [name, document] of schemas.entries()) {
|
|
316
|
-
const schemaIndex = (await Promise.resolve().then(() => require("./generator-
|
|
235
|
+
const schemaIndex = (await Promise.resolve().then(() => require("./generator-CO6Ta7fM.cjs"))).createSchemaIndex(document);
|
|
317
236
|
const objects = Array.from(schemaIndex.objects.keys()).filter((n) => !n.startsWith("__")).length;
|
|
318
237
|
const enums = Array.from(schemaIndex.enums.keys()).filter((n) => !n.startsWith("__")).length;
|
|
319
238
|
const inputs = Array.from(schemaIndex.inputs.keys()).filter((n) => !n.startsWith("__")).length;
|
|
@@ -330,32 +249,6 @@ const runCodegen = async (options) => {
|
|
|
330
249
|
if (writeResult.isErr()) {
|
|
331
250
|
return (0, neverthrow.err)(writeResult.error);
|
|
332
251
|
}
|
|
333
|
-
if (options.prebuilt) {
|
|
334
|
-
const prebuiltDir = (0, node_path.join)((0, node_path.dirname)(outPath), "prebuilt");
|
|
335
|
-
await (0, node_fs_promises.mkdir)(prebuiltDir, { recursive: true });
|
|
336
|
-
const mainModulePath = toImportSpecifier((0, node_path.join)(prebuiltDir, "index.ts"), outPath, importSpecifierOptions);
|
|
337
|
-
const prebuilt = generatePrebuiltModule(schemas, {
|
|
338
|
-
mainModulePath,
|
|
339
|
-
injection: injectionConfig
|
|
340
|
-
});
|
|
341
|
-
const prebuiltIndexPath = (0, node_path.join)(prebuiltDir, "index.ts");
|
|
342
|
-
const prebuiltIndexResult = await writeModule(prebuiltIndexPath, prebuilt.indexCode).match(() => Promise.resolve((0, neverthrow.ok)(undefined)), (error) => Promise.resolve((0, neverthrow.err)(error)));
|
|
343
|
-
if (prebuiltIndexResult.isErr()) {
|
|
344
|
-
return (0, neverthrow.err)(prebuiltIndexResult.error);
|
|
345
|
-
}
|
|
346
|
-
const prebuiltTypesPath = (0, node_path.join)(prebuiltDir, "types.ts");
|
|
347
|
-
const prebuiltTypesResult = await writeModule(prebuiltTypesPath, prebuilt.typesCode).match(() => Promise.resolve((0, neverthrow.ok)(undefined)), (error) => Promise.resolve((0, neverthrow.err)(error)));
|
|
348
|
-
if (prebuiltTypesResult.isErr()) {
|
|
349
|
-
return (0, neverthrow.err)(prebuiltTypesResult.error);
|
|
350
|
-
}
|
|
351
|
-
const prebuiltBundleOutcome = await esbuildBundler.bundle({
|
|
352
|
-
sourcePath: prebuiltIndexPath,
|
|
353
|
-
external: ["@soda-gql/core", "@soda-gql/runtime"]
|
|
354
|
-
});
|
|
355
|
-
if (prebuiltBundleOutcome.isErr()) {
|
|
356
|
-
return (0, neverthrow.err)(prebuiltBundleOutcome.error);
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
252
|
const bundleOutcome = await esbuildBundler.bundle({
|
|
360
253
|
sourcePath: outPath,
|
|
361
254
|
external: ["@soda-gql/core", "@soda-gql/runtime"]
|