
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
@umituz/react-native-ai-generation-content
Advanced tools
Provider-agnostic AI generation orchestration for React Native with result preview components
Core business logic and type definitions.
The domain layer contains the core business logic, types, and interfaces that define the AI generation system. It is independent of any external dependencies and provides the foundation for the entire library.
// Generation status
enum GenerationStatus {
IDLE = 'idle',
PROCESSING = 'processing',
COMPLETED = 'completed',
FAILED = 'failed',
}
// Generation result
interface GenerationResult {
success: boolean;
output?: {
imageUrl?: string;
imageUrls?: string[];
videoUrl?: string;
audioUrl?: string;
thumbnailUrl?: string;
};
metadata?: GenerationMetadata;
error?: string;
}
// Generation request
interface GenerationRequest {
featureType: string;
inputData: any;
userId: string;
providerId?: string;
options?: Record<string, any>;
}
// Generation metadata
interface GenerationMetadata {
prompt?: string;
model?: string;
timestamp: string;
duration?: number;
[key: string]: any;
}
// Job status
enum JobStatus {
PENDING = 'pending',
PROCESSING = 'processing',
COMPLETED = 'completed',
FAILED = 'failed',
CANCELLED = 'cancelled',
}
// Job submission
interface JobSubmission {
jobId: string;
status: JobStatus;
result?: any;
error?: Error;
}
// Background job
interface BackgroundJob {
id: string;
featureType: string;
inputData: any;
userId: string;
status: JobStatus;
progress: number;
createdAt: string;
updatedAt: string;
result?: any;
error?: Error;
}
// Error types
enum AIErrorType {
INSUFFICIENT_CREDITS = 'INSUFFICIENT_CREDITS',
PROVIDER_ERROR = 'PROVIDER_ERROR',
NETWORK_ERROR = 'NETWORK_ERROR',
VALIDATION_ERROR = 'VALIDATION_ERROR',
TIMEOUT_ERROR = 'TIMEOUT_ERROR',
UNKNOWN_ERROR = 'UNKNOWN_ERROR',
}
// Error info
interface AIErrorInfo {
type: AIErrorType;
message: string;
details?: any;
timestamp: string;
}
// Error messages
interface AIErrorMessages {
[key: string]: string;
}
// Processing modes
type ImageProcessingMode =
| 'free'
| 'premium'
| 'prompt-required';
// Mode config
interface ModeConfig {
id: string;
name: string;
description: string;
mode: ImageProcessingMode;
creditCost: number;
promptRequired?: boolean;
}
// Mode catalog
interface ModeCatalog {
modes: ModeConfig[];
getMode(modeId: string): ModeConfig | undefined;
getFreeModes(): ModeConfig[];
getPremiumModes(): ModeConfig[];
getPromptRequiredModes(): ModeConfig[];
}
AI provider interface:
interface IAIProvider {
id: string;
name: string;
capabilities: ProviderCapabilities;
execute(request: GenerationRequest): Promise<GenerationResult>;
pollJob?(jobId: string): Promise<JobSubmission>;
}
interface ProviderCapabilities {
textToImage?: boolean;
textToVideo?: boolean;
textToVoice?: boolean;
imageToImage?: boolean;
faceSwap?: boolean;
// ... more capabilities
}
App services interface:
interface IAppServices {
networkService?: INetworkService;
creditService?: ICreditService;
paywallService?: IPaywallService;
authService?: IAuthService;
analyticsService?: IAnalyticsService;
}
interface INetworkService {
baseUrl: string;
apiKey?: string;
timeout?: number;
}
interface ICreditService {
checkCredits(userId: string, cost: number): Promise<boolean>;
deductCredits(userId: string, cost: number): Promise<void>;
}
interface IPaywallService {
showPaywall(): Promise<boolean>;
}
interface IAuthService {
getCurrentUser(): Promise<User | null>;
getToken(): Promise<string | null>;
}
interface IAnalyticsService {
trackEvent(event: string, properties?: any): Promise<void>;
}
Feature utilities interface:
interface IFeatureUtils {
showVideoGenerationSuccess?(options: VideoAlertFunction): Promise<void>;
showContentModerationWarning?(options: AlertFunction): Promise<void>;
}
interface GenerationCapability {
featureType: string;
supported: boolean;
provider?: string;
creditCost: number;
processingTime?: number;
}
interface GenerationProgress {
percent: number;
stage: string;
message: string;
timestamp: string;
}
interface PollingConfig {
maxAttempts: number;
interval: number;
timeout: number;
backoffMultiplier: number;
}
interface MiddlewareContext {
featureType: string;
inputData: any;
userId?: string;
options?: Record<string, any>;
}
interface MiddlewareResultContext extends MiddlewareContext {
result: GenerationResult;
duration: number;
}
interface MiddlewareErrorContext extends MiddlewareContext {
error: Error;
errorType: AIErrorType;
}
// Default polling config
const DEFAULT_POLLING_CONFIG: PollingConfig = {
maxAttempts: 30,
interval: 2000,
timeout: 60000,
backoffMultiplier: 1.5,
};
// Default progress stages
const DEFAULT_PROGRESS_STAGES = {
textToImage: [
{ stage: 'initializing', weight: 10 },
{ stage: 'processing', weight: 70 },
{ stage: 'finalizing', weight: 20 },
],
// ... more features
};
// Default queue config
const DEFAULT_QUEUE_CONFIG = {
concurrency: 3,
maxQueueSize: 100,
retryAttempts: 3,
};
// Default processing modes
const DEFAULT_PROCESSING_MODES: ModeConfig[] = [
{
id: 'free',
name: 'Free',
description: 'Free generation',
mode: 'free',
creditCost: 0,
},
{
id: 'premium',
name: 'Premium',
description: 'Premium quality',
mode: 'premium',
creditCost: 1,
},
// ... more modes
];
Get mode configuration:
import { getModeConfig } from '@umituz/react-native-ai-generation-content';
const config = getModeConfig('premium');
console.log('Premium mode costs:', config.creditCost, 'credits');
Get all free modes:
import { getFreeModes } from '@umituz/react-native-ai-generation-content';
const freeModes = getFreeModes();
console.log('Free modes:', freeModes);
Get all premium modes:
import { getPremiumModes } from '@umituz/react-native-ai-generation-content';
const premiumModes = getPremiumModes();
console.log('Premium modes:', premiumModes);
Get modes requiring prompts:
import { getPromptRequiredModes } from '@umituz/react-native-ai-generation-content';
const modes = getPromptRequiredModes();
console.log('Modes requiring prompts:', modes);
import { isJobComplete } from '@umituz/react-native-ai-generation-content';
if (isJobComplete(jobStatus)) {
console.log('Job is complete');
}
import { isJobProcessing } from '@umituz/react-native-ai-generation-content';
if (isJobProcessing(jobStatus)) {
console.log('Job is processing');
}
import { isJobFailed } from '@umituz/react-native-ai-generation-content';
if (isJobFailed(jobStatus)) {
console.log('Job failed');
}
The domain layer exports all core types:
// Core interfaces
export type {
IAIProvider,
IAppServices,
INetworkService,
ICreditService,
IPaywallService,
IAuthService,
IAnalyticsService,
IFeatureUtils,
};
// Core types
export type {
AIProviderConfig,
JobSubmission,
JobStatus,
AIJobStatusType,
AILogEntry,
SubscribeOptions,
RunOptions,
ImageFeatureType,
VideoFeatureType,
ImageFeatureInputData,
VideoFeatureInputData,
ProviderCapabilities,
ProviderProgressInfo,
};
// Entities
export type {
AIErrorInfo,
AIErrorMessages,
GenerationCapability,
GenerationStatus,
GenerationMetadata,
GenerationResult,
GenerationProgress,
GenerationRequest,
PollingConfig,
PollingState,
PollingOptions,
ProgressStageConfig,
ProgressConfig,
MiddlewareContext,
MiddlewareResultContext,
BeforeGenerateHook,
AfterGenerateHook,
GenerationMiddleware,
MiddlewareChain,
BackgroundJobStatus,
BackgroundJob,
AddJobInput,
UpdateJobInput,
JobExecutorConfig,
BackgroundQueueConfig,
GenerationMode,
};
// Enums
export { AIErrorType };
export { DEFAULT_POLLING_CONFIG, DEFAULT_PROGRESS_STAGES, DEFAULT_QUEUE_CONFIG };
export { DEFAULT_PROCESSING_MODES, getModeConfig, getFreeModes, getPremiumModes, getPromptRequiredModes };
MIT
FAQs
Provider-agnostic AI generation orchestration for React Native with result preview components
We found that @umituz/react-native-ai-generation-content demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.