@purpleschool/student-works 1.2.2 → 1.3.1
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 +37 -0
- package/api/routes.ts +90 -0
- package/build/api/controller/http/index.js +1 -0
- package/build/api/controller/http/presentation.js +33 -0
- package/build/api/routes.js +52 -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 +17 -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 +14 -0
- package/build/commands/presentation/get-presentation-config.command.js +11 -0
- package/build/commands/presentation/index.js +39 -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/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 +18 -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 +236 -0
- package/build/constants/index.js +1 -0
- package/build/constants/presentation/enums/index.js +26 -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/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 +24 -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.schema.js +28 -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 +358 -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 +19 -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 +16 -0
- package/commands/presentation/get-presentation-config.command.ts +10 -0
- package/commands/presentation/index.ts +23 -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/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 +21 -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 +236 -0
- package/constants/index.ts +1 -0
- package/constants/presentation/enums/index.ts +10 -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/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 +8 -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.schema.ts +29 -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 +571 -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,66 @@
|
|
|
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
|
+
import { SlideContentUserEditSchema } from './slide-content-edit.schema';
|
|
7
|
+
|
|
8
|
+
export const SlideSchema = z.object({
|
|
9
|
+
uuid: z.string().uuid(),
|
|
10
|
+
order: z.number(),
|
|
11
|
+
contentTypeId: z.nativeEnum(SLIDE_CONTENT_TYPE),
|
|
12
|
+
layoutId: z.nativeEnum(SLIDE_LAYOUT),
|
|
13
|
+
content: SlideContentSchema,
|
|
14
|
+
presentationId: z.string(),
|
|
15
|
+
iconSlots: z.array(SlideIconSlotSchema),
|
|
16
|
+
imageSlots: z.array(SlideImageSlotSchema),
|
|
17
|
+
createdAt: z.date(),
|
|
18
|
+
updatedAt: z.date(),
|
|
19
|
+
});
|
|
20
|
+
export type Slide = z.infer<typeof SlideSchema>;
|
|
21
|
+
|
|
22
|
+
export const SlideUpdateSchema = SlideSchema.pick({
|
|
23
|
+
layoutId: true,
|
|
24
|
+
})
|
|
25
|
+
.extend({
|
|
26
|
+
content: SlideContentUserEditSchema,
|
|
27
|
+
})
|
|
28
|
+
.partial();
|
|
29
|
+
export type SlideUpdate = z.infer<typeof SlideUpdateSchema>;
|
|
30
|
+
|
|
31
|
+
export const SlideBulkUpdateSchema = SlideSchema.pick({
|
|
32
|
+
order: true,
|
|
33
|
+
contentTypeId: true,
|
|
34
|
+
layoutId: true,
|
|
35
|
+
presentationId: true,
|
|
36
|
+
})
|
|
37
|
+
.extend({
|
|
38
|
+
uuid: z.string().uuid().optional(),
|
|
39
|
+
content: SlideContentUserEditSchema,
|
|
40
|
+
})
|
|
41
|
+
.array()
|
|
42
|
+
.min(1, 'Must include at least one slide')
|
|
43
|
+
.refine(
|
|
44
|
+
(arr) => {
|
|
45
|
+
const orders = arr.map((s) => s.order);
|
|
46
|
+
const unique = new Set(orders);
|
|
47
|
+
if (unique.size !== orders.length) return false;
|
|
48
|
+
const sorted = [...orders].sort((a, b) => a - b);
|
|
49
|
+
return sorted.every((val, idx) => val === idx);
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
message: 'Slide orders must be unique and sequential starting at 0',
|
|
53
|
+
path: ['order'],
|
|
54
|
+
},
|
|
55
|
+
)
|
|
56
|
+
.refine(
|
|
57
|
+
(arr) => {
|
|
58
|
+
const [firstId, ...rest] = arr.map((s) => s.presentationId);
|
|
59
|
+
return rest.every((id) => id === firstId);
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
message: 'All slides must belong to the same presentation',
|
|
63
|
+
path: ['presentationId'],
|
|
64
|
+
},
|
|
65
|
+
);
|
|
66
|
+
export type SlideBulkUpdate = z.infer<typeof SlideBulkUpdateSchema>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@purpleschool/student-works",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -12,6 +12,6 @@
|
|
|
12
12
|
"author": "",
|
|
13
13
|
"license": "ISC",
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"zod": "^
|
|
15
|
+
"zod": "^3.25.76"
|
|
16
16
|
}
|
|
17
17
|
}
|