@umituz/react-native-ai-generation-content 1.12.21 → 1.12.24

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 (132) hide show
  1. package/package.json +33 -15
  2. package/src/domains/content-moderation/infrastructure/services/content-moderation.service.ts +4 -32
  3. package/src/domains/content-moderation/infrastructure/services/moderators/base.moderator.ts +1 -1
  4. package/src/domains/face-detection/infrastructure/validators/faceValidator.ts +1 -1
  5. package/src/domains/face-detection/presentation/components/FaceValidationStatus.tsx +3 -3
  6. package/src/domains/prompts/domain/entities/FuturePredictionConfig.ts +2 -1
  7. package/src/domains/prompts/domain/entities/GeneratedPrompt.ts +0 -1
  8. package/src/domains/prompts/domain/repositories/IAIPromptServices.ts +6 -12
  9. package/src/domains/prompts/infrastructure/repositories/PromptHistoryRepository.ts +42 -42
  10. package/src/domains/prompts/infrastructure/repositories/TemplateRepository.ts +42 -42
  11. package/src/domains/prompts/infrastructure/services/BackgroundRemovalService.ts +7 -7
  12. package/src/domains/prompts/infrastructure/services/ColorizationService.ts +7 -7
  13. package/src/domains/prompts/infrastructure/services/FaceSwapService.ts +19 -20
  14. package/src/domains/prompts/infrastructure/services/FuturePredictionService.ts +11 -31
  15. package/src/domains/prompts/infrastructure/services/ImageEnhancementService.ts +7 -7
  16. package/src/domains/prompts/infrastructure/services/PhotoRestorationService.ts +7 -7
  17. package/src/domains/prompts/infrastructure/services/PromptGenerationService.ts +13 -13
  18. package/src/domains/prompts/infrastructure/services/StyleTransferService.ts +8 -8
  19. package/src/domains/prompts/infrastructure/services/TextGenerationService.ts +7 -7
  20. package/src/domains/prompts/presentation/hooks/useAIServices.ts +30 -28
  21. package/src/domains/prompts/presentation/hooks/useFaceSwap.ts +1 -2
  22. package/src/domains/prompts/presentation/hooks/usePromptGeneration.ts +4 -5
  23. package/src/domains/prompts/presentation/hooks/useStyleTransfer.ts +1 -1
  24. package/src/domains/prompts/presentation/hooks/useTemplateRepository.ts +3 -3
  25. package/src/domains/prompts/presentation/theme/utils.ts +1 -1
  26. package/src/features/audio-generation/domain/entities.ts +39 -0
  27. package/src/features/audio-generation/index.ts +2 -0
  28. package/src/features/audio-generation/presentation/hooks.ts +39 -0
  29. package/src/{domains/feature-background → features/background}/presentation/components/BackgroundFeature.tsx +5 -4
  30. package/src/{domains/feature-background → features/background}/presentation/components/ComparisonSlider.tsx +45 -51
  31. package/src/{domains/feature-background → features/background}/presentation/components/ErrorDisplay.tsx +5 -3
  32. package/src/{domains/feature-background → features/background}/presentation/components/ModeSelector.tsx +2 -2
  33. package/src/{domains/feature-background → features/background}/presentation/hooks/useBackgroundFeature.ts +3 -2
  34. package/src/features/colorization/domain/entities.ts +46 -0
  35. package/src/features/colorization/index.ts +2 -0
  36. package/src/features/colorization/presentation/hooks.ts +39 -0
  37. package/src/features/face-swap/domain/entities.ts +48 -0
  38. package/src/features/face-swap/index.ts +2 -0
  39. package/src/features/face-swap/presentation/hooks.ts +41 -0
  40. package/src/features/future-prediction/domain/entities.ts +45 -0
  41. package/src/features/future-prediction/index.ts +2 -0
  42. package/src/features/future-prediction/presentation/hooks.ts +39 -0
  43. package/src/features/image-captioning/domain/entities.ts +47 -0
  44. package/src/features/image-captioning/index.ts +2 -0
  45. package/src/features/image-captioning/presentation/hooks.ts +39 -0
  46. package/src/features/inpainting/domain/entities.ts +58 -0
  47. package/src/features/inpainting/index.ts +2 -0
  48. package/src/features/inpainting/presentation/hooks.ts +39 -0
  49. package/src/features/photo-restoration/domain/entities.ts +48 -0
  50. package/src/features/photo-restoration/index.ts +2 -0
  51. package/src/features/photo-restoration/presentation/hooks.ts +39 -0
  52. package/src/features/sketch-to-image/domain/entities.ts +47 -0
  53. package/src/features/sketch-to-image/index.ts +2 -0
  54. package/src/features/sketch-to-image/presentation/hooks.ts +39 -0
  55. package/src/features/style-transfer/domain/entities.ts +52 -0
  56. package/src/features/style-transfer/index.ts +2 -0
  57. package/src/features/style-transfer/presentation/hooks.ts +39 -0
  58. package/src/features/text-to-image/domain/entities.ts +58 -0
  59. package/src/features/text-to-image/index.ts +2 -0
  60. package/src/features/text-to-image/presentation/hooks.ts +39 -0
  61. package/src/features/text-to-video/domain/entities.ts +52 -0
  62. package/src/features/text-to-video/index.ts +2 -0
  63. package/src/features/text-to-video/presentation/hooks.ts +39 -0
  64. package/src/features/upscaling/domain/entities.ts +42 -0
  65. package/src/features/upscaling/index.ts +2 -0
  66. package/src/features/upscaling/presentation/hooks.ts +39 -0
  67. package/src/index.ts +3 -6
  68. package/src/infrastructure/utils/status-checker.util.ts +4 -4
  69. package/src/infrastructure/wrappers/synchronous-generation.wrapper.ts +3 -3
  70. package/src/presentation/components/result/GenerationResultContent.tsx +21 -22
  71. package/src/presentation/components/result/ResultActions.tsx +51 -52
  72. package/src/presentation/components/result/ResultHeader.tsx +24 -25
  73. package/src/presentation/components/result/ResultImageCard.tsx +19 -20
  74. package/src/presentation/components/result/ResultStoryCard.tsx +23 -24
  75. package/src/presentation/hooks/photo-generation.types.ts +13 -4
  76. package/src/presentation/hooks/usePhotoGeneration.ts +30 -13
  77. package/src/domains/creations/application/services/CreationsService.ts +0 -72
  78. package/src/domains/creations/domain/entities/Creation.ts +0 -54
  79. package/src/domains/creations/domain/entities/index.ts +0 -6
  80. package/src/domains/creations/domain/repositories/ICreationsRepository.ts +0 -25
  81. package/src/domains/creations/domain/repositories/index.ts +0 -5
  82. package/src/domains/creations/domain/services/ICreationsStorageService.ts +0 -13
  83. package/src/domains/creations/domain/value-objects/CreationsConfig.ts +0 -77
  84. package/src/domains/creations/domain/value-objects/index.ts +0 -12
  85. package/src/domains/creations/index.ts +0 -84
  86. package/src/domains/creations/infrastructure/adapters/createRepository.ts +0 -54
  87. package/src/domains/creations/infrastructure/adapters/index.ts +0 -5
  88. package/src/domains/creations/infrastructure/repositories/CreationsRepository.ts +0 -263
  89. package/src/domains/creations/infrastructure/repositories/index.ts +0 -8
  90. package/src/domains/creations/infrastructure/services/CreationsStorageService.ts +0 -48
  91. package/src/domains/creations/presentation/components/CreationCard.tsx +0 -196
  92. package/src/domains/creations/presentation/components/CreationDetail/DetailActions.tsx +0 -76
  93. package/src/domains/creations/presentation/components/CreationDetail/DetailHeader.tsx +0 -81
  94. package/src/domains/creations/presentation/components/CreationDetail/DetailImage.tsx +0 -41
  95. package/src/domains/creations/presentation/components/CreationDetail/DetailStory.tsx +0 -67
  96. package/src/domains/creations/presentation/components/CreationDetail/index.ts +0 -4
  97. package/src/domains/creations/presentation/components/CreationImageViewer.tsx +0 -101
  98. package/src/domains/creations/presentation/components/CreationThumbnail.tsx +0 -63
  99. package/src/domains/creations/presentation/components/CreationsGalleryEmptyState.tsx +0 -77
  100. package/src/domains/creations/presentation/components/CreationsGrid.tsx +0 -87
  101. package/src/domains/creations/presentation/components/CreationsHomeCard.tsx +0 -176
  102. package/src/domains/creations/presentation/components/EmptyState.tsx +0 -75
  103. package/src/domains/creations/presentation/components/FilterBottomSheet.tsx +0 -157
  104. package/src/domains/creations/presentation/components/FilterChips.tsx +0 -105
  105. package/src/domains/creations/presentation/components/GalleryHeader.tsx +0 -157
  106. package/src/domains/creations/presentation/components/index.ts +0 -20
  107. package/src/domains/creations/presentation/hooks/index.ts +0 -9
  108. package/src/domains/creations/presentation/hooks/useCreations.ts +0 -33
  109. package/src/domains/creations/presentation/hooks/useCreationsFilter.ts +0 -90
  110. package/src/domains/creations/presentation/hooks/useDeleteCreation.ts +0 -51
  111. package/src/domains/creations/presentation/hooks/useDeleteMultipleCreations.ts +0 -57
  112. package/src/domains/creations/presentation/hooks/useToggleFavorite.ts +0 -59
  113. package/src/domains/creations/presentation/screens/CreationDetailScreen.tsx +0 -71
  114. package/src/domains/creations/presentation/screens/CreationsGalleryScreen.tsx +0 -264
  115. package/src/domains/creations/presentation/screens/index.ts +0 -5
  116. package/src/domains/creations/presentation/utils/filterUtils.ts +0 -52
  117. package/src/domains/creations/types.d.ts +0 -107
  118. /package/src/{domains/feature-background → features/background}/domain/entities/background.types.ts +0 -0
  119. /package/src/{domains/feature-background → features/background}/domain/entities/component.types.ts +0 -0
  120. /package/src/{domains/feature-background → features/background}/domain/entities/config.types.ts +0 -0
  121. /package/src/{domains/feature-background → features/background}/domain/entities/index.ts +0 -0
  122. /package/src/{domains/feature-background → features/background}/index.ts +0 -0
  123. /package/src/{domains/feature-background → features/background}/infrastructure/constants/index.ts +0 -0
  124. /package/src/{domains/feature-background → features/background}/infrastructure/constants/prompts.constants.ts +0 -0
  125. /package/src/{domains/feature-background → features/background}/presentation/components/FeatureHeader.tsx +0 -0
  126. /package/src/{domains/feature-background → features/background}/presentation/components/GenerateButton.tsx +0 -0
  127. /package/src/{domains/feature-background → features/background}/presentation/components/ImagePicker.tsx +0 -0
  128. /package/src/{domains/feature-background → features/background}/presentation/components/ProcessingModal.tsx +0 -0
  129. /package/src/{domains/feature-background → features/background}/presentation/components/PromptInput.tsx +0 -0
  130. /package/src/{domains/feature-background → features/background}/presentation/components/ResultDisplay.tsx +0 -0
  131. /package/src/{domains/feature-background → features/background}/presentation/components/index.ts +0 -0
  132. /package/src/{domains/feature-background → features/background}/presentation/hooks/index.ts +0 -0
@@ -0,0 +1,39 @@
1
+ /* eslint-disable @typescript-eslint/no-unsafe-argument */
2
+ /* eslint-disable @typescript-eslint/ban-ts-comment */
3
+ /* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */
4
+ /* eslint-disable @typescript-eslint/no-unsafe-assignment */
5
+ /* eslint-disable @typescript-eslint/no-unsafe-call */
6
+ /* eslint-disable @typescript-eslint/no-explicit-any */
7
+ import { useState, useCallback } from 'react';
8
+ import { useGeneration } from '../../../presentation/hooks/use-generation';
9
+ import { InpaintingRequest, InpaintingResult } from '../domain/entities';
10
+
11
+ export interface UseInpaintingReturn {
12
+ inpaint: (request: InpaintingRequest) => Promise<InpaintingResult>;
13
+ isInpainting: boolean;
14
+ result: InpaintingResult | null;
15
+ error: Error | null;
16
+ }
17
+
18
+ export const useInpainting = (): UseInpaintingReturn => {
19
+ const { generate, isGenerating, error, result: genResult } = useGeneration({ model: "deprecated" });
20
+ const [result, setResult] = useState<InpaintingResult | null>(null);
21
+
22
+ const inpaint = useCallback(async (request: InpaintingRequest) => {
23
+ await generate(request as any);
24
+
25
+ if (genResult?.data) {
26
+ setResult(genResult.data as InpaintingResult);
27
+ return genResult.data as InpaintingResult;
28
+ }
29
+
30
+ throw new Error('Inpainting failed to return a result');
31
+ }, [generate, genResult]);
32
+
33
+ return {
34
+ inpaint,
35
+ isInpainting: isGenerating,
36
+ result,
37
+ error: error as any,
38
+ };
39
+ };
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Photo Restoration Domain Entities
3
+ */
4
+
5
+ export interface PhotoRestorationConfig {
6
+ /**
7
+ * Whether to fix scratches and creases
8
+ * @default true
9
+ */
10
+ fixScratches?: boolean;
11
+
12
+ /**
13
+ * Whether to enhance faces in the photo
14
+ * @default true
15
+ */
16
+ enhanceFaces?: boolean;
17
+
18
+ /**
19
+ * Upscale factor for the result
20
+ * @default 2
21
+ */
22
+ upscaleFactor?: 1 | 2 | 4;
23
+ }
24
+
25
+ export interface PhotoRestorationRequest {
26
+ /**
27
+ * The image to restore.
28
+ * Can be a Base64 string or a remote URL.
29
+ */
30
+ image: string;
31
+
32
+ /**
33
+ * Optional configuration
34
+ */
35
+ options?: PhotoRestorationConfig;
36
+ }
37
+
38
+ export interface PhotoRestorationResult {
39
+ /**
40
+ * The restored image URL or Base64
41
+ */
42
+ imageUrl: string;
43
+
44
+ /**
45
+ * Metadata about the generation
46
+ */
47
+ metadata?: Record<string, unknown>;
48
+ }
@@ -0,0 +1,2 @@
1
+ export * from './domain/entities';
2
+ export * from './presentation/hooks';
@@ -0,0 +1,39 @@
1
+ /* eslint-disable @typescript-eslint/no-unsafe-argument */
2
+ /* eslint-disable @typescript-eslint/ban-ts-comment */
3
+ /* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */
4
+ /* eslint-disable @typescript-eslint/no-unsafe-assignment */
5
+ /* eslint-disable @typescript-eslint/no-unsafe-call */
6
+ /* eslint-disable @typescript-eslint/no-explicit-any */
7
+ import { useState, useCallback } from 'react';
8
+ import { useGeneration } from '../../../presentation/hooks/use-generation';
9
+ import { PhotoRestorationRequest, PhotoRestorationResult } from '../domain/entities';
10
+
11
+ export interface UsePhotoRestorationReturn {
12
+ restorePhoto: (request: PhotoRestorationRequest) => Promise<PhotoRestorationResult>;
13
+ isRestoring: boolean;
14
+ result: PhotoRestorationResult | null;
15
+ error: Error | null;
16
+ }
17
+
18
+ export const usePhotoRestoration = (): UsePhotoRestorationReturn => {
19
+ const { generate, isGenerating, error, result: genResult } = useGeneration({ model: "deprecated" });
20
+ const [result, setResult] = useState<PhotoRestorationResult | null>(null);
21
+
22
+ const restorePhoto = useCallback(async (request: PhotoRestorationRequest) => {
23
+ await generate(request as any);
24
+
25
+ if (genResult?.data) {
26
+ setResult(genResult.data as PhotoRestorationResult);
27
+ return genResult.data as PhotoRestorationResult;
28
+ }
29
+
30
+ throw new Error('Photo restoration failed to return a result');
31
+ }, [generate, genResult]);
32
+
33
+ return {
34
+ restorePhoto,
35
+ isRestoring: isGenerating,
36
+ result,
37
+ error: error as any,
38
+ };
39
+ };
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Sketch to Image Domain Entities
3
+ */
4
+
5
+ export interface SketchToImageConfig {
6
+ /**
7
+ * Strength of the prompt influence vs sketch influence (0.0 to 1.0)
8
+ * @default 0.7
9
+ */
10
+ strength?: number;
11
+
12
+ /**
13
+ * Steps for generation
14
+ * @default 20
15
+ */
16
+ steps?: number;
17
+ }
18
+
19
+ export interface SketchToImageRequest {
20
+ /**
21
+ * The sketch image.
22
+ * Can be a Base64 string or a remote URL.
23
+ */
24
+ sketchImage: string;
25
+
26
+ /**
27
+ * Description of the desired output
28
+ */
29
+ prompt: string;
30
+
31
+ /**
32
+ * Optional configuration
33
+ */
34
+ options?: SketchToImageConfig;
35
+ }
36
+
37
+ export interface SketchToImageResult {
38
+ /**
39
+ * The generated realistic image URL
40
+ */
41
+ imageUrl: string;
42
+
43
+ /**
44
+ * Metadata about the generation
45
+ */
46
+ metadata?: Record<string, unknown>;
47
+ }
@@ -0,0 +1,2 @@
1
+ export * from './domain/entities';
2
+ export * from './presentation/hooks';
@@ -0,0 +1,39 @@
1
+ /* eslint-disable @typescript-eslint/no-unsafe-argument */
2
+ /* eslint-disable @typescript-eslint/ban-ts-comment */
3
+ /* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */
4
+ /* eslint-disable @typescript-eslint/no-unsafe-assignment */
5
+ /* eslint-disable @typescript-eslint/no-unsafe-call */
6
+ /* eslint-disable @typescript-eslint/no-explicit-any */
7
+ import { useState, useCallback } from 'react';
8
+ import { useGeneration } from '../../../presentation/hooks/use-generation';
9
+ import { SketchToImageRequest, SketchToImageResult } from '../domain/entities';
10
+
11
+ export interface UseSketchToImageReturn {
12
+ generateFromSketch: (request: SketchToImageRequest) => Promise<SketchToImageResult>;
13
+ isGenerating: boolean;
14
+ result: SketchToImageResult | null;
15
+ error: Error | null;
16
+ }
17
+
18
+ export const useSketchToImage = (): UseSketchToImageReturn => {
19
+ const { generate, isGenerating, error, result: genResult } = useGeneration({ model: "deprecated" });
20
+ const [result, setResult] = useState<SketchToImageResult | null>(null);
21
+
22
+ const generateFromSketch = useCallback(async (request: SketchToImageRequest) => {
23
+ await generate(request as any);
24
+
25
+ if (genResult?.data) {
26
+ setResult(genResult.data as SketchToImageResult);
27
+ return genResult.data as SketchToImageResult;
28
+ }
29
+
30
+ throw new Error('Sketch to image generation failed to return a result');
31
+ }, [generate, genResult]);
32
+
33
+ return {
34
+ generateFromSketch,
35
+ isGenerating,
36
+ result,
37
+ error: error as any,
38
+ };
39
+ };
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Style Transfer Domain Entities
3
+ */
4
+
5
+ export interface StyleTransferConfig {
6
+ /**
7
+ * Strength of the style application (0.0 to 1.0)
8
+ * @default 1.0
9
+ */
10
+ strength?: number;
11
+
12
+ /**
13
+ * Preserve original colors
14
+ * @default false
15
+ */
16
+ preserveColor?: boolean;
17
+ }
18
+
19
+ export interface StyleTransferRequest {
20
+ /**
21
+ * The content image to apply style TO.
22
+ * Can be a Base64 string or a remote URL.
23
+ */
24
+ contentImage: string;
25
+
26
+ /**
27
+ * The style image references (Base64 or URL)
28
+ */
29
+ styleImage?: string;
30
+
31
+ /**
32
+ * Or a preset style ID (e.g. "van_gogh_starry_night")
33
+ */
34
+ stylePreset?: string;
35
+
36
+ /**
37
+ * Optional configuration
38
+ */
39
+ options?: StyleTransferConfig;
40
+ }
41
+
42
+ export interface StyleTransferResult {
43
+ /**
44
+ * The stylized image URL or Base64
45
+ */
46
+ imageUrl: string;
47
+
48
+ /**
49
+ * Metadata about the generation
50
+ */
51
+ metadata?: Record<string, unknown>;
52
+ }
@@ -0,0 +1,2 @@
1
+ export * from './domain/entities';
2
+ export * from './presentation/hooks';
@@ -0,0 +1,39 @@
1
+ /* eslint-disable @typescript-eslint/no-unsafe-argument */
2
+ /* eslint-disable @typescript-eslint/ban-ts-comment */
3
+ /* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */
4
+ /* eslint-disable @typescript-eslint/no-unsafe-assignment */
5
+ /* eslint-disable @typescript-eslint/no-unsafe-call */
6
+ /* eslint-disable @typescript-eslint/no-explicit-any */
7
+ import { useState, useCallback } from 'react';
8
+ import { useGeneration } from '../../../presentation/hooks/use-generation';
9
+ import { StyleTransferRequest, StyleTransferResult } from '../domain/entities';
10
+
11
+ export interface UseStyleTransferReturn {
12
+ transferStyle: (request: StyleTransferRequest) => Promise<StyleTransferResult>;
13
+ isTransferring: boolean;
14
+ result: StyleTransferResult | null;
15
+ error: Error | null;
16
+ }
17
+
18
+ export const useStyleTransfer = (): UseStyleTransferReturn => {
19
+ const { generate, isGenerating, error, result: genResult } = useGeneration({ model: "deprecated" });
20
+ const [result, setResult] = useState<StyleTransferResult | null>(null);
21
+
22
+ const transferStyle = useCallback(async (request: StyleTransferRequest) => {
23
+ await generate(request as any);
24
+
25
+ if (genResult?.data) {
26
+ setResult(genResult.data as StyleTransferResult);
27
+ return genResult.data as StyleTransferResult;
28
+ }
29
+
30
+ throw new Error('Style transfer failed to return a result');
31
+ }, [generate, genResult]);
32
+
33
+ return {
34
+ transferStyle,
35
+ isTransferring: isGenerating,
36
+ result,
37
+ error: error as any,
38
+ };
39
+ };
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Text-to-Image Domain Entities
3
+ */
4
+
5
+ export interface TextToImageConfig {
6
+ /**
7
+ * Width of the generated image
8
+ * @default 1024
9
+ */
10
+ width?: number;
11
+
12
+ /**
13
+ * Height of the generated image
14
+ * @default 1024
15
+ */
16
+ height?: number;
17
+
18
+ /**
19
+ * Number of inference steps
20
+ * @default 30
21
+ */
22
+ steps?: number;
23
+
24
+ /**
25
+ * Guidance scale
26
+ * @default 7.5
27
+ */
28
+ guidanceScale?: number;
29
+ }
30
+
31
+ export interface TextToImageRequest {
32
+ /**
33
+ * The description of the image to generate
34
+ */
35
+ prompt: string;
36
+
37
+ /**
38
+ * Negative prompt for what to avoid
39
+ */
40
+ negativePrompt?: string;
41
+
42
+ /**
43
+ * Optional configuration
44
+ */
45
+ options?: TextToImageConfig;
46
+ }
47
+
48
+ export interface TextToImageResult {
49
+ /**
50
+ * The generated image URL or Base64
51
+ */
52
+ imageUrl: string;
53
+
54
+ /**
55
+ * Metadata about the generation
56
+ */
57
+ metadata?: Record<string, unknown>;
58
+ }
@@ -0,0 +1,2 @@
1
+ export * from './domain/entities';
2
+ export * from './presentation/hooks';
@@ -0,0 +1,39 @@
1
+ /* eslint-disable @typescript-eslint/no-unsafe-argument */
2
+ /* eslint-disable @typescript-eslint/ban-ts-comment */
3
+ /* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */
4
+ /* eslint-disable @typescript-eslint/no-unsafe-assignment */
5
+ /* eslint-disable @typescript-eslint/no-unsafe-call */
6
+ /* eslint-disable @typescript-eslint/no-explicit-any */
7
+ import { useState, useCallback } from 'react';
8
+ import { useGeneration } from '../../../presentation/hooks/use-generation';
9
+ import { TextToImageRequest, TextToImageResult } from '../domain/entities';
10
+
11
+ export interface UseTextToImageReturn {
12
+ generateImage: (request: TextToImageRequest) => Promise<TextToImageResult>;
13
+ isGenerating: boolean;
14
+ result: TextToImageResult | null;
15
+ error: Error | null;
16
+ }
17
+
18
+ export const useTextToImage = (): UseTextToImageReturn => {
19
+ const { generate, isGenerating, error, result: genResult } = useGeneration({ model: "deprecated" });
20
+ const [result, setResult] = useState<TextToImageResult | null>(null);
21
+
22
+ const generateImage = useCallback(async (request: TextToImageRequest) => {
23
+ await generate(request as any);
24
+
25
+ if (genResult?.data) {
26
+ setResult(genResult.data as TextToImageResult);
27
+ return genResult.data as TextToImageResult;
28
+ }
29
+
30
+ throw new Error('Image generation failed to return a result');
31
+ }, [generate, genResult]);
32
+
33
+ return {
34
+ generateImage,
35
+ isGenerating,
36
+ result,
37
+ error: error as any,
38
+ };
39
+ };
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Text to Video Domain Entities
3
+ */
4
+
5
+ export interface TextToVideoConfig {
6
+ /**
7
+ * Duration of the video in seconds
8
+ * @default 4
9
+ */
10
+ duration?: number;
11
+
12
+ /**
13
+ * FPS of the generated video
14
+ * @default 24
15
+ */
16
+ fps?: number;
17
+
18
+ /**
19
+ * Guidance scale
20
+ * @default 7.5
21
+ */
22
+ guidanceScale?: number;
23
+ }
24
+
25
+ export interface TextToVideoRequest {
26
+ /**
27
+ * The text prompt to generate video from
28
+ */
29
+ prompt: string;
30
+
31
+ /**
32
+ * Negative prompt
33
+ */
34
+ negativePrompt?: string;
35
+
36
+ /**
37
+ * Optional configuration
38
+ */
39
+ options?: TextToVideoConfig;
40
+ }
41
+
42
+ export interface TextToVideoResult {
43
+ /**
44
+ * The generated video URL
45
+ */
46
+ videoUrl: string;
47
+
48
+ /**
49
+ * Metadata about the generation
50
+ */
51
+ metadata?: Record<string, unknown>;
52
+ }
@@ -0,0 +1,2 @@
1
+ export * from './domain/entities';
2
+ export * from './presentation/hooks';
@@ -0,0 +1,39 @@
1
+ /* eslint-disable @typescript-eslint/no-unsafe-argument */
2
+ /* eslint-disable @typescript-eslint/ban-ts-comment */
3
+ /* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */
4
+ /* eslint-disable @typescript-eslint/no-unsafe-assignment */
5
+ /* eslint-disable @typescript-eslint/no-unsafe-call */
6
+ /* eslint-disable @typescript-eslint/no-explicit-any */
7
+ import { useState, useCallback } from 'react';
8
+ import { useGeneration } from '../../../presentation/hooks/use-generation';
9
+ import { TextToVideoRequest, TextToVideoResult } from '../domain/entities';
10
+
11
+ export interface UseTextToVideoReturn {
12
+ generateVideo: (request: TextToVideoRequest) => Promise<TextToVideoResult>;
13
+ isGenerating: boolean;
14
+ result: TextToVideoResult | null;
15
+ error: Error | null;
16
+ }
17
+
18
+ export const useTextToVideo = (): UseTextToVideoReturn => {
19
+ const { generate, isGenerating, error, result: genResult } = useGeneration({ model: "deprecated" });
20
+ const [result, setResult] = useState<TextToVideoResult | null>(null);
21
+
22
+ const generateVideo = useCallback(async (request: TextToVideoRequest) => {
23
+ await generate(request as any);
24
+
25
+ if (genResult?.data) {
26
+ setResult(genResult.data as TextToVideoResult);
27
+ return genResult.data as TextToVideoResult;
28
+ }
29
+
30
+ throw new Error('Video generation failed to return a result');
31
+ }, [generate, genResult]);
32
+
33
+ return {
34
+ generateVideo,
35
+ isGenerating,
36
+ result,
37
+ error: error as any,
38
+ };
39
+ };
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Upscaling Domain Entities
3
+ */
4
+
5
+ export interface UpscaleConfig {
6
+ /**
7
+ * The factor to upscale the image by
8
+ * @default 2
9
+ */
10
+ scaleFactor?: 2 | 4;
11
+
12
+ /**
13
+ * Whether to enhance faces during upscaling
14
+ * @default false
15
+ */
16
+ enhanceFaces?: boolean;
17
+ }
18
+
19
+ export interface UpscaleRequest {
20
+ /**
21
+ * The image to upscale.
22
+ * Can be a Base64 string or a remote URL.
23
+ */
24
+ image: string;
25
+
26
+ /**
27
+ * Optional configuration
28
+ */
29
+ options?: UpscaleConfig;
30
+ }
31
+
32
+ export interface UpscaleResult {
33
+ /**
34
+ * The upscaled image URL or Base64
35
+ */
36
+ imageUrl: string;
37
+
38
+ /**
39
+ * Metadata about the generation
40
+ */
41
+ metadata?: Record<string, unknown>;
42
+ }
@@ -0,0 +1,2 @@
1
+ export * from './domain/entities';
2
+ export * from './presentation/hooks';
@@ -0,0 +1,39 @@
1
+ /* eslint-disable @typescript-eslint/no-unsafe-argument */
2
+ /* eslint-disable @typescript-eslint/ban-ts-comment */
3
+ /* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */
4
+ /* eslint-disable @typescript-eslint/no-unsafe-assignment */
5
+ /* eslint-disable @typescript-eslint/no-unsafe-call */
6
+ /* eslint-disable @typescript-eslint/no-explicit-any */
7
+ import { useState, useCallback } from 'react';
8
+ import { useGeneration } from '../../../presentation/hooks/use-generation';
9
+ import { UpscaleRequest, UpscaleResult } from '../domain/entities';
10
+
11
+ export interface UseUpscalingReturn {
12
+ upscale: (request: UpscaleRequest) => Promise<UpscaleResult>;
13
+ isUpscaling: boolean;
14
+ result: UpscaleResult | null;
15
+ error: Error | null;
16
+ }
17
+
18
+ export const useUpscaling = (): UseUpscalingReturn => {
19
+ const { generate, isGenerating, error, result: genResult } = useGeneration({ model: "deprecated" });
20
+ const [result, setResult] = useState<UpscaleResult | null>(null);
21
+
22
+ const upscale = useCallback(async (request: UpscaleRequest) => {
23
+ await generate(request as any);
24
+
25
+ if (genResult?.data) {
26
+ setResult(genResult.data as UpscaleResult);
27
+ return genResult.data as UpscaleResult;
28
+ }
29
+
30
+ throw new Error('Upscaling failed to return a result');
31
+ }, [generate, genResult]);
32
+
33
+ return {
34
+ upscale,
35
+ isUpscaling: isGenerating,
36
+ result,
37
+ error: error as any,
38
+ };
39
+ };
package/src/index.ts CHANGED
@@ -234,11 +234,6 @@ export * from "./domains/prompts";
234
234
 
235
235
  export * from "./domains/content-moderation";
236
236
 
237
- // =============================================================================
238
- // DOMAINS - AI Creations
239
- // =============================================================================
240
-
241
- export * from "./domains/creations";
242
237
 
243
238
  // =============================================================================
244
239
  // DOMAINS - Face Detection
@@ -250,4 +245,6 @@ export * from "./domains/face-detection";
250
245
  // DOMAINS - Feature Background
251
246
  // =============================================================================
252
247
 
253
- export * from "./domains/feature-background";
248
+ export * from "./features/background";
249
+
250
+
@@ -34,7 +34,7 @@ export function checkStatusForErrors(
34
34
  const logs = Array.isArray((status as JobStatus)?.logs)
35
35
  ? (status as JobStatus).logs
36
36
  : [];
37
- const errorLogs = (logs as AILogEntry[]).filter((log) => {
37
+ const errorLogs = logs.filter((log) => {
38
38
  const level = String(log?.level || "").toUpperCase();
39
39
  return level === "ERROR" || level === "FATAL";
40
40
  });
@@ -44,9 +44,9 @@ export function checkStatusForErrors(
44
44
  const errorLogMessage =
45
45
  errorLogs.length > 0
46
46
  ? (errorLogs[0] as AILogEntry & { text?: string; content?: string })
47
- ?.message ||
48
- (errorLogs[0] as AILogEntry & { text?: string })?.text ||
49
- (errorLogs[0] as AILogEntry & { content?: string })?.content
47
+ ?.message ||
48
+ (errorLogs[0] as AILogEntry & { text?: string })?.text ||
49
+ (errorLogs[0] as AILogEntry & { content?: string })?.content
50
50
  : undefined;
51
51
 
52
52
  // Combine error messages
@@ -13,13 +13,13 @@ export interface SynchronousGenerationInput {
13
13
  userId?: string;
14
14
  type?: string;
15
15
  languageCode?: string;
16
- metadata?: Record<string, any>;
16
+ metadata?: Record<string, unknown>;
17
17
  }
18
18
 
19
- export interface SynchronousGenerationConfig<T = any> {
19
+ export interface SynchronousGenerationConfig<T = unknown> {
20
20
  checkCredits?: (userId: string, type: string) => Promise<boolean>;
21
21
  deductCredits?: (userId: string, type: string) => Promise<void>;
22
- execute: (prompt: string, metadata?: Record<string, any>) => Promise<T>;
22
+ execute: (prompt: string, metadata?: Record<string, unknown>) => Promise<T>;
23
23
  }
24
24
 
25
25
  export async function generateSynchronously<T = string>(