@suaveplan/api-graphql — abstract GraphQL contract for the Suaveplan API plugin system. Owns the GraphqlRegistry / Resolver / LoaderFactory / SubscriptionResolver re-exports, federation SDL merger with collision detection + plugin namespace wrapping, @auth + @rateLimit directive descriptors, the GraphqlEngine lifecycle interface, the GRAPHQL_CODES registry, and the runGraphqlEngineConformance harness. No concrete engine — Yoga / Apollo land packages and implement the contract.
Stage-1 abstract GraphQL contract for the Suaveplan API plugin system.
Plugins contribute SDL + resolvers via a small abstract surface; the host
federates a single schema across every plugin and dispatches via a
swappable engine. Concrete engines (api-graphql-yoga default,
api-graphql-apollo alternative) live and implement the
GraphqlEngine contract published from this package.
Documentation tree
- directives — Host-supplied GraphQL directive descriptors that engine adapters install at schema-build time. The contract layer ships…
- directives — Host-supplied GraphQL directive descriptors that engine adapters install at schema-build time. The contract layer ships…
- error-codes — Stable error-code registry for
@suaveplan/api-graphql. Every public failure path raises aGraphqlErrorcarrying one…- error-codes — Stable error-code registry for
@suaveplan/api-graphql. Every public failure path raises aGraphqlErrorcarrying one…
- error-codes — Stable error-code registry for
- merge-sdl — Federate one or more plugin SDL contributions into a single merged schema. This is the engine-agnostic federation step…
- namespace — Apply the
graphql.namespacewrapper to a plugin's parsed SDL blocks. Plugins that declarenamespace: "Billing"in t… - parse-sdl — Minimal SDL parser used by the federation merger to locate
type Name { ... }andextend type Name { ... }blocks pl… - registry — Concrete accumulator-style
GraphqlRegistryimplementation. The host hands each plugin one of these during the GraphQL…- registry — Concrete accumulator-style
GraphqlRegistryimplementation. The host hands each plugin one of these during the GraphQL…
- registry — Concrete accumulator-style
- subscription — Validate incoming
graphql-wssubscription envelopes and surface a typed "transport unavailable" failure whenapi-ws…- subscription — Validate incoming
graphql-wssubscription envelopes and surface a typed "transport unavailable" failure whenapi-ws…
- subscription — Validate incoming
- testing —
runGraphqlEngineConformanceis the cross-engine test harness every concrete GraphQL engine (api-graphql-yoga, `api-…- conformance —
runGraphqlEngineConformanceis the cross-engine test harness every concrete GraphQL engine (api-graphql-yoga, `api-…
- conformance —
- validators — Pre-build validators concrete GraphQL engines call after
registry.freeze()and beforebuildSchema. The contract lay…- validators — Pre-build validators concrete GraphQL engines call after
registry.freeze()and beforebuildSchema. The contract lay…
- validators — Pre-build validators concrete GraphQL engines call after
Surface
./registry— abstractGraphqlRegistryaccumulator (addTypes/addResolvers/addLoader) +freeze()../resolver—Resolver(re-exported from@suaveplan/api-types) and the keyedResolverMap/ResolverFieldMap../loader—LoaderFactory(re-exported) and theBatchFnsignature../subscription—SubscriptionResolver(re-exported) + Zod-validatedgraphql-wsenvelope + transport-availability assertion../federation—mergeSdlcollision detector +graphql.namespacewrapper + minimal SDL parser../directives—@auth(scope: String!)and@rateLimit(rpm: Int!)descriptors +HOST_DIRECTIVESlookup../engine— abstractGraphqlEnginelifecycle interface implemented by Stage-7 packages../capability-id— re-export of"graphql"literal +GRAPHQL_CAPABILITY_IDruntime constant../error-codes—GRAPHQL_CODESregistry +GraphqlErrorclass../validators—validateResolvers,lookupDirective,lookupLoaderpre-build checks../testing—runGraphqlEngineConformancecross-engine harness.
Error codes (GRAPHQL.*)
| Code | When |
|---|---|
SCHEMA_COLLISION |
Two plugins declare the same Type.field. |
RESOLVER_MISSING |
SDL declares a root field with no resolver. |
LOADER_DUPLICATE_NAME |
Two addLoader calls registered the same name. |
LOADER_NOT_REGISTERED |
Request references an unknown loader. |
DIRECTIVE_UNKNOWN |
SDL references an uninstalled directive. |
SUBSCRIPTION_TRANSPORT_UNAVAILABLE |
Subscriptions used without api-ws. |
NAMESPACE_REQUIRED |
Strict-mode federation missing namespace. |
Stage
Contracts. No concrete GraphQL engine; Yoga / Apollo / GraphiQL / Altair packages land .
Dependencies
@suaveplan/api-types— type-level contract surface.@suaveplan/error—defineCodes+SuaveplanErrorbase.zod— subscription protocol envelope validation.tslib— TypeScript helper functions.