feat(client): allow to disable auto-upload

This commit is contained in:
Daniel Rochetti 2023-11-20 09:13:18 -08:00
parent 7f444cdfcd
commit c5840192da
No known key found for this signature in database
GPG Key ID: 791E89AB68BDD5DB
2 changed files with 15 additions and 4 deletions

View File

@ -1,7 +1,7 @@
{
"name": "@fal-ai/serverless-client",
"description": "The fal serverless JS/TS client",
"version": "0.5.3",
"version": "0.5.4",
"license": "MIT",
"repository": {
"type": "git",

View File

@ -24,6 +24,16 @@ type RunOptions<Input> = {
* The HTTP method, defaults to `post`;
*/
readonly method?: 'get' | 'post' | 'put' | 'delete' | string;
/**
* If `true`, the function will automatically upload any files
* (i.e. instances of `Blob`) or data:uri in the input.
*
* You can disable this behavior by setting it to `false`, which
* is useful in cases where you want to upload the files yourself
* or use small data:uri in the input.
*/
readonly autoUpload?: boolean;
};
/**
@ -71,7 +81,8 @@ export async function run<Input, Output>(
id: string,
options: RunOptions<Input> = {}
): Promise<Output> {
const input = options.input
const input =
options.input && options.autoUpload !== false
? await storageImpl.transformInput(options.input)
: options.input;
return dispatchRequest<Input, Output>(