@umituz/react-native-ai-generation-content 1.90.22 → 1.90.23
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 +2 -1
- package/src/domains/access-control/hooks/useAIFeatureGate.ts +2 -2
- package/src/domains/background/infrastructure/utils/polling-interval.util.ts +1 -1
- package/src/domains/background/presentation/hooks/use-background-generation.ts +1 -1
- package/src/domains/creations/presentation/components/CreationCard.utils.ts +1 -1
- package/src/domains/creations/presentation/components/CreationImagePreview.tsx +2 -18
- package/src/domains/creations/presentation/hooks/filterHelpers.ts +1 -1
- package/src/domains/creations/presentation/hooks/job-poller-utils.stale-handlers.ts +1 -1
- package/src/domains/creations/presentation/hooks/useProcessingJobsPoller.ts +1 -1
- package/src/domains/creations/presentation/screens/CreationsGalleryScreen.tsx +1 -1
- package/src/infrastructure/utils/photo-generation/photo-preparation.util.ts +1 -1
- package/src/infrastructure/validation/base-validator.ts +3 -2
- package/src/presentation/hooks/generation/orchestrator.ts +0 -1
- package/src/core/constants/index.ts +0 -16
- package/src/core/index.ts +0 -68
- package/src/domain/entities/index.ts +0 -11
- package/src/domain/interfaces/index.ts +0 -13
- package/src/domains/creations/index.ts +0 -13
- package/src/domains/image-to-video/domain/index.ts +0 -6
- package/src/domains/shared/index.ts +0 -6
- package/src/domains/text-to-image/domain/index.ts +0 -7
- package/src/domains/text-to-image/index.ts +0 -18
- package/src/domains/text-to-image/presentation/index.ts +0 -7
- package/src/domains/text-to-video/domain/index.ts +0 -6
- package/src/infrastructure/constants/index.ts +0 -9
- package/src/infrastructure/utils/index.ts +0 -24
- package/src/presentation/components/headers/index.ts +0 -3
- package/src/presentation/components/index.ts +0 -34
- package/src/presentation/components/selectors/factories/index.ts +0 -8
- package/src/presentation/components/selectors/index.ts +0 -21
- package/src/shared/components/index.ts +0 -5
- package/src/shared/hooks/index.ts +0 -6
- package/src/shared/index.ts +0 -16
- package/src/shared/utils/calculations/index.ts +0 -46
- package/src/shared/utils/date/index.ts +0 -7
- package/src/shared-kernel/index.ts +0 -17
- package/src/shared-kernel/infrastructure/validation/index.ts +0 -36
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-ai-generation-content",
|
|
3
|
-
"version": "1.90.
|
|
3
|
+
"version": "1.90.23",
|
|
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",
|
|
@@ -69,6 +69,7 @@
|
|
|
69
69
|
"@gorhom/bottom-sheet": "^5.2.8",
|
|
70
70
|
"@react-native-async-storage/async-storage": "^2.2.0",
|
|
71
71
|
"@react-native-community/slider": "^5.1.1",
|
|
72
|
+
"@react-navigation/bottom-tabs": "^7.15.6",
|
|
72
73
|
"@tanstack/query-async-storage-persister": "^5.66.7",
|
|
73
74
|
"@tanstack/react-query": "^5.66.7",
|
|
74
75
|
"@tanstack/react-query-persist-client": "^5.66.7",
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
useCredits,
|
|
19
19
|
usePaywallVisibility,
|
|
20
20
|
useFeatureGate,
|
|
21
|
-
|
|
21
|
+
usePremium,
|
|
22
22
|
} from "@umituz/react-native-subscription";
|
|
23
23
|
import type {
|
|
24
24
|
AIFeatureGateOptions,
|
|
@@ -49,7 +49,7 @@ export function useAIFeatureGate(options: AIFeatureGateOptions): AIFeatureGateRe
|
|
|
49
49
|
const { showAuthModal } = useAuthModalStore();
|
|
50
50
|
const { credits, isCreditsLoaded, isLoading: isCreditsLoading } = useCredits();
|
|
51
51
|
const { openPaywall } = usePaywallVisibility();
|
|
52
|
-
const { isPremium } =
|
|
52
|
+
const { isPremium } = usePremium();
|
|
53
53
|
const creditBalance = credits?.credits ?? 0;
|
|
54
54
|
const hasCredits = creditBalance >= creditCost;
|
|
55
55
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import type { PollingConfig } from "../../../../domain/entities/polling.types";
|
|
7
|
-
import { calculatePollingInterval as calculateInterval } from "../../../../shared/utils/calculations";
|
|
7
|
+
import { calculatePollingInterval as calculateInterval } from "../../../../shared/utils/calculations/time-calculations";
|
|
8
8
|
|
|
9
9
|
export interface IntervalOptions {
|
|
10
10
|
attempt: number;
|
|
@@ -2,7 +2,7 @@ import { useCallback, useRef, useState, useMemo } from "react";
|
|
|
2
2
|
import { usePendingJobs } from "./use-pending-jobs";
|
|
3
3
|
import { executeDirectGeneration, executeQueuedJob } from "../../infrastructure/executors/backgroundJobExecutor";
|
|
4
4
|
import { DEFAULT_QUEUE_CONFIG } from "../../domain/entities/job.types";
|
|
5
|
-
import { calculateFilteredCount } from "../../../../shared/utils/calculations";
|
|
5
|
+
import { calculateFilteredCount } from "../../../../shared/utils/calculations/cost-calculations";
|
|
6
6
|
import type {
|
|
7
7
|
UseBackgroundGenerationOptions,
|
|
8
8
|
UseBackgroundGenerationReturn,
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Uses expo-image for caching and performance
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import React, { useMemo,
|
|
7
|
+
import React, { useMemo, useRef, useEffect } from "react";
|
|
8
8
|
import { View, StyleSheet, Animated } from "react-native";
|
|
9
9
|
import { AtomicIcon, AtomicSpinner } from "@umituz/react-native-design-system/atoms";
|
|
10
10
|
import { AtomicImage } from "@umituz/react-native-design-system/image";
|
|
@@ -38,8 +38,6 @@ export function CreationImagePreview({
|
|
|
38
38
|
const tokens = useAppDesignTokens();
|
|
39
39
|
const inProgress = isInProgress(status);
|
|
40
40
|
const typeIcon = getTypeIcon(type);
|
|
41
|
-
const [imageError, setImageError] = useState(false);
|
|
42
|
-
const [isLoading, setIsLoading] = useState(true);
|
|
43
41
|
const pulseAnim = useRef(new Animated.Value(0.4)).current;
|
|
44
42
|
|
|
45
43
|
useEffect(() => {
|
|
@@ -54,16 +52,7 @@ export function CreationImagePreview({
|
|
|
54
52
|
return () => animation.stop();
|
|
55
53
|
}, [inProgress, pulseAnim]);
|
|
56
54
|
|
|
57
|
-
const hasPreview = !!uri && !inProgress
|
|
58
|
-
|
|
59
|
-
const handleImageError = useCallback(() => {
|
|
60
|
-
setImageError(true);
|
|
61
|
-
setIsLoading(false);
|
|
62
|
-
}, []);
|
|
63
|
-
|
|
64
|
-
const handleLoadEnd = useCallback(() => {
|
|
65
|
-
setIsLoading(false);
|
|
66
|
-
}, []);
|
|
55
|
+
const hasPreview = !!uri && !inProgress;
|
|
67
56
|
|
|
68
57
|
const styles = useMemo(
|
|
69
58
|
() =>
|
|
@@ -127,11 +116,6 @@ export function CreationImagePreview({
|
|
|
127
116
|
contentFit="cover"
|
|
128
117
|
cachePolicy="disk"
|
|
129
118
|
/>
|
|
130
|
-
{isLoading && (
|
|
131
|
-
<View style={styles.loadingOverlay}>
|
|
132
|
-
<AtomicSpinner size="md" color="primary" />
|
|
133
|
-
</View>
|
|
134
|
-
)}
|
|
135
119
|
</View>
|
|
136
120
|
);
|
|
137
121
|
}
|
|
@@ -7,7 +7,7 @@ import type { CreationFilter } from "../../domain/types";
|
|
|
7
7
|
import { isTypeInCategory } from "../../domain/types";
|
|
8
8
|
import type { CreationCategory, CreationTypeId } from "../../domain/types";
|
|
9
9
|
import type { FilterableCreation } from "./advancedFilter.types";
|
|
10
|
-
import { normalizeDateToTimestamp, compareDates } from "../../../../shared/utils/date";
|
|
10
|
+
import { normalizeDateToTimestamp, compareDates } from "../../../../shared/utils/date/normalization";
|
|
11
11
|
|
|
12
12
|
function filterByType<T extends FilterableCreation>(
|
|
13
13
|
creations: T[],
|
|
@@ -7,7 +7,7 @@ import type { Creation } from "../../domain/entities/Creation";
|
|
|
7
7
|
import type { ICreationsRepository } from "../../domain/repositories/ICreationsRepository";
|
|
8
8
|
import { CREATION_STATUS } from "../../../../domain/constants/queue-status.constants";
|
|
9
9
|
import { DEFAULT_MAX_POLL_TIME_MS } from "../../../../infrastructure/constants/polling.constants";
|
|
10
|
-
import { isOlderThan, calculateAgeMs } from "../../../../shared/utils/calculations";
|
|
10
|
+
import { isOlderThan, calculateAgeMs } from "../../../../shared/utils/calculations/time-calculations";
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Check if job is stale (older than max poll time)
|
|
@@ -31,7 +31,7 @@ export function useProcessingJobsPoller(
|
|
|
31
31
|
const timer = setInterval(() => {
|
|
32
32
|
// Stub: Polling logic to be implemented when job status API is available
|
|
33
33
|
const processingCreations = creations.filter(c => c.status === 'processing');
|
|
34
|
-
processingCreations.forEach(async (
|
|
34
|
+
processingCreations.forEach(async (_creation) => {
|
|
35
35
|
try {
|
|
36
36
|
// Check job status and update creation
|
|
37
37
|
// Note: Actual polling implementation requires job status API
|
|
@@ -14,7 +14,7 @@ import { GalleryResultPreview } from "../components/GalleryResultPreview";
|
|
|
14
14
|
import { GalleryScreenHeader } from "../components/GalleryScreenHeader";
|
|
15
15
|
import { MEDIA_FILTER_OPTIONS, STATUS_FILTER_OPTIONS } from "../../domain/types/creation-filter";
|
|
16
16
|
import { createFilterButtons, createItemTitle } from "../utils/filter-buttons.util";
|
|
17
|
-
import { calculatePaginationSlice, calculateHasMore } from "../../../../shared/utils/calculations";
|
|
17
|
+
import { calculatePaginationSlice, calculateHasMore } from "../../../../shared/utils/calculations/cost-calculations";
|
|
18
18
|
import type { Creation } from "../../domain/entities/Creation";
|
|
19
19
|
import type { CreationsGalleryScreenProps } from "./creations-gallery.types";
|
|
20
20
|
import { creationsGalleryStyles as styles } from "./creations-gallery.styles";
|
|
@@ -3,11 +3,12 @@
|
|
|
3
3
|
* Core validation functions for strings, numbers, URLs, emails, and base64
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import type { ValidationResult
|
|
6
|
+
import type { ValidationResult } from "../../shared-kernel/infrastructure/validation";
|
|
7
7
|
import { validateString, validateNumber } from "../../shared-kernel/infrastructure/validation";
|
|
8
8
|
|
|
9
9
|
// Re-export types for convenience
|
|
10
|
-
export type { ValidationResult
|
|
10
|
+
export type { ValidationResult } from "../../shared-kernel/infrastructure/validation";
|
|
11
|
+
export type { StringValidationOptions, NumberValidationOptions } from "../../shared-kernel/infrastructure/validation";
|
|
11
12
|
|
|
12
13
|
// Re-export validation functions for convenience
|
|
13
14
|
export { validateString, validateNumber };
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* AI Generation Constants
|
|
3
|
-
*
|
|
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.
|
|
6
|
-
*/
|
|
7
|
-
|
|
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";
|
package/src/core/index.ts
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @umituz/react-native-ai-generation-content/core
|
|
3
|
-
*
|
|
4
|
-
* Core types for AI generation providers.
|
|
5
|
-
* This module contains ONLY types and utilities - no implementation details.
|
|
6
|
-
*
|
|
7
|
-
* Use this subpath for provider implementations:
|
|
8
|
-
* ```typescript
|
|
9
|
-
* import type { IAIProvider, AIProviderConfig } from "@umituz/react-native-ai-generation-content/core";
|
|
10
|
-
* ```
|
|
11
|
-
*
|
|
12
|
-
* @module @umituz/react-native-ai-generation-content/core
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
// Result Pattern
|
|
16
|
-
export type { Result, Success, Failure } from "../domain/types/result.types";
|
|
17
|
-
export {
|
|
18
|
-
success,
|
|
19
|
-
failure,
|
|
20
|
-
isSuccess,
|
|
21
|
-
isFailure,
|
|
22
|
-
mapResult,
|
|
23
|
-
andThen,
|
|
24
|
-
unwrap,
|
|
25
|
-
unwrapOr,
|
|
26
|
-
} from "../domain/types/result.types";
|
|
27
|
-
|
|
28
|
-
// Error Types
|
|
29
|
-
export { AIErrorType } from "../domain/entities/error.types";
|
|
30
|
-
export type { AIErrorInfo, AIErrorMessages } from "../domain/entities/error.types";
|
|
31
|
-
|
|
32
|
-
// Provider Types
|
|
33
|
-
export type {
|
|
34
|
-
// Feature Types
|
|
35
|
-
ImageFeatureType,
|
|
36
|
-
VideoFeatureType,
|
|
37
|
-
// Config
|
|
38
|
-
AIProviderConfig,
|
|
39
|
-
// Status
|
|
40
|
-
AIJobStatusType,
|
|
41
|
-
AILogEntry,
|
|
42
|
-
JobSubmission,
|
|
43
|
-
JobStatus,
|
|
44
|
-
// Progress
|
|
45
|
-
ProviderProgressInfo,
|
|
46
|
-
SubscribeOptions,
|
|
47
|
-
RunOptions,
|
|
48
|
-
// Capabilities
|
|
49
|
-
ProviderCapabilities,
|
|
50
|
-
// Input Data
|
|
51
|
-
ImageFeatureInputData,
|
|
52
|
-
VideoFeatureInputData,
|
|
53
|
-
// Main Provider Interface
|
|
54
|
-
IAIProvider,
|
|
55
|
-
// Logging
|
|
56
|
-
ProviderLogEntry,
|
|
57
|
-
} from "../domain/interfaces/ai-provider.interface";
|
|
58
|
-
|
|
59
|
-
// Generation Constants
|
|
60
|
-
export * from "./constants";
|
|
61
|
-
|
|
62
|
-
// Segregated provider sub-interfaces
|
|
63
|
-
export type { IAIProviderLifecycle } from "../domain/interfaces/provider-lifecycle.interface";
|
|
64
|
-
export type { IAIProviderCapabilities } from "../domain/interfaces/provider-capabilities.interface";
|
|
65
|
-
export type { IAIProviderJobManager } from "../domains/background/domain/interfaces/provider-job-manager.interface";
|
|
66
|
-
export type { IAIProviderExecutor } from "../domain/interfaces/provider-executor.interface";
|
|
67
|
-
export type { IAIProviderImageFeatures } from "../domain/interfaces/provider-image-features.interface";
|
|
68
|
-
export type { IAIProviderVideoFeatures } from "../domain/interfaces/provider-video-features.interface";
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Domain Entities
|
|
3
|
-
* Core type definitions
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
export * from "./error.types";
|
|
7
|
-
export * from "./generation.types";
|
|
8
|
-
export * from "./polling.types";
|
|
9
|
-
export * from "../../domains/background/domain/entities/job.types";
|
|
10
|
-
export * from "./processing-modes.types";
|
|
11
|
-
export * from "./flow-config.types";
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Domain Interfaces
|
|
3
|
-
* Provider-agnostic contracts
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
export * from "./ai-provider.interface";
|
|
7
|
-
export * from "./app-services.interface";
|
|
8
|
-
export * from "./app-services-auth.interface";
|
|
9
|
-
export * from "./app-services-composite.interface";
|
|
10
|
-
export * from "./app-services-optional.interface";
|
|
11
|
-
|
|
12
|
-
// Video Model Configuration
|
|
13
|
-
export type { VideoModelConfig, ModelCapabilityOption } from "./video-model-config.types";
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Creations Domain
|
|
3
|
-
* AI-generated creations gallery with filtering, sharing, and management
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
// Domain Layer
|
|
7
|
-
export * from "./domain-exports";
|
|
8
|
-
|
|
9
|
-
// Infrastructure Layer
|
|
10
|
-
export * from "./infrastructure-exports";
|
|
11
|
-
|
|
12
|
-
// Presentation Layer
|
|
13
|
-
export * from "./presentation-exports";
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Text-to-Image Feature
|
|
3
|
-
* Provider-agnostic text-to-image generation feature
|
|
4
|
-
*
|
|
5
|
-
* Architecture:
|
|
6
|
-
* - Domain: Types, constants
|
|
7
|
-
* - Infrastructure: Execution logic, provider support
|
|
8
|
-
* - Presentation: Hooks, components
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
// Domain Layer
|
|
12
|
-
export * from "./domain-exports";
|
|
13
|
-
|
|
14
|
-
// Infrastructure Layer
|
|
15
|
-
export * from "./infrastructure-exports";
|
|
16
|
-
|
|
17
|
-
// Presentation Layer
|
|
18
|
-
export * from "./presentation-exports";
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Infrastructure Utils
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
export * from "./error-classification";
|
|
6
|
-
export * from "./error-factory";
|
|
7
|
-
export * from "./message-extractor";
|
|
8
|
-
export * from "./classifier-helpers";
|
|
9
|
-
export * from "./result-polling";
|
|
10
|
-
export * from "../../domains/background/infrastructure/utils/polling-interval.util";
|
|
11
|
-
export * from "./progress-calculator.util";
|
|
12
|
-
export * from "./progress.utils";
|
|
13
|
-
export * from "../../domains/background/infrastructure/utils/status-checker.util";
|
|
14
|
-
export * from "../../domains/background/infrastructure/utils/result-validator.util";
|
|
15
|
-
export * from "./url-extractor.util";
|
|
16
|
-
export * from "./photo-generation";
|
|
17
|
-
export * from "./feature-utils";
|
|
18
|
-
export * from "./video-helpers";
|
|
19
|
-
export * from "./provider-validator.util";
|
|
20
|
-
export * from "./base64.util";
|
|
21
|
-
export * from "./video-result-extractor.util";
|
|
22
|
-
export * from "./id-generator.util";
|
|
23
|
-
export * from "./intensity.util";
|
|
24
|
-
export * from "./couple-input.util";
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
export { GenerationProgressContent } from "./GenerationProgressContent";
|
|
2
|
-
export { PendingJobCard } from "./PendingJobCard";
|
|
3
|
-
export { PendingJobCardActions } from "./PendingJobCardActions";
|
|
4
|
-
export { PromptInput } from "./PromptInput";
|
|
5
|
-
export { AIGenerationHero } from "./AIGenerationHero";
|
|
6
|
-
|
|
7
|
-
export * from "./StylePresetsGrid";
|
|
8
|
-
export * from "./AIGenerationForm";
|
|
9
|
-
export * from "./AIGenerationForm.types";
|
|
10
|
-
export * from "./AIGenerationConfig";
|
|
11
|
-
|
|
12
|
-
export type { GenerationProgressContentProps } from "./GenerationProgressContent";
|
|
13
|
-
|
|
14
|
-
export type {
|
|
15
|
-
PendingJobCardProps,
|
|
16
|
-
StatusLabels,
|
|
17
|
-
} from "./PendingJobCard";
|
|
18
|
-
|
|
19
|
-
export type { PendingJobCardActionsProps } from "./PendingJobCardActions";
|
|
20
|
-
export type { PromptInputProps } from "./PromptInput";
|
|
21
|
-
export type { AIGenerationHeroProps } from "./AIGenerationHero";
|
|
22
|
-
|
|
23
|
-
export * from "./result";
|
|
24
|
-
export * from "./photo-step";
|
|
25
|
-
export * from "./modals/SettingsSheet";
|
|
26
|
-
export * from "./selectors";
|
|
27
|
-
export * from "./image-picker";
|
|
28
|
-
export * from "./buttons";
|
|
29
|
-
export * from "./display";
|
|
30
|
-
export * from "./headers";
|
|
31
|
-
export * from "./PhotoUploadCard";
|
|
32
|
-
export * from "./prompts/ExamplePrompts";
|
|
33
|
-
export * from "./moderation/ModerationSummary";
|
|
34
|
-
export * from "./shared/ModelSelector";
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Selector Components
|
|
3
|
-
* Generic, props-driven selection UI components
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
export { StyleSelector } from "./StyleSelector";
|
|
7
|
-
export { AspectRatioSelector } from "./AspectRatioSelector";
|
|
8
|
-
export { DurationSelector } from "./DurationSelector";
|
|
9
|
-
export { GridSelector, type GridSelectorProps, type GridSelectorOption } from "./GridSelector";
|
|
10
|
-
|
|
11
|
-
export type { StyleSelectorProps } from "./StyleSelector";
|
|
12
|
-
export type { AspectRatioSelectorProps } from "./AspectRatioSelector";
|
|
13
|
-
export type { DurationSelectorProps } from "./DurationSelector";
|
|
14
|
-
|
|
15
|
-
export type {
|
|
16
|
-
StyleOption,
|
|
17
|
-
AspectRatioOption,
|
|
18
|
-
DurationValue,
|
|
19
|
-
} from "./types";
|
|
20
|
-
|
|
21
|
-
export * from "./factories";
|
package/src/shared/index.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared Utilities, Components, and Hooks
|
|
3
|
-
* Centralized exports for all shared code
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
// Components
|
|
7
|
-
export * from "./components";
|
|
8
|
-
|
|
9
|
-
// Hooks
|
|
10
|
-
export * from "./hooks";
|
|
11
|
-
|
|
12
|
-
// Utils
|
|
13
|
-
export * from "./utils/date";
|
|
14
|
-
export * from "./utils/filters";
|
|
15
|
-
export * from "./utils/debounce.util";
|
|
16
|
-
export * from "./utils/calculations";
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Calculation Utilities
|
|
3
|
-
* Centralized calculation operations for better performance and maintainability
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
// Credit & Cost Calculations
|
|
7
|
-
export {
|
|
8
|
-
calculateCredits,
|
|
9
|
-
calculateResolutionMultiplier,
|
|
10
|
-
convertCostToCredits,
|
|
11
|
-
} from "./credit-calculations";
|
|
12
|
-
|
|
13
|
-
// Time & Duration Calculations
|
|
14
|
-
export {
|
|
15
|
-
calculateAgeMs,
|
|
16
|
-
calculateAgeSeconds,
|
|
17
|
-
calculateAgeMinutes,
|
|
18
|
-
isOlderThan,
|
|
19
|
-
calculateDurationMs,
|
|
20
|
-
formatDuration,
|
|
21
|
-
calculatePollingInterval,
|
|
22
|
-
calculateEstimatedPollingTime,
|
|
23
|
-
} from "./time-calculations";
|
|
24
|
-
|
|
25
|
-
// General Cost & Value Calculations
|
|
26
|
-
export {
|
|
27
|
-
calculatePercentage,
|
|
28
|
-
calculateProgress,
|
|
29
|
-
calculateRemaining,
|
|
30
|
-
calculateFilteredCount,
|
|
31
|
-
calculatePaginationSlice,
|
|
32
|
-
calculateHasMore,
|
|
33
|
-
calculateBase64Size,
|
|
34
|
-
calculateBase64SizeMB,
|
|
35
|
-
isBase64SizeWithinLimit,
|
|
36
|
-
calculateConfidenceScore,
|
|
37
|
-
calculateAspectRatio,
|
|
38
|
-
calculateHeightFromAspectRatio,
|
|
39
|
-
calculateWidthFromAspectRatio,
|
|
40
|
-
calculateImageMemoryUsage,
|
|
41
|
-
calculateMemoryMB,
|
|
42
|
-
calculateSafeBatchSize,
|
|
43
|
-
clamp,
|
|
44
|
-
lerp,
|
|
45
|
-
mapRange,
|
|
46
|
-
} from "./cost-calculations";
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared Kernel Module
|
|
3
|
-
* Provides base types, utilities, and patterns for all domains
|
|
4
|
-
* Following DDD principles with clean architecture
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
// Base types
|
|
8
|
-
export * from './base-types';
|
|
9
|
-
|
|
10
|
-
// Application services
|
|
11
|
-
export * from './application/hooks';
|
|
12
|
-
|
|
13
|
-
// Domain layer
|
|
14
|
-
export * from './domain';
|
|
15
|
-
|
|
16
|
-
// Infrastructure utilities
|
|
17
|
-
export * from './infrastructure/validation';
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared Validation Utilities
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
// Export all from common-validators
|
|
6
|
-
export * from "./common-validators";
|
|
7
|
-
export * from "./common-validators.types";
|
|
8
|
-
|
|
9
|
-
// Export functions from advanced-validator
|
|
10
|
-
export { combineValidationResults } from "../../../infrastructure/validation/advanced-validator";
|
|
11
|
-
|
|
12
|
-
// Export error handling utilities
|
|
13
|
-
export { handleError } from "./error-handler";
|
|
14
|
-
export { ErrorType } from "./error-handler.types";
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Validate required fields in an object
|
|
18
|
-
*/
|
|
19
|
-
export function validateRequiredFields<T extends Record<string, unknown>>(
|
|
20
|
-
obj: T,
|
|
21
|
-
requiredFields: (keyof T)[]
|
|
22
|
-
): { isValid: boolean; missingFields: string[] } {
|
|
23
|
-
const missingFields: string[] = [];
|
|
24
|
-
|
|
25
|
-
for (const field of requiredFields) {
|
|
26
|
-
const value = obj[field];
|
|
27
|
-
if (value === undefined || value === null || value === '') {
|
|
28
|
-
missingFields.push(String(field));
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return {
|
|
33
|
-
isValid: missingFields.length === 0,
|
|
34
|
-
missingFields,
|
|
35
|
-
};
|
|
36
|
-
}
|