@umituz/react-native-ai-generation-content 1.17.302 → 1.17.304
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 +6 -2
- package/src/domains/creations/presentation/hooks/useCreationPersistence.ts +1 -1
- package/src/domains/creations/presentation/hooks/useDeleteCreation.ts +3 -3
- package/src/presentation/hooks/use-pending-jobs.ts +12 -12
- package/src/presentation/hooks/useGenerationCallbacksBuilder.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-ai-generation-content",
|
|
3
|
-
"version": "1.17.
|
|
3
|
+
"version": "1.17.304",
|
|
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",
|
|
@@ -58,7 +58,9 @@
|
|
|
58
58
|
"@react-navigation/bottom-tabs": "^7.9.0",
|
|
59
59
|
"@react-navigation/native": "^7.1.26",
|
|
60
60
|
"@react-navigation/stack": "^7.6.13",
|
|
61
|
-
"@tanstack/
|
|
61
|
+
"@tanstack/query-async-storage-persister": "^5.66.7",
|
|
62
|
+
"@tanstack/react-query": "^5.66.7",
|
|
63
|
+
"@tanstack/react-query-persist-client": "^5.66.7",
|
|
62
64
|
"@types/react": "~19.1.10",
|
|
63
65
|
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
64
66
|
"@typescript-eslint/parser": "^8.0.0",
|
|
@@ -68,6 +70,7 @@
|
|
|
68
70
|
"eslint": "^9.0.0",
|
|
69
71
|
"expo-apple-authentication": "^8.0.8",
|
|
70
72
|
"expo-application": "^7.0.8",
|
|
73
|
+
"expo-auth-session": "^5.0.0",
|
|
71
74
|
"expo-clipboard": "^8.0.8",
|
|
72
75
|
"expo-crypto": "^15.0.8",
|
|
73
76
|
"expo-device": "^8.0.10",
|
|
@@ -85,6 +88,7 @@
|
|
|
85
88
|
"expo-secure-store": "^15.0.8",
|
|
86
89
|
"expo-sharing": "^14.0.8",
|
|
87
90
|
"expo-video": "^3.0.15",
|
|
91
|
+
"expo-web-browser": "^12.0.0",
|
|
88
92
|
"firebase": "^12.6.0",
|
|
89
93
|
"i18next": "^25.7.3",
|
|
90
94
|
"react": "19.1.0",
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { useCallback, useMemo } from "react";
|
|
8
|
-
import { useQueryClient } from "@
|
|
8
|
+
import { useQueryClient } from "@umituz/react-native-design-system";
|
|
9
9
|
import { useAuth } from "@umituz/react-native-auth";
|
|
10
10
|
import { createCreationsRepository } from "../../infrastructure/adapters";
|
|
11
11
|
import type { Creation } from "../../domain/entities/Creation";
|
|
@@ -29,14 +29,14 @@ export function useDeleteCreation({
|
|
|
29
29
|
const previousData = queryClient.getQueryData<Creation[]>(queryKey);
|
|
30
30
|
|
|
31
31
|
if (previousData) {
|
|
32
|
-
queryClient.setQueryData<Creation[]>(queryKey, (old) =>
|
|
33
|
-
old?.filter((c) => c.id !== creationId) ?? []
|
|
32
|
+
queryClient.setQueryData<Creation[]>(queryKey, (old: Creation[] | undefined) =>
|
|
33
|
+
old?.filter((c: Creation) => c.id !== creationId) ?? []
|
|
34
34
|
);
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
return { previousData };
|
|
38
38
|
},
|
|
39
|
-
onError: (_error, _variables, context) => {
|
|
39
|
+
onError: (_error: Error, _variables: string, context: { previousData?: Creation[] } | undefined) => {
|
|
40
40
|
if (context?.previousData) {
|
|
41
41
|
queryClient.setQueryData(queryKey, context.previousData);
|
|
42
42
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Generic pending job management with TanStack Query
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { useQuery, useMutation, useQueryClient } from "@
|
|
6
|
+
import { useQuery, useMutation, useQueryClient } from "@umituz/react-native-design-system";
|
|
7
7
|
import type {
|
|
8
8
|
BackgroundJob,
|
|
9
9
|
AddJobInput,
|
|
@@ -54,23 +54,23 @@ export function usePendingJobs<TInput = unknown, TResult = unknown>(
|
|
|
54
54
|
};
|
|
55
55
|
return Promise.resolve(newJob);
|
|
56
56
|
},
|
|
57
|
-
onSuccess: (newJob) => {
|
|
57
|
+
onSuccess: (newJob: BackgroundJob<TInput, TResult>) => {
|
|
58
58
|
queryClient.setQueryData<BackgroundJob<TInput, TResult>[]>(
|
|
59
59
|
queryKey,
|
|
60
|
-
(old) => [newJob, ...(old ?? [])],
|
|
60
|
+
(old: BackgroundJob<TInput, TResult>[] | undefined) => [newJob, ...(old ?? [])],
|
|
61
61
|
);
|
|
62
62
|
},
|
|
63
63
|
});
|
|
64
64
|
|
|
65
65
|
const updateJobMutation = useMutation({
|
|
66
66
|
mutationFn: ({ id, updates }: UpdateJobInput) =>
|
|
67
|
-
Promise.resolve({ id, updates }),
|
|
68
|
-
onSuccess: ({ id, updates }) => {
|
|
67
|
+
Promise.resolve({ id, updates: updates as Partial<BackgroundJob<TInput, TResult>> }),
|
|
68
|
+
onSuccess: ({ id, updates }: { id: string; updates: Partial<BackgroundJob<TInput, TResult>> }) => {
|
|
69
69
|
queryClient.setQueryData<BackgroundJob<TInput, TResult>[]>(
|
|
70
70
|
queryKey,
|
|
71
|
-
(old) => {
|
|
71
|
+
(old: BackgroundJob<TInput, TResult>[] | undefined) => {
|
|
72
72
|
if (!old) return [];
|
|
73
|
-
return old.map((job) =>
|
|
73
|
+
return old.map((job: BackgroundJob<TInput, TResult>) =>
|
|
74
74
|
job.id === id ? ({ ...job, ...updates } as BackgroundJob<TInput, TResult>) : job,
|
|
75
75
|
);
|
|
76
76
|
},
|
|
@@ -80,10 +80,10 @@ export function usePendingJobs<TInput = unknown, TResult = unknown>(
|
|
|
80
80
|
|
|
81
81
|
const removeJobMutation = useMutation({
|
|
82
82
|
mutationFn: (id: string) => Promise.resolve(id),
|
|
83
|
-
onSuccess: (id) => {
|
|
83
|
+
onSuccess: (id: string) => {
|
|
84
84
|
queryClient.setQueryData<BackgroundJob<TInput, TResult>[]>(
|
|
85
85
|
queryKey,
|
|
86
|
-
(old) => old?.filter((job) => job.id !== id) ?? [],
|
|
86
|
+
(old: BackgroundJob<TInput, TResult>[] | undefined) => old?.filter((job: BackgroundJob<TInput, TResult>) => job.id !== id) ?? [],
|
|
87
87
|
);
|
|
88
88
|
},
|
|
89
89
|
});
|
|
@@ -93,7 +93,7 @@ export function usePendingJobs<TInput = unknown, TResult = unknown>(
|
|
|
93
93
|
onSuccess: () => {
|
|
94
94
|
queryClient.setQueryData<BackgroundJob<TInput, TResult>[]>(
|
|
95
95
|
queryKey,
|
|
96
|
-
(old) => old?.filter((job) => job.status !== "completed") ?? [],
|
|
96
|
+
(old: BackgroundJob<TInput, TResult>[] | undefined) => old?.filter((job: BackgroundJob<TInput, TResult>) => job.status !== "completed") ?? [],
|
|
97
97
|
);
|
|
98
98
|
},
|
|
99
99
|
});
|
|
@@ -103,12 +103,12 @@ export function usePendingJobs<TInput = unknown, TResult = unknown>(
|
|
|
103
103
|
onSuccess: () => {
|
|
104
104
|
queryClient.setQueryData<BackgroundJob<TInput, TResult>[]>(
|
|
105
105
|
queryKey,
|
|
106
|
-
(old) => old?.filter((job) => job.status !== "failed") ?? [],
|
|
106
|
+
(old: BackgroundJob<TInput, TResult>[] | undefined) => old?.filter((job: BackgroundJob<TInput, TResult>) => job.status !== "failed") ?? [],
|
|
107
107
|
);
|
|
108
108
|
},
|
|
109
109
|
});
|
|
110
110
|
|
|
111
|
-
const getJob = (id: string) => jobs.find((job) => job.id === id);
|
|
111
|
+
const getJob = (id: string) => jobs.find((job: BackgroundJob<TInput, TResult>) => job.id === id);
|
|
112
112
|
|
|
113
113
|
return {
|
|
114
114
|
jobs,
|