clhq-postgres-module 1.1.0-alpha.161 → 1.1.0-alpha.163
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/entities/ai-video-job.entity.d.ts +42 -0
- package/dist/entities/ai-video-job.entity.js +147 -0
- package/dist/entities/ai-video-scene-task.entity.d.ts +40 -0
- package/dist/entities/ai-video-scene-task.entity.js +149 -0
- package/dist/entities/index.d.ts +2 -0
- package/dist/entities/index.js +2 -0
- package/dist/repositories/ai-video-job.repository.d.ts +19 -0
- package/dist/repositories/ai-video-job.repository.js +78 -0
- package/dist/repositories/ai-video-scene-task.repository.d.ts +15 -0
- package/dist/repositories/ai-video-scene-task.repository.js +65 -0
- package/dist/repositories/index.d.ts +2 -0
- package/dist/repositories/index.js +5 -1
- package/dist/repositories/repository.module.js +5 -0
- package/package.json +1 -1
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export declare enum AiVideoJobStatus {
|
|
2
|
+
PENDING = "pending",
|
|
3
|
+
GENERATING_SCRIPT = "generating_script",
|
|
4
|
+
GENERATING_VOICE = "generating_voice",
|
|
5
|
+
FINDING_MUSIC = "finding_music",
|
|
6
|
+
FINDING_VISUALS = "finding_visuals",
|
|
7
|
+
GENERATING_SCENES = "generating_scenes",
|
|
8
|
+
ASSEMBLING_VIDEO = "assembling_video",
|
|
9
|
+
RENDERING_VIDEO = "rendering_video",
|
|
10
|
+
COMPLETED = "completed",
|
|
11
|
+
FAILED = "failed"
|
|
12
|
+
}
|
|
13
|
+
export declare class AiVideoJob {
|
|
14
|
+
id: string;
|
|
15
|
+
userId: string;
|
|
16
|
+
workspaceId: string;
|
|
17
|
+
projectId: string;
|
|
18
|
+
projectTitle: string;
|
|
19
|
+
prompt: string;
|
|
20
|
+
agentId: string;
|
|
21
|
+
duration: number;
|
|
22
|
+
aspectRatio: string;
|
|
23
|
+
language: string;
|
|
24
|
+
style: string;
|
|
25
|
+
voiceEnabled: boolean;
|
|
26
|
+
voiceId: string;
|
|
27
|
+
musicEnabled: boolean;
|
|
28
|
+
status: AiVideoJobStatus;
|
|
29
|
+
progress: number;
|
|
30
|
+
totalDurationSeconds: number;
|
|
31
|
+
totalScenes: number;
|
|
32
|
+
script: string;
|
|
33
|
+
voiceAudioUrl: string;
|
|
34
|
+
backgroundMusicUrl: string;
|
|
35
|
+
outputUrl: string;
|
|
36
|
+
canvasProjectId: string;
|
|
37
|
+
isPremiumUser: boolean;
|
|
38
|
+
klingScenesCount: number;
|
|
39
|
+
errorMessage: string;
|
|
40
|
+
createdAt: Date;
|
|
41
|
+
updatedAt: Date;
|
|
42
|
+
}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.AiVideoJob = exports.AiVideoJobStatus = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
var AiVideoJobStatus;
|
|
15
|
+
(function (AiVideoJobStatus) {
|
|
16
|
+
AiVideoJobStatus["PENDING"] = "pending";
|
|
17
|
+
AiVideoJobStatus["GENERATING_SCRIPT"] = "generating_script";
|
|
18
|
+
AiVideoJobStatus["GENERATING_VOICE"] = "generating_voice";
|
|
19
|
+
AiVideoJobStatus["FINDING_MUSIC"] = "finding_music";
|
|
20
|
+
AiVideoJobStatus["FINDING_VISUALS"] = "finding_visuals";
|
|
21
|
+
AiVideoJobStatus["GENERATING_SCENES"] = "generating_scenes";
|
|
22
|
+
AiVideoJobStatus["ASSEMBLING_VIDEO"] = "assembling_video";
|
|
23
|
+
AiVideoJobStatus["RENDERING_VIDEO"] = "rendering_video";
|
|
24
|
+
AiVideoJobStatus["COMPLETED"] = "completed";
|
|
25
|
+
AiVideoJobStatus["FAILED"] = "failed";
|
|
26
|
+
})(AiVideoJobStatus || (exports.AiVideoJobStatus = AiVideoJobStatus = {}));
|
|
27
|
+
let AiVideoJob = class AiVideoJob {
|
|
28
|
+
};
|
|
29
|
+
exports.AiVideoJob = AiVideoJob;
|
|
30
|
+
__decorate([
|
|
31
|
+
(0, typeorm_1.PrimaryColumn)({ type: 'varchar' }),
|
|
32
|
+
__metadata("design:type", String)
|
|
33
|
+
], AiVideoJob.prototype, "id", void 0);
|
|
34
|
+
__decorate([
|
|
35
|
+
(0, typeorm_1.Column)({ name: 'user_id', type: 'varchar' }),
|
|
36
|
+
__metadata("design:type", String)
|
|
37
|
+
], AiVideoJob.prototype, "userId", void 0);
|
|
38
|
+
__decorate([
|
|
39
|
+
(0, typeorm_1.Column)({ name: 'workspace_id', type: 'varchar', nullable: true }),
|
|
40
|
+
__metadata("design:type", String)
|
|
41
|
+
], AiVideoJob.prototype, "workspaceId", void 0);
|
|
42
|
+
__decorate([
|
|
43
|
+
(0, typeorm_1.Column)({ name: 'project_id', type: 'varchar', nullable: true }),
|
|
44
|
+
__metadata("design:type", String)
|
|
45
|
+
], AiVideoJob.prototype, "projectId", void 0);
|
|
46
|
+
__decorate([
|
|
47
|
+
(0, typeorm_1.Column)({ name: 'project_title', type: 'varchar', nullable: true }),
|
|
48
|
+
__metadata("design:type", String)
|
|
49
|
+
], AiVideoJob.prototype, "projectTitle", void 0);
|
|
50
|
+
__decorate([
|
|
51
|
+
(0, typeorm_1.Column)({ type: 'text' }),
|
|
52
|
+
__metadata("design:type", String)
|
|
53
|
+
], AiVideoJob.prototype, "prompt", void 0);
|
|
54
|
+
__decorate([
|
|
55
|
+
(0, typeorm_1.Column)({ name: 'agent_id', type: 'varchar' }),
|
|
56
|
+
__metadata("design:type", String)
|
|
57
|
+
], AiVideoJob.prototype, "agentId", void 0);
|
|
58
|
+
__decorate([
|
|
59
|
+
(0, typeorm_1.Column)({ type: 'integer' }),
|
|
60
|
+
__metadata("design:type", Number)
|
|
61
|
+
], AiVideoJob.prototype, "duration", void 0);
|
|
62
|
+
__decorate([
|
|
63
|
+
(0, typeorm_1.Column)({ name: 'aspect_ratio', type: 'varchar', default: '16:9' }),
|
|
64
|
+
__metadata("design:type", String)
|
|
65
|
+
], AiVideoJob.prototype, "aspectRatio", void 0);
|
|
66
|
+
__decorate([
|
|
67
|
+
(0, typeorm_1.Column)({ type: 'varchar', default: 'en' }),
|
|
68
|
+
__metadata("design:type", String)
|
|
69
|
+
], AiVideoJob.prototype, "language", void 0);
|
|
70
|
+
__decorate([
|
|
71
|
+
(0, typeorm_1.Column)({ type: 'varchar', default: 'cinematic' }),
|
|
72
|
+
__metadata("design:type", String)
|
|
73
|
+
], AiVideoJob.prototype, "style", void 0);
|
|
74
|
+
__decorate([
|
|
75
|
+
(0, typeorm_1.Column)({ name: 'voice_enabled', type: 'boolean', default: false }),
|
|
76
|
+
__metadata("design:type", Boolean)
|
|
77
|
+
], AiVideoJob.prototype, "voiceEnabled", void 0);
|
|
78
|
+
__decorate([
|
|
79
|
+
(0, typeorm_1.Column)({ name: 'voice_id', type: 'varchar', nullable: true }),
|
|
80
|
+
__metadata("design:type", String)
|
|
81
|
+
], AiVideoJob.prototype, "voiceId", void 0);
|
|
82
|
+
__decorate([
|
|
83
|
+
(0, typeorm_1.Column)({ name: 'music_enabled', type: 'boolean', default: false }),
|
|
84
|
+
__metadata("design:type", Boolean)
|
|
85
|
+
], AiVideoJob.prototype, "musicEnabled", void 0);
|
|
86
|
+
__decorate([
|
|
87
|
+
(0, typeorm_1.Column)({ type: 'varchar', default: AiVideoJobStatus.PENDING }),
|
|
88
|
+
__metadata("design:type", String)
|
|
89
|
+
], AiVideoJob.prototype, "status", void 0);
|
|
90
|
+
__decorate([
|
|
91
|
+
(0, typeorm_1.Column)({ type: 'integer', default: 0 }),
|
|
92
|
+
__metadata("design:type", Number)
|
|
93
|
+
], AiVideoJob.prototype, "progress", void 0);
|
|
94
|
+
__decorate([
|
|
95
|
+
(0, typeorm_1.Column)({ name: 'total_duration_seconds', type: 'integer', default: 0 }),
|
|
96
|
+
__metadata("design:type", Number)
|
|
97
|
+
], AiVideoJob.prototype, "totalDurationSeconds", void 0);
|
|
98
|
+
__decorate([
|
|
99
|
+
(0, typeorm_1.Column)({ name: 'total_scenes', type: 'integer', default: 0 }),
|
|
100
|
+
__metadata("design:type", Number)
|
|
101
|
+
], AiVideoJob.prototype, "totalScenes", void 0);
|
|
102
|
+
__decorate([
|
|
103
|
+
(0, typeorm_1.Column)({ type: 'text', nullable: true }),
|
|
104
|
+
__metadata("design:type", String)
|
|
105
|
+
], AiVideoJob.prototype, "script", void 0);
|
|
106
|
+
__decorate([
|
|
107
|
+
(0, typeorm_1.Column)({ name: 'voice_audio_url', type: 'text', nullable: true }),
|
|
108
|
+
__metadata("design:type", String)
|
|
109
|
+
], AiVideoJob.prototype, "voiceAudioUrl", void 0);
|
|
110
|
+
__decorate([
|
|
111
|
+
(0, typeorm_1.Column)({ name: 'background_music_url', type: 'text', nullable: true }),
|
|
112
|
+
__metadata("design:type", String)
|
|
113
|
+
], AiVideoJob.prototype, "backgroundMusicUrl", void 0);
|
|
114
|
+
__decorate([
|
|
115
|
+
(0, typeorm_1.Column)({ name: 'output_url', type: 'text', nullable: true }),
|
|
116
|
+
__metadata("design:type", String)
|
|
117
|
+
], AiVideoJob.prototype, "outputUrl", void 0);
|
|
118
|
+
__decorate([
|
|
119
|
+
(0, typeorm_1.Column)({ name: 'canvas_project_id', type: 'varchar', nullable: true }),
|
|
120
|
+
__metadata("design:type", String)
|
|
121
|
+
], AiVideoJob.prototype, "canvasProjectId", void 0);
|
|
122
|
+
__decorate([
|
|
123
|
+
(0, typeorm_1.Column)({ name: 'is_premium_user', type: 'boolean', default: false }),
|
|
124
|
+
__metadata("design:type", Boolean)
|
|
125
|
+
], AiVideoJob.prototype, "isPremiumUser", void 0);
|
|
126
|
+
__decorate([
|
|
127
|
+
(0, typeorm_1.Column)({ name: 'kling_scenes_count', type: 'integer', default: 0 }),
|
|
128
|
+
__metadata("design:type", Number)
|
|
129
|
+
], AiVideoJob.prototype, "klingScenesCount", void 0);
|
|
130
|
+
__decorate([
|
|
131
|
+
(0, typeorm_1.Column)({ name: 'error_message', type: 'text', nullable: true }),
|
|
132
|
+
__metadata("design:type", String)
|
|
133
|
+
], AiVideoJob.prototype, "errorMessage", void 0);
|
|
134
|
+
__decorate([
|
|
135
|
+
(0, typeorm_1.CreateDateColumn)({ name: 'created_at' }),
|
|
136
|
+
__metadata("design:type", Date)
|
|
137
|
+
], AiVideoJob.prototype, "createdAt", void 0);
|
|
138
|
+
__decorate([
|
|
139
|
+
(0, typeorm_1.UpdateDateColumn)({ name: 'updated_at' }),
|
|
140
|
+
__metadata("design:type", Date)
|
|
141
|
+
], AiVideoJob.prototype, "updatedAt", void 0);
|
|
142
|
+
exports.AiVideoJob = AiVideoJob = __decorate([
|
|
143
|
+
(0, typeorm_1.Entity)('ai_video_jobs'),
|
|
144
|
+
(0, typeorm_1.Index)(['userId']),
|
|
145
|
+
(0, typeorm_1.Index)(['status']),
|
|
146
|
+
(0, typeorm_1.Index)(['createdAt'])
|
|
147
|
+
], AiVideoJob);
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { AiVideoJob } from './ai-video-job.entity';
|
|
2
|
+
export declare enum AiVideoSceneTaskStatus {
|
|
3
|
+
PENDING = "pending",
|
|
4
|
+
SEARCHING_STOCK = "searching_stock",
|
|
5
|
+
SUBMITTING_KLING = "submitting_kling",
|
|
6
|
+
GENERATING = "generating",
|
|
7
|
+
COMPLETED = "completed",
|
|
8
|
+
FAILED = "failed"
|
|
9
|
+
}
|
|
10
|
+
export declare class AiVideoSceneTask {
|
|
11
|
+
id: string;
|
|
12
|
+
jobId: string;
|
|
13
|
+
job: AiVideoJob;
|
|
14
|
+
sceneOrder: number;
|
|
15
|
+
sceneTitle: string;
|
|
16
|
+
description: string;
|
|
17
|
+
narration: string;
|
|
18
|
+
durationSeconds: number;
|
|
19
|
+
style: string;
|
|
20
|
+
shotType: string;
|
|
21
|
+
stockSearchQuery: string;
|
|
22
|
+
pexelsVideoId: number;
|
|
23
|
+
pixabayVideoId: number;
|
|
24
|
+
stockVideoUrl: string;
|
|
25
|
+
stockVideoConfidence: number;
|
|
26
|
+
mediaType: string;
|
|
27
|
+
klingTaskId: string;
|
|
28
|
+
outputUrl: string;
|
|
29
|
+
s3Url: string;
|
|
30
|
+
klingSubmitRequest: object;
|
|
31
|
+
klingSubmitResponse: object;
|
|
32
|
+
klingPollLog: object[];
|
|
33
|
+
voiceAudioUrl: string;
|
|
34
|
+
voiceoverDurationSeconds: number;
|
|
35
|
+
status: AiVideoSceneTaskStatus;
|
|
36
|
+
progress: number;
|
|
37
|
+
errorMessage: string;
|
|
38
|
+
createdAt: Date;
|
|
39
|
+
updatedAt: Date;
|
|
40
|
+
}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.AiVideoSceneTask = exports.AiVideoSceneTaskStatus = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const ai_video_job_entity_1 = require("./ai-video-job.entity");
|
|
15
|
+
var AiVideoSceneTaskStatus;
|
|
16
|
+
(function (AiVideoSceneTaskStatus) {
|
|
17
|
+
AiVideoSceneTaskStatus["PENDING"] = "pending";
|
|
18
|
+
AiVideoSceneTaskStatus["SEARCHING_STOCK"] = "searching_stock";
|
|
19
|
+
AiVideoSceneTaskStatus["SUBMITTING_KLING"] = "submitting_kling";
|
|
20
|
+
AiVideoSceneTaskStatus["GENERATING"] = "generating";
|
|
21
|
+
AiVideoSceneTaskStatus["COMPLETED"] = "completed";
|
|
22
|
+
AiVideoSceneTaskStatus["FAILED"] = "failed";
|
|
23
|
+
})(AiVideoSceneTaskStatus || (exports.AiVideoSceneTaskStatus = AiVideoSceneTaskStatus = {}));
|
|
24
|
+
let AiVideoSceneTask = class AiVideoSceneTask {
|
|
25
|
+
};
|
|
26
|
+
exports.AiVideoSceneTask = AiVideoSceneTask;
|
|
27
|
+
__decorate([
|
|
28
|
+
(0, typeorm_1.PrimaryColumn)({ type: 'varchar' }),
|
|
29
|
+
__metadata("design:type", String)
|
|
30
|
+
], AiVideoSceneTask.prototype, "id", void 0);
|
|
31
|
+
__decorate([
|
|
32
|
+
(0, typeorm_1.Column)({ name: 'job_id', type: 'varchar' }),
|
|
33
|
+
__metadata("design:type", String)
|
|
34
|
+
], AiVideoSceneTask.prototype, "jobId", void 0);
|
|
35
|
+
__decorate([
|
|
36
|
+
(0, typeorm_1.ManyToOne)(() => ai_video_job_entity_1.AiVideoJob, { onDelete: 'CASCADE' }),
|
|
37
|
+
(0, typeorm_1.JoinColumn)({ name: 'job_id' }),
|
|
38
|
+
__metadata("design:type", ai_video_job_entity_1.AiVideoJob)
|
|
39
|
+
], AiVideoSceneTask.prototype, "job", void 0);
|
|
40
|
+
__decorate([
|
|
41
|
+
(0, typeorm_1.Column)({ name: 'scene_order', type: 'integer' }),
|
|
42
|
+
__metadata("design:type", Number)
|
|
43
|
+
], AiVideoSceneTask.prototype, "sceneOrder", void 0);
|
|
44
|
+
__decorate([
|
|
45
|
+
(0, typeorm_1.Column)({ name: 'scene_title', type: 'varchar', nullable: true }),
|
|
46
|
+
__metadata("design:type", String)
|
|
47
|
+
], AiVideoSceneTask.prototype, "sceneTitle", void 0);
|
|
48
|
+
__decorate([
|
|
49
|
+
(0, typeorm_1.Column)({ type: 'text', nullable: true }),
|
|
50
|
+
__metadata("design:type", String)
|
|
51
|
+
], AiVideoSceneTask.prototype, "description", void 0);
|
|
52
|
+
__decorate([
|
|
53
|
+
(0, typeorm_1.Column)({ type: 'text', nullable: true }),
|
|
54
|
+
__metadata("design:type", String)
|
|
55
|
+
], AiVideoSceneTask.prototype, "narration", void 0);
|
|
56
|
+
__decorate([
|
|
57
|
+
(0, typeorm_1.Column)({ name: 'duration_seconds', type: 'integer', nullable: true }),
|
|
58
|
+
__metadata("design:type", Number)
|
|
59
|
+
], AiVideoSceneTask.prototype, "durationSeconds", void 0);
|
|
60
|
+
__decorate([
|
|
61
|
+
(0, typeorm_1.Column)({ type: 'varchar', nullable: true }),
|
|
62
|
+
__metadata("design:type", String)
|
|
63
|
+
], AiVideoSceneTask.prototype, "style", void 0);
|
|
64
|
+
__decorate([
|
|
65
|
+
(0, typeorm_1.Column)({ name: 'shot_type', type: 'varchar', nullable: true }),
|
|
66
|
+
__metadata("design:type", String)
|
|
67
|
+
], AiVideoSceneTask.prototype, "shotType", void 0);
|
|
68
|
+
__decorate([
|
|
69
|
+
(0, typeorm_1.Column)({ name: 'stock_search_query', type: 'text', nullable: true }),
|
|
70
|
+
__metadata("design:type", String)
|
|
71
|
+
], AiVideoSceneTask.prototype, "stockSearchQuery", void 0);
|
|
72
|
+
__decorate([
|
|
73
|
+
(0, typeorm_1.Column)({ name: 'pexels_video_id', type: 'integer', nullable: true }),
|
|
74
|
+
__metadata("design:type", Number)
|
|
75
|
+
], AiVideoSceneTask.prototype, "pexelsVideoId", void 0);
|
|
76
|
+
__decorate([
|
|
77
|
+
(0, typeorm_1.Column)({ name: 'pixabay_video_id', type: 'integer', nullable: true }),
|
|
78
|
+
__metadata("design:type", Number)
|
|
79
|
+
], AiVideoSceneTask.prototype, "pixabayVideoId", void 0);
|
|
80
|
+
__decorate([
|
|
81
|
+
(0, typeorm_1.Column)({ name: 'stock_video_url', type: 'text', nullable: true }),
|
|
82
|
+
__metadata("design:type", String)
|
|
83
|
+
], AiVideoSceneTask.prototype, "stockVideoUrl", void 0);
|
|
84
|
+
__decorate([
|
|
85
|
+
(0, typeorm_1.Column)({ name: 'stock_video_confidence', type: 'decimal', precision: 3, scale: 2, nullable: true }),
|
|
86
|
+
__metadata("design:type", Number)
|
|
87
|
+
], AiVideoSceneTask.prototype, "stockVideoConfidence", void 0);
|
|
88
|
+
__decorate([
|
|
89
|
+
(0, typeorm_1.Column)({ name: 'media_type', type: 'varchar', default: 'video' }),
|
|
90
|
+
__metadata("design:type", String)
|
|
91
|
+
], AiVideoSceneTask.prototype, "mediaType", void 0);
|
|
92
|
+
__decorate([
|
|
93
|
+
(0, typeorm_1.Column)({ name: 'kling_task_id', type: 'varchar', nullable: true }),
|
|
94
|
+
__metadata("design:type", String)
|
|
95
|
+
], AiVideoSceneTask.prototype, "klingTaskId", void 0);
|
|
96
|
+
__decorate([
|
|
97
|
+
(0, typeorm_1.Column)({ name: 'output_url', type: 'text', nullable: true }),
|
|
98
|
+
__metadata("design:type", String)
|
|
99
|
+
], AiVideoSceneTask.prototype, "outputUrl", void 0);
|
|
100
|
+
__decorate([
|
|
101
|
+
(0, typeorm_1.Column)({ name: 's3_url', type: 'text', nullable: true }),
|
|
102
|
+
__metadata("design:type", String)
|
|
103
|
+
], AiVideoSceneTask.prototype, "s3Url", void 0);
|
|
104
|
+
__decorate([
|
|
105
|
+
(0, typeorm_1.Column)({ name: 'kling_submit_request', type: 'jsonb', nullable: true }),
|
|
106
|
+
__metadata("design:type", Object)
|
|
107
|
+
], AiVideoSceneTask.prototype, "klingSubmitRequest", void 0);
|
|
108
|
+
__decorate([
|
|
109
|
+
(0, typeorm_1.Column)({ name: 'kling_submit_response', type: 'jsonb', nullable: true }),
|
|
110
|
+
__metadata("design:type", Object)
|
|
111
|
+
], AiVideoSceneTask.prototype, "klingSubmitResponse", void 0);
|
|
112
|
+
__decorate([
|
|
113
|
+
(0, typeorm_1.Column)({ name: 'kling_poll_log', type: 'jsonb', default: '[]' }),
|
|
114
|
+
__metadata("design:type", Array)
|
|
115
|
+
], AiVideoSceneTask.prototype, "klingPollLog", void 0);
|
|
116
|
+
__decorate([
|
|
117
|
+
(0, typeorm_1.Column)({ name: 'voice_audio_url', type: 'text', nullable: true }),
|
|
118
|
+
__metadata("design:type", String)
|
|
119
|
+
], AiVideoSceneTask.prototype, "voiceAudioUrl", void 0);
|
|
120
|
+
__decorate([
|
|
121
|
+
(0, typeorm_1.Column)({ name: 'voiceover_duration_seconds', type: 'decimal', precision: 6, scale: 2, nullable: true }),
|
|
122
|
+
__metadata("design:type", Number)
|
|
123
|
+
], AiVideoSceneTask.prototype, "voiceoverDurationSeconds", void 0);
|
|
124
|
+
__decorate([
|
|
125
|
+
(0, typeorm_1.Column)({ type: 'varchar', default: AiVideoSceneTaskStatus.PENDING }),
|
|
126
|
+
__metadata("design:type", String)
|
|
127
|
+
], AiVideoSceneTask.prototype, "status", void 0);
|
|
128
|
+
__decorate([
|
|
129
|
+
(0, typeorm_1.Column)({ type: 'integer', default: 0 }),
|
|
130
|
+
__metadata("design:type", Number)
|
|
131
|
+
], AiVideoSceneTask.prototype, "progress", void 0);
|
|
132
|
+
__decorate([
|
|
133
|
+
(0, typeorm_1.Column)({ name: 'error_message', type: 'text', nullable: true }),
|
|
134
|
+
__metadata("design:type", String)
|
|
135
|
+
], AiVideoSceneTask.prototype, "errorMessage", void 0);
|
|
136
|
+
__decorate([
|
|
137
|
+
(0, typeorm_1.CreateDateColumn)({ name: 'created_at' }),
|
|
138
|
+
__metadata("design:type", Date)
|
|
139
|
+
], AiVideoSceneTask.prototype, "createdAt", void 0);
|
|
140
|
+
__decorate([
|
|
141
|
+
(0, typeorm_1.UpdateDateColumn)({ name: 'updated_at' }),
|
|
142
|
+
__metadata("design:type", Date)
|
|
143
|
+
], AiVideoSceneTask.prototype, "updatedAt", void 0);
|
|
144
|
+
exports.AiVideoSceneTask = AiVideoSceneTask = __decorate([
|
|
145
|
+
(0, typeorm_1.Entity)('ai_video_scene_tasks'),
|
|
146
|
+
(0, typeorm_1.Index)(['jobId']),
|
|
147
|
+
(0, typeorm_1.Index)(['jobId', 'sceneOrder']),
|
|
148
|
+
(0, typeorm_1.Index)(['status'])
|
|
149
|
+
], AiVideoSceneTask);
|
package/dist/entities/index.d.ts
CHANGED
package/dist/entities/index.js
CHANGED
|
@@ -56,3 +56,5 @@ __exportStar(require("./scene.entity"), exports);
|
|
|
56
56
|
__exportStar(require("./item.entity"), exports);
|
|
57
57
|
__exportStar(require("./RemotionRender"), exports);
|
|
58
58
|
__exportStar(require("./project-share.entity"), exports);
|
|
59
|
+
__exportStar(require("./ai-video-job.entity"), exports);
|
|
60
|
+
__exportStar(require("./ai-video-scene-task.entity"), exports);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { DataSource } from 'typeorm';
|
|
2
|
+
import { AiVideoJob } from '../entities/ai-video-job.entity';
|
|
3
|
+
import { AiVideoSceneTask } from '../entities/ai-video-scene-task.entity';
|
|
4
|
+
export declare class AiVideoJobRepository {
|
|
5
|
+
private dataSource;
|
|
6
|
+
private jobRepo;
|
|
7
|
+
private taskRepo;
|
|
8
|
+
constructor(dataSource: DataSource);
|
|
9
|
+
createJob(data: Partial<AiVideoJob>): Promise<AiVideoJob>;
|
|
10
|
+
findById(jobId: string): Promise<AiVideoJob | null>;
|
|
11
|
+
findByIdAndUser(jobId: string, userId: string): Promise<AiVideoJob | null>;
|
|
12
|
+
findByIdWithTasks(jobId: string, userId?: string): Promise<(AiVideoJob & {
|
|
13
|
+
tasks: AiVideoSceneTask[];
|
|
14
|
+
}) | null>;
|
|
15
|
+
updateJob(jobId: string, fields: Partial<AiVideoJob>): Promise<void>;
|
|
16
|
+
claimAssembly(jobId: string): Promise<boolean>;
|
|
17
|
+
findStuckJobs(timeoutMinutes: number): Promise<AiVideoJob[]>;
|
|
18
|
+
getSceneTasks(jobId: string): Promise<AiVideoSceneTask[]>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.AiVideoJobRepository = void 0;
|
|
13
|
+
const common_1 = require("@nestjs/common");
|
|
14
|
+
const typeorm_1 = require("typeorm");
|
|
15
|
+
const ai_video_job_entity_1 = require("../entities/ai-video-job.entity");
|
|
16
|
+
const ai_video_scene_task_entity_1 = require("../entities/ai-video-scene-task.entity");
|
|
17
|
+
let AiVideoJobRepository = class AiVideoJobRepository {
|
|
18
|
+
constructor(dataSource) {
|
|
19
|
+
this.dataSource = dataSource;
|
|
20
|
+
this.jobRepo = this.dataSource.getRepository(ai_video_job_entity_1.AiVideoJob);
|
|
21
|
+
this.taskRepo = this.dataSource.getRepository(ai_video_scene_task_entity_1.AiVideoSceneTask);
|
|
22
|
+
}
|
|
23
|
+
async createJob(data) {
|
|
24
|
+
return this.jobRepo.save(data);
|
|
25
|
+
}
|
|
26
|
+
async findById(jobId) {
|
|
27
|
+
return this.jobRepo.findOne({ where: { id: jobId } });
|
|
28
|
+
}
|
|
29
|
+
async findByIdAndUser(jobId, userId) {
|
|
30
|
+
return this.jobRepo.findOne({ where: { id: jobId, userId } });
|
|
31
|
+
}
|
|
32
|
+
async findByIdWithTasks(jobId, userId) {
|
|
33
|
+
const where = { id: jobId };
|
|
34
|
+
if (userId)
|
|
35
|
+
where.userId = userId;
|
|
36
|
+
const job = await this.jobRepo.findOne({ where });
|
|
37
|
+
if (!job)
|
|
38
|
+
return null;
|
|
39
|
+
const tasks = await this.taskRepo.find({
|
|
40
|
+
where: { jobId },
|
|
41
|
+
order: { sceneOrder: 'ASC' },
|
|
42
|
+
});
|
|
43
|
+
return { ...job, tasks };
|
|
44
|
+
}
|
|
45
|
+
async updateJob(jobId, fields) {
|
|
46
|
+
await this.jobRepo.update(jobId, fields);
|
|
47
|
+
}
|
|
48
|
+
async claimAssembly(jobId) {
|
|
49
|
+
const result = await this.jobRepo
|
|
50
|
+
.createQueryBuilder()
|
|
51
|
+
.update(ai_video_job_entity_1.AiVideoJob)
|
|
52
|
+
.set({ status: ai_video_job_entity_1.AiVideoJobStatus.ASSEMBLING_VIDEO })
|
|
53
|
+
.where('id = :id AND status = :status', {
|
|
54
|
+
id: jobId,
|
|
55
|
+
status: ai_video_job_entity_1.AiVideoJobStatus.GENERATING_SCENES,
|
|
56
|
+
})
|
|
57
|
+
.execute();
|
|
58
|
+
return (result.affected ?? 0) > 0;
|
|
59
|
+
}
|
|
60
|
+
async findStuckJobs(timeoutMinutes) {
|
|
61
|
+
return this.jobRepo
|
|
62
|
+
.createQueryBuilder('job')
|
|
63
|
+
.where('job.status = :status', { status: ai_video_job_entity_1.AiVideoJobStatus.GENERATING_SCENES })
|
|
64
|
+
.andWhere("job.updatedAt < NOW() - (:timeout * INTERVAL '1 minute')", { timeout: timeoutMinutes })
|
|
65
|
+
.getMany();
|
|
66
|
+
}
|
|
67
|
+
async getSceneTasks(jobId) {
|
|
68
|
+
return this.taskRepo.find({
|
|
69
|
+
where: { jobId },
|
|
70
|
+
order: { sceneOrder: 'ASC' },
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
exports.AiVideoJobRepository = AiVideoJobRepository;
|
|
75
|
+
exports.AiVideoJobRepository = AiVideoJobRepository = __decorate([
|
|
76
|
+
(0, common_1.Injectable)(),
|
|
77
|
+
__metadata("design:paramtypes", [typeorm_1.DataSource])
|
|
78
|
+
], AiVideoJobRepository);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { DataSource } from 'typeorm';
|
|
2
|
+
import { AiVideoSceneTask } from '../entities/ai-video-scene-task.entity';
|
|
3
|
+
export declare class AiVideoSceneTaskRepository {
|
|
4
|
+
private dataSource;
|
|
5
|
+
private repo;
|
|
6
|
+
constructor(dataSource: DataSource);
|
|
7
|
+
createTask(data: Partial<AiVideoSceneTask>): Promise<AiVideoSceneTask>;
|
|
8
|
+
createTasks(tasks: Partial<AiVideoSceneTask>[]): Promise<AiVideoSceneTask[]>;
|
|
9
|
+
findById(taskId: string): Promise<AiVideoSceneTask | null>;
|
|
10
|
+
findByJobId(jobId: string): Promise<AiVideoSceneTask[]>;
|
|
11
|
+
updateTask(taskId: string, fields: Partial<AiVideoSceneTask>): Promise<void>;
|
|
12
|
+
appendKlingPollLog(taskId: string, pollResponse: object): Promise<void>;
|
|
13
|
+
countByStatus(jobId: string, status: string): Promise<number>;
|
|
14
|
+
findPendingTasks(jobId: string): Promise<AiVideoSceneTask[]>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.AiVideoSceneTaskRepository = void 0;
|
|
13
|
+
const common_1 = require("@nestjs/common");
|
|
14
|
+
const typeorm_1 = require("typeorm");
|
|
15
|
+
const ai_video_scene_task_entity_1 = require("../entities/ai-video-scene-task.entity");
|
|
16
|
+
let AiVideoSceneTaskRepository = class AiVideoSceneTaskRepository {
|
|
17
|
+
constructor(dataSource) {
|
|
18
|
+
this.dataSource = dataSource;
|
|
19
|
+
this.repo = this.dataSource.getRepository(ai_video_scene_task_entity_1.AiVideoSceneTask);
|
|
20
|
+
}
|
|
21
|
+
async createTask(data) {
|
|
22
|
+
return this.repo.save(data);
|
|
23
|
+
}
|
|
24
|
+
async createTasks(tasks) {
|
|
25
|
+
return this.repo.save(tasks);
|
|
26
|
+
}
|
|
27
|
+
async findById(taskId) {
|
|
28
|
+
return this.repo.findOne({ where: { id: taskId } });
|
|
29
|
+
}
|
|
30
|
+
async findByJobId(jobId) {
|
|
31
|
+
return this.repo.find({
|
|
32
|
+
where: { jobId },
|
|
33
|
+
order: { sceneOrder: 'ASC' },
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
async updateTask(taskId, fields) {
|
|
37
|
+
await this.repo.update(taskId, fields);
|
|
38
|
+
}
|
|
39
|
+
async appendKlingPollLog(taskId, pollResponse) {
|
|
40
|
+
await this.repo
|
|
41
|
+
.createQueryBuilder()
|
|
42
|
+
.update(ai_video_scene_task_entity_1.AiVideoSceneTask)
|
|
43
|
+
.set({ klingPollLog: () => `kling_poll_log || '${JSON.stringify([pollResponse])}'::jsonb` })
|
|
44
|
+
.where('id = :id', { id: taskId })
|
|
45
|
+
.execute();
|
|
46
|
+
}
|
|
47
|
+
async countByStatus(jobId, status) {
|
|
48
|
+
return this.repo.count({ where: { jobId, status: status } });
|
|
49
|
+
}
|
|
50
|
+
async findPendingTasks(jobId) {
|
|
51
|
+
return this.repo
|
|
52
|
+
.createQueryBuilder('task')
|
|
53
|
+
.where('task.jobId = :jobId', { jobId })
|
|
54
|
+
.andWhere('task.status IN (:...statuses)', {
|
|
55
|
+
statuses: ['pending', 'searching_stock', 'submitting_kling', 'generating'],
|
|
56
|
+
})
|
|
57
|
+
.orderBy('task.sceneOrder', 'ASC')
|
|
58
|
+
.getMany();
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
exports.AiVideoSceneTaskRepository = AiVideoSceneTaskRepository;
|
|
62
|
+
exports.AiVideoSceneTaskRepository = AiVideoSceneTaskRepository = __decorate([
|
|
63
|
+
(0, common_1.Injectable)(),
|
|
64
|
+
__metadata("design:paramtypes", [typeorm_1.DataSource])
|
|
65
|
+
], AiVideoSceneTaskRepository);
|
|
@@ -37,3 +37,5 @@ export { SceneRepository } from './scene.repository';
|
|
|
37
37
|
export { ItemRepository } from './item.repository';
|
|
38
38
|
export { RemotionRenderRepository } from './RemotionRenderRepository';
|
|
39
39
|
export { ProjectShareRepository } from './project-share.repository';
|
|
40
|
+
export { AiVideoJobRepository } from './ai-video-job.repository';
|
|
41
|
+
export { AiVideoSceneTaskRepository } from './ai-video-scene-task.repository';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ProjectShareRepository = exports.RemotionRenderRepository = exports.ItemRepository = exports.SceneRepository = exports.ProjectSceneRepository = exports.MetadataActivityLogRepository = exports.AiEmbeddingRepository = exports.UserContextRepository = exports.ProjectMetadataRepository = exports.AssetMetadataRepository = exports.AudioWaveformRepository = exports.VideoFilmstripRepository = exports.VideoSubtitleRepository = exports.VideoRenderRepository = exports.VideoTranscodeRepository = exports.EffectRepository = exports.AssetRepository = exports.AiUsageRepository = exports.ReferralEventRepository = exports.RewardRuleRepository = exports.PlanCreditConfigurationRepository = exports.CreditTransactionRepository = exports.CreditAllocationRepository = exports.StripeWebhookRepository = exports.PaymentTransactionRepository = exports.SubscriptionUsageRepository = exports.UserSubscriptionRepository = exports.PlanRepository = exports.SubscriptionPlanRepository = exports.CommentRepository = exports.EditorProjectRepository = exports.InviteRepository = exports.WorkspaceMemberRepository = exports.WorkspaceRepository = exports.AuthSessionRepository = exports.UserOnboardingRepository = exports.UserProfileRepository = exports.UserRepository = exports.BaseRepository = void 0;
|
|
3
|
+
exports.AiVideoSceneTaskRepository = exports.AiVideoJobRepository = exports.ProjectShareRepository = exports.RemotionRenderRepository = exports.ItemRepository = exports.SceneRepository = exports.ProjectSceneRepository = exports.MetadataActivityLogRepository = exports.AiEmbeddingRepository = exports.UserContextRepository = exports.ProjectMetadataRepository = exports.AssetMetadataRepository = exports.AudioWaveformRepository = exports.VideoFilmstripRepository = exports.VideoSubtitleRepository = exports.VideoRenderRepository = exports.VideoTranscodeRepository = exports.EffectRepository = exports.AssetRepository = exports.AiUsageRepository = exports.ReferralEventRepository = exports.RewardRuleRepository = exports.PlanCreditConfigurationRepository = exports.CreditTransactionRepository = exports.CreditAllocationRepository = exports.StripeWebhookRepository = exports.PaymentTransactionRepository = exports.SubscriptionUsageRepository = exports.UserSubscriptionRepository = exports.PlanRepository = exports.SubscriptionPlanRepository = exports.CommentRepository = exports.EditorProjectRepository = exports.InviteRepository = exports.WorkspaceMemberRepository = exports.WorkspaceRepository = exports.AuthSessionRepository = exports.UserOnboardingRepository = exports.UserProfileRepository = exports.UserRepository = exports.BaseRepository = void 0;
|
|
4
4
|
var base_repository_1 = require("./base.repository");
|
|
5
5
|
Object.defineProperty(exports, "BaseRepository", { enumerable: true, get: function () { return base_repository_1.BaseRepository; } });
|
|
6
6
|
var user_repository_1 = require("./user.repository");
|
|
@@ -79,3 +79,7 @@ var RemotionRenderRepository_1 = require("./RemotionRenderRepository");
|
|
|
79
79
|
Object.defineProperty(exports, "RemotionRenderRepository", { enumerable: true, get: function () { return RemotionRenderRepository_1.RemotionRenderRepository; } });
|
|
80
80
|
var project_share_repository_1 = require("./project-share.repository");
|
|
81
81
|
Object.defineProperty(exports, "ProjectShareRepository", { enumerable: true, get: function () { return project_share_repository_1.ProjectShareRepository; } });
|
|
82
|
+
var ai_video_job_repository_1 = require("./ai-video-job.repository");
|
|
83
|
+
Object.defineProperty(exports, "AiVideoJobRepository", { enumerable: true, get: function () { return ai_video_job_repository_1.AiVideoJobRepository; } });
|
|
84
|
+
var ai_video_scene_task_repository_1 = require("./ai-video-scene-task.repository");
|
|
85
|
+
Object.defineProperty(exports, "AiVideoSceneTaskRepository", { enumerable: true, get: function () { return ai_video_scene_task_repository_1.AiVideoSceneTaskRepository; } });
|
|
@@ -10,6 +10,7 @@ exports.RepositoryModule = void 0;
|
|
|
10
10
|
const common_1 = require("@nestjs/common");
|
|
11
11
|
const typeorm_1 = require("@nestjs/typeorm");
|
|
12
12
|
const entities_1 = require("../entities");
|
|
13
|
+
const entities_2 = require("../entities");
|
|
13
14
|
const _1 = require("./");
|
|
14
15
|
const repositories = [
|
|
15
16
|
_1.UserRepository,
|
|
@@ -50,6 +51,8 @@ const repositories = [
|
|
|
50
51
|
_1.ItemRepository,
|
|
51
52
|
_1.RemotionRenderRepository,
|
|
52
53
|
_1.ProjectShareRepository,
|
|
54
|
+
_1.AiVideoJobRepository,
|
|
55
|
+
_1.AiVideoSceneTaskRepository,
|
|
53
56
|
];
|
|
54
57
|
const entities = [
|
|
55
58
|
entities_1.User,
|
|
@@ -92,6 +95,8 @@ const entities = [
|
|
|
92
95
|
entities_1.PlanCreditConfiguration,
|
|
93
96
|
entities_1.CreditConsumptionLog,
|
|
94
97
|
entities_1.ProjectShare,
|
|
98
|
+
entities_2.AiVideoJob,
|
|
99
|
+
entities_2.AiVideoSceneTask,
|
|
95
100
|
];
|
|
96
101
|
let RepositoryModule = class RepositoryModule {
|
|
97
102
|
};
|