@hed-hog/core 0.0.368 → 0.0.370
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/hedhog/data/integration_event_catalog.yaml +118 -118
- package/hedhog/data/route.yaml +156 -207
- package/hedhog/table/event_webhook.yaml +55 -55
- package/hedhog/table/event_webhook_delivery_log.yaml +66 -66
- package/hedhog/table/event_webhook_event.yaml +26 -26
- package/hedhog/table/integration_event_catalog.yaml +41 -41
- package/hedhog/table/mcp_conversation.yaml +12 -12
- package/hedhog/table/mcp_conversation_message.yaml +23 -23
- package/hedhog/table/mcp_tool_call_log.yaml +22 -22
- package/hedhog/table/route.yaml +33 -33
- package/hedhog/table/webhook_call_log.yaml +46 -46
- package/hedhog/table/webhook_integration.yaml +43 -43
- package/package.json +3 -3
- package/src/integration/types/event.types.ts +4 -4
- package/src/mcp/decorators/mcp-tool.decorator.ts +7 -7
- package/src/mcp/guards/mcp-permission.guard.ts +51 -51
- package/src/mcp/interfaces/mcp-tool-definition.interface.ts +6 -6
- package/src/mcp/mcp-server.service.ts +87 -87
- package/src/mcp/types/mcp-context.type.ts +6 -6
- package/src/mcp-chat/dto/create-conversation.dto.ts +7 -7
- package/src/mcp-chat/dto/send-message.dto.ts +7 -7
- package/src/notification/events/notification-stale-progress-check.event.ts +5 -5
- package/src/route/dto/create.dto.ts +32 -32
- package/src/route/dto/update.dto.ts +31 -31
- package/src/webhook-integration/integration-event-catalog.controller.ts +50 -50
- package/src/webhook-integration/integration-event-catalog.service.ts +117 -117
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
import { DeleteDTO, Role } from '@hed-hog/api';
|
|
2
|
-
import { Pagination } from '@hed-hog/api-pagination';
|
|
3
|
-
import {
|
|
4
|
-
Body,
|
|
5
|
-
Controller,
|
|
6
|
-
Delete,
|
|
7
|
-
Get,
|
|
8
|
-
Param,
|
|
9
|
-
ParseIntPipe,
|
|
10
|
-
Patch,
|
|
11
|
-
Post,
|
|
12
|
-
} from '@nestjs/common';
|
|
13
|
-
import { IntegrationEventCatalogService } from './integration-event-catalog.service';
|
|
14
|
-
|
|
15
|
-
@Role()
|
|
16
|
-
@Controller('integration-event-catalog')
|
|
17
|
-
export class IntegrationEventCatalogController {
|
|
18
|
-
constructor(private readonly service: IntegrationEventCatalogService) {}
|
|
19
|
-
|
|
20
|
-
@Get()
|
|
21
|
-
list(@Pagination() paginationParams) {
|
|
22
|
-
return this.service.list(paginationParams);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
@Get('options')
|
|
26
|
-
options() {
|
|
27
|
-
return this.service.options();
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
@Get(':id')
|
|
31
|
-
get(@Param('id', ParseIntPipe) id: number) {
|
|
32
|
-
return this.service.get(id);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
@Post()
|
|
36
|
-
create(@Body() data: any) {
|
|
37
|
-
return this.service.create(data);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
@Patch(':id')
|
|
41
|
-
update(@Param('id', ParseIntPipe) id: number, @Body() data: any) {
|
|
42
|
-
return this.service.update(id, data);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
@Delete()
|
|
46
|
-
delete(@Body() data: DeleteDTO) {
|
|
47
|
-
return this.service.delete(data);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
1
|
+
import { DeleteDTO, Role } from '@hed-hog/api';
|
|
2
|
+
import { Pagination } from '@hed-hog/api-pagination';
|
|
3
|
+
import {
|
|
4
|
+
Body,
|
|
5
|
+
Controller,
|
|
6
|
+
Delete,
|
|
7
|
+
Get,
|
|
8
|
+
Param,
|
|
9
|
+
ParseIntPipe,
|
|
10
|
+
Patch,
|
|
11
|
+
Post,
|
|
12
|
+
} from '@nestjs/common';
|
|
13
|
+
import { IntegrationEventCatalogService } from './integration-event-catalog.service';
|
|
14
|
+
|
|
15
|
+
@Role()
|
|
16
|
+
@Controller('integration-event-catalog')
|
|
17
|
+
export class IntegrationEventCatalogController {
|
|
18
|
+
constructor(private readonly service: IntegrationEventCatalogService) {}
|
|
19
|
+
|
|
20
|
+
@Get()
|
|
21
|
+
list(@Pagination() paginationParams) {
|
|
22
|
+
return this.service.list(paginationParams);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@Get('options')
|
|
26
|
+
options() {
|
|
27
|
+
return this.service.options();
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@Get(':id')
|
|
31
|
+
get(@Param('id', ParseIntPipe) id: number) {
|
|
32
|
+
return this.service.get(id);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@Post()
|
|
36
|
+
create(@Body() data: any) {
|
|
37
|
+
return this.service.create(data);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
@Patch(':id')
|
|
41
|
+
update(@Param('id', ParseIntPipe) id: number, @Body() data: any) {
|
|
42
|
+
return this.service.update(id, data);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
@Delete()
|
|
46
|
+
delete(@Body() data: DeleteDTO) {
|
|
47
|
+
return this.service.delete(data);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
@@ -1,117 +1,117 @@
|
|
|
1
|
-
import { DeleteDTO } from '@hed-hog/api';
|
|
2
|
-
import { PaginationDTO, PaginationService } from '@hed-hog/api-pagination';
|
|
3
|
-
import { PrismaService } from '@hed-hog/api-prisma';
|
|
4
|
-
import {
|
|
5
|
-
BadRequestException,
|
|
6
|
-
Injectable,
|
|
7
|
-
NotFoundException,
|
|
8
|
-
} from '@nestjs/common';
|
|
9
|
-
|
|
10
|
-
@Injectable()
|
|
11
|
-
export class IntegrationEventCatalogService {
|
|
12
|
-
constructor(
|
|
13
|
-
private readonly prisma: PrismaService,
|
|
14
|
-
private readonly pagination: PaginationService,
|
|
15
|
-
) {}
|
|
16
|
-
|
|
17
|
-
private get delegate() {
|
|
18
|
-
return (this.prisma as any).integration_event_catalog;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
async list(paginationParams: PaginationDTO) {
|
|
22
|
-
const fields = ['slug', 'name', 'module', 'description', 'status'];
|
|
23
|
-
const OR = this.prisma.createInsensitiveSearch(fields, paginationParams);
|
|
24
|
-
|
|
25
|
-
return this.pagination.paginate(this.delegate, paginationParams, {
|
|
26
|
-
where: OR.length > 0 ? { OR } : {},
|
|
27
|
-
orderBy: [{ module: 'asc' }, { slug: 'asc' }],
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
async options() {
|
|
32
|
-
return this.delegate.findMany({
|
|
33
|
-
where: { status: 'active' },
|
|
34
|
-
orderBy: [{ module: 'asc' }, { slug: 'asc' }],
|
|
35
|
-
select: {
|
|
36
|
-
id: true,
|
|
37
|
-
slug: true,
|
|
38
|
-
name: true,
|
|
39
|
-
module: true,
|
|
40
|
-
description: true,
|
|
41
|
-
},
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
async get(id: number) {
|
|
46
|
-
const record = await this.delegate.findUnique({ where: { id } });
|
|
47
|
-
if (!record) {
|
|
48
|
-
throw new NotFoundException(`Event catalog item with id ${id} not found.`);
|
|
49
|
-
}
|
|
50
|
-
return record;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
async create(data: any) {
|
|
54
|
-
await this.ensureSlugAvailable(data.slug);
|
|
55
|
-
return this.delegate.create({
|
|
56
|
-
data: this.normalize(data),
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
async update(id: number, data: any) {
|
|
61
|
-
const existing = await this.get(id);
|
|
62
|
-
if (data.slug && data.slug !== existing.slug) {
|
|
63
|
-
await this.ensureSlugAvailable(data.slug);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
return this.delegate.update({
|
|
67
|
-
where: { id },
|
|
68
|
-
data: this.normalize(data, true),
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
async delete(data: DeleteDTO) {
|
|
73
|
-
if (!data.ids?.length) {
|
|
74
|
-
throw new BadRequestException('You must select at least one item to delete.');
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
return this.delegate.deleteMany({
|
|
78
|
-
where: { id: { in: data.ids } },
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
private async ensureSlugAvailable(slug: string) {
|
|
83
|
-
const existing = await this.delegate.findUnique({
|
|
84
|
-
where: { slug: String(slug || '').trim() },
|
|
85
|
-
select: { id: true },
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
if (existing) {
|
|
89
|
-
throw new BadRequestException(`Event "${slug}" already exists.`);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
private normalize(data: any, partial = false) {
|
|
94
|
-
const normalized: Record<string, any> = {};
|
|
95
|
-
const assign = (key: string, value: any) => {
|
|
96
|
-
if (!partial || value !== undefined) {
|
|
97
|
-
normalized[key] = value;
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
assign('slug', String(data.slug ?? '').trim());
|
|
102
|
-
assign('name', String(data.name ?? '').trim());
|
|
103
|
-
assign('module', String(data.module ?? '').trim());
|
|
104
|
-
assign(
|
|
105
|
-
'description',
|
|
106
|
-
data.description === undefined || data.description === null
|
|
107
|
-
? partial
|
|
108
|
-
? undefined
|
|
109
|
-
: null
|
|
110
|
-
: String(data.description).trim() || null,
|
|
111
|
-
);
|
|
112
|
-
assign('status', data.status === 'inactive' ? 'inactive' : 'active');
|
|
113
|
-
|
|
114
|
-
return normalized;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
1
|
+
import { DeleteDTO } from '@hed-hog/api';
|
|
2
|
+
import { PaginationDTO, PaginationService } from '@hed-hog/api-pagination';
|
|
3
|
+
import { PrismaService } from '@hed-hog/api-prisma';
|
|
4
|
+
import {
|
|
5
|
+
BadRequestException,
|
|
6
|
+
Injectable,
|
|
7
|
+
NotFoundException,
|
|
8
|
+
} from '@nestjs/common';
|
|
9
|
+
|
|
10
|
+
@Injectable()
|
|
11
|
+
export class IntegrationEventCatalogService {
|
|
12
|
+
constructor(
|
|
13
|
+
private readonly prisma: PrismaService,
|
|
14
|
+
private readonly pagination: PaginationService,
|
|
15
|
+
) {}
|
|
16
|
+
|
|
17
|
+
private get delegate() {
|
|
18
|
+
return (this.prisma as any).integration_event_catalog;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
async list(paginationParams: PaginationDTO) {
|
|
22
|
+
const fields = ['slug', 'name', 'module', 'description', 'status'];
|
|
23
|
+
const OR = this.prisma.createInsensitiveSearch(fields, paginationParams);
|
|
24
|
+
|
|
25
|
+
return this.pagination.paginate(this.delegate, paginationParams, {
|
|
26
|
+
where: OR.length > 0 ? { OR } : {},
|
|
27
|
+
orderBy: [{ module: 'asc' }, { slug: 'asc' }],
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
async options() {
|
|
32
|
+
return this.delegate.findMany({
|
|
33
|
+
where: { status: 'active' },
|
|
34
|
+
orderBy: [{ module: 'asc' }, { slug: 'asc' }],
|
|
35
|
+
select: {
|
|
36
|
+
id: true,
|
|
37
|
+
slug: true,
|
|
38
|
+
name: true,
|
|
39
|
+
module: true,
|
|
40
|
+
description: true,
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
async get(id: number) {
|
|
46
|
+
const record = await this.delegate.findUnique({ where: { id } });
|
|
47
|
+
if (!record) {
|
|
48
|
+
throw new NotFoundException(`Event catalog item with id ${id} not found.`);
|
|
49
|
+
}
|
|
50
|
+
return record;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
async create(data: any) {
|
|
54
|
+
await this.ensureSlugAvailable(data.slug);
|
|
55
|
+
return this.delegate.create({
|
|
56
|
+
data: this.normalize(data),
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
async update(id: number, data: any) {
|
|
61
|
+
const existing = await this.get(id);
|
|
62
|
+
if (data.slug && data.slug !== existing.slug) {
|
|
63
|
+
await this.ensureSlugAvailable(data.slug);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return this.delegate.update({
|
|
67
|
+
where: { id },
|
|
68
|
+
data: this.normalize(data, true),
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
async delete(data: DeleteDTO) {
|
|
73
|
+
if (!data.ids?.length) {
|
|
74
|
+
throw new BadRequestException('You must select at least one item to delete.');
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return this.delegate.deleteMany({
|
|
78
|
+
where: { id: { in: data.ids } },
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
private async ensureSlugAvailable(slug: string) {
|
|
83
|
+
const existing = await this.delegate.findUnique({
|
|
84
|
+
where: { slug: String(slug || '').trim() },
|
|
85
|
+
select: { id: true },
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
if (existing) {
|
|
89
|
+
throw new BadRequestException(`Event "${slug}" already exists.`);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
private normalize(data: any, partial = false) {
|
|
94
|
+
const normalized: Record<string, any> = {};
|
|
95
|
+
const assign = (key: string, value: any) => {
|
|
96
|
+
if (!partial || value !== undefined) {
|
|
97
|
+
normalized[key] = value;
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
assign('slug', String(data.slug ?? '').trim());
|
|
102
|
+
assign('name', String(data.name ?? '').trim());
|
|
103
|
+
assign('module', String(data.module ?? '').trim());
|
|
104
|
+
assign(
|
|
105
|
+
'description',
|
|
106
|
+
data.description === undefined || data.description === null
|
|
107
|
+
? partial
|
|
108
|
+
? undefined
|
|
109
|
+
: null
|
|
110
|
+
: String(data.description).trim() || null,
|
|
111
|
+
);
|
|
112
|
+
assign('status', data.status === 'inactive' ? 'inactive' : 'active');
|
|
113
|
+
|
|
114
|
+
return normalized;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|