@purpleschool/student-works 1.2.2 → 1.4.0
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/controller/http/index.ts +1 -0
- package/api/controller/http/presentation.ts +39 -0
- package/api/routes.ts +94 -0
- package/build/api/controller/http/index.js +1 -0
- package/build/api/controller/http/presentation.js +34 -0
- package/build/api/routes.js +54 -0
- package/build/commands/index.js +1 -0
- package/build/commands/presentation/build-blank-slide.command.js +16 -0
- package/build/commands/presentation/create-presentation.command.js +19 -0
- package/build/commands/presentation/delete-all-user-presentations.command.js +9 -0
- package/build/commands/presentation/delete-presentation.command.js +11 -0
- package/build/commands/presentation/delete-slide-outline.command.js +12 -0
- package/build/commands/presentation/export-presentation-as-pptx.command.js +17 -0
- package/build/commands/presentation/find-presentation-by-uuid.command.js +14 -0
- package/build/commands/presentation/find-presentation-outline.command.js +14 -0
- package/build/commands/presentation/find-presentations.command.js +18 -0
- package/build/commands/presentation/generate-and-insert-slide.command.js +22 -0
- package/build/commands/presentation/generate-presentation-slides.command.js +17 -0
- package/build/commands/presentation/get-presentation-config.command.js +11 -0
- package/build/commands/presentation/index.js +40 -0
- package/build/commands/presentation/presentation-generate-report.command.js +17 -0
- package/build/commands/presentation/presentation-paraphrase.command.js +20 -0
- package/build/commands/presentation/reposition-slide-outline.command.js +15 -0
- package/build/commands/presentation/reposition-slide.command.js +15 -0
- package/build/commands/presentation/set-reaction-to-presentation.command.js +28 -0
- package/build/commands/presentation/update-presentation-outline.command.js +15 -0
- package/build/commands/presentation/update-presentation-slides.command.js +25 -0
- package/build/commands/presentation/update-presentation.command.js +15 -0
- package/build/commands/presentation/update-slide-image-slot.command.js +34 -0
- package/build/commands/presentation/update-slide-outline.command.js +23 -0
- package/build/commands/presentation/update-slide.command.js +19 -0
- package/build/constants/errors/errors.js +261 -0
- package/build/constants/index.js +1 -0
- package/build/constants/presentation/enums/index.js +27 -0
- package/build/constants/presentation/enums/presentation-ai-action-call-status.enum.js +9 -0
- package/build/constants/presentation/enums/presentation-ai-action-pricing-type.enum.js +8 -0
- package/build/constants/presentation/enums/presentation-ai-action-type.enum.js +8 -0
- package/build/constants/presentation/enums/presentation-stage.enum.js +14 -0
- package/build/constants/presentation/enums/presentation-target-audience.enum.js +10 -0
- package/build/constants/presentation/enums/slide-content-type.enum.js +16 -0
- package/build/constants/presentation/enums/slide-icon-slot-status.enum.js +10 -0
- package/build/constants/presentation/enums/slide-image-slot-action.enum.js +8 -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 +17 -0
- package/build/helpers/index.js +1 -0
- package/build/helpers/presentation/calculate-presentation-ai-action-price.util.js +16 -0
- package/build/helpers/presentation/index.js +17 -0
- package/build/models/index.js +1 -0
- package/build/models/language.schema.js +11 -0
- package/build/models/presentation/index.js +25 -0
- package/build/models/presentation/pptx-export-payload.schema.js +216 -0
- package/build/models/presentation/presentation-ai-action.schema.js +27 -0
- package/build/models/presentation/presentation-config.schema.js +21 -0
- package/build/models/presentation/presentation-template.schema.js +13 -0
- package/build/models/presentation/presentation-title-page.schema.js +9 -0
- package/build/models/presentation/presentation.schema.js +35 -0
- package/build/models/presentation/slide-content-edit.schema.js +146 -0
- package/build/models/presentation/slide-content-type.schema.js +14 -0
- package/build/models/presentation/slide-content.schema.js +368 -0
- package/build/models/presentation/slide-icon-slot.schema.js +15 -0
- package/build/models/presentation/slide-image-slot.schema.js +16 -0
- package/build/models/presentation/slide-outline.schema.js +50 -0
- package/build/models/presentation/slide.schema.js +58 -0
- package/commands/index.ts +1 -0
- package/commands/presentation/build-blank-slide.command.ts +18 -0
- package/commands/presentation/create-presentation.command.ts +21 -0
- package/commands/presentation/delete-all-user-presentations.command.ts +9 -0
- package/commands/presentation/delete-presentation.command.ts +13 -0
- package/commands/presentation/delete-slide-outline.command.ts +12 -0
- package/commands/presentation/export-presentation-as-pptx.command.ts +20 -0
- package/commands/presentation/find-presentation-by-uuid.command.ts +16 -0
- package/commands/presentation/find-presentation-outline.command.ts +16 -0
- package/commands/presentation/find-presentations.command.ts +18 -0
- package/commands/presentation/generate-and-insert-slide.command.ts +27 -0
- package/commands/presentation/generate-presentation-slides.command.ts +21 -0
- package/commands/presentation/get-presentation-config.command.ts +10 -0
- package/commands/presentation/index.ts +24 -0
- package/commands/presentation/presentation-generate-report.command.ts +21 -0
- package/commands/presentation/presentation-paraphrase.command.ts +26 -0
- package/commands/presentation/reposition-slide-outline.command.ts +17 -0
- package/commands/presentation/reposition-slide.command.ts +17 -0
- package/commands/presentation/set-reaction-to-presentation.command.ts +33 -0
- package/commands/presentation/update-presentation-outline.command.ts +18 -0
- package/commands/presentation/update-presentation-slides.command.ts +32 -0
- package/commands/presentation/update-presentation.command.ts +18 -0
- package/commands/presentation/update-slide-image-slot.command.ts +40 -0
- package/commands/presentation/update-slide-outline.command.ts +26 -0
- package/commands/presentation/update-slide.command.ts +25 -0
- package/constants/errors/errors.ts +261 -0
- package/constants/index.ts +1 -0
- package/constants/presentation/enums/index.ts +11 -0
- package/constants/presentation/enums/presentation-ai-action-call-status.enum.ts +5 -0
- package/constants/presentation/enums/presentation-ai-action-pricing-type.enum.ts +4 -0
- package/constants/presentation/enums/presentation-ai-action-type.enum.ts +4 -0
- package/constants/presentation/enums/presentation-stage.enum.ts +13 -0
- package/constants/presentation/enums/presentation-target-audience.enum.ts +6 -0
- package/constants/presentation/enums/slide-content-type.enum.ts +12 -0
- package/constants/presentation/enums/slide-icon-slot-status.enum.ts +6 -0
- package/constants/presentation/enums/slide-image-slot-action.enum.ts +4 -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 +15 -0
- package/helpers/index.ts +1 -0
- package/helpers/presentation/calculate-presentation-ai-action-price.util.ts +20 -0
- package/helpers/presentation/index.ts +1 -0
- package/models/index.ts +1 -0
- package/models/language.schema.ts +9 -0
- package/models/presentation/index.ts +9 -0
- package/models/presentation/pptx-export-payload.schema.ts +246 -0
- package/models/presentation/presentation-ai-action.schema.ts +30 -0
- package/models/presentation/presentation-config.schema.ts +20 -0
- package/models/presentation/presentation-template.schema.ts +11 -0
- package/models/presentation/presentation-title-page.schema.ts +9 -0
- package/models/presentation/presentation.schema.ts +38 -0
- package/models/presentation/slide-content-edit.schema.ts +175 -0
- package/models/presentation/slide-content-type.schema.ts +13 -0
- package/models/presentation/slide-content.schema.ts +581 -0
- package/models/presentation/slide-icon-slot.schema.ts +13 -0
- package/models/presentation/slide-image-slot.schema.ts +14 -0
- package/models/presentation/slide-outline.schema.ts +58 -0
- package/models/presentation/slide.schema.ts +66 -0
- package/package.json +2 -2
|
@@ -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,12 @@
|
|
|
1
|
+
export enum SLIDE_CONTENT_TYPE {
|
|
2
|
+
COVER = 'COVER',
|
|
3
|
+
TEXT = 'TEXT',
|
|
4
|
+
TEXT_WITH_IMAGE = 'TEXT_WITH_IMAGE',
|
|
5
|
+
SECTION_BREAK = 'SECTION_BREAK',
|
|
6
|
+
STRUCTURED_LIST = 'STRUCTURED_LIST',
|
|
7
|
+
CONTENTS = 'CONTENTS',
|
|
8
|
+
THANK_YOU = 'THANK_YOU',
|
|
9
|
+
TABLE = 'TABLE',
|
|
10
|
+
CHART = 'CHART',
|
|
11
|
+
TIMELINE = 'TIMELINE',
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './slide-layout-map.constant';
|
|
@@ -0,0 +1,15 @@
|
|
|
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.TEXT_WITH_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
|
+
[SLIDE_CONTENT_TYPE.TIMELINE, [SLIDE_LAYOUT.TYPE_1]],
|
|
15
|
+
]);
|
package/helpers/index.ts
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { PRESENTATION_AI_ACTION_PRICING_TYPE } from '../../constants';
|
|
2
|
+
import { PresentationAiActionPricingRules } from '../../models';
|
|
3
|
+
|
|
4
|
+
export function calculatePresentationAiActionPrice(
|
|
5
|
+
pricingRules: PresentationAiActionPricingRules,
|
|
6
|
+
selectionText: string,
|
|
7
|
+
): number {
|
|
8
|
+
switch (pricingRules.type) {
|
|
9
|
+
case PRESENTATION_AI_ACTION_PRICING_TYPE.PER_CHARACTER:
|
|
10
|
+
const characterCount = selectionText.length;
|
|
11
|
+
const price = characterCount * pricingRules.price;
|
|
12
|
+
return Math.max(1, Math.ceil(price));
|
|
13
|
+
|
|
14
|
+
case PRESENTATION_AI_ACTION_PRICING_TYPE.FLAT:
|
|
15
|
+
return Math.max(1, Math.ceil(pricingRules.price));
|
|
16
|
+
|
|
17
|
+
default:
|
|
18
|
+
throw new Error(`Unknown pricing type`);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './calculate-presentation-ai-action-price.util';
|
package/models/index.ts
CHANGED
|
@@ -0,0 +1,9 @@
|
|
|
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';
|
|
8
|
+
export * from './presentation-ai-action.schema';
|
|
9
|
+
export * from './presentation-title-page.schema';
|
|
@@ -0,0 +1,246 @@
|
|
|
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
|
+
CHEVRON = 'chevron',
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export enum PPTX_CHEVRON_DIRECTION {
|
|
12
|
+
RIGHT = 'right',
|
|
13
|
+
LEFT = 'left',
|
|
14
|
+
UP = 'up',
|
|
15
|
+
DOWN = 'down',
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export enum PPTX_ARROW_TYPE {
|
|
19
|
+
RIGHT = 'rightArrow',
|
|
20
|
+
LEFT = 'leftArrow',
|
|
21
|
+
UP = 'upArrow',
|
|
22
|
+
DOWN = 'downArrow',
|
|
23
|
+
}
|
|
24
|
+
export enum PPTX_H_ALIGN {
|
|
25
|
+
LEFT = 'left',
|
|
26
|
+
CENTER = 'center',
|
|
27
|
+
RIGHT = 'right',
|
|
28
|
+
JUSTIFY = 'justify',
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export enum PPTX_V_ALIGN {
|
|
32
|
+
TOP = 'top',
|
|
33
|
+
MIDDLE = 'middle',
|
|
34
|
+
BOTTOM = 'bottom',
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export enum PPTX_OBJECT_FIT {
|
|
38
|
+
COVER = 'cover',
|
|
39
|
+
CONTAIN = 'contain',
|
|
40
|
+
CROP = 'crop',
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export enum PPTX_BORDER_TYPE {
|
|
44
|
+
SOLID = 'solid',
|
|
45
|
+
NONE = 'none',
|
|
46
|
+
DASH = 'dash',
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export enum PPTX_FILL_TYPE {
|
|
50
|
+
SOLID = 'solid',
|
|
51
|
+
NONE = 'none',
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export enum PPTX_SHADOW_TYPE {
|
|
55
|
+
OUTER = 'outer',
|
|
56
|
+
INNER = 'inner',
|
|
57
|
+
NONE = 'none',
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export enum PPTX_CUSTOM_SHAPE_TYPE {
|
|
61
|
+
ROUND_RECT = 'roundRect',
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export const PPTXShadowSchema = z.object({
|
|
65
|
+
type: z.nativeEnum(PPTX_SHADOW_TYPE),
|
|
66
|
+
opacity: z.number().min(0).max(100).optional().describe('percents, range 0-100'),
|
|
67
|
+
color: z.string().optional().describe('hex color'),
|
|
68
|
+
blur: z.number().min(0).max(100).optional().describe('degrees, range 0-100'),
|
|
69
|
+
angle: z.number().min(0).max(359).optional().describe('degrees, range 0-359'),
|
|
70
|
+
offset: z.number().min(0).max(200).optional().describe('points, range 0-200'),
|
|
71
|
+
rotateWithShape: z.boolean().optional().describe('whether or not to rotate shadow with shape'),
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
export const PPTXFillSchema = z.object({
|
|
75
|
+
color: z.string(),
|
|
76
|
+
type: z.nativeEnum(PPTX_FILL_TYPE),
|
|
77
|
+
transparency: z.number().min(0).max(100).optional().describe('percents, range 0-100'),
|
|
78
|
+
alpha: z.number().min(0).max(1).optional().describe('range 0-1'),
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
export const PPTXMarginSchema = z.union([
|
|
82
|
+
z.number(),
|
|
83
|
+
z.tuple([z.number(), z.number(), z.number(), z.number()]),
|
|
84
|
+
]);
|
|
85
|
+
export type PPTXMargin = z.infer<typeof PPTXMarginSchema>;
|
|
86
|
+
|
|
87
|
+
// Common
|
|
88
|
+
export const PPTXPositionSchema = z.object({
|
|
89
|
+
height: z.number(),
|
|
90
|
+
width: z.number(),
|
|
91
|
+
top: z.number(),
|
|
92
|
+
left: z.number(),
|
|
93
|
+
});
|
|
94
|
+
export type PPTXPosition = z.infer<typeof PPTXPositionSchema>;
|
|
95
|
+
|
|
96
|
+
export const PPTXFontSchema = z.object({
|
|
97
|
+
bold: z.boolean().optional(),
|
|
98
|
+
color: z.string(),
|
|
99
|
+
name: z.string(),
|
|
100
|
+
size: z.number(),
|
|
101
|
+
lineHeight: z
|
|
102
|
+
.union([
|
|
103
|
+
z.object({
|
|
104
|
+
percent: z.number(),
|
|
105
|
+
}),
|
|
106
|
+
z.object({
|
|
107
|
+
px: z.number(),
|
|
108
|
+
}),
|
|
109
|
+
])
|
|
110
|
+
.optional(),
|
|
111
|
+
});
|
|
112
|
+
export type PPTXFont = z.infer<typeof PPTXFontSchema>;
|
|
113
|
+
|
|
114
|
+
// Textual
|
|
115
|
+
export const PPTXParagraphSchema = z.object({
|
|
116
|
+
alignment: z.nativeEnum(PPTX_H_ALIGN),
|
|
117
|
+
font: PPTXFontSchema,
|
|
118
|
+
valign: z.nativeEnum(PPTX_V_ALIGN).optional(),
|
|
119
|
+
margin: PPTXMarginSchema.optional(),
|
|
120
|
+
rotate: z.number().optional(),
|
|
121
|
+
text: z.string(),
|
|
122
|
+
});
|
|
123
|
+
export type PPTXParagraph = z.infer<typeof PPTXParagraphSchema>;
|
|
124
|
+
|
|
125
|
+
export const PPTXTextBoxSchema = z.object({
|
|
126
|
+
type: z.literal(PPTX_SHAPE_TYPE.TEXT_BOX),
|
|
127
|
+
position: PPTXPositionSchema,
|
|
128
|
+
|
|
129
|
+
paragraphs: z.array(PPTXParagraphSchema),
|
|
130
|
+
});
|
|
131
|
+
export type PPTXTextBox = z.infer<typeof PPTXTextBoxSchema>;
|
|
132
|
+
|
|
133
|
+
// Picture
|
|
134
|
+
export const PPTXPictureBoxSchema = z.object({
|
|
135
|
+
type: z.literal(PPTX_SHAPE_TYPE.PICTURE_BOX),
|
|
136
|
+
position: PPTXPositionSchema,
|
|
137
|
+
borderRadius: z.array(z.number()).optional(),
|
|
138
|
+
objectFit: z.nativeEnum(PPTX_OBJECT_FIT),
|
|
139
|
+
data: z.union([
|
|
140
|
+
z.object({
|
|
141
|
+
base64: z
|
|
142
|
+
.string()
|
|
143
|
+
.describe('Base64 encoded image in "image/{mimeType};base64,{bas64}" format'),
|
|
144
|
+
}),
|
|
145
|
+
z.object({
|
|
146
|
+
path: z.string().describe('URL to image'),
|
|
147
|
+
}),
|
|
148
|
+
]),
|
|
149
|
+
});
|
|
150
|
+
export type PPTXPictureBox = z.infer<typeof PPTXPictureBoxSchema>;
|
|
151
|
+
|
|
152
|
+
// CustomShape
|
|
153
|
+
export const PPTXCustomShapeSchema = z.object({
|
|
154
|
+
type: z.literal(PPTX_SHAPE_TYPE.CUSTOM_SHAPE),
|
|
155
|
+
customShapeType: z.nativeEnum(PPTX_CUSTOM_SHAPE_TYPE).optional(),
|
|
156
|
+
position: PPTXPositionSchema,
|
|
157
|
+
borderRadius: z.number(),
|
|
158
|
+
fill: PPTXFillSchema.optional(),
|
|
159
|
+
shadow: PPTXShadowSchema.optional(),
|
|
160
|
+
});
|
|
161
|
+
export type PPTXCustomShape = z.infer<typeof PPTXCustomShapeSchema>;
|
|
162
|
+
|
|
163
|
+
// Table
|
|
164
|
+
export const PPTXTableCellSchema = z.object({
|
|
165
|
+
text: z.string().optional(),
|
|
166
|
+
font: PPTXFontSchema.optional(),
|
|
167
|
+
fill: z
|
|
168
|
+
.object({
|
|
169
|
+
color: z.string(),
|
|
170
|
+
type: z.nativeEnum(PPTX_FILL_TYPE),
|
|
171
|
+
transparency: z.number().min(0).max(100).optional().describe('percents, range 0-100'),
|
|
172
|
+
})
|
|
173
|
+
.optional(),
|
|
174
|
+
align: z.nativeEnum(PPTX_H_ALIGN).optional(),
|
|
175
|
+
valign: z.nativeEnum(PPTX_V_ALIGN).optional(),
|
|
176
|
+
colspan: z.number().int().optional(),
|
|
177
|
+
rowspan: z.number().int().optional(),
|
|
178
|
+
margin: PPTXMarginSchema.optional(),
|
|
179
|
+
});
|
|
180
|
+
export type PPTXTableCell = z.infer<typeof PPTXTableCellSchema>;
|
|
181
|
+
|
|
182
|
+
export const PPTXTableRowSchema = z.array(PPTXTableCellSchema);
|
|
183
|
+
export type PPTXTableRow = z.infer<typeof PPTXTableRowSchema>;
|
|
184
|
+
|
|
185
|
+
export const PPTXTableShapeSchema = z.object({
|
|
186
|
+
type: z.literal(PPTX_SHAPE_TYPE.TABLE),
|
|
187
|
+
position: PPTXPositionSchema,
|
|
188
|
+
rows: z.array(PPTXTableRowSchema),
|
|
189
|
+
columnWidths: z.array(z.number()).optional(),
|
|
190
|
+
headerRows: z.number().int().min(0).optional(),
|
|
191
|
+
border: z.object({
|
|
192
|
+
type: z.nativeEnum(PPTX_BORDER_TYPE),
|
|
193
|
+
color: z.string(),
|
|
194
|
+
px: z.number(),
|
|
195
|
+
}),
|
|
196
|
+
});
|
|
197
|
+
export type PPTXTableShape = z.infer<typeof PPTXTableShapeSchema>;
|
|
198
|
+
|
|
199
|
+
// Chevron
|
|
200
|
+
export const PPTXChevronShapeSchema = z.object({
|
|
201
|
+
type: z.literal(PPTX_SHAPE_TYPE.CHEVRON),
|
|
202
|
+
direction: z.nativeEnum(PPTX_CHEVRON_DIRECTION).default(PPTX_CHEVRON_DIRECTION.RIGHT),
|
|
203
|
+
position: PPTXPositionSchema,
|
|
204
|
+
fill: PPTXFillSchema.optional(),
|
|
205
|
+
text: z.string().optional(),
|
|
206
|
+
font: PPTXFontSchema.optional(),
|
|
207
|
+
align: z
|
|
208
|
+
.nativeEnum(PPTX_H_ALIGN)
|
|
209
|
+
.optional()
|
|
210
|
+
.default('center' as PPTX_H_ALIGN),
|
|
211
|
+
valign: z
|
|
212
|
+
.nativeEnum(PPTX_V_ALIGN)
|
|
213
|
+
.optional()
|
|
214
|
+
.default('middle' as PPTX_V_ALIGN),
|
|
215
|
+
});
|
|
216
|
+
export type PPTXChevronShape = z.infer<typeof PPTXChevronShapeSchema>;
|
|
217
|
+
|
|
218
|
+
// Overview
|
|
219
|
+
|
|
220
|
+
export const PPTXShapeSchema = z.discriminatedUnion('type', [
|
|
221
|
+
PPTXTextBoxSchema,
|
|
222
|
+
PPTXPictureBoxSchema,
|
|
223
|
+
PPTXCustomShapeSchema,
|
|
224
|
+
PPTXTableShapeSchema,
|
|
225
|
+
PPTXChevronShapeSchema,
|
|
226
|
+
]);
|
|
227
|
+
export type PPTXShape = z.infer<typeof PPTXShapeSchema>;
|
|
228
|
+
|
|
229
|
+
export const SlideBackground = z.union([
|
|
230
|
+
PPTXFillSchema,
|
|
231
|
+
z.object({
|
|
232
|
+
path: z.string(),
|
|
233
|
+
}),
|
|
234
|
+
]);
|
|
235
|
+
export type SlideBackground = z.infer<typeof SlideBackground>;
|
|
236
|
+
|
|
237
|
+
export const PPTXSlideSchema = z.object({
|
|
238
|
+
background: SlideBackground.optional(),
|
|
239
|
+
shapes: z.array(PPTXShapeSchema),
|
|
240
|
+
});
|
|
241
|
+
export type PPTXSlide = z.infer<typeof PPTXSlideSchema>;
|
|
242
|
+
|
|
243
|
+
export const PPTXExportPayloadSchema = z.object({
|
|
244
|
+
slides: z.array(PPTXSlideSchema),
|
|
245
|
+
});
|
|
246
|
+
export type PPTXExportPayload = z.infer<typeof PPTXExportPayloadSchema>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { PRESENTATION_AI_ACTION_PRICING_TYPE, PRESENTATION_AI_ACTION_TYPE } from '../../constants';
|
|
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>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { SlideContentTypeSchema } from './slide-content-type.schema';
|
|
3
|
+
import { PresentationTemplateSchema } from './presentation-template.schema';
|
|
4
|
+
import { PresentationAiActionSchema } from './presentation-ai-action.schema';
|
|
5
|
+
import { LanguageSchema } from '../language.schema';
|
|
6
|
+
|
|
7
|
+
export const PresentationConfigSchema = z.object({
|
|
8
|
+
slideContentTypes: z.array(SlideContentTypeSchema),
|
|
9
|
+
languages: z.array(LanguageSchema),
|
|
10
|
+
templates: z.array(PresentationTemplateSchema),
|
|
11
|
+
aiActions: z.array(PresentationAiActionSchema),
|
|
12
|
+
slideGenerationPrice: z.number(),
|
|
13
|
+
maxSlides: z.number(),
|
|
14
|
+
minSlides: z.number(),
|
|
15
|
+
maxSlideTitleLength: z.number(),
|
|
16
|
+
maxSlideOutlineLength: z.number(),
|
|
17
|
+
maxPromptLength: z.number(),
|
|
18
|
+
imageGenerationPrice: z.number(),
|
|
19
|
+
});
|
|
20
|
+
export type PresentationConfig = z.infer<typeof PresentationConfigSchema>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export const PresentationTitlePageSchema = z.object({
|
|
4
|
+
author: z.string().optional().nullable(),
|
|
5
|
+
createdAt: z.date().optional().nullable(),
|
|
6
|
+
email: z.string().email().optional().nullable(),
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export type PresentationTitlePage = z.infer<typeof PresentationTitlePageSchema>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { SlideOutlineSchema } from './slide-outline.schema';
|
|
3
|
+
import { SlideSchema } from './slide.schema';
|
|
4
|
+
import { PRESENTATION_STAGE, USER_REACTION } from '../../constants';
|
|
5
|
+
import { PresentationTitlePageSchema } from './presentation-title-page.schema';
|
|
6
|
+
|
|
7
|
+
export const PresentationSchema = z.object({
|
|
8
|
+
uuid: z.string().uuid(),
|
|
9
|
+
prompt: z.string(),
|
|
10
|
+
stage: z.nativeEnum(PRESENTATION_STAGE),
|
|
11
|
+
title: z.string(),
|
|
12
|
+
thumbnail: z.string(),
|
|
13
|
+
languageId: z.string(),
|
|
14
|
+
templateId: z.string(),
|
|
15
|
+
downloadUrl: z.string().nullable(),
|
|
16
|
+
reaction: z.nativeEnum(USER_REACTION).nullable(),
|
|
17
|
+
dislikeReason: z.string().nullable(),
|
|
18
|
+
slideCount: z.number(),
|
|
19
|
+
lastContentUpdateAt: z.date().nullable(),
|
|
20
|
+
lastPptxExportedAt: z.date().nullable(),
|
|
21
|
+
titlePage: PresentationTitlePageSchema.nullable(),
|
|
22
|
+
createdAt: z.date(),
|
|
23
|
+
updatedAt: z.date(),
|
|
24
|
+
});
|
|
25
|
+
export type Presentation = z.infer<typeof PresentationSchema>;
|
|
26
|
+
|
|
27
|
+
export const PresentationWithSlidesSchema = PresentationSchema.extend({
|
|
28
|
+
outline: z.array(SlideOutlineSchema),
|
|
29
|
+
slides: z.array(SlideSchema),
|
|
30
|
+
});
|
|
31
|
+
export type PresentationWithSlides = z.infer<typeof PresentationWithSlidesSchema>;
|
|
32
|
+
|
|
33
|
+
export const PresentationUpdateSchema = PresentationSchema.pick({
|
|
34
|
+
title: true,
|
|
35
|
+
templateId: true,
|
|
36
|
+
titlePage: true,
|
|
37
|
+
}).partial();
|
|
38
|
+
export type PresentationUpdate = z.infer<typeof PresentationUpdateSchema>;
|