refactor(postgrest-typegen): drop the unused postgres-meta options from the introspection - #180
Open
spydon wants to merge 2 commits into
Conversation
…om the introspection The SQL builders kept every option of the postgres-meta managers they were ported from: limit and offset, id and name filters, table identifier filters, the functions args filter and the types flags. introspect() only ever sets the schema filter, the builders are not exported, and nothing else in the repository passes the other options, so they were unreachable. Each builder now takes the schema filter alone and the types query is a constant, which also removes the blank filter lines from the rendered SQL and the lint suppression the args interpolation needed. introspect() no longer re-filters the schemas rows in JavaScript, since the query already applies the same include and exclude filter, and passes the filter it built to listRelationships instead of having it rebuilt. The cartesian product in the view relationship expansion is a flatMap.
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
spydon
added this pull request to stack #182
September 14, 2026 15:56
…lders Every caller passes it, so an optional field only hides a forgotten filter. Also drop the removed limit interpolation from the pg-format note.
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.
Stacked on #179.
Summary
The introspection SQL builders were ported from postgres-meta's managers together with every option those managers accept:
limit,offset,idsFilter,nameFilter,tableIdentifierFilter,viewIdentifierFilter,columnNameFilter,tableIdFilter, theargsfilter of the functions query and theincludeTableTypes/includeArrayTypesflags of the types query.introspect()sets exactly one of them, the schema filter. The builders are not exported from the package and nothing else in the repository passes the other options, so they were unreachable code that still had to be read around.SchemaFilterProps, a requiredschemaFilterand nothing else.TYPES_SQLbecomes a constant since it had no variable part left.argsblock ofFUNCTIONS_SQL, a nested ternary interpolating astring[]throughArray#toString, goes away together with the file-wide lint suppression it needed.introspect()no longer re-filters theschemasrows in JavaScript. The query already applies the same include and exclude filter; the only case where the two differed was a schema listed in both lists, which the JavaScript filter dropped fromschemaswhile every other collection still contained it.introspect()passes the filter it already built tolistRelationshipsinstead of having it rebuilt from the options.expandViewRelationshipsis aflatMapinstead of the gist-linkedmap/reducepair.Verification
bun run testwith Docker: 133 pass, including the introspection integration tests and the view relationship expansions.sql.test.tsregenerated; the diff is the removed blank lines, the constantTYPES_SQL, and the schemas query's unconditionalpg_exclusion.check-types,format-and-lintandknippass.Generated output is unchanged for every option combination
introspect()can produce, so the byte-parity constraint with postgres-meta holds.