@ai-grator/api 0.2.66 → 0.3.66
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/build/errors/errors.d.ts +74 -0
- package/build/errors/errors.d.ts.map +1 -1
- package/build/errors/errors.js +74 -0
- package/build/generation-job/endpoints/commands/create-generation-job.command.d.ts +2 -2
- package/build/generation-job/endpoints/commands/update-generation-job.command.d.ts +2 -2
- package/build/generation-job/endpoints/queries/get-generation-job-by-uuid.query.d.ts +2 -2
- package/build/generation-job/endpoints/queries/get-generation-job-history.query.d.ts +3 -3
- package/build/generation-job/endpoints/queries/get-generation-jobs.query.d.ts +2 -2
- package/build/generation-job/models/generation-job-response.schema.d.ts +1 -1
- package/build/generation-job/models/generation-job-response.schema.js +1 -1
- package/build/index.d.ts +1 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1 -0
- package/build/referral/endpoints/referral.d.ts +3 -0
- package/build/referral/endpoints/referral.d.ts.map +1 -1
- package/build/referral/endpoints/referral.js +3 -0
- package/build/referral/models/index.d.ts +1 -0
- package/build/referral/models/index.d.ts.map +1 -1
- package/build/referral/models/index.js +1 -0
- package/build/referral/models/referral-advertising-stats.schema.d.ts +101 -0
- package/build/referral/models/referral-advertising-stats.schema.d.ts.map +1 -0
- package/build/referral/models/referral-advertising-stats.schema.js +62 -0
- package/build/tsconfig.tsbuildinfo +1 -1
- package/build/video-generation-chain/endpoints/commands/cancel-video-generation-chain.command.d.ts +112 -0
- package/build/video-generation-chain/endpoints/commands/cancel-video-generation-chain.command.d.ts.map +1 -0
- package/build/video-generation-chain/endpoints/commands/cancel-video-generation-chain.command.js +26 -0
- package/build/video-generation-chain/endpoints/commands/create-video-generation-chain.command.d.ts +120 -0
- package/build/video-generation-chain/endpoints/commands/create-video-generation-chain.command.d.ts.map +1 -0
- package/build/video-generation-chain/endpoints/commands/create-video-generation-chain.command.js +52 -0
- package/build/video-generation-chain/endpoints/commands/index.d.ts +6 -0
- package/build/video-generation-chain/endpoints/commands/index.d.ts.map +1 -0
- package/build/video-generation-chain/endpoints/commands/index.js +21 -0
- package/build/video-generation-chain/endpoints/commands/regenerate-video-generation-chain-scene.command.d.ts +114 -0
- package/build/video-generation-chain/endpoints/commands/regenerate-video-generation-chain-scene.command.d.ts.map +1 -0
- package/build/video-generation-chain/endpoints/commands/regenerate-video-generation-chain-scene.command.js +25 -0
- package/build/video-generation-chain/endpoints/commands/resume-video-generation-chain.command.d.ts +113 -0
- package/build/video-generation-chain/endpoints/commands/resume-video-generation-chain.command.d.ts.map +1 -0
- package/build/video-generation-chain/endpoints/commands/resume-video-generation-chain.command.js +27 -0
- package/build/video-generation-chain/endpoints/commands/update-video-generation-chain-scene.command.d.ts +127 -0
- package/build/video-generation-chain/endpoints/commands/update-video-generation-chain-scene.command.d.ts.map +1 -0
- package/build/video-generation-chain/endpoints/commands/update-video-generation-chain-scene.command.js +43 -0
- package/build/video-generation-chain/endpoints/index.d.ts +4 -0
- package/build/video-generation-chain/endpoints/index.d.ts.map +1 -0
- package/build/video-generation-chain/endpoints/index.js +19 -0
- package/build/video-generation-chain/endpoints/queries/get-video-generation-chain-by-uuid.query.d.ts +111 -0
- package/build/video-generation-chain/endpoints/queries/get-video-generation-chain-by-uuid.query.d.ts.map +1 -0
- package/build/video-generation-chain/endpoints/queries/get-video-generation-chain-by-uuid.query.js +25 -0
- package/build/video-generation-chain/endpoints/queries/get-video-generation-chain-config.query.d.ts +107 -0
- package/build/video-generation-chain/endpoints/queries/get-video-generation-chain-config.query.d.ts.map +1 -0
- package/build/video-generation-chain/endpoints/queries/get-video-generation-chain-config.query.js +22 -0
- package/build/video-generation-chain/endpoints/queries/get-video-generation-chains.query.d.ts +54 -0
- package/build/video-generation-chain/endpoints/queries/get-video-generation-chains.query.d.ts.map +1 -0
- package/build/video-generation-chain/endpoints/queries/get-video-generation-chains.query.js +26 -0
- package/build/video-generation-chain/endpoints/queries/index.d.ts +4 -0
- package/build/video-generation-chain/endpoints/queries/index.d.ts.map +1 -0
- package/build/video-generation-chain/endpoints/queries/index.js +19 -0
- package/build/video-generation-chain/endpoints/video-generation-chain.d.ts +12 -0
- package/build/video-generation-chain/endpoints/video-generation-chain.d.ts.map +1 -0
- package/build/video-generation-chain/endpoints/video-generation-chain.js +14 -0
- package/build/video-generation-chain/enums/index.d.ts +5 -0
- package/build/video-generation-chain/enums/index.d.ts.map +1 -0
- package/build/video-generation-chain/enums/index.js +20 -0
- package/build/video-generation-chain/enums/video-generation-chain-frame-slot.enum.d.ts +6 -0
- package/build/video-generation-chain/enums/video-generation-chain-frame-slot.enum.d.ts.map +1 -0
- package/build/video-generation-chain/enums/video-generation-chain-frame-slot.enum.js +13 -0
- package/build/video-generation-chain/enums/video-generation-chain-limits.d.ts +3 -0
- package/build/video-generation-chain/enums/video-generation-chain-limits.d.ts.map +1 -0
- package/build/video-generation-chain/enums/video-generation-chain-limits.js +5 -0
- package/build/video-generation-chain/enums/video-generation-chain-scene-status.enum.d.ts +7 -0
- package/build/video-generation-chain/enums/video-generation-chain-scene-status.enum.d.ts.map +1 -0
- package/build/video-generation-chain/enums/video-generation-chain-scene-status.enum.js +10 -0
- package/build/video-generation-chain/enums/video-generation-chain-status.enum.d.ts +9 -0
- package/build/video-generation-chain/enums/video-generation-chain-status.enum.d.ts.map +1 -0
- package/build/video-generation-chain/enums/video-generation-chain-status.enum.js +12 -0
- package/build/video-generation-chain/index.d.ts +4 -0
- package/build/video-generation-chain/index.d.ts.map +1 -0
- package/build/video-generation-chain/index.js +19 -0
- package/build/video-generation-chain/models/index.d.ts +4 -0
- package/build/video-generation-chain/models/index.d.ts.map +1 -0
- package/build/video-generation-chain/models/index.js +19 -0
- package/build/video-generation-chain/models/video-generation-chain-response.schema.d.ts +73 -0
- package/build/video-generation-chain/models/video-generation-chain-response.schema.d.ts.map +1 -0
- package/build/video-generation-chain/models/video-generation-chain-response.schema.js +24 -0
- package/build/video-generation-chain/models/video-generation-chain-scene-input.schema.d.ts +9 -0
- package/build/video-generation-chain/models/video-generation-chain-scene-input.schema.d.ts.map +1 -0
- package/build/video-generation-chain/models/video-generation-chain-scene-input.schema.js +15 -0
- package/build/video-generation-chain/models/video-generation-chain-scene-response.schema.d.ts +44 -0
- package/build/video-generation-chain/models/video-generation-chain-scene-response.schema.d.ts.map +1 -0
- package/build/video-generation-chain/models/video-generation-chain-scene-response.schema.js +24 -0
- package/errors/errors.ts +74 -0
- package/generation-job/models/generation-job-response.schema.ts +1 -1
- package/index.ts +1 -0
- package/package.json +1 -1
- package/referral/endpoints/referral.ts +3 -0
- package/referral/models/index.ts +1 -0
- package/referral/models/referral-advertising-stats.schema.ts +79 -0
- package/video-generation-chain/endpoints/commands/cancel-video-generation-chain.command.ts +26 -0
- package/video-generation-chain/endpoints/commands/create-video-generation-chain.command.ts +59 -0
- package/video-generation-chain/endpoints/commands/index.ts +5 -0
- package/video-generation-chain/endpoints/commands/regenerate-video-generation-chain-scene.command.ts +25 -0
- package/video-generation-chain/endpoints/commands/resume-video-generation-chain.command.ts +27 -0
- package/video-generation-chain/endpoints/commands/update-video-generation-chain-scene.command.ts +49 -0
- package/video-generation-chain/endpoints/index.ts +3 -0
- package/video-generation-chain/endpoints/queries/get-video-generation-chain-by-uuid.query.ts +25 -0
- package/video-generation-chain/endpoints/queries/get-video-generation-chain-config.query.ts +23 -0
- package/video-generation-chain/endpoints/queries/get-video-generation-chains.query.ts +26 -0
- package/video-generation-chain/endpoints/queries/index.ts +3 -0
- package/video-generation-chain/endpoints/video-generation-chain.ts +12 -0
- package/video-generation-chain/enums/index.ts +4 -0
- package/video-generation-chain/enums/video-generation-chain-frame-slot.enum.ts +10 -0
- package/video-generation-chain/enums/video-generation-chain-limits.ts +2 -0
- package/video-generation-chain/enums/video-generation-chain-scene-status.enum.ts +6 -0
- package/video-generation-chain/enums/video-generation-chain-status.enum.ts +8 -0
- package/video-generation-chain/index.ts +3 -0
- package/video-generation-chain/models/index.ts +3 -0
- package/video-generation-chain/models/video-generation-chain-response.schema.ts +28 -0
- package/video-generation-chain/models/video-generation-chain-scene-input.schema.ts +17 -0
- package/video-generation-chain/models/video-generation-chain-scene-response.schema.ts +26 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { defineContract, HTTP_METHODS, HttpErrorResponseSchema } from '../../../_common';
|
|
3
|
+
import {
|
|
4
|
+
VIDEO_GENERATION_CHAIN_FRAME_SLOT,
|
|
5
|
+
VIDEO_GENERATION_CHAIN_MAX_SCENES,
|
|
6
|
+
VIDEO_GENERATION_CHAIN_MIN_SCENES,
|
|
7
|
+
} from '../../enums';
|
|
8
|
+
import { VideoGenerationChainResponseSchema, VideoGenerationChainSceneInputSchema } from '../../models';
|
|
9
|
+
import { VIDEO_GENERATION_CHAIN_ROUTES } from '../video-generation-chain';
|
|
10
|
+
|
|
11
|
+
export const CreateVideoGenerationChainCommandBody = z
|
|
12
|
+
.object({
|
|
13
|
+
modelId: z.uuid(),
|
|
14
|
+
scenes: z
|
|
15
|
+
.array(VideoGenerationChainSceneInputSchema)
|
|
16
|
+
.min(VIDEO_GENERATION_CHAIN_MIN_SCENES)
|
|
17
|
+
.max(VIDEO_GENERATION_CHAIN_MAX_SCENES),
|
|
18
|
+
})
|
|
19
|
+
.superRefine(({ scenes }, ctx) => {
|
|
20
|
+
const lastIndex = scenes.length - 1;
|
|
21
|
+
|
|
22
|
+
scenes.forEach((scene, index) => {
|
|
23
|
+
const slots = Object.keys(scene.attachments ?? {});
|
|
24
|
+
|
|
25
|
+
if (index !== 0 && slots.includes(VIDEO_GENERATION_CHAIN_FRAME_SLOT.FIRST_FRAME)) {
|
|
26
|
+
ctx.addIssue({
|
|
27
|
+
code: 'custom',
|
|
28
|
+
path: ['scenes', index, 'attachments', VIDEO_GENERATION_CHAIN_FRAME_SLOT.FIRST_FRAME],
|
|
29
|
+
message: 'First frame is allowed only for the first scene',
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (index !== lastIndex && slots.includes(VIDEO_GENERATION_CHAIN_FRAME_SLOT.LAST_FRAME)) {
|
|
34
|
+
ctx.addIssue({
|
|
35
|
+
code: 'custom',
|
|
36
|
+
path: ['scenes', index, 'attachments', VIDEO_GENERATION_CHAIN_FRAME_SLOT.LAST_FRAME],
|
|
37
|
+
message: 'Last frame is allowed only for the last scene',
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
export const CreateVideoGenerationChainCommandResponse = VideoGenerationChainResponseSchema;
|
|
44
|
+
|
|
45
|
+
export const CreateVideoGenerationChainCommand = defineContract({
|
|
46
|
+
method: HTTP_METHODS.POST,
|
|
47
|
+
path: VIDEO_GENERATION_CHAIN_ROUTES.CREATE,
|
|
48
|
+
summary: 'Create and start a chain of linked video generations',
|
|
49
|
+
request: {
|
|
50
|
+
body: CreateVideoGenerationChainCommandBody,
|
|
51
|
+
},
|
|
52
|
+
responses: {
|
|
53
|
+
201: CreateVideoGenerationChainCommandResponse,
|
|
54
|
+
400: HttpErrorResponseSchema,
|
|
55
|
+
401: HttpErrorResponseSchema,
|
|
56
|
+
404: HttpErrorResponseSchema,
|
|
57
|
+
500: HttpErrorResponseSchema,
|
|
58
|
+
},
|
|
59
|
+
});
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export * from './create-video-generation-chain.command';
|
|
2
|
+
export * from './update-video-generation-chain-scene.command';
|
|
3
|
+
export * from './resume-video-generation-chain.command';
|
|
4
|
+
export * from './cancel-video-generation-chain.command';
|
|
5
|
+
export * from './regenerate-video-generation-chain-scene.command';
|
package/video-generation-chain/endpoints/commands/regenerate-video-generation-chain-scene.command.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { defineContract, HTTP_METHODS, HttpErrorResponseSchema } from '../../../_common';
|
|
2
|
+
import { VideoGenerationChainResponseSchema } from '../../models';
|
|
3
|
+
import { VIDEO_GENERATION_CHAIN_ROUTES } from '../video-generation-chain';
|
|
4
|
+
import { VideoGenerationChainSceneParams } from './update-video-generation-chain-scene.command';
|
|
5
|
+
|
|
6
|
+
export const RegenerateVideoGenerationChainSceneCommandParams = VideoGenerationChainSceneParams;
|
|
7
|
+
|
|
8
|
+
export const RegenerateVideoGenerationChainSceneCommandResponse = VideoGenerationChainResponseSchema;
|
|
9
|
+
|
|
10
|
+
export const RegenerateVideoGenerationChainSceneCommand = defineContract({
|
|
11
|
+
method: HTTP_METHODS.POST,
|
|
12
|
+
path: VIDEO_GENERATION_CHAIN_ROUTES.REGENERATE_SCENE(':uuid', ':index'),
|
|
13
|
+
summary: 'Regenerate a generated scene that no generated scene depends on',
|
|
14
|
+
request: {
|
|
15
|
+
params: RegenerateVideoGenerationChainSceneCommandParams,
|
|
16
|
+
},
|
|
17
|
+
responses: {
|
|
18
|
+
200: RegenerateVideoGenerationChainSceneCommandResponse,
|
|
19
|
+
400: HttpErrorResponseSchema,
|
|
20
|
+
401: HttpErrorResponseSchema,
|
|
21
|
+
404: HttpErrorResponseSchema,
|
|
22
|
+
409: HttpErrorResponseSchema,
|
|
23
|
+
500: HttpErrorResponseSchema,
|
|
24
|
+
},
|
|
25
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { defineContract, HTTP_METHODS, HttpErrorResponseSchema } from '../../../_common';
|
|
3
|
+
import { VideoGenerationChainResponseSchema } from '../../models';
|
|
4
|
+
import { VIDEO_GENERATION_CHAIN_ROUTES } from '../video-generation-chain';
|
|
5
|
+
|
|
6
|
+
export const ResumeVideoGenerationChainCommandParams = z.object({
|
|
7
|
+
uuid: z.uuid(),
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export const ResumeVideoGenerationChainCommandResponse = VideoGenerationChainResponseSchema;
|
|
11
|
+
|
|
12
|
+
export const ResumeVideoGenerationChainCommand = defineContract({
|
|
13
|
+
method: HTTP_METHODS.POST,
|
|
14
|
+
path: VIDEO_GENERATION_CHAIN_ROUTES.RESUME(':uuid'),
|
|
15
|
+
summary: 'Resume a paused generation chain from the first ungenerated scene',
|
|
16
|
+
request: {
|
|
17
|
+
params: ResumeVideoGenerationChainCommandParams,
|
|
18
|
+
},
|
|
19
|
+
responses: {
|
|
20
|
+
200: ResumeVideoGenerationChainCommandResponse,
|
|
21
|
+
400: HttpErrorResponseSchema,
|
|
22
|
+
401: HttpErrorResponseSchema,
|
|
23
|
+
404: HttpErrorResponseSchema,
|
|
24
|
+
409: HttpErrorResponseSchema,
|
|
25
|
+
500: HttpErrorResponseSchema,
|
|
26
|
+
},
|
|
27
|
+
});
|
package/video-generation-chain/endpoints/commands/update-video-generation-chain-scene.command.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { defineContract, HTTP_METHODS, HttpErrorResponseSchema } from '../../../_common';
|
|
3
|
+
import { VIDEO_GENERATION_CHAIN_MAX_SCENES } from '../../enums';
|
|
4
|
+
import {
|
|
5
|
+
VideoGenerationChainResponseSchema,
|
|
6
|
+
VideoGenerationChainSceneAttachmentsSchema,
|
|
7
|
+
VideoGenerationChainSceneParamsSchema,
|
|
8
|
+
} from '../../models';
|
|
9
|
+
import { VIDEO_GENERATION_CHAIN_ROUTES } from '../video-generation-chain';
|
|
10
|
+
|
|
11
|
+
export const VideoGenerationChainSceneParams = z.object({
|
|
12
|
+
uuid: z.uuid(),
|
|
13
|
+
index: z.coerce
|
|
14
|
+
.number()
|
|
15
|
+
.int()
|
|
16
|
+
.min(0)
|
|
17
|
+
.max(VIDEO_GENERATION_CHAIN_MAX_SCENES - 1),
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export const UpdateVideoGenerationChainSceneCommandParams = VideoGenerationChainSceneParams;
|
|
21
|
+
|
|
22
|
+
export const UpdateVideoGenerationChainSceneCommandBody = z
|
|
23
|
+
.object({
|
|
24
|
+
params: VideoGenerationChainSceneParamsSchema.optional(),
|
|
25
|
+
attachments: VideoGenerationChainSceneAttachmentsSchema.optional(),
|
|
26
|
+
})
|
|
27
|
+
.refine((body) => body.params !== undefined || body.attachments !== undefined, {
|
|
28
|
+
message: 'At least one of params or attachments is required',
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
export const UpdateVideoGenerationChainSceneCommandResponse = VideoGenerationChainResponseSchema;
|
|
32
|
+
|
|
33
|
+
export const UpdateVideoGenerationChainSceneCommand = defineContract({
|
|
34
|
+
method: HTTP_METHODS.PATCH,
|
|
35
|
+
path: VIDEO_GENERATION_CHAIN_ROUTES.UPDATE_SCENE(':uuid', ':index'),
|
|
36
|
+
summary: 'Update a pending or failed scene of a paused generation chain',
|
|
37
|
+
request: {
|
|
38
|
+
params: UpdateVideoGenerationChainSceneCommandParams,
|
|
39
|
+
body: UpdateVideoGenerationChainSceneCommandBody,
|
|
40
|
+
},
|
|
41
|
+
responses: {
|
|
42
|
+
200: UpdateVideoGenerationChainSceneCommandResponse,
|
|
43
|
+
400: HttpErrorResponseSchema,
|
|
44
|
+
401: HttpErrorResponseSchema,
|
|
45
|
+
404: HttpErrorResponseSchema,
|
|
46
|
+
409: HttpErrorResponseSchema,
|
|
47
|
+
500: HttpErrorResponseSchema,
|
|
48
|
+
},
|
|
49
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { defineContract, HTTP_METHODS, HttpErrorResponseSchema } from '../../../_common';
|
|
3
|
+
import { VideoGenerationChainResponseSchema } from '../../models';
|
|
4
|
+
import { VIDEO_GENERATION_CHAIN_ROUTES } from '../video-generation-chain';
|
|
5
|
+
|
|
6
|
+
export const GetVideoGenerationChainByUuidQueryParams = z.object({
|
|
7
|
+
uuid: z.uuid(),
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export const GetVideoGenerationChainByUuidQueryResponse = VideoGenerationChainResponseSchema;
|
|
11
|
+
|
|
12
|
+
export const GetVideoGenerationChainByUuidQuery = defineContract({
|
|
13
|
+
method: HTTP_METHODS.GET,
|
|
14
|
+
path: VIDEO_GENERATION_CHAIN_ROUTES.GET_BY_UUID(':uuid'),
|
|
15
|
+
summary: 'Get generation chain with its scenes',
|
|
16
|
+
request: {
|
|
17
|
+
params: GetVideoGenerationChainByUuidQueryParams,
|
|
18
|
+
},
|
|
19
|
+
responses: {
|
|
20
|
+
200: GetVideoGenerationChainByUuidQueryResponse,
|
|
21
|
+
401: HttpErrorResponseSchema,
|
|
22
|
+
404: HttpErrorResponseSchema,
|
|
23
|
+
500: HttpErrorResponseSchema,
|
|
24
|
+
},
|
|
25
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { defineContract, HTTP_METHODS, HttpErrorResponseSchema } from '../../../_common';
|
|
3
|
+
import { GenerationModelResponseSchema } from '../../../generation-model';
|
|
4
|
+
import { VIDEO_GENERATION_CHAIN_ROUTES } from '../video-generation-chain';
|
|
5
|
+
|
|
6
|
+
export const GetVideoGenerationChainConfigResponse = z.object({
|
|
7
|
+
models: z.array(GenerationModelResponseSchema),
|
|
8
|
+
minScenes: z.int().positive(),
|
|
9
|
+
maxScenes: z.int().positive(),
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export type GetVideoGenerationChainConfigResponseType = z.infer<typeof GetVideoGenerationChainConfigResponse>;
|
|
13
|
+
|
|
14
|
+
export const GetVideoGenerationChainConfigQuery = defineContract({
|
|
15
|
+
method: HTTP_METHODS.GET,
|
|
16
|
+
path: VIDEO_GENERATION_CHAIN_ROUTES.GET_CONFIG,
|
|
17
|
+
summary: 'Get generation chain config (available models and scene limits)',
|
|
18
|
+
responses: {
|
|
19
|
+
200: GetVideoGenerationChainConfigResponse,
|
|
20
|
+
401: HttpErrorResponseSchema,
|
|
21
|
+
500: HttpErrorResponseSchema,
|
|
22
|
+
},
|
|
23
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { defineContract, defineCursorPaginationQuery, HTTP_METHODS, HttpErrorResponseSchema } from '../../../_common';
|
|
3
|
+
import { VideoGenerationChainListItemSchema } from '../../models';
|
|
4
|
+
import { VIDEO_GENERATION_CHAIN_ROUTES } from '../video-generation-chain';
|
|
5
|
+
|
|
6
|
+
export const GetVideoGenerationChainsQueryQuery = defineCursorPaginationQuery(z.uuid());
|
|
7
|
+
|
|
8
|
+
export const GetVideoGenerationChainsQueryResponse = z.object({
|
|
9
|
+
chains: z.array(VideoGenerationChainListItemSchema),
|
|
10
|
+
nextCursor: z.uuid().nullable(),
|
|
11
|
+
hasMore: z.boolean(),
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export const GetVideoGenerationChainsQuery = defineContract({
|
|
15
|
+
method: HTTP_METHODS.GET,
|
|
16
|
+
path: VIDEO_GENERATION_CHAIN_ROUTES.GET_ALL,
|
|
17
|
+
summary: 'Get generation chains of the current user with cursor pagination',
|
|
18
|
+
request: {
|
|
19
|
+
query: GetVideoGenerationChainsQueryQuery,
|
|
20
|
+
},
|
|
21
|
+
responses: {
|
|
22
|
+
200: GetVideoGenerationChainsQueryResponse,
|
|
23
|
+
401: HttpErrorResponseSchema,
|
|
24
|
+
500: HttpErrorResponseSchema,
|
|
25
|
+
},
|
|
26
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export const VIDEO_GENERATION_CHAIN_CONTROLLER = 'video-generation-chains' as const;
|
|
2
|
+
|
|
3
|
+
export const VIDEO_GENERATION_CHAIN_ROUTES = {
|
|
4
|
+
CREATE: '',
|
|
5
|
+
GET_ALL: '',
|
|
6
|
+
GET_CONFIG: 'config',
|
|
7
|
+
GET_BY_UUID: (uuid: string) => `${uuid}`,
|
|
8
|
+
RESUME: (uuid: string) => `${uuid}/resume`,
|
|
9
|
+
CANCEL: (uuid: string) => `${uuid}/cancel`,
|
|
10
|
+
UPDATE_SCENE: (uuid: string, index: string) => `${uuid}/scenes/${index}`,
|
|
11
|
+
REGENERATE_SCENE: (uuid: string, index: string) => `${uuid}/scenes/${index}/regenerate`,
|
|
12
|
+
} as const;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export enum VIDEO_GENERATION_CHAIN_FRAME_SLOT {
|
|
2
|
+
FIRST_FRAME = 'first_frame_url',
|
|
3
|
+
LAST_FRAME = 'last_frame_url',
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export const VIDEO_GENERATION_CHAIN_RESERVED_PARAM_KEYS: readonly string[] = [
|
|
7
|
+
VIDEO_GENERATION_CHAIN_FRAME_SLOT.FIRST_FRAME,
|
|
8
|
+
VIDEO_GENERATION_CHAIN_FRAME_SLOT.LAST_FRAME,
|
|
9
|
+
'return_last_frame',
|
|
10
|
+
];
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { VIDEO_GENERATION_CHAIN_STATUS } from '../enums';
|
|
3
|
+
import { VideoGenerationChainSceneResponseSchema } from './video-generation-chain-scene-response.schema';
|
|
4
|
+
|
|
5
|
+
export const VideoGenerationChainStatusSchema = z.enum(VIDEO_GENERATION_CHAIN_STATUS);
|
|
6
|
+
|
|
7
|
+
export const VideoGenerationChainSummarySchema = z.object({
|
|
8
|
+
uuid: z.uuid(),
|
|
9
|
+
modelId: z.uuid(),
|
|
10
|
+
status: VideoGenerationChainStatusSchema,
|
|
11
|
+
errorCode: z.string().nullable(),
|
|
12
|
+
errorMessage: z.string().nullable(),
|
|
13
|
+
finishedAt: z.iso.datetime().nullable(),
|
|
14
|
+
createdAt: z.iso.datetime(),
|
|
15
|
+
updatedAt: z.iso.datetime(),
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export const VideoGenerationChainResponseSchema = VideoGenerationChainSummarySchema.extend({
|
|
19
|
+
scenes: z.array(VideoGenerationChainSceneResponseSchema),
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
export const VideoGenerationChainListItemSchema = VideoGenerationChainSummarySchema.extend({
|
|
23
|
+
scenesTotal: z.number().int().nonnegative(),
|
|
24
|
+
scenesSucceeded: z.number().int().nonnegative(),
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export type VideoGenerationChainResponseSchemaType = z.infer<typeof VideoGenerationChainResponseSchema>;
|
|
28
|
+
export type VideoGenerationChainListItemSchemaType = z.infer<typeof VideoGenerationChainListItemSchema>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { VIDEO_GENERATION_CHAIN_RESERVED_PARAM_KEYS } from '../enums';
|
|
3
|
+
|
|
4
|
+
export const VideoGenerationChainSceneParamsSchema = z
|
|
5
|
+
.record(z.string(), z.unknown())
|
|
6
|
+
.refine((params) => VIDEO_GENERATION_CHAIN_RESERVED_PARAM_KEYS.every((key) => !(key in params)), {
|
|
7
|
+
message: `Params must not contain: ${VIDEO_GENERATION_CHAIN_RESERVED_PARAM_KEYS.join(', ')}`,
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export const VideoGenerationChainSceneAttachmentsSchema = z.record(z.string(), z.array(z.uuid()));
|
|
11
|
+
|
|
12
|
+
export const VideoGenerationChainSceneInputSchema = z.object({
|
|
13
|
+
params: VideoGenerationChainSceneParamsSchema,
|
|
14
|
+
attachments: VideoGenerationChainSceneAttachmentsSchema.optional(),
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export type VideoGenerationChainSceneInputSchemaType = z.infer<typeof VideoGenerationChainSceneInputSchema>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { GenerationJobAttachmentFileSchema, GenerationJobOutputSchema } from '../../generation-job';
|
|
3
|
+
import { VIDEO_GENERATION_CHAIN_SCENE_STATUS } from '../enums';
|
|
4
|
+
|
|
5
|
+
export const VideoGenerationChainSceneStatusSchema = z.enum(VIDEO_GENERATION_CHAIN_SCENE_STATUS);
|
|
6
|
+
|
|
7
|
+
export const VideoGenerationChainSceneFrameSchema = z.object({
|
|
8
|
+
uuid: z.uuid(),
|
|
9
|
+
url: z.url(),
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export const VideoGenerationChainSceneResponseSchema = z.object({
|
|
13
|
+
index: z.number().int().nonnegative(),
|
|
14
|
+
status: VideoGenerationChainSceneStatusSchema,
|
|
15
|
+
params: z.record(z.string(), z.unknown()),
|
|
16
|
+
attachments: z.record(z.string(), z.array(GenerationJobAttachmentFileSchema)),
|
|
17
|
+
generationJobId: z.uuid().nullable(),
|
|
18
|
+
output: GenerationJobOutputSchema.nullable(),
|
|
19
|
+
lastFrame: VideoGenerationChainSceneFrameSchema.nullable(),
|
|
20
|
+
errorCode: z.string().nullable(),
|
|
21
|
+
errorMessage: z.string().nullable(),
|
|
22
|
+
startedAt: z.iso.datetime().nullable(),
|
|
23
|
+
finishedAt: z.iso.datetime().nullable(),
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
export type VideoGenerationChainSceneResponseSchemaType = z.infer<typeof VideoGenerationChainSceneResponseSchema>;
|