@umituz/react-native-ai-generation-content 1.83.47 → 1.83.48

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.83.47",
3
+ "version": "1.83.48",
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",
@@ -49,6 +49,7 @@ export const CREATION_FIELDS = {
49
49
  // AI provider metadata
50
50
  REQUEST_ID: "requestId" as const,
51
51
  MODEL: "model" as const,
52
+ PROVIDER: "provider" as const,
52
53
  } as const;
53
54
 
54
55
  /** Union type of all field names */
@@ -25,8 +25,8 @@ export interface Creation {
25
25
  readonly uri: string;
26
26
  readonly type: string;
27
27
  readonly prompt?: string;
28
+ readonly provider?: string;
28
29
  readonly metadata?: Record<string, unknown>;
29
- readonly originalUri?: string;
30
30
  readonly createdAt: Date;
31
31
  readonly isShared: boolean;
32
32
  readonly isFavorite: boolean;
@@ -53,12 +53,8 @@ interface FirebaseTimestamp {
53
53
  export interface CreationDocument {
54
54
  readonly uri?: string;
55
55
  readonly prompt?: string;
56
+ readonly provider?: string;
56
57
  readonly metadata?: Record<string, unknown>;
57
- readonly originalImage?: string;
58
- readonly originalImageUrl?: string;
59
- readonly transformedImage?: string;
60
- readonly transformedImageUrl?: string;
61
- readonly transformationType?: string;
62
58
  readonly type?: string;
63
59
  readonly status?: string;
64
60
  readonly output?: CreationOutput | null;
@@ -92,21 +88,15 @@ export function mapDocumentToCreation(
92
88
  ): Creation {
93
89
  const creationDate = toDate(data.createdAt) ?? new Date();
94
90
 
95
- // Get URI from output or direct fields
96
- const uri = data.output?.imageUrl ||
97
- data.output?.videoUrl ||
98
- data.transformedImageUrl ||
99
- data.transformedImage ||
100
- data.uri ||
101
- "";
91
+ const uri = data.output?.imageUrl || data.output?.videoUrl || data.uri || "";
102
92
 
103
93
  return {
104
94
  id,
105
95
  uri,
106
- type: data.transformationType || data.type || "unknown",
96
+ type: data.type || "unknown",
107
97
  prompt: data.prompt,
98
+ provider: data.provider,
108
99
  metadata: data.metadata,
109
- originalUri: data.originalImageUrl || data.originalImage,
110
100
  createdAt: creationDate,
111
101
  isShared: data.isShared ?? false,
112
102
  isFavorite: data.isFavorite ?? false,
@@ -25,6 +25,7 @@ export async function createCreation(
25
25
  ...(creation.status !== undefined && { status: creation.status }),
26
26
  ...(creation.output !== undefined && { output: creation.output }),
27
27
  ...(creation.prompt !== undefined && { prompt: creation.prompt }),
28
+ ...(creation.provider !== undefined && { provider: creation.provider }),
28
29
  ...(creation.requestId !== undefined && { requestId: creation.requestId }),
29
30
  ...(creation.model !== undefined && { model: creation.model }),
30
31
  ...(creation.startedAt !== undefined && { startedAt: creation.startedAt }),
@@ -25,6 +25,7 @@ export async function saveAsProcessing(
25
25
  uri: "",
26
26
  type: data.scenarioId,
27
27
  prompt: data.prompt,
28
+ provider: data.provider,
28
29
  status: "processing" as const,
29
30
  createdAt: new Date(),
30
31
  startedAt,
@@ -39,7 +40,6 @@ export async function saveAsProcessing(
39
40
  ...(data.resolution && { resolution: data.resolution }),
40
41
  ...(data.creditCost && { creditCost: data.creditCost }),
41
42
  ...(data.aspectRatio && { aspectRatio: data.aspectRatio }),
42
- ...(data.provider && { provider: data.provider }),
43
43
  ...(data.outputType && { outputType: data.outputType }),
44
44
  },
45
45
  });
@@ -4,6 +4,7 @@
4
4
  */
5
5
 
6
6
  import type { ICreationsRepository } from "../../../../creations/domain/repositories";
7
+ import type { Creation, CreationOutput } from "../../../../creations/domain/entities/Creation";
7
8
  import type { CompletedCreationData } from "./creation-persistence.types";
8
9
 
9
10
 
@@ -16,10 +17,11 @@ export async function updateToCompleted(
16
17
  creationId: string,
17
18
  data: CompletedCreationData
18
19
  ): Promise<void> {
19
- const output: { imageUrl?: string; videoUrl?: string; thumbnailUrl?: string } = {};
20
- if (data.imageUrl) output.imageUrl = data.imageUrl;
21
- if (data.videoUrl) output.videoUrl = data.videoUrl;
22
- if (data.thumbnailUrl) output.thumbnailUrl = data.thumbnailUrl;
20
+ const output: CreationOutput = {
21
+ ...(data.imageUrl && { imageUrl: data.imageUrl }),
22
+ ...(data.videoUrl && { videoUrl: data.videoUrl }),
23
+ ...(data.thumbnailUrl && { thumbnailUrl: data.thumbnailUrl }),
24
+ };
23
25
 
24
26
  const completedAt = new Date();
25
27
  const durationMs =
@@ -33,7 +35,7 @@ export async function updateToCompleted(
33
35
  output,
34
36
  completedAt,
35
37
  ...(durationMs !== undefined && { durationMs }),
36
- } as Partial<import("../../../../creations/domain/entities/Creation").Creation>);
38
+ } as Partial<Creation>);
37
39
 
38
40
  if (typeof __DEV__ !== "undefined" && __DEV__) {
39
41
  console.log("[CreationPersistence] Updated to completed", { creationId });
@@ -53,7 +55,7 @@ export async function updateToFailed(
53
55
  status: "failed" as const,
54
56
  metadata: { error },
55
57
  completedAt: new Date(),
56
- } as Partial<import("../../../../creations/domain/entities/Creation").Creation>);
58
+ } as Partial<Creation>);
57
59
 
58
60
  if (typeof __DEV__ !== "undefined" && __DEV__) {
59
61
  console.log("[CreationPersistence] Updated to failed", { creationId, error });