@umituz/react-native-ai-generation-content 1.67.4 → 1.68.0

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.67.4",
3
+ "version": "1.68.0",
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",
@@ -5,4 +5,8 @@
5
5
 
6
6
  export * from "./status-helpers";
7
7
  export * from "./preview-helpers";
8
- export * from "./creation-helpers";
8
+ export * from "./creation-id.util";
9
+ export * from "./creation-display.util";
10
+ export * from "./creation-search.util";
11
+ export * from "./creation-sort.util";
12
+ export * from "./creation-format.util";
@@ -104,8 +104,10 @@ export const useFlow = (config: UseFlowConfig): UseFlowReturn => {
104
104
  };
105
105
  };
106
106
 
107
- // Note: resetFlowStore is no longer needed as each component instance maintains its own store
108
- // If you need to reset flow state, use the reset() action from the useFlow hook
107
+ declare const __DEV__: boolean;
108
+
109
109
  export const resetFlowStore = () => {
110
- console.warn('resetFlowStore is deprecated. Each component now maintains its own flow store instance.');
110
+ if (typeof __DEV__ !== "undefined" && __DEV__) {
111
+ console.warn('resetFlowStore is deprecated. Each component now maintains its own flow store instance.');
112
+ }
111
113
  };
@@ -3,12 +3,17 @@
3
3
  * Infrastructure: Orchestrates request execution with error handling
4
4
  */
5
5
 
6
- import { withErrorHandling, getErrorMessage, retryWithBackoff, isNetworkError } from "../utils/error-handling.util";
6
+ import { withErrorHandling } from "../utils/error-handlers";
7
+ import { getErrorMessage } from "../utils/error-extractors";
8
+ import { retryWithBackoff } from "../utils/error-retry";
9
+ import { isNetworkError } from "../utils/error-classifiers";
7
10
  import { env } from "../config/env.config";
8
11
  import type { RequestOptions, ApiResponse } from "./api-client.types";
9
12
  import { executeRequest, isSuccessResponse, extractErrorMessage } from "./http-request-executor";
10
13
  import { parseResponse, createSuccessResponse, createErrorResponse } from "./http-response-parser";
11
14
 
15
+ declare const __DEV__: boolean;
16
+
12
17
  /**
13
18
  * Fetches data with timeout, retry, and error handling
14
19
  */
@@ -41,7 +46,9 @@ export async function fetchWithTimeout<T>(
41
46
  return operation();
42
47
  },
43
48
  (error) => {
44
- console.error("[API Client] Request failed:", error);
49
+ if (typeof __DEV__ !== "undefined" && __DEV__) {
50
+ console.error("[API Client] Request failed:", error);
51
+ }
45
52
  }
46
53
  );
47
54
 
@@ -9,7 +9,7 @@ import type {
9
9
  GenerationResult,
10
10
  PollingConfig,
11
11
  } from "../../domain/entities";
12
- import { classifyError } from "../utils/error-classifier.util";
12
+ import { classifyError } from "../utils/error-classification";
13
13
  import { pollJob } from "../../domains/background/infrastructure/services/job-poller.service";
14
14
  import { ProviderValidator } from "./provider-validator";
15
15
 
@@ -2,7 +2,7 @@
2
2
  * Error Classification Utilities
3
3
  */
4
4
 
5
- import { isError, isAppError } from "./error-types";
5
+ import { isError } from "./error-types";
6
6
 
7
7
  /**
8
8
  * Checks if error is a network error
@@ -21,29 +21,3 @@ export function isNetworkError(error: unknown): boolean {
21
21
  );
22
22
  }
23
23
 
24
- /**
25
- * Checks if error is a validation error
26
- */
27
- export function isValidationError(error: unknown): boolean {
28
- if (isAppError(error)) {
29
- return error.code?.toLowerCase().includes("validation") || false;
30
- }
31
- return false;
32
- }
33
-
34
- /**
35
- * Checks if error is an authentication error
36
- */
37
- export function isAuthError(error: unknown): boolean {
38
- if (!isError(error)) {
39
- return false;
40
- }
41
-
42
- const message = error.message.toLowerCase();
43
- return (
44
- message.includes("unauthorized") ||
45
- message.includes("authentication") ||
46
- message.includes("forbidden") ||
47
- message.includes("token")
48
- );
49
- }
@@ -1,9 +1,7 @@
1
1
  /**
2
- * Error Message Extraction and Creation
2
+ * Error Message Extraction
3
3
  */
4
4
 
5
- import type { AppError } from "./error-types";
6
-
7
5
  /**
8
6
  * Safely extracts error message from unknown error type
9
7
  */
@@ -23,20 +21,3 @@ export function getErrorMessage(error: unknown): string {
23
21
  return "An unknown error occurred";
24
22
  }
25
23
 
26
- /**
27
- * Creates a standardized application error
28
- */
29
- export function createAppError(
30
- message: string,
31
- options: {
32
- code?: string;
33
- statusCode?: number;
34
- originalError?: unknown;
35
- } = {}
36
- ): AppError {
37
- const error = new Error(message) as AppError;
38
- error.code = options.code;
39
- error.statusCode = options.statusCode;
40
- error.originalError = options.originalError;
41
- return error;
42
- }
@@ -4,6 +4,8 @@
4
4
 
5
5
  import { getErrorMessage } from "./error-extractors";
6
6
 
7
+ declare const __DEV__: boolean;
8
+
7
9
  /**
8
10
  * Wraps an async function with error handling
9
11
  */
@@ -21,31 +23,3 @@ export async function withErrorHandling<T>(
21
23
  }
22
24
  }
23
25
 
24
- /**
25
- * Safely executes a function and returns null on error
26
- */
27
- export function safeExecute<T>(
28
- operation: () => T,
29
- fallback: T = null as T
30
- ): T {
31
- try {
32
- return operation();
33
- } catch {
34
- return fallback;
35
- }
36
- }
37
-
38
- /**
39
- * Logs error with context
40
- */
41
- export function logError(
42
- error: unknown,
43
- context?: string
44
- ): void {
45
- const message = getErrorMessage(error);
46
- const contextPrefix = context ? `[${context}]` : "";
47
-
48
- if (typeof console !== "undefined" && console.error) {
49
- console.error(`${contextPrefix} Error:`, message, error);
50
- }
51
- }
@@ -2,11 +2,16 @@
2
2
  * Infrastructure Utils
3
3
  */
4
4
 
5
- export * from "./error-classifier.util";
6
- export * from "./error-message-extractor.util";
7
- export * from "./error-handling.util";
5
+ export * from "./error-classification";
6
+ export * from "./error-classifiers";
7
+ export * from "./error-extractors";
8
+ export * from "./error-handlers";
9
+ export * from "./error-factory";
10
+ export * from "./error-types";
11
+ export * from "./message-extractor";
12
+ export * from "./fal-error-checker";
13
+ export * from "./classifier-helpers";
8
14
  export * from "./validation.util";
9
- export * from "./api-client.util";
10
15
  export * from "../../domains/background/infrastructure/utils/polling-interval.util";
11
16
  export * from "./progress-calculator.util";
12
17
  export * from "./progress.utils";
@@ -1,12 +0,0 @@
1
- /**
2
- * Creation Helpers
3
- * Central export point for creation utility functions
4
- * @deprecated Individual utilities split into focused modules for better maintainability
5
- */
6
-
7
- // Re-export all utilities for backward compatibility
8
- export * from "./creation-id.util";
9
- export * from "./creation-display.util";
10
- export * from "./creation-search.util";
11
- export * from "./creation-sort.util";
12
- export * from "./creation-format.util";
@@ -1,16 +0,0 @@
1
- /**
2
- * API Client Utilities (Deprecated - Use /infrastructure/http instead)
3
- * @deprecated Import from @umituz/react-native-ai-generation-content/infrastructure/http instead
4
- */
5
-
6
- export type { RequestOptions, ApiResponse } from "../http/api-client.types";
7
- export {
8
- get,
9
- post,
10
- put,
11
- del,
12
- patch,
13
- fetchWithTimeout,
14
- buildQueryString,
15
- appendQueryParams,
16
- } from "../http";
@@ -1,12 +0,0 @@
1
- /**
2
- * Error Classifier Utility - Barrel Export
3
- * Classifies errors for retry and user feedback decisions
4
- */
5
-
6
- export { matchesPatterns, getStatusCode, logClassification } from "./classifier-helpers";
7
- export {
8
- classifyError,
9
- isTransientError,
10
- isPermanentError,
11
- } from "./error-classification";
12
- export { isResultNotReady } from "./result-polling";
@@ -1,11 +0,0 @@
1
- /**
2
- * Centralized Error Handling Utilities - Barrel Export
3
- * Provides consistent error handling patterns across the application
4
- */
5
-
6
- export type { AppError } from "./error-types";
7
- export { isError, isAppError } from "./error-types";
8
- export { getErrorMessage, createAppError } from "./error-extractors";
9
- export { withErrorHandling, safeExecute, logError } from "./error-handlers";
10
- export { isNetworkError, isValidationError, isAuthError } from "./error-classifiers";
11
- export { retryWithBackoff } from "./error-retry";
@@ -1,14 +0,0 @@
1
- /**
2
- * Error Message Extractor - Barrel Export
3
- * Extracts error messages from various API error formats
4
- */
5
-
6
- export type {
7
- FalErrorDetail,
8
- GenerationErrorTypeValue,
9
- GenerationError,
10
- } from "./extraction-types";
11
- export { GenerationErrorType } from "./extraction-types";
12
- export { createGenerationError, isGenerationError } from "./error-factory";
13
- export { checkFalApiError } from "./fal-error-checker";
14
- export { extractErrorMessage, getErrorTranslationKey } from "./message-extractor";