From 9262814578e9e2cac6d656eb1dffbb5f59d477f1 Mon Sep 17 00:00:00 2001 From: Daniel Rochetti Date: Mon, 15 Apr 2024 08:33:38 -0700 Subject: [PATCH] feat: support recursive auto-upload (#62) --- .gitignore | 3 ++- libs/client/package.json | 2 +- libs/client/src/storage.ts | 3 +++ libs/client/src/streaming.ts | 5 ++--- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index b22eeb6..fe035ef 100644 --- a/.gitignore +++ b/.gitignore @@ -40,4 +40,5 @@ Thumbs.db # Next.js .next -*.local \ No newline at end of file +*.local +.vercel diff --git a/libs/client/package.json b/libs/client/package.json index 35d4379..b51a260 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.9.1", + "version": "0.9.2", "license": "MIT", "repository": { "type": "git", diff --git a/libs/client/src/storage.ts b/libs/client/src/storage.ts index 063a583..6b81038 100644 --- a/libs/client/src/storage.ts +++ b/libs/client/src/storage.ts @@ -121,6 +121,9 @@ export const storageImpl: StorageSupport = { if (isPlainObject(value)) { return [key, await storageImpl.transformInput(value)]; } + if (Array.isArray(value)) { + return [key, await Promise.all(value.map(storageImpl.transformInput))]; + } return [key, value] as KeyValuePair; }); const results = await Promise.all(promises); diff --git a/libs/client/src/streaming.ts b/libs/client/src/streaming.ts index 115bc96..efe6cb0 100644 --- a/libs/client/src/streaming.ts +++ b/libs/client/src/streaming.ts @@ -72,7 +72,7 @@ class FalStream { reject(error); }); }); - this.start(); + this.start().catch(this.handleError); } private start = async () => { @@ -145,8 +145,7 @@ class FalStream { this.emit( 'error', new ApiError({ - message: - 'Event stream timed out after 15 seconds with no messages.', + message: `Event stream timed out after ${(timeout / 1000).toFixed(0)} seconds with no messages.`, status: 408, }) );