@headless-lms/server 0.1.0 → 0.3.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 (351) hide show
  1. package/README.md +1 -1
  2. package/dist/_virtual/_rolldown/runtime.js +5 -0
  3. package/dist/app/community-mail.d.ts +26 -0
  4. package/dist/app/community-mail.js +96 -0
  5. package/dist/app/community-mail.js.map +1 -0
  6. package/dist/app/container.d.ts +22 -14
  7. package/dist/app/container.js +186 -62
  8. package/dist/app/container.js.map +1 -1
  9. package/dist/app/mcp-endpoints.d.ts +13 -0
  10. package/dist/app/mcp-endpoints.js +25 -0
  11. package/dist/app/mcp-endpoints.js.map +1 -0
  12. package/dist/http/config.d.ts +2 -1
  13. package/dist/http/errors.d.ts +14 -0
  14. package/dist/http/errors.js +147 -0
  15. package/dist/http/errors.js.map +1 -0
  16. package/dist/http/mcp/catalogue.d.ts +37 -0
  17. package/dist/http/mcp/catalogue.js +69 -0
  18. package/dist/http/mcp/catalogue.js.map +1 -0
  19. package/dist/http/mcp/challenge.d.ts +7 -0
  20. package/dist/http/mcp/challenge.js +35 -0
  21. package/dist/http/mcp/challenge.js.map +1 -0
  22. package/dist/http/mcp/input-schema.d.ts +7 -0
  23. package/dist/http/mcp/input-schema.js +28 -0
  24. package/dist/http/mcp/input-schema.js.map +1 -0
  25. package/dist/http/mcp/route.d.ts +8 -0
  26. package/dist/http/mcp/route.js +75 -0
  27. package/dist/http/mcp/route.js.map +1 -0
  28. package/dist/http/mcp/server.d.ts +8 -0
  29. package/dist/http/mcp/server.js +31 -0
  30. package/dist/http/mcp/server.js.map +1 -0
  31. package/dist/http/mcp/test-support.d.ts +55 -0
  32. package/dist/http/mcp/test-support.js +151 -0
  33. package/dist/http/mcp/test-support.js.map +1 -0
  34. package/dist/http/mcp/tool.d.ts +48 -0
  35. package/dist/http/mcp/tool.js +58 -0
  36. package/dist/http/mcp/tool.js.map +1 -0
  37. package/dist/http/mcp/tools/automations.d.ts +6 -0
  38. package/dist/http/mcp/tools/automations.js +120 -0
  39. package/dist/http/mcp/tools/automations.js.map +1 -0
  40. package/dist/http/mcp/tools/catalog.d.ts +6 -0
  41. package/dist/http/mcp/tools/catalog.js +200 -0
  42. package/dist/http/mcp/tools/catalog.js.map +1 -0
  43. package/dist/http/mcp/tools/comments.d.ts +6 -0
  44. package/dist/http/mcp/tools/comments.js +70 -0
  45. package/dist/http/mcp/tools/comments.js.map +1 -0
  46. package/dist/http/mcp/tools/communities.d.ts +6 -0
  47. package/dist/http/mcp/tools/communities.js +175 -0
  48. package/dist/http/mcp/tools/communities.js.map +1 -0
  49. package/dist/http/mcp/tools/community-members.d.ts +6 -0
  50. package/dist/http/mcp/tools/community-members.js +89 -0
  51. package/dist/http/mcp/tools/community-members.js.map +1 -0
  52. package/dist/http/mcp/tools/community-moderation.d.ts +6 -0
  53. package/dist/http/mcp/tools/community-moderation.js +144 -0
  54. package/dist/http/mcp/tools/community-moderation.js.map +1 -0
  55. package/dist/http/mcp/tools/courses.d.ts +6 -0
  56. package/dist/http/mcp/tools/courses.js +121 -0
  57. package/dist/http/mcp/tools/courses.js.map +1 -0
  58. package/dist/http/mcp/tools/index.d.ts +6 -0
  59. package/dist/http/mcp/tools/index.js +23 -0
  60. package/dist/http/mcp/tools/index.js.map +1 -0
  61. package/dist/http/mcp/tools/people.d.ts +6 -0
  62. package/dist/http/mcp/tools/people.js +145 -0
  63. package/dist/http/mcp/tools/people.js.map +1 -0
  64. package/dist/http/plugins/auth.js +13 -5
  65. package/dist/http/plugins/auth.js.map +1 -1
  66. package/dist/http/plugins/error-handler.d.ts +3 -2
  67. package/dist/http/plugins/error-handler.js +52 -57
  68. package/dist/http/plugins/error-handler.js.map +1 -1
  69. package/dist/http/plugins/openapi.js +70 -20
  70. package/dist/http/plugins/openapi.js.map +1 -1
  71. package/dist/http/routes/access.d.ts +7 -0
  72. package/dist/http/routes/access.js +140 -0
  73. package/dist/http/routes/access.js.map +1 -0
  74. package/dist/http/routes/activities.js +97 -20
  75. package/dist/http/routes/activities.js.map +1 -1
  76. package/dist/http/routes/assets.js +60 -51
  77. package/dist/http/routes/assets.js.map +1 -1
  78. package/dist/http/routes/automations.js +64 -20
  79. package/dist/http/routes/automations.js.map +1 -1
  80. package/dist/http/routes/bundles.d.ts +7 -0
  81. package/dist/http/routes/bundles.js +181 -0
  82. package/dist/http/routes/bundles.js.map +1 -0
  83. package/dist/http/routes/communities.d.ts +7 -0
  84. package/dist/http/routes/communities.js +462 -0
  85. package/dist/http/routes/communities.js.map +1 -0
  86. package/dist/http/routes/community-moderation.d.ts +7 -0
  87. package/dist/http/routes/community-moderation.js +425 -0
  88. package/dist/http/routes/community-moderation.js.map +1 -0
  89. package/dist/http/routes/course-analytics.d.ts +7 -0
  90. package/dist/http/routes/course-analytics.js +60 -0
  91. package/dist/http/routes/course-analytics.js.map +1 -0
  92. package/dist/http/routes/courses.js +38 -23
  93. package/dist/http/routes/courses.js.map +1 -1
  94. package/dist/http/routes/dashboard.js +17 -8
  95. package/dist/http/routes/dashboard.js.map +1 -1
  96. package/dist/http/routes/discussion.js +35 -27
  97. package/dist/http/routes/discussion.js.map +1 -1
  98. package/dist/http/routes/downloads.js +58 -40
  99. package/dist/http/routes/downloads.js.map +1 -1
  100. package/dist/http/routes/entitlements.js +16 -7
  101. package/dist/http/routes/entitlements.js.map +1 -1
  102. package/dist/http/routes/integrations.js +38 -41
  103. package/dist/http/routes/integrations.js.map +1 -1
  104. package/dist/http/routes/member/actor.d.ts +14 -0
  105. package/dist/http/routes/member/actor.js +11 -0
  106. package/dist/http/routes/member/actor.js.map +1 -0
  107. package/dist/http/routes/member/assets.d.ts +7 -0
  108. package/dist/http/routes/member/assets.js +79 -0
  109. package/dist/http/routes/member/assets.js.map +1 -0
  110. package/dist/http/routes/member/chats.d.ts +7 -0
  111. package/dist/http/routes/member/chats.js +456 -0
  112. package/dist/http/routes/member/chats.js.map +1 -0
  113. package/dist/http/routes/member/comments.d.ts +7 -0
  114. package/dist/http/routes/member/comments.js +187 -0
  115. package/dist/http/routes/member/comments.js.map +1 -0
  116. package/dist/http/routes/member/community.d.ts +7 -0
  117. package/dist/http/routes/member/community.js +288 -0
  118. package/dist/http/routes/member/community.js.map +1 -0
  119. package/dist/http/routes/member/courses.d.ts +7 -0
  120. package/dist/http/routes/member/courses.js +101 -0
  121. package/dist/http/routes/member/courses.js.map +1 -0
  122. package/dist/http/routes/member/downloads.d.ts +7 -0
  123. package/dist/http/routes/member/downloads.js +56 -0
  124. package/dist/http/routes/member/downloads.js.map +1 -0
  125. package/dist/http/routes/member/files.d.ts +7 -0
  126. package/dist/http/routes/member/files.js +184 -0
  127. package/dist/http/routes/member/files.js.map +1 -0
  128. package/dist/http/routes/member/index.d.ts +7 -0
  129. package/dist/http/routes/member/index.js +31 -0
  130. package/dist/http/routes/member/index.js.map +1 -0
  131. package/dist/http/routes/member/notifications.d.ts +7 -0
  132. package/dist/http/routes/member/notifications.js +101 -0
  133. package/dist/http/routes/member/notifications.js.map +1 -0
  134. package/dist/http/routes/member/org.d.ts +7 -0
  135. package/dist/http/routes/member/org.js +56 -0
  136. package/dist/http/routes/member/org.js.map +1 -0
  137. package/dist/http/routes/member/posts.d.ts +7 -0
  138. package/dist/http/routes/member/posts.js +612 -0
  139. package/dist/http/routes/member/posts.js.map +1 -0
  140. package/dist/http/routes/member/profile.d.ts +7 -0
  141. package/dist/http/routes/member/profile.js +48 -0
  142. package/dist/http/routes/member/profile.js.map +1 -0
  143. package/dist/http/routes/member/progress.d.ts +7 -0
  144. package/dist/http/routes/member/progress.js +60 -0
  145. package/dist/http/routes/member/progress.js.map +1 -0
  146. package/dist/http/routes/organizations.js +49 -24
  147. package/dist/http/routes/organizations.js.map +1 -1
  148. package/dist/http/routes/students.js +43 -37
  149. package/dist/http/routes/students.js.map +1 -1
  150. package/dist/http/routes/webhooks.d.ts +7 -0
  151. package/dist/http/routes/webhooks.js +167 -0
  152. package/dist/http/routes/webhooks.js.map +1 -0
  153. package/dist/http/routes.js +14 -2
  154. package/dist/http/routes.js.map +1 -1
  155. package/dist/http/schemas/access.d.ts +146 -0
  156. package/dist/http/schemas/access.js +36 -0
  157. package/dist/http/schemas/access.js.map +1 -0
  158. package/dist/http/schemas/activities.d.ts +36 -1
  159. package/dist/http/schemas/activities.js +9 -4
  160. package/dist/http/schemas/activities.js.map +1 -1
  161. package/dist/http/schemas/assets.d.ts +76 -73
  162. package/dist/http/schemas/assets.js +23 -13
  163. package/dist/http/schemas/assets.js.map +1 -1
  164. package/dist/http/schemas/automations.d.ts +85 -8
  165. package/dist/http/schemas/automations.js +13 -2
  166. package/dist/http/schemas/automations.js.map +1 -1
  167. package/dist/http/schemas/bundles.d.ts +63 -0
  168. package/dist/http/schemas/bundles.js +23 -0
  169. package/dist/http/schemas/bundles.js.map +1 -0
  170. package/dist/http/schemas/chats.d.ts +386 -0
  171. package/dist/http/schemas/chats.js +58 -0
  172. package/dist/http/schemas/chats.js.map +1 -0
  173. package/dist/http/schemas/community.d.ts +537 -0
  174. package/dist/http/schemas/community.js +129 -0
  175. package/dist/http/schemas/community.js.map +1 -0
  176. package/dist/http/schemas/content.d.ts +22 -13
  177. package/dist/http/schemas/content.js +11 -9
  178. package/dist/http/schemas/content.js.map +1 -1
  179. package/dist/http/schemas/course-analytics.d.ts +29 -0
  180. package/dist/http/schemas/course-analytics.js +21 -0
  181. package/dist/http/schemas/course-analytics.js.map +1 -0
  182. package/dist/http/schemas/dashboard.js.map +1 -1
  183. package/dist/http/schemas/discussion.d.ts +85 -23
  184. package/dist/http/schemas/discussion.js +12 -11
  185. package/dist/http/schemas/discussion.js.map +1 -1
  186. package/dist/http/schemas/downloads.d.ts +13 -5
  187. package/dist/http/schemas/downloads.js +14 -11
  188. package/dist/http/schemas/downloads.js.map +1 -1
  189. package/dist/http/schemas/entitlements.d.ts +14 -6
  190. package/dist/http/schemas/entitlements.js +8 -6
  191. package/dist/http/schemas/entitlements.js.map +1 -1
  192. package/dist/http/schemas/files.d.ts +45 -0
  193. package/dist/http/schemas/files.js +25 -0
  194. package/dist/http/schemas/files.js.map +1 -0
  195. package/dist/http/schemas/index.d.ts +19 -10
  196. package/dist/http/schemas/index.js +19 -10
  197. package/dist/http/schemas/integrations.d.ts +4 -4
  198. package/dist/http/schemas/integrations.js.map +1 -1
  199. package/dist/http/schemas/invites.d.ts +4 -0
  200. package/dist/http/schemas/invites.js +3 -1
  201. package/dist/http/schemas/invites.js.map +1 -1
  202. package/dist/http/schemas/{learn.d.ts → member.d.ts} +42 -19
  203. package/dist/http/schemas/{learn.js → member.js} +17 -13
  204. package/dist/http/schemas/member.js.map +1 -0
  205. package/dist/http/schemas/members.d.ts +39 -6
  206. package/dist/http/schemas/members.js +17 -3
  207. package/dist/http/schemas/members.js.map +1 -1
  208. package/dist/http/schemas/notifications.d.ts +227 -0
  209. package/dist/http/schemas/notifications.js +44 -0
  210. package/dist/http/schemas/notifications.js.map +1 -0
  211. package/dist/http/schemas/organizations.js.map +1 -1
  212. package/dist/http/schemas/posts.d.ts +316 -0
  213. package/dist/http/schemas/posts.js +47 -0
  214. package/dist/http/schemas/posts.js.map +1 -0
  215. package/dist/http/schemas/profile.d.ts +23 -0
  216. package/dist/http/schemas/profile.js +15 -0
  217. package/dist/http/schemas/profile.js.map +1 -0
  218. package/dist/http/schemas/settings.js.map +1 -1
  219. package/dist/http/schemas/shared.d.ts +26 -1
  220. package/dist/http/schemas/shared.js +22 -3
  221. package/dist/http/schemas/shared.js.map +1 -1
  222. package/dist/http/schemas/students.d.ts +32 -10
  223. package/dist/http/schemas/students.js +19 -6
  224. package/dist/http/schemas/students.js.map +1 -1
  225. package/dist/http/scope.d.ts +2 -1
  226. package/dist/http/scope.js +20 -4
  227. package/dist/http/scope.js.map +1 -1
  228. package/dist/http/server.js +10 -3
  229. package/dist/http/server.js.map +1 -1
  230. package/dist/http/web-bridge.d.ts +1 -1
  231. package/dist/http/web-bridge.js +2 -2
  232. package/dist/http/web-bridge.js.map +1 -1
  233. package/dist/http/well-known.d.ts +7 -0
  234. package/dist/http/well-known.js +22 -0
  235. package/dist/http/well-known.js.map +1 -0
  236. package/dist/index.d.ts +3 -2
  237. package/dist/index.js +4 -2
  238. package/dist/index.js.map +1 -1
  239. package/dist/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.js +78 -0
  240. package/dist/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.js.map +1 -0
  241. package/dist/node_modules/.pnpm/@vitest_expect@2.1.9/node_modules/@vitest/expect/dist/index.js +1267 -0
  242. package/dist/node_modules/.pnpm/@vitest_expect@2.1.9/node_modules/@vitest/expect/dist/index.js.map +1 -0
  243. package/dist/node_modules/.pnpm/@vitest_pretty-format@2.1.9/node_modules/@vitest/pretty-format/dist/index.js +814 -0
  244. package/dist/node_modules/.pnpm/@vitest_pretty-format@2.1.9/node_modules/@vitest/pretty-format/dist/index.js.map +1 -0
  245. package/dist/node_modules/.pnpm/@vitest_runner@2.1.9/node_modules/@vitest/runner/dist/chunk-tasks.js +43 -0
  246. package/dist/node_modules/.pnpm/@vitest_runner@2.1.9/node_modules/@vitest/runner/dist/chunk-tasks.js.map +1 -0
  247. package/dist/node_modules/.pnpm/@vitest_runner@2.1.9/node_modules/@vitest/runner/dist/index.js +527 -0
  248. package/dist/node_modules/.pnpm/@vitest_runner@2.1.9/node_modules/@vitest/runner/dist/index.js.map +1 -0
  249. package/dist/node_modules/.pnpm/@vitest_runner@2.1.9/node_modules/@vitest/runner/dist/utils.js +2 -0
  250. package/dist/node_modules/.pnpm/@vitest_snapshot@2.1.9/node_modules/@vitest/snapshot/dist/index.js +1737 -0
  251. package/dist/node_modules/.pnpm/@vitest_snapshot@2.1.9/node_modules/@vitest/snapshot/dist/index.js.map +1 -0
  252. package/dist/node_modules/.pnpm/@vitest_spy@2.1.9/node_modules/@vitest/spy/dist/index.js +137 -0
  253. package/dist/node_modules/.pnpm/@vitest_spy@2.1.9/node_modules/@vitest/spy/dist/index.js.map +1 -0
  254. package/dist/node_modules/.pnpm/@vitest_utils@2.1.9/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.js +118 -0
  255. package/dist/node_modules/.pnpm/@vitest_utils@2.1.9/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.js.map +1 -0
  256. package/dist/node_modules/.pnpm/@vitest_utils@2.1.9/node_modules/@vitest/utils/dist/diff.js +1222 -0
  257. package/dist/node_modules/.pnpm/@vitest_utils@2.1.9/node_modules/@vitest/utils/dist/diff.js.map +1 -0
  258. package/dist/node_modules/.pnpm/@vitest_utils@2.1.9/node_modules/@vitest/utils/dist/error.js +91 -0
  259. package/dist/node_modules/.pnpm/@vitest_utils@2.1.9/node_modules/@vitest/utils/dist/error.js.map +1 -0
  260. package/dist/node_modules/.pnpm/@vitest_utils@2.1.9/node_modules/@vitest/utils/dist/helpers.js +113 -0
  261. package/dist/node_modules/.pnpm/@vitest_utils@2.1.9/node_modules/@vitest/utils/dist/helpers.js.map +1 -0
  262. package/dist/node_modules/.pnpm/@vitest_utils@2.1.9/node_modules/@vitest/utils/dist/index.js +449 -0
  263. package/dist/node_modules/.pnpm/@vitest_utils@2.1.9/node_modules/@vitest/utils/dist/index.js.map +1 -0
  264. package/dist/node_modules/.pnpm/@vitest_utils@2.1.9/node_modules/@vitest/utils/dist/source-map.js +163 -0
  265. package/dist/node_modules/.pnpm/@vitest_utils@2.1.9/node_modules/@vitest/utils/dist/source-map.js.map +1 -0
  266. package/dist/node_modules/.pnpm/chai@5.3.3/node_modules/chai/index.js +3187 -0
  267. package/dist/node_modules/.pnpm/chai@5.3.3/node_modules/chai/index.js.map +1 -0
  268. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/arguments.js +11 -0
  269. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/arguments.js.map +1 -0
  270. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/array.js +16 -0
  271. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/array.js.map +1 -0
  272. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/bigint.js +11 -0
  273. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/bigint.js.map +1 -0
  274. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/class.js +15 -0
  275. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/class.js.map +1 -0
  276. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/date.js +13 -0
  277. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/date.js.map +1 -0
  278. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/error.js +34 -0
  279. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/error.js.map +1 -0
  280. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/function.js +12 -0
  281. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/function.js.map +1 -0
  282. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/helpers.js +122 -0
  283. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/helpers.js.map +1 -0
  284. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/html.js +39 -0
  285. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/html.js.map +1 -0
  286. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/index.js +99 -0
  287. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/index.js.map +1 -0
  288. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/map.js +25 -0
  289. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/map.js.map +1 -0
  290. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/number.js +14 -0
  291. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/number.js.map +1 -0
  292. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/object.js +21 -0
  293. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/object.js.map +1 -0
  294. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/promise.js +6 -0
  295. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/promise.js.map +1 -0
  296. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/regexp.js +12 -0
  297. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/regexp.js.map +1 -0
  298. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/set.js +18 -0
  299. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/set.js.map +1 -0
  300. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/string.js +24 -0
  301. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/string.js.map +1 -0
  302. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/symbol.js +9 -0
  303. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/symbol.js.map +1 -0
  304. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/typedarray.js +30 -0
  305. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/typedarray.js.map +1 -0
  306. package/dist/node_modules/.pnpm/magic-string@0.30.21/node_modules/magic-string/dist/magic-string.es.js +939 -0
  307. package/dist/node_modules/.pnpm/magic-string@0.30.21/node_modules/magic-string/dist/magic-string.es.js.map +1 -0
  308. package/dist/node_modules/.pnpm/pathe@1.1.2/node_modules/pathe/dist/shared/pathe.ff20891b.js +82 -0
  309. package/dist/node_modules/.pnpm/pathe@1.1.2/node_modules/pathe/dist/shared/pathe.ff20891b.js.map +1 -0
  310. package/dist/node_modules/.pnpm/tinyrainbow@1.2.0/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.js +82 -0
  311. package/dist/node_modules/.pnpm/tinyrainbow@1.2.0/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.js.map +1 -0
  312. package/dist/node_modules/.pnpm/tinyrainbow@1.2.0/node_modules/tinyrainbow/dist/node.js +8 -0
  313. package/dist/node_modules/.pnpm/tinyrainbow@1.2.0/node_modules/tinyrainbow/dist/node.js.map +1 -0
  314. package/dist/node_modules/.pnpm/tinyspy@3.0.2/node_modules/tinyspy/dist/index.js +83 -0
  315. package/dist/node_modules/.pnpm/tinyspy@3.0.2/node_modules/tinyspy/dist/index.js.map +1 -0
  316. package/dist/node_modules/.pnpm/vitest@2.1.9_@types_node@22.20.0_jsdom@25.0.1_lightningcss@1.32.0/node_modules/vitest/dist/chunks/_commonjsHelpers.BFTU3MAI.js +9 -0
  317. package/dist/node_modules/.pnpm/vitest@2.1.9_@types_node@22.20.0_jsdom@25.0.1_lightningcss@1.32.0/node_modules/vitest/dist/chunks/_commonjsHelpers.BFTU3MAI.js.map +1 -0
  318. package/dist/node_modules/.pnpm/vitest@2.1.9_@types_node@22.20.0_jsdom@25.0.1_lightningcss@1.32.0/node_modules/vitest/dist/chunks/date.W2xKR2qe.js +51 -0
  319. package/dist/node_modules/.pnpm/vitest@2.1.9_@types_node@22.20.0_jsdom@25.0.1_lightningcss@1.32.0/node_modules/vitest/dist/chunks/date.W2xKR2qe.js.map +1 -0
  320. package/dist/node_modules/.pnpm/vitest@2.1.9_@types_node@22.20.0_jsdom@25.0.1_lightningcss@1.32.0/node_modules/vitest/dist/chunks/utils.C8RiOc4B.js +48 -0
  321. package/dist/node_modules/.pnpm/vitest@2.1.9_@types_node@22.20.0_jsdom@25.0.1_lightningcss@1.32.0/node_modules/vitest/dist/chunks/utils.C8RiOc4B.js.map +1 -0
  322. package/dist/node_modules/.pnpm/vitest@2.1.9_@types_node@22.20.0_jsdom@25.0.1_lightningcss@1.32.0/node_modules/vitest/dist/chunks/vi.DgezovHB.js +2426 -0
  323. package/dist/node_modules/.pnpm/vitest@2.1.9_@types_node@22.20.0_jsdom@25.0.1_lightningcss@1.32.0/node_modules/vitest/dist/chunks/vi.DgezovHB.js.map +1 -0
  324. package/dist/packages/server/package.js +6 -0
  325. package/dist/packages/server/package.js.map +1 -0
  326. package/package.json +9 -7
  327. package/dist/app/notifications.d.ts +0 -7
  328. package/dist/app/notifications.js +0 -23
  329. package/dist/app/notifications.js.map +0 -1
  330. package/dist/http/routes/learn/assets.d.ts +0 -8
  331. package/dist/http/routes/learn/assets.js +0 -32
  332. package/dist/http/routes/learn/assets.js.map +0 -1
  333. package/dist/http/routes/learn/comments.d.ts +0 -7
  334. package/dist/http/routes/learn/comments.js +0 -175
  335. package/dist/http/routes/learn/comments.js.map +0 -1
  336. package/dist/http/routes/learn/courses.d.ts +0 -7
  337. package/dist/http/routes/learn/courses.js +0 -75
  338. package/dist/http/routes/learn/courses.js.map +0 -1
  339. package/dist/http/routes/learn/downloads.d.ts +0 -7
  340. package/dist/http/routes/learn/downloads.js +0 -76
  341. package/dist/http/routes/learn/downloads.js.map +0 -1
  342. package/dist/http/routes/learn/index.d.ts +0 -7
  343. package/dist/http/routes/learn/index.js +0 -19
  344. package/dist/http/routes/learn/index.js.map +0 -1
  345. package/dist/http/routes/learn/org.d.ts +0 -7
  346. package/dist/http/routes/learn/org.js +0 -50
  347. package/dist/http/routes/learn/org.js.map +0 -1
  348. package/dist/http/routes/learn/progress.d.ts +0 -7
  349. package/dist/http/routes/learn/progress.js +0 -63
  350. package/dist/http/routes/learn/progress.js.map +0 -1
  351. package/dist/http/schemas/learn.js.map +0 -1
@@ -0,0 +1,167 @@
1
+ import { refusals } from "../schemas/shared.js";
2
+ import { resolveScope } from "../scope.js";
3
+ import { AutomationIdParam, CreateWebhookBody, CreatedWebhook, UpdateWebhookBody, Webhook, WebhookSecret } from "../schemas/automations.js";
4
+ import "../schemas/index.js";
5
+ import { z } from "zod";
6
+ import { NotFoundError } from "@headless-lms/core/shared/errors";
7
+ //#region src/http/routes/webhooks.ts
8
+ const DELIVERY_DESCRIPTION = "Staff only (owner, admin, instructor). `url` must be a public address: localhost and private network addresses are refused when saved and when delivering. Each subscribed event is POSTed to `url` as the JSON event envelope (`id`, `type`, `version`, `orgId`, `occurredAt`, `data`), signed per the Standard Webhooks spec: `webhook-id` (the event id, stable across retries), `webhook-timestamp` (unix seconds) and `webhook-signature` (`v1,` + base64 HMAC-SHA256 of `{webhook-id}.{webhook-timestamp}.{body}`, keyed with the base64-decoded part of the `whsec_` secret). Any non-2xx response or timeout is a failed attempt and is retried. Deliveries are the webhook's automation runs: `GET /api/automations/{id}/runs`.";
9
+ async function webhooksRoutes(app, container) {
10
+ const r = app.withTypeProvider();
11
+ const automations = container.automations;
12
+ const tags = ["Automations"];
13
+ r.route({
14
+ method: "GET",
15
+ url: "/api/automations/webhooks",
16
+ preHandler: app.requireOrgSession,
17
+ schema: {
18
+ operationId: "listWebhooks",
19
+ tags,
20
+ summary: "List the organization's webhooks (staff)",
21
+ description: "Staff only (owner, admin, instructor). Signing secrets are not included.",
22
+ response: {
23
+ 200: z.array(Webhook),
24
+ ...refusals(403)
25
+ }
26
+ },
27
+ handler: async (req) => {
28
+ const scope = await resolveScope(container, req);
29
+ return automations.listWebhooks(scope.orgId);
30
+ }
31
+ });
32
+ r.route({
33
+ method: "POST",
34
+ url: "/api/automations/webhooks",
35
+ preHandler: app.requireOrgSession,
36
+ schema: {
37
+ operationId: "createWebhook",
38
+ tags,
39
+ summary: "Create a webhook (staff)",
40
+ description: DELIVERY_DESCRIPTION,
41
+ body: CreateWebhookBody,
42
+ response: {
43
+ 201: CreatedWebhook,
44
+ ...refusals(400, 403)
45
+ }
46
+ },
47
+ handler: async (req, reply) => {
48
+ const scope = await resolveScope(container, req);
49
+ const webhook = await automations.createWebhook(scope.orgId, req.body);
50
+ return reply.code(201).send(webhook);
51
+ }
52
+ });
53
+ r.route({
54
+ method: "GET",
55
+ url: "/api/automations/webhooks/:id",
56
+ preHandler: app.requireOrgSession,
57
+ schema: {
58
+ operationId: "getWebhook",
59
+ tags,
60
+ summary: "Get a webhook (staff)",
61
+ description: "Staff only (owner, admin, instructor). The signing secret is not included.",
62
+ params: AutomationIdParam,
63
+ response: {
64
+ 200: Webhook,
65
+ ...refusals(403, 404)
66
+ }
67
+ },
68
+ handler: async (req) => {
69
+ const scope = await resolveScope(container, req);
70
+ const webhook = await automations.getWebhook(scope.orgId, req.params.id);
71
+ if (!webhook) throw new NotFoundError("Webhook", req.params.id);
72
+ return webhook;
73
+ }
74
+ });
75
+ r.route({
76
+ method: "PATCH",
77
+ url: "/api/automations/webhooks/:id",
78
+ preHandler: app.requireOrgSession,
79
+ schema: {
80
+ operationId: "updateWebhook",
81
+ tags,
82
+ summary: "Change a webhook's URL, events, description or enabled flag (staff)",
83
+ description: "Staff only (owner, admin, instructor). Changes only the fields sent. 400 when an event is reserved or unknown.",
84
+ params: AutomationIdParam,
85
+ body: UpdateWebhookBody,
86
+ response: {
87
+ 200: Webhook,
88
+ ...refusals(400, 403, 404)
89
+ }
90
+ },
91
+ handler: async (req) => {
92
+ const scope = await resolveScope(container, req);
93
+ const webhook = await automations.updateWebhook(scope.orgId, req.params.id, req.body);
94
+ if (!webhook) throw new NotFoundError("Webhook", req.params.id);
95
+ return webhook;
96
+ }
97
+ });
98
+ r.route({
99
+ method: "DELETE",
100
+ url: "/api/automations/webhooks/:id",
101
+ preHandler: app.requireOrgSession,
102
+ schema: {
103
+ operationId: "deleteWebhook",
104
+ tags,
105
+ summary: "Delete a webhook and its signing secret (staff)",
106
+ description: "Staff only (owner, admin, instructor). Its delivery history is kept.",
107
+ params: AutomationIdParam,
108
+ response: {
109
+ 204: z.void(),
110
+ ...refusals(403, 404)
111
+ }
112
+ },
113
+ handler: async (req, reply) => {
114
+ const scope = await resolveScope(container, req);
115
+ if (!await automations.deleteWebhook(scope.orgId, req.params.id)) throw new NotFoundError("Webhook", req.params.id);
116
+ return reply.code(204).send();
117
+ }
118
+ });
119
+ r.route({
120
+ method: "GET",
121
+ url: "/api/automations/webhooks/:id/secret",
122
+ preHandler: app.requireOrgSession,
123
+ schema: {
124
+ operationId: "getWebhookSecret",
125
+ tags,
126
+ summary: "Reveal a webhook's signing secret (staff)",
127
+ description: "Staff only (owner, admin, instructor).",
128
+ params: AutomationIdParam,
129
+ response: {
130
+ 200: WebhookSecret,
131
+ ...refusals(403, 404)
132
+ }
133
+ },
134
+ handler: async (req) => {
135
+ const scope = await resolveScope(container, req);
136
+ const secret = await automations.revealWebhookSecret(scope.orgId, req.params.id);
137
+ if (!secret) throw new NotFoundError("Webhook", req.params.id);
138
+ return secret;
139
+ }
140
+ });
141
+ r.route({
142
+ method: "POST",
143
+ url: "/api/automations/webhooks/:id/secret/rotate",
144
+ preHandler: app.requireOrgSession,
145
+ schema: {
146
+ operationId: "rotateWebhookSecret",
147
+ tags,
148
+ summary: "Replace a webhook's signing secret (staff)",
149
+ description: "Staff only (owner, admin, instructor). The old secret stops working immediately.",
150
+ params: AutomationIdParam,
151
+ response: {
152
+ 200: WebhookSecret,
153
+ ...refusals(403, 404)
154
+ }
155
+ },
156
+ handler: async (req) => {
157
+ const scope = await resolveScope(container, req);
158
+ const secret = await automations.rotateWebhookSecret(scope.orgId, req.params.id);
159
+ if (!secret) throw new NotFoundError("Webhook", req.params.id);
160
+ return secret;
161
+ }
162
+ });
163
+ }
164
+ //#endregion
165
+ export { webhooksRoutes };
166
+
167
+ //# sourceMappingURL=webhooks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhooks.js","names":[],"sources":["../../../src/http/routes/webhooks.ts"],"sourcesContent":["import type { FastifyInstance } from 'fastify';\nimport { z } from 'zod';\nimport type { ZodTypeProvider } from 'fastify-type-provider-zod';\nimport {\n AutomationIdParam,\n CreatedWebhook,\n CreateWebhookBody,\n UpdateWebhookBody,\n Webhook,\n WebhookSecret,\n refusals,\n} from '../schemas/index.js';\nimport { NotFoundError } from '@headless-lms/core/shared/errors';\nimport type { Container } from '../../app/container.js';\nimport { resolveScope } from '../scope.js';\n\nconst DELIVERY_DESCRIPTION =\n \"Staff only (owner, admin, instructor). `url` must be a public address: localhost and private network addresses are refused when saved and when delivering. Each subscribed event is POSTed to `url` as the JSON event envelope (`id`, `type`, `version`, `orgId`, `occurredAt`, `data`), signed per the Standard Webhooks spec: `webhook-id` (the event id, stable across retries), `webhook-timestamp` (unix seconds) and `webhook-signature` (`v1,` + base64 HMAC-SHA256 of `{webhook-id}.{webhook-timestamp}.{body}`, keyed with the base64-decoded part of the `whsec_` secret). Any non-2xx response or timeout is a failed attempt and is retried. Deliveries are the webhook's automation runs: `GET /api/automations/{id}/runs`.\";\n\nexport async function webhooksRoutes(app: FastifyInstance, container: Container): Promise<void> {\n const r = app.withTypeProvider<ZodTypeProvider>();\n const automations = container.automations;\n const tags = ['Automations'];\n\n r.route({\n method: 'GET',\n url: '/api/automations/webhooks',\n preHandler: app.requireOrgSession,\n schema: {\n operationId: 'listWebhooks',\n tags,\n summary: \"List the organization's webhooks (staff)\",\n description: 'Staff only (owner, admin, instructor). Signing secrets are not included.',\n response: { 200: z.array(Webhook), ...refusals(403) },\n },\n handler: async (req) => {\n const scope = await resolveScope(container, req);\n return automations.listWebhooks(scope.orgId);\n },\n });\n\n r.route({\n method: 'POST',\n url: '/api/automations/webhooks',\n preHandler: app.requireOrgSession,\n schema: {\n operationId: 'createWebhook',\n tags,\n summary: 'Create a webhook (staff)',\n description: DELIVERY_DESCRIPTION,\n body: CreateWebhookBody,\n response: { 201: CreatedWebhook, ...refusals(400, 403) },\n },\n handler: async (req, reply) => {\n const scope = await resolveScope(container, req);\n const webhook = await automations.createWebhook(scope.orgId, req.body);\n return reply.code(201).send(webhook);\n },\n });\n\n r.route({\n method: 'GET',\n url: '/api/automations/webhooks/:id',\n preHandler: app.requireOrgSession,\n schema: {\n operationId: 'getWebhook',\n tags,\n summary: 'Get a webhook (staff)',\n description: 'Staff only (owner, admin, instructor). The signing secret is not included.',\n params: AutomationIdParam,\n response: { 200: Webhook, ...refusals(403, 404) },\n },\n handler: async (req) => {\n const scope = await resolveScope(container, req);\n const webhook = await automations.getWebhook(scope.orgId, req.params.id);\n if (!webhook) {\n throw new NotFoundError('Webhook', req.params.id);\n }\n return webhook;\n },\n });\n\n r.route({\n method: 'PATCH',\n url: '/api/automations/webhooks/:id',\n preHandler: app.requireOrgSession,\n schema: {\n operationId: 'updateWebhook',\n tags,\n summary: \"Change a webhook's URL, events, description or enabled flag (staff)\",\n description:\n 'Staff only (owner, admin, instructor). Changes only the fields sent. 400 when an event is reserved or unknown.',\n params: AutomationIdParam,\n body: UpdateWebhookBody,\n response: { 200: Webhook, ...refusals(400, 403, 404) },\n },\n handler: async (req) => {\n const scope = await resolveScope(container, req);\n const webhook = await automations.updateWebhook(scope.orgId, req.params.id, req.body);\n if (!webhook) {\n throw new NotFoundError('Webhook', req.params.id);\n }\n return webhook;\n },\n });\n\n r.route({\n method: 'DELETE',\n url: '/api/automations/webhooks/:id',\n preHandler: app.requireOrgSession,\n schema: {\n operationId: 'deleteWebhook',\n tags,\n summary: 'Delete a webhook and its signing secret (staff)',\n description: 'Staff only (owner, admin, instructor). Its delivery history is kept.',\n params: AutomationIdParam,\n response: { 204: z.void(), ...refusals(403, 404) },\n },\n handler: async (req, reply) => {\n const scope = await resolveScope(container, req);\n const deleted = await automations.deleteWebhook(scope.orgId, req.params.id);\n if (!deleted) {\n throw new NotFoundError('Webhook', req.params.id);\n }\n return reply.code(204).send();\n },\n });\n\n r.route({\n method: 'GET',\n url: '/api/automations/webhooks/:id/secret',\n preHandler: app.requireOrgSession,\n schema: {\n operationId: 'getWebhookSecret',\n tags,\n summary: \"Reveal a webhook's signing secret (staff)\",\n description: 'Staff only (owner, admin, instructor).',\n params: AutomationIdParam,\n response: { 200: WebhookSecret, ...refusals(403, 404) },\n },\n handler: async (req) => {\n const scope = await resolveScope(container, req);\n const secret = await automations.revealWebhookSecret(scope.orgId, req.params.id);\n if (!secret) {\n throw new NotFoundError('Webhook', req.params.id);\n }\n return secret;\n },\n });\n\n r.route({\n method: 'POST',\n url: '/api/automations/webhooks/:id/secret/rotate',\n preHandler: app.requireOrgSession,\n schema: {\n operationId: 'rotateWebhookSecret',\n tags,\n summary: \"Replace a webhook's signing secret (staff)\",\n description:\n 'Staff only (owner, admin, instructor). The old secret stops working immediately.',\n params: AutomationIdParam,\n response: { 200: WebhookSecret, ...refusals(403, 404) },\n },\n handler: async (req) => {\n const scope = await resolveScope(container, req);\n const secret = await automations.rotateWebhookSecret(scope.orgId, req.params.id);\n if (!secret) {\n throw new NotFoundError('Webhook', req.params.id);\n }\n return secret;\n },\n });\n}\n"],"mappings":";;;;;;;AAgBA,MAAM,uBACJ;AAEF,eAAsB,eAAe,KAAsB,WAAqC;CAC9F,MAAM,IAAI,IAAI,iBAAkC;CAChD,MAAM,cAAc,UAAU;CAC9B,MAAM,OAAO,CAAC,aAAa;CAE3B,EAAE,MAAM;EACN,QAAQ;EACR,KAAK;EACL,YAAY,IAAI;EAChB,QAAQ;GACN,aAAa;GACb;GACA,SAAS;GACT,aAAa;GACb,UAAU;IAAE,KAAK,EAAE,MAAM,OAAO;IAAG,GAAG,SAAS,GAAG;GAAE;EACtD;EACA,SAAS,OAAO,QAAQ;GACtB,MAAM,QAAQ,MAAM,aAAa,WAAW,GAAG;GAC/C,OAAO,YAAY,aAAa,MAAM,KAAK;EAC7C;CACF,CAAC;CAED,EAAE,MAAM;EACN,QAAQ;EACR,KAAK;EACL,YAAY,IAAI;EAChB,QAAQ;GACN,aAAa;GACb;GACA,SAAS;GACT,aAAa;GACb,MAAM;GACN,UAAU;IAAE,KAAK;IAAgB,GAAG,SAAS,KAAK,GAAG;GAAE;EACzD;EACA,SAAS,OAAO,KAAK,UAAU;GAC7B,MAAM,QAAQ,MAAM,aAAa,WAAW,GAAG;GAC/C,MAAM,UAAU,MAAM,YAAY,cAAc,MAAM,OAAO,IAAI,IAAI;GACrE,OAAO,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,OAAO;EACrC;CACF,CAAC;CAED,EAAE,MAAM;EACN,QAAQ;EACR,KAAK;EACL,YAAY,IAAI;EAChB,QAAQ;GACN,aAAa;GACb;GACA,SAAS;GACT,aAAa;GACb,QAAQ;GACR,UAAU;IAAE,KAAK;IAAS,GAAG,SAAS,KAAK,GAAG;GAAE;EAClD;EACA,SAAS,OAAO,QAAQ;GACtB,MAAM,QAAQ,MAAM,aAAa,WAAW,GAAG;GAC/C,MAAM,UAAU,MAAM,YAAY,WAAW,MAAM,OAAO,IAAI,OAAO,EAAE;GACvE,IAAI,CAAC,SACH,MAAM,IAAI,cAAc,WAAW,IAAI,OAAO,EAAE;GAElD,OAAO;EACT;CACF,CAAC;CAED,EAAE,MAAM;EACN,QAAQ;EACR,KAAK;EACL,YAAY,IAAI;EAChB,QAAQ;GACN,aAAa;GACb;GACA,SAAS;GACT,aACE;GACF,QAAQ;GACR,MAAM;GACN,UAAU;IAAE,KAAK;IAAS,GAAG,SAAS,KAAK,KAAK,GAAG;GAAE;EACvD;EACA,SAAS,OAAO,QAAQ;GACtB,MAAM,QAAQ,MAAM,aAAa,WAAW,GAAG;GAC/C,MAAM,UAAU,MAAM,YAAY,cAAc,MAAM,OAAO,IAAI,OAAO,IAAI,IAAI,IAAI;GACpF,IAAI,CAAC,SACH,MAAM,IAAI,cAAc,WAAW,IAAI,OAAO,EAAE;GAElD,OAAO;EACT;CACF,CAAC;CAED,EAAE,MAAM;EACN,QAAQ;EACR,KAAK;EACL,YAAY,IAAI;EAChB,QAAQ;GACN,aAAa;GACb;GACA,SAAS;GACT,aAAa;GACb,QAAQ;GACR,UAAU;IAAE,KAAK,EAAE,KAAK;IAAG,GAAG,SAAS,KAAK,GAAG;GAAE;EACnD;EACA,SAAS,OAAO,KAAK,UAAU;GAC7B,MAAM,QAAQ,MAAM,aAAa,WAAW,GAAG;GAE/C,IAAI,CAAC,MADiB,YAAY,cAAc,MAAM,OAAO,IAAI,OAAO,EAAE,GAExE,MAAM,IAAI,cAAc,WAAW,IAAI,OAAO,EAAE;GAElD,OAAO,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK;EAC9B;CACF,CAAC;CAED,EAAE,MAAM;EACN,QAAQ;EACR,KAAK;EACL,YAAY,IAAI;EAChB,QAAQ;GACN,aAAa;GACb;GACA,SAAS;GACT,aAAa;GACb,QAAQ;GACR,UAAU;IAAE,KAAK;IAAe,GAAG,SAAS,KAAK,GAAG;GAAE;EACxD;EACA,SAAS,OAAO,QAAQ;GACtB,MAAM,QAAQ,MAAM,aAAa,WAAW,GAAG;GAC/C,MAAM,SAAS,MAAM,YAAY,oBAAoB,MAAM,OAAO,IAAI,OAAO,EAAE;GAC/E,IAAI,CAAC,QACH,MAAM,IAAI,cAAc,WAAW,IAAI,OAAO,EAAE;GAElD,OAAO;EACT;CACF,CAAC;CAED,EAAE,MAAM;EACN,QAAQ;EACR,KAAK;EACL,YAAY,IAAI;EAChB,QAAQ;GACN,aAAa;GACb;GACA,SAAS;GACT,aACE;GACF,QAAQ;GACR,UAAU;IAAE,KAAK;IAAe,GAAG,SAAS,KAAK,GAAG;GAAE;EACxD;EACA,SAAS,OAAO,QAAQ;GACtB,MAAM,QAAQ,MAAM,aAAa,WAAW,GAAG;GAC/C,MAAM,SAAS,MAAM,YAAY,oBAAoB,MAAM,OAAO,IAAI,OAAO,EAAE;GAC/E,IAAI,CAAC,QACH,MAAM,IAAI,cAAc,WAAW,IAAI,OAAO,EAAE;GAElD,OAAO;EACT;CACF,CAAC;AACH"}
@@ -1,15 +1,21 @@
1
+ import { communitiesRoutes } from "./routes/communities.js";
2
+ import { communityModerationRoutes } from "./routes/community-moderation.js";
1
3
  import { coursesRoutes } from "./routes/courses.js";
2
4
  import { downloadsRoutes } from "./routes/downloads.js";
3
- import { learnRoutes } from "./routes/learn/index.js";
5
+ import { bundlesRoutes } from "./routes/bundles.js";
6
+ import { memberRoutes } from "./routes/member/index.js";
4
7
  import { discussionRoutes } from "./routes/discussion.js";
5
8
  import { activitiesRoutes } from "./routes/activities.js";
6
9
  import { studentsRoutes } from "./routes/students.js";
7
10
  import { entitlementsRoutes } from "./routes/entitlements.js";
8
11
  import { automationsRoutes } from "./routes/automations.js";
12
+ import { webhooksRoutes } from "./routes/webhooks.js";
9
13
  import { organizationsRoutes } from "./routes/organizations.js";
10
14
  import { dashboardRoutes } from "./routes/dashboard.js";
15
+ import { courseAnalyticsRoutes } from "./routes/course-analytics.js";
11
16
  import { assetsRoutes } from "./routes/assets.js";
12
17
  import { integrationsRoutes } from "./routes/integrations.js";
18
+ import { accessRoutes } from "./routes/access.js";
13
19
  //#region src/http/routes.ts
14
20
  function registerRoutes(app, container) {
15
21
  app.get("/health", async () => ({ status: "ok" }));
@@ -19,16 +25,22 @@ function registerRoutes(app, container) {
19
25
  app.register(async (instance) => {
20
26
  instance.addHook("onRequest", instance.requireOrgSession);
21
27
  await coursesRoutes(instance, container);
28
+ await communitiesRoutes(instance, container);
29
+ await communityModerationRoutes(instance, container);
22
30
  await downloadsRoutes(instance, container);
23
- await learnRoutes(instance, container);
31
+ await bundlesRoutes(instance, container);
32
+ await memberRoutes(instance, container);
24
33
  await discussionRoutes(instance, container);
25
34
  await activitiesRoutes(instance, container);
26
35
  await studentsRoutes(instance, container);
27
36
  await entitlementsRoutes(instance, container);
28
37
  await automationsRoutes(instance, container);
38
+ await webhooksRoutes(instance, container);
29
39
  await dashboardRoutes(instance, container);
40
+ await courseAnalyticsRoutes(instance, container);
30
41
  await assetsRoutes(instance, container);
31
42
  await integrationsRoutes(instance, container);
43
+ await accessRoutes(instance, container);
32
44
  });
33
45
  }
34
46
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"routes.js","names":[],"sources":["../../src/http/routes.ts"],"sourcesContent":["import type { FastifyInstance } from 'fastify';\nimport type { Container } from '../app/container.js';\nimport { coursesRoutes } from './routes/courses.js';\nimport { downloadsRoutes } from './routes/downloads.js';\nimport { learnRoutes } from './routes/learn/index.js';\nimport { discussionRoutes } from './routes/discussion.js';\nimport { activitiesRoutes } from './routes/activities.js';\nimport { studentsRoutes } from './routes/students.js';\nimport { entitlementsRoutes } from './routes/entitlements.js';\nimport { automationsRoutes } from './routes/automations.js';\nimport { organizationsRoutes } from './routes/organizations.js';\nimport { dashboardRoutes } from './routes/dashboard.js';\nimport { assetsRoutes } from './routes/assets.js';\nimport { integrationsRoutes } from './routes/integrations.js';\n\nexport function registerRoutes(\n app: FastifyInstance,\n container: Container,\n): void {\n app.get('/health', async () => ({ status: 'ok' }));\n\n app.register(async (instance) => {\n // instance.addHook('onRequest', instance.requireSession);\n await organizationsRoutes(instance, container);\n });\n\n app.register(async (instance) => {\n instance.addHook('onRequest', instance.requireOrgSession);\n await coursesRoutes(instance, container);\n await downloadsRoutes(instance, container);\n await learnRoutes(instance, container);\n await discussionRoutes(instance, container);\n await activitiesRoutes(instance, container);\n await studentsRoutes(instance, container);\n await entitlementsRoutes(instance, container);\n await automationsRoutes(instance, container);\n await dashboardRoutes(instance, container);\n await assetsRoutes(instance, container);\n await integrationsRoutes(instance, container);\n });\n}\n"],"mappings":";;;;;;;;;;;;;AAeA,SAAgB,eACd,KACA,WACM;CACN,IAAI,IAAI,WAAW,aAAa,EAAE,QAAQ,KAAK,EAAE;CAEjD,IAAI,SAAS,OAAO,aAAa;EAE/B,MAAM,oBAAoB,UAAU,SAAS;CAC/C,CAAC;CAED,IAAI,SAAS,OAAO,aAAa;EAC/B,SAAS,QAAQ,aAAa,SAAS,iBAAiB;EACxD,MAAM,cAAc,UAAU,SAAS;EACvC,MAAM,gBAAgB,UAAU,SAAS;EACzC,MAAM,YAAY,UAAU,SAAS;EACrC,MAAM,iBAAiB,UAAU,SAAS;EAC1C,MAAM,iBAAiB,UAAU,SAAS;EAC1C,MAAM,eAAe,UAAU,SAAS;EACxC,MAAM,mBAAmB,UAAU,SAAS;EAC5C,MAAM,kBAAkB,UAAU,SAAS;EAC3C,MAAM,gBAAgB,UAAU,SAAS;EACzC,MAAM,aAAa,UAAU,SAAS;EACtC,MAAM,mBAAmB,UAAU,SAAS;CAC9C,CAAC;AACH"}
1
+ {"version":3,"file":"routes.js","names":[],"sources":["../../src/http/routes.ts"],"sourcesContent":["import type { FastifyInstance } from 'fastify';\nimport type { Container } from '../app/container.js';\nimport { communitiesRoutes } from './routes/communities.js';\nimport { communityModerationRoutes } from './routes/community-moderation.js';\nimport { coursesRoutes } from './routes/courses.js';\nimport { downloadsRoutes } from './routes/downloads.js';\nimport { bundlesRoutes } from './routes/bundles.js';\nimport { memberRoutes } from './routes/member/index.js';\nimport { discussionRoutes } from './routes/discussion.js';\nimport { activitiesRoutes } from './routes/activities.js';\nimport { studentsRoutes } from './routes/students.js';\nimport { entitlementsRoutes } from './routes/entitlements.js';\nimport { automationsRoutes } from './routes/automations.js';\nimport { webhooksRoutes } from './routes/webhooks.js';\nimport { organizationsRoutes } from './routes/organizations.js';\nimport { dashboardRoutes } from './routes/dashboard.js';\nimport { courseAnalyticsRoutes } from './routes/course-analytics.js';\nimport { assetsRoutes } from './routes/assets.js';\nimport { integrationsRoutes } from './routes/integrations.js';\nimport { accessRoutes } from './routes/access.js';\n\nexport function registerRoutes(app: FastifyInstance, container: Container): void {\n app.get('/health', async () => ({ status: 'ok' }));\n\n app.register(async (instance) => {\n // instance.addHook('onRequest', instance.requireSession);\n await organizationsRoutes(instance, container);\n });\n\n app.register(async (instance) => {\n instance.addHook('onRequest', instance.requireOrgSession);\n await coursesRoutes(instance, container);\n await communitiesRoutes(instance, container);\n await communityModerationRoutes(instance, container);\n await downloadsRoutes(instance, container);\n await bundlesRoutes(instance, container);\n await memberRoutes(instance, container);\n await discussionRoutes(instance, container);\n await activitiesRoutes(instance, container);\n await studentsRoutes(instance, container);\n await entitlementsRoutes(instance, container);\n await automationsRoutes(instance, container);\n await webhooksRoutes(instance, container);\n await dashboardRoutes(instance, container);\n await courseAnalyticsRoutes(instance, container);\n await assetsRoutes(instance, container);\n await integrationsRoutes(instance, container);\n await accessRoutes(instance, container);\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAqBA,SAAgB,eAAe,KAAsB,WAA4B;CAC/E,IAAI,IAAI,WAAW,aAAa,EAAE,QAAQ,KAAK,EAAE;CAEjD,IAAI,SAAS,OAAO,aAAa;EAE/B,MAAM,oBAAoB,UAAU,SAAS;CAC/C,CAAC;CAED,IAAI,SAAS,OAAO,aAAa;EAC/B,SAAS,QAAQ,aAAa,SAAS,iBAAiB;EACxD,MAAM,cAAc,UAAU,SAAS;EACvC,MAAM,kBAAkB,UAAU,SAAS;EAC3C,MAAM,0BAA0B,UAAU,SAAS;EACnD,MAAM,gBAAgB,UAAU,SAAS;EACzC,MAAM,cAAc,UAAU,SAAS;EACvC,MAAM,aAAa,UAAU,SAAS;EACtC,MAAM,iBAAiB,UAAU,SAAS;EAC1C,MAAM,iBAAiB,UAAU,SAAS;EAC1C,MAAM,eAAe,UAAU,SAAS;EACxC,MAAM,mBAAmB,UAAU,SAAS;EAC5C,MAAM,kBAAkB,UAAU,SAAS;EAC3C,MAAM,eAAe,UAAU,SAAS;EACxC,MAAM,gBAAgB,UAAU,SAAS;EACzC,MAAM,sBAAsB,UAAU,SAAS;EAC/C,MAAM,aAAa,UAAU,SAAS;EACtC,MAAM,mBAAmB,UAAU,SAAS;EAC5C,MAAM,aAAa,UAAU,SAAS;CACxC,CAAC;AACH"}
@@ -0,0 +1,146 @@
1
+ import { z } from "zod";
2
+ //#region src/http/schemas/access.d.ts
3
+ declare const ScopeOption: z.ZodObject<{
4
+ scope: z.ZodEnum<{
5
+ "courses:read": "courses:read";
6
+ "courses:write": "courses:write";
7
+ "courses:delete": "courses:delete";
8
+ "downloads:read": "downloads:read";
9
+ "downloads:write": "downloads:write";
10
+ "downloads:delete": "downloads:delete";
11
+ "bundles:read": "bundles:read";
12
+ "bundles:write": "bundles:write";
13
+ "bundles:delete": "bundles:delete";
14
+ "media:read": "media:read";
15
+ "students:read": "students:read";
16
+ "students:invite": "students:invite";
17
+ "access:read": "access:read";
18
+ "access:write": "access:write";
19
+ "analytics:read": "analytics:read";
20
+ "automations:read": "automations:read";
21
+ "automations:write": "automations:write";
22
+ "automations:delete": "automations:delete";
23
+ "comments:read": "comments:read";
24
+ "comments:moderate": "comments:moderate";
25
+ "communities:read": "communities:read";
26
+ "communities:write": "communities:write";
27
+ "communities:delete": "communities:delete";
28
+ "community_members:read": "community_members:read";
29
+ "community_members:write": "community_members:write";
30
+ "community_moderation:read": "community_moderation:read";
31
+ "community_moderation:write": "community_moderation:write";
32
+ }>;
33
+ allowed: z.ZodBoolean;
34
+ }, z.core.$strip>;
35
+ declare const ScopeOptionList: z.ZodArray<z.ZodObject<{
36
+ scope: z.ZodEnum<{
37
+ "courses:read": "courses:read";
38
+ "courses:write": "courses:write";
39
+ "courses:delete": "courses:delete";
40
+ "downloads:read": "downloads:read";
41
+ "downloads:write": "downloads:write";
42
+ "downloads:delete": "downloads:delete";
43
+ "bundles:read": "bundles:read";
44
+ "bundles:write": "bundles:write";
45
+ "bundles:delete": "bundles:delete";
46
+ "media:read": "media:read";
47
+ "students:read": "students:read";
48
+ "students:invite": "students:invite";
49
+ "access:read": "access:read";
50
+ "access:write": "access:write";
51
+ "analytics:read": "analytics:read";
52
+ "automations:read": "automations:read";
53
+ "automations:write": "automations:write";
54
+ "automations:delete": "automations:delete";
55
+ "comments:read": "comments:read";
56
+ "comments:moderate": "comments:moderate";
57
+ "communities:read": "communities:read";
58
+ "communities:write": "communities:write";
59
+ "communities:delete": "communities:delete";
60
+ "community_members:read": "community_members:read";
61
+ "community_members:write": "community_members:write";
62
+ "community_moderation:read": "community_moderation:read";
63
+ "community_moderation:write": "community_moderation:write";
64
+ }>;
65
+ allowed: z.ZodBoolean;
66
+ }, z.core.$strip>>;
67
+ declare const ConnectedApp: z.ZodObject<{
68
+ clientId: z.ZodString;
69
+ name: z.ZodString;
70
+ iconUrl: z.ZodNullable<z.ZodString>;
71
+ scopes: z.ZodArray<z.ZodString>;
72
+ connectedAt: z.ZodCoercedDate<unknown>;
73
+ }, z.core.$strip>;
74
+ declare const ConnectedAppList: z.ZodArray<z.ZodObject<{
75
+ clientId: z.ZodString;
76
+ name: z.ZodString;
77
+ iconUrl: z.ZodNullable<z.ZodString>;
78
+ scopes: z.ZodArray<z.ZodString>;
79
+ connectedAt: z.ZodCoercedDate<unknown>;
80
+ }, z.core.$strip>>;
81
+ declare const ClientIdParam: z.ZodObject<{
82
+ clientId: z.ZodString;
83
+ }, z.core.$strip>;
84
+ declare const ApiKey: z.ZodObject<{
85
+ id: z.ZodString;
86
+ name: z.ZodNullable<z.ZodString>;
87
+ start: z.ZodNullable<z.ZodString>;
88
+ scopes: z.ZodArray<z.ZodString>;
89
+ createdAt: z.ZodCoercedDate<unknown>;
90
+ lastUsedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
91
+ }, z.core.$strip>;
92
+ declare const ApiKeyList: z.ZodArray<z.ZodObject<{
93
+ id: z.ZodString;
94
+ name: z.ZodNullable<z.ZodString>;
95
+ start: z.ZodNullable<z.ZodString>;
96
+ scopes: z.ZodArray<z.ZodString>;
97
+ createdAt: z.ZodCoercedDate<unknown>;
98
+ lastUsedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
99
+ }, z.core.$strip>>;
100
+ declare const CreatedApiKey: z.ZodObject<{
101
+ id: z.ZodString;
102
+ name: z.ZodNullable<z.ZodString>;
103
+ start: z.ZodNullable<z.ZodString>;
104
+ scopes: z.ZodArray<z.ZodString>;
105
+ createdAt: z.ZodCoercedDate<unknown>;
106
+ lastUsedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
107
+ key: z.ZodString;
108
+ }, z.core.$strip>;
109
+ declare const CreateApiKey: z.ZodObject<{
110
+ name: z.ZodString;
111
+ scopes: z.ZodArray<z.ZodEnum<{
112
+ "courses:read": "courses:read";
113
+ "courses:write": "courses:write";
114
+ "courses:delete": "courses:delete";
115
+ "downloads:read": "downloads:read";
116
+ "downloads:write": "downloads:write";
117
+ "downloads:delete": "downloads:delete";
118
+ "bundles:read": "bundles:read";
119
+ "bundles:write": "bundles:write";
120
+ "bundles:delete": "bundles:delete";
121
+ "media:read": "media:read";
122
+ "students:read": "students:read";
123
+ "students:invite": "students:invite";
124
+ "access:read": "access:read";
125
+ "access:write": "access:write";
126
+ "analytics:read": "analytics:read";
127
+ "automations:read": "automations:read";
128
+ "automations:write": "automations:write";
129
+ "automations:delete": "automations:delete";
130
+ "comments:read": "comments:read";
131
+ "comments:moderate": "comments:moderate";
132
+ "communities:read": "communities:read";
133
+ "communities:write": "communities:write";
134
+ "communities:delete": "communities:delete";
135
+ "community_members:read": "community_members:read";
136
+ "community_members:write": "community_members:write";
137
+ "community_moderation:read": "community_moderation:read";
138
+ "community_moderation:write": "community_moderation:write";
139
+ }>>;
140
+ }, z.core.$strip>;
141
+ declare const ApiKeyIdParam: z.ZodObject<{
142
+ id: z.ZodString;
143
+ }, z.core.$strip>;
144
+ //#endregion
145
+ export { ApiKey, ApiKeyIdParam, ApiKeyList, ClientIdParam, ConnectedApp, ConnectedAppList, CreateApiKey, CreatedApiKey, ScopeOption, ScopeOptionList };
146
+ //# sourceMappingURL=access.d.ts.map
@@ -0,0 +1,36 @@
1
+ import { ACCESS_SCOPES } from "@headless-lms/core/organizations";
2
+ import { z } from "zod";
3
+ //#region src/http/schemas/access.ts
4
+ const ScopeOption = z.object({
5
+ scope: z.enum(ACCESS_SCOPES),
6
+ allowed: z.boolean()
7
+ });
8
+ const ScopeOptionList = z.array(ScopeOption);
9
+ const ConnectedApp = z.object({
10
+ clientId: z.string(),
11
+ name: z.string(),
12
+ iconUrl: z.string().nullable(),
13
+ scopes: z.array(z.string()),
14
+ connectedAt: z.coerce.date()
15
+ });
16
+ const ConnectedAppList = z.array(ConnectedApp);
17
+ const ClientIdParam = z.object({ clientId: z.string() });
18
+ const ApiKey = z.object({
19
+ id: z.string(),
20
+ name: z.string().nullable(),
21
+ start: z.string().nullable(),
22
+ scopes: z.array(z.string()),
23
+ createdAt: z.coerce.date(),
24
+ lastUsedAt: z.coerce.date().nullable()
25
+ });
26
+ const ApiKeyList = z.array(ApiKey);
27
+ const CreatedApiKey = ApiKey.extend({ key: z.string() });
28
+ const CreateApiKey = z.object({
29
+ name: z.string().trim().min(1).max(80),
30
+ scopes: z.array(z.enum(ACCESS_SCOPES)).min(1)
31
+ });
32
+ const ApiKeyIdParam = z.object({ id: z.string() });
33
+ //#endregion
34
+ export { ApiKey, ApiKeyIdParam, ApiKeyList, ClientIdParam, ConnectedApp, ConnectedAppList, CreateApiKey, CreatedApiKey, ScopeOption, ScopeOptionList };
35
+
36
+ //# sourceMappingURL=access.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"access.js","names":[],"sources":["../../../src/http/schemas/access.ts"],"sourcesContent":["import { z } from 'zod';\nimport { ACCESS_SCOPES } from '@headless-lms/core/organizations';\n\nexport const ScopeOption = z.object({ scope: z.enum(ACCESS_SCOPES), allowed: z.boolean() });\nexport const ScopeOptionList = z.array(ScopeOption);\n\nexport const ConnectedApp = z.object({\n clientId: z.string(),\n name: z.string(),\n iconUrl: z.string().nullable(),\n scopes: z.array(z.string()),\n connectedAt: z.coerce.date(),\n});\nexport const ConnectedAppList = z.array(ConnectedApp);\nexport const ClientIdParam = z.object({ clientId: z.string() });\n\nexport const ApiKey = z.object({\n id: z.string(),\n name: z.string().nullable(),\n start: z.string().nullable(),\n scopes: z.array(z.string()),\n createdAt: z.coerce.date(),\n lastUsedAt: z.coerce.date().nullable(),\n});\nexport const ApiKeyList = z.array(ApiKey);\nexport const CreatedApiKey = ApiKey.extend({ key: z.string() });\nexport const CreateApiKey = z.object({\n name: z.string().trim().min(1).max(80),\n scopes: z.array(z.enum(ACCESS_SCOPES)).min(1),\n});\nexport const ApiKeyIdParam = z.object({ id: z.string() });\n"],"mappings":";;;AAGA,MAAa,cAAc,EAAE,OAAO;CAAE,OAAO,EAAE,KAAK,aAAa;CAAG,SAAS,EAAE,QAAQ;AAAE,CAAC;AAC1F,MAAa,kBAAkB,EAAE,MAAM,WAAW;AAElD,MAAa,eAAe,EAAE,OAAO;CACnC,UAAU,EAAE,OAAO;CACnB,MAAM,EAAE,OAAO;CACf,SAAS,EAAE,OAAO,CAAC,CAAC,SAAS;CAC7B,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC;CAC1B,aAAa,EAAE,OAAO,KAAK;AAC7B,CAAC;AACD,MAAa,mBAAmB,EAAE,MAAM,YAAY;AACpD,MAAa,gBAAgB,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC;AAE9D,MAAa,SAAS,EAAE,OAAO;CAC7B,IAAI,EAAE,OAAO;CACb,MAAM,EAAE,OAAO,CAAC,CAAC,SAAS;CAC1B,OAAO,EAAE,OAAO,CAAC,CAAC,SAAS;CAC3B,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC;CAC1B,WAAW,EAAE,OAAO,KAAK;CACzB,YAAY,EAAE,OAAO,KAAK,CAAC,CAAC,SAAS;AACvC,CAAC;AACD,MAAa,aAAa,EAAE,MAAM,MAAM;AACxC,MAAa,gBAAgB,OAAO,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;AAC9D,MAAa,eAAe,EAAE,OAAO;CACnC,MAAM,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE;CACrC,QAAQ,EAAE,MAAM,EAAE,KAAK,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC;AAC9C,CAAC;AACD,MAAa,gBAAgB,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC"}
@@ -9,8 +9,19 @@ declare const Activity: z.ZodObject<{
9
9
  settings: z.ZodNullable<z.ZodType<import("@headless-lms/core/types").JsonValue, unknown, z.core.$ZodTypeInternals<import("@headless-lms/core/types").JsonValue, unknown>>>;
10
10
  createdAt: z.ZodCoercedDate<unknown>;
11
11
  updatedAt: z.ZodCoercedDate<unknown>;
12
+ assetUrls: z.ZodRecord<z.ZodString, z.ZodString>;
12
13
  }, z.core.$strict>;
13
14
  type Activity = z.infer<typeof Activity>;
15
+ declare const ActivityAsset: z.ZodObject<{
16
+ orgId: z.ZodString;
17
+ id: z.ZodString;
18
+ activityId: z.ZodString;
19
+ assetId: z.ZodString;
20
+ seq: z.ZodNumber;
21
+ createdAt: z.ZodCoercedDate<unknown>;
22
+ updatedAt: z.ZodCoercedDate<unknown>;
23
+ }, z.core.$strict>;
24
+ type ActivityAsset = z.infer<typeof ActivityAsset>;
14
25
  declare const Module: z.ZodObject<{
15
26
  orgId: z.ZodString;
16
27
  id: z.ZodString;
@@ -32,6 +43,30 @@ declare const ModuleList: z.ZodArray<z.ZodObject<{
32
43
  updatedAt: z.ZodCoercedDate<unknown>;
33
44
  }, z.core.$strict>>;
34
45
  type ModuleList = z.infer<typeof ModuleList>;
46
+ /** A course's activities, each with the stable file URLs of the files it links, ordered by (moduleId, seq). */
47
+ declare const ActivityList: z.ZodArray<z.ZodObject<{
48
+ orgId: z.ZodString;
49
+ id: z.ZodString;
50
+ moduleId: z.ZodString;
51
+ courseId: z.ZodString;
52
+ seq: z.ZodNumber;
53
+ settings: z.ZodNullable<z.ZodType<import("@headless-lms/core/types").JsonValue, unknown, z.core.$ZodTypeInternals<import("@headless-lms/core/types").JsonValue, unknown>>>;
54
+ createdAt: z.ZodCoercedDate<unknown>;
55
+ updatedAt: z.ZodCoercedDate<unknown>;
56
+ assetUrls: z.ZodRecord<z.ZodString, z.ZodString>;
57
+ }, z.core.$strict>>;
58
+ type ActivityList = z.infer<typeof ActivityList>;
59
+ /** A course's activity→asset link rows, ordered by (activityId, seq). */
60
+ declare const ActivityAssetList: z.ZodArray<z.ZodObject<{
61
+ orgId: z.ZodString;
62
+ id: z.ZodString;
63
+ activityId: z.ZodString;
64
+ assetId: z.ZodString;
65
+ seq: z.ZodNumber;
66
+ createdAt: z.ZodCoercedDate<unknown>;
67
+ updatedAt: z.ZodCoercedDate<unknown>;
68
+ }, z.core.$strict>>;
69
+ type ActivityAssetList = z.infer<typeof ActivityAssetList>;
35
70
  declare const CourseIdPathParam: z.ZodObject<{
36
71
  courseId: z.ZodString;
37
72
  }, z.core.$strip>;
@@ -65,5 +100,5 @@ declare const SaveActivity: z.ZodObject<{
65
100
  }, z.core.$strict>;
66
101
  type SaveActivity = z.infer<typeof SaveActivity>;
67
102
  //#endregion
68
- export { Activity, ActivityPathParam, CourseIdPathParam, CreateModule, Module, ModuleList, ModulePathParam, ReorderInput, SaveActivity, UpdateModule };
103
+ export { Activity, ActivityAsset, ActivityAssetList, ActivityList, ActivityPathParam, CourseIdPathParam, CreateModule, Module, ModuleList, ModulePathParam, ReorderInput, SaveActivity, UpdateModule };
69
104
  //# sourceMappingURL=activities.d.ts.map
@@ -1,10 +1,15 @@
1
1
  import { z } from "zod";
2
- import { activitySchema, moduleSchema, saveActivityInputSchema } from "@headless-lms/core/schemas";
2
+ import { activityAssetSchema, activityViewSchema, idSchema, moduleSchema, saveActivityInputSchema } from "@headless-lms/core/schemas";
3
3
  //#region src/http/schemas/activities.ts
4
- const Activity = activitySchema;
4
+ const Activity = activityViewSchema;
5
+ const ActivityAsset = activityAssetSchema;
5
6
  const Module = moduleSchema;
6
7
  /** Module/activity-write endpoints return the full, reordered module list. */
7
8
  const ModuleList = z.array(Module);
9
+ /** A course's activities, each with the stable file URLs of the files it links, ordered by (moduleId, seq). */
10
+ const ActivityList = z.array(Activity);
11
+ /** A course's activity→asset link rows, ordered by (activityId, seq). */
12
+ const ActivityAssetList = z.array(ActivityAsset);
8
13
  const CourseIdPathParam = z.object({ courseId: z.string() });
9
14
  const ModulePathParam = z.object({
10
15
  courseId: z.string(),
@@ -17,9 +22,9 @@ const ActivityPathParam = z.object({
17
22
  });
18
23
  const CreateModule = z.object({ title: z.string().min(1) });
19
24
  const UpdateModule = z.object({ title: z.string().min(1) });
20
- const ReorderInput = z.object({ orderedIds: z.array(z.string()) });
25
+ const ReorderInput = z.object({ orderedIds: z.array(idSchema).max(500).describe("Every id in the collection, in the new order") });
21
26
  const SaveActivity = saveActivityInputSchema;
22
27
  //#endregion
23
- export { Activity, ActivityPathParam, CourseIdPathParam, CreateModule, Module, ModuleList, ModulePathParam, ReorderInput, SaveActivity, UpdateModule };
28
+ export { Activity, ActivityAsset, ActivityAssetList, ActivityList, ActivityPathParam, CourseIdPathParam, CreateModule, Module, ModuleList, ModulePathParam, ReorderInput, SaveActivity, UpdateModule };
24
29
 
25
30
  //# sourceMappingURL=activities.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"activities.js","names":[],"sources":["../../../src/http/schemas/activities.ts"],"sourcesContent":["// Course modules + activities resource schemas. A module holds an ordered list\n// of activities directly; each activity is a uniform, orderable unit placing an\n// opaque settings blob at a position (`seq`) with a set of linked assets.\nimport { z } from \"zod\";\nimport {\n activitySchema,\n moduleSchema,\n saveActivityInputSchema,\n} from \"@headless-lms/core/schemas\";\n\nexport const Activity = activitySchema;\nexport type Activity = z.infer<typeof Activity>;\n\nexport const Module = moduleSchema;\nexport type Module = z.infer<typeof Module>;\n\n/** Module/activity-write endpoints return the full, reordered module list. */\nexport const ModuleList = z.array(Module);\nexport type ModuleList = z.infer<typeof ModuleList>;\n\nexport const CourseIdPathParam = z.object({ courseId: z.string() });\nexport type CourseIdPathParam = z.infer<typeof CourseIdPathParam>;\n\nexport const ModulePathParam = z.object({ courseId: z.string(), moduleId: z.string() });\nexport type ModulePathParam = z.infer<typeof ModulePathParam>;\n\nexport const ActivityPathParam = z.object({\n courseId: z.string(),\n moduleId: z.string(),\n activityId: z.string(),\n});\nexport type ActivityPathParam = z.infer<typeof ActivityPathParam>;\n\nexport const CreateModule = z.object({ title: z.string().min(1) });\nexport type CreateModule = z.infer<typeof CreateModule>;\n\nexport const UpdateModule = z.object({ title: z.string().min(1) });\nexport type UpdateModule = z.infer<typeof UpdateModule>;\n\nexport const ReorderInput = z.object({ orderedIds: z.array(z.string()) });\nexport type ReorderInput = z.infer<typeof ReorderInput>;\n\nexport const SaveActivity = saveActivityInputSchema;\nexport type SaveActivity = z.infer<typeof SaveActivity>;\n"],"mappings":";;;AAUA,MAAa,WAAW;AAGxB,MAAa,SAAS;;AAItB,MAAa,aAAa,EAAE,MAAM,MAAM;AAGxC,MAAa,oBAAoB,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC;AAGlE,MAAa,kBAAkB,EAAE,OAAO;CAAE,UAAU,EAAE,OAAO;CAAG,UAAU,EAAE,OAAO;AAAE,CAAC;AAGtF,MAAa,oBAAoB,EAAE,OAAO;CACxC,UAAU,EAAE,OAAO;CACnB,UAAU,EAAE,OAAO;CACnB,YAAY,EAAE,OAAO;AACvB,CAAC;AAGD,MAAa,eAAe,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;AAGjE,MAAa,eAAe,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;AAGjE,MAAa,eAAe,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;AAGxE,MAAa,eAAe"}
1
+ {"version":3,"file":"activities.js","names":[],"sources":["../../../src/http/schemas/activities.ts"],"sourcesContent":["// Course modules + activities resource schemas. A module holds an ordered list\n// of activities directly; each activity is a uniform, orderable unit placing an\n// opaque settings blob at a position (`seq`) with a set of linked assets.\nimport { z } from 'zod';\nimport {\n activityAssetSchema,\n activityViewSchema,\n moduleSchema,\n saveActivityInputSchema,\n idSchema,\n} from '@headless-lms/core/schemas';\n\nexport const Activity = activityViewSchema;\nexport type Activity = z.infer<typeof Activity>;\n\nexport const ActivityAsset = activityAssetSchema;\nexport type ActivityAsset = z.infer<typeof ActivityAsset>;\n\nexport const Module = moduleSchema;\nexport type Module = z.infer<typeof Module>;\n\n/** Module/activity-write endpoints return the full, reordered module list. */\nexport const ModuleList = z.array(Module);\nexport type ModuleList = z.infer<typeof ModuleList>;\n\n/** A course's activities, each with the stable file URLs of the files it links, ordered by (moduleId, seq). */\nexport const ActivityList = z.array(Activity);\nexport type ActivityList = z.infer<typeof ActivityList>;\n\n/** A course's activity→asset link rows, ordered by (activityId, seq). */\nexport const ActivityAssetList = z.array(ActivityAsset);\nexport type ActivityAssetList = z.infer<typeof ActivityAssetList>;\n\nexport const CourseIdPathParam = z.object({ courseId: z.string() });\nexport type CourseIdPathParam = z.infer<typeof CourseIdPathParam>;\n\nexport const ModulePathParam = z.object({ courseId: z.string(), moduleId: z.string() });\nexport type ModulePathParam = z.infer<typeof ModulePathParam>;\n\nexport const ActivityPathParam = z.object({\n courseId: z.string(),\n moduleId: z.string(),\n activityId: z.string(),\n});\nexport type ActivityPathParam = z.infer<typeof ActivityPathParam>;\n\nexport const CreateModule = z.object({ title: z.string().min(1) });\nexport type CreateModule = z.infer<typeof CreateModule>;\n\nexport const UpdateModule = z.object({ title: z.string().min(1) });\nexport type UpdateModule = z.infer<typeof UpdateModule>;\n\nexport const ReorderInput = z.object({\n orderedIds: z.array(idSchema).max(500).describe('Every id in the collection, in the new order'),\n});\nexport type ReorderInput = z.infer<typeof ReorderInput>;\n\nexport const SaveActivity = saveActivityInputSchema;\nexport type SaveActivity = z.infer<typeof SaveActivity>;\n"],"mappings":";;;AAYA,MAAa,WAAW;AAGxB,MAAa,gBAAgB;AAG7B,MAAa,SAAS;;AAItB,MAAa,aAAa,EAAE,MAAM,MAAM;;AAIxC,MAAa,eAAe,EAAE,MAAM,QAAQ;;AAI5C,MAAa,oBAAoB,EAAE,MAAM,aAAa;AAGtD,MAAa,oBAAoB,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC;AAGlE,MAAa,kBAAkB,EAAE,OAAO;CAAE,UAAU,EAAE,OAAO;CAAG,UAAU,EAAE,OAAO;AAAE,CAAC;AAGtF,MAAa,oBAAoB,EAAE,OAAO;CACxC,UAAU,EAAE,OAAO;CACnB,UAAU,EAAE,OAAO;CACnB,YAAY,EAAE,OAAO;AACvB,CAAC;AAGD,MAAa,eAAe,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;AAGjE,MAAa,eAAe,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;AAGjE,MAAa,eAAe,EAAE,OAAO,EACnC,YAAY,EAAE,MAAM,QAAQ,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,SAAS,8CAA8C,EAChG,CAAC;AAGD,MAAa,eAAe"}