feat(codegen): wire condition arg through ORM query builder for findMany/findFirst#794
Merged
pyramation merged 1 commit intomainfrom Mar 12, 2026
Merged
Conversation
…any/findFirst
- Add TCondition generic and condition?: TCondition to FindManyArgs and FindFirstArgs
- Add conditionTypeName parameter and addVariable() call in buildFindManyDocument/buildFindFirstDocument
- Wire ${TypeName}Condition into model-generator for findMany/findFirst methods
- Add unit tests for condition wiring in model-generator and query-builder
- Update snapshots
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.
feat(codegen): wire condition arg through ORM query builder for findMany/findFirst
Summary
Adds
TConditiongeneric parameter support to the ORM layer so that generated model classes can accept and forwardconditionarguments (e.g.,embeddingNearbyfor vector search,bm25Bodyfor BM25) throughfindManyandfindFirstoperations.Changes across 4 source files:
select-types.ts(template + ORM): AddedTConditiongeneric andcondition?: TConditionfield toFindManyArgsandFindFirstArgsquery-builder.ts: AddedconditionTypeNameparameter andaddVariable()call forconditionin bothbuildFindManyDocumentandbuildFindFirstDocument. MadeVariableSpec.typeNameoptional with a guard so condition is cleanly skipped when not provided.model-generator.ts: Wires${TypeName}Conditioninto imports, generic type params, body arg forwarding, and document builder calls for bothfindManyandfindFirst3 new tests + 4 updated snapshots:
Review & Testing Checklist for Human
VariableSpec.typeNamechange is safe: Changed fromtypeName: stringtotypeName?: stringinquery-builder.ts(line 825). TheaddVariableguard (!spec.typeName) prevents runtime errors, but confirm no other callers depend ontypeNamebeing required at the type level.buildFindManyDocument, condition is added before where/filter. InbuildFindFirstDocument, condition is added after where/filter. GraphQL doesn't care about variable order, but confirm this inconsistency is acceptable.${typeName}Conditionnaming convention: The condition type name is hardcoded as${typeName}Conditionin model-generator (line 178). Confirm this matches what PostGraphile actually generates for all table types.Notes
codegen/vectors-v2, with proper code style and comprehensive testsdevin/1773279354-fix-vector-codegen-v2)