From 8c24bdf9052d041ced523ff8a59470dd2bd00b54 Mon Sep 17 00:00:00 2001 From: Daniel Rochetti Date: Tue, 19 Nov 2024 09:39:12 -0800 Subject: [PATCH] chore(lib): update endpoint types (#105) * chore(lib): update endpoint types * chore(docs): update client api reference docs --- docs/reference/classes/ApiError.html | 4 +- docs/reference/classes/FalStream.html | 12 +- docs/reference/classes/ValidationError.html | 4 +- docs/reference/functions/createFalClient.html | 4 +- .../functions/isCompletedQueueStatus.html | 2 +- docs/reference/functions/isQueueStatus.html | 2 +- docs/reference/functions/parseEndpointId.html | 2 +- docs/reference/functions/withMiddleware.html | 4 +- docs/reference/functions/withProxy.html | 2 +- docs/reference/hierarchy.html | 2 +- docs/reference/index.html | 4 +- .../interfaces/CompletedQueueStatus.html | 4 +- docs/reference/interfaces/FalClient.html | 18 +- .../interfaces/InProgressQueueStatus.html | 4 +- .../interfaces/InQueueQueueStatus.html | 4 +- docs/reference/interfaces/QueueClient.html | 16 +- docs/reference/interfaces/RealtimeClient.html | 4 +- docs/reference/interfaces/StorageClient.html | 8 +- .../reference/interfaces/StreamingClient.html | 6 +- docs/reference/types/Metrics.html | 2 +- docs/reference/types/QueueStatus.html | 2 +- docs/reference/types/RequestLog.html | 2 +- docs/reference/types/RequestMiddleware.html | 2 +- docs/reference/types/ResponseHandler.html | 2 +- docs/reference/types/Result.html | 4 +- docs/reference/types/RunOptions.html | 4 +- docs/reference/types/UrlOptions.html | 4 +- docs/reference/types/ValidationErrorInfo.html | 2 +- docs/reference/types/WebHookResponse.html | 4 +- docs/reference/variables/fal.html | 4 +- libs/client/package.json | 2 +- libs/client/src/types/endpoints.ts | 285 +++++++++++++++++- 32 files changed, 350 insertions(+), 75 deletions(-) diff --git a/docs/reference/classes/ApiError.html b/docs/reference/classes/ApiError.html index 9e450a7..fc693e7 100644 --- a/docs/reference/classes/ApiError.html +++ b/docs/reference/classes/ApiError.html @@ -1,4 +1,4 @@ -ApiError | @fal-ai/client - v1.1.1

Class ApiError<Body>

Type Parameters

  • Body

Hierarchy (view full)

Constructors

constructor +ApiError | @fal-ai/client - v1.1.2

Class ApiError<Body>

Type Parameters

  • Body

Hierarchy (view full)

Constructors

Properties

Constructors

Properties

body: Body
status: number
+

Constructors

Properties

body: Body
status: number
diff --git a/docs/reference/classes/FalStream.html b/docs/reference/classes/FalStream.html index 6988cb4..8545818 100644 --- a/docs/reference/classes/FalStream.html +++ b/docs/reference/classes/FalStream.html @@ -1,5 +1,5 @@ -FalStream | @fal-ai/client - v1.1.1

Class FalStream<Input, Output>

The class representing a streaming response. With t

-

Type Parameters

  • Input
  • Output

Constructors

constructor +FalStream | @fal-ai/client - v1.1.2

Class FalStream<Input, Output>

The class representing a streaming response. With t

+

Type Parameters

  • Input
  • Output

Constructors

Properties

config endpointId options @@ -9,16 +9,16 @@ abort done on -

Constructors

Properties

config: Required<Config>
endpointId: string
options: StreamOptions<Input>
url: string

Accessors

  • get signal(): AbortSignal
  • Gets the AbortSignal instance that can be used to listen for abort events.

    +

Constructors

Properties

config: Required<Config>
endpointId: string
options: StreamOptions<Input>
url: string

Accessors

Methods

Methods

  • Aborts the streaming request.

    Note: This method is noop in case the request is already done.

    Parameters

    • Optionalreason: string | Error

      optional cause for aborting the request.

      -

    Returns void

  • Gets a reference to the Promise that indicates whether the streaming +

Returns void

  • Gets a reference to the Promise that indicates whether the streaming is done or not. Developers should always call this in their apps to ensure the request is over.

    An alternative to this, is to use on('done') in case your application architecture works best with event listeners.

    Returns Promise<Output>

    the promise that resolves when the request is done.

    -
  • Parameters

    • type: FalStreamEventType
    • listener: EventHandler<any>

    Returns void

+
diff --git a/docs/reference/classes/ValidationError.html b/docs/reference/classes/ValidationError.html index 2e73090..9dc4cb1 100644 --- a/docs/reference/classes/ValidationError.html +++ b/docs/reference/classes/ValidationError.html @@ -1,6 +1,6 @@ -ValidationError | @fal-ai/client - v1.1.1

Class ValidationError

Hierarchy (view full)

  • ApiError<ValidationErrorBody>
    • ValidationError

Constructors

constructor +ValidationError | @fal-ai/client - v1.1.2

Class ValidationError

Hierarchy (view full)

  • ApiError<ValidationErrorBody>
    • ValidationError

Constructors

Properties

Accessors

Methods

Constructors

Properties

body: ValidationErrorBody
status: number

Accessors

Methods

+

Constructors

Properties

body: ValidationErrorBody
status: number

Accessors

Methods

diff --git a/docs/reference/functions/createFalClient.html b/docs/reference/functions/createFalClient.html index 2180871..037a14a 100644 --- a/docs/reference/functions/createFalClient.html +++ b/docs/reference/functions/createFalClient.html @@ -1,4 +1,4 @@ -createFalClient | @fal-ai/client - v1.1.1

Function createFalClient

  • Creates a new reference of the FalClient.

    +createFalClient | @fal-ai/client - v1.1.2

    Function createFalClient

    • Creates a new reference of the FalClient.

      Parameters

      • userConfig: Config = {}

        Optional configuration to override the default settings.

      Returns FalClient

      a new instance of the FalClient.

      -
    +
diff --git a/docs/reference/functions/isCompletedQueueStatus.html b/docs/reference/functions/isCompletedQueueStatus.html index 83bb7d4..075c0ca 100644 --- a/docs/reference/functions/isCompletedQueueStatus.html +++ b/docs/reference/functions/isCompletedQueueStatus.html @@ -1 +1 @@ -isCompletedQueueStatus | @fal-ai/client - v1.1.1

Function isCompletedQueueStatus

+isCompletedQueueStatus | @fal-ai/client - v1.1.2

Function isCompletedQueueStatus

diff --git a/docs/reference/functions/isQueueStatus.html b/docs/reference/functions/isQueueStatus.html index 2e806ee..26488c9 100644 --- a/docs/reference/functions/isQueueStatus.html +++ b/docs/reference/functions/isQueueStatus.html @@ -1 +1 @@ -isQueueStatus | @fal-ai/client - v1.1.1

Function isQueueStatus

+isQueueStatus | @fal-ai/client - v1.1.2

Function isQueueStatus

diff --git a/docs/reference/functions/parseEndpointId.html b/docs/reference/functions/parseEndpointId.html index 0e43bb6..ccad16e 100644 --- a/docs/reference/functions/parseEndpointId.html +++ b/docs/reference/functions/parseEndpointId.html @@ -1 +1 @@ -parseEndpointId | @fal-ai/client - v1.1.1

Function parseEndpointId

  • Parameters

    • id: string

    Returns EndpointId

+parseEndpointId | @fal-ai/client - v1.1.2

Function parseEndpointId

  • Parameters

    • id: string

    Returns EndpointId

diff --git a/docs/reference/functions/withMiddleware.html b/docs/reference/functions/withMiddleware.html index f04be33..53f1a1d 100644 --- a/docs/reference/functions/withMiddleware.html +++ b/docs/reference/functions/withMiddleware.html @@ -1,4 +1,4 @@ -withMiddleware | @fal-ai/client - v1.1.1

Function withMiddleware

  • Setup a execution chain of middleware functions.

    +withMiddleware | @fal-ai/client - v1.1.2

    Function withMiddleware

    +
diff --git a/docs/reference/functions/withProxy.html b/docs/reference/functions/withProxy.html index 1894a44..2edf98e 100644 --- a/docs/reference/functions/withProxy.html +++ b/docs/reference/functions/withProxy.html @@ -1 +1 @@ -withProxy | @fal-ai/client - v1.1.1

Function withProxy

+withProxy | @fal-ai/client - v1.1.2

Function withProxy

diff --git a/docs/reference/hierarchy.html b/docs/reference/hierarchy.html index cba8738..4cac32e 100644 --- a/docs/reference/hierarchy.html +++ b/docs/reference/hierarchy.html @@ -1 +1 @@ -@fal-ai/client - v1.1.1

@fal-ai/client - v1.1.1

Class Hierarchy

+@fal-ai/client - v1.1.2

@fal-ai/client - v1.1.2

Class Hierarchy

diff --git a/docs/reference/index.html b/docs/reference/index.html index d96bed8..e882763 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -1,4 +1,4 @@ -@fal-ai/client - v1.1.1

@fal-ai/client - v1.1.1

Index

Classes

ApiError +@fal-ai/client - v1.1.2

@fal-ai/client - v1.1.2

Index

Classes

Interfaces

+
diff --git a/docs/reference/interfaces/CompletedQueueStatus.html b/docs/reference/interfaces/CompletedQueueStatus.html index 6dfb27f..120984b 100644 --- a/docs/reference/interfaces/CompletedQueueStatus.html +++ b/docs/reference/interfaces/CompletedQueueStatus.html @@ -1,6 +1,6 @@ -CompletedQueueStatus | @fal-ai/client - v1.1.1

Interface CompletedQueueStatus

interface CompletedQueueStatus {
    logs: RequestLog[];
    metrics?: Metrics;
    request_id: string;
    response_url: string;
    status: "COMPLETED";
}

Hierarchy

  • BaseQueueStatus
    • CompletedQueueStatus

Properties

logs +CompletedQueueStatus | @fal-ai/client - v1.1.2

Interface CompletedQueueStatus

interface CompletedQueueStatus {
    logs: RequestLog[];
    metrics?: Metrics;
    request_id: string;
    response_url: string;
    status: "COMPLETED";
}

Hierarchy

  • BaseQueueStatus
    • CompletedQueueStatus

Properties

logs: RequestLog[]
metrics?: Metrics
request_id: string
response_url: string
status: "COMPLETED"
+

Properties

logs: RequestLog[]
metrics?: Metrics
request_id: string
response_url: string
status: "COMPLETED"
diff --git a/docs/reference/interfaces/FalClient.html b/docs/reference/interfaces/FalClient.html index eedfe92..acda015 100644 --- a/docs/reference/interfaces/FalClient.html +++ b/docs/reference/interfaces/FalClient.html @@ -1,7 +1,7 @@ -FalClient | @fal-ai/client - v1.1.1

Interface FalClient

The main client type, it provides access to simple API model usage, +FalClient | @fal-ai/client - v1.1.2

Interface FalClient

The main client type, it provides access to simple API model usage, as well as access to the queue and storage APIs.

createFalClient

-
interface FalClient {
    queue: QueueClient;
    realtime: RealtimeClient;
    storage: StorageClient;
    stream: (<Id>(endpointId: Id, options: StreamOptions<InputType<Id>>) => Promise<FalStream<InputType<Id>, OutputType<Id>>>);
    streaming: StreamingClient;
    run<Id>(endpointId: Id, options: RunOptions<InputType<Id>>): Promise<Result<OutputType<Id>>>;
    subscribe<Id>(endpointId: Id, options: RunOptions<InputType<Id>> & QueueSubscribeOptions): Promise<Result<OutputType<Id>>>;
}

Properties

interface FalClient {
    queue: QueueClient;
    realtime: RealtimeClient;
    storage: StorageClient;
    stream: (<Id>(endpointId: Id, options: StreamOptions<InputType<Id>>) => Promise<FalStream<InputType<Id>, OutputType<Id>>>);
    streaming: StreamingClient;
    run<Id>(endpointId: Id, options: RunOptions<InputType<Id>>): Promise<Result<OutputType<Id>>>;
    subscribe<Id>(endpointId: Id, options: RunOptions<InputType<Id>> & QueueSubscribeOptions): Promise<Result<OutputType<Id>>>;
}

Properties

queue realtime storage stream @@ -9,14 +9,14 @@

Methods

Properties

The queue client to interact with the queue API.

-
realtime: RealtimeClient

The realtime client to interact with the realtime API +

realtime: RealtimeClient

The realtime client to interact with the realtime API and receive updates in real-time.

  • #RealtimeClient
  • #RealtimeClient.connect
-
storage: StorageClient

The storage client to interact with the storage API.

-
stream: (<Id>(endpointId: Id, options: StreamOptions<InputType<Id>>) => Promise<FalStream<InputType<Id>, OutputType<Id>>>)

Calls a fal app that supports streaming and provides a streaming-capable +

storage: StorageClient

The storage client to interact with the storage API.

+
stream: (<Id>(endpointId: Id, options: StreamOptions<InputType<Id>>) => Promise<FalStream<InputType<Id>, OutputType<Id>>>)

Calls a fal app that supports streaming and provides a streaming-capable object as a result, that can be used to get partial results through either AsyncIterator or through an event listener.

Type declaration

    • <Id>(endpointId, options): Promise<FalStream<InputType<Id>, OutputType<Id>>>
    • Calls a fal app that supports streaming and provides a streaming-capable @@ -28,13 +28,13 @@

the endpoint id, e.g. fal-ai/llavav15-13b.

the request options, including the input payload.

the FalStream instance.

-
streaming: StreamingClient

The streaming client to interact with the streaming API.

+
streaming: StreamingClient

The streaming client to interact with the streaming API.

#stream

-

Methods

Methods

  • Runs a fal endpoints identified by its endpointId.

    Type Parameters

    • Id extends EndpointType

    Parameters

    • endpointId: Id

      the registered function revision id or alias.

    • options: RunOptions<InputType<Id>>

    Returns Promise<Result<OutputType<Id>>>

    the remote function output

    -
  • Subscribes to updates for a specific request in the queue.

    +
  • Subscribes to updates for a specific request in the queue.

    Type Parameters

    • Id extends EndpointType

    Parameters

    • endpointId: Id

      The ID of the API endpoint.

    • options: RunOptions<InputType<Id>> & QueueSubscribeOptions

      Options to configure how the request is run and how updates are received.

    Returns Promise<Result<OutputType<Id>>>

    A promise that resolves to the result of the request once it's completed.

    -
+
diff --git a/docs/reference/interfaces/InProgressQueueStatus.html b/docs/reference/interfaces/InProgressQueueStatus.html index fd427da..0e12a9f 100644 --- a/docs/reference/interfaces/InProgressQueueStatus.html +++ b/docs/reference/interfaces/InProgressQueueStatus.html @@ -1,5 +1,5 @@ -InProgressQueueStatus | @fal-ai/client - v1.1.1

Interface InProgressQueueStatus

interface InProgressQueueStatus {
    logs: RequestLog[];
    request_id: string;
    response_url: string;
    status: "IN_PROGRESS";
}

Hierarchy

  • BaseQueueStatus
    • InProgressQueueStatus

Properties

logs +InProgressQueueStatus | @fal-ai/client - v1.1.2

Interface InProgressQueueStatus

interface InProgressQueueStatus {
    logs: RequestLog[];
    request_id: string;
    response_url: string;
    status: "IN_PROGRESS";
}

Hierarchy

  • BaseQueueStatus
    • InProgressQueueStatus

Properties

logs: RequestLog[]
request_id: string
response_url: string
status: "IN_PROGRESS"
+

Properties

logs: RequestLog[]
request_id: string
response_url: string
status: "IN_PROGRESS"
diff --git a/docs/reference/interfaces/InQueueQueueStatus.html b/docs/reference/interfaces/InQueueQueueStatus.html index 475e571..a73e1c7 100644 --- a/docs/reference/interfaces/InQueueQueueStatus.html +++ b/docs/reference/interfaces/InQueueQueueStatus.html @@ -1,5 +1,5 @@ -InQueueQueueStatus | @fal-ai/client - v1.1.1

Interface InQueueQueueStatus

interface InQueueQueueStatus {
    queue_position: number;
    request_id: string;
    response_url: string;
    status: "IN_QUEUE";
}

Hierarchy

  • BaseQueueStatus
    • InQueueQueueStatus

Properties

queue_position +InQueueQueueStatus | @fal-ai/client - v1.1.2

Interface InQueueQueueStatus

interface InQueueQueueStatus {
    queue_position: number;
    request_id: string;
    response_url: string;
    status: "IN_QUEUE";
}

Hierarchy

  • BaseQueueStatus
    • InQueueQueueStatus

Properties

queue_position: number
request_id: string
response_url: string
status: "IN_QUEUE"
+

Properties

queue_position: number
request_id: string
response_url: string
status: "IN_QUEUE"
diff --git a/docs/reference/interfaces/QueueClient.html b/docs/reference/interfaces/QueueClient.html index 8948ff7..f24fcaa 100644 --- a/docs/reference/interfaces/QueueClient.html +++ b/docs/reference/interfaces/QueueClient.html @@ -1,6 +1,6 @@ -QueueClient | @fal-ai/client - v1.1.1

Interface QueueClient

Represents a request queue with methods for submitting requests, +QueueClient | @fal-ai/client - v1.1.2

Interface QueueClient

Represents a request queue with methods for submitting requests, checking their status, retrieving results, and subscribing to updates.

-
interface QueueClient {
    cancel(endpointId: string, options: BaseQueueOptions): Promise<void>;
    result<Id>(endpointId: Id, options: BaseQueueOptions): Promise<Result<any>>;
    status(endpointId: string, options: QueueStatusOptions): Promise<QueueStatus>;
    streamStatus(endpointId: string, options: QueueStatusStreamOptions): Promise<FalStream<unknown, QueueStatus>>;
    submit<Id>(endpointId: Id, options: SubmitOptions<InputType<Id>>): Promise<InQueueQueueStatus>;
    subscribeToStatus(endpointId: string, options: QueueStatusSubscriptionOptions): Promise<CompletedQueueStatus>;
}

Methods

interface QueueClient {
    cancel(endpointId: string, options: BaseQueueOptions): Promise<void>;
    result<Id>(endpointId: Id, options: BaseQueueOptions): Promise<Result<any>>;
    status(endpointId: string, options: QueueStatusOptions): Promise<QueueStatus>;
    streamStatus(endpointId: string, options: QueueStatusStreamOptions): Promise<FalStream<unknown, QueueStatus>>;
    submit<Id>(endpointId: Id, options: SubmitOptions<InputType<Id>>): Promise<InQueueQueueStatus>;
    subscribeToStatus(endpointId: string, options: QueueStatusSubscriptionOptions): Promise<CompletedQueueStatus>;
}

Methods

cancel result status streamStatus @@ -12,25 +12,25 @@ is run and how updates are received.

Returns Promise<void>

A promise that resolves once the request is cancelled.

If the request cannot be cancelled.

-
  • Retrieves the result of a specific request from the queue.

    +
  • Retrieves the result of a specific request from the queue.

    Type Parameters

    • Id extends EndpointType

    Parameters

    • endpointId: Id

      The ID of the function web endpoint.

    • options: BaseQueueOptions

      Options to configure how the request is run.

    Returns Promise<Result<any>>

    A promise that resolves to the result of the request.

    -
  • Retrieves the status of a specific request in the queue.

    Parameters

    • endpointId: string

      The ID of the function web endpoint.

    • options: QueueStatusOptions

      Options to configure how the request is run.

    Returns Promise<QueueStatus>

    A promise that resolves to the status of the request.

    -
  • Subscribes to updates for a specific request in the queue using HTTP streaming events.

    Parameters

    • endpointId: string

      The ID of the function web endpoint.

    • options: QueueStatusStreamOptions

      Options to configure how the request is run and how updates are received.

    Returns Promise<FalStream<unknown, QueueStatus>>

    The streaming object that can be used to listen for updates.

    -
  • Submits a request to the queue.

    Type Parameters

    • Id extends EndpointType

    Parameters

    • endpointId: Id

      The ID of the function web endpoint.

    • options: SubmitOptions<InputType<Id>>

      Options to configure how the request is run.

    Returns Promise<InQueueQueueStatus>

    A promise that resolves to the result of enqueuing the request.

    -
  • Subscribes to updates for a specific request in the queue using polling or streaming. See options.mode for more details.

    Parameters

    • endpointId: string

      The ID of the function web endpoint.

    • options: QueueStatusSubscriptionOptions

      Options to configure how the request is run and how updates are received.

    Returns Promise<CompletedQueueStatus>

    A promise that resolves to the final status of the request.

    -
+
diff --git a/docs/reference/interfaces/RealtimeClient.html b/docs/reference/interfaces/RealtimeClient.html index ab8fbcd..30b753b 100644 --- a/docs/reference/interfaces/RealtimeClient.html +++ b/docs/reference/interfaces/RealtimeClient.html @@ -1,6 +1,6 @@ -RealtimeClient | @fal-ai/client - v1.1.1

Interface RealtimeClient

interface RealtimeClient {
    connect<Input, Output>(app: string, handler: RealtimeConnectionHandler<Output>): RealtimeConnection<Input>;
}

Methods

connect +RealtimeClient | @fal-ai/client - v1.1.2

Interface RealtimeClient

interface RealtimeClient {
    connect<Input, Output>(app: string, handler: RealtimeConnectionHandler<Output>): RealtimeConnection<Input>;
}

Methods

Methods

  • Connect to the realtime endpoint. The default implementation uses WebSockets to connect to fal function endpoints that support WSS.

    Type Parameters

    • Input = any
    • Output = any

    Parameters

    • app: string

      the app alias or identifier.

    • handler: RealtimeConnectionHandler<Output>

      the connection handler.

      -

    Returns RealtimeConnection<Input>

+

Returns RealtimeConnection<Input>

diff --git a/docs/reference/interfaces/StorageClient.html b/docs/reference/interfaces/StorageClient.html index c2facfa..6f810d5 100644 --- a/docs/reference/interfaces/StorageClient.html +++ b/docs/reference/interfaces/StorageClient.html @@ -1,14 +1,14 @@ -StorageClient | @fal-ai/client - v1.1.1

Interface StorageClient

File support for the client. This interface establishes the contract for +StorageClient | @fal-ai/client - v1.1.2

Interface StorageClient

File support for the client. This interface establishes the contract for uploading files to the server and transforming the input to replace file objects with URLs.

-
interface StorageClient {
    transformInput: ((input: Record<string, any>) => Promise<Record<string, any>>);
    upload: ((file: Blob) => Promise<string>);
}

Properties

interface StorageClient {
    transformInput: ((input: Record<string, any>) => Promise<Record<string, any>>);
    upload: ((file: Blob) => Promise<string>);
}

Properties

transformInput: ((input: Record<string, any>) => Promise<Record<string, any>>)

Transform the input to replace file objects with URLs. This is used to transform the input before sending it to the server and ensures that the server receives URLs instead of file objects.

Type declaration

upload: ((file: Blob) => Promise<string>)

Upload a file to the server. Returns the URL of the uploaded file.

+
upload: ((file: Blob) => Promise<string>)

Upload a file to the server. Returns the URL of the uploaded file.

Type declaration

    • (file): Promise<string>
    • Parameters

      • file: Blob

        the file to upload

      Returns Promise<string>

      the URL of the uploaded file

      -
+
diff --git a/docs/reference/interfaces/StreamingClient.html b/docs/reference/interfaces/StreamingClient.html index c3910e2..77bb310 100644 --- a/docs/reference/interfaces/StreamingClient.html +++ b/docs/reference/interfaces/StreamingClient.html @@ -1,9 +1,9 @@ -StreamingClient | @fal-ai/client - v1.1.1

Interface StreamingClient

The streaming client interface.

-
interface StreamingClient {
    stream<Id>(endpointId: Id, options: StreamOptions<InputType<Id>>): Promise<FalStream<InputType<Id>, OutputType<Id>>>;
}

Methods

stream +StreamingClient | @fal-ai/client - v1.1.2

Interface StreamingClient

The streaming client interface.

+
interface StreamingClient {
    stream<Id>(endpointId: Id, options: StreamOptions<InputType<Id>>): Promise<FalStream<InputType<Id>, OutputType<Id>>>;
}

Methods

Methods

  • Calls a fal app that supports streaming and provides a streaming-capable object as a result, that can be used to get partial results through either AsyncIterator or through an event listener.

    Type Parameters

    • Id extends EndpointType

    Parameters

    • endpointId: Id

      the endpoint id, e.g. fal-ai/llavav15-13b.

    • options: StreamOptions<InputType<Id>>

      the request options, including the input payload.

    Returns Promise<FalStream<InputType<Id>, OutputType<Id>>>

    the FalStream instance.

    -
+
diff --git a/docs/reference/types/Metrics.html b/docs/reference/types/Metrics.html index 5ba4aca..418e2dd 100644 --- a/docs/reference/types/Metrics.html +++ b/docs/reference/types/Metrics.html @@ -1 +1 @@ -Metrics | @fal-ai/client - v1.1.1

Type Alias Metrics

Metrics: {
    inference_time: number | null;
}
+Metrics | @fal-ai/client - v1.1.2

Type Alias Metrics

Metrics: {
    inference_time: number | null;
}
diff --git a/docs/reference/types/QueueStatus.html b/docs/reference/types/QueueStatus.html index 88af3f0..7fba712 100644 --- a/docs/reference/types/QueueStatus.html +++ b/docs/reference/types/QueueStatus.html @@ -1 +1 @@ -QueueStatus | @fal-ai/client - v1.1.1
+QueueStatus | @fal-ai/client - v1.1.2
diff --git a/docs/reference/types/RequestLog.html b/docs/reference/types/RequestLog.html index 35f9ae6..3cd214d 100644 --- a/docs/reference/types/RequestLog.html +++ b/docs/reference/types/RequestLog.html @@ -1 +1 @@ -RequestLog | @fal-ai/client - v1.1.1

Type Alias RequestLog

RequestLog: {
    level:
        | "STDERR"
        | "STDOUT"
        | "ERROR"
        | "INFO"
        | "WARN"
        | "DEBUG";
    message: string;
    source: "USER";
    timestamp: string;
}
+RequestLog | @fal-ai/client - v1.1.2

Type Alias RequestLog

RequestLog: {
    level:
        | "STDERR"
        | "STDOUT"
        | "ERROR"
        | "INFO"
        | "WARN"
        | "DEBUG";
    message: string;
    source: "USER";
    timestamp: string;
}
diff --git a/docs/reference/types/RequestMiddleware.html b/docs/reference/types/RequestMiddleware.html index 5a742e0..b9af755 100644 --- a/docs/reference/types/RequestMiddleware.html +++ b/docs/reference/types/RequestMiddleware.html @@ -1 +1 @@ -RequestMiddleware | @fal-ai/client - v1.1.1

Type Alias RequestMiddleware

RequestMiddleware: ((request: RequestConfig) => Promise<RequestConfig>)
+RequestMiddleware | @fal-ai/client - v1.1.2

Type Alias RequestMiddleware

RequestMiddleware: ((request: RequestConfig) => Promise<RequestConfig>)
diff --git a/docs/reference/types/ResponseHandler.html b/docs/reference/types/ResponseHandler.html index fcb5539..0e797e8 100644 --- a/docs/reference/types/ResponseHandler.html +++ b/docs/reference/types/ResponseHandler.html @@ -1 +1 @@ -ResponseHandler | @fal-ai/client - v1.1.1

Type Alias ResponseHandler<Output>

ResponseHandler<Output>: ((response: Response) => Promise<Output>)

Type Parameters

  • Output
+ResponseHandler | @fal-ai/client - v1.1.2

Type Alias ResponseHandler<Output>

ResponseHandler<Output>: ((response: Response) => Promise<Output>)

Type Parameters

  • Output
diff --git a/docs/reference/types/Result.html b/docs/reference/types/Result.html index 03ec374..23d123a 100644 --- a/docs/reference/types/Result.html +++ b/docs/reference/types/Result.html @@ -1,3 +1,3 @@ -Result | @fal-ai/client - v1.1.1

Type Alias Result<T>

Result<T>: {
    data: T;
    requestId: string;
}

Represents an API result, containing the data, +Result | @fal-ai/client - v1.1.2

Type Alias Result<T>

Result<T>: {
    data: T;
    requestId: string;
}

Represents an API result, containing the data, the request ID and any other relevant information.

-

Type Parameters

  • T
+

Type Parameters

  • T
diff --git a/docs/reference/types/RunOptions.html b/docs/reference/types/RunOptions.html index 46ee8c1..06d36f5 100644 --- a/docs/reference/types/RunOptions.html +++ b/docs/reference/types/RunOptions.html @@ -1,6 +1,6 @@ -RunOptions | @fal-ai/client - v1.1.1

Type Alias RunOptions<Input>

RunOptions<Input>: {
    input?: Input;
    method?:
        | "get"
        | "post"
        | "put"
        | "delete"
        | string;
}

The function input and other configuration when running +RunOptions | @fal-ai/client - v1.1.2

Type Alias RunOptions<Input>

RunOptions<Input>: {
    input?: Input;
    method?:
        | "get"
        | "post"
        | "put"
        | "delete"
        | string;
}

The function input and other configuration when running the function, such as the HTTP method to use.

Type Parameters

  • Input

Type declaration

  • Optional Readonlyinput?: Input

    The function input. It will be submitted either as query params or the body payload, depending on the method.

  • Optional Readonlymethod?:
        | "get"
        | "post"
        | "put"
        | "delete"
        | string

    The HTTP method, defaults to post;

    -
+
diff --git a/docs/reference/types/UrlOptions.html b/docs/reference/types/UrlOptions.html index 9937753..a3ba287 100644 --- a/docs/reference/types/UrlOptions.html +++ b/docs/reference/types/UrlOptions.html @@ -1,6 +1,6 @@ -UrlOptions | @fal-ai/client - v1.1.1

Type Alias UrlOptions

UrlOptions: {
    path?: string;
    query?: Record<string, string>;
    subdomain?: string;
}

Type declaration

  • Optionalpath?: string

    The path to append to the function URL.

    +UrlOptions | @fal-ai/client - v1.1.2

    Type Alias UrlOptions

    UrlOptions: {
        path?: string;
        query?: Record<string, string>;
        subdomain?: string;
    }

    Type declaration

    • Optionalpath?: string

      The path to append to the function URL.

    • Optional Readonlyquery?: Record<string, string>

      The query parameters to include in the URL.

    • Optional Readonlysubdomain?: string

      If true, the function will use the queue to run the function asynchronously and return the result in a separate call. This influences how the URL is built.

      -
    +
diff --git a/docs/reference/types/ValidationErrorInfo.html b/docs/reference/types/ValidationErrorInfo.html index 3bff8f6..2f90fed 100644 --- a/docs/reference/types/ValidationErrorInfo.html +++ b/docs/reference/types/ValidationErrorInfo.html @@ -1 +1 @@ -ValidationErrorInfo | @fal-ai/client - v1.1.1

Type Alias ValidationErrorInfo

ValidationErrorInfo: {
    loc: (string | number)[];
    msg: string;
    type: string;
}
+ValidationErrorInfo | @fal-ai/client - v1.1.2

Type Alias ValidationErrorInfo

ValidationErrorInfo: {
    loc: (string | number)[];
    msg: string;
    type: string;
}
diff --git a/docs/reference/types/WebHookResponse.html b/docs/reference/types/WebHookResponse.html index 98ef24b..88d711d 100644 --- a/docs/reference/types/WebHookResponse.html +++ b/docs/reference/types/WebHookResponse.html @@ -1,4 +1,4 @@ -WebHookResponse | @fal-ai/client - v1.1.1

Type Alias WebHookResponse<Payload>

WebHookResponse<Payload>: {
    error: never;
    payload: Payload;
    request_id: string;
    status: "OK";
} | {
    error: string;
    payload: Payload;
    request_id: string;
    status: "ERROR";
}

Represents the response from a WebHook request. +WebHookResponse | @fal-ai/client - v1.1.2

Type Alias WebHookResponse<Payload>

WebHookResponse<Payload>: {
    error: never;
    payload: Payload;
    request_id: string;
    status: "OK";
} | {
    error: string;
    payload: Payload;
    request_id: string;
    status: "ERROR";
}

Represents the response from a WebHook request. This is a union type that varies based on the status property.

Type Parameters

  • Payload = any

    The type of the payload in the response. It defaults to any, allowing for flexibility in specifying the structure of the payload.

    @@ -10,4 +10,4 @@
  • payload: Payload

    The payload of the response, structure determined by the Payload type.

  • request_id: string

    The unique identifier for the request.

  • status: "ERROR"

    Indicates an unsuccessful response.

    -
+
diff --git a/docs/reference/variables/fal.html b/docs/reference/variables/fal.html index ad41c35..ae5d6b8 100644 --- a/docs/reference/variables/fal.html +++ b/docs/reference/variables/fal.html @@ -1,3 +1,3 @@ -fal | @fal-ai/client - v1.1.1

Variable falConst

fal: SingletonFalClient = ...

Creates a singleton instance of the client. This is useful as a compatibility +fal | @fal-ai/client - v1.1.2

Variable falConst

fal: SingletonFalClient = ...

Creates a singleton instance of the client. This is useful as a compatibility layer for existing code that uses the clients version prior to 1.0.0.

-
+
diff --git a/libs/client/package.json b/libs/client/package.json index 306350c..18dbccd 100644 --- a/libs/client/package.json +++ b/libs/client/package.json @@ -1,7 +1,7 @@ { "name": "@fal-ai/client", "description": "The fal.ai client for JavaScript and TypeScript", - "version": "1.1.1", + "version": "1.1.2", "license": "MIT", "repository": { "type": "git", diff --git a/libs/client/src/types/endpoints.ts b/libs/client/src/types/endpoints.ts index 4535715..511b87e 100644 --- a/libs/client/src/types/endpoints.ts +++ b/libs/client/src/types/endpoints.ts @@ -3472,6 +3472,94 @@ export type FluxGeneralRfInversionOutput = { */ prompt: string; }; +export type FluxPulidInput = { + /** + * The prompt to generate an image from. + */ + prompt: string; + /** + * URL of image to use for inpainting. + */ + reference_image_url: string | Blob | File; + /** + * The size of the generated image. Default value: `landscape_4_3` + */ + image_size?: + | ImageSize + | "square_hd" + | "square" + | "portrait_4_3" + | "portrait_16_9" + | "landscape_4_3" + | "landscape_16_9"; + /** + * The number of inference steps to perform. Default value: `20` + */ + num_inference_steps?: number; + /** + * The same seed and the same prompt given to the same version of the model + * will output the same image every time. + */ + seed?: number; + /** + * The CFG (Classifier Free Guidance) scale is a measure of how close you want + * the model to stick to your prompt when looking for a related image to show you. Default value: `4` + */ + guidance_scale?: number; + /** + * The prompt to generate an image from. Default value: `""` + */ + negative_prompt?: string; + /** + * If set to true, the function will wait for the image to be generated and uploaded + * before returning the response. This will increase the latency of the function but + * it allows you to get the image directly in the response without going through the CDN. + */ + sync_mode?: boolean; + /** + * The number of steps to start the CFG from. + */ + start_step?: number; + /** + * The weight of the CFG loss. Default value: `1` + */ + true_cfg?: number; + /** + * The weight of the ID loss. Default value: `1` + */ + id_weight?: number; + /** + * If set to true, the safety checker will be enabled. Default value: `true` + */ + enable_safety_checker?: boolean; + /** + * The maximum sequence length for the model. Default value: `"128"` + */ + max_sequence_length?: "128" | "256" | "512"; +}; +export type FluxPulidOutput = { + /** + * The generated image files info. + */ + images: Array; + /** + * + */ + timings: any; + /** + * Seed of the generated Image. It will be the same value of the one passed in the + * input or the randomly generated that was used in case none was passed. + */ + seed: number; + /** + * Whether the generated images contain NSFW concepts. + */ + has_nsfw_concepts: Array; + /** + * The prompt used for generating the image. + */ + prompt: string; +}; export type IclightV2Output = { /** * The generated image files info. @@ -3508,6 +3596,10 @@ export type IclightV2Input = { * URL of image to be used for relighting */ image_url: string | Blob | File; + /** + * URL of mask to be used for ic-light conditioning image + */ + mask_image_url?: string | Blob | File; /** * The size of the generated image. */ @@ -5587,7 +5679,7 @@ export type ClarityUpscalerInput = { * The same seed and the same prompt given to the same version of Stable Diffusion * will output the same image every time. */ - seed?: number; + seed?: number | null; /** * If set to false, the safety checker will be disabled. Default value: `true` */ @@ -16249,6 +16341,103 @@ export type MusePoseOutput = { */ video: File; }; +export type KolorsOutput = { + /** + * The generated image files info. + */ + images: Array; + /** + * + */ + timings: any; + /** + * Seed of the generated Image. It will be the same value of the one passed in the + * input or the randomly generated that was used in case none was passed. + */ + seed: number; + /** + * Whether the generated images contain NSFW concepts. + */ + has_nsfw_concepts: Array; + /** + * The prompt used for generating the image. + */ + prompt: string; +}; +export type KolorsImg2ImgInput = { + /** + * The prompt to generate an image from. + */ + prompt: string; + /** + * The negative prompt to use. Use it to address details that you don't want + * in the image. This could be colors, objects, scenery and even the small + * details (e.g. moustache, blurry, low resolution). Default value: `""` + */ + negative_prompt?: string; + /** + * The CFG (Classifier Free Guidance) scale is a measure of how close you want + * the model to stick to your prompt when looking for a related image to show + * you. Default value: `5` + */ + guidance_scale?: number; + /** + * The number of inference steps to perform. Default value: `50` + */ + num_inference_steps?: number; + /** + * Seed + */ + seed?: number; + /** + * If set to true, the function will wait for the image to be generated and + * uploaded before returning the response. This will increase the latency of + * the function but it allows you to get the image directly in the response + * without going through the CDN. + */ + sync_mode?: boolean; + /** + * Enable safety checker. Default value: `true` + */ + enable_safety_checker?: boolean; + /** + * The number of images to generate. Default value: `1` + */ + num_images?: number; + /** + * The size of the generated image. + */ + image_size?: + | ImageSize + | "square_hd" + | "square" + | "portrait_4_3" + | "portrait_16_9" + | "landscape_4_3" + | "landscape_16_9"; + /** + * The scheduler to use for the model. Default value: `"EulerDiscreteScheduler"` + */ + scheduler?: + | "EulerDiscreteScheduler" + | "EulerAncestralDiscreteScheduler" + | "DPMSolverMultistepScheduler" + | "DPMSolverMultistepScheduler_SDE_karras" + | "UniPCMultistepScheduler" + | "DEISMultistepScheduler"; + /** + * The format of the generated image. Default value: `"png"` + */ + output_format?: "jpeg" | "png"; + /** + * URL of image to use for image to image + */ + image_url: string | Blob | File; + /** + * The strength to use for image-to-image. 1.0 is completely remakes the image while 0.0 preserves the original. Default value: `0.85` + */ + strength?: number; +}; export type KolorsInput = { /** * The prompt to use for generating the image. Be as descriptive as possible @@ -16311,19 +16500,23 @@ export type KolorsInput = { | "DPMSolverMultistepScheduler_SDE_karras" | "UniPCMultistepScheduler" | "DEISMultistepScheduler"; + /** + * The format of the generated image. Default value: `"png"` + */ + output_format?: "jpeg" | "png"; }; -export type KolorsOutput = { +export type KolorsImageToImageOutput = { /** * The generated image files info. */ images: Array; /** - * The timings of the different steps of the generation process. + * */ timings: any; /** - * Seed of the generated Image. It will be the same value of the one passed in - * the input or the randomly generated that was used in case none was passed. + * Seed of the generated Image. It will be the same value of the one passed in the + * input or the randomly generated that was used in case none was passed. */ seed: number; /** @@ -16335,6 +16528,80 @@ export type KolorsOutput = { */ prompt: string; }; +export type KolorsImageToImageInput = { + /** + * The prompt to generate an image from. + */ + prompt: string; + /** + * The negative prompt to use. Use it to address details that you don't want + * in the image. This could be colors, objects, scenery and even the small + * details (e.g. moustache, blurry, low resolution). Default value: `""` + */ + negative_prompt?: string; + /** + * The CFG (Classifier Free Guidance) scale is a measure of how close you want + * the model to stick to your prompt when looking for a related image to show + * you. Default value: `5` + */ + guidance_scale?: number; + /** + * The number of inference steps to perform. Default value: `50` + */ + num_inference_steps?: number; + /** + * Seed + */ + seed?: number; + /** + * If set to true, the function will wait for the image to be generated and + * uploaded before returning the response. This will increase the latency of + * the function but it allows you to get the image directly in the response + * without going through the CDN. + */ + sync_mode?: boolean; + /** + * Enable safety checker. Default value: `true` + */ + enable_safety_checker?: boolean; + /** + * The number of images to generate. Default value: `1` + */ + num_images?: number; + /** + * The size of the generated image. + */ + image_size?: + | ImageSize + | "square_hd" + | "square" + | "portrait_4_3" + | "portrait_16_9" + | "landscape_4_3" + | "landscape_16_9"; + /** + * The scheduler to use for the model. Default value: `"EulerDiscreteScheduler"` + */ + scheduler?: + | "EulerDiscreteScheduler" + | "EulerAncestralDiscreteScheduler" + | "DPMSolverMultistepScheduler" + | "DPMSolverMultistepScheduler_SDE_karras" + | "UniPCMultistepScheduler" + | "DEISMultistepScheduler"; + /** + * The format of the generated image. Default value: `"png"` + */ + output_format?: "jpeg" | "png"; + /** + * URL of image to use for image to image + */ + image_url: string | Blob | File; + /** + * The strength to use for image-to-image. 1.0 is completely remakes the image while 0.0 preserves the original. Default value: `0.85` + */ + strength?: number; +}; export type SdxlControlnetUnionOutput = { /** * The generated image files info. @@ -18270,6 +18537,10 @@ export type EndpointTypeMap = { input: FluxGeneralRfInversionInput; output: FluxGeneralRfInversionOutput; }; + "fal-ai/flux-pulid": { + input: FluxPulidInput; + output: FluxPulidOutput; + }; "fal-ai/iclight-v2": { input: IclightV2Input; output: IclightV2Output; @@ -18774,6 +19045,10 @@ export type EndpointTypeMap = { input: KolorsInput; output: KolorsOutput; }; + "fal-ai/kolors/image-to-image": { + input: KolorsImageToImageInput; + output: KolorsImageToImageOutput; + }; "fal-ai/sdxl-controlnet-union": { input: SdxlControlnetUnionInput; output: SdxlControlnetUnionOutput;