@umituz/react-native-ai-fal-provider 2.0.1 → 2.0.2
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 +1 -1
- package/src/exports/domain.ts +59 -0
- package/src/exports/infrastructure.ts +97 -0
- package/src/exports/presentation.ts +23 -0
- package/src/exports/registry.ts +39 -0
- package/src/index.ts +8 -201
package/package.json
CHANGED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Domain Layer Exports
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export type {
|
|
6
|
+
FalConfig,
|
|
7
|
+
FalModel,
|
|
8
|
+
FalModelType,
|
|
9
|
+
FalModelPricing,
|
|
10
|
+
FalJobInput,
|
|
11
|
+
FalJobResult,
|
|
12
|
+
FalLogEntry,
|
|
13
|
+
FalQueueStatus,
|
|
14
|
+
FalSubscribeOptions,
|
|
15
|
+
} from "../domain/entities/fal.types";
|
|
16
|
+
|
|
17
|
+
export type {
|
|
18
|
+
GenerationCost,
|
|
19
|
+
CostTrackerConfig,
|
|
20
|
+
CostSummary,
|
|
21
|
+
ModelCostInfo,
|
|
22
|
+
} from "../domain/entities/cost-tracking.types";
|
|
23
|
+
|
|
24
|
+
export { FalErrorType } from "../domain/entities/error.types";
|
|
25
|
+
export type {
|
|
26
|
+
FalErrorCategory,
|
|
27
|
+
FalErrorInfo,
|
|
28
|
+
FalErrorMessages,
|
|
29
|
+
} from "../domain/entities/error.types";
|
|
30
|
+
|
|
31
|
+
export {
|
|
32
|
+
DEFAULT_TEXT_TO_IMAGE_MODELS,
|
|
33
|
+
DEFAULT_TEXT_TO_VOICE_MODELS,
|
|
34
|
+
DEFAULT_TEXT_TO_VIDEO_MODELS,
|
|
35
|
+
DEFAULT_IMAGE_TO_VIDEO_MODELS,
|
|
36
|
+
getAllDefaultModels,
|
|
37
|
+
getDefaultModelsByType,
|
|
38
|
+
getDefaultModel,
|
|
39
|
+
findModelById,
|
|
40
|
+
} from "../domain/constants/default-models.constants";
|
|
41
|
+
export type { FalModelConfig } from "../domain/constants/default-models.constants";
|
|
42
|
+
|
|
43
|
+
export { FAL_IMAGE_FEATURE_MODELS } from "../domain/constants/feature-models.constants";
|
|
44
|
+
|
|
45
|
+
export type {
|
|
46
|
+
UpscaleOptions,
|
|
47
|
+
PhotoRestoreOptions,
|
|
48
|
+
FaceSwapOptions,
|
|
49
|
+
ImageToImagePromptConfig,
|
|
50
|
+
RemoveBackgroundOptions,
|
|
51
|
+
RemoveObjectOptions,
|
|
52
|
+
ReplaceBackgroundOptions,
|
|
53
|
+
VideoFromImageOptions,
|
|
54
|
+
ModelType,
|
|
55
|
+
ModelSelectionConfig,
|
|
56
|
+
ModelSelectionState,
|
|
57
|
+
ModelSelectionActions,
|
|
58
|
+
UseModelsReturn,
|
|
59
|
+
} from "../domain/types";
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Infrastructure Layer Exports
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export {
|
|
6
|
+
FalProvider,
|
|
7
|
+
falProvider,
|
|
8
|
+
falModelsService,
|
|
9
|
+
NSFWContentError,
|
|
10
|
+
cancelCurrentFalRequest,
|
|
11
|
+
hasRunningFalRequest,
|
|
12
|
+
} from "../infrastructure/services";
|
|
13
|
+
export type { FalProviderType } from "../infrastructure/services";
|
|
14
|
+
|
|
15
|
+
export {
|
|
16
|
+
categorizeFalError,
|
|
17
|
+
falErrorMapper,
|
|
18
|
+
mapFalError,
|
|
19
|
+
isFalErrorRetryable,
|
|
20
|
+
buildSingleImageInput,
|
|
21
|
+
buildDualImageInput,
|
|
22
|
+
buildUpscaleInput,
|
|
23
|
+
buildPhotoRestoreInput,
|
|
24
|
+
buildVideoFromImageInput,
|
|
25
|
+
buildFaceSwapInput,
|
|
26
|
+
buildImageToImageInput,
|
|
27
|
+
buildRemoveBackgroundInput,
|
|
28
|
+
buildRemoveObjectInput,
|
|
29
|
+
buildReplaceBackgroundInput,
|
|
30
|
+
buildHDTouchUpInput,
|
|
31
|
+
} from "../infrastructure/utils";
|
|
32
|
+
|
|
33
|
+
export { CostTracker } from "../infrastructure/utils/cost-tracker";
|
|
34
|
+
|
|
35
|
+
export {
|
|
36
|
+
isFalModelType,
|
|
37
|
+
isModelType,
|
|
38
|
+
isFalErrorType,
|
|
39
|
+
isValidBase64Image,
|
|
40
|
+
isValidApiKey,
|
|
41
|
+
isValidModelId,
|
|
42
|
+
isValidPrompt,
|
|
43
|
+
isValidTimeout,
|
|
44
|
+
isValidRetryCount,
|
|
45
|
+
} from "../infrastructure/utils";
|
|
46
|
+
|
|
47
|
+
export {
|
|
48
|
+
formatImageDataUri,
|
|
49
|
+
extractBase64,
|
|
50
|
+
getDataUriExtension,
|
|
51
|
+
isImageDataUri,
|
|
52
|
+
uploadToFalStorage,
|
|
53
|
+
uploadMultipleToFalStorage,
|
|
54
|
+
calculateTimeoutWithJitter,
|
|
55
|
+
formatCreditCost,
|
|
56
|
+
truncatePrompt,
|
|
57
|
+
sanitizePrompt,
|
|
58
|
+
buildErrorMessage,
|
|
59
|
+
isDefined,
|
|
60
|
+
removeNullish,
|
|
61
|
+
debounce,
|
|
62
|
+
throttle,
|
|
63
|
+
} from "../infrastructure/utils";
|
|
64
|
+
|
|
65
|
+
export {
|
|
66
|
+
createJobMetadata,
|
|
67
|
+
updateJobMetadata,
|
|
68
|
+
isJobCompleted,
|
|
69
|
+
isJobRunning,
|
|
70
|
+
isJobStale,
|
|
71
|
+
getJobDuration,
|
|
72
|
+
formatJobDuration,
|
|
73
|
+
calculateJobProgress,
|
|
74
|
+
serializeJobMetadata,
|
|
75
|
+
deserializeJobMetadata,
|
|
76
|
+
filterValidJobs,
|
|
77
|
+
sortJobsByCreation,
|
|
78
|
+
getActiveJobs,
|
|
79
|
+
getCompletedJobs,
|
|
80
|
+
} from "../infrastructure/utils";
|
|
81
|
+
|
|
82
|
+
export {
|
|
83
|
+
saveJobMetadata,
|
|
84
|
+
loadJobMetadata,
|
|
85
|
+
deleteJobMetadata,
|
|
86
|
+
loadAllJobs,
|
|
87
|
+
cleanupOldJobs,
|
|
88
|
+
getJobsByModel,
|
|
89
|
+
getJobsByStatus,
|
|
90
|
+
updateJobStatus,
|
|
91
|
+
} from "../infrastructure/utils";
|
|
92
|
+
|
|
93
|
+
export type {
|
|
94
|
+
FalJobMetadata,
|
|
95
|
+
IJobStorage,
|
|
96
|
+
InMemoryJobStorage,
|
|
97
|
+
} from "../infrastructure/utils";
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Presentation Layer Exports
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export {
|
|
6
|
+
useFalGeneration,
|
|
7
|
+
useModels,
|
|
8
|
+
useModelCapabilities,
|
|
9
|
+
useVideoDurations,
|
|
10
|
+
useVideoResolutions,
|
|
11
|
+
useAspectRatios,
|
|
12
|
+
} from "../presentation/hooks";
|
|
13
|
+
|
|
14
|
+
export type {
|
|
15
|
+
UseFalGenerationOptions,
|
|
16
|
+
UseFalGenerationResult,
|
|
17
|
+
UseModelsProps,
|
|
18
|
+
UseModelCapabilitiesOptions,
|
|
19
|
+
UseModelCapabilitiesReturn,
|
|
20
|
+
UseVideoDurationsReturn,
|
|
21
|
+
UseVideoResolutionsReturn,
|
|
22
|
+
UseAspectRatiosReturn,
|
|
23
|
+
} from "../presentation/hooks";
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Model Registry Exports
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export {
|
|
6
|
+
VIDEO_ASPECT_RATIOS,
|
|
7
|
+
IMAGE_ASPECT_RATIOS,
|
|
8
|
+
GLOBAL_CAPABILITIES,
|
|
9
|
+
GLOBAL_DEFAULTS,
|
|
10
|
+
SORA_2_DURATIONS,
|
|
11
|
+
SORA_2_RESOLUTIONS,
|
|
12
|
+
SORA_2_CREDITS_BY_DURATION,
|
|
13
|
+
SORA_2_TEXT_TO_VIDEO,
|
|
14
|
+
SORA_2_IMAGE_TO_VIDEO,
|
|
15
|
+
SORA_2_MODELS,
|
|
16
|
+
MODEL_REGISTRY,
|
|
17
|
+
getModelConfig,
|
|
18
|
+
getModelsByType,
|
|
19
|
+
getEnabledModels,
|
|
20
|
+
getModelCapabilities,
|
|
21
|
+
getModelCreditCost,
|
|
22
|
+
getDefaultModelFromRegistry,
|
|
23
|
+
} from "../registry";
|
|
24
|
+
|
|
25
|
+
export type {
|
|
26
|
+
ModelType as RegistryModelType,
|
|
27
|
+
ModelProvider,
|
|
28
|
+
DurationOption,
|
|
29
|
+
ResolutionOption,
|
|
30
|
+
AspectRatioOption,
|
|
31
|
+
ModelCapabilities,
|
|
32
|
+
ModelPricing,
|
|
33
|
+
ModelDefaults,
|
|
34
|
+
ModelConfig,
|
|
35
|
+
ModelRegistry as ModelRegistryType,
|
|
36
|
+
ResolvedCapabilities,
|
|
37
|
+
GlobalCapabilities,
|
|
38
|
+
GlobalDefaults,
|
|
39
|
+
} from "../registry";
|
package/src/index.ts
CHANGED
|
@@ -3,213 +3,20 @@
|
|
|
3
3
|
* FAL AI provider for React Native - implements IAIProvider interface
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
FalModel,
|
|
9
|
-
FalModelType,
|
|
10
|
-
FalModelPricing,
|
|
11
|
-
FalJobInput,
|
|
12
|
-
FalJobResult,
|
|
13
|
-
FalLogEntry,
|
|
14
|
-
FalQueueStatus,
|
|
15
|
-
FalSubscribeOptions,
|
|
16
|
-
} from "./domain/entities/fal.types";
|
|
6
|
+
// Domain Layer
|
|
7
|
+
export * from "./exports/domain";
|
|
17
8
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
CostTrackerConfig,
|
|
21
|
-
CostSummary,
|
|
22
|
-
ModelCostInfo,
|
|
23
|
-
} from "./domain/entities/cost-tracking.types";
|
|
9
|
+
// Infrastructure Layer
|
|
10
|
+
export * from "./exports/infrastructure";
|
|
24
11
|
|
|
25
|
-
|
|
26
|
-
export
|
|
27
|
-
FalErrorCategory,
|
|
28
|
-
FalErrorInfo,
|
|
29
|
-
FalErrorMessages,
|
|
30
|
-
} from "./domain/entities/error.types";
|
|
12
|
+
// Presentation Layer
|
|
13
|
+
export * from "./exports/presentation";
|
|
31
14
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
DEFAULT_TEXT_TO_VOICE_MODELS,
|
|
35
|
-
DEFAULT_TEXT_TO_VIDEO_MODELS,
|
|
36
|
-
DEFAULT_IMAGE_TO_VIDEO_MODELS,
|
|
37
|
-
getAllDefaultModels,
|
|
38
|
-
getDefaultModelsByType,
|
|
39
|
-
getDefaultModel,
|
|
40
|
-
findModelById,
|
|
41
|
-
} from "./domain/constants/default-models.constants";
|
|
42
|
-
export type { FalModelConfig } from "./domain/constants/default-models.constants";
|
|
43
|
-
|
|
44
|
-
export { FAL_IMAGE_FEATURE_MODELS } from "./domain/constants/feature-models.constants";
|
|
45
|
-
|
|
46
|
-
export {
|
|
47
|
-
FalProvider,
|
|
48
|
-
falProvider,
|
|
49
|
-
falModelsService,
|
|
50
|
-
NSFWContentError,
|
|
51
|
-
cancelCurrentFalRequest,
|
|
52
|
-
hasRunningFalRequest,
|
|
53
|
-
} from "./infrastructure/services";
|
|
54
|
-
export type { FalProviderType } from "./infrastructure/services";
|
|
55
|
-
|
|
56
|
-
export {
|
|
57
|
-
categorizeFalError,
|
|
58
|
-
falErrorMapper,
|
|
59
|
-
mapFalError,
|
|
60
|
-
isFalErrorRetryable,
|
|
61
|
-
buildSingleImageInput,
|
|
62
|
-
buildDualImageInput,
|
|
63
|
-
buildUpscaleInput,
|
|
64
|
-
buildPhotoRestoreInput,
|
|
65
|
-
buildVideoFromImageInput,
|
|
66
|
-
buildFaceSwapInput,
|
|
67
|
-
buildImageToImageInput,
|
|
68
|
-
buildRemoveBackgroundInput,
|
|
69
|
-
buildRemoveObjectInput,
|
|
70
|
-
buildReplaceBackgroundInput,
|
|
71
|
-
buildHDTouchUpInput,
|
|
72
|
-
} from "./infrastructure/utils";
|
|
73
|
-
|
|
74
|
-
export { CostTracker } from "./infrastructure/utils/cost-tracker";
|
|
75
|
-
|
|
76
|
-
export {
|
|
77
|
-
isFalModelType,
|
|
78
|
-
isModelType,
|
|
79
|
-
isFalErrorType,
|
|
80
|
-
isValidBase64Image,
|
|
81
|
-
isValidApiKey,
|
|
82
|
-
isValidModelId,
|
|
83
|
-
isValidPrompt,
|
|
84
|
-
isValidTimeout,
|
|
85
|
-
isValidRetryCount,
|
|
86
|
-
} from "./infrastructure/utils";
|
|
87
|
-
|
|
88
|
-
export {
|
|
89
|
-
formatImageDataUri,
|
|
90
|
-
extractBase64,
|
|
91
|
-
getDataUriExtension,
|
|
92
|
-
isImageDataUri,
|
|
93
|
-
uploadToFalStorage,
|
|
94
|
-
uploadMultipleToFalStorage,
|
|
95
|
-
calculateTimeoutWithJitter,
|
|
96
|
-
formatCreditCost,
|
|
97
|
-
truncatePrompt,
|
|
98
|
-
sanitizePrompt,
|
|
99
|
-
buildErrorMessage,
|
|
100
|
-
isDefined,
|
|
101
|
-
removeNullish,
|
|
102
|
-
debounce,
|
|
103
|
-
throttle,
|
|
104
|
-
} from "./infrastructure/utils";
|
|
105
|
-
|
|
106
|
-
export {
|
|
107
|
-
createJobMetadata,
|
|
108
|
-
updateJobMetadata,
|
|
109
|
-
isJobCompleted,
|
|
110
|
-
isJobRunning,
|
|
111
|
-
isJobStale,
|
|
112
|
-
getJobDuration,
|
|
113
|
-
formatJobDuration,
|
|
114
|
-
calculateJobProgress,
|
|
115
|
-
serializeJobMetadata,
|
|
116
|
-
deserializeJobMetadata,
|
|
117
|
-
filterValidJobs,
|
|
118
|
-
sortJobsByCreation,
|
|
119
|
-
getActiveJobs,
|
|
120
|
-
getCompletedJobs,
|
|
121
|
-
} from "./infrastructure/utils";
|
|
122
|
-
|
|
123
|
-
export {
|
|
124
|
-
saveJobMetadata,
|
|
125
|
-
loadJobMetadata,
|
|
126
|
-
deleteJobMetadata,
|
|
127
|
-
loadAllJobs,
|
|
128
|
-
cleanupOldJobs,
|
|
129
|
-
getJobsByModel,
|
|
130
|
-
getJobsByStatus,
|
|
131
|
-
updateJobStatus,
|
|
132
|
-
} from "./infrastructure/utils";
|
|
133
|
-
|
|
134
|
-
export type {
|
|
135
|
-
FalJobMetadata,
|
|
136
|
-
IJobStorage,
|
|
137
|
-
InMemoryJobStorage,
|
|
138
|
-
} from "./infrastructure/utils";
|
|
139
|
-
|
|
140
|
-
export type {
|
|
141
|
-
UpscaleOptions,
|
|
142
|
-
PhotoRestoreOptions,
|
|
143
|
-
FaceSwapOptions,
|
|
144
|
-
ImageToImagePromptConfig,
|
|
145
|
-
RemoveBackgroundOptions,
|
|
146
|
-
RemoveObjectOptions,
|
|
147
|
-
ReplaceBackgroundOptions,
|
|
148
|
-
VideoFromImageOptions,
|
|
149
|
-
ModelType,
|
|
150
|
-
ModelSelectionConfig,
|
|
151
|
-
ModelSelectionState,
|
|
152
|
-
ModelSelectionActions,
|
|
153
|
-
UseModelsReturn,
|
|
154
|
-
} from "./domain/types";
|
|
155
|
-
|
|
156
|
-
export {
|
|
157
|
-
useFalGeneration,
|
|
158
|
-
useModels,
|
|
159
|
-
useModelCapabilities,
|
|
160
|
-
useVideoDurations,
|
|
161
|
-
useVideoResolutions,
|
|
162
|
-
useAspectRatios,
|
|
163
|
-
} from "./presentation/hooks";
|
|
164
|
-
export type {
|
|
165
|
-
UseFalGenerationOptions,
|
|
166
|
-
UseFalGenerationResult,
|
|
167
|
-
UseModelsProps,
|
|
168
|
-
UseModelCapabilitiesOptions,
|
|
169
|
-
UseModelCapabilitiesReturn,
|
|
170
|
-
UseVideoDurationsReturn,
|
|
171
|
-
UseVideoResolutionsReturn,
|
|
172
|
-
UseAspectRatiosReturn,
|
|
173
|
-
} from "./presentation/hooks";
|
|
15
|
+
// Model Registry
|
|
16
|
+
export * from "./exports/registry";
|
|
174
17
|
|
|
175
18
|
// Init Module Factory
|
|
176
19
|
export {
|
|
177
20
|
createAiProviderInitModule,
|
|
178
21
|
type AiProviderInitModuleConfig,
|
|
179
22
|
} from './init';
|
|
180
|
-
|
|
181
|
-
// Model Registry
|
|
182
|
-
export {
|
|
183
|
-
VIDEO_ASPECT_RATIOS,
|
|
184
|
-
IMAGE_ASPECT_RATIOS,
|
|
185
|
-
GLOBAL_CAPABILITIES,
|
|
186
|
-
GLOBAL_DEFAULTS,
|
|
187
|
-
SORA_2_DURATIONS,
|
|
188
|
-
SORA_2_RESOLUTIONS,
|
|
189
|
-
SORA_2_CREDITS_BY_DURATION,
|
|
190
|
-
SORA_2_TEXT_TO_VIDEO,
|
|
191
|
-
SORA_2_IMAGE_TO_VIDEO,
|
|
192
|
-
SORA_2_MODELS,
|
|
193
|
-
MODEL_REGISTRY,
|
|
194
|
-
getModelConfig,
|
|
195
|
-
getModelsByType,
|
|
196
|
-
getEnabledModels,
|
|
197
|
-
getModelCapabilities,
|
|
198
|
-
getModelCreditCost,
|
|
199
|
-
getDefaultModelFromRegistry,
|
|
200
|
-
} from "./registry";
|
|
201
|
-
export type {
|
|
202
|
-
ModelType as RegistryModelType,
|
|
203
|
-
ModelProvider,
|
|
204
|
-
DurationOption,
|
|
205
|
-
ResolutionOption,
|
|
206
|
-
AspectRatioOption,
|
|
207
|
-
ModelCapabilities,
|
|
208
|
-
ModelPricing,
|
|
209
|
-
ModelDefaults,
|
|
210
|
-
ModelConfig,
|
|
211
|
-
ModelRegistry as ModelRegistryType,
|
|
212
|
-
ResolvedCapabilities,
|
|
213
|
-
GlobalCapabilities,
|
|
214
|
-
GlobalDefaults,
|
|
215
|
-
} from "./registry";
|