@umituz/react-native-ai-generation-content 1.62.7 → 1.62.8

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.62.7",
3
+ "version": "1.62.8",
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",
@@ -17,11 +17,6 @@ export class CreationsFetcher {
17
17
  ) { }
18
18
 
19
19
  async getAll(userId: string): Promise<Creation[]> {
20
- if (__DEV__) {
21
-
22
- console.log("[CreationsRepository] getAll()", { userId });
23
- }
24
-
25
20
  const userCollection = this.pathResolver.getUserCollection(userId);
26
21
  if (!userCollection) return [];
27
22
 
@@ -29,11 +24,6 @@ export class CreationsFetcher {
29
24
  const q = query(userCollection, orderBy("createdAt", "desc"));
30
25
  const snapshot = await getDocs(q);
31
26
 
32
- if (__DEV__) {
33
-
34
- console.log("[CreationsRepository] Fetched:", snapshot.docs.length);
35
- }
36
-
37
27
  const allCreations = snapshot.docs.map((docSnap) => {
38
28
  const data = docSnap.data() as CreationDocument;
39
29
  const creation = this.documentMapper(docSnap.id, data);
@@ -55,19 +45,13 @@ export class CreationsFetcher {
55
45
  return allCreations.filter((creation: Creation) => !creation.deletedAt);
56
46
  } catch (error) {
57
47
  if (__DEV__) {
58
-
59
- console.error("[CreationsRepository] getAll() ERROR", error);
48
+ console.error("[CreationsFetcher] getAll() error:", error);
60
49
  }
61
50
  return [];
62
51
  }
63
52
  }
64
53
 
65
54
  async getById(userId: string, id: string): Promise<Creation | null> {
66
- if (__DEV__) {
67
-
68
- console.log("[CreationsRepository] getById()", { userId, id });
69
- }
70
-
71
55
  const docRef = this.pathResolver.getDocRef(userId, id);
72
56
  if (!docRef) return null;
73
57
 
@@ -75,10 +59,6 @@ export class CreationsFetcher {
75
59
  const docSnap = await getDoc(docRef);
76
60
 
77
61
  if (!docSnap.exists()) {
78
- if (__DEV__) {
79
-
80
- console.log("[CreationsRepository] Document not found");
81
- }
82
62
  return null;
83
63
  }
84
64
 
@@ -86,8 +66,7 @@ export class CreationsFetcher {
86
66
  return this.documentMapper(docSnap.id, data);
87
67
  } catch (error) {
88
68
  if (__DEV__) {
89
-
90
- console.error("[CreationsRepository] getById() ERROR", error);
69
+ console.error("[CreationsFetcher] getById() error:", error);
91
70
  }
92
71
  return null;
93
72
  }
@@ -98,10 +77,6 @@ export class CreationsFetcher {
98
77
  onData: CreationsSubscriptionCallback,
99
78
  onError?: (error: Error) => void,
100
79
  ): UnsubscribeFunction {
101
- if (__DEV__) {
102
- console.log("[CreationsFetcher] subscribeToAll()", { userId });
103
- }
104
-
105
80
  const userCollection = this.pathResolver.getUserCollection(userId);
106
81
  if (!userCollection) {
107
82
  onData([]);
@@ -135,14 +110,14 @@ export class CreationsFetcher {
135
110
  const filtered = allCreations.filter((c: Creation) => !c.deletedAt);
136
111
 
137
112
  if (__DEV__) {
138
- console.log("[CreationsFetcher] Realtime update:", filtered.length);
113
+ console.log("[CreationsFetcher] Synced:", filtered.length, "creations");
139
114
  }
140
115
 
141
116
  onData(filtered);
142
117
  },
143
118
  (error: Error) => {
144
119
  if (__DEV__) {
145
- console.error("[CreationsFetcher] subscribeToAll() ERROR", error);
120
+ console.error("[CreationsFetcher] Realtime error:", error);
146
121
  }
147
122
  onError?.(error);
148
123
  },
@@ -1,5 +1,4 @@
1
-
2
- if (typeof __DEV__ !== "undefined" && __DEV__) console.log("📍 [LIFECYCLE] CreationsRepository.ts - Module loading");
1
+ declare const __DEV__: boolean;
3
2
 
4
3
  import { BaseRepository, FirestorePathResolver } from "@umituz/react-native-firebase";
5
4
  import type {
@@ -43,8 +42,6 @@ export class CreationsRepository
43
42
  collectionName: string,
44
43
  options?: RepositoryOptions,
45
44
  ) {
46
-
47
- if (typeof __DEV__ !== "undefined" && __DEV__) console.log("📍 [LIFECYCLE] CreationsRepository - Constructor start");
48
45
  super();
49
46
 
50
47
  const documentMapper = options?.documentMapper ?? mapDocumentToCreation;
@@ -53,8 +50,6 @@ export class CreationsRepository
53
50
  this.pathResolver = new FirestorePathResolver(collectionName, null);
54
51
  this.fetcher = new CreationsFetcher(this.pathResolver, documentMapper);
55
52
  this.writer = new CreationsWriter(this.pathResolver);
56
-
57
- if (typeof __DEV__ !== "undefined" && __DEV__) console.log("📍 [LIFECYCLE] CreationsRepository - Constructor end");
58
53
  }
59
54
 
60
55
  async getAll(userId: string): Promise<Creation[]> {
@@ -10,7 +10,7 @@ import type { Creation, CreationDocument } from "../../domain/entities/Creation"
10
10
  const UPDATABLE_FIELDS = [
11
11
  "metadata", "isShared", "uri", "type", "prompt", "status",
12
12
  "output", "rating", "ratedAt", "isFavorite", "deletedAt",
13
- "requestId", "model",
13
+ "requestId", "model", "imageUrl", "videoUrl",
14
14
  ] as const;
15
15
 
16
16
  /**
@@ -107,11 +107,23 @@ export function useCreationPersistence(
107
107
  ? { videoUrl: result.videoUrl }
108
108
  : undefined;
109
109
 
110
- repository.update(userId, result.creationId, {
110
+ // Update with both nested (output) and flat (imageUrl/videoUrl) fields
111
+ // This ensures compatibility with different document mappers
112
+ const updates: Record<string, unknown> = {
111
113
  uri,
112
114
  status: "completed",
113
115
  output,
114
- });
116
+ };
117
+
118
+ // Add flat fields for backwards compatibility
119
+ if (result.imageUrl) {
120
+ updates.imageUrl = result.imageUrl;
121
+ }
122
+ if (result.videoUrl) {
123
+ updates.videoUrl = result.videoUrl;
124
+ }
125
+
126
+ repository.update(userId, result.creationId, updates);
115
127
 
116
128
  if (creditCost && creditCost > 0 && onCreditDeduct) {
117
129
  if (typeof __DEV__ !== "undefined" && __DEV__) {