Skip to content

Commit 49b2e40

Browse files
committed
fix(types): exclude the computed fields for functions embeding
1 parent 65f2f41 commit 49b2e40

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/select-query-parser/result.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,7 @@ type ProcessEmbeddedResourceResult<
376376
relation: GenericRelationship & {
377377
match: 'refrel' | 'col' | 'fkname' | 'func'
378378
isNotNullable?: boolean
379+
referencedRelation: string
379380
}
380381
direction: string
381382
},
@@ -385,7 +386,11 @@ type ProcessEmbeddedResourceResult<
385386
ClientOptions,
386387
Schema,
387388
Resolved['referencedTable']['Row'],
388-
Field['name'],
389+
// For embeded function selection, the source of truth is the 'referencedRelation'
390+
// coming from the SetofOptions.to parameter
391+
Resolved['relation']['match'] extends 'func'
392+
? Resolved['relation']['referencedRelation']
393+
: Field['name'],
389394
Resolved['referencedTable']['Relationships'],
390395
Field['children'] extends undefined
391396
? []

0 commit comments

Comments
 (0)