@purpleschool/gptbot-tools 0.0.55 → 0.0.56-presentation
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/common/errors/errors.js +399 -2
- package/build/index.js +6 -0
- package/build/music/commands/convert-to-wav.command.js +15 -0
- package/build/music/commands/delete-all-music-jobs.command.js +13 -0
- package/build/music/commands/delete-music-job-by-uuid.command.js +14 -0
- package/build/music/commands/generate-lyrics.command.js +18 -0
- package/build/music/commands/generate-music.command.js +18 -0
- package/build/music/commands/index.js +24 -0
- package/build/music/commands/retry-music-job.command.js +16 -0
- package/build/music/commands/set-reaction-to-music-job.command.js +17 -0
- package/build/music/commands/update-music-job-title.command.js +16 -0
- package/build/music/enums/index.js +22 -0
- package/build/music/enums/music-action-type.enum.js +7 -0
- package/build/music/enums/music-pricing-rule-type.enum.js +7 -0
- package/build/music/enums/music-strategy.enum.js +7 -0
- package/build/music/enums/music-vocal-gender.enum.js +8 -0
- package/build/music/enums/suno-mode-type.enum.js +10 -0
- package/build/music/enums/suno-model-type.enum.js +10 -0
- package/build/music/index.js +22 -0
- package/build/music/models/index.js +20 -0
- package/build/music/models/music-config.schema.js +8 -0
- package/build/music/models/music-job.schema.js +54 -0
- package/build/music/models/music-model.schema.js +35 -0
- package/build/music/models/music-track.schema.js +17 -0
- package/build/music/queries/find-music-job-by-id.query.js +10 -0
- package/build/music/queries/find-music-jobs.query.js +28 -0
- package/build/music/queries/get-music-config.query.js +9 -0
- package/build/music/queries/index.js +19 -0
- package/build/music/routes/index.js +17 -0
- package/build/music/routes/music.amqp.routes.js +16 -0
- package/build/music/utils/calculate-music-generation-price.util.js +7 -0
- package/build/music/utils/index.js +17 -0
- package/build/presentation/commands/build-blank-slide.command.js +15 -0
- package/build/presentation/commands/generate-and-insert-slide.command.js +22 -0
- package/build/presentation/commands/index.js +7 -0
- package/build/presentation/commands/presentation-generate-report.command.js +18 -0
- package/build/presentation/commands/presentation-paraphrase.command.js +19 -0
- package/build/presentation/commands/update-presentation-slides.command.js +16 -0
- package/build/presentation/commands/update-slide-image-slot.command.js +34 -0
- package/build/presentation/commands/update-slide.command.js +17 -0
- package/build/presentation/enums/index.js +4 -0
- package/build/presentation/enums/presentation-ai-action-call-status.enum.js +9 -0
- package/build/presentation/enums/presentation-ai-action-pricing-type.enum.js +8 -0
- package/build/presentation/enums/presentation-ai-action-type.enum.js +8 -0
- package/build/presentation/enums/slide-image-slot-action.enum.js +8 -0
- package/build/presentation/index.js +1 -0
- package/build/presentation/models/index.js +1 -0
- package/build/presentation/models/presentation-ai-action.schema.js +27 -0
- package/build/presentation/models/presentation-config.schema.js +3 -0
- package/build/presentation/models/presentation.schema.js +4 -1
- package/build/presentation/models/slide-content-edit.schema.js +135 -0
- package/build/presentation/models/slide-content.schema.js +5 -1
- package/build/presentation/models/slide.schema.js +39 -1
- package/build/presentation/routes/presentation.routes.js +7 -0
- package/build/presentation/utils/calculate-presentation-ai-action-price.util.js +16 -0
- package/build/presentation/utils/index.js +17 -0
- package/build/tools/enums/tool-type.enum.js +4 -0
- package/build/video/enums/video-strategy.enum.js +2 -0
- package/build/video/routes/video.http.routes.js +1 -0
- package/build/video-editor/commands/delete-all-video-editor-jobs.command.js +13 -0
- package/build/video-editor/commands/delete-video-editor-job-by-uuid.command.js +14 -0
- package/build/video-editor/commands/edit-video.command.js +19 -0
- package/build/video-editor/commands/index.js +22 -0
- package/build/video-editor/commands/retry-video-editor-job.command.js +16 -0
- package/build/video-editor/commands/set-reaction-to-video-editor-job.command.js +17 -0
- package/build/video-editor/commands/update-video-editor-job-title.command.js +16 -0
- package/build/video-editor/enums/index.js +17 -0
- package/build/video-editor/enums/video-editor-model-strategy.enum.js +10 -0
- package/build/video-editor/index.js +22 -0
- package/build/video-editor/models/index.js +19 -0
- package/build/video-editor/models/video-editor-config.schema.js +11 -0
- package/build/video-editor/models/video-editor-job.schema.js +27 -0
- package/build/video-editor/models/video-editor-model.schema.js +24 -0
- package/build/video-editor/queries/find-video-editor-job-by-id.query.js +19 -0
- package/build/video-editor/queries/find-video-editor-jobs.query.js +28 -0
- package/build/video-editor/queries/get-video-editor-config.query.js +11 -0
- package/build/video-editor/queries/index.js +19 -0
- package/build/video-editor/routes/index.js +18 -0
- package/build/video-editor/routes/video-editor.amqp.routes.js +14 -0
- package/build/video-editor/routes/video-editor.http.routes.js +8 -0
- package/build/video-editor/utils/calculate-video-editing-price.js +10 -0
- package/build/video-editor/utils/index.js +17 -0
- package/build/writer/commands/generate-document-contents.command.js +1 -0
- package/build/writer/enums/index.js +1 -0
- package/build/writer/enums/writer-content-generation-strategy.enum.js +8 -0
- package/build/writer/index.js +1 -0
- package/build/writer/models/index.js +1 -0
- package/build/writer/models/writer-config.schema.js +2 -0
- package/build/writer/models/writer-document-type.schema.js +1 -0
- package/build/writer/models/writer-document.schema.js +1 -0
- package/build/writer/models/writer-model.schema.js +21 -0
- package/build/writer/utils/calculate-writer-content-generation-price.util.js +2 -2
- package/common/errors/errors.ts +408 -3
- package/index.ts +6 -0
- package/music/commands/convert-to-wav.command.ts +15 -0
- package/music/commands/delete-all-music-jobs.command.ts +13 -0
- package/music/commands/delete-music-job-by-uuid.command.ts +14 -0
- package/music/commands/generate-lyrics.command.ts +20 -0
- package/music/commands/generate-music.command.ts +18 -0
- package/music/commands/index.ts +8 -0
- package/music/commands/retry-music-job.command.ts +16 -0
- package/music/commands/set-reaction-to-music-job.command.ts +17 -0
- package/music/commands/update-music-job-title.command.ts +16 -0
- package/music/enums/index.ts +6 -0
- package/music/enums/music-action-type.enum.ts +3 -0
- package/music/enums/music-pricing-rule-type.enum.ts +3 -0
- package/music/enums/music-strategy.enum.ts +3 -0
- package/music/enums/music-vocal-gender.enum.ts +4 -0
- package/music/enums/suno-mode-type.enum.ts +6 -0
- package/music/enums/suno-model-type.enum.ts +6 -0
- package/music/index.ts +6 -0
- package/music/models/index.ts +4 -0
- package/music/models/music-config.schema.ts +8 -0
- package/music/models/music-job.schema.ts +57 -0
- package/music/models/music-model.schema.ts +40 -0
- package/music/models/music-track.schema.ts +19 -0
- package/music/queries/find-music-job-by-id.query.ts +11 -0
- package/music/queries/find-music-jobs.query.ts +33 -0
- package/music/queries/get-music-config.query.ts +8 -0
- package/music/queries/index.ts +3 -0
- package/music/routes/index.ts +1 -0
- package/music/routes/music.amqp.routes.ts +13 -0
- package/music/utils/calculate-music-generation-price.util.ts +5 -0
- package/music/utils/index.ts +1 -0
- package/package.json +1 -1
- package/presentation/commands/build-blank-slide.command.ts +15 -0
- package/presentation/commands/generate-and-insert-slide.command.ts +22 -0
- package/presentation/commands/index.ts +7 -0
- package/presentation/commands/presentation-generate-report.command.ts +20 -0
- package/presentation/commands/presentation-paraphrase.command.ts +21 -0
- package/presentation/commands/update-presentation-slides.command.ts +16 -0
- package/presentation/commands/update-slide-image-slot.command.ts +39 -0
- package/presentation/commands/update-slide.command.ts +17 -0
- package/presentation/enums/index.ts +4 -0
- package/presentation/enums/presentation-ai-action-call-status.enum.ts +5 -0
- package/presentation/enums/presentation-ai-action-pricing-type.enum.ts +4 -0
- package/presentation/enums/presentation-ai-action-type.enum.ts +4 -0
- package/presentation/enums/slide-image-slot-action.enum.ts +4 -0
- package/presentation/index.ts +1 -0
- package/presentation/models/index.ts +1 -0
- package/presentation/models/presentation-ai-action.schema.ts +30 -0
- package/presentation/models/presentation-config.schema.ts +3 -0
- package/presentation/models/presentation.schema.ts +4 -1
- package/presentation/models/slide-content-edit.schema.ts +160 -0
- package/presentation/models/slide-content.schema.ts +104 -11
- package/presentation/models/slide-image-slot.schema.ts +1 -0
- package/presentation/models/slide.schema.ts +47 -0
- package/presentation/routes/presentation.routes.ts +7 -0
- package/presentation/utils/calculate-presentation-ai-action-price.util.ts +20 -0
- package/presentation/utils/index.ts +1 -0
- package/tools/enums/tool-type.enum.ts +4 -0
- package/video/enums/video-strategy.enum.ts +2 -0
- package/video/routes/video.http.routes.ts +1 -0
- package/video-editor/commands/delete-all-video-editor-jobs.command.ts +13 -0
- package/video-editor/commands/delete-video-editor-job-by-uuid.command.ts +14 -0
- package/video-editor/commands/edit-video.command.ts +19 -0
- package/video-editor/commands/index.ts +6 -0
- package/video-editor/commands/retry-video-editor-job.command.ts +16 -0
- package/video-editor/commands/set-reaction-to-video-editor-job.command.ts +17 -0
- package/video-editor/commands/update-video-editor-job-title.command.ts +16 -0
- package/video-editor/enums/index.ts +1 -0
- package/video-editor/enums/video-editor-model-strategy.enum.ts +6 -0
- package/video-editor/index.ts +6 -0
- package/video-editor/models/index.ts +3 -0
- package/video-editor/models/video-editor-config.schema.ts +7 -0
- package/video-editor/models/video-editor-job.schema.ts +27 -0
- package/video-editor/models/video-editor-model.schema.ts +23 -0
- package/video-editor/queries/find-video-editor-job-by-id.query.ts +19 -0
- package/video-editor/queries/find-video-editor-jobs.query.ts +33 -0
- package/video-editor/queries/get-video-editor-config.query.ts +11 -0
- package/video-editor/queries/index.ts +3 -0
- package/video-editor/routes/index.ts +2 -0
- package/video-editor/routes/video-editor.amqp.routes.ts +11 -0
- package/video-editor/routes/video-editor.http.routes.ts +6 -0
- package/video-editor/utils/calculate-video-editing-price.ts +12 -0
- package/video-editor/utils/index.ts +1 -0
- package/writer/commands/generate-document-contents.command.ts +1 -0
- package/writer/enums/index.ts +1 -0
- package/writer/enums/writer-content-generation-strategy.enum.ts +4 -0
- package/writer/index.ts +1 -0
- package/writer/models/index.ts +1 -0
- package/writer/models/writer-config.schema.ts +2 -0
- package/writer/models/writer-document-type.schema.ts +1 -0
- package/writer/models/writer-document.schema.ts +1 -0
- package/writer/models/writer-model.schema.ts +21 -0
- package/writer/utils/calculate-writer-content-generation-price.util.ts +4 -2
package/music/index.ts
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { JOB_STATUS } from '../../tools';
|
|
3
|
+
import { USER_REACTION } from '../../common';
|
|
4
|
+
import { MUSIC_VOCAL_GENDER } from '../enums';
|
|
5
|
+
import { MusicTrackSchema } from './music-track.schema';
|
|
6
|
+
import { SUNO_MODE_TYPE } from '../enums/suno-mode-type.enum';
|
|
7
|
+
|
|
8
|
+
export const MusicJobParamsSchema = z.discriminatedUnion('mode', [
|
|
9
|
+
z.object({
|
|
10
|
+
mode: z.literal(SUNO_MODE_TYPE.SIMPLE),
|
|
11
|
+
prompt: z.string().min(1).max(450),
|
|
12
|
+
style: z.string(),
|
|
13
|
+
vocalGender: z.nativeEnum(MUSIC_VOCAL_GENDER),
|
|
14
|
+
}),
|
|
15
|
+
z.object({
|
|
16
|
+
mode: z.literal(SUNO_MODE_TYPE.SIMPLE_INSTRUMENTAL),
|
|
17
|
+
prompt: z.string().min(1).max(450),
|
|
18
|
+
style: z.string(),
|
|
19
|
+
}),
|
|
20
|
+
z.object({
|
|
21
|
+
mode: z.literal(SUNO_MODE_TYPE.CUSTOM),
|
|
22
|
+
prompt: z.string().min(1).max(5000),
|
|
23
|
+
title: z.string().min(1).max(80),
|
|
24
|
+
style: z.string().min(1).max(1000),
|
|
25
|
+
vocalGender: z.nativeEnum(MUSIC_VOCAL_GENDER),
|
|
26
|
+
}),
|
|
27
|
+
z.object({
|
|
28
|
+
mode: z.literal(SUNO_MODE_TYPE.CUSTOM_INSTRUMENTAL),
|
|
29
|
+
title: z.string().min(1).max(80),
|
|
30
|
+
style: z.string().min(1).max(1000),
|
|
31
|
+
}),
|
|
32
|
+
]);
|
|
33
|
+
|
|
34
|
+
export type MusicJobParams = z.infer<typeof MusicJobParamsSchema>;
|
|
35
|
+
|
|
36
|
+
export const MusicJobSchema = z.object({
|
|
37
|
+
uuid: z.string(),
|
|
38
|
+
prompt: z.string(),
|
|
39
|
+
reaction: z.nativeEnum(USER_REACTION).nullable(),
|
|
40
|
+
externalId: z.string().nullable(),
|
|
41
|
+
title: z.string(),
|
|
42
|
+
status: z.nativeEnum(JOB_STATUS),
|
|
43
|
+
error: z.string().nullable(),
|
|
44
|
+
modelId: z.string(),
|
|
45
|
+
price: z.number(),
|
|
46
|
+
params: MusicJobParamsSchema,
|
|
47
|
+
tracks: z.array(MusicTrackSchema),
|
|
48
|
+
attempts: z.array(z.any()),
|
|
49
|
+
userId: z.string().nullable().optional(),
|
|
50
|
+
unregisteredUserId: z.string().nullable().optional(),
|
|
51
|
+
isDeleted: z.boolean(),
|
|
52
|
+
createdAt: z.date(),
|
|
53
|
+
completedAt: z.date().nullable().optional(),
|
|
54
|
+
updatedAt: z.date(),
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
export type MusicJob = z.infer<typeof MusicJobSchema>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { TOOL_MODEL_STATUS, IconVariantsSchema } from '../../common';
|
|
3
|
+
import { MUSIC_GENERATION_STRATEGY, MUSIC_VOCAL_GENDER } from '../enums';
|
|
4
|
+
import { SUNO_MODEL_TYPE } from '../enums';
|
|
5
|
+
|
|
6
|
+
export const MusicModelParamsSchema = z.object({
|
|
7
|
+
vocalGender: z.object({
|
|
8
|
+
options: z.array(z.nativeEnum(MUSIC_VOCAL_GENDER)),
|
|
9
|
+
}),
|
|
10
|
+
styles: z.object({
|
|
11
|
+
maxStyles: z.number(),
|
|
12
|
+
options: z.array(
|
|
13
|
+
z.object({
|
|
14
|
+
title: z.string(),
|
|
15
|
+
style: z.string(),
|
|
16
|
+
}),
|
|
17
|
+
),
|
|
18
|
+
}),
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export type MusicModelParams = z.infer<typeof MusicModelParamsSchema>;
|
|
22
|
+
|
|
23
|
+
export const MusicModelSchema = z.object({
|
|
24
|
+
uuid: z.string(),
|
|
25
|
+
title: z.string(),
|
|
26
|
+
description: z.string(),
|
|
27
|
+
aiModel: z.nativeEnum(SUNO_MODEL_TYPE),
|
|
28
|
+
pricePerTrack: z.number(),
|
|
29
|
+
order: z.number(),
|
|
30
|
+
status: z.nativeEnum(TOOL_MODEL_STATUS),
|
|
31
|
+
icons: IconVariantsSchema,
|
|
32
|
+
strategy: z.nativeEnum(MUSIC_GENERATION_STRATEGY),
|
|
33
|
+
maxPromptLength: z.number(),
|
|
34
|
+
maxLyricsLength: z.number(),
|
|
35
|
+
params: MusicModelParamsSchema,
|
|
36
|
+
createdAt: z.date(),
|
|
37
|
+
updatedAt: z.date(),
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
export type MusicModel = z.infer<typeof MusicModelSchema>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export const MusicTrackSchema = z.object({
|
|
4
|
+
uuid: z.string(),
|
|
5
|
+
title: z.string(),
|
|
6
|
+
audioId: z.string(),
|
|
7
|
+
audioUrl: z.string(),
|
|
8
|
+
coverUrl: z.string(),
|
|
9
|
+
tags: z.string(),
|
|
10
|
+
duration: z.number(),
|
|
11
|
+
|
|
12
|
+
genJobId: z.string().nullable().optional(),
|
|
13
|
+
editorJobId: z.string().nullable().optional(),
|
|
14
|
+
|
|
15
|
+
createdAt: z.date(),
|
|
16
|
+
updatedAt: z.date(),
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export type MusicTrack = z.infer<typeof MusicTrackSchema>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ICommandResponseSchema } from '../../common/models/command-response.schema';
|
|
3
|
+
import { MusicJobSchema } from '../models/music-job.schema';
|
|
4
|
+
|
|
5
|
+
export namespace FindMusicJobByIdQuery {
|
|
6
|
+
export const RequestSchema = MusicJobSchema.pick({ uuid: true });
|
|
7
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
8
|
+
|
|
9
|
+
export const ResponseSchema = ICommandResponseSchema(MusicJobSchema);
|
|
10
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ICommandResponseSchema } from '../../common/models/command-response.schema';
|
|
3
|
+
import { MusicJobSchema } from '../models/music-job.schema';
|
|
4
|
+
|
|
5
|
+
export namespace FindMusicJobsQuery {
|
|
6
|
+
export const RequestSchema = z
|
|
7
|
+
.object({
|
|
8
|
+
userId: z.string().uuid().optional(),
|
|
9
|
+
unregisteredUserId: z.string().uuid().optional(),
|
|
10
|
+
title: z.string().optional(),
|
|
11
|
+
limit: z.coerce.number().min(1).optional(),
|
|
12
|
+
offset: z.coerce.number().min(0).default(0).optional(),
|
|
13
|
+
})
|
|
14
|
+
.refine(
|
|
15
|
+
(data) => {
|
|
16
|
+
return Boolean(data.userId) !== Boolean(data.unregisteredUserId);
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
message: 'At least userId or unregisteredUserId must be present',
|
|
20
|
+
path: ['userId', 'unregisteredUserId'],
|
|
21
|
+
},
|
|
22
|
+
);
|
|
23
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
24
|
+
|
|
25
|
+
export const ResponseSchema = ICommandResponseSchema(
|
|
26
|
+
z.object({
|
|
27
|
+
data: z.array(MusicJobSchema),
|
|
28
|
+
page: z.number(),
|
|
29
|
+
totalPages: z.number(),
|
|
30
|
+
}),
|
|
31
|
+
);
|
|
32
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
33
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ICommandResponseSchema } from '../../common/models/command-response.schema';
|
|
3
|
+
import { MusicConfigSchema } from '../models';
|
|
4
|
+
|
|
5
|
+
export namespace GetMusicConfigQuery {
|
|
6
|
+
export const ResponseSchema = ICommandResponseSchema(MusicConfigSchema);
|
|
7
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
8
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './music.amqp.routes';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export const MUSIC_AMQP_ROUTES = {
|
|
2
|
+
EXECUTE: 'tools.music.execute.rpc',
|
|
3
|
+
GENERATE_LYRICS: 'tools.music.generate-lyrics.rpc',
|
|
4
|
+
CONVERT_TO_WAV: 'tools.music.convert-to-wav.rpc',
|
|
5
|
+
CONFIG: 'tools.music.config.rpc',
|
|
6
|
+
GET_JOB: 'tools.music.jobs.get.rpc',
|
|
7
|
+
LIST_JOBS: 'tools.music.jobs.list.rpc',
|
|
8
|
+
SET_REACTION: 'tools.music.jobs.set-reaction.rpc',
|
|
9
|
+
UPDATE_TITLE: 'tools.music.jobs.update-title.rpc',
|
|
10
|
+
SOFT_DELETE: 'tools.music.jobs.soft-delete.rpc',
|
|
11
|
+
SOFT_DELETE_ALL: 'tools.music.jobs.soft-delete-all.rpc',
|
|
12
|
+
RETRY: 'tools.music.jobs.retry.rpc',
|
|
13
|
+
} as const;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './calculate-music-generation-price.util';
|
package/package.json
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ICommandResponseSchema } from '../../common';
|
|
2
|
+
import { SLIDE_CONTENT_TYPE, SLIDE_LAYOUT } from '../enums';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
import { SlideSchema } from '../models';
|
|
5
|
+
|
|
6
|
+
export namespace BuildBlankSlideCommand {
|
|
7
|
+
export const RequestSchema = z.object({
|
|
8
|
+
slideContentType: z.nativeEnum(SLIDE_CONTENT_TYPE),
|
|
9
|
+
layoutId: z.nativeEnum(SLIDE_LAYOUT).optional(),
|
|
10
|
+
});
|
|
11
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
12
|
+
|
|
13
|
+
export const ResponseSchema = ICommandResponseSchema(SlideSchema);
|
|
14
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ICommandResponseSchema } from '../../common';
|
|
3
|
+
import { SLIDE_CONTENT_TYPE, SLIDE_LAYOUT } from '../enums';
|
|
4
|
+
import { SlideSchema } from '../models';
|
|
5
|
+
|
|
6
|
+
export namespace GenerateAndInsertSlideCommand {
|
|
7
|
+
export const RequestSchema = z.object({
|
|
8
|
+
userId: z.string().uuid().nullable().optional(),
|
|
9
|
+
unregisteredUserId: z.string().uuid().nullable().optional(),
|
|
10
|
+
userBalance: z.number(),
|
|
11
|
+
presentationId: z.string().uuid(),
|
|
12
|
+
contentTypeId: z.nativeEnum(SLIDE_CONTENT_TYPE),
|
|
13
|
+
prompt: z.string().min(1).max(1000).optional(),
|
|
14
|
+
title: z.string().max(80),
|
|
15
|
+
position: z.number().int().min(0),
|
|
16
|
+
layoutId: z.nativeEnum(SLIDE_LAYOUT).optional(),
|
|
17
|
+
});
|
|
18
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
19
|
+
|
|
20
|
+
export const ResponseSchema = ICommandResponseSchema(SlideSchema.array());
|
|
21
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
22
|
+
}
|
|
@@ -1,11 +1,18 @@
|
|
|
1
|
+
export * from './build-blank-slide.command';
|
|
1
2
|
export * from './create-presentation.command';
|
|
2
3
|
export * from './delete-all-user-presentations.command';
|
|
3
4
|
export * from './delete-presentation.command';
|
|
4
5
|
export * from './delete-slide-outline.command';
|
|
5
6
|
export * from './generate-presentation-outline.command';
|
|
7
|
+
export * from './generate-and-insert-slide.command';
|
|
6
8
|
export * from './export-as-pptx.command';
|
|
7
9
|
export * from './generate-slides.command';
|
|
8
10
|
export * from './reposition-slide-outline.command';
|
|
9
11
|
export * from './update-slide-outline.command';
|
|
10
12
|
export * from './update-presentation.command';
|
|
11
13
|
export * from './update-presentation-outline.command';
|
|
14
|
+
export * from './update-presentation-slides.command';
|
|
15
|
+
export * from './update-slide-image-slot.command';
|
|
16
|
+
export * from './update-slide.command';
|
|
17
|
+
export * from './presentation-paraphrase.command';
|
|
18
|
+
export * from './presentation-generate-report.command';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ICommandResponseSchema } from '../../common';
|
|
3
|
+
|
|
4
|
+
export namespace PresentationGenerateReportCommand {
|
|
5
|
+
export const RequestSchema = z.object({
|
|
6
|
+
userId: z.string().uuid().nullable().optional(),
|
|
7
|
+
unregisteredUserId: z.string().uuid().nullable().optional(),
|
|
8
|
+
presentationId: z.string().uuid(),
|
|
9
|
+
userBalance: z.number(),
|
|
10
|
+
});
|
|
11
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
12
|
+
|
|
13
|
+
export const ResponseSchema = ICommandResponseSchema(
|
|
14
|
+
z.object({
|
|
15
|
+
output: z.string(),
|
|
16
|
+
docxUrl: z.string(),
|
|
17
|
+
}),
|
|
18
|
+
);
|
|
19
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ICommandResponseSchema } from '../../common';
|
|
3
|
+
|
|
4
|
+
export namespace PresentationParaphraseCommand {
|
|
5
|
+
export const RequestSchema = z.object({
|
|
6
|
+
userId: z.string().uuid().nullable().optional(),
|
|
7
|
+
unregisteredUserId: z.string().uuid().nullable().optional(),
|
|
8
|
+
presentationId: z.string().uuid(),
|
|
9
|
+
slideId: z.string().uuid(),
|
|
10
|
+
selectionText: z.string(),
|
|
11
|
+
userBalance: z.number(),
|
|
12
|
+
});
|
|
13
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
14
|
+
|
|
15
|
+
export const ResponseSchema = ICommandResponseSchema(
|
|
16
|
+
z.object({
|
|
17
|
+
output: z.string(),
|
|
18
|
+
}),
|
|
19
|
+
);
|
|
20
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { SlideSchema, SlideBulkUpdateSchema } from '../models';
|
|
3
|
+
import { ICommandResponseSchema } from '../../common';
|
|
4
|
+
|
|
5
|
+
export namespace UpdatePresentationSlidesCommand {
|
|
6
|
+
export const RequestSchema = z.object({
|
|
7
|
+
userId: z.string().uuid().nullable().optional(),
|
|
8
|
+
unregisteredUserId: z.string().uuid().nullable().optional(),
|
|
9
|
+
presentationId: z.string().uuid(),
|
|
10
|
+
data: SlideBulkUpdateSchema,
|
|
11
|
+
});
|
|
12
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
13
|
+
|
|
14
|
+
export const ResponseSchema = ICommandResponseSchema(z.array(SlideSchema));
|
|
15
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ICommandResponseSchema } from '../../common';
|
|
3
|
+
import { SlideImageSlotSchema } from '../models';
|
|
4
|
+
import { SLIDE_IMAGE_SLOT_ACTION } from '../enums';
|
|
5
|
+
|
|
6
|
+
export namespace UpdateSlideImageSlotCommand {
|
|
7
|
+
const ReplacePayload = z.object({
|
|
8
|
+
action: z.literal(SLIDE_IMAGE_SLOT_ACTION.REPLACE),
|
|
9
|
+
url: z.string().url(),
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
const GeneratePayload = z.object({
|
|
13
|
+
action: z.literal(SLIDE_IMAGE_SLOT_ACTION.GENERATE),
|
|
14
|
+
prompt: z.string().min(1).max(1000).optional(),
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const UpdateImageSlotPayload = z.discriminatedUnion('action', [
|
|
18
|
+
ReplacePayload,
|
|
19
|
+
GeneratePayload,
|
|
20
|
+
]);
|
|
21
|
+
|
|
22
|
+
export const RequestSchema = z.object({
|
|
23
|
+
userId: z.string().uuid().nullable().optional(),
|
|
24
|
+
unregisteredUserId: z.string().uuid().nullable().optional(),
|
|
25
|
+
presentationId: z.string().uuid(),
|
|
26
|
+
slideId: z.string().uuid(),
|
|
27
|
+
slotId: z.string().uuid().optional(),
|
|
28
|
+
payload: UpdateImageSlotPayload,
|
|
29
|
+
userBalance: z.number(),
|
|
30
|
+
});
|
|
31
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
32
|
+
|
|
33
|
+
export const ResponseSchema = ICommandResponseSchema(
|
|
34
|
+
z.object({
|
|
35
|
+
imageSlot: SlideImageSlotSchema,
|
|
36
|
+
}),
|
|
37
|
+
);
|
|
38
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
39
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { SlideSchema, SlideUpdateSchema } from '../models';
|
|
3
|
+
import { ICommandResponseSchema } from '../../common';
|
|
4
|
+
|
|
5
|
+
export namespace UpdateSlideCommand {
|
|
6
|
+
export const RequestSchema = z.object({
|
|
7
|
+
userId: z.string().uuid().nullable().optional(),
|
|
8
|
+
unregisteredUserId: z.string().uuid().nullable().optional(),
|
|
9
|
+
presentationId: z.string().uuid(),
|
|
10
|
+
slideId: z.string().uuid(),
|
|
11
|
+
data: SlideUpdateSchema,
|
|
12
|
+
});
|
|
13
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
14
|
+
|
|
15
|
+
export const ResponseSchema = ICommandResponseSchema(SlideSchema);
|
|
16
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
17
|
+
}
|
|
@@ -4,3 +4,7 @@ export * from './slide-image-job-status.enum';
|
|
|
4
4
|
export * from './slide-image-slot-status.enum';
|
|
5
5
|
export * from './slide-icon-slot-status.enum';
|
|
6
6
|
export * from './slide-layout.enum';
|
|
7
|
+
export * from './slide-image-slot-action.enum';
|
|
8
|
+
export * from './presentation-ai-action-call-status.enum';
|
|
9
|
+
export * from './presentation-ai-action-type.enum';
|
|
10
|
+
export * from './presentation-ai-action-pricing-type.enum';
|
package/presentation/index.ts
CHANGED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { PRESENTATION_AI_ACTION_PRICING_TYPE, PRESENTATION_AI_ACTION_TYPE } from '../enums';
|
|
3
|
+
|
|
4
|
+
export const PresentationAiActionPricingRulesSchema = z.discriminatedUnion('type', [
|
|
5
|
+
z.object({
|
|
6
|
+
type: z.literal(PRESENTATION_AI_ACTION_PRICING_TYPE.PER_CHARACTER),
|
|
7
|
+
price: z.number(),
|
|
8
|
+
}),
|
|
9
|
+
z.object({
|
|
10
|
+
type: z.literal(PRESENTATION_AI_ACTION_PRICING_TYPE.FLAT),
|
|
11
|
+
price: z.number(),
|
|
12
|
+
}),
|
|
13
|
+
]);
|
|
14
|
+
export type PresentationAiActionPricingRules = z.infer<
|
|
15
|
+
typeof PresentationAiActionPricingRulesSchema
|
|
16
|
+
>;
|
|
17
|
+
|
|
18
|
+
export const PresentationAiActionSchema = z.object({
|
|
19
|
+
uuid: z.string(),
|
|
20
|
+
type: z.nativeEnum(PRESENTATION_AI_ACTION_TYPE),
|
|
21
|
+
pricingRules: PresentationAiActionPricingRulesSchema,
|
|
22
|
+
maxPromptLength: z.number(),
|
|
23
|
+
aiModel: z.string(),
|
|
24
|
+
title: z.string(),
|
|
25
|
+
icon: z.string(),
|
|
26
|
+
order: z.number(),
|
|
27
|
+
createdAt: z.date(),
|
|
28
|
+
updatedAt: z.date(),
|
|
29
|
+
});
|
|
30
|
+
export type PresentationAiAction = z.infer<typeof PresentationAiActionSchema>;
|
|
@@ -2,16 +2,19 @@ import { z } from 'zod';
|
|
|
2
2
|
import { SlideContentTypeSchema } from './slide-content-type.schema';
|
|
3
3
|
import { LanguageSchema } from '../../language';
|
|
4
4
|
import { PresentationTemplateSchema } from './presentation-template.schema';
|
|
5
|
+
import { PresentationAiActionSchema } from './presentation-ai-action.schema';
|
|
5
6
|
|
|
6
7
|
export const PresentationConfigSchema = z.object({
|
|
7
8
|
slideContentTypes: z.array(SlideContentTypeSchema),
|
|
8
9
|
languages: z.array(LanguageSchema),
|
|
9
10
|
templates: z.array(PresentationTemplateSchema),
|
|
11
|
+
aiActions: z.array(PresentationAiActionSchema),
|
|
10
12
|
slideGenerationPrice: z.number(),
|
|
11
13
|
maxSlides: z.number(),
|
|
12
14
|
minSlides: z.number(),
|
|
13
15
|
maxSlideTitleLength: z.number(),
|
|
14
16
|
maxSlideOutlineLength: z.number(),
|
|
15
17
|
maxPromptLength: z.number(),
|
|
18
|
+
imageGenerationPrice: z.number(),
|
|
16
19
|
});
|
|
17
20
|
export type PresentationConfig = z.infer<typeof PresentationConfigSchema>;
|
|
@@ -16,6 +16,8 @@ export const PresentationSchema = z.object({
|
|
|
16
16
|
unregisteredUserId: z.string().uuid().nullable().optional(),
|
|
17
17
|
slideCount: z.number(),
|
|
18
18
|
isDeleted: z.boolean(),
|
|
19
|
+
lastContentUpdateAt: z.date().nullable(),
|
|
20
|
+
lastPptxExportedAt: z.date().nullable(),
|
|
19
21
|
createdAt: z.date(),
|
|
20
22
|
updatedAt: z.date(),
|
|
21
23
|
});
|
|
@@ -29,5 +31,6 @@ export type PresentationWithSlides = z.infer<typeof PresentationWithSlidesSchema
|
|
|
29
31
|
|
|
30
32
|
export const PresentationUpdateSchema = PresentationSchema.pick({
|
|
31
33
|
title: true,
|
|
32
|
-
|
|
34
|
+
templateId: true,
|
|
35
|
+
}).partial();
|
|
33
36
|
export type PresentationUpdate = z.infer<typeof PresentationUpdateSchema>;
|