@hed-hog/lms 0.0.364 → 0.0.366

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 (290) hide show
  1. package/dist/bitcode-wallet/bitcode-wallet.service.d.ts +1 -0
  2. package/dist/bitcode-wallet/bitcode-wallet.service.d.ts.map +1 -1
  3. package/dist/bitcode-wallet/bitcode-wallet.service.js +22 -3
  4. package/dist/bitcode-wallet/bitcode-wallet.service.js.map +1 -1
  5. package/dist/class-group/class-group.controller.d.ts +1 -0
  6. package/dist/class-group/class-group.controller.d.ts.map +1 -1
  7. package/dist/class-group/class-group.service.d.ts +1 -0
  8. package/dist/class-group/class-group.service.d.ts.map +1 -1
  9. package/dist/course/course-export-scorm12-worker.service.d.ts +21 -0
  10. package/dist/course/course-export-scorm12-worker.service.d.ts.map +1 -0
  11. package/dist/course/course-export-scorm12-worker.service.js +109 -0
  12. package/dist/course/course-export-scorm12-worker.service.js.map +1 -0
  13. package/dist/course/course-export-scorm12.service.d.ts +42 -0
  14. package/dist/course/course-export-scorm12.service.d.ts.map +1 -0
  15. package/dist/course/course-export-scorm12.service.js +628 -0
  16. package/dist/course/course-export-scorm12.service.js.map +1 -0
  17. package/dist/course/course-export.service.d.ts +84 -0
  18. package/dist/course/course-export.service.d.ts.map +1 -0
  19. package/dist/course/course-export.service.js +237 -0
  20. package/dist/course/course-export.service.js.map +1 -0
  21. package/dist/course/course-structure.controller.d.ts +20 -10
  22. package/dist/course/course-structure.controller.d.ts.map +1 -1
  23. package/dist/course/course-structure.controller.js +20 -4
  24. package/dist/course/course-structure.controller.js.map +1 -1
  25. package/dist/course/course-structure.service.d.ts +12 -4
  26. package/dist/course/course-structure.service.d.ts.map +1 -1
  27. package/dist/course/course-structure.service.js +98 -23
  28. package/dist/course/course-structure.service.js.map +1 -1
  29. package/dist/course/course-video-agent-pipeline.service.d.ts +70 -0
  30. package/dist/course/course-video-agent-pipeline.service.d.ts.map +1 -0
  31. package/dist/course/course-video-agent-pipeline.service.js +398 -0
  32. package/dist/course/course-video-agent-pipeline.service.js.map +1 -0
  33. package/dist/course/course-video-hls.service.d.ts +71 -0
  34. package/dist/course/course-video-hls.service.d.ts.map +1 -0
  35. package/dist/course/course-video-hls.service.js +784 -0
  36. package/dist/course/course-video-hls.service.js.map +1 -0
  37. package/dist/course/course.controller.d.ts +47 -13
  38. package/dist/course/course.controller.d.ts.map +1 -1
  39. package/dist/course/course.controller.js +40 -26
  40. package/dist/course/course.controller.js.map +1 -1
  41. package/dist/course/course.mcp-tools.js +1 -1
  42. package/dist/course/course.mcp-tools.js.map +1 -1
  43. package/dist/course/course.module.d.ts.map +1 -1
  44. package/dist/course/course.module.js +16 -0
  45. package/dist/course/course.module.js.map +1 -1
  46. package/dist/course/course.service.d.ts +8 -9
  47. package/dist/course/course.service.d.ts.map +1 -1
  48. package/dist/course/course.service.js +93 -50
  49. package/dist/course/course.service.js.map +1 -1
  50. package/dist/course/dto/cleanup-course-storage.dto.d.ts +1 -1
  51. package/dist/course/dto/cleanup-course-storage.dto.d.ts.map +1 -1
  52. package/dist/course/dto/cleanup-course-storage.dto.js +1 -0
  53. package/dist/course/dto/cleanup-course-storage.dto.js.map +1 -1
  54. package/dist/course/dto/cleanup-upload-history.dto.d.ts +1 -1
  55. package/dist/course/dto/cleanup-upload-history.dto.d.ts.map +1 -1
  56. package/dist/course/dto/cleanup-upload-history.dto.js +1 -1
  57. package/dist/course/dto/cleanup-upload-history.dto.js.map +1 -1
  58. package/dist/course/dto/create-course-bulk-job.dto.d.ts +2 -1
  59. package/dist/course/dto/create-course-bulk-job.dto.d.ts.map +1 -1
  60. package/dist/course/dto/create-course-bulk-job.dto.js +6 -1
  61. package/dist/course/dto/create-course-bulk-job.dto.js.map +1 -1
  62. package/dist/course/dto/create-course-export.dto.d.ts +14 -0
  63. package/dist/course/dto/create-course-export.dto.d.ts.map +1 -0
  64. package/dist/course/dto/create-course-export.dto.js +71 -0
  65. package/dist/course/dto/create-course-export.dto.js.map +1 -0
  66. package/dist/course/dto/create-course-structure-lesson.dto.d.ts +2 -2
  67. package/dist/course/dto/create-course-structure-lesson.dto.d.ts.map +1 -1
  68. package/dist/course/dto/create-course-structure-lesson.dto.js +3 -2
  69. package/dist/course/dto/create-course-structure-lesson.dto.js.map +1 -1
  70. package/dist/course/ffmpeg.util.d.ts +10 -0
  71. package/dist/course/ffmpeg.util.d.ts.map +1 -0
  72. package/dist/course/ffmpeg.util.js +79 -0
  73. package/dist/course/ffmpeg.util.js.map +1 -0
  74. package/dist/course/lms-bulk-upload-automation.service.d.ts +18 -1
  75. package/dist/course/lms-bulk-upload-automation.service.d.ts.map +1 -1
  76. package/dist/course/lms-bulk-upload-automation.service.js +106 -8
  77. package/dist/course/lms-bulk-upload-automation.service.js.map +1 -1
  78. package/dist/course/lms-bulk-upload-infra.service.d.ts +1 -0
  79. package/dist/course/lms-bulk-upload-infra.service.d.ts.map +1 -1
  80. package/dist/course/lms-bulk-upload-infra.service.js +32 -8
  81. package/dist/course/lms-bulk-upload-infra.service.js.map +1 -1
  82. package/dist/course/lms-bulk-upload.controller.d.ts +30 -3
  83. package/dist/course/lms-bulk-upload.controller.d.ts.map +1 -1
  84. package/dist/course/lms-bulk-upload.controller.js +43 -2
  85. package/dist/course/lms-bulk-upload.controller.js.map +1 -1
  86. package/dist/course/lms-bulk-upload.service.d.ts +11 -0
  87. package/dist/course/lms-bulk-upload.service.d.ts.map +1 -1
  88. package/dist/course/lms-bulk-upload.service.js +59 -6
  89. package/dist/course/lms-bulk-upload.service.js.map +1 -1
  90. package/dist/course/lms-setting.controller.d.ts +2 -1
  91. package/dist/course/lms-setting.controller.d.ts.map +1 -1
  92. package/dist/course/lms-setting.controller.js +4 -2
  93. package/dist/course/lms-setting.controller.js.map +1 -1
  94. package/dist/course/scorm12-schemas.d.ts +4 -0
  95. package/dist/course/scorm12-schemas.d.ts.map +1 -0
  96. package/dist/course/scorm12-schemas.js +9 -0
  97. package/dist/course/scorm12-schemas.js.map +1 -0
  98. package/dist/enterprise/training/training-admin.controller.d.ts +2 -0
  99. package/dist/enterprise/training/training-admin.controller.d.ts.map +1 -1
  100. package/dist/enterprise/training/training-admin.service.d.ts +2 -0
  101. package/dist/enterprise/training/training-admin.service.d.ts.map +1 -1
  102. package/dist/enterprise/training/training-student.service.d.ts +51 -0
  103. package/dist/enterprise/training/training-student.service.d.ts.map +1 -1
  104. package/dist/enterprise/training/training-student.service.js +217 -4
  105. package/dist/enterprise/training/training-student.service.js.map +1 -1
  106. package/dist/evaluation/evaluation.service.d.ts +18 -0
  107. package/dist/evaluation/evaluation.service.d.ts.map +1 -1
  108. package/dist/evaluation/evaluation.service.js +125 -0
  109. package/dist/evaluation/evaluation.service.js.map +1 -1
  110. package/dist/exam/dto/create-standalone-question.dto.d.ts +12 -0
  111. package/dist/exam/dto/create-standalone-question.dto.d.ts.map +1 -0
  112. package/dist/exam/dto/create-standalone-question.dto.js +70 -0
  113. package/dist/exam/dto/create-standalone-question.dto.js.map +1 -0
  114. package/dist/exam/exam.module.d.ts.map +1 -1
  115. package/dist/exam/exam.module.js +2 -1
  116. package/dist/exam/exam.module.js.map +1 -1
  117. package/dist/exam/exam.service.d.ts +21 -0
  118. package/dist/exam/exam.service.d.ts.map +1 -1
  119. package/dist/exam/exam.service.js +80 -0
  120. package/dist/exam/exam.service.js.map +1 -1
  121. package/dist/exam/question.controller.d.ts +27 -0
  122. package/dist/exam/question.controller.d.ts.map +1 -0
  123. package/dist/exam/question.controller.js +53 -0
  124. package/dist/exam/question.controller.js.map +1 -0
  125. package/dist/lesson-xp-map/lesson-xp-ai-calculation.service.d.ts +4 -0
  126. package/dist/lesson-xp-map/lesson-xp-ai-calculation.service.d.ts.map +1 -1
  127. package/dist/lesson-xp-map/lesson-xp-ai-calculation.service.js +161 -25
  128. package/dist/lesson-xp-map/lesson-xp-ai-calculation.service.js.map +1 -1
  129. package/dist/libraries/lms/tsconfig.tsbuildinfo +1 -1
  130. package/dist/lms-commerce-access.subscriber.d.ts +11 -0
  131. package/dist/lms-commerce-access.subscriber.d.ts.map +1 -0
  132. package/dist/lms-commerce-access.subscriber.js +74 -0
  133. package/dist/lms-commerce-access.subscriber.js.map +1 -0
  134. package/dist/lms.module.d.ts.map +1 -1
  135. package/dist/lms.module.js +16 -5
  136. package/dist/lms.module.js.map +1 -1
  137. package/dist/platforma/dto/heartbeat.dto.d.ts +9 -0
  138. package/dist/platforma/dto/heartbeat.dto.d.ts.map +1 -0
  139. package/dist/platforma/dto/heartbeat.dto.js +50 -0
  140. package/dist/platforma/dto/heartbeat.dto.js.map +1 -0
  141. package/dist/platforma/handlers/emit-certificate.handler.d.ts +27 -0
  142. package/dist/platforma/handlers/emit-certificate.handler.d.ts.map +1 -0
  143. package/dist/platforma/handlers/emit-certificate.handler.js +117 -0
  144. package/dist/platforma/handlers/emit-certificate.handler.js.map +1 -0
  145. package/dist/platforma/handlers/lesson-heartbeat.handler.d.ts +31 -0
  146. package/dist/platforma/handlers/lesson-heartbeat.handler.d.ts.map +1 -0
  147. package/dist/platforma/handlers/lesson-heartbeat.handler.js +281 -0
  148. package/dist/platforma/handlers/lesson-heartbeat.handler.js.map +1 -0
  149. package/dist/platforma/platforma-heartbeat.service.d.ts +10 -0
  150. package/dist/platforma/platforma-heartbeat.service.d.ts.map +1 -0
  151. package/dist/platforma/platforma-heartbeat.service.js +50 -0
  152. package/dist/platforma/platforma-heartbeat.service.js.map +1 -0
  153. package/dist/platforma/platforma-performance.service.d.ts +121 -0
  154. package/dist/platforma/platforma-performance.service.d.ts.map +1 -0
  155. package/dist/platforma/platforma-performance.service.js +500 -0
  156. package/dist/platforma/platforma-performance.service.js.map +1 -0
  157. package/dist/platforma/platforma-search.service.d.ts +21 -0
  158. package/dist/platforma/platforma-search.service.d.ts.map +1 -0
  159. package/dist/platforma/platforma-search.service.js +64 -0
  160. package/dist/platforma/platforma-search.service.js.map +1 -0
  161. package/dist/platforma/platforma-video.service.d.ts +39 -0
  162. package/dist/platforma/platforma-video.service.d.ts.map +1 -0
  163. package/dist/platforma/platforma-video.service.js +301 -0
  164. package/dist/platforma/platforma-video.service.js.map +1 -0
  165. package/dist/platforma/platforma.controller.d.ts +209 -1
  166. package/dist/platforma/platforma.controller.d.ts.map +1 -1
  167. package/dist/platforma/platforma.controller.js +208 -2
  168. package/dist/platforma/platforma.controller.js.map +1 -1
  169. package/dist/realtime/lms-realtime.controller.d.ts +2 -0
  170. package/dist/realtime/lms-realtime.controller.d.ts.map +1 -1
  171. package/dist/realtime/lms-realtime.controller.js +31 -0
  172. package/dist/realtime/lms-realtime.controller.js.map +1 -1
  173. package/dist/realtime/lms-realtime.service.d.ts +1 -1
  174. package/dist/realtime/lms-realtime.service.d.ts.map +1 -1
  175. package/dist/realtime/lms-realtime.service.js.map +1 -1
  176. package/dist/student-xp/dto/grant-skill-card-xp.dto.d.ts +5 -0
  177. package/dist/student-xp/dto/grant-skill-card-xp.dto.d.ts.map +1 -0
  178. package/dist/student-xp/dto/grant-skill-card-xp.dto.js +26 -0
  179. package/dist/student-xp/dto/grant-skill-card-xp.dto.js.map +1 -0
  180. package/dist/student-xp/student-xp.controller.d.ts +15 -0
  181. package/dist/student-xp/student-xp.controller.d.ts.map +1 -1
  182. package/dist/student-xp/student-xp.controller.js +24 -0
  183. package/dist/student-xp/student-xp.controller.js.map +1 -1
  184. package/dist/student-xp/student-xp.service.d.ts +16 -0
  185. package/dist/student-xp/student-xp.service.d.ts.map +1 -1
  186. package/dist/student-xp/student-xp.service.js +51 -1
  187. package/dist/student-xp/student-xp.service.js.map +1 -1
  188. package/hedhog/data/evaluation_topic.yaml +17 -0
  189. package/hedhog/data/menu.yaml +0 -17
  190. package/hedhog/data/queue_definition.yaml +48 -0
  191. package/hedhog/data/route.yaml +94 -124
  192. package/hedhog/data/setting_group.yaml +19 -19
  193. package/hedhog/frontend/app/bulk-upload-sessions/page.tsx.ejs +337 -41
  194. package/hedhog/frontend/app/certificates/models/page.tsx.ejs +182 -29
  195. package/hedhog/frontend/app/classes/_components/classes-calendar-view.tsx.ejs +277 -0
  196. package/hedhog/frontend/app/classes/page.tsx.ejs +127 -20
  197. package/hedhog/frontend/app/courses/[id]/page.tsx.ejs +69 -4
  198. package/hedhog/frontend/app/courses/[id]/structure/_components/course-export-sheet.tsx.ejs +420 -0
  199. package/hedhog/frontend/app/courses/[id]/structure/_components/course-exports-tab.tsx.ejs +308 -0
  200. package/hedhog/frontend/app/courses/[id]/structure/_components/course-overview-tab.tsx.ejs +158 -45
  201. package/hedhog/frontend/app/courses/[id]/structure/_components/course-xp-overview-tab.tsx.ejs +13 -13
  202. package/hedhog/frontend/app/courses/[id]/structure/_components/detail-lesson-xp-tab.tsx.ejs +11 -23
  203. package/hedhog/frontend/app/courses/[id]/structure/_components/detail-lesson.tsx.ejs +51 -63
  204. package/hedhog/frontend/app/courses/[id]/structure/_components/detail-panel.tsx.ejs +8 -3
  205. package/hedhog/frontend/app/courses/[id]/structure/_components/detail-session.tsx.ejs +31 -8
  206. package/hedhog/frontend/app/courses/[id]/structure/_components/drag-overlay.tsx.ejs +16 -9
  207. package/hedhog/frontend/app/courses/[id]/structure/_components/editor-course.tsx.ejs +201 -401
  208. package/hedhog/frontend/app/courses/[id]/structure/_components/editor-lesson.tsx.ejs +378 -690
  209. package/hedhog/frontend/app/courses/[id]/structure/_components/mock-data.ts.ejs +1 -2
  210. package/hedhog/frontend/app/courses/[id]/structure/_components/tree-row-lesson.tsx.ejs +3 -9
  211. package/hedhog/frontend/app/courses/[id]/structure/_components/types.ts.ejs +1 -1
  212. package/hedhog/frontend/app/courses/[id]/structure/_components/xp-premium-pills.tsx.ejs +1 -8
  213. package/hedhog/frontend/app/courses/[id]/structure/_data/adapters/course-structure.adapter.ts.ejs +6 -10
  214. package/hedhog/frontend/app/courses/[id]/structure/_data/services/course-structure.service.ts.ejs +49 -0
  215. package/hedhog/frontend/app/courses/[id]/structure/_data/types/api-course.types.ts.ejs +4 -3
  216. package/hedhog/frontend/app/courses/[id]/structure/_data/use-course-content-overview.ts.ejs +2 -1
  217. package/hedhog/frontend/app/courses/[id]/structure/_data/use-course-exports.ts.ejs +106 -0
  218. package/hedhog/frontend/app/courses/[id]/structure/_data/use-course-structure-mutations.ts.ejs +28 -1
  219. package/hedhog/frontend/app/courses/[id]/structure/_data/use-lms-settings-query.ts.ejs +0 -2
  220. package/hedhog/frontend/app/courses/page.tsx.ejs +85 -9
  221. package/hedhog/frontend/app/enterprise/[id]/page.tsx.ejs +6 -0
  222. package/hedhog/frontend/app/enterprise/_components/enterprise-classes-calendar-tab.tsx.ejs +264 -0
  223. package/hedhog/frontend/app/enterprise/page.tsx.ejs +104 -47
  224. package/hedhog/frontend/app/exams/page.tsx.ejs +38 -4
  225. package/hedhog/frontend/app/instructors/page.tsx.ejs +87 -46
  226. package/hedhog/frontend/app/paths/page.tsx.ejs +38 -4
  227. package/hedhog/frontend/app/training/page.tsx.ejs +38 -4
  228. package/hedhog/frontend/messages/en.json +44 -28
  229. package/hedhog/frontend/messages/pt.json +47 -29
  230. package/hedhog/table/course_enrollment.yaml +3 -0
  231. package/hedhog/table/course_export.yaml +62 -0
  232. package/hedhog/table/lesson_view_event.yaml +66 -0
  233. package/package.json +14 -9
  234. package/src/bitcode-wallet/bitcode-wallet.service.ts +43 -4
  235. package/src/course/course-export-scorm12-worker.service.ts +124 -0
  236. package/src/course/course-export-scorm12.service.ts +668 -0
  237. package/src/course/course-export.service.ts +280 -0
  238. package/src/course/course-structure.controller.ts +16 -2
  239. package/src/course/course-structure.service.ts +100 -7
  240. package/src/course/course-video-agent-pipeline.service.ts +471 -0
  241. package/src/course/course-video-hls.service.ts +966 -0
  242. package/src/course/course.controller.ts +33 -19
  243. package/src/course/course.mcp-tools.ts +1 -1
  244. package/src/course/course.module.ts +16 -0
  245. package/src/course/course.service.ts +119 -61
  246. package/src/course/dto/cleanup-course-storage.dto.ts +1 -0
  247. package/src/course/dto/cleanup-upload-history.dto.ts +1 -1
  248. package/src/course/dto/create-course-bulk-job.dto.ts +7 -3
  249. package/src/course/dto/create-course-export.dto.ts +56 -0
  250. package/src/course/dto/create-course-structure-lesson.dto.ts +4 -3
  251. package/src/course/ffmpeg.util.ts +65 -0
  252. package/src/course/lms-bulk-upload-automation.service.ts +156 -6
  253. package/src/course/lms-bulk-upload-infra.service.ts +39 -6
  254. package/src/course/lms-bulk-upload.controller.ts +32 -2
  255. package/src/course/lms-bulk-upload.service.ts +70 -7
  256. package/src/course/lms-setting.controller.ts +4 -2
  257. package/src/course/scorm12-schemas.ts +9 -0
  258. package/src/enterprise/training/training-student.service.ts +221 -2
  259. package/src/evaluation/evaluation.service.ts +123 -0
  260. package/src/exam/dto/create-standalone-question.dto.ts +66 -0
  261. package/src/exam/exam.module.ts +2 -1
  262. package/src/exam/exam.service.ts +86 -0
  263. package/src/exam/question.controller.ts +28 -0
  264. package/src/lesson-xp-map/lesson-xp-ai-calculation.service.ts +205 -31
  265. package/src/lms-commerce-access.subscriber.ts +88 -0
  266. package/src/lms.module.ts +16 -5
  267. package/src/platforma/dto/heartbeat.dto.ts +30 -0
  268. package/src/platforma/handlers/emit-certificate.handler.ts +117 -0
  269. package/src/platforma/handlers/lesson-heartbeat.handler.ts +343 -0
  270. package/src/platforma/platforma-heartbeat.service.ts +33 -0
  271. package/src/platforma/platforma-performance.service.ts +606 -0
  272. package/src/platforma/platforma-search.service.ts +48 -0
  273. package/src/platforma/platforma-video.service.ts +346 -0
  274. package/src/platforma/platforma.controller.ts +137 -1
  275. package/src/platforma/platforma.service.ts +268 -268
  276. package/src/realtime/lms-realtime.controller.ts +27 -1
  277. package/src/realtime/lms-realtime.service.ts +2 -1
  278. package/src/student-xp/dto/grant-skill-card-xp.dto.ts +10 -0
  279. package/src/student-xp/student-xp.controller.ts +18 -2
  280. package/src/student-xp/student-xp.service.ts +84 -2
  281. package/hedhog/data/video_resolution_profile.yaml +0 -7
  282. package/hedhog/frontend/app/video-resolution-profiles/page.tsx.ejs +0 -607
  283. package/hedhog/table/course_video_resolution_profile.yaml +0 -22
  284. package/hedhog/table/video_resolution_profile.yaml +0 -18
  285. package/src/video-resolution-profile/dto/create-video-resolution-profile.dto.ts +0 -16
  286. package/src/video-resolution-profile/dto/update-video-resolution-profile.dto.ts +0 -16
  287. package/src/video-resolution-profile/video-resolution-profile.controller.ts +0 -62
  288. package/src/video-resolution-profile/video-resolution-profile.mcp-tools.ts +0 -128
  289. package/src/video-resolution-profile/video-resolution-profile.module.ts +0 -13
  290. package/src/video-resolution-profile/video-resolution-profile.service.ts +0 -117
@@ -0,0 +1,398 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ var __importDefault = (this && this.__importDefault) || function (mod) {
15
+ return (mod && mod.__esModule) ? mod : { "default": mod };
16
+ };
17
+ var CourseVideoAgentPipelineService_1;
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ exports.CourseVideoAgentPipelineService = exports.LMS_TRANSCRIPTION_SAVE_JOB = exports.LMS_AUDIO_TRANSCRIBE_CHUNKS_JOB = exports.LMS_AUDIO_SPLIT_JOB = exports.LMS_AUDIO_EXTRACT_JOB = exports.VIDEO_PROCESSING_AGENT_SLUG = void 0;
20
+ const api_prisma_1 = require("@hed-hog/api-prisma");
21
+ const core_1 = require("@hed-hog/core");
22
+ const queue_1 = require("@hed-hog/queue");
23
+ const agent_1 = require("@hed-hog/agent");
24
+ const common_1 = require("@nestjs/common");
25
+ const axios_1 = __importDefault(require("axios"));
26
+ const child_process_1 = require("child_process");
27
+ const fs_1 = require("fs");
28
+ const os_1 = require("os");
29
+ const path_1 = require("path");
30
+ const util_1 = require("util");
31
+ const course_video_hls_service_1 = require("./course-video-hls.service");
32
+ const ffmpeg_util_1 = require("./ffmpeg.util");
33
+ const execFileAsync = (0, util_1.promisify)(child_process_1.execFile);
34
+ exports.VIDEO_PROCESSING_AGENT_SLUG = 'lms-video-processing';
35
+ exports.LMS_AUDIO_EXTRACT_JOB = 'lms.audio.extract';
36
+ exports.LMS_AUDIO_SPLIT_JOB = 'lms.audio.split';
37
+ exports.LMS_AUDIO_TRANSCRIBE_CHUNKS_JOB = 'lms.audio.transcribe.chunks';
38
+ exports.LMS_TRANSCRIPTION_SAVE_JOB = 'lms.transcription.save';
39
+ const CHUNK_SECONDS = 60;
40
+ /**
41
+ * Decomposed, queue-backed steps of the LMS video transcription pipeline, orchestrated by the
42
+ * seeded `lms-video-processing` agent flow via `tool.queue_dispatch` (dispatch-and-wait).
43
+ *
44
+ * Each step is its own job so it is visible both in the queue dashboard and the agent run
45
+ * timeline. Intermediates are persisted (audio + chunk + transcript files) and only small
46
+ * file-id references travel through the agent state between steps. The existing monolithic
47
+ * `lms.audio.transcribe` job and legacy paths are left untouched.
48
+ */
49
+ let CourseVideoAgentPipelineService = CourseVideoAgentPipelineService_1 = class CourseVideoAgentPipelineService {
50
+ constructor(prisma, fileService, settingService, registry, dbQueue, agentRuntime, hlsService) {
51
+ this.prisma = prisma;
52
+ this.fileService = fileService;
53
+ this.settingService = settingService;
54
+ this.registry = registry;
55
+ this.dbQueue = dbQueue;
56
+ this.agentRuntime = agentRuntime;
57
+ this.hlsService = hlsService;
58
+ this.logger = new common_1.Logger(CourseVideoAgentPipelineService_1.name);
59
+ }
60
+ get db() {
61
+ return this.prisma;
62
+ }
63
+ onModuleInit() {
64
+ for (const type of [
65
+ exports.LMS_AUDIO_EXTRACT_JOB,
66
+ exports.LMS_AUDIO_SPLIT_JOB,
67
+ exports.LMS_AUDIO_TRANSCRIBE_CHUNKS_JOB,
68
+ exports.LMS_TRANSCRIPTION_SAVE_JOB,
69
+ ]) {
70
+ this.registry.register(type, this);
71
+ }
72
+ this.logger.log(`Registered handlers for ${exports.LMS_AUDIO_EXTRACT_JOB}, ${exports.LMS_AUDIO_SPLIT_JOB}, ${exports.LMS_AUDIO_TRANSCRIBE_CHUNKS_JOB}, ${exports.LMS_TRANSCRIPTION_SAVE_JOB}`);
73
+ }
74
+ // ───────────────────────────── orchestration entry ─────────────────────────────
75
+ /**
76
+ * Validates the lesson/original, registers the `video_original` file, and starts the seeded
77
+ * `lms-video-processing` agent run (async). Falls back to the legacy monolithic HLS pipeline
78
+ * when the agent flow is not seeded yet, so the feature degrades gracefully during rollout.
79
+ */
80
+ async startProcessing(params) {
81
+ var _a, _b, _c;
82
+ const agent = await this.db.agent.findUnique({
83
+ where: { slug: exports.VIDEO_PROCESSING_AGENT_SLUG },
84
+ select: { id: true, status: true },
85
+ });
86
+ if (!agent || agent.status === 'archived') {
87
+ this.logger.warn(`Agent "${exports.VIDEO_PROCESSING_AGENT_SLUG}" unavailable — falling back to legacy enqueueHls.`);
88
+ const legacy = await this.hlsService.enqueueHls(params);
89
+ return { agentRunId: null, status: legacy.status };
90
+ }
91
+ await this.hlsService.prepareLessonForProcessing({
92
+ courseId: params.courseId,
93
+ sessionId: params.sessionId,
94
+ lessonId: params.lessonId,
95
+ originalFileId: params.originalFileId,
96
+ });
97
+ const settings = await this.settingService.getSettingValues([
98
+ 'lms-audio-transcription-enabled',
99
+ ]);
100
+ const transcriptionEnabled = settings['lms-audio-transcription-enabled'] !== false;
101
+ const course = await this.db.course.findUnique({
102
+ where: { id: params.courseId },
103
+ include: { locale: true },
104
+ });
105
+ const localeCode = (_b = (_a = course === null || course === void 0 ? void 0 : course.locale) === null || _a === void 0 ? void 0 : _a.code) !== null && _b !== void 0 ? _b : 'pt';
106
+ const run = await this.agentRuntime.startManualRun(agent.id, {
107
+ course_id: params.courseId,
108
+ session_id: params.sessionId,
109
+ lesson_id: params.lessonId,
110
+ original_file_id: params.originalFileId,
111
+ user_id: params.userId,
112
+ transcription_enabled: transcriptionEnabled,
113
+ locale_code: localeCode,
114
+ }, params.userId);
115
+ this.logger.log(`Started agent run ${run === null || run === void 0 ? void 0 : run.id} for lesson ${params.lessonId} (transcription=${transcriptionEnabled}).`);
116
+ return { agentRunId: (_c = run === null || run === void 0 ? void 0 : run.id) !== null && _c !== void 0 ? _c : null, status: 'started' };
117
+ }
118
+ // ───────────────────────────── job dispatch ─────────────────────────────
119
+ async handle(job) {
120
+ switch (job.type) {
121
+ case exports.LMS_AUDIO_EXTRACT_JOB:
122
+ return this.handleExtract(job);
123
+ case exports.LMS_AUDIO_SPLIT_JOB:
124
+ return this.handleSplit(job);
125
+ case exports.LMS_AUDIO_TRANSCRIBE_CHUNKS_JOB:
126
+ return this.handleTranscribeChunks(job);
127
+ case exports.LMS_TRANSCRIPTION_SAVE_JOB:
128
+ return this.handleSave(job);
129
+ default:
130
+ throw new queue_1.NonRetryableError(`Unsupported job type "${job.type}"`);
131
+ }
132
+ }
133
+ /** Step: extract a 16 kHz mono mp3 from the original video and persist it as lesson_audio. */
134
+ async handleExtract(job) {
135
+ var _a, _b, _c, _d, _e;
136
+ const courseId = Number((_a = job.payload) === null || _a === void 0 ? void 0 : _a.courseId);
137
+ const lessonId = Number((_b = job.payload) === null || _b === void 0 ? void 0 : _b.lessonId);
138
+ const originalFileId = Number((_c = job.payload) === null || _c === void 0 ? void 0 : _c.originalFileId);
139
+ if (!lessonId || !originalFileId) {
140
+ throw new queue_1.NonRetryableError('lms.audio.extract: lessonId and originalFileId are required.');
141
+ }
142
+ const workDir = await fs_1.promises.mkdtemp((0, path_1.join)((0, os_1.tmpdir)(), `lms-extract-${job.id}-`));
143
+ const inputPath = (0, path_1.join)(workDir, `original-${originalFileId}`);
144
+ const mp3Path = (0, path_1.join)(workDir, `lesson_${lessonId}_audio.mp3`);
145
+ try {
146
+ await this.fileService.downloadToPath(originalFileId, inputPath);
147
+ await execFileAsync((0, ffmpeg_util_1.getFfmpegCommand)(), ['-y', '-i', inputPath, '-vn', '-ar', '16000', '-ac', '1', '-c:a', 'libmp3lame', '-b:a', '32k', mp3Path], { maxBuffer: 1024 * 1024 * 20, windowsHide: true });
148
+ const course = await this.db.course.findUnique({
149
+ where: { id: courseId },
150
+ select: { locale_id: true },
151
+ });
152
+ const uploaded = await this.fileService.uploadFromPath('lms/lessons/audio', mp3Path, {
153
+ originalname: (0, path_1.basename)(mp3Path),
154
+ mimetype: 'audio/mp3',
155
+ });
156
+ const defaultLocale = await this.db.locale.findFirst({
157
+ where: { OR: [{ code: 'pt-BR' }, { code: 'pt' }] },
158
+ select: { id: true },
159
+ orderBy: { id: 'asc' },
160
+ });
161
+ const resolvedLocaleId = (_e = (_d = course === null || course === void 0 ? void 0 : course.locale_id) !== null && _d !== void 0 ? _d : defaultLocale === null || defaultLocale === void 0 ? void 0 : defaultLocale.id) !== null && _e !== void 0 ? _e : null;
162
+ const existing = await this.db.course_lesson_file.findFirst({
163
+ where: { course_lesson_id: lessonId, type: 'lesson_audio' },
164
+ select: { id: true },
165
+ });
166
+ if (existing) {
167
+ await this.db.course_lesson_file.update({
168
+ where: { id: existing.id },
169
+ data: { file_id: uploaded.id, locale_id: resolvedLocaleId, title: 'Audio Original.mp3', type: 'lesson_audio', is_public: false },
170
+ });
171
+ }
172
+ else {
173
+ await this.db.course_lesson_file.create({
174
+ data: { course_lesson_id: lessonId, file_id: uploaded.id, title: 'Audio Original.mp3', type: 'lesson_audio', is_public: false, locale_id: resolvedLocaleId },
175
+ });
176
+ }
177
+ this.logger.log(`[extract job=${job.id}] lesson ${lessonId} audio fileId=${uploaded.id}`);
178
+ return { audioFileId: uploaded.id };
179
+ }
180
+ finally {
181
+ await fs_1.promises.rm(workDir, { recursive: true, force: true }).catch(() => undefined);
182
+ }
183
+ }
184
+ /** Step: split the lesson audio into 60s chunks, uploaded to a staging prefix. */
185
+ async handleSplit(job) {
186
+ var _a, _b;
187
+ const lessonId = Number((_a = job.payload) === null || _a === void 0 ? void 0 : _a.lessonId);
188
+ const audioFileId = Number((_b = job.payload) === null || _b === void 0 ? void 0 : _b.audioFileId);
189
+ if (!lessonId || !audioFileId) {
190
+ throw new queue_1.NonRetryableError('lms.audio.split: lessonId and audioFileId are required.');
191
+ }
192
+ const workDir = await fs_1.promises.mkdtemp((0, path_1.join)((0, os_1.tmpdir)(), `lms-split-${job.id}-`));
193
+ const sourceAudioPath = (0, path_1.join)(workDir, `audio_${lessonId}.source`);
194
+ const normalizedAudioPath = (0, path_1.join)(workDir, `audio_${lessonId}.normalized.mp3`);
195
+ try {
196
+ await this.fileService.downloadToPath(audioFileId, sourceAudioPath);
197
+ await execFileAsync((0, ffmpeg_util_1.getFfmpegCommand)(), ['-y', '-i', sourceAudioPath, '-ar', '16000', '-ac', '1', '-c:a', 'libmp3lame', '-b:a', '32k', normalizedAudioPath], { maxBuffer: 1024 * 1024 * 20, windowsHide: true });
198
+ const chunkPattern = (0, path_1.join)(workDir, 'chunk_%04d.mp3');
199
+ await execFileAsync((0, ffmpeg_util_1.getFfmpegCommand)(), ['-y', '-i', normalizedAudioPath, '-f', 'segment', '-segment_time', String(CHUNK_SECONDS), '-ar', '16000', '-ac', '1', '-c:a', 'libmp3lame', '-b:a', '32k', chunkPattern], { maxBuffer: 1024 * 1024 * 20, windowsHide: true });
200
+ const chunkNames = (await fs_1.promises.readdir(workDir))
201
+ .filter((n) => n.startsWith('chunk_') && n.endsWith('.mp3'))
202
+ .sort((a, b) => a.localeCompare(b));
203
+ const chunkFileIds = [];
204
+ for (const name of chunkNames) {
205
+ const uploaded = await this.fileService.uploadFromPath(`lms/lessons/transcribe-chunks/${lessonId}`, (0, path_1.join)(workDir, name), { originalname: name, mimetype: 'audio/mpeg' });
206
+ chunkFileIds.push(uploaded.id);
207
+ }
208
+ this.logger.log(`[split job=${job.id}] lesson ${lessonId} → ${chunkFileIds.length} chunk(s)`);
209
+ return { chunkFileIds, chunkCount: chunkFileIds.length };
210
+ }
211
+ finally {
212
+ await fs_1.promises.rm(workDir, { recursive: true, force: true }).catch(() => undefined);
213
+ }
214
+ }
215
+ /** Step: transcribe each chunk via OpenAI Whisper and persist the merged transcript JSON. */
216
+ async handleTranscribeChunks(job) {
217
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
218
+ const courseId = Number((_a = job.payload) === null || _a === void 0 ? void 0 : _a.courseId);
219
+ const lessonId = Number((_b = job.payload) === null || _b === void 0 ? void 0 : _b.lessonId);
220
+ const chunkFileIds = this.parseIdArray((_c = job.payload) === null || _c === void 0 ? void 0 : _c.chunkFileIds);
221
+ if (!lessonId || chunkFileIds.length === 0) {
222
+ throw new queue_1.NonRetryableError('lms.audio.transcribe.chunks: lessonId and chunkFileIds are required.');
223
+ }
224
+ const apiKey = await this.resolveOpenAiKey();
225
+ const course = await this.db.course.findUnique({
226
+ where: { id: courseId },
227
+ include: { locale: true },
228
+ });
229
+ const language = (_e = (_d = course === null || course === void 0 ? void 0 : course.locale) === null || _d === void 0 ? void 0 : _d.code) !== null && _e !== void 0 ? _e : 'pt';
230
+ const workDir = await fs_1.promises.mkdtemp((0, path_1.join)((0, os_1.tmpdir)(), `lms-transcribe-${job.id}-`));
231
+ try {
232
+ const segments = [];
233
+ for (let i = 0; i < chunkFileIds.length; i += 1) {
234
+ const chunkPath = (0, path_1.join)(workDir, `chunk_${i}.mp3`);
235
+ await this.fileService.downloadToPath(chunkFileIds[i], chunkPath);
236
+ const offsetSeconds = i * CHUNK_SECONDS;
237
+ const buffer = await fs_1.promises.readFile(chunkPath);
238
+ const formData = new FormData();
239
+ formData.append('file', new Blob([buffer], { type: 'audio/mpeg' }), `chunk_${i}.mp3`);
240
+ formData.append('model', 'whisper-1');
241
+ formData.append('response_format', 'verbose_json');
242
+ formData.append('language', language);
243
+ const headers = { Authorization: `Bearer ${apiKey}` };
244
+ const maybeHeaders = (_g = (_f = formData).getHeaders) === null || _g === void 0 ? void 0 : _g.call(_f);
245
+ if (maybeHeaders && typeof maybeHeaders === 'object')
246
+ Object.assign(headers, maybeHeaders);
247
+ const response = await axios_1.default.post('https://api.openai.com/v1/audio/transcriptions', formData, { headers });
248
+ for (const segment of (_j = (_h = response.data) === null || _h === void 0 ? void 0 : _h.segments) !== null && _j !== void 0 ? _j : []) {
249
+ const text = String((_k = segment === null || segment === void 0 ? void 0 : segment.text) !== null && _k !== void 0 ? _k : '').trim();
250
+ if (!text)
251
+ continue;
252
+ segments.push({
253
+ course_lesson_id: lessonId,
254
+ start_seconds: offsetSeconds + Number((_l = segment === null || segment === void 0 ? void 0 : segment.start) !== null && _l !== void 0 ? _l : 0),
255
+ end_seconds: offsetSeconds + Number((_m = segment === null || segment === void 0 ? void 0 : segment.end) !== null && _m !== void 0 ? _m : 0),
256
+ text,
257
+ });
258
+ }
259
+ }
260
+ const transcriptPath = (0, path_1.join)(workDir, `transcript_${lessonId}.json`);
261
+ await fs_1.promises.writeFile(transcriptPath, JSON.stringify({ lessonId, segments }), 'utf8');
262
+ const uploaded = await this.fileService.uploadFromPath(`lms/lessons/transcripts/${lessonId}`, transcriptPath, { originalname: `transcript_${lessonId}.json`, mimetype: 'application/json' });
263
+ this.logger.log(`[transcribe job=${job.id}] lesson ${lessonId} → ${segments.length} segment(s)`);
264
+ return { transcriptFileId: uploaded.id, segmentCount: segments.length };
265
+ }
266
+ finally {
267
+ await fs_1.promises.rm(workDir, { recursive: true, force: true }).catch(() => undefined);
268
+ }
269
+ }
270
+ /** Step: join + persist the transcript segments and trigger XP calculation. */
271
+ async handleSave(job) {
272
+ var _a, _b, _c;
273
+ const lessonId = Number((_a = job.payload) === null || _a === void 0 ? void 0 : _a.lessonId);
274
+ const transcriptFileId = Number((_b = job.payload) === null || _b === void 0 ? void 0 : _b.transcriptFileId);
275
+ const userId = Number((_c = job.payload) === null || _c === void 0 ? void 0 : _c.userId) || 0;
276
+ if (!lessonId || !transcriptFileId) {
277
+ throw new queue_1.NonRetryableError('lms.transcription.save: lessonId and transcriptFileId are required.');
278
+ }
279
+ const workDir = await fs_1.promises.mkdtemp((0, path_1.join)((0, os_1.tmpdir)(), `lms-tsave-${job.id}-`));
280
+ try {
281
+ const transcriptPath = (0, path_1.join)(workDir, 'transcript.json');
282
+ await this.fileService.downloadToPath(transcriptFileId, transcriptPath);
283
+ const parsed = JSON.parse(await fs_1.promises.readFile(transcriptPath, 'utf8'));
284
+ const segments = Array.isArray(parsed === null || parsed === void 0 ? void 0 : parsed.segments)
285
+ ? parsed.segments
286
+ : [];
287
+ await this.prisma.$transaction([
288
+ this.db.course_lesson_transcription_segment.deleteMany({
289
+ where: { course_lesson_id: lessonId },
290
+ }),
291
+ this.db.course_lesson_transcription_segment.createMany({
292
+ data: segments.map((s) => {
293
+ var _a, _b, _c;
294
+ return ({
295
+ course_lesson_id: lessonId,
296
+ start_seconds: Number((_a = s === null || s === void 0 ? void 0 : s.start_seconds) !== null && _a !== void 0 ? _a : 0),
297
+ end_seconds: Number((_b = s === null || s === void 0 ? void 0 : s.end_seconds) !== null && _b !== void 0 ? _b : 0),
298
+ text: String((_c = s === null || s === void 0 ? void 0 : s.text) !== null && _c !== void 0 ? _c : ''),
299
+ });
300
+ }),
301
+ }),
302
+ ]);
303
+ this.logger.log(`[save job=${job.id}] lesson ${lessonId} saved ${segments.length} segment(s)`);
304
+ await this.triggerXpCalculation(lessonId, userId);
305
+ return { saved: segments.length };
306
+ }
307
+ finally {
308
+ await fs_1.promises.rm(workDir, { recursive: true, force: true }).catch(() => undefined);
309
+ }
310
+ }
311
+ // ───────────────────────────── helpers ─────────────────────────────
312
+ parseIdArray(raw) {
313
+ let arr = raw;
314
+ if (typeof raw === 'string') {
315
+ try {
316
+ arr = JSON.parse(raw);
317
+ }
318
+ catch (_a) {
319
+ arr = [];
320
+ }
321
+ }
322
+ if (!Array.isArray(arr))
323
+ return [];
324
+ return arr.map((x) => Number(x)).filter((n) => Number.isFinite(n) && n > 0);
325
+ }
326
+ async resolveOpenAiKey() {
327
+ const settings = await this.settingService.getSettingValues(['ai-openai-profile-id']);
328
+ const profileId = Number(settings['ai-openai-profile-id']);
329
+ let apiKey = '';
330
+ if (profileId) {
331
+ const profile = await this.db.integration_profile.findUnique({
332
+ where: { id: profileId },
333
+ include: { integration_provider: { select: { slug: true } } },
334
+ });
335
+ if (profile) {
336
+ apiKey = (0, core_1.buildAiConfigFromIntegration)(profile.integration_provider.slug, profile.config).apiKey;
337
+ }
338
+ }
339
+ if (!apiKey) {
340
+ throw new queue_1.NonRetryableError('Transcrição de áudio requer um perfil OpenAI configurado (Settings → LMS → ai-openai-profile-id).');
341
+ }
342
+ return apiKey;
343
+ }
344
+ async triggerXpCalculation(lessonId, userId) {
345
+ try {
346
+ const existingMap = await this.db.lesson_xp_map.findUnique({
347
+ where: { course_lesson_id: lessonId },
348
+ select: { id: true },
349
+ });
350
+ let mapId;
351
+ if (existingMap) {
352
+ mapId = existingMap.id;
353
+ await this.prisma.$executeRawUnsafe(`UPDATE lesson_xp_map
354
+ SET status = 'processing'::lesson_xp_map_status_d4e5f6a7b8_enum,
355
+ processing_error = NULL,
356
+ updated_at = NOW()
357
+ WHERE id = $1`, mapId);
358
+ }
359
+ else {
360
+ const rows = await this.prisma.$queryRawUnsafe(`INSERT INTO lesson_xp_map (course_lesson_id, version, total_xp, status, created_at, updated_at)
361
+ VALUES ($1, 1, 0, 'processing'::lesson_xp_map_status_d4e5f6a7b8_enum, NOW(), NOW())
362
+ RETURNING id`, lessonId);
363
+ mapId = rows[0].id;
364
+ }
365
+ await this.dbQueue.enqueue({
366
+ type: 'lms.lesson.xp.calculate',
367
+ queueName: 'lms.lesson.xp.calculate',
368
+ payload: { lessonId, mapId, userId },
369
+ maxAttempts: 3,
370
+ sourceModule: 'lms',
371
+ sourceEntity: 'course_lesson',
372
+ sourceEntityId: String(lessonId),
373
+ });
374
+ }
375
+ catch (err) {
376
+ this.logger.warn(`Failed to enqueue XP calculation for lesson ${lessonId}: ${err instanceof Error ? err.message : String(err)}`);
377
+ }
378
+ }
379
+ };
380
+ exports.CourseVideoAgentPipelineService = CourseVideoAgentPipelineService;
381
+ exports.CourseVideoAgentPipelineService = CourseVideoAgentPipelineService = CourseVideoAgentPipelineService_1 = __decorate([
382
+ (0, common_1.Injectable)(),
383
+ __param(0, (0, common_1.Inject)((0, common_1.forwardRef)(() => api_prisma_1.PrismaService))),
384
+ __param(1, (0, common_1.Inject)((0, common_1.forwardRef)(() => core_1.FileService))),
385
+ __param(2, (0, common_1.Inject)((0, common_1.forwardRef)(() => core_1.SettingService))),
386
+ __param(3, (0, common_1.Inject)((0, common_1.forwardRef)(() => queue_1.QueueHandlerRegistry))),
387
+ __param(4, (0, common_1.Inject)((0, common_1.forwardRef)(() => queue_1.DatabaseQueueProvider))),
388
+ __param(5, (0, common_1.Inject)((0, common_1.forwardRef)(() => agent_1.AgentRuntimeService))),
389
+ __param(6, (0, common_1.Inject)((0, common_1.forwardRef)(() => course_video_hls_service_1.CourseVideoHlsService))),
390
+ __metadata("design:paramtypes", [api_prisma_1.PrismaService,
391
+ core_1.FileService,
392
+ core_1.SettingService,
393
+ queue_1.QueueHandlerRegistry,
394
+ queue_1.DatabaseQueueProvider,
395
+ agent_1.AgentRuntimeService,
396
+ course_video_hls_service_1.CourseVideoHlsService])
397
+ ], CourseVideoAgentPipelineService);
398
+ //# sourceMappingURL=course-video-agent-pipeline.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"course-video-agent-pipeline.service.js","sourceRoot":"","sources":["../../src/course/course-video-agent-pipeline.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,oDAAoD;AACpD,wCAA0F;AAC1F,0CAKwB;AACxB,0CAAqD;AACrD,2CAAsF;AACtF,kDAA0B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C,CAAC,CAAA;IAErC,WAAA,IAAA,eAAM,EAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,qBAAc,CAAC,CAAC,CAAA;IAExC,WAAA,IAAA,eAAM,EAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,4BAAoB,CAAC,CAAC,CAAA;IAE9C,WAAA,IAAA,eAAM,EAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,6BAAqB,CAAC,CAAC,CAAA;IAE/C,WAAA,IAAA,eAAM,EAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,2BAAmB,CAAC,CAAC,CAAA;IAE7C,WAAA,IAAA,eAAM,EAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,gDAAqB,CAAC,CAAC,CAAA;qCAXvB,0BAAa;QAER,kBAAW;QAER,qBAAc;QAEpB,4BAAoB;QAErB,6BAAqB;QAEhB,2BAAmB;QAErB,gDAAqB;GAjBzC,+BAA+B,CAqa3C"}
@@ -0,0 +1,71 @@
1
+ import { PrismaService } from '@hed-hog/api-prisma';
2
+ import { FileService, NotificationService, SettingService } from '@hed-hog/core';
3
+ import { IJobHandler, QueueHandlerRegistry, QueueJobService } from '@hed-hog/queue';
4
+ import { OnModuleInit } from '@nestjs/common';
5
+ export declare const LMS_VIDEO_HLS_JOB = "lms.video.hls";
6
+ export declare class CourseVideoHlsService implements OnModuleInit, IJobHandler {
7
+ private readonly prisma;
8
+ private readonly fileService;
9
+ private readonly settingService;
10
+ private readonly notificationService;
11
+ private readonly registry;
12
+ private readonly queueJob;
13
+ private readonly logger;
14
+ constructor(prisma: PrismaService, fileService: FileService, settingService: SettingService, notificationService: NotificationService, registry: QueueHandlerRegistry, queueJob: QueueJobService);
15
+ onModuleInit(): void;
16
+ /**
17
+ * Validates a lesson is an eligible file-storage video and registers the uploaded original
18
+ * as its `video_original` file. Shared by the legacy `enqueueHls` path and the new
19
+ * agent-orchestrated pipeline (CourseVideoAgentPipelineService.startProcessing).
20
+ */
21
+ prepareLessonForProcessing(params: {
22
+ courseId: number;
23
+ sessionId: number;
24
+ lessonId: number;
25
+ originalFileId: number;
26
+ }): Promise<{
27
+ content: Record<string, unknown> | null;
28
+ original: any;
29
+ }>;
30
+ enqueueHls(params: {
31
+ userId: number;
32
+ courseId: number;
33
+ sessionId: number;
34
+ lessonId: number;
35
+ originalFileId: number;
36
+ }): Promise<{
37
+ queueJobId: any;
38
+ status: string;
39
+ }>;
40
+ handle(job: {
41
+ id: number;
42
+ type: string;
43
+ queue_name: string;
44
+ payload: Record<string, any>;
45
+ attempts: number;
46
+ max_attempts: number;
47
+ source_module?: string | null;
48
+ source_entity?: string | null;
49
+ source_entity_id?: string | null;
50
+ }): Promise<any>;
51
+ private generateHls;
52
+ private uploadHlsDirectory;
53
+ private parseResolutions;
54
+ private buildHlsVariants;
55
+ private probeVideoHeight;
56
+ private probeDurationSeconds;
57
+ private extractAndUploadLessonFrames;
58
+ private extractAndUploadLessonAudio;
59
+ private upsertLessonFile;
60
+ private createProgressEvent;
61
+ private resolveNotificationProgress;
62
+ private updateAsyncNotification;
63
+ private parseContent;
64
+ private isVideoFile;
65
+ private resolveFrameIntervalSeconds;
66
+ private getPositiveIntegerEnv;
67
+ private getFfmpegCommand;
68
+ private getFfprobeCommand;
69
+ private findWindowsBinary;
70
+ }
71
+ //# sourceMappingURL=course-video-hls.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"course-video-hls.service.d.ts","sourceRoot":"","sources":["../../src/course/course-video-hls.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACjF,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACpF,OAAO,EAML,YAAY,EAEb,MAAM,gBAAgB,CAAC;AAOxB,eAAO,MAAM,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