@umituz/react-native-ai-generation-content 1.26.29 → 1.26.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umituz/react-native-ai-generation-content",
3
- "version": "1.26.29",
3
+ "version": "1.26.30",
4
4
  "description": "Provider-agnostic AI generation orchestration for React Native with result preview components",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",
@@ -2,10 +2,8 @@
2
2
  * Infrastructure Constants
3
3
  */
4
4
 
5
- export {
6
- IMAGE_PROGRESS,
7
- VIDEO_PROGRESS,
8
- POLLING_PROGRESS,
9
- VIDEO_TIMEOUT_MS,
10
- MAX_TRANSIENT_ERRORS,
11
- } from "./progress.constants";
5
+ /** Video generation timeout in milliseconds (5 minutes) */
6
+ export const VIDEO_TIMEOUT_MS = 300000;
7
+
8
+ /** Maximum consecutive transient errors before failing */
9
+ export const MAX_TRANSIENT_ERRORS = 5;
@@ -7,7 +7,6 @@
7
7
  import { providerRegistry } from "./provider-registry.service";
8
8
  import { cleanBase64, extractErrorMessage } from "../utils";
9
9
  import { extractImageResult } from "../utils/url-extractor";
10
- import { IMAGE_PROGRESS } from "../constants";
11
10
  import type { ImageResultExtractor } from "../utils/url-extractor";
12
11
  import type { ImageFeatureType, ImageFeatureInputData } from "../../domain/interfaces";
13
12
 
@@ -69,8 +68,6 @@ export async function executeImageFeature(
69
68
  }
70
69
 
71
70
  try {
72
- onProgress?.(IMAGE_PROGRESS.START);
73
-
74
71
  const inputData: ImageFeatureInputData = {
75
72
  imageBase64: request.imageBase64 ? cleanBase64(request.imageBase64) : "",
76
73
  targetImageBase64: request.targetImageBase64
@@ -80,20 +77,13 @@ export async function executeImageFeature(
80
77
  options: request.options,
81
78
  };
82
79
 
83
- onProgress?.(IMAGE_PROGRESS.INPUT_PREPARED);
84
-
85
80
  const input = provider.buildImageFeatureInput(featureType, inputData);
86
-
87
- onProgress?.(IMAGE_PROGRESS.REQUEST_SENT);
88
-
89
81
  const result = await provider.run(model, input);
90
82
 
91
- onProgress?.(IMAGE_PROGRESS.RESULT_RECEIVED);
92
-
93
83
  const extractor = extractResult ?? extractImageResult;
94
84
  const imageUrl = extractor(result);
95
85
 
96
- onProgress?.(IMAGE_PROGRESS.COMPLETE);
86
+ onProgress?.(100);
97
87
 
98
88
  if (!imageUrl) {
99
89
  return { success: false, error: "No image in response" };
@@ -7,7 +7,7 @@
7
7
  import { providerRegistry } from "./provider-registry.service";
8
8
  import { cleanBase64, extractErrorMessage } from "../utils";
9
9
  import { extractVideoResult } from "../utils/url-extractor";
10
- import { VIDEO_PROGRESS, VIDEO_TIMEOUT_MS } from "../constants";
10
+ import { VIDEO_TIMEOUT_MS } from "../constants";
11
11
  import type { VideoFeatureType, VideoFeatureInputData } from "../../domain/interfaces";
12
12
  import type {
13
13
  ExecuteVideoFeatureOptions,
@@ -36,7 +36,7 @@ export async function executeVideoFeature(
36
36
  return { success: false, error: "AI provider not initialized" };
37
37
  }
38
38
 
39
- const { extractResult, onProgress } = options ?? {};
39
+ const { extractResult, onProgress, onStatusChange } = options ?? {};
40
40
 
41
41
  const model = provider.getVideoFeatureModel(featureType);
42
42
 
@@ -45,8 +45,6 @@ export async function executeVideoFeature(
45
45
  }
46
46
 
47
47
  try {
48
- onProgress?.(VIDEO_PROGRESS.START);
49
-
50
48
  const inputData: VideoFeatureInputData = {
51
49
  sourceImageBase64: cleanBase64(request.sourceImageBase64),
52
50
  targetImageBase64: cleanBase64(request.targetImageBase64),
@@ -54,36 +52,26 @@ export async function executeVideoFeature(
54
52
  options: request.options,
55
53
  };
56
54
 
57
- onProgress?.(VIDEO_PROGRESS.INPUT_PREPARED);
58
-
59
55
  const input = provider.buildVideoFeatureInput(featureType, inputData);
60
56
 
61
- onProgress?.(VIDEO_PROGRESS.REQUEST_SENT);
62
-
63
57
  const result = await provider.subscribe(model, input, {
64
58
  timeoutMs: VIDEO_TIMEOUT_MS,
65
59
  onQueueUpdate: (status) => {
66
60
  if (__DEV__) {
67
- console.log(`[Video:${featureType}] Queue update:`, status.status);
68
- }
69
- if (status.status === "IN_QUEUE") {
70
- onProgress?.(VIDEO_PROGRESS.IN_QUEUE);
71
- } else if (status.status === "IN_PROGRESS") {
72
- onProgress?.(VIDEO_PROGRESS.IN_PROGRESS);
61
+ console.log(`[Video:${featureType}] Queue status:`, status.status);
73
62
  }
63
+ onStatusChange?.(status.status);
74
64
  },
75
65
  });
76
66
 
77
- onProgress?.(VIDEO_PROGRESS.RESULT_RECEIVED);
78
-
79
67
  const extractor = extractResult ?? extractVideoResult;
80
68
  const videoUrl = extractor(result);
81
69
 
82
- onProgress?.(VIDEO_PROGRESS.COMPLETE);
70
+ onProgress?.(100);
83
71
 
84
72
  if (!videoUrl) {
85
73
  if (__DEV__) {
86
- console.log(`[Video:${featureType}] No video URL found in result:`, JSON.stringify(result, null, 2));
74
+ console.log(`[Video:${featureType}] No video URL found in result`);
87
75
  }
88
76
  return { success: false, error: "No video in response" };
89
77
  }
@@ -10,6 +10,7 @@ import type { VideoResultExtractor } from "../utils/url-extractor";
10
10
  export interface ExecuteVideoFeatureOptions {
11
11
  extractResult?: VideoResultExtractor;
12
12
  onProgress?: (progress: number) => void;
13
+ onStatusChange?: (status: string) => void;
13
14
  }
14
15
 
15
16
  /**
@@ -1,36 +0,0 @@
1
- /**
2
- * Progress Constants
3
- * Standardized progress values for generation pipelines
4
- */
5
-
6
- /** Image generation progress stages */
7
- export const IMAGE_PROGRESS = {
8
- START: 10,
9
- INPUT_PREPARED: 30,
10
- REQUEST_SENT: 40,
11
- RESULT_RECEIVED: 90,
12
- COMPLETE: 100,
13
- } as const;
14
-
15
- /** Video generation progress stages */
16
- export const VIDEO_PROGRESS = {
17
- START: 5,
18
- INPUT_PREPARED: 10,
19
- REQUEST_SENT: 15,
20
- IN_QUEUE: 20,
21
- IN_PROGRESS: 50,
22
- RESULT_RECEIVED: 90,
23
- COMPLETE: 100,
24
- } as const;
25
-
26
- /** Polling progress stages */
27
- export const POLLING_PROGRESS = {
28
- RESULT_RECEIVED: 90,
29
- COMPLETE: 100,
30
- } as const;
31
-
32
- /** Video generation timeout in milliseconds (5 minutes) */
33
- export const VIDEO_TIMEOUT_MS = 300000;
34
-
35
- /** Maximum consecutive transient errors before failing */
36
- export const MAX_TRANSIENT_ERRORS = 5;