feat: inline pg-type-mappings plugin into graphile-settings#688
Merged
pyramation merged 5 commits intodevelop-v5from Feb 5, 2026
Merged
feat: inline pg-type-mappings plugin into graphile-settings#688pyramation merged 5 commits intodevelop-v5from
pyramation merged 5 commits intodevelop-v5from
Conversation
- Add PgTypeMappingsPlugin that maps custom PostgreSQL types to GraphQL scalars - Default mappings: email, hostname, url, origin -> String; multiple_select, single_select -> JSON - Uses v5 gather hooks to create codecs for custom types - Uses v5 schema hooks to map codecs to GraphQL types - Add PgTypeMappingsPreset to ConstructivePreset - Export plugin and types from plugins/index.ts
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:
|
- Remove single_select and multiple_select type mappings (jsonb types) - Simplify TypeMapping interface to only support String type - Remove JSON-related code from fromPg function - Keep only email, hostname, origin, url mappings
… rename to constructiveInternalType* - Remove single_select and multiple_select domain files from fixtures - Rename pgpmInternalType* to constructiveInternalType* in all domain comments - Update pgpm.plan to remove single_select/multiple_select entries
- email: remove complex regex, keep as citext - hostname: remove regex - url: remove regex - origin: remove regex - attachment: remove regex - image: jsonb requiring only 'url' key - upload: jsonb requiring at least one of 'url', 'id', or 'key'
URL validation: ^https?://[^\s]+$ - Must start with http:// or https:// - Must have at least one character after protocol - No whitespace allowed
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
Inlines the
graphile-pg-type-mappingsplugin from the main branch intographile-settingsas a PostGraphile v5 preset. This plugin maps custom PostgreSQL types to GraphQL scalar types.Default mappings:
email,hostname,url,origin→ StringThe v4 plugin used
builder.hook()patterns. This v5 conversion uses:gather.hooks.pgCodecs_findPgCodecto create codecs for custom typesschema.hooks.initto map codecs to GraphQL typesUpdates since last revision
single_selectandmultiple_selecttypes - These JSONB domain types have been removed from the type mappings as they are no longer needed@name pgpmInternalType*to@name constructiveInternalType*email: now justcitext(no regex - real validation is email confirmation)hostname: now justtext(no regex - real validation is DNS resolution)url,origin,attachment: now justtext(no regex)image: jsonb requiring onlyurlkey (removedmimerequirement and URL regex)upload: jsonb requiring at least one ofurl,id, orkey(removedmimerequirement and URL regex)__fixtures__/sqitch/simple-w-exts/extensions/@pgpm/types/directory updated to matchCompanion PR: constructive-db#469 contains the corresponding database-side changes.
Review & Testing Checklist for Human
uploaddomain now acceptsidorkeyas alternatives tourl. Verify this aligns with how uploads are used in the applicationemaildomain type and confirm it appears asStringin the GraphQL schemaRecommended test plan:
uploaddomain with{"id": "123"}and{"key": "abc"}objectsNotes
The original v4 plugin source was retrieved from
origin/main:graphile/graphile-pg-type-mappings/src/index.ts. The standalone package directory on develop-v5 only containeddist/andnode_modules/(no source).Link to Devin run: https://app.devin.ai/sessions/ba45b64c92bb4307bf9e920123213d9e
Requested by: Dan Lynch (@pyramation)