@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,316 @@
1
+ import { z } from "zod";
2
+ //#region src/http/schemas/posts.d.ts
3
+ declare const PostView: z.ZodObject<{
4
+ orgId: z.ZodString;
5
+ id: z.ZodString;
6
+ communityId: z.ZodString;
7
+ spaceId: z.ZodString;
8
+ orgUserId: z.ZodString;
9
+ topicId: z.ZodNullable<z.ZodString>;
10
+ title: z.ZodString;
11
+ body: z.ZodString;
12
+ extra: z.ZodType<import("@headless-lms/core/types").JsonValue, unknown, z.core.$ZodTypeInternals<import("@headless-lms/core/types").JsonValue, unknown>>;
13
+ coverAssetId: z.ZodNullable<z.ZodString>;
14
+ status: z.ZodEnum<{
15
+ pending: "pending";
16
+ draft: "draft";
17
+ published: "published";
18
+ removed: "removed";
19
+ scheduled: "scheduled";
20
+ }>;
21
+ scheduledAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
22
+ publishedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
23
+ removedBy: z.ZodNullable<z.ZodString>;
24
+ pinned: z.ZodBoolean;
25
+ commentsClosed: z.ZodNullable<z.ZodBoolean>;
26
+ reactionsEnabled: z.ZodNullable<z.ZodBoolean>;
27
+ createdAt: z.ZodCoercedDate<unknown>;
28
+ updatedAt: z.ZodCoercedDate<unknown>;
29
+ coverUrl: z.ZodNullable<z.ZodString>;
30
+ author: z.ZodObject<{
31
+ id: z.ZodString;
32
+ firstName: z.ZodNullable<z.ZodString>;
33
+ lastName: z.ZodNullable<z.ZodString>;
34
+ displayName: z.ZodNullable<z.ZodString>;
35
+ headline: z.ZodNullable<z.ZodString>;
36
+ image: z.ZodNullable<z.ZodString>;
37
+ imageAssetId: z.ZodNullable<z.ZodString>;
38
+ imageUrl: z.ZodNullable<z.ZodString>;
39
+ role: z.ZodEnum<{
40
+ owner: "owner";
41
+ admin: "admin";
42
+ instructor: "instructor";
43
+ moderator: "moderator";
44
+ student: "student";
45
+ }>;
46
+ }, z.core.$strict>;
47
+ reactions: z.ZodRecord<z.ZodString, z.ZodNumber>;
48
+ viewerReaction: z.ZodNullable<z.ZodString>;
49
+ commentCount: z.ZodNumber;
50
+ following: z.ZodBoolean;
51
+ bookmarked: z.ZodBoolean;
52
+ }, z.core.$strict>;
53
+ declare const PostFlag: z.ZodObject<{
54
+ orgId: z.ZodString;
55
+ id: z.ZodString;
56
+ postId: z.ZodString;
57
+ orgUserId: z.ZodString;
58
+ reason: z.ZodString;
59
+ resolvedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
60
+ resolution: z.ZodNullable<z.ZodEnum<{
61
+ dismissed: "dismissed";
62
+ removed: "removed";
63
+ }>>;
64
+ resolvedBy: z.ZodNullable<z.ZodString>;
65
+ createdAt: z.ZodCoercedDate<unknown>;
66
+ updatedAt: z.ZodCoercedDate<unknown>;
67
+ }, z.core.$strict>;
68
+ declare const PostFeedPage: z.ZodObject<{
69
+ rows: z.ZodArray<z.ZodObject<{
70
+ orgId: z.ZodString;
71
+ id: z.ZodString;
72
+ communityId: z.ZodString;
73
+ spaceId: z.ZodString;
74
+ orgUserId: z.ZodString;
75
+ topicId: z.ZodNullable<z.ZodString>;
76
+ title: z.ZodString;
77
+ body: z.ZodString;
78
+ extra: z.ZodType<import("@headless-lms/core/types").JsonValue, unknown, z.core.$ZodTypeInternals<import("@headless-lms/core/types").JsonValue, unknown>>;
79
+ coverAssetId: z.ZodNullable<z.ZodString>;
80
+ status: z.ZodEnum<{
81
+ pending: "pending";
82
+ draft: "draft";
83
+ published: "published";
84
+ removed: "removed";
85
+ scheduled: "scheduled";
86
+ }>;
87
+ scheduledAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
88
+ publishedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
89
+ removedBy: z.ZodNullable<z.ZodString>;
90
+ pinned: z.ZodBoolean;
91
+ commentsClosed: z.ZodNullable<z.ZodBoolean>;
92
+ reactionsEnabled: z.ZodNullable<z.ZodBoolean>;
93
+ createdAt: z.ZodCoercedDate<unknown>;
94
+ updatedAt: z.ZodCoercedDate<unknown>;
95
+ coverUrl: z.ZodNullable<z.ZodString>;
96
+ author: z.ZodObject<{
97
+ id: z.ZodString;
98
+ firstName: z.ZodNullable<z.ZodString>;
99
+ lastName: z.ZodNullable<z.ZodString>;
100
+ displayName: z.ZodNullable<z.ZodString>;
101
+ headline: z.ZodNullable<z.ZodString>;
102
+ image: z.ZodNullable<z.ZodString>;
103
+ imageAssetId: z.ZodNullable<z.ZodString>;
104
+ imageUrl: z.ZodNullable<z.ZodString>;
105
+ role: z.ZodEnum<{
106
+ owner: "owner";
107
+ admin: "admin";
108
+ instructor: "instructor";
109
+ moderator: "moderator";
110
+ student: "student";
111
+ }>;
112
+ }, z.core.$strict>;
113
+ reactions: z.ZodRecord<z.ZodString, z.ZodNumber>;
114
+ viewerReaction: z.ZodNullable<z.ZodString>;
115
+ commentCount: z.ZodNumber;
116
+ following: z.ZodBoolean;
117
+ bookmarked: z.ZodBoolean;
118
+ }, z.core.$strict>>;
119
+ total: z.ZodNumber;
120
+ page: z.ZodNumber;
121
+ pageSize: z.ZodNumber;
122
+ }, z.core.$strip>;
123
+ declare const PostIdParam: z.ZodObject<{
124
+ postId: z.ZodString;
125
+ }, z.core.$strip>;
126
+ declare const FeedQuery: z.ZodObject<{
127
+ page: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
128
+ pageSize: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
129
+ topicId: z.ZodOptional<z.ZodString>;
130
+ }, z.core.$strict>;
131
+ declare const CreatePost: z.ZodObject<{
132
+ title: z.ZodString;
133
+ body: z.ZodString;
134
+ topicId: z.ZodNullable<z.ZodString>;
135
+ extra: z.ZodDefault<z.ZodType<import("@headless-lms/core/types").JsonValue, unknown, z.core.$ZodTypeInternals<import("@headless-lms/core/types").JsonValue, unknown>>>;
136
+ coverAssetId: z.ZodNullable<z.ZodString>;
137
+ mode: z.ZodEnum<{
138
+ draft: "draft";
139
+ submit: "submit";
140
+ schedule: "schedule";
141
+ }>;
142
+ scheduledAt: z.ZodNullable<z.ZodPipe<z.ZodISODateTime, z.ZodCoercedDate<string>>>;
143
+ }, z.core.$strict>;
144
+ declare const UpdatePost: z.ZodObject<{
145
+ title: z.ZodOptional<z.ZodString>;
146
+ body: z.ZodOptional<z.ZodString>;
147
+ topicId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
148
+ extra: z.ZodOptional<z.ZodType<import("@headless-lms/core/types").JsonValue, unknown, z.core.$ZodTypeInternals<import("@headless-lms/core/types").JsonValue, unknown>>>;
149
+ coverAssetId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
150
+ }, z.core.$strict>;
151
+ declare const SchedulePost: z.ZodObject<{
152
+ scheduledAt: z.ZodPipe<z.ZodISODateTime, z.ZodCoercedDate<string>>;
153
+ }, z.core.$strict>;
154
+ declare const SetPostReactions: z.ZodObject<{
155
+ enabled: z.ZodBoolean;
156
+ }, z.core.$strict>;
157
+ declare const FlagReason: z.ZodObject<{
158
+ reason: z.ZodString;
159
+ }, z.core.$strict>;
160
+ declare const ResolvePostFlags: z.ZodObject<{
161
+ resolution: z.ZodEnum<{
162
+ dismissed: "dismissed";
163
+ }>;
164
+ }, z.core.$strict>;
165
+ declare const SpaceQueue: z.ZodObject<{
166
+ pending: z.ZodArray<z.ZodObject<{
167
+ orgId: z.ZodString;
168
+ id: z.ZodString;
169
+ communityId: z.ZodString;
170
+ spaceId: z.ZodString;
171
+ orgUserId: z.ZodString;
172
+ topicId: z.ZodNullable<z.ZodString>;
173
+ title: z.ZodString;
174
+ body: z.ZodString;
175
+ extra: z.ZodType<import("@headless-lms/core/types").JsonValue, unknown, z.core.$ZodTypeInternals<import("@headless-lms/core/types").JsonValue, unknown>>;
176
+ coverAssetId: z.ZodNullable<z.ZodString>;
177
+ status: z.ZodEnum<{
178
+ pending: "pending";
179
+ draft: "draft";
180
+ published: "published";
181
+ removed: "removed";
182
+ scheduled: "scheduled";
183
+ }>;
184
+ scheduledAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
185
+ publishedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
186
+ removedBy: z.ZodNullable<z.ZodString>;
187
+ pinned: z.ZodBoolean;
188
+ commentsClosed: z.ZodNullable<z.ZodBoolean>;
189
+ reactionsEnabled: z.ZodNullable<z.ZodBoolean>;
190
+ createdAt: z.ZodCoercedDate<unknown>;
191
+ updatedAt: z.ZodCoercedDate<unknown>;
192
+ coverUrl: z.ZodNullable<z.ZodString>;
193
+ author: z.ZodObject<{
194
+ id: z.ZodString;
195
+ firstName: z.ZodNullable<z.ZodString>;
196
+ lastName: z.ZodNullable<z.ZodString>;
197
+ displayName: z.ZodNullable<z.ZodString>;
198
+ headline: z.ZodNullable<z.ZodString>;
199
+ image: z.ZodNullable<z.ZodString>;
200
+ imageAssetId: z.ZodNullable<z.ZodString>;
201
+ imageUrl: z.ZodNullable<z.ZodString>;
202
+ role: z.ZodEnum<{
203
+ owner: "owner";
204
+ admin: "admin";
205
+ instructor: "instructor";
206
+ moderator: "moderator";
207
+ student: "student";
208
+ }>;
209
+ }, z.core.$strict>;
210
+ reactions: z.ZodRecord<z.ZodString, z.ZodNumber>;
211
+ viewerReaction: z.ZodNullable<z.ZodString>;
212
+ commentCount: z.ZodNumber;
213
+ following: z.ZodBoolean;
214
+ bookmarked: z.ZodBoolean;
215
+ }, z.core.$strict>>;
216
+ flags: z.ZodArray<z.ZodObject<{
217
+ orgId: z.ZodString;
218
+ id: z.ZodString;
219
+ postId: z.ZodString;
220
+ orgUserId: z.ZodString;
221
+ reason: z.ZodString;
222
+ resolvedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
223
+ resolution: z.ZodNullable<z.ZodEnum<{
224
+ dismissed: "dismissed";
225
+ removed: "removed";
226
+ }>>;
227
+ resolvedBy: z.ZodNullable<z.ZodString>;
228
+ createdAt: z.ZodCoercedDate<unknown>;
229
+ updatedAt: z.ZodCoercedDate<unknown>;
230
+ }, z.core.$strict>>;
231
+ commentFlags: z.ZodArray<z.ZodObject<{
232
+ id: z.ZodString;
233
+ orgId: z.ZodString;
234
+ commentId: z.ZodString;
235
+ orgUserId: z.ZodString;
236
+ reason: z.ZodString;
237
+ resolvedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
238
+ resolution: z.ZodNullable<z.ZodEnum<{
239
+ dismissed: "dismissed";
240
+ removed: "removed";
241
+ }>>;
242
+ resolvedBy: z.ZodNullable<z.ZodString>;
243
+ createdAt: z.ZodCoercedDate<unknown>;
244
+ updatedAt: z.ZodCoercedDate<unknown>;
245
+ comment: z.ZodObject<{
246
+ id: z.ZodString;
247
+ postId: z.ZodString;
248
+ body: z.ZodString;
249
+ orgUserId: z.ZodString;
250
+ status: z.ZodEnum<{
251
+ pending: "pending";
252
+ published: "published";
253
+ removed: "removed";
254
+ }>;
255
+ }, z.core.$strict>;
256
+ }, z.core.$strict>>;
257
+ }, z.core.$strip>;
258
+ declare const PostCommentsPage: z.ZodObject<{
259
+ rows: z.ZodArray<z.ZodObject<{
260
+ id: z.ZodString;
261
+ activityId: z.ZodNullable<z.ZodString>;
262
+ postId: z.ZodNullable<z.ZodString>;
263
+ communityId: z.ZodNullable<z.ZodString>;
264
+ parentId: z.ZodNullable<z.ZodString>;
265
+ author: z.ZodObject<{
266
+ id: z.ZodString;
267
+ firstName: z.ZodNullable<z.ZodString>;
268
+ lastName: z.ZodNullable<z.ZodString>;
269
+ displayName: z.ZodNullable<z.ZodString>;
270
+ headline: z.ZodNullable<z.ZodString>;
271
+ image: z.ZodNullable<z.ZodString>;
272
+ imageAssetId: z.ZodNullable<z.ZodString>;
273
+ imageUrl: z.ZodNullable<z.ZodString>;
274
+ role: z.ZodEnum<{
275
+ owner: "owner";
276
+ admin: "admin";
277
+ instructor: "instructor";
278
+ moderator: "moderator";
279
+ student: "student";
280
+ }>;
281
+ }, z.core.$strict>;
282
+ body: z.ZodNullable<z.ZodString>;
283
+ status: z.ZodEnum<{
284
+ pending: "pending";
285
+ published: "published";
286
+ removed: "removed";
287
+ }>;
288
+ removedBy: z.ZodNullable<z.ZodObject<{
289
+ id: z.ZodString;
290
+ firstName: z.ZodNullable<z.ZodString>;
291
+ lastName: z.ZodNullable<z.ZodString>;
292
+ displayName: z.ZodNullable<z.ZodString>;
293
+ headline: z.ZodNullable<z.ZodString>;
294
+ image: z.ZodNullable<z.ZodString>;
295
+ imageAssetId: z.ZodNullable<z.ZodString>;
296
+ imageUrl: z.ZodNullable<z.ZodString>;
297
+ role: z.ZodEnum<{
298
+ owner: "owner";
299
+ admin: "admin";
300
+ instructor: "instructor";
301
+ moderator: "moderator";
302
+ student: "student";
303
+ }>;
304
+ }, z.core.$strict>>;
305
+ reactions: z.ZodRecord<z.ZodString, z.ZodNumber>;
306
+ viewerReaction: z.ZodOptional<z.ZodString>;
307
+ createdAt: z.ZodCoercedDate<unknown>;
308
+ updatedAt: z.ZodCoercedDate<unknown>;
309
+ }, z.core.$strict>>;
310
+ total: z.ZodNumber;
311
+ page: z.ZodNumber;
312
+ pageSize: z.ZodNumber;
313
+ }, z.core.$strip>;
314
+ //#endregion
315
+ export { CreatePost, FeedQuery, FlagReason, PostCommentsPage, PostFeedPage, PostFlag, PostIdParam, PostView, ResolvePostFlags, SchedulePost, SetPostReactions, SpaceQueue, UpdatePost };
316
+ //# sourceMappingURL=posts.d.ts.map
@@ -0,0 +1,47 @@
1
+ import { DateTimeInput, PageQuery, paginated } from "./shared.js";
2
+ import { CommentView } from "./discussion.js";
3
+ import { z } from "zod";
4
+ import { boundedJsonSchema, flaggedCommentSchema, idSchema, postFlagResolutionSchema, postFlagSchema, postViewSchema } from "@headless-lms/core/schemas";
5
+ //#region src/http/schemas/posts.ts
6
+ const PostView = postViewSchema;
7
+ const PostFlag = postFlagSchema;
8
+ const PostFeedPage = paginated(PostView);
9
+ const PostIdParam = z.object({ postId: z.string() });
10
+ const FeedQuery = PageQuery.extend({ topicId: z.string().optional().describe("Only posts under this topic") }).strict();
11
+ const PostTitle = z.string().trim().min(1).max(200);
12
+ const PostBody = z.string().max(5e4);
13
+ const PostExtra = boundedJsonSchema(16 * 1024);
14
+ const CreatePost = z.object({
15
+ title: PostTitle,
16
+ body: PostBody,
17
+ topicId: idSchema.nullable().describe("One of the space's topics. Required when the space has topics, else null"),
18
+ extra: PostExtra.default({}),
19
+ coverAssetId: idSchema.nullable().describe("A finalized image you uploaded through `requestMemberUpload`"),
20
+ mode: z.enum([
21
+ "draft",
22
+ "submit",
23
+ "schedule"
24
+ ]).describe("`draft` keeps the post to yourself. `submit` publishes it, or holds it for review when the space requires review and you are not staff. `schedule` submits it at `scheduledAt`."),
25
+ scheduledAt: DateTimeInput.nullable().describe("When a scheduled post is submitted. Required, and in the future, when `mode` is `schedule`; ignored otherwise.")
26
+ }).strict();
27
+ const UpdatePost = z.object({
28
+ title: PostTitle.optional(),
29
+ body: PostBody.optional(),
30
+ topicId: idSchema.nullable().optional(),
31
+ extra: PostExtra.optional(),
32
+ coverAssetId: idSchema.nullable().optional()
33
+ }).strict();
34
+ const SchedulePost = z.object({ scheduledAt: DateTimeInput.describe("When the post is submitted; must be in the future") }).strict();
35
+ const SetPostReactions = z.object({ enabled: z.boolean().describe("Whether readers may react to this post") }).strict();
36
+ const FlagReason = z.object({ reason: z.string().trim().min(1).max(1e3) }).strict();
37
+ const ResolvePostFlags = z.object({ resolution: postFlagResolutionSchema.extract(["dismissed"]).describe("`dismissed` closes the open flags and leaves the post up. Removing the post resolves its flags as `removed` instead.") }).strict();
38
+ const SpaceQueue = z.object({
39
+ pending: z.array(PostView),
40
+ flags: z.array(PostFlag),
41
+ commentFlags: z.array(flaggedCommentSchema)
42
+ });
43
+ const PostCommentsPage = paginated(CommentView);
44
+ //#endregion
45
+ export { CreatePost, FeedQuery, FlagReason, PostCommentsPage, PostFeedPage, PostFlag, PostIdParam, PostView, ResolvePostFlags, SchedulePost, SetPostReactions, SpaceQueue, UpdatePost };
46
+
47
+ //# sourceMappingURL=posts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"posts.js","names":[],"sources":["../../../src/http/schemas/posts.ts"],"sourcesContent":["import { z } from 'zod';\nimport {\n boundedJsonSchema,\n flaggedCommentSchema,\n idSchema,\n postFlagResolutionSchema,\n postFlagSchema,\n postViewSchema,\n} from '@headless-lms/core/schemas';\nimport { CommentView } from './discussion.js';\nimport { DateTimeInput, PageQuery, paginated } from './shared.js';\n\nexport const PostView = postViewSchema;\nexport const PostFlag = postFlagSchema;\nexport const PostFeedPage = paginated(PostView);\nexport const PostIdParam = z.object({ postId: z.string() });\nexport const FeedQuery = PageQuery.extend({\n topicId: z.string().optional().describe('Only posts under this topic'),\n}).strict();\n\nconst PostTitle = z.string().trim().min(1).max(200);\nconst PostBody = z.string().max(50_000);\nconst PostExtra = boundedJsonSchema(16 * 1024);\n\nexport const CreatePost = z\n .object({\n title: PostTitle,\n body: PostBody,\n topicId: idSchema\n .nullable()\n .describe(\"One of the space's topics. Required when the space has topics, else null\"),\n extra: PostExtra.default({}),\n coverAssetId: idSchema\n .nullable()\n .describe('A finalized image you uploaded through `requestMemberUpload`'),\n mode: z\n .enum(['draft', 'submit', 'schedule'])\n .describe(\n '`draft` keeps the post to yourself. `submit` publishes it, or holds it for review when the space requires review and you are not staff. `schedule` submits it at `scheduledAt`.',\n ),\n scheduledAt: DateTimeInput.nullable().describe(\n 'When a scheduled post is submitted. Required, and in the future, when `mode` is `schedule`; ignored otherwise.',\n ),\n })\n .strict();\n\nexport const UpdatePost = z\n .object({\n title: PostTitle.optional(),\n body: PostBody.optional(),\n topicId: idSchema.nullable().optional(),\n extra: PostExtra.optional(),\n coverAssetId: idSchema.nullable().optional(),\n })\n .strict();\n\nexport const SchedulePost = z\n .object({\n scheduledAt: DateTimeInput.describe('When the post is submitted; must be in the future'),\n })\n .strict();\nexport const SetPostReactions = z\n .object({ enabled: z.boolean().describe('Whether readers may react to this post') })\n .strict();\nexport const FlagReason = z.object({ reason: z.string().trim().min(1).max(1_000) }).strict();\nexport const ResolvePostFlags = z\n .object({\n resolution: postFlagResolutionSchema\n .extract(['dismissed'])\n .describe(\n '`dismissed` closes the open flags and leaves the post up. Removing the post resolves its flags as `removed` instead.',\n ),\n })\n .strict();\n\nexport const SpaceQueue = z.object({\n pending: z.array(PostView),\n flags: z.array(PostFlag),\n commentFlags: z.array(flaggedCommentSchema),\n});\n\nexport const PostCommentsPage = paginated(CommentView);\n"],"mappings":";;;;;AAYA,MAAa,WAAW;AACxB,MAAa,WAAW;AACxB,MAAa,eAAe,UAAU,QAAQ;AAC9C,MAAa,cAAc,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;AAC1D,MAAa,YAAY,UAAU,OAAO,EACxC,SAAS,EAAE,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS,6BAA6B,EACvE,CAAC,CAAC,CAAC,OAAO;AAEV,MAAM,YAAY,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG;AAClD,MAAM,WAAW,EAAE,OAAO,CAAC,CAAC,IAAI,GAAM;AACtC,MAAM,YAAY,kBAAkB,KAAK,IAAI;AAE7C,MAAa,aAAa,EACvB,OAAO;CACN,OAAO;CACP,MAAM;CACN,SAAS,SACN,SAAS,CAAC,CACV,SAAS,0EAA0E;CACtF,OAAO,UAAU,QAAQ,CAAC,CAAC;CAC3B,cAAc,SACX,SAAS,CAAC,CACV,SAAS,8DAA8D;CAC1E,MAAM,EACH,KAAK;EAAC;EAAS;EAAU;CAAU,CAAC,CAAC,CACrC,SACC,iLACF;CACF,aAAa,cAAc,SAAS,CAAC,CAAC,SACpC,gHACF;AACF,CAAC,CAAC,CACD,OAAO;AAEV,MAAa,aAAa,EACvB,OAAO;CACN,OAAO,UAAU,SAAS;CAC1B,MAAM,SAAS,SAAS;CACxB,SAAS,SAAS,SAAS,CAAC,CAAC,SAAS;CACtC,OAAO,UAAU,SAAS;CAC1B,cAAc,SAAS,SAAS,CAAC,CAAC,SAAS;AAC7C,CAAC,CAAC,CACD,OAAO;AAEV,MAAa,eAAe,EACzB,OAAO,EACN,aAAa,cAAc,SAAS,mDAAmD,EACzF,CAAC,CAAC,CACD,OAAO;AACV,MAAa,mBAAmB,EAC7B,OAAO,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC,SAAS,wCAAwC,EAAE,CAAC,CAAC,CACnF,OAAO;AACV,MAAa,aAAa,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAK,EAAE,CAAC,CAAC,CAAC,OAAO;AAC3F,MAAa,mBAAmB,EAC7B,OAAO,EACN,YAAY,yBACT,QAAQ,CAAC,WAAW,CAAC,CAAC,CACtB,SACC,sHACF,EACJ,CAAC,CAAC,CACD,OAAO;AAEV,MAAa,aAAa,EAAE,OAAO;CACjC,SAAS,EAAE,MAAM,QAAQ;CACzB,OAAO,EAAE,MAAM,QAAQ;CACvB,cAAc,EAAE,MAAM,oBAAoB;AAC5C,CAAC;AAED,MAAa,mBAAmB,UAAU,WAAW"}
@@ -0,0 +1,23 @@
1
+ import { z } from "zod";
2
+ //#region src/http/schemas/profile.d.ts
3
+ declare const UserProfile: z.ZodObject<{
4
+ createdAt: z.ZodCoercedDate<unknown>;
5
+ updatedAt: z.ZodCoercedDate<unknown>;
6
+ displayName: z.ZodNullable<z.ZodString>;
7
+ headline: z.ZodNullable<z.ZodString>;
8
+ imageAssetId: z.ZodNullable<z.ZodString>;
9
+ imageUrl: z.ZodNullable<z.ZodString>;
10
+ bio: z.ZodNullable<z.ZodString>;
11
+ userId: z.ZodString;
12
+ extra: z.ZodType<import("@headless-lms/core/types").JsonValue, unknown, z.core.$ZodTypeInternals<import("@headless-lms/core/types").JsonValue, unknown>>;
13
+ }, z.core.$strip>;
14
+ declare const UpdateProfile: z.ZodObject<{
15
+ displayName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
16
+ headline: z.ZodOptional<z.ZodNullable<z.ZodString>>;
17
+ bio: z.ZodOptional<z.ZodNullable<z.ZodString>>;
18
+ imageAssetId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
19
+ extra: z.ZodOptional<z.ZodType<import("@headless-lms/core/types").JsonValue, unknown, z.core.$ZodTypeInternals<import("@headless-lms/core/types").JsonValue, unknown>>>;
20
+ }, z.core.$strict>;
21
+ //#endregion
22
+ export { UpdateProfile, UserProfile };
23
+ //# sourceMappingURL=profile.d.ts.map
@@ -0,0 +1,15 @@
1
+ import { z } from "zod";
2
+ import { boundedJsonSchema, idSchema, userProfileViewSchema } from "@headless-lms/core/schemas";
3
+ //#region src/http/schemas/profile.ts
4
+ const UserProfile = userProfileViewSchema.omit({ imageAssetOrgId: true }).strip();
5
+ const UpdateProfile = z.object({
6
+ displayName: z.string().trim().max(80).nullable().optional(),
7
+ headline: z.string().trim().max(160).nullable().optional(),
8
+ bio: z.string().trim().max(2e3).nullable().optional(),
9
+ imageAssetId: idSchema.nullable().optional().describe("A finalized image you uploaded through `requestMemberUpload`; null clears it"),
10
+ extra: boundedJsonSchema(16 * 1024).optional()
11
+ }).strict();
12
+ //#endregion
13
+ export { UpdateProfile, UserProfile };
14
+
15
+ //# sourceMappingURL=profile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profile.js","names":[],"sources":["../../../src/http/schemas/profile.ts"],"sourcesContent":["import { z } from 'zod';\nimport { boundedJsonSchema, idSchema, userProfileViewSchema } from '@headless-lms/core/schemas';\n\nexport const UserProfile = userProfileViewSchema.omit({ imageAssetOrgId: true }).strip();\nexport const UpdateProfile = z\n .object({\n displayName: z.string().trim().max(80).nullable().optional(),\n headline: z.string().trim().max(160).nullable().optional(),\n bio: z.string().trim().max(2_000).nullable().optional(),\n imageAssetId: idSchema\n .nullable()\n .optional()\n .describe('A finalized image you uploaded through `requestMemberUpload`; null clears it'),\n extra: boundedJsonSchema(16 * 1024).optional(),\n })\n .strict();\n"],"mappings":";;;AAGA,MAAa,cAAc,sBAAsB,KAAK,EAAE,iBAAiB,KAAK,CAAC,CAAC,CAAC,MAAM;AACvF,MAAa,gBAAgB,EAC1B,OAAO;CACN,aAAa,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS;CAC3D,UAAU,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS;CACzD,KAAK,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,GAAK,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS;CACtD,cAAc,SACX,SAAS,CAAC,CACV,SAAS,CAAC,CACV,SAAS,8EAA8E;CAC1F,OAAO,kBAAkB,KAAK,IAAI,CAAC,CAAC,SAAS;AAC/C,CAAC,CAAC,CACD,OAAO"}
@@ -1 +1 @@
1
- {"version":3,"file":"settings.js","names":[],"sources":["../../../src/http/schemas/settings.ts"],"sourcesContent":["import { z } from \"zod\";\n\n/** A namespace's values. The owning domain defines the shape; the contract\n * carries it opaquely so a new namespace needs no contract change. */\nexport const SettingsValue = z.record(z.string(), z.unknown());\nexport type SettingsValue = z.infer<typeof SettingsValue>;\n\n\nexport const ScopeSettings = z.object({\n scopeId: z.string(),\n namespaces: z.record(z.string(), z.any()),\n});\nexport type ScopeSettings = z.infer<typeof ScopeSettings>;\n\nexport const SettingsScopeParam = z.object({ scopeId: z.string() });\nexport const SettingsNamespaceParam = z.object({\n scopeId: z.string(),\n namespace: z.string(),\n});\n\n/** Partial by definition — the server shallow-merges it into the stored value. */\nexport const PatchSettings = SettingsValue;\n"],"mappings":";;;;AAIA,MAAa,gBAAgB,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,QAAQ,CAAC;AAI7D,MAAa,gBAAgB,EAAE,OAAO;CACpC,SAAS,EAAE,OAAO;CAClB,YAAY,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,IAAI,CAAC;AAC1C,CAAC;AAGD,MAAa,qBAAqB,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC;AAClE,MAAa,yBAAyB,EAAE,OAAO;CAC7C,SAAS,EAAE,OAAO;CAClB,WAAW,EAAE,OAAO;AACtB,CAAC;;AAGD,MAAa,gBAAgB"}
1
+ {"version":3,"file":"settings.js","names":[],"sources":["../../../src/http/schemas/settings.ts"],"sourcesContent":["import { z } from 'zod';\n\n/** A namespace's values. The owning domain defines the shape; the contract\n * carries it opaquely so a new namespace needs no contract change. */\nexport const SettingsValue = z.record(z.string(), z.unknown());\nexport type SettingsValue = z.infer<typeof SettingsValue>;\n\nexport const ScopeSettings = z.object({\n scopeId: z.string(),\n namespaces: z.record(z.string(), z.any()),\n});\nexport type ScopeSettings = z.infer<typeof ScopeSettings>;\n\nexport const SettingsScopeParam = z.object({ scopeId: z.string() });\nexport const SettingsNamespaceParam = z.object({\n scopeId: z.string(),\n namespace: z.string(),\n});\n\n/** Partial by definition — the server shallow-merges it into the stored value. */\nexport const PatchSettings = SettingsValue;\n"],"mappings":";;;;AAIA,MAAa,gBAAgB,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,QAAQ,CAAC;AAG7D,MAAa,gBAAgB,EAAE,OAAO;CACpC,SAAS,EAAE,OAAO;CAClB,YAAY,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,IAAI,CAAC;AAC1C,CAAC;AAGD,MAAa,qBAAqB,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC;AAClE,MAAa,yBAAyB,EAAE,OAAO;CAC7C,SAAS,EAAE,OAAO;CAClB,WAAW,EAAE,OAAO;AACtB,CAAC;;AAGD,MAAa,gBAAgB"}
@@ -6,8 +6,32 @@ type Matches<A, _B extends A> = true;
6
6
  declare const ErrorBody: z.ZodObject<{
7
7
  error: z.ZodString;
8
8
  message: z.ZodOptional<z.ZodString>;
9
+ requestId: z.ZodOptional<z.ZodString>;
9
10
  }, z.core.$strip>;
10
11
  type ErrorBody = z.infer<typeof ErrorBody>;
12
+ /** A 400 from request validation: `message` names the first problem, `issues` lists them all. */
13
+ declare const ValidationErrorBody: z.ZodObject<{
14
+ error: z.ZodString;
15
+ message: z.ZodOptional<z.ZodString>;
16
+ requestId: z.ZodOptional<z.ZodString>;
17
+ issues: z.ZodOptional<z.ZodArray<z.ZodObject<{
18
+ path: z.ZodString;
19
+ message: z.ZodString;
20
+ }, z.core.$strip>>>;
21
+ }, z.core.$strip>;
22
+ type ValidationErrorBody = z.infer<typeof ValidationErrorBody>;
23
+ type RefusalStatus = 400 | 403 | 404 | 409 | 413 | 415 | 502;
24
+ type RefusalBodies<S extends RefusalStatus> = { [K in S]: K extends 400 ? typeof ValidationErrorBody : typeof ErrorBody; };
25
+ /** Response schemas for the refusals a route can answer. A 400 keeps the validation `issues`. */
26
+ declare function refusals<S extends RefusalStatus>(...statuses: S[]): RefusalBodies<S>;
27
+ /** An RFC 3339 date-time in a request, such as `2026-10-29T12:00:00Z`, read as a Date. */
28
+ declare const DateTimeInput: z.ZodPipe<z.ZodISODateTime, z.ZodCoercedDate<string>>;
29
+ /** Page position only, for lists that take no search or sort. */
30
+ declare const PageQuery: z.ZodObject<{
31
+ page: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
32
+ pageSize: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
33
+ }, z.core.$strict>;
34
+ type PageQuery = z.infer<typeof PageQuery>;
11
35
  /**
12
36
  * Common list query for page-based collections. `z.coerce` because query-string
13
37
  * values arrive as strings; defaults make the params optional for callers.
@@ -32,6 +56,7 @@ declare const OrgRole: z.ZodEnum<{
32
56
  owner: "owner";
33
57
  admin: "admin";
34
58
  instructor: "instructor";
59
+ moderator: "moderator";
35
60
  student: "student";
36
61
  }>;
37
62
  type OrgRole = z.infer<typeof OrgRole>;
@@ -53,5 +78,5 @@ declare const OrgUserProfileSchema: z.ZodObject<{
53
78
  }, z.core.$strip>;
54
79
  type OrgUserProfileSchema = z.infer<typeof OrgUserProfileSchema>;
55
80
  //#endregion
56
- export { ErrorBody, ListQuery, Matches, OrgRole, OrgUserProfileSchema, UserProfileSchema, paginated };
81
+ export { DateTimeInput, ErrorBody, ListQuery, Matches, OrgRole, OrgUserProfileSchema, PageQuery, UserProfileSchema, ValidationErrorBody, paginated, refusals };
57
82
  //# sourceMappingURL=shared.d.ts.map
@@ -3,8 +3,26 @@ import { z } from "zod";
3
3
  /** Uniform error envelope returned by every non-2xx response. */
4
4
  const ErrorBody = z.object({
5
5
  error: z.string(),
6
- message: z.string().optional()
6
+ message: z.string().optional(),
7
+ /** Server-side correlation id — quote it to find the matching API log line. */
8
+ requestId: z.string().optional()
7
9
  });
10
+ /** A 400 from request validation: `message` names the first problem, `issues` lists them all. */
11
+ const ValidationErrorBody = ErrorBody.extend({ issues: z.array(z.object({
12
+ path: z.string().describe("Where in the request, such as `body.topics[1].name`"),
13
+ message: z.string()
14
+ })).optional() });
15
+ /** Response schemas for the refusals a route can answer. A 400 keeps the validation `issues`. */
16
+ function refusals(...statuses) {
17
+ return Object.fromEntries(statuses.map((status) => [status, status === 400 ? ValidationErrorBody : ErrorBody]));
18
+ }
19
+ /** An RFC 3339 date-time in a request, such as `2026-10-29T12:00:00Z`, read as a Date. */
20
+ const DateTimeInput = z.iso.datetime({ offset: true }).pipe(z.coerce.date());
21
+ /** Page position only, for lists that take no search or sort. */
22
+ const PageQuery = z.object({
23
+ page: z.coerce.number().int().min(1).default(1),
24
+ pageSize: z.coerce.number().int().min(1).max(100).default(20)
25
+ }).strict();
8
26
  /**
9
27
  * Common list query for page-based collections. `z.coerce` because query-string
10
28
  * values arrive as strings; defaults make the params optional for callers.
@@ -12,7 +30,7 @@ const ErrorBody = z.object({
12
30
  const ListQuery = z.object({
13
31
  page: z.coerce.number().int().min(1).default(1),
14
32
  pageSize: z.coerce.number().int().min(1).max(100).default(20),
15
- search: z.string().trim().optional(),
33
+ search: z.string().trim().max(200).optional(),
16
34
  /** Sort field, optionally prefixed with `-` for descending (e.g. `-updatedAt`). */
17
35
  sort: z.string().optional()
18
36
  });
@@ -31,6 +49,7 @@ const OrgRole = z.enum([
31
49
  "owner",
32
50
  "admin",
33
51
  "instructor",
52
+ "moderator",
34
53
  "student"
35
54
  ]);
36
55
  /** Mirrors UserProfile in @headless-lms/core/types — keyed on the auth user id. */
@@ -49,6 +68,6 @@ const OrgUserProfileSchema = z.object({
49
68
  image: z.string().nullable()
50
69
  });
51
70
  //#endregion
52
- export { ErrorBody, ListQuery, OrgRole, OrgUserProfileSchema, UserProfileSchema, paginated };
71
+ export { DateTimeInput, ErrorBody, ListQuery, OrgRole, OrgUserProfileSchema, PageQuery, UserProfileSchema, ValidationErrorBody, paginated, refusals };
53
72
 
54
73
  //# sourceMappingURL=shared.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"shared.js","names":[],"sources":["../../../src/http/schemas/shared.ts"],"sourcesContent":["// Shared contract primitives reused across resource contracts.\nimport { z } from \"zod\";\n\n/** Fails typecheck when a schema and its domain type drift apart. */\nexport type Matches<A, _B extends A> = true;\n\n/** Uniform error envelope returned by every non-2xx response. */\nexport const ErrorBody = z.object({\n error: z.string(),\n message: z.string().optional(),\n});\nexport type ErrorBody = z.infer<typeof ErrorBody>;\n\n/**\n * Common list query for page-based collections. `z.coerce` because query-string\n * values arrive as strings; defaults make the params optional for callers.\n */\nexport const ListQuery = z.object({\n page: z.coerce.number().int().min(1).default(1),\n pageSize: z.coerce.number().int().min(1).max(100).default(20),\n search: z.string().trim().optional(),\n /** Sort field, optionally prefixed with `-` for descending (e.g. `-updatedAt`). */\n sort: z.string().optional(),\n});\nexport type ListQuery = z.infer<typeof ListQuery>;\n\n/** Wrap a row schema into the standard paginated envelope. */\nexport function paginated<T extends z.ZodTypeAny>(row: T) {\n return z.object({\n rows: z.array(row),\n total: z.number().int(),\n page: z.number().int(),\n pageSize: z.number().int(),\n });\n}\n\n/** All four org roles. `members.ts` exports a staff-only three-value `Role`;\n * this is the full set, used wherever a learner can also appear. */\nexport const OrgRole = z.enum([\"owner\", \"admin\", \"instructor\", \"student\"]);\nexport type OrgRole = z.infer<typeof OrgRole>;\n\n/** Mirrors UserProfile in @headless-lms/core/types — keyed on the auth user id. */\nexport const UserProfileSchema = z.object({\n id: z.string(),\n name: z.string(),\n email: z.string(),\n image: z.string().nullable(),\n});\nexport type UserProfileSchema = z.infer<typeof UserProfileSchema>;\n\n/** Mirrors OrgUserProfile in @headless-lms/core/types — keyed on org_users.id. */\nexport const OrgUserProfileSchema = z.object({\n id: z.string(),\n firstName: z.string().nullable(),\n lastName: z.string().nullable(),\n email: z.string(),\n image: z.string().nullable(),\n});\nexport type OrgUserProfileSchema = z.infer<typeof OrgUserProfileSchema>;\n"],"mappings":";;;AAOA,MAAa,YAAY,EAAE,OAAO;CAChC,OAAO,EAAE,OAAO;CAChB,SAAS,EAAE,OAAO,CAAC,CAAC,SAAS;AAC/B,CAAC;;;;;AAOD,MAAa,YAAY,EAAE,OAAO;CAChC,MAAM,EAAE,OAAO,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC;CAC9C,UAAU,EAAE,OAAO,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE;CAC5D,QAAQ,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,SAAS;;CAEnC,MAAM,EAAE,OAAO,CAAC,CAAC,SAAS;AAC5B,CAAC;;AAID,SAAgB,UAAkC,KAAQ;CACxD,OAAO,EAAE,OAAO;EACd,MAAM,EAAE,MAAM,GAAG;EACjB,OAAO,EAAE,OAAO,CAAC,CAAC,IAAI;EACtB,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI;EACrB,UAAU,EAAE,OAAO,CAAC,CAAC,IAAI;CAC3B,CAAC;AACH;;;AAIA,MAAa,UAAU,EAAE,KAAK;CAAC;CAAS;CAAS;CAAc;AAAS,CAAC;;AAIzE,MAAa,oBAAoB,EAAE,OAAO;CACxC,IAAI,EAAE,OAAO;CACb,MAAM,EAAE,OAAO;CACf,OAAO,EAAE,OAAO;CAChB,OAAO,EAAE,OAAO,CAAC,CAAC,SAAS;AAC7B,CAAC;;AAID,MAAa,uBAAuB,EAAE,OAAO;CAC3C,IAAI,EAAE,OAAO;CACb,WAAW,EAAE,OAAO,CAAC,CAAC,SAAS;CAC/B,UAAU,EAAE,OAAO,CAAC,CAAC,SAAS;CAC9B,OAAO,EAAE,OAAO;CAChB,OAAO,EAAE,OAAO,CAAC,CAAC,SAAS;AAC7B,CAAC"}
1
+ {"version":3,"file":"shared.js","names":[],"sources":["../../../src/http/schemas/shared.ts"],"sourcesContent":["// Shared contract primitives reused across resource contracts.\nimport { z } from 'zod';\n\n/** Fails typecheck when a schema and its domain type drift apart. */\nexport type Matches<A, _B extends A> = true;\n\n/** Uniform error envelope returned by every non-2xx response. */\nexport const ErrorBody = z.object({\n error: z.string(),\n message: z.string().optional(),\n /** Server-side correlation id — quote it to find the matching API log line. */\n requestId: z.string().optional(),\n});\nexport type ErrorBody = z.infer<typeof ErrorBody>;\n\n/** A 400 from request validation: `message` names the first problem, `issues` lists them all. */\nexport const ValidationErrorBody = ErrorBody.extend({\n issues: z\n .array(\n z.object({\n path: z.string().describe('Where in the request, such as `body.topics[1].name`'),\n message: z.string(),\n }),\n )\n .optional(),\n});\nexport type ValidationErrorBody = z.infer<typeof ValidationErrorBody>;\n\ntype RefusalStatus = 400 | 403 | 404 | 409 | 413 | 415 | 502;\ntype RefusalBodies<S extends RefusalStatus> = {\n [K in S]: K extends 400 ? typeof ValidationErrorBody : typeof ErrorBody;\n};\n\n/** Response schemas for the refusals a route can answer. A 400 keeps the validation `issues`. */\nexport function refusals<S extends RefusalStatus>(...statuses: S[]): RefusalBodies<S> {\n return Object.fromEntries(\n statuses.map((status) => [status, status === 400 ? ValidationErrorBody : ErrorBody]),\n ) as RefusalBodies<S>;\n}\n\n/** An RFC 3339 date-time in a request, such as `2026-10-29T12:00:00Z`, read as a Date. */\nexport const DateTimeInput = z.iso.datetime({ offset: true }).pipe(z.coerce.date());\n\n/** Page position only, for lists that take no search or sort. */\nexport const PageQuery = z\n .object({\n page: z.coerce.number().int().min(1).default(1),\n pageSize: z.coerce.number().int().min(1).max(100).default(20),\n })\n .strict();\nexport type PageQuery = z.infer<typeof PageQuery>;\n\n/**\n * Common list query for page-based collections. `z.coerce` because query-string\n * values arrive as strings; defaults make the params optional for callers.\n */\nexport const ListQuery = z.object({\n page: z.coerce.number().int().min(1).default(1),\n pageSize: z.coerce.number().int().min(1).max(100).default(20),\n search: z.string().trim().max(200).optional(),\n /** Sort field, optionally prefixed with `-` for descending (e.g. `-updatedAt`). */\n sort: z.string().optional(),\n});\nexport type ListQuery = z.infer<typeof ListQuery>;\n\n/** Wrap a row schema into the standard paginated envelope. */\nexport function paginated<T extends z.ZodTypeAny>(row: T) {\n return z.object({\n rows: z.array(row),\n total: z.number().int(),\n page: z.number().int(),\n pageSize: z.number().int(),\n });\n}\n\n/** All four org roles. `members.ts` exports a staff-only three-value `Role`;\n * this is the full set, used wherever a learner can also appear. */\nexport const OrgRole = z.enum(['owner', 'admin', 'instructor', 'moderator', 'student']);\nexport type OrgRole = z.infer<typeof OrgRole>;\n\n/** Mirrors UserProfile in @headless-lms/core/types — keyed on the auth user id. */\nexport const UserProfileSchema = z.object({\n id: z.string(),\n name: z.string(),\n email: z.string(),\n image: z.string().nullable(),\n});\nexport type UserProfileSchema = z.infer<typeof UserProfileSchema>;\n\n/** Mirrors OrgUserProfile in @headless-lms/core/types — keyed on org_users.id. */\nexport const OrgUserProfileSchema = z.object({\n id: z.string(),\n firstName: z.string().nullable(),\n lastName: z.string().nullable(),\n email: z.string(),\n image: z.string().nullable(),\n});\nexport type OrgUserProfileSchema = z.infer<typeof OrgUserProfileSchema>;\n"],"mappings":";;;AAOA,MAAa,YAAY,EAAE,OAAO;CAChC,OAAO,EAAE,OAAO;CAChB,SAAS,EAAE,OAAO,CAAC,CAAC,SAAS;;CAE7B,WAAW,EAAE,OAAO,CAAC,CAAC,SAAS;AACjC,CAAC;;AAID,MAAa,sBAAsB,UAAU,OAAO,EAClD,QAAQ,EACL,MACC,EAAE,OAAO;CACP,MAAM,EAAE,OAAO,CAAC,CAAC,SAAS,qDAAqD;CAC/E,SAAS,EAAE,OAAO;AACpB,CAAC,CACH,CAAC,CACA,SAAS,EACd,CAAC;;AASD,SAAgB,SAAkC,GAAG,UAAiC;CACpF,OAAO,OAAO,YACZ,SAAS,KAAK,WAAW,CAAC,QAAQ,WAAW,MAAM,sBAAsB,SAAS,CAAC,CACrF;AACF;;AAGA,MAAa,gBAAgB,EAAE,IAAI,SAAS,EAAE,QAAQ,KAAK,CAAC,CAAC,CAAC,KAAK,EAAE,OAAO,KAAK,CAAC;;AAGlF,MAAa,YAAY,EACtB,OAAO;CACN,MAAM,EAAE,OAAO,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC;CAC9C,UAAU,EAAE,OAAO,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE;AAC9D,CAAC,CAAC,CACD,OAAO;;;;;AAOV,MAAa,YAAY,EAAE,OAAO;CAChC,MAAM,EAAE,OAAO,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC;CAC9C,UAAU,EAAE,OAAO,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE;CAC5D,QAAQ,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,SAAS;;CAE5C,MAAM,EAAE,OAAO,CAAC,CAAC,SAAS;AAC5B,CAAC;;AAID,SAAgB,UAAkC,KAAQ;CACxD,OAAO,EAAE,OAAO;EACd,MAAM,EAAE,MAAM,GAAG;EACjB,OAAO,EAAE,OAAO,CAAC,CAAC,IAAI;EACtB,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI;EACrB,UAAU,EAAE,OAAO,CAAC,CAAC,IAAI;CAC3B,CAAC;AACH;;;AAIA,MAAa,UAAU,EAAE,KAAK;CAAC;CAAS;CAAS;CAAc;CAAa;AAAS,CAAC;;AAItF,MAAa,oBAAoB,EAAE,OAAO;CACxC,IAAI,EAAE,OAAO;CACb,MAAM,EAAE,OAAO;CACf,OAAO,EAAE,OAAO;CAChB,OAAO,EAAE,OAAO,CAAC,CAAC,SAAS;AAC7B,CAAC;;AAID,MAAa,uBAAuB,EAAE,OAAO;CAC3C,IAAI,EAAE,OAAO;CACb,WAAW,EAAE,OAAO,CAAC,CAAC,SAAS;CAC/B,UAAU,EAAE,OAAO,CAAC,CAAC,SAAS;CAC9B,OAAO,EAAE,OAAO;CAChB,OAAO,EAAE,OAAO,CAAC,CAAC,SAAS;AAC7B,CAAC"}
@@ -1,8 +1,8 @@
1
1
  import { z } from "zod";
2
2
  //#region src/http/schemas/students.d.ts
3
3
  declare const OrgUserStatus: z.ZodEnum<{
4
- active: "active";
5
4
  invited: "invited";
5
+ active: "active";
6
6
  }>;
7
7
  type OrgUserStatus = z.infer<typeof OrgUserStatus>;
8
8
  declare const Student: z.ZodObject<{
@@ -14,13 +14,41 @@ declare const Student: z.ZodObject<{
14
14
  entitlementCount: z.ZodNumber;
15
15
  avgProgress: z.ZodNumber;
16
16
  status: z.ZodEnum<{
17
- active: "active";
18
17
  invited: "invited";
18
+ active: "active";
19
19
  }>;
20
20
  joinedAt: z.ZodString;
21
21
  lastActiveAt: z.ZodNullable<z.ZodString>;
22
22
  }, z.core.$strip>;
23
23
  type Student = z.infer<typeof Student>;
24
+ declare const StudentCourseProgress: z.ZodObject<{
25
+ courseId: z.ZodString;
26
+ title: z.ZodString;
27
+ totalActivities: z.ZodNumber;
28
+ completedActivities: z.ZodNumber;
29
+ progress: z.ZodNumber;
30
+ startedAt: z.ZodNullable<z.ZodString>;
31
+ lastActivityAt: z.ZodNullable<z.ZodString>;
32
+ completedAt: z.ZodNullable<z.ZodString>;
33
+ }, z.core.$strip>;
34
+ type StudentCourseProgress = z.infer<typeof StudentCourseProgress>;
35
+ declare const StudentAnalytics: z.ZodObject<{
36
+ enrolled: z.ZodNumber;
37
+ started: z.ZodNumber;
38
+ completed: z.ZodNumber;
39
+ avgProgress: z.ZodNumber;
40
+ courses: z.ZodArray<z.ZodObject<{
41
+ courseId: z.ZodString;
42
+ title: z.ZodString;
43
+ totalActivities: z.ZodNumber;
44
+ completedActivities: z.ZodNumber;
45
+ progress: z.ZodNumber;
46
+ startedAt: z.ZodNullable<z.ZodString>;
47
+ lastActivityAt: z.ZodNullable<z.ZodString>;
48
+ completedAt: z.ZodNullable<z.ZodString>;
49
+ }, z.core.$strip>>;
50
+ }, z.core.$strip>;
51
+ type StudentAnalytics = z.infer<typeof StudentAnalytics>;
24
52
  declare const StudentsQuery: z.ZodObject<{
25
53
  page: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
26
54
  pageSize: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
@@ -38,8 +66,8 @@ declare const StudentsPage: z.ZodObject<{
38
66
  entitlementCount: z.ZodNumber;
39
67
  avgProgress: z.ZodNumber;
40
68
  status: z.ZodEnum<{
41
- active: "active";
42
69
  invited: "invited";
70
+ active: "active";
43
71
  }>;
44
72
  joinedAt: z.ZodString;
45
73
  lastActiveAt: z.ZodNullable<z.ZodString>;
@@ -53,12 +81,6 @@ declare const StudentIdParam: z.ZodObject<{
53
81
  id: z.ZodString;
54
82
  }, z.core.$strip>;
55
83
  type StudentIdParam = z.infer<typeof StudentIdParam>;
56
- declare const UpdateStudentBody: z.ZodObject<{
57
- firstName: z.ZodString;
58
- lastName: z.ZodString;
59
- email: z.ZodString;
60
- }, z.core.$strip>;
61
- type UpdateStudentBody = z.infer<typeof UpdateStudentBody>;
62
84
  //#endregion
63
- export { OrgUserStatus, Student, StudentIdParam, StudentsPage, StudentsQuery, UpdateStudentBody };
85
+ export { OrgUserStatus, Student, StudentAnalytics, StudentCourseProgress, StudentIdParam, StudentsPage, StudentsQuery };
64
86
  //# sourceMappingURL=students.d.ts.map
@@ -11,15 +11,28 @@ const Student = OrgUserProfileSchema.extend({
11
11
  joinedAt: z.string(),
12
12
  lastActiveAt: z.string().nullable()
13
13
  });
14
+ const StudentCourseProgress = z.object({
15
+ courseId: z.string(),
16
+ title: z.string(),
17
+ totalActivities: z.number().int(),
18
+ completedActivities: z.number().int(),
19
+ /** 0–100, completed published activities over the course's total. */
20
+ progress: z.number().int(),
21
+ startedAt: z.string().nullable(),
22
+ lastActivityAt: z.string().nullable(),
23
+ completedAt: z.string().nullable()
24
+ });
25
+ const StudentAnalytics = z.object({
26
+ enrolled: z.number().int(),
27
+ started: z.number().int(),
28
+ completed: z.number().int(),
29
+ avgProgress: z.number().int(),
30
+ courses: z.array(StudentCourseProgress)
31
+ });
14
32
  const StudentsQuery = ListQuery;
15
33
  const StudentsPage = paginated(Student);
16
34
  const StudentIdParam = z.object({ id: z.string() });
17
- const UpdateStudentBody = z.object({
18
- firstName: z.string().trim().min(1),
19
- lastName: z.string().trim().min(1),
20
- email: z.string().email()
21
- });
22
35
  //#endregion
23
- export { OrgUserStatus, Student, StudentIdParam, StudentsPage, StudentsQuery, UpdateStudentBody };
36
+ export { OrgUserStatus, Student, StudentAnalytics, StudentCourseProgress, StudentIdParam, StudentsPage, StudentsQuery };
24
37
 
25
38
  //# sourceMappingURL=students.js.map