@umituz/react-native-ai-generation-content 1.17.165 → 1.17.167

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-generation-content",
3
- "version": "1.17.165",
3
+ "version": "1.17.167",
4
4
  "description": "Provider-agnostic AI generation orchestration for React Native",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",
@@ -22,7 +22,6 @@ export class CreationsWriter {
22
22
 
23
23
  const data: CreationDocument = {
24
24
  type: creation.type,
25
- prompt: creation.prompt,
26
25
  uri: creation.uri,
27
26
  createdAt: creation.createdAt,
28
27
  metadata: creation.metadata || {},
@@ -30,6 +29,7 @@ export class CreationsWriter {
30
29
  isFavorite: creation.isFavorite || false,
31
30
  status: creation.status,
32
31
  output: creation.output ?? null,
32
+ ...(creation.prompt !== undefined && { prompt: creation.prompt }),
33
33
  };
34
34
 
35
35
  try {
@@ -10,6 +10,8 @@ import { useAuth } from "@umituz/react-native-auth";
10
10
  import { createCreationsRepository } from "../../infrastructure/adapters";
11
11
  import type { Creation } from "../../domain/entities/Creation";
12
12
 
13
+ declare const __DEV__: boolean;
14
+
13
15
  /**
14
16
  * Configuration for creation persistence
15
17
  */
@@ -70,13 +72,24 @@ export function useCreationPersistence(
70
72
 
71
73
  const onProcessingStart = useCallback(
72
74
  <T extends BaseProcessingStartData>(data: T) => {
73
- if (!userId) return;
75
+ if (__DEV__) {
76
+ console.log("[useCreationPersistence] onProcessingStart called", { type, userId, data });
77
+ }
78
+
79
+ if (!userId) {
80
+ if (__DEV__) console.log("[useCreationPersistence] No userId, skipping");
81
+ return;
82
+ }
74
83
 
75
84
  const { creationId, ...rest } = data;
76
85
  const cleanMetadata = Object.fromEntries(
77
86
  Object.entries(rest).filter(([, v]) => v !== undefined && v !== null),
78
87
  );
79
88
 
89
+ if (__DEV__) {
90
+ console.log("[useCreationPersistence] cleanMetadata", cleanMetadata);
91
+ }
92
+
80
93
  const creation: Creation = {
81
94
  id: creationId,
82
95
  uri: "",
@@ -88,6 +101,10 @@ export function useCreationPersistence(
88
101
  metadata: cleanMetadata,
89
102
  };
90
103
 
104
+ if (__DEV__) {
105
+ console.log("[useCreationPersistence] Creating document", { creationId, type });
106
+ }
107
+
91
108
  repository.create(userId, creation);
92
109
  queryClient.invalidateQueries({ queryKey: ["creations"] });
93
110
  },
@@ -96,7 +113,18 @@ export function useCreationPersistence(
96
113
 
97
114
  const onProcessingComplete = useCallback(
98
115
  <T extends BaseProcessingResult>(result: T) => {
99
- if (!userId || !result.creationId) return;
116
+ if (__DEV__) {
117
+ console.log("[useCreationPersistence] onProcessingComplete called", {
118
+ creationId: result.creationId,
119
+ hasImageUrl: !!result.imageUrl,
120
+ hasVideoUrl: !!result.videoUrl,
121
+ });
122
+ }
123
+
124
+ if (!userId || !result.creationId) {
125
+ if (__DEV__) console.log("[useCreationPersistence] Missing userId or creationId, skipping");
126
+ return;
127
+ }
100
128
 
101
129
  const uri = result.imageUrl || result.videoUrl || "";
102
130
  const output = result.imageUrl
@@ -105,6 +133,13 @@ export function useCreationPersistence(
105
133
  ? { videoUrl: result.videoUrl }
106
134
  : undefined;
107
135
 
136
+ if (__DEV__) {
137
+ console.log("[useCreationPersistence] Updating document to completed", {
138
+ creationId: result.creationId,
139
+ uri: uri.substring(0, 50) + "...",
140
+ });
141
+ }
142
+
108
143
  repository.update(userId, result.creationId, {
109
144
  uri,
110
145
  status: "completed",
@@ -117,7 +152,18 @@ export function useCreationPersistence(
117
152
 
118
153
  const onError = useCallback(
119
154
  (error: string, creationId?: string) => {
120
- if (!userId || !creationId) return;
155
+ if (__DEV__) {
156
+ console.log("[useCreationPersistence] onError called", { error, creationId });
157
+ }
158
+
159
+ if (!userId || !creationId) {
160
+ if (__DEV__) console.log("[useCreationPersistence] Missing userId or creationId, skipping");
161
+ return;
162
+ }
163
+
164
+ if (__DEV__) {
165
+ console.log("[useCreationPersistence] Updating document to failed", { creationId });
166
+ }
121
167
 
122
168
  repository.update(userId, creationId, {
123
169
  status: "failed",