@hed-hog/core 0.0.325 → 0.0.326
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/core.module.d.ts.map +1 -1
- package/dist/core.module.js +3 -0
- package/dist/core.module.js.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/integration/services/outbox.processor.d.ts.map +1 -1
- package/dist/integration/services/outbox.processor.js +1 -0
- package/dist/integration/services/outbox.processor.js.map +1 -1
- package/dist/integration/types/event.types.d.ts +1 -0
- package/dist/integration/types/event.types.d.ts.map +1 -1
- package/dist/mail/mail.controller.d.ts +2 -0
- package/dist/mail/mail.controller.d.ts.map +1 -1
- package/dist/mail/mail.module.d.ts.map +1 -1
- package/dist/mail/mail.module.js +33 -53
- package/dist/mail/mail.module.js.map +1 -1
- package/dist/mail/mail.service.d.ts +5 -1
- package/dist/mail/mail.service.d.ts.map +1 -1
- package/dist/mail/mail.service.js +64 -84
- package/dist/mail/mail.service.js.map +1 -1
- package/dist/role/role.service.d.ts +3 -1
- package/dist/role/role.service.d.ts.map +1 -1
- package/dist/role/role.service.js +33 -5
- package/dist/role/role.service.js.map +1 -1
- package/dist/setting/setting.service.d.ts.map +1 -1
- package/dist/setting/setting.service.js +1 -0
- package/dist/setting/setting.service.js.map +1 -1
- package/dist/user/user.service.d.ts +3 -1
- package/dist/user/user.service.d.ts.map +1 -1
- package/dist/user/user.service.js +31 -4
- package/dist/user/user.service.js.map +1 -1
- package/dist/webhook-integration/event-webhook.controller.d.ts +29 -0
- package/dist/webhook-integration/event-webhook.controller.d.ts.map +1 -0
- package/dist/webhook-integration/event-webhook.controller.js +93 -0
- package/dist/webhook-integration/event-webhook.controller.js.map +1 -0
- package/dist/webhook-integration/event-webhook.service.d.ts +54 -0
- package/dist/webhook-integration/event-webhook.service.d.ts.map +1 -0
- package/dist/webhook-integration/event-webhook.service.js +334 -0
- package/dist/webhook-integration/event-webhook.service.js.map +1 -0
- package/dist/webhook-integration/integration-event-catalog.controller.d.ts +21 -0
- package/dist/webhook-integration/integration-event-catalog.controller.d.ts.map +1 -0
- package/dist/webhook-integration/integration-event-catalog.controller.js +91 -0
- package/dist/webhook-integration/integration-event-catalog.controller.js.map +1 -0
- package/dist/webhook-integration/integration-event-catalog.service.d.ts +26 -0
- package/dist/webhook-integration/integration-event-catalog.service.d.ts.map +1 -0
- package/dist/webhook-integration/integration-event-catalog.service.js +112 -0
- package/dist/webhook-integration/integration-event-catalog.service.js.map +1 -0
- package/dist/webhook-integration/webhook-integration.controller.d.ts +44 -0
- package/dist/webhook-integration/webhook-integration.controller.d.ts.map +1 -0
- package/dist/webhook-integration/webhook-integration.controller.js +181 -0
- package/dist/webhook-integration/webhook-integration.controller.js.map +1 -0
- package/dist/webhook-integration/webhook-integration.module.d.ts +3 -0
- package/dist/webhook-integration/webhook-integration.module.d.ts.map +1 -0
- package/dist/webhook-integration/webhook-integration.module.js +54 -0
- package/dist/webhook-integration/webhook-integration.module.js.map +1 -0
- package/dist/webhook-integration/webhook-integration.service.d.ts +73 -0
- package/dist/webhook-integration/webhook-integration.service.d.ts.map +1 -0
- package/dist/webhook-integration/webhook-integration.service.js +569 -0
- package/dist/webhook-integration/webhook-integration.service.js.map +1 -0
- package/dist/webhook-integration/webhook-utils.d.ts +7 -0
- package/dist/webhook-integration/webhook-utils.d.ts.map +1 -0
- package/dist/webhook-integration/webhook-utils.js +104 -0
- package/dist/webhook-integration/webhook-utils.js.map +1 -0
- package/hedhog/data/integration_event_catalog.yaml +118 -0
- package/hedhog/data/mail_profile.yaml +18 -0
- package/hedhog/data/menu.yaml +26 -12
- package/hedhog/data/route.yaml +152 -8
- package/hedhog/data/setting_group.yaml +7 -156
- package/hedhog/data/setting_subgroup.yaml +0 -32
- package/hedhog/frontend/app/configurations/[slug]/components/setting-field.tsx.ejs +205 -0
- package/hedhog/frontend/app/integrations-webhooks/page.tsx.ejs +1835 -0
- package/hedhog/frontend/messages/en.json +2 -1
- package/hedhog/frontend/messages/pt.json +2 -1
- package/hedhog/table/event_webhook.yaml +55 -0
- package/hedhog/table/event_webhook_delivery_log.yaml +66 -0
- package/hedhog/table/event_webhook_event.yaml +26 -0
- package/hedhog/table/integration_event_catalog.yaml +41 -0
- package/hedhog/table/setting.yaml +1 -0
- package/hedhog/table/webhook_action.yaml +85 -0
- package/hedhog/table/webhook_call_log.yaml +46 -0
- package/hedhog/table/webhook_integration.yaml +43 -0
- package/package.json +4 -4
- package/src/core.module.ts +10 -7
- package/src/index.ts +10 -5
- package/src/integration/services/outbox.processor.ts +5 -4
- package/src/integration/types/event.types.ts +4 -3
- package/src/mail/mail.module.ts +36 -59
- package/src/mail/mail.service.ts +84 -89
- package/src/role/role.service.ts +41 -8
- package/src/setting/setting.service.ts +7 -6
- package/src/user/user.service.ts +34 -3
- package/src/webhook-integration/event-webhook.controller.ts +50 -0
- package/src/webhook-integration/event-webhook.service.ts +384 -0
- package/src/webhook-integration/integration-event-catalog.controller.ts +50 -0
- package/src/webhook-integration/integration-event-catalog.service.ts +117 -0
- package/src/webhook-integration/webhook-integration.controller.ts +103 -0
- package/src/webhook-integration/webhook-integration.module.ts +45 -0
- package/src/webhook-integration/webhook-integration.service.ts +735 -0
- package/src/webhook-integration/webhook-utils.ts +79 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { createHash, randomBytes, randomUUID } from 'crypto';
|
|
2
|
+
import * as Handlebars from 'handlebars';
|
|
3
|
+
|
|
4
|
+
export function createPublicUuid() {
|
|
5
|
+
return randomUUID();
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export function createPlainToken() {
|
|
9
|
+
return randomBytes(32).toString('hex');
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function hashToken(token: string) {
|
|
13
|
+
return createHash('sha256').update(token).digest('hex');
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function renderTemplate(source: unknown, context: Record<string, any>) {
|
|
17
|
+
if (source === undefined || source === null) {
|
|
18
|
+
return source;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (typeof source === 'string') {
|
|
22
|
+
return Handlebars.compile(source)(context);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (Array.isArray(source)) {
|
|
26
|
+
return source.map((item) => renderTemplate(item, context));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (typeof source === 'object') {
|
|
30
|
+
return Object.fromEntries(
|
|
31
|
+
Object.entries(source as Record<string, unknown>).map(([key, value]) => [
|
|
32
|
+
key,
|
|
33
|
+
renderTemplate(value, context),
|
|
34
|
+
]),
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return source;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function summarizePayload(value: unknown) {
|
|
42
|
+
if (value === undefined || value === null) {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
try {
|
|
47
|
+
const serialized = JSON.stringify(value);
|
|
48
|
+
if (serialized.length <= 4000) {
|
|
49
|
+
return value as any;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return {
|
|
53
|
+
truncated: true,
|
|
54
|
+
preview: serialized.slice(0, 4000),
|
|
55
|
+
};
|
|
56
|
+
} catch {
|
|
57
|
+
return {
|
|
58
|
+
unsupported: true,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export function normalizeJsonObject(value: unknown) {
|
|
64
|
+
if (!value) {
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (typeof value === 'string') {
|
|
69
|
+
const trimmed = value.trim();
|
|
70
|
+
if (!trimmed) {
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return JSON.parse(trimmed);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return value;
|
|
78
|
+
}
|
|
79
|
+
|