diff --git a/libs/client/package.json b/libs/client/package.json index 5c323cf..8d1f95e 100644 --- a/libs/client/package.json +++ b/libs/client/package.json @@ -1,7 +1,7 @@ { "name": "@fal-ai/serverless-client", "description": "The fal serverless JS/TS client", - "version": "0.8.2", + "version": "0.8.3", "license": "MIT", "repository": { "type": "git", diff --git a/libs/client/src/storage.ts b/libs/client/src/storage.ts index 203bbbd..063a583 100644 --- a/libs/client/src/storage.ts +++ b/libs/client/src/storage.ts @@ -1,5 +1,6 @@ import { getConfig, getRestApiUrl } from './config'; import { dispatchRequest } from './request'; +import { isPlainObject } from './utils'; /** * File support for the client. This interface establishes the contract for @@ -117,6 +118,9 @@ export const storageImpl: StorageSupport = { const url = await storageImpl.upload(blob as Blob); return [key, url]; } + if (isPlainObject(value)) { + return [key, await storageImpl.transformInput(value)]; + } return [key, value] as KeyValuePair; }); const results = await Promise.all(promises); diff --git a/libs/client/src/utils.ts b/libs/client/src/utils.ts index e3634bc..750a584 100644 --- a/libs/client/src/utils.ts +++ b/libs/client/src/utils.ts @@ -82,3 +82,12 @@ export function isReact() { } return isRunningInReact; } + +/** + * Check if a value is a plain object. + * @param value - The value to check. + * @returns `true` if the value is a plain object, `false` otherwise. + */ +export function isPlainObject(value: any): boolean { + return !!value && Object.getPrototypeOf(value) === Object.prototype; +}