1
1
import { generateQueryBuilder as runQueryBuilderGenerator } from '@edgedb/generate/dist/edgeql-js.js' ;
2
2
import { groupBy } from '@seedcompany/common' ;
3
- import { Directory , SyntaxKind } from 'ts-morph' ;
3
+ import { Directory } from 'ts-morph' ;
4
4
import { customScalars } from './scalars' ;
5
5
import { addCustomScalarImports , GeneratorParams } from './util' ;
6
6
@@ -27,7 +27,6 @@ export async function generateQueryBuilder({
27
27
updateCastMapsForOurCustomScalars ( qbDir ) ;
28
28
changeImplicitIDType ( qbDir ) ;
29
29
allowOrderingByEnums ( qbDir ) ;
30
- mergeDefaultTypesWithModuleNames ( qbDir ) ;
31
30
}
32
31
33
32
function addJsExtensionDeepPathsOfEdgedbLibrary ( qbDir : Directory ) {
@@ -118,29 +117,3 @@ function allowOrderingByEnums(qbDir: Directory) {
118
117
. setType ( 'TypeSet<EnumType | ScalarType | ObjectType>' ) ;
119
118
file . fixMissingImports ( ) ;
120
119
}
121
-
122
- function mergeDefaultTypesWithModuleNames ( qbDir : Directory ) {
123
- const file = qbDir . getSourceFileOrThrow ( 'index.ts' ) ;
124
- const st = file . getVariableDeclarationOrThrow ( 'ExportDefault' ) ;
125
- const typeText = st . getTypeNodeOrThrow ( ) . getFullText ( ) ;
126
- const value = st . getInitializerIfKindOrThrow (
127
- SyntaxKind . ObjectLiteralExpression ,
128
- ) ;
129
- // Regex is faster here than ts-morph type parsing
130
- const conflicting = (
131
- typeText . match ( / O m i t < t y p e o f _ d e f a u l t , ( .+ ) > / ) ?. [ 1 ] . split ( / \| / g) ?? [ ]
132
- ) . map ( ( s ) => s . slice ( 1 , - 1 ) ) ;
133
- let newTypeText = typeText ;
134
- for ( const name of conflicting ) {
135
- newTypeText = newTypeText . replace (
136
- `typeof _${ name } ` ,
137
- `typeof _${ name } & typeof _default.${ name } ` ,
138
- ) ;
139
- value
140
- . getPropertyOrThrow ( `"${ name } "` )
141
- . asKindOrThrow ( SyntaxKind . PropertyAssignment )
142
- . getInitializerOrThrow ( )
143
- . replaceWithText ( `{ ..._${ name } , ..._default.${ name } }` ) ;
144
- }
145
- st . setType ( newTypeText ) ;
146
- }
0 commit comments