Skip to content

Commit dbe1ec0

Browse files
committed
fix(stack): align batch query types with ffi 0.27
1 parent fa0c370 commit dbe1ec0

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

packages/stack/src/encryption/operations/batch-encrypt-query.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { type Result, withResult } from '@byteslice/result'
22
import type {
33
Encrypted as CipherStashEncrypted,
44
EncryptedQuery as CipherStashEncryptedQuery,
5-
EncryptedV3Query as CipherStashEncryptedV3Query,
65
} from '@cipherstash/protect-ffi'
76
import {
87
encryptQueryBulk as ffiEncryptQueryBulk,
@@ -83,17 +82,17 @@ function buildQueryPayload(
8382
*/
8483
function 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

Comments
 (0)