fork of hey-api/openapi-ts because I need some additional things
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge pull request #3614 from hey-api/copilot/fix-unwrap-refs-abortsignal

authored by

Lubos and committed by
GitHub
5f3a5a09 c77746eb

+120 -13
+5
.changeset/five-cats-begin.md
··· 1 + --- 2 + "@hey-api/openapi-ts": patch 3 + --- 4 + 5 + **plugin(@hey-api/client-nuxt)**: preserve AbortSignal, FormData, and ReadableStream in unwrapRefs
+6 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-false/client/utils.gen.ts
··· 346 346 return (isRef(value) ? unref(value) : value) as UnwrapRefs<T>; 347 347 } 348 348 349 - if (value instanceof Blob) { 349 + if ( 350 + value instanceof Blob || 351 + value instanceof FormData || 352 + value instanceof ReadableStream || 353 + value instanceof AbortSignal 354 + ) { 350 355 return value as UnwrapRefs<T>; 351 356 } 352 357
+6 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-number/client/utils.gen.ts
··· 346 346 return (isRef(value) ? unref(value) : value) as UnwrapRefs<T>; 347 347 } 348 348 349 - if (value instanceof Blob) { 349 + if ( 350 + value instanceof Blob || 351 + value instanceof FormData || 352 + value instanceof ReadableStream || 353 + value instanceof AbortSignal 354 + ) { 350 355 return value as UnwrapRefs<T>; 351 356 } 352 357
+6 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-strict/client/utils.gen.ts
··· 346 346 return (isRef(value) ? unref(value) : value) as UnwrapRefs<T>; 347 347 } 348 348 349 - if (value instanceof Blob) { 349 + if ( 350 + value instanceof Blob || 351 + value instanceof FormData || 352 + value instanceof ReadableStream || 353 + value instanceof AbortSignal 354 + ) { 350 355 return value as UnwrapRefs<T>; 351 356 } 352 357
+6 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-string/client/utils.gen.ts
··· 346 346 return (isRef(value) ? unref(value) : value) as UnwrapRefs<T>; 347 347 } 348 348 349 - if (value instanceof Blob) { 349 + if ( 350 + value instanceof Blob || 351 + value instanceof FormData || 352 + value instanceof ReadableStream || 353 + value instanceof AbortSignal 354 + ) { 350 355 return value as UnwrapRefs<T>; 351 356 } 352 357
+6 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/clean-false/client/utils.gen.ts
··· 346 346 return (isRef(value) ? unref(value) : value) as UnwrapRefs<T>; 347 347 } 348 348 349 - if (value instanceof Blob) { 349 + if ( 350 + value instanceof Blob || 351 + value instanceof FormData || 352 + value instanceof ReadableStream || 353 + value instanceof AbortSignal 354 + ) { 350 355 return value as UnwrapRefs<T>; 351 356 } 352 357
+6 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/default/client/utils.gen.ts
··· 346 346 return (isRef(value) ? unref(value) : value) as UnwrapRefs<T>; 347 347 } 348 348 349 - if (value instanceof Blob) { 349 + if ( 350 + value instanceof Blob || 351 + value instanceof FormData || 352 + value instanceof ReadableStream || 353 + value instanceof AbortSignal 354 + ) { 350 355 return value as UnwrapRefs<T>; 351 356 } 352 357
+6 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/import-file-extension-ts/client/utils.gen.ts
··· 346 346 return (isRef(value) ? unref(value) : value) as UnwrapRefs<T>; 347 347 } 348 348 349 - if (value instanceof Blob) { 349 + if ( 350 + value instanceof Blob || 351 + value instanceof FormData || 352 + value instanceof ReadableStream || 353 + value instanceof AbortSignal 354 + ) { 350 355 return value as UnwrapRefs<T>; 351 356 } 352 357
+6 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/sdk-client-optional/client/utils.gen.ts
··· 346 346 return (isRef(value) ? unref(value) : value) as UnwrapRefs<T>; 347 347 } 348 348 349 - if (value instanceof Blob) { 349 + if ( 350 + value instanceof Blob || 351 + value instanceof FormData || 352 + value instanceof ReadableStream || 353 + value instanceof AbortSignal 354 + ) { 350 355 return value as UnwrapRefs<T>; 351 356 } 352 357
+6 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/sdk-client-required/client/utils.gen.ts
··· 346 346 return (isRef(value) ? unref(value) : value) as UnwrapRefs<T>; 347 347 } 348 348 349 - if (value instanceof Blob) { 349 + if ( 350 + value instanceof Blob || 351 + value instanceof FormData || 352 + value instanceof ReadableStream || 353 + value instanceof AbortSignal 354 + ) { 350 355 return value as UnwrapRefs<T>; 351 356 } 352 357
+6 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/tsconfig-node16-sdk/client/utils.gen.ts
··· 346 346 return (isRef(value) ? unref(value) : value) as UnwrapRefs<T>; 347 347 } 348 348 349 - if (value instanceof Blob) { 349 + if ( 350 + value instanceof Blob || 351 + value instanceof FormData || 352 + value instanceof ReadableStream || 353 + value instanceof AbortSignal 354 + ) { 350 355 return value as UnwrapRefs<T>; 351 356 } 352 357
+6 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/tsconfig-nodenext-sdk/client/utils.gen.ts
··· 346 346 return (isRef(value) ? unref(value) : value) as UnwrapRefs<T>; 347 347 } 348 348 349 - if (value instanceof Blob) { 349 + if ( 350 + value instanceof Blob || 351 + value instanceof FormData || 352 + value instanceof ReadableStream || 353 + value instanceof AbortSignal 354 + ) { 350 355 return value as UnwrapRefs<T>; 351 356 } 352 357
+6 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-nuxt/client/utils.gen.ts
··· 346 346 return (isRef(value) ? unref(value) : value) as UnwrapRefs<T>; 347 347 } 348 348 349 - if (value instanceof Blob) { 349 + if ( 350 + value instanceof Blob || 351 + value instanceof FormData || 352 + value instanceof ReadableStream || 353 + value instanceof AbortSignal 354 + ) { 350 355 return value as UnwrapRefs<T>; 351 356 } 352 357
+37
packages/openapi-ts/src/plugins/@hey-api/client-nuxt/__tests__/utils.test.ts
··· 29 29 const result = unwrapRefs(file); 30 30 expect(result).toBe(file); 31 31 }); 32 + 33 + it('returns AbortSignal as-is', () => { 34 + const controller = new AbortController(); 35 + const result = unwrapRefs(controller.signal); 36 + expect(result).toBe(controller.signal); 37 + }); 38 + 39 + it('preserves AbortSignal in object', () => { 40 + const controller = new AbortController(); 41 + const input = { signal: controller.signal, url: '/test' }; 42 + const result = unwrapRefs(input); 43 + expect(result.signal).toBe(controller.signal); 44 + expect(result.signal instanceof AbortSignal).toBe(true); 45 + expect(result.url).toBe('/test'); 46 + }); 47 + 48 + it('returns FormData as-is', () => { 49 + const formData = new FormData(); 50 + formData.append('key', 'value'); 51 + const result = unwrapRefs(formData); 52 + expect(result).toBe(formData); 53 + }); 54 + 55 + it('preserves FormData in object', () => { 56 + const formData = new FormData(); 57 + formData.append('key', 'value'); 58 + const input = { body: formData, url: '/upload' }; 59 + const result = unwrapRefs(input); 60 + expect(result.body).toBe(formData); 61 + expect(result.body instanceof FormData).toBe(true); 62 + }); 63 + 64 + it('returns ReadableStream as-is', () => { 65 + const stream = new ReadableStream(); 66 + const result = unwrapRefs(stream); 67 + expect(result).toBe(stream); 68 + }); 32 69 }); 33 70 34 71 describe('mergeInterceptors', () => {
+6 -1
packages/openapi-ts/src/plugins/@hey-api/client-nuxt/bundle/utils.ts
··· 344 344 return (isRef(value) ? unref(value) : value) as UnwrapRefs<T>; 345 345 } 346 346 347 - if (value instanceof Blob) { 347 + if ( 348 + value instanceof Blob || 349 + value instanceof FormData || 350 + value instanceof ReadableStream || 351 + value instanceof AbortSignal 352 + ) { 348 353 return value as UnwrapRefs<T>; 349 354 } 350 355