@headless-lms/server 0.6.0 → 0.6.1
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/README.md +6 -0
- package/dist/app/container.d.ts +5 -1
- package/dist/app/container.js +3 -1
- package/dist/app/container.js.map +1 -1
- package/dist/http/schemas/access.d.ts +6 -6
- package/dist/http/schemas/assets.d.ts +20 -20
- package/dist/http/schemas/chats.d.ts +23 -23
- package/dist/http/schemas/community.d.ts +23 -23
- package/dist/http/schemas/content.d.ts +5 -5
- package/dist/http/schemas/course-analytics.d.ts +2 -2
- package/dist/http/schemas/downloads.d.ts +5 -5
- package/dist/http/schemas/entitlements.d.ts +5 -5
- package/dist/http/schemas/events.d.ts +61 -61
- package/dist/http/schemas/integrations.d.ts +4 -4
- package/dist/http/schemas/member.d.ts +3 -3
- package/dist/http/schemas/members.d.ts +18 -18
- package/dist/http/schemas/notifications.d.ts +31 -31
- package/dist/http/schemas/posts.d.ts +6 -6
- package/dist/http/schemas/profile.d.ts +3 -3
- package/dist/http/schemas/students.d.ts +4 -4
- package/dist/index.d.ts +2 -2
- package/dist/index.js.map +1 -1
- package/dist/packages/server/package.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -32,6 +32,12 @@ and the hub before the relay. `buildServer` closes the hub in `preClose`, so ope
|
|
|
32
32
|
streams receive their closing frame, and on close stops the relay, the engine and then
|
|
33
33
|
`PubSub`.
|
|
34
34
|
|
|
35
|
+
The outbox relay publishes every committed event to the `EventBus`. Absent
|
|
36
|
+
`adapters.eventBus`, it is the same-process `InMemoryEventBus`. An installation
|
|
37
|
+
supplies its own (an instance, or a factory given its logger) to carry events over
|
|
38
|
+
its own transport; the container attaches the core subscribers to it and exposes it
|
|
39
|
+
as `container.eventBus`, which the entry point starts and stops when the bus needs it.
|
|
40
|
+
|
|
35
41
|
Public surface (`src/index.ts`): `createContainer`, `buildServer`,
|
|
36
42
|
`loadIntegrations`, the operational function `runMigrations` (re-exported from
|
|
37
43
|
`@headless-lms/adapter-db`, which ships the `drizzle/` migration assets;
|
package/dist/app/container.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ import { AdminReportServiceImpl } from "@headless-lms/core/reporting/admin";
|
|
|
18
18
|
import { MemberReportServiceImpl } from "@headless-lms/core/reporting/member";
|
|
19
19
|
import { SettingsService } from "@headless-lms/core/shared/settings";
|
|
20
20
|
import { AutomationEngine, PushConfig, WebhookSender } from "@headless-lms/core/types";
|
|
21
|
-
import { BodyParser, ChannelRegistry, CredentialStore, EmailSender, Logger, NotificationChannel, NotificationTypeRegistry, ObjectStorage, OutboxRelay, PubSub, PushSender, Scheduler, TemplateContext, TemplateRenderer } from "@headless-lms/core/shared/ports";
|
|
21
|
+
import { BodyParser, ChannelRegistry, CredentialStore, EmailSender, EventBus, Logger, NotificationChannel, NotificationTypeRegistry, ObjectStorage, OutboxRelay, PubSub, PushSender, Scheduler, TemplateContext, TemplateRenderer } from "@headless-lms/core/shared/ports";
|
|
22
22
|
//#region src/app/container.d.ts
|
|
23
23
|
/** Installation-supplied ports; an absent slot falls back to a fail-loudly stub. */
|
|
24
24
|
interface AdapterOverrides {
|
|
@@ -39,6 +39,8 @@ interface AdapterOverrides {
|
|
|
39
39
|
bodyParser?: BodyParser;
|
|
40
40
|
/** Delivery to every API instance, or a factory given its logger. Absent → no live chat; the chat stream answers 503. */
|
|
41
41
|
pubsub?: PubSub | ((logger: Logger) => PubSub);
|
|
42
|
+
/** Delivers outbox events to their subscribers, or a factory given its logger. Absent → InMemoryEventBus (same process). */
|
|
43
|
+
eventBus?: EventBus | ((logger: Logger) => EventBus);
|
|
42
44
|
}
|
|
43
45
|
interface BuildContainerOptions {
|
|
44
46
|
/** Installation's plugins folder, scanned by loadIntegrations. Absent → no integrations. */
|
|
@@ -143,6 +145,8 @@ interface Container {
|
|
|
143
145
|
* installation's entry point starts it after listen (gen-openapi must not
|
|
144
146
|
* poll). buildServer stops it onClose. */
|
|
145
147
|
outboxRelay: OutboxRelay;
|
|
148
|
+
/** The event bus the outbox relay publishes to, with the core subscribers attached. */
|
|
149
|
+
eventBus: EventBus;
|
|
146
150
|
/** The automation engine — constructed but NEVER started by the container;
|
|
147
151
|
* the installation's entry point starts it after listen (gen-openapi must
|
|
148
152
|
* not run a worker). buildServer stops it onClose. */
|
package/dist/app/container.js
CHANGED
|
@@ -504,7 +504,8 @@ async function buildContainer(config, options) {
|
|
|
504
504
|
...entitlementsRecurringJobs,
|
|
505
505
|
...assetsRecurringJobs
|
|
506
506
|
]);
|
|
507
|
-
const
|
|
507
|
+
const eventBusOption = options?.adapters?.eventBus;
|
|
508
|
+
const eventBus = typeof eventBusOption === "function" ? eventBusOption(logger.child({ name: "events" })) : eventBusOption ?? new InMemoryEventBus();
|
|
508
509
|
if (pubsub) new ChatLiveForwarder({
|
|
509
510
|
pubsub,
|
|
510
511
|
logger: discussionLogger
|
|
@@ -640,6 +641,7 @@ async function buildContainer(config, options) {
|
|
|
640
641
|
mailer,
|
|
641
642
|
credentials: credentialStore,
|
|
642
643
|
outboxRelay,
|
|
644
|
+
eventBus,
|
|
643
645
|
automationEngine,
|
|
644
646
|
scheduler: automationEngine,
|
|
645
647
|
pubsub,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"container.js","names":[],"sources":["../../src/app/container.ts"],"sourcesContent":["// Wires adapters + services in dependency order. Starts nothing.\nimport {\n createDb,\n type DatabasePoolOptions,\n DrizzleAssetsRepository,\n DrizzleAutomationRunsRepository,\n DrizzleAutomationsRepository,\n DrizzleConnectionsRepository,\n DrizzleContentRepository,\n DrizzleCredentialStore,\n DrizzleAdminRepository,\n DrizzleDigestRunRepository,\n DrizzleDevicesRepository,\n DrizzleDiscussionRepository,\n DrizzlePostRepository,\n DrizzleChatRepository,\n DrizzleEntitlementsRepository,\n DrizzleIdentityRepository,\n DrizzleMemberRepository,\n DrizzleMembersRepository,\n DrizzleMentionsRepository,\n DrizzleNotificationsRepository,\n DrizzleNotificationSettingsRepository,\n DrizzleOrganizationsRepository,\n DrizzleRolesRepository,\n DrizzleOutboxAppender,\n DrizzleOutboxStore,\n DrizzleProgressRepository,\n DrizzleSettingsRepository,\n DrizzleSubscriptionsRepository,\n DrizzleUnitOfWork,\n} from '@headless-lms/adapter-db';\nimport { InMemoryEventBus } from '@headless-lms/adapter-defaults/events';\nimport {\n PollingOutboxRelay,\n type PollingOutboxRelayConfig,\n} from '@headless-lms/adapter-defaults/events/outbox-relay';\nimport { InlineAutomationEngine } from '@headless-lms/adapter-defaults/workflows';\nimport { FetchWebhookSender } from '@headless-lms/adapter-defaults/webhooks';\nimport { EmailAdapter, StubTemplateRenderer } from '@headless-lms/adapter-defaults/email';\nimport {\n createRootLogger,\n type LogLevel,\n type PinoInstance,\n requestLogContext,\n type RequestLogContext,\n} from '@headless-lms/adapter-defaults/logging';\nimport { StorageAdapter } from '@headless-lms/adapter-defaults/storage';\nimport { PlainBodyParser } from '@headless-lms/adapter-defaults/body';\nimport { BetterAuth } from '@headless-lms/adapter-auth';\n\nimport {\n CommunityNotificationCategories,\n ContentItemTitles,\n ContentService,\n contentJobs,\n} from '@headless-lms/core/content';\nimport {\n EntitlementsServiceImpl,\n entitlementsJobs,\n entitlementsRecurringJobs,\n} from '@headless-lms/core/entitlements';\nimport { ProgressServiceImpl } from '@headless-lms/core/progress';\nimport {\n type ChatHub,\n type ChatHubOptions,\n ChatLiveForwarder,\n ChatServiceImpl,\n DigestServiceImpl,\n DiscussionItemTitles,\n DiscussionServiceImpl,\n type AuthorPermissionReader,\n PostServiceImpl,\n SubscriptionServiceImpl,\n discussionJobs,\n discussionRecurringJobs,\n} from '@headless-lms/core/discussion';\nimport {\n DevicesServiceImpl,\n IdentityServiceImpl,\n NotificationSettingsServiceImpl,\n type SessionAdmin,\n} from '@headless-lms/core/identity';\nimport {\n type ApiKeys,\n type GrantReader,\n type OrgAdmin,\n NotificationCatalog,\n OrganizationServiceImpl,\n OrgNotificationCategories,\n type RoleDefinition,\n} from '@headless-lms/core/organizations';\nimport {\n AssetsServiceImpl,\n assetsJobs,\n assetsRecurringJobs,\n createFileUrls,\n} from '@headless-lms/core/assets';\nimport { IntegrationsServiceImpl } from '@headless-lms/core/integrations';\nimport {\n AutomationsServiceImpl,\n DEFAULT_COMMUNITY_CATEGORIES,\n DEFAULT_ORG_CATEGORIES,\n NOTIFICATION_TYPES,\n NotificationDelivery,\n NotificationProcessor,\n NotificationsServiceImpl,\n RECIPIENT_RULES,\n SchedulerChatDebounce,\n notificationJobs,\n type NotificationCategories,\n} from '@headless-lms/core/automations';\nimport { buildNotificationRegistries, configuredPushSender } from './notification-channels.js';\nimport { loadIntegrations } from './integrations.js';\nimport { mcpEndpoints, type McpEndpoints } from './mcp-endpoints.js';\nimport { communityMail } from './community-mail.js';\nimport { notificationReads } from './notification-reads.js';\nimport { AdminReportServiceImpl } from '@headless-lms/core/reporting/admin';\nimport { MemberReportServiceImpl } from '@headless-lms/core/reporting/member';\nimport { Mailer, type MailerLookups } from '@headless-lms/core/shared/mailer';\nimport { SettingsService } from '@headless-lms/core/shared/settings';\nimport { platformKeyCheck, type PlatformConfig, type PlatformKeyCheck } from './platform.js';\n\nimport type {\n BodyParser,\n ChannelRegistry,\n CredentialStore,\n EmailSender,\n Logger,\n NotificationChannel,\n NotificationTypeRegistry,\n ObjectStorage,\n OutboxRelay,\n PubSub,\n PushSender,\n Scheduler,\n TemplateContext,\n TemplateRenderer,\n} from '@headless-lms/core/shared/ports';\nimport type { AutomationEngine, PushConfig, WebhookSender } from '@headless-lms/core/types';\n\n/** Installation-supplied ports; an absent slot falls back to a fail-loudly stub. */\nexport interface AdapterOverrides {\n email?: EmailSender;\n storage?: ObjectStorage;\n /** Resolves email templates to rendered content. Absent → fail-loudly stub. */\n templates?: TemplateRenderer;\n /** Durable automation engine, or a factory given the automations logger. Absent → InlineAutomationEngine (in-process, one attempt per action). */\n workflows?: (AutomationEngine & Scheduler) | ((logger: Logger) => AutomationEngine & Scheduler);\n /** Outbound HTTP for webhook deliveries. Absent → FetchWebhookSender (public addresses only, 10s timeout). */\n webhooks?: WebhookSender;\n /** Notification channels beyond in-app, email and push; each key must be new. */\n notificationChannels?: NotificationChannel[];\n /** Push credentials per provider. Absent → no provider is configured and devices cannot register. */\n push?: PushConfig;\n pushSender?: PushSender;\n /** Reads post bodies: their text, mentions and images. Absent → PlainBodyParser (plain text, no images). */\n bodyParser?: BodyParser;\n /** Delivery to every API instance, or a factory given its logger. Absent → no live chat; the chat stream answers 503. */\n pubsub?: PubSub | ((logger: Logger) => PubSub);\n}\n\nexport interface BuildContainerOptions {\n /** Installation's plugins folder, scanned by loadIntegrations. Absent → no integrations. */\n pluginsDir?: string;\n adapters?: AdapterOverrides;\n roles?: readonly RoleDefinition[];\n /** Live chat hub timings. Absent → the defaults (1 s state flush, 30 s session check). */\n live?: ChatHubOptions;\n}\n\nexport interface Config {\n databaseUrl: string;\n databasePool?: DatabasePoolOptions;\n authBaseURL: string;\n authSecret: string;\n trustedOrigins: string[];\n /** Branding threaded into every email template. Default: brandName \"Headless LMS\", baseUrl = adminAppUrl.\n * (studentPortalUrl is composed in from the top-level config field.) */\n emailBranding?: Omit<TemplateContext, 'studentPortalUrl'>;\n /** base64-encoded 32-byte key for the credential store (CREDENTIAL_STORE_KEY). */\n credentialStoreKey: string;\n /** Parent domain for cross-subdomain session cookies (e.g. \".example.com\"); undefined → host-only cookie. */\n cookieDomain?: string;\n /** Mark session cookies Secure (set behind HTTPS / in production). */\n secureCookies?: boolean;\n /** Student portal origin — invite links for students, and the origin whose signups are invite-gated. */\n studentPortalUrl: string;\n /** Admin app origin — invite links for staff. */\n adminAppUrl: string;\n /** Transactional-outbox relay tuning. All optional — see OUTBOX_DEFAULTS. */\n outbox?: OutboxConfig;\n /** Log level for the process-wide logger (HTTP + domain + relay). Default \"info\". */\n logging?: LoggingConfig;\n /** Lifetime of every signed file URL a response carries, seconds. Mirrors\n * ServerConfig.deliveryExpirySeconds — createContainer threads it through. */\n deliveryExpirySeconds: number;\n memberImageMaxBytes: number;\n memberFileMaxBytes: number;\n /** Let the default webhook sender reach loopback and private network addresses. Local development only. */\n webhookAllowPrivateNetwork?: boolean;\n platform?: PlatformConfig;\n}\n\n/** Tuning for the transactional-outbox relay. Every field is optional; the\n * container resolves against OUTBOX_DEFAULTS. */\nexport interface OutboxConfig {\n /** Master switch for the same-process relay. Default true. */\n enabled?: boolean;\n /** Idle delay between polls. Default 1000. */\n pollIntervalMs?: number;\n /** Max rows fetched/dispatched per tick. Default 100. */\n batchSize?: number;\n concurrency?: number;\n}\n\nexport const OUTBOX_DEFAULTS: PollingOutboxRelayConfig = {\n enabled: true,\n pollIntervalMs: 1000,\n batchSize: 100,\n concurrency: 16,\n};\n\nexport function resolveOutboxConfig(config: OutboxConfig = {}): PollingOutboxRelayConfig {\n const overrides = Object.fromEntries(\n Object.entries(config).filter(([, value]) => value !== undefined),\n );\n return { ...OUTBOX_DEFAULTS, ...overrides };\n}\n\n/** Logging tuning. Optional; resolved against LOGGING_DEFAULTS. */\nexport interface LoggingConfig {\n /** Minimum level emitted. Default \"info\". */\n level?: LogLevel;\n}\n\nexport const LOGGING_DEFAULTS: Required<LoggingConfig> = { level: 'info' };\n\nexport function resolveLoggingConfig(config: LoggingConfig = {}): Required<LoggingConfig> {\n return { level: config.level ?? LOGGING_DEFAULTS.level };\n}\n\nexport interface Container {\n auth: BetterAuth;\n mcp: McpEndpoints;\n platform: PlatformKeyCheck | null;\n // Org Provider\n orgProvider: OrgAdmin;\n\n // Domains\n identity: IdentityServiceImpl;\n organizations: OrganizationServiceImpl;\n content: ContentService;\n entitlements: EntitlementsServiceImpl;\n progress: ProgressServiceImpl;\n discussion: DiscussionServiceImpl;\n posts: PostServiceImpl;\n chats: ChatServiceImpl;\n subscriptions: SubscriptionServiceImpl;\n assets: AssetsServiceImpl;\n integrations: IntegrationsServiceImpl;\n automations: AutomationsServiceImpl;\n notificationTypes: NotificationTypeRegistry;\n notificationChannels: ChannelRegistry;\n notificationCategories: {\n community: CommunityNotificationCategories;\n org: OrgNotificationCategories;\n };\n notificationCatalog: NotificationCatalog;\n notificationCategoryLists: NotificationCategories;\n notificationSettings: NotificationSettingsServiceImpl;\n devices: DevicesServiceImpl;\n notificationList: NotificationsServiceImpl;\n /** Cross-cutting settings store. Not a context — a leaf every context may use;\n * inject `settings.for('<namespace>')` into a service, never the service itself. */\n settings: SettingsService;\n // Reporting read layer (composed cross-context reads; owns no domain rules).\n reporting: {\n admin: AdminReportServiceImpl;\n member: MemberReportServiceImpl;\n };\n storage: ObjectStorage;\n mailer: Mailer;\n /** Shared secure credential store — encrypted at rest, org-scoped, decrypt at point of use. */\n credentials: CredentialStore;\n /** The outbox relay — constructed but NEVER started by the container; the\n * installation's entry point starts it after listen (gen-openapi must not\n * poll). buildServer stops it onClose. */\n outboxRelay: OutboxRelay;\n /** The automation engine — constructed but NEVER started by the container;\n * the installation's entry point starts it after listen (gen-openapi must\n * not run a worker). buildServer stops it onClose. */\n automationEngine: AutomationEngine;\n scheduler: Scheduler;\n /** The PubSub adapter — constructed but NEVER started by the container; the\n * installation's entry point starts it after listen. buildServer stops it\n * onClose. Null without one. */\n pubsub: PubSub | null;\n /** This process's live chat hub; started by the entry point after `pubsub`,\n * closed by buildServer preClose. Null without a PubSub. */\n chatHub: ChatHub | null;\n /** Root logger port — components receive children bound with { name }. */\n logger: Logger;\n /** The raw pino root; buildServer hands it to Fastify so HTTP shares the stream. */\n loggerInstance: PinoInstance;\n /** Request-scoped log correlation; the HTTP layer enters it per request. */\n requestContext: RequestLogContext;\n /** Identity's session-write port; the auth adapter fulfils it. */\n sessions: SessionAdmin;\n}\n\nexport async function buildContainer(\n config: Config,\n options?: BuildContainerOptions,\n): Promise<Container> {\n const { instance: loggerInstance, logger } = createRootLogger(\n resolveLoggingConfig(config.logging).level,\n );\n // One child per domain — a context's service and repositories share it.\n\n const contentLogger = logger.child({ name: 'content' });\n const entitlementsLogger = logger.child({ name: 'entitlements' });\n const progressLogger = logger.child({ name: 'progress' });\n const discussionLogger = logger.child({ name: 'discussion' });\n const assetsLogger = logger.child({ name: 'assets' });\n const integrationsLogger = logger.child({ name: 'integrations' });\n const automationsLogger = logger.child({ name: 'automations' });\n const reportingLogger = logger.child({ name: 'reporting' });\n const outboxLogger = logger.child({ name: 'outbox' });\n\n // Outbound adapters\n const db = createDb(config.databaseUrl, logger.child({ name: 'db' }), config.databasePool);\n const email = options?.adapters?.email ?? new EmailAdapter(logger.child({ name: 'email' }));\n const storage: ObjectStorage =\n options?.adapters?.storage ?? new StorageAdapter(logger.child({ name: 'storage' }));\n const templates =\n options?.adapters?.templates ?? new StubTemplateRenderer(logger.child({ name: 'email' }));\n const bodies = options?.adapters?.bodyParser ?? new PlainBodyParser();\n const workflows = options?.adapters?.workflows;\n const automationEngine: AutomationEngine & Scheduler =\n typeof workflows === 'function'\n ? workflows(automationsLogger)\n : (workflows ?? new InlineAutomationEngine(automationsLogger));\n const pubsubOption = options?.adapters?.pubsub;\n const pubsub: PubSub | null =\n typeof pubsubOption === 'function'\n ? pubsubOption(logger.child({ name: 'pubsub' }))\n : (pubsubOption ?? null);\n const mailer = new Mailer(templates, email, {\n ...(config.emailBranding ?? { brandName: 'Headless LMS', baseUrl: config.adminAppUrl }),\n studentPortalUrl: config.studentPortalUrl,\n });\n\n const fileUrls = createFileUrls(config.authBaseURL, (key) => storage.publicUrl(key));\n const assets = new AssetsServiceImpl({\n storage,\n repo: new DrizzleAssetsRepository(db, assetsLogger),\n uow: new DrizzleUnitOfWork(db, (tx) => ({\n assets: new DrizzleAssetsRepository(tx, assetsLogger),\n outbox: new DrizzleOutboxAppender(tx, outboxLogger),\n })),\n memberImageMaxBytes: config.memberImageMaxBytes,\n memberFileMaxBytes: config.memberFileMaxBytes,\n downloadLinkExpirySeconds: config.deliveryExpirySeconds,\n fileUrls,\n logger: assetsLogger,\n });\n\n /*\n * Identity\n */\n const identityUoW = new DrizzleUnitOfWork(db, (tx) => ({\n identity: new DrizzleIdentityRepository(tx, logger.child({ name: 'identity' })),\n outbox: new DrizzleOutboxAppender(tx, logger.child({ name: 'identity' })),\n }));\n const identity = new IdentityServiceImpl({\n repo: new DrizzleIdentityRepository(db, logger.child({ name: 'identity_repo' })),\n logger: logger.child({ name: 'identity' }),\n uow: identityUoW,\n mailer,\n images: assets,\n fileUrls,\n });\n\n /*\n * Organization\n */\n const organizationsRepo = new DrizzleOrganizationsRepository(db, logger.child({ name: 'org' }));\n const organizationsUow = new DrizzleUnitOfWork(db, (tx) => ({\n organizations: new DrizzleOrganizationsRepository(tx, logger.child({ name: 'org' })),\n roles: new DrizzleRolesRepository(tx),\n outbox: new DrizzleOutboxAppender(tx, logger.child({ name: 'org' })),\n }));\n const orgAdminRef: { current: BetterAuth | undefined } = { current: undefined };\n const platform = config.platform ? platformKeyCheck(config.platform) : null;\n const organizations: OrganizationServiceImpl = new OrganizationServiceImpl({\n repo: organizationsRepo,\n roles: new DrizzleRolesRepository(db),\n ...(options?.roles && { defaultRoles: options.roles }),\n apiKeys: (): ApiKeys => {\n if (!orgAdminRef.current) {\n throw new Error('api keys not initialised');\n }\n return orgAdminRef.current;\n },\n accounts: () => {\n if (!orgAdminRef.current) {\n throw new Error('accounts not initialised');\n }\n return orgAdminRef.current;\n },\n ...(config.platform && {\n platform: {\n email: config.platform.accountEmail,\n name: config.platform.accountName ?? 'Platform',\n },\n }),\n membersRepo: new DrizzleMembersRepository(db, logger.child({ name: 'org' })),\n people: identity,\n images: assets,\n uow: organizationsUow,\n orgAdmin: () => {\n if (!orgAdminRef.current) {\n throw new Error('orgAdmin not initialised');\n }\n return orgAdminRef.current;\n },\n sessions: () => {\n if (!orgAdminRef.current) {\n throw new Error('sessions not initialised');\n }\n return orgAdminRef.current;\n },\n logger: logger.child({ name: 'org' }),\n mailer,\n inviteUrls: { studentPortalUrl: config.studentPortalUrl, adminAppUrl: config.adminAppUrl },\n grants: (): GrantReader => entitlements,\n });\n\n /*\n * Settings\n */\n const settings = new SettingsService(\n new DrizzleSettingsRepository(db, logger.child({ name: 'settings' })),\n );\n // Content: reads on the root db; course writes + outbox append in one tx.\n const contentUow = new DrizzleUnitOfWork(db, (tx) => ({\n content: new DrizzleContentRepository(tx, contentLogger),\n outbox: new DrizzleOutboxAppender(tx, outboxLogger),\n }));\n const content = new ContentService({\n repo: new DrizzleContentRepository(db, contentLogger),\n uow: contentUow,\n libraryAssets: assets,\n files: assets,\n fileUrls,\n scheduler: automationEngine,\n logger: contentLogger,\n });\n const pushConfig = options?.adapters?.push ?? {};\n const pushSender = configuredPushSender(pushConfig, options?.adapters?.pushSender);\n const notificationRegistries = buildNotificationRegistries({\n declarations: NOTIFICATION_TYPES,\n defaults: { community: DEFAULT_COMMUNITY_CATEGORIES, org: DEFAULT_ORG_CATEGORIES },\n mailer: options?.adapters?.email ? mailer : null,\n emailOf: async (_orgId, userId) => (await identity.getUserById(userId))?.email ?? null,\n push: pushSender\n ? {\n sender: pushSender,\n activeDevices: (orgId, userId, since) => devices.activeDevices(orgId, userId, since),\n }\n : null,\n channels: options?.adapters?.notificationChannels ?? [],\n });\n const notificationCategories = {\n community: new CommunityNotificationCategories({\n communities: new DrizzleContentRepository(db, contentLogger),\n settings,\n types: notificationRegistries.types,\n channels: notificationRegistries.channels,\n logger: contentLogger,\n }),\n org: new OrgNotificationCategories({\n settings,\n types: notificationRegistries.types,\n channels: notificationRegistries.channels,\n logger: logger.child({ name: 'org' }),\n }),\n };\n const notificationCatalog = new NotificationCatalog({\n types: notificationRegistries.types,\n channels: notificationRegistries.channels,\n });\n const notificationCategoryLists: NotificationCategories = {\n listFor: async (orgId, communityId) =>\n (communityId\n ? await notificationCategories.community.get(communityId, organizations.systemActor(orgId))\n : await notificationCategories.org.get(orgId, organizations.systemActor(orgId))\n ).categories,\n };\n // Entitlements: reads on the root db; writes + outbox append in one tx.\n const entitlementsUow = new DrizzleUnitOfWork(db, (tx) => ({\n entitlements: new DrizzleEntitlementsRepository(tx, entitlementsLogger),\n spaces: new DrizzleContentRepository(tx, contentLogger),\n outbox: new DrizzleOutboxAppender(tx, outboxLogger),\n }));\n const authors: AuthorPermissionReader = organizations;\n const entitlementsRepo = new DrizzleEntitlementsRepository(db, entitlementsLogger);\n const entitlements = new EntitlementsServiceImpl({\n repo: entitlementsRepo,\n content,\n permissions: organizations,\n uow: entitlementsUow,\n logger: entitlementsLogger,\n });\n const identityLogger = logger.child({ name: 'identity' });\n const notificationSettings = new NotificationSettingsServiceImpl({\n repo: new DrizzleNotificationSettingsRepository(db, identityLogger),\n categories: {\n communityList: async (orgId, communityId) =>\n (await notificationCategories.community.get(communityId, organizations.systemActor(orgId)))\n .categories,\n orgList: async (orgId) =>\n (await notificationCategories.org.get(orgId, organizations.systemActor(orgId))).categories,\n },\n access: {\n canOpen: (orgId, actor, communityId) => entitlements.isCommunityMember(communityId, actor),\n },\n channels: notificationRegistries.channels,\n logger: identityLogger,\n });\n const devices = new DevicesServiceImpl({\n repo: new DrizzleDevicesRepository(db, identityLogger),\n push: pushConfig,\n logger: identityLogger,\n });\n // Progress: report writes + outbox append in one tx; content supplies the\n // structure and completion rules the service evaluates against.\n const progressUow = new DrizzleUnitOfWork(db, (tx) => ({\n progress: new DrizzleProgressRepository(tx, progressLogger),\n outbox: new DrizzleOutboxAppender(tx, outboxLogger),\n }));\n const progress = new ProgressServiceImpl({\n repo: new DrizzleProgressRepository(db, progressLogger),\n content,\n access: entitlements,\n system: organizations,\n uow: progressUow,\n logger: progressLogger,\n });\n\n const postReads = new DrizzlePostRepository(db, discussionLogger);\n const discussionReads = new DrizzleDiscussionRepository(db, discussionLogger);\n const chatReads = new DrizzleChatRepository(db, discussionLogger);\n const subscriptionReads = new DrizzleSubscriptionsRepository(db, discussionLogger);\n const mentionReads = new DrizzleMentionsRepository(db, discussionLogger);\n const posts = new PostServiceImpl({\n repo: postReads,\n access: entitlements,\n content,\n authors,\n profiles: discussionReads,\n comments: discussionReads,\n subscriptions: subscriptionReads,\n mentions: mentionReads,\n images: assets,\n fileUrls,\n bodies,\n uow: new DrizzleUnitOfWork(db, (tx) => ({\n posts: new DrizzlePostRepository(tx, discussionLogger),\n mentions: new DrizzleMentionsRepository(tx, discussionLogger),\n outbox: new DrizzleOutboxAppender(tx, outboxLogger),\n })),\n scheduler: automationEngine,\n logger: discussionLogger,\n });\n const chats = new ChatServiceImpl({\n repo: chatReads,\n access: entitlements,\n content,\n authors,\n profiles: discussionReads,\n subscriptions: subscriptionReads,\n mentions: mentionReads,\n images: assets,\n fileUrls,\n uow: new DrizzleUnitOfWork(db, (tx) => ({\n chats: new DrizzleChatRepository(tx, discussionLogger),\n mentions: new DrizzleMentionsRepository(tx, discussionLogger),\n outbox: new DrizzleOutboxAppender(tx, outboxLogger),\n })),\n ...(pubsub && { pubsub }),\n ...(options?.live && { live: options.live }),\n logger: discussionLogger,\n });\n const discussion = new DiscussionServiceImpl({\n repo: discussionReads,\n access: entitlements,\n content: content,\n posts,\n spaces: entitlements,\n authors,\n mentions: mentionReads,\n fileUrls,\n uow: new DrizzleUnitOfWork(db, (tx) => ({\n discussion: new DrizzleDiscussionRepository(tx, discussionLogger),\n mentions: new DrizzleMentionsRepository(tx, discussionLogger),\n outbox: new DrizzleOutboxAppender(tx, outboxLogger),\n })),\n settings,\n logger: discussionLogger,\n });\n\n const subscriptions = new SubscriptionServiceImpl({\n repo: subscriptionReads,\n access: entitlements,\n posts,\n chats,\n uow: new DrizzleUnitOfWork(db, (tx) => ({\n subscriptions: new DrizzleSubscriptionsRepository(tx, discussionLogger),\n outbox: new DrizzleOutboxAppender(tx, outboxLogger),\n })),\n logger: discussionLogger,\n });\n\n const digests = new DigestServiceImpl({\n schedules: { communitiesWithDigest: () => content.communitiesWithDigest() },\n runs: new DrizzleDigestRunRepository(db, discussionLogger),\n uow: new DrizzleUnitOfWork(db, (tx) => ({\n digests: new DrizzleDigestRunRepository(tx, discussionLogger),\n outbox: new DrizzleOutboxAppender(tx, outboxLogger),\n })),\n logger: discussionLogger,\n });\n\n const notificationsRepo = new DrizzleNotificationsRepository(db);\n const notificationList = new NotificationsServiceImpl({\n repo: notificationsRepo,\n logger: automationsLogger,\n });\n const itemTitles = {\n discussion: new DiscussionItemTitles({\n posts,\n chats,\n comments: discussionReads,\n messages: chatReads,\n profiles: discussionReads,\n activities: content,\n access: entitlements,\n actors: organizations,\n }),\n content: new ContentItemTitles({ content, access: entitlements, organizations }),\n };\n\n const reporting = {\n admin: new AdminReportServiceImpl({\n repo: new DrizzleAdminRepository(db, reportingLogger),\n permissions: organizations,\n spaces: entitlements,\n events: content,\n fileUrls,\n }),\n member: new MemberReportServiceImpl({\n repo: new DrizzleMemberRepository(db, reportingLogger),\n content,\n progress,\n files: assets,\n fileUrls,\n access: entitlements,\n people: organizations,\n notifications: notificationList,\n titles: itemTitles,\n subscriptions,\n notificationCategories,\n notificationSettings,\n channels: notificationRegistries.channels,\n studentPortalUrl: config.studentPortalUrl,\n }),\n };\n\n const credentialStore = new DrizzleCredentialStore(\n db,\n config.credentialStoreKey,\n integrationsLogger,\n );\n // The integrations this deployment supports: the installation's declared\n // plugins folder (directory name = integration id), loaded at startup.\n // Connect/configure reject undeclared ids and validate config with the\n // integration's own schema. No folder → no integrations.\n const integrationsRegistry = await loadIntegrations(options?.pluginsDir, integrationsLogger);\n // Integrations: credential + connection writes + outbox append in one tx\n // (a tx-bound credential store instance shares the scope's transaction).\n const integrationsUow = new DrizzleUnitOfWork(db, (tx) => ({\n connections: new DrizzleConnectionsRepository(tx, integrationsLogger),\n credentials: new DrizzleCredentialStore(tx, config.credentialStoreKey, integrationsLogger),\n outbox: new DrizzleOutboxAppender(tx, outboxLogger),\n }));\n const integrations = new IntegrationsServiceImpl({\n registry: integrationsRegistry,\n repo: new DrizzleConnectionsRepository(db, integrationsLogger),\n uow: integrationsUow,\n credentials: credentialStore,\n logger: integrationsLogger,\n });\n\n // Automations: run writes + outbox append in one tx; the engine drives\n // execution (register below), integrations supplies the loaded\n // integrations' actions for `available`.\n const automationsUow = new DrizzleUnitOfWork(db, (tx) => ({\n automations: new DrizzleAutomationsRepository(tx, automationsLogger),\n runs: new DrizzleAutomationRunsRepository(tx, automationsLogger),\n credentials: new DrizzleCredentialStore(tx, config.credentialStoreKey, automationsLogger),\n outbox: new DrizzleOutboxAppender(tx, automationsLogger),\n }));\n // Emails triggered by row-shaped events resolve their recipient and content\n // details at send time — the event carries ids only.\n const mailerLookups: MailerLookups = {\n orgUserPerson: async (orgId, orgUserId) => {\n const orgUser = await organizationsRepo.findOrgUserById(orgId, orgUserId);\n const user = orgUser ? await identity.getUserById(orgUser.userId) : null;\n return user ? { userId: user.id, email: user.email } : null;\n },\n contentInfo: async (orgId, contentId) => {\n const system = organizations.systemActor(orgId);\n const course = await content.findCourse(contentId, system);\n if (course) {\n return { id: course.id, title: course.title, type: course.type };\n }\n const download = await content.findDownload(contentId, system);\n if (download) {\n return { id: download.id, title: download.title, type: download.type };\n }\n const community = await content.findCommunity(contentId, system);\n if (community) {\n return { id: community.id, title: community.title, type: community.type };\n }\n const event = await content.findEvent(contentId, system);\n return event ? { id: event.id, title: event.title, type: event.type } : null;\n },\n };\n\n const runsRepo = new DrizzleAutomationRunsRepository(db, automationsLogger);\n const wired = communityMail({\n content,\n entitlements,\n organizations,\n identity,\n posts,\n subscriptions,\n discussion,\n chats,\n bodies,\n });\n const recipientReads = notificationReads({\n content,\n entitlements,\n organizations,\n identity,\n posts,\n subscriptions,\n discussion,\n chats,\n bodies,\n settings: notificationSettings,\n });\n const notificationProcessor = new NotificationProcessor({\n rules: RECIPIENT_RULES,\n reads: recipientReads,\n types: notificationRegistries.types,\n channels: notificationRegistries.channels,\n categories: notificationCategoryLists,\n settings: notificationSettings,\n devices,\n repo: notificationsRepo,\n engine: automationEngine,\n debounce: new SchedulerChatDebounce(automationEngine),\n logger: automationsLogger,\n });\n const automations = new AutomationsServiceImpl({\n repo: new DrizzleAutomationsRepository(db, automationsLogger),\n runsRepo,\n uow: automationsUow,\n engine: automationEngine,\n mailer,\n lookups: mailerLookups,\n integrations,\n systemActor: (orgId) => organizations.systemActor(orgId),\n credentials: credentialStore,\n webhooks:\n options?.adapters?.webhooks ??\n new FetchWebhookSender({ allowPrivateNetwork: config.webhookAllowPrivateNetwork }),\n mail: wired.mail,\n grants: wired.grants,\n delivery: new NotificationDelivery({\n repo: notificationsRepo,\n channels: notificationRegistries.channels,\n devices,\n logger: automationsLogger,\n }),\n processor: notificationProcessor,\n logger: automationsLogger,\n });\n automationEngine.register(automations);\n automationEngine.registerJobs(\n [\n ...discussionJobs({ posts, digests, logger: discussionLogger }),\n ...contentJobs({ events: content, logger: contentLogger }),\n ...entitlementsJobs({ grants: entitlements }),\n ...assetsJobs({ assets, orgs: organizations, logger: assetsLogger }),\n ...notificationJobs({\n processor: notificationProcessor,\n reads: recipientReads,\n logger: automationsLogger,\n }),\n ],\n [...discussionRecurringJobs, ...entitlementsRecurringJobs, ...assetsRecurringJobs],\n );\n\n const eventBus = new InMemoryEventBus();\n if (pubsub) {\n new ChatLiveForwarder({ pubsub, logger: discussionLogger }).attach(eventBus);\n }\n eventBus.subscribeAll((event) => automations.handle(event));\n const outboxConfig = resolveOutboxConfig(config.outbox);\n const outboxRelay = new PollingOutboxRelay(\n new DrizzleOutboxStore(db, outboxLogger),\n eventBus,\n outboxConfig,\n outboxLogger,\n );\n\n /*\n * Auth Adapter\n */\n const authLogger = logger.child({ name: 'auth' });\n // Hook failures otherwise surface through Better Auth's route as an opaque\n // 500 — log which hook died before rethrowing.\n const authHook =\n <A extends unknown[], R>(name: string, fn: (...args: A) => Promise<R>) =>\n async (...args: A): Promise<R> => {\n try {\n return await fn(...args);\n } catch (err) {\n authLogger.error(`auth hook ${name} failed`, { err });\n throw err;\n }\n };\n const mcp = mcpEndpoints(config);\n if (!mcp.oauthEnabled) {\n authLogger.warn(\n 'MCP OAuth is off: BETTER_AUTH_URL must be https or a loopback host; /mcp accepts API keys only',\n { authBaseURL: config.authBaseURL },\n );\n }\n const auth: BetterAuth = new BetterAuth({\n db,\n baseUrl: config.authBaseURL,\n mcp: {\n oauthEnabled: mcp.oauthEnabled,\n resource: mcp.resource,\n loginPage: mcp.loginPage,\n consentPage: mcp.consentPage,\n orgPickerPage: mcp.orgPickerPage,\n },\n secret: config.authSecret,\n trustedOrigins: config.trustedOrigins,\n hooks: {\n sendResetPassword: async ({ user, url }) => {\n await identity.sendPasswordReset({ email: user.email, url });\n },\n onPasswordReset: async ({ user }) => {\n await identity.sendPasswordChanged({ email: user.email });\n },\n sendMagicLink: authHook('sendMagicLink', async ({ email, url }) => {\n await identity.sendMagicLink({\n email,\n url,\n });\n }),\n beforeUserCreate: authHook('beforeUserCreate', async (user) => {\n const { email, name } = user;\n const [firstName, lastName] = name.split(' ');\n // Better Auth has not minted an id yet — the id returned below becomes\n // its account id. A person provisioned at invite time is linked instead of re-created.\n const domainUser = await identity.linkOrCreateUser({\n email,\n ...(firstName !== undefined && { firstName }),\n ...(lastName !== undefined && { lastName }),\n });\n\n return {\n data: {\n ...user,\n id: domainUser.id,\n },\n };\n }),\n beforeCreateSession: authHook('beforeCreateSession', async (session) => {\n const person = await identity.getUserByExternalId(session.userId);\n if (!person) {\n return;\n }\n if (organizations.isPlatformAccount(person.email)) {\n authLogger.warn('sign-in refused for the platform account', { userId: person.id });\n return false;\n }\n const orgs = await organizations.getOrgUsersForUser(person.id);\n if (orgs.length !== 1) {\n return;\n }\n // TODO - fix, why default to the first?\n const org = await organizations.getById(orgs[0]!.orgId);\n if (!org) {\n return;\n }\n\n return { data: { ...session, activeOrganizationId: org.id } };\n }),\n /*\n * We're making sure the domain org creates and using the same ID for better-auth org ID.\n */\n beforeCreateOrganization: authHook(\n 'beforeCreateOrganization',\n async ({ organization: org, user: baUser }) => {\n const domainOrg = await organizations.provisionOrganization({\n ownerId: baUser.id,\n ...org,\n logo: org.logo ?? undefined,\n });\n return { data: { ...org, id: domainOrg.id } };\n },\n ),\n beforeDeleteOrganization: authHook('beforeDeleteOrganization', async ({ organization }) => {\n await organizations.deleteOrganization(organization.id);\n }),\n beforeAddMember: authHook('beforeAddMember', async ({ member }) => {\n await organizations.addOrgUser({\n orgId: member.organizationId,\n userId: member.userId,\n });\n }),\n beforeRemoveMember: authHook('beforeRemoveMember', async ({ member }) => {\n await organizations.removeOrgUser(member.organizationId, member.userId);\n }),\n },\n logger: authLogger,\n cookieDomain: config.cookieDomain,\n secureCookies: config.secureCookies,\n });\n orgAdminRef.current = auth;\n\n return {\n auth,\n mcp,\n platform,\n identity,\n organizations,\n // Better Auth owns org writes; the same instance fulfils the OrgAdmin port.\n orgProvider: auth,\n content,\n entitlements,\n progress,\n discussion,\n posts,\n chats,\n subscriptions,\n assets,\n integrations,\n automations,\n notificationTypes: notificationRegistries.types,\n notificationChannels: notificationRegistries.channels,\n notificationCategories,\n notificationCatalog,\n notificationCategoryLists,\n notificationSettings,\n devices,\n notificationList,\n settings,\n reporting,\n storage,\n mailer,\n credentials: credentialStore,\n outboxRelay,\n automationEngine,\n scheduler: automationEngine,\n pubsub,\n chatHub: chats.hub,\n logger,\n loggerInstance,\n requestContext: requestLogContext,\n // Better Auth owns the session store; the same instance fulfils SessionAdmin.\n sessions: auth,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwNA,MAAa,kBAA4C;CACvD,SAAS;CACT,gBAAgB;CAChB,WAAW;CACX,aAAa;AACf;AAEA,SAAgB,oBAAoB,SAAuB,CAAC,GAA6B;CACvF,MAAM,YAAY,OAAO,YACvB,OAAO,QAAQ,MAAM,CAAC,CAAC,QAAQ,GAAG,WAAW,UAAU,KAAA,CAAS,CAClE;CACA,OAAO;EAAE,GAAG;EAAiB,GAAG;CAAU;AAC5C;AAQA,MAAa,mBAA4C,EAAE,OAAO,OAAO;AAEzE,SAAgB,qBAAqB,SAAwB,CAAC,GAA4B;CACxF,OAAO,EAAE,OAAO,OAAO,SAAS,iBAAiB,MAAM;AACzD;AAuEA,eAAsB,eACpB,QACA,SACoB;CACpB,MAAM,EAAE,UAAU,gBAAgB,WAAW,iBAC3C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AAc,WAAW;KAC7B,OAAO,OAAO;KACd,QAAQ,OAAO;IACjB,CAAC;GACH,CAAC;GACD,oBAAoB,SAAS,sBAAsB,OAAO,EAAE,aAAa;IACvE,MAAM,cAAc,cAAc,OAAO,gBAAgB,OAAO,MAAM;GACxE,CAAC;EACH;EACA,QAAQ;EACR,cAAc,OAAO;EACrB,eAAe,OAAO;CACxB,CAAC;CACD,YAAY,UAAU;CAEtB,OAAO;EACL;EACA;EACA;EACA;EACA;EAEA,aAAa;EACb;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,mBAAmB,uBAAuB;EAC1C,sBAAsB,uBAAuB;EAC7C;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,aAAa;EACb;EACA;EACA,WAAW;EACX;EACA,SAAS,MAAM;EACf;EACA;EACA,gBAAgB;EAEhB,UAAU;CACZ;AACF"}
|
|
1
|
+
{"version":3,"file":"container.js","names":[],"sources":["../../src/app/container.ts"],"sourcesContent":["// Wires adapters + services in dependency order. Starts nothing.\nimport {\n createDb,\n type DatabasePoolOptions,\n DrizzleAssetsRepository,\n DrizzleAutomationRunsRepository,\n DrizzleAutomationsRepository,\n DrizzleConnectionsRepository,\n DrizzleContentRepository,\n DrizzleCredentialStore,\n DrizzleAdminRepository,\n DrizzleDigestRunRepository,\n DrizzleDevicesRepository,\n DrizzleDiscussionRepository,\n DrizzlePostRepository,\n DrizzleChatRepository,\n DrizzleEntitlementsRepository,\n DrizzleIdentityRepository,\n DrizzleMemberRepository,\n DrizzleMembersRepository,\n DrizzleMentionsRepository,\n DrizzleNotificationsRepository,\n DrizzleNotificationSettingsRepository,\n DrizzleOrganizationsRepository,\n DrizzleRolesRepository,\n DrizzleOutboxAppender,\n DrizzleOutboxStore,\n DrizzleProgressRepository,\n DrizzleSettingsRepository,\n DrizzleSubscriptionsRepository,\n DrizzleUnitOfWork,\n} from '@headless-lms/adapter-db';\nimport { InMemoryEventBus } from '@headless-lms/adapter-defaults/events';\nimport {\n PollingOutboxRelay,\n type PollingOutboxRelayConfig,\n} from '@headless-lms/adapter-defaults/events/outbox-relay';\nimport { InlineAutomationEngine } from '@headless-lms/adapter-defaults/workflows';\nimport { FetchWebhookSender } from '@headless-lms/adapter-defaults/webhooks';\nimport { EmailAdapter, StubTemplateRenderer } from '@headless-lms/adapter-defaults/email';\nimport {\n createRootLogger,\n type LogLevel,\n type PinoInstance,\n requestLogContext,\n type RequestLogContext,\n} from '@headless-lms/adapter-defaults/logging';\nimport { StorageAdapter } from '@headless-lms/adapter-defaults/storage';\nimport { PlainBodyParser } from '@headless-lms/adapter-defaults/body';\nimport { BetterAuth } from '@headless-lms/adapter-auth';\n\nimport {\n CommunityNotificationCategories,\n ContentItemTitles,\n ContentService,\n contentJobs,\n} from '@headless-lms/core/content';\nimport {\n EntitlementsServiceImpl,\n entitlementsJobs,\n entitlementsRecurringJobs,\n} from '@headless-lms/core/entitlements';\nimport { ProgressServiceImpl } from '@headless-lms/core/progress';\nimport {\n type ChatHub,\n type ChatHubOptions,\n ChatLiveForwarder,\n ChatServiceImpl,\n DigestServiceImpl,\n DiscussionItemTitles,\n DiscussionServiceImpl,\n type AuthorPermissionReader,\n PostServiceImpl,\n SubscriptionServiceImpl,\n discussionJobs,\n discussionRecurringJobs,\n} from '@headless-lms/core/discussion';\nimport {\n DevicesServiceImpl,\n IdentityServiceImpl,\n NotificationSettingsServiceImpl,\n type SessionAdmin,\n} from '@headless-lms/core/identity';\nimport {\n type ApiKeys,\n type GrantReader,\n type OrgAdmin,\n NotificationCatalog,\n OrganizationServiceImpl,\n OrgNotificationCategories,\n type RoleDefinition,\n} from '@headless-lms/core/organizations';\nimport {\n AssetsServiceImpl,\n assetsJobs,\n assetsRecurringJobs,\n createFileUrls,\n} from '@headless-lms/core/assets';\nimport { IntegrationsServiceImpl } from '@headless-lms/core/integrations';\nimport {\n AutomationsServiceImpl,\n DEFAULT_COMMUNITY_CATEGORIES,\n DEFAULT_ORG_CATEGORIES,\n NOTIFICATION_TYPES,\n NotificationDelivery,\n NotificationProcessor,\n NotificationsServiceImpl,\n RECIPIENT_RULES,\n SchedulerChatDebounce,\n notificationJobs,\n type NotificationCategories,\n} from '@headless-lms/core/automations';\nimport { buildNotificationRegistries, configuredPushSender } from './notification-channels.js';\nimport { loadIntegrations } from './integrations.js';\nimport { mcpEndpoints, type McpEndpoints } from './mcp-endpoints.js';\nimport { communityMail } from './community-mail.js';\nimport { notificationReads } from './notification-reads.js';\nimport { AdminReportServiceImpl } from '@headless-lms/core/reporting/admin';\nimport { MemberReportServiceImpl } from '@headless-lms/core/reporting/member';\nimport { Mailer, type MailerLookups } from '@headless-lms/core/shared/mailer';\nimport { SettingsService } from '@headless-lms/core/shared/settings';\nimport { platformKeyCheck, type PlatformConfig, type PlatformKeyCheck } from './platform.js';\n\nimport type {\n BodyParser,\n ChannelRegistry,\n CredentialStore,\n EmailSender,\n EventBus,\n Logger,\n NotificationChannel,\n NotificationTypeRegistry,\n ObjectStorage,\n OutboxRelay,\n PubSub,\n PushSender,\n Scheduler,\n TemplateContext,\n TemplateRenderer,\n} from '@headless-lms/core/shared/ports';\nimport type { AutomationEngine, PushConfig, WebhookSender } from '@headless-lms/core/types';\n\n/** Installation-supplied ports; an absent slot falls back to a fail-loudly stub. */\nexport interface AdapterOverrides {\n email?: EmailSender;\n storage?: ObjectStorage;\n /** Resolves email templates to rendered content. Absent → fail-loudly stub. */\n templates?: TemplateRenderer;\n /** Durable automation engine, or a factory given the automations logger. Absent → InlineAutomationEngine (in-process, one attempt per action). */\n workflows?: (AutomationEngine & Scheduler) | ((logger: Logger) => AutomationEngine & Scheduler);\n /** Outbound HTTP for webhook deliveries. Absent → FetchWebhookSender (public addresses only, 10s timeout). */\n webhooks?: WebhookSender;\n /** Notification channels beyond in-app, email and push; each key must be new. */\n notificationChannels?: NotificationChannel[];\n /** Push credentials per provider. Absent → no provider is configured and devices cannot register. */\n push?: PushConfig;\n pushSender?: PushSender;\n /** Reads post bodies: their text, mentions and images. Absent → PlainBodyParser (plain text, no images). */\n bodyParser?: BodyParser;\n /** Delivery to every API instance, or a factory given its logger. Absent → no live chat; the chat stream answers 503. */\n pubsub?: PubSub | ((logger: Logger) => PubSub);\n /** Delivers outbox events to their subscribers, or a factory given its logger. Absent → InMemoryEventBus (same process). */\n eventBus?: EventBus | ((logger: Logger) => EventBus);\n}\n\nexport interface BuildContainerOptions {\n /** Installation's plugins folder, scanned by loadIntegrations. Absent → no integrations. */\n pluginsDir?: string;\n adapters?: AdapterOverrides;\n roles?: readonly RoleDefinition[];\n /** Live chat hub timings. Absent → the defaults (1 s state flush, 30 s session check). */\n live?: ChatHubOptions;\n}\n\nexport interface Config {\n databaseUrl: string;\n databasePool?: DatabasePoolOptions;\n authBaseURL: string;\n authSecret: string;\n trustedOrigins: string[];\n /** Branding threaded into every email template. Default: brandName \"Headless LMS\", baseUrl = adminAppUrl.\n * (studentPortalUrl is composed in from the top-level config field.) */\n emailBranding?: Omit<TemplateContext, 'studentPortalUrl'>;\n /** base64-encoded 32-byte key for the credential store (CREDENTIAL_STORE_KEY). */\n credentialStoreKey: string;\n /** Parent domain for cross-subdomain session cookies (e.g. \".example.com\"); undefined → host-only cookie. */\n cookieDomain?: string;\n /** Mark session cookies Secure (set behind HTTPS / in production). */\n secureCookies?: boolean;\n /** Student portal origin — invite links for students, and the origin whose signups are invite-gated. */\n studentPortalUrl: string;\n /** Admin app origin — invite links for staff. */\n adminAppUrl: string;\n /** Transactional-outbox relay tuning. All optional — see OUTBOX_DEFAULTS. */\n outbox?: OutboxConfig;\n /** Log level for the process-wide logger (HTTP + domain + relay). Default \"info\". */\n logging?: LoggingConfig;\n /** Lifetime of every signed file URL a response carries, seconds. Mirrors\n * ServerConfig.deliveryExpirySeconds — createContainer threads it through. */\n deliveryExpirySeconds: number;\n memberImageMaxBytes: number;\n memberFileMaxBytes: number;\n /** Let the default webhook sender reach loopback and private network addresses. Local development only. */\n webhookAllowPrivateNetwork?: boolean;\n platform?: PlatformConfig;\n}\n\n/** Tuning for the transactional-outbox relay. Every field is optional; the\n * container resolves against OUTBOX_DEFAULTS. */\nexport interface OutboxConfig {\n /** Master switch for the same-process relay. Default true. */\n enabled?: boolean;\n /** Idle delay between polls. Default 1000. */\n pollIntervalMs?: number;\n /** Max rows fetched/dispatched per tick. Default 100. */\n batchSize?: number;\n concurrency?: number;\n}\n\nexport const OUTBOX_DEFAULTS: PollingOutboxRelayConfig = {\n enabled: true,\n pollIntervalMs: 1000,\n batchSize: 100,\n concurrency: 16,\n};\n\nexport function resolveOutboxConfig(config: OutboxConfig = {}): PollingOutboxRelayConfig {\n const overrides = Object.fromEntries(\n Object.entries(config).filter(([, value]) => value !== undefined),\n );\n return { ...OUTBOX_DEFAULTS, ...overrides };\n}\n\n/** Logging tuning. Optional; resolved against LOGGING_DEFAULTS. */\nexport interface LoggingConfig {\n /** Minimum level emitted. Default \"info\". */\n level?: LogLevel;\n}\n\nexport const LOGGING_DEFAULTS: Required<LoggingConfig> = { level: 'info' };\n\nexport function resolveLoggingConfig(config: LoggingConfig = {}): Required<LoggingConfig> {\n return { level: config.level ?? LOGGING_DEFAULTS.level };\n}\n\nexport interface Container {\n auth: BetterAuth;\n mcp: McpEndpoints;\n platform: PlatformKeyCheck | null;\n // Org Provider\n orgProvider: OrgAdmin;\n\n // Domains\n identity: IdentityServiceImpl;\n organizations: OrganizationServiceImpl;\n content: ContentService;\n entitlements: EntitlementsServiceImpl;\n progress: ProgressServiceImpl;\n discussion: DiscussionServiceImpl;\n posts: PostServiceImpl;\n chats: ChatServiceImpl;\n subscriptions: SubscriptionServiceImpl;\n assets: AssetsServiceImpl;\n integrations: IntegrationsServiceImpl;\n automations: AutomationsServiceImpl;\n notificationTypes: NotificationTypeRegistry;\n notificationChannels: ChannelRegistry;\n notificationCategories: {\n community: CommunityNotificationCategories;\n org: OrgNotificationCategories;\n };\n notificationCatalog: NotificationCatalog;\n notificationCategoryLists: NotificationCategories;\n notificationSettings: NotificationSettingsServiceImpl;\n devices: DevicesServiceImpl;\n notificationList: NotificationsServiceImpl;\n /** Cross-cutting settings store. Not a context — a leaf every context may use;\n * inject `settings.for('<namespace>')` into a service, never the service itself. */\n settings: SettingsService;\n // Reporting read layer (composed cross-context reads; owns no domain rules).\n reporting: {\n admin: AdminReportServiceImpl;\n member: MemberReportServiceImpl;\n };\n storage: ObjectStorage;\n mailer: Mailer;\n /** Shared secure credential store — encrypted at rest, org-scoped, decrypt at point of use. */\n credentials: CredentialStore;\n /** The outbox relay — constructed but NEVER started by the container; the\n * installation's entry point starts it after listen (gen-openapi must not\n * poll). buildServer stops it onClose. */\n outboxRelay: OutboxRelay;\n /** The event bus the outbox relay publishes to, with the core subscribers attached. */\n eventBus: EventBus;\n /** The automation engine — constructed but NEVER started by the container;\n * the installation's entry point starts it after listen (gen-openapi must\n * not run a worker). buildServer stops it onClose. */\n automationEngine: AutomationEngine;\n scheduler: Scheduler;\n /** The PubSub adapter — constructed but NEVER started by the container; the\n * installation's entry point starts it after listen. buildServer stops it\n * onClose. Null without one. */\n pubsub: PubSub | null;\n /** This process's live chat hub; started by the entry point after `pubsub`,\n * closed by buildServer preClose. Null without a PubSub. */\n chatHub: ChatHub | null;\n /** Root logger port — components receive children bound with { name }. */\n logger: Logger;\n /** The raw pino root; buildServer hands it to Fastify so HTTP shares the stream. */\n loggerInstance: PinoInstance;\n /** Request-scoped log correlation; the HTTP layer enters it per request. */\n requestContext: RequestLogContext;\n /** Identity's session-write port; the auth adapter fulfils it. */\n sessions: SessionAdmin;\n}\n\nexport async function buildContainer(\n config: Config,\n options?: BuildContainerOptions,\n): Promise<Container> {\n const { instance: loggerInstance, logger } = createRootLogger(\n resolveLoggingConfig(config.logging).level,\n );\n // One child per domain — a context's service and repositories share it.\n\n const contentLogger = logger.child({ name: 'content' });\n const entitlementsLogger = logger.child({ name: 'entitlements' });\n const progressLogger = logger.child({ name: 'progress' });\n const discussionLogger = logger.child({ name: 'discussion' });\n const assetsLogger = logger.child({ name: 'assets' });\n const integrationsLogger = logger.child({ name: 'integrations' });\n const automationsLogger = logger.child({ name: 'automations' });\n const reportingLogger = logger.child({ name: 'reporting' });\n const outboxLogger = logger.child({ name: 'outbox' });\n\n // Outbound adapters\n const db = createDb(config.databaseUrl, logger.child({ name: 'db' }), config.databasePool);\n const email = options?.adapters?.email ?? new EmailAdapter(logger.child({ name: 'email' }));\n const storage: ObjectStorage =\n options?.adapters?.storage ?? new StorageAdapter(logger.child({ name: 'storage' }));\n const templates =\n options?.adapters?.templates ?? new StubTemplateRenderer(logger.child({ name: 'email' }));\n const bodies = options?.adapters?.bodyParser ?? new PlainBodyParser();\n const workflows = options?.adapters?.workflows;\n const automationEngine: AutomationEngine & Scheduler =\n typeof workflows === 'function'\n ? workflows(automationsLogger)\n : (workflows ?? new InlineAutomationEngine(automationsLogger));\n const pubsubOption = options?.adapters?.pubsub;\n const pubsub: PubSub | null =\n typeof pubsubOption === 'function'\n ? pubsubOption(logger.child({ name: 'pubsub' }))\n : (pubsubOption ?? null);\n const mailer = new Mailer(templates, email, {\n ...(config.emailBranding ?? { brandName: 'Headless LMS', baseUrl: config.adminAppUrl }),\n studentPortalUrl: config.studentPortalUrl,\n });\n\n const fileUrls = createFileUrls(config.authBaseURL, (key) => storage.publicUrl(key));\n const assets = new AssetsServiceImpl({\n storage,\n repo: new DrizzleAssetsRepository(db, assetsLogger),\n uow: new DrizzleUnitOfWork(db, (tx) => ({\n assets: new DrizzleAssetsRepository(tx, assetsLogger),\n outbox: new DrizzleOutboxAppender(tx, outboxLogger),\n })),\n memberImageMaxBytes: config.memberImageMaxBytes,\n memberFileMaxBytes: config.memberFileMaxBytes,\n downloadLinkExpirySeconds: config.deliveryExpirySeconds,\n fileUrls,\n logger: assetsLogger,\n });\n\n /*\n * Identity\n */\n const identityUoW = new DrizzleUnitOfWork(db, (tx) => ({\n identity: new DrizzleIdentityRepository(tx, logger.child({ name: 'identity' })),\n outbox: new DrizzleOutboxAppender(tx, logger.child({ name: 'identity' })),\n }));\n const identity = new IdentityServiceImpl({\n repo: new DrizzleIdentityRepository(db, logger.child({ name: 'identity_repo' })),\n logger: logger.child({ name: 'identity' }),\n uow: identityUoW,\n mailer,\n images: assets,\n fileUrls,\n });\n\n /*\n * Organization\n */\n const organizationsRepo = new DrizzleOrganizationsRepository(db, logger.child({ name: 'org' }));\n const organizationsUow = new DrizzleUnitOfWork(db, (tx) => ({\n organizations: new DrizzleOrganizationsRepository(tx, logger.child({ name: 'org' })),\n roles: new DrizzleRolesRepository(tx),\n outbox: new DrizzleOutboxAppender(tx, logger.child({ name: 'org' })),\n }));\n const orgAdminRef: { current: BetterAuth | undefined } = { current: undefined };\n const platform = config.platform ? platformKeyCheck(config.platform) : null;\n const organizations: OrganizationServiceImpl = new OrganizationServiceImpl({\n repo: organizationsRepo,\n roles: new DrizzleRolesRepository(db),\n ...(options?.roles && { defaultRoles: options.roles }),\n apiKeys: (): ApiKeys => {\n if (!orgAdminRef.current) {\n throw new Error('api keys not initialised');\n }\n return orgAdminRef.current;\n },\n accounts: () => {\n if (!orgAdminRef.current) {\n throw new Error('accounts not initialised');\n }\n return orgAdminRef.current;\n },\n ...(config.platform && {\n platform: {\n email: config.platform.accountEmail,\n name: config.platform.accountName ?? 'Platform',\n },\n }),\n membersRepo: new DrizzleMembersRepository(db, logger.child({ name: 'org' })),\n people: identity,\n images: assets,\n uow: organizationsUow,\n orgAdmin: () => {\n if (!orgAdminRef.current) {\n throw new Error('orgAdmin not initialised');\n }\n return orgAdminRef.current;\n },\n sessions: () => {\n if (!orgAdminRef.current) {\n throw new Error('sessions not initialised');\n }\n return orgAdminRef.current;\n },\n logger: logger.child({ name: 'org' }),\n mailer,\n inviteUrls: { studentPortalUrl: config.studentPortalUrl, adminAppUrl: config.adminAppUrl },\n grants: (): GrantReader => entitlements,\n });\n\n /*\n * Settings\n */\n const settings = new SettingsService(\n new DrizzleSettingsRepository(db, logger.child({ name: 'settings' })),\n );\n // Content: reads on the root db; course writes + outbox append in one tx.\n const contentUow = new DrizzleUnitOfWork(db, (tx) => ({\n content: new DrizzleContentRepository(tx, contentLogger),\n outbox: new DrizzleOutboxAppender(tx, outboxLogger),\n }));\n const content = new ContentService({\n repo: new DrizzleContentRepository(db, contentLogger),\n uow: contentUow,\n libraryAssets: assets,\n files: assets,\n fileUrls,\n scheduler: automationEngine,\n logger: contentLogger,\n });\n const pushConfig = options?.adapters?.push ?? {};\n const pushSender = configuredPushSender(pushConfig, options?.adapters?.pushSender);\n const notificationRegistries = buildNotificationRegistries({\n declarations: NOTIFICATION_TYPES,\n defaults: { community: DEFAULT_COMMUNITY_CATEGORIES, org: DEFAULT_ORG_CATEGORIES },\n mailer: options?.adapters?.email ? mailer : null,\n emailOf: async (_orgId, userId) => (await identity.getUserById(userId))?.email ?? null,\n push: pushSender\n ? {\n sender: pushSender,\n activeDevices: (orgId, userId, since) => devices.activeDevices(orgId, userId, since),\n }\n : null,\n channels: options?.adapters?.notificationChannels ?? [],\n });\n const notificationCategories = {\n community: new CommunityNotificationCategories({\n communities: new DrizzleContentRepository(db, contentLogger),\n settings,\n types: notificationRegistries.types,\n channels: notificationRegistries.channels,\n logger: contentLogger,\n }),\n org: new OrgNotificationCategories({\n settings,\n types: notificationRegistries.types,\n channels: notificationRegistries.channels,\n logger: logger.child({ name: 'org' }),\n }),\n };\n const notificationCatalog = new NotificationCatalog({\n types: notificationRegistries.types,\n channels: notificationRegistries.channels,\n });\n const notificationCategoryLists: NotificationCategories = {\n listFor: async (orgId, communityId) =>\n (communityId\n ? await notificationCategories.community.get(communityId, organizations.systemActor(orgId))\n : await notificationCategories.org.get(orgId, organizations.systemActor(orgId))\n ).categories,\n };\n // Entitlements: reads on the root db; writes + outbox append in one tx.\n const entitlementsUow = new DrizzleUnitOfWork(db, (tx) => ({\n entitlements: new DrizzleEntitlementsRepository(tx, entitlementsLogger),\n spaces: new DrizzleContentRepository(tx, contentLogger),\n outbox: new DrizzleOutboxAppender(tx, outboxLogger),\n }));\n const authors: AuthorPermissionReader = organizations;\n const entitlementsRepo = new DrizzleEntitlementsRepository(db, entitlementsLogger);\n const entitlements = new EntitlementsServiceImpl({\n repo: entitlementsRepo,\n content,\n permissions: organizations,\n uow: entitlementsUow,\n logger: entitlementsLogger,\n });\n const identityLogger = logger.child({ name: 'identity' });\n const notificationSettings = new NotificationSettingsServiceImpl({\n repo: new DrizzleNotificationSettingsRepository(db, identityLogger),\n categories: {\n communityList: async (orgId, communityId) =>\n (await notificationCategories.community.get(communityId, organizations.systemActor(orgId)))\n .categories,\n orgList: async (orgId) =>\n (await notificationCategories.org.get(orgId, organizations.systemActor(orgId))).categories,\n },\n access: {\n canOpen: (orgId, actor, communityId) => entitlements.isCommunityMember(communityId, actor),\n },\n channels: notificationRegistries.channels,\n logger: identityLogger,\n });\n const devices = new DevicesServiceImpl({\n repo: new DrizzleDevicesRepository(db, identityLogger),\n push: pushConfig,\n logger: identityLogger,\n });\n // Progress: report writes + outbox append in one tx; content supplies the\n // structure and completion rules the service evaluates against.\n const progressUow = new DrizzleUnitOfWork(db, (tx) => ({\n progress: new DrizzleProgressRepository(tx, progressLogger),\n outbox: new DrizzleOutboxAppender(tx, outboxLogger),\n }));\n const progress = new ProgressServiceImpl({\n repo: new DrizzleProgressRepository(db, progressLogger),\n content,\n access: entitlements,\n system: organizations,\n uow: progressUow,\n logger: progressLogger,\n });\n\n const postReads = new DrizzlePostRepository(db, discussionLogger);\n const discussionReads = new DrizzleDiscussionRepository(db, discussionLogger);\n const chatReads = new DrizzleChatRepository(db, discussionLogger);\n const subscriptionReads = new DrizzleSubscriptionsRepository(db, discussionLogger);\n const mentionReads = new DrizzleMentionsRepository(db, discussionLogger);\n const posts = new PostServiceImpl({\n repo: postReads,\n access: entitlements,\n content,\n authors,\n profiles: discussionReads,\n comments: discussionReads,\n subscriptions: subscriptionReads,\n mentions: mentionReads,\n images: assets,\n fileUrls,\n bodies,\n uow: new DrizzleUnitOfWork(db, (tx) => ({\n posts: new DrizzlePostRepository(tx, discussionLogger),\n mentions: new DrizzleMentionsRepository(tx, discussionLogger),\n outbox: new DrizzleOutboxAppender(tx, outboxLogger),\n })),\n scheduler: automationEngine,\n logger: discussionLogger,\n });\n const chats = new ChatServiceImpl({\n repo: chatReads,\n access: entitlements,\n content,\n authors,\n profiles: discussionReads,\n subscriptions: subscriptionReads,\n mentions: mentionReads,\n images: assets,\n fileUrls,\n uow: new DrizzleUnitOfWork(db, (tx) => ({\n chats: new DrizzleChatRepository(tx, discussionLogger),\n mentions: new DrizzleMentionsRepository(tx, discussionLogger),\n outbox: new DrizzleOutboxAppender(tx, outboxLogger),\n })),\n ...(pubsub && { pubsub }),\n ...(options?.live && { live: options.live }),\n logger: discussionLogger,\n });\n const discussion = new DiscussionServiceImpl({\n repo: discussionReads,\n access: entitlements,\n content: content,\n posts,\n spaces: entitlements,\n authors,\n mentions: mentionReads,\n fileUrls,\n uow: new DrizzleUnitOfWork(db, (tx) => ({\n discussion: new DrizzleDiscussionRepository(tx, discussionLogger),\n mentions: new DrizzleMentionsRepository(tx, discussionLogger),\n outbox: new DrizzleOutboxAppender(tx, outboxLogger),\n })),\n settings,\n logger: discussionLogger,\n });\n\n const subscriptions = new SubscriptionServiceImpl({\n repo: subscriptionReads,\n access: entitlements,\n posts,\n chats,\n uow: new DrizzleUnitOfWork(db, (tx) => ({\n subscriptions: new DrizzleSubscriptionsRepository(tx, discussionLogger),\n outbox: new DrizzleOutboxAppender(tx, outboxLogger),\n })),\n logger: discussionLogger,\n });\n\n const digests = new DigestServiceImpl({\n schedules: { communitiesWithDigest: () => content.communitiesWithDigest() },\n runs: new DrizzleDigestRunRepository(db, discussionLogger),\n uow: new DrizzleUnitOfWork(db, (tx) => ({\n digests: new DrizzleDigestRunRepository(tx, discussionLogger),\n outbox: new DrizzleOutboxAppender(tx, outboxLogger),\n })),\n logger: discussionLogger,\n });\n\n const notificationsRepo = new DrizzleNotificationsRepository(db);\n const notificationList = new NotificationsServiceImpl({\n repo: notificationsRepo,\n logger: automationsLogger,\n });\n const itemTitles = {\n discussion: new DiscussionItemTitles({\n posts,\n chats,\n comments: discussionReads,\n messages: chatReads,\n profiles: discussionReads,\n activities: content,\n access: entitlements,\n actors: organizations,\n }),\n content: new ContentItemTitles({ content, access: entitlements, organizations }),\n };\n\n const reporting = {\n admin: new AdminReportServiceImpl({\n repo: new DrizzleAdminRepository(db, reportingLogger),\n permissions: organizations,\n spaces: entitlements,\n events: content,\n fileUrls,\n }),\n member: new MemberReportServiceImpl({\n repo: new DrizzleMemberRepository(db, reportingLogger),\n content,\n progress,\n files: assets,\n fileUrls,\n access: entitlements,\n people: organizations,\n notifications: notificationList,\n titles: itemTitles,\n subscriptions,\n notificationCategories,\n notificationSettings,\n channels: notificationRegistries.channels,\n studentPortalUrl: config.studentPortalUrl,\n }),\n };\n\n const credentialStore = new DrizzleCredentialStore(\n db,\n config.credentialStoreKey,\n integrationsLogger,\n );\n // The integrations this deployment supports: the installation's declared\n // plugins folder (directory name = integration id), loaded at startup.\n // Connect/configure reject undeclared ids and validate config with the\n // integration's own schema. No folder → no integrations.\n const integrationsRegistry = await loadIntegrations(options?.pluginsDir, integrationsLogger);\n // Integrations: credential + connection writes + outbox append in one tx\n // (a tx-bound credential store instance shares the scope's transaction).\n const integrationsUow = new DrizzleUnitOfWork(db, (tx) => ({\n connections: new DrizzleConnectionsRepository(tx, integrationsLogger),\n credentials: new DrizzleCredentialStore(tx, config.credentialStoreKey, integrationsLogger),\n outbox: new DrizzleOutboxAppender(tx, outboxLogger),\n }));\n const integrations = new IntegrationsServiceImpl({\n registry: integrationsRegistry,\n repo: new DrizzleConnectionsRepository(db, integrationsLogger),\n uow: integrationsUow,\n credentials: credentialStore,\n logger: integrationsLogger,\n });\n\n // Automations: run writes + outbox append in one tx; the engine drives\n // execution (register below), integrations supplies the loaded\n // integrations' actions for `available`.\n const automationsUow = new DrizzleUnitOfWork(db, (tx) => ({\n automations: new DrizzleAutomationsRepository(tx, automationsLogger),\n runs: new DrizzleAutomationRunsRepository(tx, automationsLogger),\n credentials: new DrizzleCredentialStore(tx, config.credentialStoreKey, automationsLogger),\n outbox: new DrizzleOutboxAppender(tx, automationsLogger),\n }));\n // Emails triggered by row-shaped events resolve their recipient and content\n // details at send time — the event carries ids only.\n const mailerLookups: MailerLookups = {\n orgUserPerson: async (orgId, orgUserId) => {\n const orgUser = await organizationsRepo.findOrgUserById(orgId, orgUserId);\n const user = orgUser ? await identity.getUserById(orgUser.userId) : null;\n return user ? { userId: user.id, email: user.email } : null;\n },\n contentInfo: async (orgId, contentId) => {\n const system = organizations.systemActor(orgId);\n const course = await content.findCourse(contentId, system);\n if (course) {\n return { id: course.id, title: course.title, type: course.type };\n }\n const download = await content.findDownload(contentId, system);\n if (download) {\n return { id: download.id, title: download.title, type: download.type };\n }\n const community = await content.findCommunity(contentId, system);\n if (community) {\n return { id: community.id, title: community.title, type: community.type };\n }\n const event = await content.findEvent(contentId, system);\n return event ? { id: event.id, title: event.title, type: event.type } : null;\n },\n };\n\n const runsRepo = new DrizzleAutomationRunsRepository(db, automationsLogger);\n const wired = communityMail({\n content,\n entitlements,\n organizations,\n identity,\n posts,\n subscriptions,\n discussion,\n chats,\n bodies,\n });\n const recipientReads = notificationReads({\n content,\n entitlements,\n organizations,\n identity,\n posts,\n subscriptions,\n discussion,\n chats,\n bodies,\n settings: notificationSettings,\n });\n const notificationProcessor = new NotificationProcessor({\n rules: RECIPIENT_RULES,\n reads: recipientReads,\n types: notificationRegistries.types,\n channels: notificationRegistries.channels,\n categories: notificationCategoryLists,\n settings: notificationSettings,\n devices,\n repo: notificationsRepo,\n engine: automationEngine,\n debounce: new SchedulerChatDebounce(automationEngine),\n logger: automationsLogger,\n });\n const automations = new AutomationsServiceImpl({\n repo: new DrizzleAutomationsRepository(db, automationsLogger),\n runsRepo,\n uow: automationsUow,\n engine: automationEngine,\n mailer,\n lookups: mailerLookups,\n integrations,\n systemActor: (orgId) => organizations.systemActor(orgId),\n credentials: credentialStore,\n webhooks:\n options?.adapters?.webhooks ??\n new FetchWebhookSender({ allowPrivateNetwork: config.webhookAllowPrivateNetwork }),\n mail: wired.mail,\n grants: wired.grants,\n delivery: new NotificationDelivery({\n repo: notificationsRepo,\n channels: notificationRegistries.channels,\n devices,\n logger: automationsLogger,\n }),\n processor: notificationProcessor,\n logger: automationsLogger,\n });\n automationEngine.register(automations);\n automationEngine.registerJobs(\n [\n ...discussionJobs({ posts, digests, logger: discussionLogger }),\n ...contentJobs({ events: content, logger: contentLogger }),\n ...entitlementsJobs({ grants: entitlements }),\n ...assetsJobs({ assets, orgs: organizations, logger: assetsLogger }),\n ...notificationJobs({\n processor: notificationProcessor,\n reads: recipientReads,\n logger: automationsLogger,\n }),\n ],\n [...discussionRecurringJobs, ...entitlementsRecurringJobs, ...assetsRecurringJobs],\n );\n\n const eventBusOption = options?.adapters?.eventBus;\n const eventBus: EventBus =\n typeof eventBusOption === 'function'\n ? eventBusOption(logger.child({ name: 'events' }))\n : (eventBusOption ?? new InMemoryEventBus());\n if (pubsub) {\n new ChatLiveForwarder({ pubsub, logger: discussionLogger }).attach(eventBus);\n }\n eventBus.subscribeAll((event) => automations.handle(event));\n const outboxConfig = resolveOutboxConfig(config.outbox);\n const outboxRelay = new PollingOutboxRelay(\n new DrizzleOutboxStore(db, outboxLogger),\n eventBus,\n outboxConfig,\n outboxLogger,\n );\n\n /*\n * Auth Adapter\n */\n const authLogger = logger.child({ name: 'auth' });\n // Hook failures otherwise surface through Better Auth's route as an opaque\n // 500 — log which hook died before rethrowing.\n const authHook =\n <A extends unknown[], R>(name: string, fn: (...args: A) => Promise<R>) =>\n async (...args: A): Promise<R> => {\n try {\n return await fn(...args);\n } catch (err) {\n authLogger.error(`auth hook ${name} failed`, { err });\n throw err;\n }\n };\n const mcp = mcpEndpoints(config);\n if (!mcp.oauthEnabled) {\n authLogger.warn(\n 'MCP OAuth is off: BETTER_AUTH_URL must be https or a loopback host; /mcp accepts API keys only',\n { authBaseURL: config.authBaseURL },\n );\n }\n const auth: BetterAuth = new BetterAuth({\n db,\n baseUrl: config.authBaseURL,\n mcp: {\n oauthEnabled: mcp.oauthEnabled,\n resource: mcp.resource,\n loginPage: mcp.loginPage,\n consentPage: mcp.consentPage,\n orgPickerPage: mcp.orgPickerPage,\n },\n secret: config.authSecret,\n trustedOrigins: config.trustedOrigins,\n hooks: {\n sendResetPassword: async ({ user, url }) => {\n await identity.sendPasswordReset({ email: user.email, url });\n },\n onPasswordReset: async ({ user }) => {\n await identity.sendPasswordChanged({ email: user.email });\n },\n sendMagicLink: authHook('sendMagicLink', async ({ email, url }) => {\n await identity.sendMagicLink({\n email,\n url,\n });\n }),\n beforeUserCreate: authHook('beforeUserCreate', async (user) => {\n const { email, name } = user;\n const [firstName, lastName] = name.split(' ');\n // Better Auth has not minted an id yet — the id returned below becomes\n // its account id. A person provisioned at invite time is linked instead of re-created.\n const domainUser = await identity.linkOrCreateUser({\n email,\n ...(firstName !== undefined && { firstName }),\n ...(lastName !== undefined && { lastName }),\n });\n\n return {\n data: {\n ...user,\n id: domainUser.id,\n },\n };\n }),\n beforeCreateSession: authHook('beforeCreateSession', async (session) => {\n const person = await identity.getUserByExternalId(session.userId);\n if (!person) {\n return;\n }\n if (organizations.isPlatformAccount(person.email)) {\n authLogger.warn('sign-in refused for the platform account', { userId: person.id });\n return false;\n }\n const orgs = await organizations.getOrgUsersForUser(person.id);\n if (orgs.length !== 1) {\n return;\n }\n // TODO - fix, why default to the first?\n const org = await organizations.getById(orgs[0]!.orgId);\n if (!org) {\n return;\n }\n\n return { data: { ...session, activeOrganizationId: org.id } };\n }),\n /*\n * We're making sure the domain org creates and using the same ID for better-auth org ID.\n */\n beforeCreateOrganization: authHook(\n 'beforeCreateOrganization',\n async ({ organization: org, user: baUser }) => {\n const domainOrg = await organizations.provisionOrganization({\n ownerId: baUser.id,\n ...org,\n logo: org.logo ?? undefined,\n });\n return { data: { ...org, id: domainOrg.id } };\n },\n ),\n beforeDeleteOrganization: authHook('beforeDeleteOrganization', async ({ organization }) => {\n await organizations.deleteOrganization(organization.id);\n }),\n beforeAddMember: authHook('beforeAddMember', async ({ member }) => {\n await organizations.addOrgUser({\n orgId: member.organizationId,\n userId: member.userId,\n });\n }),\n beforeRemoveMember: authHook('beforeRemoveMember', async ({ member }) => {\n await organizations.removeOrgUser(member.organizationId, member.userId);\n }),\n },\n logger: authLogger,\n cookieDomain: config.cookieDomain,\n secureCookies: config.secureCookies,\n });\n orgAdminRef.current = auth;\n\n return {\n auth,\n mcp,\n platform,\n identity,\n organizations,\n // Better Auth owns org writes; the same instance fulfils the OrgAdmin port.\n orgProvider: auth,\n content,\n entitlements,\n progress,\n discussion,\n posts,\n chats,\n subscriptions,\n assets,\n integrations,\n automations,\n notificationTypes: notificationRegistries.types,\n notificationChannels: notificationRegistries.channels,\n notificationCategories,\n notificationCatalog,\n notificationCategoryLists,\n notificationSettings,\n devices,\n notificationList,\n settings,\n reporting,\n storage,\n mailer,\n credentials: credentialStore,\n outboxRelay,\n eventBus,\n automationEngine,\n scheduler: automationEngine,\n pubsub,\n chatHub: chats.hub,\n logger,\n loggerInstance,\n requestContext: requestLogContext,\n // Better Auth owns the session store; the same instance fulfils SessionAdmin.\n sessions: auth,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2NA,MAAa,kBAA4C;CACvD,SAAS;CACT,gBAAgB;CAChB,WAAW;CACX,aAAa;AACf;AAEA,SAAgB,oBAAoB,SAAuB,CAAC,GAA6B;CACvF,MAAM,YAAY,OAAO,YACvB,OAAO,QAAQ,MAAM,CAAC,CAAC,QAAQ,GAAG,WAAW,UAAU,KAAA,CAAS,CAClE;CACA,OAAO;EAAE,GAAG;EAAiB,GAAG;CAAU;AAC5C;AAQA,MAAa,mBAA4C,EAAE,OAAO,OAAO;AAEzE,SAAgB,qBAAqB,SAAwB,CAAC,GAA4B;CACxF,OAAO,EAAE,OAAO,OAAO,SAAS,iBAAiB,MAAM;AACzD;AAyEA,eAAsB,eACpB,QACA,SACoB;CACp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ACF;GACA,0BAA0B,SAAS,4BAA4B,OAAO,EAAE,mBAAmB;IACzF,MAAM,cAAc,mBAAmB,aAAa,EAAE;GACxD,CAAC;GACD,iBAAiB,SAAS,mBAAmB,OAAO,EAAE,aAAa;IACjE,MAAM,cAAc,WAAW;KAC7B,OAAO,OAAO;KACd,QAAQ,OAAO;IACjB,CAAC;GACH,CAAC;GACD,oBAAoB,SAAS,sBAAsB,OAAO,EAAE,aAAa;IACvE,MAAM,cAAc,cAAc,OAAO,gBAAgB,OAAO,MAAM;GACxE,CAAC;EACH;EACA,QAAQ;EACR,cAAc,OAAO;EACrB,eAAe,OAAO;CACxB,CAAC;CACD,YAAY,UAAU;CAEtB,OAAO;EACL;EACA;EACA;EACA;EACA;EAEA,aAAa;EACb;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,mBAAmB,uBAAuB;EAC1C,sBAAsB,uBAAuB;EAC7C;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,aAAa;EACb;EACA;EACA;EACA,WAAW;EACX;EACA,SAAS,MAAM;EACf;EACA;EACA,gBAAgB;EAEhB,UAAU;CACZ;AACF"}
|
|
@@ -46,10 +46,10 @@ declare const Permission: z.ZodEnum<{
|
|
|
46
46
|
"automations:delete": "automations:delete";
|
|
47
47
|
}>;
|
|
48
48
|
declare const Level: z.ZodUnion<readonly [z.ZodLiteral<"org">, z.ZodLazy<z.ZodEnum<{
|
|
49
|
-
course: "course";
|
|
50
49
|
download: "download";
|
|
51
|
-
|
|
50
|
+
course: "course";
|
|
52
51
|
event: "event";
|
|
52
|
+
community: "community";
|
|
53
53
|
}>>]>;
|
|
54
54
|
declare const PermissionDefinition: z.ZodObject<{
|
|
55
55
|
key: z.ZodEnum<{
|
|
@@ -101,10 +101,10 @@ declare const PermissionDefinition: z.ZodObject<{
|
|
|
101
101
|
label: z.ZodString;
|
|
102
102
|
description: z.ZodString;
|
|
103
103
|
about: z.ZodUnion<readonly [z.ZodLiteral<"org">, z.ZodLazy<z.ZodEnum<{
|
|
104
|
-
course: "course";
|
|
105
104
|
download: "download";
|
|
106
|
-
|
|
105
|
+
course: "course";
|
|
107
106
|
event: "event";
|
|
107
|
+
community: "community";
|
|
108
108
|
}>>]>;
|
|
109
109
|
implies: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
110
110
|
"organizations:read": "organizations:read";
|
|
@@ -202,10 +202,10 @@ declare const PermissionDefinitionList: z.ZodArray<z.ZodObject<{
|
|
|
202
202
|
label: z.ZodString;
|
|
203
203
|
description: z.ZodString;
|
|
204
204
|
about: z.ZodUnion<readonly [z.ZodLiteral<"org">, z.ZodLazy<z.ZodEnum<{
|
|
205
|
-
course: "course";
|
|
206
205
|
download: "download";
|
|
207
|
-
|
|
206
|
+
course: "course";
|
|
208
207
|
event: "event";
|
|
208
|
+
community: "community";
|
|
209
209
|
}>>]>;
|
|
210
210
|
implies: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
211
211
|
"organizations:read": "organizations:read";
|
|
@@ -8,8 +8,8 @@ declare const AssetKind: z.ZodEnum<{
|
|
|
8
8
|
}>;
|
|
9
9
|
type AssetKind = z.infer<typeof AssetKind>;
|
|
10
10
|
declare const AssetSource: z.ZodEnum<{
|
|
11
|
-
library: "library";
|
|
12
11
|
member: "member";
|
|
12
|
+
library: "library";
|
|
13
13
|
}>;
|
|
14
14
|
type AssetSource = z.infer<typeof AssetSource>;
|
|
15
15
|
declare const AssetStatus: z.ZodEnum<{
|
|
@@ -19,18 +19,18 @@ declare const AssetStatus: z.ZodEnum<{
|
|
|
19
19
|
type AssetStatus = z.infer<typeof AssetStatus>;
|
|
20
20
|
declare const Asset: z.ZodObject<{
|
|
21
21
|
id: z.ZodString;
|
|
22
|
-
createdAt: z.ZodCoercedDate<unknown>;
|
|
23
22
|
status: z.ZodEnum<{
|
|
24
23
|
pending: "pending";
|
|
25
24
|
ready: "ready";
|
|
26
25
|
}>;
|
|
27
|
-
|
|
28
|
-
contentId: z.ZodNullable<z.ZodString>;
|
|
29
|
-
orgId: z.ZodString;
|
|
26
|
+
createdAt: z.ZodCoercedDate<unknown>;
|
|
30
27
|
updatedAt: z.ZodCoercedDate<unknown>;
|
|
31
|
-
|
|
28
|
+
orgId: z.ZodString;
|
|
32
29
|
filename: z.ZodString;
|
|
30
|
+
contentType: z.ZodString;
|
|
33
31
|
size: z.ZodNumber;
|
|
32
|
+
contentId: z.ZodNullable<z.ZodString>;
|
|
33
|
+
uploadedBy: z.ZodString;
|
|
34
34
|
kind: z.ZodEnum<{
|
|
35
35
|
image: "image";
|
|
36
36
|
video: "video";
|
|
@@ -38,8 +38,8 @@ declare const Asset: z.ZodObject<{
|
|
|
38
38
|
document: "document";
|
|
39
39
|
}>;
|
|
40
40
|
source: z.ZodEnum<{
|
|
41
|
-
library: "library";
|
|
42
41
|
member: "member";
|
|
42
|
+
library: "library";
|
|
43
43
|
}>;
|
|
44
44
|
url: z.ZodNullable<z.ZodString>;
|
|
45
45
|
downloadUrl: z.ZodNullable<z.ZodString>;
|
|
@@ -57,8 +57,8 @@ declare const AssetsQuery: z.ZodObject<{
|
|
|
57
57
|
document: "document";
|
|
58
58
|
}>>;
|
|
59
59
|
source: z.ZodOptional<z.ZodEnum<{
|
|
60
|
-
library: "library";
|
|
61
60
|
member: "member";
|
|
61
|
+
library: "library";
|
|
62
62
|
}>>;
|
|
63
63
|
contentId: z.ZodOptional<z.ZodString>;
|
|
64
64
|
}, z.core.$strip>;
|
|
@@ -66,18 +66,18 @@ type AssetsQuery = z.infer<typeof AssetsQuery>;
|
|
|
66
66
|
declare const AssetsPage: z.ZodObject<{
|
|
67
67
|
rows: z.ZodArray<z.ZodObject<{
|
|
68
68
|
id: z.ZodString;
|
|
69
|
-
createdAt: z.ZodCoercedDate<unknown>;
|
|
70
69
|
status: z.ZodEnum<{
|
|
71
70
|
pending: "pending";
|
|
72
71
|
ready: "ready";
|
|
73
72
|
}>;
|
|
74
|
-
|
|
75
|
-
contentId: z.ZodNullable<z.ZodString>;
|
|
76
|
-
orgId: z.ZodString;
|
|
73
|
+
createdAt: z.ZodCoercedDate<unknown>;
|
|
77
74
|
updatedAt: z.ZodCoercedDate<unknown>;
|
|
78
|
-
|
|
75
|
+
orgId: z.ZodString;
|
|
79
76
|
filename: z.ZodString;
|
|
77
|
+
contentType: z.ZodString;
|
|
80
78
|
size: z.ZodNumber;
|
|
79
|
+
contentId: z.ZodNullable<z.ZodString>;
|
|
80
|
+
uploadedBy: z.ZodString;
|
|
81
81
|
kind: z.ZodEnum<{
|
|
82
82
|
image: "image";
|
|
83
83
|
video: "video";
|
|
@@ -85,8 +85,8 @@ declare const AssetsPage: z.ZodObject<{
|
|
|
85
85
|
document: "document";
|
|
86
86
|
}>;
|
|
87
87
|
source: z.ZodEnum<{
|
|
88
|
-
library: "library";
|
|
89
88
|
member: "member";
|
|
89
|
+
library: "library";
|
|
90
90
|
}>;
|
|
91
91
|
url: z.ZodNullable<z.ZodString>;
|
|
92
92
|
downloadUrl: z.ZodNullable<z.ZodString>;
|
|
@@ -118,18 +118,18 @@ declare const UploadTicket: z.ZodObject<{
|
|
|
118
118
|
headers: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
119
119
|
asset: z.ZodObject<{
|
|
120
120
|
id: z.ZodString;
|
|
121
|
-
createdAt: z.ZodCoercedDate<unknown>;
|
|
122
121
|
status: z.ZodEnum<{
|
|
123
122
|
pending: "pending";
|
|
124
123
|
ready: "ready";
|
|
125
124
|
}>;
|
|
126
|
-
|
|
127
|
-
contentId: z.ZodNullable<z.ZodString>;
|
|
128
|
-
orgId: z.ZodString;
|
|
125
|
+
createdAt: z.ZodCoercedDate<unknown>;
|
|
129
126
|
updatedAt: z.ZodCoercedDate<unknown>;
|
|
130
|
-
|
|
127
|
+
orgId: z.ZodString;
|
|
131
128
|
filename: z.ZodString;
|
|
129
|
+
contentType: z.ZodString;
|
|
132
130
|
size: z.ZodNumber;
|
|
131
|
+
contentId: z.ZodNullable<z.ZodString>;
|
|
132
|
+
uploadedBy: z.ZodString;
|
|
133
133
|
kind: z.ZodEnum<{
|
|
134
134
|
image: "image";
|
|
135
135
|
video: "video";
|
|
@@ -137,8 +137,8 @@ declare const UploadTicket: z.ZodObject<{
|
|
|
137
137
|
document: "document";
|
|
138
138
|
}>;
|
|
139
139
|
source: z.ZodEnum<{
|
|
140
|
-
library: "library";
|
|
141
140
|
member: "member";
|
|
141
|
+
library: "library";
|
|
142
142
|
}>;
|
|
143
143
|
url: z.ZodNullable<z.ZodString>;
|
|
144
144
|
downloadUrl: z.ZodNullable<z.ZodString>;
|
|
@@ -29,8 +29,8 @@ declare const MessageFlag: z.ZodObject<{
|
|
|
29
29
|
resolvedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
30
30
|
resolution: z.ZodNullable<z.ZodEnum<{
|
|
31
31
|
dismissed: "dismissed";
|
|
32
|
-
deleted: "deleted";
|
|
33
32
|
locked: "locked";
|
|
33
|
+
deleted: "deleted";
|
|
34
34
|
}>>;
|
|
35
35
|
resolvedBy: z.ZodNullable<z.ZodString>;
|
|
36
36
|
createdAt: z.ZodCoercedDate<unknown>;
|
|
@@ -234,15 +234,20 @@ declare const ChatLiveEvent: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
234
234
|
type: z.ZodLiteral<"message.created">;
|
|
235
235
|
chatId: z.ZodString;
|
|
236
236
|
message: z.ZodObject<{
|
|
237
|
-
clientId: z.ZodNullable<z.ZodUUID>;
|
|
238
237
|
id: z.ZodString;
|
|
239
|
-
|
|
240
|
-
orgId: z.ZodString;
|
|
241
|
-
updatedAt: z.ZodCoercedDate<unknown>;
|
|
238
|
+
reactions: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
242
239
|
communityId: z.ZodString;
|
|
240
|
+
body: z.ZodString;
|
|
241
|
+
mentions: z.ZodArray<z.ZodObject<{
|
|
242
|
+
orgUserId: z.ZodString;
|
|
243
|
+
name: z.ZodString;
|
|
244
|
+
}, z.core.$strict>>;
|
|
243
245
|
orgUserId: z.ZodString;
|
|
246
|
+
createdAt: z.ZodCoercedDate<unknown>;
|
|
247
|
+
updatedAt: z.ZodCoercedDate<unknown>;
|
|
248
|
+
orgId: z.ZodString;
|
|
244
249
|
chatId: z.ZodString;
|
|
245
|
-
|
|
250
|
+
clientId: z.ZodNullable<z.ZodUUID>;
|
|
246
251
|
replyToId: z.ZodNullable<z.ZodString>;
|
|
247
252
|
editedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
248
253
|
deletedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
@@ -262,25 +267,25 @@ declare const ChatLiveEvent: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
262
267
|
assetId: z.ZodString;
|
|
263
268
|
url: z.ZodString;
|
|
264
269
|
}, z.core.$strict>>;
|
|
265
|
-
reactions: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
266
|
-
mentions: z.ZodArray<z.ZodObject<{
|
|
267
|
-
orgUserId: z.ZodString;
|
|
268
|
-
name: z.ZodString;
|
|
269
|
-
}, z.core.$strict>>;
|
|
270
270
|
}, z.core.$strict>;
|
|
271
271
|
}, z.core.$strict>, z.ZodObject<{
|
|
272
272
|
type: z.ZodLiteral<"message.updated">;
|
|
273
273
|
chatId: z.ZodString;
|
|
274
274
|
message: z.ZodObject<{
|
|
275
|
-
clientId: z.ZodNullable<z.ZodUUID>;
|
|
276
275
|
id: z.ZodString;
|
|
277
|
-
|
|
278
|
-
orgId: z.ZodString;
|
|
279
|
-
updatedAt: z.ZodCoercedDate<unknown>;
|
|
276
|
+
reactions: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
280
277
|
communityId: z.ZodString;
|
|
278
|
+
body: z.ZodString;
|
|
279
|
+
mentions: z.ZodArray<z.ZodObject<{
|
|
280
|
+
orgUserId: z.ZodString;
|
|
281
|
+
name: z.ZodString;
|
|
282
|
+
}, z.core.$strict>>;
|
|
281
283
|
orgUserId: z.ZodString;
|
|
284
|
+
createdAt: z.ZodCoercedDate<unknown>;
|
|
285
|
+
updatedAt: z.ZodCoercedDate<unknown>;
|
|
286
|
+
orgId: z.ZodString;
|
|
282
287
|
chatId: z.ZodString;
|
|
283
|
-
|
|
288
|
+
clientId: z.ZodNullable<z.ZodUUID>;
|
|
284
289
|
replyToId: z.ZodNullable<z.ZodString>;
|
|
285
290
|
editedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
286
291
|
deletedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
@@ -300,11 +305,6 @@ declare const ChatLiveEvent: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
300
305
|
assetId: z.ZodString;
|
|
301
306
|
url: z.ZodString;
|
|
302
307
|
}, z.core.$strict>>;
|
|
303
|
-
reactions: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
304
|
-
mentions: z.ZodArray<z.ZodObject<{
|
|
305
|
-
orgUserId: z.ZodString;
|
|
306
|
-
name: z.ZodString;
|
|
307
|
-
}, z.core.$strict>>;
|
|
308
308
|
}, z.core.$strict>;
|
|
309
309
|
}, z.core.$strict>, z.ZodObject<{
|
|
310
310
|
type: z.ZodLiteral<"message.deleted">;
|
|
@@ -431,8 +431,8 @@ declare const MessageQueueEntry: z.ZodObject<{
|
|
|
431
431
|
resolvedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
432
432
|
resolution: z.ZodNullable<z.ZodEnum<{
|
|
433
433
|
dismissed: "dismissed";
|
|
434
|
-
deleted: "deleted";
|
|
435
434
|
locked: "locked";
|
|
435
|
+
deleted: "deleted";
|
|
436
436
|
}>>;
|
|
437
437
|
resolvedBy: z.ZodNullable<z.ZodString>;
|
|
438
438
|
createdAt: z.ZodCoercedDate<unknown>;
|
|
@@ -507,8 +507,8 @@ declare const MessageQueue: z.ZodObject<{
|
|
|
507
507
|
resolvedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
508
508
|
resolution: z.ZodNullable<z.ZodEnum<{
|
|
509
509
|
dismissed: "dismissed";
|
|
510
|
-
deleted: "deleted";
|
|
511
510
|
locked: "locked";
|
|
511
|
+
deleted: "deleted";
|
|
512
512
|
}>>;
|
|
513
513
|
resolvedBy: z.ZodNullable<z.ZodString>;
|
|
514
514
|
createdAt: z.ZodCoercedDate<unknown>;
|