@umituz/react-native-ai-generation-content 1.83.1 → 1.83.2
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 +1 -1
- package/src/core/constants/duration-options.constants.ts +1 -0
- package/src/core/constants/index.ts +11 -44
- package/src/core/constants/preset-styles.constants.ts +1 -0
- package/src/core/constants/script-durations.constants.ts +5 -0
- package/src/core/constants/style-options.constants.ts +1 -0
- package/src/domains/access-control/hooks/useAIFeatureGate.ts +0 -1
- package/src/domains/background/infrastructure/services/job-poller.service.ts +0 -1
- package/src/domains/background/infrastructure/utils/result-validation-logic.ts +0 -1
- package/src/domains/content-moderation/infrastructure/services/moderators/text.moderator.ts +0 -1
- package/src/domains/creations/infrastructure/repositories/CreationsQuery.ts +0 -1
- package/src/domains/creations/infrastructure/repositories/CreationsSubscription.ts +0 -1
- package/src/domains/creations/infrastructure/repositories/creation-error-handler.util.ts +0 -1
- package/src/domains/creations/infrastructure/repositories/creation-update.operations.ts +0 -1
- package/src/domains/creations/presentation/components/GalleryHeader.tsx +0 -1
- package/src/domains/creations/presentation/hooks/useCreationPersistence.ts +0 -1
- package/src/domains/creations/presentation/hooks/useCreationRating.ts +0 -1
- package/src/domains/creations/presentation/hooks/useCreations.ts +0 -1
- package/src/domains/creations/presentation/hooks/useDeleteCreation.ts +0 -1
- package/src/domains/creations/presentation/hooks/useGalleryCallbacks.ts +0 -1
- package/src/domains/creations/presentation/hooks/useProcessingJobsPoller.ts +0 -1
- package/src/domains/generation/application/feature-registry.ts +0 -1
- package/src/domains/generation/application/generation-strategy.factory.ts +0 -1
- package/src/domains/generation/infrastructure/executors/executor-factory.ts +0 -1
- package/src/domains/generation/infrastructure/executors/image-executor.ts +0 -1
- package/src/domains/generation/infrastructure/executors/text-to-image-executor.ts +0 -1
- package/src/domains/generation/infrastructure/executors/video-executor.ts +0 -1
- package/src/domains/generation/infrastructure/flow/useFlowStore.ts +0 -1
- package/src/domains/generation/presentation/useAIGeneration.hook.ts +0 -1
- package/src/domains/generation/wizard/infrastructure/strategies/image-generation.executor.ts +0 -1
- package/src/domains/generation/wizard/infrastructure/strategies/shared/photo-extraction.utils.ts +0 -1
- package/src/domains/generation/wizard/infrastructure/strategies/video-generation.executor.ts +0 -1
- package/src/domains/generation/wizard/infrastructure/strategies/video-generation.strategy.ts +0 -1
- package/src/domains/generation/wizard/infrastructure/strategies/video-generation.utils.ts +0 -1
- package/src/domains/generation/wizard/infrastructure/utils/creation-save-operations.ts +0 -1
- package/src/domains/generation/wizard/infrastructure/utils/creation-update-operations.ts +0 -1
- package/src/domains/generation/wizard/presentation/components/GenericWizardFlow.tsx +0 -1
- package/src/domains/generation/wizard/presentation/components/step-renderers/renderSelectionStep.tsx +0 -1
- package/src/domains/generation/wizard/presentation/hooks/generationExecutor.ts +0 -1
- package/src/domains/generation/wizard/presentation/hooks/usePhotoBlockingGeneration.ts +0 -1
- package/src/domains/generation/wizard/presentation/hooks/usePhotoUploadState.ts +0 -1
- package/src/domains/generation/wizard/presentation/hooks/useVideoQueueGeneration.ts +0 -1
- package/src/domains/generation/wizard/presentation/hooks/videoQueuePoller.ts +0 -1
- package/src/domains/generation/wizard/presentation/screens/SelectionScreen.tsx +0 -1
- package/src/domains/generation/wizard/presentation/utilities/validateScenario.ts +0 -1
- package/src/domains/image-to-video/presentation/hooks/imageToVideoStrategy.ts +0 -1
- package/src/domains/image-to-video/presentation/hooks/useImageToVideoForm.ts +0 -1
- package/src/domains/result-preview/presentation/hooks/useResultActions.ts +0 -1
- package/src/domains/scenarios/configs/wizard-config-resolver.ts +0 -1
- package/src/domains/scenarios/infrastructure/scenario-registry.ts +0 -1
- package/src/domains/text-to-image/presentation/hooks/useGeneration.ts +0 -1
- package/src/domains/text-to-video/infrastructure/services/text-to-video-executor.ts +0 -1
- package/src/domains/text-to-video/presentation/hooks/textToVideoStrategy.ts +0 -1
- package/src/domains/text-to-video/presentation/hooks/useTextToVideoForm.ts +0 -1
- package/src/infrastructure/config/app-services.config.ts +0 -1
- package/src/infrastructure/executors/base-executor.ts +0 -1
- package/src/infrastructure/http/http-fetch-handler.ts +1 -2
- package/src/infrastructure/logging/debug.util.ts +2 -3
- package/src/infrastructure/logging/index.ts +1 -1
- package/src/infrastructure/providers/generation-config.provider.tsx +0 -1
- package/src/infrastructure/services/generation-orchestrator.service.ts +0 -1
- package/src/infrastructure/services/multi-image-generation.executor.ts +0 -1
- package/src/infrastructure/services/provider-registry.service.ts +0 -2
- package/src/infrastructure/services/provider-validator.ts +0 -1
- package/src/infrastructure/utils/classifier-helpers.ts +0 -1
- package/src/infrastructure/utils/error-classification.ts +0 -1
- package/src/infrastructure/utils/error-handlers.ts +1 -2
- package/src/infrastructure/utils/error-retry.ts +1 -1
- package/src/infrastructure/utils/feature-utils.ts +0 -1
- package/src/infrastructure/utils/index.ts +0 -1
- package/src/infrastructure/utils/message-extractor.ts +18 -1
- package/src/infrastructure/utils/provider-validator.util.ts +0 -1
- package/src/infrastructure/utils/url-extractor/rule-executor.ts +0 -1
- package/src/presentation/components/buttons/GenerateButton.tsx +0 -1
- package/src/presentation/hooks/generation/orchestrator.ts +0 -1
- package/src/presentation/hooks/generation/useImagePicker.ts +0 -1
- package/src/core/constants/model.constants.ts +0 -11
- package/src/core/constants/text-to-image-models.constants.ts +0 -18
- package/src/infrastructure/logging/logger.ts +0 -174
- package/src/infrastructure/utils/error-extractors.ts +0 -24
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-ai-generation-content",
|
|
3
|
-
"version": "1.83.
|
|
3
|
+
"version": "1.83.2",
|
|
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",
|
|
@@ -1,49 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* AI Generation Constants
|
|
3
|
-
* Generic constants reusable across any AI generation app
|
|
4
3
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* Here we export the raw config constants (not UI-specific types).
|
|
4
|
+
* Generic, provider-agnostic constants — single source of truth for all apps.
|
|
5
|
+
* Model IDs and pricing are NOT here: those are always app-level decisions.
|
|
8
6
|
*/
|
|
9
7
|
|
|
10
|
-
|
|
11
|
-
export
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
export
|
|
18
|
-
|
|
19
|
-
// Video duration options
|
|
20
|
-
export {
|
|
21
|
-
VIDEO_DURATION,
|
|
22
|
-
VIDEO_DURATION_OPTIONS,
|
|
23
|
-
VIDEO_DURATION_OPTIONS_WITH_LABELS,
|
|
24
|
-
VIDEO_ASPECT_RATIO,
|
|
25
|
-
VIDEO_ASPECT_RATIO_OPTIONS,
|
|
26
|
-
} from "./video.constants";
|
|
27
|
-
export type { VideoAspectRatio } from "./video.constants";
|
|
28
|
-
|
|
29
|
-
// Image constants
|
|
30
|
-
export {
|
|
31
|
-
IMAGE_SIZE,
|
|
32
|
-
DEFAULT_NUM_IMAGES,
|
|
33
|
-
DEFAULT_IMAGE_GUIDANCE_SCALE,
|
|
34
|
-
} from "./image.constants";
|
|
35
|
-
|
|
36
|
-
// Aspect ratio config
|
|
37
|
-
export { ASPECT_RATIO, DEFAULT_IMAGE_SIZES } from "./aspect-ratio.constants";
|
|
38
|
-
|
|
39
|
-
// Status constants
|
|
40
|
-
export { FAL_AI_STATUS, CREATION_STATUS, PROVIDER } from "./status.constants";
|
|
41
|
-
|
|
42
|
-
// Validation limits
|
|
43
|
-
export { VALIDATION_LIMITS } from "./validation.constants";
|
|
44
|
-
|
|
45
|
-
// Polling config
|
|
46
|
-
export { POLLING_CONFIG } from "./polling.constants";
|
|
47
|
-
|
|
48
|
-
// Animation style options
|
|
49
|
-
export { ANIMATION_STYLE } from "./animation.constants";
|
|
8
|
+
export * from "./video.constants";
|
|
9
|
+
export * from "./aspect-ratio.constants";
|
|
10
|
+
export * from "./image.constants";
|
|
11
|
+
export * from "./animation.constants";
|
|
12
|
+
export * from "./validation.constants";
|
|
13
|
+
export * from "./preset-styles.constants";
|
|
14
|
+
export * from "./style-options.constants";
|
|
15
|
+
export * from "./duration-options.constants";
|
|
16
|
+
export * from "./script-durations.constants";
|
|
@@ -10,7 +10,6 @@ import { checkStatusForErrors, isJobComplete } from "../utils/status-checker.uti
|
|
|
10
10
|
import { validateResult } from "../utils/result-validator.util";
|
|
11
11
|
import type { PollJobOptions, PollJobResult } from "./job-poller.types";
|
|
12
12
|
|
|
13
|
-
declare const __DEV__: boolean;
|
|
14
13
|
|
|
15
14
|
/**
|
|
16
15
|
* Wraps a promise with abort signal support
|
|
@@ -11,7 +11,6 @@ import { DEFAULT_MAX_TEXT_LENGTH } from "../../constants/moderation.constants";
|
|
|
11
11
|
import { containsMaliciousPatterns } from "../../utils/content-security.util";
|
|
12
12
|
import { containsPromptInjection } from "../../utils/prompt-injection.util";
|
|
13
13
|
|
|
14
|
-
declare const __DEV__: boolean;
|
|
15
14
|
|
|
16
15
|
class TextModerator extends BaseModerator {
|
|
17
16
|
private maxLength = DEFAULT_MAX_TEXT_LENGTH;
|
|
@@ -10,7 +10,6 @@ import type { DocumentMapper } from "../../domain/value-objects/CreationsConfig"
|
|
|
10
10
|
import type { Creation, CreationDocument } from "../../domain/entities/Creation";
|
|
11
11
|
import { CREATION_FIELDS } from "../../domain/constants";
|
|
12
12
|
|
|
13
|
-
declare const __DEV__: boolean;
|
|
14
13
|
|
|
15
14
|
export class CreationsQuery {
|
|
16
15
|
constructor(
|
|
@@ -11,7 +11,6 @@ import type { CreationDocument } from "../../domain/entities/Creation";
|
|
|
11
11
|
import type { CreationsSubscriptionCallback, UnsubscribeFunction } from "../../domain/repositories/ICreationsRepository";
|
|
12
12
|
import { CREATION_FIELDS } from "../../domain/constants";
|
|
13
13
|
|
|
14
|
-
declare const __DEV__: boolean;
|
|
15
14
|
|
|
16
15
|
export class CreationsSubscription {
|
|
17
16
|
constructor(
|
|
@@ -7,7 +7,6 @@ import type { IPathResolver } from "@umituz/react-native-firebase";
|
|
|
7
7
|
import type { Creation } from "../../domain/entities/Creation";
|
|
8
8
|
import { UPDATABLE_FIELDS } from "../../domain/constants";
|
|
9
9
|
|
|
10
|
-
declare const __DEV__: boolean;
|
|
11
10
|
|
|
12
11
|
export { UPDATABLE_FIELDS };
|
|
13
12
|
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
|
|
5
5
|
import { useCallback, useMemo } from "react";
|
|
6
6
|
|
|
7
|
-
declare const __DEV__: boolean;
|
|
8
7
|
import { useAuth } from "@umituz/react-native-auth";
|
|
9
8
|
import { createCreationsRepository } from "../../infrastructure/adapters";
|
|
10
9
|
import type { Creation } from "../../domain/entities/Creation";
|
|
@@ -8,7 +8,6 @@ import { useState, useEffect, useCallback } from "react";
|
|
|
8
8
|
import type { ICreationsRepository } from "../../domain/repositories/ICreationsRepository";
|
|
9
9
|
import type { Creation } from "../../domain/entities/Creation";
|
|
10
10
|
|
|
11
|
-
declare const __DEV__: boolean;
|
|
12
11
|
|
|
13
12
|
interface UseCreationsProps {
|
|
14
13
|
readonly userId: string | null;
|
|
@@ -16,7 +16,6 @@ import {
|
|
|
16
16
|
import type { Creation } from "../../domain/entities/Creation";
|
|
17
17
|
import type { ICreationsRepository } from "../../domain/repositories/ICreationsRepository";
|
|
18
18
|
|
|
19
|
-
declare const __DEV__: boolean;
|
|
20
19
|
|
|
21
20
|
export interface UseProcessingJobsPollerConfig {
|
|
22
21
|
readonly userId?: string | null;
|
|
@@ -12,7 +12,6 @@ import type {
|
|
|
12
12
|
import { ExecutorFactory } from "../infrastructure/executors/executor-factory";
|
|
13
13
|
import { featureRegistry } from "./feature-registry";
|
|
14
14
|
|
|
15
|
-
declare const __DEV__: boolean;
|
|
16
15
|
|
|
17
16
|
interface CreationRepository {
|
|
18
17
|
create(userId: string, creation: unknown): Promise<void>;
|
|
@@ -8,7 +8,6 @@ import { ImageExecutor } from "./image-executor";
|
|
|
8
8
|
import { VideoExecutor } from "./video-executor";
|
|
9
9
|
import { TextToImageExecutor } from "./text-to-image-executor";
|
|
10
10
|
|
|
11
|
-
declare const __DEV__: boolean;
|
|
12
11
|
|
|
13
12
|
export type GenerationType = "image" | "video" | "text-to-image" | "text-to-video" | "image-to-video" | "meme";
|
|
14
13
|
|
|
@@ -13,7 +13,6 @@ import type { GenerationResult } from "../../../../domain/entities/generation.ty
|
|
|
13
13
|
import { providerRegistry } from "../../../../infrastructure/services/provider-registry.service";
|
|
14
14
|
import { env } from "../../../../infrastructure/config/env.config";
|
|
15
15
|
|
|
16
|
-
declare const __DEV__: boolean;
|
|
17
16
|
|
|
18
17
|
export class ImageExecutor
|
|
19
18
|
implements GenerationExecutor<ImageGenerationInput, ImageGenerationOutput>
|
|
@@ -12,7 +12,6 @@ import { providerRegistry } from "../../../../infrastructure/services/provider-r
|
|
|
12
12
|
import type { TextToImageInput, TextToImageOutput } from "./text-to-image-executor.types";
|
|
13
13
|
import { buildModelInput, extractResult } from "./text-to-image-executor.helpers";
|
|
14
14
|
|
|
15
|
-
declare const __DEV__: boolean;
|
|
16
15
|
|
|
17
16
|
export class TextToImageExecutor
|
|
18
17
|
implements GenerationExecutor<TextToImageInput, TextToImageOutput>
|
|
@@ -13,7 +13,6 @@ import type { GenerationResult } from "../../../../domain/entities/generation.ty
|
|
|
13
13
|
import { providerRegistry } from "../../../../infrastructure/services/provider-registry.service";
|
|
14
14
|
import { env } from "../../../../infrastructure/config/env.config";
|
|
15
15
|
|
|
16
|
-
declare const __DEV__: boolean;
|
|
17
16
|
|
|
18
17
|
export class VideoExecutor
|
|
19
18
|
implements GenerationExecutor<VideoGenerationInput, VideoGenerationOutput>
|
|
@@ -9,7 +9,6 @@ import type { AlertMessages } from "../../../presentation/hooks/generation/types
|
|
|
9
9
|
import { DEFAULT_ALERT_MESSAGES } from "../../../presentation/constants/alert-messages";
|
|
10
10
|
import { createGenerationStrategy } from "../application/generation-strategy.factory";
|
|
11
11
|
|
|
12
|
-
declare const __DEV__: boolean;
|
|
13
12
|
|
|
14
13
|
// ============================================================================
|
|
15
14
|
// Types
|
package/src/domains/generation/wizard/infrastructure/strategies/video-generation.executor.ts
CHANGED
|
@@ -10,7 +10,6 @@ import type { VideoModelConfig } from "../../../../../domain/interfaces/video-mo
|
|
|
10
10
|
import { GENERATION_TIMEOUT_MS, BASE64_IMAGE_PREFIX } from "./wizard-strategy.constants";
|
|
11
11
|
import { createGenerationError, GenerationErrorType } from "../../../../../infrastructure/utils/error-factory";
|
|
12
12
|
|
|
13
|
-
declare const __DEV__: boolean;
|
|
14
13
|
|
|
15
14
|
interface ExecutionResult {
|
|
16
15
|
success: boolean;
|
package/src/domains/generation/wizard/infrastructure/strategies/video-generation.strategy.ts
CHANGED
|
@@ -13,7 +13,6 @@ import type { WizardVideoInput, CreateVideoStrategyOptions } from "./video-gener
|
|
|
13
13
|
import { validatePhotoCount, validateWizardVideoInput } from "./video-generation.types";
|
|
14
14
|
import { executeVideoGeneration, submitVideoGenerationToQueue } from "./video-generation.executor";
|
|
15
15
|
|
|
16
|
-
declare const __DEV__: boolean;
|
|
17
16
|
|
|
18
17
|
export type { WizardVideoInput, WizardVideoResult, CreateVideoStrategyOptions } from "./video-generation.types";
|
|
19
18
|
|
|
@@ -7,7 +7,6 @@ import type { VideoFeatureType } from "../../../../../domain/interfaces";
|
|
|
7
7
|
import type { WizardScenarioData } from "../../presentation/hooks/wizard-generation.types";
|
|
8
8
|
import { VIDEO_FEATURE_PATTERNS } from "./wizard-strategy.constants";
|
|
9
9
|
|
|
10
|
-
declare const __DEV__: boolean;
|
|
11
10
|
|
|
12
11
|
/**
|
|
13
12
|
* Determines the video feature type from scenario
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
import type { ICreationsRepository } from "../../../../creations/domain/repositories";
|
|
7
7
|
import type { ProcessingCreationData } from "./creation-persistence.types";
|
|
8
8
|
|
|
9
|
-
declare const __DEV__: boolean;
|
|
10
9
|
|
|
11
10
|
/**
|
|
12
11
|
* Save creation with status="processing" when generation starts
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
import type { ICreationsRepository } from "../../../../creations/domain/repositories";
|
|
7
7
|
import type { CompletedCreationData } from "./creation-persistence.types";
|
|
8
8
|
|
|
9
|
-
declare const __DEV__: boolean;
|
|
10
9
|
|
|
11
10
|
/**
|
|
12
11
|
* Update creation to status="completed" when generation finishes
|
|
@@ -2,7 +2,6 @@ import { buildWizardInput } from "../../infrastructure/strategies";
|
|
|
2
2
|
import type { WizardScenarioData } from "./wizard-generation.types";
|
|
3
3
|
import type { GenerationAction } from "./generationStateMachine";
|
|
4
4
|
|
|
5
|
-
declare const __DEV__: boolean;
|
|
6
5
|
|
|
7
6
|
interface ExecuteGenerationParams {
|
|
8
7
|
wizardData: Record<string, unknown>;
|
|
@@ -13,7 +13,6 @@ import type { WizardStrategy } from "../../infrastructure/strategies/wizard-stra
|
|
|
13
13
|
import type { WizardScenarioData } from "./wizard-generation.types";
|
|
14
14
|
import type { AlertMessages } from "../../../../../presentation/hooks/generation/types";
|
|
15
15
|
|
|
16
|
-
declare const __DEV__: boolean;
|
|
17
16
|
|
|
18
17
|
export interface UsePhotoBlockingGenerationProps {
|
|
19
18
|
readonly userId?: string;
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
|
|
7
7
|
import { useState, useCallback, useEffect, useRef } from "react";
|
|
8
8
|
|
|
9
|
-
declare const __DEV__: boolean;
|
|
10
9
|
import { useMedia, MediaQuality, MediaValidationError, MEDIA_CONSTANTS } from "@umituz/react-native-design-system";
|
|
11
10
|
import type { UploadedImage } from "../../../../../presentation/hooks/generation/useAIGenerateState";
|
|
12
11
|
|
|
@@ -3,7 +3,6 @@ import { extractResultUrl, type GenerationUrls, type GenerationResult } from "./
|
|
|
3
3
|
import { QUEUE_STATUS } from "../../../../../domain/constants/queue-status.constants";
|
|
4
4
|
import { DEFAULT_MAX_CONSECUTIVE_ERRORS } from "../../../../../infrastructure/constants/polling.constants";
|
|
5
5
|
|
|
6
|
-
declare const __DEV__: boolean;
|
|
7
6
|
|
|
8
7
|
/**
|
|
9
8
|
* Extract meaningful error message from various error formats.
|
|
@@ -9,7 +9,6 @@ import { WizardInputType, type WizardConfigOptions } from "./wizard-input.types"
|
|
|
9
9
|
import { detectWizardInputType, SCENARIO_TO_WIZARD_INPUT_MAP } from "./wizard-input-detector";
|
|
10
10
|
import { getConfigFactory } from "./wizard-step-factories";
|
|
11
11
|
|
|
12
|
-
declare const __DEV__: boolean;
|
|
13
12
|
|
|
14
13
|
const scenarioWizardConfigs: Record<string, WizardFeatureConfig> = {};
|
|
15
14
|
|
|
@@ -7,7 +7,6 @@ import { failure, success, type Result } from "../../domain/types/result.types";
|
|
|
7
7
|
import type { IAIProvider } from "../../domain/interfaces";
|
|
8
8
|
import type { BaseExecutorOptions } from "./base-executor.types";
|
|
9
9
|
|
|
10
|
-
declare const __DEV__: boolean;
|
|
11
10
|
|
|
12
11
|
export abstract class BaseExecutor<TRequest, TResult, TOutput> {
|
|
13
12
|
protected readonly logPrefix: string;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { withErrorHandling } from "../utils/error-handlers";
|
|
7
|
-
import { getErrorMessage } from "../utils/
|
|
7
|
+
import { getErrorMessage } from "../utils/message-extractor";
|
|
8
8
|
import { retryWithBackoff } from "../utils/error-retry";
|
|
9
9
|
import { isNetworkError } from "../utils/error-classifiers";
|
|
10
10
|
import { env } from "../config/env.config";
|
|
@@ -12,7 +12,6 @@ import type { RequestOptions, ApiResponse } from "./api-client.types";
|
|
|
12
12
|
import { executeRequest, isSuccessResponse, extractErrorMessage } from "./http-request-executor";
|
|
13
13
|
import { parseResponse, createSuccessResponse, createErrorResponse } from "./http-response-parser";
|
|
14
14
|
|
|
15
|
-
declare const __DEV__: boolean;
|
|
16
15
|
|
|
17
16
|
/**
|
|
18
17
|
* Fetches data with timeout, retry, and error handling
|
|
@@ -9,9 +9,8 @@ export interface DebugOptions {
|
|
|
9
9
|
readonly tag?: string;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const isDev = typeof __DEV__ !== "undefined" && __DEV__;
|
|
12
|
+
/** Single source of truth for development environment detection */
|
|
13
|
+
export const isDev = typeof __DEV__ !== "undefined" && __DEV__;
|
|
15
14
|
|
|
16
15
|
function formatMessage(tag: string | undefined, message: string): string {
|
|
17
16
|
return tag ? `[${tag}] ${message}` : message;
|
|
@@ -13,7 +13,6 @@ 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
|
|
|
16
|
-
declare const __DEV__: boolean;
|
|
17
16
|
|
|
18
17
|
export interface OrchestratorConfig {
|
|
19
18
|
polling?: Partial<PollingConfig>;
|
|
@@ -8,7 +8,6 @@ import { formatBase64 } from "../utils/base64.util";
|
|
|
8
8
|
import { validateURL } from "../validation/base-validator";
|
|
9
9
|
import { env } from "../config/env.config";
|
|
10
10
|
|
|
11
|
-
declare const __DEV__: boolean;
|
|
12
11
|
|
|
13
12
|
/** Generation timeout in milliseconds */
|
|
14
13
|
const GENERATION_TIMEOUT_MS = env.generationMultiImageTimeoutMs;
|
|
@@ -13,7 +13,6 @@ import {
|
|
|
13
13
|
} from "./error-patterns.constants";
|
|
14
14
|
import { matchesPatterns, getStatusCode, logClassification } from "./classifier-helpers";
|
|
15
15
|
|
|
16
|
-
declare const __DEV__: boolean;
|
|
17
16
|
|
|
18
17
|
export function classifyError(error: unknown): AIErrorInfo {
|
|
19
18
|
const message = error instanceof Error ? error.message : String(error);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Error Handling Utilities
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import { getErrorMessage } from "./
|
|
5
|
+
import { getErrorMessage } from "./message-extractor";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Sanitizes error message to prevent information disclosure
|
|
@@ -50,5 +50,4 @@ export async function withErrorHandling<T>(
|
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
declare const __DEV__: boolean;
|
|
54
53
|
|
|
@@ -7,7 +7,6 @@ import { readFileAsBase64 } from "@umituz/react-native-design-system";
|
|
|
7
7
|
import { getAuthService, getCreditService, getPaywallService, isAppServicesConfigured } from "../config/app-services.config";
|
|
8
8
|
import { env } from "../config/env.config";
|
|
9
9
|
|
|
10
|
-
declare const __DEV__: boolean;
|
|
11
10
|
|
|
12
11
|
export type ImageSelector = () => Promise<string | null>;
|
|
13
12
|
export type VideoSaver = (uri: string) => Promise<void>;
|
|
@@ -4,7 +4,24 @@
|
|
|
4
4
|
|
|
5
5
|
import { GenerationErrorType, isGenerationError } from "./error-factory";
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Safely extracts error message from unknown error type
|
|
9
|
+
* Generic utility for any error - no domain-specific logic
|
|
10
|
+
*/
|
|
11
|
+
export function getErrorMessage(error: unknown, prefix?: string): string {
|
|
12
|
+
let message = "An unknown error occurred";
|
|
13
|
+
|
|
14
|
+
if (error instanceof Error) {
|
|
15
|
+
message = error.message;
|
|
16
|
+
} else if (typeof error === "string") {
|
|
17
|
+
message = error;
|
|
18
|
+
} else if (error && typeof error === "object" && "message" in error) {
|
|
19
|
+
message = String((error as { message: unknown }).message);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return prefix ? `${prefix}: ${message}` : message;
|
|
23
|
+
}
|
|
24
|
+
|
|
8
25
|
|
|
9
26
|
/**
|
|
10
27
|
* Get translation key from error (returns key if GenerationError, null otherwise)
|
|
@@ -7,7 +7,6 @@ import { providerRegistry } from "../services/provider-registry.service";
|
|
|
7
7
|
import { cleanBase64 } from "./index";
|
|
8
8
|
import type { IAIProvider, VideoFeatureInputData, ImageFeatureInputData } from "../../domain/interfaces";
|
|
9
9
|
|
|
10
|
-
declare const __DEV__: boolean;
|
|
11
10
|
|
|
12
11
|
export type ProviderValidationResult =
|
|
13
12
|
| { success: true; provider: IAIProvider }
|
|
@@ -7,7 +7,6 @@ import { useState, useCallback } from "react";
|
|
|
7
7
|
import { MediaPickerService, MediaQuality } from "@umituz/react-native-design-system";
|
|
8
8
|
import { prepareImage } from "../../../infrastructure/utils/feature-utils";
|
|
9
9
|
|
|
10
|
-
declare const __DEV__: boolean;
|
|
11
10
|
|
|
12
11
|
export interface ImagePickerState {
|
|
13
12
|
readonly uri: string | null;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* AI Model Constants
|
|
3
|
-
* Single Source of Truth for all AI model IDs
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
export const DEFAULT_MODELS = {
|
|
7
|
-
TEXT_TO_IMAGE: "xai/grok-imagine-image",
|
|
8
|
-
TEXT_TO_VIDEO: "fal-ai/ltx-video",
|
|
9
|
-
IMAGE_TO_VIDEO: "fal-ai/ltx-video",
|
|
10
|
-
SCENARIO_VIDEO: "fal-ai/ltx-video",
|
|
11
|
-
} as const;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Text-to-Image Models Configuration
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import type { FalModelConfig } from "@umituz/react-native-ai-fal-provider";
|
|
6
|
-
|
|
7
|
-
export const TEXT_TO_IMAGE_MODELS: FalModelConfig[] = [
|
|
8
|
-
{
|
|
9
|
-
id: "xai/grok-imagine-image",
|
|
10
|
-
name: "Grok Imagine",
|
|
11
|
-
type: "text-to-image",
|
|
12
|
-
isDefault: true,
|
|
13
|
-
isActive: true,
|
|
14
|
-
pricing: { freeUserCost: 0.5, premiumUserCost: 0.25 },
|
|
15
|
-
description: "X.AI's cost-effective text-to-image generation ($0.02/image)",
|
|
16
|
-
order: 1,
|
|
17
|
-
},
|
|
18
|
-
];
|
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Production-Ready Logging Utility
|
|
3
|
-
* Provides structured logging with levels and context
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
declare const __DEV__: boolean;
|
|
7
|
-
|
|
8
|
-
export enum LogLevel {
|
|
9
|
-
DEBUG = 0,
|
|
10
|
-
INFO = 1,
|
|
11
|
-
WARN = 2,
|
|
12
|
-
ERROR = 3,
|
|
13
|
-
NONE = 4,
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export interface LogContext {
|
|
17
|
-
readonly [key: string]: unknown;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export interface LogEntry {
|
|
21
|
-
readonly level: LogLevel;
|
|
22
|
-
readonly timestamp: number;
|
|
23
|
-
readonly message: string;
|
|
24
|
-
readonly context?: LogContext;
|
|
25
|
-
readonly error?: Error;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
class Logger {
|
|
29
|
-
private minLevel: LogLevel;
|
|
30
|
-
private logs: LogEntry[] = [];
|
|
31
|
-
private maxLogs = 1000;
|
|
32
|
-
|
|
33
|
-
constructor() {
|
|
34
|
-
// In production, only log WARN and ERROR
|
|
35
|
-
this.minLevel =
|
|
36
|
-
typeof __DEV__ !== "undefined" && __DEV__ ? LogLevel.DEBUG : LogLevel.WARN;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
setMinLevel(level: LogLevel): void {
|
|
40
|
-
this.minLevel = level;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
private shouldLog(level: LogLevel): boolean {
|
|
44
|
-
return level >= this.minLevel;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
private addLog(entry: LogEntry): void {
|
|
48
|
-
this.logs.push(entry);
|
|
49
|
-
// Keep only last maxLogs entries
|
|
50
|
-
if (this.logs.length > this.maxLogs) {
|
|
51
|
-
this.logs.shift();
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
debug(message: string, context?: LogContext): void {
|
|
56
|
-
if (!this.shouldLog(LogLevel.DEBUG)) return;
|
|
57
|
-
|
|
58
|
-
const entry: LogEntry = {
|
|
59
|
-
level: LogLevel.DEBUG,
|
|
60
|
-
timestamp: Date.now(),
|
|
61
|
-
message,
|
|
62
|
-
context,
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
this.addLog(entry);
|
|
66
|
-
|
|
67
|
-
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
68
|
-
console.log(`[DEBUG] ${message}`, context || "");
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
info(message: string, context?: LogContext): void {
|
|
73
|
-
if (!this.shouldLog(LogLevel.INFO)) return;
|
|
74
|
-
|
|
75
|
-
const entry: LogEntry = {
|
|
76
|
-
level: LogLevel.INFO,
|
|
77
|
-
timestamp: Date.now(),
|
|
78
|
-
message,
|
|
79
|
-
context,
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
this.addLog(entry);
|
|
83
|
-
|
|
84
|
-
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
85
|
-
console.info(`[INFO] ${message}`, context || "");
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
warn(message: string, context?: LogContext): void {
|
|
90
|
-
if (!this.shouldLog(LogLevel.WARN)) return;
|
|
91
|
-
|
|
92
|
-
const entry: LogEntry = {
|
|
93
|
-
level: LogLevel.WARN,
|
|
94
|
-
timestamp: Date.now(),
|
|
95
|
-
message,
|
|
96
|
-
context,
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
this.addLog(entry);
|
|
100
|
-
console.warn(`[WARN] ${message}`, context || "");
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
error(message: string, error?: Error | unknown, context?: LogContext): void {
|
|
104
|
-
if (!this.shouldLog(LogLevel.ERROR)) return;
|
|
105
|
-
|
|
106
|
-
const errorObj =
|
|
107
|
-
error instanceof Error ? error : error ? new Error(String(error)) : undefined;
|
|
108
|
-
|
|
109
|
-
const entry: LogEntry = {
|
|
110
|
-
level: LogLevel.ERROR,
|
|
111
|
-
timestamp: Date.now(),
|
|
112
|
-
message,
|
|
113
|
-
context,
|
|
114
|
-
error: errorObj,
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
this.addLog(entry);
|
|
118
|
-
console.error(`[ERROR] ${message}`, errorObj || "", context || "");
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
getLogs(level?: LogLevel): readonly LogEntry[] {
|
|
122
|
-
if (level !== undefined) {
|
|
123
|
-
return this.logs.filter((log) => log.level >= level);
|
|
124
|
-
}
|
|
125
|
-
return this.logs;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
clearLogs(): void {
|
|
129
|
-
this.logs = [];
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
// Convenience methods for specific domains
|
|
133
|
-
processing(message: string, context?: LogContext): void {
|
|
134
|
-
this.debug(`[Processing] ${message}`, context);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
generation(message: string, context?: LogContext): void {
|
|
138
|
-
this.debug(`[Generation] ${message}`, context);
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
polling(message: string, context?: LogContext): void {
|
|
142
|
-
this.debug(`[Polling] ${message}`, context);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
moderation(message: string, context?: LogContext): void {
|
|
146
|
-
this.info(`[Moderation] ${message}`, context);
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
network(message: string, context?: LogContext): void {
|
|
150
|
-
this.info(`[Network] ${message}`, context);
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
storage(message: string, context?: LogContext): void {
|
|
154
|
-
this.debug(`[Storage] ${message}`, context);
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
validation(message: string, context?: LogContext): void {
|
|
158
|
-
this.warn(`[Validation] ${message}`, context);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
// Singleton instance
|
|
163
|
-
export const logger = new Logger();
|
|
164
|
-
|
|
165
|
-
// Development helper
|
|
166
|
-
export function setDevelopmentMode(): void {
|
|
167
|
-
logger.setMinLevel(LogLevel.DEBUG);
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
// Production helper
|
|
171
|
-
export function setProductionMode(): void {
|
|
172
|
-
logger.setMinLevel(LogLevel.WARN);
|
|
173
|
-
}
|
|
174
|
-
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Error Message Extraction
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Safely extracts error message from unknown error type
|
|
7
|
-
* @param error - The error to extract message from
|
|
8
|
-
* @param prefix - Optional prefix to prepend to error message
|
|
9
|
-
* @returns The extracted error message with optional prefix
|
|
10
|
-
*/
|
|
11
|
-
export function getErrorMessage(error: unknown, prefix?: string): string {
|
|
12
|
-
let message = "An unknown error occurred";
|
|
13
|
-
|
|
14
|
-
if (error instanceof Error) {
|
|
15
|
-
message = error.message;
|
|
16
|
-
} else if (typeof error === "string") {
|
|
17
|
-
message = error;
|
|
18
|
-
} else if (error && typeof error === "object" && "message" in error) {
|
|
19
|
-
message = String(error.message);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
return prefix ? `${prefix}: ${message}` : message;
|
|
23
|
-
}
|
|
24
|
-
|