From 6eb4e6b835cd8b2e855b6925a98fd8ba81dc6f42 Mon Sep 17 00:00:00 2001 From: Deep Singhvi Date: Tue, 16 Jul 2024 18:58:39 -0400 Subject: [PATCH] (fix, typescript): multipart form upload on Node 19+ (#4056) --- .pnp.cjs | 73 ++++++-- ...ress-npm-4.17.20-a63c9e93d3-bf8a97d283.zip | Bin 3596 -> 0 bytes ...ulter-npm-1.4.11-a023fdbf13-3d80b2acdf.zip | Bin 0 -> 5802 bytes ...-field-npm-1.0.0-bb98be199c-482ba08acc.zip | Bin 0 -> 4525 bytes ...busboy-npm-1.6.0-ebb5cbb04b-32801e2c01.zip | Bin 0 -> 31373 bytes ...-npm-1.4.5-lts.1-2b83a2d180-d6dfa78a6e.zip | Bin 0 -> 12155 bytes ...search-npm-1.1.0-fc3ad6536d-1cce16cea8.zip | Bin 0 -> 7565 bytes generators/typescript/sdk/CHANGELOG.md | 12 ++ generators/typescript/sdk/VERSION | 2 +- .../GeneratedDefaultEndpointRequest.ts | 5 +- .../GeneratedEndpointRequest.ts | 2 +- .../GeneratedFileUploadEndpointRequest.ts | 28 ++- .../utils/appendPropertyToFormData.ts | 2 +- .../src/core-utilities/fetcher/Fetcher.ts | 1 + .../src/core-utilities/fetcher/FetcherImpl.ts | 9 + .../form-data-utils/FormDataUtils.ts | 14 +- .../form-data-utils/FormDataUtilsImpl.ts | 62 +++---- .../ExternalDependencies.ts | 2 + .../src/external-dependencies/blob/Blob.ts | 7 + .../external-dependencies/blob/BlobImpl.ts | 16 ++ .../src/external-dependencies/blob/index.ts | 1 + .../createExternalDependencies.ts | 4 +- .../src/external-dependencies/index.ts | 1 + .../utils/core-utilities/fetcher/.mrlint.json | 4 +- .../utils/core-utilities/fetcher/package.json | 4 + .../fetcher/src/fetcher/Fetcher.ts | 6 +- .../src/fetcher/__test__/Fetcher.test.ts | 3 +- .../fetcher/__test__/getRequestBody.test.ts | 45 +++-- .../fetcher/src/fetcher/getRequestBody.ts | 38 +--- .../src/form-data-utils/FormDataWrapper.ts | 162 ++++++++++++------ .../__test__/multipart.upload.test.ts | 61 +++++++ .../fetcher/src/runtime/runtime.ts | 4 +- packages/cli/docs-preview/package.json | 2 +- .../src/tests/fetcher/fetcher.test.ts | 11 +- packages/cli/mock/package.json | 2 +- seed/ts-sdk/alias/src/Client.ts | 1 + seed/ts-sdk/alias/src/core/fetcher/Fetcher.ts | 6 +- .../alias/src/core/fetcher/getRequestBody.ts | 38 +--- seed/ts-sdk/alias/src/core/runtime/runtime.ts | 2 + .../api/resources/service/client/Client.ts | 1 + .../src/core/fetcher/Fetcher.ts | 6 +- .../src/core/fetcher/getRequestBody.ts | 38 +--- .../src/core/runtime/runtime.ts | 2 + .../resources/service/client/Client.ts | 1 + .../src/api/resources/foo/client/Client.ts | 1 + .../audiences/src/core/fetcher/Fetcher.ts | 6 +- .../src/core/fetcher/getRequestBody.ts | 38 +--- .../audiences/src/core/runtime/runtime.ts | 2 + .../api/resources/service/client/Client.ts | 2 + .../src/core/fetcher/Fetcher.ts | 6 +- .../src/core/fetcher/getRequestBody.ts | 38 +--- .../src/core/runtime/runtime.ts | 2 + .../api/resources/basicAuth/client/Client.ts | 2 + .../src/core/fetcher/Fetcher.ts | 6 +- .../src/core/fetcher/getRequestBody.ts | 38 +--- .../src/core/runtime/runtime.ts | 2 + .../api/resources/basicAuth/client/Client.ts | 2 + .../basic-auth/src/core/fetcher/Fetcher.ts | 6 +- .../src/core/fetcher/getRequestBody.ts | 38 +--- .../basic-auth/src/core/runtime/runtime.ts | 2 + .../api/resources/service/client/Client.ts | 1 + .../src/core/fetcher/Fetcher.ts | 6 +- .../src/core/fetcher/getRequestBody.ts | 38 +--- .../src/core/runtime/runtime.ts | 2 + .../api/resources/service/client/Client.ts | 1 + .../code-samples/src/core/fetcher/Fetcher.ts | 6 +- .../src/core/fetcher/getRequestBody.ts | 38 +--- .../code-samples/src/core/runtime/runtime.ts | 2 + .../api/resources/customAuth/client/Client.ts | 2 + .../custom-auth/src/core/fetcher/Fetcher.ts | 6 +- .../src/core/fetcher/getRequestBody.ts | 38 +--- .../custom-auth/src/core/runtime/runtime.ts | 2 + .../resources/inlinedRequest/client/Client.ts | 1 + .../api/resources/pathParam/client/Client.ts | 1 + .../api/resources/queryParam/client/Client.ts | 2 + seed/ts-sdk/enum/src/core/fetcher/Fetcher.ts | 6 +- .../enum/src/core/fetcher/getRequestBody.ts | 38 +--- seed/ts-sdk/enum/src/core/runtime/runtime.ts | 2 + .../propertyBasedError/client/Client.ts | 1 + .../union-utils/src/core/fetcher/Fetcher.ts | 6 +- .../src/core/fetcher/getRequestBody.ts | 38 +--- .../union-utils/src/core/runtime/runtime.ts | 2 + .../examples-with-api-reference/src/Client.ts | 1 + .../resources/service/client/Client.ts | 1 + .../file/resources/service/client/Client.ts | 1 + .../health/resources/service/client/Client.ts | 2 + .../api/resources/service/client/Client.ts | 4 + .../src/core/fetcher/Fetcher.ts | 6 +- .../src/core/fetcher/getRequestBody.ts | 38 +--- .../src/core/runtime/runtime.ts | 2 + .../retain-original-casing/src/Client.ts | 1 + .../resources/service/client/Client.ts | 1 + .../file/resources/service/client/Client.ts | 1 + .../health/resources/service/client/Client.ts | 2 + .../api/resources/service/client/Client.ts | 4 + .../src/core/fetcher/Fetcher.ts | 6 +- .../src/core/fetcher/getRequestBody.ts | 38 +--- .../src/core/runtime/runtime.ts | 2 + .../resources/container/client/Client.ts | 7 + .../endpoints/resources/enum/client/Client.ts | 1 + .../resources/httpMethods/client/Client.ts | 5 + .../resources/object/client/Client.ts | 6 + .../resources/params/client/Client.ts | 5 + .../resources/primitive/client/Client.ts | 9 + .../resources/union/client/Client.ts | 1 + .../inlinedRequests/client/Client.ts | 1 + .../src/api/resources/noAuth/client/Client.ts | 1 + .../api/resources/noReqBody/client/Client.ts | 2 + .../resources/reqWithHeaders/client/Client.ts | 1 + .../src/core/fetcher/Fetcher.ts | 6 +- .../src/core/fetcher/getRequestBody.ts | 38 +--- .../src/core/runtime/runtime.ts | 2 + .../resources/container/client/Client.ts | 7 + .../endpoints/resources/enum/client/Client.ts | 1 + .../resources/httpMethods/client/Client.ts | 5 + .../resources/object/client/Client.ts | 6 + .../resources/params/client/Client.ts | 5 + .../resources/primitive/client/Client.ts | 9 + .../resources/union/client/Client.ts | 1 + .../inlinedRequests/client/Client.ts | 1 + .../src/api/resources/noAuth/client/Client.ts | 1 + .../api/resources/noReqBody/client/Client.ts | 2 + .../resources/reqWithHeaders/client/Client.ts | 1 + .../bundle/src/core/fetcher/Fetcher.ts | 6 +- .../bundle/src/core/fetcher/getRequestBody.ts | 38 +--- .../bundle/src/core/runtime/runtime.ts | 2 + .../resources/container/client/Client.ts | 7 + .../endpoints/resources/enum/client/Client.ts | 1 + .../resources/httpMethods/client/Client.ts | 5 + .../resources/object/client/Client.ts | 6 + .../resources/params/client/Client.ts | 5 + .../resources/primitive/client/Client.ts | 9 + .../resources/union/client/Client.ts | 1 + .../inlinedRequests/client/Client.ts | 1 + .../src/api/resources/noAuth/client/Client.ts | 1 + .../api/resources/noReqBody/client/Client.ts | 2 + .../resources/reqWithHeaders/client/Client.ts | 1 + .../src/core/fetcher/Fetcher.ts | 6 +- .../src/core/fetcher/getRequestBody.ts | 38 +--- .../src/core/runtime/runtime.ts | 2 + .../resources/container/client/Client.ts | 7 + .../endpoints/resources/enum/client/Client.ts | 1 + .../resources/httpMethods/client/Client.ts | 5 + .../resources/object/client/Client.ts | 6 + .../resources/params/client/Client.ts | 5 + .../resources/primitive/client/Client.ts | 9 + .../resources/union/client/Client.ts | 1 + .../inlinedRequests/client/Client.ts | 1 + .../src/api/resources/noAuth/client/Client.ts | 1 + .../api/resources/noReqBody/client/Client.ts | 2 + .../resources/reqWithHeaders/client/Client.ts | 1 + .../src/core/fetcher/Fetcher.ts | 6 +- .../src/core/fetcher/getRequestBody.ts | 38 +--- .../src/core/runtime/runtime.ts | 2 + .../resources/container/client/Client.ts | 7 + .../endpoints/resources/enum/client/Client.ts | 1 + .../resources/httpMethods/client/Client.ts | 5 + .../resources/object/client/Client.ts | 6 + .../resources/params/client/Client.ts | 5 + .../resources/primitive/client/Client.ts | 9 + .../resources/union/client/Client.ts | 1 + .../inlinedRequests/client/Client.ts | 1 + .../src/api/resources/noAuth/client/Client.ts | 1 + .../api/resources/noReqBody/client/Client.ts | 2 + .../resources/reqWithHeaders/client/Client.ts | 1 + .../jsr/src/core/fetcher/Fetcher.ts | 6 +- .../jsr/src/core/fetcher/getRequestBody.ts | 38 +--- .../jsr/src/core/runtime/runtime.ts | 2 + .../resources/container/client/Client.ts | 7 + .../endpoints/resources/enum/client/Client.ts | 1 + .../resources/httpMethods/client/Client.ts | 5 + .../resources/object/client/Client.ts | 6 + .../resources/params/client/Client.ts | 5 + .../resources/primitive/client/Client.ts | 9 + .../resources/union/client/Client.ts | 1 + .../inlinedRequests/client/Client.ts | 1 + .../src/api/resources/noAuth/client/Client.ts | 1 + .../api/resources/noReqBody/client/Client.ts | 2 + .../resources/reqWithHeaders/client/Client.ts | 1 + .../src/core/fetcher/Fetcher.ts | 6 +- .../src/core/fetcher/getRequestBody.ts | 38 +--- .../src/core/runtime/runtime.ts | 2 + .../resources/container/client/Client.ts | 7 + .../endpoints/resources/enum/client/Client.ts | 1 + .../resources/httpMethods/client/Client.ts | 5 + .../resources/object/client/Client.ts | 6 + .../resources/params/client/Client.ts | 5 + .../resources/primitive/client/Client.ts | 9 + .../resources/union/client/Client.ts | 1 + .../inlinedRequests/client/Client.ts | 1 + .../src/api/resources/noAuth/client/Client.ts | 1 + .../api/resources/noReqBody/client/Client.ts | 2 + .../resources/reqWithHeaders/client/Client.ts | 1 + .../src/core/fetcher/Fetcher.ts | 6 +- .../src/core/fetcher/getRequestBody.ts | 38 +--- .../src/core/runtime/runtime.ts | 2 + .../src/api/resources/user/client/Client.ts | 1 + .../src/core/fetcher/Fetcher.ts | 6 +- .../src/core/fetcher/getRequestBody.ts | 38 +--- .../src/core/runtime/runtime.ts | 2 + .../api/resources/service/client/Client.ts | 1 + .../src/core/fetcher/Fetcher.ts | 6 +- .../src/core/fetcher/getRequestBody.ts | 38 +--- .../src/core/runtime/runtime.ts | 2 + .../api/resources/service/client/Client.ts | 1 + .../src/core/fetcher/Fetcher.ts | 6 +- .../src/core/fetcher/getRequestBody.ts | 38 +--- .../src/core/runtime/runtime.ts | 2 + .../file-upload/no-custom-config/reference.md | 12 +- .../api/resources/service/client/Client.ts | 60 ++++--- .../src/core/fetcher/Fetcher.ts | 6 +- .../src/core/fetcher/getRequestBody.ts | 38 +--- .../core/form-data-utils/FormDataWrapper.ts | 162 ++++++++++++------ .../src/core/runtime/runtime.ts | 2 + .../api/resources/service/client/Client.ts | 35 ++-- .../src/core/fetcher/Fetcher.ts | 6 +- .../src/core/fetcher/getRequestBody.ts | 38 +--- .../core/form-data-utils/FormDataWrapper.ts | 162 ++++++++++++------ .../src/core/runtime/runtime.ts | 2 + seed/ts-sdk/folders/src/Client.ts | 1 + .../resources/a/resources/b/client/Client.ts | 1 + .../resources/a/resources/c/client/Client.ts | 1 + .../src/api/resources/folder/client/Client.ts | 1 + .../folder/resources/service/client/Client.ts | 2 + .../folders/src/core/fetcher/Fetcher.ts | 6 +- .../src/core/fetcher/getRequestBody.ts | 38 +--- .../folders/src/core/runtime/runtime.ts | 2 + .../api/resources/payment/client/Client.ts | 2 + .../src/core/fetcher/Fetcher.ts | 6 +- .../src/core/fetcher/getRequestBody.ts | 38 +--- .../src/core/runtime/runtime.ts | 2 + .../src/api/resources/imdb/client/Client.ts | 2 + .../src/core/fetcher/Fetcher.ts | 6 +- .../src/core/fetcher/getRequestBody.ts | 38 +--- .../src/core/runtime/runtime.ts | 2 + .../src/api/resources/imdb/client/Client.ts | 2 + .../src/core/fetcher/Fetcher.ts | 6 +- .../src/core/fetcher/getRequestBody.ts | 38 +--- .../src/core/runtime/runtime.ts | 2 + .../api/resources/headers/client/Client.ts | 1 + .../api/resources/inlined/client/Client.ts | 1 + .../src/api/resources/path/client/Client.ts | 1 + .../src/api/resources/query/client/Client.ts | 1 + .../api/resources/reference/client/Client.ts | 1 + .../literal/src/core/fetcher/Fetcher.ts | 6 +- .../src/core/fetcher/getRequestBody.ts | 38 +--- .../literal/src/core/runtime/runtime.ts | 2 + .../api/resources/service/client/Client.ts | 2 + .../src/core/fetcher/Fetcher.ts | 6 +- .../src/core/fetcher/getRequestBody.ts | 38 +--- .../src/core/runtime/runtime.ts | 2 + .../api/resources/service/client/Client.ts | 2 + .../src/core/fetcher/Fetcher.ts | 6 +- .../src/core/fetcher/getRequestBody.ts | 38 +--- .../src/core/runtime/runtime.ts | 2 + .../src/api/resources/user/client/Client.ts | 2 + .../src/core/fetcher/Fetcher.ts | 6 +- .../src/core/fetcher/getRequestBody.ts | 38 +--- .../src/core/runtime/runtime.ts | 2 + .../src/api/resources/ec2/client/Client.ts | 1 + .../src/api/resources/s3/client/Client.ts | 1 + .../src/core/fetcher/Fetcher.ts | 6 +- .../src/core/fetcher/getRequestBody.ts | 38 +--- .../src/core/runtime/runtime.ts | 2 + .../src/api/resources/ec2/client/Client.ts | 1 + .../src/api/resources/s3/client/Client.ts | 1 + .../src/core/fetcher/Fetcher.ts | 6 +- .../src/core/fetcher/getRequestBody.ts | 38 +--- .../src/core/runtime/runtime.ts | 2 + .../src/api/resources/dummy/client/Client.ts | 1 + .../src/core/fetcher/Fetcher.ts | 6 +- .../src/core/fetcher/getRequestBody.ts | 38 +--- .../src/core/runtime/runtime.ts | 2 + .../src/api/resources/auth/client/Client.ts | 1 + .../src/core/fetcher/Fetcher.ts | 6 +- .../src/core/fetcher/getRequestBody.ts | 38 +--- .../src/core/runtime/runtime.ts | 2 + .../src/api/resources/auth/client/Client.ts | 2 + .../src/core/fetcher/Fetcher.ts | 6 +- .../src/core/fetcher/getRequestBody.ts | 38 +--- .../src/core/runtime/runtime.ts | 2 + .../src/api/resources/auth/client/Client.ts | 1 + .../src/core/fetcher/Fetcher.ts | 6 +- .../src/core/fetcher/getRequestBody.ts | 38 +--- .../src/core/runtime/runtime.ts | 2 + .../src/api/resources/auth/client/Client.ts | 1 + .../src/core/fetcher/Fetcher.ts | 6 +- .../src/core/fetcher/getRequestBody.ts | 38 +--- .../src/core/runtime/runtime.ts | 2 + .../src/api/resources/auth/client/Client.ts | 2 + .../src/core/fetcher/Fetcher.ts | 6 +- .../src/core/fetcher/getRequestBody.ts | 38 +--- .../src/core/runtime/runtime.ts | 2 + .../api/resources/optional/client/Client.ts | 1 + .../optional/src/core/fetcher/Fetcher.ts | 6 +- .../src/core/fetcher/getRequestBody.ts | 38 +--- .../optional/src/core/runtime/runtime.ts | 2 + seed/ts-sdk/package-yml/src/Client.ts | 1 + .../api/resources/service/client/Client.ts | 1 + .../package-yml/src/core/fetcher/Fetcher.ts | 6 +- .../src/core/fetcher/getRequestBody.ts | 38 +--- .../package-yml/src/core/runtime/runtime.ts | 2 + .../src/api/resources/users/client/Client.ts | 8 + .../pagination/src/core/fetcher/Fetcher.ts | 6 +- .../src/core/fetcher/getRequestBody.ts | 38 +--- .../pagination/src/core/runtime/runtime.ts | 2 + .../api/resources/service/client/Client.ts | 1 + .../plain-text/src/core/fetcher/Fetcher.ts | 6 +- .../src/core/fetcher/getRequestBody.ts | 38 +--- .../plain-text/src/core/runtime/runtime.ts | 2 + .../src/api/resources/user/client/Client.ts | 1 + .../src/core/fetcher/Fetcher.ts | 6 +- .../src/core/fetcher/getRequestBody.ts | 38 +--- .../src/core/runtime/runtime.ts | 2 + .../src/api/resources/user/client/Client.ts | 1 + .../src/core/fetcher/Fetcher.ts | 6 +- .../src/core/fetcher/getRequestBody.ts | 38 +--- .../src/core/runtime/runtime.ts | 2 + .../.mock/definition/.package.yml.swp | Bin 12288 -> 0 bytes .../api/resources/package/client/Client.ts | 1 + .../src/core/fetcher/Fetcher.ts | 6 +- .../src/core/fetcher/getRequestBody.ts | 38 +--- .../src/core/runtime/runtime.ts | 2 + .../api/resources/service/client/Client.ts | 7 + .../src/core/fetcher/Fetcher.ts | 6 +- .../src/core/fetcher/getRequestBody.ts | 38 +--- .../src/core/runtime/runtime.ts | 2 + .../resources/completions/client/Client.ts | 1 + .../src/core/fetcher/Fetcher.ts | 6 +- .../src/core/fetcher/getRequestBody.ts | 38 +--- .../src/core/runtime/runtime.ts | 2 + .../src/api/resources/dummy/client/Client.ts | 1 + .../src/core/fetcher/Fetcher.ts | 6 +- .../src/core/fetcher/getRequestBody.ts | 38 +--- .../src/core/runtime/runtime.ts | 2 + .../src/api/resources/dummy/client/Client.ts | 1 + .../src/core/fetcher/Fetcher.ts | 6 +- .../src/core/fetcher/getRequestBody.ts | 38 +--- .../src/core/runtime/runtime.ts | 2 + .../src/api/resources/dummy/client/Client.ts | 2 + .../src/core/fetcher/Fetcher.ts | 6 +- .../src/core/fetcher/getRequestBody.ts | 38 +--- .../src/core/runtime/runtime.ts | 2 + .../src/api/resources/dummy/client/Client.ts | 2 + .../src/core/fetcher/Fetcher.ts | 6 +- .../src/core/fetcher/getRequestBody.ts | 38 +--- .../src/core/runtime/runtime.ts | 2 + .../src/api/resources/admin/client/Client.ts | 8 + .../api/resources/homepage/client/Client.ts | 2 + .../api/resources/migration/client/Client.ts | 1 + .../api/resources/playlist/client/Client.ts | 5 + .../api/resources/problem/client/Client.ts | 4 + .../api/resources/submission/client/Client.ts | 4 + .../api/resources/sysprop/client/Client.ts | 2 + .../src/api/resources/v2/client/Client.ts | 1 + .../v2/resources/problem/client/Client.ts | 4 + .../v3/resources/problem/client/Client.ts | 4 + .../exhaustive/src/core/fetcher/Fetcher.ts | 6 +- .../src/core/fetcher/getRequestBody.ts | 38 +--- .../exhaustive/src/core/runtime/runtime.ts | 2 + .../src/api/resources/admin/client/Client.ts | 8 + .../api/resources/homepage/client/Client.ts | 2 + .../api/resources/migration/client/Client.ts | 1 + .../api/resources/playlist/client/Client.ts | 5 + .../api/resources/problem/client/Client.ts | 4 + .../api/resources/submission/client/Client.ts | 4 + .../api/resources/sysprop/client/Client.ts | 2 + .../src/api/resources/v2/client/Client.ts | 1 + .../v2/resources/problem/client/Client.ts | 4 + .../v3/resources/problem/client/Client.ts | 4 + .../src/core/fetcher/Fetcher.ts | 6 +- .../src/core/fetcher/getRequestBody.ts | 38 +--- .../src/core/runtime/runtime.ts | 2 + .../src/api/resources/admin/client/Client.ts | 8 + .../api/resources/homepage/client/Client.ts | 2 + .../api/resources/migration/client/Client.ts | 1 + .../api/resources/playlist/client/Client.ts | 5 + .../api/resources/problem/client/Client.ts | 4 + .../api/resources/submission/client/Client.ts | 4 + .../api/resources/sysprop/client/Client.ts | 2 + .../src/api/resources/v2/client/Client.ts | 1 + .../v2/resources/problem/client/Client.ts | 4 + .../v3/resources/problem/client/Client.ts | 4 + .../src/core/fetcher/Fetcher.ts | 6 +- .../src/core/fetcher/getRequestBody.ts | 38 +--- .../src/core/runtime/runtime.ts | 2 + .../src/api/resources/admin/client/Client.ts | 8 + .../api/resources/homepage/client/Client.ts | 2 + .../api/resources/migration/client/Client.ts | 1 + .../api/resources/playlist/client/Client.ts | 5 + .../api/resources/problem/client/Client.ts | 4 + .../api/resources/submission/client/Client.ts | 4 + .../api/resources/sysprop/client/Client.ts | 2 + .../src/api/resources/v2/client/Client.ts | 1 + .../v2/resources/problem/client/Client.ts | 4 + .../v3/resources/problem/client/Client.ts | 4 + .../no-zurg-trace/src/core/fetcher/Fetcher.ts | 6 +- .../src/core/fetcher/getRequestBody.ts | 38 +--- .../no-zurg-trace/src/core/runtime/runtime.ts | 2 + .../src/api/resources/union/client/Client.ts | 2 + .../src/core/fetcher/Fetcher.ts | 6 +- .../src/core/fetcher/getRequestBody.ts | 38 +--- .../src/core/runtime/runtime.ts | 2 + .../src/api/resources/union/client/Client.ts | 2 + .../src/core/fetcher/Fetcher.ts | 6 +- .../src/core/fetcher/getRequestBody.ts | 38 +--- .../src/core/runtime/runtime.ts | 2 + .../src/api/resources/union/client/Client.ts | 2 + .../ts-sdk/unions/src/core/fetcher/Fetcher.ts | 6 +- .../unions/src/core/fetcher/getRequestBody.ts | 38 +--- .../ts-sdk/unions/src/core/runtime/runtime.ts | 2 + .../api/resources/unknown/client/Client.ts | 1 + .../src/core/fetcher/Fetcher.ts | 6 +- .../src/core/fetcher/getRequestBody.ts | 38 +--- .../src/core/runtime/runtime.ts | 2 + .../api/resources/unknown/client/Client.ts | 1 + .../src/core/fetcher/Fetcher.ts | 6 +- .../src/core/fetcher/getRequestBody.ts | 38 +--- .../src/core/runtime/runtime.ts | 2 + seed/ts-sdk/validation/src/Client.ts | 2 + .../validation/src/core/fetcher/Fetcher.ts | 6 +- .../src/core/fetcher/getRequestBody.ts | 38 +--- .../validation/src/core/runtime/runtime.ts | 2 + .../api/resources/service/client/Client.ts | 1 + .../variables/src/core/fetcher/Fetcher.ts | 6 +- .../src/core/fetcher/getRequestBody.ts | 38 +--- .../variables/src/core/runtime/runtime.ts | 2 + yarn.lock | 75 ++++++-- 428 files changed, 2325 insertions(+), 2282 deletions(-) delete mode 100644 .yarn/cache/@types-express-npm-4.17.20-a63c9e93d3-bf8a97d283.zip create mode 100644 .yarn/cache/@types-multer-npm-1.4.11-a023fdbf13-3d80b2acdf.zip create mode 100644 .yarn/cache/append-field-npm-1.0.0-bb98be199c-482ba08acc.zip create mode 100644 .yarn/cache/busboy-npm-1.6.0-ebb5cbb04b-32801e2c01.zip create mode 100644 .yarn/cache/multer-npm-1.4.5-lts.1-2b83a2d180-d6dfa78a6e.zip create mode 100644 .yarn/cache/streamsearch-npm-1.1.0-fc3ad6536d-1cce16cea8.zip create mode 100644 generators/typescript/utils/commons/src/external-dependencies/blob/Blob.ts create mode 100644 generators/typescript/utils/commons/src/external-dependencies/blob/BlobImpl.ts create mode 100644 generators/typescript/utils/commons/src/external-dependencies/blob/index.ts create mode 100644 generators/typescript/utils/core-utilities/fetcher/src/form-data-utils/__test__/multipart.upload.test.ts delete mode 100644 seed/ts-sdk/reserved-keywords/.mock/definition/.package.yml.swp diff --git a/.pnp.cjs b/.pnp.cjs index c90c26138be..f33676e4f06 100644 --- a/.pnp.cjs +++ b/.pnp.cjs @@ -6663,7 +6663,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["@fern-api/task-context", "workspace:packages/cli/task-context"],\ ["@types/cors", "npm:2.8.17"],\ ["@types/decompress", "npm:4.2.7"],\ - ["@types/express", "npm:4.17.20"],\ + ["@types/express", "npm:4.17.21"],\ ["@types/jest", "npm:29.5.12"],\ ["@types/node", "npm:18.7.18"],\ ["@types/uuid", "npm:9.0.8"],\ @@ -7270,7 +7270,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["@fern-api/mock", "workspace:packages/cli/mock"],\ ["@fern-api/ir-sdk", "workspace:packages/ir-sdk"],\ ["@fern-api/task-context", "workspace:packages/cli/task-context"],\ - ["@types/express", "npm:4.17.20"],\ + ["@types/express", "npm:4.17.21"],\ ["@types/jest", "npm:29.5.12"],\ ["@types/lodash-es", "npm:4.17.12"],\ ["@types/node", "npm:18.7.18"],\ @@ -8961,18 +8961,22 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["@fern-typescript/fetcher", "workspace:generators/typescript/utils/core-utilities/fetcher"],\ ["@babel/preset-env", "virtual:7be63f1ee9eb34cb62254a57273a43b86b8b7753aa555eb261c4195c28af56c1d0f4f9ed3a307dac6e859be2fc2f1dac6612f92db051061f91f1ec4982afe62a#npm:7.24.3"],\ ["@babel/preset-typescript", "virtual:7be63f1ee9eb34cb62254a57273a43b86b8b7753aa555eb261c4195c28af56c1d0f4f9ed3a307dac6e859be2fc2f1dac6612f92db051061f91f1ec4982afe62a#npm:7.24.1"],\ + ["@types/express", "npm:4.17.21"],\ ["@types/jest", "npm:29.5.12"],\ + ["@types/multer", "npm:1.4.11"],\ ["@types/node", "npm:18.7.18"],\ ["@types/node-fetch", "npm:2.6.9"],\ ["@types/qs", "npm:6.9.15"],\ ["depcheck", "npm:1.4.6"],\ ["eslint", "npm:8.56.0"],\ + ["express", "npm:4.19.2"],\ ["form-data", "npm:4.0.0"],\ ["form-data-encoder", "npm:4.0.2"],\ ["formdata-node", "npm:6.0.3"],\ ["jest", "virtual:816fb67d993b0978271f762d4ccbec7209ef2546c234ca6e241662d44336c8e32c1c3c07189cfe14b67974a4840e1ed140408a7403bf9deb68c1953445072efe#npm:29.7.0"],\ ["jest-environment-jsdom", "virtual:7be63f1ee9eb34cb62254a57273a43b86b8b7753aa555eb261c4195c28af56c1d0f4f9ed3a307dac6e859be2fc2f1dac6612f92db051061f91f1ec4982afe62a#npm:29.7.0"],\ ["jest-fetch-mock", "npm:3.0.3"],\ + ["multer", "npm:1.4.5-lts.1"],\ ["node-fetch", "virtual:25958c3cdea01727abe9184cd62ebdcb7f32f5bd5b1d13e8a0e1d5080a9e9f7be886906e1af797d4fcc43965772a072bf87bbcb6b0a29bf8dd97020f3fa1ccf2#npm:2.7.0"],\ ["organize-imports-cli", "npm:0.10.0"],\ ["prettier", "npm:2.7.1"],\ @@ -10727,17 +10731,6 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { }]\ ]],\ ["@types/express", [\ - ["npm:4.17.20", {\ - "packageLocation": "./.yarn/cache/@types-express-npm-4.17.20-a63c9e93d3-bf8a97d283.zip/node_modules/@types/express/",\ - "packageDependencies": [\ - ["@types/express", "npm:4.17.20"],\ - ["@types/body-parser", "npm:1.19.2"],\ - ["@types/express-serve-static-core", "npm:4.17.39"],\ - ["@types/qs", "npm:6.9.7"],\ - ["@types/serve-static", "npm:1.15.0"]\ - ],\ - "linkType": "HARD"\ - }],\ ["npm:4.17.21", {\ "packageLocation": "./.yarn/cache/@types-express-npm-4.17.21-be92a0245e-fb23829863.zip/node_modules/@types/express/",\ "packageDependencies": [\ @@ -11144,6 +11137,16 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "linkType": "HARD"\ }]\ ]],\ + ["@types/multer", [\ + ["npm:1.4.11", {\ + "packageLocation": "./.yarn/cache/@types-multer-npm-1.4.11-a023fdbf13-3d80b2acdf.zip/node_modules/@types/multer/",\ + "packageDependencies": [\ + ["@types/multer", "npm:1.4.11"],\ + ["@types/express", "npm:4.17.21"]\ + ],\ + "linkType": "HARD"\ + }]\ + ]],\ ["@types/node", [\ ["npm:14.18.63", {\ "packageLocation": "./.yarn/cache/@types-node-npm-14.18.63-a411f0ee60-be909061a5.zip/node_modules/@types/node/",\ @@ -12498,6 +12501,15 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "linkType": "HARD"\ }]\ ]],\ + ["append-field", [\ + ["npm:1.0.0", {\ + "packageLocation": "./.yarn/cache/append-field-npm-1.0.0-bb98be199c-482ba08acc.zip/node_modules/append-field/",\ + "packageDependencies": [\ + ["append-field", "npm:1.0.0"]\ + ],\ + "linkType": "HARD"\ + }]\ + ]],\ ["aproba", [\ ["npm:1.2.0", {\ "packageLocation": "./.yarn/cache/aproba-npm-1.2.0-34129f0778-0fca141966.zip/node_modules/aproba/",\ @@ -13582,6 +13594,16 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "linkType": "HARD"\ }]\ ]],\ + ["busboy", [\ + ["npm:1.6.0", {\ + "packageLocation": "./.yarn/cache/busboy-npm-1.6.0-ebb5cbb04b-32801e2c01.zip/node_modules/busboy/",\ + "packageDependencies": [\ + ["busboy", "npm:1.6.0"],\ + ["streamsearch", "npm:1.1.0"]\ + ],\ + "linkType": "HARD"\ + }]\ + ]],\ ["byline", [\ ["npm:5.0.0", {\ "packageLocation": "./.yarn/cache/byline-npm-5.0.0-dde6edb7d9-737ca83e8e.zip/node_modules/byline/",\ @@ -23543,6 +23565,22 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "linkType": "HARD"\ }]\ ]],\ + ["multer", [\ + ["npm:1.4.5-lts.1", {\ + "packageLocation": "./.yarn/cache/multer-npm-1.4.5-lts.1-2b83a2d180-d6dfa78a6e.zip/node_modules/multer/",\ + "packageDependencies": [\ + ["multer", "npm:1.4.5-lts.1"],\ + ["append-field", "npm:1.0.0"],\ + ["busboy", "npm:1.6.0"],\ + ["concat-stream", "npm:1.6.2"],\ + ["mkdirp", "npm:0.5.6"],\ + ["object-assign", "npm:4.1.1"],\ + ["type-is", "npm:1.6.18"],\ + ["xtend", "npm:4.0.2"]\ + ],\ + "linkType": "HARD"\ + }]\ + ]],\ ["multimatch", [\ ["npm:5.0.0", {\ "packageLocation": "./.yarn/cache/multimatch-npm-5.0.0-9938abf6fa-82c8030a53.zip/node_modules/multimatch/",\ @@ -27634,6 +27672,15 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "linkType": "HARD"\ }]\ ]],\ + ["streamsearch", [\ + ["npm:1.1.0", {\ + "packageLocation": "./.yarn/cache/streamsearch-npm-1.1.0-fc3ad6536d-1cce16cea8.zip/node_modules/streamsearch/",\ + "packageDependencies": [\ + ["streamsearch", "npm:1.1.0"]\ + ],\ + "linkType": "HARD"\ + }]\ + ]],\ ["strict-uri-encode", [\ ["npm:2.0.0", {\ "packageLocation": "./.yarn/cache/strict-uri-encode-npm-2.0.0-1ec3189376-eaac4cf978.zip/node_modules/strict-uri-encode/",\ diff --git a/.yarn/cache/@types-express-npm-4.17.20-a63c9e93d3-bf8a97d283.zip b/.yarn/cache/@types-express-npm-4.17.20-a63c9e93d3-bf8a97d283.zip deleted file mode 100644 index 9a31ddf0618d41d3976b4d4728bd51101724efb9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3596 zcmai%2{e>nAIArSF?J!0cvQMdOWz7;%vSb-! z8B4aTWyqFYum1nMy>(7?pL3pjpL6c_bMJHRy}$eY8R(D!nE~I*x#9uPKaKA%+QZu2 z!vSIA=HcMyitssU@Y}B606%p-=NshtM+N6^6o^1iZ-md$Sfl{ZKhv^^mN|Eg6aer8 z0swq}QC`$iQ`a+AhZ}XePeB=8Zi;ARToxIwU+x4N7wS&6o*xXnf**BG_HqRXXmUxH4)!KTcn&ulY7HIIQsSq3CR+JC2VK`DB)X>3i48* zyPzIiH2?vw_e4!7jPMGr7uRNXGAB{V595G=@i$QFKAPgzi3T3Sr%nx1&F^{9oQ6;a zpeJ-=#{6F=O&XlG4q085=OPY`nSwG07@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OhdA0#`@@X3aMjD-v{`Xkma?f=-xW8jmW zQ{{x++FsT3l literal 0 HcmV?d00001 diff --git a/.yarn/cache/busboy-npm-1.6.0-ebb5cbb04b-32801e2c01.zip b/.yarn/cache/busboy-npm-1.6.0-ebb5cbb04b-32801e2c01.zip new file mode 100644 index 0000000000000000000000000000000000000000..ef174b22d6b183e7646de574799fc342ec17acdd GIT binary patch literal 31373 zcmbT71CV9kmgdv8ZB*K}ZQHhuO53(=RNA&xY1{VH|Gj?Q^Je-@_wcmFzXo^bK=PIN^X{*c;LrJ=MbMf!SzFjTI~vhiI+43LnGiTRJ6aeylXF2q z{e2p=Chqojj?PX5JOo})1Oz7T&L+0TPMief{5DQT#wPA`e;NhXw=y00RO5p#E=< zVPrw;VPhSvz#})n53_ks#ZB*+UoIaiot)NAPr#sp+FnH4<>=7=iW5-r<#u%kn)GwX zEcef0Gmm<7Qzwy-aR-uzXr+hK4c&lm$UBUlXP+@n>CzYV2V?X)sZ)O53 z!Pc9NP}vKq2;rfiDkh$5crAGI#sL5b_gmcsBFV#^X8%RU;#!*RCqUU&q2*kCc+rXcS~i{dUSQ&Zn)r2`^8!*{2wp0(n{S+dn=cYqVhelW}@yem-EO2 zQ?J~T5`L8a6DF!pnJIHpg+#8Krc6fzFZ<8bD+?d%#)`iPpMGnWopq^az4rfd$}0h4 zI;gG42?~M!q&ca*1O59~`j4c->Ih1OED(3pA5(S%h@>iM5K_4Zl9`3#c0&JL6l2%oDal-U@aWPufjW8~Ye8tHVK-FJ zUFNQE&QS-Wx(OyfE*{gd$I2sE%P9dMagWjUIBg=$0X@DO@N7A`E`h|F@1YkoZAn{% zVG9Kg5+2)Tx985mu+JYm@us4%NB{KBc%83NR02nESTh>o9RAwg&9acVa5N&&;R`<8 zebP=!arK;OTz=^y%hB#vL6Kkg=S4JWjeqr6HT28p9=&MlqdJg}@_U8;=bUci5~EoC z5h)c2008#C$f>l1kch03h>qe^%x`*x?sp2&EKQ2vTV71z8dV|ej+2Tpgba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b)J zkPzX2f2QAZv)h5+Y+F3-<{n^)EXE+%7tdFFu=xBE0Ovy|h0Q8vN(=007yZ8ZRIJVEkV~h5s%)_;>#N(hGcThrAmvAO95X zf7Ap2x>J7X2fnsLUYwV~_;*PEt|s_T%-5s8w|auFnAx5>|25`6)dgRF_bc*SQN7>D zH80cVzw`E0V(%^XTXDJH*w8QO7k`HRFR8h=KyMYmegpk@2|E7_=zsLUUZH+n@>cuu zm$t%dJLFAA{Bx*RrG-DJ-V&|e_Jxd{r|P}SHJ2lui#Dbd#<>o3y>{$z-~-Ff+qE^GAP mq5tg&ej7vohTpdM5AgqR7W8F(1^~c$`J;P@+=Q)uefxj4DF~nd literal 0 HcmV?d00001 diff --git a/.yarn/cache/multer-npm-1.4.5-lts.1-2b83a2d180-d6dfa78a6e.zip b/.yarn/cache/multer-npm-1.4.5-lts.1-2b83a2d180-d6dfa78a6e.zip new file mode 100644 index 0000000000000000000000000000000000000000..af87d2f74e26b56063aaebef19a2dd0f5f3e54b0 GIT binary patch literal 12155 zcmai)by!@Q(Qq>RRhnkO2il1Nx&0RxLvP>&t)M;NL&3ZHxfARyIaXmH-Dvh2LKK2jFj) zS~*!d0_^|O0|W@_UvO#RJk2N&ARrAeARye|^pKSj5&Nhl=A@`)vBre<<-VHhrW8Eh z+E5+5&TRT2^UH`RdRAunmBLaVi z#~U(=(|nDRxx(eK*2&AIt+#;OT%O9UJZFhr!(3id@kR4n_J$XNpKvtgUPdh+7Gx#C z?JIUv{`XF6VXg>Ge?GyDva1r2OAO^VIDZ0skkd`tx%5{k7;{Ig?IN4lp%wq^`4YQU z;BOg~k;43@mR|hFo3!%okaK2`&0Pz&N;=4#F7=Z6Dwrt*rgtoUqYsN&d=aZZXXXcx z{f8*h;fu5_!!pTTu*@<3tHKd649OS%v zC~I8D^~0sO6VtNY;uGfq$So=YpsTD&)*gu*jl~;=N_(PS+Qe=0*vi%j z6uK3~g1pthUTI})yDEEVI2a0AWGh9A+~pAxM((e}lIfwAyxYk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c5$zudxf3`~9t&;Z|! zhwq3OJJAneqWV=Pb@S)~8J-t|r}$l4Eq6|f@Pv-*j&ol@c(a`vK=pCE$a67orY^P; z31vUs*SMJWkx41(TSU-ITvA^JP;?-}>~1j5VuJdIkAXbBT#!59VD_46f$19dtF9HfOz#sykzc;qNXKnt~&V>H>_?vh2 zzjggL@XxNazjpl}+v~q?{%1+zSL5ry`vU35C4pVE<`Uf7W0AB>fqvU(I`e zk_vqL{twcBtbD%$fAwSi1r&t*=b`+eue&8=J*R5ivD}( z?}{G3(tj-l{6+7__-Fe6Ul{mbv|qBmf6*wg|C#nbIba1D@OMKX5D?<~E9zazOMlo< Gfc_skldbmv literal 0 HcmV?d00001 diff --git a/.yarn/cache/streamsearch-npm-1.1.0-fc3ad6536d-1cce16cea8.zip b/.yarn/cache/streamsearch-npm-1.1.0-fc3ad6536d-1cce16cea8.zip new file mode 100644 index 0000000000000000000000000000000000000000..68383b403e8831422b78eb137746858e49c1cf81 GIT binary patch literal 7565 zcmb7J1yogAw+5y2Al;ynhvv|o(p@4AhdglTMoB?wq=iF+BHfL2NFyPg(k;^R;NHu- z|8+dQ@1MKJ*z;R!%{BL)bIngh{yqX8+^vWfjidZ=^VbRU=4uBu0~^{x&0HX0CsvhT zzDn}*t4_|2U}IY+u(6}5Cn_N-FElDDu)8zZ&diCQicZwl$jhHIRxrgM41FOf{GSUhYYL8=1EZES$KBcPp8yPrk~wK`2M3xW>CsEIXyDE(_L|uvFnIb zLKP%}>9q@r6Z^VOG74_lks3jG%Z@3+$UXmdQw7Zic(h{ur_`$@LAtnE!TK>|Z~aYR z_hGSIO6NGc9nomXR6)E1V3$A)1`|sEi9s9``=QQ!iKxD|(FaQNmFCcMVuXccp?oZ% zB>MV(yU`ycWn=bpm}@>$d$h<9D|1G`Yw%Xg{Wo^vxU0_|HSB7kw_=*Q(*|}e#899X zDdoNQ|CYy|GAJ+B3`Tvbi(k6M@{Eo0<%c~2mba%9W<`+YkjhFG9^X6Bfc{IH-g@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Ucft&n6n z#`U>ejI$oYbynJ6TrLe#ws-Qx$ciT;C-WkIT1>n}ijc>audkEX+cJ@UJo3eezRDD7 z8XnEi+)1hVv`)IsChG(=8--b!dSPkPjH=Cz!MKQkt{l#m0n!+=ae%YMtl+fpDYK*8 z-6Pm_P6zbnNTN;TlX84=NLazPO$~N!rF&*bDdIjoWYTF)+NS(;TY6n+NW&XKvR=1m zU;@6t8>Nu+ieDNA@eAi+4;si!8H&&Yyz4K1+*6Tf<#-ZCP0vLgn(x&4RgKh{fscH!3y$sJC%pXqOL{*y2H-LP(njyu^A+rPQ}b>CS2 zm-hJeSZ|4sJJ}IqyZQ3|9q&JBkUx>{zTTgSkUQjTKhOUX`A=Hp&JuU{Ka&D~;}6^v zwEvr)-%$iVxA1du{O=a%Z%U89ZsD&|`Ok1a*DU{rTR{39-2YZE?*MNVeDVdv_D`b8!C~GVkUy{k8f2Gt}Q<-s=85 z9N930lo=62&1aKyJy{{x|p BycPfe literal 0 HcmV?d00001 diff --git a/generators/typescript/sdk/CHANGELOG.md b/generators/typescript/sdk/CHANGELOG.md index 673fc489bf7..2c269b927f5 100644 --- a/generators/typescript/sdk/CHANGELOG.md +++ b/generators/typescript/sdk/CHANGELOG.md @@ -5,6 +5,18 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.33.0] - 2024-07-15 + +- Fix: This release comes with numerous improvements to multipart uploads: + + 1. `Fetcher.ts` no longer depends on form-data and formdata-node which reduces + the size of the SDK for all consumers that are not leveraging multipart form + data uploads. + 2. The SDK now accepts `fs.ReadStream`, `Blob` and `File` as inputs and handles + parsing them appropriately. + 3. By accepting a `Blob` as a file parameter, the SDK now supports sending the + filename when making a request. + ## [0.32.0] - 2024-07-15 - Feature: The `reference.md` is now generated for every SDK. diff --git a/generators/typescript/sdk/VERSION b/generators/typescript/sdk/VERSION index 9eb2aa3f109..be386c9ede3 100644 --- a/generators/typescript/sdk/VERSION +++ b/generators/typescript/sdk/VERSION @@ -1 +1 @@ -0.32.0 +0.33.0 diff --git a/generators/typescript/sdk/client-class-generator/src/endpoint-request/GeneratedDefaultEndpointRequest.ts b/generators/typescript/sdk/client-class-generator/src/endpoint-request/GeneratedDefaultEndpointRequest.ts index 475ced2b1a9..1801367e47a 100644 --- a/generators/typescript/sdk/client-class-generator/src/endpoint-request/GeneratedDefaultEndpointRequest.ts +++ b/generators/typescript/sdk/client-class-generator/src/endpoint-request/GeneratedDefaultEndpointRequest.ts @@ -176,12 +176,13 @@ export class GeneratedDefaultEndpointRequest implements GeneratedEndpointRequest public getFetcherRequestArgs( context: SdkContext - ): Pick { + ): Pick { return { headers: this.getHeaders(context), queryParameters: this.queryParams.getReferenceTo(context), body: this.getSerializedRequestBodyWithNullCheck(context), - contentType: "application/json" + contentType: "application/json", + requestType: "json" }; } diff --git a/generators/typescript/sdk/client-class-generator/src/endpoint-request/GeneratedEndpointRequest.ts b/generators/typescript/sdk/client-class-generator/src/endpoint-request/GeneratedEndpointRequest.ts index ed5bc58a4fc..ba500f82db3 100644 --- a/generators/typescript/sdk/client-class-generator/src/endpoint-request/GeneratedEndpointRequest.ts +++ b/generators/typescript/sdk/client-class-generator/src/endpoint-request/GeneratedEndpointRequest.ts @@ -9,7 +9,7 @@ export interface GeneratedEndpointRequest { getEndpointParameters(context: SdkContext): OptionalKind[]; getFetcherRequestArgs: ( context: SdkContext - ) => Pick; + ) => Pick; getReferenceToRequestBody: (context: SdkContext) => ts.Expression | undefined; getReferenceToQueryParameter: (queryParameterKey: string, context: SdkContext) => ts.Expression; getExampleEndpointParameters({ diff --git a/generators/typescript/sdk/client-class-generator/src/endpoint-request/GeneratedFileUploadEndpointRequest.ts b/generators/typescript/sdk/client-class-generator/src/endpoint-request/GeneratedFileUploadEndpointRequest.ts index 74d839fc8ba..0e5c3a20bbb 100644 --- a/generators/typescript/sdk/client-class-generator/src/endpoint-request/GeneratedFileUploadEndpointRequest.ts +++ b/generators/typescript/sdk/client-class-generator/src/endpoint-request/GeneratedFileUploadEndpointRequest.ts @@ -210,6 +210,13 @@ export class GeneratedFileUploadEndpointRequest implements GeneratedEndpointRequ value: context.externalDependencies.fs.ReadStream._getReferenceToType() }) ); + + types.push( + this.maybeWrapFileArray({ + property, + value: context.externalDependencies.blob.Blob._getReferenceToType() + }) + ); }, browser: () => { types.push( @@ -252,7 +259,7 @@ export class GeneratedFileUploadEndpointRequest implements GeneratedEndpointRequ GeneratedFileUploadEndpointRequest.FORM_DATA_VARIABLE_NAME, undefined, undefined, - context.coreUtilities.formDataUtils._instantiate() + context.coreUtilities.formDataUtils.newFormData() ) ], ts.NodeFlags.Const @@ -282,11 +289,13 @@ export class GeneratedFileUploadEndpointRequest implements GeneratedEndpointRequ GeneratedFileUploadEndpointRequest.FORM_DATA_REQUEST_OPTIONS_VARIABLE_NAME, undefined, undefined, - context.coreUtilities.formDataUtils.getRequest({ - referencetoFormData: ts.factory.createIdentifier( - GeneratedFileUploadEndpointRequest.FORM_DATA_VARIABLE_NAME - ) - }) + ts.factory.createAwaitExpression( + context.coreUtilities.formDataUtils.getRequest({ + referencetoFormData: ts.factory.createIdentifier( + GeneratedFileUploadEndpointRequest.FORM_DATA_VARIABLE_NAME + ) + }) + ) ) ], ts.NodeFlags.Const @@ -299,12 +308,13 @@ export class GeneratedFileUploadEndpointRequest implements GeneratedEndpointRequ public getFetcherRequestArgs( context: SdkContext - ): Pick { + ): Pick { return { headers: this.getHeaders(context), queryParameters: this.queryParams != null ? this.queryParams.getReferenceTo(context) : undefined, + requestType: "file", body: context.coreUtilities.formDataUtils.getBody({ - referencetoFormDataRequest: ts.factory.createIdentifier( + referencetoFormData: ts.factory.createIdentifier( GeneratedFileUploadEndpointRequest.FORM_DATA_REQUEST_OPTIONS_VARIABLE_NAME ) }) @@ -321,7 +331,7 @@ export class GeneratedFileUploadEndpointRequest implements GeneratedEndpointRequ endpoint: this.endpoint, additionalSpreadHeaders: [ context.coreUtilities.formDataUtils.getHeaders({ - referencetoFormDataRequest: ts.factory.createIdentifier( + referencetoFormData: ts.factory.createIdentifier( GeneratedFileUploadEndpointRequest.FORM_DATA_REQUEST_OPTIONS_VARIABLE_NAME ) }) diff --git a/generators/typescript/sdk/client-class-generator/src/endpoints/utils/appendPropertyToFormData.ts b/generators/typescript/sdk/client-class-generator/src/endpoints/utils/appendPropertyToFormData.ts index fc702c721e0..2a62757e1a9 100644 --- a/generators/typescript/sdk/client-class-generator/src/endpoints/utils/appendPropertyToFormData.ts +++ b/generators/typescript/sdk/client-class-generator/src/endpoints/utils/appendPropertyToFormData.ts @@ -21,7 +21,7 @@ export function appendPropertyToFormData({ file: (property) => { const FOR_LOOP_ITEM_VARIABLE_NAME = "_file"; - let statement = context.coreUtilities.formDataUtils.append({ + let statement = context.coreUtilities.formDataUtils.appendFile({ referencetoFormData: referenceToFormData, key: property.key.wireValue, value: ts.factory.createIdentifier( diff --git a/generators/typescript/utils/commons/src/core-utilities/fetcher/Fetcher.ts b/generators/typescript/utils/commons/src/core-utilities/fetcher/Fetcher.ts index 480298bec0a..8f8f106f384 100644 --- a/generators/typescript/utils/commons/src/core-utilities/fetcher/Fetcher.ts +++ b/generators/typescript/utils/commons/src/core-utilities/fetcher/Fetcher.ts @@ -94,6 +94,7 @@ export declare namespace Fetcher { withCredentials: boolean; timeoutInSeconds: ts.Expression; maxRetries?: ts.Expression; + requestType?: "json" | "file" | "bytes" | "other"; responseType?: "json" | "blob" | "streaming" | "text"; } } diff --git a/generators/typescript/utils/commons/src/core-utilities/fetcher/FetcherImpl.ts b/generators/typescript/utils/commons/src/core-utilities/fetcher/FetcherImpl.ts index 0589918b353..673ba27cfb1 100644 --- a/generators/typescript/utils/commons/src/core-utilities/fetcher/FetcherImpl.ts +++ b/generators/typescript/utils/commons/src/core-utilities/fetcher/FetcherImpl.ts @@ -38,6 +38,7 @@ export class FetcherImpl extends CoreUtility implements Fetcher { body: "body", timeoutMs: "timeoutMs", withCredentials: "withCredentials", + requestType: "requestType", responseType: "responseType", abortSignal: "abortSignal" }, @@ -106,6 +107,14 @@ export class FetcherImpl extends CoreUtility implements Fetcher { ) ); } + if (args.requestType != null && args.responseType !== "json") { + properties.push( + ts.factory.createPropertyAssignment( + this.Fetcher.Args.properties.requestType, + ts.factory.createStringLiteral(args.requestType) + ) + ); + } if (args.body != null) { properties.push(ts.factory.createPropertyAssignment(this.Fetcher.Args.properties.body, args.body)); } diff --git a/generators/typescript/utils/commons/src/core-utilities/form-data-utils/FormDataUtils.ts b/generators/typescript/utils/commons/src/core-utilities/form-data-utils/FormDataUtils.ts index cdb91e707ea..0f546c5d138 100644 --- a/generators/typescript/utils/commons/src/core-utilities/form-data-utils/FormDataUtils.ts +++ b/generators/typescript/utils/commons/src/core-utilities/form-data-utils/FormDataUtils.ts @@ -1,9 +1,17 @@ import { ts } from "ts-morph"; export interface FormDataUtils { - _instantiate: () => ts.NewExpression; + newFormData: () => ts.AwaitExpression; + append: (args: { referencetoFormData: ts.Expression; key: string; value: ts.Expression }) => ts.Statement; + appendFile: (args: { + referencetoFormData: ts.Expression; + key: string; + value: ts.Expression; + filename?: ts.Expression; + }) => ts.Statement; + + getBody: (args: { referencetoFormData: ts.Expression }) => ts.Expression; + getHeaders: (args: { referencetoFormData: ts.Expression }) => ts.Expression; getRequest: (args: { referencetoFormData: ts.Expression }) => ts.Expression; - getBody: (args: { referencetoFormDataRequest: ts.Expression }) => ts.Expression; - getHeaders: (args: { referencetoFormDataRequest: ts.Expression }) => ts.Expression; } diff --git a/generators/typescript/utils/commons/src/core-utilities/form-data-utils/FormDataUtilsImpl.ts b/generators/typescript/utils/commons/src/core-utilities/form-data-utils/FormDataUtilsImpl.ts index f93ed5e0b23..c8eb367a42a 100644 --- a/generators/typescript/utils/commons/src/core-utilities/form-data-utils/FormDataUtilsImpl.ts +++ b/generators/typescript/utils/commons/src/core-utilities/form-data-utils/FormDataUtilsImpl.ts @@ -19,9 +19,10 @@ export class FormDataUtilsImpl extends CoreUtility implements FormDataUtils { } }; - public readonly _instantiate = this.withExportedName( - "FormDataWrapper", - (fdw) => () => ts.factory.createNewExpression(fdw.getExpression(), undefined, []) + public readonly newFormData = this.withExportedName( + "newFormData", + (fdw) => () => + ts.factory.createAwaitExpression(ts.factory.createCallExpression(fdw.getExpression(), undefined, [])) ); public readonly append = ({ @@ -47,6 +48,31 @@ export class FormDataUtilsImpl extends CoreUtility implements FormDataUtils { ); }; + public readonly appendFile = ({ + referencetoFormData, + key, + value, + filename + }: { + referencetoFormData: ts.Expression; + key: string; + value: ts.Expression; + filename?: ts.Expression; + }): ts.Statement => { + return ts.factory.createExpressionStatement( + ts.factory.createAwaitExpression( + ts.factory.createCallExpression( + ts.factory.createPropertyAccessExpression( + referencetoFormData, + ts.factory.createIdentifier("appendFile") + ), + undefined, + [ts.factory.createStringLiteral(key), value] + ) + ) + ); + }; + public readonly getRequest = ({ referencetoFormData }: { referencetoFormData: ts.Expression }): ts.Expression => { return ts.factory.createCallExpression( ts.factory.createPropertyAccessExpression(referencetoFormData, ts.factory.createIdentifier("getRequest")), @@ -55,37 +81,15 @@ export class FormDataUtilsImpl extends CoreUtility implements FormDataUtils { ); }; - public readonly getBody = ({ - referencetoFormDataRequest - }: { - referencetoFormDataRequest: ts.Expression; - }): ts.Expression => { + public readonly getBody = ({ referencetoFormData }: { referencetoFormData: ts.Expression }): ts.Expression => { return ts.factory.createAwaitExpression( - ts.factory.createCallExpression( - ts.factory.createPropertyAccessExpression( - referencetoFormDataRequest, - ts.factory.createIdentifier("getBody") - ), - undefined, - [] - ) + ts.factory.createPropertyAccessExpression(referencetoFormData, ts.factory.createIdentifier("body")) ); }; - public readonly getHeaders = ({ - referencetoFormDataRequest - }: { - referencetoFormDataRequest: ts.Expression; - }): ts.Expression => { + public readonly getHeaders = ({ referencetoFormData }: { referencetoFormData: ts.Expression }): ts.Expression => { return ts.factory.createAwaitExpression( - ts.factory.createCallExpression( - ts.factory.createPropertyAccessExpression( - referencetoFormDataRequest, - ts.factory.createIdentifier("getHeaders") - ), - undefined, - [] - ) + ts.factory.createPropertyAccessExpression(referencetoFormData, ts.factory.createIdentifier("headers")) ); }; } diff --git a/generators/typescript/utils/commons/src/external-dependencies/ExternalDependencies.ts b/generators/typescript/utils/commons/src/external-dependencies/ExternalDependencies.ts index 9d11b0f70fc..2ffe01cf241 100644 --- a/generators/typescript/utils/commons/src/external-dependencies/ExternalDependencies.ts +++ b/generators/typescript/utils/commons/src/external-dependencies/ExternalDependencies.ts @@ -1,3 +1,4 @@ +import { Blob_ } from "./blob"; import { Express } from "./express/Express"; import { Fs } from "./fs"; import { Stream } from "./stream"; @@ -7,5 +8,6 @@ export interface ExternalDependencies { urlJoin: UrlJoin; express: Express; fs: Fs; + blob: Blob_; stream: Stream; } diff --git a/generators/typescript/utils/commons/src/external-dependencies/blob/Blob.ts b/generators/typescript/utils/commons/src/external-dependencies/blob/Blob.ts new file mode 100644 index 00000000000..d0036fc5fbb --- /dev/null +++ b/generators/typescript/utils/commons/src/external-dependencies/blob/Blob.ts @@ -0,0 +1,7 @@ +import { ts } from "ts-morph"; + +export interface Blob_ { + Blob: { + _getReferenceToType: () => ts.TypeNode; + }; +} diff --git a/generators/typescript/utils/commons/src/external-dependencies/blob/BlobImpl.ts b/generators/typescript/utils/commons/src/external-dependencies/blob/BlobImpl.ts new file mode 100644 index 00000000000..23533d967e8 --- /dev/null +++ b/generators/typescript/utils/commons/src/external-dependencies/blob/BlobImpl.ts @@ -0,0 +1,16 @@ +import { ts } from "ts-morph"; +import { ExternalDependency } from "../ExternalDependency"; +import { Blob_ } from "./Blob"; + +export class BlobImpl extends ExternalDependency implements Blob_ { + protected override PACKAGE = { name: "buffer" }; + protected override TYPES_PACKAGE = undefined; + + public readonly Blob = { + _getReferenceToType: this.withNamedImport("Blob", (withImport, buffer) => + withImport(() => { + return ts.factory.createTypeReferenceNode("Blob"); + }) + ) + }; +} diff --git a/generators/typescript/utils/commons/src/external-dependencies/blob/index.ts b/generators/typescript/utils/commons/src/external-dependencies/blob/index.ts new file mode 100644 index 00000000000..3ad508d3011 --- /dev/null +++ b/generators/typescript/utils/commons/src/external-dependencies/blob/index.ts @@ -0,0 +1 @@ +export { type Blob_ } from "./Blob"; diff --git a/generators/typescript/utils/commons/src/external-dependencies/createExternalDependencies.ts b/generators/typescript/utils/commons/src/external-dependencies/createExternalDependencies.ts index bc6a8ed18e3..c8b9d1769e8 100644 --- a/generators/typescript/utils/commons/src/external-dependencies/createExternalDependencies.ts +++ b/generators/typescript/utils/commons/src/external-dependencies/createExternalDependencies.ts @@ -1,5 +1,6 @@ import { DependencyManager } from "../dependency-manager/DependencyManager"; import { ImportsManager } from "../imports-manager"; +import { BlobImpl } from "./blob/BlobImpl"; import { ExpressImpl } from "./express/ExpressImpl"; import { ExternalDependencies } from "./ExternalDependencies"; import { FsImpl } from "./fs/FsImpl"; @@ -21,6 +22,7 @@ export function createExternalDependencies({ urlJoin: new UrlJoinImpl({ importsManager, dependencyManager }), express: new ExpressImpl({ importsManager, dependencyManager }), fs: new FsImpl({ importsManager, dependencyManager }), - stream: new StreamImpl({ importsManager, dependencyManager }) + stream: new StreamImpl({ importsManager, dependencyManager }), + blob: new BlobImpl({ importsManager, dependencyManager }) }; } diff --git a/generators/typescript/utils/commons/src/external-dependencies/index.ts b/generators/typescript/utils/commons/src/external-dependencies/index.ts index e3997f90ce9..a22cac9f19b 100644 --- a/generators/typescript/utils/commons/src/external-dependencies/index.ts +++ b/generators/typescript/utils/commons/src/external-dependencies/index.ts @@ -1,3 +1,4 @@ +export * from "./blob"; export { createExternalDependencies } from "./createExternalDependencies"; export * from "./express"; export { type ExternalDependencies } from "./ExternalDependencies"; diff --git a/generators/typescript/utils/core-utilities/fetcher/.mrlint.json b/generators/typescript/utils/core-utilities/fetcher/.mrlint.json index 7afa0c3215e..51e77ad17a7 100644 --- a/generators/typescript/utils/core-utilities/fetcher/.mrlint.json +++ b/generators/typescript/utils/core-utilities/fetcher/.mrlint.json @@ -4,7 +4,9 @@ "private": false, "rules": { "duplicate-dependencies": { - "exclude": ["@fern-fern/ir-sdk"] + "exclude": [ + "@fern-fern/ir-sdk" + ] }, "depcheck": { "ignores": [ diff --git a/generators/typescript/utils/core-utilities/fetcher/package.json b/generators/typescript/utils/core-utilities/fetcher/package.json index c4c4e22c80c..987ec64c764 100644 --- a/generators/typescript/utils/core-utilities/fetcher/package.json +++ b/generators/typescript/utils/core-utilities/fetcher/package.json @@ -35,14 +35,18 @@ "devDependencies": { "@babel/preset-env": "^7.24.3", "@babel/preset-typescript": "^7.24.1", + "@types/express": "^4.17.21", "@types/jest": "^29.5.12", + "@types/multer": "^1.4.11", "@types/node": "^18.7.18", "@types/node-fetch": "2.6.9", "@types/qs": "6.9.15", "depcheck": "^1.4.6", "eslint": "^8.56.0", + "express": "^4.19.2", "jest": "^29.7.0", "jest-environment-jsdom": "^29.7.0", + "multer": "^1.4.5-lts.1", "organize-imports-cli": "^0.10.0", "prettier": "^2.7.1", "typescript": "4.6.4" diff --git a/generators/typescript/utils/core-utilities/fetcher/src/fetcher/Fetcher.ts b/generators/typescript/utils/core-utilities/fetcher/src/fetcher/Fetcher.ts index 6f641a34297..814c6ee6a6c 100644 --- a/generators/typescript/utils/core-utilities/fetcher/src/fetcher/Fetcher.ts +++ b/generators/typescript/utils/core-utilities/fetcher/src/fetcher/Fetcher.ts @@ -20,6 +20,7 @@ export declare namespace Fetcher { maxRetries?: number; withCredentials?: boolean; abortSignal?: AbortSignal; + requestType?: "json" | "file" | "bytes"; responseType?: "json" | "blob" | "streaming" | "text"; } @@ -62,7 +63,10 @@ export async function fetcherImpl(args: Fetcher.Args): Promise { method: "POST", headers: { "X-Test": "x-test-header" }, body: { data: "test" }, - contentType: "application/json" + contentType: "application/json", + requestType: "json" }; mockCreateUrl.mockReturnValue("https://test.com"); diff --git a/generators/typescript/utils/core-utilities/fetcher/src/fetcher/__test__/getRequestBody.test.ts b/generators/typescript/utils/core-utilities/fetcher/src/fetcher/__test__/getRequestBody.test.ts index 4796360ef11..7482383bc61 100644 --- a/generators/typescript/utils/core-utilities/fetcher/src/fetcher/__test__/getRequestBody.test.ts +++ b/generators/typescript/utils/core-utilities/fetcher/src/fetcher/__test__/getRequestBody.test.ts @@ -1,5 +1,5 @@ import { RUNTIME } from "../../runtime"; -import { getRequestBody, maybeStringifyBody } from "../getRequestBody"; +import { getRequestBody } from "../getRequestBody"; if (RUNTIME.type === "browser") { require("jest-fetch-mock").enableMocks(); @@ -10,7 +10,10 @@ describe("Test getRequestBody", () => { if (RUNTIME.type === "node") { const formData = new (await import("formdata-node")).FormData(); formData.append("key", "value"); - const result = await getRequestBody(formData, "multipart/form-data"); + const result = await getRequestBody({ + body: formData, + type: "file" + }); expect(result).toBe(formData); } }); @@ -18,7 +21,10 @@ describe("Test getRequestBody", () => { it("should stringify body if not FormData in Node environment", async () => { if (RUNTIME.type === "node") { const body = { key: "value" }; - const result = await getRequestBody(body, "application/json"); + const result = await getRequestBody({ + body, + type: "json" + }); expect(result).toBe('{"key":"value"}'); } }); @@ -27,7 +33,10 @@ describe("Test getRequestBody", () => { if (RUNTIME.type === "browser") { const formData = new (await import("form-data")).default(); formData.append("key", "value"); - const result = await getRequestBody(formData, "multipart/form-data"); + const result = await getRequestBody({ + body: formData, + type: "file" + }); expect(result).toBe(formData); } }); @@ -35,28 +44,38 @@ describe("Test getRequestBody", () => { it("should stringify body if not FormData in browser environment", async () => { if (RUNTIME.type === "browser") { const body = { key: "value" }; - const result = await getRequestBody(body, "application/json"); + const result = await getRequestBody({ + body, + type: "json" + }); expect(result).toBe('{"key":"value"}'); } }); -}); -describe("Test maybeStringifyBody", () => { - it("should return the Uint8Array", () => { + it("should return the Uint8Array", async () => { const input = new Uint8Array([1, 2, 3]); - const result = maybeStringifyBody(input, "application/octet-stream"); + const result = await getRequestBody({ + body: input, + type: "bytes" + }); expect(result).toBe(input); }); - it("should return the input for content-type 'application/x-www-form-urlencoded'", () => { + it("should return the input for content-type 'application/x-www-form-urlencoded'", async () => { const input = "key=value&another=param"; - const result = maybeStringifyBody(input, "application/x-www-form-urlencoded"); + const result = await getRequestBody({ + body: input, + type: "other" + }); expect(result).toBe(input); }); - it("should JSON stringify objects", () => { + it("should JSON stringify objects", async () => { const input = { key: "value" }; - const result = maybeStringifyBody(input, "application/json"); + const result = await getRequestBody({ + body: input, + type: "json" + }); expect(result).toBe('{"key":"value"}'); }); }); diff --git a/generators/typescript/utils/core-utilities/fetcher/src/fetcher/getRequestBody.ts b/generators/typescript/utils/core-utilities/fetcher/src/fetcher/getRequestBody.ts index 9ad67ca9757..1138414b1c2 100644 --- a/generators/typescript/utils/core-utilities/fetcher/src/fetcher/getRequestBody.ts +++ b/generators/typescript/utils/core-utilities/fetcher/src/fetcher/getRequestBody.ts @@ -1,34 +1,14 @@ -import { RUNTIME } from "../runtime"; - -export async function getRequestBody(body: any, contentType: string): Promise { - let requestBody: BodyInit; - if (RUNTIME.type === "node") { - if (body instanceof (await import("formdata-node")).FormData) { - // @ts-expect-error - requestBody = body; - } else if (body instanceof (await import("stream")).Readable) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } - } else { - if (body instanceof (await import("form-data")).default) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } +export declare namespace GetRequestBody { + interface Args { + body: unknown; + type: "json" | "file" | "bytes" | "other"; } - return requestBody; } -export const maybeStringifyBody = (requestBody: any, contentType: string): Uint8Array | string => { - if (requestBody instanceof Uint8Array) { - return requestBody; - } else if (contentType === "application/x-www-form-urlencoded" && typeof requestBody === "string") { - return requestBody; +export async function getRequestBody({ body, type }: GetRequestBody.Args): Promise { + if (type.includes("json")) { + return JSON.stringify(body); } else { - return JSON.stringify(requestBody); + return body as BodyInit; } -}; +} diff --git a/generators/typescript/utils/core-utilities/fetcher/src/form-data-utils/FormDataWrapper.ts b/generators/typescript/utils/core-utilities/fetcher/src/form-data-utils/FormDataWrapper.ts index 602173e5c36..2a405035dc8 100644 --- a/generators/typescript/utils/core-utilities/fetcher/src/form-data-utils/FormDataWrapper.ts +++ b/generators/typescript/utils/core-utilities/fetcher/src/form-data-utils/FormDataWrapper.ts @@ -1,72 +1,134 @@ -import { Readable } from "stream"; import { RUNTIME } from "../runtime"; -interface CrossPlatformFormData { - append(key: string, value: any): void; +export type MaybePromise = Promise | T; + +type FormDataRequest = { + body: Body; + headers: Record; +}; + +export interface CrossPlatformFormData { + setup(): Promise; + + append(key: string, value: unknown): void; + + appendFile(key: string, value: unknown, fileName?: string): Promise; + + getRequest(): MaybePromise>; +} + +export async function newFormData(): Promise { + let formdata: CrossPlatformFormData; + if (RUNTIME.type === "node" && RUNTIME.parsedVersion != null && RUNTIME.parsedVersion > 18) { + formdata = new Node19FormData(); + } else if (RUNTIME.type === "node") { + formdata = new Node16FormData(); + } else { + formdata = new WebFormData(); + } + await formdata.setup(); + return formdata; } -class FormDataRequestBody { - private fd: any; - private encoder: any; +/** + * Form Data Implementation for Node.js 18+ + */ +class Node19FormData implements CrossPlatformFormData { + private fd: + | { + append(name: string, value: unknown, fileName?: string): void; + } + | undefined; - constructor(fd: any) { - this.fd = fd; + public async setup() { + this.fd = new (await import("formdata-node")).FormData(); } - async setup(): Promise { - if (this.encoder == null && RUNTIME.type === "node") { - this.encoder = new (await import("form-data-encoder")).FormDataEncoder(this.fd); - } + public append(key: string, value: any): void { + this.fd?.append(key, value); } - /** - * @returns the multipart form data request - */ - public async getBody(): Promise { - if (RUNTIME.type !== "node") { - return this.fd; - } else { - if (this.encoder == null) { - await this.setup(); - } - return Readable.from(this.encoder); - } + public async appendFile(key: string, value: any, fileName?: string): Promise { + this.fd?.append(key, new (await import("buffer")).Blob([value]), fileName); + } + + public async getRequest(): Promise> { + const encoder = new (await import("form-data-encoder")).FormDataEncoder(this.fd as any); + return { + body: (await import("stream")).Readable.from(encoder), + headers: encoder.headers + }; + } +} + +/** + * Form Data Implementation for Node.js 16-18 + */ +class Node16FormData implements CrossPlatformFormData { + private fd: + | { + append( + name: string, + value: unknown, + options?: { + header?: string | Headers; + knownLength?: number; + filename?: string; + filepath?: string; + contentType?: string; + } + ): void; + + getHeaders(): Record; + } + | undefined; + + public async setup(): Promise { + this.fd = new (await import("form-data")).default(); + } + + public append(key: string, value: any): void { + this.fd?.append(key, value); } - /** - * @returns headers that need to be added to the multipart form data request - */ - public async getHeaders(): Promise> { - if (RUNTIME.type !== "node") { - return {}; + public async appendFile(key: string, value: any, fileName?: string): Promise { + if (fileName == null) { + this.fd?.append(key, value); } else { - if (this.encoder == null) { - await this.setup(); - } - return this.encoder.headers; + this.fd?.append(key, value, { filename: fileName }); } } + + public getRequest(): FormDataRequest { + return { + body: this.fd, + headers: this.fd ? this.fd.getHeaders() : {} + }; + } } /** - * FormDataWrapper is a utility to make form data - * requests across both Browser and Node.js runtimes. + * Form Data Implementation for Web */ -export class FormDataWrapper { - private fd: CrossPlatformFormData | undefined; - - public async append(name: string, value: any): Promise { - if (this.fd == null) { - if (RUNTIME.type === "node") { - this.fd = new (await import("formdata-node")).FormData(); - } else { - this.fd = new (await import("form-data")).default(); - } - } - this.fd.append(name, value); +class WebFormData implements CrossPlatformFormData { + private fd: { append(name: string, value: string | Blob, fileName?: string): void } | undefined; + + public async setup(): Promise { + this.fd = new FormData(); + } + + public append(key: string, value: any): void { + this.fd?.append(key, value); + } + + public async appendFile(key: string, value: any, fileName?: string): Promise { + this.fd?.append(key, new Blob([value]), fileName); } - public getRequest(): FormDataRequestBody { - return new FormDataRequestBody(this.fd); + public getRequest(): FormDataRequest { + return { + body: this.fd, + headers: {} + }; } } diff --git a/generators/typescript/utils/core-utilities/fetcher/src/form-data-utils/__test__/multipart.upload.test.ts b/generators/typescript/utils/core-utilities/fetcher/src/form-data-utils/__test__/multipart.upload.test.ts new file mode 100644 index 00000000000..81a05f8d17f --- /dev/null +++ b/generators/typescript/utils/core-utilities/fetcher/src/form-data-utils/__test__/multipart.upload.test.ts @@ -0,0 +1,61 @@ +import express from "express"; +import fs from "fs"; +import { Server } from "http"; +import multer from "multer"; +import { newFormData } from "../.."; +import { getFetchFn } from "../../fetcher/getFetchFn"; + +describe("Multipart Form Data Tests", () => { + let app = express(); + let s: Server; + + beforeAll(async () => { + const storage = multer.memoryStorage(); + const upload = multer({ storage: storage }); + // Define the file upload route + app.post("/upload", upload.any(), (req: any, res: any) => { + try { + if (!req.files) { + return res.status(400).send("No file uploaded."); + } else { + const file = req.files && req.files[0]; + return res.status(200).send(`File sent: ${file.originalname}`); + } + } catch (error) { + console.log(error); + res.status(500).send("Error uploading file."); + } + return res.status(200).send("File uploaded successfully."); + }); + app.use(express.json()); + app.use(express.urlencoded({ extended: true })); + s = app.listen(4567, () => {}); + }); + + it("should reflect that blob of blob has same content as blob", async () => { + const b = new Blob(["test"]); + const c = new Blob([b]); + + expect(await b.text).toBe(await c.text); + }); + + it("should return a 200 status code", async () => { + const fdw = await newFormData(); + + const y = fs.readFileSync("package.json"); + await fdw.appendFile("file", y, "package.json"); + + let fetch = await getFetchFn(); + + const response = await fetch("http://localhost:4567/upload", { + method: "POST", + ...(await fdw.getRequest()) + }); + + expect(response.status).toBe(200); + }); + + afterAll(async () => { + s.close(() => {}); + }); +}); diff --git a/generators/typescript/utils/core-utilities/fetcher/src/runtime/runtime.ts b/generators/typescript/utils/core-utilities/fetcher/src/runtime/runtime.ts index b1dd79dbdd8..22fe45ba685 100644 --- a/generators/typescript/utils/core-utilities/fetcher/src/runtime/runtime.ts +++ b/generators/typescript/utils/core-utilities/fetcher/src/runtime/runtime.ts @@ -69,6 +69,7 @@ export const RUNTIME: Runtime = evaluateRuntime(); export interface Runtime { type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd"; version?: string; + parsedVersion?: number; } function evaluateRuntime(): Runtime { @@ -108,7 +109,8 @@ function evaluateRuntime(): Runtime { if (isNode) { return { type: "node", - version: process.versions.node + version: process.versions.node, + parsedVersion: Number(process.versions.node.split(".")[0]) }; } diff --git a/packages/cli/docs-preview/package.json b/packages/cli/docs-preview/package.json index b937ab64d5b..3a45443e953 100644 --- a/packages/cli/docs-preview/package.json +++ b/packages/cli/docs-preview/package.json @@ -48,7 +48,7 @@ "devDependencies": { "@types/cors": "^2.8.13", "@types/decompress": "^4.2.7", - "@types/express": "^4.17.20", + "@types/express": "^4.17.21", "@types/jest": "^29.5.12", "@types/node": "^18.7.18", "@types/uuid": "^9.0.8", diff --git a/packages/cli/ete-tests/src/tests/fetcher/fetcher.test.ts b/packages/cli/ete-tests/src/tests/fetcher/fetcher.test.ts index c3e0b969c32..a0662059bba 100644 --- a/packages/cli/ete-tests/src/tests/fetcher/fetcher.test.ts +++ b/packages/cli/ete-tests/src/tests/fetcher/fetcher.test.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable jest/no-disabled-tests */ -import { fetcher, FormDataWrapper, Stream } from "@fern-typescript/fetcher"; +import { fetcher, newFormData, Stream } from "@fern-typescript/fetcher"; import * as fs from "fs"; import path from "path"; import * as stream from "stream"; @@ -18,11 +18,10 @@ describe("Fetcher Tests", () => { it.skip("Formdata request", async () => { const file = fs.createReadStream(path.join(__dirname, "addresses.csv")); - const formData = new FormDataWrapper(); - await formData.append("data", file); + const formData = await newFormData(); + formData.append("data", file); - const formDataRequest = formData.getRequest(); - const headers = await formDataRequest.getHeaders(); + const { headers, body } = await formData.getRequest(); const response = await fetcher({ url: "https://api.cohere.ai/v1/datasets", method: "POST", @@ -34,7 +33,7 @@ describe("Fetcher Tests", () => { name: "my-dataset", type: "embed-input" }, - body: await formDataRequest.getBody() + body }); expect((response as any)?.ok).toEqual(true); }, 90_000); diff --git a/packages/cli/mock/package.json b/packages/cli/mock/package.json index e58bea5cb7a..d29c06dbad0 100644 --- a/packages/cli/mock/package.json +++ b/packages/cli/mock/package.json @@ -36,7 +36,7 @@ "url-join": "^5.0.0" }, "devDependencies": { - "@types/express": "^4.17.20", + "@types/express": "^4.17.21", "@types/jest": "^29.5.12", "@types/node": "^18.7.18", "@types/url-join": "4.0.1", diff --git a/seed/ts-sdk/alias/src/Client.ts b/seed/ts-sdk/alias/src/Client.ts index de6d0c5c921..ed0e7ed516b 100644 --- a/seed/ts-sdk/alias/src/Client.ts +++ b/seed/ts-sdk/alias/src/Client.ts @@ -48,6 +48,7 @@ export class SeedAliasClient { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/seed/ts-sdk/alias/src/core/fetcher/Fetcher.ts b/seed/ts-sdk/alias/src/core/fetcher/Fetcher.ts index d3686367aa9..f3b010358d0 100644 --- a/seed/ts-sdk/alias/src/core/fetcher/Fetcher.ts +++ b/seed/ts-sdk/alias/src/core/fetcher/Fetcher.ts @@ -20,6 +20,7 @@ export declare namespace Fetcher { maxRetries?: number; withCredentials?: boolean; abortSignal?: AbortSignal; + requestType?: "json" | "file" | "bytes"; responseType?: "json" | "blob" | "streaming" | "text"; } @@ -62,7 +63,10 @@ export async function fetcherImpl(args: Fetcher.Args): Promise { - let requestBody: BodyInit; - if (RUNTIME.type === "node") { - if (body instanceof (await import("formdata-node")).FormData) { - // @ts-expect-error - requestBody = body; - } else if (body instanceof (await import("stream")).Readable) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } - } else { - if (body instanceof (await import("form-data")).default) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } +export declare namespace GetRequestBody { + interface Args { + body: unknown; + type: "json" | "file" | "bytes" | "other"; } - return requestBody; } -export const maybeStringifyBody = (requestBody: any, contentType: string): Uint8Array | string => { - if (requestBody instanceof Uint8Array) { - return requestBody; - } else if (contentType === "application/x-www-form-urlencoded" && typeof requestBody === "string") { - return requestBody; +export async function getRequestBody({ body, type }: GetRequestBody.Args): Promise { + if (type.includes("json")) { + return JSON.stringify(body); } else { - return JSON.stringify(requestBody); + return body as BodyInit; } -}; +} diff --git a/seed/ts-sdk/alias/src/core/runtime/runtime.ts b/seed/ts-sdk/alias/src/core/runtime/runtime.ts index 30fe0779aaa..4d0687e8eb4 100644 --- a/seed/ts-sdk/alias/src/core/runtime/runtime.ts +++ b/seed/ts-sdk/alias/src/core/runtime/runtime.ts @@ -69,6 +69,7 @@ export const RUNTIME: Runtime = evaluateRuntime(); export interface Runtime { type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd"; version?: string; + parsedVersion?: number; } function evaluateRuntime(): Runtime { @@ -109,6 +110,7 @@ function evaluateRuntime(): Runtime { return { type: "node", version: process.versions.node, + parsedVersion: Number(process.versions.node.split(".")[0]), }; } diff --git a/seed/ts-sdk/api-wide-base-path/src/api/resources/service/client/Client.ts b/seed/ts-sdk/api-wide-base-path/src/api/resources/service/client/Client.ts index c5b6f2d9835..a6358af6c5b 100644 --- a/seed/ts-sdk/api-wide-base-path/src/api/resources/service/client/Client.ts +++ b/seed/ts-sdk/api-wide-base-path/src/api/resources/service/client/Client.ts @@ -56,6 +56,7 @@ export class Service { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/seed/ts-sdk/api-wide-base-path/src/core/fetcher/Fetcher.ts b/seed/ts-sdk/api-wide-base-path/src/core/fetcher/Fetcher.ts index d3686367aa9..f3b010358d0 100644 --- a/seed/ts-sdk/api-wide-base-path/src/core/fetcher/Fetcher.ts +++ b/seed/ts-sdk/api-wide-base-path/src/core/fetcher/Fetcher.ts @@ -20,6 +20,7 @@ export declare namespace Fetcher { maxRetries?: number; withCredentials?: boolean; abortSignal?: AbortSignal; + requestType?: "json" | "file" | "bytes"; responseType?: "json" | "blob" | "streaming" | "text"; } @@ -62,7 +63,10 @@ export async function fetcherImpl(args: Fetcher.Args): Promise { - let requestBody: BodyInit; - if (RUNTIME.type === "node") { - if (body instanceof (await import("formdata-node")).FormData) { - // @ts-expect-error - requestBody = body; - } else if (body instanceof (await import("stream")).Readable) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } - } else { - if (body instanceof (await import("form-data")).default) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } +export declare namespace GetRequestBody { + interface Args { + body: unknown; + type: "json" | "file" | "bytes" | "other"; } - return requestBody; } -export const maybeStringifyBody = (requestBody: any, contentType: string): Uint8Array | string => { - if (requestBody instanceof Uint8Array) { - return requestBody; - } else if (contentType === "application/x-www-form-urlencoded" && typeof requestBody === "string") { - return requestBody; +export async function getRequestBody({ body, type }: GetRequestBody.Args): Promise { + if (type.includes("json")) { + return JSON.stringify(body); } else { - return JSON.stringify(requestBody); + return body as BodyInit; } -}; +} diff --git a/seed/ts-sdk/api-wide-base-path/src/core/runtime/runtime.ts b/seed/ts-sdk/api-wide-base-path/src/core/runtime/runtime.ts index 30fe0779aaa..4d0687e8eb4 100644 --- a/seed/ts-sdk/api-wide-base-path/src/core/runtime/runtime.ts +++ b/seed/ts-sdk/api-wide-base-path/src/core/runtime/runtime.ts @@ -69,6 +69,7 @@ export const RUNTIME: Runtime = evaluateRuntime(); export interface Runtime { type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd"; version?: string; + parsedVersion?: number; } function evaluateRuntime(): Runtime { @@ -109,6 +110,7 @@ function evaluateRuntime(): Runtime { return { type: "node", version: process.versions.node, + parsedVersion: Number(process.versions.node.split(".")[0]), }; } diff --git a/seed/ts-sdk/audiences/src/api/resources/folderA/resources/service/client/Client.ts b/seed/ts-sdk/audiences/src/api/resources/folderA/resources/service/client/Client.ts index 5e410f7d4ab..24d2b80b947 100644 --- a/seed/ts-sdk/audiences/src/api/resources/folderA/resources/service/client/Client.ts +++ b/seed/ts-sdk/audiences/src/api/resources/folderA/resources/service/client/Client.ts @@ -43,6 +43,7 @@ export class Service { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/seed/ts-sdk/audiences/src/api/resources/foo/client/Client.ts b/seed/ts-sdk/audiences/src/api/resources/foo/client/Client.ts index d417e85b3b0..80d805f5b50 100644 --- a/seed/ts-sdk/audiences/src/api/resources/foo/client/Client.ts +++ b/seed/ts-sdk/audiences/src/api/resources/foo/client/Client.ts @@ -58,6 +58,7 @@ export class Foo { }, contentType: "application/json", queryParameters: _queryParams, + requestType: "json", body: serializers.FindRequest.jsonOrThrow(_body, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, diff --git a/seed/ts-sdk/audiences/src/core/fetcher/Fetcher.ts b/seed/ts-sdk/audiences/src/core/fetcher/Fetcher.ts index d3686367aa9..f3b010358d0 100644 --- a/seed/ts-sdk/audiences/src/core/fetcher/Fetcher.ts +++ b/seed/ts-sdk/audiences/src/core/fetcher/Fetcher.ts @@ -20,6 +20,7 @@ export declare namespace Fetcher { maxRetries?: number; withCredentials?: boolean; abortSignal?: AbortSignal; + requestType?: "json" | "file" | "bytes"; responseType?: "json" | "blob" | "streaming" | "text"; } @@ -62,7 +63,10 @@ export async function fetcherImpl(args: Fetcher.Args): Promise { - let requestBody: BodyInit; - if (RUNTIME.type === "node") { - if (body instanceof (await import("formdata-node")).FormData) { - // @ts-expect-error - requestBody = body; - } else if (body instanceof (await import("stream")).Readable) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } - } else { - if (body instanceof (await import("form-data")).default) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } +export declare namespace GetRequestBody { + interface Args { + body: unknown; + type: "json" | "file" | "bytes" | "other"; } - return requestBody; } -export const maybeStringifyBody = (requestBody: any, contentType: string): Uint8Array | string => { - if (requestBody instanceof Uint8Array) { - return requestBody; - } else if (contentType === "application/x-www-form-urlencoded" && typeof requestBody === "string") { - return requestBody; +export async function getRequestBody({ body, type }: GetRequestBody.Args): Promise { + if (type.includes("json")) { + return JSON.stringify(body); } else { - return JSON.stringify(requestBody); + return body as BodyInit; } -}; +} diff --git a/seed/ts-sdk/audiences/src/core/runtime/runtime.ts b/seed/ts-sdk/audiences/src/core/runtime/runtime.ts index 30fe0779aaa..4d0687e8eb4 100644 --- a/seed/ts-sdk/audiences/src/core/runtime/runtime.ts +++ b/seed/ts-sdk/audiences/src/core/runtime/runtime.ts @@ -69,6 +69,7 @@ export const RUNTIME: Runtime = evaluateRuntime(); export interface Runtime { type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd"; version?: string; + parsedVersion?: number; } function evaluateRuntime(): Runtime { @@ -109,6 +110,7 @@ function evaluateRuntime(): Runtime { return { type: "node", version: process.versions.node, + parsedVersion: Number(process.versions.node.split(".")[0]), }; } diff --git a/seed/ts-sdk/auth-environment-variables/src/api/resources/service/client/Client.ts b/seed/ts-sdk/auth-environment-variables/src/api/resources/service/client/Client.ts index 874a9a8dee2..f2ec683341a 100644 --- a/seed/ts-sdk/auth-environment-variables/src/api/resources/service/client/Client.ts +++ b/seed/ts-sdk/auth-environment-variables/src/api/resources/service/client/Client.ts @@ -53,6 +53,7 @@ export class Service { ...(await this._getCustomAuthorizationHeaders()), }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -118,6 +119,7 @@ export class Service { ...(await this._getCustomAuthorizationHeaders()), }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/seed/ts-sdk/auth-environment-variables/src/core/fetcher/Fetcher.ts b/seed/ts-sdk/auth-environment-variables/src/core/fetcher/Fetcher.ts index d3686367aa9..f3b010358d0 100644 --- a/seed/ts-sdk/auth-environment-variables/src/core/fetcher/Fetcher.ts +++ b/seed/ts-sdk/auth-environment-variables/src/core/fetcher/Fetcher.ts @@ -20,6 +20,7 @@ export declare namespace Fetcher { maxRetries?: number; withCredentials?: boolean; abortSignal?: AbortSignal; + requestType?: "json" | "file" | "bytes"; responseType?: "json" | "blob" | "streaming" | "text"; } @@ -62,7 +63,10 @@ export async function fetcherImpl(args: Fetcher.Args): Promise { - let requestBody: BodyInit; - if (RUNTIME.type === "node") { - if (body instanceof (await import("formdata-node")).FormData) { - // @ts-expect-error - requestBody = body; - } else if (body instanceof (await import("stream")).Readable) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } - } else { - if (body instanceof (await import("form-data")).default) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } +export declare namespace GetRequestBody { + interface Args { + body: unknown; + type: "json" | "file" | "bytes" | "other"; } - return requestBody; } -export const maybeStringifyBody = (requestBody: any, contentType: string): Uint8Array | string => { - if (requestBody instanceof Uint8Array) { - return requestBody; - } else if (contentType === "application/x-www-form-urlencoded" && typeof requestBody === "string") { - return requestBody; +export async function getRequestBody({ body, type }: GetRequestBody.Args): Promise { + if (type.includes("json")) { + return JSON.stringify(body); } else { - return JSON.stringify(requestBody); + return body as BodyInit; } -}; +} diff --git a/seed/ts-sdk/auth-environment-variables/src/core/runtime/runtime.ts b/seed/ts-sdk/auth-environment-variables/src/core/runtime/runtime.ts index 30fe0779aaa..4d0687e8eb4 100644 --- a/seed/ts-sdk/auth-environment-variables/src/core/runtime/runtime.ts +++ b/seed/ts-sdk/auth-environment-variables/src/core/runtime/runtime.ts @@ -69,6 +69,7 @@ export const RUNTIME: Runtime = evaluateRuntime(); export interface Runtime { type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd"; version?: string; + parsedVersion?: number; } function evaluateRuntime(): Runtime { @@ -109,6 +110,7 @@ function evaluateRuntime(): Runtime { return { type: "node", version: process.versions.node, + parsedVersion: Number(process.versions.node.split(".")[0]), }; } diff --git a/seed/ts-sdk/basic-auth-environment-variables/src/api/resources/basicAuth/client/Client.ts b/seed/ts-sdk/basic-auth-environment-variables/src/api/resources/basicAuth/client/Client.ts index da7e7d144cc..c2e68f70e70 100644 --- a/seed/ts-sdk/basic-auth-environment-variables/src/api/resources/basicAuth/client/Client.ts +++ b/seed/ts-sdk/basic-auth-environment-variables/src/api/resources/basicAuth/client/Client.ts @@ -51,6 +51,7 @@ export class BasicAuth { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -125,6 +126,7 @@ export class BasicAuth { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: request, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, diff --git a/seed/ts-sdk/basic-auth-environment-variables/src/core/fetcher/Fetcher.ts b/seed/ts-sdk/basic-auth-environment-variables/src/core/fetcher/Fetcher.ts index d3686367aa9..f3b010358d0 100644 --- a/seed/ts-sdk/basic-auth-environment-variables/src/core/fetcher/Fetcher.ts +++ b/seed/ts-sdk/basic-auth-environment-variables/src/core/fetcher/Fetcher.ts @@ -20,6 +20,7 @@ export declare namespace Fetcher { maxRetries?: number; withCredentials?: boolean; abortSignal?: AbortSignal; + requestType?: "json" | "file" | "bytes"; responseType?: "json" | "blob" | "streaming" | "text"; } @@ -62,7 +63,10 @@ export async function fetcherImpl(args: Fetcher.Args): Promise { - let requestBody: BodyInit; - if (RUNTIME.type === "node") { - if (body instanceof (await import("formdata-node")).FormData) { - // @ts-expect-error - requestBody = body; - } else if (body instanceof (await import("stream")).Readable) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } - } else { - if (body instanceof (await import("form-data")).default) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } +export declare namespace GetRequestBody { + interface Args { + body: unknown; + type: "json" | "file" | "bytes" | "other"; } - return requestBody; } -export const maybeStringifyBody = (requestBody: any, contentType: string): Uint8Array | string => { - if (requestBody instanceof Uint8Array) { - return requestBody; - } else if (contentType === "application/x-www-form-urlencoded" && typeof requestBody === "string") { - return requestBody; +export async function getRequestBody({ body, type }: GetRequestBody.Args): Promise { + if (type.includes("json")) { + return JSON.stringify(body); } else { - return JSON.stringify(requestBody); + return body as BodyInit; } -}; +} diff --git a/seed/ts-sdk/basic-auth-environment-variables/src/core/runtime/runtime.ts b/seed/ts-sdk/basic-auth-environment-variables/src/core/runtime/runtime.ts index 30fe0779aaa..4d0687e8eb4 100644 --- a/seed/ts-sdk/basic-auth-environment-variables/src/core/runtime/runtime.ts +++ b/seed/ts-sdk/basic-auth-environment-variables/src/core/runtime/runtime.ts @@ -69,6 +69,7 @@ export const RUNTIME: Runtime = evaluateRuntime(); export interface Runtime { type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd"; version?: string; + parsedVersion?: number; } function evaluateRuntime(): Runtime { @@ -109,6 +110,7 @@ function evaluateRuntime(): Runtime { return { type: "node", version: process.versions.node, + parsedVersion: Number(process.versions.node.split(".")[0]), }; } diff --git a/seed/ts-sdk/basic-auth/src/api/resources/basicAuth/client/Client.ts b/seed/ts-sdk/basic-auth/src/api/resources/basicAuth/client/Client.ts index c9d9a10f15b..663bda8f3d7 100644 --- a/seed/ts-sdk/basic-auth/src/api/resources/basicAuth/client/Client.ts +++ b/seed/ts-sdk/basic-auth/src/api/resources/basicAuth/client/Client.ts @@ -51,6 +51,7 @@ export class BasicAuth { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -125,6 +126,7 @@ export class BasicAuth { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: request, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, diff --git a/seed/ts-sdk/basic-auth/src/core/fetcher/Fetcher.ts b/seed/ts-sdk/basic-auth/src/core/fetcher/Fetcher.ts index d3686367aa9..f3b010358d0 100644 --- a/seed/ts-sdk/basic-auth/src/core/fetcher/Fetcher.ts +++ b/seed/ts-sdk/basic-auth/src/core/fetcher/Fetcher.ts @@ -20,6 +20,7 @@ export declare namespace Fetcher { maxRetries?: number; withCredentials?: boolean; abortSignal?: AbortSignal; + requestType?: "json" | "file" | "bytes"; responseType?: "json" | "blob" | "streaming" | "text"; } @@ -62,7 +63,10 @@ export async function fetcherImpl(args: Fetcher.Args): Promise { - let requestBody: BodyInit; - if (RUNTIME.type === "node") { - if (body instanceof (await import("formdata-node")).FormData) { - // @ts-expect-error - requestBody = body; - } else if (body instanceof (await import("stream")).Readable) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } - } else { - if (body instanceof (await import("form-data")).default) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } +export declare namespace GetRequestBody { + interface Args { + body: unknown; + type: "json" | "file" | "bytes" | "other"; } - return requestBody; } -export const maybeStringifyBody = (requestBody: any, contentType: string): Uint8Array | string => { - if (requestBody instanceof Uint8Array) { - return requestBody; - } else if (contentType === "application/x-www-form-urlencoded" && typeof requestBody === "string") { - return requestBody; +export async function getRequestBody({ body, type }: GetRequestBody.Args): Promise { + if (type.includes("json")) { + return JSON.stringify(body); } else { - return JSON.stringify(requestBody); + return body as BodyInit; } -}; +} diff --git a/seed/ts-sdk/basic-auth/src/core/runtime/runtime.ts b/seed/ts-sdk/basic-auth/src/core/runtime/runtime.ts index 30fe0779aaa..4d0687e8eb4 100644 --- a/seed/ts-sdk/basic-auth/src/core/runtime/runtime.ts +++ b/seed/ts-sdk/basic-auth/src/core/runtime/runtime.ts @@ -69,6 +69,7 @@ export const RUNTIME: Runtime = evaluateRuntime(); export interface Runtime { type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd"; version?: string; + parsedVersion?: number; } function evaluateRuntime(): Runtime { @@ -109,6 +110,7 @@ function evaluateRuntime(): Runtime { return { type: "node", version: process.versions.node, + parsedVersion: Number(process.versions.node.split(".")[0]), }; } diff --git a/seed/ts-sdk/bearer-token-environment-variable/src/api/resources/service/client/Client.ts b/seed/ts-sdk/bearer-token-environment-variable/src/api/resources/service/client/Client.ts index be60378e384..ee235bcd2ae 100644 --- a/seed/ts-sdk/bearer-token-environment-variable/src/api/resources/service/client/Client.ts +++ b/seed/ts-sdk/bearer-token-environment-variable/src/api/resources/service/client/Client.ts @@ -47,6 +47,7 @@ export class Service { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/seed/ts-sdk/bearer-token-environment-variable/src/core/fetcher/Fetcher.ts b/seed/ts-sdk/bearer-token-environment-variable/src/core/fetcher/Fetcher.ts index d3686367aa9..f3b010358d0 100644 --- a/seed/ts-sdk/bearer-token-environment-variable/src/core/fetcher/Fetcher.ts +++ b/seed/ts-sdk/bearer-token-environment-variable/src/core/fetcher/Fetcher.ts @@ -20,6 +20,7 @@ export declare namespace Fetcher { maxRetries?: number; withCredentials?: boolean; abortSignal?: AbortSignal; + requestType?: "json" | "file" | "bytes"; responseType?: "json" | "blob" | "streaming" | "text"; } @@ -62,7 +63,10 @@ export async function fetcherImpl(args: Fetcher.Args): Promise { - let requestBody: BodyInit; - if (RUNTIME.type === "node") { - if (body instanceof (await import("formdata-node")).FormData) { - // @ts-expect-error - requestBody = body; - } else if (body instanceof (await import("stream")).Readable) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } - } else { - if (body instanceof (await import("form-data")).default) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } +export declare namespace GetRequestBody { + interface Args { + body: unknown; + type: "json" | "file" | "bytes" | "other"; } - return requestBody; } -export const maybeStringifyBody = (requestBody: any, contentType: string): Uint8Array | string => { - if (requestBody instanceof Uint8Array) { - return requestBody; - } else if (contentType === "application/x-www-form-urlencoded" && typeof requestBody === "string") { - return requestBody; +export async function getRequestBody({ body, type }: GetRequestBody.Args): Promise { + if (type.includes("json")) { + return JSON.stringify(body); } else { - return JSON.stringify(requestBody); + return body as BodyInit; } -}; +} diff --git a/seed/ts-sdk/bearer-token-environment-variable/src/core/runtime/runtime.ts b/seed/ts-sdk/bearer-token-environment-variable/src/core/runtime/runtime.ts index 30fe0779aaa..4d0687e8eb4 100644 --- a/seed/ts-sdk/bearer-token-environment-variable/src/core/runtime/runtime.ts +++ b/seed/ts-sdk/bearer-token-environment-variable/src/core/runtime/runtime.ts @@ -69,6 +69,7 @@ export const RUNTIME: Runtime = evaluateRuntime(); export interface Runtime { type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd"; version?: string; + parsedVersion?: number; } function evaluateRuntime(): Runtime { @@ -109,6 +110,7 @@ function evaluateRuntime(): Runtime { return { type: "node", version: process.versions.node, + parsedVersion: Number(process.versions.node.split(".")[0]), }; } diff --git a/seed/ts-sdk/code-samples/src/api/resources/service/client/Client.ts b/seed/ts-sdk/code-samples/src/api/resources/service/client/Client.ts index 25fa68d46f4..1cf4b82ff52 100644 --- a/seed/ts-sdk/code-samples/src/api/resources/service/client/Client.ts +++ b/seed/ts-sdk/code-samples/src/api/resources/service/client/Client.ts @@ -50,6 +50,7 @@ export class Service { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.MyRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, diff --git a/seed/ts-sdk/code-samples/src/core/fetcher/Fetcher.ts b/seed/ts-sdk/code-samples/src/core/fetcher/Fetcher.ts index d3686367aa9..f3b010358d0 100644 --- a/seed/ts-sdk/code-samples/src/core/fetcher/Fetcher.ts +++ b/seed/ts-sdk/code-samples/src/core/fetcher/Fetcher.ts @@ -20,6 +20,7 @@ export declare namespace Fetcher { maxRetries?: number; withCredentials?: boolean; abortSignal?: AbortSignal; + requestType?: "json" | "file" | "bytes"; responseType?: "json" | "blob" | "streaming" | "text"; } @@ -62,7 +63,10 @@ export async function fetcherImpl(args: Fetcher.Args): Promise { - let requestBody: BodyInit; - if (RUNTIME.type === "node") { - if (body instanceof (await import("formdata-node")).FormData) { - // @ts-expect-error - requestBody = body; - } else if (body instanceof (await import("stream")).Readable) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } - } else { - if (body instanceof (await import("form-data")).default) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } +export declare namespace GetRequestBody { + interface Args { + body: unknown; + type: "json" | "file" | "bytes" | "other"; } - return requestBody; } -export const maybeStringifyBody = (requestBody: any, contentType: string): Uint8Array | string => { - if (requestBody instanceof Uint8Array) { - return requestBody; - } else if (contentType === "application/x-www-form-urlencoded" && typeof requestBody === "string") { - return requestBody; +export async function getRequestBody({ body, type }: GetRequestBody.Args): Promise { + if (type.includes("json")) { + return JSON.stringify(body); } else { - return JSON.stringify(requestBody); + return body as BodyInit; } -}; +} diff --git a/seed/ts-sdk/code-samples/src/core/runtime/runtime.ts b/seed/ts-sdk/code-samples/src/core/runtime/runtime.ts index 30fe0779aaa..4d0687e8eb4 100644 --- a/seed/ts-sdk/code-samples/src/core/runtime/runtime.ts +++ b/seed/ts-sdk/code-samples/src/core/runtime/runtime.ts @@ -69,6 +69,7 @@ export const RUNTIME: Runtime = evaluateRuntime(); export interface Runtime { type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd"; version?: string; + parsedVersion?: number; } function evaluateRuntime(): Runtime { @@ -109,6 +110,7 @@ function evaluateRuntime(): Runtime { return { type: "node", version: process.versions.node, + parsedVersion: Number(process.versions.node.split(".")[0]), }; } diff --git a/seed/ts-sdk/custom-auth/src/api/resources/customAuth/client/Client.ts b/seed/ts-sdk/custom-auth/src/api/resources/customAuth/client/Client.ts index c783c9428ed..7471a5a6cce 100644 --- a/seed/ts-sdk/custom-auth/src/api/resources/customAuth/client/Client.ts +++ b/seed/ts-sdk/custom-auth/src/api/resources/customAuth/client/Client.ts @@ -50,6 +50,7 @@ export class CustomAuth { ...(await this._getCustomAuthorizationHeaders()), }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -124,6 +125,7 @@ export class CustomAuth { ...(await this._getCustomAuthorizationHeaders()), }, contentType: "application/json", + requestType: "json", body: request, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, diff --git a/seed/ts-sdk/custom-auth/src/core/fetcher/Fetcher.ts b/seed/ts-sdk/custom-auth/src/core/fetcher/Fetcher.ts index d3686367aa9..f3b010358d0 100644 --- a/seed/ts-sdk/custom-auth/src/core/fetcher/Fetcher.ts +++ b/seed/ts-sdk/custom-auth/src/core/fetcher/Fetcher.ts @@ -20,6 +20,7 @@ export declare namespace Fetcher { maxRetries?: number; withCredentials?: boolean; abortSignal?: AbortSignal; + requestType?: "json" | "file" | "bytes"; responseType?: "json" | "blob" | "streaming" | "text"; } @@ -62,7 +63,10 @@ export async function fetcherImpl(args: Fetcher.Args): Promise { - let requestBody: BodyInit; - if (RUNTIME.type === "node") { - if (body instanceof (await import("formdata-node")).FormData) { - // @ts-expect-error - requestBody = body; - } else if (body instanceof (await import("stream")).Readable) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } - } else { - if (body instanceof (await import("form-data")).default) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } +export declare namespace GetRequestBody { + interface Args { + body: unknown; + type: "json" | "file" | "bytes" | "other"; } - return requestBody; } -export const maybeStringifyBody = (requestBody: any, contentType: string): Uint8Array | string => { - if (requestBody instanceof Uint8Array) { - return requestBody; - } else if (contentType === "application/x-www-form-urlencoded" && typeof requestBody === "string") { - return requestBody; +export async function getRequestBody({ body, type }: GetRequestBody.Args): Promise { + if (type.includes("json")) { + return JSON.stringify(body); } else { - return JSON.stringify(requestBody); + return body as BodyInit; } -}; +} diff --git a/seed/ts-sdk/custom-auth/src/core/runtime/runtime.ts b/seed/ts-sdk/custom-auth/src/core/runtime/runtime.ts index 30fe0779aaa..4d0687e8eb4 100644 --- a/seed/ts-sdk/custom-auth/src/core/runtime/runtime.ts +++ b/seed/ts-sdk/custom-auth/src/core/runtime/runtime.ts @@ -69,6 +69,7 @@ export const RUNTIME: Runtime = evaluateRuntime(); export interface Runtime { type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd"; version?: string; + parsedVersion?: number; } function evaluateRuntime(): Runtime { @@ -109,6 +110,7 @@ function evaluateRuntime(): Runtime { return { type: "node", version: process.versions.node, + parsedVersion: Number(process.versions.node.split(".")[0]), }; } diff --git a/seed/ts-sdk/enum/src/api/resources/inlinedRequest/client/Client.ts b/seed/ts-sdk/enum/src/api/resources/inlinedRequest/client/Client.ts index 3d61bb92668..bcbd5168633 100644 --- a/seed/ts-sdk/enum/src/api/resources/inlinedRequest/client/Client.ts +++ b/seed/ts-sdk/enum/src/api/resources/inlinedRequest/client/Client.ts @@ -51,6 +51,7 @@ export class InlinedRequest { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.SendEnumInlinedRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, diff --git a/seed/ts-sdk/enum/src/api/resources/pathParam/client/Client.ts b/seed/ts-sdk/enum/src/api/resources/pathParam/client/Client.ts index dd506875ae6..eaac275aa0b 100644 --- a/seed/ts-sdk/enum/src/api/resources/pathParam/client/Client.ts +++ b/seed/ts-sdk/enum/src/api/resources/pathParam/client/Client.ts @@ -61,6 +61,7 @@ export class PathParam { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/seed/ts-sdk/enum/src/api/resources/queryParam/client/Client.ts b/seed/ts-sdk/enum/src/api/resources/queryParam/client/Client.ts index b275acf632c..86ad85350d3 100644 --- a/seed/ts-sdk/enum/src/api/resources/queryParam/client/Client.ts +++ b/seed/ts-sdk/enum/src/api/resources/queryParam/client/Client.ts @@ -65,6 +65,7 @@ export class QueryParam { }, contentType: "application/json", queryParameters: _queryParams, + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -159,6 +160,7 @@ export class QueryParam { }, contentType: "application/json", queryParameters: _queryParams, + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/seed/ts-sdk/enum/src/core/fetcher/Fetcher.ts b/seed/ts-sdk/enum/src/core/fetcher/Fetcher.ts index d3686367aa9..f3b010358d0 100644 --- a/seed/ts-sdk/enum/src/core/fetcher/Fetcher.ts +++ b/seed/ts-sdk/enum/src/core/fetcher/Fetcher.ts @@ -20,6 +20,7 @@ export declare namespace Fetcher { maxRetries?: number; withCredentials?: boolean; abortSignal?: AbortSignal; + requestType?: "json" | "file" | "bytes"; responseType?: "json" | "blob" | "streaming" | "text"; } @@ -62,7 +63,10 @@ export async function fetcherImpl(args: Fetcher.Args): Promise { - let requestBody: BodyInit; - if (RUNTIME.type === "node") { - if (body instanceof (await import("formdata-node")).FormData) { - // @ts-expect-error - requestBody = body; - } else if (body instanceof (await import("stream")).Readable) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } - } else { - if (body instanceof (await import("form-data")).default) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } +export declare namespace GetRequestBody { + interface Args { + body: unknown; + type: "json" | "file" | "bytes" | "other"; } - return requestBody; } -export const maybeStringifyBody = (requestBody: any, contentType: string): Uint8Array | string => { - if (requestBody instanceof Uint8Array) { - return requestBody; - } else if (contentType === "application/x-www-form-urlencoded" && typeof requestBody === "string") { - return requestBody; +export async function getRequestBody({ body, type }: GetRequestBody.Args): Promise { + if (type.includes("json")) { + return JSON.stringify(body); } else { - return JSON.stringify(requestBody); + return body as BodyInit; } -}; +} diff --git a/seed/ts-sdk/enum/src/core/runtime/runtime.ts b/seed/ts-sdk/enum/src/core/runtime/runtime.ts index 30fe0779aaa..4d0687e8eb4 100644 --- a/seed/ts-sdk/enum/src/core/runtime/runtime.ts +++ b/seed/ts-sdk/enum/src/core/runtime/runtime.ts @@ -69,6 +69,7 @@ export const RUNTIME: Runtime = evaluateRuntime(); export interface Runtime { type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd"; version?: string; + parsedVersion?: number; } function evaluateRuntime(): Runtime { @@ -109,6 +110,7 @@ function evaluateRuntime(): Runtime { return { type: "node", version: process.versions.node, + parsedVersion: Number(process.versions.node.split(".")[0]), }; } diff --git a/seed/ts-sdk/error-property/union-utils/src/api/resources/propertyBasedError/client/Client.ts b/seed/ts-sdk/error-property/union-utils/src/api/resources/propertyBasedError/client/Client.ts index 540a8193cca..b8349b2c35f 100644 --- a/seed/ts-sdk/error-property/union-utils/src/api/resources/propertyBasedError/client/Client.ts +++ b/seed/ts-sdk/error-property/union-utils/src/api/resources/propertyBasedError/client/Client.ts @@ -48,6 +48,7 @@ export class PropertyBasedError { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/seed/ts-sdk/error-property/union-utils/src/core/fetcher/Fetcher.ts b/seed/ts-sdk/error-property/union-utils/src/core/fetcher/Fetcher.ts index d3686367aa9..f3b010358d0 100644 --- a/seed/ts-sdk/error-property/union-utils/src/core/fetcher/Fetcher.ts +++ b/seed/ts-sdk/error-property/union-utils/src/core/fetcher/Fetcher.ts @@ -20,6 +20,7 @@ export declare namespace Fetcher { maxRetries?: number; withCredentials?: boolean; abortSignal?: AbortSignal; + requestType?: "json" | "file" | "bytes"; responseType?: "json" | "blob" | "streaming" | "text"; } @@ -62,7 +63,10 @@ export async function fetcherImpl(args: Fetcher.Args): Promise { - let requestBody: BodyInit; - if (RUNTIME.type === "node") { - if (body instanceof (await import("formdata-node")).FormData) { - // @ts-expect-error - requestBody = body; - } else if (body instanceof (await import("stream")).Readable) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } - } else { - if (body instanceof (await import("form-data")).default) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } +export declare namespace GetRequestBody { + interface Args { + body: unknown; + type: "json" | "file" | "bytes" | "other"; } - return requestBody; } -export const maybeStringifyBody = (requestBody: any, contentType: string): Uint8Array | string => { - if (requestBody instanceof Uint8Array) { - return requestBody; - } else if (contentType === "application/x-www-form-urlencoded" && typeof requestBody === "string") { - return requestBody; +export async function getRequestBody({ body, type }: GetRequestBody.Args): Promise { + if (type.includes("json")) { + return JSON.stringify(body); } else { - return JSON.stringify(requestBody); + return body as BodyInit; } -}; +} diff --git a/seed/ts-sdk/error-property/union-utils/src/core/runtime/runtime.ts b/seed/ts-sdk/error-property/union-utils/src/core/runtime/runtime.ts index 30fe0779aaa..4d0687e8eb4 100644 --- a/seed/ts-sdk/error-property/union-utils/src/core/runtime/runtime.ts +++ b/seed/ts-sdk/error-property/union-utils/src/core/runtime/runtime.ts @@ -69,6 +69,7 @@ export const RUNTIME: Runtime = evaluateRuntime(); export interface Runtime { type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd"; version?: string; + parsedVersion?: number; } function evaluateRuntime(): Runtime { @@ -109,6 +110,7 @@ function evaluateRuntime(): Runtime { return { type: "node", version: process.versions.node, + parsedVersion: Number(process.versions.node.split(".")[0]), }; } diff --git a/seed/ts-sdk/examples/examples-with-api-reference/src/Client.ts b/seed/ts-sdk/examples/examples-with-api-reference/src/Client.ts index 144bd85915f..d6f156e3934 100644 --- a/seed/ts-sdk/examples/examples-with-api-reference/src/Client.ts +++ b/seed/ts-sdk/examples/examples-with-api-reference/src/Client.ts @@ -49,6 +49,7 @@ export class SeedExamplesClient { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.echo.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, diff --git a/seed/ts-sdk/examples/examples-with-api-reference/src/api/resources/file/resources/notification/resources/service/client/Client.ts b/seed/ts-sdk/examples/examples-with-api-reference/src/api/resources/file/resources/notification/resources/service/client/Client.ts index 382dac2a5a0..d76e0b905ce 100644 --- a/seed/ts-sdk/examples/examples-with-api-reference/src/api/resources/file/resources/notification/resources/service/client/Client.ts +++ b/seed/ts-sdk/examples/examples-with-api-reference/src/api/resources/file/resources/notification/resources/service/client/Client.ts @@ -54,6 +54,7 @@ export class Service { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/seed/ts-sdk/examples/examples-with-api-reference/src/api/resources/file/resources/service/client/Client.ts b/seed/ts-sdk/examples/examples-with-api-reference/src/api/resources/file/resources/service/client/Client.ts index 2151e4d7cf5..e398b0bbdbb 100644 --- a/seed/ts-sdk/examples/examples-with-api-reference/src/api/resources/file/resources/service/client/Client.ts +++ b/seed/ts-sdk/examples/examples-with-api-reference/src/api/resources/file/resources/service/client/Client.ts @@ -61,6 +61,7 @@ export class Service { "X-File-API-Version": xFileApiVersion, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/seed/ts-sdk/examples/examples-with-api-reference/src/api/resources/health/resources/service/client/Client.ts b/seed/ts-sdk/examples/examples-with-api-reference/src/api/resources/health/resources/service/client/Client.ts index 85890393133..e3437112df4 100644 --- a/seed/ts-sdk/examples/examples-with-api-reference/src/api/resources/health/resources/service/client/Client.ts +++ b/seed/ts-sdk/examples/examples-with-api-reference/src/api/resources/health/resources/service/client/Client.ts @@ -52,6 +52,7 @@ export class Service { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -103,6 +104,7 @@ export class Service { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/seed/ts-sdk/examples/examples-with-api-reference/src/api/resources/service/client/Client.ts b/seed/ts-sdk/examples/examples-with-api-reference/src/api/resources/service/client/Client.ts index 76c4333e14f..3feba276965 100644 --- a/seed/ts-sdk/examples/examples-with-api-reference/src/api/resources/service/client/Client.ts +++ b/seed/ts-sdk/examples/examples-with-api-reference/src/api/resources/service/client/Client.ts @@ -54,6 +54,7 @@ export class Service { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -132,6 +133,7 @@ export class Service { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.Movie.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -211,6 +213,7 @@ export class Service { }, contentType: "application/json", queryParameters: _queryParams, + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -265,6 +268,7 @@ export class Service { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/seed/ts-sdk/examples/examples-with-api-reference/src/core/fetcher/Fetcher.ts b/seed/ts-sdk/examples/examples-with-api-reference/src/core/fetcher/Fetcher.ts index d3686367aa9..f3b010358d0 100644 --- a/seed/ts-sdk/examples/examples-with-api-reference/src/core/fetcher/Fetcher.ts +++ b/seed/ts-sdk/examples/examples-with-api-reference/src/core/fetcher/Fetcher.ts @@ -20,6 +20,7 @@ export declare namespace Fetcher { maxRetries?: number; withCredentials?: boolean; abortSignal?: AbortSignal; + requestType?: "json" | "file" | "bytes"; responseType?: "json" | "blob" | "streaming" | "text"; } @@ -62,7 +63,10 @@ export async function fetcherImpl(args: Fetcher.Args): Promise { - let requestBody: BodyInit; - if (RUNTIME.type === "node") { - if (body instanceof (await import("formdata-node")).FormData) { - // @ts-expect-error - requestBody = body; - } else if (body instanceof (await import("stream")).Readable) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } - } else { - if (body instanceof (await import("form-data")).default) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } +export declare namespace GetRequestBody { + interface Args { + body: unknown; + type: "json" | "file" | "bytes" | "other"; } - return requestBody; } -export const maybeStringifyBody = (requestBody: any, contentType: string): Uint8Array | string => { - if (requestBody instanceof Uint8Array) { - return requestBody; - } else if (contentType === "application/x-www-form-urlencoded" && typeof requestBody === "string") { - return requestBody; +export async function getRequestBody({ body, type }: GetRequestBody.Args): Promise { + if (type.includes("json")) { + return JSON.stringify(body); } else { - return JSON.stringify(requestBody); + return body as BodyInit; } -}; +} diff --git a/seed/ts-sdk/examples/examples-with-api-reference/src/core/runtime/runtime.ts b/seed/ts-sdk/examples/examples-with-api-reference/src/core/runtime/runtime.ts index 30fe0779aaa..4d0687e8eb4 100644 --- a/seed/ts-sdk/examples/examples-with-api-reference/src/core/runtime/runtime.ts +++ b/seed/ts-sdk/examples/examples-with-api-reference/src/core/runtime/runtime.ts @@ -69,6 +69,7 @@ export const RUNTIME: Runtime = evaluateRuntime(); export interface Runtime { type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd"; version?: string; + parsedVersion?: number; } function evaluateRuntime(): Runtime { @@ -109,6 +110,7 @@ function evaluateRuntime(): Runtime { return { type: "node", version: process.versions.node, + parsedVersion: Number(process.versions.node.split(".")[0]), }; } diff --git a/seed/ts-sdk/examples/retain-original-casing/src/Client.ts b/seed/ts-sdk/examples/retain-original-casing/src/Client.ts index 144bd85915f..d6f156e3934 100644 --- a/seed/ts-sdk/examples/retain-original-casing/src/Client.ts +++ b/seed/ts-sdk/examples/retain-original-casing/src/Client.ts @@ -49,6 +49,7 @@ export class SeedExamplesClient { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.echo.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, diff --git a/seed/ts-sdk/examples/retain-original-casing/src/api/resources/file/resources/notification/resources/service/client/Client.ts b/seed/ts-sdk/examples/retain-original-casing/src/api/resources/file/resources/notification/resources/service/client/Client.ts index 382dac2a5a0..d76e0b905ce 100644 --- a/seed/ts-sdk/examples/retain-original-casing/src/api/resources/file/resources/notification/resources/service/client/Client.ts +++ b/seed/ts-sdk/examples/retain-original-casing/src/api/resources/file/resources/notification/resources/service/client/Client.ts @@ -54,6 +54,7 @@ export class Service { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/seed/ts-sdk/examples/retain-original-casing/src/api/resources/file/resources/service/client/Client.ts b/seed/ts-sdk/examples/retain-original-casing/src/api/resources/file/resources/service/client/Client.ts index 81b3424d512..23c0ca25cf8 100644 --- a/seed/ts-sdk/examples/retain-original-casing/src/api/resources/file/resources/service/client/Client.ts +++ b/seed/ts-sdk/examples/retain-original-casing/src/api/resources/file/resources/service/client/Client.ts @@ -61,6 +61,7 @@ export class Service { "X-File-API-Version": xFileApiVersion, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/seed/ts-sdk/examples/retain-original-casing/src/api/resources/health/resources/service/client/Client.ts b/seed/ts-sdk/examples/retain-original-casing/src/api/resources/health/resources/service/client/Client.ts index 85890393133..e3437112df4 100644 --- a/seed/ts-sdk/examples/retain-original-casing/src/api/resources/health/resources/service/client/Client.ts +++ b/seed/ts-sdk/examples/retain-original-casing/src/api/resources/health/resources/service/client/Client.ts @@ -52,6 +52,7 @@ export class Service { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -103,6 +104,7 @@ export class Service { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/seed/ts-sdk/examples/retain-original-casing/src/api/resources/service/client/Client.ts b/seed/ts-sdk/examples/retain-original-casing/src/api/resources/service/client/Client.ts index bf13c980403..d0b94a46269 100644 --- a/seed/ts-sdk/examples/retain-original-casing/src/api/resources/service/client/Client.ts +++ b/seed/ts-sdk/examples/retain-original-casing/src/api/resources/service/client/Client.ts @@ -54,6 +54,7 @@ export class Service { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -132,6 +133,7 @@ export class Service { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.Movie.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -211,6 +213,7 @@ export class Service { }, contentType: "application/json", queryParameters: _queryParams, + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -265,6 +268,7 @@ export class Service { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/seed/ts-sdk/examples/retain-original-casing/src/core/fetcher/Fetcher.ts b/seed/ts-sdk/examples/retain-original-casing/src/core/fetcher/Fetcher.ts index d3686367aa9..f3b010358d0 100644 --- a/seed/ts-sdk/examples/retain-original-casing/src/core/fetcher/Fetcher.ts +++ b/seed/ts-sdk/examples/retain-original-casing/src/core/fetcher/Fetcher.ts @@ -20,6 +20,7 @@ export declare namespace Fetcher { maxRetries?: number; withCredentials?: boolean; abortSignal?: AbortSignal; + requestType?: "json" | "file" | "bytes"; responseType?: "json" | "blob" | "streaming" | "text"; } @@ -62,7 +63,10 @@ export async function fetcherImpl(args: Fetcher.Args): Promise { - let requestBody: BodyInit; - if (RUNTIME.type === "node") { - if (body instanceof (await import("formdata-node")).FormData) { - // @ts-expect-error - requestBody = body; - } else if (body instanceof (await import("stream")).Readable) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } - } else { - if (body instanceof (await import("form-data")).default) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } +export declare namespace GetRequestBody { + interface Args { + body: unknown; + type: "json" | "file" | "bytes" | "other"; } - return requestBody; } -export const maybeStringifyBody = (requestBody: any, contentType: string): Uint8Array | string => { - if (requestBody instanceof Uint8Array) { - return requestBody; - } else if (contentType === "application/x-www-form-urlencoded" && typeof requestBody === "string") { - return requestBody; +export async function getRequestBody({ body, type }: GetRequestBody.Args): Promise { + if (type.includes("json")) { + return JSON.stringify(body); } else { - return JSON.stringify(requestBody); + return body as BodyInit; } -}; +} diff --git a/seed/ts-sdk/examples/retain-original-casing/src/core/runtime/runtime.ts b/seed/ts-sdk/examples/retain-original-casing/src/core/runtime/runtime.ts index 30fe0779aaa..4d0687e8eb4 100644 --- a/seed/ts-sdk/examples/retain-original-casing/src/core/runtime/runtime.ts +++ b/seed/ts-sdk/examples/retain-original-casing/src/core/runtime/runtime.ts @@ -69,6 +69,7 @@ export const RUNTIME: Runtime = evaluateRuntime(); export interface Runtime { type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd"; version?: string; + parsedVersion?: number; } function evaluateRuntime(): Runtime { @@ -109,6 +110,7 @@ function evaluateRuntime(): Runtime { return { type: "node", version: process.versions.node, + parsedVersion: Number(process.versions.node.split(".")[0]), }; } diff --git a/seed/ts-sdk/exhaustive/allow-extra-fields/src/api/resources/endpoints/resources/container/client/Client.ts b/seed/ts-sdk/exhaustive/allow-extra-fields/src/api/resources/endpoints/resources/container/client/Client.ts index e874058f971..dbe2a108c26 100644 --- a/seed/ts-sdk/exhaustive/allow-extra-fields/src/api/resources/endpoints/resources/container/client/Client.ts +++ b/seed/ts-sdk/exhaustive/allow-extra-fields/src/api/resources/endpoints/resources/container/client/Client.ts @@ -50,6 +50,7 @@ export class Container { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.container.getAndReturnListOfPrimitives.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, @@ -115,6 +116,7 @@ export class Container { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.container.getAndReturnListOfObjects.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, @@ -178,6 +180,7 @@ export class Container { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.container.getAndReturnSetOfPrimitives.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, @@ -243,6 +246,7 @@ export class Container { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.container.getAndReturnSetOfObjects.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, @@ -308,6 +312,7 @@ export class Container { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.container.getAndReturnMapPrimToPrim.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, @@ -375,6 +380,7 @@ export class Container { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.container.getAndReturnMapOfPrimToObject.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, @@ -440,6 +446,7 @@ export class Container { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: request != null ? serializers.endpoints.container.getAndReturnOptional.Request.jsonOrThrow(request, { diff --git a/seed/ts-sdk/exhaustive/allow-extra-fields/src/api/resources/endpoints/resources/enum/client/Client.ts b/seed/ts-sdk/exhaustive/allow-extra-fields/src/api/resources/endpoints/resources/enum/client/Client.ts index 7a6d56b899e..1f4d8f42d09 100644 --- a/seed/ts-sdk/exhaustive/allow-extra-fields/src/api/resources/endpoints/resources/enum/client/Client.ts +++ b/seed/ts-sdk/exhaustive/allow-extra-fields/src/api/resources/endpoints/resources/enum/client/Client.ts @@ -50,6 +50,7 @@ export class Enum { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.types.WeatherReport.jsonOrThrow(request, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, diff --git a/seed/ts-sdk/exhaustive/allow-extra-fields/src/api/resources/endpoints/resources/httpMethods/client/Client.ts b/seed/ts-sdk/exhaustive/allow-extra-fields/src/api/resources/endpoints/resources/httpMethods/client/Client.ts index 194138e4c90..cabb489ca77 100644 --- a/seed/ts-sdk/exhaustive/allow-extra-fields/src/api/resources/endpoints/resources/httpMethods/client/Client.ts +++ b/seed/ts-sdk/exhaustive/allow-extra-fields/src/api/resources/endpoints/resources/httpMethods/client/Client.ts @@ -47,6 +47,7 @@ export class HttpMethods { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -107,6 +108,7 @@ export class HttpMethods { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.types.ObjectWithRequiredField.jsonOrThrow(request, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, @@ -174,6 +176,7 @@ export class HttpMethods { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.types.ObjectWithRequiredField.jsonOrThrow(request, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, @@ -255,6 +258,7 @@ export class HttpMethods { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.types.ObjectWithOptionalField.jsonOrThrow(request, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, @@ -315,6 +319,7 @@ export class HttpMethods { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/seed/ts-sdk/exhaustive/allow-extra-fields/src/api/resources/endpoints/resources/object/client/Client.ts b/seed/ts-sdk/exhaustive/allow-extra-fields/src/api/resources/endpoints/resources/object/client/Client.ts index fc114773746..e450074f88f 100644 --- a/seed/ts-sdk/exhaustive/allow-extra-fields/src/api/resources/endpoints/resources/object/client/Client.ts +++ b/seed/ts-sdk/exhaustive/allow-extra-fields/src/api/resources/endpoints/resources/object/client/Client.ts @@ -69,6 +69,7 @@ export class Object_ { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.types.ObjectWithOptionalField.jsonOrThrow(request, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, @@ -137,6 +138,7 @@ export class Object_ { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.types.ObjectWithRequiredField.jsonOrThrow(request, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, @@ -206,6 +208,7 @@ export class Object_ { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.types.ObjectWithMapOfMap.jsonOrThrow(request, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, @@ -291,6 +294,7 @@ export class Object_ { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.types.NestedObjectWithOptionalField.jsonOrThrow(request, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, @@ -378,6 +382,7 @@ export class Object_ { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.types.NestedObjectWithRequiredField.jsonOrThrow(request, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, @@ -463,6 +468,7 @@ export class Object_ { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.object.getAndReturnNestedWithRequiredFieldAsList.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, diff --git a/seed/ts-sdk/exhaustive/allow-extra-fields/src/api/resources/endpoints/resources/params/client/Client.ts b/seed/ts-sdk/exhaustive/allow-extra-fields/src/api/resources/endpoints/resources/params/client/Client.ts index c517f75dc4b..4f16c37d09c 100644 --- a/seed/ts-sdk/exhaustive/allow-extra-fields/src/api/resources/endpoints/resources/params/client/Client.ts +++ b/seed/ts-sdk/exhaustive/allow-extra-fields/src/api/resources/endpoints/resources/params/client/Client.ts @@ -52,6 +52,7 @@ export class Params { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -120,6 +121,7 @@ export class Params { }, contentType: "application/json", queryParameters: _queryParams, + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -193,6 +195,7 @@ export class Params { }, contentType: "application/json", queryParameters: _queryParams, + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -259,6 +262,7 @@ export class Params { }, contentType: "application/json", queryParameters: _queryParams, + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -319,6 +323,7 @@ export class Params { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.params.modifyWithPath.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, diff --git a/seed/ts-sdk/exhaustive/allow-extra-fields/src/api/resources/endpoints/resources/primitive/client/Client.ts b/seed/ts-sdk/exhaustive/allow-extra-fields/src/api/resources/endpoints/resources/primitive/client/Client.ts index 127c5c535ad..dc588c16733 100644 --- a/seed/ts-sdk/exhaustive/allow-extra-fields/src/api/resources/endpoints/resources/primitive/client/Client.ts +++ b/seed/ts-sdk/exhaustive/allow-extra-fields/src/api/resources/endpoints/resources/primitive/client/Client.ts @@ -46,6 +46,7 @@ export class Primitive { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.primitive.getAndReturnString.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, @@ -106,6 +107,7 @@ export class Primitive { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.primitive.getAndReturnInt.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, @@ -166,6 +168,7 @@ export class Primitive { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.primitive.getAndReturnLong.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, @@ -226,6 +229,7 @@ export class Primitive { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.primitive.getAndReturnDouble.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, @@ -286,6 +290,7 @@ export class Primitive { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.primitive.getAndReturnBool.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, @@ -346,6 +351,7 @@ export class Primitive { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.primitive.getAndReturnDatetime.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, @@ -406,6 +412,7 @@ export class Primitive { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.primitive.getAndReturnDate.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, @@ -466,6 +473,7 @@ export class Primitive { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.primitive.getAndReturnUuid.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, @@ -526,6 +534,7 @@ export class Primitive { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.primitive.getAndReturnBase64.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, diff --git a/seed/ts-sdk/exhaustive/allow-extra-fields/src/api/resources/endpoints/resources/union/client/Client.ts b/seed/ts-sdk/exhaustive/allow-extra-fields/src/api/resources/endpoints/resources/union/client/Client.ts index 9fcf521bbf3..c9bbfcc3737 100644 --- a/seed/ts-sdk/exhaustive/allow-extra-fields/src/api/resources/endpoints/resources/union/client/Client.ts +++ b/seed/ts-sdk/exhaustive/allow-extra-fields/src/api/resources/endpoints/resources/union/client/Client.ts @@ -54,6 +54,7 @@ export class Union { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.types.Animal.jsonOrThrow(request, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, diff --git a/seed/ts-sdk/exhaustive/allow-extra-fields/src/api/resources/inlinedRequests/client/Client.ts b/seed/ts-sdk/exhaustive/allow-extra-fields/src/api/resources/inlinedRequests/client/Client.ts index b4f67e617bf..d46954277c4 100644 --- a/seed/ts-sdk/exhaustive/allow-extra-fields/src/api/resources/inlinedRequests/client/Client.ts +++ b/seed/ts-sdk/exhaustive/allow-extra-fields/src/api/resources/inlinedRequests/client/Client.ts @@ -74,6 +74,7 @@ export class InlinedRequests { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.PostWithObjectBody.jsonOrThrow(request, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, diff --git a/seed/ts-sdk/exhaustive/allow-extra-fields/src/api/resources/noAuth/client/Client.ts b/seed/ts-sdk/exhaustive/allow-extra-fields/src/api/resources/noAuth/client/Client.ts index 2ed486a4e85..9cadcbff1b5 100644 --- a/seed/ts-sdk/exhaustive/allow-extra-fields/src/api/resources/noAuth/client/Client.ts +++ b/seed/ts-sdk/exhaustive/allow-extra-fields/src/api/resources/noAuth/client/Client.ts @@ -53,6 +53,7 @@ export class NoAuth { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: request, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, diff --git a/seed/ts-sdk/exhaustive/allow-extra-fields/src/api/resources/noReqBody/client/Client.ts b/seed/ts-sdk/exhaustive/allow-extra-fields/src/api/resources/noReqBody/client/Client.ts index e1d584e911b..38c66c24efb 100644 --- a/seed/ts-sdk/exhaustive/allow-extra-fields/src/api/resources/noReqBody/client/Client.ts +++ b/seed/ts-sdk/exhaustive/allow-extra-fields/src/api/resources/noReqBody/client/Client.ts @@ -48,6 +48,7 @@ export class NoReqBody { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -102,6 +103,7 @@ export class NoReqBody { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/seed/ts-sdk/exhaustive/allow-extra-fields/src/api/resources/reqWithHeaders/client/Client.ts b/seed/ts-sdk/exhaustive/allow-extra-fields/src/api/resources/reqWithHeaders/client/Client.ts index e77a55461d8..78379ca72f8 100644 --- a/seed/ts-sdk/exhaustive/allow-extra-fields/src/api/resources/reqWithHeaders/client/Client.ts +++ b/seed/ts-sdk/exhaustive/allow-extra-fields/src/api/resources/reqWithHeaders/client/Client.ts @@ -57,6 +57,7 @@ export class ReqWithHeaders { "X-TEST-ENDPOINT-HEADER": xTestEndpointHeader, }, contentType: "application/json", + requestType: "json", body: serializers.reqWithHeaders.getWithCustomHeader.Request.jsonOrThrow(_body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, diff --git a/seed/ts-sdk/exhaustive/allow-extra-fields/src/core/fetcher/Fetcher.ts b/seed/ts-sdk/exhaustive/allow-extra-fields/src/core/fetcher/Fetcher.ts index d3686367aa9..f3b010358d0 100644 --- a/seed/ts-sdk/exhaustive/allow-extra-fields/src/core/fetcher/Fetcher.ts +++ b/seed/ts-sdk/exhaustive/allow-extra-fields/src/core/fetcher/Fetcher.ts @@ -20,6 +20,7 @@ export declare namespace Fetcher { maxRetries?: number; withCredentials?: boolean; abortSignal?: AbortSignal; + requestType?: "json" | "file" | "bytes"; responseType?: "json" | "blob" | "streaming" | "text"; } @@ -62,7 +63,10 @@ export async function fetcherImpl(args: Fetcher.Args): Promise { - let requestBody: BodyInit; - if (RUNTIME.type === "node") { - if (body instanceof (await import("formdata-node")).FormData) { - // @ts-expect-error - requestBody = body; - } else if (body instanceof (await import("stream")).Readable) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } - } else { - if (body instanceof (await import("form-data")).default) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } +export declare namespace GetRequestBody { + interface Args { + body: unknown; + type: "json" | "file" | "bytes" | "other"; } - return requestBody; } -export const maybeStringifyBody = (requestBody: any, contentType: string): Uint8Array | string => { - if (requestBody instanceof Uint8Array) { - return requestBody; - } else if (contentType === "application/x-www-form-urlencoded" && typeof requestBody === "string") { - return requestBody; +export async function getRequestBody({ body, type }: GetRequestBody.Args): Promise { + if (type.includes("json")) { + return JSON.stringify(body); } else { - return JSON.stringify(requestBody); + return body as BodyInit; } -}; +} diff --git a/seed/ts-sdk/exhaustive/allow-extra-fields/src/core/runtime/runtime.ts b/seed/ts-sdk/exhaustive/allow-extra-fields/src/core/runtime/runtime.ts index 30fe0779aaa..4d0687e8eb4 100644 --- a/seed/ts-sdk/exhaustive/allow-extra-fields/src/core/runtime/runtime.ts +++ b/seed/ts-sdk/exhaustive/allow-extra-fields/src/core/runtime/runtime.ts @@ -69,6 +69,7 @@ export const RUNTIME: Runtime = evaluateRuntime(); export interface Runtime { type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd"; version?: string; + parsedVersion?: number; } function evaluateRuntime(): Runtime { @@ -109,6 +110,7 @@ function evaluateRuntime(): Runtime { return { type: "node", version: process.versions.node, + parsedVersion: Number(process.versions.node.split(".")[0]), }; } diff --git a/seed/ts-sdk/exhaustive/bundle/src/api/resources/endpoints/resources/container/client/Client.ts b/seed/ts-sdk/exhaustive/bundle/src/api/resources/endpoints/resources/container/client/Client.ts index 15567694d56..53a61fc47cf 100644 --- a/seed/ts-sdk/exhaustive/bundle/src/api/resources/endpoints/resources/container/client/Client.ts +++ b/seed/ts-sdk/exhaustive/bundle/src/api/resources/endpoints/resources/container/client/Client.ts @@ -49,6 +49,7 @@ export class Container { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.container.getAndReturnListOfPrimitives.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -107,6 +108,7 @@ export class Container { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.container.getAndReturnListOfObjects.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -155,6 +157,7 @@ export class Container { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.container.getAndReturnSetOfPrimitives.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -213,6 +216,7 @@ export class Container { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.container.getAndReturnSetOfObjects.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -263,6 +267,7 @@ export class Container { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.container.getAndReturnMapPrimToPrim.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -320,6 +325,7 @@ export class Container { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.container.getAndReturnMapOfPrimToObject.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -378,6 +384,7 @@ export class Container { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: request != null ? serializers.endpoints.container.getAndReturnOptional.Request.jsonOrThrow(request, { diff --git a/seed/ts-sdk/exhaustive/bundle/src/api/resources/endpoints/resources/enum/client/Client.ts b/seed/ts-sdk/exhaustive/bundle/src/api/resources/endpoints/resources/enum/client/Client.ts index 28b4a8655ed..edd09ec1733 100644 --- a/seed/ts-sdk/exhaustive/bundle/src/api/resources/endpoints/resources/enum/client/Client.ts +++ b/seed/ts-sdk/exhaustive/bundle/src/api/resources/endpoints/resources/enum/client/Client.ts @@ -49,6 +49,7 @@ export class Enum { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.types.WeatherReport.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, diff --git a/seed/ts-sdk/exhaustive/bundle/src/api/resources/endpoints/resources/httpMethods/client/Client.ts b/seed/ts-sdk/exhaustive/bundle/src/api/resources/endpoints/resources/httpMethods/client/Client.ts index 9f934a54863..5e3f74f70f2 100644 --- a/seed/ts-sdk/exhaustive/bundle/src/api/resources/endpoints/resources/httpMethods/client/Client.ts +++ b/seed/ts-sdk/exhaustive/bundle/src/api/resources/endpoints/resources/httpMethods/client/Client.ts @@ -49,6 +49,7 @@ export class HttpMethods { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -96,6 +97,7 @@ export class HttpMethods { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.types.ObjectWithRequiredField.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -146,6 +148,7 @@ export class HttpMethods { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.types.ObjectWithRequiredField.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -210,6 +213,7 @@ export class HttpMethods { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.types.ObjectWithOptionalField.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -256,6 +260,7 @@ export class HttpMethods { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/seed/ts-sdk/exhaustive/bundle/src/api/resources/endpoints/resources/object/client/Client.ts b/seed/ts-sdk/exhaustive/bundle/src/api/resources/endpoints/resources/object/client/Client.ts index 86662d8d0d8..466a8c3211f 100644 --- a/seed/ts-sdk/exhaustive/bundle/src/api/resources/endpoints/resources/object/client/Client.ts +++ b/seed/ts-sdk/exhaustive/bundle/src/api/resources/endpoints/resources/object/client/Client.ts @@ -73,6 +73,7 @@ export class Object_ { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.types.ObjectWithOptionalField.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -129,6 +130,7 @@ export class Object_ { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.types.ObjectWithRequiredField.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -183,6 +185,7 @@ export class Object_ { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.types.ObjectWithMapOfMap.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -256,6 +259,7 @@ export class Object_ { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.types.NestedObjectWithOptionalField.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -333,6 +337,7 @@ export class Object_ { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.types.NestedObjectWithRequiredField.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -408,6 +413,7 @@ export class Object_ { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.object.getAndReturnNestedWithRequiredFieldAsList.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), diff --git a/seed/ts-sdk/exhaustive/bundle/src/api/resources/endpoints/resources/params/client/Client.ts b/seed/ts-sdk/exhaustive/bundle/src/api/resources/endpoints/resources/params/client/Client.ts index 59fed338ae1..34544acc8e4 100644 --- a/seed/ts-sdk/exhaustive/bundle/src/api/resources/endpoints/resources/params/client/Client.ts +++ b/seed/ts-sdk/exhaustive/bundle/src/api/resources/endpoints/resources/params/client/Client.ts @@ -54,6 +54,7 @@ export class Params { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -109,6 +110,7 @@ export class Params { }, contentType: "application/json", queryParameters: _queryParams, + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -169,6 +171,7 @@ export class Params { }, contentType: "application/json", queryParameters: _queryParams, + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -222,6 +225,7 @@ export class Params { }, contentType: "application/json", queryParameters: _queryParams, + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -269,6 +273,7 @@ export class Params { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.params.modifyWithPath.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), diff --git a/seed/ts-sdk/exhaustive/bundle/src/api/resources/endpoints/resources/primitive/client/Client.ts b/seed/ts-sdk/exhaustive/bundle/src/api/resources/endpoints/resources/primitive/client/Client.ts index 8e5034352a6..1fa5469e2d8 100644 --- a/seed/ts-sdk/exhaustive/bundle/src/api/resources/endpoints/resources/primitive/client/Client.ts +++ b/seed/ts-sdk/exhaustive/bundle/src/api/resources/endpoints/resources/primitive/client/Client.ts @@ -49,6 +49,7 @@ export class Primitive { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.primitive.getAndReturnString.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -97,6 +98,7 @@ export class Primitive { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.primitive.getAndReturnInt.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -145,6 +147,7 @@ export class Primitive { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.primitive.getAndReturnLong.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -193,6 +196,7 @@ export class Primitive { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.primitive.getAndReturnDouble.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -241,6 +245,7 @@ export class Primitive { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.primitive.getAndReturnBool.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -289,6 +294,7 @@ export class Primitive { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.primitive.getAndReturnDatetime.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -337,6 +343,7 @@ export class Primitive { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.primitive.getAndReturnDate.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -385,6 +392,7 @@ export class Primitive { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.primitive.getAndReturnUuid.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -433,6 +441,7 @@ export class Primitive { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.primitive.getAndReturnBase64.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), diff --git a/seed/ts-sdk/exhaustive/bundle/src/api/resources/endpoints/resources/union/client/Client.ts b/seed/ts-sdk/exhaustive/bundle/src/api/resources/endpoints/resources/union/client/Client.ts index ec50ce7a537..2ac7a6aa005 100644 --- a/seed/ts-sdk/exhaustive/bundle/src/api/resources/endpoints/resources/union/client/Client.ts +++ b/seed/ts-sdk/exhaustive/bundle/src/api/resources/endpoints/resources/union/client/Client.ts @@ -52,6 +52,7 @@ export class Union { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.types.Animal.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, diff --git a/seed/ts-sdk/exhaustive/bundle/src/api/resources/inlinedRequests/client/Client.ts b/seed/ts-sdk/exhaustive/bundle/src/api/resources/inlinedRequests/client/Client.ts index ab6abe0f9c2..8168201dc45 100644 --- a/seed/ts-sdk/exhaustive/bundle/src/api/resources/inlinedRequests/client/Client.ts +++ b/seed/ts-sdk/exhaustive/bundle/src/api/resources/inlinedRequests/client/Client.ts @@ -76,6 +76,7 @@ export class InlinedRequests { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.PostWithObjectBody.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, diff --git a/seed/ts-sdk/exhaustive/bundle/src/api/resources/noAuth/client/Client.ts b/seed/ts-sdk/exhaustive/bundle/src/api/resources/noAuth/client/Client.ts index 9f304a82b20..91cade48506 100644 --- a/seed/ts-sdk/exhaustive/bundle/src/api/resources/noAuth/client/Client.ts +++ b/seed/ts-sdk/exhaustive/bundle/src/api/resources/noAuth/client/Client.ts @@ -53,6 +53,7 @@ export class NoAuth { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: request, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, diff --git a/seed/ts-sdk/exhaustive/bundle/src/api/resources/noReqBody/client/Client.ts b/seed/ts-sdk/exhaustive/bundle/src/api/resources/noReqBody/client/Client.ts index d41999ea725..1e5334b1462 100644 --- a/seed/ts-sdk/exhaustive/bundle/src/api/resources/noReqBody/client/Client.ts +++ b/seed/ts-sdk/exhaustive/bundle/src/api/resources/noReqBody/client/Client.ts @@ -47,6 +47,7 @@ export class NoReqBody { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -90,6 +91,7 @@ export class NoReqBody { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/seed/ts-sdk/exhaustive/bundle/src/api/resources/reqWithHeaders/client/Client.ts b/seed/ts-sdk/exhaustive/bundle/src/api/resources/reqWithHeaders/client/Client.ts index fa57ca1220e..95c8f75fdef 100644 --- a/seed/ts-sdk/exhaustive/bundle/src/api/resources/reqWithHeaders/client/Client.ts +++ b/seed/ts-sdk/exhaustive/bundle/src/api/resources/reqWithHeaders/client/Client.ts @@ -56,6 +56,7 @@ export class ReqWithHeaders { "X-TEST-ENDPOINT-HEADER": xTestEndpointHeader, }, contentType: "application/json", + requestType: "json", body: serializers.reqWithHeaders.getWithCustomHeader.Request.jsonOrThrow(_body, { unrecognizedObjectKeys: "strip", }), diff --git a/seed/ts-sdk/exhaustive/bundle/src/core/fetcher/Fetcher.ts b/seed/ts-sdk/exhaustive/bundle/src/core/fetcher/Fetcher.ts index d3686367aa9..f3b010358d0 100644 --- a/seed/ts-sdk/exhaustive/bundle/src/core/fetcher/Fetcher.ts +++ b/seed/ts-sdk/exhaustive/bundle/src/core/fetcher/Fetcher.ts @@ -20,6 +20,7 @@ export declare namespace Fetcher { maxRetries?: number; withCredentials?: boolean; abortSignal?: AbortSignal; + requestType?: "json" | "file" | "bytes"; responseType?: "json" | "blob" | "streaming" | "text"; } @@ -62,7 +63,10 @@ export async function fetcherImpl(args: Fetcher.Args): Promise { - let requestBody: BodyInit; - if (RUNTIME.type === "node") { - if (body instanceof (await import("formdata-node")).FormData) { - // @ts-expect-error - requestBody = body; - } else if (body instanceof (await import("stream")).Readable) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } - } else { - if (body instanceof (await import("form-data")).default) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } +export declare namespace GetRequestBody { + interface Args { + body: unknown; + type: "json" | "file" | "bytes" | "other"; } - return requestBody; } -export const maybeStringifyBody = (requestBody: any, contentType: string): Uint8Array | string => { - if (requestBody instanceof Uint8Array) { - return requestBody; - } else if (contentType === "application/x-www-form-urlencoded" && typeof requestBody === "string") { - return requestBody; +export async function getRequestBody({ body, type }: GetRequestBody.Args): Promise { + if (type.includes("json")) { + return JSON.stringify(body); } else { - return JSON.stringify(requestBody); + return body as BodyInit; } -}; +} diff --git a/seed/ts-sdk/exhaustive/bundle/src/core/runtime/runtime.ts b/seed/ts-sdk/exhaustive/bundle/src/core/runtime/runtime.ts index 30fe0779aaa..4d0687e8eb4 100644 --- a/seed/ts-sdk/exhaustive/bundle/src/core/runtime/runtime.ts +++ b/seed/ts-sdk/exhaustive/bundle/src/core/runtime/runtime.ts @@ -69,6 +69,7 @@ export const RUNTIME: Runtime = evaluateRuntime(); export interface Runtime { type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd"; version?: string; + parsedVersion?: number; } function evaluateRuntime(): Runtime { @@ -109,6 +110,7 @@ function evaluateRuntime(): Runtime { return { type: "node", version: process.versions.node, + parsedVersion: Number(process.versions.node.split(".")[0]), }; } diff --git a/seed/ts-sdk/exhaustive/custom-package-json/src/api/resources/endpoints/resources/container/client/Client.ts b/seed/ts-sdk/exhaustive/custom-package-json/src/api/resources/endpoints/resources/container/client/Client.ts index 15567694d56..53a61fc47cf 100644 --- a/seed/ts-sdk/exhaustive/custom-package-json/src/api/resources/endpoints/resources/container/client/Client.ts +++ b/seed/ts-sdk/exhaustive/custom-package-json/src/api/resources/endpoints/resources/container/client/Client.ts @@ -49,6 +49,7 @@ export class Container { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.container.getAndReturnListOfPrimitives.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -107,6 +108,7 @@ export class Container { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.container.getAndReturnListOfObjects.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -155,6 +157,7 @@ export class Container { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.container.getAndReturnSetOfPrimitives.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -213,6 +216,7 @@ export class Container { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.container.getAndReturnSetOfObjects.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -263,6 +267,7 @@ export class Container { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.container.getAndReturnMapPrimToPrim.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -320,6 +325,7 @@ export class Container { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.container.getAndReturnMapOfPrimToObject.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -378,6 +384,7 @@ export class Container { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: request != null ? serializers.endpoints.container.getAndReturnOptional.Request.jsonOrThrow(request, { diff --git a/seed/ts-sdk/exhaustive/custom-package-json/src/api/resources/endpoints/resources/enum/client/Client.ts b/seed/ts-sdk/exhaustive/custom-package-json/src/api/resources/endpoints/resources/enum/client/Client.ts index 28b4a8655ed..edd09ec1733 100644 --- a/seed/ts-sdk/exhaustive/custom-package-json/src/api/resources/endpoints/resources/enum/client/Client.ts +++ b/seed/ts-sdk/exhaustive/custom-package-json/src/api/resources/endpoints/resources/enum/client/Client.ts @@ -49,6 +49,7 @@ export class Enum { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.types.WeatherReport.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, diff --git a/seed/ts-sdk/exhaustive/custom-package-json/src/api/resources/endpoints/resources/httpMethods/client/Client.ts b/seed/ts-sdk/exhaustive/custom-package-json/src/api/resources/endpoints/resources/httpMethods/client/Client.ts index 9f934a54863..5e3f74f70f2 100644 --- a/seed/ts-sdk/exhaustive/custom-package-json/src/api/resources/endpoints/resources/httpMethods/client/Client.ts +++ b/seed/ts-sdk/exhaustive/custom-package-json/src/api/resources/endpoints/resources/httpMethods/client/Client.ts @@ -49,6 +49,7 @@ export class HttpMethods { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -96,6 +97,7 @@ export class HttpMethods { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.types.ObjectWithRequiredField.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -146,6 +148,7 @@ export class HttpMethods { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.types.ObjectWithRequiredField.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -210,6 +213,7 @@ export class HttpMethods { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.types.ObjectWithOptionalField.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -256,6 +260,7 @@ export class HttpMethods { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/seed/ts-sdk/exhaustive/custom-package-json/src/api/resources/endpoints/resources/object/client/Client.ts b/seed/ts-sdk/exhaustive/custom-package-json/src/api/resources/endpoints/resources/object/client/Client.ts index 86662d8d0d8..466a8c3211f 100644 --- a/seed/ts-sdk/exhaustive/custom-package-json/src/api/resources/endpoints/resources/object/client/Client.ts +++ b/seed/ts-sdk/exhaustive/custom-package-json/src/api/resources/endpoints/resources/object/client/Client.ts @@ -73,6 +73,7 @@ export class Object_ { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.types.ObjectWithOptionalField.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -129,6 +130,7 @@ export class Object_ { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.types.ObjectWithRequiredField.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -183,6 +185,7 @@ export class Object_ { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.types.ObjectWithMapOfMap.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -256,6 +259,7 @@ export class Object_ { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.types.NestedObjectWithOptionalField.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -333,6 +337,7 @@ export class Object_ { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.types.NestedObjectWithRequiredField.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -408,6 +413,7 @@ export class Object_ { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.object.getAndReturnNestedWithRequiredFieldAsList.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), diff --git a/seed/ts-sdk/exhaustive/custom-package-json/src/api/resources/endpoints/resources/params/client/Client.ts b/seed/ts-sdk/exhaustive/custom-package-json/src/api/resources/endpoints/resources/params/client/Client.ts index 59fed338ae1..34544acc8e4 100644 --- a/seed/ts-sdk/exhaustive/custom-package-json/src/api/resources/endpoints/resources/params/client/Client.ts +++ b/seed/ts-sdk/exhaustive/custom-package-json/src/api/resources/endpoints/resources/params/client/Client.ts @@ -54,6 +54,7 @@ export class Params { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -109,6 +110,7 @@ export class Params { }, contentType: "application/json", queryParameters: _queryParams, + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -169,6 +171,7 @@ export class Params { }, contentType: "application/json", queryParameters: _queryParams, + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -222,6 +225,7 @@ export class Params { }, contentType: "application/json", queryParameters: _queryParams, + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -269,6 +273,7 @@ export class Params { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.params.modifyWithPath.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), diff --git a/seed/ts-sdk/exhaustive/custom-package-json/src/api/resources/endpoints/resources/primitive/client/Client.ts b/seed/ts-sdk/exhaustive/custom-package-json/src/api/resources/endpoints/resources/primitive/client/Client.ts index 8e5034352a6..1fa5469e2d8 100644 --- a/seed/ts-sdk/exhaustive/custom-package-json/src/api/resources/endpoints/resources/primitive/client/Client.ts +++ b/seed/ts-sdk/exhaustive/custom-package-json/src/api/resources/endpoints/resources/primitive/client/Client.ts @@ -49,6 +49,7 @@ export class Primitive { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.primitive.getAndReturnString.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -97,6 +98,7 @@ export class Primitive { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.primitive.getAndReturnInt.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -145,6 +147,7 @@ export class Primitive { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.primitive.getAndReturnLong.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -193,6 +196,7 @@ export class Primitive { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.primitive.getAndReturnDouble.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -241,6 +245,7 @@ export class Primitive { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.primitive.getAndReturnBool.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -289,6 +294,7 @@ export class Primitive { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.primitive.getAndReturnDatetime.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -337,6 +343,7 @@ export class Primitive { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.primitive.getAndReturnDate.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -385,6 +392,7 @@ export class Primitive { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.primitive.getAndReturnUuid.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -433,6 +441,7 @@ export class Primitive { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.primitive.getAndReturnBase64.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), diff --git a/seed/ts-sdk/exhaustive/custom-package-json/src/api/resources/endpoints/resources/union/client/Client.ts b/seed/ts-sdk/exhaustive/custom-package-json/src/api/resources/endpoints/resources/union/client/Client.ts index ec50ce7a537..2ac7a6aa005 100644 --- a/seed/ts-sdk/exhaustive/custom-package-json/src/api/resources/endpoints/resources/union/client/Client.ts +++ b/seed/ts-sdk/exhaustive/custom-package-json/src/api/resources/endpoints/resources/union/client/Client.ts @@ -52,6 +52,7 @@ export class Union { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.types.Animal.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, diff --git a/seed/ts-sdk/exhaustive/custom-package-json/src/api/resources/inlinedRequests/client/Client.ts b/seed/ts-sdk/exhaustive/custom-package-json/src/api/resources/inlinedRequests/client/Client.ts index ab6abe0f9c2..8168201dc45 100644 --- a/seed/ts-sdk/exhaustive/custom-package-json/src/api/resources/inlinedRequests/client/Client.ts +++ b/seed/ts-sdk/exhaustive/custom-package-json/src/api/resources/inlinedRequests/client/Client.ts @@ -76,6 +76,7 @@ export class InlinedRequests { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.PostWithObjectBody.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, diff --git a/seed/ts-sdk/exhaustive/custom-package-json/src/api/resources/noAuth/client/Client.ts b/seed/ts-sdk/exhaustive/custom-package-json/src/api/resources/noAuth/client/Client.ts index 9f304a82b20..91cade48506 100644 --- a/seed/ts-sdk/exhaustive/custom-package-json/src/api/resources/noAuth/client/Client.ts +++ b/seed/ts-sdk/exhaustive/custom-package-json/src/api/resources/noAuth/client/Client.ts @@ -53,6 +53,7 @@ export class NoAuth { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: request, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, diff --git a/seed/ts-sdk/exhaustive/custom-package-json/src/api/resources/noReqBody/client/Client.ts b/seed/ts-sdk/exhaustive/custom-package-json/src/api/resources/noReqBody/client/Client.ts index d41999ea725..1e5334b1462 100644 --- a/seed/ts-sdk/exhaustive/custom-package-json/src/api/resources/noReqBody/client/Client.ts +++ b/seed/ts-sdk/exhaustive/custom-package-json/src/api/resources/noReqBody/client/Client.ts @@ -47,6 +47,7 @@ export class NoReqBody { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -90,6 +91,7 @@ export class NoReqBody { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/seed/ts-sdk/exhaustive/custom-package-json/src/api/resources/reqWithHeaders/client/Client.ts b/seed/ts-sdk/exhaustive/custom-package-json/src/api/resources/reqWithHeaders/client/Client.ts index fa57ca1220e..95c8f75fdef 100644 --- a/seed/ts-sdk/exhaustive/custom-package-json/src/api/resources/reqWithHeaders/client/Client.ts +++ b/seed/ts-sdk/exhaustive/custom-package-json/src/api/resources/reqWithHeaders/client/Client.ts @@ -56,6 +56,7 @@ export class ReqWithHeaders { "X-TEST-ENDPOINT-HEADER": xTestEndpointHeader, }, contentType: "application/json", + requestType: "json", body: serializers.reqWithHeaders.getWithCustomHeader.Request.jsonOrThrow(_body, { unrecognizedObjectKeys: "strip", }), diff --git a/seed/ts-sdk/exhaustive/custom-package-json/src/core/fetcher/Fetcher.ts b/seed/ts-sdk/exhaustive/custom-package-json/src/core/fetcher/Fetcher.ts index d3686367aa9..f3b010358d0 100644 --- a/seed/ts-sdk/exhaustive/custom-package-json/src/core/fetcher/Fetcher.ts +++ b/seed/ts-sdk/exhaustive/custom-package-json/src/core/fetcher/Fetcher.ts @@ -20,6 +20,7 @@ export declare namespace Fetcher { maxRetries?: number; withCredentials?: boolean; abortSignal?: AbortSignal; + requestType?: "json" | "file" | "bytes"; responseType?: "json" | "blob" | "streaming" | "text"; } @@ -62,7 +63,10 @@ export async function fetcherImpl(args: Fetcher.Args): Promise { - let requestBody: BodyInit; - if (RUNTIME.type === "node") { - if (body instanceof (await import("formdata-node")).FormData) { - // @ts-expect-error - requestBody = body; - } else if (body instanceof (await import("stream")).Readable) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } - } else { - if (body instanceof (await import("form-data")).default) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } +export declare namespace GetRequestBody { + interface Args { + body: unknown; + type: "json" | "file" | "bytes" | "other"; } - return requestBody; } -export const maybeStringifyBody = (requestBody: any, contentType: string): Uint8Array | string => { - if (requestBody instanceof Uint8Array) { - return requestBody; - } else if (contentType === "application/x-www-form-urlencoded" && typeof requestBody === "string") { - return requestBody; +export async function getRequestBody({ body, type }: GetRequestBody.Args): Promise { + if (type.includes("json")) { + return JSON.stringify(body); } else { - return JSON.stringify(requestBody); + return body as BodyInit; } -}; +} diff --git a/seed/ts-sdk/exhaustive/custom-package-json/src/core/runtime/runtime.ts b/seed/ts-sdk/exhaustive/custom-package-json/src/core/runtime/runtime.ts index 30fe0779aaa..4d0687e8eb4 100644 --- a/seed/ts-sdk/exhaustive/custom-package-json/src/core/runtime/runtime.ts +++ b/seed/ts-sdk/exhaustive/custom-package-json/src/core/runtime/runtime.ts @@ -69,6 +69,7 @@ export const RUNTIME: Runtime = evaluateRuntime(); export interface Runtime { type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd"; version?: string; + parsedVersion?: number; } function evaluateRuntime(): Runtime { @@ -109,6 +110,7 @@ function evaluateRuntime(): Runtime { return { type: "node", version: process.versions.node, + parsedVersion: Number(process.versions.node.split(".")[0]), }; } diff --git a/seed/ts-sdk/exhaustive/dev-dependencies/src/api/resources/endpoints/resources/container/client/Client.ts b/seed/ts-sdk/exhaustive/dev-dependencies/src/api/resources/endpoints/resources/container/client/Client.ts index 15567694d56..53a61fc47cf 100644 --- a/seed/ts-sdk/exhaustive/dev-dependencies/src/api/resources/endpoints/resources/container/client/Client.ts +++ b/seed/ts-sdk/exhaustive/dev-dependencies/src/api/resources/endpoints/resources/container/client/Client.ts @@ -49,6 +49,7 @@ export class Container { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.container.getAndReturnListOfPrimitives.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -107,6 +108,7 @@ export class Container { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.container.getAndReturnListOfObjects.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -155,6 +157,7 @@ export class Container { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.container.getAndReturnSetOfPrimitives.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -213,6 +216,7 @@ export class Container { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.container.getAndReturnSetOfObjects.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -263,6 +267,7 @@ export class Container { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.container.getAndReturnMapPrimToPrim.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -320,6 +325,7 @@ export class Container { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.container.getAndReturnMapOfPrimToObject.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -378,6 +384,7 @@ export class Container { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: request != null ? serializers.endpoints.container.getAndReturnOptional.Request.jsonOrThrow(request, { diff --git a/seed/ts-sdk/exhaustive/dev-dependencies/src/api/resources/endpoints/resources/enum/client/Client.ts b/seed/ts-sdk/exhaustive/dev-dependencies/src/api/resources/endpoints/resources/enum/client/Client.ts index 28b4a8655ed..edd09ec1733 100644 --- a/seed/ts-sdk/exhaustive/dev-dependencies/src/api/resources/endpoints/resources/enum/client/Client.ts +++ b/seed/ts-sdk/exhaustive/dev-dependencies/src/api/resources/endpoints/resources/enum/client/Client.ts @@ -49,6 +49,7 @@ export class Enum { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.types.WeatherReport.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, diff --git a/seed/ts-sdk/exhaustive/dev-dependencies/src/api/resources/endpoints/resources/httpMethods/client/Client.ts b/seed/ts-sdk/exhaustive/dev-dependencies/src/api/resources/endpoints/resources/httpMethods/client/Client.ts index 9f934a54863..5e3f74f70f2 100644 --- a/seed/ts-sdk/exhaustive/dev-dependencies/src/api/resources/endpoints/resources/httpMethods/client/Client.ts +++ b/seed/ts-sdk/exhaustive/dev-dependencies/src/api/resources/endpoints/resources/httpMethods/client/Client.ts @@ -49,6 +49,7 @@ export class HttpMethods { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -96,6 +97,7 @@ export class HttpMethods { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.types.ObjectWithRequiredField.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -146,6 +148,7 @@ export class HttpMethods { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.types.ObjectWithRequiredField.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -210,6 +213,7 @@ export class HttpMethods { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.types.ObjectWithOptionalField.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -256,6 +260,7 @@ export class HttpMethods { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/seed/ts-sdk/exhaustive/dev-dependencies/src/api/resources/endpoints/resources/object/client/Client.ts b/seed/ts-sdk/exhaustive/dev-dependencies/src/api/resources/endpoints/resources/object/client/Client.ts index 86662d8d0d8..466a8c3211f 100644 --- a/seed/ts-sdk/exhaustive/dev-dependencies/src/api/resources/endpoints/resources/object/client/Client.ts +++ b/seed/ts-sdk/exhaustive/dev-dependencies/src/api/resources/endpoints/resources/object/client/Client.ts @@ -73,6 +73,7 @@ export class Object_ { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.types.ObjectWithOptionalField.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -129,6 +130,7 @@ export class Object_ { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.types.ObjectWithRequiredField.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -183,6 +185,7 @@ export class Object_ { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.types.ObjectWithMapOfMap.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -256,6 +259,7 @@ export class Object_ { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.types.NestedObjectWithOptionalField.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -333,6 +337,7 @@ export class Object_ { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.types.NestedObjectWithRequiredField.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -408,6 +413,7 @@ export class Object_ { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.object.getAndReturnNestedWithRequiredFieldAsList.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), diff --git a/seed/ts-sdk/exhaustive/dev-dependencies/src/api/resources/endpoints/resources/params/client/Client.ts b/seed/ts-sdk/exhaustive/dev-dependencies/src/api/resources/endpoints/resources/params/client/Client.ts index 59fed338ae1..34544acc8e4 100644 --- a/seed/ts-sdk/exhaustive/dev-dependencies/src/api/resources/endpoints/resources/params/client/Client.ts +++ b/seed/ts-sdk/exhaustive/dev-dependencies/src/api/resources/endpoints/resources/params/client/Client.ts @@ -54,6 +54,7 @@ export class Params { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -109,6 +110,7 @@ export class Params { }, contentType: "application/json", queryParameters: _queryParams, + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -169,6 +171,7 @@ export class Params { }, contentType: "application/json", queryParameters: _queryParams, + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -222,6 +225,7 @@ export class Params { }, contentType: "application/json", queryParameters: _queryParams, + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -269,6 +273,7 @@ export class Params { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.params.modifyWithPath.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), diff --git a/seed/ts-sdk/exhaustive/dev-dependencies/src/api/resources/endpoints/resources/primitive/client/Client.ts b/seed/ts-sdk/exhaustive/dev-dependencies/src/api/resources/endpoints/resources/primitive/client/Client.ts index 8e5034352a6..1fa5469e2d8 100644 --- a/seed/ts-sdk/exhaustive/dev-dependencies/src/api/resources/endpoints/resources/primitive/client/Client.ts +++ b/seed/ts-sdk/exhaustive/dev-dependencies/src/api/resources/endpoints/resources/primitive/client/Client.ts @@ -49,6 +49,7 @@ export class Primitive { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.primitive.getAndReturnString.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -97,6 +98,7 @@ export class Primitive { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.primitive.getAndReturnInt.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -145,6 +147,7 @@ export class Primitive { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.primitive.getAndReturnLong.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -193,6 +196,7 @@ export class Primitive { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.primitive.getAndReturnDouble.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -241,6 +245,7 @@ export class Primitive { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.primitive.getAndReturnBool.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -289,6 +294,7 @@ export class Primitive { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.primitive.getAndReturnDatetime.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -337,6 +343,7 @@ export class Primitive { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.primitive.getAndReturnDate.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -385,6 +392,7 @@ export class Primitive { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.primitive.getAndReturnUuid.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -433,6 +441,7 @@ export class Primitive { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.primitive.getAndReturnBase64.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), diff --git a/seed/ts-sdk/exhaustive/dev-dependencies/src/api/resources/endpoints/resources/union/client/Client.ts b/seed/ts-sdk/exhaustive/dev-dependencies/src/api/resources/endpoints/resources/union/client/Client.ts index ec50ce7a537..2ac7a6aa005 100644 --- a/seed/ts-sdk/exhaustive/dev-dependencies/src/api/resources/endpoints/resources/union/client/Client.ts +++ b/seed/ts-sdk/exhaustive/dev-dependencies/src/api/resources/endpoints/resources/union/client/Client.ts @@ -52,6 +52,7 @@ export class Union { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.types.Animal.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, diff --git a/seed/ts-sdk/exhaustive/dev-dependencies/src/api/resources/inlinedRequests/client/Client.ts b/seed/ts-sdk/exhaustive/dev-dependencies/src/api/resources/inlinedRequests/client/Client.ts index ab6abe0f9c2..8168201dc45 100644 --- a/seed/ts-sdk/exhaustive/dev-dependencies/src/api/resources/inlinedRequests/client/Client.ts +++ b/seed/ts-sdk/exhaustive/dev-dependencies/src/api/resources/inlinedRequests/client/Client.ts @@ -76,6 +76,7 @@ export class InlinedRequests { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.PostWithObjectBody.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, diff --git a/seed/ts-sdk/exhaustive/dev-dependencies/src/api/resources/noAuth/client/Client.ts b/seed/ts-sdk/exhaustive/dev-dependencies/src/api/resources/noAuth/client/Client.ts index 9f304a82b20..91cade48506 100644 --- a/seed/ts-sdk/exhaustive/dev-dependencies/src/api/resources/noAuth/client/Client.ts +++ b/seed/ts-sdk/exhaustive/dev-dependencies/src/api/resources/noAuth/client/Client.ts @@ -53,6 +53,7 @@ export class NoAuth { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: request, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, diff --git a/seed/ts-sdk/exhaustive/dev-dependencies/src/api/resources/noReqBody/client/Client.ts b/seed/ts-sdk/exhaustive/dev-dependencies/src/api/resources/noReqBody/client/Client.ts index d41999ea725..1e5334b1462 100644 --- a/seed/ts-sdk/exhaustive/dev-dependencies/src/api/resources/noReqBody/client/Client.ts +++ b/seed/ts-sdk/exhaustive/dev-dependencies/src/api/resources/noReqBody/client/Client.ts @@ -47,6 +47,7 @@ export class NoReqBody { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -90,6 +91,7 @@ export class NoReqBody { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/seed/ts-sdk/exhaustive/dev-dependencies/src/api/resources/reqWithHeaders/client/Client.ts b/seed/ts-sdk/exhaustive/dev-dependencies/src/api/resources/reqWithHeaders/client/Client.ts index fa57ca1220e..95c8f75fdef 100644 --- a/seed/ts-sdk/exhaustive/dev-dependencies/src/api/resources/reqWithHeaders/client/Client.ts +++ b/seed/ts-sdk/exhaustive/dev-dependencies/src/api/resources/reqWithHeaders/client/Client.ts @@ -56,6 +56,7 @@ export class ReqWithHeaders { "X-TEST-ENDPOINT-HEADER": xTestEndpointHeader, }, contentType: "application/json", + requestType: "json", body: serializers.reqWithHeaders.getWithCustomHeader.Request.jsonOrThrow(_body, { unrecognizedObjectKeys: "strip", }), diff --git a/seed/ts-sdk/exhaustive/dev-dependencies/src/core/fetcher/Fetcher.ts b/seed/ts-sdk/exhaustive/dev-dependencies/src/core/fetcher/Fetcher.ts index d3686367aa9..f3b010358d0 100644 --- a/seed/ts-sdk/exhaustive/dev-dependencies/src/core/fetcher/Fetcher.ts +++ b/seed/ts-sdk/exhaustive/dev-dependencies/src/core/fetcher/Fetcher.ts @@ -20,6 +20,7 @@ export declare namespace Fetcher { maxRetries?: number; withCredentials?: boolean; abortSignal?: AbortSignal; + requestType?: "json" | "file" | "bytes"; responseType?: "json" | "blob" | "streaming" | "text"; } @@ -62,7 +63,10 @@ export async function fetcherImpl(args: Fetcher.Args): Promise { - let requestBody: BodyInit; - if (RUNTIME.type === "node") { - if (body instanceof (await import("formdata-node")).FormData) { - // @ts-expect-error - requestBody = body; - } else if (body instanceof (await import("stream")).Readable) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } - } else { - if (body instanceof (await import("form-data")).default) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } +export declare namespace GetRequestBody { + interface Args { + body: unknown; + type: "json" | "file" | "bytes" | "other"; } - return requestBody; } -export const maybeStringifyBody = (requestBody: any, contentType: string): Uint8Array | string => { - if (requestBody instanceof Uint8Array) { - return requestBody; - } else if (contentType === "application/x-www-form-urlencoded" && typeof requestBody === "string") { - return requestBody; +export async function getRequestBody({ body, type }: GetRequestBody.Args): Promise { + if (type.includes("json")) { + return JSON.stringify(body); } else { - return JSON.stringify(requestBody); + return body as BodyInit; } -}; +} diff --git a/seed/ts-sdk/exhaustive/dev-dependencies/src/core/runtime/runtime.ts b/seed/ts-sdk/exhaustive/dev-dependencies/src/core/runtime/runtime.ts index 30fe0779aaa..4d0687e8eb4 100644 --- a/seed/ts-sdk/exhaustive/dev-dependencies/src/core/runtime/runtime.ts +++ b/seed/ts-sdk/exhaustive/dev-dependencies/src/core/runtime/runtime.ts @@ -69,6 +69,7 @@ export const RUNTIME: Runtime = evaluateRuntime(); export interface Runtime { type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd"; version?: string; + parsedVersion?: number; } function evaluateRuntime(): Runtime { @@ -109,6 +110,7 @@ function evaluateRuntime(): Runtime { return { type: "node", version: process.versions.node, + parsedVersion: Number(process.versions.node.split(".")[0]), }; } diff --git a/seed/ts-sdk/exhaustive/jsr/src/api/resources/endpoints/resources/container/client/Client.ts b/seed/ts-sdk/exhaustive/jsr/src/api/resources/endpoints/resources/container/client/Client.ts index d67aaaa7010..3b8622100d5 100644 --- a/seed/ts-sdk/exhaustive/jsr/src/api/resources/endpoints/resources/container/client/Client.ts +++ b/seed/ts-sdk/exhaustive/jsr/src/api/resources/endpoints/resources/container/client/Client.ts @@ -50,6 +50,7 @@ export class Container { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.container.getAndReturnListOfPrimitives.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -113,6 +114,7 @@ export class Container { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.container.getAndReturnListOfObjects.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -174,6 +176,7 @@ export class Container { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.container.getAndReturnSetOfPrimitives.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -237,6 +240,7 @@ export class Container { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.container.getAndReturnSetOfObjects.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -300,6 +304,7 @@ export class Container { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.container.getAndReturnMapPrimToPrim.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -365,6 +370,7 @@ export class Container { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.container.getAndReturnMapOfPrimToObject.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -428,6 +434,7 @@ export class Container { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: request != null ? serializers.endpoints.container.getAndReturnOptional.Request.jsonOrThrow(request, { diff --git a/seed/ts-sdk/exhaustive/jsr/src/api/resources/endpoints/resources/enum/client/Client.ts b/seed/ts-sdk/exhaustive/jsr/src/api/resources/endpoints/resources/enum/client/Client.ts index 531614bee62..a90778e1558 100644 --- a/seed/ts-sdk/exhaustive/jsr/src/api/resources/endpoints/resources/enum/client/Client.ts +++ b/seed/ts-sdk/exhaustive/jsr/src/api/resources/endpoints/resources/enum/client/Client.ts @@ -50,6 +50,7 @@ export class Enum { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.types.WeatherReport.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, diff --git a/seed/ts-sdk/exhaustive/jsr/src/api/resources/endpoints/resources/httpMethods/client/Client.ts b/seed/ts-sdk/exhaustive/jsr/src/api/resources/endpoints/resources/httpMethods/client/Client.ts index 37433cb0f61..a8a61166980 100644 --- a/seed/ts-sdk/exhaustive/jsr/src/api/resources/endpoints/resources/httpMethods/client/Client.ts +++ b/seed/ts-sdk/exhaustive/jsr/src/api/resources/endpoints/resources/httpMethods/client/Client.ts @@ -47,6 +47,7 @@ export class HttpMethods { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -107,6 +108,7 @@ export class HttpMethods { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.types.ObjectWithRequiredField.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -170,6 +172,7 @@ export class HttpMethods { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.types.ObjectWithRequiredField.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -247,6 +250,7 @@ export class HttpMethods { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.types.ObjectWithOptionalField.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -303,6 +307,7 @@ export class HttpMethods { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/seed/ts-sdk/exhaustive/jsr/src/api/resources/endpoints/resources/object/client/Client.ts b/seed/ts-sdk/exhaustive/jsr/src/api/resources/endpoints/resources/object/client/Client.ts index 74c22feb270..2ee970c0dae 100644 --- a/seed/ts-sdk/exhaustive/jsr/src/api/resources/endpoints/resources/object/client/Client.ts +++ b/seed/ts-sdk/exhaustive/jsr/src/api/resources/endpoints/resources/object/client/Client.ts @@ -69,6 +69,7 @@ export class Object_ { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.types.ObjectWithOptionalField.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -133,6 +134,7 @@ export class Object_ { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.types.ObjectWithRequiredField.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -198,6 +200,7 @@ export class Object_ { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.types.ObjectWithMapOfMap.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -279,6 +282,7 @@ export class Object_ { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.types.NestedObjectWithOptionalField.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -364,6 +368,7 @@ export class Object_ { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.types.NestedObjectWithRequiredField.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -447,6 +452,7 @@ export class Object_ { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.object.getAndReturnNestedWithRequiredFieldAsList.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), diff --git a/seed/ts-sdk/exhaustive/jsr/src/api/resources/endpoints/resources/params/client/Client.ts b/seed/ts-sdk/exhaustive/jsr/src/api/resources/endpoints/resources/params/client/Client.ts index e4419fda2e6..4b1d2093401 100644 --- a/seed/ts-sdk/exhaustive/jsr/src/api/resources/endpoints/resources/params/client/Client.ts +++ b/seed/ts-sdk/exhaustive/jsr/src/api/resources/endpoints/resources/params/client/Client.ts @@ -52,6 +52,7 @@ export class Params { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -120,6 +121,7 @@ export class Params { }, contentType: "application/json", queryParameters: _queryParams, + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -193,6 +195,7 @@ export class Params { }, contentType: "application/json", queryParameters: _queryParams, + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -259,6 +262,7 @@ export class Params { }, contentType: "application/json", queryParameters: _queryParams, + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -319,6 +323,7 @@ export class Params { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.params.modifyWithPath.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), diff --git a/seed/ts-sdk/exhaustive/jsr/src/api/resources/endpoints/resources/primitive/client/Client.ts b/seed/ts-sdk/exhaustive/jsr/src/api/resources/endpoints/resources/primitive/client/Client.ts index 7179895ec86..cd5fe688864 100644 --- a/seed/ts-sdk/exhaustive/jsr/src/api/resources/endpoints/resources/primitive/client/Client.ts +++ b/seed/ts-sdk/exhaustive/jsr/src/api/resources/endpoints/resources/primitive/client/Client.ts @@ -46,6 +46,7 @@ export class Primitive { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.primitive.getAndReturnString.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -104,6 +105,7 @@ export class Primitive { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.primitive.getAndReturnInt.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -162,6 +164,7 @@ export class Primitive { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.primitive.getAndReturnLong.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -220,6 +223,7 @@ export class Primitive { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.primitive.getAndReturnDouble.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -278,6 +282,7 @@ export class Primitive { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.primitive.getAndReturnBool.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -336,6 +341,7 @@ export class Primitive { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.primitive.getAndReturnDatetime.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -394,6 +400,7 @@ export class Primitive { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.primitive.getAndReturnDate.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -452,6 +459,7 @@ export class Primitive { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.primitive.getAndReturnUuid.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -510,6 +518,7 @@ export class Primitive { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.primitive.getAndReturnBase64.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), diff --git a/seed/ts-sdk/exhaustive/jsr/src/api/resources/endpoints/resources/union/client/Client.ts b/seed/ts-sdk/exhaustive/jsr/src/api/resources/endpoints/resources/union/client/Client.ts index c931858e597..e7a3bcea99c 100644 --- a/seed/ts-sdk/exhaustive/jsr/src/api/resources/endpoints/resources/union/client/Client.ts +++ b/seed/ts-sdk/exhaustive/jsr/src/api/resources/endpoints/resources/union/client/Client.ts @@ -54,6 +54,7 @@ export class Union { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.types.Animal.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, diff --git a/seed/ts-sdk/exhaustive/jsr/src/api/resources/inlinedRequests/client/Client.ts b/seed/ts-sdk/exhaustive/jsr/src/api/resources/inlinedRequests/client/Client.ts index 942286e108d..413a1debbe8 100644 --- a/seed/ts-sdk/exhaustive/jsr/src/api/resources/inlinedRequests/client/Client.ts +++ b/seed/ts-sdk/exhaustive/jsr/src/api/resources/inlinedRequests/client/Client.ts @@ -74,6 +74,7 @@ export class InlinedRequests { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.PostWithObjectBody.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, diff --git a/seed/ts-sdk/exhaustive/jsr/src/api/resources/noAuth/client/Client.ts b/seed/ts-sdk/exhaustive/jsr/src/api/resources/noAuth/client/Client.ts index 2ed486a4e85..9cadcbff1b5 100644 --- a/seed/ts-sdk/exhaustive/jsr/src/api/resources/noAuth/client/Client.ts +++ b/seed/ts-sdk/exhaustive/jsr/src/api/resources/noAuth/client/Client.ts @@ -53,6 +53,7 @@ export class NoAuth { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: request, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, diff --git a/seed/ts-sdk/exhaustive/jsr/src/api/resources/noReqBody/client/Client.ts b/seed/ts-sdk/exhaustive/jsr/src/api/resources/noReqBody/client/Client.ts index e1d584e911b..38c66c24efb 100644 --- a/seed/ts-sdk/exhaustive/jsr/src/api/resources/noReqBody/client/Client.ts +++ b/seed/ts-sdk/exhaustive/jsr/src/api/resources/noReqBody/client/Client.ts @@ -48,6 +48,7 @@ export class NoReqBody { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -102,6 +103,7 @@ export class NoReqBody { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/seed/ts-sdk/exhaustive/jsr/src/api/resources/reqWithHeaders/client/Client.ts b/seed/ts-sdk/exhaustive/jsr/src/api/resources/reqWithHeaders/client/Client.ts index 82f1f77ae55..8fed42e0ca9 100644 --- a/seed/ts-sdk/exhaustive/jsr/src/api/resources/reqWithHeaders/client/Client.ts +++ b/seed/ts-sdk/exhaustive/jsr/src/api/resources/reqWithHeaders/client/Client.ts @@ -57,6 +57,7 @@ export class ReqWithHeaders { "X-TEST-ENDPOINT-HEADER": xTestEndpointHeader, }, contentType: "application/json", + requestType: "json", body: serializers.reqWithHeaders.getWithCustomHeader.Request.jsonOrThrow(_body, { unrecognizedObjectKeys: "strip", }), diff --git a/seed/ts-sdk/exhaustive/jsr/src/core/fetcher/Fetcher.ts b/seed/ts-sdk/exhaustive/jsr/src/core/fetcher/Fetcher.ts index d3686367aa9..f3b010358d0 100644 --- a/seed/ts-sdk/exhaustive/jsr/src/core/fetcher/Fetcher.ts +++ b/seed/ts-sdk/exhaustive/jsr/src/core/fetcher/Fetcher.ts @@ -20,6 +20,7 @@ export declare namespace Fetcher { maxRetries?: number; withCredentials?: boolean; abortSignal?: AbortSignal; + requestType?: "json" | "file" | "bytes"; responseType?: "json" | "blob" | "streaming" | "text"; } @@ -62,7 +63,10 @@ export async function fetcherImpl(args: Fetcher.Args): Promise { - let requestBody: BodyInit; - if (RUNTIME.type === "node") { - if (body instanceof (await import("formdata-node")).FormData) { - // @ts-expect-error - requestBody = body; - } else if (body instanceof (await import("stream")).Readable) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } - } else { - if (body instanceof (await import("form-data")).default) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } +export declare namespace GetRequestBody { + interface Args { + body: unknown; + type: "json" | "file" | "bytes" | "other"; } - return requestBody; } -export const maybeStringifyBody = (requestBody: any, contentType: string): Uint8Array | string => { - if (requestBody instanceof Uint8Array) { - return requestBody; - } else if (contentType === "application/x-www-form-urlencoded" && typeof requestBody === "string") { - return requestBody; +export async function getRequestBody({ body, type }: GetRequestBody.Args): Promise { + if (type.includes("json")) { + return JSON.stringify(body); } else { - return JSON.stringify(requestBody); + return body as BodyInit; } -}; +} diff --git a/seed/ts-sdk/exhaustive/jsr/src/core/runtime/runtime.ts b/seed/ts-sdk/exhaustive/jsr/src/core/runtime/runtime.ts index 30fe0779aaa..4d0687e8eb4 100644 --- a/seed/ts-sdk/exhaustive/jsr/src/core/runtime/runtime.ts +++ b/seed/ts-sdk/exhaustive/jsr/src/core/runtime/runtime.ts @@ -69,6 +69,7 @@ export const RUNTIME: Runtime = evaluateRuntime(); export interface Runtime { type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd"; version?: string; + parsedVersion?: number; } function evaluateRuntime(): Runtime { @@ -109,6 +110,7 @@ function evaluateRuntime(): Runtime { return { type: "node", version: process.versions.node, + parsedVersion: Number(process.versions.node.split(".")[0]), }; } diff --git a/seed/ts-sdk/exhaustive/no-custom-config/src/api/resources/endpoints/resources/container/client/Client.ts b/seed/ts-sdk/exhaustive/no-custom-config/src/api/resources/endpoints/resources/container/client/Client.ts index d67aaaa7010..3b8622100d5 100644 --- a/seed/ts-sdk/exhaustive/no-custom-config/src/api/resources/endpoints/resources/container/client/Client.ts +++ b/seed/ts-sdk/exhaustive/no-custom-config/src/api/resources/endpoints/resources/container/client/Client.ts @@ -50,6 +50,7 @@ export class Container { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.container.getAndReturnListOfPrimitives.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -113,6 +114,7 @@ export class Container { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.container.getAndReturnListOfObjects.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -174,6 +176,7 @@ export class Container { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.container.getAndReturnSetOfPrimitives.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -237,6 +240,7 @@ export class Container { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.container.getAndReturnSetOfObjects.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -300,6 +304,7 @@ export class Container { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.container.getAndReturnMapPrimToPrim.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -365,6 +370,7 @@ export class Container { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.container.getAndReturnMapOfPrimToObject.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -428,6 +434,7 @@ export class Container { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: request != null ? serializers.endpoints.container.getAndReturnOptional.Request.jsonOrThrow(request, { diff --git a/seed/ts-sdk/exhaustive/no-custom-config/src/api/resources/endpoints/resources/enum/client/Client.ts b/seed/ts-sdk/exhaustive/no-custom-config/src/api/resources/endpoints/resources/enum/client/Client.ts index 531614bee62..a90778e1558 100644 --- a/seed/ts-sdk/exhaustive/no-custom-config/src/api/resources/endpoints/resources/enum/client/Client.ts +++ b/seed/ts-sdk/exhaustive/no-custom-config/src/api/resources/endpoints/resources/enum/client/Client.ts @@ -50,6 +50,7 @@ export class Enum { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.types.WeatherReport.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, diff --git a/seed/ts-sdk/exhaustive/no-custom-config/src/api/resources/endpoints/resources/httpMethods/client/Client.ts b/seed/ts-sdk/exhaustive/no-custom-config/src/api/resources/endpoints/resources/httpMethods/client/Client.ts index 37433cb0f61..a8a61166980 100644 --- a/seed/ts-sdk/exhaustive/no-custom-config/src/api/resources/endpoints/resources/httpMethods/client/Client.ts +++ b/seed/ts-sdk/exhaustive/no-custom-config/src/api/resources/endpoints/resources/httpMethods/client/Client.ts @@ -47,6 +47,7 @@ export class HttpMethods { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -107,6 +108,7 @@ export class HttpMethods { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.types.ObjectWithRequiredField.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -170,6 +172,7 @@ export class HttpMethods { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.types.ObjectWithRequiredField.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -247,6 +250,7 @@ export class HttpMethods { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.types.ObjectWithOptionalField.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -303,6 +307,7 @@ export class HttpMethods { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/seed/ts-sdk/exhaustive/no-custom-config/src/api/resources/endpoints/resources/object/client/Client.ts b/seed/ts-sdk/exhaustive/no-custom-config/src/api/resources/endpoints/resources/object/client/Client.ts index 74c22feb270..2ee970c0dae 100644 --- a/seed/ts-sdk/exhaustive/no-custom-config/src/api/resources/endpoints/resources/object/client/Client.ts +++ b/seed/ts-sdk/exhaustive/no-custom-config/src/api/resources/endpoints/resources/object/client/Client.ts @@ -69,6 +69,7 @@ export class Object_ { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.types.ObjectWithOptionalField.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -133,6 +134,7 @@ export class Object_ { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.types.ObjectWithRequiredField.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -198,6 +200,7 @@ export class Object_ { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.types.ObjectWithMapOfMap.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -279,6 +282,7 @@ export class Object_ { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.types.NestedObjectWithOptionalField.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -364,6 +368,7 @@ export class Object_ { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.types.NestedObjectWithRequiredField.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -447,6 +452,7 @@ export class Object_ { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.object.getAndReturnNestedWithRequiredFieldAsList.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), diff --git a/seed/ts-sdk/exhaustive/no-custom-config/src/api/resources/endpoints/resources/params/client/Client.ts b/seed/ts-sdk/exhaustive/no-custom-config/src/api/resources/endpoints/resources/params/client/Client.ts index e4419fda2e6..4b1d2093401 100644 --- a/seed/ts-sdk/exhaustive/no-custom-config/src/api/resources/endpoints/resources/params/client/Client.ts +++ b/seed/ts-sdk/exhaustive/no-custom-config/src/api/resources/endpoints/resources/params/client/Client.ts @@ -52,6 +52,7 @@ export class Params { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -120,6 +121,7 @@ export class Params { }, contentType: "application/json", queryParameters: _queryParams, + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -193,6 +195,7 @@ export class Params { }, contentType: "application/json", queryParameters: _queryParams, + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -259,6 +262,7 @@ export class Params { }, contentType: "application/json", queryParameters: _queryParams, + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -319,6 +323,7 @@ export class Params { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.params.modifyWithPath.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), diff --git a/seed/ts-sdk/exhaustive/no-custom-config/src/api/resources/endpoints/resources/primitive/client/Client.ts b/seed/ts-sdk/exhaustive/no-custom-config/src/api/resources/endpoints/resources/primitive/client/Client.ts index 7179895ec86..cd5fe688864 100644 --- a/seed/ts-sdk/exhaustive/no-custom-config/src/api/resources/endpoints/resources/primitive/client/Client.ts +++ b/seed/ts-sdk/exhaustive/no-custom-config/src/api/resources/endpoints/resources/primitive/client/Client.ts @@ -46,6 +46,7 @@ export class Primitive { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.primitive.getAndReturnString.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -104,6 +105,7 @@ export class Primitive { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.primitive.getAndReturnInt.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -162,6 +164,7 @@ export class Primitive { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.primitive.getAndReturnLong.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -220,6 +223,7 @@ export class Primitive { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.primitive.getAndReturnDouble.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -278,6 +282,7 @@ export class Primitive { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.primitive.getAndReturnBool.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -336,6 +341,7 @@ export class Primitive { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.primitive.getAndReturnDatetime.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -394,6 +400,7 @@ export class Primitive { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.primitive.getAndReturnDate.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -452,6 +459,7 @@ export class Primitive { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.primitive.getAndReturnUuid.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -510,6 +518,7 @@ export class Primitive { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.primitive.getAndReturnBase64.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), diff --git a/seed/ts-sdk/exhaustive/no-custom-config/src/api/resources/endpoints/resources/union/client/Client.ts b/seed/ts-sdk/exhaustive/no-custom-config/src/api/resources/endpoints/resources/union/client/Client.ts index c931858e597..e7a3bcea99c 100644 --- a/seed/ts-sdk/exhaustive/no-custom-config/src/api/resources/endpoints/resources/union/client/Client.ts +++ b/seed/ts-sdk/exhaustive/no-custom-config/src/api/resources/endpoints/resources/union/client/Client.ts @@ -54,6 +54,7 @@ export class Union { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.types.Animal.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, diff --git a/seed/ts-sdk/exhaustive/no-custom-config/src/api/resources/inlinedRequests/client/Client.ts b/seed/ts-sdk/exhaustive/no-custom-config/src/api/resources/inlinedRequests/client/Client.ts index 942286e108d..413a1debbe8 100644 --- a/seed/ts-sdk/exhaustive/no-custom-config/src/api/resources/inlinedRequests/client/Client.ts +++ b/seed/ts-sdk/exhaustive/no-custom-config/src/api/resources/inlinedRequests/client/Client.ts @@ -74,6 +74,7 @@ export class InlinedRequests { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.PostWithObjectBody.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, diff --git a/seed/ts-sdk/exhaustive/no-custom-config/src/api/resources/noAuth/client/Client.ts b/seed/ts-sdk/exhaustive/no-custom-config/src/api/resources/noAuth/client/Client.ts index 2ed486a4e85..9cadcbff1b5 100644 --- a/seed/ts-sdk/exhaustive/no-custom-config/src/api/resources/noAuth/client/Client.ts +++ b/seed/ts-sdk/exhaustive/no-custom-config/src/api/resources/noAuth/client/Client.ts @@ -53,6 +53,7 @@ export class NoAuth { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: request, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, diff --git a/seed/ts-sdk/exhaustive/no-custom-config/src/api/resources/noReqBody/client/Client.ts b/seed/ts-sdk/exhaustive/no-custom-config/src/api/resources/noReqBody/client/Client.ts index e1d584e911b..38c66c24efb 100644 --- a/seed/ts-sdk/exhaustive/no-custom-config/src/api/resources/noReqBody/client/Client.ts +++ b/seed/ts-sdk/exhaustive/no-custom-config/src/api/resources/noReqBody/client/Client.ts @@ -48,6 +48,7 @@ export class NoReqBody { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -102,6 +103,7 @@ export class NoReqBody { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/seed/ts-sdk/exhaustive/no-custom-config/src/api/resources/reqWithHeaders/client/Client.ts b/seed/ts-sdk/exhaustive/no-custom-config/src/api/resources/reqWithHeaders/client/Client.ts index 82f1f77ae55..8fed42e0ca9 100644 --- a/seed/ts-sdk/exhaustive/no-custom-config/src/api/resources/reqWithHeaders/client/Client.ts +++ b/seed/ts-sdk/exhaustive/no-custom-config/src/api/resources/reqWithHeaders/client/Client.ts @@ -57,6 +57,7 @@ export class ReqWithHeaders { "X-TEST-ENDPOINT-HEADER": xTestEndpointHeader, }, contentType: "application/json", + requestType: "json", body: serializers.reqWithHeaders.getWithCustomHeader.Request.jsonOrThrow(_body, { unrecognizedObjectKeys: "strip", }), diff --git a/seed/ts-sdk/exhaustive/no-custom-config/src/core/fetcher/Fetcher.ts b/seed/ts-sdk/exhaustive/no-custom-config/src/core/fetcher/Fetcher.ts index d3686367aa9..f3b010358d0 100644 --- a/seed/ts-sdk/exhaustive/no-custom-config/src/core/fetcher/Fetcher.ts +++ b/seed/ts-sdk/exhaustive/no-custom-config/src/core/fetcher/Fetcher.ts @@ -20,6 +20,7 @@ export declare namespace Fetcher { maxRetries?: number; withCredentials?: boolean; abortSignal?: AbortSignal; + requestType?: "json" | "file" | "bytes"; responseType?: "json" | "blob" | "streaming" | "text"; } @@ -62,7 +63,10 @@ export async function fetcherImpl(args: Fetcher.Args): Promise { - let requestBody: BodyInit; - if (RUNTIME.type === "node") { - if (body instanceof (await import("formdata-node")).FormData) { - // @ts-expect-error - requestBody = body; - } else if (body instanceof (await import("stream")).Readable) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } - } else { - if (body instanceof (await import("form-data")).default) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } +export declare namespace GetRequestBody { + interface Args { + body: unknown; + type: "json" | "file" | "bytes" | "other"; } - return requestBody; } -export const maybeStringifyBody = (requestBody: any, contentType: string): Uint8Array | string => { - if (requestBody instanceof Uint8Array) { - return requestBody; - } else if (contentType === "application/x-www-form-urlencoded" && typeof requestBody === "string") { - return requestBody; +export async function getRequestBody({ body, type }: GetRequestBody.Args): Promise { + if (type.includes("json")) { + return JSON.stringify(body); } else { - return JSON.stringify(requestBody); + return body as BodyInit; } -}; +} diff --git a/seed/ts-sdk/exhaustive/no-custom-config/src/core/runtime/runtime.ts b/seed/ts-sdk/exhaustive/no-custom-config/src/core/runtime/runtime.ts index 30fe0779aaa..4d0687e8eb4 100644 --- a/seed/ts-sdk/exhaustive/no-custom-config/src/core/runtime/runtime.ts +++ b/seed/ts-sdk/exhaustive/no-custom-config/src/core/runtime/runtime.ts @@ -69,6 +69,7 @@ export const RUNTIME: Runtime = evaluateRuntime(); export interface Runtime { type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd"; version?: string; + parsedVersion?: number; } function evaluateRuntime(): Runtime { @@ -109,6 +110,7 @@ function evaluateRuntime(): Runtime { return { type: "node", version: process.versions.node, + parsedVersion: Number(process.versions.node.split(".")[0]), }; } diff --git a/seed/ts-sdk/exhaustive/retain-original-casing/src/api/resources/endpoints/resources/container/client/Client.ts b/seed/ts-sdk/exhaustive/retain-original-casing/src/api/resources/endpoints/resources/container/client/Client.ts index d67aaaa7010..3b8622100d5 100644 --- a/seed/ts-sdk/exhaustive/retain-original-casing/src/api/resources/endpoints/resources/container/client/Client.ts +++ b/seed/ts-sdk/exhaustive/retain-original-casing/src/api/resources/endpoints/resources/container/client/Client.ts @@ -50,6 +50,7 @@ export class Container { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.container.getAndReturnListOfPrimitives.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -113,6 +114,7 @@ export class Container { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.container.getAndReturnListOfObjects.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -174,6 +176,7 @@ export class Container { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.container.getAndReturnSetOfPrimitives.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -237,6 +240,7 @@ export class Container { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.container.getAndReturnSetOfObjects.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -300,6 +304,7 @@ export class Container { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.container.getAndReturnMapPrimToPrim.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -365,6 +370,7 @@ export class Container { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.container.getAndReturnMapOfPrimToObject.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -428,6 +434,7 @@ export class Container { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: request != null ? serializers.endpoints.container.getAndReturnOptional.Request.jsonOrThrow(request, { diff --git a/seed/ts-sdk/exhaustive/retain-original-casing/src/api/resources/endpoints/resources/enum/client/Client.ts b/seed/ts-sdk/exhaustive/retain-original-casing/src/api/resources/endpoints/resources/enum/client/Client.ts index 531614bee62..a90778e1558 100644 --- a/seed/ts-sdk/exhaustive/retain-original-casing/src/api/resources/endpoints/resources/enum/client/Client.ts +++ b/seed/ts-sdk/exhaustive/retain-original-casing/src/api/resources/endpoints/resources/enum/client/Client.ts @@ -50,6 +50,7 @@ export class Enum { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.types.WeatherReport.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, diff --git a/seed/ts-sdk/exhaustive/retain-original-casing/src/api/resources/endpoints/resources/httpMethods/client/Client.ts b/seed/ts-sdk/exhaustive/retain-original-casing/src/api/resources/endpoints/resources/httpMethods/client/Client.ts index 37433cb0f61..a8a61166980 100644 --- a/seed/ts-sdk/exhaustive/retain-original-casing/src/api/resources/endpoints/resources/httpMethods/client/Client.ts +++ b/seed/ts-sdk/exhaustive/retain-original-casing/src/api/resources/endpoints/resources/httpMethods/client/Client.ts @@ -47,6 +47,7 @@ export class HttpMethods { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -107,6 +108,7 @@ export class HttpMethods { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.types.ObjectWithRequiredField.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -170,6 +172,7 @@ export class HttpMethods { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.types.ObjectWithRequiredField.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -247,6 +250,7 @@ export class HttpMethods { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.types.ObjectWithOptionalField.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -303,6 +307,7 @@ export class HttpMethods { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/seed/ts-sdk/exhaustive/retain-original-casing/src/api/resources/endpoints/resources/object/client/Client.ts b/seed/ts-sdk/exhaustive/retain-original-casing/src/api/resources/endpoints/resources/object/client/Client.ts index a78a0f72636..893f7b7e8a3 100644 --- a/seed/ts-sdk/exhaustive/retain-original-casing/src/api/resources/endpoints/resources/object/client/Client.ts +++ b/seed/ts-sdk/exhaustive/retain-original-casing/src/api/resources/endpoints/resources/object/client/Client.ts @@ -69,6 +69,7 @@ export class Object_ { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.types.ObjectWithOptionalField.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -133,6 +134,7 @@ export class Object_ { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.types.ObjectWithRequiredField.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -198,6 +200,7 @@ export class Object_ { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.types.ObjectWithMapOfMap.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -279,6 +282,7 @@ export class Object_ { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.types.NestedObjectWithOptionalField.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -364,6 +368,7 @@ export class Object_ { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.types.NestedObjectWithRequiredField.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -447,6 +452,7 @@ export class Object_ { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.object.getAndReturnNestedWithRequiredFieldAsList.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), diff --git a/seed/ts-sdk/exhaustive/retain-original-casing/src/api/resources/endpoints/resources/params/client/Client.ts b/seed/ts-sdk/exhaustive/retain-original-casing/src/api/resources/endpoints/resources/params/client/Client.ts index e4419fda2e6..4b1d2093401 100644 --- a/seed/ts-sdk/exhaustive/retain-original-casing/src/api/resources/endpoints/resources/params/client/Client.ts +++ b/seed/ts-sdk/exhaustive/retain-original-casing/src/api/resources/endpoints/resources/params/client/Client.ts @@ -52,6 +52,7 @@ export class Params { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -120,6 +121,7 @@ export class Params { }, contentType: "application/json", queryParameters: _queryParams, + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -193,6 +195,7 @@ export class Params { }, contentType: "application/json", queryParameters: _queryParams, + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -259,6 +262,7 @@ export class Params { }, contentType: "application/json", queryParameters: _queryParams, + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -319,6 +323,7 @@ export class Params { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.params.modifyWithPath.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), diff --git a/seed/ts-sdk/exhaustive/retain-original-casing/src/api/resources/endpoints/resources/primitive/client/Client.ts b/seed/ts-sdk/exhaustive/retain-original-casing/src/api/resources/endpoints/resources/primitive/client/Client.ts index 7179895ec86..cd5fe688864 100644 --- a/seed/ts-sdk/exhaustive/retain-original-casing/src/api/resources/endpoints/resources/primitive/client/Client.ts +++ b/seed/ts-sdk/exhaustive/retain-original-casing/src/api/resources/endpoints/resources/primitive/client/Client.ts @@ -46,6 +46,7 @@ export class Primitive { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.primitive.getAndReturnString.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -104,6 +105,7 @@ export class Primitive { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.primitive.getAndReturnInt.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -162,6 +164,7 @@ export class Primitive { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.primitive.getAndReturnLong.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -220,6 +223,7 @@ export class Primitive { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.primitive.getAndReturnDouble.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -278,6 +282,7 @@ export class Primitive { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.primitive.getAndReturnBool.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -336,6 +341,7 @@ export class Primitive { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.primitive.getAndReturnDatetime.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -394,6 +400,7 @@ export class Primitive { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.primitive.getAndReturnDate.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -452,6 +459,7 @@ export class Primitive { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.primitive.getAndReturnUuid.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -510,6 +518,7 @@ export class Primitive { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.endpoints.primitive.getAndReturnBase64.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), diff --git a/seed/ts-sdk/exhaustive/retain-original-casing/src/api/resources/endpoints/resources/union/client/Client.ts b/seed/ts-sdk/exhaustive/retain-original-casing/src/api/resources/endpoints/resources/union/client/Client.ts index c931858e597..e7a3bcea99c 100644 --- a/seed/ts-sdk/exhaustive/retain-original-casing/src/api/resources/endpoints/resources/union/client/Client.ts +++ b/seed/ts-sdk/exhaustive/retain-original-casing/src/api/resources/endpoints/resources/union/client/Client.ts @@ -54,6 +54,7 @@ export class Union { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.types.Animal.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, diff --git a/seed/ts-sdk/exhaustive/retain-original-casing/src/api/resources/inlinedRequests/client/Client.ts b/seed/ts-sdk/exhaustive/retain-original-casing/src/api/resources/inlinedRequests/client/Client.ts index e394731fad5..76f3fee209a 100644 --- a/seed/ts-sdk/exhaustive/retain-original-casing/src/api/resources/inlinedRequests/client/Client.ts +++ b/seed/ts-sdk/exhaustive/retain-original-casing/src/api/resources/inlinedRequests/client/Client.ts @@ -74,6 +74,7 @@ export class InlinedRequests { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.PostWithObjectBody.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, diff --git a/seed/ts-sdk/exhaustive/retain-original-casing/src/api/resources/noAuth/client/Client.ts b/seed/ts-sdk/exhaustive/retain-original-casing/src/api/resources/noAuth/client/Client.ts index 2ed486a4e85..9cadcbff1b5 100644 --- a/seed/ts-sdk/exhaustive/retain-original-casing/src/api/resources/noAuth/client/Client.ts +++ b/seed/ts-sdk/exhaustive/retain-original-casing/src/api/resources/noAuth/client/Client.ts @@ -53,6 +53,7 @@ export class NoAuth { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: request, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, diff --git a/seed/ts-sdk/exhaustive/retain-original-casing/src/api/resources/noReqBody/client/Client.ts b/seed/ts-sdk/exhaustive/retain-original-casing/src/api/resources/noReqBody/client/Client.ts index e1d584e911b..38c66c24efb 100644 --- a/seed/ts-sdk/exhaustive/retain-original-casing/src/api/resources/noReqBody/client/Client.ts +++ b/seed/ts-sdk/exhaustive/retain-original-casing/src/api/resources/noReqBody/client/Client.ts @@ -48,6 +48,7 @@ export class NoReqBody { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -102,6 +103,7 @@ export class NoReqBody { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/seed/ts-sdk/exhaustive/retain-original-casing/src/api/resources/reqWithHeaders/client/Client.ts b/seed/ts-sdk/exhaustive/retain-original-casing/src/api/resources/reqWithHeaders/client/Client.ts index 6fe913ac166..e549be5020b 100644 --- a/seed/ts-sdk/exhaustive/retain-original-casing/src/api/resources/reqWithHeaders/client/Client.ts +++ b/seed/ts-sdk/exhaustive/retain-original-casing/src/api/resources/reqWithHeaders/client/Client.ts @@ -61,6 +61,7 @@ export class ReqWithHeaders { "X-TEST-ENDPOINT-HEADER": xTestEndpointHeader, }, contentType: "application/json", + requestType: "json", body: serializers.reqWithHeaders.getWithCustomHeader.Request.jsonOrThrow(_body, { unrecognizedObjectKeys: "strip", }), diff --git a/seed/ts-sdk/exhaustive/retain-original-casing/src/core/fetcher/Fetcher.ts b/seed/ts-sdk/exhaustive/retain-original-casing/src/core/fetcher/Fetcher.ts index d3686367aa9..f3b010358d0 100644 --- a/seed/ts-sdk/exhaustive/retain-original-casing/src/core/fetcher/Fetcher.ts +++ b/seed/ts-sdk/exhaustive/retain-original-casing/src/core/fetcher/Fetcher.ts @@ -20,6 +20,7 @@ export declare namespace Fetcher { maxRetries?: number; withCredentials?: boolean; abortSignal?: AbortSignal; + requestType?: "json" | "file" | "bytes"; responseType?: "json" | "blob" | "streaming" | "text"; } @@ -62,7 +63,10 @@ export async function fetcherImpl(args: Fetcher.Args): Promise { - let requestBody: BodyInit; - if (RUNTIME.type === "node") { - if (body instanceof (await import("formdata-node")).FormData) { - // @ts-expect-error - requestBody = body; - } else if (body instanceof (await import("stream")).Readable) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } - } else { - if (body instanceof (await import("form-data")).default) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } +export declare namespace GetRequestBody { + interface Args { + body: unknown; + type: "json" | "file" | "bytes" | "other"; } - return requestBody; } -export const maybeStringifyBody = (requestBody: any, contentType: string): Uint8Array | string => { - if (requestBody instanceof Uint8Array) { - return requestBody; - } else if (contentType === "application/x-www-form-urlencoded" && typeof requestBody === "string") { - return requestBody; +export async function getRequestBody({ body, type }: GetRequestBody.Args): Promise { + if (type.includes("json")) { + return JSON.stringify(body); } else { - return JSON.stringify(requestBody); + return body as BodyInit; } -}; +} diff --git a/seed/ts-sdk/exhaustive/retain-original-casing/src/core/runtime/runtime.ts b/seed/ts-sdk/exhaustive/retain-original-casing/src/core/runtime/runtime.ts index 30fe0779aaa..4d0687e8eb4 100644 --- a/seed/ts-sdk/exhaustive/retain-original-casing/src/core/runtime/runtime.ts +++ b/seed/ts-sdk/exhaustive/retain-original-casing/src/core/runtime/runtime.ts @@ -69,6 +69,7 @@ export const RUNTIME: Runtime = evaluateRuntime(); export interface Runtime { type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd"; version?: string; + parsedVersion?: number; } function evaluateRuntime(): Runtime { @@ -109,6 +110,7 @@ function evaluateRuntime(): Runtime { return { type: "node", version: process.versions.node, + parsedVersion: Number(process.versions.node.split(".")[0]), }; } diff --git a/seed/ts-sdk/extra-properties/src/api/resources/user/client/Client.ts b/seed/ts-sdk/extra-properties/src/api/resources/user/client/Client.ts index 20238bcf6b0..0ef521fe9cb 100644 --- a/seed/ts-sdk/extra-properties/src/api/resources/user/client/Client.ts +++ b/seed/ts-sdk/extra-properties/src/api/resources/user/client/Client.ts @@ -50,6 +50,7 @@ export class User { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: { ...serializers.CreateUserRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), _type: "CreateUserRequest", diff --git a/seed/ts-sdk/extra-properties/src/core/fetcher/Fetcher.ts b/seed/ts-sdk/extra-properties/src/core/fetcher/Fetcher.ts index d3686367aa9..f3b010358d0 100644 --- a/seed/ts-sdk/extra-properties/src/core/fetcher/Fetcher.ts +++ b/seed/ts-sdk/extra-properties/src/core/fetcher/Fetcher.ts @@ -20,6 +20,7 @@ export declare namespace Fetcher { maxRetries?: number; withCredentials?: boolean; abortSignal?: AbortSignal; + requestType?: "json" | "file" | "bytes"; responseType?: "json" | "blob" | "streaming" | "text"; } @@ -62,7 +63,10 @@ export async function fetcherImpl(args: Fetcher.Args): Promise { - let requestBody: BodyInit; - if (RUNTIME.type === "node") { - if (body instanceof (await import("formdata-node")).FormData) { - // @ts-expect-error - requestBody = body; - } else if (body instanceof (await import("stream")).Readable) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } - } else { - if (body instanceof (await import("form-data")).default) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } +export declare namespace GetRequestBody { + interface Args { + body: unknown; + type: "json" | "file" | "bytes" | "other"; } - return requestBody; } -export const maybeStringifyBody = (requestBody: any, contentType: string): Uint8Array | string => { - if (requestBody instanceof Uint8Array) { - return requestBody; - } else if (contentType === "application/x-www-form-urlencoded" && typeof requestBody === "string") { - return requestBody; +export async function getRequestBody({ body, type }: GetRequestBody.Args): Promise { + if (type.includes("json")) { + return JSON.stringify(body); } else { - return JSON.stringify(requestBody); + return body as BodyInit; } -}; +} diff --git a/seed/ts-sdk/extra-properties/src/core/runtime/runtime.ts b/seed/ts-sdk/extra-properties/src/core/runtime/runtime.ts index 30fe0779aaa..4d0687e8eb4 100644 --- a/seed/ts-sdk/extra-properties/src/core/runtime/runtime.ts +++ b/seed/ts-sdk/extra-properties/src/core/runtime/runtime.ts @@ -69,6 +69,7 @@ export const RUNTIME: Runtime = evaluateRuntime(); export interface Runtime { type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd"; version?: string; + parsedVersion?: number; } function evaluateRuntime(): Runtime { @@ -109,6 +110,7 @@ function evaluateRuntime(): Runtime { return { type: "node", version: process.versions.node, + parsedVersion: Number(process.versions.node.split(".")[0]), }; } diff --git a/seed/ts-sdk/file-download/file-download-reponse-headers/src/api/resources/service/client/Client.ts b/seed/ts-sdk/file-download/file-download-reponse-headers/src/api/resources/service/client/Client.ts index d2cece84aa8..106ba968d58 100644 --- a/seed/ts-sdk/file-download/file-download-reponse-headers/src/api/resources/service/client/Client.ts +++ b/seed/ts-sdk/file-download/file-download-reponse-headers/src/api/resources/service/client/Client.ts @@ -40,6 +40,7 @@ export class Service { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", responseType: "streaming", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, diff --git a/seed/ts-sdk/file-download/file-download-reponse-headers/src/core/fetcher/Fetcher.ts b/seed/ts-sdk/file-download/file-download-reponse-headers/src/core/fetcher/Fetcher.ts index d3686367aa9..f3b010358d0 100644 --- a/seed/ts-sdk/file-download/file-download-reponse-headers/src/core/fetcher/Fetcher.ts +++ b/seed/ts-sdk/file-download/file-download-reponse-headers/src/core/fetcher/Fetcher.ts @@ -20,6 +20,7 @@ export declare namespace Fetcher { maxRetries?: number; withCredentials?: boolean; abortSignal?: AbortSignal; + requestType?: "json" | "file" | "bytes"; responseType?: "json" | "blob" | "streaming" | "text"; } @@ -62,7 +63,10 @@ export async function fetcherImpl(args: Fetcher.Args): Promise { - let requestBody: BodyInit; - if (RUNTIME.type === "node") { - if (body instanceof (await import("formdata-node")).FormData) { - // @ts-expect-error - requestBody = body; - } else if (body instanceof (await import("stream")).Readable) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } - } else { - if (body instanceof (await import("form-data")).default) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } +export declare namespace GetRequestBody { + interface Args { + body: unknown; + type: "json" | "file" | "bytes" | "other"; } - return requestBody; } -export const maybeStringifyBody = (requestBody: any, contentType: string): Uint8Array | string => { - if (requestBody instanceof Uint8Array) { - return requestBody; - } else if (contentType === "application/x-www-form-urlencoded" && typeof requestBody === "string") { - return requestBody; +export async function getRequestBody({ body, type }: GetRequestBody.Args): Promise { + if (type.includes("json")) { + return JSON.stringify(body); } else { - return JSON.stringify(requestBody); + return body as BodyInit; } -}; +} diff --git a/seed/ts-sdk/file-download/file-download-reponse-headers/src/core/runtime/runtime.ts b/seed/ts-sdk/file-download/file-download-reponse-headers/src/core/runtime/runtime.ts index 30fe0779aaa..4d0687e8eb4 100644 --- a/seed/ts-sdk/file-download/file-download-reponse-headers/src/core/runtime/runtime.ts +++ b/seed/ts-sdk/file-download/file-download-reponse-headers/src/core/runtime/runtime.ts @@ -69,6 +69,7 @@ export const RUNTIME: Runtime = evaluateRuntime(); export interface Runtime { type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd"; version?: string; + parsedVersion?: number; } function evaluateRuntime(): Runtime { @@ -109,6 +110,7 @@ function evaluateRuntime(): Runtime { return { type: "node", version: process.versions.node, + parsedVersion: Number(process.versions.node.split(".")[0]), }; } diff --git a/seed/ts-sdk/file-download/no-custom-config/src/api/resources/service/client/Client.ts b/seed/ts-sdk/file-download/no-custom-config/src/api/resources/service/client/Client.ts index c5ad80e73d4..516e44c6528 100644 --- a/seed/ts-sdk/file-download/no-custom-config/src/api/resources/service/client/Client.ts +++ b/seed/ts-sdk/file-download/no-custom-config/src/api/resources/service/client/Client.ts @@ -36,6 +36,7 @@ export class Service { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", responseType: "streaming", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, diff --git a/seed/ts-sdk/file-download/no-custom-config/src/core/fetcher/Fetcher.ts b/seed/ts-sdk/file-download/no-custom-config/src/core/fetcher/Fetcher.ts index d3686367aa9..f3b010358d0 100644 --- a/seed/ts-sdk/file-download/no-custom-config/src/core/fetcher/Fetcher.ts +++ b/seed/ts-sdk/file-download/no-custom-config/src/core/fetcher/Fetcher.ts @@ -20,6 +20,7 @@ export declare namespace Fetcher { maxRetries?: number; withCredentials?: boolean; abortSignal?: AbortSignal; + requestType?: "json" | "file" | "bytes"; responseType?: "json" | "blob" | "streaming" | "text"; } @@ -62,7 +63,10 @@ export async function fetcherImpl(args: Fetcher.Args): Promise { - let requestBody: BodyInit; - if (RUNTIME.type === "node") { - if (body instanceof (await import("formdata-node")).FormData) { - // @ts-expect-error - requestBody = body; - } else if (body instanceof (await import("stream")).Readable) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } - } else { - if (body instanceof (await import("form-data")).default) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } +export declare namespace GetRequestBody { + interface Args { + body: unknown; + type: "json" | "file" | "bytes" | "other"; } - return requestBody; } -export const maybeStringifyBody = (requestBody: any, contentType: string): Uint8Array | string => { - if (requestBody instanceof Uint8Array) { - return requestBody; - } else if (contentType === "application/x-www-form-urlencoded" && typeof requestBody === "string") { - return requestBody; +export async function getRequestBody({ body, type }: GetRequestBody.Args): Promise { + if (type.includes("json")) { + return JSON.stringify(body); } else { - return JSON.stringify(requestBody); + return body as BodyInit; } -}; +} diff --git a/seed/ts-sdk/file-download/no-custom-config/src/core/runtime/runtime.ts b/seed/ts-sdk/file-download/no-custom-config/src/core/runtime/runtime.ts index 30fe0779aaa..4d0687e8eb4 100644 --- a/seed/ts-sdk/file-download/no-custom-config/src/core/runtime/runtime.ts +++ b/seed/ts-sdk/file-download/no-custom-config/src/core/runtime/runtime.ts @@ -69,6 +69,7 @@ export const RUNTIME: Runtime = evaluateRuntime(); export interface Runtime { type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd"; version?: string; + parsedVersion?: number; } function evaluateRuntime(): Runtime { @@ -109,6 +110,7 @@ function evaluateRuntime(): Runtime { return { type: "node", version: process.versions.node, + parsedVersion: Number(process.versions.node.split(".")[0]), }; } diff --git a/seed/ts-sdk/file-upload/no-custom-config/reference.md b/seed/ts-sdk/file-upload/no-custom-config/reference.md index 3121630aacf..51e99ab0b0a 100644 --- a/seed/ts-sdk/file-upload/no-custom-config/reference.md +++ b/seed/ts-sdk/file-upload/no-custom-config/reference.md @@ -37,7 +37,7 @@ await client.service.post(
-**file:** `File | fs.ReadStream` +**file:** `File | fs.ReadStream | Blob`
@@ -45,7 +45,7 @@ await client.service.post(
-**fileList:** `File[] | fs.ReadStream[]` +**fileList:** `File[] | fs.ReadStream[] | Blob[]`
@@ -53,7 +53,7 @@ await client.service.post(
-**maybeFile:** `File | fs.ReadStream | undefined` +**maybeFile:** `File | fs.ReadStream | Blob | undefined`
@@ -61,7 +61,7 @@ await client.service.post(
-**maybeFileList:** `File[] | fs.ReadStream[] | undefined` +**maybeFileList:** `File[] | fs.ReadStream[] | Blob[] | undefined`
@@ -117,7 +117,7 @@ await client.service.justFile(fs.createReadStream("/path/to/your/file"));
-**file:** `File | fs.ReadStream` +**file:** `File | fs.ReadStream | Blob`
@@ -171,7 +171,7 @@ await client.service.justFileWithQueryParams(fs.createReadStream("/path/to/your/
-**file:** `File | fs.ReadStream` +**file:** `File | fs.ReadStream | Blob`
diff --git a/seed/ts-sdk/file-upload/no-custom-config/src/api/resources/service/client/Client.ts b/seed/ts-sdk/file-upload/no-custom-config/src/api/resources/service/client/Client.ts index 65aaae8f44c..53116591c5f 100644 --- a/seed/ts-sdk/file-upload/no-custom-config/src/api/resources/service/client/Client.ts +++ b/seed/ts-sdk/file-upload/no-custom-config/src/api/resources/service/client/Client.ts @@ -4,6 +4,7 @@ import * as core from "../../../../core"; import * as fs from "fs"; +import { Blob } from "buffer"; import * as SeedFileUpload from "../../../index"; import * as errors from "../../../../errors/index"; import urlJoin from "url-join"; @@ -27,10 +28,10 @@ export class Service { constructor(protected readonly _options: Service.Options) {} /** - * @param {File | fs.ReadStream} file - * @param {File[] | fs.ReadStream[]} fileList - * @param {File | fs.ReadStream | undefined} maybeFile - * @param {File[] | fs.ReadStream[] | undefined} maybeFileList + * @param {File | fs.ReadStream | Blob} file + * @param {File[] | fs.ReadStream[] | Blob[]} fileList + * @param {File | fs.ReadStream | Blob | undefined} maybeFile + * @param {File[] | fs.ReadStream[] | Blob[] | undefined} maybeFileList * @param {SeedFileUpload.MyRequest} request * @param {Service.RequestOptions} requestOptions - Request-specific configuration. * @@ -38,26 +39,26 @@ export class Service { * await client.service.post(fs.createReadStream("/path/to/your/file"), [fs.createReadStream("/path/to/your/file")], fs.createReadStream("/path/to/your/file"), [fs.createReadStream("/path/to/your/file")], {}) */ public async post( - file: File | fs.ReadStream, - fileList: File[] | fs.ReadStream[], - maybeFile: File | fs.ReadStream | undefined, - maybeFileList: File[] | fs.ReadStream[] | undefined, + file: File | fs.ReadStream | Blob, + fileList: File[] | fs.ReadStream[] | Blob[], + maybeFile: File | fs.ReadStream | Blob | undefined, + maybeFileList: File[] | fs.ReadStream[] | Blob[] | undefined, request: SeedFileUpload.MyRequest, requestOptions?: Service.RequestOptions ): Promise { - const _request = new core.FormDataWrapper(); + const _request = await core.newFormData(); if (request.maybeString != null) { await _request.append("maybeString", request.maybeString); } await _request.append("integer", request.integer.toString()); - await _request.append("file", file); + await _request.appendFile("file", file); for (const _file of fileList) { await _request.append("fileList", _file); } if (maybeFile != null) { - await _request.append("maybeFile", maybeFile); + await _request.appendFile("maybeFile", maybeFile); } if (maybeFileList != null) { @@ -80,7 +81,7 @@ export class Service { await _request.append("listOfObjects", JSON.stringify(_item)); } - const _maybeEncodedRequest = _request.getRequest(); + const _maybeEncodedRequest = await _request.getRequest(); const _response = await core.fetcher({ url: await core.Supplier.get(this._options.environment), method: "POST", @@ -90,9 +91,10 @@ export class Service { "X-Fern-SDK-Version": "0.0.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, - ...(await _maybeEncodedRequest.getHeaders()), + ...(await _maybeEncodedRequest.headers), }, - body: await _maybeEncodedRequest.getBody(), + requestType: "file", + body: await _maybeEncodedRequest.body, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -124,16 +126,16 @@ export class Service { } /** - * @param {File | fs.ReadStream} file + * @param {File | fs.ReadStream | Blob} file * @param {Service.RequestOptions} requestOptions - Request-specific configuration. * * @example * await client.service.justFile(fs.createReadStream("/path/to/your/file")) */ - public async justFile(file: File | fs.ReadStream, requestOptions?: Service.RequestOptions): Promise { - const _request = new core.FormDataWrapper(); - await _request.append("file", file); - const _maybeEncodedRequest = _request.getRequest(); + public async justFile(file: File | fs.ReadStream | Blob, requestOptions?: Service.RequestOptions): Promise { + const _request = await core.newFormData(); + await _request.appendFile("file", file); + const _maybeEncodedRequest = await _request.getRequest(); const _response = await core.fetcher({ url: urlJoin(await core.Supplier.get(this._options.environment), "/just-file"), method: "POST", @@ -143,9 +145,10 @@ export class Service { "X-Fern-SDK-Version": "0.0.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, - ...(await _maybeEncodedRequest.getHeaders()), + ...(await _maybeEncodedRequest.headers), }, - body: await _maybeEncodedRequest.getBody(), + requestType: "file", + body: await _maybeEncodedRequest.body, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -177,7 +180,7 @@ export class Service { } /** - * @param {File | fs.ReadStream} file + * @param {File | fs.ReadStream | Blob} file * @param {SeedFileUpload.JustFileWithQueryParamsRequet} request * @param {Service.RequestOptions} requestOptions - Request-specific configuration. * @@ -191,7 +194,7 @@ export class Service { * }) */ public async justFileWithQueryParams( - file: File | fs.ReadStream, + file: File | fs.ReadStream | Blob, request: SeedFileUpload.JustFileWithQueryParamsRequet, requestOptions?: Service.RequestOptions ): Promise { @@ -219,9 +222,9 @@ export class Service { } } - const _request = new core.FormDataWrapper(); - await _request.append("file", file); - const _maybeEncodedRequest = _request.getRequest(); + const _request = await core.newFormData(); + await _request.appendFile("file", file); + const _maybeEncodedRequest = await _request.getRequest(); const _response = await core.fetcher({ url: urlJoin(await core.Supplier.get(this._options.environment), "/just-file-with-query-params"), method: "POST", @@ -231,10 +234,11 @@ export class Service { "X-Fern-SDK-Version": "0.0.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, - ...(await _maybeEncodedRequest.getHeaders()), + ...(await _maybeEncodedRequest.headers), }, queryParameters: _queryParams, - body: await _maybeEncodedRequest.getBody(), + requestType: "file", + body: await _maybeEncodedRequest.body, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/seed/ts-sdk/file-upload/no-custom-config/src/core/fetcher/Fetcher.ts b/seed/ts-sdk/file-upload/no-custom-config/src/core/fetcher/Fetcher.ts index d3686367aa9..f3b010358d0 100644 --- a/seed/ts-sdk/file-upload/no-custom-config/src/core/fetcher/Fetcher.ts +++ b/seed/ts-sdk/file-upload/no-custom-config/src/core/fetcher/Fetcher.ts @@ -20,6 +20,7 @@ export declare namespace Fetcher { maxRetries?: number; withCredentials?: boolean; abortSignal?: AbortSignal; + requestType?: "json" | "file" | "bytes"; responseType?: "json" | "blob" | "streaming" | "text"; } @@ -62,7 +63,10 @@ export async function fetcherImpl(args: Fetcher.Args): Promise { - let requestBody: BodyInit; - if (RUNTIME.type === "node") { - if (body instanceof (await import("formdata-node")).FormData) { - // @ts-expect-error - requestBody = body; - } else if (body instanceof (await import("stream")).Readable) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } - } else { - if (body instanceof (await import("form-data")).default) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } +export declare namespace GetRequestBody { + interface Args { + body: unknown; + type: "json" | "file" | "bytes" | "other"; } - return requestBody; } -export const maybeStringifyBody = (requestBody: any, contentType: string): Uint8Array | string => { - if (requestBody instanceof Uint8Array) { - return requestBody; - } else if (contentType === "application/x-www-form-urlencoded" && typeof requestBody === "string") { - return requestBody; +export async function getRequestBody({ body, type }: GetRequestBody.Args): Promise { + if (type.includes("json")) { + return JSON.stringify(body); } else { - return JSON.stringify(requestBody); + return body as BodyInit; } -}; +} diff --git a/seed/ts-sdk/file-upload/no-custom-config/src/core/form-data-utils/FormDataWrapper.ts b/seed/ts-sdk/file-upload/no-custom-config/src/core/form-data-utils/FormDataWrapper.ts index 602173e5c36..124ba3eb2b3 100644 --- a/seed/ts-sdk/file-upload/no-custom-config/src/core/form-data-utils/FormDataWrapper.ts +++ b/seed/ts-sdk/file-upload/no-custom-config/src/core/form-data-utils/FormDataWrapper.ts @@ -1,72 +1,134 @@ -import { Readable } from "stream"; import { RUNTIME } from "../runtime"; -interface CrossPlatformFormData { - append(key: string, value: any): void; +export type MaybePromise = Promise | T; + +type FormDataRequest = { + body: Body; + headers: Record; +}; + +export interface CrossPlatformFormData { + setup(): Promise; + + append(key: string, value: unknown): void; + + appendFile(key: string, value: unknown, fileName?: string): Promise; + + getRequest(): MaybePromise>; +} + +export async function newFormData(): Promise { + let formdata: CrossPlatformFormData; + if (RUNTIME.type === "node" && RUNTIME.parsedVersion != null && RUNTIME.parsedVersion > 18) { + formdata = new Node19FormData(); + } else if (RUNTIME.type === "node") { + formdata = new Node16FormData(); + } else { + formdata = new WebFormData(); + } + await formdata.setup(); + return formdata; } -class FormDataRequestBody { - private fd: any; - private encoder: any; +/** + * Form Data Implementation for Node.js 18+ + */ +class Node19FormData implements CrossPlatformFormData { + private fd: + | { + append(name: string, value: unknown, fileName?: string): void; + } + | undefined; - constructor(fd: any) { - this.fd = fd; + public async setup() { + this.fd = new (await import("formdata-node")).FormData(); } - async setup(): Promise { - if (this.encoder == null && RUNTIME.type === "node") { - this.encoder = new (await import("form-data-encoder")).FormDataEncoder(this.fd); - } + public append(key: string, value: any): void { + this.fd?.append(key, value); } - /** - * @returns the multipart form data request - */ - public async getBody(): Promise { - if (RUNTIME.type !== "node") { - return this.fd; - } else { - if (this.encoder == null) { - await this.setup(); - } - return Readable.from(this.encoder); - } + public async appendFile(key: string, value: any, fileName?: string): Promise { + this.fd?.append(key, new (await import("buffer")).Blob([value]), fileName); + } + + public async getRequest(): Promise> { + const encoder = new (await import("form-data-encoder")).FormDataEncoder(this.fd as any); + return { + body: (await import("stream")).Readable.from(encoder), + headers: encoder.headers, + }; + } +} + +/** + * Form Data Implementation for Node.js 16-18 + */ +class Node16FormData implements CrossPlatformFormData { + private fd: + | { + append( + name: string, + value: unknown, + options?: { + header?: string | Headers; + knownLength?: number; + filename?: string; + filepath?: string; + contentType?: string; + } + ): void; + + getHeaders(): Record; + } + | undefined; + + public async setup(): Promise { + this.fd = new (await import("form-data")).default(); + } + + public append(key: string, value: any): void { + this.fd?.append(key, value); } - /** - * @returns headers that need to be added to the multipart form data request - */ - public async getHeaders(): Promise> { - if (RUNTIME.type !== "node") { - return {}; + public async appendFile(key: string, value: any, fileName?: string): Promise { + if (fileName == null) { + this.fd?.append(key, value); } else { - if (this.encoder == null) { - await this.setup(); - } - return this.encoder.headers; + this.fd?.append(key, value, { filename: fileName }); } } + + public getRequest(): FormDataRequest { + return { + body: this.fd, + headers: this.fd ? this.fd.getHeaders() : {}, + }; + } } /** - * FormDataWrapper is a utility to make form data - * requests across both Browser and Node.js runtimes. + * Form Data Implementation for Web */ -export class FormDataWrapper { - private fd: CrossPlatformFormData | undefined; - - public async append(name: string, value: any): Promise { - if (this.fd == null) { - if (RUNTIME.type === "node") { - this.fd = new (await import("formdata-node")).FormData(); - } else { - this.fd = new (await import("form-data")).default(); - } - } - this.fd.append(name, value); +class WebFormData implements CrossPlatformFormData { + private fd: { append(name: string, value: string | Blob, fileName?: string): void } | undefined; + + public async setup(): Promise { + this.fd = new FormData(); + } + + public append(key: string, value: any): void { + this.fd?.append(key, value); + } + + public async appendFile(key: string, value: any, fileName?: string): Promise { + this.fd?.append(key, new Blob([value]), fileName); } - public getRequest(): FormDataRequestBody { - return new FormDataRequestBody(this.fd); + public getRequest(): FormDataRequest { + return { + body: this.fd, + headers: {}, + }; } } diff --git a/seed/ts-sdk/file-upload/no-custom-config/src/core/runtime/runtime.ts b/seed/ts-sdk/file-upload/no-custom-config/src/core/runtime/runtime.ts index 30fe0779aaa..4d0687e8eb4 100644 --- a/seed/ts-sdk/file-upload/no-custom-config/src/core/runtime/runtime.ts +++ b/seed/ts-sdk/file-upload/no-custom-config/src/core/runtime/runtime.ts @@ -69,6 +69,7 @@ export const RUNTIME: Runtime = evaluateRuntime(); export interface Runtime { type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd"; version?: string; + parsedVersion?: number; } function evaluateRuntime(): Runtime { @@ -109,6 +110,7 @@ function evaluateRuntime(): Runtime { return { type: "node", version: process.versions.node, + parsedVersion: Number(process.versions.node.split(".")[0]), }; } diff --git a/seed/ts-sdk/file-upload/wrap-file-properties/src/api/resources/service/client/Client.ts b/seed/ts-sdk/file-upload/wrap-file-properties/src/api/resources/service/client/Client.ts index e76ff855338..32df912f7ea 100644 --- a/seed/ts-sdk/file-upload/wrap-file-properties/src/api/resources/service/client/Client.ts +++ b/seed/ts-sdk/file-upload/wrap-file-properties/src/api/resources/service/client/Client.ts @@ -37,19 +37,19 @@ export class Service { * }) */ public async post(request: SeedFileUpload.MyRequest, requestOptions?: Service.RequestOptions): Promise { - const _request = new core.FormDataWrapper(); + const _request = await core.newFormData(); if (request.maybeString != null) { await _request.append("maybeString", request.maybeString); } await _request.append("integer", request.integer.toString()); - await _request.append("file", request.file); + await _request.appendFile("file", request.file); for (const _file of request.fileList) { await _request.append("fileList", _file); } if (request.maybeFile != null) { - await _request.append("maybeFile", request.maybeFile); + await _request.appendFile("maybeFile", request.maybeFile); } if (request.maybeFileList != null) { @@ -72,7 +72,7 @@ export class Service { await _request.append("listOfObjects", JSON.stringify(_item)); } - const _maybeEncodedRequest = _request.getRequest(); + const _maybeEncodedRequest = await _request.getRequest(); const _response = await core.fetcher({ url: await core.Supplier.get(this._options.environment), method: "POST", @@ -82,9 +82,10 @@ export class Service { "X-Fern-SDK-Version": "0.0.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, - ...(await _maybeEncodedRequest.getHeaders()), + ...(await _maybeEncodedRequest.headers), }, - body: await _maybeEncodedRequest.getBody(), + requestType: "file", + body: await _maybeEncodedRequest.body, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -128,9 +129,9 @@ export class Service { request: SeedFileUpload.JustFileRequet, requestOptions?: Service.RequestOptions ): Promise { - const _request = new core.FormDataWrapper(); - await _request.append("file", request.file); - const _maybeEncodedRequest = _request.getRequest(); + const _request = await core.newFormData(); + await _request.appendFile("file", request.file); + const _maybeEncodedRequest = await _request.getRequest(); const _response = await core.fetcher({ url: urlJoin(await core.Supplier.get(this._options.environment), "/just-file"), method: "POST", @@ -140,9 +141,10 @@ export class Service { "X-Fern-SDK-Version": "0.0.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, - ...(await _maybeEncodedRequest.getHeaders()), + ...(await _maybeEncodedRequest.headers), }, - body: await _maybeEncodedRequest.getBody(), + requestType: "file", + body: await _maybeEncodedRequest.body, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -215,9 +217,9 @@ export class Service { } } - const _request = new core.FormDataWrapper(); - await _request.append("file", request.file); - const _maybeEncodedRequest = _request.getRequest(); + const _request = await core.newFormData(); + await _request.appendFile("file", request.file); + const _maybeEncodedRequest = await _request.getRequest(); const _response = await core.fetcher({ url: urlJoin(await core.Supplier.get(this._options.environment), "/just-file-with-query-params"), method: "POST", @@ -227,10 +229,11 @@ export class Service { "X-Fern-SDK-Version": "0.0.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, - ...(await _maybeEncodedRequest.getHeaders()), + ...(await _maybeEncodedRequest.headers), }, queryParameters: _queryParams, - body: await _maybeEncodedRequest.getBody(), + requestType: "file", + body: await _maybeEncodedRequest.body, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/seed/ts-sdk/file-upload/wrap-file-properties/src/core/fetcher/Fetcher.ts b/seed/ts-sdk/file-upload/wrap-file-properties/src/core/fetcher/Fetcher.ts index d3686367aa9..f3b010358d0 100644 --- a/seed/ts-sdk/file-upload/wrap-file-properties/src/core/fetcher/Fetcher.ts +++ b/seed/ts-sdk/file-upload/wrap-file-properties/src/core/fetcher/Fetcher.ts @@ -20,6 +20,7 @@ export declare namespace Fetcher { maxRetries?: number; withCredentials?: boolean; abortSignal?: AbortSignal; + requestType?: "json" | "file" | "bytes"; responseType?: "json" | "blob" | "streaming" | "text"; } @@ -62,7 +63,10 @@ export async function fetcherImpl(args: Fetcher.Args): Promise { - let requestBody: BodyInit; - if (RUNTIME.type === "node") { - if (body instanceof (await import("formdata-node")).FormData) { - // @ts-expect-error - requestBody = body; - } else if (body instanceof (await import("stream")).Readable) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } - } else { - if (body instanceof (await import("form-data")).default) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } +export declare namespace GetRequestBody { + interface Args { + body: unknown; + type: "json" | "file" | "bytes" | "other"; } - return requestBody; } -export const maybeStringifyBody = (requestBody: any, contentType: string): Uint8Array | string => { - if (requestBody instanceof Uint8Array) { - return requestBody; - } else if (contentType === "application/x-www-form-urlencoded" && typeof requestBody === "string") { - return requestBody; +export async function getRequestBody({ body, type }: GetRequestBody.Args): Promise { + if (type.includes("json")) { + return JSON.stringify(body); } else { - return JSON.stringify(requestBody); + return body as BodyInit; } -}; +} diff --git a/seed/ts-sdk/file-upload/wrap-file-properties/src/core/form-data-utils/FormDataWrapper.ts b/seed/ts-sdk/file-upload/wrap-file-properties/src/core/form-data-utils/FormDataWrapper.ts index 602173e5c36..124ba3eb2b3 100644 --- a/seed/ts-sdk/file-upload/wrap-file-properties/src/core/form-data-utils/FormDataWrapper.ts +++ b/seed/ts-sdk/file-upload/wrap-file-properties/src/core/form-data-utils/FormDataWrapper.ts @@ -1,72 +1,134 @@ -import { Readable } from "stream"; import { RUNTIME } from "../runtime"; -interface CrossPlatformFormData { - append(key: string, value: any): void; +export type MaybePromise = Promise | T; + +type FormDataRequest = { + body: Body; + headers: Record; +}; + +export interface CrossPlatformFormData { + setup(): Promise; + + append(key: string, value: unknown): void; + + appendFile(key: string, value: unknown, fileName?: string): Promise; + + getRequest(): MaybePromise>; +} + +export async function newFormData(): Promise { + let formdata: CrossPlatformFormData; + if (RUNTIME.type === "node" && RUNTIME.parsedVersion != null && RUNTIME.parsedVersion > 18) { + formdata = new Node19FormData(); + } else if (RUNTIME.type === "node") { + formdata = new Node16FormData(); + } else { + formdata = new WebFormData(); + } + await formdata.setup(); + return formdata; } -class FormDataRequestBody { - private fd: any; - private encoder: any; +/** + * Form Data Implementation for Node.js 18+ + */ +class Node19FormData implements CrossPlatformFormData { + private fd: + | { + append(name: string, value: unknown, fileName?: string): void; + } + | undefined; - constructor(fd: any) { - this.fd = fd; + public async setup() { + this.fd = new (await import("formdata-node")).FormData(); } - async setup(): Promise { - if (this.encoder == null && RUNTIME.type === "node") { - this.encoder = new (await import("form-data-encoder")).FormDataEncoder(this.fd); - } + public append(key: string, value: any): void { + this.fd?.append(key, value); } - /** - * @returns the multipart form data request - */ - public async getBody(): Promise { - if (RUNTIME.type !== "node") { - return this.fd; - } else { - if (this.encoder == null) { - await this.setup(); - } - return Readable.from(this.encoder); - } + public async appendFile(key: string, value: any, fileName?: string): Promise { + this.fd?.append(key, new (await import("buffer")).Blob([value]), fileName); + } + + public async getRequest(): Promise> { + const encoder = new (await import("form-data-encoder")).FormDataEncoder(this.fd as any); + return { + body: (await import("stream")).Readable.from(encoder), + headers: encoder.headers, + }; + } +} + +/** + * Form Data Implementation for Node.js 16-18 + */ +class Node16FormData implements CrossPlatformFormData { + private fd: + | { + append( + name: string, + value: unknown, + options?: { + header?: string | Headers; + knownLength?: number; + filename?: string; + filepath?: string; + contentType?: string; + } + ): void; + + getHeaders(): Record; + } + | undefined; + + public async setup(): Promise { + this.fd = new (await import("form-data")).default(); + } + + public append(key: string, value: any): void { + this.fd?.append(key, value); } - /** - * @returns headers that need to be added to the multipart form data request - */ - public async getHeaders(): Promise> { - if (RUNTIME.type !== "node") { - return {}; + public async appendFile(key: string, value: any, fileName?: string): Promise { + if (fileName == null) { + this.fd?.append(key, value); } else { - if (this.encoder == null) { - await this.setup(); - } - return this.encoder.headers; + this.fd?.append(key, value, { filename: fileName }); } } + + public getRequest(): FormDataRequest { + return { + body: this.fd, + headers: this.fd ? this.fd.getHeaders() : {}, + }; + } } /** - * FormDataWrapper is a utility to make form data - * requests across both Browser and Node.js runtimes. + * Form Data Implementation for Web */ -export class FormDataWrapper { - private fd: CrossPlatformFormData | undefined; - - public async append(name: string, value: any): Promise { - if (this.fd == null) { - if (RUNTIME.type === "node") { - this.fd = new (await import("formdata-node")).FormData(); - } else { - this.fd = new (await import("form-data")).default(); - } - } - this.fd.append(name, value); +class WebFormData implements CrossPlatformFormData { + private fd: { append(name: string, value: string | Blob, fileName?: string): void } | undefined; + + public async setup(): Promise { + this.fd = new FormData(); + } + + public append(key: string, value: any): void { + this.fd?.append(key, value); + } + + public async appendFile(key: string, value: any, fileName?: string): Promise { + this.fd?.append(key, new Blob([value]), fileName); } - public getRequest(): FormDataRequestBody { - return new FormDataRequestBody(this.fd); + public getRequest(): FormDataRequest { + return { + body: this.fd, + headers: {}, + }; } } diff --git a/seed/ts-sdk/file-upload/wrap-file-properties/src/core/runtime/runtime.ts b/seed/ts-sdk/file-upload/wrap-file-properties/src/core/runtime/runtime.ts index 30fe0779aaa..4d0687e8eb4 100644 --- a/seed/ts-sdk/file-upload/wrap-file-properties/src/core/runtime/runtime.ts +++ b/seed/ts-sdk/file-upload/wrap-file-properties/src/core/runtime/runtime.ts @@ -69,6 +69,7 @@ export const RUNTIME: Runtime = evaluateRuntime(); export interface Runtime { type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd"; version?: string; + parsedVersion?: number; } function evaluateRuntime(): Runtime { @@ -109,6 +110,7 @@ function evaluateRuntime(): Runtime { return { type: "node", version: process.versions.node, + parsedVersion: Number(process.versions.node.split(".")[0]), }; } diff --git a/seed/ts-sdk/folders/src/Client.ts b/seed/ts-sdk/folders/src/Client.ts index d668bae1f83..a6ef49e2917 100644 --- a/seed/ts-sdk/folders/src/Client.ts +++ b/seed/ts-sdk/folders/src/Client.ts @@ -43,6 +43,7 @@ export class SeedApiClient { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/seed/ts-sdk/folders/src/api/resources/a/resources/b/client/Client.ts b/seed/ts-sdk/folders/src/api/resources/a/resources/b/client/Client.ts index 1197fb28b11..4ecc143f7db 100644 --- a/seed/ts-sdk/folders/src/api/resources/a/resources/b/client/Client.ts +++ b/seed/ts-sdk/folders/src/api/resources/a/resources/b/client/Client.ts @@ -41,6 +41,7 @@ export class B { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/seed/ts-sdk/folders/src/api/resources/a/resources/c/client/Client.ts b/seed/ts-sdk/folders/src/api/resources/a/resources/c/client/Client.ts index 864cea5e6e1..6ca3d30ea31 100644 --- a/seed/ts-sdk/folders/src/api/resources/a/resources/c/client/Client.ts +++ b/seed/ts-sdk/folders/src/api/resources/a/resources/c/client/Client.ts @@ -41,6 +41,7 @@ export class C { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/seed/ts-sdk/folders/src/api/resources/folder/client/Client.ts b/seed/ts-sdk/folders/src/api/resources/folder/client/Client.ts index df3f04141d2..b6c6ba6b3fb 100644 --- a/seed/ts-sdk/folders/src/api/resources/folder/client/Client.ts +++ b/seed/ts-sdk/folders/src/api/resources/folder/client/Client.ts @@ -42,6 +42,7 @@ export class Folder { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/seed/ts-sdk/folders/src/api/resources/folder/resources/service/client/Client.ts b/seed/ts-sdk/folders/src/api/resources/folder/resources/service/client/Client.ts index 1854d075ee8..768b4ad0d25 100644 --- a/seed/ts-sdk/folders/src/api/resources/folder/resources/service/client/Client.ts +++ b/seed/ts-sdk/folders/src/api/resources/folder/resources/service/client/Client.ts @@ -44,6 +44,7 @@ export class Service { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -97,6 +98,7 @@ export class Service { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: request, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, diff --git a/seed/ts-sdk/folders/src/core/fetcher/Fetcher.ts b/seed/ts-sdk/folders/src/core/fetcher/Fetcher.ts index d3686367aa9..f3b010358d0 100644 --- a/seed/ts-sdk/folders/src/core/fetcher/Fetcher.ts +++ b/seed/ts-sdk/folders/src/core/fetcher/Fetcher.ts @@ -20,6 +20,7 @@ export declare namespace Fetcher { maxRetries?: number; withCredentials?: boolean; abortSignal?: AbortSignal; + requestType?: "json" | "file" | "bytes"; responseType?: "json" | "blob" | "streaming" | "text"; } @@ -62,7 +63,10 @@ export async function fetcherImpl(args: Fetcher.Args): Promise { - let requestBody: BodyInit; - if (RUNTIME.type === "node") { - if (body instanceof (await import("formdata-node")).FormData) { - // @ts-expect-error - requestBody = body; - } else if (body instanceof (await import("stream")).Readable) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } - } else { - if (body instanceof (await import("form-data")).default) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } +export declare namespace GetRequestBody { + interface Args { + body: unknown; + type: "json" | "file" | "bytes" | "other"; } - return requestBody; } -export const maybeStringifyBody = (requestBody: any, contentType: string): Uint8Array | string => { - if (requestBody instanceof Uint8Array) { - return requestBody; - } else if (contentType === "application/x-www-form-urlencoded" && typeof requestBody === "string") { - return requestBody; +export async function getRequestBody({ body, type }: GetRequestBody.Args): Promise { + if (type.includes("json")) { + return JSON.stringify(body); } else { - return JSON.stringify(requestBody); + return body as BodyInit; } -}; +} diff --git a/seed/ts-sdk/folders/src/core/runtime/runtime.ts b/seed/ts-sdk/folders/src/core/runtime/runtime.ts index 30fe0779aaa..4d0687e8eb4 100644 --- a/seed/ts-sdk/folders/src/core/runtime/runtime.ts +++ b/seed/ts-sdk/folders/src/core/runtime/runtime.ts @@ -69,6 +69,7 @@ export const RUNTIME: Runtime = evaluateRuntime(); export interface Runtime { type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd"; version?: string; + parsedVersion?: number; } function evaluateRuntime(): Runtime { @@ -109,6 +110,7 @@ function evaluateRuntime(): Runtime { return { type: "node", version: process.versions.node, + parsedVersion: Number(process.versions.node.split(".")[0]), }; } diff --git a/seed/ts-sdk/idempotency-headers/src/api/resources/payment/client/Client.ts b/seed/ts-sdk/idempotency-headers/src/api/resources/payment/client/Client.ts index 2059cc7c2be..51b96f254b8 100644 --- a/seed/ts-sdk/idempotency-headers/src/api/resources/payment/client/Client.ts +++ b/seed/ts-sdk/idempotency-headers/src/api/resources/payment/client/Client.ts @@ -60,6 +60,7 @@ export class Payment { "Idempotency-Expiration": requestOptions?.idempotencyExpiration.toString(), }, contentType: "application/json", + requestType: "json", body: serializers.CreatePaymentRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -119,6 +120,7 @@ export class Payment { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/seed/ts-sdk/idempotency-headers/src/core/fetcher/Fetcher.ts b/seed/ts-sdk/idempotency-headers/src/core/fetcher/Fetcher.ts index d3686367aa9..f3b010358d0 100644 --- a/seed/ts-sdk/idempotency-headers/src/core/fetcher/Fetcher.ts +++ b/seed/ts-sdk/idempotency-headers/src/core/fetcher/Fetcher.ts @@ -20,6 +20,7 @@ export declare namespace Fetcher { maxRetries?: number; withCredentials?: boolean; abortSignal?: AbortSignal; + requestType?: "json" | "file" | "bytes"; responseType?: "json" | "blob" | "streaming" | "text"; } @@ -62,7 +63,10 @@ export async function fetcherImpl(args: Fetcher.Args): Promise { - let requestBody: BodyInit; - if (RUNTIME.type === "node") { - if (body instanceof (await import("formdata-node")).FormData) { - // @ts-expect-error - requestBody = body; - } else if (body instanceof (await import("stream")).Readable) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } - } else { - if (body instanceof (await import("form-data")).default) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } +export declare namespace GetRequestBody { + interface Args { + body: unknown; + type: "json" | "file" | "bytes" | "other"; } - return requestBody; } -export const maybeStringifyBody = (requestBody: any, contentType: string): Uint8Array | string => { - if (requestBody instanceof Uint8Array) { - return requestBody; - } else if (contentType === "application/x-www-form-urlencoded" && typeof requestBody === "string") { - return requestBody; +export async function getRequestBody({ body, type }: GetRequestBody.Args): Promise { + if (type.includes("json")) { + return JSON.stringify(body); } else { - return JSON.stringify(requestBody); + return body as BodyInit; } -}; +} diff --git a/seed/ts-sdk/idempotency-headers/src/core/runtime/runtime.ts b/seed/ts-sdk/idempotency-headers/src/core/runtime/runtime.ts index 30fe0779aaa..4d0687e8eb4 100644 --- a/seed/ts-sdk/idempotency-headers/src/core/runtime/runtime.ts +++ b/seed/ts-sdk/idempotency-headers/src/core/runtime/runtime.ts @@ -69,6 +69,7 @@ export const RUNTIME: Runtime = evaluateRuntime(); export interface Runtime { type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd"; version?: string; + parsedVersion?: number; } function evaluateRuntime(): Runtime { @@ -109,6 +110,7 @@ function evaluateRuntime(): Runtime { return { type: "node", version: process.versions.node, + parsedVersion: Number(process.versions.node.split(".")[0]), }; } diff --git a/seed/ts-sdk/imdb/no-custom-config/src/api/resources/imdb/client/Client.ts b/seed/ts-sdk/imdb/no-custom-config/src/api/resources/imdb/client/Client.ts index 2c174debc12..8cd113bd1b9 100644 --- a/seed/ts-sdk/imdb/no-custom-config/src/api/resources/imdb/client/Client.ts +++ b/seed/ts-sdk/imdb/no-custom-config/src/api/resources/imdb/client/Client.ts @@ -55,6 +55,7 @@ export class Imdb { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.CreateMovieRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -116,6 +117,7 @@ export class Imdb { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/seed/ts-sdk/imdb/no-custom-config/src/core/fetcher/Fetcher.ts b/seed/ts-sdk/imdb/no-custom-config/src/core/fetcher/Fetcher.ts index d3686367aa9..f3b010358d0 100644 --- a/seed/ts-sdk/imdb/no-custom-config/src/core/fetcher/Fetcher.ts +++ b/seed/ts-sdk/imdb/no-custom-config/src/core/fetcher/Fetcher.ts @@ -20,6 +20,7 @@ export declare namespace Fetcher { maxRetries?: number; withCredentials?: boolean; abortSignal?: AbortSignal; + requestType?: "json" | "file" | "bytes"; responseType?: "json" | "blob" | "streaming" | "text"; } @@ -62,7 +63,10 @@ export async function fetcherImpl(args: Fetcher.Args): Promise { - let requestBody: BodyInit; - if (RUNTIME.type === "node") { - if (body instanceof (await import("formdata-node")).FormData) { - // @ts-expect-error - requestBody = body; - } else if (body instanceof (await import("stream")).Readable) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } - } else { - if (body instanceof (await import("form-data")).default) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } +export declare namespace GetRequestBody { + interface Args { + body: unknown; + type: "json" | "file" | "bytes" | "other"; } - return requestBody; } -export const maybeStringifyBody = (requestBody: any, contentType: string): Uint8Array | string => { - if (requestBody instanceof Uint8Array) { - return requestBody; - } else if (contentType === "application/x-www-form-urlencoded" && typeof requestBody === "string") { - return requestBody; +export async function getRequestBody({ body, type }: GetRequestBody.Args): Promise { + if (type.includes("json")) { + return JSON.stringify(body); } else { - return JSON.stringify(requestBody); + return body as BodyInit; } -}; +} diff --git a/seed/ts-sdk/imdb/no-custom-config/src/core/runtime/runtime.ts b/seed/ts-sdk/imdb/no-custom-config/src/core/runtime/runtime.ts index 30fe0779aaa..4d0687e8eb4 100644 --- a/seed/ts-sdk/imdb/no-custom-config/src/core/runtime/runtime.ts +++ b/seed/ts-sdk/imdb/no-custom-config/src/core/runtime/runtime.ts @@ -69,6 +69,7 @@ export const RUNTIME: Runtime = evaluateRuntime(); export interface Runtime { type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd"; version?: string; + parsedVersion?: number; } function evaluateRuntime(): Runtime { @@ -109,6 +110,7 @@ function evaluateRuntime(): Runtime { return { type: "node", version: process.versions.node, + parsedVersion: Number(process.versions.node.split(".")[0]), }; } diff --git a/seed/ts-sdk/imdb/omit-undefined/src/api/resources/imdb/client/Client.ts b/seed/ts-sdk/imdb/omit-undefined/src/api/resources/imdb/client/Client.ts index 30c96aacf0d..f33b5d2474b 100644 --- a/seed/ts-sdk/imdb/omit-undefined/src/api/resources/imdb/client/Client.ts +++ b/seed/ts-sdk/imdb/omit-undefined/src/api/resources/imdb/client/Client.ts @@ -55,6 +55,7 @@ export class Imdb { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.CreateMovieRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", omitUndefined: true, @@ -119,6 +120,7 @@ export class Imdb { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/seed/ts-sdk/imdb/omit-undefined/src/core/fetcher/Fetcher.ts b/seed/ts-sdk/imdb/omit-undefined/src/core/fetcher/Fetcher.ts index d3686367aa9..f3b010358d0 100644 --- a/seed/ts-sdk/imdb/omit-undefined/src/core/fetcher/Fetcher.ts +++ b/seed/ts-sdk/imdb/omit-undefined/src/core/fetcher/Fetcher.ts @@ -20,6 +20,7 @@ export declare namespace Fetcher { maxRetries?: number; withCredentials?: boolean; abortSignal?: AbortSignal; + requestType?: "json" | "file" | "bytes"; responseType?: "json" | "blob" | "streaming" | "text"; } @@ -62,7 +63,10 @@ export async function fetcherImpl(args: Fetcher.Args): Promise { - let requestBody: BodyInit; - if (RUNTIME.type === "node") { - if (body instanceof (await import("formdata-node")).FormData) { - // @ts-expect-error - requestBody = body; - } else if (body instanceof (await import("stream")).Readable) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } - } else { - if (body instanceof (await import("form-data")).default) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } +export declare namespace GetRequestBody { + interface Args { + body: unknown; + type: "json" | "file" | "bytes" | "other"; } - return requestBody; } -export const maybeStringifyBody = (requestBody: any, contentType: string): Uint8Array | string => { - if (requestBody instanceof Uint8Array) { - return requestBody; - } else if (contentType === "application/x-www-form-urlencoded" && typeof requestBody === "string") { - return requestBody; +export async function getRequestBody({ body, type }: GetRequestBody.Args): Promise { + if (type.includes("json")) { + return JSON.stringify(body); } else { - return JSON.stringify(requestBody); + return body as BodyInit; } -}; +} diff --git a/seed/ts-sdk/imdb/omit-undefined/src/core/runtime/runtime.ts b/seed/ts-sdk/imdb/omit-undefined/src/core/runtime/runtime.ts index 30fe0779aaa..4d0687e8eb4 100644 --- a/seed/ts-sdk/imdb/omit-undefined/src/core/runtime/runtime.ts +++ b/seed/ts-sdk/imdb/omit-undefined/src/core/runtime/runtime.ts @@ -69,6 +69,7 @@ export const RUNTIME: Runtime = evaluateRuntime(); export interface Runtime { type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd"; version?: string; + parsedVersion?: number; } function evaluateRuntime(): Runtime { @@ -109,6 +110,7 @@ function evaluateRuntime(): Runtime { return { type: "node", version: process.versions.node, + parsedVersion: Number(process.versions.node.split(".")[0]), }; } diff --git a/seed/ts-sdk/literal/src/api/resources/headers/client/Client.ts b/seed/ts-sdk/literal/src/api/resources/headers/client/Client.ts index e65c1aafada..5a7dc8dc4c0 100644 --- a/seed/ts-sdk/literal/src/api/resources/headers/client/Client.ts +++ b/seed/ts-sdk/literal/src/api/resources/headers/client/Client.ts @@ -66,6 +66,7 @@ export class Headers { "X-Async": "true", }, contentType: "application/json", + requestType: "json", body: serializers.SendLiteralsInHeadersRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, diff --git a/seed/ts-sdk/literal/src/api/resources/inlined/client/Client.ts b/seed/ts-sdk/literal/src/api/resources/inlined/client/Client.ts index 4a8f8e524e9..ad0d345f62d 100644 --- a/seed/ts-sdk/literal/src/api/resources/inlined/client/Client.ts +++ b/seed/ts-sdk/literal/src/api/resources/inlined/client/Client.ts @@ -65,6 +65,7 @@ export class Inlined { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: { ...serializers.SendLiteralsInlinedRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), prompt: "You are a helpful assistant", diff --git a/seed/ts-sdk/literal/src/api/resources/path/client/Client.ts b/seed/ts-sdk/literal/src/api/resources/path/client/Client.ts index 61c47b6d2cd..4a20805dab3 100644 --- a/seed/ts-sdk/literal/src/api/resources/path/client/Client.ts +++ b/seed/ts-sdk/literal/src/api/resources/path/client/Client.ts @@ -59,6 +59,7 @@ export class Path { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/seed/ts-sdk/literal/src/api/resources/query/client/Client.ts b/seed/ts-sdk/literal/src/api/resources/query/client/Client.ts index 944ed93ce3e..49899e8b861 100644 --- a/seed/ts-sdk/literal/src/api/resources/query/client/Client.ts +++ b/seed/ts-sdk/literal/src/api/resources/query/client/Client.ts @@ -70,6 +70,7 @@ export class Query { }, contentType: "application/json", queryParameters: _queryParams, + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/seed/ts-sdk/literal/src/api/resources/reference/client/Client.ts b/seed/ts-sdk/literal/src/api/resources/reference/client/Client.ts index c67c1f28d3a..5fca79293ac 100644 --- a/seed/ts-sdk/literal/src/api/resources/reference/client/Client.ts +++ b/seed/ts-sdk/literal/src/api/resources/reference/client/Client.ts @@ -66,6 +66,7 @@ export class Reference { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.SendRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, diff --git a/seed/ts-sdk/literal/src/core/fetcher/Fetcher.ts b/seed/ts-sdk/literal/src/core/fetcher/Fetcher.ts index d3686367aa9..f3b010358d0 100644 --- a/seed/ts-sdk/literal/src/core/fetcher/Fetcher.ts +++ b/seed/ts-sdk/literal/src/core/fetcher/Fetcher.ts @@ -20,6 +20,7 @@ export declare namespace Fetcher { maxRetries?: number; withCredentials?: boolean; abortSignal?: AbortSignal; + requestType?: "json" | "file" | "bytes"; responseType?: "json" | "blob" | "streaming" | "text"; } @@ -62,7 +63,10 @@ export async function fetcherImpl(args: Fetcher.Args): Promise { - let requestBody: BodyInit; - if (RUNTIME.type === "node") { - if (body instanceof (await import("formdata-node")).FormData) { - // @ts-expect-error - requestBody = body; - } else if (body instanceof (await import("stream")).Readable) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } - } else { - if (body instanceof (await import("form-data")).default) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } +export declare namespace GetRequestBody { + interface Args { + body: unknown; + type: "json" | "file" | "bytes" | "other"; } - return requestBody; } -export const maybeStringifyBody = (requestBody: any, contentType: string): Uint8Array | string => { - if (requestBody instanceof Uint8Array) { - return requestBody; - } else if (contentType === "application/x-www-form-urlencoded" && typeof requestBody === "string") { - return requestBody; +export async function getRequestBody({ body, type }: GetRequestBody.Args): Promise { + if (type.includes("json")) { + return JSON.stringify(body); } else { - return JSON.stringify(requestBody); + return body as BodyInit; } -}; +} diff --git a/seed/ts-sdk/literal/src/core/runtime/runtime.ts b/seed/ts-sdk/literal/src/core/runtime/runtime.ts index 30fe0779aaa..4d0687e8eb4 100644 --- a/seed/ts-sdk/literal/src/core/runtime/runtime.ts +++ b/seed/ts-sdk/literal/src/core/runtime/runtime.ts @@ -69,6 +69,7 @@ export const RUNTIME: Runtime = evaluateRuntime(); export interface Runtime { type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd"; version?: string; + parsedVersion?: number; } function evaluateRuntime(): Runtime { @@ -109,6 +110,7 @@ function evaluateRuntime(): Runtime { return { type: "node", version: process.versions.node, + parsedVersion: Number(process.versions.node.split(".")[0]), }; } diff --git a/seed/ts-sdk/mixed-case/no-custom-config/src/api/resources/service/client/Client.ts b/seed/ts-sdk/mixed-case/no-custom-config/src/api/resources/service/client/Client.ts index 9b221908200..6a697f0b1a2 100644 --- a/seed/ts-sdk/mixed-case/no-custom-config/src/api/resources/service/client/Client.ts +++ b/seed/ts-sdk/mixed-case/no-custom-config/src/api/resources/service/client/Client.ts @@ -51,6 +51,7 @@ export class Service { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -116,6 +117,7 @@ export class Service { }, contentType: "application/json", queryParameters: _queryParams, + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/seed/ts-sdk/mixed-case/no-custom-config/src/core/fetcher/Fetcher.ts b/seed/ts-sdk/mixed-case/no-custom-config/src/core/fetcher/Fetcher.ts index d3686367aa9..f3b010358d0 100644 --- a/seed/ts-sdk/mixed-case/no-custom-config/src/core/fetcher/Fetcher.ts +++ b/seed/ts-sdk/mixed-case/no-custom-config/src/core/fetcher/Fetcher.ts @@ -20,6 +20,7 @@ export declare namespace Fetcher { maxRetries?: number; withCredentials?: boolean; abortSignal?: AbortSignal; + requestType?: "json" | "file" | "bytes"; responseType?: "json" | "blob" | "streaming" | "text"; } @@ -62,7 +63,10 @@ export async function fetcherImpl(args: Fetcher.Args): Promise { - let requestBody: BodyInit; - if (RUNTIME.type === "node") { - if (body instanceof (await import("formdata-node")).FormData) { - // @ts-expect-error - requestBody = body; - } else if (body instanceof (await import("stream")).Readable) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } - } else { - if (body instanceof (await import("form-data")).default) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } +export declare namespace GetRequestBody { + interface Args { + body: unknown; + type: "json" | "file" | "bytes" | "other"; } - return requestBody; } -export const maybeStringifyBody = (requestBody: any, contentType: string): Uint8Array | string => { - if (requestBody instanceof Uint8Array) { - return requestBody; - } else if (contentType === "application/x-www-form-urlencoded" && typeof requestBody === "string") { - return requestBody; +export async function getRequestBody({ body, type }: GetRequestBody.Args): Promise { + if (type.includes("json")) { + return JSON.stringify(body); } else { - return JSON.stringify(requestBody); + return body as BodyInit; } -}; +} diff --git a/seed/ts-sdk/mixed-case/no-custom-config/src/core/runtime/runtime.ts b/seed/ts-sdk/mixed-case/no-custom-config/src/core/runtime/runtime.ts index 30fe0779aaa..4d0687e8eb4 100644 --- a/seed/ts-sdk/mixed-case/no-custom-config/src/core/runtime/runtime.ts +++ b/seed/ts-sdk/mixed-case/no-custom-config/src/core/runtime/runtime.ts @@ -69,6 +69,7 @@ export const RUNTIME: Runtime = evaluateRuntime(); export interface Runtime { type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd"; version?: string; + parsedVersion?: number; } function evaluateRuntime(): Runtime { @@ -109,6 +110,7 @@ function evaluateRuntime(): Runtime { return { type: "node", version: process.versions.node, + parsedVersion: Number(process.versions.node.split(".")[0]), }; } diff --git a/seed/ts-sdk/mixed-case/retain-original-casing/src/api/resources/service/client/Client.ts b/seed/ts-sdk/mixed-case/retain-original-casing/src/api/resources/service/client/Client.ts index 1cd7c08a66b..3ba07230e18 100644 --- a/seed/ts-sdk/mixed-case/retain-original-casing/src/api/resources/service/client/Client.ts +++ b/seed/ts-sdk/mixed-case/retain-original-casing/src/api/resources/service/client/Client.ts @@ -51,6 +51,7 @@ export class Service { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -116,6 +117,7 @@ export class Service { }, contentType: "application/json", queryParameters: _queryParams, + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/seed/ts-sdk/mixed-case/retain-original-casing/src/core/fetcher/Fetcher.ts b/seed/ts-sdk/mixed-case/retain-original-casing/src/core/fetcher/Fetcher.ts index d3686367aa9..f3b010358d0 100644 --- a/seed/ts-sdk/mixed-case/retain-original-casing/src/core/fetcher/Fetcher.ts +++ b/seed/ts-sdk/mixed-case/retain-original-casing/src/core/fetcher/Fetcher.ts @@ -20,6 +20,7 @@ export declare namespace Fetcher { maxRetries?: number; withCredentials?: boolean; abortSignal?: AbortSignal; + requestType?: "json" | "file" | "bytes"; responseType?: "json" | "blob" | "streaming" | "text"; } @@ -62,7 +63,10 @@ export async function fetcherImpl(args: Fetcher.Args): Promise { - let requestBody: BodyInit; - if (RUNTIME.type === "node") { - if (body instanceof (await import("formdata-node")).FormData) { - // @ts-expect-error - requestBody = body; - } else if (body instanceof (await import("stream")).Readable) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } - } else { - if (body instanceof (await import("form-data")).default) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } +export declare namespace GetRequestBody { + interface Args { + body: unknown; + type: "json" | "file" | "bytes" | "other"; } - return requestBody; } -export const maybeStringifyBody = (requestBody: any, contentType: string): Uint8Array | string => { - if (requestBody instanceof Uint8Array) { - return requestBody; - } else if (contentType === "application/x-www-form-urlencoded" && typeof requestBody === "string") { - return requestBody; +export async function getRequestBody({ body, type }: GetRequestBody.Args): Promise { + if (type.includes("json")) { + return JSON.stringify(body); } else { - return JSON.stringify(requestBody); + return body as BodyInit; } -}; +} diff --git a/seed/ts-sdk/mixed-case/retain-original-casing/src/core/runtime/runtime.ts b/seed/ts-sdk/mixed-case/retain-original-casing/src/core/runtime/runtime.ts index 30fe0779aaa..4d0687e8eb4 100644 --- a/seed/ts-sdk/mixed-case/retain-original-casing/src/core/runtime/runtime.ts +++ b/seed/ts-sdk/mixed-case/retain-original-casing/src/core/runtime/runtime.ts @@ -69,6 +69,7 @@ export const RUNTIME: Runtime = evaluateRuntime(); export interface Runtime { type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd"; version?: string; + parsedVersion?: number; } function evaluateRuntime(): Runtime { @@ -109,6 +110,7 @@ function evaluateRuntime(): Runtime { return { type: "node", version: process.versions.node, + parsedVersion: Number(process.versions.node.split(".")[0]), }; } diff --git a/seed/ts-sdk/multi-line-docs/src/api/resources/user/client/Client.ts b/seed/ts-sdk/multi-line-docs/src/api/resources/user/client/Client.ts index e165877d592..09d52622e7e 100644 --- a/seed/ts-sdk/multi-line-docs/src/api/resources/user/client/Client.ts +++ b/seed/ts-sdk/multi-line-docs/src/api/resources/user/client/Client.ts @@ -49,6 +49,7 @@ export class User { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -107,6 +108,7 @@ export class User { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.CreateUserRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, diff --git a/seed/ts-sdk/multi-line-docs/src/core/fetcher/Fetcher.ts b/seed/ts-sdk/multi-line-docs/src/core/fetcher/Fetcher.ts index d3686367aa9..f3b010358d0 100644 --- a/seed/ts-sdk/multi-line-docs/src/core/fetcher/Fetcher.ts +++ b/seed/ts-sdk/multi-line-docs/src/core/fetcher/Fetcher.ts @@ -20,6 +20,7 @@ export declare namespace Fetcher { maxRetries?: number; withCredentials?: boolean; abortSignal?: AbortSignal; + requestType?: "json" | "file" | "bytes"; responseType?: "json" | "blob" | "streaming" | "text"; } @@ -62,7 +63,10 @@ export async function fetcherImpl(args: Fetcher.Args): Promise { - let requestBody: BodyInit; - if (RUNTIME.type === "node") { - if (body instanceof (await import("formdata-node")).FormData) { - // @ts-expect-error - requestBody = body; - } else if (body instanceof (await import("stream")).Readable) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } - } else { - if (body instanceof (await import("form-data")).default) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } +export declare namespace GetRequestBody { + interface Args { + body: unknown; + type: "json" | "file" | "bytes" | "other"; } - return requestBody; } -export const maybeStringifyBody = (requestBody: any, contentType: string): Uint8Array | string => { - if (requestBody instanceof Uint8Array) { - return requestBody; - } else if (contentType === "application/x-www-form-urlencoded" && typeof requestBody === "string") { - return requestBody; +export async function getRequestBody({ body, type }: GetRequestBody.Args): Promise { + if (type.includes("json")) { + return JSON.stringify(body); } else { - return JSON.stringify(requestBody); + return body as BodyInit; } -}; +} diff --git a/seed/ts-sdk/multi-line-docs/src/core/runtime/runtime.ts b/seed/ts-sdk/multi-line-docs/src/core/runtime/runtime.ts index 30fe0779aaa..4d0687e8eb4 100644 --- a/seed/ts-sdk/multi-line-docs/src/core/runtime/runtime.ts +++ b/seed/ts-sdk/multi-line-docs/src/core/runtime/runtime.ts @@ -69,6 +69,7 @@ export const RUNTIME: Runtime = evaluateRuntime(); export interface Runtime { type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd"; version?: string; + parsedVersion?: number; } function evaluateRuntime(): Runtime { @@ -109,6 +110,7 @@ function evaluateRuntime(): Runtime { return { type: "node", version: process.versions.node, + parsedVersion: Number(process.versions.node.split(".")[0]), }; } diff --git a/seed/ts-sdk/multi-url-environment-no-default/src/api/resources/ec2/client/Client.ts b/seed/ts-sdk/multi-url-environment-no-default/src/api/resources/ec2/client/Client.ts index cb0bf7506aa..cd60e4eadaa 100644 --- a/seed/ts-sdk/multi-url-environment-no-default/src/api/resources/ec2/client/Client.ts +++ b/seed/ts-sdk/multi-url-environment-no-default/src/api/resources/ec2/client/Client.ts @@ -56,6 +56,7 @@ export class Ec2 { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.BootInstanceRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, diff --git a/seed/ts-sdk/multi-url-environment-no-default/src/api/resources/s3/client/Client.ts b/seed/ts-sdk/multi-url-environment-no-default/src/api/resources/s3/client/Client.ts index 24fbe9bf0ed..95f86ab4fef 100644 --- a/seed/ts-sdk/multi-url-environment-no-default/src/api/resources/s3/client/Client.ts +++ b/seed/ts-sdk/multi-url-environment-no-default/src/api/resources/s3/client/Client.ts @@ -56,6 +56,7 @@ export class S3 { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.GetPresignedUrlRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, diff --git a/seed/ts-sdk/multi-url-environment-no-default/src/core/fetcher/Fetcher.ts b/seed/ts-sdk/multi-url-environment-no-default/src/core/fetcher/Fetcher.ts index d3686367aa9..f3b010358d0 100644 --- a/seed/ts-sdk/multi-url-environment-no-default/src/core/fetcher/Fetcher.ts +++ b/seed/ts-sdk/multi-url-environment-no-default/src/core/fetcher/Fetcher.ts @@ -20,6 +20,7 @@ export declare namespace Fetcher { maxRetries?: number; withCredentials?: boolean; abortSignal?: AbortSignal; + requestType?: "json" | "file" | "bytes"; responseType?: "json" | "blob" | "streaming" | "text"; } @@ -62,7 +63,10 @@ export async function fetcherImpl(args: Fetcher.Args): Promise { - let requestBody: BodyInit; - if (RUNTIME.type === "node") { - if (body instanceof (await import("formdata-node")).FormData) { - // @ts-expect-error - requestBody = body; - } else if (body instanceof (await import("stream")).Readable) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } - } else { - if (body instanceof (await import("form-data")).default) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } +export declare namespace GetRequestBody { + interface Args { + body: unknown; + type: "json" | "file" | "bytes" | "other"; } - return requestBody; } -export const maybeStringifyBody = (requestBody: any, contentType: string): Uint8Array | string => { - if (requestBody instanceof Uint8Array) { - return requestBody; - } else if (contentType === "application/x-www-form-urlencoded" && typeof requestBody === "string") { - return requestBody; +export async function getRequestBody({ body, type }: GetRequestBody.Args): Promise { + if (type.includes("json")) { + return JSON.stringify(body); } else { - return JSON.stringify(requestBody); + return body as BodyInit; } -}; +} diff --git a/seed/ts-sdk/multi-url-environment-no-default/src/core/runtime/runtime.ts b/seed/ts-sdk/multi-url-environment-no-default/src/core/runtime/runtime.ts index 30fe0779aaa..4d0687e8eb4 100644 --- a/seed/ts-sdk/multi-url-environment-no-default/src/core/runtime/runtime.ts +++ b/seed/ts-sdk/multi-url-environment-no-default/src/core/runtime/runtime.ts @@ -69,6 +69,7 @@ export const RUNTIME: Runtime = evaluateRuntime(); export interface Runtime { type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd"; version?: string; + parsedVersion?: number; } function evaluateRuntime(): Runtime { @@ -109,6 +110,7 @@ function evaluateRuntime(): Runtime { return { type: "node", version: process.versions.node, + parsedVersion: Number(process.versions.node.split(".")[0]), }; } diff --git a/seed/ts-sdk/multi-url-environment/src/api/resources/ec2/client/Client.ts b/seed/ts-sdk/multi-url-environment/src/api/resources/ec2/client/Client.ts index e10fb2eede4..15aa9cc2b71 100644 --- a/seed/ts-sdk/multi-url-environment/src/api/resources/ec2/client/Client.ts +++ b/seed/ts-sdk/multi-url-environment/src/api/resources/ec2/client/Client.ts @@ -61,6 +61,7 @@ export class Ec2 { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.BootInstanceRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, diff --git a/seed/ts-sdk/multi-url-environment/src/api/resources/s3/client/Client.ts b/seed/ts-sdk/multi-url-environment/src/api/resources/s3/client/Client.ts index b4a3068f0bf..1efe1323c54 100644 --- a/seed/ts-sdk/multi-url-environment/src/api/resources/s3/client/Client.ts +++ b/seed/ts-sdk/multi-url-environment/src/api/resources/s3/client/Client.ts @@ -61,6 +61,7 @@ export class S3 { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.GetPresignedUrlRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, diff --git a/seed/ts-sdk/multi-url-environment/src/core/fetcher/Fetcher.ts b/seed/ts-sdk/multi-url-environment/src/core/fetcher/Fetcher.ts index d3686367aa9..f3b010358d0 100644 --- a/seed/ts-sdk/multi-url-environment/src/core/fetcher/Fetcher.ts +++ b/seed/ts-sdk/multi-url-environment/src/core/fetcher/Fetcher.ts @@ -20,6 +20,7 @@ export declare namespace Fetcher { maxRetries?: number; withCredentials?: boolean; abortSignal?: AbortSignal; + requestType?: "json" | "file" | "bytes"; responseType?: "json" | "blob" | "streaming" | "text"; } @@ -62,7 +63,10 @@ export async function fetcherImpl(args: Fetcher.Args): Promise { - let requestBody: BodyInit; - if (RUNTIME.type === "node") { - if (body instanceof (await import("formdata-node")).FormData) { - // @ts-expect-error - requestBody = body; - } else if (body instanceof (await import("stream")).Readable) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } - } else { - if (body instanceof (await import("form-data")).default) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } +export declare namespace GetRequestBody { + interface Args { + body: unknown; + type: "json" | "file" | "bytes" | "other"; } - return requestBody; } -export const maybeStringifyBody = (requestBody: any, contentType: string): Uint8Array | string => { - if (requestBody instanceof Uint8Array) { - return requestBody; - } else if (contentType === "application/x-www-form-urlencoded" && typeof requestBody === "string") { - return requestBody; +export async function getRequestBody({ body, type }: GetRequestBody.Args): Promise { + if (type.includes("json")) { + return JSON.stringify(body); } else { - return JSON.stringify(requestBody); + return body as BodyInit; } -}; +} diff --git a/seed/ts-sdk/multi-url-environment/src/core/runtime/runtime.ts b/seed/ts-sdk/multi-url-environment/src/core/runtime/runtime.ts index 30fe0779aaa..4d0687e8eb4 100644 --- a/seed/ts-sdk/multi-url-environment/src/core/runtime/runtime.ts +++ b/seed/ts-sdk/multi-url-environment/src/core/runtime/runtime.ts @@ -69,6 +69,7 @@ export const RUNTIME: Runtime = evaluateRuntime(); export interface Runtime { type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd"; version?: string; + parsedVersion?: number; } function evaluateRuntime(): Runtime { @@ -109,6 +110,7 @@ function evaluateRuntime(): Runtime { return { type: "node", version: process.versions.node, + parsedVersion: Number(process.versions.node.split(".")[0]), }; } diff --git a/seed/ts-sdk/no-environment/src/api/resources/dummy/client/Client.ts b/seed/ts-sdk/no-environment/src/api/resources/dummy/client/Client.ts index 06b5919024f..45886d405d5 100644 --- a/seed/ts-sdk/no-environment/src/api/resources/dummy/client/Client.ts +++ b/seed/ts-sdk/no-environment/src/api/resources/dummy/client/Client.ts @@ -45,6 +45,7 @@ export class Dummy { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/seed/ts-sdk/no-environment/src/core/fetcher/Fetcher.ts b/seed/ts-sdk/no-environment/src/core/fetcher/Fetcher.ts index d3686367aa9..f3b010358d0 100644 --- a/seed/ts-sdk/no-environment/src/core/fetcher/Fetcher.ts +++ b/seed/ts-sdk/no-environment/src/core/fetcher/Fetcher.ts @@ -20,6 +20,7 @@ export declare namespace Fetcher { maxRetries?: number; withCredentials?: boolean; abortSignal?: AbortSignal; + requestType?: "json" | "file" | "bytes"; responseType?: "json" | "blob" | "streaming" | "text"; } @@ -62,7 +63,10 @@ export async function fetcherImpl(args: Fetcher.Args): Promise { - let requestBody: BodyInit; - if (RUNTIME.type === "node") { - if (body instanceof (await import("formdata-node")).FormData) { - // @ts-expect-error - requestBody = body; - } else if (body instanceof (await import("stream")).Readable) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } - } else { - if (body instanceof (await import("form-data")).default) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } +export declare namespace GetRequestBody { + interface Args { + body: unknown; + type: "json" | "file" | "bytes" | "other"; } - return requestBody; } -export const maybeStringifyBody = (requestBody: any, contentType: string): Uint8Array | string => { - if (requestBody instanceof Uint8Array) { - return requestBody; - } else if (contentType === "application/x-www-form-urlencoded" && typeof requestBody === "string") { - return requestBody; +export async function getRequestBody({ body, type }: GetRequestBody.Args): Promise { + if (type.includes("json")) { + return JSON.stringify(body); } else { - return JSON.stringify(requestBody); + return body as BodyInit; } -}; +} diff --git a/seed/ts-sdk/no-environment/src/core/runtime/runtime.ts b/seed/ts-sdk/no-environment/src/core/runtime/runtime.ts index 30fe0779aaa..4d0687e8eb4 100644 --- a/seed/ts-sdk/no-environment/src/core/runtime/runtime.ts +++ b/seed/ts-sdk/no-environment/src/core/runtime/runtime.ts @@ -69,6 +69,7 @@ export const RUNTIME: Runtime = evaluateRuntime(); export interface Runtime { type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd"; version?: string; + parsedVersion?: number; } function evaluateRuntime(): Runtime { @@ -109,6 +110,7 @@ function evaluateRuntime(): Runtime { return { type: "node", version: process.versions.node, + parsedVersion: Number(process.versions.node.split(".")[0]), }; } diff --git a/seed/ts-sdk/oauth-client-credentials-default/src/api/resources/auth/client/Client.ts b/seed/ts-sdk/oauth-client-credentials-default/src/api/resources/auth/client/Client.ts index 9dc321de766..35825cb12a0 100644 --- a/seed/ts-sdk/oauth-client-credentials-default/src/api/resources/auth/client/Client.ts +++ b/seed/ts-sdk/oauth-client-credentials-default/src/api/resources/auth/client/Client.ts @@ -53,6 +53,7 @@ export class Auth { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: { ...serializers.GetTokenRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), grant_type: "client_credentials", diff --git a/seed/ts-sdk/oauth-client-credentials-default/src/core/fetcher/Fetcher.ts b/seed/ts-sdk/oauth-client-credentials-default/src/core/fetcher/Fetcher.ts index d3686367aa9..f3b010358d0 100644 --- a/seed/ts-sdk/oauth-client-credentials-default/src/core/fetcher/Fetcher.ts +++ b/seed/ts-sdk/oauth-client-credentials-default/src/core/fetcher/Fetcher.ts @@ -20,6 +20,7 @@ export declare namespace Fetcher { maxRetries?: number; withCredentials?: boolean; abortSignal?: AbortSignal; + requestType?: "json" | "file" | "bytes"; responseType?: "json" | "blob" | "streaming" | "text"; } @@ -62,7 +63,10 @@ export async function fetcherImpl(args: Fetcher.Args): Promise { - let requestBody: BodyInit; - if (RUNTIME.type === "node") { - if (body instanceof (await import("formdata-node")).FormData) { - // @ts-expect-error - requestBody = body; - } else if (body instanceof (await import("stream")).Readable) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } - } else { - if (body instanceof (await import("form-data")).default) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } +export declare namespace GetRequestBody { + interface Args { + body: unknown; + type: "json" | "file" | "bytes" | "other"; } - return requestBody; } -export const maybeStringifyBody = (requestBody: any, contentType: string): Uint8Array | string => { - if (requestBody instanceof Uint8Array) { - return requestBody; - } else if (contentType === "application/x-www-form-urlencoded" && typeof requestBody === "string") { - return requestBody; +export async function getRequestBody({ body, type }: GetRequestBody.Args): Promise { + if (type.includes("json")) { + return JSON.stringify(body); } else { - return JSON.stringify(requestBody); + return body as BodyInit; } -}; +} diff --git a/seed/ts-sdk/oauth-client-credentials-default/src/core/runtime/runtime.ts b/seed/ts-sdk/oauth-client-credentials-default/src/core/runtime/runtime.ts index 30fe0779aaa..4d0687e8eb4 100644 --- a/seed/ts-sdk/oauth-client-credentials-default/src/core/runtime/runtime.ts +++ b/seed/ts-sdk/oauth-client-credentials-default/src/core/runtime/runtime.ts @@ -69,6 +69,7 @@ export const RUNTIME: Runtime = evaluateRuntime(); export interface Runtime { type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd"; version?: string; + parsedVersion?: number; } function evaluateRuntime(): Runtime { @@ -109,6 +110,7 @@ function evaluateRuntime(): Runtime { return { type: "node", version: process.versions.node, + parsedVersion: Number(process.versions.node.split(".")[0]), }; } diff --git a/seed/ts-sdk/oauth-client-credentials-environment-variables/src/api/resources/auth/client/Client.ts b/seed/ts-sdk/oauth-client-credentials-environment-variables/src/api/resources/auth/client/Client.ts index db8add4ea85..e90a59ccf56 100644 --- a/seed/ts-sdk/oauth-client-credentials-environment-variables/src/api/resources/auth/client/Client.ts +++ b/seed/ts-sdk/oauth-client-credentials-environment-variables/src/api/resources/auth/client/Client.ts @@ -54,6 +54,7 @@ export class Auth { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: { ...serializers.GetTokenRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), audience: "https://api.example.com", @@ -122,6 +123,7 @@ export class Auth { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: { ...serializers.RefreshTokenRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), audience: "https://api.example.com", diff --git a/seed/ts-sdk/oauth-client-credentials-environment-variables/src/core/fetcher/Fetcher.ts b/seed/ts-sdk/oauth-client-credentials-environment-variables/src/core/fetcher/Fetcher.ts index d3686367aa9..f3b010358d0 100644 --- a/seed/ts-sdk/oauth-client-credentials-environment-variables/src/core/fetcher/Fetcher.ts +++ b/seed/ts-sdk/oauth-client-credentials-environment-variables/src/core/fetcher/Fetcher.ts @@ -20,6 +20,7 @@ export declare namespace Fetcher { maxRetries?: number; withCredentials?: boolean; abortSignal?: AbortSignal; + requestType?: "json" | "file" | "bytes"; responseType?: "json" | "blob" | "streaming" | "text"; } @@ -62,7 +63,10 @@ export async function fetcherImpl(args: Fetcher.Args): Promise { - let requestBody: BodyInit; - if (RUNTIME.type === "node") { - if (body instanceof (await import("formdata-node")).FormData) { - // @ts-expect-error - requestBody = body; - } else if (body instanceof (await import("stream")).Readable) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } - } else { - if (body instanceof (await import("form-data")).default) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } +export declare namespace GetRequestBody { + interface Args { + body: unknown; + type: "json" | "file" | "bytes" | "other"; } - return requestBody; } -export const maybeStringifyBody = (requestBody: any, contentType: string): Uint8Array | string => { - if (requestBody instanceof Uint8Array) { - return requestBody; - } else if (contentType === "application/x-www-form-urlencoded" && typeof requestBody === "string") { - return requestBody; +export async function getRequestBody({ body, type }: GetRequestBody.Args): Promise { + if (type.includes("json")) { + return JSON.stringify(body); } else { - return JSON.stringify(requestBody); + return body as BodyInit; } -}; +} diff --git a/seed/ts-sdk/oauth-client-credentials-environment-variables/src/core/runtime/runtime.ts b/seed/ts-sdk/oauth-client-credentials-environment-variables/src/core/runtime/runtime.ts index 30fe0779aaa..4d0687e8eb4 100644 --- a/seed/ts-sdk/oauth-client-credentials-environment-variables/src/core/runtime/runtime.ts +++ b/seed/ts-sdk/oauth-client-credentials-environment-variables/src/core/runtime/runtime.ts @@ -69,6 +69,7 @@ export const RUNTIME: Runtime = evaluateRuntime(); export interface Runtime { type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd"; version?: string; + parsedVersion?: number; } function evaluateRuntime(): Runtime { @@ -109,6 +110,7 @@ function evaluateRuntime(): Runtime { return { type: "node", version: process.versions.node, + parsedVersion: Number(process.versions.node.split(".")[0]), }; } diff --git a/seed/ts-sdk/oauth-client-credentials-nested-root/never-throw-errors/src/api/resources/auth/client/Client.ts b/seed/ts-sdk/oauth-client-credentials-nested-root/never-throw-errors/src/api/resources/auth/client/Client.ts index 6de0abf3d55..bf9be260677 100644 --- a/seed/ts-sdk/oauth-client-credentials-nested-root/never-throw-errors/src/api/resources/auth/client/Client.ts +++ b/seed/ts-sdk/oauth-client-credentials-nested-root/never-throw-errors/src/api/resources/auth/client/Client.ts @@ -55,6 +55,7 @@ export class Auth { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: { ...serializers.auth.GetTokenRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), audience: "https://api.example.com", diff --git a/seed/ts-sdk/oauth-client-credentials-nested-root/never-throw-errors/src/core/fetcher/Fetcher.ts b/seed/ts-sdk/oauth-client-credentials-nested-root/never-throw-errors/src/core/fetcher/Fetcher.ts index d3686367aa9..f3b010358d0 100644 --- a/seed/ts-sdk/oauth-client-credentials-nested-root/never-throw-errors/src/core/fetcher/Fetcher.ts +++ b/seed/ts-sdk/oauth-client-credentials-nested-root/never-throw-errors/src/core/fetcher/Fetcher.ts @@ -20,6 +20,7 @@ export declare namespace Fetcher { maxRetries?: number; withCredentials?: boolean; abortSignal?: AbortSignal; + requestType?: "json" | "file" | "bytes"; responseType?: "json" | "blob" | "streaming" | "text"; } @@ -62,7 +63,10 @@ export async function fetcherImpl(args: Fetcher.Args): Promise { - let requestBody: BodyInit; - if (RUNTIME.type === "node") { - if (body instanceof (await import("formdata-node")).FormData) { - // @ts-expect-error - requestBody = body; - } else if (body instanceof (await import("stream")).Readable) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } - } else { - if (body instanceof (await import("form-data")).default) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } +export declare namespace GetRequestBody { + interface Args { + body: unknown; + type: "json" | "file" | "bytes" | "other"; } - return requestBody; } -export const maybeStringifyBody = (requestBody: any, contentType: string): Uint8Array | string => { - if (requestBody instanceof Uint8Array) { - return requestBody; - } else if (contentType === "application/x-www-form-urlencoded" && typeof requestBody === "string") { - return requestBody; +export async function getRequestBody({ body, type }: GetRequestBody.Args): Promise { + if (type.includes("json")) { + return JSON.stringify(body); } else { - return JSON.stringify(requestBody); + return body as BodyInit; } -}; +} diff --git a/seed/ts-sdk/oauth-client-credentials-nested-root/never-throw-errors/src/core/runtime/runtime.ts b/seed/ts-sdk/oauth-client-credentials-nested-root/never-throw-errors/src/core/runtime/runtime.ts index 30fe0779aaa..4d0687e8eb4 100644 --- a/seed/ts-sdk/oauth-client-credentials-nested-root/never-throw-errors/src/core/runtime/runtime.ts +++ b/seed/ts-sdk/oauth-client-credentials-nested-root/never-throw-errors/src/core/runtime/runtime.ts @@ -69,6 +69,7 @@ export const RUNTIME: Runtime = evaluateRuntime(); export interface Runtime { type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd"; version?: string; + parsedVersion?: number; } function evaluateRuntime(): Runtime { @@ -109,6 +110,7 @@ function evaluateRuntime(): Runtime { return { type: "node", version: process.versions.node, + parsedVersion: Number(process.versions.node.split(".")[0]), }; } diff --git a/seed/ts-sdk/oauth-client-credentials-nested-root/no-custom-config/src/api/resources/auth/client/Client.ts b/seed/ts-sdk/oauth-client-credentials-nested-root/no-custom-config/src/api/resources/auth/client/Client.ts index 891f65601c4..9fed4b6a391 100644 --- a/seed/ts-sdk/oauth-client-credentials-nested-root/no-custom-config/src/api/resources/auth/client/Client.ts +++ b/seed/ts-sdk/oauth-client-credentials-nested-root/no-custom-config/src/api/resources/auth/client/Client.ts @@ -54,6 +54,7 @@ export class Auth { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: { ...serializers.auth.GetTokenRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), audience: "https://api.example.com", diff --git a/seed/ts-sdk/oauth-client-credentials-nested-root/no-custom-config/src/core/fetcher/Fetcher.ts b/seed/ts-sdk/oauth-client-credentials-nested-root/no-custom-config/src/core/fetcher/Fetcher.ts index d3686367aa9..f3b010358d0 100644 --- a/seed/ts-sdk/oauth-client-credentials-nested-root/no-custom-config/src/core/fetcher/Fetcher.ts +++ b/seed/ts-sdk/oauth-client-credentials-nested-root/no-custom-config/src/core/fetcher/Fetcher.ts @@ -20,6 +20,7 @@ export declare namespace Fetcher { maxRetries?: number; withCredentials?: boolean; abortSignal?: AbortSignal; + requestType?: "json" | "file" | "bytes"; responseType?: "json" | "blob" | "streaming" | "text"; } @@ -62,7 +63,10 @@ export async function fetcherImpl(args: Fetcher.Args): Promise { - let requestBody: BodyInit; - if (RUNTIME.type === "node") { - if (body instanceof (await import("formdata-node")).FormData) { - // @ts-expect-error - requestBody = body; - } else if (body instanceof (await import("stream")).Readable) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } - } else { - if (body instanceof (await import("form-data")).default) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } +export declare namespace GetRequestBody { + interface Args { + body: unknown; + type: "json" | "file" | "bytes" | "other"; } - return requestBody; } -export const maybeStringifyBody = (requestBody: any, contentType: string): Uint8Array | string => { - if (requestBody instanceof Uint8Array) { - return requestBody; - } else if (contentType === "application/x-www-form-urlencoded" && typeof requestBody === "string") { - return requestBody; +export async function getRequestBody({ body, type }: GetRequestBody.Args): Promise { + if (type.includes("json")) { + return JSON.stringify(body); } else { - return JSON.stringify(requestBody); + return body as BodyInit; } -}; +} diff --git a/seed/ts-sdk/oauth-client-credentials-nested-root/no-custom-config/src/core/runtime/runtime.ts b/seed/ts-sdk/oauth-client-credentials-nested-root/no-custom-config/src/core/runtime/runtime.ts index 30fe0779aaa..4d0687e8eb4 100644 --- a/seed/ts-sdk/oauth-client-credentials-nested-root/no-custom-config/src/core/runtime/runtime.ts +++ b/seed/ts-sdk/oauth-client-credentials-nested-root/no-custom-config/src/core/runtime/runtime.ts @@ -69,6 +69,7 @@ export const RUNTIME: Runtime = evaluateRuntime(); export interface Runtime { type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd"; version?: string; + parsedVersion?: number; } function evaluateRuntime(): Runtime { @@ -109,6 +110,7 @@ function evaluateRuntime(): Runtime { return { type: "node", version: process.versions.node, + parsedVersion: Number(process.versions.node.split(".")[0]), }; } diff --git a/seed/ts-sdk/oauth-client-credentials/src/api/resources/auth/client/Client.ts b/seed/ts-sdk/oauth-client-credentials/src/api/resources/auth/client/Client.ts index 22f8c6a4c58..a6b595bf89b 100644 --- a/seed/ts-sdk/oauth-client-credentials/src/api/resources/auth/client/Client.ts +++ b/seed/ts-sdk/oauth-client-credentials/src/api/resources/auth/client/Client.ts @@ -54,6 +54,7 @@ export class Auth { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: { ...serializers.GetTokenRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), audience: "https://api.example.com", @@ -122,6 +123,7 @@ export class Auth { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: { ...serializers.RefreshTokenRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), audience: "https://api.example.com", diff --git a/seed/ts-sdk/oauth-client-credentials/src/core/fetcher/Fetcher.ts b/seed/ts-sdk/oauth-client-credentials/src/core/fetcher/Fetcher.ts index d3686367aa9..f3b010358d0 100644 --- a/seed/ts-sdk/oauth-client-credentials/src/core/fetcher/Fetcher.ts +++ b/seed/ts-sdk/oauth-client-credentials/src/core/fetcher/Fetcher.ts @@ -20,6 +20,7 @@ export declare namespace Fetcher { maxRetries?: number; withCredentials?: boolean; abortSignal?: AbortSignal; + requestType?: "json" | "file" | "bytes"; responseType?: "json" | "blob" | "streaming" | "text"; } @@ -62,7 +63,10 @@ export async function fetcherImpl(args: Fetcher.Args): Promise { - let requestBody: BodyInit; - if (RUNTIME.type === "node") { - if (body instanceof (await import("formdata-node")).FormData) { - // @ts-expect-error - requestBody = body; - } else if (body instanceof (await import("stream")).Readable) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } - } else { - if (body instanceof (await import("form-data")).default) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } +export declare namespace GetRequestBody { + interface Args { + body: unknown; + type: "json" | "file" | "bytes" | "other"; } - return requestBody; } -export const maybeStringifyBody = (requestBody: any, contentType: string): Uint8Array | string => { - if (requestBody instanceof Uint8Array) { - return requestBody; - } else if (contentType === "application/x-www-form-urlencoded" && typeof requestBody === "string") { - return requestBody; +export async function getRequestBody({ body, type }: GetRequestBody.Args): Promise { + if (type.includes("json")) { + return JSON.stringify(body); } else { - return JSON.stringify(requestBody); + return body as BodyInit; } -}; +} diff --git a/seed/ts-sdk/oauth-client-credentials/src/core/runtime/runtime.ts b/seed/ts-sdk/oauth-client-credentials/src/core/runtime/runtime.ts index 30fe0779aaa..4d0687e8eb4 100644 --- a/seed/ts-sdk/oauth-client-credentials/src/core/runtime/runtime.ts +++ b/seed/ts-sdk/oauth-client-credentials/src/core/runtime/runtime.ts @@ -69,6 +69,7 @@ export const RUNTIME: Runtime = evaluateRuntime(); export interface Runtime { type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd"; version?: string; + parsedVersion?: number; } function evaluateRuntime(): Runtime { @@ -109,6 +110,7 @@ function evaluateRuntime(): Runtime { return { type: "node", version: process.versions.node, + parsedVersion: Number(process.versions.node.split(".")[0]), }; } diff --git a/seed/ts-sdk/optional/src/api/resources/optional/client/Client.ts b/seed/ts-sdk/optional/src/api/resources/optional/client/Client.ts index dd1ae919c3e..5e4cbd30dba 100644 --- a/seed/ts-sdk/optional/src/api/resources/optional/client/Client.ts +++ b/seed/ts-sdk/optional/src/api/resources/optional/client/Client.ts @@ -51,6 +51,7 @@ export class Optional { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: request != null ? serializers.optional.sendOptionalBody.Request.jsonOrThrow(request, { diff --git a/seed/ts-sdk/optional/src/core/fetcher/Fetcher.ts b/seed/ts-sdk/optional/src/core/fetcher/Fetcher.ts index d3686367aa9..f3b010358d0 100644 --- a/seed/ts-sdk/optional/src/core/fetcher/Fetcher.ts +++ b/seed/ts-sdk/optional/src/core/fetcher/Fetcher.ts @@ -20,6 +20,7 @@ export declare namespace Fetcher { maxRetries?: number; withCredentials?: boolean; abortSignal?: AbortSignal; + requestType?: "json" | "file" | "bytes"; responseType?: "json" | "blob" | "streaming" | "text"; } @@ -62,7 +63,10 @@ export async function fetcherImpl(args: Fetcher.Args): Promise { - let requestBody: BodyInit; - if (RUNTIME.type === "node") { - if (body instanceof (await import("formdata-node")).FormData) { - // @ts-expect-error - requestBody = body; - } else if (body instanceof (await import("stream")).Readable) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } - } else { - if (body instanceof (await import("form-data")).default) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } +export declare namespace GetRequestBody { + interface Args { + body: unknown; + type: "json" | "file" | "bytes" | "other"; } - return requestBody; } -export const maybeStringifyBody = (requestBody: any, contentType: string): Uint8Array | string => { - if (requestBody instanceof Uint8Array) { - return requestBody; - } else if (contentType === "application/x-www-form-urlencoded" && typeof requestBody === "string") { - return requestBody; +export async function getRequestBody({ body, type }: GetRequestBody.Args): Promise { + if (type.includes("json")) { + return JSON.stringify(body); } else { - return JSON.stringify(requestBody); + return body as BodyInit; } -}; +} diff --git a/seed/ts-sdk/optional/src/core/runtime/runtime.ts b/seed/ts-sdk/optional/src/core/runtime/runtime.ts index 30fe0779aaa..4d0687e8eb4 100644 --- a/seed/ts-sdk/optional/src/core/runtime/runtime.ts +++ b/seed/ts-sdk/optional/src/core/runtime/runtime.ts @@ -69,6 +69,7 @@ export const RUNTIME: Runtime = evaluateRuntime(); export interface Runtime { type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd"; version?: string; + parsedVersion?: number; } function evaluateRuntime(): Runtime { @@ -109,6 +110,7 @@ function evaluateRuntime(): Runtime { return { type: "node", version: process.versions.node, + parsedVersion: Number(process.versions.node.split(".")[0]), }; } diff --git a/seed/ts-sdk/package-yml/src/Client.ts b/seed/ts-sdk/package-yml/src/Client.ts index ba126d623e4..f3024a91e41 100644 --- a/seed/ts-sdk/package-yml/src/Client.ts +++ b/seed/ts-sdk/package-yml/src/Client.ts @@ -56,6 +56,7 @@ export class SeedPackageYmlClient { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.EchoRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, diff --git a/seed/ts-sdk/package-yml/src/api/resources/service/client/Client.ts b/seed/ts-sdk/package-yml/src/api/resources/service/client/Client.ts index e900b000ccc..bffd00d29e8 100644 --- a/seed/ts-sdk/package-yml/src/api/resources/service/client/Client.ts +++ b/seed/ts-sdk/package-yml/src/api/resources/service/client/Client.ts @@ -47,6 +47,7 @@ export class Service { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/seed/ts-sdk/package-yml/src/core/fetcher/Fetcher.ts b/seed/ts-sdk/package-yml/src/core/fetcher/Fetcher.ts index d3686367aa9..f3b010358d0 100644 --- a/seed/ts-sdk/package-yml/src/core/fetcher/Fetcher.ts +++ b/seed/ts-sdk/package-yml/src/core/fetcher/Fetcher.ts @@ -20,6 +20,7 @@ export declare namespace Fetcher { maxRetries?: number; withCredentials?: boolean; abortSignal?: AbortSignal; + requestType?: "json" | "file" | "bytes"; responseType?: "json" | "blob" | "streaming" | "text"; } @@ -62,7 +63,10 @@ export async function fetcherImpl(args: Fetcher.Args): Promise { - let requestBody: BodyInit; - if (RUNTIME.type === "node") { - if (body instanceof (await import("formdata-node")).FormData) { - // @ts-expect-error - requestBody = body; - } else if (body instanceof (await import("stream")).Readable) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } - } else { - if (body instanceof (await import("form-data")).default) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } +export declare namespace GetRequestBody { + interface Args { + body: unknown; + type: "json" | "file" | "bytes" | "other"; } - return requestBody; } -export const maybeStringifyBody = (requestBody: any, contentType: string): Uint8Array | string => { - if (requestBody instanceof Uint8Array) { - return requestBody; - } else if (contentType === "application/x-www-form-urlencoded" && typeof requestBody === "string") { - return requestBody; +export async function getRequestBody({ body, type }: GetRequestBody.Args): Promise { + if (type.includes("json")) { + return JSON.stringify(body); } else { - return JSON.stringify(requestBody); + return body as BodyInit; } -}; +} diff --git a/seed/ts-sdk/package-yml/src/core/runtime/runtime.ts b/seed/ts-sdk/package-yml/src/core/runtime/runtime.ts index 30fe0779aaa..4d0687e8eb4 100644 --- a/seed/ts-sdk/package-yml/src/core/runtime/runtime.ts +++ b/seed/ts-sdk/package-yml/src/core/runtime/runtime.ts @@ -69,6 +69,7 @@ export const RUNTIME: Runtime = evaluateRuntime(); export interface Runtime { type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd"; version?: string; + parsedVersion?: number; } function evaluateRuntime(): Runtime { @@ -109,6 +110,7 @@ function evaluateRuntime(): Runtime { return { type: "node", version: process.versions.node, + parsedVersion: Number(process.versions.node.split(".")[0]), }; } diff --git a/seed/ts-sdk/pagination/src/api/resources/users/client/Client.ts b/seed/ts-sdk/pagination/src/api/resources/users/client/Client.ts index 1eb0eeb5dec..2660cf34d44 100644 --- a/seed/ts-sdk/pagination/src/api/resources/users/client/Client.ts +++ b/seed/ts-sdk/pagination/src/api/resources/users/client/Client.ts @@ -73,6 +73,7 @@ export class Users { }, contentType: "application/json", queryParameters: _queryParams, + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -145,6 +146,7 @@ export class Users { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.ListUsersBodyCursorPaginationRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -236,6 +238,7 @@ export class Users { }, contentType: "application/json", queryParameters: _queryParams, + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -310,6 +313,7 @@ export class Users { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.ListUsersBodyOffsetPaginationRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -399,6 +403,7 @@ export class Users { }, contentType: "application/json", queryParameters: _queryParams, + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -477,6 +482,7 @@ export class Users { }, contentType: "application/json", queryParameters: _queryParams, + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -551,6 +557,7 @@ export class Users { }, contentType: "application/json", queryParameters: _queryParams, + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -627,6 +634,7 @@ export class Users { }, contentType: "application/json", queryParameters: _queryParams, + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/seed/ts-sdk/pagination/src/core/fetcher/Fetcher.ts b/seed/ts-sdk/pagination/src/core/fetcher/Fetcher.ts index d3686367aa9..f3b010358d0 100644 --- a/seed/ts-sdk/pagination/src/core/fetcher/Fetcher.ts +++ b/seed/ts-sdk/pagination/src/core/fetcher/Fetcher.ts @@ -20,6 +20,7 @@ export declare namespace Fetcher { maxRetries?: number; withCredentials?: boolean; abortSignal?: AbortSignal; + requestType?: "json" | "file" | "bytes"; responseType?: "json" | "blob" | "streaming" | "text"; } @@ -62,7 +63,10 @@ export async function fetcherImpl(args: Fetcher.Args): Promise { - let requestBody: BodyInit; - if (RUNTIME.type === "node") { - if (body instanceof (await import("formdata-node")).FormData) { - // @ts-expect-error - requestBody = body; - } else if (body instanceof (await import("stream")).Readable) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } - } else { - if (body instanceof (await import("form-data")).default) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } +export declare namespace GetRequestBody { + interface Args { + body: unknown; + type: "json" | "file" | "bytes" | "other"; } - return requestBody; } -export const maybeStringifyBody = (requestBody: any, contentType: string): Uint8Array | string => { - if (requestBody instanceof Uint8Array) { - return requestBody; - } else if (contentType === "application/x-www-form-urlencoded" && typeof requestBody === "string") { - return requestBody; +export async function getRequestBody({ body, type }: GetRequestBody.Args): Promise { + if (type.includes("json")) { + return JSON.stringify(body); } else { - return JSON.stringify(requestBody); + return body as BodyInit; } -}; +} diff --git a/seed/ts-sdk/pagination/src/core/runtime/runtime.ts b/seed/ts-sdk/pagination/src/core/runtime/runtime.ts index 30fe0779aaa..4d0687e8eb4 100644 --- a/seed/ts-sdk/pagination/src/core/runtime/runtime.ts +++ b/seed/ts-sdk/pagination/src/core/runtime/runtime.ts @@ -69,6 +69,7 @@ export const RUNTIME: Runtime = evaluateRuntime(); export interface Runtime { type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd"; version?: string; + parsedVersion?: number; } function evaluateRuntime(): Runtime { @@ -109,6 +110,7 @@ function evaluateRuntime(): Runtime { return { type: "node", version: process.versions.node, + parsedVersion: Number(process.versions.node.split(".")[0]), }; } diff --git a/seed/ts-sdk/plain-text/src/api/resources/service/client/Client.ts b/seed/ts-sdk/plain-text/src/api/resources/service/client/Client.ts index 6534ea395b7..4b830d5ec20 100644 --- a/seed/ts-sdk/plain-text/src/api/resources/service/client/Client.ts +++ b/seed/ts-sdk/plain-text/src/api/resources/service/client/Client.ts @@ -42,6 +42,7 @@ export class Service { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", responseType: "text", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, diff --git a/seed/ts-sdk/plain-text/src/core/fetcher/Fetcher.ts b/seed/ts-sdk/plain-text/src/core/fetcher/Fetcher.ts index d3686367aa9..f3b010358d0 100644 --- a/seed/ts-sdk/plain-text/src/core/fetcher/Fetcher.ts +++ b/seed/ts-sdk/plain-text/src/core/fetcher/Fetcher.ts @@ -20,6 +20,7 @@ export declare namespace Fetcher { maxRetries?: number; withCredentials?: boolean; abortSignal?: AbortSignal; + requestType?: "json" | "file" | "bytes"; responseType?: "json" | "blob" | "streaming" | "text"; } @@ -62,7 +63,10 @@ export async function fetcherImpl(args: Fetcher.Args): Promise { - let requestBody: BodyInit; - if (RUNTIME.type === "node") { - if (body instanceof (await import("formdata-node")).FormData) { - // @ts-expect-error - requestBody = body; - } else if (body instanceof (await import("stream")).Readable) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } - } else { - if (body instanceof (await import("form-data")).default) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } +export declare namespace GetRequestBody { + interface Args { + body: unknown; + type: "json" | "file" | "bytes" | "other"; } - return requestBody; } -export const maybeStringifyBody = (requestBody: any, contentType: string): Uint8Array | string => { - if (requestBody instanceof Uint8Array) { - return requestBody; - } else if (contentType === "application/x-www-form-urlencoded" && typeof requestBody === "string") { - return requestBody; +export async function getRequestBody({ body, type }: GetRequestBody.Args): Promise { + if (type.includes("json")) { + return JSON.stringify(body); } else { - return JSON.stringify(requestBody); + return body as BodyInit; } -}; +} diff --git a/seed/ts-sdk/plain-text/src/core/runtime/runtime.ts b/seed/ts-sdk/plain-text/src/core/runtime/runtime.ts index 30fe0779aaa..4d0687e8eb4 100644 --- a/seed/ts-sdk/plain-text/src/core/runtime/runtime.ts +++ b/seed/ts-sdk/plain-text/src/core/runtime/runtime.ts @@ -69,6 +69,7 @@ export const RUNTIME: Runtime = evaluateRuntime(); export interface Runtime { type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd"; version?: string; + parsedVersion?: number; } function evaluateRuntime(): Runtime { @@ -109,6 +110,7 @@ function evaluateRuntime(): Runtime { return { type: "node", version: process.versions.node, + parsedVersion: Number(process.versions.node.split(".")[0]), }; } diff --git a/seed/ts-sdk/query-parameters/no-custom-config/src/api/resources/user/client/Client.ts b/seed/ts-sdk/query-parameters/no-custom-config/src/api/resources/user/client/Client.ts index 3fbb8fb13b8..32ba9f8352d 100644 --- a/seed/ts-sdk/query-parameters/no-custom-config/src/api/resources/user/client/Client.ts +++ b/seed/ts-sdk/query-parameters/no-custom-config/src/api/resources/user/client/Client.ts @@ -163,6 +163,7 @@ export class User { }, contentType: "application/json", queryParameters: _queryParams, + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/seed/ts-sdk/query-parameters/no-custom-config/src/core/fetcher/Fetcher.ts b/seed/ts-sdk/query-parameters/no-custom-config/src/core/fetcher/Fetcher.ts index d3686367aa9..f3b010358d0 100644 --- a/seed/ts-sdk/query-parameters/no-custom-config/src/core/fetcher/Fetcher.ts +++ b/seed/ts-sdk/query-parameters/no-custom-config/src/core/fetcher/Fetcher.ts @@ -20,6 +20,7 @@ export declare namespace Fetcher { maxRetries?: number; withCredentials?: boolean; abortSignal?: AbortSignal; + requestType?: "json" | "file" | "bytes"; responseType?: "json" | "blob" | "streaming" | "text"; } @@ -62,7 +63,10 @@ export async function fetcherImpl(args: Fetcher.Args): Promise { - let requestBody: BodyInit; - if (RUNTIME.type === "node") { - if (body instanceof (await import("formdata-node")).FormData) { - // @ts-expect-error - requestBody = body; - } else if (body instanceof (await import("stream")).Readable) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } - } else { - if (body instanceof (await import("form-data")).default) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } +export declare namespace GetRequestBody { + interface Args { + body: unknown; + type: "json" | "file" | "bytes" | "other"; } - return requestBody; } -export const maybeStringifyBody = (requestBody: any, contentType: string): Uint8Array | string => { - if (requestBody instanceof Uint8Array) { - return requestBody; - } else if (contentType === "application/x-www-form-urlencoded" && typeof requestBody === "string") { - return requestBody; +export async function getRequestBody({ body, type }: GetRequestBody.Args): Promise { + if (type.includes("json")) { + return JSON.stringify(body); } else { - return JSON.stringify(requestBody); + return body as BodyInit; } -}; +} diff --git a/seed/ts-sdk/query-parameters/no-custom-config/src/core/runtime/runtime.ts b/seed/ts-sdk/query-parameters/no-custom-config/src/core/runtime/runtime.ts index 30fe0779aaa..4d0687e8eb4 100644 --- a/seed/ts-sdk/query-parameters/no-custom-config/src/core/runtime/runtime.ts +++ b/seed/ts-sdk/query-parameters/no-custom-config/src/core/runtime/runtime.ts @@ -69,6 +69,7 @@ export const RUNTIME: Runtime = evaluateRuntime(); export interface Runtime { type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd"; version?: string; + parsedVersion?: number; } function evaluateRuntime(): Runtime { @@ -109,6 +110,7 @@ function evaluateRuntime(): Runtime { return { type: "node", version: process.versions.node, + parsedVersion: Number(process.versions.node.split(".")[0]), }; } diff --git a/seed/ts-sdk/query-parameters/no-serde-layer-query/src/api/resources/user/client/Client.ts b/seed/ts-sdk/query-parameters/no-serde-layer-query/src/api/resources/user/client/Client.ts index bb79c74e12f..532dba46292 100644 --- a/seed/ts-sdk/query-parameters/no-serde-layer-query/src/api/resources/user/client/Client.ts +++ b/seed/ts-sdk/query-parameters/no-serde-layer-query/src/api/resources/user/client/Client.ts @@ -133,6 +133,7 @@ export class User { }, contentType: "application/json", queryParameters: _queryParams, + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/seed/ts-sdk/query-parameters/no-serde-layer-query/src/core/fetcher/Fetcher.ts b/seed/ts-sdk/query-parameters/no-serde-layer-query/src/core/fetcher/Fetcher.ts index d3686367aa9..f3b010358d0 100644 --- a/seed/ts-sdk/query-parameters/no-serde-layer-query/src/core/fetcher/Fetcher.ts +++ b/seed/ts-sdk/query-parameters/no-serde-layer-query/src/core/fetcher/Fetcher.ts @@ -20,6 +20,7 @@ export declare namespace Fetcher { maxRetries?: number; withCredentials?: boolean; abortSignal?: AbortSignal; + requestType?: "json" | "file" | "bytes"; responseType?: "json" | "blob" | "streaming" | "text"; } @@ -62,7 +63,10 @@ export async function fetcherImpl(args: Fetcher.Args): Promise { - let requestBody: BodyInit; - if (RUNTIME.type === "node") { - if (body instanceof (await import("formdata-node")).FormData) { - // @ts-expect-error - requestBody = body; - } else if (body instanceof (await import("stream")).Readable) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } - } else { - if (body instanceof (await import("form-data")).default) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } +export declare namespace GetRequestBody { + interface Args { + body: unknown; + type: "json" | "file" | "bytes" | "other"; } - return requestBody; } -export const maybeStringifyBody = (requestBody: any, contentType: string): Uint8Array | string => { - if (requestBody instanceof Uint8Array) { - return requestBody; - } else if (contentType === "application/x-www-form-urlencoded" && typeof requestBody === "string") { - return requestBody; +export async function getRequestBody({ body, type }: GetRequestBody.Args): Promise { + if (type.includes("json")) { + return JSON.stringify(body); } else { - return JSON.stringify(requestBody); + return body as BodyInit; } -}; +} diff --git a/seed/ts-sdk/query-parameters/no-serde-layer-query/src/core/runtime/runtime.ts b/seed/ts-sdk/query-parameters/no-serde-layer-query/src/core/runtime/runtime.ts index 30fe0779aaa..4d0687e8eb4 100644 --- a/seed/ts-sdk/query-parameters/no-serde-layer-query/src/core/runtime/runtime.ts +++ b/seed/ts-sdk/query-parameters/no-serde-layer-query/src/core/runtime/runtime.ts @@ -69,6 +69,7 @@ export const RUNTIME: Runtime = evaluateRuntime(); export interface Runtime { type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd"; version?: string; + parsedVersion?: number; } function evaluateRuntime(): Runtime { @@ -109,6 +110,7 @@ function evaluateRuntime(): Runtime { return { type: "node", version: process.versions.node, + parsedVersion: Number(process.versions.node.split(".")[0]), }; } diff --git a/seed/ts-sdk/reserved-keywords/.mock/definition/.package.yml.swp b/seed/ts-sdk/reserved-keywords/.mock/definition/.package.yml.swp deleted file mode 100644 index c924d7d324888964837574ea697d56e5038469fb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12288 zcmeI2y>8S%5XUD-6cj-CXy`UalLDUusjv_d>5zyxg@BYQ+SucZb$8xncN20A;Td=n z#1qhvB9DMblb#l(%dG7SA6HONA^s!%z4FZLtmh}Wusk~}ub!@}hy4{2TO_*k<#KuY z@d~MBB0c7V=>C&EkvyNQ>wL|aQ8I9*KQ_4@&ux1f3#Pd#I4#-L?Io}eNx@}RSD`Ys zZ@t=9K6UKb?Q@Zgc>2b;!lys-QmgZk9&&#=nLlXmWH>+o1cVx~utA4k)q;B1O z2`C@{0w4eaAOHd&00JNY0{;<#U>E36`n}Zke7jp0ep|a+EFb^^AOHd&00JNY0w4ea zAOHd&00RFY0bLMnUn4pa#sB}a@Bg#wMBhXwqGQn~(Ff6c(L2$hXkRoGZHb2s&b3!LXY#Gw*s2thZ9HVxc}in4HPQA_+seJJrN>R! iI%C;|ikovbIG5r0*`u}{{RH6G(args: Fetcher.Args): Promise { - let requestBody: BodyInit; - if (RUNTIME.type === "node") { - if (body instanceof (await import("formdata-node")).FormData) { - // @ts-expect-error - requestBody = body; - } else if (body instanceof (await import("stream")).Readable) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } - } else { - if (body instanceof (await import("form-data")).default) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } +export declare namespace GetRequestBody { + interface Args { + body: unknown; + type: "json" | "file" | "bytes" | "other"; } - return requestBody; } -export const maybeStringifyBody = (requestBody: any, contentType: string): Uint8Array | string => { - if (requestBody instanceof Uint8Array) { - return requestBody; - } else if (contentType === "application/x-www-form-urlencoded" && typeof requestBody === "string") { - return requestBody; +export async function getRequestBody({ body, type }: GetRequestBody.Args): Promise { + if (type.includes("json")) { + return JSON.stringify(body); } else { - return JSON.stringify(requestBody); + return body as BodyInit; } -}; +} diff --git a/seed/ts-sdk/reserved-keywords/src/core/runtime/runtime.ts b/seed/ts-sdk/reserved-keywords/src/core/runtime/runtime.ts index 30fe0779aaa..4d0687e8eb4 100644 --- a/seed/ts-sdk/reserved-keywords/src/core/runtime/runtime.ts +++ b/seed/ts-sdk/reserved-keywords/src/core/runtime/runtime.ts @@ -69,6 +69,7 @@ export const RUNTIME: Runtime = evaluateRuntime(); export interface Runtime { type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd"; version?: string; + parsedVersion?: number; } function evaluateRuntime(): Runtime { @@ -109,6 +110,7 @@ function evaluateRuntime(): Runtime { return { type: "node", version: process.versions.node, + parsedVersion: Number(process.versions.node.split(".")[0]), }; } diff --git a/seed/ts-sdk/response-property/src/api/resources/service/client/Client.ts b/seed/ts-sdk/response-property/src/api/resources/service/client/Client.ts index 398ea40c7a4..5f85709d8c3 100644 --- a/seed/ts-sdk/response-property/src/api/resources/service/client/Client.ts +++ b/seed/ts-sdk/response-property/src/api/resources/service/client/Client.ts @@ -48,6 +48,7 @@ export class Service { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.service.getMovie.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -106,6 +107,7 @@ export class Service { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.service.getMovieDocs.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -164,6 +166,7 @@ export class Service { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.service.getMovieName.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -222,6 +225,7 @@ export class Service { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.service.getMovieMetadata.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -282,6 +286,7 @@ export class Service { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.service.getOptionalMovie.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -342,6 +347,7 @@ export class Service { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.service.getOptionalMovieDocs.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -402,6 +408,7 @@ export class Service { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.service.getOptionalMovieName.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), diff --git a/seed/ts-sdk/response-property/src/core/fetcher/Fetcher.ts b/seed/ts-sdk/response-property/src/core/fetcher/Fetcher.ts index d3686367aa9..f3b010358d0 100644 --- a/seed/ts-sdk/response-property/src/core/fetcher/Fetcher.ts +++ b/seed/ts-sdk/response-property/src/core/fetcher/Fetcher.ts @@ -20,6 +20,7 @@ export declare namespace Fetcher { maxRetries?: number; withCredentials?: boolean; abortSignal?: AbortSignal; + requestType?: "json" | "file" | "bytes"; responseType?: "json" | "blob" | "streaming" | "text"; } @@ -62,7 +63,10 @@ export async function fetcherImpl(args: Fetcher.Args): Promise { - let requestBody: BodyInit; - if (RUNTIME.type === "node") { - if (body instanceof (await import("formdata-node")).FormData) { - // @ts-expect-error - requestBody = body; - } else if (body instanceof (await import("stream")).Readable) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } - } else { - if (body instanceof (await import("form-data")).default) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } +export declare namespace GetRequestBody { + interface Args { + body: unknown; + type: "json" | "file" | "bytes" | "other"; } - return requestBody; } -export const maybeStringifyBody = (requestBody: any, contentType: string): Uint8Array | string => { - if (requestBody instanceof Uint8Array) { - return requestBody; - } else if (contentType === "application/x-www-form-urlencoded" && typeof requestBody === "string") { - return requestBody; +export async function getRequestBody({ body, type }: GetRequestBody.Args): Promise { + if (type.includes("json")) { + return JSON.stringify(body); } else { - return JSON.stringify(requestBody); + return body as BodyInit; } -}; +} diff --git a/seed/ts-sdk/response-property/src/core/runtime/runtime.ts b/seed/ts-sdk/response-property/src/core/runtime/runtime.ts index 30fe0779aaa..4d0687e8eb4 100644 --- a/seed/ts-sdk/response-property/src/core/runtime/runtime.ts +++ b/seed/ts-sdk/response-property/src/core/runtime/runtime.ts @@ -69,6 +69,7 @@ export const RUNTIME: Runtime = evaluateRuntime(); export interface Runtime { type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd"; version?: string; + parsedVersion?: number; } function evaluateRuntime(): Runtime { @@ -109,6 +110,7 @@ function evaluateRuntime(): Runtime { return { type: "node", version: process.versions.node, + parsedVersion: Number(process.versions.node.split(".")[0]), }; } diff --git a/seed/ts-sdk/server-sent-events/src/api/resources/completions/client/Client.ts b/seed/ts-sdk/server-sent-events/src/api/resources/completions/client/Client.ts index 1e176870351..a53c4fc41d5 100644 --- a/seed/ts-sdk/server-sent-events/src/api/resources/completions/client/Client.ts +++ b/seed/ts-sdk/server-sent-events/src/api/resources/completions/client/Client.ts @@ -42,6 +42,7 @@ export class Completions { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.StreamCompletionRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), responseType: "streaming", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, diff --git a/seed/ts-sdk/server-sent-events/src/core/fetcher/Fetcher.ts b/seed/ts-sdk/server-sent-events/src/core/fetcher/Fetcher.ts index d3686367aa9..f3b010358d0 100644 --- a/seed/ts-sdk/server-sent-events/src/core/fetcher/Fetcher.ts +++ b/seed/ts-sdk/server-sent-events/src/core/fetcher/Fetcher.ts @@ -20,6 +20,7 @@ export declare namespace Fetcher { maxRetries?: number; withCredentials?: boolean; abortSignal?: AbortSignal; + requestType?: "json" | "file" | "bytes"; responseType?: "json" | "blob" | "streaming" | "text"; } @@ -62,7 +63,10 @@ export async function fetcherImpl(args: Fetcher.Args): Promise { - let requestBody: BodyInit; - if (RUNTIME.type === "node") { - if (body instanceof (await import("formdata-node")).FormData) { - // @ts-expect-error - requestBody = body; - } else if (body instanceof (await import("stream")).Readable) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } - } else { - if (body instanceof (await import("form-data")).default) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } +export declare namespace GetRequestBody { + interface Args { + body: unknown; + type: "json" | "file" | "bytes" | "other"; } - return requestBody; } -export const maybeStringifyBody = (requestBody: any, contentType: string): Uint8Array | string => { - if (requestBody instanceof Uint8Array) { - return requestBody; - } else if (contentType === "application/x-www-form-urlencoded" && typeof requestBody === "string") { - return requestBody; +export async function getRequestBody({ body, type }: GetRequestBody.Args): Promise { + if (type.includes("json")) { + return JSON.stringify(body); } else { - return JSON.stringify(requestBody); + return body as BodyInit; } -}; +} diff --git a/seed/ts-sdk/server-sent-events/src/core/runtime/runtime.ts b/seed/ts-sdk/server-sent-events/src/core/runtime/runtime.ts index 30fe0779aaa..4d0687e8eb4 100644 --- a/seed/ts-sdk/server-sent-events/src/core/runtime/runtime.ts +++ b/seed/ts-sdk/server-sent-events/src/core/runtime/runtime.ts @@ -69,6 +69,7 @@ export const RUNTIME: Runtime = evaluateRuntime(); export interface Runtime { type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd"; version?: string; + parsedVersion?: number; } function evaluateRuntime(): Runtime { @@ -109,6 +110,7 @@ function evaluateRuntime(): Runtime { return { type: "node", version: process.versions.node, + parsedVersion: Number(process.versions.node.split(".")[0]), }; } diff --git a/seed/ts-sdk/single-url-environment-default/src/api/resources/dummy/client/Client.ts b/seed/ts-sdk/single-url-environment-default/src/api/resources/dummy/client/Client.ts index 74ecfc88566..395b60aaa97 100644 --- a/seed/ts-sdk/single-url-environment-default/src/api/resources/dummy/client/Client.ts +++ b/seed/ts-sdk/single-url-environment-default/src/api/resources/dummy/client/Client.ts @@ -50,6 +50,7 @@ export class Dummy { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/seed/ts-sdk/single-url-environment-default/src/core/fetcher/Fetcher.ts b/seed/ts-sdk/single-url-environment-default/src/core/fetcher/Fetcher.ts index d3686367aa9..f3b010358d0 100644 --- a/seed/ts-sdk/single-url-environment-default/src/core/fetcher/Fetcher.ts +++ b/seed/ts-sdk/single-url-environment-default/src/core/fetcher/Fetcher.ts @@ -20,6 +20,7 @@ export declare namespace Fetcher { maxRetries?: number; withCredentials?: boolean; abortSignal?: AbortSignal; + requestType?: "json" | "file" | "bytes"; responseType?: "json" | "blob" | "streaming" | "text"; } @@ -62,7 +63,10 @@ export async function fetcherImpl(args: Fetcher.Args): Promise { - let requestBody: BodyInit; - if (RUNTIME.type === "node") { - if (body instanceof (await import("formdata-node")).FormData) { - // @ts-expect-error - requestBody = body; - } else if (body instanceof (await import("stream")).Readable) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } - } else { - if (body instanceof (await import("form-data")).default) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } +export declare namespace GetRequestBody { + interface Args { + body: unknown; + type: "json" | "file" | "bytes" | "other"; } - return requestBody; } -export const maybeStringifyBody = (requestBody: any, contentType: string): Uint8Array | string => { - if (requestBody instanceof Uint8Array) { - return requestBody; - } else if (contentType === "application/x-www-form-urlencoded" && typeof requestBody === "string") { - return requestBody; +export async function getRequestBody({ body, type }: GetRequestBody.Args): Promise { + if (type.includes("json")) { + return JSON.stringify(body); } else { - return JSON.stringify(requestBody); + return body as BodyInit; } -}; +} diff --git a/seed/ts-sdk/single-url-environment-default/src/core/runtime/runtime.ts b/seed/ts-sdk/single-url-environment-default/src/core/runtime/runtime.ts index 30fe0779aaa..4d0687e8eb4 100644 --- a/seed/ts-sdk/single-url-environment-default/src/core/runtime/runtime.ts +++ b/seed/ts-sdk/single-url-environment-default/src/core/runtime/runtime.ts @@ -69,6 +69,7 @@ export const RUNTIME: Runtime = evaluateRuntime(); export interface Runtime { type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd"; version?: string; + parsedVersion?: number; } function evaluateRuntime(): Runtime { @@ -109,6 +110,7 @@ function evaluateRuntime(): Runtime { return { type: "node", version: process.versions.node, + parsedVersion: Number(process.versions.node.split(".")[0]), }; } diff --git a/seed/ts-sdk/single-url-environment-no-default/src/api/resources/dummy/client/Client.ts b/seed/ts-sdk/single-url-environment-no-default/src/api/resources/dummy/client/Client.ts index 51f0e8f0ba1..e722ee18f48 100644 --- a/seed/ts-sdk/single-url-environment-no-default/src/api/resources/dummy/client/Client.ts +++ b/seed/ts-sdk/single-url-environment-no-default/src/api/resources/dummy/client/Client.ts @@ -46,6 +46,7 @@ export class Dummy { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/seed/ts-sdk/single-url-environment-no-default/src/core/fetcher/Fetcher.ts b/seed/ts-sdk/single-url-environment-no-default/src/core/fetcher/Fetcher.ts index d3686367aa9..f3b010358d0 100644 --- a/seed/ts-sdk/single-url-environment-no-default/src/core/fetcher/Fetcher.ts +++ b/seed/ts-sdk/single-url-environment-no-default/src/core/fetcher/Fetcher.ts @@ -20,6 +20,7 @@ export declare namespace Fetcher { maxRetries?: number; withCredentials?: boolean; abortSignal?: AbortSignal; + requestType?: "json" | "file" | "bytes"; responseType?: "json" | "blob" | "streaming" | "text"; } @@ -62,7 +63,10 @@ export async function fetcherImpl(args: Fetcher.Args): Promise { - let requestBody: BodyInit; - if (RUNTIME.type === "node") { - if (body instanceof (await import("formdata-node")).FormData) { - // @ts-expect-error - requestBody = body; - } else if (body instanceof (await import("stream")).Readable) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } - } else { - if (body instanceof (await import("form-data")).default) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } +export declare namespace GetRequestBody { + interface Args { + body: unknown; + type: "json" | "file" | "bytes" | "other"; } - return requestBody; } -export const maybeStringifyBody = (requestBody: any, contentType: string): Uint8Array | string => { - if (requestBody instanceof Uint8Array) { - return requestBody; - } else if (contentType === "application/x-www-form-urlencoded" && typeof requestBody === "string") { - return requestBody; +export async function getRequestBody({ body, type }: GetRequestBody.Args): Promise { + if (type.includes("json")) { + return JSON.stringify(body); } else { - return JSON.stringify(requestBody); + return body as BodyInit; } -}; +} diff --git a/seed/ts-sdk/single-url-environment-no-default/src/core/runtime/runtime.ts b/seed/ts-sdk/single-url-environment-no-default/src/core/runtime/runtime.ts index 30fe0779aaa..4d0687e8eb4 100644 --- a/seed/ts-sdk/single-url-environment-no-default/src/core/runtime/runtime.ts +++ b/seed/ts-sdk/single-url-environment-no-default/src/core/runtime/runtime.ts @@ -69,6 +69,7 @@ export const RUNTIME: Runtime = evaluateRuntime(); export interface Runtime { type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd"; version?: string; + parsedVersion?: number; } function evaluateRuntime(): Runtime { @@ -109,6 +110,7 @@ function evaluateRuntime(): Runtime { return { type: "node", version: process.versions.node, + parsedVersion: Number(process.versions.node.split(".")[0]), }; } diff --git a/seed/ts-sdk/streaming/allow-custom-fetcher/src/api/resources/dummy/client/Client.ts b/seed/ts-sdk/streaming/allow-custom-fetcher/src/api/resources/dummy/client/Client.ts index 2fcd9ea5ce2..106dd34de04 100644 --- a/seed/ts-sdk/streaming/allow-custom-fetcher/src/api/resources/dummy/client/Client.ts +++ b/seed/ts-sdk/streaming/allow-custom-fetcher/src/api/resources/dummy/client/Client.ts @@ -43,6 +43,7 @@ export class Dummy { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: { ...serializers.GenerateStreamRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), stream: true, @@ -117,6 +118,7 @@ export class Dummy { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: { ...serializers.Generateequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), stream: false, diff --git a/seed/ts-sdk/streaming/allow-custom-fetcher/src/core/fetcher/Fetcher.ts b/seed/ts-sdk/streaming/allow-custom-fetcher/src/core/fetcher/Fetcher.ts index d3686367aa9..f3b010358d0 100644 --- a/seed/ts-sdk/streaming/allow-custom-fetcher/src/core/fetcher/Fetcher.ts +++ b/seed/ts-sdk/streaming/allow-custom-fetcher/src/core/fetcher/Fetcher.ts @@ -20,6 +20,7 @@ export declare namespace Fetcher { maxRetries?: number; withCredentials?: boolean; abortSignal?: AbortSignal; + requestType?: "json" | "file" | "bytes"; responseType?: "json" | "blob" | "streaming" | "text"; } @@ -62,7 +63,10 @@ export async function fetcherImpl(args: Fetcher.Args): Promise { - let requestBody: BodyInit; - if (RUNTIME.type === "node") { - if (body instanceof (await import("formdata-node")).FormData) { - // @ts-expect-error - requestBody = body; - } else if (body instanceof (await import("stream")).Readable) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } - } else { - if (body instanceof (await import("form-data")).default) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } +export declare namespace GetRequestBody { + interface Args { + body: unknown; + type: "json" | "file" | "bytes" | "other"; } - return requestBody; } -export const maybeStringifyBody = (requestBody: any, contentType: string): Uint8Array | string => { - if (requestBody instanceof Uint8Array) { - return requestBody; - } else if (contentType === "application/x-www-form-urlencoded" && typeof requestBody === "string") { - return requestBody; +export async function getRequestBody({ body, type }: GetRequestBody.Args): Promise { + if (type.includes("json")) { + return JSON.stringify(body); } else { - return JSON.stringify(requestBody); + return body as BodyInit; } -}; +} diff --git a/seed/ts-sdk/streaming/allow-custom-fetcher/src/core/runtime/runtime.ts b/seed/ts-sdk/streaming/allow-custom-fetcher/src/core/runtime/runtime.ts index 30fe0779aaa..4d0687e8eb4 100644 --- a/seed/ts-sdk/streaming/allow-custom-fetcher/src/core/runtime/runtime.ts +++ b/seed/ts-sdk/streaming/allow-custom-fetcher/src/core/runtime/runtime.ts @@ -69,6 +69,7 @@ export const RUNTIME: Runtime = evaluateRuntime(); export interface Runtime { type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd"; version?: string; + parsedVersion?: number; } function evaluateRuntime(): Runtime { @@ -109,6 +110,7 @@ function evaluateRuntime(): Runtime { return { type: "node", version: process.versions.node, + parsedVersion: Number(process.versions.node.split(".")[0]), }; } diff --git a/seed/ts-sdk/streaming/no-custom-config/src/api/resources/dummy/client/Client.ts b/seed/ts-sdk/streaming/no-custom-config/src/api/resources/dummy/client/Client.ts index a0f2baddf95..b57479596e2 100644 --- a/seed/ts-sdk/streaming/no-custom-config/src/api/resources/dummy/client/Client.ts +++ b/seed/ts-sdk/streaming/no-custom-config/src/api/resources/dummy/client/Client.ts @@ -42,6 +42,7 @@ export class Dummy { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: { ...serializers.GenerateStreamRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), stream: true, @@ -116,6 +117,7 @@ export class Dummy { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: { ...serializers.Generateequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), stream: false, diff --git a/seed/ts-sdk/streaming/no-custom-config/src/core/fetcher/Fetcher.ts b/seed/ts-sdk/streaming/no-custom-config/src/core/fetcher/Fetcher.ts index d3686367aa9..f3b010358d0 100644 --- a/seed/ts-sdk/streaming/no-custom-config/src/core/fetcher/Fetcher.ts +++ b/seed/ts-sdk/streaming/no-custom-config/src/core/fetcher/Fetcher.ts @@ -20,6 +20,7 @@ export declare namespace Fetcher { maxRetries?: number; withCredentials?: boolean; abortSignal?: AbortSignal; + requestType?: "json" | "file" | "bytes"; responseType?: "json" | "blob" | "streaming" | "text"; } @@ -62,7 +63,10 @@ export async function fetcherImpl(args: Fetcher.Args): Promise { - let requestBody: BodyInit; - if (RUNTIME.type === "node") { - if (body instanceof (await import("formdata-node")).FormData) { - // @ts-expect-error - requestBody = body; - } else if (body instanceof (await import("stream")).Readable) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } - } else { - if (body instanceof (await import("form-data")).default) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } +export declare namespace GetRequestBody { + interface Args { + body: unknown; + type: "json" | "file" | "bytes" | "other"; } - return requestBody; } -export const maybeStringifyBody = (requestBody: any, contentType: string): Uint8Array | string => { - if (requestBody instanceof Uint8Array) { - return requestBody; - } else if (contentType === "application/x-www-form-urlencoded" && typeof requestBody === "string") { - return requestBody; +export async function getRequestBody({ body, type }: GetRequestBody.Args): Promise { + if (type.includes("json")) { + return JSON.stringify(body); } else { - return JSON.stringify(requestBody); + return body as BodyInit; } -}; +} diff --git a/seed/ts-sdk/streaming/no-custom-config/src/core/runtime/runtime.ts b/seed/ts-sdk/streaming/no-custom-config/src/core/runtime/runtime.ts index 30fe0779aaa..4d0687e8eb4 100644 --- a/seed/ts-sdk/streaming/no-custom-config/src/core/runtime/runtime.ts +++ b/seed/ts-sdk/streaming/no-custom-config/src/core/runtime/runtime.ts @@ -69,6 +69,7 @@ export const RUNTIME: Runtime = evaluateRuntime(); export interface Runtime { type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd"; version?: string; + parsedVersion?: number; } function evaluateRuntime(): Runtime { @@ -109,6 +110,7 @@ function evaluateRuntime(): Runtime { return { type: "node", version: process.versions.node, + parsedVersion: Number(process.versions.node.split(".")[0]), }; } diff --git a/seed/ts-sdk/trace/exhaustive/src/api/resources/admin/client/Client.ts b/seed/ts-sdk/trace/exhaustive/src/api/resources/admin/client/Client.ts index f2080e07521..3a9c1728b7f 100644 --- a/seed/ts-sdk/trace/exhaustive/src/api/resources/admin/client/Client.ts +++ b/seed/ts-sdk/trace/exhaustive/src/api/resources/admin/client/Client.ts @@ -65,6 +65,7 @@ export class Admin { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.TestSubmissionStatus.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : undefined, maxRetries: requestOptions?.maxRetries, @@ -121,6 +122,7 @@ export class Admin { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.TestSubmissionUpdate.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : undefined, maxRetries: requestOptions?.maxRetries, @@ -174,6 +176,7 @@ export class Admin { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.WorkspaceSubmissionStatus.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : undefined, maxRetries: requestOptions?.maxRetries, @@ -230,6 +233,7 @@ export class Admin { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.WorkspaceSubmissionUpdate.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : undefined, maxRetries: requestOptions?.maxRetries, @@ -298,6 +302,7 @@ export class Admin { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.StoreTracedTestCaseRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : undefined, maxRetries: requestOptions?.maxRetries, @@ -361,6 +366,7 @@ export class Admin { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.admin.storeTracedTestCaseV2.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -430,6 +436,7 @@ export class Admin { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.StoreTracedWorkspaceRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : undefined, maxRetries: requestOptions?.maxRetries, @@ -491,6 +498,7 @@ export class Admin { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.admin.storeTracedWorkspaceV2.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), diff --git a/seed/ts-sdk/trace/exhaustive/src/api/resources/homepage/client/Client.ts b/seed/ts-sdk/trace/exhaustive/src/api/resources/homepage/client/Client.ts index a1d885c2edd..a8f0159ef63 100644 --- a/seed/ts-sdk/trace/exhaustive/src/api/resources/homepage/client/Client.ts +++ b/seed/ts-sdk/trace/exhaustive/src/api/resources/homepage/client/Client.ts @@ -59,6 +59,7 @@ export class Homepage { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : undefined, maxRetries: requestOptions?.maxRetries, withCredentials: true, @@ -112,6 +113,7 @@ export class Homepage { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.homepage.setHomepageProblems.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), diff --git a/seed/ts-sdk/trace/exhaustive/src/api/resources/migration/client/Client.ts b/seed/ts-sdk/trace/exhaustive/src/api/resources/migration/client/Client.ts index 5a648b9945f..7caa50af970 100644 --- a/seed/ts-sdk/trace/exhaustive/src/api/resources/migration/client/Client.ts +++ b/seed/ts-sdk/trace/exhaustive/src/api/resources/migration/client/Client.ts @@ -65,6 +65,7 @@ export class Migration { "admin-key-header": adminKeyHeader, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : undefined, maxRetries: requestOptions?.maxRetries, withCredentials: true, diff --git a/seed/ts-sdk/trace/exhaustive/src/api/resources/playlist/client/Client.ts b/seed/ts-sdk/trace/exhaustive/src/api/resources/playlist/client/Client.ts index 5376905005f..feb6beccb58 100644 --- a/seed/ts-sdk/trace/exhaustive/src/api/resources/playlist/client/Client.ts +++ b/seed/ts-sdk/trace/exhaustive/src/api/resources/playlist/client/Client.ts @@ -80,6 +80,7 @@ export class Playlist { }, contentType: "application/json", queryParameters: _queryParams, + requestType: "json", body: serializers.PlaylistCreateRequest.jsonOrThrow(_body, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : undefined, maxRetries: requestOptions?.maxRetries, @@ -167,6 +168,7 @@ export class Playlist { }, contentType: "application/json", queryParameters: _queryParams, + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : undefined, maxRetries: requestOptions?.maxRetries, withCredentials: true, @@ -226,6 +228,7 @@ export class Playlist { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : undefined, maxRetries: requestOptions?.maxRetries, withCredentials: true, @@ -309,6 +312,7 @@ export class Playlist { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: request != null ? serializers.playlist.updatePlaylist.Request.jsonOrThrow(request, { @@ -392,6 +396,7 @@ export class Playlist { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : undefined, maxRetries: requestOptions?.maxRetries, withCredentials: true, diff --git a/seed/ts-sdk/trace/exhaustive/src/api/resources/problem/client/Client.ts b/seed/ts-sdk/trace/exhaustive/src/api/resources/problem/client/Client.ts index a8071a603eb..ee10190a7a8 100644 --- a/seed/ts-sdk/trace/exhaustive/src/api/resources/problem/client/Client.ts +++ b/seed/ts-sdk/trace/exhaustive/src/api/resources/problem/client/Client.ts @@ -93,6 +93,7 @@ export class Problem { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.CreateProblemRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : undefined, maxRetries: requestOptions?.maxRetries, @@ -181,6 +182,7 @@ export class Problem { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.CreateProblemRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : undefined, maxRetries: requestOptions?.maxRetries, @@ -237,6 +239,7 @@ export class Problem { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : undefined, maxRetries: requestOptions?.maxRetries, withCredentials: true, @@ -296,6 +299,7 @@ export class Problem { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.GetDefaultStarterFilesRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : undefined, maxRetries: requestOptions?.maxRetries, diff --git a/seed/ts-sdk/trace/exhaustive/src/api/resources/submission/client/Client.ts b/seed/ts-sdk/trace/exhaustive/src/api/resources/submission/client/Client.ts index 1e203b7302b..87bb8c38e30 100644 --- a/seed/ts-sdk/trace/exhaustive/src/api/resources/submission/client/Client.ts +++ b/seed/ts-sdk/trace/exhaustive/src/api/resources/submission/client/Client.ts @@ -68,6 +68,7 @@ export class Submission { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : undefined, maxRetries: requestOptions?.maxRetries, withCredentials: true, @@ -125,6 +126,7 @@ export class Submission { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : undefined, maxRetries: requestOptions?.maxRetries, withCredentials: true, @@ -180,6 +182,7 @@ export class Submission { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : undefined, maxRetries: requestOptions?.maxRetries, withCredentials: true, @@ -231,6 +234,7 @@ export class Submission { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : undefined, maxRetries: requestOptions?.maxRetries, withCredentials: true, diff --git a/seed/ts-sdk/trace/exhaustive/src/api/resources/sysprop/client/Client.ts b/seed/ts-sdk/trace/exhaustive/src/api/resources/sysprop/client/Client.ts index 0b3d255ca28..3a1f2b670ce 100644 --- a/seed/ts-sdk/trace/exhaustive/src/api/resources/sysprop/client/Client.ts +++ b/seed/ts-sdk/trace/exhaustive/src/api/resources/sysprop/client/Client.ts @@ -65,6 +65,7 @@ export class Sysprop { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : undefined, maxRetries: requestOptions?.maxRetries, withCredentials: true, @@ -113,6 +114,7 @@ export class Sysprop { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : undefined, maxRetries: requestOptions?.maxRetries, withCredentials: true, diff --git a/seed/ts-sdk/trace/exhaustive/src/api/resources/v2/client/Client.ts b/seed/ts-sdk/trace/exhaustive/src/api/resources/v2/client/Client.ts index 3afb040d8a3..7d99fb940fc 100644 --- a/seed/ts-sdk/trace/exhaustive/src/api/resources/v2/client/Client.ts +++ b/seed/ts-sdk/trace/exhaustive/src/api/resources/v2/client/Client.ts @@ -54,6 +54,7 @@ export class V2 { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : undefined, maxRetries: requestOptions?.maxRetries, withCredentials: true, diff --git a/seed/ts-sdk/trace/exhaustive/src/api/resources/v2/resources/problem/client/Client.ts b/seed/ts-sdk/trace/exhaustive/src/api/resources/v2/resources/problem/client/Client.ts index 6c55dc07738..4e8e9d0ed9b 100644 --- a/seed/ts-sdk/trace/exhaustive/src/api/resources/v2/resources/problem/client/Client.ts +++ b/seed/ts-sdk/trace/exhaustive/src/api/resources/v2/resources/problem/client/Client.ts @@ -63,6 +63,7 @@ export class Problem { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : undefined, maxRetries: requestOptions?.maxRetries, withCredentials: true, @@ -116,6 +117,7 @@ export class Problem { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : undefined, maxRetries: requestOptions?.maxRetries, withCredentials: true, @@ -171,6 +173,7 @@ export class Problem { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : undefined, maxRetries: requestOptions?.maxRetries, withCredentials: true, @@ -230,6 +233,7 @@ export class Problem { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : undefined, maxRetries: requestOptions?.maxRetries, withCredentials: true, diff --git a/seed/ts-sdk/trace/exhaustive/src/api/resources/v2/resources/v3/resources/problem/client/Client.ts b/seed/ts-sdk/trace/exhaustive/src/api/resources/v2/resources/v3/resources/problem/client/Client.ts index 955e4ee92a2..547c92e2579 100644 --- a/seed/ts-sdk/trace/exhaustive/src/api/resources/v2/resources/v3/resources/problem/client/Client.ts +++ b/seed/ts-sdk/trace/exhaustive/src/api/resources/v2/resources/v3/resources/problem/client/Client.ts @@ -66,6 +66,7 @@ export class Problem { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : undefined, maxRetries: requestOptions?.maxRetries, withCredentials: true, @@ -119,6 +120,7 @@ export class Problem { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : undefined, maxRetries: requestOptions?.maxRetries, withCredentials: true, @@ -174,6 +176,7 @@ export class Problem { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : undefined, maxRetries: requestOptions?.maxRetries, withCredentials: true, @@ -233,6 +236,7 @@ export class Problem { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : undefined, maxRetries: requestOptions?.maxRetries, withCredentials: true, diff --git a/seed/ts-sdk/trace/exhaustive/src/core/fetcher/Fetcher.ts b/seed/ts-sdk/trace/exhaustive/src/core/fetcher/Fetcher.ts index d3686367aa9..f3b010358d0 100644 --- a/seed/ts-sdk/trace/exhaustive/src/core/fetcher/Fetcher.ts +++ b/seed/ts-sdk/trace/exhaustive/src/core/fetcher/Fetcher.ts @@ -20,6 +20,7 @@ export declare namespace Fetcher { maxRetries?: number; withCredentials?: boolean; abortSignal?: AbortSignal; + requestType?: "json" | "file" | "bytes"; responseType?: "json" | "blob" | "streaming" | "text"; } @@ -62,7 +63,10 @@ export async function fetcherImpl(args: Fetcher.Args): Promise { - let requestBody: BodyInit; - if (RUNTIME.type === "node") { - if (body instanceof (await import("formdata-node")).FormData) { - // @ts-expect-error - requestBody = body; - } else if (body instanceof (await import("stream")).Readable) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } - } else { - if (body instanceof (await import("form-data")).default) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } +export declare namespace GetRequestBody { + interface Args { + body: unknown; + type: "json" | "file" | "bytes" | "other"; } - return requestBody; } -export const maybeStringifyBody = (requestBody: any, contentType: string): Uint8Array | string => { - if (requestBody instanceof Uint8Array) { - return requestBody; - } else if (contentType === "application/x-www-form-urlencoded" && typeof requestBody === "string") { - return requestBody; +export async function getRequestBody({ body, type }: GetRequestBody.Args): Promise { + if (type.includes("json")) { + return JSON.stringify(body); } else { - return JSON.stringify(requestBody); + return body as BodyInit; } -}; +} diff --git a/seed/ts-sdk/trace/exhaustive/src/core/runtime/runtime.ts b/seed/ts-sdk/trace/exhaustive/src/core/runtime/runtime.ts index 30fe0779aaa..4d0687e8eb4 100644 --- a/seed/ts-sdk/trace/exhaustive/src/core/runtime/runtime.ts +++ b/seed/ts-sdk/trace/exhaustive/src/core/runtime/runtime.ts @@ -69,6 +69,7 @@ export const RUNTIME: Runtime = evaluateRuntime(); export interface Runtime { type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd"; version?: string; + parsedVersion?: number; } function evaluateRuntime(): Runtime { @@ -109,6 +110,7 @@ function evaluateRuntime(): Runtime { return { type: "node", version: process.versions.node, + parsedVersion: Number(process.versions.node.split(".")[0]), }; } diff --git a/seed/ts-sdk/trace/no-custom-config/src/api/resources/admin/client/Client.ts b/seed/ts-sdk/trace/no-custom-config/src/api/resources/admin/client/Client.ts index 789b57435ba..7baa47243d8 100644 --- a/seed/ts-sdk/trace/no-custom-config/src/api/resources/admin/client/Client.ts +++ b/seed/ts-sdk/trace/no-custom-config/src/api/resources/admin/client/Client.ts @@ -68,6 +68,7 @@ export class Admin { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.TestSubmissionStatus.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -139,6 +140,7 @@ export class Admin { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.TestSubmissionUpdate.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -206,6 +208,7 @@ export class Admin { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.WorkspaceSubmissionStatus.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -277,6 +280,7 @@ export class Admin { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.WorkspaceSubmissionUpdate.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -360,6 +364,7 @@ export class Admin { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.StoreTracedTestCaseRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -438,6 +443,7 @@ export class Admin { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.admin.storeTracedTestCaseV2.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), @@ -524,6 +530,7 @@ export class Admin { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.StoreTracedWorkspaceRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -600,6 +607,7 @@ export class Admin { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.admin.storeTracedWorkspaceV2.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), diff --git a/seed/ts-sdk/trace/no-custom-config/src/api/resources/homepage/client/Client.ts b/seed/ts-sdk/trace/no-custom-config/src/api/resources/homepage/client/Client.ts index 485d9f35f40..866b626af11 100644 --- a/seed/ts-sdk/trace/no-custom-config/src/api/resources/homepage/client/Client.ts +++ b/seed/ts-sdk/trace/no-custom-config/src/api/resources/homepage/client/Client.ts @@ -58,6 +58,7 @@ export class Homepage { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -123,6 +124,7 @@ export class Homepage { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.homepage.setHomepageProblems.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), diff --git a/seed/ts-sdk/trace/no-custom-config/src/api/resources/migration/client/Client.ts b/seed/ts-sdk/trace/no-custom-config/src/api/resources/migration/client/Client.ts index 5010c657412..5e5b811e5d5 100644 --- a/seed/ts-sdk/trace/no-custom-config/src/api/resources/migration/client/Client.ts +++ b/seed/ts-sdk/trace/no-custom-config/src/api/resources/migration/client/Client.ts @@ -66,6 +66,7 @@ export class Migration { "admin-key-header": adminKeyHeader, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/seed/ts-sdk/trace/no-custom-config/src/api/resources/playlist/client/Client.ts b/seed/ts-sdk/trace/no-custom-config/src/api/resources/playlist/client/Client.ts index 959e18d59b4..8cba59974ef 100644 --- a/seed/ts-sdk/trace/no-custom-config/src/api/resources/playlist/client/Client.ts +++ b/seed/ts-sdk/trace/no-custom-config/src/api/resources/playlist/client/Client.ts @@ -81,6 +81,7 @@ export class Playlist { }, contentType: "application/json", queryParameters: _queryParams, + requestType: "json", body: serializers.PlaylistCreateRequest.jsonOrThrow(_body, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -180,6 +181,7 @@ export class Playlist { }, contentType: "application/json", queryParameters: _queryParams, + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -254,6 +256,7 @@ export class Playlist { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -346,6 +349,7 @@ export class Playlist { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: request != null ? serializers.playlist.updatePlaylist.Request.jsonOrThrow(request, { @@ -435,6 +439,7 @@ export class Playlist { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/seed/ts-sdk/trace/no-custom-config/src/api/resources/problem/client/Client.ts b/seed/ts-sdk/trace/no-custom-config/src/api/resources/problem/client/Client.ts index 82371f0ed27..e5fa4f0cc1d 100644 --- a/seed/ts-sdk/trace/no-custom-config/src/api/resources/problem/client/Client.ts +++ b/seed/ts-sdk/trace/no-custom-config/src/api/resources/problem/client/Client.ts @@ -107,6 +107,7 @@ export class Problem { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.CreateProblemRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -220,6 +221,7 @@ export class Problem { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.CreateProblemRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -285,6 +287,7 @@ export class Problem { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -358,6 +361,7 @@ export class Problem { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.GetDefaultStarterFilesRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, diff --git a/seed/ts-sdk/trace/no-custom-config/src/api/resources/submission/client/Client.ts b/seed/ts-sdk/trace/no-custom-config/src/api/resources/submission/client/Client.ts index 55ad76f4977..859d24c6e82 100644 --- a/seed/ts-sdk/trace/no-custom-config/src/api/resources/submission/client/Client.ts +++ b/seed/ts-sdk/trace/no-custom-config/src/api/resources/submission/client/Client.ts @@ -67,6 +67,7 @@ export class Submission { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -134,6 +135,7 @@ export class Submission { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -198,6 +200,7 @@ export class Submission { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -256,6 +259,7 @@ export class Submission { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/seed/ts-sdk/trace/no-custom-config/src/api/resources/sysprop/client/Client.ts b/seed/ts-sdk/trace/no-custom-config/src/api/resources/sysprop/client/Client.ts index 2af30c1f38f..e3c031ff494 100644 --- a/seed/ts-sdk/trace/no-custom-config/src/api/resources/sysprop/client/Client.ts +++ b/seed/ts-sdk/trace/no-custom-config/src/api/resources/sysprop/client/Client.ts @@ -66,6 +66,7 @@ export class Sysprop { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -124,6 +125,7 @@ export class Sysprop { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/seed/ts-sdk/trace/no-custom-config/src/api/resources/v2/client/Client.ts b/seed/ts-sdk/trace/no-custom-config/src/api/resources/v2/client/Client.ts index 8396b208762..dbeaa7b9877 100644 --- a/seed/ts-sdk/trace/no-custom-config/src/api/resources/v2/client/Client.ts +++ b/seed/ts-sdk/trace/no-custom-config/src/api/resources/v2/client/Client.ts @@ -54,6 +54,7 @@ export class V2 { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/seed/ts-sdk/trace/no-custom-config/src/api/resources/v2/resources/problem/client/Client.ts b/seed/ts-sdk/trace/no-custom-config/src/api/resources/v2/resources/problem/client/Client.ts index e9d76a897e6..34a21aeadac 100644 --- a/seed/ts-sdk/trace/no-custom-config/src/api/resources/v2/resources/problem/client/Client.ts +++ b/seed/ts-sdk/trace/no-custom-config/src/api/resources/v2/resources/problem/client/Client.ts @@ -62,6 +62,7 @@ export class Problem { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -125,6 +126,7 @@ export class Problem { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -192,6 +194,7 @@ export class Problem { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -263,6 +266,7 @@ export class Problem { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/seed/ts-sdk/trace/no-custom-config/src/api/resources/v2/resources/v3/resources/problem/client/Client.ts b/seed/ts-sdk/trace/no-custom-config/src/api/resources/v2/resources/v3/resources/problem/client/Client.ts index 182d85364fc..c6c3ea24fe0 100644 --- a/seed/ts-sdk/trace/no-custom-config/src/api/resources/v2/resources/v3/resources/problem/client/Client.ts +++ b/seed/ts-sdk/trace/no-custom-config/src/api/resources/v2/resources/v3/resources/problem/client/Client.ts @@ -62,6 +62,7 @@ export class Problem { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -125,6 +126,7 @@ export class Problem { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -192,6 +194,7 @@ export class Problem { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -263,6 +266,7 @@ export class Problem { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/seed/ts-sdk/trace/no-custom-config/src/core/fetcher/Fetcher.ts b/seed/ts-sdk/trace/no-custom-config/src/core/fetcher/Fetcher.ts index d3686367aa9..f3b010358d0 100644 --- a/seed/ts-sdk/trace/no-custom-config/src/core/fetcher/Fetcher.ts +++ b/seed/ts-sdk/trace/no-custom-config/src/core/fetcher/Fetcher.ts @@ -20,6 +20,7 @@ export declare namespace Fetcher { maxRetries?: number; withCredentials?: boolean; abortSignal?: AbortSignal; + requestType?: "json" | "file" | "bytes"; responseType?: "json" | "blob" | "streaming" | "text"; } @@ -62,7 +63,10 @@ export async function fetcherImpl(args: Fetcher.Args): Promise { - let requestBody: BodyInit; - if (RUNTIME.type === "node") { - if (body instanceof (await import("formdata-node")).FormData) { - // @ts-expect-error - requestBody = body; - } else if (body instanceof (await import("stream")).Readable) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } - } else { - if (body instanceof (await import("form-data")).default) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } +export declare namespace GetRequestBody { + interface Args { + body: unknown; + type: "json" | "file" | "bytes" | "other"; } - return requestBody; } -export const maybeStringifyBody = (requestBody: any, contentType: string): Uint8Array | string => { - if (requestBody instanceof Uint8Array) { - return requestBody; - } else if (contentType === "application/x-www-form-urlencoded" && typeof requestBody === "string") { - return requestBody; +export async function getRequestBody({ body, type }: GetRequestBody.Args): Promise { + if (type.includes("json")) { + return JSON.stringify(body); } else { - return JSON.stringify(requestBody); + return body as BodyInit; } -}; +} diff --git a/seed/ts-sdk/trace/no-custom-config/src/core/runtime/runtime.ts b/seed/ts-sdk/trace/no-custom-config/src/core/runtime/runtime.ts index 30fe0779aaa..4d0687e8eb4 100644 --- a/seed/ts-sdk/trace/no-custom-config/src/core/runtime/runtime.ts +++ b/seed/ts-sdk/trace/no-custom-config/src/core/runtime/runtime.ts @@ -69,6 +69,7 @@ export const RUNTIME: Runtime = evaluateRuntime(); export interface Runtime { type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd"; version?: string; + parsedVersion?: number; } function evaluateRuntime(): Runtime { @@ -109,6 +110,7 @@ function evaluateRuntime(): Runtime { return { type: "node", version: process.versions.node, + parsedVersion: Number(process.versions.node.split(".")[0]), }; } diff --git a/seed/ts-sdk/trace/no-zurg-no-throwing/src/api/resources/admin/client/Client.ts b/seed/ts-sdk/trace/no-zurg-no-throwing/src/api/resources/admin/client/Client.ts index 6a65ea9c732..c96a0483866 100644 --- a/seed/ts-sdk/trace/no-zurg-no-throwing/src/api/resources/admin/client/Client.ts +++ b/seed/ts-sdk/trace/no-zurg-no-throwing/src/api/resources/admin/client/Client.ts @@ -64,6 +64,7 @@ export class Admin { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: request, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -120,6 +121,7 @@ export class Admin { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: request, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -172,6 +174,7 @@ export class Admin { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: request, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -228,6 +231,7 @@ export class Admin { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: request, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -298,6 +302,7 @@ export class Admin { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: request, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -363,6 +368,7 @@ export class Admin { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: request, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -432,6 +438,7 @@ export class Admin { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: request, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -493,6 +500,7 @@ export class Admin { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: request, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, diff --git a/seed/ts-sdk/trace/no-zurg-no-throwing/src/api/resources/homepage/client/Client.ts b/seed/ts-sdk/trace/no-zurg-no-throwing/src/api/resources/homepage/client/Client.ts index 2e7a59dcd1e..8e2869a21ca 100644 --- a/seed/ts-sdk/trace/no-zurg-no-throwing/src/api/resources/homepage/client/Client.ts +++ b/seed/ts-sdk/trace/no-zurg-no-throwing/src/api/resources/homepage/client/Client.ts @@ -58,6 +58,7 @@ export class Homepage { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -105,6 +106,7 @@ export class Homepage { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: request, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, diff --git a/seed/ts-sdk/trace/no-zurg-no-throwing/src/api/resources/migration/client/Client.ts b/seed/ts-sdk/trace/no-zurg-no-throwing/src/api/resources/migration/client/Client.ts index f4a0b2f1e2a..07b2708b5fa 100644 --- a/seed/ts-sdk/trace/no-zurg-no-throwing/src/api/resources/migration/client/Client.ts +++ b/seed/ts-sdk/trace/no-zurg-no-throwing/src/api/resources/migration/client/Client.ts @@ -64,6 +64,7 @@ export class Migration { "admin-key-header": adminKeyHeader, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/seed/ts-sdk/trace/no-zurg-no-throwing/src/api/resources/playlist/client/Client.ts b/seed/ts-sdk/trace/no-zurg-no-throwing/src/api/resources/playlist/client/Client.ts index 60933162fe1..b34e464f401 100644 --- a/seed/ts-sdk/trace/no-zurg-no-throwing/src/api/resources/playlist/client/Client.ts +++ b/seed/ts-sdk/trace/no-zurg-no-throwing/src/api/resources/playlist/client/Client.ts @@ -79,6 +79,7 @@ export class Playlist { }, contentType: "application/json", queryParameters: _queryParams, + requestType: "json", body: _body, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -160,6 +161,7 @@ export class Playlist { }, contentType: "application/json", queryParameters: _queryParams, + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -211,6 +213,7 @@ export class Playlist { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -278,6 +281,7 @@ export class Playlist { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: request != null ? request : undefined, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -340,6 +344,7 @@ export class Playlist { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/seed/ts-sdk/trace/no-zurg-no-throwing/src/api/resources/problem/client/Client.ts b/seed/ts-sdk/trace/no-zurg-no-throwing/src/api/resources/problem/client/Client.ts index 8ba9fda4bc3..a9b41110220 100644 --- a/seed/ts-sdk/trace/no-zurg-no-throwing/src/api/resources/problem/client/Client.ts +++ b/seed/ts-sdk/trace/no-zurg-no-throwing/src/api/resources/problem/client/Client.ts @@ -105,6 +105,7 @@ export class Problem { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: request, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -200,6 +201,7 @@ export class Problem { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: request, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -250,6 +252,7 @@ export class Problem { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -312,6 +315,7 @@ export class Problem { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: request, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, diff --git a/seed/ts-sdk/trace/no-zurg-no-throwing/src/api/resources/submission/client/Client.ts b/seed/ts-sdk/trace/no-zurg-no-throwing/src/api/resources/submission/client/Client.ts index 2d3777e6639..88221a885b8 100644 --- a/seed/ts-sdk/trace/no-zurg-no-throwing/src/api/resources/submission/client/Client.ts +++ b/seed/ts-sdk/trace/no-zurg-no-throwing/src/api/resources/submission/client/Client.ts @@ -67,6 +67,7 @@ export class Submission { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -118,6 +119,7 @@ export class Submission { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -167,6 +169,7 @@ export class Submission { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -217,6 +220,7 @@ export class Submission { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/seed/ts-sdk/trace/no-zurg-no-throwing/src/api/resources/sysprop/client/Client.ts b/seed/ts-sdk/trace/no-zurg-no-throwing/src/api/resources/sysprop/client/Client.ts index 5265d2785ff..36353800b84 100644 --- a/seed/ts-sdk/trace/no-zurg-no-throwing/src/api/resources/sysprop/client/Client.ts +++ b/seed/ts-sdk/trace/no-zurg-no-throwing/src/api/resources/sysprop/client/Client.ts @@ -62,6 +62,7 @@ export class Sysprop { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -109,6 +110,7 @@ export class Sysprop { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/seed/ts-sdk/trace/no-zurg-no-throwing/src/api/resources/v2/client/Client.ts b/seed/ts-sdk/trace/no-zurg-no-throwing/src/api/resources/v2/client/Client.ts index 8e70136c982..82175bd0484 100644 --- a/seed/ts-sdk/trace/no-zurg-no-throwing/src/api/resources/v2/client/Client.ts +++ b/seed/ts-sdk/trace/no-zurg-no-throwing/src/api/resources/v2/client/Client.ts @@ -54,6 +54,7 @@ export class V2 { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/seed/ts-sdk/trace/no-zurg-no-throwing/src/api/resources/v2/resources/problem/client/Client.ts b/seed/ts-sdk/trace/no-zurg-no-throwing/src/api/resources/v2/resources/problem/client/Client.ts index bb0fae429b3..05772979789 100644 --- a/seed/ts-sdk/trace/no-zurg-no-throwing/src/api/resources/v2/resources/problem/client/Client.ts +++ b/seed/ts-sdk/trace/no-zurg-no-throwing/src/api/resources/v2/resources/problem/client/Client.ts @@ -62,6 +62,7 @@ export class Problem { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -109,6 +110,7 @@ export class Problem { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -158,6 +160,7 @@ export class Problem { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -211,6 +214,7 @@ export class Problem { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/seed/ts-sdk/trace/no-zurg-no-throwing/src/api/resources/v2/resources/v3/resources/problem/client/Client.ts b/seed/ts-sdk/trace/no-zurg-no-throwing/src/api/resources/v2/resources/v3/resources/problem/client/Client.ts index 8f7e370e267..7268acbed00 100644 --- a/seed/ts-sdk/trace/no-zurg-no-throwing/src/api/resources/v2/resources/v3/resources/problem/client/Client.ts +++ b/seed/ts-sdk/trace/no-zurg-no-throwing/src/api/resources/v2/resources/v3/resources/problem/client/Client.ts @@ -65,6 +65,7 @@ export class Problem { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -112,6 +113,7 @@ export class Problem { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -161,6 +163,7 @@ export class Problem { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -214,6 +217,7 @@ export class Problem { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/seed/ts-sdk/trace/no-zurg-no-throwing/src/core/fetcher/Fetcher.ts b/seed/ts-sdk/trace/no-zurg-no-throwing/src/core/fetcher/Fetcher.ts index d3686367aa9..f3b010358d0 100644 --- a/seed/ts-sdk/trace/no-zurg-no-throwing/src/core/fetcher/Fetcher.ts +++ b/seed/ts-sdk/trace/no-zurg-no-throwing/src/core/fetcher/Fetcher.ts @@ -20,6 +20,7 @@ export declare namespace Fetcher { maxRetries?: number; withCredentials?: boolean; abortSignal?: AbortSignal; + requestType?: "json" | "file" | "bytes"; responseType?: "json" | "blob" | "streaming" | "text"; } @@ -62,7 +63,10 @@ export async function fetcherImpl(args: Fetcher.Args): Promise { - let requestBody: BodyInit; - if (RUNTIME.type === "node") { - if (body instanceof (await import("formdata-node")).FormData) { - // @ts-expect-error - requestBody = body; - } else if (body instanceof (await import("stream")).Readable) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } - } else { - if (body instanceof (await import("form-data")).default) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } +export declare namespace GetRequestBody { + interface Args { + body: unknown; + type: "json" | "file" | "bytes" | "other"; } - return requestBody; } -export const maybeStringifyBody = (requestBody: any, contentType: string): Uint8Array | string => { - if (requestBody instanceof Uint8Array) { - return requestBody; - } else if (contentType === "application/x-www-form-urlencoded" && typeof requestBody === "string") { - return requestBody; +export async function getRequestBody({ body, type }: GetRequestBody.Args): Promise { + if (type.includes("json")) { + return JSON.stringify(body); } else { - return JSON.stringify(requestBody); + return body as BodyInit; } -}; +} diff --git a/seed/ts-sdk/trace/no-zurg-no-throwing/src/core/runtime/runtime.ts b/seed/ts-sdk/trace/no-zurg-no-throwing/src/core/runtime/runtime.ts index 30fe0779aaa..4d0687e8eb4 100644 --- a/seed/ts-sdk/trace/no-zurg-no-throwing/src/core/runtime/runtime.ts +++ b/seed/ts-sdk/trace/no-zurg-no-throwing/src/core/runtime/runtime.ts @@ -69,6 +69,7 @@ export const RUNTIME: Runtime = evaluateRuntime(); export interface Runtime { type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd"; version?: string; + parsedVersion?: number; } function evaluateRuntime(): Runtime { @@ -109,6 +110,7 @@ function evaluateRuntime(): Runtime { return { type: "node", version: process.versions.node, + parsedVersion: Number(process.versions.node.split(".")[0]), }; } diff --git a/seed/ts-sdk/trace/no-zurg-trace/src/api/resources/admin/client/Client.ts b/seed/ts-sdk/trace/no-zurg-trace/src/api/resources/admin/client/Client.ts index bc329b4602c..65e76f531d6 100644 --- a/seed/ts-sdk/trace/no-zurg-trace/src/api/resources/admin/client/Client.ts +++ b/seed/ts-sdk/trace/no-zurg-trace/src/api/resources/admin/client/Client.ts @@ -65,6 +65,7 @@ export class Admin { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: request, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -134,6 +135,7 @@ export class Admin { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: request, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -199,6 +201,7 @@ export class Admin { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: request, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -268,6 +271,7 @@ export class Admin { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: request, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -351,6 +355,7 @@ export class Admin { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: request, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -429,6 +434,7 @@ export class Admin { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: request, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -511,6 +517,7 @@ export class Admin { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: request, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -585,6 +592,7 @@ export class Admin { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: request, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, diff --git a/seed/ts-sdk/trace/no-zurg-trace/src/api/resources/homepage/client/Client.ts b/seed/ts-sdk/trace/no-zurg-trace/src/api/resources/homepage/client/Client.ts index a8fb8a27aba..6c14b3f93f3 100644 --- a/seed/ts-sdk/trace/no-zurg-trace/src/api/resources/homepage/client/Client.ts +++ b/seed/ts-sdk/trace/no-zurg-trace/src/api/resources/homepage/client/Client.ts @@ -57,6 +57,7 @@ export class Homepage { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -117,6 +118,7 @@ export class Homepage { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: request, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, diff --git a/seed/ts-sdk/trace/no-zurg-trace/src/api/resources/migration/client/Client.ts b/seed/ts-sdk/trace/no-zurg-trace/src/api/resources/migration/client/Client.ts index 9e7c592d43f..ab79c024239 100644 --- a/seed/ts-sdk/trace/no-zurg-trace/src/api/resources/migration/client/Client.ts +++ b/seed/ts-sdk/trace/no-zurg-trace/src/api/resources/migration/client/Client.ts @@ -65,6 +65,7 @@ export class Migration { "admin-key-header": adminKeyHeader, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/seed/ts-sdk/trace/no-zurg-trace/src/api/resources/playlist/client/Client.ts b/seed/ts-sdk/trace/no-zurg-trace/src/api/resources/playlist/client/Client.ts index e0bf5b4d092..71c59415681 100644 --- a/seed/ts-sdk/trace/no-zurg-trace/src/api/resources/playlist/client/Client.ts +++ b/seed/ts-sdk/trace/no-zurg-trace/src/api/resources/playlist/client/Client.ts @@ -80,6 +80,7 @@ export class Playlist { }, contentType: "application/json", queryParameters: _queryParams, + requestType: "json", body: _body, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -174,6 +175,7 @@ export class Playlist { }, contentType: "application/json", queryParameters: _queryParams, + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -241,6 +243,7 @@ export class Playlist { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -321,6 +324,7 @@ export class Playlist { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: request != null ? request : undefined, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -393,6 +397,7 @@ export class Playlist { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/seed/ts-sdk/trace/no-zurg-trace/src/api/resources/problem/client/Client.ts b/seed/ts-sdk/trace/no-zurg-trace/src/api/resources/problem/client/Client.ts index 7abcc150d4d..f30eeff419e 100644 --- a/seed/ts-sdk/trace/no-zurg-trace/src/api/resources/problem/client/Client.ts +++ b/seed/ts-sdk/trace/no-zurg-trace/src/api/resources/problem/client/Client.ts @@ -106,6 +106,7 @@ export class Problem { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: request, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -214,6 +215,7 @@ export class Problem { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: request, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -274,6 +276,7 @@ export class Problem { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -347,6 +350,7 @@ export class Problem { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: request, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, diff --git a/seed/ts-sdk/trace/no-zurg-trace/src/api/resources/submission/client/Client.ts b/seed/ts-sdk/trace/no-zurg-trace/src/api/resources/submission/client/Client.ts index 557ecfeae4e..fbd68395fc4 100644 --- a/seed/ts-sdk/trace/no-zurg-trace/src/api/resources/submission/client/Client.ts +++ b/seed/ts-sdk/trace/no-zurg-trace/src/api/resources/submission/client/Client.ts @@ -66,6 +66,7 @@ export class Submission { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -128,6 +129,7 @@ export class Submission { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -187,6 +189,7 @@ export class Submission { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -245,6 +248,7 @@ export class Submission { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/seed/ts-sdk/trace/no-zurg-trace/src/api/resources/sysprop/client/Client.ts b/seed/ts-sdk/trace/no-zurg-trace/src/api/resources/sysprop/client/Client.ts index 89e4ab0de35..80eb2ee0c28 100644 --- a/seed/ts-sdk/trace/no-zurg-trace/src/api/resources/sysprop/client/Client.ts +++ b/seed/ts-sdk/trace/no-zurg-trace/src/api/resources/sysprop/client/Client.ts @@ -63,6 +63,7 @@ export class Sysprop { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -121,6 +122,7 @@ export class Sysprop { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/seed/ts-sdk/trace/no-zurg-trace/src/api/resources/v2/client/Client.ts b/seed/ts-sdk/trace/no-zurg-trace/src/api/resources/v2/client/Client.ts index 8396b208762..dbeaa7b9877 100644 --- a/seed/ts-sdk/trace/no-zurg-trace/src/api/resources/v2/client/Client.ts +++ b/seed/ts-sdk/trace/no-zurg-trace/src/api/resources/v2/client/Client.ts @@ -54,6 +54,7 @@ export class V2 { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/seed/ts-sdk/trace/no-zurg-trace/src/api/resources/v2/resources/problem/client/Client.ts b/seed/ts-sdk/trace/no-zurg-trace/src/api/resources/v2/resources/problem/client/Client.ts index a26f43d602c..7a285f1145e 100644 --- a/seed/ts-sdk/trace/no-zurg-trace/src/api/resources/v2/resources/problem/client/Client.ts +++ b/seed/ts-sdk/trace/no-zurg-trace/src/api/resources/v2/resources/problem/client/Client.ts @@ -61,6 +61,7 @@ export class Problem { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -119,6 +120,7 @@ export class Problem { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -181,6 +183,7 @@ export class Problem { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -247,6 +250,7 @@ export class Problem { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/seed/ts-sdk/trace/no-zurg-trace/src/api/resources/v2/resources/v3/resources/problem/client/Client.ts b/seed/ts-sdk/trace/no-zurg-trace/src/api/resources/v2/resources/v3/resources/problem/client/Client.ts index 4869cfecf2d..06168349c35 100644 --- a/seed/ts-sdk/trace/no-zurg-trace/src/api/resources/v2/resources/v3/resources/problem/client/Client.ts +++ b/seed/ts-sdk/trace/no-zurg-trace/src/api/resources/v2/resources/v3/resources/problem/client/Client.ts @@ -61,6 +61,7 @@ export class Problem { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -119,6 +120,7 @@ export class Problem { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -181,6 +183,7 @@ export class Problem { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -247,6 +250,7 @@ export class Problem { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/seed/ts-sdk/trace/no-zurg-trace/src/core/fetcher/Fetcher.ts b/seed/ts-sdk/trace/no-zurg-trace/src/core/fetcher/Fetcher.ts index d3686367aa9..f3b010358d0 100644 --- a/seed/ts-sdk/trace/no-zurg-trace/src/core/fetcher/Fetcher.ts +++ b/seed/ts-sdk/trace/no-zurg-trace/src/core/fetcher/Fetcher.ts @@ -20,6 +20,7 @@ export declare namespace Fetcher { maxRetries?: number; withCredentials?: boolean; abortSignal?: AbortSignal; + requestType?: "json" | "file" | "bytes"; responseType?: "json" | "blob" | "streaming" | "text"; } @@ -62,7 +63,10 @@ export async function fetcherImpl(args: Fetcher.Args): Promise { - let requestBody: BodyInit; - if (RUNTIME.type === "node") { - if (body instanceof (await import("formdata-node")).FormData) { - // @ts-expect-error - requestBody = body; - } else if (body instanceof (await import("stream")).Readable) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } - } else { - if (body instanceof (await import("form-data")).default) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } +export declare namespace GetRequestBody { + interface Args { + body: unknown; + type: "json" | "file" | "bytes" | "other"; } - return requestBody; } -export const maybeStringifyBody = (requestBody: any, contentType: string): Uint8Array | string => { - if (requestBody instanceof Uint8Array) { - return requestBody; - } else if (contentType === "application/x-www-form-urlencoded" && typeof requestBody === "string") { - return requestBody; +export async function getRequestBody({ body, type }: GetRequestBody.Args): Promise { + if (type.includes("json")) { + return JSON.stringify(body); } else { - return JSON.stringify(requestBody); + return body as BodyInit; } -}; +} diff --git a/seed/ts-sdk/trace/no-zurg-trace/src/core/runtime/runtime.ts b/seed/ts-sdk/trace/no-zurg-trace/src/core/runtime/runtime.ts index 30fe0779aaa..4d0687e8eb4 100644 --- a/seed/ts-sdk/trace/no-zurg-trace/src/core/runtime/runtime.ts +++ b/seed/ts-sdk/trace/no-zurg-trace/src/core/runtime/runtime.ts @@ -69,6 +69,7 @@ export const RUNTIME: Runtime = evaluateRuntime(); export interface Runtime { type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd"; version?: string; + parsedVersion?: number; } function evaluateRuntime(): Runtime { @@ -109,6 +110,7 @@ function evaluateRuntime(): Runtime { return { type: "node", version: process.versions.node, + parsedVersion: Number(process.versions.node.split(".")[0]), }; } diff --git a/seed/ts-sdk/undiscriminated-unions/no-custom-config/src/api/resources/union/client/Client.ts b/seed/ts-sdk/undiscriminated-unions/no-custom-config/src/api/resources/union/client/Client.ts index e2b3e675281..0562b0021aa 100644 --- a/seed/ts-sdk/undiscriminated-unions/no-custom-config/src/api/resources/union/client/Client.ts +++ b/seed/ts-sdk/undiscriminated-unions/no-custom-config/src/api/resources/union/client/Client.ts @@ -48,6 +48,7 @@ export class Union { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.MyUnion.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -102,6 +103,7 @@ export class Union { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/seed/ts-sdk/undiscriminated-unions/no-custom-config/src/core/fetcher/Fetcher.ts b/seed/ts-sdk/undiscriminated-unions/no-custom-config/src/core/fetcher/Fetcher.ts index d3686367aa9..f3b010358d0 100644 --- a/seed/ts-sdk/undiscriminated-unions/no-custom-config/src/core/fetcher/Fetcher.ts +++ b/seed/ts-sdk/undiscriminated-unions/no-custom-config/src/core/fetcher/Fetcher.ts @@ -20,6 +20,7 @@ export declare namespace Fetcher { maxRetries?: number; withCredentials?: boolean; abortSignal?: AbortSignal; + requestType?: "json" | "file" | "bytes"; responseType?: "json" | "blob" | "streaming" | "text"; } @@ -62,7 +63,10 @@ export async function fetcherImpl(args: Fetcher.Args): Promise { - let requestBody: BodyInit; - if (RUNTIME.type === "node") { - if (body instanceof (await import("formdata-node")).FormData) { - // @ts-expect-error - requestBody = body; - } else if (body instanceof (await import("stream")).Readable) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } - } else { - if (body instanceof (await import("form-data")).default) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } +export declare namespace GetRequestBody { + interface Args { + body: unknown; + type: "json" | "file" | "bytes" | "other"; } - return requestBody; } -export const maybeStringifyBody = (requestBody: any, contentType: string): Uint8Array | string => { - if (requestBody instanceof Uint8Array) { - return requestBody; - } else if (contentType === "application/x-www-form-urlencoded" && typeof requestBody === "string") { - return requestBody; +export async function getRequestBody({ body, type }: GetRequestBody.Args): Promise { + if (type.includes("json")) { + return JSON.stringify(body); } else { - return JSON.stringify(requestBody); + return body as BodyInit; } -}; +} diff --git a/seed/ts-sdk/undiscriminated-unions/no-custom-config/src/core/runtime/runtime.ts b/seed/ts-sdk/undiscriminated-unions/no-custom-config/src/core/runtime/runtime.ts index 30fe0779aaa..4d0687e8eb4 100644 --- a/seed/ts-sdk/undiscriminated-unions/no-custom-config/src/core/runtime/runtime.ts +++ b/seed/ts-sdk/undiscriminated-unions/no-custom-config/src/core/runtime/runtime.ts @@ -69,6 +69,7 @@ export const RUNTIME: Runtime = evaluateRuntime(); export interface Runtime { type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd"; version?: string; + parsedVersion?: number; } function evaluateRuntime(): Runtime { @@ -109,6 +110,7 @@ function evaluateRuntime(): Runtime { return { type: "node", version: process.versions.node, + parsedVersion: Number(process.versions.node.split(".")[0]), }; } diff --git a/seed/ts-sdk/undiscriminated-unions/skip-response-validation/src/api/resources/union/client/Client.ts b/seed/ts-sdk/undiscriminated-unions/skip-response-validation/src/api/resources/union/client/Client.ts index 101055d2c0d..a8b93cd9f8a 100644 --- a/seed/ts-sdk/undiscriminated-unions/skip-response-validation/src/api/resources/union/client/Client.ts +++ b/seed/ts-sdk/undiscriminated-unions/skip-response-validation/src/api/resources/union/client/Client.ts @@ -48,6 +48,7 @@ export class Union { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.MyUnion.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -103,6 +104,7 @@ export class Union { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/seed/ts-sdk/undiscriminated-unions/skip-response-validation/src/core/fetcher/Fetcher.ts b/seed/ts-sdk/undiscriminated-unions/skip-response-validation/src/core/fetcher/Fetcher.ts index d3686367aa9..f3b010358d0 100644 --- a/seed/ts-sdk/undiscriminated-unions/skip-response-validation/src/core/fetcher/Fetcher.ts +++ b/seed/ts-sdk/undiscriminated-unions/skip-response-validation/src/core/fetcher/Fetcher.ts @@ -20,6 +20,7 @@ export declare namespace Fetcher { maxRetries?: number; withCredentials?: boolean; abortSignal?: AbortSignal; + requestType?: "json" | "file" | "bytes"; responseType?: "json" | "blob" | "streaming" | "text"; } @@ -62,7 +63,10 @@ export async function fetcherImpl(args: Fetcher.Args): Promise { - let requestBody: BodyInit; - if (RUNTIME.type === "node") { - if (body instanceof (await import("formdata-node")).FormData) { - // @ts-expect-error - requestBody = body; - } else if (body instanceof (await import("stream")).Readable) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } - } else { - if (body instanceof (await import("form-data")).default) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } +export declare namespace GetRequestBody { + interface Args { + body: unknown; + type: "json" | "file" | "bytes" | "other"; } - return requestBody; } -export const maybeStringifyBody = (requestBody: any, contentType: string): Uint8Array | string => { - if (requestBody instanceof Uint8Array) { - return requestBody; - } else if (contentType === "application/x-www-form-urlencoded" && typeof requestBody === "string") { - return requestBody; +export async function getRequestBody({ body, type }: GetRequestBody.Args): Promise { + if (type.includes("json")) { + return JSON.stringify(body); } else { - return JSON.stringify(requestBody); + return body as BodyInit; } -}; +} diff --git a/seed/ts-sdk/undiscriminated-unions/skip-response-validation/src/core/runtime/runtime.ts b/seed/ts-sdk/undiscriminated-unions/skip-response-validation/src/core/runtime/runtime.ts index 30fe0779aaa..4d0687e8eb4 100644 --- a/seed/ts-sdk/undiscriminated-unions/skip-response-validation/src/core/runtime/runtime.ts +++ b/seed/ts-sdk/undiscriminated-unions/skip-response-validation/src/core/runtime/runtime.ts @@ -69,6 +69,7 @@ export const RUNTIME: Runtime = evaluateRuntime(); export interface Runtime { type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd"; version?: string; + parsedVersion?: number; } function evaluateRuntime(): Runtime { @@ -109,6 +110,7 @@ function evaluateRuntime(): Runtime { return { type: "node", version: process.versions.node, + parsedVersion: Number(process.versions.node.split(".")[0]), }; } diff --git a/seed/ts-sdk/unions/src/api/resources/union/client/Client.ts b/seed/ts-sdk/unions/src/api/resources/union/client/Client.ts index 9b9e30eeb6a..08f47ea7668 100644 --- a/seed/ts-sdk/unions/src/api/resources/union/client/Client.ts +++ b/seed/ts-sdk/unions/src/api/resources/union/client/Client.ts @@ -45,6 +45,7 @@ export class Union { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -103,6 +104,7 @@ export class Union { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.Shape.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, diff --git a/seed/ts-sdk/unions/src/core/fetcher/Fetcher.ts b/seed/ts-sdk/unions/src/core/fetcher/Fetcher.ts index d3686367aa9..f3b010358d0 100644 --- a/seed/ts-sdk/unions/src/core/fetcher/Fetcher.ts +++ b/seed/ts-sdk/unions/src/core/fetcher/Fetcher.ts @@ -20,6 +20,7 @@ export declare namespace Fetcher { maxRetries?: number; withCredentials?: boolean; abortSignal?: AbortSignal; + requestType?: "json" | "file" | "bytes"; responseType?: "json" | "blob" | "streaming" | "text"; } @@ -62,7 +63,10 @@ export async function fetcherImpl(args: Fetcher.Args): Promise { - let requestBody: BodyInit; - if (RUNTIME.type === "node") { - if (body instanceof (await import("formdata-node")).FormData) { - // @ts-expect-error - requestBody = body; - } else if (body instanceof (await import("stream")).Readable) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } - } else { - if (body instanceof (await import("form-data")).default) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } +export declare namespace GetRequestBody { + interface Args { + body: unknown; + type: "json" | "file" | "bytes" | "other"; } - return requestBody; } -export const maybeStringifyBody = (requestBody: any, contentType: string): Uint8Array | string => { - if (requestBody instanceof Uint8Array) { - return requestBody; - } else if (contentType === "application/x-www-form-urlencoded" && typeof requestBody === "string") { - return requestBody; +export async function getRequestBody({ body, type }: GetRequestBody.Args): Promise { + if (type.includes("json")) { + return JSON.stringify(body); } else { - return JSON.stringify(requestBody); + return body as BodyInit; } -}; +} diff --git a/seed/ts-sdk/unions/src/core/runtime/runtime.ts b/seed/ts-sdk/unions/src/core/runtime/runtime.ts index 30fe0779aaa..4d0687e8eb4 100644 --- a/seed/ts-sdk/unions/src/core/runtime/runtime.ts +++ b/seed/ts-sdk/unions/src/core/runtime/runtime.ts @@ -69,6 +69,7 @@ export const RUNTIME: Runtime = evaluateRuntime(); export interface Runtime { type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd"; version?: string; + parsedVersion?: number; } function evaluateRuntime(): Runtime { @@ -109,6 +110,7 @@ function evaluateRuntime(): Runtime { return { type: "node", version: process.versions.node, + parsedVersion: Number(process.versions.node.split(".")[0]), }; } diff --git a/seed/ts-sdk/unknown/no-custom-config/src/api/resources/unknown/client/Client.ts b/seed/ts-sdk/unknown/no-custom-config/src/api/resources/unknown/client/Client.ts index a6df71aea28..d5ee36dc71d 100644 --- a/seed/ts-sdk/unknown/no-custom-config/src/api/resources/unknown/client/Client.ts +++ b/seed/ts-sdk/unknown/no-custom-config/src/api/resources/unknown/client/Client.ts @@ -45,6 +45,7 @@ export class Unknown { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: request, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, diff --git a/seed/ts-sdk/unknown/no-custom-config/src/core/fetcher/Fetcher.ts b/seed/ts-sdk/unknown/no-custom-config/src/core/fetcher/Fetcher.ts index d3686367aa9..f3b010358d0 100644 --- a/seed/ts-sdk/unknown/no-custom-config/src/core/fetcher/Fetcher.ts +++ b/seed/ts-sdk/unknown/no-custom-config/src/core/fetcher/Fetcher.ts @@ -20,6 +20,7 @@ export declare namespace Fetcher { maxRetries?: number; withCredentials?: boolean; abortSignal?: AbortSignal; + requestType?: "json" | "file" | "bytes"; responseType?: "json" | "blob" | "streaming" | "text"; } @@ -62,7 +63,10 @@ export async function fetcherImpl(args: Fetcher.Args): Promise { - let requestBody: BodyInit; - if (RUNTIME.type === "node") { - if (body instanceof (await import("formdata-node")).FormData) { - // @ts-expect-error - requestBody = body; - } else if (body instanceof (await import("stream")).Readable) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } - } else { - if (body instanceof (await import("form-data")).default) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } +export declare namespace GetRequestBody { + interface Args { + body: unknown; + type: "json" | "file" | "bytes" | "other"; } - return requestBody; } -export const maybeStringifyBody = (requestBody: any, contentType: string): Uint8Array | string => { - if (requestBody instanceof Uint8Array) { - return requestBody; - } else if (contentType === "application/x-www-form-urlencoded" && typeof requestBody === "string") { - return requestBody; +export async function getRequestBody({ body, type }: GetRequestBody.Args): Promise { + if (type.includes("json")) { + return JSON.stringify(body); } else { - return JSON.stringify(requestBody); + return body as BodyInit; } -}; +} diff --git a/seed/ts-sdk/unknown/no-custom-config/src/core/runtime/runtime.ts b/seed/ts-sdk/unknown/no-custom-config/src/core/runtime/runtime.ts index 30fe0779aaa..4d0687e8eb4 100644 --- a/seed/ts-sdk/unknown/no-custom-config/src/core/runtime/runtime.ts +++ b/seed/ts-sdk/unknown/no-custom-config/src/core/runtime/runtime.ts @@ -69,6 +69,7 @@ export const RUNTIME: Runtime = evaluateRuntime(); export interface Runtime { type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd"; version?: string; + parsedVersion?: number; } function evaluateRuntime(): Runtime { @@ -109,6 +110,7 @@ function evaluateRuntime(): Runtime { return { type: "node", version: process.versions.node, + parsedVersion: Number(process.versions.node.split(".")[0]), }; } diff --git a/seed/ts-sdk/unknown/unknown-as-any/src/api/resources/unknown/client/Client.ts b/seed/ts-sdk/unknown/unknown-as-any/src/api/resources/unknown/client/Client.ts index e0e12e38872..32f48f9f9b3 100644 --- a/seed/ts-sdk/unknown/unknown-as-any/src/api/resources/unknown/client/Client.ts +++ b/seed/ts-sdk/unknown/unknown-as-any/src/api/resources/unknown/client/Client.ts @@ -45,6 +45,7 @@ export class Unknown { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: request, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, diff --git a/seed/ts-sdk/unknown/unknown-as-any/src/core/fetcher/Fetcher.ts b/seed/ts-sdk/unknown/unknown-as-any/src/core/fetcher/Fetcher.ts index d3686367aa9..f3b010358d0 100644 --- a/seed/ts-sdk/unknown/unknown-as-any/src/core/fetcher/Fetcher.ts +++ b/seed/ts-sdk/unknown/unknown-as-any/src/core/fetcher/Fetcher.ts @@ -20,6 +20,7 @@ export declare namespace Fetcher { maxRetries?: number; withCredentials?: boolean; abortSignal?: AbortSignal; + requestType?: "json" | "file" | "bytes"; responseType?: "json" | "blob" | "streaming" | "text"; } @@ -62,7 +63,10 @@ export async function fetcherImpl(args: Fetcher.Args): Promise { - let requestBody: BodyInit; - if (RUNTIME.type === "node") { - if (body instanceof (await import("formdata-node")).FormData) { - // @ts-expect-error - requestBody = body; - } else if (body instanceof (await import("stream")).Readable) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } - } else { - if (body instanceof (await import("form-data")).default) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } +export declare namespace GetRequestBody { + interface Args { + body: unknown; + type: "json" | "file" | "bytes" | "other"; } - return requestBody; } -export const maybeStringifyBody = (requestBody: any, contentType: string): Uint8Array | string => { - if (requestBody instanceof Uint8Array) { - return requestBody; - } else if (contentType === "application/x-www-form-urlencoded" && typeof requestBody === "string") { - return requestBody; +export async function getRequestBody({ body, type }: GetRequestBody.Args): Promise { + if (type.includes("json")) { + return JSON.stringify(body); } else { - return JSON.stringify(requestBody); + return body as BodyInit; } -}; +} diff --git a/seed/ts-sdk/unknown/unknown-as-any/src/core/runtime/runtime.ts b/seed/ts-sdk/unknown/unknown-as-any/src/core/runtime/runtime.ts index 30fe0779aaa..4d0687e8eb4 100644 --- a/seed/ts-sdk/unknown/unknown-as-any/src/core/runtime/runtime.ts +++ b/seed/ts-sdk/unknown/unknown-as-any/src/core/runtime/runtime.ts @@ -69,6 +69,7 @@ export const RUNTIME: Runtime = evaluateRuntime(); export interface Runtime { type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd"; version?: string; + parsedVersion?: number; } function evaluateRuntime(): Runtime { @@ -109,6 +110,7 @@ function evaluateRuntime(): Runtime { return { type: "node", version: process.versions.node, + parsedVersion: Number(process.versions.node.split(".")[0]), }; } diff --git a/seed/ts-sdk/validation/src/Client.ts b/seed/ts-sdk/validation/src/Client.ts index 6c9c97a5814..bbd62b9e2a9 100644 --- a/seed/ts-sdk/validation/src/Client.ts +++ b/seed/ts-sdk/validation/src/Client.ts @@ -52,6 +52,7 @@ export class SeedValidationClient { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", body: serializers.CreateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, @@ -120,6 +121,7 @@ export class SeedValidationClient { }, contentType: "application/json", queryParameters: _queryParams, + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/seed/ts-sdk/validation/src/core/fetcher/Fetcher.ts b/seed/ts-sdk/validation/src/core/fetcher/Fetcher.ts index d3686367aa9..f3b010358d0 100644 --- a/seed/ts-sdk/validation/src/core/fetcher/Fetcher.ts +++ b/seed/ts-sdk/validation/src/core/fetcher/Fetcher.ts @@ -20,6 +20,7 @@ export declare namespace Fetcher { maxRetries?: number; withCredentials?: boolean; abortSignal?: AbortSignal; + requestType?: "json" | "file" | "bytes"; responseType?: "json" | "blob" | "streaming" | "text"; } @@ -62,7 +63,10 @@ export async function fetcherImpl(args: Fetcher.Args): Promise { - let requestBody: BodyInit; - if (RUNTIME.type === "node") { - if (body instanceof (await import("formdata-node")).FormData) { - // @ts-expect-error - requestBody = body; - } else if (body instanceof (await import("stream")).Readable) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } - } else { - if (body instanceof (await import("form-data")).default) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } +export declare namespace GetRequestBody { + interface Args { + body: unknown; + type: "json" | "file" | "bytes" | "other"; } - return requestBody; } -export const maybeStringifyBody = (requestBody: any, contentType: string): Uint8Array | string => { - if (requestBody instanceof Uint8Array) { - return requestBody; - } else if (contentType === "application/x-www-form-urlencoded" && typeof requestBody === "string") { - return requestBody; +export async function getRequestBody({ body, type }: GetRequestBody.Args): Promise { + if (type.includes("json")) { + return JSON.stringify(body); } else { - return JSON.stringify(requestBody); + return body as BodyInit; } -}; +} diff --git a/seed/ts-sdk/validation/src/core/runtime/runtime.ts b/seed/ts-sdk/validation/src/core/runtime/runtime.ts index 30fe0779aaa..4d0687e8eb4 100644 --- a/seed/ts-sdk/validation/src/core/runtime/runtime.ts +++ b/seed/ts-sdk/validation/src/core/runtime/runtime.ts @@ -69,6 +69,7 @@ export const RUNTIME: Runtime = evaluateRuntime(); export interface Runtime { type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd"; version?: string; + parsedVersion?: number; } function evaluateRuntime(): Runtime { @@ -109,6 +110,7 @@ function evaluateRuntime(): Runtime { return { type: "node", version: process.versions.node, + parsedVersion: Number(process.versions.node.split(".")[0]), }; } diff --git a/seed/ts-sdk/variables/src/api/resources/service/client/Client.ts b/seed/ts-sdk/variables/src/api/resources/service/client/Client.ts index 5cdb98fd14c..61b9c97eb94 100644 --- a/seed/ts-sdk/variables/src/api/resources/service/client/Client.ts +++ b/seed/ts-sdk/variables/src/api/resources/service/client/Client.ts @@ -46,6 +46,7 @@ export class Service { "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", + requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/seed/ts-sdk/variables/src/core/fetcher/Fetcher.ts b/seed/ts-sdk/variables/src/core/fetcher/Fetcher.ts index d3686367aa9..f3b010358d0 100644 --- a/seed/ts-sdk/variables/src/core/fetcher/Fetcher.ts +++ b/seed/ts-sdk/variables/src/core/fetcher/Fetcher.ts @@ -20,6 +20,7 @@ export declare namespace Fetcher { maxRetries?: number; withCredentials?: boolean; abortSignal?: AbortSignal; + requestType?: "json" | "file" | "bytes"; responseType?: "json" | "blob" | "streaming" | "text"; } @@ -62,7 +63,10 @@ export async function fetcherImpl(args: Fetcher.Args): Promise { - let requestBody: BodyInit; - if (RUNTIME.type === "node") { - if (body instanceof (await import("formdata-node")).FormData) { - // @ts-expect-error - requestBody = body; - } else if (body instanceof (await import("stream")).Readable) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } - } else { - if (body instanceof (await import("form-data")).default) { - // @ts-expect-error - requestBody = body; - } else { - requestBody = maybeStringifyBody(body, contentType ?? ""); - } +export declare namespace GetRequestBody { + interface Args { + body: unknown; + type: "json" | "file" | "bytes" | "other"; } - return requestBody; } -export const maybeStringifyBody = (requestBody: any, contentType: string): Uint8Array | string => { - if (requestBody instanceof Uint8Array) { - return requestBody; - } else if (contentType === "application/x-www-form-urlencoded" && typeof requestBody === "string") { - return requestBody; +export async function getRequestBody({ body, type }: GetRequestBody.Args): Promise { + if (type.includes("json")) { + return JSON.stringify(body); } else { - return JSON.stringify(requestBody); + return body as BodyInit; } -}; +} diff --git a/seed/ts-sdk/variables/src/core/runtime/runtime.ts b/seed/ts-sdk/variables/src/core/runtime/runtime.ts index 30fe0779aaa..4d0687e8eb4 100644 --- a/seed/ts-sdk/variables/src/core/runtime/runtime.ts +++ b/seed/ts-sdk/variables/src/core/runtime/runtime.ts @@ -69,6 +69,7 @@ export const RUNTIME: Runtime = evaluateRuntime(); export interface Runtime { type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd"; version?: string; + parsedVersion?: number; } function evaluateRuntime(): Runtime { @@ -109,6 +110,7 @@ function evaluateRuntime(): Runtime { return { type: "node", version: process.versions.node, + parsedVersion: Number(process.versions.node.split(".")[0]), }; } diff --git a/yarn.lock b/yarn.lock index 6d4b0384bfa..7d7903c62e8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3597,7 +3597,7 @@ __metadata: "@fern-api/task-context": "workspace:*" "@types/cors": ^2.8.13 "@types/decompress": ^4.2.7 - "@types/express": ^4.17.20 + "@types/express": ^4.17.21 "@types/jest": ^29.5.12 "@types/node": ^18.7.18 "@types/uuid": ^9.0.8 @@ -4171,7 +4171,7 @@ __metadata: dependencies: "@fern-api/ir-sdk": "workspace:*" "@fern-api/task-context": "workspace:*" - "@types/express": ^4.17.20 + "@types/express": ^4.17.21 "@types/jest": ^29.5.12 "@types/lodash-es": ^4.17.12 "@types/node": ^18.7.18 @@ -5677,18 +5677,22 @@ __metadata: dependencies: "@babel/preset-env": ^7.24.3 "@babel/preset-typescript": ^7.24.1 + "@types/express": ^4.17.21 "@types/jest": ^29.5.12 + "@types/multer": ^1.4.11 "@types/node": ^18.7.18 "@types/node-fetch": 2.6.9 "@types/qs": 6.9.15 depcheck: ^1.4.6 eslint: ^8.56.0 + express: ^4.19.2 form-data: 4.0.0 form-data-encoder: ^4.0.2 formdata-node: ^6.0.3 jest: ^29.7.0 jest-environment-jsdom: ^29.7.0 jest-fetch-mock: ^3.0.3 + multer: ^1.4.5-lts.1 node-fetch: 2.7.0 organize-imports-cli: ^0.10.0 prettier: ^2.7.1 @@ -7265,7 +7269,7 @@ __metadata: languageName: node linkType: hard -"@types/express@npm:^4.17.17": +"@types/express@npm:*, @types/express@npm:^4.17.17, @types/express@npm:^4.17.21": version: 4.17.21 resolution: "@types/express@npm:4.17.21" dependencies: @@ -7277,18 +7281,6 @@ __metadata: languageName: node linkType: hard -"@types/express@npm:^4.17.20": - version: 4.17.20 - resolution: "@types/express@npm:4.17.20" - dependencies: - "@types/body-parser": "*" - "@types/express-serve-static-core": ^4.17.33 - "@types/qs": "*" - "@types/serve-static": "*" - checksum: bf8a97d283128e5129f9ccabbeef728ff3f0484465e0ae74a304bd0588fa6cb715ae68845650caba9a641944b7791ba125d02ddbd47a7e62aaefdd036570c6c5 - languageName: node - linkType: hard - "@types/find-up@npm:^4.0.0": version: 4.0.0 resolution: "@types/find-up@npm:4.0.0" @@ -7629,6 +7621,15 @@ __metadata: languageName: node linkType: hard +"@types/multer@npm:^1.4.11": + version: 1.4.11 + resolution: "@types/multer@npm:1.4.11" + dependencies: + "@types/express": "*" + checksum: 3d80b2acdfbc9f3e9027d4467e948925810b67e5622a3017f42f58a3598d34b25376890801e55d0c03973ccc34573abf5218af334e8292ec455832f4ade3e5f5 + languageName: node + linkType: hard + "@types/node-fetch@npm:2.6.9": version: 2.6.9 resolution: "@types/node-fetch@npm:2.6.9" @@ -8701,6 +8702,13 @@ __metadata: languageName: node linkType: hard +"append-field@npm:^1.0.0": + version: 1.0.0 + resolution: "append-field@npm:1.0.0" + checksum: 482ba08acc0ecef00fe7da6bf2f8e48359a9905ee1af525f3120c9260c02e91eedf0579b59d898e8d8455b6c199e340bc0a2fd4b9e02adaa29a8a86c722b37f9 + languageName: node + linkType: hard + "aproba@npm:^1.0.3 || ^2.0.0, aproba@npm:^1.1.2 || 2, aproba@npm:^2.0.0": version: 2.0.0 resolution: "aproba@npm:2.0.0" @@ -9590,6 +9598,15 @@ __metadata: languageName: node linkType: hard +"busboy@npm:^1.0.0": + version: 1.6.0 + resolution: "busboy@npm:1.6.0" + dependencies: + streamsearch: ^1.1.0 + checksum: 32801e2c0164e12106bf236291a00795c3c4e4b709ae02132883fe8478ba2ae23743b11c5735a0aae8afe65ac4b6ca4568b91f0d9fed1fdbc32ede824a73746e + languageName: node + linkType: hard + "byline@npm:^5.0.0": version: 5.0.0 resolution: "byline@npm:5.0.0" @@ -10398,7 +10415,7 @@ __metadata: languageName: node linkType: hard -"concat-stream@npm:^1.5.0": +"concat-stream@npm:^1.5.0, concat-stream@npm:^1.5.2": version: 1.6.2 resolution: "concat-stream@npm:1.6.2" dependencies: @@ -18582,7 +18599,7 @@ env-cmd@toddbluhm/env-cmd: languageName: node linkType: hard -"mkdirp@npm:^0.5.1, mkdirp@npm:^0.5.5, mkdirp@npm:^0.5.6, mkdirp@npm:~0.5.0": +"mkdirp@npm:^0.5.1, mkdirp@npm:^0.5.4, mkdirp@npm:^0.5.5, mkdirp@npm:^0.5.6, mkdirp@npm:~0.5.0": version: 0.5.6 resolution: "mkdirp@npm:0.5.6" dependencies: @@ -18662,6 +18679,21 @@ env-cmd@toddbluhm/env-cmd: languageName: node linkType: hard +"multer@npm:^1.4.5-lts.1": + version: 1.4.5-lts.1 + resolution: "multer@npm:1.4.5-lts.1" + dependencies: + append-field: ^1.0.0 + busboy: ^1.0.0 + concat-stream: ^1.5.2 + mkdirp: ^0.5.4 + object-assign: ^4.1.1 + type-is: ^1.6.4 + xtend: ^4.0.0 + checksum: d6dfa78a6ec592b74890412f8962da8a87a3dcfe20f612e039b735b8e0faa72c735516c447f7de694ee0d981eb0a1b892fb9e2402a0348dc6091d18c38d89ecc + languageName: node + linkType: hard + "multimatch@npm:^5.0.0": version: 5.0.0 resolution: "multimatch@npm:5.0.0" @@ -22450,6 +22482,13 @@ env-cmd@toddbluhm/env-cmd: languageName: node linkType: hard +"streamsearch@npm:^1.1.0": + version: 1.1.0 + resolution: "streamsearch@npm:1.1.0" + checksum: 1cce16cea8405d7a233d32ca5e00a00169cc0e19fbc02aa839959985f267335d435c07f96e5e0edd0eadc6d39c98d5435fb5bbbdefc62c41834eadc5622ad942 + languageName: node + linkType: hard + "strict-uri-encode@npm:^2.0.0": version: 2.0.0 resolution: "strict-uri-encode@npm:2.0.0" @@ -23847,7 +23886,7 @@ env-cmd@toddbluhm/env-cmd: languageName: node linkType: hard -"type-is@npm:~1.6.18": +"type-is@npm:^1.6.4, type-is@npm:~1.6.18": version: 1.6.18 resolution: "type-is@npm:1.6.18" dependencies: