diff --git a/packages/matrix-bot-common/src/base/base-matrix.service.ts b/packages/matrix-bot-common/src/base/base-matrix.service.ts index dbfa81333..335d7044b 100644 --- a/packages/matrix-bot-common/src/base/base-matrix.service.ts +++ b/packages/matrix-bot-common/src/base/base-matrix.service.ts @@ -1,5 +1,4 @@ -import { Logger, OnModuleInit, OnModuleDestroy } from '@nestjs/common'; -import { ConfigService } from '@nestjs/config'; +import { Logger, type OnModuleInit, type OnModuleDestroy } from '@nestjs/common'; import { MatrixClient, SimpleFsStorageProvider, @@ -8,7 +7,7 @@ import { } from 'matrix-bot-sdk'; import * as path from 'path'; import * as fs from 'fs'; -import { MatrixBotConfig, MatrixRoomEvent, isTextMessage, isAudioMessage } from './types'; +import { type MatrixBotConfig, type MatrixRoomEvent, isTextMessage, isAudioMessage } from './types'; import { markdownToHtml } from '../markdown/markdown-formatter'; /** @@ -42,13 +41,20 @@ import { markdownToHtml } from '../markdown/markdown-formatter'; * } * ``` */ +/** + * Interface for config service to support both @nestjs/config v3 and v4 + */ +export interface IConfigService { + get(propertyPath: string): T | undefined; +} + export abstract class BaseMatrixService implements OnModuleInit, OnModuleDestroy { protected readonly logger = new Logger(this.constructor.name); protected client!: MatrixClient; - protected botUserId: string = ''; + protected botUserId = ''; protected readonly allowedRooms: string[]; - constructor(protected configService: ConfigService) { + constructor(protected configService: IConfigService) { this.allowedRooms = this.getConfig().allowedRooms; } diff --git a/packages/matrix-bot-common/src/base/index.ts b/packages/matrix-bot-common/src/base/index.ts index 81669d5c1..bcb5fb95e 100644 --- a/packages/matrix-bot-common/src/base/index.ts +++ b/packages/matrix-bot-common/src/base/index.ts @@ -1,4 +1,4 @@ -export { BaseMatrixService } from './base-matrix.service'; +export { BaseMatrixService, type IConfigService } from './base-matrix.service'; export { type MatrixBotConfig, type MatrixRoomEvent, diff --git a/packages/matrix-bot-common/src/index.ts b/packages/matrix-bot-common/src/index.ts index c77830fe0..88f17096a 100644 --- a/packages/matrix-bot-common/src/index.ts +++ b/packages/matrix-bot-common/src/index.ts @@ -21,6 +21,7 @@ // Base Matrix Service export { BaseMatrixService, + type IConfigService, type MatrixBotConfig, type MatrixRoomEvent, type MatrixMessageEvent, @@ -46,12 +47,7 @@ export { } from './message'; // Markdown Utilities -export { - markdownToHtml, - escapeHtml, - formatNumberedList, - formatBulletList, -} from './markdown'; +export { markdownToHtml, escapeHtml, formatNumberedList, formatBulletList } from './markdown'; // Keyword Detection export { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 01c44264f..9c82549e3 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -5817,6 +5817,9 @@ importers: services/matrix-calendar-bot: dependencies: + '@manacore/matrix-bot-common': + specifier: workspace:* + version: link:../../packages/matrix-bot-common '@nestjs/common': specifier: ^10.4.15 version: 10.4.20(class-transformer@0.5.1)(class-validator@0.14.3)(reflect-metadata@0.2.2)(rxjs@7.8.2) @@ -5857,6 +5860,9 @@ importers: '@manacore/bot-services': specifier: workspace:* version: link:../../packages/bot-services + '@manacore/matrix-bot-common': + specifier: workspace:* + version: link:../../packages/matrix-bot-common '@nestjs/common': specifier: ^10.4.15 version: 10.4.20(class-transformer@0.5.1)(class-validator@0.14.3)(reflect-metadata@0.2.2)(rxjs@7.8.2) @@ -5894,6 +5900,9 @@ importers: '@manacore/bot-services': specifier: workspace:* version: link:../../packages/bot-services + '@manacore/matrix-bot-common': + specifier: workspace:* + version: link:../../packages/matrix-bot-common '@nestjs/common': specifier: ^10.4.17 version: 10.4.20(class-transformer@0.5.1)(class-validator@0.14.3)(reflect-metadata@0.2.2)(rxjs@7.8.2) @@ -5931,6 +5940,9 @@ importers: '@manacore/bot-services': specifier: workspace:* version: link:../../packages/bot-services + '@manacore/matrix-bot-common': + specifier: workspace:* + version: link:../../packages/matrix-bot-common '@nestjs/common': specifier: ^10.4.15 version: 10.4.20(class-transformer@0.5.1)(class-validator@0.14.3)(reflect-metadata@0.2.2)(rxjs@7.8.2) @@ -5968,6 +5980,9 @@ importers: '@manacore/bot-services': specifier: workspace:* version: link:../../packages/bot-services + '@manacore/matrix-bot-common': + specifier: workspace:* + version: link:../../packages/matrix-bot-common '@nestjs/common': specifier: ^10.0.0 version: 10.4.20(class-transformer@0.5.1)(class-validator@0.14.3)(reflect-metadata@0.1.14)(rxjs@7.8.2) @@ -6005,6 +6020,9 @@ importers: '@manacore/bot-services': specifier: workspace:* version: link:../../packages/bot-services + '@manacore/matrix-bot-common': + specifier: workspace:* + version: link:../../packages/matrix-bot-common '@nestjs/common': specifier: ^10.4.15 version: 10.4.20(class-transformer@0.5.1)(class-validator@0.14.3)(reflect-metadata@0.2.2)(rxjs@7.8.2) @@ -6042,6 +6060,9 @@ importers: '@manacore/bot-services': specifier: workspace:* version: link:../../packages/bot-services + '@manacore/matrix-bot-common': + specifier: workspace:* + version: link:../../packages/matrix-bot-common '@nestjs/common': specifier: ^10.4.15 version: 10.4.20(class-transformer@0.5.1)(class-validator@0.14.3)(reflect-metadata@0.2.2)(rxjs@7.8.2) @@ -6079,6 +6100,9 @@ importers: services/matrix-ollama-bot: dependencies: + '@manacore/matrix-bot-common': + specifier: workspace:* + version: link:../../packages/matrix-bot-common '@nestjs/common': specifier: ^10.4.15 version: 10.4.20(class-transformer@0.5.1)(class-validator@0.14.3)(reflect-metadata@0.2.2)(rxjs@7.8.2) @@ -6119,6 +6143,9 @@ importers: '@manacore/bot-services': specifier: workspace:* version: link:../../packages/bot-services + '@manacore/matrix-bot-common': + specifier: workspace:* + version: link:../../packages/matrix-bot-common '@nestjs/common': specifier: ^10.4.15 version: 10.4.20(class-transformer@0.5.1)(class-validator@0.14.3)(reflect-metadata@0.2.2)(rxjs@7.8.2) @@ -6156,6 +6183,9 @@ importers: '@manacore/bot-services': specifier: workspace:* version: link:../../packages/bot-services + '@manacore/matrix-bot-common': + specifier: workspace:* + version: link:../../packages/matrix-bot-common '@nestjs/common': specifier: ^10.4.15 version: 10.4.20(class-transformer@0.5.1)(class-validator@0.14.3)(reflect-metadata@0.2.2)(rxjs@7.8.2) @@ -6193,6 +6223,9 @@ importers: '@manacore/bot-services': specifier: workspace:* version: link:../../packages/bot-services + '@manacore/matrix-bot-common': + specifier: workspace:* + version: link:../../packages/matrix-bot-common '@nestjs/common': specifier: ^10.4.15 version: 10.4.20(class-transformer@0.5.1)(class-validator@0.14.3)(reflect-metadata@0.2.2)(rxjs@7.8.2) @@ -6236,6 +6269,9 @@ importers: '@manacore/bot-services': specifier: workspace:* version: link:../../packages/bot-services + '@manacore/matrix-bot-common': + specifier: workspace:* + version: link:../../packages/matrix-bot-common '@nestjs/common': specifier: ^10.4.15 version: 10.4.20(class-transformer@0.5.1)(class-validator@0.14.3)(reflect-metadata@0.2.2)(rxjs@7.8.2) @@ -6269,7 +6305,7 @@ importers: devDependencies: '@nestjs/cli': specifier: ^10.4.9 - version: 10.4.9(esbuild@0.27.0) + version: 10.4.9(esbuild@0.19.12) '@nestjs/schematics': specifier: ^10.2.3 version: 10.2.3(chokidar@3.6.0)(typescript@5.9.3) @@ -6291,6 +6327,9 @@ importers: '@manacore/bot-services': specifier: workspace:* version: link:../../packages/bot-services + '@manacore/matrix-bot-common': + specifier: workspace:* + version: link:../../packages/matrix-bot-common '@nestjs/common': specifier: ^10.4.15 version: 10.4.20(class-transformer@0.5.1)(class-validator@0.14.3)(reflect-metadata@0.2.2)(rxjs@7.8.2) @@ -6328,6 +6367,9 @@ importers: '@manacore/bot-services': specifier: workspace:* version: link:../../packages/bot-services + '@manacore/matrix-bot-common': + specifier: workspace:* + version: link:../../packages/matrix-bot-common '@nestjs/common': specifier: ^10.4.15 version: 10.4.20(class-transformer@0.5.1)(class-validator@0.14.3)(reflect-metadata@0.2.2)(rxjs@7.8.2) @@ -6362,6 +6404,9 @@ importers: services/matrix-stats-bot: dependencies: + '@manacore/matrix-bot-common': + specifier: workspace:* + version: link:../../packages/matrix-bot-common '@nestjs/common': specifier: ^10.4.15 version: 10.4.20(class-transformer@0.5.1)(class-validator@0.14.3)(reflect-metadata@0.2.2)(rxjs@7.8.2) @@ -6411,6 +6456,9 @@ importers: '@manacore/bot-services': specifier: workspace:* version: link:../../packages/bot-services + '@manacore/matrix-bot-common': + specifier: workspace:* + version: link:../../packages/matrix-bot-common '@nestjs/common': specifier: ^10.4.15 version: 10.4.20(class-transformer@0.5.1)(class-validator@0.14.3)(reflect-metadata@0.2.2)(rxjs@7.8.2) @@ -6448,6 +6496,9 @@ importers: '@manacore/bot-services': specifier: workspace:* version: link:../../packages/bot-services + '@manacore/matrix-bot-common': + specifier: workspace:* + version: link:../../packages/matrix-bot-common '@nestjs/common': specifier: ^10.4.15 version: 10.4.20(class-transformer@0.5.1)(class-validator@0.14.3)(reflect-metadata@0.2.2)(rxjs@7.8.2) @@ -6485,6 +6536,9 @@ importers: services/matrix-tts-bot: dependencies: + '@manacore/matrix-bot-common': + specifier: workspace:* + version: link:../../packages/matrix-bot-common '@nestjs/common': specifier: ^10.4.17 version: 10.4.20(class-transformer@0.5.1)(class-validator@0.14.3)(reflect-metadata@0.2.2)(rxjs@7.8.2) @@ -6522,6 +6576,9 @@ importers: '@manacore/bot-services': specifier: workspace:* version: link:../../packages/bot-services + '@manacore/matrix-bot-common': + specifier: workspace:* + version: link:../../packages/matrix-bot-common '@nestjs/common': specifier: ^10.4.15 version: 10.4.20(class-transformer@0.5.1)(class-validator@0.14.3)(reflect-metadata@0.2.2)(rxjs@7.8.2) @@ -26432,7 +26489,7 @@ snapshots: wrap-ansi: 7.0.0 ws: 8.18.3 optionalDependencies: - expo-router: 6.0.15(vmxlpuhz6xqbe2ee7fdabyqx3y) + expo-router: 6.0.15(vsbyfpxjq3qh7ulnvreavubnnm) react-native: 0.81.5(@babel/core@7.28.5)(@types/react@19.2.7)(react@19.1.0) transitivePeerDependencies: - '@modelcontextprotocol/sdk' @@ -27810,6 +27867,43 @@ snapshots: - supports-color - ts-node + '@jest/core@30.2.0(esbuild-register@3.6.0(esbuild@0.19.12))': + dependencies: + '@jest/console': 30.2.0 + '@jest/pattern': 30.0.1 + '@jest/reporters': 30.2.0 + '@jest/test-result': 30.2.0 + '@jest/transform': 30.2.0 + '@jest/types': 30.2.0 + '@types/node': 22.19.1 + ansi-escapes: 4.3.2 + chalk: 4.1.2 + ci-info: 4.3.1 + exit-x: 0.2.2 + graceful-fs: 4.2.11 + jest-changed-files: 30.2.0 + jest-config: 30.2.0(@types/node@22.19.1)(esbuild-register@3.6.0(esbuild@0.19.12)) + jest-haste-map: 30.2.0 + jest-message-util: 30.2.0 + jest-regex-util: 30.0.1 + jest-resolve: 30.2.0 + jest-resolve-dependencies: 30.2.0 + jest-runner: 30.2.0 + jest-runtime: 30.2.0 + jest-snapshot: 30.2.0 + jest-util: 30.2.0 + jest-validate: 30.2.0 + jest-watcher: 30.2.0 + micromatch: 4.0.8 + pretty-format: 30.2.0 + slash: 3.0.0 + transitivePeerDependencies: + - babel-plugin-macros + - esbuild-register + - supports-color + - ts-node + optional: true + '@jest/core@30.2.0(esbuild-register@3.6.0(esbuild@0.27.0))': dependencies: '@jest/console': 30.2.0 @@ -28328,6 +28422,32 @@ snapshots: - uglify-js - webpack-cli + '@nestjs/cli@10.4.9(esbuild@0.19.12)': + dependencies: + '@angular-devkit/core': 17.3.11(chokidar@3.6.0) + '@angular-devkit/schematics': 17.3.11(chokidar@3.6.0) + '@angular-devkit/schematics-cli': 17.3.11(chokidar@3.6.0) + '@nestjs/schematics': 10.2.3(chokidar@3.6.0)(typescript@5.7.2) + chalk: 4.1.2 + chokidar: 3.6.0 + cli-table3: 0.6.5 + commander: 4.1.1 + fork-ts-checker-webpack-plugin: 9.0.2(typescript@5.7.2)(webpack@5.97.1(esbuild@0.19.12)) + glob: 10.4.5 + inquirer: 8.2.6 + node-emoji: 1.11.0 + ora: 5.4.1 + tree-kill: 1.2.2 + tsconfig-paths: 4.2.0 + tsconfig-paths-webpack-plugin: 4.2.0 + typescript: 5.7.2 + webpack: 5.97.1(esbuild@0.19.12) + webpack-node-externals: 3.0.0 + transitivePeerDependencies: + - esbuild + - uglify-js + - webpack-cli + '@nestjs/cli@10.4.9(esbuild@0.27.0)': dependencies: '@angular-devkit/core': 17.3.11(chokidar@3.6.0) @@ -31936,6 +32056,19 @@ snapshots: jest: 30.2.0(@types/node@20.19.25)(esbuild-register@3.6.0(esbuild@0.27.0)) optional: true + '@testing-library/react-native@13.3.3(jest@30.2.0(@types/node@22.19.1)(esbuild-register@3.6.0(esbuild@0.19.12)))(react-native@0.81.5(@babel/core@7.28.5)(@types/react@19.2.7)(react@19.1.0))(react-test-renderer@19.1.0(react@19.1.0))(react@19.1.0)': + dependencies: + jest-matcher-utils: 30.2.0 + picocolors: 1.1.1 + pretty-format: 30.2.0 + react: 19.1.0 + react-native: 0.81.5(@babel/core@7.28.5)(@types/react@19.2.7)(react@19.1.0) + react-test-renderer: 19.1.0(react@19.1.0) + redent: 3.0.0 + optionalDependencies: + jest: 30.2.0(@types/node@22.19.1)(esbuild-register@3.6.0(esbuild@0.19.12)) + optional: true + '@testing-library/react-native@13.3.3(jest@30.2.0(esbuild-register@3.6.0(esbuild@0.27.0)))(react-native@0.81.4(@babel/core@7.28.5)(@types/react@19.2.7)(react@19.1.0))(react-test-renderer@19.1.0(react@19.1.0))(react@19.1.0)': dependencies: jest-matcher-utils: 30.2.0 @@ -38242,6 +38375,53 @@ snapshots: - '@types/react-dom' - supports-color + expo-router@6.0.15(vsbyfpxjq3qh7ulnvreavubnnm): + dependencies: + '@expo/metro-runtime': 6.1.2(expo@54.0.25)(react-dom@19.1.0(react@19.1.0))(react-native@0.81.5(@babel/core@7.28.5)(@types/react@19.2.7)(react@19.1.0))(react@19.1.0) + '@expo/schema-utils': 0.1.7 + '@radix-ui/react-slot': 1.2.0(@types/react@19.2.7)(react@19.1.0) + '@radix-ui/react-tabs': 1.1.13(@types/react-dom@19.2.3(@types/react@19.2.7))(@types/react@19.2.7)(react-dom@19.1.0(react@19.1.0))(react@19.1.0) + '@react-navigation/bottom-tabs': 7.8.6(@react-navigation/native@7.1.21(react-native@0.81.5(@babel/core@7.28.5)(@types/react@19.2.7)(react@19.1.0))(react@19.1.0))(react-native-safe-area-context@5.6.2(react-native@0.81.5(@babel/core@7.28.5)(@types/react@19.2.7)(react@19.1.0))(react@19.1.0))(react-native-screens@4.16.0(react-native@0.81.5(@babel/core@7.28.5)(@types/react@19.2.7)(react@19.1.0))(react@19.1.0))(react-native@0.81.5(@babel/core@7.28.5)(@types/react@19.2.7)(react@19.1.0))(react@19.1.0) + '@react-navigation/native': 7.1.21(react-native@0.81.5(@babel/core@7.28.5)(@types/react@19.2.7)(react@19.1.0))(react@19.1.0) + '@react-navigation/native-stack': 7.8.0(@react-navigation/native@7.1.21(react-native@0.81.5(@babel/core@7.28.5)(@types/react@19.2.7)(react@19.1.0))(react@19.1.0))(react-native-safe-area-context@5.6.2(react-native@0.81.5(@babel/core@7.28.5)(@types/react@19.2.7)(react@19.1.0))(react@19.1.0))(react-native-screens@4.16.0(react-native@0.81.5(@babel/core@7.28.5)(@types/react@19.2.7)(react@19.1.0))(react@19.1.0))(react-native@0.81.5(@babel/core@7.28.5)(@types/react@19.2.7)(react@19.1.0))(react@19.1.0) + client-only: 0.0.1 + debug: 4.4.3 + escape-string-regexp: 4.0.0 + expo: 54.0.25(@babel/core@7.28.5)(@expo/metro-runtime@6.1.2)(expo-router@6.0.15)(react-native-webview@13.12.2(react-native@0.81.5(@babel/core@7.28.5)(@types/react@19.2.7)(react@19.1.0))(react@19.1.0))(react-native@0.81.5(@babel/core@7.28.5)(@types/react@19.2.7)(react@19.1.0))(react@19.1.0) + expo-constants: 18.0.10(expo@54.0.25)(react-native@0.81.5(@babel/core@7.28.5)(@types/react@19.2.7)(react@19.1.0)) + expo-linking: 8.0.9(expo@54.0.25)(react-native@0.81.5(@babel/core@7.28.5)(@types/react@19.2.7)(react@19.1.0))(react@19.1.0) + expo-server: 1.0.4 + fast-deep-equal: 3.1.3 + invariant: 2.2.4 + nanoid: 3.3.11 + query-string: 7.1.3 + react: 19.1.0 + react-fast-compare: 3.2.2 + react-native: 0.81.5(@babel/core@7.28.5)(@types/react@19.2.7)(react@19.1.0) + react-native-is-edge-to-edge: 1.2.1(react-native@0.81.5(@babel/core@7.28.5)(@types/react@19.2.7)(react@19.1.0))(react@19.1.0) + react-native-safe-area-context: 5.6.2(react-native@0.81.5(@babel/core@7.28.5)(@types/react@19.2.7)(react@19.1.0))(react@19.1.0) + react-native-screens: 4.16.0(react-native@0.81.5(@babel/core@7.28.5)(@types/react@19.2.7)(react@19.1.0))(react@19.1.0) + semver: 7.6.3 + server-only: 0.0.1 + sf-symbols-typescript: 2.1.0 + shallowequal: 1.1.0 + use-latest-callback: 0.2.6(react@19.1.0) + vaul: 1.1.2(@types/react-dom@19.2.3(@types/react@19.2.7))(@types/react@19.2.7)(react-dom@19.1.0(react@19.1.0))(react@19.1.0) + optionalDependencies: + '@react-navigation/drawer': 7.7.4(@react-navigation/native@7.1.21(react-native@0.81.5(@babel/core@7.28.5)(@types/react@19.2.7)(react@19.1.0))(react@19.1.0))(react-native-gesture-handler@2.28.0(react-native@0.81.5(@babel/core@7.28.5)(@types/react@19.2.7)(react@19.1.0))(react@19.1.0))(react-native-reanimated@4.1.5(@babel/core@7.28.5)(react-native-worklets@0.6.1(@babel/core@7.28.5)(react-native@0.81.5(@babel/core@7.28.5)(@types/react@19.2.7)(react@19.1.0))(react@19.1.0))(react-native@0.81.5(@babel/core@7.28.5)(@types/react@19.2.7)(react@19.1.0))(react@19.1.0))(react-native-safe-area-context@5.6.2(react-native@0.81.5(@babel/core@7.28.5)(@types/react@19.2.7)(react@19.1.0))(react@19.1.0))(react-native-screens@4.16.0(react-native@0.81.5(@babel/core@7.28.5)(@types/react@19.2.7)(react@19.1.0))(react@19.1.0))(react-native@0.81.5(@babel/core@7.28.5)(@types/react@19.2.7)(react@19.1.0))(react@19.1.0) + '@testing-library/react-native': 13.3.3(jest@30.2.0(@types/node@22.19.1)(esbuild-register@3.6.0(esbuild@0.19.12)))(react-native@0.81.5(@babel/core@7.28.5)(@types/react@19.2.7)(react@19.1.0))(react-test-renderer@19.1.0(react@19.1.0))(react@19.1.0) + react-dom: 19.1.0(react@19.1.0) + react-native-gesture-handler: 2.28.0(react-native@0.81.5(@babel/core@7.28.5)(@types/react@19.2.7)(react@19.1.0))(react@19.1.0) + react-native-reanimated: 4.1.5(@babel/core@7.28.5)(react-native-worklets@0.6.1(@babel/core@7.28.5)(react-native@0.81.5(@babel/core@7.28.5)(@types/react@19.2.7)(react@19.1.0))(react@19.1.0))(react-native@0.81.5(@babel/core@7.28.5)(@types/react@19.2.7)(react@19.1.0))(react@19.1.0) + react-native-web: 0.21.2(encoding@0.1.13)(react-dom@19.1.0(react@19.1.0))(react@19.1.0) + react-server-dom-webpack: 19.0.0(react-dom@19.1.0(react@19.1.0))(react@19.1.0)(webpack@5.100.2(esbuild@0.19.12)) + transitivePeerDependencies: + - '@react-native-masked-view/masked-view' + - '@types/react' + - '@types/react-dom' + - supports-color + optional: true + expo-router@6.0.15(xyagqkzos5etzn52s4may7634u): dependencies: '@expo/metro-runtime': 6.1.2(expo@54.0.25)(react-dom@19.1.0(react@19.1.0))(react-native@0.81.4(@babel/core@7.28.5)(@types/react@19.2.7)(react@19.1.0))(react@19.1.0) @@ -39179,6 +39359,23 @@ snapshots: forever-agent@0.6.1: {} + fork-ts-checker-webpack-plugin@9.0.2(typescript@5.7.2)(webpack@5.97.1(esbuild@0.19.12)): + dependencies: + '@babel/code-frame': 7.27.1 + chalk: 4.1.2 + chokidar: 3.6.0 + cosmiconfig: 8.3.6(typescript@5.7.2) + deepmerge: 4.3.1 + fs-extra: 10.1.0 + memfs: 3.5.3 + minimatch: 3.1.2 + node-abort-controller: 3.1.1 + schema-utils: 3.3.0 + semver: 7.7.3 + tapable: 2.3.0 + typescript: 5.7.2 + webpack: 5.97.1(esbuild@0.19.12) + fork-ts-checker-webpack-plugin@9.0.2(typescript@5.7.2)(webpack@5.97.1(esbuild@0.27.0)): dependencies: '@babel/code-frame': 7.27.1 @@ -40673,6 +40870,26 @@ snapshots: - ts-node optional: true + jest-cli@30.2.0(@types/node@22.19.1)(esbuild-register@3.6.0(esbuild@0.19.12)): + dependencies: + '@jest/core': 30.2.0(esbuild-register@3.6.0(esbuild@0.19.12)) + '@jest/test-result': 30.2.0 + '@jest/types': 30.2.0 + chalk: 4.1.2 + exit-x: 0.2.2 + import-local: 3.2.0 + jest-config: 30.2.0(@types/node@22.19.1)(esbuild-register@3.6.0(esbuild@0.19.12)) + jest-util: 30.2.0 + jest-validate: 30.2.0 + yargs: 17.7.2 + transitivePeerDependencies: + - '@types/node' + - babel-plugin-macros + - esbuild-register + - supports-color + - ts-node + optional: true + jest-cli@30.2.0(@types/node@22.19.1)(esbuild-register@3.6.0(esbuild@0.27.0)): dependencies: '@jest/core': 30.2.0(esbuild-register@3.6.0(esbuild@0.27.0)) @@ -40858,6 +41075,40 @@ snapshots: - supports-color optional: true + jest-config@30.2.0(@types/node@22.19.1)(esbuild-register@3.6.0(esbuild@0.19.12)): + dependencies: + '@babel/core': 7.28.5 + '@jest/get-type': 30.1.0 + '@jest/pattern': 30.0.1 + '@jest/test-sequencer': 30.2.0 + '@jest/types': 30.2.0 + babel-jest: 30.2.0(@babel/core@7.28.5) + chalk: 4.1.2 + ci-info: 4.3.1 + deepmerge: 4.3.1 + glob: 10.5.0 + graceful-fs: 4.2.11 + jest-circus: 30.2.0 + jest-docblock: 30.2.0 + jest-environment-node: 30.2.0 + jest-regex-util: 30.0.1 + jest-resolve: 30.2.0 + jest-runner: 30.2.0 + jest-util: 30.2.0 + jest-validate: 30.2.0 + micromatch: 4.0.8 + parse-json: 5.2.0 + pretty-format: 30.2.0 + slash: 3.0.0 + strip-json-comments: 3.1.1 + optionalDependencies: + '@types/node': 22.19.1 + esbuild-register: 3.6.0(esbuild@0.19.12) + transitivePeerDependencies: + - babel-plugin-macros + - supports-color + optional: true + jest-config@30.2.0(@types/node@22.19.1)(esbuild-register@3.6.0(esbuild@0.27.0)): dependencies: '@babel/core': 7.28.5 @@ -41432,6 +41683,20 @@ snapshots: - ts-node optional: true + jest@30.2.0(@types/node@22.19.1)(esbuild-register@3.6.0(esbuild@0.19.12)): + dependencies: + '@jest/core': 30.2.0(esbuild-register@3.6.0(esbuild@0.19.12)) + '@jest/types': 30.2.0 + import-local: 3.2.0 + jest-cli: 30.2.0(@types/node@22.19.1)(esbuild-register@3.6.0(esbuild@0.19.12)) + transitivePeerDependencies: + - '@types/node' + - babel-plugin-macros + - esbuild-register + - supports-color + - ts-node + optional: true + jest@30.2.0(@types/node@22.19.1)(esbuild-register@3.6.0(esbuild@0.27.0)): dependencies: '@jest/core': 30.2.0(esbuild-register@3.6.0(esbuild@0.27.0)) @@ -45775,6 +46040,16 @@ snapshots: webpack-sources: 3.3.3 optional: true + react-server-dom-webpack@19.0.0(react-dom@19.1.0(react@19.1.0))(react@19.1.0)(webpack@5.100.2(esbuild@0.19.12)): + dependencies: + acorn-loose: 8.5.2 + neo-async: 2.6.2 + react: 19.1.0 + react-dom: 19.1.0(react@19.1.0) + webpack: 5.100.2(esbuild@0.19.12) + webpack-sources: 3.3.3 + optional: true + react-server-dom-webpack@19.0.0(react-dom@19.1.0(react@19.1.0))(react@19.1.0)(webpack@5.100.2(esbuild@0.27.0)): dependencies: acorn-loose: 8.5.2 @@ -47246,6 +47521,29 @@ snapshots: ansi-escapes: 4.3.2 supports-hyperlinks: 2.3.0 + terser-webpack-plugin@5.3.14(esbuild@0.19.12)(webpack@5.100.2(esbuild@0.19.12)): + dependencies: + '@jridgewell/trace-mapping': 0.3.31 + jest-worker: 27.5.1 + schema-utils: 4.3.3 + serialize-javascript: 6.0.2 + terser: 5.44.1 + webpack: 5.100.2(esbuild@0.19.12) + optionalDependencies: + esbuild: 0.19.12 + optional: true + + terser-webpack-plugin@5.3.14(esbuild@0.19.12)(webpack@5.97.1(esbuild@0.19.12)): + dependencies: + '@jridgewell/trace-mapping': 0.3.31 + jest-worker: 27.5.1 + schema-utils: 4.3.3 + serialize-javascript: 6.0.2 + terser: 5.44.1 + webpack: 5.97.1(esbuild@0.19.12) + optionalDependencies: + esbuild: 0.19.12 + terser-webpack-plugin@5.3.14(esbuild@0.27.0)(webpack@5.100.2(esbuild@0.27.0)): dependencies: '@jridgewell/trace-mapping': 0.3.31 @@ -48703,6 +49001,39 @@ snapshots: - esbuild - uglify-js + webpack@5.100.2(esbuild@0.19.12): + dependencies: + '@types/eslint-scope': 3.7.7 + '@types/estree': 1.0.8 + '@types/json-schema': 7.0.15 + '@webassemblyjs/ast': 1.14.1 + '@webassemblyjs/wasm-edit': 1.14.1 + '@webassemblyjs/wasm-parser': 1.14.1 + acorn: 8.15.0 + acorn-import-phases: 1.0.4(acorn@8.15.0) + browserslist: 4.28.0 + chrome-trace-event: 1.0.4 + enhanced-resolve: 5.18.3 + es-module-lexer: 1.7.0 + eslint-scope: 5.1.1 + events: 3.3.0 + glob-to-regexp: 0.4.1 + graceful-fs: 4.2.11 + json-parse-even-better-errors: 2.3.1 + loader-runner: 4.3.1 + mime-types: 2.1.35 + neo-async: 2.6.2 + schema-utils: 4.3.3 + tapable: 2.3.0 + terser-webpack-plugin: 5.3.14(esbuild@0.19.12)(webpack@5.100.2(esbuild@0.19.12)) + watchpack: 2.4.4 + webpack-sources: 3.3.3 + transitivePeerDependencies: + - '@swc/core' + - esbuild + - uglify-js + optional: true + webpack@5.100.2(esbuild@0.27.0): dependencies: '@types/eslint-scope': 3.7.7 @@ -48765,6 +49096,36 @@ snapshots: - esbuild - uglify-js + webpack@5.97.1(esbuild@0.19.12): + dependencies: + '@types/eslint-scope': 3.7.7 + '@types/estree': 1.0.8 + '@webassemblyjs/ast': 1.14.1 + '@webassemblyjs/wasm-edit': 1.14.1 + '@webassemblyjs/wasm-parser': 1.14.1 + acorn: 8.15.0 + browserslist: 4.28.0 + chrome-trace-event: 1.0.4 + enhanced-resolve: 5.18.3 + es-module-lexer: 1.7.0 + eslint-scope: 5.1.1 + events: 3.3.0 + glob-to-regexp: 0.4.1 + graceful-fs: 4.2.11 + json-parse-even-better-errors: 2.3.1 + loader-runner: 4.3.1 + mime-types: 2.1.35 + neo-async: 2.6.2 + schema-utils: 3.3.0 + tapable: 2.3.0 + terser-webpack-plugin: 5.3.14(esbuild@0.19.12)(webpack@5.97.1(esbuild@0.19.12)) + watchpack: 2.4.4 + webpack-sources: 3.3.3 + transitivePeerDependencies: + - '@swc/core' + - esbuild + - uglify-js + webpack@5.97.1(esbuild@0.27.0): dependencies: '@types/eslint-scope': 3.7.7 diff --git a/services/matrix-calendar-bot/package.json b/services/matrix-calendar-bot/package.json index 9b561d3e3..014e6381e 100644 --- a/services/matrix-calendar-bot/package.json +++ b/services/matrix-calendar-bot/package.json @@ -27,6 +27,7 @@ "type-check": "tsc --noEmit" }, "dependencies": { + "@manacore/matrix-bot-common": "workspace:*", "@nestjs/common": "^10.4.15", "@nestjs/config": "^3.3.0", "@nestjs/core": "^10.4.15", diff --git a/services/matrix-calendar-bot/src/app.module.ts b/services/matrix-calendar-bot/src/app.module.ts index 50eef3f55..8e9ddeeef 100644 --- a/services/matrix-calendar-bot/src/app.module.ts +++ b/services/matrix-calendar-bot/src/app.module.ts @@ -1,9 +1,9 @@ import { Module } from '@nestjs/common'; import { ConfigModule } from '@nestjs/config'; +import { HealthController, createHealthProvider } from '@manacore/matrix-bot-common'; import configuration from './config/configuration'; import { BotModule } from './bot/bot.module'; import { CalendarModule } from './calendar/calendar.module'; -import { HealthController } from './health.controller'; @Module({ imports: [ @@ -15,5 +15,6 @@ import { HealthController } from './health.controller'; CalendarModule, ], controllers: [HealthController], + providers: [createHealthProvider('matrix-calendar-bot')], }) export class AppModule {} diff --git a/services/matrix-calendar-bot/src/health.controller.ts b/services/matrix-calendar-bot/src/health.controller.ts deleted file mode 100644 index e9e747e66..000000000 --- a/services/matrix-calendar-bot/src/health.controller.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Controller, Get } from '@nestjs/common'; - -@Controller('health') -export class HealthController { - @Get() - check() { - return { - status: 'ok', - service: 'matrix-calendar-bot', - timestamp: new Date().toISOString(), - }; - } -} diff --git a/services/matrix-chat-bot/package.json b/services/matrix-chat-bot/package.json index c39648bdc..5ec36ee7a 100644 --- a/services/matrix-chat-bot/package.json +++ b/services/matrix-chat-bot/package.json @@ -5,7 +5,9 @@ "private": true, "main": "dist/main.js", "pnpm": { - "neverBuiltDependencies": ["@matrix-org/matrix-sdk-crypto-nodejs"], + "neverBuiltDependencies": [ + "@matrix-org/matrix-sdk-crypto-nodejs" + ], "overrides": { "@matrix-org/matrix-sdk-crypto-nodejs": "npm:empty-npm-package@1.0.0" } @@ -23,6 +25,7 @@ }, "dependencies": { "@manacore/bot-services": "workspace:*", + "@manacore/matrix-bot-common": "workspace:*", "@nestjs/common": "^10.4.15", "@nestjs/config": "^3.3.0", "@nestjs/core": "^10.4.15", diff --git a/services/matrix-chat-bot/src/app.module.ts b/services/matrix-chat-bot/src/app.module.ts index 52d5de4a4..2fc3b63ba 100644 --- a/services/matrix-chat-bot/src/app.module.ts +++ b/services/matrix-chat-bot/src/app.module.ts @@ -1,7 +1,7 @@ import { Module } from '@nestjs/common'; import { ConfigModule } from '@nestjs/config'; +import { HealthController, createHealthProvider } from '@manacore/matrix-bot-common'; import { BotModule } from './bot/bot.module'; -import { HealthController } from './health.controller'; import configuration from './config/configuration'; @Module({ @@ -13,5 +13,6 @@ import configuration from './config/configuration'; BotModule, ], controllers: [HealthController], + providers: [createHealthProvider('matrix-chat-bot')], }) export class AppModule {} diff --git a/services/matrix-chat-bot/src/health.controller.ts b/services/matrix-chat-bot/src/health.controller.ts deleted file mode 100644 index 2c57d35ec..000000000 --- a/services/matrix-chat-bot/src/health.controller.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { Controller, Get } from '@nestjs/common'; - -@Controller('health') -export class HealthController { - @Get() - check() { - return { status: 'ok', service: 'matrix-chat-bot' }; - } -} diff --git a/services/matrix-clock-bot/package.json b/services/matrix-clock-bot/package.json index 75a2f66ad..67eb3b9ba 100644 --- a/services/matrix-clock-bot/package.json +++ b/services/matrix-clock-bot/package.json @@ -25,6 +25,7 @@ }, "dependencies": { "@manacore/bot-services": "workspace:*", + "@manacore/matrix-bot-common": "workspace:*", "@nestjs/common": "^10.4.17", "@nestjs/config": "^3.3.0", "@nestjs/core": "^10.4.17", diff --git a/services/matrix-clock-bot/src/app.module.ts b/services/matrix-clock-bot/src/app.module.ts index 52d5de4a4..54533350e 100644 --- a/services/matrix-clock-bot/src/app.module.ts +++ b/services/matrix-clock-bot/src/app.module.ts @@ -1,7 +1,7 @@ import { Module } from '@nestjs/common'; import { ConfigModule } from '@nestjs/config'; +import { HealthController, createHealthProvider } from '@manacore/matrix-bot-common'; import { BotModule } from './bot/bot.module'; -import { HealthController } from './health.controller'; import configuration from './config/configuration'; @Module({ @@ -13,5 +13,6 @@ import configuration from './config/configuration'; BotModule, ], controllers: [HealthController], + providers: [createHealthProvider('matrix-clock-bot')], }) export class AppModule {} diff --git a/services/matrix-clock-bot/src/health.controller.ts b/services/matrix-clock-bot/src/health.controller.ts deleted file mode 100644 index d1c4783c6..000000000 --- a/services/matrix-clock-bot/src/health.controller.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { Controller, Get } from '@nestjs/common'; - -@Controller('health') -export class HealthController { - @Get() - check() { - return { status: 'ok', service: 'matrix-clock-bot' }; - } -} diff --git a/services/matrix-contacts-bot/package.json b/services/matrix-contacts-bot/package.json index 34d018d45..50a716afd 100644 --- a/services/matrix-contacts-bot/package.json +++ b/services/matrix-contacts-bot/package.json @@ -5,7 +5,9 @@ "private": true, "main": "dist/main.js", "pnpm": { - "neverBuiltDependencies": ["@matrix-org/matrix-sdk-crypto-nodejs"], + "neverBuiltDependencies": [ + "@matrix-org/matrix-sdk-crypto-nodejs" + ], "overrides": { "@matrix-org/matrix-sdk-crypto-nodejs": "npm:empty-npm-package@1.0.0" } @@ -23,6 +25,7 @@ }, "dependencies": { "@manacore/bot-services": "workspace:*", + "@manacore/matrix-bot-common": "workspace:*", "@nestjs/common": "^10.4.15", "@nestjs/config": "^3.3.0", "@nestjs/core": "^10.4.15", diff --git a/services/matrix-contacts-bot/src/app.module.ts b/services/matrix-contacts-bot/src/app.module.ts index 09bbe3a8c..9fe527786 100644 --- a/services/matrix-contacts-bot/src/app.module.ts +++ b/services/matrix-contacts-bot/src/app.module.ts @@ -1,8 +1,8 @@ import { Module } from '@nestjs/common'; import { ConfigModule } from '@nestjs/config'; +import { HealthController, createHealthProvider } from '@manacore/matrix-bot-common'; import configuration from './config/configuration'; import { BotModule } from './bot/bot.module'; -import { HealthController } from './health.controller'; @Module({ imports: [ @@ -13,5 +13,6 @@ import { HealthController } from './health.controller'; BotModule, ], controllers: [HealthController], + providers: [createHealthProvider('matrix-contacts-bot')], }) export class AppModule {} diff --git a/services/matrix-contacts-bot/src/health.controller.ts b/services/matrix-contacts-bot/src/health.controller.ts deleted file mode 100644 index 35b68cfd4..000000000 --- a/services/matrix-contacts-bot/src/health.controller.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Controller, Get } from '@nestjs/common'; - -@Controller('health') -export class HealthController { - @Get() - check() { - return { - status: 'ok', - service: 'matrix-contacts-bot', - timestamp: new Date().toISOString(), - }; - } -} diff --git a/services/matrix-mana-bot/package.json b/services/matrix-mana-bot/package.json index 738e91411..73ce22d84 100644 --- a/services/matrix-mana-bot/package.json +++ b/services/matrix-mana-bot/package.json @@ -14,6 +14,7 @@ }, "dependencies": { "@manacore/bot-services": "workspace:*", + "@manacore/matrix-bot-common": "workspace:*", "@nestjs/common": "^10.0.0", "@nestjs/config": "^3.0.0", "@nestjs/core": "^10.0.0", @@ -28,7 +29,10 @@ "typescript": "^5.0.0" }, "pnpm": { - "neverBuiltDependencies": ["cpu-features", "ssh2"], + "neverBuiltDependencies": [ + "cpu-features", + "ssh2" + ], "overrides": { "cpu-features": "npm:empty-npm-package@1.0.0", "ssh2": "npm:empty-npm-package@1.0.0" diff --git a/services/matrix-mana-bot/src/app.module.ts b/services/matrix-mana-bot/src/app.module.ts index a80393ad8..eb60cad0d 100644 --- a/services/matrix-mana-bot/src/app.module.ts +++ b/services/matrix-mana-bot/src/app.module.ts @@ -1,10 +1,10 @@ import { Module } from '@nestjs/common'; import { ConfigModule, ConfigService } from '@nestjs/config'; +import { HealthController, createHealthProvider } from '@manacore/matrix-bot-common'; import configuration from './config/configuration'; import { BotModule } from './bot/bot.module'; import { HandlersModule } from './handlers/handlers.module'; import { OrchestrationModule } from './orchestration/orchestration.module'; -import { HealthController } from './health/health.controller'; // Import shared services from bot-services package import { TodoModule, CalendarModule, AiModule, ClockModule } from '@manacore/bot-services'; @@ -57,5 +57,6 @@ import { TodoModule, CalendarModule, AiModule, ClockModule } from '@manacore/bot OrchestrationModule, ], controllers: [HealthController], + providers: [createHealthProvider('matrix-mana-bot')], }) export class AppModule {} diff --git a/services/matrix-mana-bot/src/health/health.controller.ts b/services/matrix-mana-bot/src/health/health.controller.ts deleted file mode 100644 index 132c7ef60..000000000 --- a/services/matrix-mana-bot/src/health/health.controller.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Controller, Get } from '@nestjs/common'; - -@Controller('health') -export class HealthController { - @Get() - check() { - return { - status: 'ok', - service: 'matrix-mana-bot', - timestamp: new Date().toISOString(), - }; - } -} diff --git a/services/matrix-manadeck-bot/package.json b/services/matrix-manadeck-bot/package.json index 71e3126f1..e5a027418 100644 --- a/services/matrix-manadeck-bot/package.json +++ b/services/matrix-manadeck-bot/package.json @@ -5,7 +5,9 @@ "private": true, "main": "dist/main.js", "pnpm": { - "neverBuiltDependencies": ["@matrix-org/matrix-sdk-crypto-nodejs"], + "neverBuiltDependencies": [ + "@matrix-org/matrix-sdk-crypto-nodejs" + ], "overrides": { "@matrix-org/matrix-sdk-crypto-nodejs": "npm:empty-npm-package@1.0.0" } @@ -23,6 +25,7 @@ }, "dependencies": { "@manacore/bot-services": "workspace:*", + "@manacore/matrix-bot-common": "workspace:*", "@nestjs/common": "^10.4.15", "@nestjs/config": "^3.3.0", "@nestjs/core": "^10.4.15", diff --git a/services/matrix-manadeck-bot/src/app.module.ts b/services/matrix-manadeck-bot/src/app.module.ts index 897a4ebe2..fa2d7e728 100644 --- a/services/matrix-manadeck-bot/src/app.module.ts +++ b/services/matrix-manadeck-bot/src/app.module.ts @@ -1,6 +1,6 @@ import { Module } from '@nestjs/common'; import { ConfigModule } from '@nestjs/config'; -import { HealthController } from './health.controller'; +import { HealthController, createHealthProvider } from '@manacore/matrix-bot-common'; import { BotModule } from './bot/bot.module'; import { ManadeckModule } from './manadeck/manadeck.module'; import configuration from './config/configuration'; @@ -15,5 +15,6 @@ import configuration from './config/configuration'; ManadeckModule, ], controllers: [HealthController], + providers: [createHealthProvider('matrix-manadeck-bot')], }) export class AppModule {} diff --git a/services/matrix-manadeck-bot/src/health.controller.ts b/services/matrix-manadeck-bot/src/health.controller.ts deleted file mode 100644 index bbb5af072..000000000 --- a/services/matrix-manadeck-bot/src/health.controller.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { Controller, Get } from '@nestjs/common'; - -@Controller('health') -export class HealthController { - @Get() - check() { - return { status: 'ok', service: 'matrix-manadeck-bot' }; - } -} diff --git a/services/matrix-nutriphi-bot/package.json b/services/matrix-nutriphi-bot/package.json index 08ad583ee..41af9d972 100644 --- a/services/matrix-nutriphi-bot/package.json +++ b/services/matrix-nutriphi-bot/package.json @@ -28,6 +28,7 @@ }, "dependencies": { "@manacore/bot-services": "workspace:*", + "@manacore/matrix-bot-common": "workspace:*", "@nestjs/common": "^10.4.15", "@nestjs/config": "^3.3.0", "@nestjs/core": "^10.4.15", diff --git a/services/matrix-nutriphi-bot/src/app.module.ts b/services/matrix-nutriphi-bot/src/app.module.ts index 52d5de4a4..7efab0a62 100644 --- a/services/matrix-nutriphi-bot/src/app.module.ts +++ b/services/matrix-nutriphi-bot/src/app.module.ts @@ -1,7 +1,7 @@ import { Module } from '@nestjs/common'; import { ConfigModule } from '@nestjs/config'; +import { HealthController, createHealthProvider } from '@manacore/matrix-bot-common'; import { BotModule } from './bot/bot.module'; -import { HealthController } from './health.controller'; import configuration from './config/configuration'; @Module({ @@ -13,5 +13,6 @@ import configuration from './config/configuration'; BotModule, ], controllers: [HealthController], + providers: [createHealthProvider('matrix-nutriphi-bot')], }) export class AppModule {} diff --git a/services/matrix-nutriphi-bot/src/health.controller.ts b/services/matrix-nutriphi-bot/src/health.controller.ts deleted file mode 100644 index d1437171d..000000000 --- a/services/matrix-nutriphi-bot/src/health.controller.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Controller, Get } from '@nestjs/common'; - -@Controller('health') -export class HealthController { - @Get() - check() { - return { - status: 'ok', - service: 'matrix-nutriphi-bot', - timestamp: new Date().toISOString(), - }; - } -} diff --git a/services/matrix-ollama-bot/package.json b/services/matrix-ollama-bot/package.json index 1cdd10cd2..4a81957fb 100644 --- a/services/matrix-ollama-bot/package.json +++ b/services/matrix-ollama-bot/package.json @@ -27,6 +27,7 @@ "type-check": "tsc --noEmit" }, "dependencies": { + "@manacore/matrix-bot-common": "workspace:*", "@nestjs/common": "^10.4.15", "@nestjs/config": "^3.3.0", "@nestjs/core": "^10.4.15", diff --git a/services/matrix-ollama-bot/src/app.module.ts b/services/matrix-ollama-bot/src/app.module.ts index 52d5de4a4..6d09cf311 100644 --- a/services/matrix-ollama-bot/src/app.module.ts +++ b/services/matrix-ollama-bot/src/app.module.ts @@ -1,7 +1,7 @@ import { Module } from '@nestjs/common'; import { ConfigModule } from '@nestjs/config'; +import { HealthController, createHealthProvider } from '@manacore/matrix-bot-common'; import { BotModule } from './bot/bot.module'; -import { HealthController } from './health.controller'; import configuration from './config/configuration'; @Module({ @@ -13,5 +13,6 @@ import configuration from './config/configuration'; BotModule, ], controllers: [HealthController], + providers: [createHealthProvider('matrix-ollama-bot')], }) export class AppModule {} diff --git a/services/matrix-ollama-bot/src/health.controller.ts b/services/matrix-ollama-bot/src/health.controller.ts deleted file mode 100644 index 85ecda0d3..000000000 --- a/services/matrix-ollama-bot/src/health.controller.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Controller, Get } from '@nestjs/common'; - -@Controller('health') -export class HealthController { - @Get() - check() { - return { - status: 'ok', - service: 'matrix-ollama-bot', - timestamp: new Date().toISOString(), - }; - } -} diff --git a/services/matrix-picture-bot/package.json b/services/matrix-picture-bot/package.json index 15012907d..a9d0e307c 100644 --- a/services/matrix-picture-bot/package.json +++ b/services/matrix-picture-bot/package.json @@ -25,6 +25,7 @@ }, "dependencies": { "@manacore/bot-services": "workspace:*", + "@manacore/matrix-bot-common": "workspace:*", "@nestjs/common": "^10.4.15", "@nestjs/config": "^3.3.0", "@nestjs/core": "^10.4.15", diff --git a/services/matrix-picture-bot/src/app.module.ts b/services/matrix-picture-bot/src/app.module.ts index 09bbe3a8c..c3515cae3 100644 --- a/services/matrix-picture-bot/src/app.module.ts +++ b/services/matrix-picture-bot/src/app.module.ts @@ -1,8 +1,8 @@ import { Module } from '@nestjs/common'; import { ConfigModule } from '@nestjs/config'; +import { HealthController, createHealthProvider } from '@manacore/matrix-bot-common'; import configuration from './config/configuration'; import { BotModule } from './bot/bot.module'; -import { HealthController } from './health.controller'; @Module({ imports: [ @@ -13,5 +13,6 @@ import { HealthController } from './health.controller'; BotModule, ], controllers: [HealthController], + providers: [createHealthProvider('matrix-picture-bot')], }) export class AppModule {} diff --git a/services/matrix-picture-bot/src/health.controller.ts b/services/matrix-picture-bot/src/health.controller.ts deleted file mode 100644 index 42e55a0ba..000000000 --- a/services/matrix-picture-bot/src/health.controller.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Controller, Get } from '@nestjs/common'; - -@Controller('health') -export class HealthController { - @Get() - check() { - return { - status: 'ok', - service: 'matrix-picture-bot', - timestamp: new Date().toISOString(), - }; - } -} diff --git a/services/matrix-planta-bot/package.json b/services/matrix-planta-bot/package.json index f2a530aba..f0d73904b 100644 --- a/services/matrix-planta-bot/package.json +++ b/services/matrix-planta-bot/package.json @@ -5,7 +5,9 @@ "private": true, "main": "dist/main.js", "pnpm": { - "neverBuiltDependencies": ["@matrix-org/matrix-sdk-crypto-nodejs"], + "neverBuiltDependencies": [ + "@matrix-org/matrix-sdk-crypto-nodejs" + ], "overrides": { "@matrix-org/matrix-sdk-crypto-nodejs": "npm:empty-npm-package@1.0.0" } @@ -23,6 +25,7 @@ }, "dependencies": { "@manacore/bot-services": "workspace:*", + "@manacore/matrix-bot-common": "workspace:*", "@nestjs/common": "^10.4.15", "@nestjs/config": "^3.3.0", "@nestjs/core": "^10.4.15", diff --git a/services/matrix-planta-bot/src/app.module.ts b/services/matrix-planta-bot/src/app.module.ts index 9267ec11c..3ab2c287d 100644 --- a/services/matrix-planta-bot/src/app.module.ts +++ b/services/matrix-planta-bot/src/app.module.ts @@ -1,6 +1,6 @@ import { Module } from '@nestjs/common'; import { ConfigModule } from '@nestjs/config'; -import { HealthController } from './health.controller'; +import { HealthController, createHealthProvider } from '@manacore/matrix-bot-common'; import { BotModule } from './bot/bot.module'; import { PlantaModule } from './planta/planta.module'; import configuration from './config/configuration'; @@ -15,5 +15,6 @@ import configuration from './config/configuration'; PlantaModule, ], controllers: [HealthController], + providers: [createHealthProvider('matrix-planta-bot')], }) export class AppModule {} diff --git a/services/matrix-planta-bot/src/health.controller.ts b/services/matrix-planta-bot/src/health.controller.ts deleted file mode 100644 index 3e5e04376..000000000 --- a/services/matrix-planta-bot/src/health.controller.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { Controller, Get } from '@nestjs/common'; - -@Controller('health') -export class HealthController { - @Get() - check() { - return { status: 'ok', service: 'matrix-planta-bot' }; - } -} diff --git a/services/matrix-presi-bot/package.json b/services/matrix-presi-bot/package.json index 44c6a434f..63b5dee51 100644 --- a/services/matrix-presi-bot/package.json +++ b/services/matrix-presi-bot/package.json @@ -5,7 +5,9 @@ "private": true, "main": "dist/main.js", "pnpm": { - "neverBuiltDependencies": ["@matrix-org/matrix-sdk-crypto-nodejs"], + "neverBuiltDependencies": [ + "@matrix-org/matrix-sdk-crypto-nodejs" + ], "overrides": { "@matrix-org/matrix-sdk-crypto-nodejs": "npm:empty-npm-package@1.0.0" } @@ -23,6 +25,7 @@ }, "dependencies": { "@manacore/bot-services": "workspace:*", + "@manacore/matrix-bot-common": "workspace:*", "@nestjs/common": "^10.4.15", "@nestjs/config": "^3.3.0", "@nestjs/core": "^10.4.15", diff --git a/services/matrix-presi-bot/src/app.module.ts b/services/matrix-presi-bot/src/app.module.ts index 3bcdfa5fa..bad0a2535 100644 --- a/services/matrix-presi-bot/src/app.module.ts +++ b/services/matrix-presi-bot/src/app.module.ts @@ -1,6 +1,6 @@ import { Module } from '@nestjs/common'; import { ConfigModule } from '@nestjs/config'; -import { HealthController } from './health.controller'; +import { HealthController, createHealthProvider } from '@manacore/matrix-bot-common'; import { BotModule } from './bot/bot.module'; import { PresiModule } from './presi/presi.module'; import configuration from './config/configuration'; @@ -15,5 +15,6 @@ import configuration from './config/configuration'; PresiModule, ], controllers: [HealthController], + providers: [createHealthProvider('matrix-presi-bot')], }) export class AppModule {} diff --git a/services/matrix-presi-bot/src/health.controller.ts b/services/matrix-presi-bot/src/health.controller.ts deleted file mode 100644 index 35f3c8e73..000000000 --- a/services/matrix-presi-bot/src/health.controller.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { Controller, Get } from '@nestjs/common'; - -@Controller('health') -export class HealthController { - @Get() - check() { - return { status: 'ok', service: 'matrix-presi-bot' }; - } -} diff --git a/services/matrix-project-doc-bot/package.json b/services/matrix-project-doc-bot/package.json index 3a965047d..85516fb24 100644 --- a/services/matrix-project-doc-bot/package.json +++ b/services/matrix-project-doc-bot/package.json @@ -28,6 +28,7 @@ }, "dependencies": { "@manacore/bot-services": "workspace:*", + "@manacore/matrix-bot-common": "workspace:*", "@nestjs/common": "^10.4.15", "@nestjs/config": "^3.3.0", "@nestjs/core": "^10.4.15", diff --git a/services/matrix-project-doc-bot/src/app.module.ts b/services/matrix-project-doc-bot/src/app.module.ts index 9eabccba9..dd25e43aa 100644 --- a/services/matrix-project-doc-bot/src/app.module.ts +++ b/services/matrix-project-doc-bot/src/app.module.ts @@ -1,8 +1,8 @@ import { Module } from '@nestjs/common'; import { ConfigModule } from '@nestjs/config'; +import { HealthController, createHealthProvider } from '@manacore/matrix-bot-common'; import { DatabaseModule } from './database/database.module'; import { BotModule } from './bot/bot.module'; -import { HealthController } from './health.controller'; import configuration from './config/configuration'; @Module({ @@ -15,5 +15,6 @@ import configuration from './config/configuration'; BotModule, ], controllers: [HealthController], + providers: [createHealthProvider('matrix-project-doc-bot')], }) export class AppModule {} diff --git a/services/matrix-project-doc-bot/src/health.controller.ts b/services/matrix-project-doc-bot/src/health.controller.ts deleted file mode 100644 index 869b95e8b..000000000 --- a/services/matrix-project-doc-bot/src/health.controller.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Controller, Get } from '@nestjs/common'; - -@Controller('health') -export class HealthController { - @Get() - check() { - return { - status: 'ok', - service: 'matrix-project-doc-bot', - timestamp: new Date().toISOString(), - }; - } -} diff --git a/services/matrix-questions-bot/package.json b/services/matrix-questions-bot/package.json index e3ff432fb..c775af8c5 100644 --- a/services/matrix-questions-bot/package.json +++ b/services/matrix-questions-bot/package.json @@ -5,7 +5,9 @@ "private": true, "main": "dist/main.js", "pnpm": { - "neverBuiltDependencies": ["@matrix-org/matrix-sdk-crypto-nodejs"], + "neverBuiltDependencies": [ + "@matrix-org/matrix-sdk-crypto-nodejs" + ], "overrides": { "@matrix-org/matrix-sdk-crypto-nodejs": "npm:empty-npm-package@1.0.0" } @@ -23,6 +25,7 @@ }, "dependencies": { "@manacore/bot-services": "workspace:*", + "@manacore/matrix-bot-common": "workspace:*", "@nestjs/common": "^10.4.15", "@nestjs/config": "^3.3.0", "@nestjs/core": "^10.4.15", diff --git a/services/matrix-questions-bot/src/app.module.ts b/services/matrix-questions-bot/src/app.module.ts index 11facf21d..dd9899431 100644 --- a/services/matrix-questions-bot/src/app.module.ts +++ b/services/matrix-questions-bot/src/app.module.ts @@ -1,6 +1,6 @@ import { Module } from '@nestjs/common'; import { ConfigModule } from '@nestjs/config'; -import { HealthController } from './health.controller'; +import { HealthController, createHealthProvider } from '@manacore/matrix-bot-common'; import { BotModule } from './bot/bot.module'; import { QuestionsModule } from './questions/questions.module'; import configuration from './config/configuration'; @@ -15,5 +15,6 @@ import configuration from './config/configuration'; QuestionsModule, ], controllers: [HealthController], + providers: [createHealthProvider('matrix-questions-bot')], }) export class AppModule {} diff --git a/services/matrix-questions-bot/src/health.controller.ts b/services/matrix-questions-bot/src/health.controller.ts deleted file mode 100644 index 6feedb57c..000000000 --- a/services/matrix-questions-bot/src/health.controller.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { Controller, Get } from '@nestjs/common'; - -@Controller('health') -export class HealthController { - @Get() - check() { - return { status: 'ok', service: 'matrix-questions-bot' }; - } -} diff --git a/services/matrix-skilltree-bot/package.json b/services/matrix-skilltree-bot/package.json index 5b5b96014..4a44bda13 100644 --- a/services/matrix-skilltree-bot/package.json +++ b/services/matrix-skilltree-bot/package.json @@ -5,7 +5,9 @@ "private": true, "main": "dist/main.js", "pnpm": { - "neverBuiltDependencies": ["@matrix-org/matrix-sdk-crypto-nodejs"], + "neverBuiltDependencies": [ + "@matrix-org/matrix-sdk-crypto-nodejs" + ], "overrides": { "@matrix-org/matrix-sdk-crypto-nodejs": "npm:empty-npm-package@1.0.0" } @@ -23,6 +25,7 @@ }, "dependencies": { "@manacore/bot-services": "workspace:*", + "@manacore/matrix-bot-common": "workspace:*", "@nestjs/common": "^10.4.15", "@nestjs/config": "^3.3.0", "@nestjs/core": "^10.4.15", diff --git a/services/matrix-skilltree-bot/src/app.module.ts b/services/matrix-skilltree-bot/src/app.module.ts index e37fea52a..5b979fef6 100644 --- a/services/matrix-skilltree-bot/src/app.module.ts +++ b/services/matrix-skilltree-bot/src/app.module.ts @@ -1,6 +1,6 @@ import { Module } from '@nestjs/common'; import { ConfigModule } from '@nestjs/config'; -import { HealthController } from './health.controller'; +import { HealthController, createHealthProvider } from '@manacore/matrix-bot-common'; import { BotModule } from './bot/bot.module'; import { SkilltreeModule } from './skilltree/skilltree.module'; import configuration from './config/configuration'; @@ -15,5 +15,6 @@ import configuration from './config/configuration'; SkilltreeModule, ], controllers: [HealthController], + providers: [createHealthProvider('matrix-skilltree-bot')], }) export class AppModule {} diff --git a/services/matrix-skilltree-bot/src/health.controller.ts b/services/matrix-skilltree-bot/src/health.controller.ts deleted file mode 100644 index 6251c68f4..000000000 --- a/services/matrix-skilltree-bot/src/health.controller.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { Controller, Get } from '@nestjs/common'; - -@Controller('health') -export class HealthController { - @Get() - check() { - return { status: 'ok', service: 'matrix-skilltree-bot' }; - } -} diff --git a/services/matrix-stats-bot/package.json b/services/matrix-stats-bot/package.json index be0a9fa0d..2df38c463 100644 --- a/services/matrix-stats-bot/package.json +++ b/services/matrix-stats-bot/package.json @@ -24,6 +24,7 @@ "type-check": "tsc --noEmit" }, "dependencies": { + "@manacore/matrix-bot-common": "workspace:*", "@nestjs/common": "^10.4.15", "@nestjs/config": "^3.3.0", "@nestjs/core": "^10.4.15", diff --git a/services/matrix-stats-bot/src/app.module.ts b/services/matrix-stats-bot/src/app.module.ts index 825025743..b1fd0ee45 100644 --- a/services/matrix-stats-bot/src/app.module.ts +++ b/services/matrix-stats-bot/src/app.module.ts @@ -2,7 +2,7 @@ import { Module } from '@nestjs/common'; import { ConfigModule } from '@nestjs/config'; import { BotModule } from './bot/bot.module'; import { SchedulerModule } from './scheduler/scheduler.module'; -import { HealthController } from './health.controller'; +import { HealthController, createHealthProvider } from '@manacore/matrix-bot-common'; import configuration from './config/configuration'; @Module({ @@ -15,5 +15,6 @@ import configuration from './config/configuration'; SchedulerModule, ], controllers: [HealthController], + providers: [createHealthProvider('matrix-stats-bot')], }) export class AppModule {} diff --git a/services/matrix-stats-bot/src/bot/matrix.service.ts b/services/matrix-stats-bot/src/bot/matrix.service.ts index 578866a6f..fc09fae10 100644 --- a/services/matrix-stats-bot/src/bot/matrix.service.ts +++ b/services/matrix-stats-bot/src/bot/matrix.service.ts @@ -1,75 +1,41 @@ -import { Injectable, Logger, OnModuleInit, OnModuleDestroy } from '@nestjs/common'; +import { Injectable } from '@nestjs/common'; import { ConfigService } from '@nestjs/config'; -import { - MatrixClient, - SimpleFsStorageProvider, - AutojoinRoomsMixin, - RichConsoleLogger, - LogService, - LogLevel, -} from 'matrix-bot-sdk'; +import { BaseMatrixService, MatrixBotConfig, MatrixRoomEvent } from '@manacore/matrix-bot-common'; import { AnalyticsService } from '../analytics/analytics.service'; import { UsersService } from '../users/users.service'; @Injectable() -export class MatrixService implements OnModuleInit, OnModuleDestroy { - private readonly logger = new Logger(MatrixService.name); - private client!: MatrixClient; - private botUserId: string = ''; +export class MatrixService extends BaseMatrixService { private reportRoomId: string = ''; constructor( - private configService: ConfigService, + configService: ConfigService, private analyticsService: AnalyticsService, private usersService: UsersService ) { + super(configService); this.reportRoomId = this.configService.get('matrix.reportRoomId') || ''; } - async onModuleInit() { - const homeserverUrl = this.configService.get('matrix.homeserverUrl'); - const accessToken = this.configService.get('matrix.accessToken'); - const storagePath = this.configService.get('matrix.storagePath'); - - if (!accessToken) { - this.logger.error('MATRIX_ACCESS_TOKEN is required'); - return; - } - - LogService.setLogger(new RichConsoleLogger()); - LogService.setLevel(LogLevel.INFO); - - const storage = new SimpleFsStorageProvider(storagePath || './data/bot-storage.json'); - this.client = new MatrixClient(homeserverUrl!, accessToken, storage); - - AutojoinRoomsMixin.setupOnClient(this.client); - - this.botUserId = await this.client.getUserId(); - this.logger.log(`Bot user ID: ${this.botUserId}`); - - this.client.on('room.message', this.handleRoomMessage.bind(this)); - - await this.client.start(); - this.logger.log('Matrix Stats Bot started successfully'); + protected getConfig(): MatrixBotConfig { + return { + homeserverUrl: this.configService.get('matrix.homeserverUrl') || '', + accessToken: this.configService.get('matrix.accessToken') || '', + storagePath: + this.configService.get('matrix.storagePath') || './data/bot-storage.json', + allowedRooms: [], // No room restrictions + }; } - async onModuleDestroy() { - if (this.client) { - await this.client.stop(); - this.logger.log('Matrix Stats Bot stopped'); - } - } + protected async handleTextMessage( + roomId: string, + _event: MatrixRoomEvent, + message: string, + _sender: string + ): Promise { + if (!message.startsWith('!')) return; - private async handleRoomMessage(roomId: string, event: any) { - if (event.sender === this.botUserId) return; - - const content = event.content as { msgtype?: string; body?: string }; - if (content.msgtype !== 'm.text') return; - - const body = content.body; - if (!body || !body.startsWith('!')) return; - - const [command] = body.slice(1).split(' '); + const [command] = message.slice(1).split(' '); await this.handleCommand(roomId, command.toLowerCase()); } @@ -173,23 +139,4 @@ Daten von Umami Analytics (self-hosted).`; await this.sendMessage(this.reportRoomId, report); } - - private async sendMessage(roomId: string, message: string) { - const htmlBody = this.markdownToHtml(message); - - await this.client.sendMessage(roomId, { - msgtype: 'm.text', - body: message, - format: 'org.matrix.custom.html', - formatted_body: htmlBody, - }); - } - - private markdownToHtml(markdown: string): string { - return markdown - .replace(/\*\*([^*]+)\*\*/g, '$1') - .replace(/\*([^*]+)\*/g, '$1') - .replace(/`([^`]+)`/g, '$1') - .replace(/\n/g, '
'); - } } diff --git a/services/matrix-stats-bot/src/health.controller.ts b/services/matrix-stats-bot/src/health.controller.ts deleted file mode 100644 index 44275b13b..000000000 --- a/services/matrix-stats-bot/src/health.controller.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Controller, Get } from '@nestjs/common'; - -@Controller('health') -export class HealthController { - @Get() - check() { - return { - status: 'ok', - service: 'matrix-stats-bot', - timestamp: new Date().toISOString(), - }; - } -} diff --git a/services/matrix-storage-bot/package.json b/services/matrix-storage-bot/package.json index 705e43503..29475941d 100644 --- a/services/matrix-storage-bot/package.json +++ b/services/matrix-storage-bot/package.json @@ -5,7 +5,9 @@ "private": true, "main": "dist/main.js", "pnpm": { - "neverBuiltDependencies": ["@matrix-org/matrix-sdk-crypto-nodejs"], + "neverBuiltDependencies": [ + "@matrix-org/matrix-sdk-crypto-nodejs" + ], "overrides": { "@matrix-org/matrix-sdk-crypto-nodejs": "npm:empty-npm-package@1.0.0" } @@ -23,6 +25,7 @@ }, "dependencies": { "@manacore/bot-services": "workspace:*", + "@manacore/matrix-bot-common": "workspace:*", "@nestjs/common": "^10.4.15", "@nestjs/config": "^3.3.0", "@nestjs/core": "^10.4.15", diff --git a/services/matrix-storage-bot/src/app.module.ts b/services/matrix-storage-bot/src/app.module.ts index 7fd59e6d0..00ee26893 100644 --- a/services/matrix-storage-bot/src/app.module.ts +++ b/services/matrix-storage-bot/src/app.module.ts @@ -1,6 +1,6 @@ import { Module } from '@nestjs/common'; import { ConfigModule } from '@nestjs/config'; -import { HealthController } from './health.controller'; +import { HealthController, createHealthProvider } from '@manacore/matrix-bot-common'; import { BotModule } from './bot/bot.module'; import { StorageModule } from './storage/storage.module'; import configuration from './config/configuration'; @@ -15,5 +15,6 @@ import configuration from './config/configuration'; StorageModule, ], controllers: [HealthController], + providers: [createHealthProvider('matrix-storage-bot')], }) export class AppModule {} diff --git a/services/matrix-storage-bot/src/health.controller.ts b/services/matrix-storage-bot/src/health.controller.ts deleted file mode 100644 index e6669d7ab..000000000 --- a/services/matrix-storage-bot/src/health.controller.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { Controller, Get } from '@nestjs/common'; - -@Controller('health') -export class HealthController { - @Get() - check() { - return { status: 'ok', service: 'matrix-storage-bot' }; - } -} diff --git a/services/matrix-todo-bot/package.json b/services/matrix-todo-bot/package.json index c7c18663c..2b65f0a5c 100644 --- a/services/matrix-todo-bot/package.json +++ b/services/matrix-todo-bot/package.json @@ -28,6 +28,7 @@ }, "dependencies": { "@manacore/bot-services": "workspace:*", + "@manacore/matrix-bot-common": "workspace:*", "@nestjs/common": "^10.4.15", "@nestjs/config": "^3.3.0", "@nestjs/core": "^10.4.15", diff --git a/services/matrix-todo-bot/src/app.module.ts b/services/matrix-todo-bot/src/app.module.ts index 4c838f17b..49dee3f2f 100644 --- a/services/matrix-todo-bot/src/app.module.ts +++ b/services/matrix-todo-bot/src/app.module.ts @@ -1,9 +1,9 @@ import { Module } from '@nestjs/common'; import { ConfigModule } from '@nestjs/config'; +import { HealthController, createHealthProvider } from '@manacore/matrix-bot-common'; import configuration from './config/configuration'; import { BotModule } from './bot/bot.module'; import { TodoModule } from './todo/todo.module'; -import { HealthController } from './health.controller'; @Module({ imports: [ @@ -15,5 +15,6 @@ import { HealthController } from './health.controller'; TodoModule, ], controllers: [HealthController], + providers: [createHealthProvider('matrix-todo-bot')], }) export class AppModule {} diff --git a/services/matrix-todo-bot/src/health.controller.ts b/services/matrix-todo-bot/src/health.controller.ts deleted file mode 100644 index 4787570e7..000000000 --- a/services/matrix-todo-bot/src/health.controller.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Controller, Get } from '@nestjs/common'; - -@Controller('health') -export class HealthController { - @Get() - check() { - return { - status: 'ok', - service: 'matrix-todo-bot', - timestamp: new Date().toISOString(), - }; - } -} diff --git a/services/matrix-tts-bot/package.json b/services/matrix-tts-bot/package.json index 781c0a0ea..8ef615c78 100644 --- a/services/matrix-tts-bot/package.json +++ b/services/matrix-tts-bot/package.json @@ -24,6 +24,7 @@ "type-check": "tsc --noEmit" }, "dependencies": { + "@manacore/matrix-bot-common": "workspace:*", "@nestjs/common": "^10.4.17", "@nestjs/config": "^3.3.0", "@nestjs/core": "^10.4.17", diff --git a/services/matrix-tts-bot/src/app.module.ts b/services/matrix-tts-bot/src/app.module.ts index e18c69824..6caad7205 100644 --- a/services/matrix-tts-bot/src/app.module.ts +++ b/services/matrix-tts-bot/src/app.module.ts @@ -1,6 +1,6 @@ import { Module } from '@nestjs/common'; import { ConfigModule } from '@nestjs/config'; -import { HealthController } from './health.controller'; +import { HealthController, createHealthProvider } from '@manacore/matrix-bot-common'; import { BotModule } from './bot/bot.module'; import { TtsModule } from './tts/tts.module'; import configuration from './config/configuration'; @@ -15,5 +15,6 @@ import configuration from './config/configuration'; BotModule, ], controllers: [HealthController], + providers: [createHealthProvider('matrix-tts-bot')], }) export class AppModule {} diff --git a/services/matrix-tts-bot/src/health.controller.ts b/services/matrix-tts-bot/src/health.controller.ts deleted file mode 100644 index 35f5be3ae..000000000 --- a/services/matrix-tts-bot/src/health.controller.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Controller, Get } from '@nestjs/common'; - -@Controller() -export class HealthController { - @Get('health') - health() { - return { - status: 'ok', - service: 'matrix-tts-bot', - timestamp: new Date().toISOString(), - }; - } -} diff --git a/services/matrix-zitare-bot/package.json b/services/matrix-zitare-bot/package.json index 381b515d1..c1f7cf23b 100644 --- a/services/matrix-zitare-bot/package.json +++ b/services/matrix-zitare-bot/package.json @@ -24,6 +24,7 @@ }, "dependencies": { "@manacore/bot-services": "workspace:*", + "@manacore/matrix-bot-common": "workspace:*", "@nestjs/common": "^10.4.15", "@nestjs/config": "^3.3.0", "@nestjs/core": "^10.4.15", diff --git a/services/matrix-zitare-bot/src/app.module.ts b/services/matrix-zitare-bot/src/app.module.ts index 09bbe3a8c..77e50ae91 100644 --- a/services/matrix-zitare-bot/src/app.module.ts +++ b/services/matrix-zitare-bot/src/app.module.ts @@ -1,8 +1,8 @@ import { Module } from '@nestjs/common'; import { ConfigModule } from '@nestjs/config'; +import { HealthController, createHealthProvider } from '@manacore/matrix-bot-common'; import configuration from './config/configuration'; import { BotModule } from './bot/bot.module'; -import { HealthController } from './health.controller'; @Module({ imports: [ @@ -13,5 +13,6 @@ import { HealthController } from './health.controller'; BotModule, ], controllers: [HealthController], + providers: [createHealthProvider('matrix-zitare-bot')], }) export class AppModule {} diff --git a/services/matrix-zitare-bot/src/health.controller.ts b/services/matrix-zitare-bot/src/health.controller.ts deleted file mode 100644 index a513f0fd1..000000000 --- a/services/matrix-zitare-bot/src/health.controller.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Controller, Get } from '@nestjs/common'; - -@Controller('health') -export class HealthController { - @Get() - check() { - return { - status: 'ok', - service: 'matrix-zitare-bot', - timestamp: new Date().toISOString(), - }; - } -}