@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.
Files changed (127) hide show
  1. package/api/controller/http/index.ts +1 -0
  2. package/api/controller/http/presentation.ts +39 -0
  3. package/api/routes.ts +94 -0
  4. package/build/api/controller/http/index.js +1 -0
  5. package/build/api/controller/http/presentation.js +34 -0
  6. package/build/api/routes.js +54 -0
  7. package/build/commands/index.js +1 -0
  8. package/build/commands/presentation/build-blank-slide.command.js +16 -0
  9. package/build/commands/presentation/create-presentation.command.js +19 -0
  10. package/build/commands/presentation/delete-all-user-presentations.command.js +9 -0
  11. package/build/commands/presentation/delete-presentation.command.js +11 -0
  12. package/build/commands/presentation/delete-slide-outline.command.js +12 -0
  13. package/build/commands/presentation/export-presentation-as-pptx.command.js +17 -0
  14. package/build/commands/presentation/find-presentation-by-uuid.command.js +14 -0
  15. package/build/commands/presentation/find-presentation-outline.command.js +14 -0
  16. package/build/commands/presentation/find-presentations.command.js +18 -0
  17. package/build/commands/presentation/generate-and-insert-slide.command.js +22 -0
  18. package/build/commands/presentation/generate-presentation-slides.command.js +17 -0
  19. package/build/commands/presentation/get-presentation-config.command.js +11 -0
  20. package/build/commands/presentation/index.js +40 -0
  21. package/build/commands/presentation/presentation-generate-report.command.js +17 -0
  22. package/build/commands/presentation/presentation-paraphrase.command.js +20 -0
  23. package/build/commands/presentation/reposition-slide-outline.command.js +15 -0
  24. package/build/commands/presentation/reposition-slide.command.js +15 -0
  25. package/build/commands/presentation/set-reaction-to-presentation.command.js +28 -0
  26. package/build/commands/presentation/update-presentation-outline.command.js +15 -0
  27. package/build/commands/presentation/update-presentation-slides.command.js +25 -0
  28. package/build/commands/presentation/update-presentation.command.js +15 -0
  29. package/build/commands/presentation/update-slide-image-slot.command.js +34 -0
  30. package/build/commands/presentation/update-slide-outline.command.js +23 -0
  31. package/build/commands/presentation/update-slide.command.js +19 -0
  32. package/build/constants/errors/errors.js +261 -0
  33. package/build/constants/index.js +1 -0
  34. package/build/constants/presentation/enums/index.js +27 -0
  35. package/build/constants/presentation/enums/presentation-ai-action-call-status.enum.js +9 -0
  36. package/build/constants/presentation/enums/presentation-ai-action-pricing-type.enum.js +8 -0
  37. package/build/constants/presentation/enums/presentation-ai-action-type.enum.js +8 -0
  38. package/build/constants/presentation/enums/presentation-stage.enum.js +14 -0
  39. package/build/constants/presentation/enums/presentation-target-audience.enum.js +10 -0
  40. package/build/constants/presentation/enums/slide-content-type.enum.js +16 -0
  41. package/build/constants/presentation/enums/slide-icon-slot-status.enum.js +10 -0
  42. package/build/constants/presentation/enums/slide-image-slot-action.enum.js +8 -0
  43. package/build/constants/presentation/enums/slide-image-slot.status.enum.js +10 -0
  44. package/build/constants/presentation/enums/slide-layout.enum.js +8 -0
  45. package/build/constants/presentation/index.js +18 -0
  46. package/build/constants/presentation/maps/index.js +17 -0
  47. package/build/constants/presentation/maps/slide-layout-map.constant.js +17 -0
  48. package/build/helpers/index.js +1 -0
  49. package/build/helpers/presentation/calculate-presentation-ai-action-price.util.js +16 -0
  50. package/build/helpers/presentation/index.js +17 -0
  51. package/build/models/index.js +1 -0
  52. package/build/models/language.schema.js +11 -0
  53. package/build/models/presentation/index.js +25 -0
  54. package/build/models/presentation/pptx-export-payload.schema.js +216 -0
  55. package/build/models/presentation/presentation-ai-action.schema.js +27 -0
  56. package/build/models/presentation/presentation-config.schema.js +21 -0
  57. package/build/models/presentation/presentation-template.schema.js +13 -0
  58. package/build/models/presentation/presentation-title-page.schema.js +9 -0
  59. package/build/models/presentation/presentation.schema.js +35 -0
  60. package/build/models/presentation/slide-content-edit.schema.js +146 -0
  61. package/build/models/presentation/slide-content-type.schema.js +14 -0
  62. package/build/models/presentation/slide-content.schema.js +368 -0
  63. package/build/models/presentation/slide-icon-slot.schema.js +15 -0
  64. package/build/models/presentation/slide-image-slot.schema.js +16 -0
  65. package/build/models/presentation/slide-outline.schema.js +50 -0
  66. package/build/models/presentation/slide.schema.js +58 -0
  67. package/commands/index.ts +1 -0
  68. package/commands/presentation/build-blank-slide.command.ts +18 -0
  69. package/commands/presentation/create-presentation.command.ts +21 -0
  70. package/commands/presentation/delete-all-user-presentations.command.ts +9 -0
  71. package/commands/presentation/delete-presentation.command.ts +13 -0
  72. package/commands/presentation/delete-slide-outline.command.ts +12 -0
  73. package/commands/presentation/export-presentation-as-pptx.command.ts +20 -0
  74. package/commands/presentation/find-presentation-by-uuid.command.ts +16 -0
  75. package/commands/presentation/find-presentation-outline.command.ts +16 -0
  76. package/commands/presentation/find-presentations.command.ts +18 -0
  77. package/commands/presentation/generate-and-insert-slide.command.ts +27 -0
  78. package/commands/presentation/generate-presentation-slides.command.ts +21 -0
  79. package/commands/presentation/get-presentation-config.command.ts +10 -0
  80. package/commands/presentation/index.ts +24 -0
  81. package/commands/presentation/presentation-generate-report.command.ts +21 -0
  82. package/commands/presentation/presentation-paraphrase.command.ts +26 -0
  83. package/commands/presentation/reposition-slide-outline.command.ts +17 -0
  84. package/commands/presentation/reposition-slide.command.ts +17 -0
  85. package/commands/presentation/set-reaction-to-presentation.command.ts +33 -0
  86. package/commands/presentation/update-presentation-outline.command.ts +18 -0
  87. package/commands/presentation/update-presentation-slides.command.ts +32 -0
  88. package/commands/presentation/update-presentation.command.ts +18 -0
  89. package/commands/presentation/update-slide-image-slot.command.ts +40 -0
  90. package/commands/presentation/update-slide-outline.command.ts +26 -0
  91. package/commands/presentation/update-slide.command.ts +25 -0
  92. package/constants/errors/errors.ts +261 -0
  93. package/constants/index.ts +1 -0
  94. package/constants/presentation/enums/index.ts +11 -0
  95. package/constants/presentation/enums/presentation-ai-action-call-status.enum.ts +5 -0
  96. package/constants/presentation/enums/presentation-ai-action-pricing-type.enum.ts +4 -0
  97. package/constants/presentation/enums/presentation-ai-action-type.enum.ts +4 -0
  98. package/constants/presentation/enums/presentation-stage.enum.ts +13 -0
  99. package/constants/presentation/enums/presentation-target-audience.enum.ts +6 -0
  100. package/constants/presentation/enums/slide-content-type.enum.ts +12 -0
  101. package/constants/presentation/enums/slide-icon-slot-status.enum.ts +6 -0
  102. package/constants/presentation/enums/slide-image-slot-action.enum.ts +4 -0
  103. package/constants/presentation/enums/slide-image-slot.status.enum.ts +6 -0
  104. package/constants/presentation/enums/slide-layout.enum.ts +4 -0
  105. package/constants/presentation/index.ts +2 -0
  106. package/constants/presentation/maps/index.ts +1 -0
  107. package/constants/presentation/maps/slide-layout-map.constant.ts +15 -0
  108. package/helpers/index.ts +1 -0
  109. package/helpers/presentation/calculate-presentation-ai-action-price.util.ts +20 -0
  110. package/helpers/presentation/index.ts +1 -0
  111. package/models/index.ts +1 -0
  112. package/models/language.schema.ts +9 -0
  113. package/models/presentation/index.ts +9 -0
  114. package/models/presentation/pptx-export-payload.schema.ts +246 -0
  115. package/models/presentation/presentation-ai-action.schema.ts +30 -0
  116. package/models/presentation/presentation-config.schema.ts +20 -0
  117. package/models/presentation/presentation-template.schema.ts +11 -0
  118. package/models/presentation/presentation-title-page.schema.ts +9 -0
  119. package/models/presentation/presentation.schema.ts +38 -0
  120. package/models/presentation/slide-content-edit.schema.ts +175 -0
  121. package/models/presentation/slide-content-type.schema.ts +13 -0
  122. package/models/presentation/slide-content.schema.ts +581 -0
  123. package/models/presentation/slide-icon-slot.schema.ts +13 -0
  124. package/models/presentation/slide-image-slot.schema.ts +14 -0
  125. package/models/presentation/slide-outline.schema.ts +58 -0
  126. package/models/presentation/slide.schema.ts +66 -0
  127. 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.2.2",
3
+ "version": "1.4.0",
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": "^4.1.12"
15
+ "zod": "^3.25.76"
16
16
  }
17
17
  }