@tanstack/ai-fal 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/dist/esm/adapters/audio.d.ts +1 -0
  2. package/dist/esm/adapters/audio.js +6 -7
  3. package/dist/esm/adapters/audio.js.map +1 -1
  4. package/dist/esm/adapters/files.d.ts +1 -0
  5. package/dist/esm/adapters/files.js +5 -6
  6. package/dist/esm/adapters/files.js.map +1 -1
  7. package/dist/esm/adapters/image.d.ts +1 -0
  8. package/dist/esm/adapters/image.js +6 -7
  9. package/dist/esm/adapters/image.js.map +1 -1
  10. package/dist/esm/adapters/live.js +1 -2
  11. package/dist/esm/adapters/model3d.d.ts +98 -0
  12. package/dist/esm/adapters/model3d.js +170 -0
  13. package/dist/esm/adapters/model3d.js.map +1 -0
  14. package/dist/esm/adapters/motion.d.ts +58 -0
  15. package/dist/esm/adapters/motion.js +150 -0
  16. package/dist/esm/adapters/motion.js.map +1 -0
  17. package/dist/esm/adapters/speech.d.ts +1 -0
  18. package/dist/esm/adapters/speech.js +6 -7
  19. package/dist/esm/adapters/speech.js.map +1 -1
  20. package/dist/esm/adapters/transcription.d.ts +1 -0
  21. package/dist/esm/adapters/transcription.js +6 -7
  22. package/dist/esm/adapters/transcription.js.map +1 -1
  23. package/dist/esm/adapters/video.d.ts +2 -1
  24. package/dist/esm/adapters/video.js +13 -18
  25. package/dist/esm/adapters/video.js.map +1 -1
  26. package/dist/esm/byok.js +1 -2
  27. package/dist/esm/client/index.d.ts +65 -0
  28. package/dist/esm/client/index.js +306 -0
  29. package/dist/esm/client/index.js.map +1 -0
  30. package/dist/esm/image/generated/image-field-overrides.d.ts +459 -294
  31. package/dist/esm/image/generated/image-field-overrides.js +312 -190
  32. package/dist/esm/image/generated/image-field-overrides.js.map +1 -1
  33. package/dist/esm/image/image-inputs.js +7 -4
  34. package/dist/esm/image/image-inputs.js.map +1 -1
  35. package/dist/esm/image/image-provider-options.js +1 -2
  36. package/dist/esm/image/legacy-image-field-overrides.d.ts +13 -0
  37. package/dist/esm/image/legacy-image-field-overrides.js +91 -0
  38. package/dist/esm/image/legacy-image-field-overrides.js.map +1 -0
  39. package/dist/esm/index.d.ts +6 -2
  40. package/dist/esm/index.js +5 -2
  41. package/dist/esm/model-meta.d.ts +49 -0
  42. package/dist/esm/model3d/generated/mesh-field-overrides.d.ts +20 -0
  43. package/dist/esm/model3d/generated/mesh-field-overrides.js +20 -0
  44. package/dist/esm/model3d/generated/mesh-field-overrides.js.map +1 -0
  45. package/dist/esm/model3d/model3d-inputs.d.ts +39 -0
  46. package/dist/esm/model3d/model3d-inputs.js +206 -0
  47. package/dist/esm/model3d/model3d-inputs.js.map +1 -0
  48. package/dist/esm/model3d/model3d-output.d.ts +25 -0
  49. package/dist/esm/model3d/model3d-output.js +181 -0
  50. package/dist/esm/model3d/model3d-output.js.map +1 -0
  51. package/dist/esm/utils/billing.js +1 -2
  52. package/dist/esm/utils/client.d.ts +16 -1
  53. package/dist/esm/utils/client.js +31 -9
  54. package/dist/esm/utils/client.js.map +1 -1
  55. package/dist/esm/utils/configure.d.ts +12 -0
  56. package/dist/esm/utils/configure.js +19 -0
  57. package/dist/esm/utils/configure.js.map +1 -0
  58. package/dist/esm/utils/index.d.ts +2 -1
  59. package/dist/esm/video/video-provider-options.js +20 -31
  60. package/dist/esm/video/video-provider-options.js.map +1 -1
  61. package/package.json +8 -7
  62. package/src/adapters/audio.ts +7 -6
  63. package/src/adapters/files.ts +5 -4
  64. package/src/adapters/image.ts +8 -7
  65. package/src/adapters/model3d.ts +219 -0
  66. package/src/adapters/motion.ts +237 -0
  67. package/src/adapters/speech.ts +7 -6
  68. package/src/adapters/transcription.ts +8 -7
  69. package/src/adapters/video.ts +16 -18
  70. package/src/client/index.ts +456 -0
  71. package/src/image/generated/image-field-overrides.ts +159 -110
  72. package/src/image/image-inputs.ts +9 -4
  73. package/src/image/legacy-image-field-overrides.ts +94 -0
  74. package/src/index.ts +20 -1
  75. package/src/model-meta.ts +106 -0
  76. package/src/model3d/generated/mesh-field-overrides.ts +46 -0
  77. package/src/model3d/model3d-inputs.ts +232 -0
  78. package/src/model3d/model3d-output.ts +216 -0
  79. package/src/utils/client.ts +37 -4
  80. package/src/utils/configure.ts +17 -0
  81. package/src/utils/index.ts +2 -1
  82. package/src/video/video-provider-options.ts +9 -27
@@ -0,0 +1,306 @@
1
+ // src/client/index.ts
2
+ /**
3
+ * Thrown when fal answers with a status that is not OK. Same name and fields
4
+ * as the `@fal-ai/client` `ApiError`.
5
+ */
6
+ var ApiError = class extends Error {
7
+ status;
8
+ body;
9
+ requestId;
10
+ timeoutType;
11
+ constructor({ message, status, body, requestId, timeoutType }) {
12
+ super(message);
13
+ this.name = "ApiError";
14
+ this.status = status;
15
+ this.body = body;
16
+ this.requestId = requestId || "";
17
+ this.timeoutType = timeoutType;
18
+ }
19
+ /** True when the request hit the timeout that the caller asked for. */
20
+ get isUserTimeout() {
21
+ return this.status === 504 && this.timeoutType === "user";
22
+ }
23
+ };
24
+ /**
25
+ * Thrown for a 422 answer. Same name and fields as the `@fal-ai/client`
26
+ * `ValidationError`.
27
+ */
28
+ var ValidationError = class extends ApiError {
29
+ constructor(args) {
30
+ super(args);
31
+ this.name = "ValidationError";
32
+ }
33
+ get fieldErrors() {
34
+ const detail = this.body?.detail;
35
+ if (typeof detail === "string") return [{
36
+ loc: ["body"],
37
+ msg: detail,
38
+ type: "value_error"
39
+ }];
40
+ return detail || [];
41
+ }
42
+ getFieldErrors(field) {
43
+ return this.fieldErrors.filter((error) => error.loc.at(-1) === field);
44
+ }
45
+ };
46
+ var RETRYABLE_STATUS_CODES = [
47
+ 429,
48
+ 502,
49
+ 503,
50
+ 504
51
+ ];
52
+ var DEFAULT_RETRY = {
53
+ maxRetries: 3,
54
+ maxDelay: 3e4,
55
+ statusCodes: RETRYABLE_STATUS_CODES
56
+ };
57
+ var QUEUE_RETRY = {
58
+ ...DEFAULT_RETRY,
59
+ maxDelay: 6e4
60
+ };
61
+ var QUEUE_STATUS_RETRY = {
62
+ maxRetries: 5,
63
+ maxDelay: 3e4,
64
+ statusCodes: [...RETRYABLE_STATUS_CODES, 500]
65
+ };
66
+ var NETWORK_ERROR_CODES = /* @__PURE__ */ new Set([
67
+ "ECONNABORTED",
68
+ "ECONNREFUSED",
69
+ "ECONNRESET",
70
+ "EAI_AGAIN",
71
+ "EHOSTUNREACH",
72
+ "ENETUNREACH",
73
+ "ENOTFOUND",
74
+ "EPIPE",
75
+ "ETIMEDOUT",
76
+ "UND_ERR_BODY_TIMEOUT",
77
+ "UND_ERR_CONNECT_TIMEOUT",
78
+ "UND_ERR_HEADERS_TIMEOUT",
79
+ "UND_ERR_SOCKET"
80
+ ]);
81
+ var POLL_INTERVAL_MS = 500;
82
+ var MULTIPART_THRESHOLD_BYTES = 94371840;
83
+ var UPLOAD_INITIATE_URL = "https://rest.fal.ai/storage/upload/initiate?storage_type=fal-cdn-v3";
84
+ var ENDPOINT_NAMESPACES = ["workflows", "comfy"];
85
+ var EXPIRATION_SECONDS = {
86
+ never: void 0,
87
+ immediate: 60,
88
+ "1h": 3600,
89
+ "1d": 86400,
90
+ "7d": 604800,
91
+ "30d": 2592e3,
92
+ "1y": 31536e3
93
+ };
94
+ var sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
95
+ var isBrowser = () => typeof window !== "undefined" && typeof window.document !== "undefined";
96
+ function isPlainObject(value) {
97
+ return !!value && Object.getPrototypeOf(value) === Object.prototype;
98
+ }
99
+ /** Transport errors (reset, DNS, socket timeout) are retried. Aborts are not. */
100
+ function isNetworkError(error) {
101
+ const seen = /* @__PURE__ */ new Set();
102
+ let current = error;
103
+ let hasNetworkCode = false;
104
+ while (current && typeof current === "object" && !seen.has(current)) {
105
+ seen.add(current);
106
+ const name = "name" in current ? current.name : void 0;
107
+ const code = "code" in current ? current.code : void 0;
108
+ if (name === "AbortError" || name === "TimeoutError") return false;
109
+ if (typeof code === "string" && NETWORK_ERROR_CODES.has(code)) hasNetworkCode = true;
110
+ current = "cause" in current ? current.cause : void 0;
111
+ }
112
+ return hasNetworkCode || error instanceof TypeError && /fetch failed/i.test(error.message);
113
+ }
114
+ function isRetryable(error, statusCodes) {
115
+ if (error instanceof ApiError) return !error.isUserTimeout && statusCodes.includes(error.status);
116
+ return isNetworkError(error);
117
+ }
118
+ /** Exponential backoff from 1 s, doubled per attempt, capped, with +-25% jitter. */
119
+ function backoffDelay(attempt, maxDelay) {
120
+ const delay = Math.min(1e3 * 2 ** attempt, maxDelay);
121
+ return Math.max(0, delay + .25 * delay * (Math.random() * 2 - 1));
122
+ }
123
+ /** Reads a fal response, or throws `ApiError` / `ValidationError`. */
124
+ async function parseResponse(response) {
125
+ const { status, statusText } = response;
126
+ const contentType = response.headers.get("Content-Type") ?? "";
127
+ const requestId = response.headers.get("x-fal-request-id") || void 0;
128
+ const timeoutType = response.headers.get("x-fal-request-timeout-type") || void 0;
129
+ const isJson = contentType.includes("application/json");
130
+ if (!response.ok) {
131
+ if (!isJson) throw new ApiError({
132
+ message: `HTTP ${status}: ${statusText}`,
133
+ status,
134
+ requestId,
135
+ timeoutType
136
+ });
137
+ const body = await response.json();
138
+ throw new (status === 422 ? ValidationError : ApiError)({
139
+ message: body.message || statusText,
140
+ status,
141
+ body,
142
+ requestId,
143
+ timeoutType
144
+ });
145
+ }
146
+ if (isJson) return response.json();
147
+ if (contentType.includes("application/octet-stream")) return response.arrayBuffer();
148
+ return response.text();
149
+ }
150
+ /** `123-app` becomes `123/app`. Ids that already have a `/` stay as they are. */
151
+ function normalizeEndpointId(id) {
152
+ if (id.includes("/")) return id;
153
+ const match = /^([0-9]+)-([a-zA-Z0-9-]+)$/.exec(id);
154
+ if (!match) throw new Error(`Invalid app id: ${id}. Must be in the format <appOwner>/<appId>`);
155
+ return `${match[1]}/${match[2]}`;
156
+ }
157
+ /** Status and result URLs use only `[namespace/]owner/alias`, not the subpath. */
158
+ function queueAppId(endpointId) {
159
+ const parts = normalizeEndpointId(endpointId).split("/");
160
+ const hasNamespace = ENDPOINT_NAMESPACES.includes(parts[0] ?? "");
161
+ const [owner, alias] = hasNamespace ? parts.slice(1) : parts;
162
+ return `${hasNamespace ? `${parts[0]}/` : ""}${owner}/${alias}`;
163
+ }
164
+ function isFalUrl(url) {
165
+ try {
166
+ return /(fal\.(ai|run))$/.test(new URL(url).host);
167
+ } catch {
168
+ return false;
169
+ }
170
+ }
171
+ function queueUrl(id, path = "", query) {
172
+ const search = query ? `?${new URLSearchParams(query).toString()}` : "";
173
+ const cleanPath = path.replace(/^\//, "").replace(/\/{2,}/, "/");
174
+ if (isFalUrl(id)) return `${id.endsWith("/") ? id : `${id}/`}${cleanPath}${search}`;
175
+ return `${`https://queue.fal.run/${normalizeEndpointId(id)}/${cleanPath}`.replace(/\/$/, "")}${search}`;
176
+ }
177
+ function lifecycleConfig(lifecycle) {
178
+ if (!lifecycle) return void 0;
179
+ const { expiresIn, initialAcl } = lifecycle;
180
+ const seconds = typeof expiresIn === "number" ? expiresIn : expiresIn === void 0 ? void 0 : EXPIRATION_SECONDS[expiresIn];
181
+ const config = {
182
+ ...seconds !== void 0 ? { expiration_duration_seconds: seconds } : {},
183
+ ...initialAcl !== void 0 ? { initial_acl: initialAcl } : {}
184
+ };
185
+ return Object.keys(config).length > 0 ? config : void 0;
186
+ }
187
+ function uploadFileName(file, contentType) {
188
+ if (file instanceof File && file.name) return file.name;
189
+ const extension = contentType.split("/")[1]?.split(/[-;]/)[0] ?? "bin";
190
+ return `${Date.now()}.${extension}`;
191
+ }
192
+ /**
193
+ * Create a fal client that talks to the fal queue and storage REST API with
194
+ * `fetch`. It has the same method names, arguments, results, and errors as the
195
+ * `@fal-ai/client` methods the adapters use.
196
+ *
197
+ * @param options credentials, the `fetch` to use, and an optional proxy URL.
198
+ * @example
199
+ * const client = createFalClient({ credentials: 'key', fetch })
200
+ * const { data } = await client.subscribe('fal-ai/flux/dev', { input })
201
+ */
202
+ function createFalClient(options) {
203
+ const { credentials, proxyUrl } = options;
204
+ if (isBrowser() && credentials) console.warn("The fal credentials are exposed in the browser's environment. That's not recommended for production use cases.");
205
+ async function send(method, url, { body, headers, signal, retry = DEFAULT_RETRY } = {}) {
206
+ const useProxy = proxyUrl !== void 0 && isBrowser();
207
+ for (let attempt = 0;; attempt++) try {
208
+ const response = await options.fetch(useProxy ? proxyUrl : url, {
209
+ method,
210
+ headers: {
211
+ ...credentials ? { Authorization: `Key ${credentials}` } : {},
212
+ Accept: "application/json",
213
+ "Content-Type": "application/json",
214
+ ...headers,
215
+ ...useProxy ? { "x-fal-target-url": url } : {}
216
+ },
217
+ signal,
218
+ body: method !== "GET" && body ? JSON.stringify(body) : void 0
219
+ });
220
+ return {
221
+ response,
222
+ data: await parseResponse(response)
223
+ };
224
+ } catch (error) {
225
+ if (attempt === retry.maxRetries || !isRetryable(error, retry.statusCodes) || signal?.aborted) throw error;
226
+ await sleep(backoffDelay(attempt, retry.maxDelay));
227
+ }
228
+ }
229
+ async function transformInput(input) {
230
+ if (Array.isArray(input)) return Promise.all(input.map((item) => transformInput(item)));
231
+ if (input instanceof Blob) return storage.upload(input);
232
+ if (isPlainObject(input)) {
233
+ const entries = Object.entries(input);
234
+ return Object.fromEntries(await Promise.all(entries.map(async ([key, value]) => [key, await transformInput(value)])));
235
+ }
236
+ return input;
237
+ }
238
+ const storage = { async upload(file, uploadOptions) {
239
+ if (file.size > MULTIPART_THRESHOLD_BYTES) return (await import("@fal-ai/client")).createFalClient(options).storage.upload(file, uploadOptions);
240
+ const contentType = file.type || "application/octet-stream";
241
+ const lifecycle = lifecycleConfig(uploadOptions?.lifecycle);
242
+ const { data } = await send("POST", UPLOAD_INITIATE_URL, {
243
+ body: {
244
+ content_type: contentType,
245
+ file_name: uploadFileName(file, contentType)
246
+ },
247
+ headers: lifecycle ? { "X-Fal-Object-Lifecycle": JSON.stringify(lifecycle) } : {}
248
+ });
249
+ await parseResponse(await options.fetch(data.upload_url, {
250
+ method: "PUT",
251
+ body: file,
252
+ headers: { "Content-Type": contentType }
253
+ }));
254
+ return data.file_url;
255
+ } };
256
+ const queue = {
257
+ async submit(endpointId, { input, abortSignal }) {
258
+ const body = input ? await transformInput(input) : void 0;
259
+ const { data } = await send("POST", queueUrl(endpointId), {
260
+ body,
261
+ headers: { "x-fal-queue-priority": "normal" },
262
+ signal: abortSignal,
263
+ retry: QUEUE_RETRY
264
+ });
265
+ return data;
266
+ },
267
+ async status(endpointId, { requestId, logs = false, abortSignal }) {
268
+ const { data } = await send("GET", queueUrl(queueAppId(endpointId), `/requests/${requestId}/status`, { logs: logs ? "1" : "0" }), {
269
+ signal: abortSignal,
270
+ retry: QUEUE_STATUS_RETRY
271
+ });
272
+ return data;
273
+ },
274
+ async result(endpointId, { requestId, abortSignal }) {
275
+ const { response, data } = await send("GET", queueUrl(queueAppId(endpointId), `/requests/${requestId}`), {
276
+ signal: abortSignal,
277
+ retry: QUEUE_RETRY
278
+ });
279
+ return {
280
+ data,
281
+ requestId: response.headers.get("x-fal-request-id") || ""
282
+ };
283
+ },
284
+ async cancel(endpointId, { requestId, abortSignal }) {
285
+ await send("PUT", queueUrl(queueAppId(endpointId), `/requests/${requestId}/cancel`), { signal: abortSignal });
286
+ }
287
+ };
288
+ return {
289
+ queue,
290
+ storage,
291
+ async subscribe(endpointId, subscribeOptions) {
292
+ const { request_id: requestId } = await queue.submit(endpointId, subscribeOptions);
293
+ const { abortSignal, logs, onEnqueue } = subscribeOptions;
294
+ onEnqueue?.(requestId);
295
+ while ((await queue.status(endpointId, {
296
+ requestId,
297
+ logs,
298
+ abortSignal
299
+ })).status !== "COMPLETED") await sleep(POLL_INTERVAL_MS);
300
+ return queue.result(endpointId, { requestId });
301
+ }
302
+ };
303
+ }
304
+ export { ApiError, ValidationError, createFalClient };
305
+
306
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/client/index.ts"],"sourcesContent":["import type {\n FalClient as SdkFalClient,\n QueueClient,\n StorageClient,\n StorageSettings,\n ValidationErrorInfo,\n} from '@fal-ai/client'\n\n/**\n * Config for {@link createFalClient}. These are the `@fal-ai/client` config\n * fields this package uses.\n */\nexport interface FalClientOptions {\n /** Sent as `Authorization: Key <credentials>`. */\n credentials: string\n fetch: typeof fetch\n /** In a browser, requests go here with the real URL in `x-fal-target-url`. */\n proxyUrl?: string\n}\n\n/**\n * The part of the `@fal-ai/client` client that the adapters call. A real SDK\n * client also fits this type.\n */\nexport type FalClient = Pick<SdkFalClient, 'subscribe'> & {\n queue: Pick<QueueClient, 'submit' | 'status' | 'result' | 'cancel'>\n storage: Pick<StorageClient, 'upload'>\n}\n\ninterface ApiErrorArgs<Body> {\n message: string\n status: number\n body?: Body\n requestId?: string\n timeoutType?: string\n}\n\n/**\n * Thrown when fal answers with a status that is not OK. Same name and fields\n * as the `@fal-ai/client` `ApiError`.\n */\nexport class ApiError<Body = unknown> extends Error {\n readonly status: number\n readonly body: Body | undefined\n readonly requestId: string\n readonly timeoutType?: string\n\n constructor({\n message,\n status,\n body,\n requestId,\n timeoutType,\n }: ApiErrorArgs<Body>) {\n super(message)\n this.name = 'ApiError'\n this.status = status\n this.body = body\n this.requestId = requestId || ''\n this.timeoutType = timeoutType\n }\n\n /** True when the request hit the timeout that the caller asked for. */\n get isUserTimeout() {\n return this.status === 504 && this.timeoutType === 'user'\n }\n}\n\n/**\n * Thrown for a 422 answer. Same name and fields as the `@fal-ai/client`\n * `ValidationError`.\n */\nexport class ValidationError extends ApiError<{\n detail?: Array<ValidationErrorInfo> | string\n}> {\n constructor(\n args: ApiErrorArgs<{ detail?: Array<ValidationErrorInfo> | string }>,\n ) {\n super(args)\n this.name = 'ValidationError'\n }\n\n get fieldErrors(): Array<ValidationErrorInfo> {\n const detail = this.body?.detail\n if (typeof detail === 'string') {\n return [{ loc: ['body'], msg: detail, type: 'value_error' }]\n }\n return detail || []\n }\n\n getFieldErrors(field: string) {\n return this.fieldErrors.filter((error) => error.loc.at(-1) === field)\n }\n}\n\ninterface RetryPolicy {\n maxRetries: number\n maxDelay: number\n statusCodes: Array<number>\n}\n\nconst RETRYABLE_STATUS_CODES = [429, 502, 503, 504]\nconst DEFAULT_RETRY: RetryPolicy = {\n maxRetries: 3,\n maxDelay: 30_000,\n statusCodes: RETRYABLE_STATUS_CODES,\n}\nconst QUEUE_RETRY: RetryPolicy = { ...DEFAULT_RETRY, maxDelay: 60_000 }\nconst QUEUE_STATUS_RETRY: RetryPolicy = {\n maxRetries: 5,\n maxDelay: 30_000,\n statusCodes: [...RETRYABLE_STATUS_CODES, 500],\n}\n\nconst NETWORK_ERROR_CODES = new Set([\n 'ECONNABORTED',\n 'ECONNREFUSED',\n 'ECONNRESET',\n 'EAI_AGAIN',\n 'EHOSTUNREACH',\n 'ENETUNREACH',\n 'ENOTFOUND',\n 'EPIPE',\n 'ETIMEDOUT',\n 'UND_ERR_BODY_TIMEOUT',\n 'UND_ERR_CONNECT_TIMEOUT',\n 'UND_ERR_HEADERS_TIMEOUT',\n 'UND_ERR_SOCKET',\n])\n\nconst POLL_INTERVAL_MS = 500\nconst MULTIPART_THRESHOLD_BYTES = 90 * 1024 * 1024\nconst UPLOAD_INITIATE_URL =\n 'https://rest.fal.ai/storage/upload/initiate?storage_type=fal-cdn-v3'\nconst ENDPOINT_NAMESPACES = ['workflows', 'comfy']\nconst EXPIRATION_SECONDS: Record<string, number | undefined> = {\n never: undefined,\n immediate: 60,\n '1h': 3600,\n '1d': 86400,\n '7d': 604800,\n '30d': 2592000,\n '1y': 31536000,\n}\n\nconst sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms))\n\nconst isBrowser = () =>\n typeof window !== 'undefined' && typeof window.document !== 'undefined'\n\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n return !!value && Object.getPrototypeOf(value) === Object.prototype\n}\n\n/** Transport errors (reset, DNS, socket timeout) are retried. Aborts are not. */\nfunction isNetworkError(error: unknown) {\n const seen = new Set<unknown>()\n let current = error\n let hasNetworkCode = false\n while (current && typeof current === 'object' && !seen.has(current)) {\n seen.add(current)\n const name = 'name' in current ? current.name : undefined\n const code = 'code' in current ? current.code : undefined\n if (name === 'AbortError' || name === 'TimeoutError') return false\n if (typeof code === 'string' && NETWORK_ERROR_CODES.has(code)) {\n hasNetworkCode = true\n }\n current = 'cause' in current ? current.cause : undefined\n }\n return (\n hasNetworkCode ||\n (error instanceof TypeError && /fetch failed/i.test(error.message))\n )\n}\n\nfunction isRetryable(error: unknown, statusCodes: Array<number>) {\n if (error instanceof ApiError) {\n return !error.isUserTimeout && statusCodes.includes(error.status)\n }\n return isNetworkError(error)\n}\n\n/** Exponential backoff from 1 s, doubled per attempt, capped, with +-25% jitter. */\nfunction backoffDelay(attempt: number, maxDelay: number) {\n const delay = Math.min(1000 * 2 ** attempt, maxDelay)\n return Math.max(0, delay + 0.25 * delay * (Math.random() * 2 - 1))\n}\n\n/** Reads a fal response, or throws `ApiError` / `ValidationError`. */\nasync function parseResponse(response: Response) {\n const { status, statusText } = response\n const contentType = response.headers.get('Content-Type') ?? ''\n const requestId = response.headers.get('x-fal-request-id') || undefined\n const timeoutType =\n response.headers.get('x-fal-request-timeout-type') || undefined\n const isJson = contentType.includes('application/json')\n if (!response.ok) {\n if (!isJson) {\n throw new ApiError({\n message: `HTTP ${status}: ${statusText}`,\n status,\n requestId,\n timeoutType,\n })\n }\n const body = await response.json()\n const ErrorType = status === 422 ? ValidationError : ApiError\n throw new ErrorType({\n message: body.message || statusText,\n status,\n body,\n requestId,\n timeoutType,\n })\n }\n if (isJson) return response.json()\n if (contentType.includes('application/octet-stream')) {\n return response.arrayBuffer()\n }\n return response.text()\n}\n\n/** `123-app` becomes `123/app`. Ids that already have a `/` stay as they are. */\nfunction normalizeEndpointId(id: string) {\n if (id.includes('/')) return id\n const match = /^([0-9]+)-([a-zA-Z0-9-]+)$/.exec(id)\n if (!match) {\n throw new Error(\n `Invalid app id: ${id}. Must be in the format <appOwner>/<appId>`,\n )\n }\n return `${match[1]}/${match[2]}`\n}\n\n/** Status and result URLs use only `[namespace/]owner/alias`, not the subpath. */\nfunction queueAppId(endpointId: string) {\n const parts = normalizeEndpointId(endpointId).split('/')\n const hasNamespace = ENDPOINT_NAMESPACES.includes(parts[0] ?? '')\n const [owner, alias] = hasNamespace ? parts.slice(1) : parts\n return `${hasNamespace ? `${parts[0]}/` : ''}${owner}/${alias}`\n}\n\nfunction isFalUrl(url: string) {\n try {\n return /(fal\\.(ai|run))$/.test(new URL(url).host)\n } catch {\n return false\n }\n}\n\nfunction queueUrl(id: string, path = '', query?: Record<string, string>) {\n const search = query ? `?${new URLSearchParams(query).toString()}` : ''\n const cleanPath = path.replace(/^\\//, '').replace(/\\/{2,}/, '/')\n if (isFalUrl(id)) {\n return `${id.endsWith('/') ? id : `${id}/`}${cleanPath}${search}`\n }\n const url = `https://queue.fal.run/${normalizeEndpointId(id)}/${cleanPath}`\n return `${url.replace(/\\/$/, '')}${search}`\n}\n\nfunction lifecycleConfig(lifecycle: StorageSettings | undefined) {\n if (!lifecycle) return undefined\n const { expiresIn, initialAcl } = lifecycle\n const seconds =\n typeof expiresIn === 'number'\n ? expiresIn\n : expiresIn === undefined\n ? undefined\n : EXPIRATION_SECONDS[expiresIn]\n const config = {\n ...(seconds !== undefined ? { expiration_duration_seconds: seconds } : {}),\n ...(initialAcl !== undefined ? { initial_acl: initialAcl } : {}),\n }\n return Object.keys(config).length > 0 ? config : undefined\n}\n\nfunction uploadFileName(file: Blob, contentType: string) {\n if (file instanceof File && file.name) return file.name\n const extension = contentType.split('/')[1]?.split(/[-;]/)[0] ?? 'bin'\n return `${Date.now()}.${extension}`\n}\n\ninterface SendOptions {\n body?: unknown\n headers?: Record<string, string>\n signal?: AbortSignal\n retry?: RetryPolicy\n}\n\n/**\n * Create a fal client that talks to the fal queue and storage REST API with\n * `fetch`. It has the same method names, arguments, results, and errors as the\n * `@fal-ai/client` methods the adapters use.\n *\n * @param options credentials, the `fetch` to use, and an optional proxy URL.\n * @example\n * const client = createFalClient({ credentials: 'key', fetch })\n * const { data } = await client.subscribe('fal-ai/flux/dev', { input })\n */\nexport function createFalClient(options: FalClientOptions) {\n const { credentials, proxyUrl } = options\n if (isBrowser() && credentials) {\n console.warn(\n \"The fal credentials are exposed in the browser's environment. \" +\n \"That's not recommended for production use cases.\",\n )\n }\n\n async function send(\n method: 'GET' | 'POST' | 'PUT',\n url: string,\n { body, headers, signal, retry = DEFAULT_RETRY }: SendOptions = {},\n ) {\n // Same as the SDK proxy middleware: without a `when` rule it only\n // proxies in a browser.\n const useProxy = proxyUrl !== undefined && isBrowser()\n for (let attempt = 0; ; attempt++) {\n try {\n const response = await options.fetch(useProxy ? proxyUrl : url, {\n method,\n headers: {\n ...(credentials ? { Authorization: `Key ${credentials}` } : {}),\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n ...headers,\n ...(useProxy ? { 'x-fal-target-url': url } : {}),\n },\n signal,\n body: method !== 'GET' && body ? JSON.stringify(body) : undefined,\n })\n return { response, data: await parseResponse(response) }\n } catch (error) {\n const isLastTry =\n attempt === retry.maxRetries ||\n !isRetryable(error, retry.statusCodes) ||\n signal?.aborted\n if (isLastTry) throw error\n await sleep(backoffDelay(attempt, retry.maxDelay))\n }\n }\n }\n\n async function transformInput(input: unknown): Promise<unknown> {\n if (Array.isArray(input)) {\n return Promise.all(input.map((item) => transformInput(item)))\n }\n if (input instanceof Blob) return storage.upload(input)\n if (isPlainObject(input)) {\n const entries = Object.entries(input)\n return Object.fromEntries(\n await Promise.all(\n entries.map(async ([key, value]) => [\n key,\n await transformInput(value),\n ]),\n ),\n )\n }\n return input\n }\n\n const storage: FalClient['storage'] = {\n async upload(file, uploadOptions) {\n if (file.size > MULTIPART_THRESHOLD_BYTES) {\n // ponytail: multipart upload stays in the SDK. Only files over 90 MB\n // load it.\n const sdk = await import('@fal-ai/client')\n return sdk.createFalClient(options).storage.upload(file, uploadOptions)\n }\n const contentType = file.type || 'application/octet-stream'\n const lifecycle = lifecycleConfig(uploadOptions?.lifecycle)\n const { data } = await send('POST', UPLOAD_INITIATE_URL, {\n body: {\n content_type: contentType,\n file_name: uploadFileName(file, contentType),\n },\n headers: lifecycle\n ? { 'X-Fal-Object-Lifecycle': JSON.stringify(lifecycle) }\n : {},\n })\n const uploaded = await options.fetch(data.upload_url, {\n method: 'PUT',\n body: file,\n headers: { 'Content-Type': contentType },\n })\n await parseResponse(uploaded)\n return data.file_url\n },\n }\n\n const queue: FalClient['queue'] = {\n async submit(endpointId, { input, abortSignal }) {\n const body = input ? await transformInput(input) : undefined\n const { data } = await send('POST', queueUrl(endpointId), {\n body,\n headers: { 'x-fal-queue-priority': 'normal' },\n signal: abortSignal,\n retry: QUEUE_RETRY,\n })\n return data\n },\n async status(endpointId, { requestId, logs = false, abortSignal }) {\n const url = queueUrl(\n queueAppId(endpointId),\n `/requests/${requestId}/status`,\n { logs: logs ? '1' : '0' },\n )\n const { data } = await send('GET', url, {\n signal: abortSignal,\n retry: QUEUE_STATUS_RETRY,\n })\n return data\n },\n async result(endpointId, { requestId, abortSignal }) {\n const url = queueUrl(queueAppId(endpointId), `/requests/${requestId}`)\n const { response, data } = await send('GET', url, {\n signal: abortSignal,\n retry: QUEUE_RETRY,\n })\n return {\n data,\n requestId: response.headers.get('x-fal-request-id') || '',\n }\n },\n async cancel(endpointId, { requestId, abortSignal }) {\n const url = queueUrl(\n queueAppId(endpointId),\n `/requests/${requestId}/cancel`,\n )\n await send('PUT', url, { signal: abortSignal })\n },\n }\n\n const client: FalClient = {\n queue,\n storage,\n async subscribe(endpointId, subscribeOptions) {\n const { request_id: requestId } = await queue.submit(\n endpointId,\n subscribeOptions,\n )\n const { abortSignal, logs, onEnqueue } = subscribeOptions\n onEnqueue?.(requestId)\n // Same as the SDK: poll right away, then every 500 ms until COMPLETED.\n while (\n (await queue.status(endpointId, { requestId, logs, abortSignal }))\n .status !== 'COMPLETED'\n ) {\n await sleep(POLL_INTERVAL_MS)\n }\n // The SDK does not pass the abort signal to the result request.\n return queue.result(endpointId, { requestId })\n },\n }\n return client\n}\n"],"mappings":";;;;;AAyCA,IAAa,WAAb,cAA8C,MAAM;CAClD;CACA;CACA;CACA;CAEA,YAAY,EACV,SACA,QACA,MACA,WACA,eACqB;EACrB,MAAM,OAAO;EACb,KAAK,OAAO;EACZ,KAAK,SAAS;EACd,KAAK,OAAO;EACZ,KAAK,YAAY,aAAa;EAC9B,KAAK,cAAc;CACrB;;CAGA,IAAI,gBAAgB;EAClB,OAAO,KAAK,WAAW,OAAO,KAAK,gBAAgB;CACrD;AACF;;;;;AAMA,IAAa,kBAAb,cAAqC,SAElC;CACD,YACE,MACA;EACA,MAAM,IAAI;EACV,KAAK,OAAO;CACd;CAEA,IAAI,cAA0C;EAC5C,MAAM,SAAS,KAAK,MAAM;EAC1B,IAAI,OAAO,WAAW,UACpB,OAAO,CAAC;GAAE,KAAK,CAAC,MAAM;GAAG,KAAK;GAAQ,MAAM;EAAc,CAAC;EAE7D,OAAO,UAAU,CAAC;CACpB;CAEA,eAAe,OAAe;EAC5B,OAAO,KAAK,YAAY,QAAQ,UAAU,MAAM,IAAI,GAAG,EAAE,MAAM,KAAK;CACtE;AACF;AAQA,IAAM,yBAAyB;CAAC;CAAK;CAAK;CAAK;AAAG;AAClD,IAAM,gBAA6B;CACjC,YAAY;CACZ,UAAU;CACV,aAAa;AACf;AACA,IAAM,cAA2B;CAAE,GAAG;CAAe,UAAU;AAAO;AACtE,IAAM,qBAAkC;CACtC,YAAY;CACZ,UAAU;CACV,aAAa,CAAC,GAAG,wBAAwB,GAAG;AAC9C;AAEA,IAAM,sCAAsB,IAAI,IAAI;CAClC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AAED,IAAM,mBAAmB;AACzB,IAAM,4BAA4B;AAClC,IAAM,sBACJ;AACF,IAAM,sBAAsB,CAAC,aAAa,OAAO;AACjD,IAAM,qBAAyD;CAC7D,OAAO,KAAA;CACP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