vidspotai-shared 1.0.1 → 1.0.3

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.
Files changed (41) hide show
  1. package/lib/globals/aiModels.js +3 -3
  2. package/lib/globals/types.d.ts +13 -8
  3. package/lib/globals/types.d.ts.map +1 -1
  4. package/lib/globals/types.js +12 -5
  5. package/lib/models/video.model.d.ts +11 -12
  6. package/lib/models/video.model.d.ts.map +1 -1
  7. package/lib/services/aiGen/providers/alibaba/alibaba.d.ts +1 -1
  8. package/lib/services/aiGen/providers/alibaba/alibaba.d.ts.map +1 -1
  9. package/lib/services/aiGen/providers/alibaba/alibaba.js +11 -28
  10. package/lib/services/aiGen/providers/azure/azure.service.d.ts +1 -1
  11. package/lib/services/aiGen/providers/azure/azure.service.d.ts.map +1 -1
  12. package/lib/services/aiGen/providers/azure/azure.service.js +25 -47
  13. package/lib/services/aiGen/providers/baseAiGenProvider.service.d.ts +1 -1
  14. package/lib/services/aiGen/providers/baseAiGenProvider.service.d.ts.map +1 -1
  15. package/lib/services/aiGen/providers/google/google.service.d.ts +1 -1
  16. package/lib/services/aiGen/providers/google/google.service.d.ts.map +1 -1
  17. package/lib/services/aiGen/providers/google/google.service.js +23 -32
  18. package/lib/services/aiGen/providers/kling/kling.service.d.ts +1 -1
  19. package/lib/services/aiGen/providers/kling/kling.service.d.ts.map +1 -1
  20. package/lib/services/aiGen/providers/kling/kling.service.js +10 -25
  21. package/lib/services/aiGen/providers/minimax/minimax.service.d.ts +1 -1
  22. package/lib/services/aiGen/providers/minimax/minimax.service.d.ts.map +1 -1
  23. package/lib/services/aiGen/providers/minimax/minimax.service.js +21 -18
  24. package/lib/services/aiGen/providers/minimax/types.d.ts +1 -0
  25. package/lib/services/aiGen/providers/minimax/types.d.ts.map +1 -1
  26. package/lib/services/aiGen/providers/openai/openai.service.d.ts +1 -1
  27. package/lib/services/aiGen/providers/openai/openai.service.d.ts.map +1 -1
  28. package/lib/services/aiGen/providers/openai/openai.service.js +7 -7
  29. package/lib/services/aiGen/providers/runway/runway.service.d.ts +1 -1
  30. package/lib/services/aiGen/providers/runway/runway.service.d.ts.map +1 -1
  31. package/lib/services/aiGen/providers/runway/runway.service.js +8 -8
  32. package/lib/services/aiGen/providers/types.d.ts +4 -4
  33. package/lib/services/aiGen/providers/types.d.ts.map +1 -1
  34. package/lib/services/bullmq.service.d.ts +30 -0
  35. package/lib/services/bullmq.service.d.ts.map +1 -0
  36. package/lib/services/bullmq.service.js +99 -0
  37. package/lib/services/index.d.ts +1 -0
  38. package/lib/services/index.d.ts.map +1 -1
  39. package/lib/services/index.js +1 -0
  40. package/lib/services/redis.service.js +1 -1
  41. package/package.json +8 -6
@@ -350,12 +350,12 @@ exports.aiModelConfigs = {
350
350
  type: ["text-to-video"],
351
351
  fields: {
352
352
  prompt: { required: true },
353
- resolution: { allowedValues: ["512P", "768P", "1080P"] }, // 768P as default
353
+ resolution: { allowedValues: ["768P", "1080P"] }, // 768P as default
354
354
  duration: { allowedValues: [6, 10] }, // in seconds, 6s as default
355
355
  },
356
356
  durationRules: {
357
- 6: ["512P", "768P", "1080P"],
358
- 10: ["512P", "768P"],
357
+ 6: ["768P", "1080P"],
358
+ 10: ["768P"],
359
359
  },
360
360
  // parallelRequests: 1,
361
361
  cost: {
@@ -12,18 +12,23 @@ export interface IDetectLang {
12
12
  chunks: any[];
13
13
  }
14
14
  export declare enum EVideoJobStatus {
15
- QUEUED = "queued",
16
- TRIGGERED = "triggered",
17
- COMPLETED = "completed",
18
- FAILED = "failed",
19
- STITCHING = "stitching",
20
- PENDING = "pending",
21
- PARTIALLY_COMPLETED = "partiallyCompleted",
22
- IN_PROGRESS = "inProgress"
15
+ QUEUED = "queued",// for video: job is sent to redis queue
16
+ IN_PROGRESS = "inProgress",// for video: job is being processed (set in prepare scene)
17
+ COMPLETED = "completed",// for video: all scenes generated and stiched
18
+ FAILED = "failed",// for video: all scenes failed
19
+ PARTIALLY_COMPLETED = "partiallyCompleted"
20
+ }
21
+ export declare enum EVideoSceneStatus {
22
+ IN_PROGRESS = "inProgress",// for scene: scene is queued for generation in prepare scenes (set in prepare scene)
23
+ TRIGGERED = "triggered",// for scene: when provider video generation function is called in trigger video generation
24
+ PENDING = "pending",// for scene: triggered, status checked but still in progress (wont be setting it in scene status or in firestore, just a status return by provider status method)
25
+ FAILED = "failed",// for scene: scene generation failed
26
+ COMPLETED = "completed"
23
27
  }
24
28
  export declare enum ERedisQueues {
25
29
  VIDEO_JOBS = "video-job-queue"
26
30
  }
31
+ export declare const REDIS_QUEUES: ERedisQueues[];
27
32
  export declare enum EVideoDurationType {
28
33
  SHORT = "short",
29
34
  MEDIUM = "medium",
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/globals/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAYtD,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE;QACT,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,cAAc,CAAC;QACrB,OAAO,EAAE,MAAM,CAAC;QAChB,KAAK,EAAE,MAAM,CAAC;KACf,EAAE,CAAC;IACJ,MAAM,EAAE,GAAG,EAAE,CAAC;CACf;AAED,oBAAY,eAAe;IACzB,MAAM,WAAW;IACjB,SAAS,cAAc;IACvB,SAAS,cAAc;IACvB,MAAM,WAAW;IACjB,SAAS,cAAc;IACvB,OAAO,YAAY;IACnB,mBAAmB,uBAAuB;IAC1C,WAAW,eAAe;CAC3B;AAMD,oBAAY,YAAY;IACtB,UAAU,oBAAoB;CAC/B;AAED,oBAAY,kBAAkB;IAC5B,KAAK,UAAU;IACf,MAAM,WAAW;IACjB,IAAI,SAAS;CACd;AAYD,MAAM,MAAM,aAAa,GAAG,uB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,OAAO;IACT,EAAE,OAAO;IACT,EAAE,OAAO;IACT,EAAE,OAAO;IACT,EAAE,OAAO;CACV;AAED,oBAAY,kBAAkB;IAC5B,QAAQ,OAAO;IACf,OAAO,OAAO;IACd,MAAM,OAAO;IACb,QAAQ,OAAO;IACf,OAAO,OAAO;IACd,OAAO,OAAO;IACd,SAAS,OAAO;IAChB,OAAO,OAAO;IACd,OAAO,OAAO;IACd,OAAO,OAAO;IACd,QAAQ,OAAO;IACf,KAAK,OAAO;IACZ,MAAM,OAAO;IACb,KAAK,OAAO;IACZ,QAAQ,OAAO;IACf,OAAO,OAAO;IACd,MAAM,OAAO;IACb,QAAQ,OAAO;IACf,MAAM,OAAO;IACb,KAAK,OAAO;IACZ,QAAQ,OAAO;IACf,KAAK,OAAO;IACZ,SAAS,OAAO;IAChB,SAAS,OAAO;IAChB,UAAU,OAAO;IACjB,OAAO,OAAO;IACd,QAAQ,OAAO;IACf,OAAO,OAAO;IACd,MAAM,OAAO;IACb,MAAM,OAAO;IACb,OAAO,OAAO;IACd,UAAU,OAAO;IACjB,UAAU,OAAO;IACjB,KAAK,OAAO;IACZ,SAAS,OAAO;IAChB,OAAO,OAAO;IACd,SAAS,OAAO;IAChB,SAAS,OAAO;IAChB,OAAO,OAAO;IACd,MAAM,OAAO;IACb,UAAU,OAAO;IACjB,OAAO,OAAO;IACd,QAAQ,OAAO;IACf,OAAO,OAAO;IACd,OAAO,OAAO;IACd,MAAM,OAAO;IACb,SAAS,OAAO;IAChB,MAAM,OAAO;IACb,OAAO,OAAO;IACd,OAAO,OAAO;IACd,OAAO,OAAO;IACd,OAAO,OAAO;IACd,KAAK,OAAO;IACZ,MAAM,OAAO;IACb,IAAI,OAAO;IACX,OAAO,OAAO;IACd,SAAS,OAAO;IAChB,IAAI,OAAO;IACX,UAAU,OAAO;CAClB"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/globals/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,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OAAO;IACb,KAAK,OAAO;IACZ,QAAQ,OAAO;IACf,OAAO,OAAO;IACd,MAAM,OAAO;IACb,QAAQ,OAAO;IACf,MAAM,OAAO;IACb,KAAK,OAAO;IACZ,QAAQ,OAAO;IACf,KAAK,OAAO;IACZ,SAAS,OAAO;IAChB,SAAS,OAAO;IAChB,UAAU,OAAO;IACjB,OAAO,OAAO;IACd,QAAQ,OAAO;IACf,OAAO,OAAO;IACd,MAAM,OAAO;IACb,MAAM,OAAO;IACb,OAAO,OAAO;IACd,UAAU,OAAO;IACjB,UAAU,OAAO;IACjB,KAAK,OAAO;IACZ,SAAS,OAAO;IAChB,OAAO,OAAO;IACd,SAAS,OAAO;IAChB,SAAS,OAAO;IAChB,OAAO,OAAO;IACd,MAAM,OAAO;IACb,UAAU,OAAO;IACjB,OAAO,OAAO;IACd,QAAQ,OAAO;IACf,OAAO,OAAO;IACd,OAAO,OAAO;IACd,MAAM,OAAO;IACb,SAAS,OAAO;IAChB,MAAM,OAAO;IACb,OAAO,OAAO;IACd,OAAO,OAAO;IACd,OAAO,OAAO;IACd,OAAO,OAAO;IACd,KAAK,OAAO;IACZ,MAAM,OAAO;IACb,IAAI,OAAO;IACX,OAAO,OAAO;IACd,SAAS,OAAO;IAChB,IAAI,OAAO;IACX,UAAU,OAAO;CAClB"}
@@ -1,17 +1,23 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EGPT_LANGUAGE_CODE = exports.ELANGUAGE_CODE = exports.ERROR_CODE = exports.EENVS = exports.ECURRENCY = exports.ESUBSCRIPTION_STATUS = exports.ERENEWAL_FREQUENCY = exports.ESUBSCRIPTION_PLANS = exports.ESCHEDULE_UPDATE_STATUS = exports.EVideoDurationType = exports.ERedisQueues = exports.EVideoJobStatus = void 0;
3
+ exports.EGPT_LANGUAGE_CODE = exports.ELANGUAGE_CODE = exports.ERROR_CODE = exports.EENVS = exports.ECURRENCY = exports.ESUBSCRIPTION_STATUS = exports.ERENEWAL_FREQUENCY = exports.ESUBSCRIPTION_PLANS = exports.ESCHEDULE_UPDATE_STATUS = exports.EVideoDurationType = exports.REDIS_QUEUES = exports.ERedisQueues = exports.EVideoSceneStatus = exports.EVideoJobStatus = void 0;
4
4
  var EVideoJobStatus;
5
5
  (function (EVideoJobStatus) {
6
6
  EVideoJobStatus["QUEUED"] = "queued";
7
- EVideoJobStatus["TRIGGERED"] = "triggered";
7
+ EVideoJobStatus["IN_PROGRESS"] = "inProgress";
8
+ // STITCHING = "stitching", // for video: when all scenes are generated and video stitching is in progress
8
9
  EVideoJobStatus["COMPLETED"] = "completed";
9
10
  EVideoJobStatus["FAILED"] = "failed";
10
- EVideoJobStatus["STITCHING"] = "stitching";
11
- EVideoJobStatus["PENDING"] = "pending";
12
11
  EVideoJobStatus["PARTIALLY_COMPLETED"] = "partiallyCompleted";
13
- EVideoJobStatus["IN_PROGRESS"] = "inProgress";
14
12
  })(EVideoJobStatus || (exports.EVideoJobStatus = EVideoJobStatus = {}));
13
+ var EVideoSceneStatus;
14
+ (function (EVideoSceneStatus) {
15
+ EVideoSceneStatus["IN_PROGRESS"] = "inProgress";
16
+ EVideoSceneStatus["TRIGGERED"] = "triggered";
17
+ EVideoSceneStatus["PENDING"] = "pending";
18
+ EVideoSceneStatus["FAILED"] = "failed";
19
+ EVideoSceneStatus["COMPLETED"] = "completed";
20
+ })(EVideoSceneStatus || (exports.EVideoSceneStatus = EVideoSceneStatus = {}));
15
21
  // export const ERedisQueues = {
16
22
  // videoJobs: "video-job-queue",
17
23
  // } as const;
@@ -19,6 +25,7 @@ var ERedisQueues;
19
25
  (function (ERedisQueues) {
20
26
  ERedisQueues["VIDEO_JOBS"] = "video-job-queue";
21
27
  })(ERedisQueues || (exports.ERedisQueues = ERedisQueues = {}));
28
+ exports.REDIS_QUEUES = [ERedisQueues.VIDEO_JOBS];
22
29
  var EVideoDurationType;
23
30
  (function (EVideoDurationType) {
24
31
  EVideoDurationType["SHORT"] = "short";
@@ -1,19 +1,16 @@
1
1
  import { FieldValue } from "firebase-admin/firestore";
2
2
  import { EVideoGenModels } from "../globals/aiModels";
3
- import { EVideoDurationType, EVideoJobStatus, TVideoJobTask } from "../globals/types";
3
+ import { EVideoDurationType, EVideoJobStatus, EVideoSceneStatus, TVideoJobTask } from "../globals/types";
4
4
  import { EVideoMode } from "../services/aiGen/types";
5
5
  export interface IVideoScene {
6
6
  task?: TVideoJobTask;
7
7
  sceneIndex: number;
8
- modelKey?: EVideoGenModels;
9
8
  duration?: number;
10
9
  prompt?: string;
11
- resolution?: string;
12
- aspectRatio?: string;
13
10
  outputVideoUrl?: string;
14
11
  inputVideoUrl?: string;
15
12
  inputImageUrl?: string;
16
- status: EVideoJobStatus;
13
+ status: EVideoSceneStatus;
17
14
  creditsUsed?: number;
18
15
  errorMessage?: string;
19
16
  retryCount?: number;
@@ -21,24 +18,26 @@ export interface IVideoScene {
21
18
  }
22
19
  export interface IVideoJobModel {
23
20
  userId: string;
24
- title?: string;
25
21
  modelKey: EVideoGenModels;
22
+ status: EVideoJobStatus;
23
+ title?: string;
26
24
  language?: string;
27
25
  prompt?: string;
28
26
  originalPrompt?: string;
29
- duration: number;
30
- mode?: EVideoMode;
31
- dimensions?: string;
32
- resolution?: string;
33
- aspectRatio?: string;
34
27
  scriptId?: string;
35
28
  scenes?: IVideoScene[];
36
29
  finalVideoUrl?: string;
37
- status: EVideoJobStatus;
38
30
  errorMessage?: string;
39
31
  totalCreditsUsed?: number;
40
32
  estimatedCredits?: number;
41
33
  durationType?: EVideoDurationType;
34
+ duration: number;
35
+ mode?: EVideoMode;
36
+ dimensions?: string;
37
+ resolution?: string;
38
+ aspectRatio?: string;
39
+ inputVideoUrl?: string;
40
+ inputImageUrl?: string;
42
41
  createdAt: FieldValue;
43
42
  updatedAt: FieldValue;
44
43
  }
@@ -1 +1 @@
1
- {"version":3,"file":"video.model.d.ts","sourceRoot":"","sources":["../../src/models/video.model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UA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M,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,WAAW,EAAE,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,YAAY,CAAC,EAAE,kBAAkB,CAAC;IAGlC,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IAGvB,SAAS,EAAE,UAAU,CAAC;IACtB,SAAS,EAAE,UAAU,CAAC;CACvB"}
@@ -6,7 +6,7 @@ export declare class AlibabaService extends BaseAiGenProviderService {
6
6
  constructor();
7
7
  private request;
8
8
  generateVideo(params: VideoGenerationParams): Promise<VideoGenerationResult>;
9
- checkVideoStatus({ task, outputFilename, outputFilePath, }: VideoStatusParams): Promise<VideoStatusResult | null>;
9
+ checkVideoStatus({ task, outputFilename, outputFilePath, }: VideoStatusParams): Promise<VideoStatusResult>;
10
10
  getCreditUsed({ modelKey, resolution, aspectRatio, duration, }: CreditUsageParams): number;
11
11
  }
12
12
  //# sourceMappingURL=alibaba.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"alibaba.d.ts","sourceRoot":"","sources":["../../../../../src/services/aiGen/providers/alibaba/alibaba.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EAC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22 +33,8 @@ class AlibabaService extends baseAiGenProvider_service_1.BaseAiGenProviderServic
33
33
  timeout: this.timeout,
34
34
  data: method === "POST" ? body : undefined,
35
35
  };
36
- try {
37
- const res = await axios_1.default.request(config);
38
- return res.data;
39
- }
40
- catch (err) {
41
- if (err.response) {
42
- console.error("Alibaba API error:", err.response.data);
43
- }
44
- else if (err.request) {
45
- console.error("Alibaba API request error:", err.message);
46
- }
47
- else {
48
- console.error("Unexpected error:", err.message);
49
- }
50
- return null;
51
- }
36
+ const res = await axios_1.default.request(config);
37
+ return res.data;
52
38
  }
53
39
  async generateVideo(params) {
54
40
  (0, helpers_2.validateParams)(params);
@@ -72,14 +58,11 @@ class AlibabaService extends baseAiGenProvider_service_1.BaseAiGenProviderServic
72
58
  },
73
59
  };
74
60
  const result = await this.request(body);
75
- if (!result || !result.request_id) {
76
- return {
77
- status: types_1.EVideoJobStatus.FAILED,
78
- };
79
- }
61
+ if (!result || !result.request_id)
62
+ throw new Error("No response from Alibaba API");
80
63
  return {
81
64
  task: result.request_id,
82
- status: types_1.EVideoJobStatus.TRIGGERED,
65
+ status: types_1.EVideoSceneStatus.TRIGGERED,
83
66
  };
84
67
  }
85
68
  async checkVideoStatus({ task, outputFilename, outputFilePath = "videos", }) {
@@ -87,7 +70,7 @@ class AlibabaService extends baseAiGenProvider_service_1.BaseAiGenProviderServic
87
70
  const result = await this.request(null, "GET", statusUrl);
88
71
  if (!result) {
89
72
  return {
90
- status: types_1.EVideoJobStatus.FAILED,
73
+ status: types_1.EVideoSceneStatus.FAILED,
91
74
  errorMessage: "No response from Alibaba API",
92
75
  };
93
76
  }
@@ -98,7 +81,7 @@ class AlibabaService extends baseAiGenProvider_service_1.BaseAiGenProviderServic
98
81
  result.output?.video_url;
99
82
  if (!videoUrl) {
100
83
  return {
101
- status: types_1.EVideoJobStatus.FAILED,
84
+ status: types_1.EVideoSceneStatus.FAILED,
102
85
  errorMessage: "No video URL found in Alibaba response",
103
86
  };
104
87
  }
@@ -118,24 +101,24 @@ class AlibabaService extends baseAiGenProvider_service_1.BaseAiGenProviderServic
118
101
  });
119
102
  return {
120
103
  videoUrl: signedUrl,
121
- status: types_1.EVideoJobStatus.COMPLETED,
104
+ status: types_1.EVideoSceneStatus.COMPLETED,
122
105
  };
123
106
  }
124
107
  catch (downloadErr) {
125
108
  console.error("Error downloading or saving Alibaba video:", downloadErr);
126
109
  return {
127
- status: types_1.EVideoJobStatus.FAILED,
110
+ status: types_1.EVideoSceneStatus.FAILED,
128
111
  errorMessage: "Error downloading or saving video file",
129
112
  };
130
113
  }
131
114
  }
132
115
  if (status === "FAILED" || status === "failed") {
133
116
  return {
134
- status: types_1.EVideoJobStatus.FAILED,
117
+ status: types_1.EVideoSceneStatus.FAILED,
135
118
  errorMessage: result.output?.message || "Video generation failed",
136
119
  };
137
120
  }
138
- return { status: types_1.EVideoJobStatus.PENDING };
121
+ return { status: types_1.EVideoSceneStatus.PENDING };
139
122
  }
140
123
  getCreditUsed({ modelKey, resolution, aspectRatio, duration, }) {
141
124
  const modelConfig = aiModels_1.aiModelConfigs[modelKey];
@@ -8,7 +8,7 @@ export declare class AzureService extends BaseAiGenProviderService {
8
8
  constructor();
9
9
  private request;
10
10
  generateVideo(params: VideoGenerationParams): Promise<VideoGenerationResult>;
11
- checkVideoStatus({ task, outputFilename, outputFilePath, }: VideoStatusParams): Promise<VideoStatusResult | null>;
11
+ checkVideoStatus({ task, outputFilename, outputFilePath, }: VideoStatusParams): Promise<VideoStatusResult>;
12
12
  getCreditUsed({ modelKey, dimensions, duration, }: CreditUsageParams): number;
13
13
  }
14
14
  //# sourceMappingURL=azure.service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"azure.service.d.ts","sourceRoot":"","sources":["../../../../../src/services/aiGen/providers/azure/azure.service.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,UAAU,CAAC;AAElB,qBAAa,YAAa,SAAQ,wBAAwB;IACxD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAa;IACxC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;;YAYnB,OAAO;IAyCf,aAAa,CAAC,MAAM,EAAE,qBAAqB,GAAG,OAAO,CAAC,qBAAqB,CAAC;IA6B5E,gBAAgB,CAAC,EACrB,IAAI,EACJ,cAAc,EACd,cAAyB,GAC1B,EAAE,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC;IAuDxD,aAAa,CAAC,EACZ,QAAQ,EACR,UAAsB,EACtB,QAAY,GACb,EAAE,iBAAiB,GAAG,MAAM;CAK9B"}
1
+ {"version":3,"file":"azure.service.d.ts","sourceRoot":"","sources":["../../../../../src/services/aiGen/providers/azure/azure.service.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,UAAU,CAAC;AAElB,qBAAa,YAAa,SAAQ,wBAAwB;IACxD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAa;IACxC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;;YAiBnB,OAAO;IAwBf,aAAa,CACjB,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,qBAAqB,CAAC;IA6B3B,gBAAgB,CAAC,EACrB,IAAI,EACJ,cAAc,EACd,cAAyB,GAC1B,EAAE,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAgDjD,aAAa,CAAC,EACZ,QAAQ,EACR,UAAsB,EACtB,QAAY,GACb,EAAE,iBAAiB,GAAG,MAAM;CAK9B"}
@@ -16,7 +16,8 @@ class AzureService extends baseAiGenProvider_service_1.BaseAiGenProviderService
16
16
  super();
17
17
  this.apiVersion = "preview";
18
18
  this.timeout = 60000; // 60 seconds
19
- if (!process.env.AZURE_OPENAI_ENDPOINT || !process.env.AZURE_OPENAI_API_KEY) {
19
+ if (!process.env.AZURE_OPENAI_ENDPOINT ||
20
+ !process.env.AZURE_OPENAI_API_KEY) {
20
21
  throw new Error("Missing AZURE_OPENAI_ENDPOINT or AZURE_OPENAI_API_KEY in environment variables");
21
22
  }
22
23
  this.baseUrl = process.env.AZURE_OPENAI_ENDPOINT;
@@ -34,24 +35,8 @@ class AzureService extends baseAiGenProvider_service_1.BaseAiGenProviderService
34
35
  timeout: this.timeout,
35
36
  data: body,
36
37
  };
37
- try {
38
- const res = await axios_1.default.request(config);
39
- return res.data;
40
- }
41
- catch (err) {
42
- if (err.response) {
43
- console.error("Azure OpenAI API error:", err.response.data);
44
- throw new Error(`Azure API Error: ${err.response.status} ${err.response.statusText} - ${JSON.stringify(err.response.data)}`);
45
- }
46
- else if (err.request) {
47
- console.error("Azure OpenAI API request error:", err.message);
48
- throw new Error(`Azure API Request failed: ${err.message}`);
49
- }
50
- else {
51
- console.error("Unexpected Azure API error:", err.message);
52
- throw new Error(`Unexpected Azure API error: ${err.message}`);
53
- }
54
- }
38
+ const res = await axios_1.default.request(config);
39
+ return res.data;
55
40
  }
56
41
  async generateVideo(params) {
57
42
  (0, helpers_2.validateParams)(params);
@@ -70,7 +55,7 @@ class AzureService extends baseAiGenProvider_service_1.BaseAiGenProviderService
70
55
  const job = await this.request(`/openai/v1/video/generations/jobs?`, "POST", body);
71
56
  return {
72
57
  task: job.id,
73
- status: job.status || types_1.EVideoJobStatus.PENDING,
58
+ status: types_1.EVideoSceneStatus.TRIGGERED,
74
59
  };
75
60
  }
76
61
  async checkVideoStatus({ task, outputFilename, outputFilePath = "videos", }) {
@@ -78,43 +63,36 @@ class AzureService extends baseAiGenProvider_service_1.BaseAiGenProviderService
78
63
  if (result.status === "succeeded") {
79
64
  if (!result.generations || !(result.generations.length > 0)) {
80
65
  return {
81
- status: types_1.EVideoJobStatus.FAILED,
66
+ status: types_1.EVideoSceneStatus.FAILED,
82
67
  errorMessage: "No video returned from API",
83
68
  };
84
69
  }
85
70
  const generationId = result.generations[0].id;
86
71
  const videoUrl = `${this.baseUrl}/openai/v1/video/generations/${generationId}/content/video?api-version=${this.apiVersion}`;
87
- try {
88
- const videoResp = await axios_1.default.get(videoUrl, {
89
- headers: { "api-key": this.apiKey },
90
- responseType: "arraybuffer",
91
- timeout: this.timeout,
92
- });
93
- const filePath = `${outputFilePath}/${outputFilename}.mp4`;
94
- const file = (0, firebase_1.getBucket)().file(filePath);
95
- const buffer = Buffer.from(videoResp.data);
96
- await file.save(buffer, { contentType: "video/mp4" });
97
- const [signedUrl] = await file.getSignedUrl({
98
- action: "read",
99
- expires: "03-09-2491",
100
- });
101
- return { videoUrl: signedUrl, status: types_1.EVideoJobStatus.COMPLETED };
102
- }
103
- catch (downloadErr) {
104
- console.error("Error downloading Azure video:", downloadErr.message);
105
- return {
106
- status: types_1.EVideoJobStatus.FAILED,
107
- errorMessage: "Failed to download or save video content",
108
- };
109
- }
72
+ const videoResp = await axios_1.default.get(videoUrl, {
73
+ headers: { "api-key": this.apiKey },
74
+ responseType: "arraybuffer",
75
+ timeout: this.timeout,
76
+ });
77
+ if (!videoResp.data)
78
+ throw new Error("No video data received from Azure API");
79
+ const filePath = `${outputFilePath}/${outputFilename}.mp4`;
80
+ const file = (0, firebase_1.getBucket)().file(filePath);
81
+ const buffer = Buffer.from(videoResp.data);
82
+ await file.save(buffer, { contentType: "video/mp4" });
83
+ const [signedUrl] = await file.getSignedUrl({
84
+ action: "read",
85
+ expires: "03-09-2491",
86
+ });
87
+ return { videoUrl: signedUrl, status: types_1.EVideoSceneStatus.COMPLETED };
110
88
  }
111
- if (result.status === "failed" || result.status === types_1.EVideoJobStatus.FAILED) {
89
+ else if (result.status === "failed") {
112
90
  return {
113
- status: types_1.EVideoJobStatus.FAILED,
91
+ status: types_1.EVideoSceneStatus.FAILED,
114
92
  errorMessage: `Task failed: ${result.failure_reason || "unknown"}`,
115
93
  };
116
94
  }
117
- return { status: types_1.EVideoJobStatus.PENDING };
95
+ return { status: types_1.EVideoSceneStatus.PENDING };
118
96
  }
119
97
  getCreditUsed({ modelKey, dimensions = "480x480", duration = 5, }) {
120
98
  const modelConfig = aiModels_1.aiModelConfigs[modelKey];
@@ -1,7 +1,7 @@
1
1
  import { CreditUsageParams, TextGenerationParams, TextGenerationResult, VideoGenerationParams, VideoGenerationResult, VideoStatusParams, VideoStatusResult } from "./types";
2
2
  export declare abstract class BaseAiGenProviderService {
3
3
  abstract generateVideo(params: VideoGenerationParams): Promise<VideoGenerationResult>;
4
- abstract checkVideoStatus(params: VideoStatusParams): Promise<VideoStatusResult | null>;
4
+ abstract checkVideoStatus(params: VideoStatusParams): Promise<VideoStatusResult>;
5
5
  generateText?(params: TextGenerationParams): Promise<TextGenerationResult>;
6
6
  getCreditUsed(params: CreditUsageParams): number;
7
7
  }
@@ -1 +1 @@
1
- {"version":3,"file":"baseAiGenProvider.service.d.ts","sourceRoot":"","sources":["../../../../src/services/aiGen/providers/baseAiGenProvider.service.ts"],"names":[],"mappings":"AACA,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,SAAS,CAAC;AAEjB,8BAAsB,wBAAwB;IAC5C,QAAQ,CAAC,aAAa,CACpB,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,qBAAqB,CAAC;IAEjC,QAAQ,CAAC,gBAAgB,CACvB,MAAM,EAAE,iBAAiB,GACxB,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC;IAE9B,YAAY,CAAC,CACjB,MAAM,EAAE,oBAAoB,GAC3B,OAAO,CAAC,oBAAoB,CAAC;IAIhC,aAAa,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM;CAKjD"}
1
+ {"version":3,"file":"baseAiGenProvider.service.d.ts","sourceRoot":"","sources":["../../../../src/services/aiGen/providers/baseAiGenProvider.service.ts"],"names":[],"mappings":"AACA,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,SAAS,CAAC;AAEjB,8BAAsB,wBAAwB;IAC5C,QAAQ,CAAC,aAAa,CACpB,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,qBAAqB,CAAC;IAEjC,QAAQ,CAAC,gBAAgB,CACvB,MAAM,EAAE,iBAAiB,GACxB,OAAO,CAAC,iBAAiB,CAAC;IAEvB,YAAY,CAAC,CACjB,MAAM,EAAE,oBAAoB,GAC3B,OAAO,CAAC,oBAAoB,CAAC;IAIhC,aAAa,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM;CAKjD"}
@@ -4,7 +4,7 @@ export declare class GoogleService extends BaseAiGenProviderService {
4
4
  private ai;
5
5
  constructor();
6
6
  generateVideo(params: VideoGenerationParams): Promise<VideoGenerationResult>;
7
- checkVideoStatus({ task, outputFilename, outputFilePath, }: VideoStatusParams): Promise<VideoStatusResult | null>;
7
+ checkVideoStatus({ task, outputFilename, outputFilePath, }: VideoStatusParams): Promise<VideoStatusResult>;
8
8
  getCreditUsed({ modelKey, duration }: CreditUsageParams): number;
9
9
  }
10
10
  //# sourceMappingURL=google.service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"google.service.d.ts","sourceRoot":"","sources":["../../../../../src/services/aiGen/providers/google/google.service.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,UAAU,CAAC;AAIlB,qBAAa,aAAc,SAAQ,wBAAwB;IACzD,OAAO,CAAC,EAAE,CAAc;;IAOlB,aAAa,CACjB,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,qBAAqB,CAAC;IAoC3B,gBAAgB,CAAC,EACrB,IAAI,EAEJ,cAAc,EACd,cAAyB,GAC1B,EAAE,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC;IAgDxD,aAAa,CAAC,EAAE,QAAQ,EAAE,QAAY,EAAE,EAAE,iBAAiB,GAAG,MAAM;CAMrE"}
1
+ {"version":3,"file":"google.service.d.ts","sourceRoot":"","sources":["../../../../../src/services/aiGen/providers/google/google.service.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,UAAU,CAAC;AAIlB,qBAAa,aAAc,SAAQ,wBAAwB;IACzD,OAAO,CAAC,EAAE,CAAc;;IAOlB,aAAa,CACjB,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,qBAAqB,CAAC;IA4B3B,gBAAgB,CAAC,EACrB,IAAI,EAEJ,cAAc,EACd,cAAyB,GAC1B,EAAE,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAgDjD,aAAa,CAAC,EAAE,QAAQ,EAAE,QAAY,EAAE,EAAE,iBAAiB,GAAG,MAAM;CAMrE"}
@@ -15,36 +15,27 @@ class GoogleService extends baseAiGenProvider_service_1.BaseAiGenProviderService
15
15
  this.ai = new genai_1.GoogleGenAI({});
16
16
  }
17
17
  async generateVideo(params) {
18
- try {
19
- (0, helpers_2.validateParams)(params);
20
- const modelConfig = aiModels_1.aiModelConfigs[params.modelKey];
21
- const modelId = modelConfig.modelId;
22
- const request = {
23
- model: modelId,
24
- prompt: params.prompt,
25
- config: {
26
- aspectRatio: params.aspectRatio,
27
- resolution: params.resolution,
28
- },
29
- };
30
- if (params.inputImageUrl) {
31
- const imgResp = await fetch(params.inputImageUrl);
32
- const imgBuffer = Buffer.from(await imgResp.arrayBuffer());
33
- request.image = {
34
- mimeType: "image/png", // or infer from URL (jpg/png)
35
- imageBytes: imgBuffer.toString("base64"),
36
- };
37
- }
38
- const task = await this.ai.models.generateVideos(request);
39
- return { task, status: types_1.EVideoJobStatus.TRIGGERED };
40
- }
41
- catch (error) {
42
- console.error("Google video generation error:", error);
43
- throw {
44
- code: 500,
45
- message: "Google video generation failed. " + String(error),
18
+ (0, helpers_2.validateParams)(params);
19
+ const modelConfig = aiModels_1.aiModelConfigs[params.modelKey];
20
+ const modelId = modelConfig.modelId;
21
+ const request = {
22
+ model: modelId,
23
+ prompt: params.prompt,
24
+ config: {
25
+ aspectRatio: params.aspectRatio,
26
+ resolution: params.resolution,
27
+ },
28
+ };
29
+ if (params.inputImageUrl) {
30
+ const imgResp = await fetch(params.inputImageUrl);
31
+ const imgBuffer = Buffer.from(await imgResp.arrayBuffer());
32
+ request.image = {
33
+ mimeType: "image/png", // or infer from URL (jpg/png)
34
+ imageBytes: imgBuffer.toString("base64"),
46
35
  };
47
36
  }
37
+ const task = await this.ai.models.generateVideos(request);
38
+ return { task, status: types_1.EVideoSceneStatus.TRIGGERED };
48
39
  }
49
40
  async checkVideoStatus({ task,
50
41
  // modelKey,
@@ -57,14 +48,14 @@ class GoogleService extends baseAiGenProvider_service_1.BaseAiGenProviderService
57
48
  if (result.done) {
58
49
  if (result.error) {
59
50
  return {
60
- status: types_1.EVideoJobStatus.FAILED,
51
+ status: types_1.EVideoSceneStatus.FAILED,
61
52
  errorMessage: JSON.stringify(result.error),
62
53
  };
63
54
  }
64
55
  const videoUri = result.response?.generatedVideos?.[0]?.video?.uri;
65
56
  if (!videoUri) {
66
57
  return {
67
- status: types_1.EVideoJobStatus.FAILED,
58
+ status: types_1.EVideoSceneStatus.FAILED,
68
59
  errorMessage: "No video URL found in response",
69
60
  };
70
61
  }
@@ -81,10 +72,10 @@ class GoogleService extends baseAiGenProvider_service_1.BaseAiGenProviderService
81
72
  // const creditsUsed = this.calculateCredits(videoJob);
82
73
  return {
83
74
  videoUrl: signedUrl,
84
- status: types_1.EVideoJobStatus.COMPLETED,
75
+ status: types_1.EVideoSceneStatus.COMPLETED,
85
76
  };
86
77
  }
87
- return { status: types_1.EVideoJobStatus.PENDING };
78
+ return { status: types_1.EVideoSceneStatus.PENDING };
88
79
  }
89
80
  getCreditUsed({ modelKey, duration = 8 }) {
90
81
  const modelConfig = aiModels_1.aiModelConfigs[modelKey];
@@ -6,7 +6,7 @@ export declare class KlingService extends BaseAiGenProviderService {
6
6
  constructor();
7
7
  private request;
8
8
  generateVideo(params: VideoGenerationParams): Promise<VideoGenerationResult>;
9
- checkVideoStatus({ task, outputFilename, outputFilePath, }: VideoStatusParams): Promise<VideoStatusResult | null>;
9
+ checkVideoStatus({ task, outputFilename, outputFilePath, }: VideoStatusParams): Promise<VideoStatusResult>;
10
10
  encodeJwtToken(): string;
11
11
  getCreditUsed({ modelKey, mode, duration, }: CreditUsageParams): number;
12
12
  }
@@ -1 +1 @@
1
- {"version":3,"file":"kling.service.d.ts","sourceRoot":"","sources":["../../../../../src/services/aiGen/providers/kling/kling.service.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,UAAU,CAAC;AAWlB,qBAAa,YAAa,SAAQ,wBAAwB;IACxD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAuC;IAC/D,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;;YAWnB,OAAO;IAgCf,aAAa,CACjB,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,qBAAqB,CAAC;IAkC3B,gBAAgB,CAAC,EACrB,IAAI,EACJ,cAAc,EACd,cAAyB,GAC1B,EAAE,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC;IA8DxD,cAAc,IAAI,MAAM;IAexB,aAAa,CAAC,EACZ,QAAQ,EACR,IAA8B,EAC9B,QAAY,GACb,EAAE,iBAAiB,GAAG,MAAM;CAM9B"}
1
+ {"version":3,"file":"kling.service.d.ts","sourceRoot":"","sources":["../../../../../src/services/aiGen/providers/kling/kling.service.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,UAAU,CAAC;AAWlB,qBAAa,YAAa,SAAQ,wBAAwB;IACxD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAuC;IAC/D,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;;YAWnB,OAAO;IA6Bf,aAAa,CACjB,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,qBAAqB,CAAC;IA8B3B,gBAAgB,CAAC,EACrB,IAAI,EACJ,cAAc,EACd,cAAyB,GAC1B,EAAE,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IA8DjD,cAAc,IAAI,MAAM;IAexB,aAAa,CAAC,EACZ,QAAQ,EACR,IAA8B,EAC9B,QAAY,GACb,EAAE,iBAAiB,GAAG,MAAM;CAM9B"}
@@ -34,23 +34,11 @@ class KlingService extends baseAiGenProvider_service_1.BaseAiGenProviderService
34
34
  timeout: this.timeout,
35
35
  data: body,
36
36
  };
37
- try {
38
- const res = await axios_1.default.request(config);
39
- return res.data;
40
- }
41
- catch (err) {
42
- console.error("Error at Endpoint:", endpoint);
43
- if (err.response) {
44
- console.error("Kling API error:", err.response.data);
45
- }
46
- else if (err.request) {
47
- console.error("Kling API request error:", err.message);
48
- }
49
- else {
50
- console.error("Unexpected error:", err.message);
51
- }
52
- return null;
37
+ const response = await axios_1.default.request(config);
38
+ if (response.status < 200 || response.status >= 300) {
39
+ throw new Error(`Kling API Error: ${response.status} ${response.statusText} — ${JSON.stringify(response.data)}`);
53
40
  }
41
+ return response.data;
54
42
  }
55
43
  async generateVideo(params) {
56
44
  (0, helpers_1.validateParams)(params);
@@ -67,10 +55,7 @@ class KlingService extends baseAiGenProvider_service_1.BaseAiGenProviderService
67
55
  const starttime = Date.now();
68
56
  const task = await this.request("/v1/videos/text2video", "POST", request);
69
57
  console.log(`Kling generateVideo API call took ${Date.now() - starttime} ms`, task ? `(task ID: ${task.data.task_id})` : "(failed)");
70
- if (!task) {
71
- return { status: types_1.EVideoJobStatus.FAILED };
72
- }
73
- return { task: task.data.task_id, status: types_1.EVideoJobStatus.TRIGGERED };
58
+ return { task: task.data.task_id, status: types_1.EVideoSceneStatus.TRIGGERED };
74
59
  }
75
60
  async checkVideoStatus({ task, outputFilename, outputFilePath = "videos", }) {
76
61
  const startTime = Date.now();
@@ -78,7 +63,7 @@ class KlingService extends baseAiGenProvider_service_1.BaseAiGenProviderService
78
63
  console.log(`Kling checkVideoStatus API call took ${Date.now() - startTime} ms`);
79
64
  if (!result) {
80
65
  return {
81
- status: types_1.EVideoJobStatus.FAILED,
66
+ status: types_1.EVideoSceneStatus.FAILED,
82
67
  errorMessage: "No response from Kling API",
83
68
  };
84
69
  }
@@ -86,7 +71,7 @@ class KlingService extends baseAiGenProvider_service_1.BaseAiGenProviderService
86
71
  const videoUrl = result.data.task_result?.videos?.[0]?.url;
87
72
  if (!videoUrl) {
88
73
  return {
89
- status: types_1.EVideoJobStatus.FAILED,
74
+ status: types_1.EVideoSceneStatus.FAILED,
90
75
  errorMessage: "No video URL in response",
91
76
  };
92
77
  }
@@ -106,16 +91,16 @@ class KlingService extends baseAiGenProvider_service_1.BaseAiGenProviderService
106
91
  });
107
92
  return {
108
93
  videoUrl: signedUrl,
109
- status: types_1.EVideoJobStatus.COMPLETED,
94
+ status: types_1.EVideoSceneStatus.COMPLETED,
110
95
  };
111
96
  }
112
97
  if (result.data.task_status === "failed") {
113
98
  return {
114
- status: types_1.EVideoJobStatus.FAILED,
99
+ status: types_1.EVideoSceneStatus.FAILED,
115
100
  errorMessage: `${result.code}: ${result.message}`,
116
101
  };
117
102
  }
118
- return { status: types_1.EVideoJobStatus.PENDING };
103
+ return { status: types_1.EVideoSceneStatus.PENDING };
119
104
  }
120
105
  encodeJwtToken() {
121
106
  const payload = {
@@ -6,7 +6,7 @@ export declare class MinimaxService extends BaseAiGenProviderService {
6
6
  constructor();
7
7
  private request;
8
8
  generateVideo(params: VideoGenerationParams): Promise<VideoGenerationResult>;
9
- checkVideoStatus({ task, outputFilename, outputFilePath, }: VideoStatusParams): Promise<VideoStatusResult | null>;
9
+ checkVideoStatus({ task, outputFilename, outputFilePath, }: VideoStatusParams): Promise<VideoStatusResult>;
10
10
  getCreditUsed({ modelKey, resolution, duration, }: CreditUsageParams): number;
11
11
  }
12
12
  //# sourceMappingURL=minimax.service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"minimax.service.d.ts","sourceRoot":"","sources":["../../../../../src/services/aiGen/providers/minimax/minimax.service.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,UAAU,CAAC;AASlB,qBAAa,cAAe,SAAQ,wBAAwB;IAC1D,OAAO,CAAC,QAAQ,CAAC,OAAO,CACkC;IAE1D,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;;YAUlB,OAAO;IAiCf,aAAa,CACjB,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,qBAAqB,CAAC;IAyB3B,gBAAgB,CAAC,EACrB,IAAI,EACJ,cAAc,EACd,cAAyB,GAC1B,EAAE,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC;IAyExD,aAAa,CAAC,EACZ,QAAQ,EACR,UAAmB,EACnB,QAAY,GACb,EAAE,iBAAiB,GAAG,MAAM;CAO9B"}
1
+ {"version":3,"file":"minimax.service.d.ts","sourceRoot":"","sources":["../../../../../src/services/aiGen/providers/minimax/minimax.service.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,UAAU,CAAC;AASlB,qBAAa,cAAe,SAAQ,wBAAwB;IAC1D,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA4B;IAEpD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;;YAUlB,OAAO;IAiCf,aAAa,CACjB,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,qBAAqB,CAAC;IA4B3B,gBAAgB,CAAC,EACrB,IAAI,EACJ,cAAc,EACd,cAAyB,GAC1B,EAAE,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IA6EjD,aAAa,CAAC,EACZ,QAAQ,EACR,UAAmB,EACnB,QAAY,GACb,EAAE,iBAAiB,GAAG,MAAM;CAO9B"}
@@ -14,7 +14,7 @@ const helpers_2 = require("../../../../utils/helpers");
14
14
  class MinimaxService extends baseAiGenProvider_service_1.BaseAiGenProviderService {
15
15
  constructor() {
16
16
  super();
17
- this.baseUrl = process.env.MINIMAX_API_URL || "https://api.minimax.io";
17
+ this.baseUrl = "https://api.minimax.io";
18
18
  if (!process.env.MINIMAX_ACCESS_KEY) {
19
19
  throw new Error("Missing MINIMAX_ACCESS_KEY in environment variables");
20
20
  }
@@ -49,38 +49,46 @@ class MinimaxService extends baseAiGenProvider_service_1.BaseAiGenProviderServic
49
49
  const requestBody = {
50
50
  model: modelId,
51
51
  prompt: params.prompt,
52
+ first_frame_image: params.inputImageUrl,
52
53
  resolution: params.resolution || "512P",
53
54
  duration: params.duration || 6,
54
55
  };
55
- const task = await this.request("/platform/text_to_video", "POST", requestBody);
56
- const taskId = task.task_id;
57
- return { task: taskId, status: types_1.EVideoJobStatus.PENDING };
56
+ const response = await this.request("/v1/video_generation", "POST", requestBody);
57
+ console.log("Minimax video generation task response:", response);
58
+ const taskId = response.task_id;
59
+ return { task: taskId, status: types_1.EVideoSceneStatus.TRIGGERED };
58
60
  }
59
61
  async checkVideoStatus({ task, outputFilename, outputFilePath = "videos", }) {
60
62
  const result = await this.request(`/v1/query/video_generation`, "GET", undefined, { task_id: `${task}` });
61
- if (result.status === "Success") {
63
+ if (result.status === "Fail") {
64
+ return {
65
+ status: types_1.EVideoSceneStatus.FAILED,
66
+ errorMessage: `${result.base_resp.status_code} ${result.base_resp.status_msg}`,
67
+ };
68
+ }
69
+ else if (result.status === "Success") {
62
70
  if (!result.file_id) {
63
71
  return {
64
- status: types_1.EVideoJobStatus.FAILED,
72
+ status: types_1.EVideoSceneStatus.FAILED,
65
73
  errorMessage: "No file_id in response",
66
74
  };
67
75
  }
68
76
  // Get file metadata and download URL
69
77
  const fileInfo = await this.request(`/v1/files/retrieve`, "GET", undefined, { file_id: result.file_id });
70
- if (!fileInfo.download_url) {
78
+ if (!fileInfo.file.download_url) {
71
79
  return {
72
- status: types_1.EVideoJobStatus.FAILED,
80
+ status: types_1.EVideoSceneStatus.FAILED,
73
81
  errorMessage: `File retrieval failed: ${fileInfo.base_resp?.status_code} ${fileInfo.base_resp?.status_msg}`,
74
82
  };
75
83
  }
76
84
  // Download the video as binary
77
- const videoResp = await axios_1.default.get(fileInfo.download_url, {
85
+ const videoResp = await axios_1.default.get(fileInfo.file.download_url, {
78
86
  responseType: "arraybuffer",
79
87
  timeout: 180000, // 3 minutes
80
88
  });
81
89
  if (videoResp.status !== 200) {
82
90
  return {
83
- status: types_1.EVideoJobStatus.FAILED,
91
+ status: types_1.EVideoSceneStatus.FAILED,
84
92
  errorMessage: `Failed to download video: ${videoResp.status}`,
85
93
  };
86
94
  }
@@ -94,16 +102,11 @@ class MinimaxService extends baseAiGenProvider_service_1.BaseAiGenProviderServic
94
102
  });
95
103
  return {
96
104
  videoUrl: signedUrl,
97
- status: types_1.EVideoJobStatus.COMPLETED,
98
- };
99
- }
100
- if (result.status === "Fail") {
101
- return {
102
- status: types_1.EVideoJobStatus.FAILED,
103
- errorMessage: `${result.base_resp.status_code} ${result.base_resp.status_msg}`,
105
+ status: types_1.EVideoSceneStatus.COMPLETED,
104
106
  };
105
107
  }
106
- return { status: types_1.EVideoJobStatus.PENDING };
108
+ // rest status are pending forms
109
+ return { status: types_1.EVideoSceneStatus.PENDING };
107
110
  }
108
111
  getCreditUsed({ modelKey, resolution = "512P", duration = 6, }) {
109
112
  const modelConfig = aiModels_1.aiModelConfigs[modelKey];
@@ -1,6 +1,7 @@
1
1
  export type MinimaxModelName = "MiniMax-Hailuo-02" | "T2V-01-Director" | "T2V-01";
2
2
  export interface MinimaxVideoGenerateRequest {
3
3
  model: MinimaxModelName;
4
+ first_frame_image?: string;
4
5
  prompt: string;
5
6
  resolution?: string;
6
7
  duration?: number;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/services/aiGen/providers/minimax/types.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,gBAAgB,GACxB,mBAAmB,GACnB,iBAAiB,GACjB,QAAQ,CAAC;AAEb,MAAM,WAAW,2BAA2B;IAC1C,KAAK,EAAE,gBAAgB,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,WAAW,GAAG,UAAU,GAAG,YAAY,GAAG,SAAS,GAAG,MAAM,CAAC;IACrE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE;QACT,WAAW,EAAE,CAAC,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;QAC3C,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;CACH;AAED,MAAM,WAAW,4BAA4B;IAC3C,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE;QACT,WAAW,EAAE,CAAC,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;QACzD,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;CACH"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/services/aiGen/providers/minimax/types.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,gBAAgB,GACxB,mBAAmB,GACnB,iBAAiB,GACjB,QAAQ,CAAC;AAEb,MAAM,WAAW,2BAA2B;IAC1C,KAAK,EAAE,gBAAgB,CAAC;IACxB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,WAAW,GAAG,UAAU,GAAG,YAAY,GAAG,SAAS,GAAG,MAAM,CAAC;IACrE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE;QACT,WAAW,EAAE,CAAC,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;QAC3C,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;CACH;AAED,MAAM,WAAW,4BAA4B;IAC3C,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE;QACT,WAAW,EAAE,CAAC,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;QACzD,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;CACH"}
@@ -5,7 +5,7 @@ export declare class OpenaiService extends BaseAiGenProviderService {
5
5
  private client;
6
6
  constructor();
7
7
  generateVideo(params: VideoGenerationParams): Promise<VideoGenerationResult>;
8
- checkVideoStatus({ task, outputFilename, outputFilePath, }: VideoStatusParams): Promise<VideoStatusResult | null>;
8
+ checkVideoStatus({ task, outputFilename, outputFilePath, }: VideoStatusParams): Promise<VideoStatusResult>;
9
9
  generateText(params: TextGenerationParams): Promise<TextGenerationResult>;
10
10
  getCreditUsed({ modelKey, duration }: CreditUsageParams): number;
11
11
  }
@@ -1 +1 @@
1
- {"version":3,"file":"openai.service.d.ts","sourceRoot":"","sources":["../../../../../src/services/aiGen/providers/openai/openai.service.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,UAAU,CAAC;AAIlB,qBAAa,aAAc,SAAQ,wBAAwB;IACzD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAa;IACxC,OAAO,CAAC,MAAM,CAAS;;IAQjB,aAAa,CACjB,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,qBAAqB,CAAC;IAoB3B,gBAAgB,CAAC,EACrB,IAAI,EACJ,cAAc,EACd,cAAyB,GAC1B,EAAE,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC;IAwClD,YAAY,CAChB,MAAM,EAAE,oBAAoB,GAC3B,OAAO,CAAC,oBAAoB,CAAC;IA4BhC,aAAa,CAAC,EAAE,QAAQ,EAAE,QAAY,EAAE,EAAE,iBAAiB,GAAG,MAAM;CAMrE"}
1
+ {"version":3,"file":"openai.service.d.ts","sourceRoot":"","sources":["../../../../../src/services/aiGen/providers/openai/openai.service.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,UAAU,CAAC;AAElB,qBAAa,aAAc,SAAQ,wBAAwB;IACzD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAa;IACxC,OAAO,CAAC,MAAM,CAAS;;IAQjB,aAAa,CACjB,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,qBAAqB,CAAC;IAoB3B,gBAAgB,CAAC,EACrB,IAAI,EACJ,cAAc,EACd,cAAyB,GAC1B,EAAE,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAsC3C,YAAY,CAChB,MAAM,EAAE,oBAAoB,GAC3B,OAAO,CAAC,oBAAoB,CAAC;IA4BhC,aAAa,CAAC,EAAE,QAAQ,EAAE,QAAY,EAAE,EAAE,iBAAiB,GAAG,MAAM;CAMrE"}
@@ -8,10 +8,10 @@ exports.OpenaiService = void 0;
8
8
  const openai_1 = __importDefault(require("openai"));
9
9
  const aiModels_1 = require("../../../../globals/aiModels");
10
10
  const types_1 = require("../../../../globals/types");
11
+ const firebase_1 = require("../../../../libs/firebase");
12
+ const utils_1 = require("../../../../utils");
11
13
  const helpers_1 = require("../../helpers");
12
14
  const baseAiGenProvider_service_1 = require("../baseAiGenProvider.service");
13
- const utils_1 = require("../../../../utils");
14
- const firebase_1 = require("../../../../libs/firebase");
15
15
  class OpenaiService extends baseAiGenProvider_service_1.BaseAiGenProviderService {
16
16
  constructor() {
17
17
  super();
@@ -30,7 +30,7 @@ class OpenaiService extends baseAiGenProvider_service_1.BaseAiGenProviderService
30
30
  if (job.status === "failed") {
31
31
  throw new Error(`OpenAI video generation failed: ${JSON.stringify(job.error)}`);
32
32
  }
33
- return { task: job.id, status: types_1.EVideoJobStatus.TRIGGERED };
33
+ return { task: job.id, status: types_1.EVideoSceneStatus.TRIGGERED };
34
34
  }
35
35
  async checkVideoStatus({ task, outputFilename, outputFilePath = "videos", }) {
36
36
  // Get job info from OpenAI
@@ -50,19 +50,19 @@ class OpenaiService extends baseAiGenProvider_service_1.BaseAiGenProviderService
50
50
  expires: "03-09-2491",
51
51
  });
52
52
  return {
53
- status: types_1.EVideoJobStatus.COMPLETED,
53
+ status: types_1.EVideoSceneStatus.COMPLETED,
54
54
  videoUrl: signedUrl,
55
55
  };
56
56
  }
57
- if (job.status === "failed") {
57
+ else if (job.status === "failed") {
58
58
  return {
59
- status: types_1.EVideoJobStatus.FAILED,
59
+ status: types_1.EVideoSceneStatus.FAILED,
60
60
  errorMessage: job.error
61
61
  ? `${job.error.code}: ${job.error.message}`
62
62
  : "Unknown error",
63
63
  };
64
64
  }
65
- return { status: types_1.EVideoJobStatus.PENDING };
65
+ return { status: types_1.EVideoSceneStatus.PENDING };
66
66
  }
67
67
  async generateText(params) {
68
68
  const { input, modelKey, options } = params;
@@ -6,7 +6,7 @@ export declare class RunwayService extends BaseAiGenProviderService {
6
6
  constructor();
7
7
  private request;
8
8
  generateVideo(params: VideoGenerationParams): Promise<VideoGenerationResult>;
9
- checkVideoStatus({ task, outputFilename, outputFilePath, }: VideoStatusParams): Promise<VideoStatusResult | null>;
9
+ checkVideoStatus({ task, outputFilename, outputFilePath, }: VideoStatusParams): Promise<VideoStatusResult>;
10
10
  getCreditUsed({ modelKey, duration }: CreditUsageParams): number;
11
11
  }
12
12
  //# sourceMappingURL=runway.service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"runway.service.d.ts","sourceRoot":"","sources":["../../../../../src/services/aiGen/providers/runway/runway.service.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,UAAU,CAAC;AAIlB,qBAAa,aAAc,SAAQ,wBAAwB;IACzD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAiC;IACzD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;;YAUlB,OAAO;IA+Bf,aAAa,CACjB,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,qBAAqB,CAAC;IA+C3B,gBAAgB,CAAC,EACrB,IAAI,EACJ,cAAc,EACd,cAAyB,GAC1B,EAAE,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC;IA4DxD,aAAa,CAAC,EAAE,QAAQ,EAAE,QAAY,EAAE,EAAE,iBAAiB,GAAG,MAAM;CAIrE"}
1
+ {"version":3,"file":"runway.service.d.ts","sourceRoot":"","sources":["../../../../../src/services/aiGen/providers/runway/runway.service.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,UAAU,CAAC;AAGlB,qBAAa,aAAc,SAAQ,wBAAwB;IACzD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAiC;IACzD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;;YAUlB,OAAO;IA+Bf,aAAa,CACjB,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,qBAAqB,CAAC;IAuC3B,gBAAgB,CAAC,EACrB,IAAI,EACJ,cAAc,EACd,cAAyB,GAC1B,EAAE,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IA4DjD,aAAa,CAAC,EAAE,QAAQ,EAAE,QAAY,EAAE,EAAE,iBAAiB,GAAG,MAAM;CAIrE"}
@@ -6,11 +6,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.RunwayService = void 0;
7
7
  const axios_1 = __importDefault(require("axios"));
8
8
  const aiModels_1 = require("../../../../globals/aiModels");
9
- const helpers_1 = require("../../../../utils/helpers");
9
+ const types_1 = require("../../../../globals/types");
10
10
  const firebase_1 = require("../../../../libs/firebase");
11
+ const helpers_1 = require("../../../../utils/helpers");
11
12
  const helpers_2 = require("../../helpers");
12
13
  const baseAiGenProvider_service_1 = require("../baseAiGenProvider.service");
13
- const types_1 = require("../../../../globals/types");
14
14
  class RunwayService extends baseAiGenProvider_service_1.BaseAiGenProviderService {
15
15
  constructor() {
16
16
  super();
@@ -69,7 +69,7 @@ class RunwayService extends baseAiGenProvider_service_1.BaseAiGenProviderService
69
69
  else {
70
70
  throw new Error(`Invalid params: Model ${params.modelKey} does not support this generation type`);
71
71
  }
72
- return { task: run.id, status: types_1.EVideoJobStatus.PENDING };
72
+ return { task: run.id, status: types_1.EVideoSceneStatus.TRIGGERED };
73
73
  }
74
74
  async checkVideoStatus({ task, outputFilename, outputFilePath = "videos", }) {
75
75
  const result = await this.request(`/tasks/${task}`, "GET");
@@ -77,7 +77,7 @@ class RunwayService extends baseAiGenProvider_service_1.BaseAiGenProviderService
77
77
  const videoUri = result.output[0];
78
78
  if (!videoUri) {
79
79
  return {
80
- status: types_1.EVideoJobStatus.FAILED,
80
+ status: types_1.EVideoSceneStatus.FAILED,
81
81
  errorMessage: "No video returned from Runway API",
82
82
  };
83
83
  }
@@ -88,7 +88,7 @@ class RunwayService extends baseAiGenProvider_service_1.BaseAiGenProviderService
88
88
  });
89
89
  if (videoResp.status !== 200) {
90
90
  return {
91
- status: types_1.EVideoJobStatus.FAILED,
91
+ status: types_1.EVideoSceneStatus.FAILED,
92
92
  errorMessage: `Failed to download video: ${videoResp.status}`,
93
93
  };
94
94
  }
@@ -102,17 +102,17 @@ class RunwayService extends baseAiGenProvider_service_1.BaseAiGenProviderService
102
102
  });
103
103
  return {
104
104
  videoUrl: signedUrl,
105
- status: types_1.EVideoJobStatus.COMPLETED,
105
+ status: types_1.EVideoSceneStatus.COMPLETED,
106
106
  };
107
107
  }
108
108
  if (result.status === "FAILED" || result.status === "CANCELLED") {
109
109
  return {
110
- status: types_1.EVideoJobStatus.FAILED,
110
+ status: types_1.EVideoSceneStatus.FAILED,
111
111
  errorMessage: `Failure: ${result.failure || "unknown"} Code: ${result.failureCode || "unknown"}`,
112
112
  };
113
113
  }
114
114
  // Still processing
115
- return { status: types_1.EVideoJobStatus.PENDING };
115
+ return { status: types_1.EVideoSceneStatus.PENDING };
116
116
  }
117
117
  getCreditUsed({ modelKey, duration = 5 }) {
118
118
  const modelConfig = aiModels_1.aiModelConfigs[modelKey];
@@ -1,6 +1,6 @@
1
1
  import { ChatCompletionMessageParam } from "openai/resources/index";
2
2
  import { ETextGenModels, EVideoGenModels } from "../../../globals/aiModels";
3
- import { EVideoJobStatus, TVideoJobTask } from "../../../globals/types";
3
+ import { EVideoSceneStatus, TVideoJobTask } from "../../../globals/types";
4
4
  import { EVideoMode } from "../types";
5
5
  export interface VideoGenerationParams {
6
6
  prompt?: string;
@@ -14,11 +14,11 @@ export interface VideoGenerationParams {
14
14
  mode?: EVideoMode;
15
15
  }
16
16
  export interface VideoGenerationResult {
17
- status: EVideoJobStatus;
18
- task?: TVideoJobTask;
17
+ status: EVideoSceneStatus.TRIGGERED;
18
+ task: TVideoJobTask;
19
19
  }
20
20
  export interface VideoStatusResult {
21
- status: EVideoJobStatus;
21
+ status: EVideoSceneStatus;
22
22
  videoUrl?: string;
23
23
  errorMessage?: string;
24
24
  }
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/services/aiGen/providers/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE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,EAAE,aAAa,CAAC;IACpB,QAAQ,EAAE,eAAe,CAAC;IAC1B,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;CAMzB;AAED,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,0BAA0B,EAAE,GAAG,MAAM,CAAC;IAC7C,QAAQ,EAAE,cAAc,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC/B;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,eAAe,GAAG,cAAc,CAAC;IAC3C,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC;IACvC,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC;CACzC"}
@@ -0,0 +1,30 @@
1
+ import { Job } from "bullmq";
2
+ import { RedisOptions } from "ioredis";
3
+ export type JobData = Record<string, any>;
4
+ interface BullMQServiceOptions {
5
+ redisOptions: RedisOptions;
6
+ concurrency?: number;
7
+ }
8
+ declare class BullMQService {
9
+ private static instance;
10
+ private queues;
11
+ private workers;
12
+ private redisOptions;
13
+ private concurrency;
14
+ private initialized;
15
+ private shuttingDown;
16
+ private constructor();
17
+ static getInstance(options: BullMQServiceOptions): BullMQService;
18
+ /** Initialize BullMQ service (like your initRedis) */
19
+ /** Initialize BullMQ service (like initRedis) */
20
+ init(): Promise<void>;
21
+ /** Add a job */
22
+ addJob(queueName: string, data: JobData, opts?: {
23
+ jobId?: string;
24
+ delay?: number;
25
+ }): Promise<void>;
26
+ startWorkers(queueNames: string[], processor: (job: Job) => Promise<void>): void;
27
+ }
28
+ export declare const bullmq: BullMQService;
29
+ export {};
30
+ //# sourceMappingURL=bullmq.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bullmq.service.d.ts","sourceRoot":"","sources":["../../src/services/bullmq.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAiB,GAAG,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAE1C,UAAU,oBAAoB;IAC5B,YAAY,EAAE,YAAY,CAAC;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,cAAM,aAAa;IACjB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAgB;IACvC,OAAO,CAAC,MAAM,CAAiC;IAC/C,OAAO,CAAC,OAAO,CAAgB;IAC/B,OAAO,CAAC,YAAY,CAAgB;IACpC,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,YAAY,CAAS;IAE7B,OAAO;WAQO,WAAW,CAAC,OAAO,EAAE,oBAAoB;IAOvD,sDAAsD;IACtD,iDAAiD;IACpC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAsBlC,gBAAgB;IACH,MAAM,CACjB,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,OAAO,EACb,IAAI,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE;IAUpC,YAAY,CACjB,UAAU,EAAE,MAAM,EAAE,EACpB,SAAS,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,OAAO,CAAC,IAAI,CAAC;CAmDzC;AAQD,eAAO,MAAM,MAAM,eAGjB,CAAC"}
@@ -0,0 +1,99 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.bullmq = void 0;
4
+ // libs/bullmqService.ts
5
+ const bullmq_1 = require("bullmq");
6
+ class BullMQService {
7
+ constructor({ redisOptions, concurrency = 10, }) {
8
+ this.queues = new Map();
9
+ this.workers = [];
10
+ this.initialized = false;
11
+ this.shuttingDown = false;
12
+ this.redisOptions = redisOptions;
13
+ this.concurrency = concurrency;
14
+ }
15
+ static getInstance(options) {
16
+ if (!BullMQService.instance) {
17
+ BullMQService.instance = new BullMQService(options);
18
+ }
19
+ return BullMQService.instance;
20
+ }
21
+ /** Initialize BullMQ service (like your initRedis) */
22
+ /** Initialize BullMQ service (like initRedis) */
23
+ async init() {
24
+ if (this.initialized)
25
+ return;
26
+ try {
27
+ // Create a temporary test queue
28
+ const testQueue = new bullmq_1.Queue("__init__", {
29
+ connection: this.redisOptions,
30
+ });
31
+ // Ping Redis via ioredis client
32
+ const testQueueClient = await testQueue.client;
33
+ testQueueClient.ping();
34
+ await testQueue.close();
35
+ this.initialized = true;
36
+ console.log("✅ BullMQService initialized and connected to Redis");
37
+ }
38
+ catch (err) {
39
+ console.error("❌ BullMQService failed to connect to Redis", err);
40
+ throw err;
41
+ }
42
+ }
43
+ /** Add a job */
44
+ async addJob(queueName, data, opts) {
45
+ if (!this.initialized)
46
+ await this.init();
47
+ const queue = this.queues.get(queueName) ??
48
+ new bullmq_1.Queue(queueName, { connection: this.redisOptions });
49
+ this.queues.set(queueName, queue);
50
+ await queue.add(opts?.jobId || "default", data, { delay: opts?.delay });
51
+ }
52
+ startWorkers(queueNames, processor) {
53
+ const start = async () => {
54
+ if (!this.initialized)
55
+ await this.init();
56
+ for (const queueName of queueNames) {
57
+ const queue = this.queues.get(queueName) ??
58
+ new bullmq_1.Queue(queueName, { connection: this.redisOptions });
59
+ this.queues.set(queueName, queue);
60
+ const worker = new bullmq_1.Worker(queueName, async (job) => processor(job), {
61
+ connection: this.redisOptions,
62
+ concurrency: this.concurrency,
63
+ });
64
+ worker.on("completed", (job) => console.log(`✅ [${queueName}] Job ${job.id} completed`));
65
+ worker.on("failed", (job, err) => console.error(`❌ [${queueName}] Job ${job?.id} failed:`, err));
66
+ this.workers.push(worker);
67
+ }
68
+ console.log(`🚀 Started workers for queues: ${queueNames.join(", ")}`);
69
+ // Setup graceful shutdown
70
+ const graceful = async () => {
71
+ if (this.shuttingDown)
72
+ return;
73
+ this.shuttingDown = true;
74
+ console.log("🛑 Shutting down BullMQ workers gracefully...");
75
+ for (const worker of this.workers) {
76
+ await worker.close();
77
+ console.log(`✅ Worker for queue ${worker.name} closed`);
78
+ }
79
+ console.log("✅ All workers closed. Exiting process.");
80
+ process.exit(0);
81
+ };
82
+ process.on("SIGINT", graceful);
83
+ process.on("SIGTERM", graceful);
84
+ };
85
+ start().catch((err) => {
86
+ console.error("❌ Failed to start workers:", err);
87
+ process.exit(1);
88
+ });
89
+ }
90
+ }
91
+ const redisOptions = {
92
+ host: process.env.REDIS_HOST,
93
+ port: Number(process.env.REDIS_PORT),
94
+ password: process.env.REDIS_PASSWORD,
95
+ };
96
+ exports.bullmq = BullMQService.getInstance({
97
+ redisOptions,
98
+ concurrency: 10,
99
+ });
@@ -1,4 +1,5 @@
1
1
  export * from "./redis.service";
2
2
  export * from "./firestore.service";
3
3
  export * from "./aiGen";
4
+ export * from "./bullmq.service";
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,SAAS,CAAC;AACxB,cAAc,kBAAkB,CAAC"}
@@ -17,3 +17,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./redis.service"), exports);
18
18
  __exportStar(require("./firestore.service"), exports);
19
19
  __exportStar(require("./aiGen"), exports);
20
+ __exportStar(require("./bullmq.service"), exports);
@@ -13,7 +13,7 @@ class RedisService {
13
13
  this.client.on("error", (err) => console.error("❌ Redis Client Error:", err));
14
14
  this.client.on("connect", () => {
15
15
  this.connected = true;
16
- console.log("✅ Connected to Redis Cloud!!!");
16
+ console.log("✅ Connected to Redis Cloud!");
17
17
  });
18
18
  }
19
19
  // Singleton instance
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vidspotai-shared",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "exports": {
@@ -13,15 +13,13 @@
13
13
  "files": [
14
14
  "lib"
15
15
  ],
16
- "scripts": {
17
- "build": "tsc -p tsconfig.json",
18
- "watch": "tsc -p tsconfig.json --watch"
19
- },
20
16
  "dependencies": {
21
17
  "@google-cloud/storage": "*",
22
18
  "@google/genai": "^1.22.0",
23
19
  "@runwayml/sdk": "^2.11.0",
24
20
  "axios": "^1.12.2",
21
+ "ioredis": "^5.8.0",
22
+ "bullmq": "^5.61.0",
25
23
  "firebase-admin": "^13.5.0",
26
24
  "jsonwebtoken": "^9.0.2",
27
25
  "openai": "^6.1.0",
@@ -34,5 +32,9 @@
34
32
  "peerDependencies": {
35
33
  "firebase-admin": "^13.5.0",
36
34
  "ioredis": "^5.8.0"
35
+ },
36
+ "scripts": {
37
+ "build": "tsc -p tsconfig.json",
38
+ "watch": "tsc -p tsconfig.json --watch"
37
39
  }
38
- }
40
+ }