@umituz/react-native-ai-fal-provider 2.0.11 → 2.0.15

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 (71) hide show
  1. package/package.json +2 -4
  2. package/src/domain/entities/error.types.ts +2 -0
  3. package/src/domain/types/provider.types.ts +1 -0
  4. package/src/exports/infrastructure.ts +0 -3
  5. package/src/exports/presentation.ts +0 -9
  6. package/src/index.ts +0 -3
  7. package/src/infrastructure/services/fal-feature-models.ts +3 -1
  8. package/src/infrastructure/services/fal-provider-subscription.ts +35 -13
  9. package/src/infrastructure/services/fal-provider.ts +6 -0
  10. package/src/infrastructure/services/fal-queue-operations.ts +30 -1
  11. package/src/infrastructure/services/fal-status-mapper.ts +2 -0
  12. package/src/infrastructure/services/request-store.ts +30 -2
  13. package/src/infrastructure/utils/cost-tracker.ts +34 -8
  14. package/src/infrastructure/utils/error-mapper.ts +17 -3
  15. package/src/infrastructure/utils/fal-storage.util.ts +3 -3
  16. package/src/infrastructure/utils/image-feature-builders.util.ts +10 -5
  17. package/src/infrastructure/utils/index.ts +7 -6
  18. package/src/infrastructure/utils/input-preprocessor.util.ts +1 -1
  19. package/src/infrastructure/utils/input-validator.util.ts +92 -0
  20. package/src/infrastructure/utils/type-guards.util.ts +7 -3
  21. package/src/infrastructure/utils/video-feature-builders.util.ts +6 -3
  22. package/src/infrastructure/validators/nsfw-validator.ts +62 -4
  23. package/src/presentation/hooks/index.ts +3 -21
  24. package/src/presentation/hooks/use-fal-generation.ts +5 -4
  25. package/src/domain/constants/default-models.constants.README.md +0 -378
  26. package/src/domain/constants/models/image-to-video.README.md +0 -266
  27. package/src/domain/constants/models/index.README.md +0 -269
  28. package/src/domain/constants/models/text-to-image.README.md +0 -237
  29. package/src/domain/constants/models/text-to-text.README.md +0 -249
  30. package/src/domain/constants/models/text-to-video.README.md +0 -259
  31. package/src/domain/constants/models/text-to-voice.README.md +0 -264
  32. package/src/domain/entities/error.types.README.md +0 -292
  33. package/src/domain/entities/fal.types.README.md +0 -460
  34. package/src/domain/types/index.README.md +0 -229
  35. package/src/domain/types/model-selection.types.README.md +0 -311
  36. package/src/exports/registry.ts +0 -39
  37. package/src/index.README.md +0 -420
  38. package/src/infrastructure/builders/image-feature-builder.README.md +0 -435
  39. package/src/infrastructure/builders/index.ts +0 -7
  40. package/src/infrastructure/services/fal-models-service.README.md +0 -293
  41. package/src/infrastructure/services/fal-provider-subscription.README.md +0 -257
  42. package/src/infrastructure/services/fal-provider.README.md +0 -474
  43. package/src/infrastructure/services/fal-status-mapper.README.md +0 -246
  44. package/src/infrastructure/services/nsfw-content-error.README.md +0 -215
  45. package/src/infrastructure/utils/base-builders.util.README.md +0 -313
  46. package/src/infrastructure/utils/cost-tracker-queries.ts +0 -67
  47. package/src/infrastructure/utils/error-categorizer.README.md +0 -395
  48. package/src/infrastructure/utils/error-mapper.README.md +0 -367
  49. package/src/infrastructure/utils/helpers.util.README.md +0 -395
  50. package/src/infrastructure/utils/image-feature-builders.util.README.md +0 -411
  51. package/src/infrastructure/utils/index.README.md +0 -338
  52. package/src/infrastructure/utils/job-metadata/index.README.md +0 -267
  53. package/src/infrastructure/utils/job-metadata/job-metadata-format.util.README.md +0 -209
  54. package/src/infrastructure/utils/job-metadata/job-metadata-lifecycle.util.README.md +0 -311
  55. package/src/infrastructure/utils/job-metadata/job-metadata-queries.util.README.md +0 -332
  56. package/src/infrastructure/utils/job-metadata/job-metadata.types.README.md +0 -446
  57. package/src/infrastructure/utils/job-metadata.README.md +0 -268
  58. package/src/infrastructure/utils/timing-helpers.util.ts +0 -56
  59. package/src/infrastructure/utils/type-guards.util.README.md +0 -371
  60. package/src/infrastructure/validators/index.README.md +0 -205
  61. package/src/infrastructure/validators/nsfw-validator.README.md +0 -309
  62. package/src/presentation/hooks/index.README.md +0 -224
  63. package/src/presentation/hooks/use-fal-generation.README.md +0 -398
  64. package/src/presentation/hooks/use-model-capabilities.ts +0 -99
  65. package/src/presentation/hooks/use-models.README.md +0 -318
  66. package/src/registry/global-capabilities.ts +0 -75
  67. package/src/registry/index.ts +0 -50
  68. package/src/registry/model-registry.service.ts +0 -93
  69. package/src/registry/model-registry.types.ts +0 -106
  70. package/src/registry/models/index.ts +0 -6
  71. package/src/registry/models/sora-2.config.ts +0 -95
@@ -1,266 +0,0 @@
1
- # Image-to-Video Generation
2
-
3
- Transforms static images into moving videos.
4
-
5
- **Location:** `src/domain/constants/models/image-to-video.ts`
6
-
7
- ## Overview
8
-
9
- Image-to-video generation animates static images to create video content using AI models. This module provides model configurations for converting images into videos with various camera movements and durations.
10
-
11
- ## Purpose
12
-
13
- Provides image-to-video models by:
14
- - Animating static images
15
- - Supporting camera movements
16
- - Enabling configurable durations
17
- - Providing various aspect ratios
18
- - Maintaining image quality in video
19
-
20
- ## Import
21
-
22
- ```typescript
23
- import {
24
- falProvider,
25
- useFalGeneration
26
- } from '@umituz/react-native-ai-fal-provider';
27
- ```
28
-
29
- ## Available Models
30
-
31
- ### Kling I2V
32
- - **Model ID:** `fal-ai/kling-video/v1.5/pro/image-to-video`
33
- - **Cost:** 15 credits (Free), 8 credits (Premium)
34
- - **Description:** High-quality image-to-video generation (Default)
35
- - **Use Cases:** Professional image animation, high-quality output
36
-
37
- ## Parameters
38
-
39
- ### Common Parameters
40
-
41
- | Parameter | Type | Description | Default |
42
- |-----------|------|-------------|---------|
43
- | `image_url` | `string` | Source image (base64 or URL) | - |
44
- | `prompt` | `string` | Description of desired motion/action | - |
45
- | `aspect_ratio` | `string` | Video aspect ratio | `16:9` |
46
- | `duration` | `number` | Video duration in seconds | 5 |
47
- | `fps` | `number` | Frame rate | 24 |
48
-
49
- ### Aspect Ratios
50
-
51
- - `16:9`: Horizontal (landscape)
52
- - `9:16`: Vertical (portrait)
53
- - `1:1`: Square
54
-
55
- ### Camera Movements
56
-
57
- **Movement Types:**
58
- - `pan`: Horizontal panning
59
- - `tilt`: Vertical tilting
60
- - `zoom`: Zoom in/out
61
- - `dolly`: Forward/backward movement
62
- - `static`: Fixed camera
63
-
64
- ## Usage Guidelines
65
-
66
- ### For Image Animation
67
-
68
- **Animation Pattern:**
69
- 1. Select high-quality source image
70
- 2. Describe desired motion in prompt
71
- 3. Set appropriate aspect ratio
72
- 4. Configure duration and frame rate
73
- 5. Specify camera movement type
74
- 6. Handle generation result
75
-
76
- **Best Practices:**
77
- - Use high-resolution source images (min 512x512)
78
- - Focus on specific, achievable motions
79
- - Describe subtle movements
80
- - Match camera movement to subject
81
- - Keep prompts concise
82
-
83
- ### For Image Selection
84
-
85
- **Selection Pattern:**
86
- 1. Evaluate image quality
87
- 2. Check resolution and clarity
88
- 3. Identify focal point
89
- 4. Assess lighting conditions
90
- 5. Verify suitability for animation
91
-
92
- **Image Guidelines:**
93
- - Minimum 512x512 resolution
94
- - Well-lit and clear focus
95
- - Distinct subject or focal point
96
- - Good contrast
97
- - Appropriate composition
98
-
99
- ## Best Practices
100
-
101
- ### 1. Select Quality Source Images
102
-
103
- Choose appropriate images:
104
- - Use high-resolution images
105
- - Ensure good lighting
106
- - Check focus clarity
107
- - Verify distinct subjects
108
- - Assess composition quality
109
-
110
- ### 2. Write Concise Motion Prompts
111
-
112
- Describe movement effectively:
113
- - Focus on one or two actions
114
- - Use movement-oriented language
115
- - Describe subtle changes
116
- - Include atmospheric details
117
- - Keep prompts brief
118
-
119
- **Prompt Guidelines:**
120
- - Be specific: "Person slowly smiling" not "Person happy"
121
- - Add atmosphere: "Wind blowing", "Light changing"
122
- - Focus on achievable motions
123
- - Describe natural movements
124
-
125
- ### 3. Choose Appropriate Camera Movements
126
-
127
- Select movement types carefully:
128
- - Static: Portraits, subtle expressions
129
- - Pan: Landscapes, wide scenes
130
- - Zoom: Focusing on subjects
131
- - Tilt: Vertical scans
132
- - Dolly: Forward/backward motion
133
-
134
- ### 4. Optimize Parameters
135
-
136
- Balance quality and performance:
137
- - Shorter durations (3-5s) for quick results
138
- - Standard fps (24) for most use cases
139
- - Higher fps (30) for smooth motion
140
- - Match aspect ratio to platform
141
- - Adjust duration to content
142
-
143
- ### 5. Handle Edge Cases
144
-
145
- Manage challenging scenarios:
146
- - NSFW content detection
147
- - Invalid image formats
148
- - Unsupported resolutions
149
- - Generation failures
150
- - Timeout handling
151
-
152
- ## For AI Agents
153
-
154
- ### When Using Image-to-Video Models
155
-
156
- **DO:**
157
- - Validate source image quality
158
- - Check image resolution
159
- - Write concise motion prompts
160
- - Select appropriate camera movements
161
- - Handle NSFW content errors
162
- - Validate image format
163
- - Check aspect ratio compatibility
164
- - Test with shorter durations
165
-
166
- **DON'T:**
167
- - Use low-resolution images
168
- - Write complex multi-action prompts
169
- - Ignore camera movement selection
170
- - Skip image validation
171
- - Forget error handling
172
- - Use excessive durations
173
- - Ignore aspect ratios
174
- - Assume all images work
175
-
176
- ### When Writing Prompts
177
-
178
- **DO:**
179
- - Keep prompts concise (1-2 actions)
180
- - Focus on specific movements
181
- - Use descriptive motion language
182
- - Include subtle atmospheric details
183
- - Describe natural movements
184
- - Be explicit about pace
185
- - Reference subject features
186
-
187
- **DON'T:**
188
- - Write long complex prompts
189
- - Describe multiple simultaneous actions
190
- - Use vague motion descriptions
191
- - Skip movement details
192
- - Include contradictory elements
193
- - Overcomplicate descriptions
194
- - Forget subject specifics
195
-
196
- ### When Selecting Images
197
-
198
- **DO:**
199
- - Check minimum resolution (512x512)
200
- - Verify image quality
201
- - Ensure good lighting
202
- - Identify clear focal point
203
- - Assess composition
204
- - Validate image format
205
- - Test image suitability
206
-
207
- **DON'T:**
208
- - Use low-quality images
209
- - Skip resolution checks
210
- - Ignore lighting conditions
211
- - Use blurry images
212
- - Forget focal point
213
- - Use unsupported formats
214
- - Assume any image works
215
-
216
- ### When Configuring Parameters
217
-
218
- **DO:**
219
- - Start with shorter durations (3-5s)
220
- - Use standard fps (24) initially
221
- - Match aspect ratio to platform
222
- - Test camera movement types
223
- - Adjust based on content
224
- - Consider file size
225
- - Optimize for use case
226
-
227
- **DON'T:**
228
- - Use maximum duration initially
229
- - Skip camera movement selection
230
- - Ignore aspect ratio requirements
231
- - Set excessive frame rates
232
- - Forget platform constraints
233
- - Use one-size-fits-all approach
234
- - Waste credits on long tests
235
-
236
- ## Implementation Notes
237
-
238
- **Location:** `src/domain/constants/models/image-to-video.ts`
239
-
240
- **Dependencies:**
241
- - FAL provider service
242
- - useFalGeneration hook
243
- - Image format utilities
244
- - NSFW validators
245
- - Progress tracking utilities
246
-
247
- **Supported Operations:**
248
- - Single image animation
249
- - Camera movement control
250
- - Duration and fps configuration
251
- - Aspect ratio selection
252
- - Format validation
253
-
254
- **Import:**
255
- ```typescript
256
- import {
257
- falProvider,
258
- useFalGeneration
259
- } from '@umituz/react-native-ai-fal-provider';
260
- ```
261
-
262
- **Related:**
263
- - FAL provider: `src/infrastructure/services/fal-provider.ts`
264
- - Generation hook: `src/presentation/hooks/use-fal-generation.ts`
265
- - Image utilities: `src/infrastructure/utils/helpers.util.ts`
266
- - NSFW validator: `src/infrastructure/validators/nsfw-validator.ts`
@@ -1,269 +0,0 @@
1
- # Model Catalog Index
2
-
3
- Central export point for all FAL AI model configurations.
4
-
5
- **Location:** `src/domain/constants/models/index.ts`
6
-
7
- ## Overview
8
-
9
- The model catalog provides organized access to all available FAL AI models across different generation types. Each model includes detailed configuration such as pricing, availability, and capabilities.
10
-
11
- ## Purpose
12
-
13
- Provides model catalog by:
14
- - Organizing models by generation type
15
- - Exporting all model configurations
16
- - Supporting model discovery
17
- - Enabling model comparison
18
- - Facilitating model selection
19
-
20
- ## Import
21
-
22
- ```typescript
23
- import {
24
- DEFAULT_TEXT_TO_IMAGE_MODELS,
25
- DEFAULT_TEXT_TO_VIDEO_MODELS,
26
- DEFAULT_IMAGE_TO_VIDEO_MODELS,
27
- DEFAULT_TEXT_TO_VOICE_MODELS,
28
- DEFAULT_TEXT_TO_TEXT_MODELS,
29
- } from '@umituz/react-native-ai-fal-provider';
30
- ```
31
-
32
- ## Exports
33
-
34
- ### Text-to-Image Models
35
-
36
- Models for generating images from text prompts.
37
-
38
- **Documentation:** See `text-to-image.README.md`
39
-
40
- **Models:**
41
- - Flux Schnell (1 credit) - Fast generation
42
- - Flux Dev (2 credits) - High quality
43
- - Flux Pro (3 credits) - Professional quality
44
-
45
- **Path:** `src/domain/constants/models/text-to-image.ts`
46
-
47
- ### Text-to-Video Models
48
-
49
- Models for generating videos from text descriptions.
50
-
51
- **Documentation:** See `text-to-video.README.md`
52
-
53
- **Models:**
54
- - Hunyuan (10 credits) - Balanced quality/speed
55
- - MiniMax (15 credits) - High quality video
56
- - Kling 1.5 (20 credits) - Premium video generation
57
- - Mochi (8 credits) - Fast video generation
58
-
59
- **Path:** `src/domain/constants/models/text-to-video.ts`
60
-
61
- ### Image-to-Video Models
62
-
63
- Models for converting images to videos.
64
-
65
- **Documentation:** See `image-to-video.README.md`
66
-
67
- **Models:**
68
- - Kling I2V (15 credits) - Professional image-to-video conversion
69
-
70
- **Path:** `src/domain/constants/models/image-to-video.ts`
71
-
72
- ### Text-to-Voice Models
73
-
74
- Models for text-to-speech generation.
75
-
76
- **Documentation:** See `text-to-voice.README.md`
77
-
78
- **Models:**
79
- - PlayAI TTS v3 (1 credit) - Fast text-to-speech
80
- - ElevenLabs TTS (2 credits) - High quality TTS
81
-
82
- **Path:** `src/domain/constants/models/text-to-voice.ts`
83
-
84
- ### Text-to-Text Models
85
-
86
- Models for text generation and completion.
87
-
88
- **Documentation:** See `text-to-text.README.md`
89
-
90
- **Models:**
91
- - Llama 3 8B Instruct (0.1 credits) - General purpose LLM
92
-
93
- **Path:** `src/domain/constants/models/text-to-text.ts`
94
-
95
- ## Usage Guidelines
96
-
97
- ### For Model Discovery
98
-
99
- **Discovery Pattern:**
100
- 1. Import model arrays by type
101
- 2. Filter models based on criteria
102
- 3. Access model configurations
103
- 4. Display model information
104
- 5. Enable user selection
105
-
106
- **Best Practices:**
107
- - Import from package root
108
- - Use model arrays for UI components
109
- - Filter by cost, quality, or availability
110
- - Display pricing information
111
- - Indicate default models
112
-
113
- ### For Model Information
114
-
115
- **Information Pattern:**
116
- 1. Access model configuration
117
- 2. Read model metadata
118
- 3. Check availability and pricing
119
- 4. Display to users
120
- 5. Guide model selection
121
-
122
- **Available Information:**
123
- - Model ID and name
124
- - Generation type
125
- - Pricing (free/premium)
126
- - Default status
127
- - Active status
128
- - Description
129
-
130
- ## Best Practices
131
-
132
- ### 1. Use Model IDs Directly
133
-
134
- Reference models by ID:
135
- - Use model IDs from catalog
136
- - Avoid hardcoding IDs
137
- - Reference through configuration
138
- - Maintain single source of truth
139
- - Update models centrally
140
-
141
- ### 2. Check Model Availability
142
-
143
- Validate model status:
144
- - Check `isActive` property
145
- - Handle inactive models
146
- - Provide fallback options
147
- - Inform users of issues
148
- - Update UI accordingly
149
-
150
- ### 3. Display Cost to Users
151
-
152
- Show pricing information:
153
- - Display credit cost per generation
154
- - Show free vs premium pricing
155
- - Calculate batch costs
156
- - Warn before expensive operations
157
- - Help users optimize costs
158
-
159
- ### 4. Respect Default Models
160
-
161
- Use default appropriately:
162
- - Identify default models
163
- - Use default for new users
164
- - Enable easy switching
165
- - Clearly mark defaults
166
- - Support user preferences
167
-
168
- ### 5. Enable Model Comparison
169
-
170
- Facilitate model selection:
171
- - Compare by cost
172
- - Compare by quality
173
- - Compare by capabilities
174
- - Show pros and cons
175
- - Help users choose
176
-
177
- ## For AI Agents
178
-
179
- ### When Using Model Catalog
180
-
181
- **DO:**
182
- - Import from package root
183
- - Use model arrays from catalog
184
- - Check model availability
185
- - Display pricing information
186
- - Respect default models
187
- - Filter models appropriately
188
- - Use model IDs from catalog
189
-
190
- **DON'T:**
191
- - Hardcode model IDs
192
- - Skip availability checks
193
- - Hide pricing information
194
- - Ignore default status
195
- - Create duplicate model lists
196
- - Import from internal paths
197
- - Assume model validity
198
-
199
- ### When Displaying Models
200
-
201
- **DO:**
202
- - Show model names clearly
203
- - Display pricing information
204
- - Indicate default models
205
- - Show availability status
206
- - Provide descriptions
207
- - Enable filtering
208
- - Support comparison
209
-
210
- **DON'T:**
211
- - Hide model information
212
- - Skip pricing display
213
- - Ignore defaults
214
- - Show inactive models
215
- - Prevent comparison
216
- - Create confusing UIs
217
- - Overwhelm users
218
-
219
- ### When Selecting Models
220
-
221
- **DO:**
222
- - Use default models initially
223
- - Enable user switching
224
- - Validate selections
225
- - Check availability
226
- - Warn about costs
227
- - Provide recommendations
228
- - Support preferences
229
-
230
- **DON'T:**
231
- - Force model selection
232
- - Skip validation
233
- - Ignore costs
234
- - Hide options
235
- - Remove user control
236
- - Make arbitrary choices
237
- - Override user preferences
238
-
239
- ## Implementation Notes
240
-
241
- **Location:** `src/domain/constants/models/index.ts`
242
-
243
- **Dependencies:**
244
- - Re-exports all model type files
245
- - No external dependencies
246
- - Pure TypeScript exports
247
-
248
- **Export Categories:**
249
- - Text-to-image models
250
- - Text-to-video models
251
- - Image-to-video models
252
- - Text-to-voice models
253
- - Text-to-text models
254
-
255
- **Import:**
256
- ```typescript
257
- import {
258
- DEFAULT_TEXT_TO_IMAGE_MODELS,
259
- DEFAULT_TEXT_TO_VIDEO_MODELS,
260
- DEFAULT_IMAGE_TO_VIDEO_MODELS,
261
- DEFAULT_TEXT_TO_VOICE_MODELS,
262
- DEFAULT_TEXT_TO_TEXT_MODELS,
263
- } from '@umituz/react-native-ai-fal-provider';
264
- ```
265
-
266
- **Related:**
267
- - Individual model docs: `src/domain/constants/models/*.README.md`
268
- - Default models: `src/domain/constants/default-models.constants.ts`
269
- - Feature models: `src/domain/constants/feature-models.constants.ts`