refactor(codegen): remove default selects entirely (Path A) #694
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.
refactor(codegen): remove default selects entirely, make selection required
Summary
Removes all default select logic from the codegen package (Path A). Previously, every generated hook and ORM model method had two overloads: one requiring an explicit
fields/select, and a second that fell back to aconst defaultSelect = { id: true } as constwhen no fields were provided. This "magic" fallback is removed —selectionwithfieldsis now required in all hook and ORM method signatures.What was removed:
getDefaultSelectFieldName()fromutils.tsbuildDefaultSelectLiteral()fromselect-helpers.tsbuildSelectFallbackExpr(),buildDefaultSelectExpr(),withoutFieldsSelectionType(),withoutFieldsListSelectionType(),NON_SELECT_TYPES_ASTfromhooks-ast.tsbuildDefaultSelectExpression()fromorm/custom-ops-generator.tsconst defaultSelect = ...declarations and Overload 2 (without fields) from all generatorsdefaultRef()helper and related fallback logic fromorm/model-generator.tsNet result: ~1,300 lines removed, 25 snapshots updated to reflect the simpler single-overload signatures.
Updates since last revision
makagefrom0.1.10→0.1.12across all 78 workspace packages. This picks up theENOTEMPTYrace condition fix (maxRetries: 3onfs.rminclean.ts) that was causing intermittent CI build failures in packages likepg-ast,csv-to-pg, etc.Review & Testing Checklist for Human
selection/fieldsrequired is intentional but breaking. Any existing consumer code calling hooks without specifying fields will fail to compile. Confirm this is the desired behavior before merging.defaultSelectreferences — no unintended logic changes. Whitespace/formatting differences from Babel AST output are expected.findMany,findFirst,findOne,create,update,deleteall properly requireselectin their signatures (no optional fallback).typeRegistryparameter fromgenerateCustomQueryOpsFile/generateCustomMutationOpsFiledoesn't break anything (it was only used for building default selects).pnpm build && pnpm testingraphql/codegen— all 204 tests should pass. CI should now pass with makage 0.1.12.Notes