@umituz/react-native-ai-fal-provider 3.2.51 → 3.2.52

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-fal-provider",
3
- "version": "3.2.51",
3
+ "version": "3.2.52",
4
4
  "description": "FAL AI provider for React Native - implements IAIProvider interface for unified AI generation",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -47,9 +47,6 @@
47
47
  "@gorhom/bottom-sheet": "^5.2.8",
48
48
  "@react-native-async-storage/async-storage": "^2.2.0",
49
49
  "@react-native-community/slider": "^5.1.1",
50
- "@react-navigation/bottom-tabs": "^7.9.0",
51
- "@react-navigation/native": "^7.1.26",
52
- "@react-navigation/stack": "^7.6.13",
53
50
  "@tanstack/query-async-storage-persister": "^5.66.7",
54
51
  "@tanstack/react-query": "^5.66.7",
55
52
  "@tanstack/react-query-persist-client": "^5.66.7",
@@ -1,168 +1,21 @@
1
1
  /**
2
2
  * Calculation Helper Utilities
3
- * Centralized calculation functions for consistent metrics across the codebase
3
+ * Internal calculation functions for FAL provider
4
4
  */
5
5
 
6
6
  /**
7
7
  * Calculate elapsed time in milliseconds from a start timestamp
8
- *
9
- * @param startTime - Start timestamp in milliseconds (from Date.now())
10
- * @returns Elapsed time in milliseconds
11
- *
12
- * @example
13
- * ```typescript
14
- * const start = Date.now();
15
- * // ... do work ...
16
- * const elapsed = getElapsedTime(start); // e.g., 1234
17
- * ```
18
8
  */
19
9
  export function getElapsedTime(startTime: number): number {
20
10
  return Date.now() - startTime;
21
11
  }
22
12
 
23
- /**
24
- * Format elapsed time in milliseconds to human-readable string
25
- *
26
- * @param elapsedMs - Elapsed time in milliseconds
27
- * @returns Formatted string (e.g., "1234ms", "1.2s")
28
- *
29
- * @example
30
- * ```typescript
31
- * formatDuration(1234); // "1234ms"
32
- * formatDuration(1200); // "1.2s"
33
- * formatDuration(1500); // "1.5s"
34
- * ```
35
- */
36
- export function formatDuration(elapsedMs: number): string {
37
- if (elapsedMs < 1000) {
38
- return `${Math.round(elapsedMs)}ms`;
39
- }
40
- return `${(elapsedMs / 1000).toFixed(1)}s`;
41
- }
42
-
43
- /**
44
- * Convert bytes to kilobytes (KB)
45
- *
46
- * @param bytes - Size in bytes
47
- * @returns Size in kilobytes (rounded)
48
- *
49
- * @example
50
- * ```typescript
51
- * bytesToKB(5000); // 5
52
- * bytesToKB(1536); // 2
53
- * ```
54
- */
55
- export function bytesToKB(bytes: number): number {
56
- return Math.round(bytes / 1024);
57
- }
58
-
59
13
  /**
60
14
  * Calculate actual file size from base64 string
61
15
  * Base64 encoding inflates size by ~33%, so actual size is ~75% of base64 length
62
- *
63
- * @param base64String - Base64 encoded string
64
- * @returns Actual size in kilobytes (rounded)
65
- *
66
- * @example
67
- * ```typescript
68
- * getActualSizeKB("data:image/png;base64,iVBOR..."); // ~3KB for 4KB base64
69
- * ```
70
16
  */
71
17
  export function getActualSizeKB(base64String: string): number {
72
18
  const base64SizeKB = Math.round(base64String.length / 1024);
73
19
  // Base64 inflates by ~33%, so actual size is ~75%
74
20
  return Math.round(base64SizeKB * 0.75);
75
21
  }
76
-
77
- /**
78
- * Calculate base64 size in KB (before inflation adjustment)
79
- *
80
- * @param base64String - Base64 encoded string
81
- * @returns Size in kilobytes (rounded)
82
- *
83
- * @example
84
- * ```typescript
85
- * getBase64SizeKB("data:image/png;base64,iVBOR..."); // 4
86
- * ```
87
- */
88
- export function getBase64SizeKB(base64String: string): number {
89
- return Math.round(base64String.length / 1024);
90
- }
91
-
92
- /**
93
- * Calculate success rate as percentage
94
- *
95
- * @param successCount - Number of successful operations
96
- * @param totalCount - Total number of operations
97
- * @returns Success rate as percentage (0-100)
98
- *
99
- * @example
100
- * ```typescript
101
- * getSuccessRate(8, 10); // 80
102
- * getSuccessRate(5, 5); // 100
103
- * getSuccessRate(0, 10); // 0
104
- * ```
105
- */
106
- export function getSuccessRate(successCount: number, totalCount: number): number {
107
- if (totalCount === 0) return 0;
108
- return Math.round((successCount / totalCount) * 100);
109
- }
110
-
111
- /**
112
- * Format bytes to human-readable size
113
- *
114
- * @param bytes - Size in bytes
115
- * @returns Formatted string (e.g., "1.5KB", "2.3MB")
116
- *
117
- * @example
118
- * ```typescript
119
- * formatBytes(1536); // "1.5KB"
120
- * formatBytes(2048000); // "2.0MB"
121
- * formatBytes(500); // "500B"
122
- * ```
123
- */
124
- export function formatBytes(bytes: number): string {
125
- if (bytes < 1024) return `${bytes}B`;
126
- if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)}KB`;
127
- return `${(bytes / (1024 * 1024)).toFixed(1)}MB`;
128
- }
129
-
130
- /**
131
- * Calculate retry count suffix for logging
132
- *
133
- * @param attempt - Current attempt number (0-indexed)
134
- * @param totalAttempts - Total number of attempts
135
- * @returns Formatted suffix string
136
- *
137
- * @example
138
- * ```typescript
139
- * getRetrySuffix(1, 2); // " (succeeded on retry 1)"
140
- * getRetrySuffix(0, 1); // ""
141
- * ```
142
- */
143
- export function getRetrySuffix(attempt: number, _totalAttempts: number): string {
144
- if (attempt > 0) {
145
- return ` (succeeded on retry ${attempt})`;
146
- }
147
- return "";
148
- }
149
-
150
- /**
151
- * Calculate failure info string for logging
152
- *
153
- * @param attempt - Current attempt number (0-indexed)
154
- * @param totalAttempts - Total number of attempts
155
- * @returns Formatted failure info string
156
- *
157
- * @example
158
- * ```typescript
159
- * getFailureInfo(1, 2); // " after 2 attempts"
160
- * getFailureInfo(0, 1); // ""
161
- * ```
162
- */
163
- export function getFailureInfo(attempt: number, _totalAttempts: number): string {
164
- if (attempt > 0) {
165
- return ` after ${attempt + 1} attempts`;
166
- }
167
- return "";
168
- }