Skip to content

Commit 251fce5

Browse files
committed
fix: node-26 type compatibility for adopted upstream code
BlobPart casts (upstream builds on @types/node 22) and zod dedupe to the 4.4.3 catalog so kap-server and klient typecheck under our toolchain.
1 parent fe79f5f commit 251fce5

3 files changed

Lines changed: 884 additions & 2095 deletions

File tree

packages/kap-server/test/prompts.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -617,7 +617,7 @@ describe('server-v2 /api/v1 prompts', () => {
617617
});
618618
});
619619

620-
function avifBytes(): Buffer {
620+
function avifBytes(): Buffer<ArrayBuffer> {
621621
const buf = Buffer.alloc(24);
622622
buf.writeUInt32BE(24, 0);
623623
buf.write('ftyp', 4, 'latin1');
@@ -700,7 +700,8 @@ describe('server-v2 /api/v1 prompts', () => {
700700
name: string,
701701
): Promise<{ id: string; size: number }> {
702702
const form = new FormData();
703-
form.set('file', new Blob([bytes], { type: mediaType }), name);
703+
// `BlobPart` needs a non-shared backing buffer under @types/node 26.
704+
form.set('file', new Blob([bytes as Buffer<ArrayBuffer>], { type: mediaType }), name);
704705
const uploadRes = await fetch(`${base}/api/v1/files`, {
705706
method: 'POST',
706707
headers: authHeaders(server as RunningServer),

packages/klient/test/e2e/harness/http.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,10 @@ function blobFromInput(input: {
477477
mediaType?: string;
478478
}): Blob {
479479
if (input.data instanceof Blob) return input.data;
480-
return new Blob([input.data], {
480+
// `BlobPart` requires a non-shared backing buffer under @types/node 26;
481+
// the assertion is safe because these bytes never come from a
482+
// SharedArrayBuffer.
483+
return new Blob([input.data as string | ArrayBuffer | Uint8Array<ArrayBuffer>], {
481484
type: input.mediaType ?? 'application/octet-stream',
482485
});
483486
}

0 commit comments

Comments
 (0)