@hed-hog/core 0.0.350 → 0.0.353
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/access-log/access-log.controller.d.ts +16 -0
- package/dist/access-log/access-log.controller.d.ts.map +1 -0
- package/dist/access-log/access-log.controller.js +44 -0
- package/dist/access-log/access-log.controller.js.map +1 -0
- package/dist/access-log/access-log.interceptor.d.ts +9 -0
- package/dist/access-log/access-log.interceptor.d.ts.map +1 -0
- package/dist/access-log/access-log.interceptor.js +46 -0
- package/dist/access-log/access-log.interceptor.js.map +1 -0
- package/dist/access-log/access-log.module.d.ts +3 -0
- package/dist/access-log/access-log.module.d.ts.map +1 -0
- package/dist/access-log/access-log.module.js +29 -0
- package/dist/access-log/access-log.module.js.map +1 -0
- package/dist/access-log/access-log.service.d.ts +47 -0
- package/dist/access-log/access-log.service.d.ts.map +1 -0
- package/dist/access-log/access-log.service.js +113 -0
- package/dist/access-log/access-log.service.js.map +1 -0
- package/dist/access-log/dto/query-access-log.dto.d.ts +8 -0
- package/dist/access-log/dto/query-access-log.dto.d.ts.map +1 -0
- package/dist/access-log/dto/query-access-log.dto.js +42 -0
- package/dist/access-log/dto/query-access-log.dto.js.map +1 -0
- package/dist/auth/auth.controller.d.ts +9 -9
- package/dist/auth/auth.service.d.ts +19 -19
- package/dist/auth/auth.service.d.ts.map +1 -1
- package/dist/auth/auth.service.js +0 -4
- package/dist/auth/auth.service.js.map +1 -1
- package/dist/challenge/challenge.service.d.ts +2 -2
- package/dist/challenge/challenge.service.d.ts.map +1 -1
- package/dist/challenge/challenge.service.js +0 -1
- package/dist/challenge/challenge.service.js.map +1 -1
- package/dist/core/system.module.d.ts.map +1 -1
- package/dist/core/system.module.js +1 -0
- package/dist/core/system.module.js.map +1 -1
- package/dist/core.module.d.ts.map +1 -1
- package/dist/core.module.js +12 -0
- package/dist/core.module.js.map +1 -1
- package/dist/dashboard/dashboard-user/dashboard-user.controller.d.ts +3 -3
- package/dist/dashboard/dashboard-user/dashboard-user.service.d.ts +3 -3
- package/dist/dashboard/dashboard.module.d.ts.map +1 -1
- package/dist/dashboard/dashboard.module.js +4 -1
- package/dist/dashboard/dashboard.module.js.map +1 -1
- package/dist/file/file.controller.js +0 -1
- package/dist/file/file.controller.js.map +1 -1
- package/dist/file/file.service.d.ts +65 -0
- package/dist/file/file.service.d.ts.map +1 -1
- package/dist/file/file.service.js +151 -3
- package/dist/file/file.service.js.map +1 -1
- package/dist/file/provider/abstract.provider.d.ts +8 -0
- package/dist/file/provider/abstract.provider.d.ts.map +1 -1
- package/dist/file/provider/abstract.provider.js.map +1 -1
- package/dist/file/provider/azure.provider.d.ts +4 -0
- package/dist/file/provider/azure.provider.d.ts.map +1 -1
- package/dist/file/provider/azure.provider.js +14 -0
- package/dist/file/provider/azure.provider.js.map +1 -1
- package/dist/file/provider/gcs.provider.d.ts +4 -0
- package/dist/file/provider/gcs.provider.d.ts.map +1 -1
- package/dist/file/provider/gcs.provider.js +14 -0
- package/dist/file/provider/gcs.provider.js.map +1 -1
- package/dist/file/provider/local.provider.d.ts +4 -0
- package/dist/file/provider/local.provider.d.ts.map +1 -1
- package/dist/file/provider/local.provider.js +19 -0
- package/dist/file/provider/local.provider.js.map +1 -1
- package/dist/file/provider/provider.factory.d.ts.map +1 -1
- package/dist/file/provider/provider.factory.js +3 -0
- package/dist/file/provider/provider.factory.js.map +1 -1
- package/dist/file/provider/s3.provider.d.ts +4 -0
- package/dist/file/provider/s3.provider.d.ts.map +1 -1
- package/dist/file/provider/s3.provider.js +17 -0
- package/dist/file/provider/s3.provider.js.map +1 -1
- package/dist/mcp/mcp-audit.service.d.ts +3 -1
- package/dist/mcp/mcp-audit.service.d.ts.map +1 -1
- package/dist/mcp/mcp-audit.service.js +14 -2
- package/dist/mcp/mcp-audit.service.js.map +1 -1
- package/dist/mcp/mcp.controller.d.ts +3 -1
- package/dist/mcp/mcp.controller.d.ts.map +1 -1
- package/dist/mcp/mcp.controller.js +10 -2
- package/dist/mcp/mcp.controller.js.map +1 -1
- package/dist/mcp/mcp.module.d.ts.map +1 -1
- package/dist/mcp/mcp.module.js +72 -0
- package/dist/mcp/mcp.module.js.map +1 -1
- package/dist/mcp/tools/core-ai.mcp-tools.d.ts +45 -0
- package/dist/mcp/tools/core-ai.mcp-tools.d.ts.map +1 -0
- package/dist/mcp/tools/core-ai.mcp-tools.js +214 -0
- package/dist/mcp/tools/core-ai.mcp-tools.js.map +1 -0
- package/dist/mcp/tools/core-dashboard-items.mcp-tools.d.ts +21 -0
- package/dist/mcp/tools/core-dashboard-items.mcp-tools.d.ts.map +1 -0
- package/dist/mcp/tools/core-dashboard-items.mcp-tools.js +89 -0
- package/dist/mcp/tools/core-dashboard-items.mcp-tools.js.map +1 -0
- package/dist/mcp/tools/core-dashboard.mcp-tools.d.ts +29 -0
- package/dist/mcp/tools/core-dashboard.mcp-tools.d.ts.map +1 -0
- package/dist/mcp/tools/core-dashboard.mcp-tools.js +149 -0
- package/dist/mcp/tools/core-dashboard.mcp-tools.js.map +1 -0
- package/dist/mcp/tools/core-event-webhooks.mcp-tools.d.ts +30 -0
- package/dist/mcp/tools/core-event-webhooks.mcp-tools.d.ts.map +1 -0
- package/dist/mcp/tools/core-event-webhooks.mcp-tools.js +185 -0
- package/dist/mcp/tools/core-event-webhooks.mcp-tools.js.map +1 -0
- package/dist/mcp/tools/core-files.mcp-tools.d.ts +26 -0
- package/dist/mcp/tools/core-files.mcp-tools.d.ts.map +1 -0
- package/dist/mcp/tools/core-files.mcp-tools.js +140 -0
- package/dist/mcp/tools/core-files.mcp-tools.js.map +1 -0
- package/dist/mcp/tools/core-integration-events.mcp-tools.d.ts +26 -0
- package/dist/mcp/tools/core-integration-events.mcp-tools.d.ts.map +1 -0
- package/dist/mcp/tools/core-integration-events.mcp-tools.js +168 -0
- package/dist/mcp/tools/core-integration-events.mcp-tools.js.map +1 -0
- package/dist/mcp/tools/core-mail-profile.mcp-tools.d.ts +32 -0
- package/dist/mcp/tools/core-mail-profile.mcp-tools.d.ts.map +1 -0
- package/dist/mcp/tools/core-mail-profile.mcp-tools.js +178 -0
- package/dist/mcp/tools/core-mail-profile.mcp-tools.js.map +1 -0
- package/dist/mcp/tools/core-mail-sent.mcp-tools.d.ts +14 -0
- package/dist/mcp/tools/core-mail-sent.mcp-tools.d.ts.map +1 -0
- package/dist/mcp/tools/core-mail-sent.mcp-tools.js +106 -0
- package/dist/mcp/tools/core-mail-sent.mcp-tools.js.map +1 -0
- package/dist/mcp/tools/core-mail.mcp-tools.d.ts +36 -0
- package/dist/mcp/tools/core-mail.mcp-tools.d.ts.map +1 -0
- package/dist/mcp/tools/core-mail.mcp-tools.js +184 -0
- package/dist/mcp/tools/core-mail.mcp-tools.js.map +1 -0
- package/dist/mcp/tools/core-mcp-chat.mcp-tools.d.ts +21 -0
- package/dist/mcp/tools/core-mcp-chat.mcp-tools.d.ts.map +1 -0
- package/dist/mcp/tools/core-mcp-chat.mcp-tools.js +118 -0
- package/dist/mcp/tools/core-mcp-chat.mcp-tools.js.map +1 -0
- package/dist/mcp/tools/core-menus.mcp-tools.d.ts +40 -0
- package/dist/mcp/tools/core-menus.mcp-tools.d.ts.map +1 -0
- package/dist/mcp/tools/core-menus.mcp-tools.js +268 -0
- package/dist/mcp/tools/core-menus.mcp-tools.js.map +1 -0
- package/dist/mcp/tools/core-notifications.mcp-tools.d.ts +31 -0
- package/dist/mcp/tools/core-notifications.mcp-tools.d.ts.map +1 -0
- package/dist/mcp/tools/core-notifications.mcp-tools.js +178 -0
- package/dist/mcp/tools/core-notifications.mcp-tools.js.map +1 -0
- package/dist/mcp/tools/core-profile.mcp-tools.d.ts +20 -0
- package/dist/mcp/tools/core-profile.mcp-tools.d.ts.map +1 -0
- package/dist/mcp/tools/core-profile.mcp-tools.js +111 -0
- package/dist/mcp/tools/core-profile.mcp-tools.js.map +1 -0
- package/dist/mcp/tools/core-roles.mcp-tools.d.ts +70 -0
- package/dist/mcp/tools/core-roles.mcp-tools.d.ts.map +1 -0
- package/dist/mcp/tools/core-roles.mcp-tools.js +355 -0
- package/dist/mcp/tools/core-roles.mcp-tools.js.map +1 -0
- package/dist/mcp/tools/core-routes.mcp-tools.d.ts +52 -0
- package/dist/mcp/tools/core-routes.mcp-tools.d.ts.map +1 -0
- package/dist/mcp/tools/core-routes.mcp-tools.js +254 -0
- package/dist/mcp/tools/core-routes.mcp-tools.js.map +1 -0
- package/dist/mcp/tools/core-screens.mcp-tools.d.ts +47 -0
- package/dist/mcp/tools/core-screens.mcp-tools.d.ts.map +1 -0
- package/dist/mcp/tools/core-screens.mcp-tools.js +250 -0
- package/dist/mcp/tools/core-screens.mcp-tools.js.map +1 -0
- package/dist/mcp/tools/core-sessions.mcp-tools.d.ts +20 -0
- package/dist/mcp/tools/core-sessions.mcp-tools.d.ts.map +1 -0
- package/dist/mcp/tools/core-sessions.mcp-tools.js +128 -0
- package/dist/mcp/tools/core-sessions.mcp-tools.js.map +1 -0
- package/dist/mcp/tools/core-settings.mcp-tools.d.ts +25 -0
- package/dist/mcp/tools/core-settings.mcp-tools.d.ts.map +1 -1
- package/dist/mcp/tools/core-settings.mcp-tools.js +138 -0
- package/dist/mcp/tools/core-settings.mcp-tools.js.map +1 -1
- package/dist/mcp/tools/core-system.mcp-tools.d.ts +8 -0
- package/dist/mcp/tools/core-system.mcp-tools.d.ts.map +1 -0
- package/dist/mcp/tools/core-system.mcp-tools.js +40 -0
- package/dist/mcp/tools/core-system.mcp-tools.js.map +1 -0
- package/dist/mcp/tools/core-webhooks.mcp-tools.d.ts +46 -0
- package/dist/mcp/tools/core-webhooks.mcp-tools.d.ts.map +1 -0
- package/dist/mcp/tools/core-webhooks.mcp-tools.js +266 -0
- package/dist/mcp/tools/core-webhooks.mcp-tools.js.map +1 -0
- package/dist/mcp-chat/mcp-chat.controller.d.ts +1 -1
- package/dist/mcp-chat/mcp-chat.service.d.ts +25 -2
- package/dist/mcp-chat/mcp-chat.service.d.ts.map +1 -1
- package/dist/mcp-chat/mcp-chat.service.js +666 -36
- package/dist/mcp-chat/mcp-chat.service.js.map +1 -1
- package/dist/notification/notification.controller.d.ts +8 -4
- package/dist/notification/notification.controller.d.ts.map +1 -1
- package/dist/notification/notification.controller.js +12 -0
- package/dist/notification/notification.controller.js.map +1 -1
- package/dist/notification/notification.service.d.ts +19 -5
- package/dist/notification/notification.service.d.ts.map +1 -1
- package/dist/notification/notification.service.js +155 -9
- package/dist/notification/notification.service.js.map +1 -1
- package/dist/pdf/pdf.service.js +1 -1
- package/dist/pdf/pdf.service.js.map +1 -1
- package/dist/profile/profile.controller.d.ts +3 -3
- package/dist/profile/profile.controller.js +0 -1
- package/dist/profile/profile.controller.js.map +1 -1
- package/dist/profile/profile.module.d.ts.map +1 -1
- package/dist/profile/profile.module.js +1 -0
- package/dist/profile/profile.module.js.map +1 -1
- package/dist/profile/profile.service.d.ts +3 -3
- package/dist/session/session.controller.d.ts +2 -2
- package/dist/session/session.service.d.ts +6 -6
- package/dist/setting/setting.controller.d.ts +1 -1
- package/dist/setting/setting.service.d.ts +1 -1
- package/dist/setting/setting.service.d.ts.map +1 -1
- package/dist/setting/setting.service.js +1 -4
- package/dist/setting/setting.service.js.map +1 -1
- package/dist/task/task.service.d.ts +1 -0
- package/dist/task/task.service.d.ts.map +1 -1
- package/dist/task/task.service.js +25 -0
- package/dist/task/task.service.js.map +1 -1
- package/dist/token/token.service.d.ts.map +1 -1
- package/dist/token/token.service.js +0 -1
- package/dist/token/token.service.js.map +1 -1
- package/dist/user/user.controller.d.ts +9 -9
- package/dist/user/user.service.d.ts +21 -21
- package/dist/webhook-integration/dto/webhook-action.dto.d.ts +22 -0
- package/dist/webhook-integration/dto/webhook-action.dto.d.ts.map +1 -0
- package/dist/webhook-integration/dto/webhook-action.dto.js +120 -0
- package/dist/webhook-integration/dto/webhook-action.dto.js.map +1 -0
- package/dist/webhook-integration/webhook-integration.controller.d.ts +7 -5
- package/dist/webhook-integration/webhook-integration.controller.d.ts.map +1 -1
- package/dist/webhook-integration/webhook-integration.controller.js +18 -5
- package/dist/webhook-integration/webhook-integration.controller.js.map +1 -1
- package/dist/webhook-integration/webhook-integration.service.d.ts +14 -5
- package/dist/webhook-integration/webhook-integration.service.d.ts.map +1 -1
- package/dist/webhook-integration/webhook-integration.service.js +174 -41
- package/dist/webhook-integration/webhook-integration.service.js.map +1 -1
- package/hedhog/data/menu.yaml +15 -0
- package/hedhog/data/route.yaml +1304 -0
- package/hedhog/data/setting_group.yaml +67 -0
- package/hedhog/data/setting_subgroup.yaml +16 -0
- package/hedhog/frontend/app/access-log/page.tsx.ejs +772 -0
- package/hedhog/frontend/app/ai_agent/page.tsx.ejs +10 -3
- package/hedhog/frontend/app/dashboard/dashboard-home-tabs.tsx.ejs +33 -13
- package/hedhog/frontend/app/dashboard/management/tabs/components-tab.tsx.ejs +12 -5
- package/hedhog/frontend/app/dashboard/management/tabs/dashboards-tab.tsx.ejs +12 -5
- package/hedhog/frontend/app/integrations-webhooks/page.tsx.ejs +1817 -356
- package/hedhog/frontend/app/mcp_chat/chat-components.tsx.ejs +43 -5
- package/hedhog/frontend/app/mcp_chat/page.tsx.ejs +35 -7
- package/hedhog/frontend/app/menu/page.tsx.ejs +9 -3
- package/hedhog/frontend/app/roles/page.tsx.ejs +18 -6
- package/hedhog/frontend/app/routes/page.tsx.ejs +9 -3
- package/hedhog/frontend/app/setting-list/page.tsx.ejs +344 -171
- package/hedhog/frontend/app/users/user-access-sheet.tsx.ejs +310 -304
- package/hedhog/frontend/app/users/user-sheet.tsx.ejs +25 -7
- package/hedhog/frontend/messages/en.json +104 -3
- package/hedhog/frontend/messages/pt.json +104 -3
- package/hedhog/table/access_log.yaml +31 -0
- package/package.json +4 -3
- package/src/access-log/access-log.controller.ts +29 -0
- package/src/access-log/access-log.interceptor.ts +38 -0
- package/src/access-log/access-log.module.ts +16 -0
- package/src/access-log/access-log.service.ts +129 -0
- package/src/access-log/dto/query-access-log.dto.ts +23 -0
- package/src/auth/auth.service.ts +0 -7
- package/src/challenge/challenge.service.ts +0 -2
- package/src/core/system.module.ts +1 -0
- package/src/core.module.ts +12 -0
- package/src/dashboard/dashboard.module.ts +4 -1
- package/src/file/file.controller.ts +14 -14
- package/src/file/file.service.ts +198 -4
- package/src/file/provider/abstract.provider.ts +10 -0
- package/src/file/provider/azure.provider.ts +24 -0
- package/src/file/provider/gcs.provider.ts +20 -0
- package/src/file/provider/local.provider.ts +30 -2
- package/src/file/provider/provider.factory.ts +3 -0
- package/src/file/provider/s3.provider.ts +22 -0
- package/src/mcp/mcp-audit.service.ts +47 -36
- package/src/mcp/mcp.controller.ts +40 -30
- package/src/mcp/mcp.module.ts +72 -0
- package/src/mcp/tools/core-ai.mcp-tools.ts +156 -0
- package/src/mcp/tools/core-dashboard-items.mcp-tools.ts +63 -0
- package/src/mcp/tools/core-dashboard.mcp-tools.ts +103 -0
- package/src/mcp/tools/core-event-webhooks.mcp-tools.ts +134 -0
- package/src/mcp/tools/core-files.mcp-tools.ts +105 -0
- package/src/mcp/tools/core-integration-events.mcp-tools.ts +118 -0
- package/src/mcp/tools/core-mail-profile.mcp-tools.ts +128 -0
- package/src/mcp/tools/core-mail-sent.mcp-tools.ts +76 -0
- package/src/mcp/tools/core-mail.mcp-tools.ts +130 -0
- package/src/mcp/tools/core-mcp-chat.mcp-tools.ts +81 -0
- package/src/mcp/tools/core-menus.mcp-tools.ts +197 -0
- package/src/mcp/tools/core-notifications.mcp-tools.ts +128 -0
- package/src/mcp/tools/core-profile.mcp-tools.ts +74 -0
- package/src/mcp/tools/core-roles.mcp-tools.ts +288 -0
- package/src/mcp/tools/core-routes.mcp-tools.ts +196 -0
- package/src/mcp/tools/core-screens.mcp-tools.ts +186 -0
- package/src/mcp/tools/core-sessions.mcp-tools.ts +97 -0
- package/src/mcp/tools/core-settings.mcp-tools.ts +171 -53
- package/src/mcp/tools/core-system.mcp-tools.ts +19 -0
- package/src/mcp/tools/core-webhooks.mcp-tools.ts +199 -0
- package/src/mcp-chat/mcp-chat.service.ts +887 -38
- package/src/notification/notification.controller.ts +20 -8
- package/src/notification/notification.service.ts +209 -9
- package/src/pdf/pdf.service.ts +1 -1
- package/src/profile/profile.controller.ts +1 -1
- package/src/profile/profile.module.ts +1 -0
- package/src/setting/setting.service.ts +8 -11
- package/src/task/task.service.ts +31 -0
- package/src/token/token.service.ts +0 -2
- package/src/webhook-integration/dto/webhook-action.dto.ts +96 -0
- package/src/webhook-integration/webhook-integration.controller.ts +124 -103
- package/src/webhook-integration/webhook-integration.service.ts +267 -64
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { Injectable } from '@nestjs/common';
|
|
2
|
+
import { PageOrderDirection } from '@hed-hog/api-pagination';
|
|
3
|
+
import { MenuService } from '../../menu/menu.service';
|
|
4
|
+
import { McpTool } from '../decorators/mcp-tool.decorator';
|
|
5
|
+
import { McpContext } from '../types/mcp-context.type';
|
|
6
|
+
|
|
7
|
+
@Injectable()
|
|
8
|
+
export class CoreMenusMcpTools {
|
|
9
|
+
constructor(private readonly menuService: MenuService) {}
|
|
10
|
+
|
|
11
|
+
@McpTool({
|
|
12
|
+
name: 'core.menus.system',
|
|
13
|
+
description: 'Returns the system menu for the authenticated user.',
|
|
14
|
+
inputSchema: { type: 'object', properties: {} },
|
|
15
|
+
readOnly: true,
|
|
16
|
+
})
|
|
17
|
+
async getSystemMenu(_args: Record<string, any>, context: McpContext): Promise<any> {
|
|
18
|
+
return this.menuService.getSystemMenu(context.locale, context.userId);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@McpTool({
|
|
22
|
+
name: 'core.menus.stats',
|
|
23
|
+
description: 'Returns menu statistics. Admin only.',
|
|
24
|
+
inputSchema: { type: 'object', properties: {} },
|
|
25
|
+
readOnly: true,
|
|
26
|
+
})
|
|
27
|
+
async getMenuStats(_args: Record<string, any>, _context: McpContext): Promise<any> {
|
|
28
|
+
return this.menuService.stats();
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@McpTool({
|
|
32
|
+
name: 'core.menus.all',
|
|
33
|
+
description: 'Returns all menus as a flat list (no pagination). Admin only.',
|
|
34
|
+
inputSchema: { type: 'object', properties: {} },
|
|
35
|
+
readOnly: true,
|
|
36
|
+
})
|
|
37
|
+
async listAllMenus(_args: Record<string, any>, context: McpContext): Promise<any> {
|
|
38
|
+
return this.menuService.listAll(context.locale);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@McpTool({
|
|
42
|
+
name: 'core.menus.list',
|
|
43
|
+
description: 'Lists menus with pagination. Admin only.',
|
|
44
|
+
inputSchema: {
|
|
45
|
+
type: 'object',
|
|
46
|
+
properties: {
|
|
47
|
+
page: { type: 'number', description: 'Page number (default: 1)' },
|
|
48
|
+
pageSize: { type: 'number', description: 'Items per page (default: 20)' },
|
|
49
|
+
search: { type: 'string', description: 'Search term' },
|
|
50
|
+
sortField: { type: 'string', description: 'Field to sort by' },
|
|
51
|
+
sortOrder: { type: 'string', enum: ['asc', 'desc'], description: 'Sort direction' },
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
readOnly: true,
|
|
55
|
+
})
|
|
56
|
+
async listMenus(
|
|
57
|
+
args: { page?: number; pageSize?: number; search?: string; sortField?: string; sortOrder?: string },
|
|
58
|
+
context: McpContext,
|
|
59
|
+
): Promise<any> {
|
|
60
|
+
return this.menuService.list(context.locale, {
|
|
61
|
+
page: args.page ?? 1,
|
|
62
|
+
pageSize: args.pageSize ?? 20,
|
|
63
|
+
search: args.search ?? '',
|
|
64
|
+
sortField: args.sortField ?? 'id',
|
|
65
|
+
sortOrder: (args.sortOrder as any) ?? 'asc',
|
|
66
|
+
fields: '',
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
@McpTool({
|
|
71
|
+
name: 'core.menus.get',
|
|
72
|
+
description: 'Returns a single menu by ID. Admin only.',
|
|
73
|
+
inputSchema: {
|
|
74
|
+
type: 'object',
|
|
75
|
+
properties: {
|
|
76
|
+
menuId: { type: 'number', description: 'Menu ID' },
|
|
77
|
+
},
|
|
78
|
+
required: ['menuId'],
|
|
79
|
+
},
|
|
80
|
+
readOnly: true,
|
|
81
|
+
})
|
|
82
|
+
async getMenu(args: { menuId: number }, context: McpContext): Promise<any> {
|
|
83
|
+
return this.menuService.get(context.locale, args.menuId);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
@McpTool({
|
|
87
|
+
name: 'core.menus.create',
|
|
88
|
+
description: 'Creates a new menu item. Admin only.',
|
|
89
|
+
inputSchema: {
|
|
90
|
+
type: 'object',
|
|
91
|
+
properties: {
|
|
92
|
+
slug: { type: 'string', description: 'Menu slug' },
|
|
93
|
+
url: { type: 'string', description: 'Target URL' },
|
|
94
|
+
icon: { type: 'string', description: 'Icon identifier' },
|
|
95
|
+
order: { type: 'number', description: 'Display order' },
|
|
96
|
+
menu_id: { type: 'number', description: 'Parent menu ID' },
|
|
97
|
+
locale: { type: 'object', description: 'Locale translations, e.g. {"en": {"name": "Dashboard"}}' },
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
})
|
|
101
|
+
async createMenu(args: Record<string, any>, context: McpContext): Promise<any> {
|
|
102
|
+
return this.menuService.create(context.locale, args as any);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
@McpTool({
|
|
106
|
+
name: 'core.menus.update',
|
|
107
|
+
description: 'Updates an existing menu item by ID. Admin only.',
|
|
108
|
+
inputSchema: {
|
|
109
|
+
type: 'object',
|
|
110
|
+
properties: {
|
|
111
|
+
menuId: { type: 'number', description: 'Menu ID' },
|
|
112
|
+
slug: { type: 'string', description: 'New slug' },
|
|
113
|
+
url: { type: 'string', description: 'New URL' },
|
|
114
|
+
icon: { type: 'string', description: 'New icon' },
|
|
115
|
+
order: { type: 'number', description: 'New display order' },
|
|
116
|
+
menu_id: { type: 'number', description: 'New parent menu ID' },
|
|
117
|
+
locale: { type: 'object', description: 'Updated locale translations' },
|
|
118
|
+
},
|
|
119
|
+
required: ['menuId'],
|
|
120
|
+
},
|
|
121
|
+
})
|
|
122
|
+
async updateMenu(args: { menuId: number; [key: string]: any }, context: McpContext): Promise<any> {
|
|
123
|
+
const { menuId, ...data } = args;
|
|
124
|
+
return this.menuService.update(context.locale, { id: menuId, data: data as any });
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
@McpTool({
|
|
128
|
+
name: 'core.menus.delete',
|
|
129
|
+
description: 'Deletes one or more menu items by their IDs. Admin only.',
|
|
130
|
+
inputSchema: {
|
|
131
|
+
type: 'object',
|
|
132
|
+
properties: {
|
|
133
|
+
ids: { type: 'array', items: { type: 'number' }, description: 'Menu IDs to delete' },
|
|
134
|
+
},
|
|
135
|
+
required: ['ids'],
|
|
136
|
+
},
|
|
137
|
+
})
|
|
138
|
+
async deleteMenus(args: { ids: number[] }, context: McpContext): Promise<any> {
|
|
139
|
+
return this.menuService.delete(context.locale, { ids: args.ids });
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
@McpTool({
|
|
143
|
+
name: 'core.menus.order',
|
|
144
|
+
description: 'Updates the display order of menus. Admin only.',
|
|
145
|
+
inputSchema: {
|
|
146
|
+
type: 'object',
|
|
147
|
+
properties: {
|
|
148
|
+
ids: { type: 'array', items: { type: 'number' }, description: 'Menu IDs in the desired order' },
|
|
149
|
+
},
|
|
150
|
+
required: ['ids'],
|
|
151
|
+
},
|
|
152
|
+
})
|
|
153
|
+
async updateMenuOrder(args: { ids: number[] }, context: McpContext): Promise<any> {
|
|
154
|
+
return this.menuService.updateOrder(context.locale, { ids: args.ids });
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
@McpTool({
|
|
158
|
+
name: 'core.menus.roles.list',
|
|
159
|
+
description: 'Lists roles assigned to a menu. Admin only.',
|
|
160
|
+
inputSchema: {
|
|
161
|
+
type: 'object',
|
|
162
|
+
properties: {
|
|
163
|
+
menuId: { type: 'number', description: 'Menu ID' },
|
|
164
|
+
page: { type: 'number', description: 'Page number (default: 1)' },
|
|
165
|
+
pageSize: { type: 'number', description: 'Items per page (default: 20)' },
|
|
166
|
+
},
|
|
167
|
+
required: ['menuId'],
|
|
168
|
+
},
|
|
169
|
+
readOnly: true,
|
|
170
|
+
})
|
|
171
|
+
async listMenuRoles(args: { menuId: number; page?: number; pageSize?: number }, context: McpContext): Promise<any> {
|
|
172
|
+
return this.menuService.listRoles(context.locale, args.menuId, {
|
|
173
|
+
page: args.page ?? 1,
|
|
174
|
+
pageSize: args.pageSize ?? 20,
|
|
175
|
+
search: '',
|
|
176
|
+
sortField: 'id',
|
|
177
|
+
sortOrder: PageOrderDirection.Asc,
|
|
178
|
+
fields: '',
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
@McpTool({
|
|
183
|
+
name: 'core.menus.roles.update',
|
|
184
|
+
description: 'Replaces all roles assigned to a menu. Admin only.',
|
|
185
|
+
inputSchema: {
|
|
186
|
+
type: 'object',
|
|
187
|
+
properties: {
|
|
188
|
+
menuId: { type: 'number', description: 'Menu ID' },
|
|
189
|
+
ids: { type: 'array', items: { type: 'number' }, description: 'Role IDs to assign' },
|
|
190
|
+
},
|
|
191
|
+
required: ['menuId', 'ids'],
|
|
192
|
+
},
|
|
193
|
+
})
|
|
194
|
+
async updateMenuRoles(args: { menuId: number; ids: number[] }, context: McpContext): Promise<any> {
|
|
195
|
+
return this.menuService.updateRoles(context.locale, args.menuId, { ids: args.ids });
|
|
196
|
+
}
|
|
197
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { Injectable } from '@nestjs/common';
|
|
2
|
+
import { NotificationService } from '../../notification/notification.service';
|
|
3
|
+
import { McpTool } from '../decorators/mcp-tool.decorator';
|
|
4
|
+
import { McpContext } from '../types/mcp-context.type';
|
|
5
|
+
|
|
6
|
+
@Injectable()
|
|
7
|
+
export class CoreNotificationsMcpTools {
|
|
8
|
+
constructor(private readonly notificationService: NotificationService) {}
|
|
9
|
+
|
|
10
|
+
@McpTool({
|
|
11
|
+
name: 'core.notifications.list',
|
|
12
|
+
description: 'Lists notifications for the authenticated user.',
|
|
13
|
+
inputSchema: {
|
|
14
|
+
type: 'object',
|
|
15
|
+
properties: {
|
|
16
|
+
page: { type: 'number', description: 'Page number (default: 1)' },
|
|
17
|
+
pageSize: { type: 'number', description: 'Items per page (default: 20)' },
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
readOnly: true,
|
|
21
|
+
})
|
|
22
|
+
async listNotifications(args: { page?: number; pageSize?: number }, context: McpContext): Promise<any> {
|
|
23
|
+
return this.notificationService.list(context.userId, {
|
|
24
|
+
page: args.page ?? 1,
|
|
25
|
+
pageSize: args.pageSize ?? 20,
|
|
26
|
+
search: '',
|
|
27
|
+
sortField: 'id',
|
|
28
|
+
sortOrder: 'desc',
|
|
29
|
+
fields: '',
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@McpTool({
|
|
34
|
+
name: 'core.notifications.unread-count',
|
|
35
|
+
description: 'Returns the unread notification count for the authenticated user.',
|
|
36
|
+
inputSchema: { type: 'object', properties: {} },
|
|
37
|
+
readOnly: true,
|
|
38
|
+
})
|
|
39
|
+
async getUnreadCount(_args: Record<string, any>, context: McpContext): Promise<any> {
|
|
40
|
+
return this.notificationService.unreadCount(context.userId);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
@McpTool({
|
|
44
|
+
name: 'core.notifications.mark-read',
|
|
45
|
+
description: 'Marks a specific notification as read.',
|
|
46
|
+
inputSchema: {
|
|
47
|
+
type: 'object',
|
|
48
|
+
properties: {
|
|
49
|
+
id: { type: 'number', description: 'Notification ID' },
|
|
50
|
+
},
|
|
51
|
+
required: ['id'],
|
|
52
|
+
},
|
|
53
|
+
})
|
|
54
|
+
async markRead(args: { id: number }, context: McpContext): Promise<any> {
|
|
55
|
+
return this.notificationService.markRead(context.userId, args.id);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
@McpTool({
|
|
59
|
+
name: 'core.notifications.mark-all-read',
|
|
60
|
+
description: 'Marks all notifications as read for the authenticated user.',
|
|
61
|
+
inputSchema: { type: 'object', properties: {} },
|
|
62
|
+
})
|
|
63
|
+
async markAllRead(_args: Record<string, any>, context: McpContext): Promise<any> {
|
|
64
|
+
return this.notificationService.markAllRead(context.userId);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@McpTool({
|
|
68
|
+
name: 'core.notifications.create',
|
|
69
|
+
description: 'Creates a new notification for a user. Admin only.',
|
|
70
|
+
inputSchema: {
|
|
71
|
+
type: 'object',
|
|
72
|
+
properties: {
|
|
73
|
+
userId: { type: 'number', description: 'Target user ID' },
|
|
74
|
+
title: { type: 'string', description: 'Notification title' },
|
|
75
|
+
message: { type: 'string', description: 'Notification message' },
|
|
76
|
+
type: { type: 'string', description: 'Notification type (e.g. info, success, error)' },
|
|
77
|
+
},
|
|
78
|
+
required: ['userId', 'title', 'message'],
|
|
79
|
+
},
|
|
80
|
+
})
|
|
81
|
+
async createNotification(args: { userId: number; title: string; message: string; type?: string }, _context: McpContext): Promise<any> {
|
|
82
|
+
return this.notificationService.create(args as any);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
@McpTool({
|
|
86
|
+
name: 'core.notifications.delete',
|
|
87
|
+
description: 'Deletes a specific notification for the authenticated user.',
|
|
88
|
+
inputSchema: {
|
|
89
|
+
type: 'object',
|
|
90
|
+
properties: {
|
|
91
|
+
id: { type: 'number', description: 'Notification ID' },
|
|
92
|
+
},
|
|
93
|
+
required: ['id'],
|
|
94
|
+
},
|
|
95
|
+
})
|
|
96
|
+
async deleteNotification(args: { id: number }, context: McpContext): Promise<any> {
|
|
97
|
+
return this.notificationService.delete(context.userId, args.id);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
@McpTool({
|
|
101
|
+
name: 'core.notifications.delete-all',
|
|
102
|
+
description: 'Deletes all notifications for the authenticated user.',
|
|
103
|
+
inputSchema: { type: 'object', properties: {} },
|
|
104
|
+
})
|
|
105
|
+
async deleteAllNotifications(_args: Record<string, any>, context: McpContext): Promise<any> {
|
|
106
|
+
return this.notificationService.deleteAll(context.userId);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
@McpTool({
|
|
110
|
+
name: 'core.notifications.update-progress',
|
|
111
|
+
description: 'Updates the progress of a notification (e.g. for background job tracking).',
|
|
112
|
+
inputSchema: {
|
|
113
|
+
type: 'object',
|
|
114
|
+
properties: {
|
|
115
|
+
id: { type: 'number', description: 'Notification ID' },
|
|
116
|
+
progress: { type: 'number', description: 'Progress value (0-100)' },
|
|
117
|
+
status: { type: 'string', description: 'Status (e.g. in_progress, completed, failed)' },
|
|
118
|
+
},
|
|
119
|
+
required: ['id', 'progress'],
|
|
120
|
+
},
|
|
121
|
+
})
|
|
122
|
+
async updateProgress(args: { id: number; progress: number; status?: string }, context: McpContext): Promise<any> {
|
|
123
|
+
return this.notificationService.updateProgress(context.userId, args.id, {
|
|
124
|
+
progress: args.progress,
|
|
125
|
+
success: args.status === 'failed' ? false : args.status === 'completed' ? true : undefined,
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { Injectable } from '@nestjs/common';
|
|
2
|
+
import { ProfileService } from '../../profile/profile.service';
|
|
3
|
+
import { McpTool } from '../decorators/mcp-tool.decorator';
|
|
4
|
+
import { McpContext } from '../types/mcp-context.type';
|
|
5
|
+
|
|
6
|
+
@Injectable()
|
|
7
|
+
export class CoreProfileMcpTools {
|
|
8
|
+
constructor(private readonly profileService: ProfileService) {}
|
|
9
|
+
|
|
10
|
+
@McpTool({
|
|
11
|
+
name: 'core.profile.get',
|
|
12
|
+
description: 'Returns the authenticated user profile.',
|
|
13
|
+
inputSchema: { type: 'object', properties: {} },
|
|
14
|
+
readOnly: true,
|
|
15
|
+
})
|
|
16
|
+
async getProfile(_args: Record<string, any>, context: McpContext): Promise<any> {
|
|
17
|
+
return this.profileService.getProfile(context.userId);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
@McpTool({
|
|
21
|
+
name: 'core.profile.update',
|
|
22
|
+
description: 'Updates the authenticated user profile name.',
|
|
23
|
+
inputSchema: {
|
|
24
|
+
type: 'object',
|
|
25
|
+
properties: {
|
|
26
|
+
name: { type: 'string', description: 'New display name' },
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
})
|
|
30
|
+
async updateProfile(args: { name?: string }, context: McpContext): Promise<any> {
|
|
31
|
+
return this.profileService.update(context.userId, { name: args.name } as any);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@McpTool({
|
|
35
|
+
name: 'core.profile.update-preferences',
|
|
36
|
+
description: 'Updates authenticated user preferences such as theme and language.',
|
|
37
|
+
inputSchema: {
|
|
38
|
+
type: 'object',
|
|
39
|
+
properties: {
|
|
40
|
+
theme: { type: 'string', description: 'UI theme (e.g. dark, light)' },
|
|
41
|
+
language: { type: 'string', description: 'Locale code (e.g. en, pt-BR)' },
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
})
|
|
45
|
+
async updatePreferences(args: { theme?: string; language?: string }, context: McpContext): Promise<any> {
|
|
46
|
+
return this.profileService.updatePreferences(context.locale, context.userId, args as any);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@McpTool({
|
|
50
|
+
name: 'core.profile.mfa.list',
|
|
51
|
+
description: 'Returns the MFA methods configured for the authenticated user.',
|
|
52
|
+
inputSchema: { type: 'object', properties: {} },
|
|
53
|
+
readOnly: true,
|
|
54
|
+
})
|
|
55
|
+
async getMfaMethods(_args: Record<string, any>, context: McpContext): Promise<any> {
|
|
56
|
+
return this.profileService.getMFAMethods(context.userId);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
@McpTool({
|
|
60
|
+
name: 'core.profile.change-password',
|
|
61
|
+
description: 'Changes the password of the authenticated user.',
|
|
62
|
+
inputSchema: {
|
|
63
|
+
type: 'object',
|
|
64
|
+
properties: {
|
|
65
|
+
currentPassword: { type: 'string', description: 'Current password' },
|
|
66
|
+
newPassword: { type: 'string', description: 'New password (must meet strength requirements)' },
|
|
67
|
+
},
|
|
68
|
+
required: ['currentPassword', 'newPassword'],
|
|
69
|
+
},
|
|
70
|
+
})
|
|
71
|
+
async changePassword(args: { currentPassword: string; newPassword: string }, context: McpContext): Promise<any> {
|
|
72
|
+
return this.profileService.changePassword(context.locale, context.userId, args as any);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
import { Injectable } from '@nestjs/common';
|
|
2
|
+
import { PageOrderDirection } from '@hed-hog/api-pagination';
|
|
3
|
+
import { RoleService } from '../../role/role.service';
|
|
4
|
+
import { McpTool } from '../decorators/mcp-tool.decorator';
|
|
5
|
+
import { McpContext } from '../types/mcp-context.type';
|
|
6
|
+
|
|
7
|
+
@Injectable()
|
|
8
|
+
export class CoreRolesMcpTools {
|
|
9
|
+
constructor(private readonly roleService: RoleService) {}
|
|
10
|
+
|
|
11
|
+
@McpTool({
|
|
12
|
+
name: 'core.roles.list',
|
|
13
|
+
description: 'Lists all roles with optional pagination and search. Admin only.',
|
|
14
|
+
inputSchema: {
|
|
15
|
+
type: 'object',
|
|
16
|
+
properties: {
|
|
17
|
+
page: { type: 'number', description: 'Page number (default: 1)' },
|
|
18
|
+
pageSize: { type: 'number', description: 'Items per page (default: 20)' },
|
|
19
|
+
search: { type: 'string', description: 'Search term to filter roles' },
|
|
20
|
+
sortField: { type: 'string', description: 'Field to sort by' },
|
|
21
|
+
sortOrder: { type: 'string', enum: ['asc', 'desc'], description: 'Sort direction' },
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
readOnly: true,
|
|
25
|
+
})
|
|
26
|
+
async listRoles(
|
|
27
|
+
args: { page?: number; pageSize?: number; search?: string; sortField?: string; sortOrder?: string },
|
|
28
|
+
context: McpContext,
|
|
29
|
+
): Promise<any> {
|
|
30
|
+
return this.roleService.list(
|
|
31
|
+
{
|
|
32
|
+
page: args.page ?? 1,
|
|
33
|
+
pageSize: args.pageSize ?? 20,
|
|
34
|
+
search: args.search ?? '',
|
|
35
|
+
sortField: args.sortField ?? 'id',
|
|
36
|
+
sortOrder: (args.sortOrder as any) ?? 'asc',
|
|
37
|
+
fields: '',
|
|
38
|
+
},
|
|
39
|
+
context.locale,
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
@McpTool({
|
|
44
|
+
name: 'core.roles.get',
|
|
45
|
+
description: 'Returns a single role by ID. Admin only.',
|
|
46
|
+
inputSchema: {
|
|
47
|
+
type: 'object',
|
|
48
|
+
properties: {
|
|
49
|
+
roleId: { type: 'number', description: 'Role ID' },
|
|
50
|
+
},
|
|
51
|
+
required: ['roleId'],
|
|
52
|
+
},
|
|
53
|
+
readOnly: true,
|
|
54
|
+
})
|
|
55
|
+
async getRole(args: { roleId: number }, _context: McpContext): Promise<any> {
|
|
56
|
+
return this.roleService.get(args.roleId);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
@McpTool({
|
|
60
|
+
name: 'core.roles.create',
|
|
61
|
+
description: 'Creates a new role. Admin only.',
|
|
62
|
+
inputSchema: {
|
|
63
|
+
type: 'object',
|
|
64
|
+
properties: {
|
|
65
|
+
slug: { type: 'string', description: 'Role slug (unique identifier)' },
|
|
66
|
+
locale: {
|
|
67
|
+
type: 'object',
|
|
68
|
+
description: 'Locale translations keyed by locale code, e.g. {"en": {"name": "Admin", "description": "..."}}',
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
required: ['slug'],
|
|
72
|
+
},
|
|
73
|
+
})
|
|
74
|
+
async createRole(args: { slug: string; locale?: Record<string, { name: string; description?: string }> }, _context: McpContext): Promise<any> {
|
|
75
|
+
return this.roleService.create(args as any);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
@McpTool({
|
|
79
|
+
name: 'core.roles.update',
|
|
80
|
+
description: 'Updates an existing role by ID. Admin only.',
|
|
81
|
+
inputSchema: {
|
|
82
|
+
type: 'object',
|
|
83
|
+
properties: {
|
|
84
|
+
roleId: { type: 'number', description: 'Role ID' },
|
|
85
|
+
slug: { type: 'string', description: 'New slug' },
|
|
86
|
+
locale: { type: 'object', description: 'Updated locale translations' },
|
|
87
|
+
},
|
|
88
|
+
required: ['roleId'],
|
|
89
|
+
},
|
|
90
|
+
})
|
|
91
|
+
async updateRole(
|
|
92
|
+
args: { roleId: number; slug?: string; locale?: Record<string, any> },
|
|
93
|
+
context: McpContext,
|
|
94
|
+
): Promise<any> {
|
|
95
|
+
const { roleId, ...data } = args;
|
|
96
|
+
return this.roleService.update(roleId, data as any, context.locale);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
@McpTool({
|
|
100
|
+
name: 'core.roles.delete',
|
|
101
|
+
description: 'Deletes one or more roles by their IDs. Admin only.',
|
|
102
|
+
inputSchema: {
|
|
103
|
+
type: 'object',
|
|
104
|
+
properties: {
|
|
105
|
+
ids: { type: 'array', items: { type: 'number' }, description: 'Array of role IDs to delete' },
|
|
106
|
+
},
|
|
107
|
+
required: ['ids'],
|
|
108
|
+
},
|
|
109
|
+
})
|
|
110
|
+
async deleteRoles(args: { ids: number[] }, context: McpContext): Promise<any> {
|
|
111
|
+
return this.roleService.delete({ ids: args.ids }, context.locale);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
@McpTool({
|
|
115
|
+
name: 'core.roles.users.list',
|
|
116
|
+
description: 'Lists users assigned to a role. Admin only.',
|
|
117
|
+
inputSchema: {
|
|
118
|
+
type: 'object',
|
|
119
|
+
properties: {
|
|
120
|
+
roleId: { type: 'number', description: 'Role ID' },
|
|
121
|
+
page: { type: 'number', description: 'Page number (default: 1)' },
|
|
122
|
+
pageSize: { type: 'number', description: 'Items per page (default: 20)' },
|
|
123
|
+
},
|
|
124
|
+
required: ['roleId'],
|
|
125
|
+
},
|
|
126
|
+
readOnly: true,
|
|
127
|
+
})
|
|
128
|
+
async listRoleUsers(args: { roleId: number; page?: number; pageSize?: number }, _context: McpContext): Promise<any> {
|
|
129
|
+
return this.roleService.listUsers(args.roleId, {
|
|
130
|
+
page: args.page ?? 1,
|
|
131
|
+
pageSize: args.pageSize ?? 20,
|
|
132
|
+
search: '',
|
|
133
|
+
sortField: 'id',
|
|
134
|
+
sortOrder: PageOrderDirection.Asc,
|
|
135
|
+
fields: '',
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
@McpTool({
|
|
140
|
+
name: 'core.roles.users.update',
|
|
141
|
+
description: 'Replaces all users assigned to a role. Admin only.',
|
|
142
|
+
inputSchema: {
|
|
143
|
+
type: 'object',
|
|
144
|
+
properties: {
|
|
145
|
+
roleId: { type: 'number', description: 'Role ID' },
|
|
146
|
+
ids: { type: 'array', items: { type: 'number' }, description: 'User IDs to assign' },
|
|
147
|
+
},
|
|
148
|
+
required: ['roleId', 'ids'],
|
|
149
|
+
},
|
|
150
|
+
})
|
|
151
|
+
async updateRoleUsers(args: { roleId: number; ids: number[] }, _context: McpContext): Promise<any> {
|
|
152
|
+
return this.roleService.updateUsers(args.roleId, { ids: args.ids });
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
@McpTool({
|
|
156
|
+
name: 'core.roles.menus.list',
|
|
157
|
+
description: 'Lists menus assigned to a role. Admin only.',
|
|
158
|
+
inputSchema: {
|
|
159
|
+
type: 'object',
|
|
160
|
+
properties: {
|
|
161
|
+
roleId: { type: 'number', description: 'Role ID' },
|
|
162
|
+
page: { type: 'number', description: 'Page number (default: 1)' },
|
|
163
|
+
pageSize: { type: 'number', description: 'Items per page (default: 20)' },
|
|
164
|
+
},
|
|
165
|
+
required: ['roleId'],
|
|
166
|
+
},
|
|
167
|
+
readOnly: true,
|
|
168
|
+
})
|
|
169
|
+
async listRoleMenus(args: { roleId: number; page?: number; pageSize?: number }, context: McpContext): Promise<any> {
|
|
170
|
+
return this.roleService.listMenus(context.locale, args.roleId, {
|
|
171
|
+
page: args.page ?? 1,
|
|
172
|
+
pageSize: args.pageSize ?? 20,
|
|
173
|
+
search: '',
|
|
174
|
+
sortField: 'id',
|
|
175
|
+
sortOrder: PageOrderDirection.Asc,
|
|
176
|
+
fields: '',
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
@McpTool({
|
|
181
|
+
name: 'core.roles.menus.update',
|
|
182
|
+
description: 'Replaces all menus assigned to a role. Admin only.',
|
|
183
|
+
inputSchema: {
|
|
184
|
+
type: 'object',
|
|
185
|
+
properties: {
|
|
186
|
+
roleId: { type: 'number', description: 'Role ID' },
|
|
187
|
+
ids: { type: 'array', items: { type: 'number' }, description: 'Menu IDs to assign' },
|
|
188
|
+
},
|
|
189
|
+
required: ['roleId', 'ids'],
|
|
190
|
+
},
|
|
191
|
+
})
|
|
192
|
+
async updateRoleMenus(args: { roleId: number; ids: number[] }, _context: McpContext): Promise<any> {
|
|
193
|
+
return this.roleService.updateMenus(args.roleId, { ids: args.ids });
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
@McpTool({
|
|
197
|
+
name: 'core.roles.routes.list',
|
|
198
|
+
description: 'Lists routes assigned to a role with optional URL filter. Admin only.',
|
|
199
|
+
inputSchema: {
|
|
200
|
+
type: 'object',
|
|
201
|
+
properties: {
|
|
202
|
+
roleId: { type: 'number', description: 'Role ID' },
|
|
203
|
+
page: { type: 'number', description: 'Page number (default: 1)' },
|
|
204
|
+
pageSize: { type: 'number', description: 'Items per page (default: 20)' },
|
|
205
|
+
search: { type: 'string', description: 'Search filter for URL' },
|
|
206
|
+
method: { type: 'string', description: 'HTTP method filter (GET, POST, etc.)' },
|
|
207
|
+
},
|
|
208
|
+
required: ['roleId'],
|
|
209
|
+
},
|
|
210
|
+
readOnly: true,
|
|
211
|
+
})
|
|
212
|
+
async listRoleRoutes(
|
|
213
|
+
args: { roleId: number; page?: number; pageSize?: number; search?: string; method?: string },
|
|
214
|
+
_context: McpContext,
|
|
215
|
+
): Promise<any> {
|
|
216
|
+
return this.roleService.listRoutes(
|
|
217
|
+
args.roleId,
|
|
218
|
+
{
|
|
219
|
+
page: args.page ?? 1,
|
|
220
|
+
pageSize: args.pageSize ?? 20,
|
|
221
|
+
search: '',
|
|
222
|
+
sortField: 'id',
|
|
223
|
+
sortOrder: PageOrderDirection.Asc,
|
|
224
|
+
fields: '',
|
|
225
|
+
},
|
|
226
|
+
args.search,
|
|
227
|
+
'contains',
|
|
228
|
+
args.method,
|
|
229
|
+
);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
@McpTool({
|
|
233
|
+
name: 'core.roles.routes.update',
|
|
234
|
+
description: 'Replaces all routes assigned to a role. Admin only.',
|
|
235
|
+
inputSchema: {
|
|
236
|
+
type: 'object',
|
|
237
|
+
properties: {
|
|
238
|
+
roleId: { type: 'number', description: 'Role ID' },
|
|
239
|
+
ids: { type: 'array', items: { type: 'number' }, description: 'Route IDs to assign' },
|
|
240
|
+
},
|
|
241
|
+
required: ['roleId', 'ids'],
|
|
242
|
+
},
|
|
243
|
+
})
|
|
244
|
+
async updateRoleRoutes(args: { roleId: number; ids: number[] }, _context: McpContext): Promise<any> {
|
|
245
|
+
return this.roleService.updateRoutes(args.roleId, { ids: args.ids });
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
@McpTool({
|
|
249
|
+
name: 'core.roles.screens.list',
|
|
250
|
+
description: 'Lists screens assigned to a role. Admin only.',
|
|
251
|
+
inputSchema: {
|
|
252
|
+
type: 'object',
|
|
253
|
+
properties: {
|
|
254
|
+
roleId: { type: 'number', description: 'Role ID' },
|
|
255
|
+
page: { type: 'number', description: 'Page number (default: 1)' },
|
|
256
|
+
pageSize: { type: 'number', description: 'Items per page (default: 20)' },
|
|
257
|
+
},
|
|
258
|
+
required: ['roleId'],
|
|
259
|
+
},
|
|
260
|
+
readOnly: true,
|
|
261
|
+
})
|
|
262
|
+
async listRoleScreens(args: { roleId: number; page?: number; pageSize?: number }, context: McpContext): Promise<any> {
|
|
263
|
+
return this.roleService.listScreens(context.locale, args.roleId, {
|
|
264
|
+
page: args.page ?? 1,
|
|
265
|
+
pageSize: args.pageSize ?? 20,
|
|
266
|
+
search: '',
|
|
267
|
+
sortField: 'id',
|
|
268
|
+
sortOrder: PageOrderDirection.Asc,
|
|
269
|
+
fields: '',
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
@McpTool({
|
|
274
|
+
name: 'core.roles.screens.update',
|
|
275
|
+
description: 'Replaces all screens assigned to a role. Admin only.',
|
|
276
|
+
inputSchema: {
|
|
277
|
+
type: 'object',
|
|
278
|
+
properties: {
|
|
279
|
+
roleId: { type: 'number', description: 'Role ID' },
|
|
280
|
+
ids: { type: 'array', items: { type: 'number' }, description: 'Screen IDs to assign' },
|
|
281
|
+
},
|
|
282
|
+
required: ['roleId', 'ids'],
|
|
283
|
+
},
|
|
284
|
+
})
|
|
285
|
+
async updateRoleScreens(args: { roleId: number; ids: number[] }, _context: McpContext): Promise<any> {
|
|
286
|
+
return this.roleService.updateScreens(args.roleId, { ids: args.ids });
|
|
287
|
+
}
|
|
288
|
+
}
|