@ts-rest/core
Advanced tools
Comparing version 3.41.2 to 3.42.0
# @ts-rest/core | ||
## 3.42.0 | ||
### Minor Changes | ||
- 7372bee: Allow arrays of files to be uploaded | ||
## 3.41.2 | ||
@@ -4,0 +10,0 @@ |
@@ -245,3 +245,3 @@ 'use strict'; | ||
const formData = new FormData(); | ||
Object.entries(body).forEach(([key, value]) => { | ||
const appendToFormData = (key, value) => { | ||
if (value instanceof File) { | ||
@@ -253,2 +253,12 @@ formData.append(key, value); | ||
} | ||
}; | ||
Object.entries(body).forEach(([key, value]) => { | ||
if (Array.isArray(value)) { | ||
for (const item of value) { | ||
appendToFormData(key, item); | ||
} | ||
} | ||
else { | ||
appendToFormData(key, value); | ||
} | ||
}); | ||
@@ -255,0 +265,0 @@ return formData; |
@@ -241,3 +241,3 @@ const isZodType = (obj) => { | ||
const formData = new FormData(); | ||
Object.entries(body).forEach(([key, value]) => { | ||
const appendToFormData = (key, value) => { | ||
if (value instanceof File) { | ||
@@ -249,2 +249,12 @@ formData.append(key, value); | ||
} | ||
}; | ||
Object.entries(body).forEach(([key, value]) => { | ||
if (Array.isArray(value)) { | ||
for (const item of value) { | ||
appendToFormData(key, item); | ||
} | ||
} | ||
else { | ||
appendToFormData(key, value); | ||
} | ||
}); | ||
@@ -251,0 +261,0 @@ return formData; |
{ | ||
"name": "@ts-rest/core", | ||
"version": "3.41.2", | ||
"version": "3.42.0", | ||
"description": "RPC-like experience over a regular REST API, with type safe server implementations 🪄", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -37,3 +37,3 @@ import { AppRoute, AppRouteMutation, AppRouter, AppRouteStrictStatusCodes, ContractAnyType, ContractNoBodyType, ContractOtherResponse } from './dsl'; | ||
export type ClientInferResponseBody<T extends AppRoute, TStatus extends keyof T['responses'] = keyof T['responses']> = Prettify<AppRouteResponses<T, TStatus & HTTPStatusCode, 'client'>['body']>; | ||
type BodyWithoutFileIfMultiPart<T extends AppRouteMutation> = T['contentType'] extends 'multipart/form-data' ? Without<ZodInferOrType<T['body']>, File> : ZodInferOrType<T['body']>; | ||
type BodyWithoutFileIfMultiPart<T extends AppRouteMutation> = T['contentType'] extends 'multipart/form-data' ? Without<ZodInferOrType<T['body']>, File | File[]> : ZodInferOrType<T['body']>; | ||
export type ServerInferRequest<T extends AppRoute | AppRouter, TServerHeaders = never> = T extends AppRoute ? Prettify<Without<{ | ||
@@ -40,0 +40,0 @@ params: [keyof PathParamsWithCustomValidators<T>] extends [never] ? never : Prettify<PathParamsWithCustomValidators<T>>; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
83007
1450