@purpleschool/gptbot 0.7.13 → 0.7.15

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.
Files changed (91) hide show
  1. package/api/controllers/http/index.ts +1 -0
  2. package/api/controllers/http/presentation.ts +26 -0
  3. package/build/api/controllers/http/index.js +1 -0
  4. package/build/api/controllers/http/presentation.js +25 -0
  5. package/build/commands/tools/index.js +1 -0
  6. package/build/commands/tools/presentation/create-presentation.command.js +17 -0
  7. package/build/commands/tools/presentation/delete-all-user-presentations.command.js +8 -0
  8. package/build/commands/tools/presentation/delete-presentation.command.js +11 -0
  9. package/build/commands/tools/presentation/delete-slide-outline.command.js +12 -0
  10. package/build/commands/tools/presentation/export-presentation-as-pptx.command.js +17 -0
  11. package/build/commands/tools/presentation/find-presentation-by-uuid.command.js +14 -0
  12. package/build/commands/tools/presentation/find-presentation-outline.command.js +14 -0
  13. package/build/commands/tools/presentation/find-presentations.command.js +18 -0
  14. package/build/commands/tools/presentation/generate-presentation-slides.command.js +14 -0
  15. package/build/commands/tools/presentation/get-presentation-config.command.js +11 -0
  16. package/build/commands/tools/presentation/index.js +31 -0
  17. package/build/commands/tools/presentation/reposition-slide-outline.command.js +15 -0
  18. package/build/commands/tools/presentation/update-presentation-outline.command.js +15 -0
  19. package/build/commands/tools/presentation/update-presentation.command.js +17 -0
  20. package/build/commands/tools/presentation/update-slide-outline.command.js +23 -0
  21. package/build/constants/errors/errors.js +65 -0
  22. package/build/constants/index.js +1 -0
  23. package/build/constants/presentation/enums/index.js +21 -0
  24. package/build/constants/presentation/enums/presentation-stage.enum.js +14 -0
  25. package/build/constants/presentation/enums/slide-content-type.enum.js +15 -0
  26. package/build/constants/presentation/enums/slide-icon-slot-status.enum.js +10 -0
  27. package/build/constants/presentation/enums/slide-image-slot.status.enum.js +10 -0
  28. package/build/constants/presentation/enums/slide-layout.enum.js +8 -0
  29. package/build/constants/presentation/index.js +18 -0
  30. package/build/constants/presentation/maps/index.js +17 -0
  31. package/build/constants/presentation/maps/slide-layout-map.constant.js +16 -0
  32. package/build/constants/subscription/enums/subscription-feature-type.enum.js +2 -0
  33. package/build/models/subscription-feature.schema.js +7 -1
  34. package/build/models/tools/index.js +1 -0
  35. package/build/models/tools/language/index.js +17 -0
  36. package/build/models/tools/language/language.schema.js +11 -0
  37. package/build/models/tools/presentation/index.js +23 -0
  38. package/build/models/tools/presentation/pptx-export-payload.schema.js +183 -0
  39. package/build/models/tools/presentation/presentation-config.schema.js +17 -0
  40. package/build/models/tools/presentation/presentation-template.schema.js +13 -0
  41. package/build/models/tools/presentation/presentation.schema.js +24 -0
  42. package/build/models/tools/presentation/slide-content-type.schema.js +14 -0
  43. package/build/models/tools/presentation/slide-content.schema.js +177 -0
  44. package/build/models/tools/presentation/slide-icon-slot.schema.js +15 -0
  45. package/build/models/tools/presentation/slide-image-slot.schema.js +16 -0
  46. package/build/models/tools/presentation/slide-outline.schema.js +50 -0
  47. package/build/models/tools/presentation/slide.schema.js +20 -0
  48. package/commands/tools/index.ts +1 -0
  49. package/commands/tools/presentation/create-presentation.command.ts +19 -0
  50. package/commands/tools/presentation/delete-all-user-presentations.command.ts +6 -0
  51. package/commands/tools/presentation/delete-presentation.command.ts +11 -0
  52. package/commands/tools/presentation/delete-slide-outline.command.ts +12 -0
  53. package/commands/tools/presentation/export-presentation-as-pptx.command.ts +20 -0
  54. package/commands/tools/presentation/find-presentation-by-uuid.command.ts +16 -0
  55. package/commands/tools/presentation/find-presentation-outline.command.ts +16 -0
  56. package/commands/tools/presentation/find-presentations.command.ts +18 -0
  57. package/commands/tools/presentation/generate-presentation-slides.command.ts +16 -0
  58. package/commands/tools/presentation/get-presentation-config.command.ts +10 -0
  59. package/commands/tools/presentation/index.ts +15 -0
  60. package/commands/tools/presentation/reposition-slide-outline.command.ts +17 -0
  61. package/commands/tools/presentation/update-presentation-outline.command.ts +21 -0
  62. package/commands/tools/presentation/update-presentation.command.ts +20 -0
  63. package/commands/tools/presentation/update-slide-outline.command.ts +26 -0
  64. package/constants/errors/errors.ts +66 -0
  65. package/constants/index.ts +1 -0
  66. package/constants/presentation/enums/index.ts +5 -0
  67. package/constants/presentation/enums/presentation-stage.enum.ts +13 -0
  68. package/constants/presentation/enums/slide-content-type.enum.ts +11 -0
  69. package/constants/presentation/enums/slide-icon-slot-status.enum.ts +6 -0
  70. package/constants/presentation/enums/slide-image-slot.status.enum.ts +6 -0
  71. package/constants/presentation/enums/slide-layout.enum.ts +4 -0
  72. package/constants/presentation/index.ts +2 -0
  73. package/constants/presentation/maps/index.ts +1 -0
  74. package/constants/presentation/maps/slide-layout-map.constant.ts +14 -0
  75. package/constants/subscription/enums/subscription-feature-type.enum.ts +2 -0
  76. package/models/subscription-feature.schema.ts +8 -0
  77. package/models/tools/index.ts +1 -0
  78. package/models/tools/language/index.ts +1 -0
  79. package/models/tools/language/language.schema.ts +9 -0
  80. package/models/tools/presentation/index.ts +7 -0
  81. package/models/tools/presentation/pptx-export-payload.schema.ts +212 -0
  82. package/models/tools/presentation/presentation-config.schema.ts +16 -0
  83. package/models/tools/presentation/presentation-template.schema.ts +11 -0
  84. package/models/tools/presentation/presentation.schema.ts +25 -0
  85. package/models/tools/presentation/slide-content-type.schema.ts +13 -0
  86. package/models/tools/presentation/slide-content.schema.ts +218 -0
  87. package/models/tools/presentation/slide-icon-slot.schema.ts +13 -0
  88. package/models/tools/presentation/slide-image-slot.schema.ts +14 -0
  89. package/models/tools/presentation/slide-outline.schema.ts +58 -0
  90. package/models/tools/presentation/slide.schema.ts +19 -0
  91. package/package.json +1 -1
@@ -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>;
@@ -0,0 +1,218 @@
1
+ import { z } from 'zod';
2
+ import { SLIDE_CONTENT_TYPE } from '../../../constants';
3
+
4
+ export enum SLIDE_CHART_TYPE {
5
+ BAR = 'BAR',
6
+ }
7
+
8
+ export const ImageSlotSchema = z.object({
9
+ uuid: z
10
+ .string()
11
+ .uuid()
12
+ .describe('Generate a valid uuid for image slot, that will be used for future lookups'),
13
+ prompt: z.string().describe('Image prompt for slide'),
14
+ });
15
+ export type ImageSlot = z.infer<typeof ImageSlotSchema>;
16
+
17
+ export const IconSlotSchema = z.object({
18
+ uuid: z
19
+ .string()
20
+ .uuid()
21
+ .describe('Generate a valid uuid for icon slot, that will be used for future lookups'),
22
+ prompt: z
23
+ .string()
24
+ .describe(
25
+ 'Icons are stored locally. Provide a search query for a fitting icon. MUST BE IN ENGLISH',
26
+ ),
27
+ });
28
+ export type IconSlot = z.infer<typeof IconSlotSchema>;
29
+
30
+ export const CoverSlideDataSchema = z.object({
31
+ contentType: z.literal(SLIDE_CONTENT_TYPE.COVER),
32
+ title: z.string().describe('Slide title in about 6 words').min(10).max(200),
33
+ author: z.object({
34
+ label: z.string().describe('Literal "Author" in presentation\'s language'),
35
+ value: z
36
+ .string()
37
+ .describe('Literal "Author of the presentation" in presentation\'s language'),
38
+ }),
39
+ date: z.object({
40
+ label: z.string().describe('Literal "Date" in presentation\'s language'),
41
+ value: z
42
+ .string()
43
+ .describe(
44
+ 'Date of the presentation in the "dd month yyyy" format in presentation\'s locale',
45
+ ),
46
+ }),
47
+ email: z.object({
48
+ label: z.string().describe('Just default word "Email"'),
49
+ value: z.string().describe('Just default "email@example.com"'),
50
+ }),
51
+ });
52
+ export type CoverSlideData = z.infer<typeof CoverSlideDataSchema>;
53
+
54
+ export const ThankYouSlideDataSchema = z.object({
55
+ contentType: z.literal(SLIDE_CONTENT_TYPE.THANK_YOU),
56
+ title: z.string().describe('Slide title in about 6 words').min(10).max(200),
57
+ author: z.object({
58
+ label: z.string().describe('Literal "Author" in presentation\'s language'),
59
+ value: z
60
+ .string()
61
+ .describe('Literal "Author of the presentation" in presentation\'s language'),
62
+ }),
63
+ date: z.object({
64
+ label: z.string().describe('Literal "Date" in presentation\'s language'),
65
+ value: z
66
+ .string()
67
+ .describe(
68
+ 'Date of the presentation in the "dd month yyyy" format in presentation\'s locale',
69
+ ),
70
+ }),
71
+ email: z.object({
72
+ label: z.string().describe('Just default word "Email"'),
73
+ value: z.string().describe('Just default "email@example.com"'),
74
+ }),
75
+ });
76
+ export type ThankYouSlideData = z.infer<typeof ThankYouSlideDataSchema>;
77
+
78
+ export const StructuredListSlideDataSchema = z.object({
79
+ contentType: z.literal(SLIDE_CONTENT_TYPE.STRUCTURED_LIST),
80
+ title: z.string().describe('Slide title in about 6 words').min(10).max(200),
81
+ description: z.string().describe('Description of the slide in about 6 words').min(10).max(200),
82
+ list: z
83
+ .array(
84
+ z.object({
85
+ title: z.string().describe('List item title in about 6 words').min(10).max(200),
86
+ description: z
87
+ .string()
88
+ .describe('List item description in about 6 words')
89
+ .min(10)
90
+ .max(200),
91
+ }),
92
+ )
93
+ .min(4)
94
+ .max(4),
95
+ });
96
+ export type StructuredListSlideData = z.infer<typeof StructuredListSlideDataSchema>;
97
+
98
+ export const TextSlideDataSchema = z.object({
99
+ contentType: z.literal(SLIDE_CONTENT_TYPE.TEXT),
100
+ title: z.string().describe('Slide title in about 6 words').min(10).max(200),
101
+ description: z
102
+ .string()
103
+ .describe(
104
+ 'Fairly long textual description of the point presented in the title. A couple of paragraphs.',
105
+ )
106
+ .min(300)
107
+ .max(1000),
108
+ });
109
+ export type TextSlideData = z.infer<typeof TextSlideDataSchema>;
110
+
111
+ export const ContentsSlideDataSchema = z.object({
112
+ contentType: z.literal(SLIDE_CONTENT_TYPE.CONTENTS),
113
+ title: z
114
+ .string()
115
+ .describe(
116
+ 'This slide represents table of contents for the presentation and must be named "Contents" in the presentation language',
117
+ )
118
+ .min(10)
119
+ .max(200),
120
+ items: z
121
+ .array(z.string().min(1))
122
+ .min(1)
123
+ .describe(
124
+ 'List of slide titles. Must be relevant and generated after all the slides are generated',
125
+ ),
126
+ });
127
+ export type ContentsSlideData = z.infer<typeof ContentsSlideDataSchema>;
128
+
129
+ export const ImageSlideDataSchema = z.object({
130
+ contentType: z.literal(SLIDE_CONTENT_TYPE.IMAGE),
131
+ title: z.string().describe('Slide title in about 6 words').min(10).max(200),
132
+ description: z.string().describe('Description of the slide in about 6 words').min(10).max(200),
133
+ imageSlot: ImageSlotSchema,
134
+ });
135
+ export type ImageSlideData = z.infer<typeof ImageSlideDataSchema>;
136
+
137
+ export const SectionBreakSlideDataSchema = z.object({
138
+ contentType: z.literal(SLIDE_CONTENT_TYPE.SECTION_BREAK),
139
+ title: z.string().describe('Slide title in about 6 words').min(10).max(200),
140
+ description: z.string().describe('Description of the slide in about 6 words').min(10).max(200),
141
+ });
142
+ export type SectionBreakSlideData = z.infer<typeof SectionBreakSlideDataSchema>;
143
+
144
+ export const TableSlideDataSchema = z.object({
145
+ contentType: z.literal(SLIDE_CONTENT_TYPE.TABLE),
146
+ title: z
147
+ .string()
148
+ .describe('Slide title and table title at the same time in a couple of words')
149
+ .min(10)
150
+ .max(200),
151
+ description: z.string().describe('Description of the table represents').min(10).max(200),
152
+ table: z.object({
153
+ columnHeaders: z
154
+ .array(z.string().min(1).max(50))
155
+ .min(1)
156
+ .max(10)
157
+ .describe('Array of column header labels'),
158
+ rows: z
159
+ .array(z.array(z.string().min(1).max(150)))
160
+ .min(2)
161
+ .max(10)
162
+ .describe(
163
+ 'Table rows; each row must have exactly the same number of cells as columnHeaders',
164
+ ),
165
+ hasRowHeaders: z.boolean().describe('If table needs special row headers, set this to true'),
166
+ hasSummaryRow: z.boolean().describe('If table needs a summary row, set this to true'),
167
+ }),
168
+ });
169
+ export type TableSlideData = z.infer<typeof TableSlideDataSchema>;
170
+
171
+ // Charts
172
+ export const BarChartSlideDataSchema = z.object({
173
+ type: z.literal(SLIDE_CHART_TYPE.BAR),
174
+ categories: z
175
+ .array(z.string().min(1).max(12))
176
+ .min(1)
177
+ .max(12)
178
+ .describe('Category labels (e.g., months, products, regions)'),
179
+ series: z
180
+ .array(
181
+ z.object({
182
+ name: z.string().min(1).max(12).describe('Series name for legend'),
183
+ data: z.array(z.number()).describe('Values corresponding to categories'),
184
+ type: z
185
+ .number()
186
+ .min(0)
187
+ .max(11)
188
+ .describe('Series type. Used to discriminate colors when applying theme'),
189
+ }),
190
+ )
191
+ .min(1)
192
+ .max(12)
193
+ .describe('Data series for the chart'),
194
+ yAxisLabel: z.string().max(40).optional().describe('Y-axis label'),
195
+ unit: z.string().max(10).optional().describe('Unit symbol (%, $, etc.)'),
196
+ });
197
+ export type BarChartSlideData = z.infer<typeof BarChartSlideDataSchema>;
198
+
199
+ export const ChartSlideDataSchema = z.object({
200
+ contentType: z.literal(SLIDE_CONTENT_TYPE.CHART),
201
+ title: z.string().describe('Slide title in about 6 words').min(10).max(200),
202
+ description: z.string().describe('Description of the slide in about 6 words').min(10).max(200),
203
+ chart: z.discriminatedUnion('type', [BarChartSlideDataSchema]),
204
+ });
205
+ export type ChartSlideData = z.infer<typeof ChartSlideDataSchema>;
206
+
207
+ export const SlideContentSchema = z.discriminatedUnion('contentType', [
208
+ CoverSlideDataSchema,
209
+ StructuredListSlideDataSchema,
210
+ TextSlideDataSchema,
211
+ ContentsSlideDataSchema,
212
+ SectionBreakSlideDataSchema,
213
+ ImageSlideDataSchema,
214
+ ThankYouSlideDataSchema,
215
+ TableSlideDataSchema,
216
+ ChartSlideDataSchema,
217
+ ]);
218
+ export type SlideContent = z.infer<typeof SlideContentSchema>;
@@ -0,0 +1,13 @@
1
+ import { z } from 'zod';
2
+ import { SLIDE_ICON_SLOT_STATUS } from '../../../constants';
3
+
4
+ export const SlideIconSlotSchema = z.object({
5
+ uuid: z.string().uuid(),
6
+ prompt: z.string(),
7
+ alt: z.string(),
8
+ url: z.string().nullable(),
9
+ slideId: z.string(),
10
+ status: z.nativeEnum(SLIDE_ICON_SLOT_STATUS),
11
+ createdAt: z.date(),
12
+ updatedAt: z.date(),
13
+ });
@@ -0,0 +1,14 @@
1
+ import { z } from 'zod';
2
+ import { SLIDE_IMAGE_SLOT_STATUS } from '../../../constants';
3
+
4
+ export const SlideImageSlotSchema = z.object({
5
+ uuid: z.string().uuid(),
6
+ prompt: z.string(),
7
+ alt: z.string(),
8
+ url: z.string().nullable(),
9
+ placeholder: z.string(),
10
+ slideId: z.string(),
11
+ status: z.nativeEnum(SLIDE_IMAGE_SLOT_STATUS),
12
+ createdAt: z.date(),
13
+ updatedAt: z.date(),
14
+ });
@@ -0,0 +1,58 @@
1
+ import { z } from 'zod';
2
+ import { SLIDE_CONTENT_TYPE } from '../../../constants';
3
+
4
+ export const SlideOutlineSchema = z.object({
5
+ uuid: z.string(),
6
+ order: z.number(),
7
+ title: z.string().max(80),
8
+ body: z.string().max(500),
9
+ contentTypeId: z.nativeEnum(SLIDE_CONTENT_TYPE),
10
+ presentationId: z.string(),
11
+ createdAt: z.date(),
12
+ updatedAt: z.date(),
13
+ });
14
+ export type SlideOutline = z.infer<typeof SlideOutlineSchema>;
15
+
16
+ export const SlideOutlineUpdateSchema = SlideOutlineSchema.pick({
17
+ title: true,
18
+ body: true,
19
+ contentTypeId: true,
20
+ }).partial();
21
+ export type SlideOutlineUpdate = z.infer<typeof SlideOutlineUpdateSchema>;
22
+
23
+ export const SlideOutlineBulkUpdateSchema = SlideOutlineSchema.pick({
24
+ order: true,
25
+ title: true,
26
+ body: true,
27
+ contentTypeId: true,
28
+ presentationId: true,
29
+ })
30
+ .extend({
31
+ uuid: z.string().uuid().optional(),
32
+ })
33
+ .array()
34
+ .min(1, 'Must include at least one slide outline')
35
+ .refine(
36
+ (arr) => {
37
+ const orders = arr.map((s) => s.order);
38
+ const unique = new Set(orders);
39
+ if (unique.size !== orders.length) return false;
40
+ const sorted = [...orders].sort((a, b) => a - b);
41
+ return sorted.every((val, idx) => val === idx);
42
+ },
43
+ {
44
+ message: 'Slide orders must be unique and sequential starting at 0',
45
+ path: ['order'],
46
+ },
47
+ )
48
+ .refine(
49
+ (arr) => {
50
+ const [firstId, ...rest] = arr.map((s) => s.presentationId);
51
+ return rest.every((id) => id === firstId);
52
+ },
53
+ {
54
+ message: 'All slide outlines must belong to the same presentation',
55
+ path: ['presentationId'],
56
+ },
57
+ );
58
+ export type SlideOutlineBulkUpdate = z.infer<typeof SlideOutlineBulkUpdateSchema>;
@@ -0,0 +1,19 @@
1
+ import { z } from 'zod';
2
+ import { SlideContentSchema } from './slide-content.schema';
3
+ import { SLIDE_CONTENT_TYPE, SLIDE_LAYOUT } from '../../../constants';
4
+ import { SlideIconSlotSchema } from './slide-icon-slot.schema';
5
+ import { SlideImageSlotSchema } from './slide-image-slot.schema';
6
+
7
+ export const SlideSchema = z.object({
8
+ uuid: z.string().uuid(),
9
+ order: z.number(),
10
+ contentTypeId: z.nativeEnum(SLIDE_CONTENT_TYPE),
11
+ layoutId: z.nativeEnum(SLIDE_LAYOUT),
12
+ content: SlideContentSchema,
13
+ presentationId: z.string(),
14
+ iconSlots: z.array(SlideIconSlotSchema),
15
+ imageSlots: z.array(SlideImageSlotSchema),
16
+ createdAt: z.date(),
17
+ updatedAt: z.date(),
18
+ });
19
+ export type Slide = z.infer<typeof SlideSchema>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purpleschool/gptbot",
3
- "version": "0.7.13",
3
+ "version": "0.7.15",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",