@umituz/react-native-ai-fal-provider 2.0.20 → 2.0.21
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": "2.0.
|
|
3
|
+
"version": "2.0.21",
|
|
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",
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"@fal-ai/client": ">=0.6.0",
|
|
31
|
-
"react": ">=
|
|
32
|
-
"react-native": ">=0.
|
|
31
|
+
"react": ">=19.0.0",
|
|
32
|
+
"react-native": ">=0.81.0"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@fal-ai/client": ">=0.6.0"
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"@tanstack/query-async-storage-persister": "^5.66.7",
|
|
47
47
|
"@tanstack/react-query": "^5.66.7",
|
|
48
48
|
"@tanstack/react-query-persist-client": "^5.66.7",
|
|
49
|
-
"@types/react": "~
|
|
49
|
+
"@types/react": "~19.1.0",
|
|
50
50
|
"@typescript-eslint/eslint-plugin": "^7.0.0",
|
|
51
51
|
"@typescript-eslint/parser": "^7.0.0",
|
|
52
52
|
"@umituz/react-native-auth": "*",
|
|
@@ -77,8 +77,8 @@
|
|
|
77
77
|
"expo-video": "^3.0.15",
|
|
78
78
|
"expo-web-browser": "^12.0.0",
|
|
79
79
|
"firebase": "^12.7.0",
|
|
80
|
-
"react": "
|
|
81
|
-
"react-native": "0.
|
|
80
|
+
"react": "19.1.0",
|
|
81
|
+
"react-native": "0.81.5",
|
|
82
82
|
"react-native-gesture-handler": "^2.30.0",
|
|
83
83
|
"react-native-purchases": "^9.7.5",
|
|
84
84
|
"react-native-reanimated": "^4.2.1",
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Collection Filter Utilities
|
|
3
|
+
* Common filter operations for arrays of objects
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Filter array by property value
|
|
8
|
+
*/
|
|
9
|
+
export function filterByProperty<T>(
|
|
10
|
+
items: readonly T[],
|
|
11
|
+
property: keyof T,
|
|
12
|
+
value: unknown
|
|
13
|
+
): T[] {
|
|
14
|
+
return items.filter((item) => item[property] === value);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Filter array by predicate function
|
|
19
|
+
*/
|
|
20
|
+
export function filterByPredicate<T>(
|
|
21
|
+
items: readonly T[],
|
|
22
|
+
predicate: (item: T) => boolean
|
|
23
|
+
): T[] {
|
|
24
|
+
return items.filter(predicate);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Filter array by time range (timestamp property)
|
|
29
|
+
*/
|
|
30
|
+
export function filterByTimeRange<T>(
|
|
31
|
+
items: readonly T[],
|
|
32
|
+
timestampProperty: keyof T,
|
|
33
|
+
startTime: number,
|
|
34
|
+
endTime: number
|
|
35
|
+
): T[] {
|
|
36
|
+
return items.filter((item) => {
|
|
37
|
+
const timestamp = item[timestampProperty] as unknown as number;
|
|
38
|
+
return timestamp >= startTime && timestamp <= endTime;
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Filter array by multiple property values (OR logic)
|
|
44
|
+
*/
|
|
45
|
+
export function filterByAnyProperty<T>(
|
|
46
|
+
items: readonly T[],
|
|
47
|
+
property: keyof T,
|
|
48
|
+
values: readonly unknown[]
|
|
49
|
+
): T[] {
|
|
50
|
+
const valueSet = new Set(values);
|
|
51
|
+
return items.filter((item) => valueSet.has(item[property]));
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Sort array by date property (descending - newest first)
|
|
56
|
+
*/
|
|
57
|
+
export function sortByDateDescending<T>(
|
|
58
|
+
items: readonly T[],
|
|
59
|
+
dateProperty: keyof T
|
|
60
|
+
): T[] {
|
|
61
|
+
return [...items].sort((a, b) => {
|
|
62
|
+
const timeA = new Date(a[dateProperty] as unknown as string).getTime();
|
|
63
|
+
const timeB = new Date(b[dateProperty] as unknown as string).getTime();
|
|
64
|
+
return timeB - timeA;
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Sort array by date property (ascending - oldest first)
|
|
70
|
+
*/
|
|
71
|
+
export function sortByDateAscending<T>(
|
|
72
|
+
items: readonly T[],
|
|
73
|
+
dateProperty: keyof T
|
|
74
|
+
): T[] {
|
|
75
|
+
return [...items].sort((a, b) => {
|
|
76
|
+
const timeA = new Date(a[dateProperty] as unknown as string).getTime();
|
|
77
|
+
const timeB = new Date(b[dateProperty] as unknown as string).getTime();
|
|
78
|
+
return timeA - timeB;
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Sort array by number property (descending)
|
|
84
|
+
*/
|
|
85
|
+
export function sortByNumberDescending<T>(
|
|
86
|
+
items: readonly T[],
|
|
87
|
+
numberProperty: keyof T
|
|
88
|
+
): T[] {
|
|
89
|
+
return [...items].sort((a, b) => {
|
|
90
|
+
const numA = a[numberProperty] as unknown as number;
|
|
91
|
+
const numB = b[numberProperty] as unknown as number;
|
|
92
|
+
return numB - numA;
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Sort array by number property (ascending)
|
|
98
|
+
*/
|
|
99
|
+
export function sortByNumberAscending<T>(
|
|
100
|
+
items: readonly T[],
|
|
101
|
+
numberProperty: keyof T
|
|
102
|
+
): T[] {
|
|
103
|
+
return [...items].sort((a, b) => {
|
|
104
|
+
const numA = a[numberProperty] as unknown as number;
|
|
105
|
+
const numB = b[numberProperty] as unknown as number;
|
|
106
|
+
return numA - numB;
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Reduce array to sum of number property
|
|
112
|
+
*/
|
|
113
|
+
export function sumByProperty<T>(
|
|
114
|
+
items: readonly T[],
|
|
115
|
+
numberProperty: keyof T
|
|
116
|
+
): number {
|
|
117
|
+
return items.reduce((sum, item) => {
|
|
118
|
+
const value = item[numberProperty] as unknown as number;
|
|
119
|
+
return sum + (typeof value === "number" ? value : 0);
|
|
120
|
+
}, 0);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Group array by property value
|
|
125
|
+
*/
|
|
126
|
+
export function groupByProperty<T>(
|
|
127
|
+
items: readonly T[],
|
|
128
|
+
property: keyof T
|
|
129
|
+
): Map<unknown, T[]> {
|
|
130
|
+
const groups = new Map<unknown, T[]>();
|
|
131
|
+
for (const item of items) {
|
|
132
|
+
const key = item[property];
|
|
133
|
+
const existing = groups.get(key);
|
|
134
|
+
if (existing) {
|
|
135
|
+
existing.push(item);
|
|
136
|
+
} else {
|
|
137
|
+
groups.set(key, [item]);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return groups;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Chunk array into smaller arrays of specified size
|
|
145
|
+
*/
|
|
146
|
+
export function chunkArray<T>(items: readonly T[], chunkSize: number): T[][] {
|
|
147
|
+
const result: T[][] = [];
|
|
148
|
+
for (let i = 0; i < items.length; i += chunkSize) {
|
|
149
|
+
result.push(items.slice(i, i + chunkSize) as T[]);
|
|
150
|
+
}
|
|
151
|
+
return result;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Get distinct values of a property from array
|
|
156
|
+
*/
|
|
157
|
+
export function distinctByProperty<T>(
|
|
158
|
+
items: readonly T[],
|
|
159
|
+
property: keyof T
|
|
160
|
+
): unknown[] {
|
|
161
|
+
const seen = new Set<unknown>();
|
|
162
|
+
const result: unknown[] = [];
|
|
163
|
+
for (const item of items) {
|
|
164
|
+
const value = item[property];
|
|
165
|
+
if (!seen.has(value)) {
|
|
166
|
+
seen.add(value);
|
|
167
|
+
result.push(value);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
return result;
|
|
171
|
+
}
|