Add Alloy infrastructure, context system, and field components#77
Conversation
8f1da87 to
8b51ca4
Compare
8f411e1 to
5f26c25
Compare
After the TypeGraph refactor in PR #77, ScalarVariant was removed from the context module. Move it to schema-mutator.ts where it belongs since it's part of the MutatedSchema interface.
|
After This matters because:
Fix: after |
Architecture discussionAfter tracing the full PR chain (#77→#85), here's how I think the pieces should fit together: Data flowTypeGraph wiring
Type resolution
const resolved = resolveGraphQLType(property.type, ...);
<gql.Field name={property.name} type={resolved.typeName} nonNull={resolved.nonNull}>
{resolved.listLayers.reduceRight(
(inner, layerNonNull) => <gql.Field.List nonNull={layerNonNull}>{inner}</gql.Field.List>,
undefined
)}
</gql.Field>This also fixes the nested list issue ( Component data flowComponents should get their types from What stays the same
We should also add tests in each PR to catch edge cases, errors, rather than doing it all at once at the end. |
ea85714 to
7edda3d
Compare
7edda3d to
3f74c91
Compare
- Build: @alloy-js/graphql (linked local), JSX transpilation via alloy build, rollup plugin for vitest - Context: GraphQLSchemaContext provider with TypeGraph from mutation engine (single source of truth, no duplicate interface) - Components: Field and OperationField — thin translators from mutated types to Alloy GraphQL SDL components. Use resolveGraphQLTypeName for type names and decorator-based nullable state. No type-expression render-prop indirection (mutation pipeline handles all transforms). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
3f74c91 to
21abccf
Compare
|
@swatkatz Additions LGTM! thanks! |
swatkatz
left a comment
There was a problem hiding this comment.
Since Fiona is the author, she can't officially approve this PR, so I am approving it on her behalf as I wrote the code, so it is fine to swap roles: https://pinterest.slack.com/archives/C08UD3MR5QT/p1781035265891089?thread_ts=1780928581.664069&cid=C08UD3MR5QT
Summary
Adds the Alloy component infrastructure for the GraphQL emitter, stacked on PR #89 (structural transforms):
@alloy-js/core,@alloy-js/graphql), build tooling (alloy build, rollup plugin)GraphQLSchemaContextwithTypeGraph— imports the interface frommutation-engine/type-graph.ts(single source of truth)FieldandOperationFieldcomponents — thin translators from mutated types to Alloy GraphQL SDL componentsresolveGraphQLTypeName(shared lib) for type name resolution and decorator-based nullable stateNo
GraphQLTypeExpressionrender-prop component — the mutation pipeline (PRs #88, #89) already handles name composition, nullable unwrapping, record-to-scalar, and union transforms. Components just readtype.nameand nullable metadata.Key design decisions
resolveGraphQLTypeNamehandles the one exception: std scalars (string→String,int32→Int) which the mutation engine intentionally leaves untouched to avoid mutating shared compiler singletons.Test plan
Stacked on #89.
🤖 Generated with Claude Code