@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.
- package/dist/_virtual/_rolldown/runtime.js +5 -0
- package/dist/app/community-mail.d.ts +24 -0
- package/dist/app/community-mail.js +92 -0
- package/dist/app/community-mail.js.map +1 -0
- package/dist/app/container.d.ts +40 -19
- package/dist/app/container.js +294 -45
- package/dist/app/container.js.map +1 -1
- package/dist/app/mcp-endpoints.d.ts +13 -0
- package/dist/app/mcp-endpoints.js +25 -0
- package/dist/app/mcp-endpoints.js.map +1 -0
- package/dist/app/notification-channels.d.ts +47 -0
- package/dist/app/notification-channels.js +174 -0
- package/dist/app/notification-channels.js.map +1 -0
- package/dist/app/notification-reads.d.ts +23 -0
- package/dist/app/notification-reads.js +95 -0
- package/dist/app/notification-reads.js.map +1 -0
- package/dist/http/config.d.ts +2 -1
- package/dist/http/errors.d.ts +15 -0
- package/dist/http/errors.js +162 -0
- package/dist/http/errors.js.map +1 -0
- package/dist/http/mcp/catalogue.d.ts +37 -0
- package/dist/http/mcp/catalogue.js +69 -0
- package/dist/http/mcp/catalogue.js.map +1 -0
- package/dist/http/mcp/challenge.d.ts +7 -0
- package/dist/http/mcp/challenge.js +35 -0
- package/dist/http/mcp/challenge.js.map +1 -0
- package/dist/http/mcp/input-schema.d.ts +7 -0
- package/dist/http/mcp/input-schema.js +28 -0
- package/dist/http/mcp/input-schema.js.map +1 -0
- package/dist/http/mcp/route.d.ts +8 -0
- package/dist/http/mcp/route.js +75 -0
- package/dist/http/mcp/route.js.map +1 -0
- package/dist/http/mcp/server.d.ts +8 -0
- package/dist/http/mcp/server.js +31 -0
- package/dist/http/mcp/server.js.map +1 -0
- package/dist/http/mcp/test-support.d.ts +55 -0
- package/dist/http/mcp/test-support.js +151 -0
- package/dist/http/mcp/test-support.js.map +1 -0
- package/dist/http/mcp/tool.d.ts +48 -0
- package/dist/http/mcp/tool.js +58 -0
- package/dist/http/mcp/tool.js.map +1 -0
- package/dist/http/mcp/tools/automations.d.ts +6 -0
- package/dist/http/mcp/tools/automations.js +120 -0
- package/dist/http/mcp/tools/automations.js.map +1 -0
- package/dist/http/mcp/tools/catalog.d.ts +6 -0
- package/dist/http/mcp/tools/catalog.js +200 -0
- package/dist/http/mcp/tools/catalog.js.map +1 -0
- package/dist/http/mcp/tools/comments.d.ts +6 -0
- package/dist/http/mcp/tools/comments.js +70 -0
- package/dist/http/mcp/tools/comments.js.map +1 -0
- package/dist/http/mcp/tools/communities.d.ts +6 -0
- package/dist/http/mcp/tools/communities.js +175 -0
- package/dist/http/mcp/tools/communities.js.map +1 -0
- package/dist/http/mcp/tools/community-members.d.ts +6 -0
- package/dist/http/mcp/tools/community-members.js +89 -0
- package/dist/http/mcp/tools/community-members.js.map +1 -0
- package/dist/http/mcp/tools/community-moderation.d.ts +6 -0
- package/dist/http/mcp/tools/community-moderation.js +144 -0
- package/dist/http/mcp/tools/community-moderation.js.map +1 -0
- package/dist/http/mcp/tools/courses.d.ts +6 -0
- package/dist/http/mcp/tools/courses.js +121 -0
- package/dist/http/mcp/tools/courses.js.map +1 -0
- package/dist/http/mcp/tools/index.d.ts +6 -0
- package/dist/http/mcp/tools/index.js +23 -0
- package/dist/http/mcp/tools/index.js.map +1 -0
- package/dist/http/mcp/tools/people.d.ts +6 -0
- package/dist/http/mcp/tools/people.js +145 -0
- package/dist/http/mcp/tools/people.js.map +1 -0
- package/dist/http/plugins/auth.js +13 -5
- package/dist/http/plugins/auth.js.map +1 -1
- package/dist/http/plugins/error-handler.d.ts +2 -1
- package/dist/http/plugins/error-handler.js +51 -65
- package/dist/http/plugins/error-handler.js.map +1 -1
- package/dist/http/plugins/openapi.js +49 -2
- package/dist/http/plugins/openapi.js.map +1 -1
- package/dist/http/routes/access.d.ts +7 -0
- package/dist/http/routes/access.js +140 -0
- package/dist/http/routes/access.js.map +1 -0
- package/dist/http/routes/activities.js +68 -23
- package/dist/http/routes/activities.js.map +1 -1
- package/dist/http/routes/assets.js +60 -55
- package/dist/http/routes/assets.js.map +1 -1
- package/dist/http/routes/automations.js +44 -24
- package/dist/http/routes/automations.js.map +1 -1
- package/dist/http/routes/bundles.js +29 -18
- package/dist/http/routes/bundles.js.map +1 -1
- package/dist/http/routes/communities.d.ts +7 -0
- package/dist/http/routes/communities.js +522 -0
- package/dist/http/routes/communities.js.map +1 -0
- package/dist/http/routes/community-moderation.d.ts +7 -0
- package/dist/http/routes/community-moderation.js +425 -0
- package/dist/http/routes/community-moderation.js.map +1 -0
- package/dist/http/routes/course-analytics.js +9 -7
- package/dist/http/routes/course-analytics.js.map +1 -1
- package/dist/http/routes/courses.js +30 -15
- package/dist/http/routes/courses.js.map +1 -1
- package/dist/http/routes/dashboard.js +15 -6
- package/dist/http/routes/dashboard.js.map +1 -1
- package/dist/http/routes/discussion.js +34 -26
- package/dist/http/routes/discussion.js.map +1 -1
- package/dist/http/routes/downloads.js +48 -30
- package/dist/http/routes/downloads.js.map +1 -1
- package/dist/http/routes/entitlements.js +16 -7
- package/dist/http/routes/entitlements.js.map +1 -1
- package/dist/http/routes/integrations.js +38 -41
- package/dist/http/routes/integrations.js.map +1 -1
- package/dist/http/routes/member/actor.d.ts +14 -0
- package/dist/http/routes/member/actor.js +11 -0
- package/dist/http/routes/member/actor.js.map +1 -0
- package/dist/http/routes/member/assets.d.ts +7 -0
- package/dist/http/routes/member/assets.js +79 -0
- package/dist/http/routes/member/assets.js.map +1 -0
- package/dist/http/routes/member/chats.d.ts +7 -0
- package/dist/http/routes/member/chats.js +435 -0
- package/dist/http/routes/member/chats.js.map +1 -0
- package/dist/http/routes/member/comments.d.ts +7 -0
- package/dist/http/routes/member/comments.js +187 -0
- package/dist/http/routes/member/comments.js.map +1 -0
- package/dist/http/routes/member/community.d.ts +7 -0
- package/dist/http/routes/member/community.js +312 -0
- package/dist/http/routes/member/community.js.map +1 -0
- package/dist/http/routes/member/courses.d.ts +7 -0
- package/dist/http/routes/member/courses.js +101 -0
- package/dist/http/routes/member/courses.js.map +1 -0
- package/dist/http/routes/member/devices.d.ts +7 -0
- package/dist/http/routes/member/devices.js +98 -0
- package/dist/http/routes/member/devices.js.map +1 -0
- package/dist/http/routes/member/downloads.d.ts +7 -0
- package/dist/http/routes/member/downloads.js +56 -0
- package/dist/http/routes/member/downloads.js.map +1 -0
- package/dist/http/routes/member/files.d.ts +7 -0
- package/dist/http/routes/member/files.js +184 -0
- package/dist/http/routes/member/files.js.map +1 -0
- package/dist/http/routes/member/index.d.ts +7 -0
- package/dist/http/routes/member/index.js +35 -0
- package/dist/http/routes/member/index.js.map +1 -0
- package/dist/http/routes/member/notification-settings.d.ts +7 -0
- package/dist/http/routes/member/notification-settings.js +108 -0
- package/dist/http/routes/member/notification-settings.js.map +1 -0
- package/dist/http/routes/member/notifications.d.ts +7 -0
- package/dist/http/routes/member/notifications.js +125 -0
- package/dist/http/routes/member/notifications.js.map +1 -0
- package/dist/http/routes/member/org.d.ts +7 -0
- package/dist/http/routes/member/org.js +56 -0
- package/dist/http/routes/member/org.js.map +1 -0
- package/dist/http/routes/member/posts.d.ts +7 -0
- package/dist/http/routes/member/posts.js +612 -0
- package/dist/http/routes/member/posts.js.map +1 -0
- package/dist/http/routes/member/profile.d.ts +7 -0
- package/dist/http/routes/member/profile.js +48 -0
- package/dist/http/routes/member/profile.js.map +1 -0
- package/dist/http/routes/member/progress.d.ts +7 -0
- package/dist/http/routes/member/progress.js +60 -0
- package/dist/http/routes/member/progress.js.map +1 -0
- package/dist/http/routes/organizations.js +171 -25
- package/dist/http/routes/organizations.js.map +1 -1
- package/dist/http/routes/students.js +32 -47
- package/dist/http/routes/students.js.map +1 -1
- package/dist/http/routes/webhooks.js +26 -18
- package/dist/http/routes/webhooks.js.map +1 -1
- package/dist/http/routes.js +8 -2
- package/dist/http/routes.js.map +1 -1
- package/dist/http/schemas/access.d.ts +146 -0
- package/dist/http/schemas/access.js +36 -0
- package/dist/http/schemas/access.js.map +1 -0
- package/dist/http/schemas/activities.d.ts +3 -1
- package/dist/http/schemas/activities.js +4 -4
- package/dist/http/schemas/activities.js.map +1 -1
- package/dist/http/schemas/assets.d.ts +79 -80
- package/dist/http/schemas/assets.js +23 -13
- package/dist/http/schemas/assets.js.map +1 -1
- package/dist/http/schemas/automations.d.ts +6 -0
- package/dist/http/schemas/bundles.js +6 -6
- package/dist/http/schemas/bundles.js.map +1 -1
- package/dist/http/schemas/chats.d.ts +409 -0
- package/dist/http/schemas/chats.js +56 -0
- package/dist/http/schemas/chats.js.map +1 -0
- package/dist/http/schemas/community.d.ts +597 -0
- package/dist/http/schemas/community.js +132 -0
- package/dist/http/schemas/community.js.map +1 -0
- package/dist/http/schemas/content.d.ts +4 -2
- package/dist/http/schemas/content.js +11 -8
- package/dist/http/schemas/content.js.map +1 -1
- package/dist/http/schemas/discussion.d.ts +98 -14
- package/dist/http/schemas/discussion.js +25 -12
- package/dist/http/schemas/discussion.js.map +1 -1
- package/dist/http/schemas/downloads.d.ts +11 -5
- package/dist/http/schemas/downloads.js +14 -11
- package/dist/http/schemas/downloads.js.map +1 -1
- package/dist/http/schemas/entitlements.d.ts +6 -6
- package/dist/http/schemas/entitlements.js +6 -6
- package/dist/http/schemas/entitlements.js.map +1 -1
- package/dist/http/schemas/files.d.ts +45 -0
- package/dist/http/schemas/files.js +25 -0
- package/dist/http/schemas/files.js.map +1 -0
- package/dist/http/schemas/index.d.ts +15 -8
- package/dist/http/schemas/index.js +15 -8
- package/dist/http/schemas/integrations.d.ts +4 -4
- package/dist/http/schemas/invites.d.ts +4 -0
- package/dist/http/schemas/invites.js +1 -0
- package/dist/http/schemas/invites.js.map +1 -1
- package/dist/http/schemas/{learn.d.ts → member.d.ts} +31 -18
- package/dist/http/schemas/{learn.js → member.js} +17 -13
- package/dist/http/schemas/member.js.map +1 -0
- package/dist/http/schemas/members.d.ts +35 -2
- package/dist/http/schemas/members.js +17 -3
- package/dist/http/schemas/members.js.map +1 -1
- package/dist/http/schemas/notifications.d.ts +550 -0
- package/dist/http/schemas/notifications.js +164 -0
- package/dist/http/schemas/notifications.js.map +1 -0
- package/dist/http/schemas/posts.d.ts +350 -0
- package/dist/http/schemas/posts.js +47 -0
- package/dist/http/schemas/posts.js.map +1 -0
- package/dist/http/schemas/profile.d.ts +23 -0
- package/dist/http/schemas/profile.js +15 -0
- package/dist/http/schemas/profile.js.map +1 -0
- package/dist/http/schemas/shared.d.ts +32 -1
- package/dist/http/schemas/shared.js +20 -2
- package/dist/http/schemas/shared.js.map +1 -1
- package/dist/http/schemas/students.d.ts +1 -7
- package/dist/http/schemas/students.js +1 -7
- package/dist/http/schemas/students.js.map +1 -1
- package/dist/http/scope.d.ts +3 -1
- package/dist/http/scope.js +26 -4
- package/dist/http/scope.js.map +1 -1
- package/dist/http/server.js +6 -1
- package/dist/http/server.js.map +1 -1
- package/dist/http/web-bridge.d.ts +1 -1
- package/dist/http/web-bridge.js +2 -2
- package/dist/http/web-bridge.js.map +1 -1
- package/dist/http/well-known.d.ts +7 -0
- package/dist/http/well-known.js +22 -0
- package/dist/http/well-known.js.map +1 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.js +78 -0
- package/dist/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.js.map +1 -0
- package/dist/node_modules/.pnpm/@vitest_expect@2.1.9/node_modules/@vitest/expect/dist/index.js +1267 -0
- package/dist/node_modules/.pnpm/@vitest_expect@2.1.9/node_modules/@vitest/expect/dist/index.js.map +1 -0
- package/dist/node_modules/.pnpm/@vitest_pretty-format@2.1.9/node_modules/@vitest/pretty-format/dist/index.js +814 -0
- package/dist/node_modules/.pnpm/@vitest_pretty-format@2.1.9/node_modules/@vitest/pretty-format/dist/index.js.map +1 -0
- package/dist/node_modules/.pnpm/@vitest_runner@2.1.9/node_modules/@vitest/runner/dist/chunk-tasks.js +43 -0
- package/dist/node_modules/.pnpm/@vitest_runner@2.1.9/node_modules/@vitest/runner/dist/chunk-tasks.js.map +1 -0
- package/dist/node_modules/.pnpm/@vitest_runner@2.1.9/node_modules/@vitest/runner/dist/index.js +527 -0
- package/dist/node_modules/.pnpm/@vitest_runner@2.1.9/node_modules/@vitest/runner/dist/index.js.map +1 -0
- package/dist/node_modules/.pnpm/@vitest_runner@2.1.9/node_modules/@vitest/runner/dist/utils.js +2 -0
- package/dist/node_modules/.pnpm/@vitest_snapshot@2.1.9/node_modules/@vitest/snapshot/dist/index.js +1737 -0
- package/dist/node_modules/.pnpm/@vitest_snapshot@2.1.9/node_modules/@vitest/snapshot/dist/index.js.map +1 -0
- package/dist/node_modules/.pnpm/@vitest_spy@2.1.9/node_modules/@vitest/spy/dist/index.js +137 -0
- package/dist/node_modules/.pnpm/@vitest_spy@2.1.9/node_modules/@vitest/spy/dist/index.js.map +1 -0
- package/dist/node_modules/.pnpm/@vitest_utils@2.1.9/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.js +118 -0
- package/dist/node_modules/.pnpm/@vitest_utils@2.1.9/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.js.map +1 -0
- package/dist/node_modules/.pnpm/@vitest_utils@2.1.9/node_modules/@vitest/utils/dist/diff.js +1222 -0
- package/dist/node_modules/.pnpm/@vitest_utils@2.1.9/node_modules/@vitest/utils/dist/diff.js.map +1 -0
- package/dist/node_modules/.pnpm/@vitest_utils@2.1.9/node_modules/@vitest/utils/dist/error.js +91 -0
- package/dist/node_modules/.pnpm/@vitest_utils@2.1.9/node_modules/@vitest/utils/dist/error.js.map +1 -0
- package/dist/node_modules/.pnpm/@vitest_utils@2.1.9/node_modules/@vitest/utils/dist/helpers.js +113 -0
- package/dist/node_modules/.pnpm/@vitest_utils@2.1.9/node_modules/@vitest/utils/dist/helpers.js.map +1 -0
- package/dist/node_modules/.pnpm/@vitest_utils@2.1.9/node_modules/@vitest/utils/dist/index.js +449 -0
- package/dist/node_modules/.pnpm/@vitest_utils@2.1.9/node_modules/@vitest/utils/dist/index.js.map +1 -0
- package/dist/node_modules/.pnpm/@vitest_utils@2.1.9/node_modules/@vitest/utils/dist/source-map.js +163 -0
- package/dist/node_modules/.pnpm/@vitest_utils@2.1.9/node_modules/@vitest/utils/dist/source-map.js.map +1 -0
- package/dist/node_modules/.pnpm/chai@5.3.3/node_modules/chai/index.js +3187 -0
- package/dist/node_modules/.pnpm/chai@5.3.3/node_modules/chai/index.js.map +1 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/arguments.js +11 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/arguments.js.map +1 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/array.js +16 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/array.js.map +1 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/bigint.js +11 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/bigint.js.map +1 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/class.js +15 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/class.js.map +1 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/date.js +13 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/date.js.map +1 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/error.js +34 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/error.js.map +1 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/function.js +12 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/function.js.map +1 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/helpers.js +122 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/helpers.js.map +1 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/html.js +39 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/html.js.map +1 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/index.js +99 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/index.js.map +1 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/map.js +25 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/map.js.map +1 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/number.js +14 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/number.js.map +1 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/object.js +21 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/object.js.map +1 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/promise.js +6 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/promise.js.map +1 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/regexp.js +12 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/regexp.js.map +1 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/set.js +18 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/set.js.map +1 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/string.js +24 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/string.js.map +1 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/symbol.js +9 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/symbol.js.map +1 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/typedarray.js +30 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/typedarray.js.map +1 -0
- package/dist/node_modules/.pnpm/magic-string@0.30.21/node_modules/magic-string/dist/magic-string.es.js +939 -0
- package/dist/node_modules/.pnpm/magic-string@0.30.21/node_modules/magic-string/dist/magic-string.es.js.map +1 -0
- package/dist/node_modules/.pnpm/pathe@1.1.2/node_modules/pathe/dist/shared/pathe.ff20891b.js +82 -0
- package/dist/node_modules/.pnpm/pathe@1.1.2/node_modules/pathe/dist/shared/pathe.ff20891b.js.map +1 -0
- package/dist/node_modules/.pnpm/tinyrainbow@1.2.0/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.js +82 -0
- package/dist/node_modules/.pnpm/tinyrainbow@1.2.0/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.js.map +1 -0
- package/dist/node_modules/.pnpm/tinyrainbow@1.2.0/node_modules/tinyrainbow/dist/node.js +8 -0
- package/dist/node_modules/.pnpm/tinyrainbow@1.2.0/node_modules/tinyrainbow/dist/node.js.map +1 -0
- package/dist/node_modules/.pnpm/tinyspy@3.0.2/node_modules/tinyspy/dist/index.js +83 -0
- package/dist/node_modules/.pnpm/tinyspy@3.0.2/node_modules/tinyspy/dist/index.js.map +1 -0
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- package/dist/packages/server/package.js +6 -0
- package/dist/packages/server/package.js.map +1 -0
- package/package.json +9 -7
- package/dist/app/notifications.d.ts +0 -7
- package/dist/app/notifications.js +0 -26
- package/dist/app/notifications.js.map +0 -1
- package/dist/http/routes/learn/assets.d.ts +0 -8
- package/dist/http/routes/learn/assets.js +0 -32
- package/dist/http/routes/learn/assets.js.map +0 -1
- package/dist/http/routes/learn/comments.d.ts +0 -7
- package/dist/http/routes/learn/comments.js +0 -175
- package/dist/http/routes/learn/comments.js.map +0 -1
- package/dist/http/routes/learn/courses.d.ts +0 -7
- package/dist/http/routes/learn/courses.js +0 -98
- package/dist/http/routes/learn/courses.js.map +0 -1
- package/dist/http/routes/learn/downloads.d.ts +0 -7
- package/dist/http/routes/learn/downloads.js +0 -76
- package/dist/http/routes/learn/downloads.js.map +0 -1
- package/dist/http/routes/learn/index.d.ts +0 -7
- package/dist/http/routes/learn/index.js +0 -19
- package/dist/http/routes/learn/index.js.map +0 -1
- package/dist/http/routes/learn/org.d.ts +0 -7
- package/dist/http/routes/learn/org.js +0 -50
- package/dist/http/routes/learn/org.js.map +0 -1
- package/dist/http/routes/learn/progress.d.ts +0 -7
- package/dist/http/routes/learn/progress.js +0 -63
- package/dist/http/routes/learn/progress.js.map +0 -1
- package/dist/http/schemas/learn.js.map +0 -1
- package/dist/package.js +0 -6
- package/dist/package.js.map +0 -1
package/dist/app/container.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import { buildNotificationRegistries, configuredPushSender } from "./notification-channels.js";
|
|
1
2
|
import { loadIntegrations } from "./integrations.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
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
|
|
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:
|
|
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:
|
|
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
|
|
139
|
-
|
|
140
|
-
|
|
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
|
-
|
|
277
|
+
digests: new DrizzleDigestRunRepository(tx, discussionLogger),
|
|
143
278
|
outbox: new DrizzleOutboxAppender(tx, outboxLogger)
|
|
144
279
|
})),
|
|
145
|
-
logger:
|
|
280
|
+
logger: discussionLogger
|
|
146
281
|
});
|
|
147
|
-
const
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
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
|
-
|
|
161
|
-
|
|
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
|
-
|
|
166
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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,
|