vidspotai-shared 1.0.0 → 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 (73) hide show
  1. package/lib/globals/aiModels.d.ts +2 -0
  2. package/lib/globals/aiModels.d.ts.map +1 -1
  3. package/lib/globals/aiModels.js +51 -5
  4. package/lib/globals/plans.js +6 -6
  5. package/lib/globals/types.d.ts +197 -8
  6. package/lib/globals/types.d.ts.map +1 -1
  7. package/lib/globals/types.js +188 -14
  8. package/lib/libs/firebase.d.ts.map +1 -1
  9. package/lib/libs/firebase.js +18 -12
  10. package/lib/models/script.model.d.ts +4 -0
  11. package/lib/models/script.model.d.ts.map +1 -1
  12. package/lib/models/script.model.js +7 -4
  13. package/lib/models/user.model.d.ts +1 -6
  14. package/lib/models/user.model.d.ts.map +1 -1
  15. package/lib/models/video.model.d.ts +13 -12
  16. package/lib/models/video.model.d.ts.map +1 -1
  17. package/lib/services/aiGen/aiGenFactory.service.d.ts.map +1 -1
  18. package/lib/services/aiGen/aiGenFactory.service.js +2 -0
  19. package/lib/services/aiGen/providers/alibaba/alibaba.d.ts +1 -1
  20. package/lib/services/aiGen/providers/alibaba/alibaba.d.ts.map +1 -1
  21. package/lib/services/aiGen/providers/alibaba/alibaba.js +12 -29
  22. package/lib/services/aiGen/providers/azure/azure.service.d.ts +1 -1
  23. package/lib/services/aiGen/providers/azure/azure.service.d.ts.map +1 -1
  24. package/lib/services/aiGen/providers/azure/azure.service.js +25 -47
  25. package/lib/services/aiGen/providers/baseAiGenProvider.service.d.ts +1 -1
  26. package/lib/services/aiGen/providers/baseAiGenProvider.service.d.ts.map +1 -1
  27. package/lib/services/aiGen/providers/google/google.service.d.ts +1 -1
  28. package/lib/services/aiGen/providers/google/google.service.d.ts.map +1 -1
  29. package/lib/services/aiGen/providers/google/google.service.js +23 -32
  30. package/lib/services/aiGen/providers/kling/kling.service.d.ts +1 -1
  31. package/lib/services/aiGen/providers/kling/kling.service.d.ts.map +1 -1
  32. package/lib/services/aiGen/providers/kling/kling.service.js +11 -26
  33. package/lib/services/aiGen/providers/minimax/minimax.service.d.ts +1 -1
  34. package/lib/services/aiGen/providers/minimax/minimax.service.d.ts.map +1 -1
  35. package/lib/services/aiGen/providers/minimax/minimax.service.js +21 -18
  36. package/lib/services/aiGen/providers/minimax/types.d.ts +1 -0
  37. package/lib/services/aiGen/providers/minimax/types.d.ts.map +1 -1
  38. package/lib/services/aiGen/providers/openai/openai.service.d.ts +1 -1
  39. package/lib/services/aiGen/providers/openai/openai.service.d.ts.map +1 -1
  40. package/lib/services/aiGen/providers/openai/openai.service.js +7 -7
  41. package/lib/services/aiGen/providers/runway/runway.service.d.ts +1 -1
  42. package/lib/services/aiGen/providers/runway/runway.service.d.ts.map +1 -1
  43. package/lib/services/aiGen/providers/runway/runway.service.js +8 -8
  44. package/lib/services/aiGen/providers/types.d.ts +4 -4
  45. package/lib/services/aiGen/providers/types.d.ts.map +1 -1
  46. package/lib/services/bullmq.service.d.ts +30 -0
  47. package/lib/services/bullmq.service.d.ts.map +1 -0
  48. package/lib/services/bullmq.service.js +99 -0
  49. package/lib/services/firestore.service.d.ts +3 -0
  50. package/lib/services/firestore.service.d.ts.map +1 -1
  51. package/lib/services/index.d.ts +1 -0
  52. package/lib/services/index.d.ts.map +1 -1
  53. package/lib/services/index.js +1 -0
  54. package/lib/services/redis.service.js +1 -1
  55. package/lib/utils/helpers.d.ts +3 -1
  56. package/lib/utils/helpers.d.ts.map +1 -1
  57. package/lib/utils/helpers.js +31 -1
  58. package/package.json +10 -1
  59. package/lib/services/aiGen/atypes.d.ts +0 -5
  60. package/lib/services/aiGen/atypes.d.ts.map +0 -1
  61. package/lib/services/aiGen/atypes.js +0 -8
  62. package/lib/services/aiGen/providers/azure/azure.d.ts +0 -1
  63. package/lib/services/aiGen/providers/azure/azure.d.ts.map +0 -1
  64. package/lib/services/aiGen/providers/azure/azure.js +0 -1
  65. package/lib/services/aiGen/providers/kling/btypes.d.ts +0 -73
  66. package/lib/services/aiGen/providers/kling/btypes.d.ts.map +0 -1
  67. package/lib/services/aiGen/providers/kling/btypes.js +0 -2
  68. package/lib/services/aiGen/providers/minimax/ctypes.d.ts +0 -26
  69. package/lib/services/aiGen/providers/minimax/ctypes.d.ts.map +0 -1
  70. package/lib/services/aiGen/providers/minimax/ctypes.js +0 -3
  71. package/lib/services/aiGen/providers/runway/dtypes.d.ts +0 -14
  72. package/lib/services/aiGen/providers/runway/dtypes.d.ts.map +0 -1
  73. package/lib/services/aiGen/providers/runway/dtypes.js +0 -27
@@ -10,6 +10,7 @@ export declare const scriptScenes: z.ZodArray<z.ZodObject<{
10
10
  }, z.core.$strip>>;
11
11
  export declare const scriptModelOutput: z.ZodObject<{
12
12
  summary: z.ZodString;
13
+ title: z.ZodString;
13
14
  scenes: z.ZodArray<z.ZodObject<{
14
15
  sceneIndex: z.ZodNumber;
15
16
  duration: z.ZodNumber;
@@ -21,12 +22,15 @@ export declare const scriptModelOutput: z.ZodObject<{
21
22
  export declare const scriptModel: z.ZodIntersection<z.ZodObject<{
22
23
  userId: z.ZodString;
23
24
  prompt: z.ZodString;
25
+ originalPrompt: z.ZodOptional<z.ZodString>;
24
26
  durationType: z.ZodEnum<typeof EVideoDurationType>;
25
27
  videoModelKey: z.ZodEnum<typeof EVideoGenModels>;
28
+ translatedSummary: z.ZodOptional<z.ZodString>;
26
29
  createdAt: z.ZodDate;
27
30
  updatedAt: z.ZodDate;
28
31
  }, z.core.$strip>, z.ZodObject<{
29
32
  summary: z.ZodString;
33
+ title: z.ZodString;
30
34
  scenes: z.ZodArray<z.ZodObject<{
31
35
  sceneIndex: z.ZodNumber;
32
36
  duration: z.ZodNumber;
@@ -1 +1 @@
1
- {"version":3,"file":"script.model.d.ts","sourceRoot":"","sources":["../../src/models/script.model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAWtD,eAAO,MAAM,YAAY;;;;;;kBAQxB,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;;;;;;;iBAG5B,CAAC;AAEH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;kBAAyC,CAAC;AAElE,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC"}
1
+ {"version":3,"file":"script.model.d.ts","sourceRoot":"","sources":["../../src/models/script.model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAatD,eAAO,MAAM,YAAY;;;;;;kBAQxB,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;;;;;;;;iBAI5B,CAAC;AAEH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;kBAAyC,CAAC;AAElE,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC"}
@@ -6,9 +6,11 @@ const types_1 = require("../globals/types");
6
6
  const aiModels_1 = require("../globals/aiModels");
7
7
  const scriptModelBase = zod_1.z.object({
8
8
  userId: zod_1.z.string(),
9
- prompt: zod_1.z.string(),
10
- durationType: zod_1.z.enum(types_1.EVideoDurationType), // replace with your TVideoDurationType enum schema
11
- videoModelKey: zod_1.z.enum(aiModels_1.EVideoGenModels), // replace with your TVideoGenModel enum schema
9
+ prompt: zod_1.z.string(), // original if en other wise en translated
10
+ originalPrompt: zod_1.z.string().optional(),
11
+ durationType: zod_1.z.enum(types_1.EVideoDurationType),
12
+ videoModelKey: zod_1.z.enum(aiModels_1.EVideoGenModels),
13
+ translatedSummary: zod_1.z.string().min(1).optional(), // translated summary
12
14
  createdAt: zod_1.z.date(),
13
15
  updatedAt: zod_1.z.date(),
14
16
  });
@@ -20,7 +22,8 @@ exports.scriptScenes = zod_1.z.array(zod_1.z.object({
20
22
  dialogue: zod_1.z.string(),
21
23
  }));
22
24
  exports.scriptModelOutput = zod_1.z.object({
23
- summary: zod_1.z.string().min(1),
25
+ summary: zod_1.z.string().min(1), // en summary by model
26
+ title: zod_1.z.string().min(1),
24
27
  scenes: exports.scriptScenes,
25
28
  });
26
29
  exports.scriptModel = scriptModelBase.and(exports.scriptModelOutput);
@@ -1,5 +1,5 @@
1
1
  import { FieldValue } from "firebase-admin/firestore";
2
- import { ECURRENCY, ERENEWAL_FREQUENCY, ESCHEDULE_UPDATE_STATUS, ESUBSCRIPTION_PLANS, ESUBSCRIPTION_STATUS } from "../globals/types";
2
+ import { ECURRENCY, ERENEWAL_FREQUENCY, ESUBSCRIPTION_PLANS, ESUBSCRIPTION_STATUS } from "../globals/types";
3
3
  export interface IUserModel {
4
4
  id: string;
5
5
  email: string;
@@ -37,10 +37,5 @@ export interface IUserSubscription {
37
37
  endDate?: string;
38
38
  status: ESUBSCRIPTION_STATUS;
39
39
  currency?: ECURRENCY;
40
- scheduleUpdate?: {
41
- plan: ESUBSCRIPTION_PLANS;
42
- status: ESCHEDULE_UPDATE_STATUS;
43
- scheduleId: string;
44
- };
45
40
  }
46
41
  //# sourceMappingURL=user.model.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"user.model.d.ts","sourceRoot":"","sources":["../../src/models/user.model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EACL,SAAS,EACT,kBAAkB,EAClB,uBAAuB,EACvB,mBAAmB,EACnB,oBAAoB,EACrB,MAAM,kBAAkB,CAAC;AAE1B,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE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AC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,oBAAoB,CAAC;IAC7B,QAAQ,CAAC,EAAE,SAAS,CAAC;CAOtB"}
@@ -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,22 +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;
24
+ language?: string;
26
25
  prompt?: string;
27
- duration: number;
28
- mode?: EVideoMode;
29
- dimensions?: string;
30
- resolution?: string;
31
- aspectRatio?: string;
26
+ originalPrompt?: string;
32
27
  scriptId?: string;
33
28
  scenes?: IVideoScene[];
34
29
  finalVideoUrl?: string;
35
- status: EVideoJobStatus;
36
30
  errorMessage?: string;
37
31
  totalCreditsUsed?: number;
38
32
  estimatedCredits?: number;
39
33
  durationType?: EVideoDurationType;
34
+ duration: number;
35
+ mode?: EVideoMode;
36
+ dimensions?: string;
37
+ resolution?: string;
38
+ aspectRatio?: string;
39
+ inputVideoUrl?: string;
40
+ inputImageUrl?: string;
40
41
  createdAt: FieldValue;
41
42
  updatedAt: FieldValue;
42
43
  }
@@ -1 +1 @@
1
- {"version":3,"file":"video.model.d.ts","sourceRoot":"","sources":["../../src/models/video.model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAe,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,aAAa,EACd,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAErD,MAAM,WAAW,WAAW;IAC1B,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,eAAe,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CAGpB;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,eAAe,CAAC;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,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,E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uB,CACrC,QAAQ,EAAE,WAAW,GACpB,wBAAwB,CAY1B"}
1
+ {"version":3,"file":"aiGenFactory.service.d.ts","sourceRoot":"","sources":["../../../src/services/aiGen/aiGenFactory.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAC;AACjF,OAAO,EACL,cAAc,EACd,eAAe,EACf,WAAW,EACZ,MAAM,wBAAwB,CAAC;AAUhC,KAAK,uBAAuB,GAAG,UAAU,wBAAwB,CAAC;AAElE,eAAO,MAAM,gBAAgB,EAAE,MAAM,CACnC,eAAe,EACf,uBAAuB,CAqBxB,CAAC;AAUF,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,cAAc,EAAE,uBAAuB,CAOzE,CAAC;AAEJ,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,WAAW,GACpB,wBAAwB,CAY1B"}
@@ -10,6 +10,8 @@ const runway_service_1 = require("./providers/runway/runway.service");
10
10
  const alibaba_1 = require("./providers/alibaba/alibaba");
11
11
  const azure_1 = require("./providers/azure");
12
12
  exports.videoServicesMap = {
13
+ "google-veo-3.1-preview": google_service_1.GoogleService,
14
+ "google-veo-3.1-fast-preview": google_service_1.GoogleService,
13
15
  "google-veo-3": google_service_1.GoogleService,
14
16
  "google-veo-2": google_service_1.GoogleService,
15
17
  "google-veo-3-fast": google_service_1.GoogleService,
@@ -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,EACL,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,UAAU,CAAC;AAOlB,qBAAa,cAAe,SAAQ,wBAAwB;IAC1D,OAAO,CAAC,QAAQ,CAAC,OAAO,CACsE;IAC9F,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;;YASnB,OAAO;IAgCf,aAAa,CACjB,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,qBAAqB,CAAC;IAwC3B,gBAAgB,CAAC,EACrB,IAAI,EACJ,cAAc,EACd,cAAyB,GAC1B,EAAE,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC;IAuExD,aAAa,CAAC,EACZ,QAAQ,EACR,UAAU,EACV,WAAW,EACX,QAAQ,GACT,EAAE,iBAAiB,GAAG,MAAM;CAO9B"}
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,EACL,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,UAAU,CAAC;AAOlB,qBAAa,cAAe,SAAQ,wBAAwB;IAC1D,OAAO,CAAC,QAAQ,CAAC,OAAO,CACsE;IAC9F,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;;YASnB,OAAO;IAqBf,aAAa,CACjB,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,qBAAqB,CAAC;IAqC3B,gBAAgB,CAAC,EACrB,IAAI,EACJ,cAAc,EACd,cAAyB,GAC1B,EAAE,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAuEjD,aAAa,CAAC,EACZ,QAAQ,EACR,UAAU,EACV,WAAW,EACX,QAAQ,GACT,EAAE,iBAAiB,GAAG,MAAM;CAO9B"}
@@ -33,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,11 +81,11 @@ 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
  }
105
- console.log("Alibaba video URL:", videoUrl);
88
+ // console.log("Alibaba video URL:", videoUrl);
106
89
  const filePath = `${outputFilePath}/${outputFilename}.mp4`;
107
90
  const file = (0, firebase_1.getBucket)().file(filePath);
108
91
  try {
@@ -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,11 +71,11 @@ 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
  }
93
- console.log("Kling video URL:", videoUrl);
78
+ // console.log("Kling video URL:", videoUrl);
94
79
  const filePath = `${outputFilePath}/${outputFilename}.mp4`;
95
80
  const file = (0, firebase_1.getBucket)().file(filePath);
96
81
  // Download video using axios
@@ -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 = {