refactor: remove duplicative re-exports and options from graphql packages#764
Merged
pyramation merged 2 commits intomainfrom Mar 2, 2026
Merged
Conversation
…ages - Delete graphql/server/src/options.ts (type re-exports, duplicate defaults, unused type guards, legacy detection) - Remove export * from '@pgpmjs/types' in graphql/types/src/index.ts - Remove all re-exports from graphql/env/src/index.ts (was re-exporting @pgpmjs/env and @constructive-io/graphql-types) - Remove duplicate ApiOptions type from graphql/server/src/types.ts - Replace normalizeServerOptions with direct getEnvOptions call in server.ts - Update middleware imports: getNodeEnv from @pgpmjs/env, ApiOptions -> ConstructiveOptions - Add @pgpmjs/env as direct dependency of graphql/server
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Eliminates duplicative type re-exports, redundant defaults, unused type guards, and dead legacy-detection code across
graphql/server,graphql/types, andgraphql/env. Consumers should import from OG sources (@pgpmjs/types,@pgpmjs/env,@constructive-io/graphql-types) instead of through convenience re-export layers.Deleted:
graphql/server/src/options.ts— 298 lines of re-exported types, duplicateserverDefaults, unused type guards (isConstructiveOptions,hasPgConfig,hasServerConfig,hasApiConfig), deadisLegacyOptions/LEGACY_FIELDS, and redundantnormalizeServerOptionsRemoved re-exports:
graphql/types/src/index.ts: removedexport * from '@pgpmjs/types'graphql/env/src/index.ts: removed re-exports of@pgpmjs/env(loadConfigSync,getNodeEnv, etc.) and@constructive-io/graphql-types(ConstructiveOptions,constructiveDefaults, etc.)Updated:
graphql/server/src/server.ts: replacednormalizeServerOptions(rawOpts) → getEnvOptions(normalized)with directgetEnvOptions(rawOpts)getNodeEnvnow from@pgpmjs/env(OG source) instead of@constructive-io/graphql-envgraphql/server/package.json: added@pgpmjs/envas direct dependencyUpdates since last revision
ApiOptionstype for the API middleware, but implemented as composition from OG sources (not a duplicated shape):ApiOptions = PgpmOptions & { api?: ApiConfig }whereApiConfigisApiOptionsfrom@constructive-io/graphql-typesgraphql/server/src/middleware/api.tsnow correctly acceptsApiOptions(notConstructiveOptions) to keep the middleware surface area minimal/semantic.Review & Testing Checklist for Human
server.tsnow callsgetEnvOptions(rawOpts)directly instead ofnormalizeServerOptions(rawOpts) → getEnvOptions(normalized). The old flow mergedserverDefaultsfirst, then passed togetEnvOptions. The new flow passesrawOptsdirectly andgetEnvOptionsappliesconstructiveDefaultsinternally. Values should be equivalent, but precedence changed slightly.createApiMiddleware/getApiConfig/getSvcKeyshould only requirepg+apiconfig. Sanity-check any call sites that previously passed fullConstructiveOptionsstill type-check (they should, sinceConstructiveOptionsis compatible withPgpmOptions & { api?: ... }if itsapitype matches).@constructive-io/graphql-env/@constructive-io/graphql-typesas “barrel” modules for pgpm exports.pnpm devingraphql/server) and verify API resolution paths (services-disabled, domain lookup, X-Schemata / X-Api-Name headers) still behave as expected.Notes
pnpm buildat repo root andpnpm testingraphql/serverandgraphql/envwere run successfully during development.pnpm-lock.yamlhas a large diff due to install/lock formatting changes.Session: https://app.devin.ai/sessions/0e3e61f1ce1340e7b5232ca2a687bcf5
Requested by: @pyramation