@@ -2,7 +2,6 @@ import { type Result, withResult } from '@byteslice/result'
22import type {
33 Encrypted as CipherStashEncrypted ,
44 EncryptedQuery as CipherStashEncryptedQuery ,
5- EncryptedV3Query as CipherStashEncryptedV3Query ,
65} from '@cipherstash/protect-ffi'
76import {
87 encryptQueryBulk as ffiEncryptQueryBulk ,
@@ -83,17 +82,17 @@ function buildQueryPayload(
8382 */
8483function assembleResults (
8584 totalLength : number ,
86- encryptedValues : (
87- | CipherStashEncrypted
88- | CipherStashEncryptedQuery
89- | CipherStashEncryptedV3Query
90- ) [ ] ,
85+ // Typed as the FFI bulk-query return so it tracks the upstream union. As of
86+ // protect-ffi 0.27 that union also includes `SteVecQuery`, but scalar query
87+ // terms (all this operation builds) never produce a ste_vec result, so each
88+ // element is narrowed back to the scalar shape `formatEncryptedResult` takes.
89+ encryptedValues : Awaited < ReturnType < typeof ffiEncryptQueryBulk > > ,
9190 nonNullTerms : { term : ScalarQueryTerm ; originalIndex : number } [ ] ,
9291) : EncryptedQueryResult [ ] {
9392 const results : EncryptedQueryResult [ ] = new Array ( totalLength ) . fill ( null )
9493 nonNullTerms . forEach ( ( { term, originalIndex } , i ) => {
9594 results [ originalIndex ] = formatEncryptedResult (
96- encryptedValues [ i ] ,
95+ encryptedValues [ i ] as CipherStashEncrypted | CipherStashEncryptedQuery ,
9796 term . returnType ,
9897 )
9998 } )
0 commit comments