feat(client): allow to disable auto-upload
This commit is contained in:
parent
7f444cdfcd
commit
c5840192da
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@fal-ai/serverless-client",
|
"name": "@fal-ai/serverless-client",
|
||||||
"description": "The fal serverless JS/TS client",
|
"description": "The fal serverless JS/TS client",
|
||||||
"version": "0.5.3",
|
"version": "0.5.4",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|||||||
@ -24,6 +24,16 @@ type RunOptions<Input> = {
|
|||||||
* The HTTP method, defaults to `post`;
|
* The HTTP method, defaults to `post`;
|
||||||
*/
|
*/
|
||||||
readonly method?: 'get' | 'post' | 'put' | 'delete' | string;
|
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,
|
id: string,
|
||||||
options: RunOptions<Input> = {}
|
options: RunOptions<Input> = {}
|
||||||
): Promise<Output> {
|
): Promise<Output> {
|
||||||
const input = options.input
|
const input =
|
||||||
|
options.input && options.autoUpload !== false
|
||||||
? await storageImpl.transformInput(options.input)
|
? await storageImpl.transformInput(options.input)
|
||||||
: options.input;
|
: options.input;
|
||||||
return dispatchRequest<Input, Output>(
|
return dispatchRequest<Input, Output>(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user