@umituz/react-native-ai-generation-content 1.12.1 → 1.12.3

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 (43) hide show
  1. package/package.json +6 -2
  2. package/src/domains/prompts/domain/entities/AIPromptTemplate.ts +48 -0
  3. package/src/domains/prompts/domain/entities/BackgroundRemovalConfig.ts +86 -0
  4. package/src/domains/prompts/domain/entities/ColorizationConfig.ts +101 -0
  5. package/src/domains/prompts/domain/entities/FaceSwapConfig.ts +54 -0
  6. package/src/domains/prompts/domain/entities/FuturePredictionConfig.ts +93 -0
  7. package/src/domains/prompts/domain/entities/GeneratedPrompt.ts +32 -0
  8. package/src/domains/prompts/domain/entities/ImageEnhancementConfig.ts +93 -0
  9. package/src/domains/prompts/domain/entities/PhotoRestorationConfig.ts +64 -0
  10. package/src/domains/prompts/domain/entities/StyleTransferConfig.ts +80 -0
  11. package/src/domains/prompts/domain/entities/TextGenerationConfig.ts +100 -0
  12. package/src/domains/prompts/domain/entities/types.ts +27 -0
  13. package/src/domains/prompts/domain/entities/value-objects.ts +33 -0
  14. package/src/domains/prompts/domain/repositories/IAIPromptServices.ts +106 -0
  15. package/src/domains/prompts/domain/repositories/IPromptHistoryRepository.ts +10 -0
  16. package/src/domains/prompts/domain/repositories/ITemplateRepository.ts +11 -0
  17. package/src/domains/prompts/index.ts +318 -0
  18. package/src/domains/prompts/infrastructure/repositories/PromptHistoryRepository.ts +85 -0
  19. package/src/domains/prompts/infrastructure/repositories/TemplateRepository.ts +77 -0
  20. package/src/domains/prompts/infrastructure/services/BackgroundRemovalService.ts +209 -0
  21. package/src/domains/prompts/infrastructure/services/ColorizationService.ts +232 -0
  22. package/src/domains/prompts/infrastructure/services/FaceSwapService.ts +198 -0
  23. package/src/domains/prompts/infrastructure/services/FuturePredictionService.ts +176 -0
  24. package/src/domains/prompts/infrastructure/services/ImageEnhancementService.ts +181 -0
  25. package/src/domains/prompts/infrastructure/services/PhotoRestorationService.ts +160 -0
  26. package/src/domains/prompts/infrastructure/services/PromptGenerationService.ts +59 -0
  27. package/src/domains/prompts/infrastructure/services/StyleTransferService.ts +194 -0
  28. package/src/domains/prompts/infrastructure/services/TextGenerationService.ts +241 -0
  29. package/src/domains/prompts/presentation/hooks/useAIServices.ts +213 -0
  30. package/src/domains/prompts/presentation/hooks/useAsyncState.ts +56 -0
  31. package/src/domains/prompts/presentation/hooks/useFaceSwap.ts +100 -0
  32. package/src/domains/prompts/presentation/hooks/useImageEnhancement.ts +100 -0
  33. package/src/domains/prompts/presentation/hooks/usePhotoRestoration.ts +100 -0
  34. package/src/domains/prompts/presentation/hooks/usePromptGeneration.ts +144 -0
  35. package/src/domains/prompts/presentation/hooks/useStyleTransfer.ts +125 -0
  36. package/src/domains/prompts/presentation/hooks/useTemplateRepository.ts +113 -0
  37. package/src/domains/prompts/presentation/theme/theme.ts +16 -0
  38. package/src/domains/prompts/presentation/theme/types.ts +82 -0
  39. package/src/domains/prompts/presentation/theme/utils.ts +24 -0
  40. package/src/index.ts +6 -0
  41. package/src/presentation/components/GenerationProgressContent.tsx +3 -3
  42. package/src/presentation/components/PendingJobCard.tsx +4 -4
  43. package/src/presentation/components/PendingJobCardActions.tsx +2 -2
@@ -0,0 +1,100 @@
1
+ import type { AIPromptTemplate } from './AIPromptTemplate';
2
+
3
+ export interface TextGenerationConfig {
4
+ promptType: 'creative' | 'technical' | 'marketing' | 'educational' | 'conversational';
5
+ tone: 'formal' | 'casual' | 'professional' | 'friendly' | 'humorous';
6
+ length: 'short' | 'medium' | 'long';
7
+ language: string;
8
+ context?: string;
9
+ keywords?: string[];
10
+ }
11
+
12
+ export interface TextGenerationTemplate {
13
+ readonly id: string;
14
+ readonly name: string;
15
+ readonly description: string;
16
+ readonly basePrompt: string;
17
+ readonly variables: TextGenerationVariable[];
18
+ readonly generation: TextGenerationSettings;
19
+ }
20
+
21
+ export interface TextGenerationVariable {
22
+ name: string;
23
+ description: string;
24
+ required: boolean;
25
+ type: 'string' | 'select' | 'array';
26
+ options?: string[];
27
+ }
28
+
29
+ export interface TextGenerationSettings {
30
+ supportedLanguages: string[];
31
+ maxTokens: Record<string, number>;
32
+ temperaturePresets: Record<string, number>;
33
+ }
34
+
35
+ export interface TextGenerationResult {
36
+ template: AIPromptTemplate;
37
+ config: TextGenerationConfig;
38
+ estimatedTokens: number;
39
+ suggestedParameters: {
40
+ temperature: number;
41
+ maxTokens: number;
42
+ topP: number;
43
+ };
44
+ }
45
+
46
+ export const validateTextGenerationConfig = (config: TextGenerationConfig): boolean => {
47
+ return !!(
48
+ config.promptType &&
49
+ config.tone &&
50
+ config.length &&
51
+ config.language &&
52
+ config.language.trim().length > 0
53
+ );
54
+ };
55
+
56
+ export const createTextGenerationVariable = (
57
+ name: string,
58
+ description: string,
59
+ type: TextGenerationVariable['type'] = 'string',
60
+ required: boolean = true,
61
+ options?: string[]
62
+ ): TextGenerationVariable => ({
63
+ name,
64
+ description,
65
+ type,
66
+ required,
67
+ options,
68
+ });
69
+
70
+ export const getTokenCount = (length: TextGenerationConfig['length']): number => {
71
+ switch (length) {
72
+ case 'short': return 50;
73
+ case 'medium': return 200;
74
+ case 'long': return 500;
75
+ default: return 200;
76
+ }
77
+ };
78
+
79
+ export const getTemperature = (
80
+ promptType: TextGenerationConfig['promptType'],
81
+ tone: TextGenerationConfig['tone']
82
+ ): number => {
83
+ let temp = 0.7;
84
+
85
+ if (promptType === 'creative') temp += 0.2;
86
+ if (promptType === 'technical') temp -= 0.3;
87
+ if (tone === 'humorous') temp += 0.1;
88
+ if (tone === 'formal') temp -= 0.2;
89
+
90
+ return Math.max(0.1, Math.min(1.0, temp));
91
+ };
92
+
93
+ export const getTopP = (promptType: TextGenerationConfig['promptType']): number => {
94
+ switch (promptType) {
95
+ case 'creative': return 0.95;
96
+ case 'technical': return 0.8;
97
+ case 'educational': return 0.85;
98
+ default: return 0.9;
99
+ }
100
+ };
@@ -0,0 +1,27 @@
1
+ export type AIPromptCategory =
2
+ | 'face-swap'
3
+ | 'photo-restoration'
4
+ | 'image-enhancement'
5
+ | 'style-transfer'
6
+ | 'background-removal'
7
+ | 'object-detection'
8
+ | 'text-generation'
9
+ | 'colorization'
10
+ | 'content-generation'
11
+ | 'text-processing'
12
+ | 'future-prediction';
13
+
14
+ export type AIPromptVariableType = 'string' | 'number' | 'boolean' | 'select' | 'array';
15
+
16
+ export type AIPromptError =
17
+ | 'TEMPLATE_NOT_FOUND'
18
+ | 'INVALID_VARIABLES'
19
+ | 'GENERATION_FAILED'
20
+ | 'STORAGE_ERROR'
21
+ | 'NETWORK_ERROR'
22
+ | 'VALIDATION_ERROR'
23
+ | 'SERVICE_UNAVAILABLE';
24
+
25
+ export type AIPromptResult<T> =
26
+ | { success: true; data: T }
27
+ | { success: false; error: AIPromptError; message?: string };
@@ -0,0 +1,33 @@
1
+ import type { AIPromptVariableType } from './types';
2
+
3
+ export interface AIPromptVariable {
4
+ name: string;
5
+ type: AIPromptVariableType;
6
+ description: string;
7
+ required: boolean;
8
+ defaultValue?: string | number | boolean;
9
+ options?: string[];
10
+ }
11
+
12
+ export interface AIPromptSafety {
13
+ contentFilter: boolean;
14
+ adultContentFilter: boolean;
15
+ violenceFilter: boolean;
16
+ hateSpeechFilter: boolean;
17
+ copyrightFilter: boolean;
18
+ }
19
+
20
+ export interface AIPromptVersion {
21
+ major: number;
22
+ minor: number;
23
+ patch: number;
24
+ }
25
+
26
+ export const createPromptVersion = (version: string): AIPromptVersion => {
27
+ const [major, minor, patch] = version.split('.').map(Number);
28
+ return { major: major || 1, minor: minor || 0, patch: patch || 0 };
29
+ };
30
+
31
+ export const formatVersion = (version: AIPromptVersion): string => {
32
+ return `${version.major}.${version.minor}.${version.patch}`;
33
+ };
@@ -0,0 +1,106 @@
1
+ import type { AIPromptTemplate } from '../entities/AIPromptTemplate';
2
+ import type { AIPromptResult } from '../entities/types';
3
+ import type { FaceSwapConfig, FaceSwapGenerationResult } from '../entities/FaceSwapConfig';
4
+ import type {
5
+ PhotoRestorationConfig,
6
+ PhotoRestorationResult
7
+ } from '../entities/PhotoRestorationConfig';
8
+ import type {
9
+ ImageEnhancementConfig,
10
+ ImageEnhancementResult,
11
+ EnhancementAdjustments
12
+ } from '../entities/ImageEnhancementConfig';
13
+ import type {
14
+ StyleTransferConfig,
15
+ StyleTransferResult
16
+ } from '../entities/StyleTransferConfig';
17
+ import type {
18
+ BackgroundRemovalConfig,
19
+ BackgroundRemovalResult
20
+ } from '../entities/BackgroundRemovalConfig';
21
+ import type {
22
+ TextGenerationConfig,
23
+ TextGenerationResult
24
+ } from '../entities/TextGenerationConfig';
25
+ import type {
26
+ ColorizationConfig,
27
+ ColorizationResult
28
+ } from '../entities/ColorizationConfig';
29
+ import type {
30
+ FuturePredictionConfig,
31
+ FuturePredictionResult,
32
+ } from '../entities/FuturePredictionConfig';
33
+
34
+ export interface IFaceSwapService {
35
+ generateTemplate(config: FaceSwapConfig): Promise<AIPromptResult<AIPromptTemplate>>;
36
+ generatePrompt(template: AIPromptTemplate, config: FaceSwapConfig): Promise<AIPromptResult<string>>;
37
+ validateConfig(config: FaceSwapConfig): boolean;
38
+ getAvailableStyles(): Promise<string[]>;
39
+ }
40
+
41
+ export interface IPhotoRestorationService {
42
+ generateTemplate(config: PhotoRestorationConfig): Promise<AIPromptResult<AIPromptTemplate>>;
43
+ generatePrompt(template: AIPromptTemplate, config: PhotoRestorationConfig): Promise<AIPromptResult<string>>;
44
+ validateConfig(config: PhotoRestorationConfig): boolean;
45
+ estimateQuality(config: PhotoRestorationConfig): number;
46
+ }
47
+
48
+ export interface IImageEnhancementService {
49
+ generateTemplate(config: ImageEnhancementConfig): Promise<AIPromptResult<AIPromptTemplate>>;
50
+ generatePrompt(template: AIPromptTemplate, config: ImageEnhancementConfig): Promise<AIPromptResult<string>>;
51
+ validateConfig(config: ImageEnhancementConfig): boolean;
52
+ calculateAdjustments(config: ImageEnhancementConfig): EnhancementAdjustments;
53
+ }
54
+
55
+ export interface IStyleTransferService {
56
+ generateTemplate(config: StyleTransferConfig): Promise<AIPromptResult<AIPromptTemplate>>;
57
+ generatePrompt(template: AIPromptTemplate, config: StyleTransferConfig): Promise<AIPromptResult<string>>;
58
+ validateConfig(config: StyleTransferConfig): boolean;
59
+ getAvailableStyles(): Promise<string[]>;
60
+ }
61
+
62
+ export interface IBackgroundRemovalService {
63
+ generateTemplate(config: BackgroundRemovalConfig): Promise<AIPromptResult<AIPromptTemplate>>;
64
+ generatePrompt(template: AIPromptTemplate, config: BackgroundRemovalConfig): Promise<AIPromptResult<string>>;
65
+ validateConfig(config: BackgroundRemovalConfig): boolean;
66
+ estimateProcessingTime(config: BackgroundRemovalConfig): number;
67
+ }
68
+
69
+ export interface ITextGenerationService {
70
+ generateTemplate(config: TextGenerationConfig): Promise<AIPromptResult<AIPromptTemplate>>;
71
+ generatePrompt(template: AIPromptTemplate, config: TextGenerationConfig): Promise<AIPromptResult<string>>;
72
+ validateConfig(config: TextGenerationConfig): boolean;
73
+ estimateTokens(config: TextGenerationConfig): number;
74
+ getGenerationParameters(config: TextGenerationConfig): Record<string, number>;
75
+ }
76
+
77
+ export interface IColorizationService {
78
+ generateTemplate(config: ColorizationConfig): Promise<AIPromptResult<AIPromptTemplate>>;
79
+ generatePrompt(template: AIPromptTemplate, config: ColorizationConfig): Promise<AIPromptResult<string>>;
80
+ validateConfig(config: ColorizationConfig): boolean;
81
+ getColorPalette(config: ColorizationConfig): string[];
82
+ getQualityScore(config: ColorizationConfig): number;
83
+ }
84
+
85
+ export interface IPromptGenerationService {
86
+ generateFromTemplate(
87
+ template: AIPromptTemplate,
88
+ variables: Record<string, unknown>
89
+ ): Promise<AIPromptResult<string>>;
90
+ validateVariables(
91
+ template: AIPromptTemplate,
92
+ variables: Record<string, unknown>
93
+ ): AIPromptResult<void>;
94
+ replaceTemplateVariables(
95
+ template: string,
96
+ variables: Record<string, unknown>
97
+ ): string;
98
+ }
99
+
100
+ export interface IFuturePredictionService {
101
+ generateTemplate(config: FuturePredictionConfig): Promise<AIPromptResult<AIPromptTemplate>>;
102
+ generatePrompts(config: FuturePredictionConfig): Promise<AIPromptResult<FuturePredictionResult>>;
103
+ validateConfig(config: FuturePredictionConfig): boolean;
104
+ buildImagePrompt(config: FuturePredictionConfig): string;
105
+ buildStoryPrompt(config: FuturePredictionConfig): string;
106
+ }
@@ -0,0 +1,10 @@
1
+ import type { GeneratedPrompt } from '../entities/GeneratedPrompt';
2
+ import type { AIPromptResult } from '../entities/types';
3
+
4
+ export interface IPromptHistoryRepository {
5
+ save(prompt: GeneratedPrompt): Promise<AIPromptResult<void>>;
6
+ findRecent(limit?: number): Promise<AIPromptResult<GeneratedPrompt[]>>;
7
+ findByTemplateId(templateId: string, limit?: number): Promise<AIPromptResult<GeneratedPrompt[]>>;
8
+ delete(id: string): Promise<AIPromptResult<void>>;
9
+ clear(): Promise<AIPromptResult<void>>;
10
+ }
@@ -0,0 +1,11 @@
1
+ import type { AIPromptTemplate } from '../entities/AIPromptTemplate';
2
+ import type { AIPromptResult, AIPromptCategory } from '../entities/types';
3
+
4
+ export interface ITemplateRepository {
5
+ findById(id: string): Promise<AIPromptResult<AIPromptTemplate | null>>;
6
+ findByCategory(category: AIPromptCategory): Promise<AIPromptResult<AIPromptTemplate[]>>;
7
+ findAll(): Promise<AIPromptResult<AIPromptTemplate[]>>;
8
+ save(template: AIPromptTemplate): Promise<AIPromptResult<void>>;
9
+ delete(id: string): Promise<AIPromptResult<void>>;
10
+ exists(id: string): Promise<boolean>;
11
+ }
@@ -0,0 +1,318 @@
1
+ /**
2
+ * @umituz/react-native-ai-prompts - Public API
3
+ *
4
+ * AI prompt templates and utilities for React Native applications
5
+ * Following SOLID, DRY, KISS principles with maximum maintainability
6
+ *
7
+ * Usage:
8
+ * import {
9
+ * useFaceSwap,
10
+ * useTemplateRepository,
11
+ * FaceSwapService,
12
+ * TemplateRepository
13
+ * } from '@umituz/react-native-ai-prompts';
14
+ */
15
+
16
+ // =============================================================================
17
+ // DOMAIN LAYER - Types and Value Objects
18
+ // =============================================================================
19
+
20
+ export type {
21
+ AIPromptCategory,
22
+ AIPromptVariableType,
23
+ AIPromptError,
24
+ AIPromptResult,
25
+ } from './domain/entities/types';
26
+
27
+ export type {
28
+ AIPromptVariable,
29
+ AIPromptSafety,
30
+ AIPromptVersion,
31
+ } from './domain/entities/value-objects';
32
+
33
+ export {
34
+ createPromptVersion,
35
+ formatVersion,
36
+ } from './domain/entities/value-objects';
37
+
38
+ // =============================================================================
39
+ // DOMAIN LAYER - Entities
40
+ // =============================================================================
41
+
42
+ export type {
43
+ AIPromptTemplate,
44
+ CreateAIPromptTemplateParams,
45
+ } from './domain/entities/AIPromptTemplate';
46
+
47
+ export {
48
+ createAIPromptTemplate,
49
+ updateTemplateVersion,
50
+ getTemplateString,
51
+ } from './domain/entities/AIPromptTemplate';
52
+
53
+ export type {
54
+ GeneratedPrompt,
55
+ CreateGeneratedPromptParams,
56
+ } from './domain/entities/GeneratedPrompt';
57
+
58
+ export {
59
+ createGeneratedPrompt,
60
+ isPromptRecent,
61
+ } from './domain/entities/GeneratedPrompt';
62
+
63
+ export type {
64
+ FaceSwapConfig,
65
+ FaceSwapTemplate,
66
+ FaceSwapTemplateVariable,
67
+ FaceSwapSafety,
68
+ FaceSwapGenerationResult,
69
+ } from './domain/entities/FaceSwapConfig';
70
+
71
+ export {
72
+ validateFaceSwapConfig,
73
+ createFaceSwapVariable,
74
+ } from './domain/entities/FaceSwapConfig';
75
+
76
+ export type {
77
+ PhotoRestorationConfig,
78
+ PhotoRestorationTemplate,
79
+ PhotoRestorationVariable,
80
+ PhotoRestorationQuality,
81
+ PhotoRestorationResult,
82
+ } from './domain/entities/PhotoRestorationConfig';
83
+
84
+ export {
85
+ validatePhotoRestorationConfig,
86
+ createPhotoRestorationVariable,
87
+ getQualityLevel,
88
+ } from './domain/entities/PhotoRestorationConfig';
89
+
90
+ export type {
91
+ ImageEnhancementConfig,
92
+ ImageEnhancementTemplate,
93
+ ImageEnhancementVariable,
94
+ EnhancementSettings,
95
+ ImageEnhancementResult,
96
+ EnhancementAdjustments,
97
+ } from './domain/entities/ImageEnhancementConfig';
98
+
99
+ export {
100
+ validateImageEnhancementConfig,
101
+ createImageEnhancementVariable,
102
+ calculateAdjustments,
103
+ } from './domain/entities/ImageEnhancementConfig';
104
+
105
+ export type {
106
+ StyleTransferConfig,
107
+ StyleTransferTemplate,
108
+ StyleTransferVariable,
109
+ StyleTransferSettings,
110
+ StyleTransferResult,
111
+ } from './domain/entities/StyleTransferConfig';
112
+
113
+ export {
114
+ validateStyleTransferConfig,
115
+ createStyleTransferVariable,
116
+ getStyleStrengthValue,
117
+ getArtisticModeDescription,
118
+ } from './domain/entities/StyleTransferConfig';
119
+
120
+ export type {
121
+ BackgroundRemovalConfig,
122
+ BackgroundRemovalTemplate,
123
+ BackgroundRemovalVariable,
124
+ BackgroundRemovalSettings,
125
+ BackgroundRemovalResult,
126
+ DetectedObject,
127
+ } from './domain/entities/BackgroundRemovalConfig';
128
+
129
+ export {
130
+ validateBackgroundRemovalConfig,
131
+ createBackgroundRemovalVariable,
132
+ getProcessingTime,
133
+ getQualityScore,
134
+ } from './domain/entities/BackgroundRemovalConfig';
135
+
136
+ export type {
137
+ TextGenerationConfig,
138
+ TextGenerationTemplate,
139
+ TextGenerationVariable,
140
+ TextGenerationSettings,
141
+ TextGenerationResult,
142
+ } from './domain/entities/TextGenerationConfig';
143
+
144
+ export {
145
+ validateTextGenerationConfig,
146
+ createTextGenerationVariable,
147
+ getTokenCount,
148
+ getTemperature,
149
+ getTopP,
150
+ } from './domain/entities/TextGenerationConfig';
151
+
152
+ export type {
153
+ ColorizationConfig,
154
+ ColorizationTemplate,
155
+ ColorizationVariable,
156
+ ColorizationSettings,
157
+ ColorizationResult,
158
+ } from './domain/entities/ColorizationConfig';
159
+
160
+ export {
161
+ validateColorizationConfig,
162
+ createColorizationVariable,
163
+ getColorizationQuality,
164
+ getEraDescription,
165
+ getSuggestedColorPalette,
166
+ } from './domain/entities/ColorizationConfig';
167
+
168
+ export type {
169
+ FuturePredictionConfig,
170
+ FuturePredictionTemplate,
171
+ FuturePredictionVariable,
172
+ FuturePredictionSettings,
173
+ FuturePredictionResult,
174
+ FuturePredictionMetadata,
175
+ FuturePredictionOutputType,
176
+ } from './domain/entities/FuturePredictionConfig';
177
+
178
+ export {
179
+ validateFuturePredictionConfig,
180
+ createFuturePredictionVariable,
181
+ getFutureYear,
182
+ } from './domain/entities/FuturePredictionConfig';
183
+
184
+ // =============================================================================
185
+ // DOMAIN LAYER - Repository Interfaces
186
+ // =============================================================================
187
+
188
+ export type {
189
+ ITemplateRepository,
190
+ } from './domain/repositories/ITemplateRepository';
191
+
192
+ export type {
193
+ IPromptHistoryRepository,
194
+ } from './domain/repositories/IPromptHistoryRepository';
195
+
196
+ export type {
197
+ IFaceSwapService,
198
+ IPhotoRestorationService,
199
+ IImageEnhancementService,
200
+ IStyleTransferService,
201
+ IBackgroundRemovalService,
202
+ ITextGenerationService,
203
+ IColorizationService,
204
+ IPromptGenerationService,
205
+ IFuturePredictionService,
206
+ } from './domain/repositories/IAIPromptServices';
207
+
208
+ // =============================================================================
209
+ // INFRASTRUCTURE LAYER - Repositories
210
+ // =============================================================================
211
+
212
+ export { TemplateRepository } from './infrastructure/repositories/TemplateRepository';
213
+ export { PromptHistoryRepository } from './infrastructure/repositories/PromptHistoryRepository';
214
+
215
+ // =============================================================================
216
+ // INFRASTRUCTURE LAYER - Services
217
+ // =============================================================================
218
+
219
+ export { PromptGenerationService } from './infrastructure/services/PromptGenerationService';
220
+ export { FaceSwapService } from './infrastructure/services/FaceSwapService';
221
+ export { PhotoRestorationService } from './infrastructure/services/PhotoRestorationService';
222
+ export { ImageEnhancementService } from './infrastructure/services/ImageEnhancementService';
223
+ export { StyleTransferService } from './infrastructure/services/StyleTransferService';
224
+ export { BackgroundRemovalService } from './infrastructure/services/BackgroundRemovalService';
225
+ export { TextGenerationService } from './infrastructure/services/TextGenerationService';
226
+ export { ColorizationService } from './infrastructure/services/ColorizationService';
227
+ export { FuturePredictionService } from './infrastructure/services/FuturePredictionService';
228
+
229
+ // =============================================================================
230
+ // PRESENTATION LAYER - Theme
231
+ // =============================================================================
232
+
233
+ export type {
234
+ ThemeColors,
235
+ ThemeSpacing,
236
+ ThemeTypography,
237
+ Theme,
238
+ } from './presentation/theme/types';
239
+
240
+ export {
241
+ createTheme,
242
+ defaultTheme,
243
+ } from './presentation/theme/types';
244
+
245
+ export {
246
+ useTheme,
247
+ setTheme,
248
+ getTheme,
249
+ resetTheme,
250
+ } from './presentation/theme/theme';
251
+
252
+ export {
253
+ createStyleSheet,
254
+ spacing,
255
+ color,
256
+ typography,
257
+ } from './presentation/theme/utils';
258
+
259
+ // =============================================================================
260
+ // PRESENTATION LAYER - Hooks
261
+ // =============================================================================
262
+
263
+ export type {
264
+ AsyncState,
265
+ AsyncActions,
266
+ } from './presentation/hooks/useAsyncState';
267
+
268
+ export { useAsyncState } from './presentation/hooks/useAsyncState';
269
+
270
+ export type {
271
+ UseTemplateState,
272
+ UseTemplateActions,
273
+ } from './presentation/hooks/useTemplateRepository';
274
+
275
+ export { useTemplateRepository } from './presentation/hooks/useTemplateRepository';
276
+
277
+ export type {
278
+ UseFaceSwapState,
279
+ UseFaceSwapActions,
280
+ } from './presentation/hooks/useFaceSwap';
281
+
282
+ export { useFaceSwap } from './presentation/hooks/useFaceSwap';
283
+
284
+ export type {
285
+ UsePhotoRestorationState,
286
+ UsePhotoRestorationActions,
287
+ } from './presentation/hooks/usePhotoRestoration';
288
+
289
+ export { usePhotoRestoration } from './presentation/hooks/usePhotoRestoration';
290
+
291
+ export type {
292
+ UseImageEnhancementState,
293
+ UseImageEnhancementActions,
294
+ } from './presentation/hooks/useImageEnhancement';
295
+
296
+ export { useImageEnhancement } from './presentation/hooks/useImageEnhancement';
297
+
298
+ export type {
299
+ UseStyleTransferState,
300
+ UseStyleTransferActions,
301
+ } from './presentation/hooks/useStyleTransfer';
302
+
303
+ export { useStyleTransfer } from './presentation/hooks/useStyleTransfer';
304
+
305
+ export type {
306
+ AIConfig,
307
+ UseAIServicesState,
308
+ UseAIServicesActions,
309
+ } from './presentation/hooks/useAIServices';
310
+
311
+ export { useAIServices } from './presentation/hooks/useAIServices';
312
+
313
+ export type {
314
+ UsePromptGenerationState,
315
+ UsePromptGenerationActions,
316
+ } from './presentation/hooks/usePromptGeneration';
317
+
318
+ export { usePromptGeneration } from './presentation/hooks/usePromptGeneration';
@@ -0,0 +1,85 @@
1
+ import type { IPromptHistoryRepository } from '../../domain/repositories/IPromptHistoryRepository';
2
+ import type { GeneratedPrompt } from '../../domain/entities/GeneratedPrompt';
3
+ import type { AIPromptResult, AIPromptError } from '../../domain/entities/types';
4
+
5
+ export class PromptHistoryRepository implements IPromptHistoryRepository {
6
+ private storage: GeneratedPrompt[] = [];
7
+ private readonly maxStorageSize = 100;
8
+
9
+ async save(prompt: GeneratedPrompt): Promise<AIPromptResult<void>> {
10
+ try {
11
+ this.storage.push(prompt);
12
+ this.trimStorage();
13
+ return { success: true, data: undefined };
14
+ } catch (error) {
15
+ return {
16
+ success: false,
17
+ error: 'STORAGE_ERROR',
18
+ message: 'Failed to save prompt to history'
19
+ };
20
+ }
21
+ }
22
+
23
+ async findRecent(limit: number = 50): Promise<AIPromptResult<GeneratedPrompt[]>> {
24
+ try {
25
+ const prompts = this.storage.slice(-limit);
26
+ return { success: true, data: prompts };
27
+ } catch (error) {
28
+ return {
29
+ success: false,
30
+ error: 'STORAGE_ERROR',
31
+ message: 'Failed to retrieve recent prompts'
32
+ };
33
+ }
34
+ }
35
+
36
+ async findByTemplateId(
37
+ templateId: string,
38
+ limit: number = 20
39
+ ): Promise<AIPromptResult<GeneratedPrompt[]>> {
40
+ try {
41
+ const prompts = this.storage
42
+ .filter(prompt => prompt.templateId === templateId)
43
+ .slice(-limit);
44
+ return { success: true, data: prompts };
45
+ } catch (error) {
46
+ return {
47
+ success: false,
48
+ error: 'STORAGE_ERROR',
49
+ message: 'Failed to retrieve prompts by template ID'
50
+ };
51
+ }
52
+ }
53
+
54
+ async delete(id: string): Promise<AIPromptResult<void>> {
55
+ try {
56
+ this.storage = this.storage.filter(prompt => prompt.id !== id);
57
+ return { success: true, data: undefined };
58
+ } catch (error) {
59
+ return {
60
+ success: false,
61
+ error: 'STORAGE_ERROR',
62
+ message: 'Failed to delete prompt'
63
+ };
64
+ }
65
+ }
66
+
67
+ async clear(): Promise<AIPromptResult<void>> {
68
+ try {
69
+ this.storage = [];
70
+ return { success: true, data: undefined };
71
+ } catch (error) {
72
+ return {
73
+ success: false,
74
+ error: 'STORAGE_ERROR',
75
+ message: 'Failed to clear prompt history'
76
+ };
77
+ }
78
+ }
79
+
80
+ private trimStorage(): void {
81
+ if (this.storage.length > this.maxStorageSize) {
82
+ this.storage = this.storage.slice(-this.maxStorageSize);
83
+ }
84
+ }
85
+ }