@umituz/react-native-ai-fal-provider 3.2.15 → 3.2.17

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umituz/react-native-ai-fal-provider",
3
- "version": "3.2.15",
3
+ "version": "3.2.17",
4
4
  "description": "FAL AI provider for React Native - implements IAIProvider interface for unified AI generation",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -146,6 +146,9 @@ export async function handleFalSubscription<T = unknown>(
146
146
  const statusWithPosition = `${jobStatus.status}:${jobStatus.queuePosition ?? ""}`;
147
147
  if (statusWithPosition !== lastStatus) {
148
148
  lastStatus = statusWithPosition;
149
+ if (typeof __DEV__ !== "undefined" && __DEV__) {
150
+ console.log(`[fal-provider] Job Status Update: ${jobStatus.status}${jobStatus.queuePosition ? ` (Position: ${jobStatus.queuePosition})` : ""}`);
151
+ }
149
152
  if (options?.onProgress) {
150
153
  if (jobStatus.status === "IN_QUEUE" || jobStatus.status === "IN_PROGRESS") {
151
154
  options.onProgress({ progress: -1, status: jobStatus.status });
@@ -182,9 +185,15 @@ export async function handleFalSubscription<T = unknown>(
182
185
  const rawResult = await Promise.race(promises);
183
186
  const { data, requestId } = unwrapFalResult<T>(rawResult);
184
187
 
188
+ // Validate response for base64 data URIs
189
+ // Since we use subscribe, we should always get CDN URLs, not base64 data URIs
185
190
  validateNoBase64InResponse(data);
186
191
  validateNSFWContent(data as Record<string, unknown>);
187
192
 
193
+ if (typeof __DEV__ !== "undefined" && __DEV__) {
194
+ console.log(`[fal-provider] Subscription completed successfully. Request ID: ${requestId}`);
195
+ }
196
+
188
197
  options?.onResult?.(data);
189
198
  return { result: data, requestId };
190
199
  } catch (error) {
@@ -15,6 +15,10 @@ import { getErrorMessage } from './helpers/error-helpers.util';
15
15
  * Uses design system's filesystem utilities for React Native compatibility
16
16
  */
17
17
  export async function uploadToFalStorage(base64: string): Promise<string> {
18
+ if (typeof __DEV__ !== "undefined" && __DEV__) {
19
+ console.log(`[fal-storage] Uploading base64 image to FAL (first 50 chars): ${base64.substring(0, 50)}...`);
20
+ }
21
+
18
22
  // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-assignment
19
23
  const tempUri = (await base64ToTempFile(base64));
20
24
 
@@ -26,6 +30,11 @@ export async function uploadToFalStorage(base64: string): Promise<string> {
26
30
  const response = await fetch(tempUri);
27
31
  const blob = await response.blob();
28
32
  const url = await fal.storage.upload(blob);
33
+
34
+ if (typeof __DEV__ !== "undefined" && __DEV__) {
35
+ console.log(`[fal-storage] Successfully uploaded base64 data to FAL. URL: ${url}`);
36
+ }
37
+
29
38
  return url;
30
39
  } finally {
31
40
  try {
@@ -48,9 +57,18 @@ export async function uploadToFalStorage(base64: string): Promise<string> {
48
57
  */
49
58
  export async function uploadLocalFileToFalStorage(fileUri: string): Promise<string> {
50
59
  try {
60
+ if (typeof __DEV__ !== "undefined" && __DEV__) {
61
+ console.log(`[fal-storage] Starting local file upload to FAL: ${fileUri}`);
62
+ }
63
+
51
64
  const response = await fetch(fileUri);
52
65
  const blob = await response.blob();
53
66
  const url = await fal.storage.upload(blob);
67
+
68
+ if (typeof __DEV__ !== "undefined" && __DEV__) {
69
+ console.log(`[fal-storage] Successfully uploaded local file to FAL. URL: ${url}`);
70
+ }
71
+
54
72
  return url;
55
73
  } catch (error) {
56
74
  throw new Error(
@@ -25,6 +25,12 @@ function isLocalFileUri(value: unknown): value is string {
25
25
  export async function preprocessInput(
26
26
  input: Record<string, unknown>,
27
27
  ): Promise<Record<string, unknown>> {
28
+ if (typeof __DEV__ !== "undefined" && __DEV__) {
29
+ console.log("[preprocessInput] Starting input preprocessing...", {
30
+ keys: Object.keys(input)
31
+ });
32
+ }
33
+
28
34
  const result = { ...input };
29
35
  const uploadPromises: Promise<unknown>[] = [];
30
36