@headless-lms/server 0.2.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (351) hide show
  1. package/dist/_virtual/_rolldown/runtime.js +5 -0
  2. package/dist/app/community-mail.d.ts +24 -0
  3. package/dist/app/community-mail.js +92 -0
  4. package/dist/app/community-mail.js.map +1 -0
  5. package/dist/app/container.d.ts +40 -19
  6. package/dist/app/container.js +294 -45
  7. package/dist/app/container.js.map +1 -1
  8. package/dist/app/mcp-endpoints.d.ts +13 -0
  9. package/dist/app/mcp-endpoints.js +25 -0
  10. package/dist/app/mcp-endpoints.js.map +1 -0
  11. package/dist/app/notification-channels.d.ts +47 -0
  12. package/dist/app/notification-channels.js +174 -0
  13. package/dist/app/notification-channels.js.map +1 -0
  14. package/dist/app/notification-reads.d.ts +23 -0
  15. package/dist/app/notification-reads.js +95 -0
  16. package/dist/app/notification-reads.js.map +1 -0
  17. package/dist/http/config.d.ts +2 -1
  18. package/dist/http/errors.d.ts +15 -0
  19. package/dist/http/errors.js +162 -0
  20. package/dist/http/errors.js.map +1 -0
  21. package/dist/http/mcp/catalogue.d.ts +37 -0
  22. package/dist/http/mcp/catalogue.js +69 -0
  23. package/dist/http/mcp/catalogue.js.map +1 -0
  24. package/dist/http/mcp/challenge.d.ts +7 -0
  25. package/dist/http/mcp/challenge.js +35 -0
  26. package/dist/http/mcp/challenge.js.map +1 -0
  27. package/dist/http/mcp/input-schema.d.ts +7 -0
  28. package/dist/http/mcp/input-schema.js +28 -0
  29. package/dist/http/mcp/input-schema.js.map +1 -0
  30. package/dist/http/mcp/route.d.ts +8 -0
  31. package/dist/http/mcp/route.js +75 -0
  32. package/dist/http/mcp/route.js.map +1 -0
  33. package/dist/http/mcp/server.d.ts +8 -0
  34. package/dist/http/mcp/server.js +31 -0
  35. package/dist/http/mcp/server.js.map +1 -0
  36. package/dist/http/mcp/test-support.d.ts +55 -0
  37. package/dist/http/mcp/test-support.js +151 -0
  38. package/dist/http/mcp/test-support.js.map +1 -0
  39. package/dist/http/mcp/tool.d.ts +48 -0
  40. package/dist/http/mcp/tool.js +58 -0
  41. package/dist/http/mcp/tool.js.map +1 -0
  42. package/dist/http/mcp/tools/automations.d.ts +6 -0
  43. package/dist/http/mcp/tools/automations.js +120 -0
  44. package/dist/http/mcp/tools/automations.js.map +1 -0
  45. package/dist/http/mcp/tools/catalog.d.ts +6 -0
  46. package/dist/http/mcp/tools/catalog.js +200 -0
  47. package/dist/http/mcp/tools/catalog.js.map +1 -0
  48. package/dist/http/mcp/tools/comments.d.ts +6 -0
  49. package/dist/http/mcp/tools/comments.js +70 -0
  50. package/dist/http/mcp/tools/comments.js.map +1 -0
  51. package/dist/http/mcp/tools/communities.d.ts +6 -0
  52. package/dist/http/mcp/tools/communities.js +175 -0
  53. package/dist/http/mcp/tools/communities.js.map +1 -0
  54. package/dist/http/mcp/tools/community-members.d.ts +6 -0
  55. package/dist/http/mcp/tools/community-members.js +89 -0
  56. package/dist/http/mcp/tools/community-members.js.map +1 -0
  57. package/dist/http/mcp/tools/community-moderation.d.ts +6 -0
  58. package/dist/http/mcp/tools/community-moderation.js +144 -0
  59. package/dist/http/mcp/tools/community-moderation.js.map +1 -0
  60. package/dist/http/mcp/tools/courses.d.ts +6 -0
  61. package/dist/http/mcp/tools/courses.js +121 -0
  62. package/dist/http/mcp/tools/courses.js.map +1 -0
  63. package/dist/http/mcp/tools/index.d.ts +6 -0
  64. package/dist/http/mcp/tools/index.js +23 -0
  65. package/dist/http/mcp/tools/index.js.map +1 -0
  66. package/dist/http/mcp/tools/people.d.ts +6 -0
  67. package/dist/http/mcp/tools/people.js +145 -0
  68. package/dist/http/mcp/tools/people.js.map +1 -0
  69. package/dist/http/plugins/auth.js +13 -5
  70. package/dist/http/plugins/auth.js.map +1 -1
  71. package/dist/http/plugins/error-handler.d.ts +2 -1
  72. package/dist/http/plugins/error-handler.js +51 -65
  73. package/dist/http/plugins/error-handler.js.map +1 -1
  74. package/dist/http/plugins/openapi.js +49 -2
  75. package/dist/http/plugins/openapi.js.map +1 -1
  76. package/dist/http/routes/access.d.ts +7 -0
  77. package/dist/http/routes/access.js +140 -0
  78. package/dist/http/routes/access.js.map +1 -0
  79. package/dist/http/routes/activities.js +68 -23
  80. package/dist/http/routes/activities.js.map +1 -1
  81. package/dist/http/routes/assets.js +60 -55
  82. package/dist/http/routes/assets.js.map +1 -1
  83. package/dist/http/routes/automations.js +44 -24
  84. package/dist/http/routes/automations.js.map +1 -1
  85. package/dist/http/routes/bundles.js +29 -18
  86. package/dist/http/routes/bundles.js.map +1 -1
  87. package/dist/http/routes/communities.d.ts +7 -0
  88. package/dist/http/routes/communities.js +522 -0
  89. package/dist/http/routes/communities.js.map +1 -0
  90. package/dist/http/routes/community-moderation.d.ts +7 -0
  91. package/dist/http/routes/community-moderation.js +425 -0
  92. package/dist/http/routes/community-moderation.js.map +1 -0
  93. package/dist/http/routes/course-analytics.js +9 -7
  94. package/dist/http/routes/course-analytics.js.map +1 -1
  95. package/dist/http/routes/courses.js +30 -15
  96. package/dist/http/routes/courses.js.map +1 -1
  97. package/dist/http/routes/dashboard.js +15 -6
  98. package/dist/http/routes/dashboard.js.map +1 -1
  99. package/dist/http/routes/discussion.js +34 -26
  100. package/dist/http/routes/discussion.js.map +1 -1
  101. package/dist/http/routes/downloads.js +48 -30
  102. package/dist/http/routes/downloads.js.map +1 -1
  103. package/dist/http/routes/entitlements.js +16 -7
  104. package/dist/http/routes/entitlements.js.map +1 -1
  105. package/dist/http/routes/integrations.js +38 -41
  106. package/dist/http/routes/integrations.js.map +1 -1
  107. package/dist/http/routes/member/actor.d.ts +14 -0
  108. package/dist/http/routes/member/actor.js +11 -0
  109. package/dist/http/routes/member/actor.js.map +1 -0
  110. package/dist/http/routes/member/assets.d.ts +7 -0
  111. package/dist/http/routes/member/assets.js +79 -0
  112. package/dist/http/routes/member/assets.js.map +1 -0
  113. package/dist/http/routes/member/chats.d.ts +7 -0
  114. package/dist/http/routes/member/chats.js +435 -0
  115. package/dist/http/routes/member/chats.js.map +1 -0
  116. package/dist/http/routes/member/comments.d.ts +7 -0
  117. package/dist/http/routes/member/comments.js +187 -0
  118. package/dist/http/routes/member/comments.js.map +1 -0
  119. package/dist/http/routes/member/community.d.ts +7 -0
  120. package/dist/http/routes/member/community.js +312 -0
  121. package/dist/http/routes/member/community.js.map +1 -0
  122. package/dist/http/routes/member/courses.d.ts +7 -0
  123. package/dist/http/routes/member/courses.js +101 -0
  124. package/dist/http/routes/member/courses.js.map +1 -0
  125. package/dist/http/routes/member/devices.d.ts +7 -0
  126. package/dist/http/routes/member/devices.js +98 -0
  127. package/dist/http/routes/member/devices.js.map +1 -0
  128. package/dist/http/routes/member/downloads.d.ts +7 -0
  129. package/dist/http/routes/member/downloads.js +56 -0
  130. package/dist/http/routes/member/downloads.js.map +1 -0
  131. package/dist/http/routes/member/files.d.ts +7 -0
  132. package/dist/http/routes/member/files.js +184 -0
  133. package/dist/http/routes/member/files.js.map +1 -0
  134. package/dist/http/routes/member/index.d.ts +7 -0
  135. package/dist/http/routes/member/index.js +35 -0
  136. package/dist/http/routes/member/index.js.map +1 -0
  137. package/dist/http/routes/member/notification-settings.d.ts +7 -0
  138. package/dist/http/routes/member/notification-settings.js +108 -0
  139. package/dist/http/routes/member/notification-settings.js.map +1 -0
  140. package/dist/http/routes/member/notifications.d.ts +7 -0
  141. package/dist/http/routes/member/notifications.js +125 -0
  142. package/dist/http/routes/member/notifications.js.map +1 -0
  143. package/dist/http/routes/member/org.d.ts +7 -0
  144. package/dist/http/routes/member/org.js +56 -0
  145. package/dist/http/routes/member/org.js.map +1 -0
  146. package/dist/http/routes/member/posts.d.ts +7 -0
  147. package/dist/http/routes/member/posts.js +612 -0
  148. package/dist/http/routes/member/posts.js.map +1 -0
  149. package/dist/http/routes/member/profile.d.ts +7 -0
  150. package/dist/http/routes/member/profile.js +48 -0
  151. package/dist/http/routes/member/profile.js.map +1 -0
  152. package/dist/http/routes/member/progress.d.ts +7 -0
  153. package/dist/http/routes/member/progress.js +60 -0
  154. package/dist/http/routes/member/progress.js.map +1 -0
  155. package/dist/http/routes/organizations.js +171 -25
  156. package/dist/http/routes/organizations.js.map +1 -1
  157. package/dist/http/routes/students.js +32 -47
  158. package/dist/http/routes/students.js.map +1 -1
  159. package/dist/http/routes/webhooks.js +26 -18
  160. package/dist/http/routes/webhooks.js.map +1 -1
  161. package/dist/http/routes.js +8 -2
  162. package/dist/http/routes.js.map +1 -1
  163. package/dist/http/schemas/access.d.ts +146 -0
  164. package/dist/http/schemas/access.js +36 -0
  165. package/dist/http/schemas/access.js.map +1 -0
  166. package/dist/http/schemas/activities.d.ts +3 -1
  167. package/dist/http/schemas/activities.js +4 -4
  168. package/dist/http/schemas/activities.js.map +1 -1
  169. package/dist/http/schemas/assets.d.ts +79 -80
  170. package/dist/http/schemas/assets.js +23 -13
  171. package/dist/http/schemas/assets.js.map +1 -1
  172. package/dist/http/schemas/automations.d.ts +6 -0
  173. package/dist/http/schemas/bundles.js +6 -6
  174. package/dist/http/schemas/bundles.js.map +1 -1
  175. package/dist/http/schemas/chats.d.ts +409 -0
  176. package/dist/http/schemas/chats.js +56 -0
  177. package/dist/http/schemas/chats.js.map +1 -0
  178. package/dist/http/schemas/community.d.ts +597 -0
  179. package/dist/http/schemas/community.js +132 -0
  180. package/dist/http/schemas/community.js.map +1 -0
  181. package/dist/http/schemas/content.d.ts +4 -2
  182. package/dist/http/schemas/content.js +11 -8
  183. package/dist/http/schemas/content.js.map +1 -1
  184. package/dist/http/schemas/discussion.d.ts +98 -14
  185. package/dist/http/schemas/discussion.js +25 -12
  186. package/dist/http/schemas/discussion.js.map +1 -1
  187. package/dist/http/schemas/downloads.d.ts +11 -5
  188. package/dist/http/schemas/downloads.js +14 -11
  189. package/dist/http/schemas/downloads.js.map +1 -1
  190. package/dist/http/schemas/entitlements.d.ts +6 -6
  191. package/dist/http/schemas/entitlements.js +6 -6
  192. package/dist/http/schemas/entitlements.js.map +1 -1
  193. package/dist/http/schemas/files.d.ts +45 -0
  194. package/dist/http/schemas/files.js +25 -0
  195. package/dist/http/schemas/files.js.map +1 -0
  196. package/dist/http/schemas/index.d.ts +15 -8
  197. package/dist/http/schemas/index.js +15 -8
  198. package/dist/http/schemas/integrations.d.ts +4 -4
  199. package/dist/http/schemas/invites.d.ts +4 -0
  200. package/dist/http/schemas/invites.js +1 -0
  201. package/dist/http/schemas/invites.js.map +1 -1
  202. package/dist/http/schemas/{learn.d.ts → member.d.ts} +31 -18
  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 +35 -2
  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 +550 -0
  209. package/dist/http/schemas/notifications.js +164 -0
  210. package/dist/http/schemas/notifications.js.map +1 -0
  211. package/dist/http/schemas/posts.d.ts +350 -0
  212. package/dist/http/schemas/posts.js +47 -0
  213. package/dist/http/schemas/posts.js.map +1 -0
  214. package/dist/http/schemas/profile.d.ts +23 -0
  215. package/dist/http/schemas/profile.js +15 -0
  216. package/dist/http/schemas/profile.js.map +1 -0
  217. package/dist/http/schemas/shared.d.ts +32 -1
  218. package/dist/http/schemas/shared.js +20 -2
  219. package/dist/http/schemas/shared.js.map +1 -1
  220. package/dist/http/schemas/students.d.ts +1 -7
  221. package/dist/http/schemas/students.js +1 -7
  222. package/dist/http/schemas/students.js.map +1 -1
  223. package/dist/http/scope.d.ts +3 -1
  224. package/dist/http/scope.js +26 -4
  225. package/dist/http/scope.js.map +1 -1
  226. package/dist/http/server.js +6 -1
  227. package/dist/http/server.js.map +1 -1
  228. package/dist/http/web-bridge.d.ts +1 -1
  229. package/dist/http/web-bridge.js +2 -2
  230. package/dist/http/web-bridge.js.map +1 -1
  231. package/dist/http/well-known.d.ts +7 -0
  232. package/dist/http/well-known.js +22 -0
  233. package/dist/http/well-known.js.map +1 -0
  234. package/dist/index.d.ts +3 -1
  235. package/dist/index.js +4 -2
  236. package/dist/index.js.map +1 -1
  237. package/dist/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.js +78 -0
  238. package/dist/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.js.map +1 -0
  239. package/dist/node_modules/.pnpm/@vitest_expect@2.1.9/node_modules/@vitest/expect/dist/index.js +1267 -0
  240. package/dist/node_modules/.pnpm/@vitest_expect@2.1.9/node_modules/@vitest/expect/dist/index.js.map +1 -0
  241. package/dist/node_modules/.pnpm/@vitest_pretty-format@2.1.9/node_modules/@vitest/pretty-format/dist/index.js +814 -0
  242. package/dist/node_modules/.pnpm/@vitest_pretty-format@2.1.9/node_modules/@vitest/pretty-format/dist/index.js.map +1 -0
  243. package/dist/node_modules/.pnpm/@vitest_runner@2.1.9/node_modules/@vitest/runner/dist/chunk-tasks.js +43 -0
  244. package/dist/node_modules/.pnpm/@vitest_runner@2.1.9/node_modules/@vitest/runner/dist/chunk-tasks.js.map +1 -0
  245. package/dist/node_modules/.pnpm/@vitest_runner@2.1.9/node_modules/@vitest/runner/dist/index.js +527 -0
  246. package/dist/node_modules/.pnpm/@vitest_runner@2.1.9/node_modules/@vitest/runner/dist/index.js.map +1 -0
  247. package/dist/node_modules/.pnpm/@vitest_runner@2.1.9/node_modules/@vitest/runner/dist/utils.js +2 -0
  248. package/dist/node_modules/.pnpm/@vitest_snapshot@2.1.9/node_modules/@vitest/snapshot/dist/index.js +1737 -0
  249. package/dist/node_modules/.pnpm/@vitest_snapshot@2.1.9/node_modules/@vitest/snapshot/dist/index.js.map +1 -0
  250. package/dist/node_modules/.pnpm/@vitest_spy@2.1.9/node_modules/@vitest/spy/dist/index.js +137 -0
  251. package/dist/node_modules/.pnpm/@vitest_spy@2.1.9/node_modules/@vitest/spy/dist/index.js.map +1 -0
  252. package/dist/node_modules/.pnpm/@vitest_utils@2.1.9/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.js +118 -0
  253. package/dist/node_modules/.pnpm/@vitest_utils@2.1.9/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.js.map +1 -0
  254. package/dist/node_modules/.pnpm/@vitest_utils@2.1.9/node_modules/@vitest/utils/dist/diff.js +1222 -0
  255. package/dist/node_modules/.pnpm/@vitest_utils@2.1.9/node_modules/@vitest/utils/dist/diff.js.map +1 -0
  256. package/dist/node_modules/.pnpm/@vitest_utils@2.1.9/node_modules/@vitest/utils/dist/error.js +91 -0
  257. package/dist/node_modules/.pnpm/@vitest_utils@2.1.9/node_modules/@vitest/utils/dist/error.js.map +1 -0
  258. package/dist/node_modules/.pnpm/@vitest_utils@2.1.9/node_modules/@vitest/utils/dist/helpers.js +113 -0
  259. package/dist/node_modules/.pnpm/@vitest_utils@2.1.9/node_modules/@vitest/utils/dist/helpers.js.map +1 -0
  260. package/dist/node_modules/.pnpm/@vitest_utils@2.1.9/node_modules/@vitest/utils/dist/index.js +449 -0
  261. package/dist/node_modules/.pnpm/@vitest_utils@2.1.9/node_modules/@vitest/utils/dist/index.js.map +1 -0
  262. package/dist/node_modules/.pnpm/@vitest_utils@2.1.9/node_modules/@vitest/utils/dist/source-map.js +163 -0
  263. package/dist/node_modules/.pnpm/@vitest_utils@2.1.9/node_modules/@vitest/utils/dist/source-map.js.map +1 -0
  264. package/dist/node_modules/.pnpm/chai@5.3.3/node_modules/chai/index.js +3187 -0
  265. package/dist/node_modules/.pnpm/chai@5.3.3/node_modules/chai/index.js.map +1 -0
  266. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/arguments.js +11 -0
  267. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/arguments.js.map +1 -0
  268. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/array.js +16 -0
  269. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/array.js.map +1 -0
  270. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/bigint.js +11 -0
  271. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/bigint.js.map +1 -0
  272. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/class.js +15 -0
  273. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/class.js.map +1 -0
  274. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/date.js +13 -0
  275. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/date.js.map +1 -0
  276. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/error.js +34 -0
  277. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/error.js.map +1 -0
  278. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/function.js +12 -0
  279. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/function.js.map +1 -0
  280. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/helpers.js +122 -0
  281. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/helpers.js.map +1 -0
  282. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/html.js +39 -0
  283. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/html.js.map +1 -0
  284. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/index.js +99 -0
  285. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/index.js.map +1 -0
  286. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/map.js +25 -0
  287. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/map.js.map +1 -0
  288. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/number.js +14 -0
  289. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/number.js.map +1 -0
  290. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/object.js +21 -0
  291. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/object.js.map +1 -0
  292. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/promise.js +6 -0
  293. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/promise.js.map +1 -0
  294. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/regexp.js +12 -0
  295. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/regexp.js.map +1 -0
  296. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/set.js +18 -0
  297. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/set.js.map +1 -0
  298. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/string.js +24 -0
  299. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/string.js.map +1 -0
  300. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/symbol.js +9 -0
  301. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/symbol.js.map +1 -0
  302. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/typedarray.js +30 -0
  303. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/typedarray.js.map +1 -0
  304. package/dist/node_modules/.pnpm/magic-string@0.30.21/node_modules/magic-string/dist/magic-string.es.js +939 -0
  305. package/dist/node_modules/.pnpm/magic-string@0.30.21/node_modules/magic-string/dist/magic-string.es.js.map +1 -0
  306. package/dist/node_modules/.pnpm/pathe@1.1.2/node_modules/pathe/dist/shared/pathe.ff20891b.js +82 -0
  307. package/dist/node_modules/.pnpm/pathe@1.1.2/node_modules/pathe/dist/shared/pathe.ff20891b.js.map +1 -0
  308. package/dist/node_modules/.pnpm/tinyrainbow@1.2.0/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.js +82 -0
  309. package/dist/node_modules/.pnpm/tinyrainbow@1.2.0/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.js.map +1 -0
  310. package/dist/node_modules/.pnpm/tinyrainbow@1.2.0/node_modules/tinyrainbow/dist/node.js +8 -0
  311. package/dist/node_modules/.pnpm/tinyrainbow@1.2.0/node_modules/tinyrainbow/dist/node.js.map +1 -0
  312. package/dist/node_modules/.pnpm/tinyspy@3.0.2/node_modules/tinyspy/dist/index.js +83 -0
  313. package/dist/node_modules/.pnpm/tinyspy@3.0.2/node_modules/tinyspy/dist/index.js.map +1 -0
  314. 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
  315. 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
  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/date.W2xKR2qe.js +51 -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/date.W2xKR2qe.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/utils.C8RiOc4B.js +48 -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/utils.C8RiOc4B.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/vi.DgezovHB.js +2426 -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/vi.DgezovHB.js.map +1 -0
  322. package/dist/packages/server/package.js +6 -0
  323. package/dist/packages/server/package.js.map +1 -0
  324. package/package.json +9 -7
  325. package/dist/app/notifications.d.ts +0 -7
  326. package/dist/app/notifications.js +0 -26
  327. package/dist/app/notifications.js.map +0 -1
  328. package/dist/http/routes/learn/assets.d.ts +0 -8
  329. package/dist/http/routes/learn/assets.js +0 -32
  330. package/dist/http/routes/learn/assets.js.map +0 -1
  331. package/dist/http/routes/learn/comments.d.ts +0 -7
  332. package/dist/http/routes/learn/comments.js +0 -175
  333. package/dist/http/routes/learn/comments.js.map +0 -1
  334. package/dist/http/routes/learn/courses.d.ts +0 -7
  335. package/dist/http/routes/learn/courses.js +0 -98
  336. package/dist/http/routes/learn/courses.js.map +0 -1
  337. package/dist/http/routes/learn/downloads.d.ts +0 -7
  338. package/dist/http/routes/learn/downloads.js +0 -76
  339. package/dist/http/routes/learn/downloads.js.map +0 -1
  340. package/dist/http/routes/learn/index.d.ts +0 -7
  341. package/dist/http/routes/learn/index.js +0 -19
  342. package/dist/http/routes/learn/index.js.map +0 -1
  343. package/dist/http/routes/learn/org.d.ts +0 -7
  344. package/dist/http/routes/learn/org.js +0 -50
  345. package/dist/http/routes/learn/org.js.map +0 -1
  346. package/dist/http/routes/learn/progress.d.ts +0 -7
  347. package/dist/http/routes/learn/progress.js +0 -63
  348. package/dist/http/routes/learn/progress.js.map +0 -1
  349. package/dist/http/schemas/learn.js.map +0 -1
  350. package/dist/package.js +0 -6
  351. package/dist/package.js.map +0 -1
@@ -1,6 +1,9 @@
1
+ import { buildNotificationRegistries, configuredPushSender } from "./notification-channels.js";
1
2
  import { loadIntegrations } from "./integrations.js";
2
- import { registerNotificationSubscribers } from "./notifications.js";
3
- import { DrizzleAssetsRepository, DrizzleAutomationRunsRepository, DrizzleAutomationsRepository, DrizzleConnectionsRepository, DrizzleContentRepository, DrizzleCourseAnalyticsRepository, DrizzleCredentialStore, DrizzleDashboardRepository, DrizzleDiscussionRepository, DrizzleEntitlementsRepository, DrizzleIdentityRepository, DrizzleLearnRepository, DrizzleMembersRepository, DrizzleOrganizationsRepository, DrizzleOutboxAppender, DrizzleOutboxStore, DrizzleProgressRepository, DrizzleSettingsRepository, DrizzleStudentsRepository, DrizzleUnitOfWork, createDb } from "@headless-lms/adapter-db";
3
+ import { mcpEndpoints } from "./mcp-endpoints.js";
4
+ import { communityMail } from "./community-mail.js";
5
+ import { notificationReads } from "./notification-reads.js";
6
+ import { DrizzleAdminRepository, DrizzleAssetsRepository, DrizzleAutomationRunsRepository, DrizzleAutomationsRepository, DrizzleChatRepository, DrizzleConnectionsRepository, DrizzleContentRepository, DrizzleCredentialStore, DrizzleDevicesRepository, DrizzleDigestRunRepository, DrizzleDiscussionRepository, DrizzleEntitlementsRepository, DrizzleIdentityRepository, DrizzleMemberRepository, DrizzleMembersRepository, DrizzleMentionsRepository, DrizzleNotificationSettingsRepository, DrizzleNotificationsRepository, DrizzleOrganizationsRepository, DrizzleOutboxAppender, DrizzleOutboxStore, DrizzlePostRepository, DrizzleProgressRepository, DrizzleSettingsRepository, DrizzleSubscriptionsRepository, DrizzleUnitOfWork, createDb } from "@headless-lms/adapter-db";
4
7
  import { InMemoryEventBus } from "@headless-lms/adapter-defaults/events";
5
8
  import { PollingOutboxRelay } from "@headless-lms/adapter-defaults/events/outbox-relay";
6
9
  import { InlineAutomationEngine } from "@headless-lms/adapter-defaults/workflows";
@@ -9,26 +12,25 @@ import { EmailAdapter, StubTemplateRenderer } from "@headless-lms/adapter-defaul
9
12
  import { createRootLogger, requestLogContext } from "@headless-lms/adapter-defaults/logging";
10
13
  import { StorageAdapter } from "@headless-lms/adapter-defaults/storage";
11
14
  import { BetterAuth } from "@headless-lms/adapter-auth";
12
- import { ContentService } from "@headless-lms/core/content";
13
- import { EntitlementsServiceImpl } from "@headless-lms/core/entitlements";
15
+ import { CommunityNotificationCategories, ContentItemTitles, ContentService } from "@headless-lms/core/content";
16
+ import { EntitlementsServiceImpl, entitlementsJobs, entitlementsRecurringJobs } from "@headless-lms/core/entitlements";
14
17
  import { ProgressServiceImpl } from "@headless-lms/core/progress";
15
- import { DiscussionServiceImpl } from "@headless-lms/core/discussion";
16
- import { IdentityServiceImpl } from "@headless-lms/core/identity";
17
- import { OrganizationServiceImpl, parseRole } from "@headless-lms/core/organizations";
18
- import { AssetsServiceImpl } from "@headless-lms/core/assets";
18
+ import { ChatServiceImpl, DigestServiceImpl, DiscussionItemTitles, DiscussionServiceImpl, PostServiceImpl, SubscriptionServiceImpl, discussionJobs, discussionRecurringJobs } from "@headless-lms/core/discussion";
19
+ import { DevicesServiceImpl, IdentityServiceImpl, NotificationSettingsServiceImpl } from "@headless-lms/core/identity";
20
+ import { OrgNotificationCategories, OrganizationServiceImpl, parseRole } from "@headless-lms/core/organizations";
21
+ import { AssetsServiceImpl, assetsJobs, assetsRecurringJobs, createFileUrls } from "@headless-lms/core/assets";
19
22
  import { IntegrationsServiceImpl } from "@headless-lms/core/integrations";
20
- import { AutomationsServiceImpl } from "@headless-lms/core/automations";
21
- import { StudentsReportServiceImpl } from "@headless-lms/core/reporting/students";
22
- import { DashboardReportServiceImpl } from "@headless-lms/core/reporting/dashboard";
23
- import { CoursesReportServiceImpl } from "@headless-lms/core/reporting/courses";
24
- import { LearnReportServiceImpl } from "@headless-lms/core/reporting/learn";
23
+ import { AutomationsServiceImpl, DEFAULT_COMMUNITY_CATEGORIES, DEFAULT_ORG_CATEGORIES, NOTIFICATION_TYPES, NotificationDelivery, NotificationProcessor, NotificationsServiceImpl, RECIPIENT_RULES, SchedulerChatDebounce, notificationJobs } from "@headless-lms/core/automations";
25
24
  import { Mailer } from "@headless-lms/core/shared/mailer";
25
+ import { AdminReportServiceImpl } from "@headless-lms/core/reporting/admin";
26
+ import { MemberReportServiceImpl } from "@headless-lms/core/reporting/member";
26
27
  import { SettingsService } from "@headless-lms/core/shared/settings";
27
28
  //#region src/app/container.ts
28
29
  const OUTBOX_DEFAULTS = {
29
30
  enabled: true,
30
31
  pollIntervalMs: 1e3,
31
- batchSize: 100
32
+ batchSize: 100,
33
+ concurrency: 16
32
34
  };
33
35
  function resolveOutboxConfig(config = {}) {
34
36
  const overrides = Object.fromEntries(Object.entries(config).filter(([, value]) => value !== void 0));
@@ -56,7 +58,8 @@ async function buildContainer(config, options) {
56
58
  const email = options?.adapters?.email ?? new EmailAdapter(logger.child({ name: "email" }));
57
59
  const storage = options?.adapters?.storage ?? new StorageAdapter(logger.child({ name: "storage" }));
58
60
  const templates = options?.adapters?.templates ?? new StubTemplateRenderer(logger.child({ name: "email" }));
59
- const automationEngine = options?.adapters?.workflows ?? new InlineAutomationEngine();
61
+ const workflows = options?.adapters?.workflows;
62
+ const automationEngine = typeof workflows === "function" ? workflows(automationsLogger) : workflows ?? new InlineAutomationEngine(automationsLogger);
60
63
  const mailer = new Mailer(templates, email, {
61
64
  ...config.emailBranding ?? {
62
65
  brandName: "Headless LMS",
@@ -64,6 +67,19 @@ async function buildContainer(config, options) {
64
67
  },
65
68
  studentPortalUrl: config.studentPortalUrl
66
69
  });
70
+ const fileUrls = createFileUrls(config.authBaseURL);
71
+ const assets = new AssetsServiceImpl({
72
+ storage,
73
+ repo: new DrizzleAssetsRepository(db, assetsLogger),
74
+ uow: new DrizzleUnitOfWork(db, (tx) => ({
75
+ assets: new DrizzleAssetsRepository(tx, assetsLogger),
76
+ outbox: new DrizzleOutboxAppender(tx, outboxLogger)
77
+ })),
78
+ memberImageMaxBytes: config.memberImageMaxBytes,
79
+ downloadLinkExpirySeconds: config.deliveryExpirySeconds,
80
+ fileUrls,
81
+ logger: assetsLogger
82
+ });
67
83
  const identityUoW = new DrizzleUnitOfWork(db, (tx) => ({
68
84
  identity: new DrizzleIdentityRepository(tx, logger.child({ name: "identity" })),
69
85
  outbox: new DrizzleOutboxAppender(tx, logger.child({ name: "identity" }))
@@ -72,15 +88,18 @@ async function buildContainer(config, options) {
72
88
  repo: new DrizzleIdentityRepository(db, logger.child({ name: "identity_repo" })),
73
89
  logger: logger.child({ name: "identity" }),
74
90
  uow: identityUoW,
75
- mailer
91
+ mailer,
92
+ images: assets,
93
+ fileUrls
76
94
  });
95
+ const organizationsRepo = new DrizzleOrganizationsRepository(db, logger.child({ name: "org" }));
77
96
  const organizationsUow = new DrizzleUnitOfWork(db, (tx) => ({
78
97
  organizations: new DrizzleOrganizationsRepository(tx, logger.child({ name: "org" })),
79
98
  outbox: new DrizzleOutboxAppender(tx, logger.child({ name: "org" }))
80
99
  }));
81
100
  const orgAdminRef = { current: void 0 };
82
101
  const organizations = new OrganizationServiceImpl({
83
- repo: new DrizzleOrganizationsRepository(db, logger.child({ name: "org" })),
102
+ repo: organizationsRepo,
84
103
  membersRepo: new DrizzleMembersRepository(db, logger.child({ name: "org" })),
85
104
  people: identity,
86
105
  uow: organizationsUow,
@@ -103,17 +122,79 @@ async function buildContainer(config, options) {
103
122
  const content = new ContentService({
104
123
  repo: new DrizzleContentRepository(db, contentLogger),
105
124
  uow: contentUow,
125
+ libraryAssets: assets,
126
+ files: assets,
127
+ fileUrls,
106
128
  logger: contentLogger
107
129
  });
130
+ const pushConfig = options?.adapters?.push ?? {};
131
+ const pushSender = configuredPushSender(pushConfig, options?.adapters?.pushSender);
132
+ const notificationRegistries = buildNotificationRegistries({
133
+ declarations: NOTIFICATION_TYPES,
134
+ defaults: {
135
+ community: DEFAULT_COMMUNITY_CATEGORIES,
136
+ org: DEFAULT_ORG_CATEGORIES
137
+ },
138
+ mailer: options?.adapters?.email ? mailer : null,
139
+ emailOf: async (_orgId, userId) => (await identity.getUserById(userId))?.email ?? null,
140
+ push: pushSender ? {
141
+ sender: pushSender,
142
+ activeDevices: (orgId, userId, since) => devices.activeDevices(orgId, userId, since)
143
+ } : null,
144
+ channels: options?.adapters?.notificationChannels ?? []
145
+ });
146
+ const notificationCategories = {
147
+ community: new CommunityNotificationCategories({
148
+ communities: new DrizzleContentRepository(db, contentLogger),
149
+ settings,
150
+ types: notificationRegistries.types,
151
+ channels: notificationRegistries.channels,
152
+ logger: contentLogger
153
+ }),
154
+ org: new OrgNotificationCategories({
155
+ settings,
156
+ types: notificationRegistries.types,
157
+ channels: notificationRegistries.channels,
158
+ logger: logger.child({ name: "org" })
159
+ })
160
+ };
161
+ const notificationCategoryLists = { listFor: async (orgId, communityId) => (communityId ? await notificationCategories.community.get(orgId, communityId) : await notificationCategories.org.get(orgId, orgId)).categories };
108
162
  const entitlementsUow = new DrizzleUnitOfWork(db, (tx) => ({
109
163
  entitlements: new DrizzleEntitlementsRepository(tx, entitlementsLogger),
164
+ spaces: new DrizzleContentRepository(tx, contentLogger),
110
165
  outbox: new DrizzleOutboxAppender(tx, outboxLogger)
111
166
  }));
167
+ const authors = {
168
+ roleOf: async (orgId, orgUserId) => {
169
+ return (await organizationsRepo.findOrgUserById(orgId, orgUserId))?.role ?? null;
170
+ },
171
+ rolesOf: async (orgId, orgUserIds) => {
172
+ const rows = await organizationsRepo.findOrgUsersByIds(orgId, orgUserIds);
173
+ return Object.fromEntries(rows.map((row) => [row.id, row.role]));
174
+ }
175
+ };
112
176
  const entitlements = new EntitlementsServiceImpl({
113
177
  repo: new DrizzleEntitlementsRepository(db, entitlementsLogger),
178
+ content,
114
179
  uow: entitlementsUow,
115
180
  logger: entitlementsLogger
116
181
  });
182
+ const identityLogger = logger.child({ name: "identity" });
183
+ const notificationSettings = new NotificationSettingsServiceImpl({
184
+ repo: new DrizzleNotificationSettingsRepository(db, identityLogger),
185
+ categories: {
186
+ communityList: async (orgId, communityId) => (await notificationCategories.community.get(orgId, communityId)).categories,
187
+ orgList: async (orgId) => (await notificationCategories.org.get(orgId, orgId)).categories
188
+ },
189
+ access: { canOpen: (orgId, actor, communityId) => entitlements.isCommunityMember(orgId, actor, communityId) },
190
+ channels: notificationRegistries.channels,
191
+ logger: identityLogger
192
+ });
193
+ const devices = new DevicesServiceImpl({
194
+ repo: new DrizzleDevicesRepository(db, identityLogger),
195
+ push: pushConfig,
196
+ logger: identityLogger
197
+ });
117
198
  const progressUow = new DrizzleUnitOfWork(db, (tx) => ({
118
199
  progress: new DrizzleProgressRepository(tx, progressLogger),
119
200
  outbox: new DrizzleOutboxAppender(tx, outboxLogger)
@@ -121,49 +202,118 @@ async function buildContainer(config, options) {
121
202
  const progress = new ProgressServiceImpl({
122
203
  repo: new DrizzleProgressRepository(db, progressLogger),
123
204
  content,
205
+ access: entitlements,
124
206
  uow: progressUow,
125
207
  logger: progressLogger
126
208
  });
209
+ const postReads = new DrizzlePostRepository(db, discussionLogger);
210
+ const discussionReads = new DrizzleDiscussionRepository(db, discussionLogger);
211
+ const chatReads = new DrizzleChatRepository(db, discussionLogger);
212
+ const subscriptionReads = new DrizzleSubscriptionsRepository(db, discussionLogger);
213
+ const mentionReads = new DrizzleMentionsRepository(db, discussionLogger);
214
+ const posts = new PostServiceImpl({
215
+ repo: postReads,
216
+ access: entitlements,
217
+ content,
218
+ authors,
219
+ profiles: discussionReads,
220
+ comments: discussionReads,
221
+ subscriptions: subscriptionReads,
222
+ mentions: mentionReads,
223
+ images: assets,
224
+ fileUrls,
225
+ uow: new DrizzleUnitOfWork(db, (tx) => ({
226
+ posts: new DrizzlePostRepository(tx, discussionLogger),
227
+ mentions: new DrizzleMentionsRepository(tx, discussionLogger),
228
+ outbox: new DrizzleOutboxAppender(tx, outboxLogger)
229
+ })),
230
+ scheduler: automationEngine,
231
+ logger: discussionLogger
232
+ });
233
+ const chats = new ChatServiceImpl({
234
+ repo: chatReads,
235
+ access: entitlements,
236
+ content,
237
+ authors,
238
+ profiles: discussionReads,
239
+ subscriptions: subscriptionReads,
240
+ mentions: mentionReads,
241
+ images: assets,
242
+ fileUrls,
243
+ uow: new DrizzleUnitOfWork(db, (tx) => ({
244
+ chats: new DrizzleChatRepository(tx, discussionLogger),
245
+ mentions: new DrizzleMentionsRepository(tx, discussionLogger),
246
+ outbox: new DrizzleOutboxAppender(tx, outboxLogger)
247
+ })),
248
+ logger: discussionLogger
249
+ });
127
250
  const discussion = new DiscussionServiceImpl({
128
- repo: new DrizzleDiscussionRepository(db, discussionLogger),
251
+ repo: discussionReads,
129
252
  access: entitlements,
130
253
  content,
254
+ posts,
255
+ spaces: entitlements,
256
+ mentions: mentionReads,
257
+ fileUrls,
131
258
  uow: new DrizzleUnitOfWork(db, (tx) => ({
132
259
  discussion: new DrizzleDiscussionRepository(tx, discussionLogger),
260
+ mentions: new DrizzleMentionsRepository(tx, discussionLogger),
133
261
  outbox: new DrizzleOutboxAppender(tx, outboxLogger)
134
262
  })),
135
263
  settings,
136
264
  logger: discussionLogger
137
265
  });
138
- const assets = new AssetsServiceImpl({
139
- storage,
140
- repo: new DrizzleAssetsRepository(db, assetsLogger),
266
+ const subscriptions = new SubscriptionServiceImpl({
267
+ repo: subscriptionReads,
268
+ access: entitlements,
269
+ posts,
270
+ chats,
271
+ logger: discussionLogger
272
+ });
273
+ const digests = new DigestServiceImpl({
274
+ schedules: { communitiesWithDigest: () => content.communitiesWithDigest() },
275
+ runs: new DrizzleDigestRunRepository(db, discussionLogger),
141
276
  uow: new DrizzleUnitOfWork(db, (tx) => ({
142
- assets: new DrizzleAssetsRepository(tx, assetsLogger),
277
+ digests: new DrizzleDigestRunRepository(tx, discussionLogger),
143
278
  outbox: new DrizzleOutboxAppender(tx, outboxLogger)
144
279
  })),
145
- logger: assetsLogger
280
+ logger: discussionLogger
146
281
  });
147
- const reporting = {
148
- students: new StudentsReportServiceImpl({
149
- repo: new DrizzleStudentsRepository(db, reportingLogger),
150
- logger: reportingLogger
151
- }),
152
- dashboard: new DashboardReportServiceImpl({
153
- repo: new DrizzleDashboardRepository(db, reportingLogger),
154
- logger: reportingLogger
155
- }),
156
- courses: new CoursesReportServiceImpl({
157
- repo: new DrizzleCourseAnalyticsRepository(db, reportingLogger),
158
- logger: reportingLogger
282
+ const notificationsRepo = new DrizzleNotificationsRepository(db);
283
+ const notificationList = new NotificationsServiceImpl({
284
+ repo: notificationsRepo,
285
+ logger: automationsLogger
286
+ });
287
+ const itemTitles = {
288
+ discussion: new DiscussionItemTitles({
289
+ posts,
290
+ chats,
291
+ comments: discussionReads,
292
+ messages: chatReads,
293
+ profiles: discussionReads,
294
+ activities: content,
295
+ access: entitlements
159
296
  }),
160
- learn: new LearnReportServiceImpl({
161
- reader: new DrizzleLearnRepository(db, reportingLogger),
297
+ content: new ContentItemTitles({
298
+ content,
299
+ access: entitlements
300
+ })
301
+ };
302
+ const reporting = {
303
+ admin: new AdminReportServiceImpl({ repo: new DrizzleAdminRepository(db, reportingLogger) }),
304
+ member: new MemberReportServiceImpl({
305
+ repo: new DrizzleMemberRepository(db, reportingLogger),
162
306
  content,
163
307
  progress,
164
- assets,
165
- deliveryExpirySeconds: config.deliveryExpirySeconds,
166
- logger: reportingLogger
308
+ files: assets,
309
+ fileUrls,
310
+ access: entitlements,
311
+ notifications: notificationList,
312
+ titles: itemTitles,
313
+ subscriptions,
314
+ notificationCategories,
315
+ notificationSettings,
316
+ channels: notificationRegistries.channels
167
317
  })
168
318
  };
169
319
  const credentialStore = new DrizzleCredentialStore(db, config.credentialStoreKey, integrationsLogger);
@@ -187,7 +337,14 @@ async function buildContainer(config, options) {
187
337
  outbox: new DrizzleOutboxAppender(tx, automationsLogger)
188
338
  }));
189
339
  const mailerLookups = {
190
- orgUserEmail: async (orgId, orgUserId) => (await reporting.students.get(orgId, orgUserId))?.email ?? null,
340
+ orgUserPerson: async (orgId, orgUserId) => {
341
+ const orgUser = await organizationsRepo.findOrgUserById(orgId, orgUserId);
342
+ const user = orgUser ? await identity.getUserById(orgUser.userId) : null;
343
+ return user ? {
344
+ userId: user.id,
345
+ email: user.email
346
+ } : null;
347
+ },
191
348
  contentInfo: async (orgId, contentId) => {
192
349
  const course = await content.getCourse(orgId, contentId);
193
350
  if (course) return {
@@ -196,28 +353,99 @@ async function buildContainer(config, options) {
196
353
  type: course.type
197
354
  };
198
355
  const download = await content.getDownload(orgId, contentId);
199
- return download ? {
356
+ if (download) return {
200
357
  id: download.id,
201
358
  title: download.title,
202
359
  type: download.type
360
+ };
361
+ const community = await content.getCommunity(orgId, contentId);
362
+ return community ? {
363
+ id: community.id,
364
+ title: community.title,
365
+ type: community.type
203
366
  } : null;
204
367
  }
205
368
  };
369
+ const runsRepo = new DrizzleAutomationRunsRepository(db, automationsLogger);
370
+ const wired = communityMail({
371
+ content,
372
+ entitlements,
373
+ organizations,
374
+ identity,
375
+ posts,
376
+ subscriptions,
377
+ discussion,
378
+ chats
379
+ });
380
+ const recipientReads = notificationReads({
381
+ content,
382
+ entitlements,
383
+ organizations,
384
+ identity,
385
+ posts,
386
+ subscriptions,
387
+ discussion,
388
+ chats,
389
+ settings: notificationSettings
390
+ });
391
+ const notificationProcessor = new NotificationProcessor({
392
+ rules: RECIPIENT_RULES,
393
+ reads: recipientReads,
394
+ types: notificationRegistries.types,
395
+ channels: notificationRegistries.channels,
396
+ categories: notificationCategoryLists,
397
+ settings: notificationSettings,
398
+ devices,
399
+ repo: notificationsRepo,
400
+ engine: automationEngine,
401
+ debounce: new SchedulerChatDebounce(automationEngine),
402
+ logger: automationsLogger
403
+ });
206
404
  const automations = new AutomationsServiceImpl({
207
405
  repo: new DrizzleAutomationsRepository(db, automationsLogger),
208
- runsRepo: new DrizzleAutomationRunsRepository(db, automationsLogger),
406
+ runsRepo,
209
407
  uow: automationsUow,
210
408
  engine: automationEngine,
211
409
  mailer,
212
410
  lookups: mailerLookups,
213
411
  integrations,
214
412
  credentials: credentialStore,
215
- webhooks: options?.adapters?.webhooks ?? new FetchWebhookSender(),
413
+ webhooks: options?.adapters?.webhooks ?? new FetchWebhookSender({ allowPrivateNetwork: config.webhookAllowPrivateNetwork }),
414
+ mail: wired.mail,
415
+ grants: wired.grants,
416
+ delivery: new NotificationDelivery({
417
+ repo: notificationsRepo,
418
+ channels: notificationRegistries.channels,
419
+ devices,
420
+ logger: automationsLogger
421
+ }),
422
+ processor: notificationProcessor,
216
423
  logger: automationsLogger
217
424
  });
218
425
  automationEngine.register(automations);
426
+ automationEngine.registerJobs([
427
+ ...discussionJobs({
428
+ posts,
429
+ digests,
430
+ logger: discussionLogger
431
+ }),
432
+ ...entitlementsJobs({ grants: entitlements }),
433
+ ...assetsJobs({
434
+ assets,
435
+ orgs: organizations,
436
+ logger: assetsLogger
437
+ }),
438
+ ...notificationJobs({
439
+ processor: notificationProcessor,
440
+ reads: recipientReads,
441
+ logger: automationsLogger
442
+ })
443
+ ], [
444
+ ...discussionRecurringJobs,
445
+ ...entitlementsRecurringJobs,
446
+ ...assetsRecurringJobs
447
+ ]);
219
448
  const eventBus = new InMemoryEventBus();
220
- registerNotificationSubscribers(eventBus, mailer, mailerLookups);
221
449
  eventBus.subscribeAll((event) => automations.handle(event));
222
450
  const outboxConfig = resolveOutboxConfig(config.outbox);
223
451
  const outboxRelay = new PollingOutboxRelay(new DrizzleOutboxStore(db, outboxLogger), eventBus, outboxConfig, outboxLogger);
@@ -230,9 +458,18 @@ async function buildContainer(config, options) {
230
458
  throw err;
231
459
  }
232
460
  };
461
+ const mcp = mcpEndpoints(config);
462
+ if (!mcp.oauthEnabled) authLogger.warn("MCP OAuth is off: BETTER_AUTH_URL must be https or a loopback host; /mcp accepts API keys only", { authBaseURL: config.authBaseURL });
233
463
  const auth = new BetterAuth({
234
464
  db,
235
465
  baseUrl: config.authBaseURL,
466
+ mcp: {
467
+ oauthEnabled: mcp.oauthEnabled,
468
+ resource: mcp.resource,
469
+ loginPage: mcp.loginPage,
470
+ consentPage: mcp.consentPage,
471
+ orgPickerPage: mcp.orgPickerPage
472
+ },
236
473
  secret: config.authSecret,
237
474
  trustedOrigins: config.trustedOrigins,
238
475
  hooks: {
@@ -314,6 +551,7 @@ async function buildContainer(config, options) {
314
551
  orgAdminRef.current = auth;
315
552
  return {
316
553
  auth,
554
+ mcp,
317
555
  identity,
318
556
  organizations,
319
557
  orgProvider: auth,
@@ -321,9 +559,19 @@ async function buildContainer(config, options) {
321
559
  entitlements,
322
560
  progress,
323
561
  discussion,
562
+ posts,
563
+ chats,
564
+ subscriptions,
324
565
  assets,
325
566
  integrations,
326
567
  automations,
568
+ notificationTypes: notificationRegistries.types,
569
+ notificationChannels: notificationRegistries.channels,
570
+ notificationCategories,
571
+ notificationCategoryLists,
572
+ notificationSettings,
573
+ devices,
574
+ notificationList,
327
575
  settings,
328
576
  reporting,
329
577
  storage,
@@ -331,6 +579,7 @@ async function buildContainer(config, options) {
331
579
  credentials: credentialStore,
332
580
  outboxRelay,
333
581
  automationEngine,
582
+ scheduler: automationEngine,
334
583
  logger,
335
584
  loggerInstance,
336
585
  requestContext: requestLogContext,