@hed-hog/core 0.0.355 → 0.0.358
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/ai/ai.service.d.ts +3 -12
- package/dist/ai/ai.service.d.ts.map +1 -1
- package/dist/ai/ai.service.js +34 -125
- package/dist/ai/ai.service.js.map +1 -1
- package/dist/auth/guards/auth.guard.d.ts +6 -1
- package/dist/auth/guards/auth.guard.d.ts.map +1 -1
- package/dist/auth/guards/auth.guard.js +33 -2
- package/dist/auth/guards/auth.guard.js.map +1 -1
- package/dist/core.module.d.ts.map +1 -1
- package/dist/core.module.js +3 -3
- package/dist/core.module.js.map +1 -1
- package/dist/file/file.controller.d.ts +4 -2
- package/dist/file/file.controller.d.ts.map +1 -1
- package/dist/file/file.controller.js +44 -38
- package/dist/file/file.controller.js.map +1 -1
- package/dist/file/file.service.d.ts +2 -2
- package/dist/file/file.service.d.ts.map +1 -1
- package/dist/file/file.service.js +58 -89
- package/dist/file/file.service.js.map +1 -1
- package/dist/file/provider/azure.provider.d.ts.map +1 -1
- package/dist/file/provider/azure.provider.js +10 -15
- package/dist/file/provider/azure.provider.js.map +1 -1
- package/dist/file/provider/gcs.provider.d.ts.map +1 -1
- package/dist/file/provider/gcs.provider.js +8 -9
- package/dist/file/provider/gcs.provider.js.map +1 -1
- package/dist/file/provider/local.provider.d.ts.map +1 -1
- package/dist/file/provider/local.provider.js +11 -10
- package/dist/file/provider/local.provider.js.map +1 -1
- package/dist/file/provider/provider.enum.d.ts +2 -1
- package/dist/file/provider/provider.enum.d.ts.map +1 -1
- package/dist/file/provider/provider.enum.js +1 -0
- package/dist/file/provider/provider.enum.js.map +1 -1
- package/dist/file/provider/provider.factory.d.ts +1 -1
- package/dist/file/provider/provider.factory.d.ts.map +1 -1
- package/dist/file/provider/provider.factory.js +18 -5
- package/dist/file/provider/provider.factory.js.map +1 -1
- package/dist/file/provider/s3.provider.d.ts.map +1 -1
- package/dist/file/provider/s3.provider.js +4 -20
- package/dist/file/provider/s3.provider.js.map +1 -1
- package/dist/file/provider/spaces.provider.d.ts +27 -0
- package/dist/file/provider/spaces.provider.d.ts.map +1 -0
- package/dist/file/provider/spaces.provider.js +203 -0
- package/dist/file/provider/spaces.provider.js.map +1 -0
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -3
- package/dist/index.js.map +1 -1
- package/dist/integration-profile/dto/create.dto.d.ts +9 -0
- package/dist/integration-profile/dto/create.dto.d.ts.map +1 -0
- package/dist/integration-profile/dto/create.dto.js +54 -0
- package/dist/integration-profile/dto/create.dto.js.map +1 -0
- package/dist/integration-profile/dto/export.dto.d.ts +5 -0
- package/dist/integration-profile/dto/export.dto.d.ts.map +1 -0
- package/dist/integration-profile/dto/export.dto.js +29 -0
- package/dist/integration-profile/dto/export.dto.js.map +1 -0
- package/dist/integration-profile/dto/import-confirm.dto.d.ts +17 -0
- package/dist/integration-profile/dto/import-confirm.dto.d.ts.map +1 -0
- package/dist/integration-profile/dto/import-confirm.dto.js +77 -0
- package/dist/integration-profile/dto/import-confirm.dto.js.map +1 -0
- package/dist/integration-profile/dto/update.dto.d.ts.map +1 -0
- package/dist/integration-profile/dto/update.dto.js.map +1 -0
- package/dist/integration-profile/integration-profile.controller.d.ts +142 -0
- package/dist/integration-profile/integration-profile.controller.d.ts.map +1 -0
- package/dist/integration-profile/integration-profile.controller.js +166 -0
- package/dist/integration-profile/integration-profile.controller.js.map +1 -0
- package/dist/integration-profile/integration-profile.module.d.ts +3 -0
- package/dist/integration-profile/integration-profile.module.d.ts.map +1 -0
- package/dist/{mail-profile/mail-profile.module.js → integration-profile/integration-profile.module.js} +11 -13
- package/dist/integration-profile/integration-profile.module.js.map +1 -0
- package/dist/integration-profile/integration-profile.service.d.ts +160 -0
- package/dist/integration-profile/integration-profile.service.d.ts.map +1 -0
- package/dist/integration-profile/integration-profile.service.js +609 -0
- package/dist/integration-profile/integration-profile.service.js.map +1 -0
- package/dist/integration-profile/integration-profile.utils.d.ts +30 -0
- package/dist/integration-profile/integration-profile.utils.d.ts.map +1 -0
- package/dist/integration-profile/integration-profile.utils.js +156 -0
- package/dist/integration-profile/integration-profile.utils.js.map +1 -0
- package/dist/mail/mail.module.d.ts.map +1 -1
- package/dist/mail/mail.module.js +36 -23
- package/dist/mail/mail.module.js.map +1 -1
- package/dist/mail/mail.service.d.ts +4 -2
- package/dist/mail/mail.service.d.ts.map +1 -1
- package/dist/mail/mail.service.js +33 -51
- package/dist/mail/mail.service.js.map +1 -1
- package/dist/mcp/guards/mcp-auth.guard.js +1 -1
- package/dist/mcp/guards/mcp-auth.guard.js.map +1 -1
- package/dist/mcp/mcp-api-key.controller.d.ts +2 -0
- package/dist/mcp/mcp-api-key.controller.d.ts.map +1 -1
- package/dist/mcp/mcp-api-key.controller.js +1 -1
- package/dist/mcp/mcp-api-key.controller.js.map +1 -1
- package/dist/mcp/mcp-api-key.service.d.ts +2 -1
- package/dist/mcp/mcp-api-key.service.d.ts.map +1 -1
- package/dist/mcp/mcp-api-key.service.js +6 -2
- package/dist/mcp/mcp-api-key.service.js.map +1 -1
- package/dist/mcp/mcp.module.d.ts.map +1 -1
- package/dist/mcp/mcp.module.js +3 -5
- package/dist/mcp/mcp.module.js.map +1 -1
- package/dist/mcp-chat/mcp-chat.service.d.ts.map +1 -1
- package/dist/mcp-chat/mcp-chat.service.js +17 -16
- package/dist/mcp-chat/mcp-chat.service.js.map +1 -1
- package/dist/oauth/interfaces/OAuthProvider.d.ts +1 -1
- package/dist/oauth/interfaces/OAuthProvider.d.ts.map +1 -1
- package/dist/oauth/oauth.controller.d.ts +4 -1
- package/dist/oauth/oauth.controller.d.ts.map +1 -1
- package/dist/oauth/oauth.controller.js +31 -5
- package/dist/oauth/oauth.controller.js.map +1 -1
- package/dist/oauth/oauth.service.d.ts +12 -1
- package/dist/oauth/oauth.service.d.ts.map +1 -1
- package/dist/oauth/oauth.service.js +125 -23
- package/dist/oauth/oauth.service.js.map +1 -1
- package/dist/oauth/providers/abstract.provider.d.ts +1 -1
- package/dist/oauth/providers/abstract.provider.d.ts.map +1 -1
- package/dist/oauth/providers/facebook.provider.d.ts +5 -2
- package/dist/oauth/providers/facebook.provider.d.ts.map +1 -1
- package/dist/oauth/providers/facebook.provider.js +34 -19
- package/dist/oauth/providers/facebook.provider.js.map +1 -1
- package/dist/oauth/providers/github.provider.d.ts +6 -2
- package/dist/oauth/providers/github.provider.d.ts.map +1 -1
- package/dist/oauth/providers/github.provider.js +43 -20
- package/dist/oauth/providers/github.provider.js.map +1 -1
- package/dist/oauth/providers/google.provider.d.ts +5 -2
- package/dist/oauth/providers/google.provider.d.ts.map +1 -1
- package/dist/oauth/providers/google.provider.js +34 -19
- package/dist/oauth/providers/google.provider.js.map +1 -1
- package/dist/oauth/providers/microsoft-entra-id.provider.d.ts +5 -2
- package/dist/oauth/providers/microsoft-entra-id.provider.d.ts.map +1 -1
- package/dist/oauth/providers/microsoft-entra-id.provider.js +43 -40
- package/dist/oauth/providers/microsoft-entra-id.provider.js.map +1 -1
- package/dist/oauth/providers/microsoft.provider.d.ts +5 -2
- package/dist/oauth/providers/microsoft.provider.d.ts.map +1 -1
- package/dist/oauth/providers/microsoft.provider.js +34 -19
- package/dist/oauth/providers/microsoft.provider.js.map +1 -1
- package/dist/profile/profile.controller.js +1 -1
- package/dist/profile/profile.controller.js.map +1 -1
- package/dist/security/security.service.d.ts +2 -0
- package/dist/security/security.service.d.ts.map +1 -1
- package/dist/security/security.service.js +21 -0
- package/dist/security/security.service.js.map +1 -1
- package/dist/setting/setting.service.d.ts +26 -1
- package/dist/setting/setting.service.d.ts.map +1 -1
- package/dist/setting/setting.service.js +240 -7
- package/dist/setting/setting.service.js.map +1 -1
- package/dist/user/user.controller.d.ts +2 -1
- package/dist/user/user.controller.d.ts.map +1 -1
- package/dist/user/user.controller.js +5 -4
- package/dist/user/user.controller.js.map +1 -1
- package/dist/user/user.service.d.ts +4 -2
- package/dist/user/user.service.d.ts.map +1 -1
- package/dist/user/user.service.js +19 -4
- package/dist/user/user.service.js.map +1 -1
- package/dist/webhook-integration/dto/webhook-action.dto.d.ts +17 -2
- package/dist/webhook-integration/dto/webhook-action.dto.d.ts.map +1 -1
- package/dist/webhook-integration/dto/webhook-action.dto.js +93 -2
- package/dist/webhook-integration/dto/webhook-action.dto.js.map +1 -1
- package/dist/webhook-integration/event-webhook.controller.d.ts +1 -0
- package/dist/webhook-integration/event-webhook.controller.d.ts.map +1 -1
- package/dist/webhook-integration/event-webhook.controller.js +10 -0
- package/dist/webhook-integration/event-webhook.controller.js.map +1 -1
- package/dist/webhook-integration/event-webhook.service.d.ts +2 -0
- package/dist/webhook-integration/event-webhook.service.d.ts.map +1 -1
- package/dist/webhook-integration/event-webhook.service.js +30 -0
- package/dist/webhook-integration/event-webhook.service.js.map +1 -1
- package/dist/webhook-integration/webhook-command.registry.d.ts +15 -0
- package/dist/webhook-integration/webhook-command.registry.d.ts.map +1 -0
- package/dist/webhook-integration/webhook-command.registry.js +36 -0
- package/dist/webhook-integration/webhook-command.registry.js.map +1 -0
- package/dist/webhook-integration/webhook-integration.controller.d.ts +20 -0
- package/dist/webhook-integration/webhook-integration.controller.d.ts.map +1 -1
- package/dist/webhook-integration/webhook-integration.controller.js +48 -0
- package/dist/webhook-integration/webhook-integration.controller.js.map +1 -1
- package/dist/webhook-integration/webhook-integration.module.d.ts.map +1 -1
- package/dist/webhook-integration/webhook-integration.module.js +5 -0
- package/dist/webhook-integration/webhook-integration.module.js.map +1 -1
- package/dist/webhook-integration/webhook-integration.service.d.ts +27 -2
- package/dist/webhook-integration/webhook-integration.service.d.ts.map +1 -1
- package/dist/webhook-integration/webhook-integration.service.js +377 -50
- package/dist/webhook-integration/webhook-integration.service.js.map +1 -1
- package/hedhog/data/file_provider.yaml +9 -1
- package/hedhog/data/integration_provider.yaml +148 -0
- package/hedhog/data/integration_type.yaml +29 -0
- package/hedhog/data/menu.yaml +6 -21
- package/hedhog/data/role.yaml +8 -0
- package/hedhog/data/route.yaml +73 -373
- package/hedhog/data/setting_group.yaml +209 -365
- package/hedhog/data/setting_subgroup.yaml +21 -13
- package/hedhog/frontend/app/account/components/connected-accounts.tsx.ejs +25 -20
- package/hedhog/frontend/app/account/components/tokens.tsx.ejs +421 -0
- package/hedhog/frontend/app/account/layout.tsx.ejs +6 -3
- package/hedhog/frontend/app/account/mcp-tokens/page.tsx.ejs +2 -2
- package/hedhog/frontend/app/account/tokens/page.tsx.ejs +5 -0
- package/hedhog/frontend/app/configurations/[slug]/components/setting-field.tsx.ejs +938 -225
- package/hedhog/frontend/app/configurations/layout.tsx.ejs +1 -1
- package/hedhog/frontend/app/dashboard/dashboard-home-tabs.tsx.ejs +3 -1
- package/hedhog/frontend/app/integration/profiles/page.tsx.ejs +1830 -0
- package/hedhog/frontend/app/integrations-webhooks/page.tsx.ejs +829 -128
- package/hedhog/frontend/app/mail/profiles/page.tsx.ejs +1 -820
- package/hedhog/frontend/app/setting-list/page.tsx.ejs +229 -395
- package/hedhog/frontend/app/users/permissions.tsx.ejs +79 -2
- package/hedhog/frontend/app/users/user-sheet.tsx.ejs +7 -2
- package/hedhog/frontend/messages/en.json +239 -3
- package/hedhog/frontend/messages/pt.json +239 -3
- package/hedhog/table/file.yaml +1 -1
- package/hedhog/table/integration_profile.yaml +34 -0
- package/hedhog/table/integration_provider.yaml +23 -0
- package/hedhog/table/integration_type.yaml +19 -0
- package/hedhog/table/mcp_api_key.yaml +4 -0
- package/hedhog/table/webhook_action.yaml +141 -85
- package/package.json +4 -3
- package/src/ai/ai.service.ts +35 -153
- package/src/auth/guards/auth.guard.ts +32 -0
- package/src/core.module.ts +3 -3
- package/src/file/file.controller.ts +51 -42
- package/src/file/file.service.ts +67 -104
- package/src/file/provider/azure.provider.ts +14 -28
- package/src/file/provider/gcs.provider.ts +9 -9
- package/src/file/provider/local.provider.ts +10 -13
- package/src/file/provider/provider.enum.ts +1 -0
- package/src/file/provider/provider.factory.ts +21 -6
- package/src/file/provider/s3.provider.ts +4 -20
- package/src/file/provider/spaces.provider.ts +246 -0
- package/src/index.ts +6 -3
- package/src/integration-profile/dto/create.dto.ts +44 -0
- package/src/integration-profile/dto/export.dto.ts +15 -0
- package/src/integration-profile/dto/import-confirm.dto.ts +61 -0
- package/src/integration-profile/integration-profile.controller.ts +131 -0
- package/src/integration-profile/integration-profile.module.ts +16 -0
- package/src/integration-profile/integration-profile.service.ts +793 -0
- package/src/integration-profile/integration-profile.utils.ts +173 -0
- package/src/mail/mail.module.ts +41 -22
- package/src/mail/mail.service.ts +40 -64
- package/src/mcp/guards/mcp-auth.guard.ts +1 -1
- package/src/mcp/mcp-api-key.controller.ts +2 -2
- package/src/mcp/mcp-api-key.service.ts +6 -2
- package/src/mcp/mcp.module.ts +3 -5
- package/src/mcp-chat/mcp-chat.service.ts +23 -20
- package/src/oauth/interfaces/OAuthProvider.ts +1 -1
- package/src/oauth/oauth.controller.ts +30 -2
- package/src/oauth/oauth.service.ts +194 -35
- package/src/oauth/providers/abstract.provider.ts +1 -1
- package/src/oauth/providers/facebook.provider.ts +36 -20
- package/src/oauth/providers/github.provider.ts +46 -23
- package/src/oauth/providers/google.provider.ts +36 -20
- package/src/oauth/providers/microsoft-entra-id.provider.ts +42 -46
- package/src/oauth/providers/microsoft.provider.ts +36 -21
- package/src/profile/profile.controller.ts +2 -2
- package/src/security/security.service.ts +34 -1
- package/src/setting/setting.service.ts +307 -9
- package/src/user/user.controller.ts +4 -1
- package/src/user/user.service.ts +20 -2
- package/src/webhook-integration/dto/webhook-action.dto.ts +85 -4
- package/src/webhook-integration/event-webhook.controller.ts +55 -50
- package/src/webhook-integration/event-webhook.service.ts +422 -384
- package/src/webhook-integration/webhook-command.registry.ts +42 -0
- package/src/webhook-integration/webhook-integration.controller.ts +25 -0
- package/src/webhook-integration/webhook-integration.module.ts +50 -45
- package/src/webhook-integration/webhook-integration.service.ts +444 -53
- package/dist/mail-profile/dto/create.dto.d.ts +0 -23
- package/dist/mail-profile/dto/create.dto.d.ts.map +0 -1
- package/dist/mail-profile/dto/create.dto.js +0 -139
- package/dist/mail-profile/dto/create.dto.js.map +0 -1
- package/dist/mail-profile/dto/update.dto.d.ts.map +0 -1
- package/dist/mail-profile/dto/update.dto.js.map +0 -1
- package/dist/mail-profile/mail-profile.controller.d.ts +0 -94
- package/dist/mail-profile/mail-profile.controller.d.ts.map +0 -1
- package/dist/mail-profile/mail-profile.controller.js +0 -95
- package/dist/mail-profile/mail-profile.controller.js.map +0 -1
- package/dist/mail-profile/mail-profile.module.d.ts +0 -3
- package/dist/mail-profile/mail-profile.module.d.ts.map +0 -1
- package/dist/mail-profile/mail-profile.module.js.map +0 -1
- package/dist/mail-profile/mail-profile.service.d.ts +0 -109
- package/dist/mail-profile/mail-profile.service.d.ts.map +0 -1
- package/dist/mail-profile/mail-profile.service.js +0 -278
- package/dist/mail-profile/mail-profile.service.js.map +0 -1
- package/dist/mcp/tools/core-mail-profile.mcp-tools.d.ts +0 -32
- package/dist/mcp/tools/core-mail-profile.mcp-tools.d.ts.map +0 -1
- package/dist/mcp/tools/core-mail-profile.mcp-tools.js +0 -178
- package/dist/mcp/tools/core-mail-profile.mcp-tools.js.map +0 -1
- package/hedhog/data/mail_profile.yaml +0 -18
- package/hedhog/table/mail_profile.yaml +0 -75
- package/src/mail-profile/dto/create.dto.ts +0 -145
- package/src/mail-profile/mail-profile.controller.ts +0 -56
- package/src/mail-profile/mail-profile.module.ts +0 -18
- package/src/mail-profile/mail-profile.service.ts +0 -308
- package/src/mcp/tools/core-mail-profile.mcp-tools.ts +0 -128
- /package/dist/{mail-profile → integration-profile}/dto/update.dto.d.ts +0 -0
- /package/dist/{mail-profile → integration-profile}/dto/update.dto.js +0 -0
- /package/src/{mail-profile → integration-profile}/dto/update.dto.ts +0 -0
|
@@ -17,18 +17,59 @@ const axios_1 = require("@nestjs/axios");
|
|
|
17
17
|
const common_1 = require("@nestjs/common");
|
|
18
18
|
const events_1 = require("events");
|
|
19
19
|
const rxjs_1 = require("rxjs");
|
|
20
|
+
const integration_profile_utils_1 = require("../integration-profile/integration-profile.utils");
|
|
20
21
|
const mail_service_1 = require("../mail/mail.service");
|
|
22
|
+
const mcp_api_key_service_1 = require("../mcp/mcp-api-key.service");
|
|
21
23
|
const setting_service_1 = require("../setting/setting.service");
|
|
24
|
+
const webhook_command_registry_1 = require("./webhook-command.registry");
|
|
22
25
|
const webhook_utils_1 = require("./webhook-utils");
|
|
23
26
|
let WebhookIntegrationService = class WebhookIntegrationService {
|
|
24
|
-
constructor(prisma, pagination, http, mailMainService, coreMailService, settingService) {
|
|
27
|
+
constructor(prisma, pagination, http, mailMainService, coreMailService, settingService, commandRegistry, mcpApiKeyService) {
|
|
25
28
|
this.prisma = prisma;
|
|
26
29
|
this.pagination = pagination;
|
|
27
30
|
this.http = http;
|
|
28
31
|
this.mailMainService = mailMainService;
|
|
29
32
|
this.coreMailService = coreMailService;
|
|
30
33
|
this.settingService = settingService;
|
|
34
|
+
this.commandRegistry = commandRegistry;
|
|
35
|
+
this.mcpApiKeyService = mcpApiKeyService;
|
|
31
36
|
this.logEmitter = new events_1.EventEmitter();
|
|
37
|
+
this.webhookActionSelect = {
|
|
38
|
+
id: true,
|
|
39
|
+
webhook_integration_id: true,
|
|
40
|
+
type: true,
|
|
41
|
+
name: true,
|
|
42
|
+
order: true,
|
|
43
|
+
status: true,
|
|
44
|
+
integration_profile_id: true,
|
|
45
|
+
mail_id: true,
|
|
46
|
+
email_to: true,
|
|
47
|
+
email_cc: true,
|
|
48
|
+
email_bcc: true,
|
|
49
|
+
whatsapp_target_type: true,
|
|
50
|
+
whatsapp_target: true,
|
|
51
|
+
whatsapp_template: true,
|
|
52
|
+
whatsapp_instance: true,
|
|
53
|
+
whatsapp_base_url: true,
|
|
54
|
+
whatsapp_token: true,
|
|
55
|
+
http_url: true,
|
|
56
|
+
http_method: true,
|
|
57
|
+
http_headers: true,
|
|
58
|
+
http_query: true,
|
|
59
|
+
http_body: true,
|
|
60
|
+
http_timeout_ms: true,
|
|
61
|
+
http_retry_count: true,
|
|
62
|
+
internal_api_path: true,
|
|
63
|
+
internal_api_method: true,
|
|
64
|
+
internal_api_query: true,
|
|
65
|
+
internal_api_body: true,
|
|
66
|
+
internal_api_token: true,
|
|
67
|
+
internal_api_user_id: true,
|
|
68
|
+
app_command_slug: true,
|
|
69
|
+
app_command_params: true,
|
|
70
|
+
created_at: true,
|
|
71
|
+
updated_at: true,
|
|
72
|
+
};
|
|
32
73
|
}
|
|
33
74
|
get integrations() {
|
|
34
75
|
return this.prisma.webhook_integration;
|
|
@@ -49,6 +90,7 @@ let WebhookIntegrationService = class WebhookIntegrationService {
|
|
|
49
90
|
where: OR.length > 0 ? { OR } : {},
|
|
50
91
|
include: {
|
|
51
92
|
webhook_action: {
|
|
93
|
+
select: this.webhookActionSelect,
|
|
52
94
|
orderBy: [{ order: 'asc' }, { id: 'asc' }],
|
|
53
95
|
},
|
|
54
96
|
},
|
|
@@ -61,6 +103,7 @@ let WebhookIntegrationService = class WebhookIntegrationService {
|
|
|
61
103
|
where: { id },
|
|
62
104
|
include: {
|
|
63
105
|
webhook_action: {
|
|
106
|
+
select: this.webhookActionSelect,
|
|
64
107
|
orderBy: [{ order: 'asc' }, { id: 'asc' }],
|
|
65
108
|
},
|
|
66
109
|
},
|
|
@@ -130,6 +173,80 @@ let WebhookIntegrationService = class WebhookIntegrationService {
|
|
|
130
173
|
});
|
|
131
174
|
return Object.assign(Object.assign({}, (await this.withPublicUrl(record))), { plainToken });
|
|
132
175
|
}
|
|
176
|
+
async duplicate(id) {
|
|
177
|
+
var _a;
|
|
178
|
+
const original = await this.get(id);
|
|
179
|
+
const newSlug = await this.generateUniqueSlug(original.slug, this.integrations);
|
|
180
|
+
let plainToken = null;
|
|
181
|
+
let tokenHash = null;
|
|
182
|
+
if (original.require_token) {
|
|
183
|
+
plainToken = (0, webhook_utils_1.createPlainToken)();
|
|
184
|
+
tokenHash = (0, webhook_utils_1.hashToken)(plainToken);
|
|
185
|
+
}
|
|
186
|
+
const record = await this.integrations.create({
|
|
187
|
+
data: {
|
|
188
|
+
slug: newSlug,
|
|
189
|
+
name: `${original.name} (copy)`,
|
|
190
|
+
description: original.description,
|
|
191
|
+
public_uuid: (0, webhook_utils_1.createPublicUuid)(),
|
|
192
|
+
status: original.status,
|
|
193
|
+
require_token: original.require_token,
|
|
194
|
+
token_hash: tokenHash,
|
|
195
|
+
allowed_ips: original.allowed_ips,
|
|
196
|
+
body_schema: original.body_schema,
|
|
197
|
+
webhook_action: {
|
|
198
|
+
create: ((_a = original.webhook_action) !== null && _a !== void 0 ? _a : []).map((a) => {
|
|
199
|
+
var _a;
|
|
200
|
+
return ({
|
|
201
|
+
type: a.type,
|
|
202
|
+
name: a.name,
|
|
203
|
+
order: a.order,
|
|
204
|
+
status: a.status,
|
|
205
|
+
integration_profile_id: (_a = a.integration_profile_id) !== null && _a !== void 0 ? _a : null,
|
|
206
|
+
mail_id: a.mail_id,
|
|
207
|
+
email_to: a.email_to,
|
|
208
|
+
email_cc: a.email_cc,
|
|
209
|
+
email_bcc: a.email_bcc,
|
|
210
|
+
whatsapp_target_type: a.whatsapp_target_type,
|
|
211
|
+
whatsapp_target: a.whatsapp_target,
|
|
212
|
+
whatsapp_template: a.whatsapp_template,
|
|
213
|
+
whatsapp_instance: a.whatsapp_instance,
|
|
214
|
+
whatsapp_base_url: a.whatsapp_base_url,
|
|
215
|
+
whatsapp_token: a.whatsapp_token,
|
|
216
|
+
http_url: a.http_url,
|
|
217
|
+
http_method: a.http_method,
|
|
218
|
+
http_headers: a.http_headers,
|
|
219
|
+
http_query: a.http_query,
|
|
220
|
+
http_body: a.http_body,
|
|
221
|
+
http_timeout_ms: a.http_timeout_ms,
|
|
222
|
+
http_retry_count: a.http_retry_count,
|
|
223
|
+
internal_api_path: a.internal_api_path,
|
|
224
|
+
internal_api_method: a.internal_api_method,
|
|
225
|
+
internal_api_query: a.internal_api_query,
|
|
226
|
+
internal_api_body: a.internal_api_body,
|
|
227
|
+
internal_api_token: a.internal_api_token,
|
|
228
|
+
internal_api_user_id: a.internal_api_user_id,
|
|
229
|
+
app_command_slug: a.app_command_slug,
|
|
230
|
+
app_command_params: a.app_command_params,
|
|
231
|
+
});
|
|
232
|
+
}),
|
|
233
|
+
},
|
|
234
|
+
},
|
|
235
|
+
});
|
|
236
|
+
return Object.assign(Object.assign({}, (await this.withPublicUrl(record))), { plainToken });
|
|
237
|
+
}
|
|
238
|
+
async generateUniqueSlug(base, table) {
|
|
239
|
+
const candidate = `${base}-copy`;
|
|
240
|
+
const existing = await table.findUnique({ where: { slug: candidate } });
|
|
241
|
+
if (!existing)
|
|
242
|
+
return candidate;
|
|
243
|
+
for (let i = 2;; i++) {
|
|
244
|
+
const next = `${base}-copy-${i}`;
|
|
245
|
+
const taken = await table.findUnique({ where: { slug: next } });
|
|
246
|
+
if (!taken)
|
|
247
|
+
return next;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
133
250
|
async getApplicationBaseUrl() {
|
|
134
251
|
const settings = await this.settingService.getSettingValues([
|
|
135
252
|
'api-url',
|
|
@@ -187,6 +304,44 @@ let WebhookIntegrationService = class WebhookIntegrationService {
|
|
|
187
304
|
},
|
|
188
305
|
});
|
|
189
306
|
}
|
|
307
|
+
async listUserApiTokens(userId) {
|
|
308
|
+
return this.prisma.mcp_api_key.findMany({
|
|
309
|
+
where: { user_id: userId, type: 'api', revoked_at: null },
|
|
310
|
+
select: {
|
|
311
|
+
id: true,
|
|
312
|
+
name: true,
|
|
313
|
+
token_prefix: true,
|
|
314
|
+
last_used_at: true,
|
|
315
|
+
created_at: true,
|
|
316
|
+
},
|
|
317
|
+
orderBy: { created_at: 'desc' },
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
async createUserApiToken(userId, name) {
|
|
321
|
+
return this.mcpApiKeyService.create(userId, name, 'api');
|
|
322
|
+
}
|
|
323
|
+
async listInternalRoutes() {
|
|
324
|
+
return this.prisma.route.findMany({
|
|
325
|
+
select: {
|
|
326
|
+
id: true,
|
|
327
|
+
url: true,
|
|
328
|
+
method: true,
|
|
329
|
+
},
|
|
330
|
+
where: {
|
|
331
|
+
url: { not: null },
|
|
332
|
+
method: { not: null },
|
|
333
|
+
},
|
|
334
|
+
orderBy: [{ url: 'asc' }, { method: 'asc' }],
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
async listAppCommands() {
|
|
338
|
+
return this.commandRegistry.list().map((cmd) => ({
|
|
339
|
+
slug: cmd.slug,
|
|
340
|
+
name: cmd.name,
|
|
341
|
+
description: cmd.description,
|
|
342
|
+
inputSchema: cmd.inputSchema,
|
|
343
|
+
}));
|
|
344
|
+
}
|
|
190
345
|
async listLogs(integrationId, paginationParams, sort = 'desc') {
|
|
191
346
|
await this.get(integrationId);
|
|
192
347
|
const page = Math.max(Number(paginationParams.page || 1), 1);
|
|
@@ -259,6 +414,7 @@ let WebhookIntegrationService = class WebhookIntegrationService {
|
|
|
259
414
|
where: { public_uuid: uuid },
|
|
260
415
|
include: {
|
|
261
416
|
webhook_action: {
|
|
417
|
+
select: this.webhookActionSelect,
|
|
262
418
|
where: { status: 'active' },
|
|
263
419
|
orderBy: [{ order: 'asc' }, { id: 'asc' }],
|
|
264
420
|
},
|
|
@@ -382,13 +538,23 @@ let WebhookIntegrationService = class WebhookIntegrationService {
|
|
|
382
538
|
if (action.type === 'whatsapp_evolution') {
|
|
383
539
|
return this.executeWhatsappAction(action, body);
|
|
384
540
|
}
|
|
541
|
+
if (action.type === 'http_request') {
|
|
542
|
+
return this.executeHttpRequestAction(action, body);
|
|
543
|
+
}
|
|
544
|
+
if (action.type === 'internal_api') {
|
|
545
|
+
return this.executeInternalApiAction(action, body);
|
|
546
|
+
}
|
|
547
|
+
if (action.type === 'app_command') {
|
|
548
|
+
return this.executeAppCommandAction(action, body);
|
|
549
|
+
}
|
|
385
550
|
throw new common_1.BadRequestException(`Unsupported action type: ${action.type}`);
|
|
386
551
|
}
|
|
387
552
|
async executeEmailAction(action, body) {
|
|
388
553
|
var _a, _b, _c, _d;
|
|
389
554
|
this.validateActionConfiguration(action);
|
|
390
|
-
const profile = await this.prisma.
|
|
391
|
-
where: { id: Number(action.
|
|
555
|
+
const profile = await this.prisma.integration_profile.findUnique({
|
|
556
|
+
where: { id: Number(action.integration_profile_id) },
|
|
557
|
+
include: { integration_provider: { select: { slug: true } } },
|
|
392
558
|
});
|
|
393
559
|
const mail = await this.prisma.mail.findUnique({
|
|
394
560
|
where: { id: Number(action.mail_id) },
|
|
@@ -402,15 +568,9 @@ let WebhookIntegrationService = class WebhookIntegrationService {
|
|
|
402
568
|
throw new common_1.BadRequestException('Email action references an invalid profile or template.');
|
|
403
569
|
}
|
|
404
570
|
const template = mail.mail_locale[0];
|
|
405
|
-
const config =
|
|
406
|
-
const sender = profile.
|
|
407
|
-
|
|
408
|
-
: profile.from_email;
|
|
409
|
-
const replyTo = profile.reply_to_email
|
|
410
|
-
? profile.reply_to_name
|
|
411
|
-
? `${profile.reply_to_name} <${profile.reply_to_email}>`
|
|
412
|
-
: profile.reply_to_email
|
|
413
|
-
: undefined;
|
|
571
|
+
const config = (0, integration_profile_utils_1.buildMailConfigFromIntegration)(profile.integration_provider.slug, profile.config);
|
|
572
|
+
const sender = (0, integration_profile_utils_1.getFromAddress)(profile.config);
|
|
573
|
+
const replyTo = (0, integration_profile_utils_1.getReplyToAddress)(profile.config);
|
|
414
574
|
const renderedTo = String((_b = (0, webhook_utils_1.renderTemplate)(action.email_to, body)) !== null && _b !== void 0 ? _b : '').trim();
|
|
415
575
|
const renderedCc = action.email_cc
|
|
416
576
|
? String((_c = (0, webhook_utils_1.renderTemplate)(action.email_cc, body)) !== null && _c !== void 0 ? _c : '').trim()
|
|
@@ -501,6 +661,165 @@ let WebhookIntegrationService = class WebhookIntegrationService {
|
|
|
501
661
|
},
|
|
502
662
|
};
|
|
503
663
|
}
|
|
664
|
+
async executeHttpRequestAction(action, body) {
|
|
665
|
+
var _a, _b, _c;
|
|
666
|
+
this.validateActionConfiguration(action);
|
|
667
|
+
const method = String(action.http_method || 'POST').toUpperCase();
|
|
668
|
+
const rawUrl = String(action.http_url || '').trim();
|
|
669
|
+
const timeoutMs = Number(action.http_timeout_ms || 30000);
|
|
670
|
+
const maxAttempts = Math.max(1, Number(action.http_retry_count || 0) + 1);
|
|
671
|
+
const renderedUrl = String((_a = (0, webhook_utils_1.renderTemplate)(rawUrl, body)) !== null && _a !== void 0 ? _a : rawUrl).trim();
|
|
672
|
+
const rawHeaders = (0, webhook_utils_1.normalizeJsonObject)(action.http_headers) || {};
|
|
673
|
+
const renderedHeaders = {};
|
|
674
|
+
for (const [k, v] of Object.entries(rawHeaders)) {
|
|
675
|
+
renderedHeaders[k] = String((_b = (0, webhook_utils_1.renderTemplate)(String(v), body)) !== null && _b !== void 0 ? _b : v);
|
|
676
|
+
}
|
|
677
|
+
const rawQuery = (0, webhook_utils_1.normalizeJsonObject)(action.http_query) || {};
|
|
678
|
+
const renderedQuery = {};
|
|
679
|
+
for (const [k, v] of Object.entries(rawQuery)) {
|
|
680
|
+
renderedQuery[k] = String((_c = (0, webhook_utils_1.renderTemplate)(String(v), body)) !== null && _c !== void 0 ? _c : v);
|
|
681
|
+
}
|
|
682
|
+
const rawBody = String(action.http_body || '').trim();
|
|
683
|
+
const renderedBody = rawBody
|
|
684
|
+
? (0, webhook_utils_1.renderTemplate)(rawBody, body)
|
|
685
|
+
: undefined;
|
|
686
|
+
let parsedBody = renderedBody;
|
|
687
|
+
if (renderedBody) {
|
|
688
|
+
try {
|
|
689
|
+
parsedBody = JSON.parse(renderedBody);
|
|
690
|
+
}
|
|
691
|
+
catch (_d) {
|
|
692
|
+
parsedBody = renderedBody;
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
const requestPayload = {
|
|
696
|
+
method,
|
|
697
|
+
url: renderedUrl,
|
|
698
|
+
headers: renderedHeaders,
|
|
699
|
+
query: renderedQuery,
|
|
700
|
+
body: parsedBody,
|
|
701
|
+
};
|
|
702
|
+
let lastError;
|
|
703
|
+
for (let attempt = 0; attempt < maxAttempts; attempt++) {
|
|
704
|
+
try {
|
|
705
|
+
const response = await (0, rxjs_1.firstValueFrom)(this.http.request({
|
|
706
|
+
method,
|
|
707
|
+
url: renderedUrl,
|
|
708
|
+
headers: renderedHeaders,
|
|
709
|
+
params: Object.keys(renderedQuery).length ? renderedQuery : undefined,
|
|
710
|
+
data: parsedBody,
|
|
711
|
+
timeout: timeoutMs,
|
|
712
|
+
}));
|
|
713
|
+
return {
|
|
714
|
+
requestPayload,
|
|
715
|
+
responsePayload: {
|
|
716
|
+
status: (response === null || response === void 0 ? void 0 : response.status) || null,
|
|
717
|
+
statusText: (response === null || response === void 0 ? void 0 : response.statusText) || null,
|
|
718
|
+
data: (response === null || response === void 0 ? void 0 : response.data) || null,
|
|
719
|
+
},
|
|
720
|
+
};
|
|
721
|
+
}
|
|
722
|
+
catch (error) {
|
|
723
|
+
lastError = error;
|
|
724
|
+
if (attempt === maxAttempts - 1) {
|
|
725
|
+
this.attachErrorRequestPayload(error, requestPayload);
|
|
726
|
+
throw error;
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
this.attachErrorRequestPayload(lastError, requestPayload);
|
|
731
|
+
throw lastError;
|
|
732
|
+
}
|
|
733
|
+
async executeInternalApiAction(action, body) {
|
|
734
|
+
var _a, _b;
|
|
735
|
+
this.validateActionConfiguration(action);
|
|
736
|
+
const baseUrl = await this.getApplicationBaseUrl();
|
|
737
|
+
if (!baseUrl) {
|
|
738
|
+
throw new common_1.BadRequestException('Internal API action requires the api-url setting to be configured.');
|
|
739
|
+
}
|
|
740
|
+
const method = String(action.internal_api_method || 'POST').toUpperCase();
|
|
741
|
+
const rawPath = String(action.internal_api_path || '').trim();
|
|
742
|
+
const token = String(action.internal_api_token || '').trim();
|
|
743
|
+
const renderedPath = String((_a = (0, webhook_utils_1.renderTemplate)(rawPath, body)) !== null && _a !== void 0 ? _a : rawPath).trim();
|
|
744
|
+
const rawQuery = (0, webhook_utils_1.normalizeJsonObject)(action.internal_api_query) || {};
|
|
745
|
+
const renderedQuery = {};
|
|
746
|
+
for (const [k, v] of Object.entries(rawQuery)) {
|
|
747
|
+
renderedQuery[k] = String((_b = (0, webhook_utils_1.renderTemplate)(String(v), body)) !== null && _b !== void 0 ? _b : v);
|
|
748
|
+
}
|
|
749
|
+
const rawBody = (0, webhook_utils_1.normalizeJsonObject)(action.internal_api_body) || {};
|
|
750
|
+
const renderedBodyObj = {};
|
|
751
|
+
for (const [k, v] of Object.entries(rawBody)) {
|
|
752
|
+
renderedBodyObj[k] = typeof v === 'string' ? (0, webhook_utils_1.renderTemplate)(v, body) : v;
|
|
753
|
+
}
|
|
754
|
+
const url = `${baseUrl}${renderedPath.startsWith('/') ? '' : '/'}${renderedPath}`;
|
|
755
|
+
const requestPayload = {
|
|
756
|
+
method,
|
|
757
|
+
url,
|
|
758
|
+
query: renderedQuery,
|
|
759
|
+
body: renderedBodyObj,
|
|
760
|
+
};
|
|
761
|
+
let response;
|
|
762
|
+
try {
|
|
763
|
+
response = await (0, rxjs_1.firstValueFrom)(this.http.request({
|
|
764
|
+
method,
|
|
765
|
+
url,
|
|
766
|
+
headers: {
|
|
767
|
+
Authorization: `Bearer ${token}`,
|
|
768
|
+
'Content-Type': 'application/json',
|
|
769
|
+
},
|
|
770
|
+
params: Object.keys(renderedQuery).length ? renderedQuery : undefined,
|
|
771
|
+
data: Object.keys(renderedBodyObj).length ? renderedBodyObj : undefined,
|
|
772
|
+
timeout: 30000,
|
|
773
|
+
}));
|
|
774
|
+
}
|
|
775
|
+
catch (error) {
|
|
776
|
+
this.attachErrorRequestPayload(error, requestPayload);
|
|
777
|
+
throw error;
|
|
778
|
+
}
|
|
779
|
+
return {
|
|
780
|
+
requestPayload,
|
|
781
|
+
responsePayload: {
|
|
782
|
+
status: (response === null || response === void 0 ? void 0 : response.status) || null,
|
|
783
|
+
statusText: (response === null || response === void 0 ? void 0 : response.statusText) || null,
|
|
784
|
+
data: (response === null || response === void 0 ? void 0 : response.data) || null,
|
|
785
|
+
},
|
|
786
|
+
};
|
|
787
|
+
}
|
|
788
|
+
async executeAppCommandAction(action, body) {
|
|
789
|
+
this.validateActionConfiguration(action);
|
|
790
|
+
const slug = String(action.app_command_slug || '').trim();
|
|
791
|
+
const command = this.commandRegistry.find(slug);
|
|
792
|
+
if (!command) {
|
|
793
|
+
throw new common_1.BadRequestException(`app_command: unknown command slug "${slug}".`);
|
|
794
|
+
}
|
|
795
|
+
const rawParams = (0, webhook_utils_1.normalizeJsonObject)(action.app_command_params) || {};
|
|
796
|
+
const renderedParams = {};
|
|
797
|
+
for (const [k, v] of Object.entries(rawParams)) {
|
|
798
|
+
renderedParams[k] = typeof v === 'string' ? (0, webhook_utils_1.renderTemplate)(v, body) : v;
|
|
799
|
+
}
|
|
800
|
+
const schemaErrors = this.validateJsonSchema(command.inputSchema, renderedParams);
|
|
801
|
+
if (schemaErrors.length) {
|
|
802
|
+
throw new common_1.BadRequestException({
|
|
803
|
+
message: `app_command "${slug}" params do not match expected schema.`,
|
|
804
|
+
errors: schemaErrors,
|
|
805
|
+
});
|
|
806
|
+
}
|
|
807
|
+
const requestPayload = { slug, params: renderedParams };
|
|
808
|
+
let result;
|
|
809
|
+
try {
|
|
810
|
+
result = await this.commandRegistry.dispatch(slug, renderedParams, {
|
|
811
|
+
webhookBody: body,
|
|
812
|
+
});
|
|
813
|
+
}
|
|
814
|
+
catch (error) {
|
|
815
|
+
this.attachErrorRequestPayload(error, requestPayload);
|
|
816
|
+
throw error;
|
|
817
|
+
}
|
|
818
|
+
return {
|
|
819
|
+
requestPayload,
|
|
820
|
+
responsePayload: result,
|
|
821
|
+
};
|
|
822
|
+
}
|
|
504
823
|
validateToken(integration, headers) {
|
|
505
824
|
var _a;
|
|
506
825
|
if (!integration.require_token) {
|
|
@@ -527,8 +846,8 @@ let WebhookIntegrationService = class WebhookIntegrationService {
|
|
|
527
846
|
validateActionConfiguration(action) {
|
|
528
847
|
if ((action === null || action === void 0 ? void 0 : action.type) === 'email') {
|
|
529
848
|
const missing = [];
|
|
530
|
-
if (!this.nullableNumber(action.
|
|
531
|
-
missing.push('
|
|
849
|
+
if (!this.nullableNumber(action.integration_profile_id)) {
|
|
850
|
+
missing.push('integration_profile_id');
|
|
532
851
|
}
|
|
533
852
|
if (!this.nullableNumber(action.mail_id)) {
|
|
534
853
|
missing.push('mail_id');
|
|
@@ -554,6 +873,31 @@ let WebhookIntegrationService = class WebhookIntegrationService {
|
|
|
554
873
|
throw new common_1.BadRequestException(`WhatsApp action is missing required configuration: ${missing.join(', ')}.`);
|
|
555
874
|
}
|
|
556
875
|
}
|
|
876
|
+
if ((action === null || action === void 0 ? void 0 : action.type) === 'http_request') {
|
|
877
|
+
if (!this.nullableString(action.http_url)) {
|
|
878
|
+
throw new common_1.BadRequestException('HTTP request action is missing required configuration: http_url.');
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
if ((action === null || action === void 0 ? void 0 : action.type) === 'internal_api') {
|
|
882
|
+
const missing = [];
|
|
883
|
+
if (!this.nullableString(action.internal_api_path)) {
|
|
884
|
+
missing.push('internal_api_path');
|
|
885
|
+
}
|
|
886
|
+
if (!this.nullableNumber(action.internal_api_user_id)) {
|
|
887
|
+
missing.push('internal_api_user_id');
|
|
888
|
+
}
|
|
889
|
+
if (!this.nullableString(action.internal_api_token)) {
|
|
890
|
+
missing.push('internal_api_token');
|
|
891
|
+
}
|
|
892
|
+
if (missing.length) {
|
|
893
|
+
throw new common_1.BadRequestException(`Internal API action is missing required configuration: ${missing.join(', ')}.`);
|
|
894
|
+
}
|
|
895
|
+
}
|
|
896
|
+
if ((action === null || action === void 0 ? void 0 : action.type) === 'app_command') {
|
|
897
|
+
if (!this.nullableString(action.app_command_slug)) {
|
|
898
|
+
throw new common_1.BadRequestException('App command action is missing required configuration: app_command_slug.');
|
|
899
|
+
}
|
|
900
|
+
}
|
|
557
901
|
}
|
|
558
902
|
validateBodySchema(integration, body) {
|
|
559
903
|
if (!integration.body_schema) {
|
|
@@ -772,7 +1116,7 @@ let WebhookIntegrationService = class WebhookIntegrationService {
|
|
|
772
1116
|
assign('name', String((_a = data.name) !== null && _a !== void 0 ? _a : '').trim());
|
|
773
1117
|
assign('order', Number((_b = data.order) !== null && _b !== void 0 ? _b : 0));
|
|
774
1118
|
assign('status', data.status === 'inactive' ? 'inactive' : 'active');
|
|
775
|
-
assign('
|
|
1119
|
+
assign('integration_profile_id', this.nullableNumber(data.integration_profile_id, partial));
|
|
776
1120
|
assign('mail_id', this.nullableNumber(data.mail_id, partial));
|
|
777
1121
|
assign('email_to', this.nullableString(data.email_to, partial));
|
|
778
1122
|
assign('email_cc', this.nullableString(data.email_cc, partial));
|
|
@@ -783,6 +1127,21 @@ let WebhookIntegrationService = class WebhookIntegrationService {
|
|
|
783
1127
|
assign('whatsapp_instance', this.nullableString(data.whatsapp_instance, partial));
|
|
784
1128
|
assign('whatsapp_base_url', this.nullableString(data.whatsapp_base_url, partial));
|
|
785
1129
|
assign('whatsapp_token', this.nullableString(data.whatsapp_token, partial));
|
|
1130
|
+
assign('http_url', this.nullableString(data.http_url, partial));
|
|
1131
|
+
assign('http_method', this.nullableString(data.http_method, partial));
|
|
1132
|
+
assign('http_headers', (0, webhook_utils_1.normalizeJsonObject)(data.http_headers));
|
|
1133
|
+
assign('http_query', (0, webhook_utils_1.normalizeJsonObject)(data.http_query));
|
|
1134
|
+
assign('http_body', this.nullableString(data.http_body, partial));
|
|
1135
|
+
assign('http_timeout_ms', this.nullableNumber(data.http_timeout_ms, partial));
|
|
1136
|
+
assign('http_retry_count', this.nullableNumber(data.http_retry_count, partial));
|
|
1137
|
+
assign('internal_api_path', this.nullableString(data.internal_api_path, partial));
|
|
1138
|
+
assign('internal_api_method', this.nullableString(data.internal_api_method, partial));
|
|
1139
|
+
assign('internal_api_query', (0, webhook_utils_1.normalizeJsonObject)(data.internal_api_query));
|
|
1140
|
+
assign('internal_api_body', (0, webhook_utils_1.normalizeJsonObject)(data.internal_api_body));
|
|
1141
|
+
assign('internal_api_token', this.nullableString(data.internal_api_token, partial));
|
|
1142
|
+
assign('internal_api_user_id', this.nullableNumber(data.internal_api_user_id, partial));
|
|
1143
|
+
assign('app_command_slug', this.nullableString(data.app_command_slug, partial));
|
|
1144
|
+
assign('app_command_params', (0, webhook_utils_1.normalizeJsonObject)(data.app_command_params));
|
|
786
1145
|
return normalized;
|
|
787
1146
|
}
|
|
788
1147
|
nullableString(value, partial = false) {
|
|
@@ -804,40 +1163,6 @@ let WebhookIntegrationService = class WebhookIntegrationService {
|
|
|
804
1163
|
}
|
|
805
1164
|
return Number(value);
|
|
806
1165
|
}
|
|
807
|
-
buildMailConfig(profile) {
|
|
808
|
-
switch (profile.provider) {
|
|
809
|
-
case 'SMTP':
|
|
810
|
-
return {
|
|
811
|
-
global: true,
|
|
812
|
-
type: 'SMTP',
|
|
813
|
-
host: profile.smtp_host,
|
|
814
|
-
port: Number(profile.smtp_port || 587),
|
|
815
|
-
secure: Boolean(profile.smtp_secure),
|
|
816
|
-
username: profile.smtp_username || '',
|
|
817
|
-
password: profile.smtp_password || '',
|
|
818
|
-
};
|
|
819
|
-
case 'GMAIL':
|
|
820
|
-
return {
|
|
821
|
-
global: true,
|
|
822
|
-
type: 'GMAIL',
|
|
823
|
-
clientId: profile.gmail_client_id,
|
|
824
|
-
clientSecret: profile.gmail_client_secret,
|
|
825
|
-
refreshToken: profile.gmail_refresh_token,
|
|
826
|
-
from: profile.from_email,
|
|
827
|
-
};
|
|
828
|
-
case 'SES':
|
|
829
|
-
return {
|
|
830
|
-
global: true,
|
|
831
|
-
type: 'SES',
|
|
832
|
-
region: profile.ses_region,
|
|
833
|
-
accessKeyId: profile.ses_access_key_id,
|
|
834
|
-
secretAccessKey: profile.ses_secret_access_key,
|
|
835
|
-
from: profile.from_email,
|
|
836
|
-
};
|
|
837
|
-
default:
|
|
838
|
-
throw new common_1.BadRequestException(`Invalid mail profile provider: ${profile.provider}`);
|
|
839
|
-
}
|
|
840
|
-
}
|
|
841
1166
|
};
|
|
842
1167
|
exports.WebhookIntegrationService = WebhookIntegrationService;
|
|
843
1168
|
exports.WebhookIntegrationService = WebhookIntegrationService = __decorate([
|
|
@@ -847,6 +1172,8 @@ exports.WebhookIntegrationService = WebhookIntegrationService = __decorate([
|
|
|
847
1172
|
axios_1.HttpService,
|
|
848
1173
|
api_mail_1.MailService,
|
|
849
1174
|
mail_service_1.MailService,
|
|
850
|
-
setting_service_1.SettingService
|
|
1175
|
+
setting_service_1.SettingService,
|
|
1176
|
+
webhook_command_registry_1.WebhookCommandRegistry,
|
|
1177
|
+
mcp_api_key_service_1.McpApiKeyService])
|
|
851
1178
|
], WebhookIntegrationService);
|
|
852
1179
|
//# sourceMappingURL=webhook-integration.service.js.map
|