@umituz/react-native-ai-generation-content 1.17.26 → 1.17.27

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.17.26",
3
+ "version": "1.17.27",
4
4
  "description": "Provider-agnostic AI generation orchestration for React Native",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",
@@ -8,7 +8,6 @@ import { executeVideoFeature } from "../../../../infrastructure/services";
8
8
  import type {
9
9
  AIHugFeatureState,
10
10
  AIHugFeatureConfig,
11
- AIHugResult,
12
11
  } from "../../domain/types";
13
12
 
14
13
  export interface UseAIHugFeatureProps {
@@ -8,7 +8,6 @@ import { executeVideoFeature } from "../../../../infrastructure/services";
8
8
  import type {
9
9
  AIKissFeatureState,
10
10
  AIKissFeatureConfig,
11
- AIKissResult,
12
11
  } from "../../domain/types";
13
12
 
14
13
  export interface UseAIKissFeatureProps {
package/src/index.ts CHANGED
@@ -129,6 +129,7 @@ export {
129
129
  classifyError,
130
130
  isTransientError,
131
131
  isPermanentError,
132
+ isResultNotReady,
132
133
  // Polling
133
134
  calculatePollingInterval,
134
135
  createPollingDelay,
@@ -170,3 +170,31 @@ export function isTransientError(error: unknown): boolean {
170
170
  export function isPermanentError(error: unknown): boolean {
171
171
  return !isTransientError(error);
172
172
  }
173
+
174
+ /**
175
+ * Check if result is not ready yet (used during polling)
176
+ * More specific than isTransientError for result fetching scenarios
177
+ * Returns true for 404/not-found errors that indicate job still processing
178
+ */
179
+ export function isResultNotReady(
180
+ error: unknown,
181
+ retryAttempt: number,
182
+ maxRetries: number,
183
+ ): boolean {
184
+ if (isPermanentError(error)) {
185
+ return false;
186
+ }
187
+
188
+ const message = error instanceof Error ? error.message.toLowerCase() : String(error).toLowerCase();
189
+ const errorName = error instanceof Error ? error.constructor.name.toLowerCase() : "";
190
+
191
+ return (
192
+ message.includes("not found") ||
193
+ message.includes("404") ||
194
+ message.includes("still in progress") ||
195
+ message.includes("result not ready") ||
196
+ message.includes("request is still in progress") ||
197
+ message.includes("job result not found") ||
198
+ (errorName === "apierror" && retryAttempt < maxRetries - 1)
199
+ );
200
+ }