@purpleschool/gptbot 0.7.12 → 0.7.14
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/api/controllers/http/index.ts +1 -0
- package/api/controllers/http/presentation.ts +26 -0
- package/build/api/controllers/http/index.js +1 -0
- package/build/api/controllers/http/presentation.js +25 -0
- package/build/commands/file/calculate-file-cost.command.js +1 -1
- package/build/commands/file/upload.command.js +1 -1
- package/build/commands/tools/index.js +1 -0
- package/build/commands/tools/presentation/create-presentation.command.js +17 -0
- package/build/commands/tools/presentation/delete-all-user-presentations.command.js +8 -0
- package/build/commands/tools/presentation/delete-presentation.command.js +11 -0
- package/build/commands/tools/presentation/delete-slide-outline.command.js +12 -0
- package/build/commands/tools/presentation/export-presentation-as-pptx.command.js +17 -0
- package/build/commands/tools/presentation/find-presentation-by-uuid.command.js +14 -0
- package/build/commands/tools/presentation/find-presentation-outline.command.js +14 -0
- package/build/commands/tools/presentation/find-presentations.command.js +18 -0
- package/build/commands/tools/presentation/generate-presentation-slides.command.js +14 -0
- package/build/commands/tools/presentation/get-presentation-config.command.js +11 -0
- package/build/commands/tools/presentation/index.js +31 -0
- package/build/commands/tools/presentation/reposition-slide-outline.command.js +15 -0
- package/build/commands/tools/presentation/update-presentation-outline.command.js +15 -0
- package/build/commands/tools/presentation/update-presentation.command.js +17 -0
- package/build/commands/tools/presentation/update-slide-outline.command.js +23 -0
- package/build/constants/errors/errors.js +65 -0
- package/build/constants/index.js +1 -0
- package/build/constants/presentation/enums/index.js +21 -0
- package/build/constants/presentation/enums/presentation-stage.enum.js +14 -0
- package/build/constants/presentation/enums/slide-content-type.enum.js +15 -0
- package/build/constants/presentation/enums/slide-icon-slot-status.enum.js +10 -0
- package/build/constants/presentation/enums/slide-image-slot.status.enum.js +10 -0
- package/build/constants/presentation/enums/slide-layout.enum.js +8 -0
- package/build/constants/presentation/index.js +18 -0
- package/build/constants/presentation/maps/index.js +17 -0
- package/build/constants/presentation/maps/slide-layout-map.constant.js +16 -0
- package/build/models/tools/index.js +1 -0
- package/build/models/tools/language/index.js +17 -0
- package/build/models/tools/language/language.schema.js +11 -0
- package/build/models/tools/presentation/index.js +23 -0
- package/build/models/tools/presentation/pptx-export-payload.schema.js +183 -0
- package/build/models/tools/presentation/presentation-config.schema.js +17 -0
- package/build/models/tools/presentation/presentation-template.schema.js +13 -0
- package/build/models/tools/presentation/presentation.schema.js +24 -0
- package/build/models/tools/presentation/slide-content-type.schema.js +14 -0
- package/build/models/tools/presentation/slide-content.schema.js +177 -0
- package/build/models/tools/presentation/slide-icon-slot.schema.js +15 -0
- package/build/models/tools/presentation/slide-image-slot.schema.js +16 -0
- package/build/models/tools/presentation/slide-outline.schema.js +50 -0
- package/build/models/tools/presentation/slide.schema.js +20 -0
- package/commands/file/calculate-file-cost.command.ts +1 -1
- package/commands/file/upload.command.ts +1 -1
- package/commands/tools/index.ts +1 -0
- package/commands/tools/presentation/create-presentation.command.ts +19 -0
- package/commands/tools/presentation/delete-all-user-presentations.command.ts +6 -0
- package/commands/tools/presentation/delete-presentation.command.ts +11 -0
- package/commands/tools/presentation/delete-slide-outline.command.ts +12 -0
- package/commands/tools/presentation/export-presentation-as-pptx.command.ts +20 -0
- package/commands/tools/presentation/find-presentation-by-uuid.command.ts +16 -0
- package/commands/tools/presentation/find-presentation-outline.command.ts +16 -0
- package/commands/tools/presentation/find-presentations.command.ts +18 -0
- package/commands/tools/presentation/generate-presentation-slides.command.ts +16 -0
- package/commands/tools/presentation/get-presentation-config.command.ts +10 -0
- package/commands/tools/presentation/index.ts +15 -0
- package/commands/tools/presentation/reposition-slide-outline.command.ts +17 -0
- package/commands/tools/presentation/update-presentation-outline.command.ts +21 -0
- package/commands/tools/presentation/update-presentation.command.ts +20 -0
- package/commands/tools/presentation/update-slide-outline.command.ts +26 -0
- package/constants/errors/errors.ts +66 -0
- package/constants/index.ts +1 -0
- package/constants/presentation/enums/index.ts +5 -0
- package/constants/presentation/enums/presentation-stage.enum.ts +13 -0
- package/constants/presentation/enums/slide-content-type.enum.ts +11 -0
- package/constants/presentation/enums/slide-icon-slot-status.enum.ts +6 -0
- package/constants/presentation/enums/slide-image-slot.status.enum.ts +6 -0
- package/constants/presentation/enums/slide-layout.enum.ts +4 -0
- package/constants/presentation/index.ts +2 -0
- package/constants/presentation/maps/index.ts +1 -0
- package/constants/presentation/maps/slide-layout-map.constant.ts +14 -0
- package/models/tools/index.ts +1 -0
- package/models/tools/language/index.ts +1 -0
- package/models/tools/language/language.schema.ts +9 -0
- package/models/tools/presentation/index.ts +7 -0
- package/models/tools/presentation/pptx-export-payload.schema.ts +212 -0
- package/models/tools/presentation/presentation-config.schema.ts +16 -0
- package/models/tools/presentation/presentation-template.schema.ts +11 -0
- package/models/tools/presentation/presentation.schema.ts +25 -0
- package/models/tools/presentation/slide-content-type.schema.ts +13 -0
- package/models/tools/presentation/slide-content.schema.ts +218 -0
- package/models/tools/presentation/slide-icon-slot.schema.ts +13 -0
- package/models/tools/presentation/slide-image-slot.schema.ts +14 -0
- package/models/tools/presentation/slide-outline.schema.ts +58 -0
- package/models/tools/presentation/slide.schema.ts +19 -0
- package/package.json +2 -1
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { PresentationWithSlidesSchema } from '../../../models/tools/presentation';
|
|
3
|
+
|
|
4
|
+
export namespace FindPresentationByUuidCommand {
|
|
5
|
+
export const RequestParamsSchema = z.object({
|
|
6
|
+
uuid: z.string().uuid(),
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export type RequestParams = z.infer<typeof RequestParamsSchema>;
|
|
10
|
+
|
|
11
|
+
export const ResponseSchema = z.object({
|
|
12
|
+
data: PresentationWithSlidesSchema,
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { SlideOutlineSchema } from '../../../models/tools/presentation';
|
|
3
|
+
|
|
4
|
+
export namespace FindPresentationOutlineCommand {
|
|
5
|
+
export const RequestParamsSchema = z.object({
|
|
6
|
+
uuid: z.string().uuid(),
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export type RequestParams = z.infer<typeof RequestParamsSchema>;
|
|
10
|
+
|
|
11
|
+
export const ResponseSchema = z.object({
|
|
12
|
+
data: z.array(SlideOutlineSchema),
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { PresentationSchema } from '../../../models/tools/presentation';
|
|
3
|
+
|
|
4
|
+
export namespace FindPresentationsCommand {
|
|
5
|
+
export const RequestQuerySchema = z.object({
|
|
6
|
+
limit: z.coerce.number().min(1).optional(),
|
|
7
|
+
offset: z.coerce.number().min(0).default(0).optional(),
|
|
8
|
+
title: z.string().optional(),
|
|
9
|
+
});
|
|
10
|
+
export type RequestQuery = z.infer<typeof RequestQuerySchema>;
|
|
11
|
+
|
|
12
|
+
export const ResponseSchema = z.object({
|
|
13
|
+
data: z.array(PresentationSchema),
|
|
14
|
+
totalPages: z.number(),
|
|
15
|
+
page: z.number(),
|
|
16
|
+
});
|
|
17
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { PresentationSchema } from '../../../models/tools/presentation';
|
|
3
|
+
|
|
4
|
+
export namespace GeneratePresentationSlidesCommand {
|
|
5
|
+
export const RequestParamsSchema = z.object({
|
|
6
|
+
uuid: z.string().uuid(),
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export type RequestParams = z.infer<typeof RequestParamsSchema>;
|
|
10
|
+
|
|
11
|
+
export const ResponseSchema = z.object({
|
|
12
|
+
data: PresentationSchema,
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { PresentationConfigSchema } from '../../../models/tools/presentation';
|
|
3
|
+
|
|
4
|
+
export namespace GetPresentationConfigCommand {
|
|
5
|
+
export const ResponseSchema = z.object({
|
|
6
|
+
data: PresentationConfigSchema,
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export * from './create-presentation.command';
|
|
2
|
+
export * from './delete-all-user-presentations.command';
|
|
3
|
+
export * from './delete-slide-outline.command';
|
|
4
|
+
export * from './delete-presentation.command';
|
|
5
|
+
export * from './export-presentation-as-pptx.command';
|
|
6
|
+
export * from './find-presentation-by-uuid.command';
|
|
7
|
+
export * from './find-presentation-outline.command';
|
|
8
|
+
export * from './find-presentations.command';
|
|
9
|
+
export * from './generate-presentation-slides.command';
|
|
10
|
+
export * from './get-presentation-config.command';
|
|
11
|
+
export * from './reposition-slide-outline.command';
|
|
12
|
+
export * from './update-slide-outline.command';
|
|
13
|
+
export * from './update-presentation-outline.command';
|
|
14
|
+
export * from './update-presentation.command';
|
|
15
|
+
export * from './update-slide-outline.command';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export namespace RepositionSlideOutlineCommand {
|
|
4
|
+
export const RequestParamsSchema = z.object({
|
|
5
|
+
presentationId: z.string().uuid(),
|
|
6
|
+
slideOutlineId: z.string().uuid(),
|
|
7
|
+
});
|
|
8
|
+
export type Params = z.infer<typeof RequestParamsSchema>;
|
|
9
|
+
|
|
10
|
+
export const RequestBodySchema = z.object({
|
|
11
|
+
newPosition: z.number().min(0),
|
|
12
|
+
});
|
|
13
|
+
export type Request = z.infer<typeof RequestBodySchema>;
|
|
14
|
+
|
|
15
|
+
export const ResponseSchema = z.void();
|
|
16
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import {
|
|
3
|
+
SlideOutlineBulkUpdateSchema,
|
|
4
|
+
SlideOutlineSchema,
|
|
5
|
+
} from '../../../models/tools/presentation';
|
|
6
|
+
|
|
7
|
+
export namespace UpdatePresentationOutlineCommand {
|
|
8
|
+
export const RequestParamsSchema = z.object({
|
|
9
|
+
uuid: z.string().uuid(),
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export const RequestBodySchema = SlideOutlineBulkUpdateSchema;
|
|
13
|
+
|
|
14
|
+
export type Request = z.infer<typeof RequestBodySchema>;
|
|
15
|
+
|
|
16
|
+
export const ResponseSchema = z.object({
|
|
17
|
+
data: SlideOutlineSchema.array(),
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { PresentationSchema } from '../../../models/tools/presentation';
|
|
3
|
+
|
|
4
|
+
export namespace UpdatePresentationCommand {
|
|
5
|
+
export const RequestParamsSchema = z.object({
|
|
6
|
+
uuid: z.string().uuid(),
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export const RequestBodySchema = z.object({
|
|
10
|
+
title: z.string(),
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export type Request = z.infer<typeof RequestBodySchema>;
|
|
14
|
+
|
|
15
|
+
export const ResponseSchema = z.object({
|
|
16
|
+
data: PresentationSchema,
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { SlideOutlineSchema } from '../../../models/tools/presentation';
|
|
3
|
+
import { SLIDE_CONTENT_TYPE } from '../../../constants';
|
|
4
|
+
|
|
5
|
+
export namespace UpdateSlideOutlineCommand {
|
|
6
|
+
export const RequestParamsSchema = z.object({
|
|
7
|
+
presentationId: z.string().uuid(),
|
|
8
|
+
slideOutlineId: z.string().uuid(),
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export const RequestBodySchema = z
|
|
12
|
+
.object({
|
|
13
|
+
title: z.string(),
|
|
14
|
+
body: z.string(),
|
|
15
|
+
contentTypeId: z.nativeEnum(SLIDE_CONTENT_TYPE),
|
|
16
|
+
})
|
|
17
|
+
.partial();
|
|
18
|
+
|
|
19
|
+
export type Request = z.infer<typeof RequestBodySchema>;
|
|
20
|
+
|
|
21
|
+
export const ResponseSchema = z.object({
|
|
22
|
+
data: SlideOutlineSchema,
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
26
|
+
}
|
|
@@ -1589,4 +1589,70 @@ export const ERRORS = {
|
|
|
1589
1589
|
message: 'Вложения изображений и текстовых файлов нельзя использовать вместе',
|
|
1590
1590
|
httpCode: 400,
|
|
1591
1591
|
},
|
|
1592
|
+
PRESENTATION_CONFIG_ERROR: {
|
|
1593
|
+
code: 'A338',
|
|
1594
|
+
message: 'Произошла ошибка при получении конфигурации презентации',
|
|
1595
|
+
httpCode: 500,
|
|
1596
|
+
},
|
|
1597
|
+
PRESENTATION_CREATE_ERROR: {
|
|
1598
|
+
code: 'A335',
|
|
1599
|
+
message: 'Произошла ошибка при создании презентации',
|
|
1600
|
+
httpCode: 500,
|
|
1601
|
+
},
|
|
1602
|
+
PRESENTATION_FIND_ERROR: {
|
|
1603
|
+
code: 'A336',
|
|
1604
|
+
message: 'Произошла ошибка при поиске презентации',
|
|
1605
|
+
httpCode: 500,
|
|
1606
|
+
},
|
|
1607
|
+
PRESENTATION_NOT_FOUND: {
|
|
1608
|
+
code: 'A337',
|
|
1609
|
+
message: 'Презентация не найдена',
|
|
1610
|
+
httpCode: 404,
|
|
1611
|
+
},
|
|
1612
|
+
PRESENTATION_SLIDES_GENERATE_ERROR: {
|
|
1613
|
+
code: 'A338',
|
|
1614
|
+
message: 'Произошла ошибка при генерации слайдов презентации',
|
|
1615
|
+
httpCode: 500,
|
|
1616
|
+
},
|
|
1617
|
+
PRESENTATION_UPDATE_SLIDE_OUTLINE_ERROR: {
|
|
1618
|
+
code: 'A339',
|
|
1619
|
+
message: 'Произошла ошибка при редактировании макета слайда',
|
|
1620
|
+
httpCode: 500,
|
|
1621
|
+
},
|
|
1622
|
+
PRESENTATION_REPOSITION_SLIDE_OUTLINE_ERROR: {
|
|
1623
|
+
code: 'A340',
|
|
1624
|
+
message: 'Произошла ошибка при перемещении макета слайда',
|
|
1625
|
+
httpCode: 500,
|
|
1626
|
+
},
|
|
1627
|
+
PRESENTATION_DELETE_SLIDE_OUTLINE_ERROR: {
|
|
1628
|
+
code: 'A341',
|
|
1629
|
+
message: 'Произошла ошибка при удалении макета слайда',
|
|
1630
|
+
httpCode: 500,
|
|
1631
|
+
},
|
|
1632
|
+
PRESENTATION_DELETE_PRESENTATION_ERROR: {
|
|
1633
|
+
code: 'A342',
|
|
1634
|
+
message: 'Произошла ошибка при удалении презентации',
|
|
1635
|
+
httpCode: 500,
|
|
1636
|
+
},
|
|
1637
|
+
PRESENTATION_UPDATE_PRESENTATION_OUTLINE_ERROR: {
|
|
1638
|
+
code: 'A343',
|
|
1639
|
+
message: 'Произошла ошибка при обновлении макета презентации',
|
|
1640
|
+
httpCode: 500,
|
|
1641
|
+
},
|
|
1642
|
+
PRESENTATION_EXPORT_AS_PPTX_ERROR: {
|
|
1643
|
+
code: 'A344',
|
|
1644
|
+
message: 'Произошла ошибка при экспорте презентации в PPTX',
|
|
1645
|
+
httpCode: 500,
|
|
1646
|
+
},
|
|
1647
|
+
PRESENTATION_DELETE_ALL_USER_PRESENTATIONS_ERROR: {
|
|
1648
|
+
code: 'A345',
|
|
1649
|
+
message: 'Произошла ошибка при удалении презентаций пользователя',
|
|
1650
|
+
httpCode: 500,
|
|
1651
|
+
},
|
|
1652
|
+
PRESENTATION_UPDATE_ERROR: {
|
|
1653
|
+
code: 'A346',
|
|
1654
|
+
message: 'Произошла ошибка при обновлении презентации',
|
|
1655
|
+
httpCode: 500,
|
|
1656
|
+
},
|
|
1592
1657
|
};
|
|
1658
|
+
|
package/constants/index.ts
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export enum PRESENTATION_STAGE {
|
|
2
|
+
CREATED = 'CREATED',
|
|
3
|
+
|
|
4
|
+
GENERATING_OUTLINE = 'GENERATING_OUTLINE',
|
|
5
|
+
OUTLINE_GENERATED = 'OUTLINE_GENERATED',
|
|
6
|
+
OUTLINE_GENERATION_FAILED = 'OUTLINE_GENERATION_FAILED',
|
|
7
|
+
|
|
8
|
+
GENERATING_SLIDES = 'GENERATING_SLIDES',
|
|
9
|
+
SLIDES_GENERATED = 'SLIDES_GENERATED',
|
|
10
|
+
SLIDES_GENERATION_FAILED = 'SLIDES_GENERATION_FAILED',
|
|
11
|
+
|
|
12
|
+
DELETED = 'DELETED',
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './slide-layout-map.constant';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { SLIDE_CONTENT_TYPE } from '../enums';
|
|
2
|
+
import { SLIDE_LAYOUT } from '../enums/slide-layout.enum';
|
|
3
|
+
|
|
4
|
+
export const SLIDE_LAYOUT_MAP = new Map<SLIDE_CONTENT_TYPE, SLIDE_LAYOUT[]>([
|
|
5
|
+
[SLIDE_CONTENT_TYPE.COVER, [SLIDE_LAYOUT.TYPE_1]],
|
|
6
|
+
[SLIDE_CONTENT_TYPE.STRUCTURED_LIST, [SLIDE_LAYOUT.TYPE_1, SLIDE_LAYOUT.TYPE_2]],
|
|
7
|
+
[SLIDE_CONTENT_TYPE.TEXT, [SLIDE_LAYOUT.TYPE_1, SLIDE_LAYOUT.TYPE_2]],
|
|
8
|
+
[SLIDE_CONTENT_TYPE.SECTION_BREAK, [SLIDE_LAYOUT.TYPE_1]],
|
|
9
|
+
[SLIDE_CONTENT_TYPE.CONTENTS, [SLIDE_LAYOUT.TYPE_1]],
|
|
10
|
+
[SLIDE_CONTENT_TYPE.IMAGE, [SLIDE_LAYOUT.TYPE_1]],
|
|
11
|
+
[SLIDE_CONTENT_TYPE.THANK_YOU, [SLIDE_LAYOUT.TYPE_1]],
|
|
12
|
+
[SLIDE_CONTENT_TYPE.TABLE, [SLIDE_LAYOUT.TYPE_1]],
|
|
13
|
+
[SLIDE_CONTENT_TYPE.CHART, [SLIDE_LAYOUT.TYPE_1]],
|
|
14
|
+
]);
|
package/models/tools/index.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './language.schema';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from './pptx-export-payload.schema';
|
|
2
|
+
export * from './presentation.schema';
|
|
3
|
+
export * from './slide-content-type.schema';
|
|
4
|
+
export * from './slide-outline.schema';
|
|
5
|
+
export * from './slide.schema';
|
|
6
|
+
export * from './slide-content.schema';
|
|
7
|
+
export * from './presentation-config.schema';
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export enum PPTX_SHAPE_TYPE {
|
|
4
|
+
TEXT_BOX = 'text_box',
|
|
5
|
+
PICTURE_BOX = 'picture_box',
|
|
6
|
+
CUSTOM_SHAPE = 'custom_shape',
|
|
7
|
+
TABLE = 'table',
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export enum PPTX_H_ALIGN {
|
|
11
|
+
LEFT = 'left',
|
|
12
|
+
CENTER = 'center',
|
|
13
|
+
RIGHT = 'right',
|
|
14
|
+
JUSTIFY = 'justify',
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export enum PPTX_V_ALIGN {
|
|
18
|
+
TOP = 'top',
|
|
19
|
+
MIDDLE = 'middle',
|
|
20
|
+
BOTTOM = 'bottom',
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export enum PPTX_OBJECT_FIT {
|
|
24
|
+
COVER = 'cover',
|
|
25
|
+
CONTAIN = 'contain',
|
|
26
|
+
CROP = 'crop',
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export enum PPTX_BORDER_TYPE {
|
|
30
|
+
SOLID = 'solid',
|
|
31
|
+
NONE = 'none',
|
|
32
|
+
DASH = 'dash',
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export enum PPTX_FILL_TYPE {
|
|
36
|
+
SOLID = 'solid',
|
|
37
|
+
NONE = 'none',
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export enum PPTX_SHADOW_TYPE {
|
|
41
|
+
OUTER = 'outer',
|
|
42
|
+
INNER = 'inner',
|
|
43
|
+
NONE = 'none',
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export enum PPTX_CUSTOM_SHAPE_TYPE {
|
|
47
|
+
ROUND_RECT = 'roundRect',
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export const PPTXShadowSchema = z.object({
|
|
51
|
+
type: z.nativeEnum(PPTX_SHADOW_TYPE),
|
|
52
|
+
opacity: z.number().min(0).max(100).optional().describe('percents, range 0-100'),
|
|
53
|
+
color: z.string().optional().describe('hex color'),
|
|
54
|
+
blur: z.number().min(0).max(100).optional().describe('degrees, range 0-100'),
|
|
55
|
+
angle: z.number().min(0).max(359).optional().describe('degrees, range 0-359'),
|
|
56
|
+
offset: z.number().min(0).max(200).optional().describe('points, range 0-200'),
|
|
57
|
+
rotateWithShape: z.boolean().optional().describe('whether or not to rotate shadow with shape'),
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
export const PPTXFillSchema = z.object({
|
|
61
|
+
color: z.string(),
|
|
62
|
+
type: z.nativeEnum(PPTX_FILL_TYPE),
|
|
63
|
+
transparency: z.number().min(0).max(100).optional().describe('percents, range 0-100'),
|
|
64
|
+
alpha: z.number().min(0).max(1).optional().describe('range 0-1'),
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
export const PPTXMarginSchema = z.union([
|
|
68
|
+
z.number(),
|
|
69
|
+
z.tuple([z.number(), z.number(), z.number(), z.number()]),
|
|
70
|
+
]);
|
|
71
|
+
export type PPTXMargin = z.infer<typeof PPTXMarginSchema>;
|
|
72
|
+
|
|
73
|
+
// Common
|
|
74
|
+
export const PPTXPositionSchema = z.object({
|
|
75
|
+
height: z.number(),
|
|
76
|
+
width: z.number(),
|
|
77
|
+
top: z.number(),
|
|
78
|
+
left: z.number(),
|
|
79
|
+
});
|
|
80
|
+
export type PPTXPosition = z.infer<typeof PPTXPositionSchema>;
|
|
81
|
+
|
|
82
|
+
export const PPTXFontSchema = z.object({
|
|
83
|
+
bold: z.boolean().optional(),
|
|
84
|
+
color: z.string(),
|
|
85
|
+
name: z.string(),
|
|
86
|
+
size: z.number(),
|
|
87
|
+
lineHeight: z
|
|
88
|
+
.union([
|
|
89
|
+
z.object({
|
|
90
|
+
percent: z.number(),
|
|
91
|
+
}),
|
|
92
|
+
z.object({
|
|
93
|
+
px: z.number(),
|
|
94
|
+
}),
|
|
95
|
+
])
|
|
96
|
+
.optional(),
|
|
97
|
+
});
|
|
98
|
+
export type PPTXFont = z.infer<typeof PPTXFontSchema>;
|
|
99
|
+
|
|
100
|
+
// Textual
|
|
101
|
+
export const PPTXParagraphSchema = z.object({
|
|
102
|
+
alignment: z.nativeEnum(PPTX_H_ALIGN),
|
|
103
|
+
font: PPTXFontSchema,
|
|
104
|
+
valign: z.nativeEnum(PPTX_V_ALIGN).optional(),
|
|
105
|
+
margin: PPTXMarginSchema.optional(),
|
|
106
|
+
rotate: z.number().optional(),
|
|
107
|
+
text: z.string(),
|
|
108
|
+
});
|
|
109
|
+
export type PPTXParagraph = z.infer<typeof PPTXParagraphSchema>;
|
|
110
|
+
|
|
111
|
+
export const PPTXTextBoxSchema = z.object({
|
|
112
|
+
type: z.literal(PPTX_SHAPE_TYPE.TEXT_BOX),
|
|
113
|
+
position: PPTXPositionSchema,
|
|
114
|
+
|
|
115
|
+
paragraphs: z.array(PPTXParagraphSchema),
|
|
116
|
+
});
|
|
117
|
+
export type PPTXTextBox = z.infer<typeof PPTXTextBoxSchema>;
|
|
118
|
+
|
|
119
|
+
// Picture
|
|
120
|
+
export const PPTXPictureBoxSchema = z.object({
|
|
121
|
+
type: z.literal(PPTX_SHAPE_TYPE.PICTURE_BOX),
|
|
122
|
+
position: PPTXPositionSchema,
|
|
123
|
+
borderRadius: z.array(z.number()).optional(),
|
|
124
|
+
objectFit: z.nativeEnum(PPTX_OBJECT_FIT),
|
|
125
|
+
data: z.union([
|
|
126
|
+
z.object({
|
|
127
|
+
base64: z
|
|
128
|
+
.string()
|
|
129
|
+
.describe('Base64 encoded image in "image/{mimeType};base64,{bas64}" format'),
|
|
130
|
+
}),
|
|
131
|
+
z.object({
|
|
132
|
+
path: z.string().describe('URL to image'),
|
|
133
|
+
}),
|
|
134
|
+
]),
|
|
135
|
+
});
|
|
136
|
+
export type PPTXPictureBox = z.infer<typeof PPTXPictureBoxSchema>;
|
|
137
|
+
|
|
138
|
+
// CustomShape
|
|
139
|
+
export const PPTXCustomShapeSchema = z.object({
|
|
140
|
+
type: z.literal(PPTX_SHAPE_TYPE.CUSTOM_SHAPE),
|
|
141
|
+
customShapeType: z.nativeEnum(PPTX_CUSTOM_SHAPE_TYPE).optional(),
|
|
142
|
+
position: PPTXPositionSchema,
|
|
143
|
+
borderRadius: z.number(),
|
|
144
|
+
fill: PPTXFillSchema.optional(),
|
|
145
|
+
shadow: PPTXShadowSchema.optional(),
|
|
146
|
+
});
|
|
147
|
+
export type PPTXCustomShape = z.infer<typeof PPTXCustomShapeSchema>;
|
|
148
|
+
|
|
149
|
+
// Table
|
|
150
|
+
export const PPTXTableCellSchema = z.object({
|
|
151
|
+
text: z.string().optional(),
|
|
152
|
+
font: PPTXFontSchema.optional(),
|
|
153
|
+
fill: z
|
|
154
|
+
.object({
|
|
155
|
+
color: z.string(),
|
|
156
|
+
type: z.nativeEnum(PPTX_FILL_TYPE),
|
|
157
|
+
transparency: z.number().min(0).max(100).optional().describe('percents, range 0-100'),
|
|
158
|
+
})
|
|
159
|
+
.optional(),
|
|
160
|
+
align: z.nativeEnum(PPTX_H_ALIGN).optional(),
|
|
161
|
+
valign: z.nativeEnum(PPTX_V_ALIGN).optional(),
|
|
162
|
+
colspan: z.number().int().optional(),
|
|
163
|
+
rowspan: z.number().int().optional(),
|
|
164
|
+
margin: PPTXMarginSchema.optional(),
|
|
165
|
+
});
|
|
166
|
+
export type PPTXTableCell = z.infer<typeof PPTXTableCellSchema>;
|
|
167
|
+
|
|
168
|
+
export const PPTXTableRowSchema = z.array(PPTXTableCellSchema);
|
|
169
|
+
export type PPTXTableRow = z.infer<typeof PPTXTableRowSchema>;
|
|
170
|
+
|
|
171
|
+
export const PPTXTableShapeSchema = z.object({
|
|
172
|
+
type: z.literal(PPTX_SHAPE_TYPE.TABLE),
|
|
173
|
+
position: PPTXPositionSchema,
|
|
174
|
+
rows: z.array(PPTXTableRowSchema),
|
|
175
|
+
columnWidths: z.array(z.number()).optional(),
|
|
176
|
+
headerRows: z.number().int().min(0).optional(),
|
|
177
|
+
border: z.object({
|
|
178
|
+
type: z.nativeEnum(PPTX_BORDER_TYPE),
|
|
179
|
+
color: z.string(),
|
|
180
|
+
px: z.number(),
|
|
181
|
+
}),
|
|
182
|
+
});
|
|
183
|
+
export type PPTXTableShape = z.infer<typeof PPTXTableShapeSchema>;
|
|
184
|
+
|
|
185
|
+
// Overview
|
|
186
|
+
|
|
187
|
+
export const PPTXShapeSchema = z.discriminatedUnion('type', [
|
|
188
|
+
PPTXTextBoxSchema,
|
|
189
|
+
PPTXPictureBoxSchema,
|
|
190
|
+
PPTXCustomShapeSchema,
|
|
191
|
+
PPTXTableShapeSchema,
|
|
192
|
+
]);
|
|
193
|
+
export type PPTXShape = z.infer<typeof PPTXShapeSchema>;
|
|
194
|
+
|
|
195
|
+
export const SlideBackground = z.union([
|
|
196
|
+
PPTXFillSchema,
|
|
197
|
+
z.object({
|
|
198
|
+
path: z.string(),
|
|
199
|
+
}),
|
|
200
|
+
]);
|
|
201
|
+
export type SlideBackground = z.infer<typeof SlideBackground>;
|
|
202
|
+
|
|
203
|
+
export const PPTXSlideSchema = z.object({
|
|
204
|
+
background: SlideBackground.optional(),
|
|
205
|
+
shapes: z.array(PPTXShapeSchema),
|
|
206
|
+
});
|
|
207
|
+
export type PPTXSlide = z.infer<typeof PPTXSlideSchema>;
|
|
208
|
+
|
|
209
|
+
export const PPTXExportPayloadSchema = z.object({
|
|
210
|
+
slides: z.array(PPTXSlideSchema),
|
|
211
|
+
});
|
|
212
|
+
export type PPTXExportPayload = z.infer<typeof PPTXExportPayloadSchema>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { SlideContentTypeSchema } from './slide-content-type.schema';
|
|
3
|
+
import { LanguageSchema } from '../language';
|
|
4
|
+
import { PresentationTemplateSchema } from './presentation-template.schema';
|
|
5
|
+
|
|
6
|
+
export const PresentationConfigSchema = z.object({
|
|
7
|
+
slideContentTypes: z.array(SlideContentTypeSchema),
|
|
8
|
+
languages: z.array(LanguageSchema),
|
|
9
|
+
templates: z.array(PresentationTemplateSchema),
|
|
10
|
+
slideGenerationPrice: z.number(),
|
|
11
|
+
maxSlides: z.number(),
|
|
12
|
+
minSlides: z.number(),
|
|
13
|
+
maxSlideOutlineLength: z.number(),
|
|
14
|
+
maxPromptLength: z.number(),
|
|
15
|
+
});
|
|
16
|
+
export type PresentationConfig = z.infer<typeof PresentationConfigSchema>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { PRESENTATION_STAGE } from '../../../constants';
|
|
3
|
+
import { SlideOutlineSchema } from './slide-outline.schema';
|
|
4
|
+
import { SlideSchema } from './slide.schema';
|
|
5
|
+
|
|
6
|
+
export const PresentationSchema = z.object({
|
|
7
|
+
uuid: z.string().uuid(),
|
|
8
|
+
prompt: z.string(),
|
|
9
|
+
stage: z.nativeEnum(PRESENTATION_STAGE),
|
|
10
|
+
title: z.string(),
|
|
11
|
+
thumbnail: z.string(),
|
|
12
|
+
languageId: z.string(),
|
|
13
|
+
templateId: z.string(),
|
|
14
|
+
downloadUrl: z.string().nullable(),
|
|
15
|
+
slideCount: z.number(),
|
|
16
|
+
createdAt: z.date(),
|
|
17
|
+
updatedAt: z.date(),
|
|
18
|
+
});
|
|
19
|
+
export type Presentation = z.infer<typeof PresentationSchema>;
|
|
20
|
+
|
|
21
|
+
export const PresentationWithSlidesSchema = PresentationSchema.extend({
|
|
22
|
+
outline: z.array(SlideOutlineSchema),
|
|
23
|
+
slides: z.array(SlideSchema),
|
|
24
|
+
});
|
|
25
|
+
export type PresentationWithSlides = z.infer<typeof PresentationWithSlidesSchema>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { SLIDE_CONTENT_TYPE, SLIDE_LAYOUT } from '../../../constants';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
export const SlideContentTypeSchema = z.object({
|
|
5
|
+
id: z.nativeEnum(SLIDE_CONTENT_TYPE),
|
|
6
|
+
title: z.string(),
|
|
7
|
+
layouts: z.array(z.nativeEnum(SLIDE_LAYOUT)),
|
|
8
|
+
order: z.number(),
|
|
9
|
+
icon: z.string(),
|
|
10
|
+
createdAt: z.date(),
|
|
11
|
+
updatedAt: z.date(),
|
|
12
|
+
});
|
|
13
|
+
export type SlideContentType = z.infer<typeof SlideContentTypeSchema>;
|