Skip to content

Commit 962b388

Browse files
committed
Move schema mutation orchestration into the mutation engine
The emitter used to walk the schema namespace itself, bucket types by kind, dedup scalars, and run a second classification pass to split models into input/output variants. That loop also leaked implementation details (an `originalToMutated` back-map and a `TypeUsageResolver` that outlived mutation) into the emitter's public shape. Introduce `GraphQLMutationEngine.mutateSchema(schema, typeUsage)` that returns a fully-classified `MutatedSchema`: - Pre-bucketed models: `interfaces`, `outputModels`, `inputModels` - Pre-classified operations: `queries`, `mutations`, `subscriptions` - Derived metadata: `wrapperModels`, `scalarVariants`, `scalarSpecifications` Classification happens inline during the walk. `typeUsage` is consumed entirely inside the engine; the emitter hands it over and never touches it again. `originalToMutated` no longer exists outside the engine. Implementation lives in `src/mutation-engine/schema-mutator.ts` as a free function called from the `GraphQLMutationEngine` class to avoid a circular import between engine.ts and schema-mutator.ts. The emitter's `emitSchema` reduces to: resolve type usage, call `engine.mutateSchema`, report void-return diagnostics, check for empty schema, build variant lookups, hand off to the (stubbed) renderer.
1 parent 5c9fbb4 commit 962b388

4 files changed

Lines changed: 371 additions & 349 deletions

File tree

0 commit comments

Comments
 (0)