@hed-hog/core 0.0.370 → 0.0.373
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/LICENSE.md +21 -0
- package/README.md +2 -0
- package/dist/ai/ai.service.d.ts.map +1 -1
- package/dist/ai/ai.service.js +10 -7
- package/dist/ai/ai.service.js.map +1 -1
- package/dist/app-command/app-command.module.d.ts +3 -0
- package/dist/app-command/app-command.module.d.ts.map +1 -0
- package/dist/app-command/app-command.module.js +22 -0
- package/dist/app-command/app-command.module.js.map +1 -0
- package/dist/app-command/app-command.registry.d.ts +22 -0
- package/dist/app-command/app-command.registry.d.ts.map +1 -0
- package/dist/{webhook-integration/webhook-command.registry.js → app-command/app-command.registry.js} +6 -6
- package/dist/app-command/app-command.registry.js.map +1 -0
- package/dist/auth/auth.controller.d.ts +2 -2
- package/dist/auth/auth.controller.d.ts.map +1 -1
- package/dist/auth/auth.controller.js +20 -7
- package/dist/auth/auth.controller.js.map +1 -1
- package/dist/auth/auth.service.d.ts +3 -3
- package/dist/auth/auth.service.d.ts.map +1 -1
- package/dist/auth/auth.service.js +10 -36
- package/dist/auth/auth.service.js.map +1 -1
- package/dist/auth/dto/forget.dto.d.ts +1 -0
- package/dist/auth/dto/forget.dto.d.ts.map +1 -1
- package/dist/auth/dto/forget.dto.js +5 -0
- package/dist/auth/dto/forget.dto.js.map +1 -1
- package/dist/auth/guards/auth.guard.d.ts.map +1 -1
- package/dist/auth/guards/auth.guard.js +4 -1
- package/dist/auth/guards/auth.guard.js.map +1 -1
- package/dist/challenge/challenge.service.d.ts +8 -7
- package/dist/challenge/challenge.service.d.ts.map +1 -1
- package/dist/challenge/challenge.service.js +27 -19
- package/dist/challenge/challenge.service.js.map +1 -1
- package/dist/file/dto/upload.dto.d.ts +3 -0
- package/dist/file/dto/upload.dto.d.ts.map +1 -1
- package/dist/file/dto/upload.dto.js +22 -0
- package/dist/file/dto/upload.dto.js.map +1 -1
- package/dist/file/file.controller.d.ts +2 -1
- package/dist/file/file.controller.d.ts.map +1 -1
- package/dist/file/file.controller.js +29 -16
- package/dist/file/file.controller.js.map +1 -1
- package/dist/file/file.service.d.ts +51 -1
- package/dist/file/file.service.d.ts.map +1 -1
- package/dist/file/file.service.js +250 -18
- package/dist/file/file.service.js.map +1 -1
- package/dist/file/image-optimization.service.d.ts +17 -4
- package/dist/file/image-optimization.service.d.ts.map +1 -1
- package/dist/file/image-optimization.service.js +101 -46
- package/dist/file/image-optimization.service.js.map +1 -1
- package/dist/file/provider/s3.provider.d.ts.map +1 -1
- package/dist/file/provider/s3.provider.js +15 -7
- package/dist/file/provider/s3.provider.js.map +1 -1
- package/dist/file/provider/spaces.provider.d.ts.map +1 -1
- package/dist/file/provider/spaces.provider.js +18 -8
- package/dist/file/provider/spaces.provider.js.map +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/integration/services/event-subscriber.registry.d.ts +5 -0
- package/dist/integration/services/event-subscriber.registry.d.ts.map +1 -1
- package/dist/integration/services/event-subscriber.registry.js +15 -0
- package/dist/integration/services/event-subscriber.registry.js.map +1 -1
- package/dist/integration/services/outbox.processor.d.ts.map +1 -1
- package/dist/integration/services/outbox.processor.js +2 -4
- package/dist/integration/services/outbox.processor.js.map +1 -1
- package/dist/integration/services/outbox.service.d.ts +4 -2
- package/dist/integration/services/outbox.service.d.ts.map +1 -1
- package/dist/integration/services/outbox.service.js +26 -15
- package/dist/integration/services/outbox.service.js.map +1 -1
- package/dist/integration-profile/integration-credential-crypto.service.d.ts +43 -0
- package/dist/integration-profile/integration-credential-crypto.service.d.ts.map +1 -0
- package/dist/integration-profile/integration-credential-crypto.service.js +142 -0
- package/dist/integration-profile/integration-credential-crypto.service.js.map +1 -0
- package/dist/integration-profile/integration-profile.controller.d.ts +6 -7
- package/dist/integration-profile/integration-profile.controller.d.ts.map +1 -1
- package/dist/integration-profile/integration-profile.controller.js +4 -3
- package/dist/integration-profile/integration-profile.controller.js.map +1 -1
- package/dist/integration-profile/integration-profile.module.d.ts.map +1 -1
- package/dist/integration-profile/integration-profile.module.js +5 -2
- package/dist/integration-profile/integration-profile.module.js.map +1 -1
- package/dist/integration-profile/integration-profile.secrets.d.ts +16 -0
- package/dist/integration-profile/integration-profile.secrets.d.ts.map +1 -0
- package/dist/integration-profile/integration-profile.secrets.js +56 -0
- package/dist/integration-profile/integration-profile.secrets.js.map +1 -0
- package/dist/integration-profile/integration-profile.service.d.ts +125 -8
- package/dist/integration-profile/integration-profile.service.d.ts.map +1 -1
- package/dist/integration-profile/integration-profile.service.js +257 -68
- package/dist/integration-profile/integration-profile.service.js.map +1 -1
- package/dist/integration-profile/integration-profile.utils.d.ts +17 -0
- package/dist/integration-profile/integration-profile.utils.d.ts.map +1 -1
- package/dist/integration-profile/integration-profile.utils.js +31 -0
- package/dist/integration-profile/integration-profile.utils.js.map +1 -1
- package/dist/language/en.json +178 -0
- package/dist/language/pt.json +178 -0
- package/dist/mail/mail.controller.d.ts.map +1 -1
- package/dist/mail/mail.controller.js +5 -28
- package/dist/mail/mail.controller.js.map +1 -1
- package/dist/mail/mail.module.js +18 -18
- package/dist/mail/mail.module.js.map +1 -1
- package/dist/mail/mail.service.d.ts +13 -2
- package/dist/mail/mail.service.d.ts.map +1 -1
- package/dist/mail/mail.service.js +25 -15
- package/dist/mail/mail.service.js.map +1 -1
- package/dist/mcp-chat/mcp-chat.service.js +6 -5
- package/dist/mcp-chat/mcp-chat.service.js.map +1 -1
- package/dist/oauth/providers/facebook.provider.js +5 -5
- package/dist/oauth/providers/facebook.provider.js.map +1 -1
- package/dist/oauth/providers/github.provider.js +5 -5
- package/dist/oauth/providers/github.provider.js.map +1 -1
- package/dist/oauth/providers/google.provider.js +5 -5
- package/dist/oauth/providers/google.provider.js.map +1 -1
- package/dist/oauth/providers/microsoft-entra-id.provider.js +5 -5
- package/dist/oauth/providers/microsoft-entra-id.provider.js.map +1 -1
- package/dist/oauth/providers/microsoft.provider.js +5 -5
- package/dist/oauth/providers/microsoft.provider.js.map +1 -1
- package/dist/pdf/pdf.service.d.ts +4 -0
- package/dist/pdf/pdf.service.d.ts.map +1 -1
- package/dist/pdf/pdf.service.js +16 -9
- package/dist/pdf/pdf.service.js.map +1 -1
- package/dist/profile/profile.controller.d.ts +7 -7
- package/dist/profile/profile.controller.d.ts.map +1 -1
- package/dist/profile/profile.controller.js +28 -21
- package/dist/profile/profile.controller.js.map +1 -1
- package/dist/profile/profile.service.d.ts +7 -7
- package/dist/profile/profile.service.d.ts.map +1 -1
- package/dist/profile/profile.service.js +21 -25
- package/dist/profile/profile.service.js.map +1 -1
- package/dist/setting/setting.service.d.ts +1 -0
- package/dist/setting/setting.service.d.ts.map +1 -1
- package/dist/setting/setting.service.js +15 -2
- package/dist/setting/setting.service.js.map +1 -1
- package/dist/token/token.service.d.ts.map +1 -1
- package/dist/token/token.service.js +2 -1
- package/dist/token/token.service.js.map +1 -1
- package/dist/user/user.controller.d.ts +9 -0
- package/dist/user/user.controller.d.ts.map +1 -1
- package/dist/user/user.controller.js +13 -0
- package/dist/user/user.controller.js.map +1 -1
- package/dist/user/user.service.d.ts +7 -0
- package/dist/user/user.service.d.ts.map +1 -1
- package/dist/user/user.service.js +19 -0
- package/dist/user/user.service.js.map +1 -1
- package/dist/utils/webauthn-origin.d.ts +11 -0
- package/dist/utils/webauthn-origin.d.ts.map +1 -0
- package/dist/utils/webauthn-origin.js +37 -0
- package/dist/utils/webauthn-origin.js.map +1 -0
- package/dist/webhook-integration/webhook-integration.controller.d.ts +13 -0
- package/dist/webhook-integration/webhook-integration.controller.d.ts.map +1 -1
- package/dist/webhook-integration/webhook-integration.controller.js +29 -0
- package/dist/webhook-integration/webhook-integration.controller.js.map +1 -1
- package/dist/webhook-integration/webhook-integration.module.js +3 -3
- package/dist/webhook-integration/webhook-integration.module.js.map +1 -1
- package/dist/webhook-integration/webhook-integration.service.d.ts +18 -2
- package/dist/webhook-integration/webhook-integration.service.d.ts.map +1 -1
- package/dist/webhook-integration/webhook-integration.service.js +110 -6
- package/dist/webhook-integration/webhook-integration.service.js.map +1 -1
- package/hedhog/data/integration_provider.yaml +9 -0
- package/hedhog/data/integration_type.yaml +6 -0
- package/hedhog/data/menu.yaml +6 -0
- package/hedhog/data/role.yaml +7 -0
- package/hedhog/data/route.yaml +36 -0
- package/hedhog/data/setting_group.yaml +119 -13
- package/hedhog/frontend/app/access-log/page.tsx.ejs +35 -3
- package/hedhog/frontend/app/account/components/active-sessions.tsx.ejs +36 -3
- package/hedhog/frontend/app/account/components/mcp-tokens.tsx.ejs +39 -4
- package/hedhog/frontend/app/account/components/tokens.tsx.ejs +39 -4
- package/hedhog/frontend/app/ai_agent/page.tsx.ejs +35 -2
- package/hedhog/frontend/app/configurations/[slug]/components/byte-size-input.tsx.ejs +160 -0
- package/hedhog/frontend/app/configurations/[slug]/components/duration-input.tsx.ejs +157 -0
- package/hedhog/frontend/app/configurations/[slug]/components/setting-field.tsx.ejs +244 -63
- package/hedhog/frontend/app/dashboard/[slug]/dashboard-content.tsx.ejs +33 -1
- package/hedhog/frontend/app/dashboard/management/tabs/component-roles-tab.tsx.ejs +35 -3
- package/hedhog/frontend/app/dashboard/management/tabs/components-tab.tsx.ejs +36 -4
- package/hedhog/frontend/app/dashboard/management/tabs/dashboard-roles-tab.tsx.ejs +35 -3
- package/hedhog/frontend/app/dashboard/management/tabs/dashboards-tab.tsx.ejs +36 -4
- package/hedhog/frontend/app/dashboard/management/tabs/items-tab.tsx.ejs +35 -3
- package/hedhog/frontend/app/integration/profiles/page.tsx.ejs +156 -38
- package/hedhog/frontend/app/integrations-webhooks/page.tsx.ejs +118 -11
- package/hedhog/frontend/app/mail/log/page.tsx.ejs +37 -4
- package/hedhog/frontend/app/menu/page.tsx.ejs +34 -2
- package/hedhog/frontend/app/preferences/page.tsx.ejs +77 -0
- package/hedhog/frontend/app/roles/menus.tsx.ejs +35 -3
- package/hedhog/frontend/app/roles/page.tsx.ejs +34 -2
- package/hedhog/frontend/app/roles/routes.tsx.ejs +36 -4
- package/hedhog/frontend/app/roles/users.tsx.ejs +36 -4
- package/hedhog/frontend/app/routes/page.tsx.ejs +34 -2
- package/hedhog/frontend/app/setting-list/page.tsx.ejs +34 -2
- package/hedhog/frontend/app/users/page.tsx.ejs +51 -21
- package/hedhog/frontend/messages/en.json +69 -4
- package/hedhog/frontend/messages/pt.json +69 -4
- package/hedhog/table/setting.yaml +2 -0
- package/hedhog/table/webhook_call_log.yaml +49 -46
- package/package.json +9 -4
- package/src/ai/ai.service.ts +9 -6
- package/src/app-command/app-command.module.ts +9 -0
- package/src/{webhook-integration/webhook-command.registry.ts → app-command/app-command.registry.ts} +9 -9
- package/src/auth/auth.controller.ts +20 -4
- package/src/auth/auth.service.ts +10 -36
- package/src/auth/dto/forget.dto.ts +5 -1
- package/src/auth/guards/auth.guard.ts +4 -1
- package/src/challenge/challenge.service.ts +30 -19
- package/src/file/dto/upload.dto.ts +25 -1
- package/src/file/file.controller.ts +31 -18
- package/src/file/file.service.ts +341 -16
- package/src/file/image-optimization.service.ts +111 -46
- package/src/file/provider/s3.provider.ts +16 -7
- package/src/file/provider/spaces.provider.ts +15 -5
- package/src/index.ts +4 -1
- package/src/integration/services/event-subscriber.registry.ts +15 -0
- package/src/integration/services/outbox.processor.ts +2 -5
- package/src/integration/services/outbox.service.ts +35 -17
- package/src/integration-profile/integration-credential-crypto.service.ts +146 -0
- package/src/integration-profile/integration-profile.controller.ts +2 -0
- package/src/integration-profile/integration-profile.module.ts +5 -2
- package/src/integration-profile/integration-profile.secrets.ts +51 -0
- package/src/integration-profile/integration-profile.service.ts +335 -54
- package/src/integration-profile/integration-profile.utils.ts +56 -0
- package/src/language/en.json +5 -1
- package/src/language/pt.json +5 -1
- package/src/mail/mail.controller.ts +5 -29
- package/src/mail/mail.module.ts +5 -5
- package/src/mail/mail.service.ts +37 -13
- package/src/mcp-chat/mcp-chat.service.ts +5 -5
- package/src/oauth/oauth-callback-coordinator.service.spec.ts +159 -0
- package/src/oauth/providers/facebook.provider.ts +3 -3
- package/src/oauth/providers/github.provider.ts +3 -3
- package/src/oauth/providers/google.provider.ts +3 -3
- package/src/oauth/providers/microsoft-entra-id.provider.ts +3 -3
- package/src/oauth/providers/microsoft.provider.ts +3 -3
- package/src/pdf/pdf.service.ts +19 -6
- package/src/profile/profile.controller.ts +21 -14
- package/src/profile/profile.service.ts +23 -20
- package/src/security/security.service.spec.ts +222 -0
- package/src/setting/setting.service.ts +15 -2
- package/src/token/token.service.ts +2 -1
- package/src/user/user.controller.ts +26 -16
- package/src/user/user.service.ts +25 -0
- package/src/utils/webauthn-origin.ts +38 -0
- package/src/webhook-integration/webhook-integration.controller.ts +23 -0
- package/src/webhook-integration/webhook-integration.module.ts +3 -3
- package/src/webhook-integration/webhook-integration.service.ts +115 -5
- package/dist/webhook-integration/webhook-command.registry.d.ts +0 -22
- package/dist/webhook-integration/webhook-command.registry.d.ts.map +0 -1
- package/dist/webhook-integration/webhook-command.registry.js.map +0 -1
- package/src/menu/menu.service.spec.ts +0 -247
- package/src/route/route.service.spec.ts +0 -300
- package/src/screen/screen.service.spec.ts +0 -298
- package/src/user/user.service.spec.ts +0 -294
|
@@ -21,9 +21,11 @@ export declare class OutboxService {
|
|
|
21
21
|
*/
|
|
22
22
|
createEvent(dto: CreateOutboxEventDto, persistenceClient?: OutboxEventPersistenceClient): Promise<OutboxEvent>;
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
24
|
+
* Atomically claim a batch of pending events using SELECT FOR UPDATE SKIP LOCKED.
|
|
25
|
+
* Prevents duplicate processing across multiple API replicas: each replica gets
|
|
26
|
+
* its own non-overlapping set of rows with no blocking between them.
|
|
25
27
|
*/
|
|
26
|
-
|
|
28
|
+
findPendingAndLock(limit: number, leaseMs: number): Promise<OutboxEvent[]>;
|
|
27
29
|
/**
|
|
28
30
|
* Update event status and related fields
|
|
29
31
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"outbox.service.d.ts","sourceRoot":"","sources":["../../../src/integration/services/outbox.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAE1D,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC9B;AAED,MAAM,WAAW,4BAA4B;IAC3C,YAAY,EAAE,aAAa,CAAC,cAAc,CAAC,CAAC;CAC7C;AAkBD,qBACa,aAAa;IACZ,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,aAAa;IAElD,OAAO,CAAC,aAAa;IAkBrB,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,gBAAgB;IAoBxB;;OAEG;IACG,WAAW,CACf,GAAG,EAAE,oBAAoB,EACzB,iBAAiB,CAAC,EAAE,4BAA4B,GAC/C,OAAO,CAAC,WAAW,CAAC;IAmBvB
|
|
1
|
+
{"version":3,"file":"outbox.service.d.ts","sourceRoot":"","sources":["../../../src/integration/services/outbox.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAE1D,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC9B;AAED,MAAM,WAAW,4BAA4B;IAC3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Service {
|
|
|
68
68
|
return this.toDomainEvent(record);
|
|
69
69
|
}
|
|
70
70
|
/**
|
|
71
|
-
*
|
|
71
|
+
* Atomically claim a batch of pending events using SELECT FOR UPDATE SKIP LOCKED.
|
|
72
|
+
* Prevents duplicate processing across multiple API replicas: each replica gets
|
|
73
|
+
* its own non-overlapping set of rows with no blocking between them.
|
|
72
74
|
*/
|
|
73
|
-
async
|
|
75
|
+
async findPendingAndLock(limit, leaseMs) {
|
|
74
76
|
const now = new Date();
|
|
75
77
|
const leaseThreshold = new Date(now.getTime() - leaseMs);
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
78
|
+
const leaseUntil = new Date(now.getTime() + leaseMs);
|
|
79
|
+
return this.prisma.$transaction(async (tx) => {
|
|
80
|
+
const rows = await tx.$queryRaw `
|
|
81
|
+
SELECT * FROM outbox_event
|
|
82
|
+
WHERE status = 'pending'::"outbox_event_status_e5d55ba10d_enum"
|
|
83
|
+
OR (status = 'processing'::"outbox_event_status_e5d55ba10d_enum"
|
|
84
|
+
AND available_at <= ${leaseThreshold})
|
|
85
|
+
ORDER BY created_at ASC
|
|
86
|
+
LIMIT ${limit}
|
|
87
|
+
FOR UPDATE SKIP LOCKED
|
|
88
|
+
`;
|
|
89
|
+
if (rows.length === 0)
|
|
90
|
+
return [];
|
|
91
|
+
const ids = rows.map((r) => r.id);
|
|
92
|
+
await tx.$executeRaw `
|
|
93
|
+
UPDATE outbox_event
|
|
94
|
+
SET status = 'processing'::"outbox_event_status_e5d55ba10d_enum",
|
|
95
|
+
available_at = ${leaseUntil},
|
|
96
|
+
updated_at = now()
|
|
97
|
+
WHERE id = ANY(${ids}::int[])
|
|
98
|
+
`;
|
|
99
|
+
return rows.map((r) => this.toDomainEvent(Object.assign(Object.assign({}, r), { status: types_1.OutboxEventStatus.PROCESSING, available_at: leaseUntil })));
|
|
88
100
|
});
|
|
89
|
-
return records.map((record) => this.toDomainEvent(record));
|
|
90
101
|
}
|
|
91
102
|
/**
|
|
92
103
|
* Update event status and related fields
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"outbox.service.js","sourceRoot":"","sources":["../../../src/integration/services/outbox.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAoD;AACpD,2CAA4C;AAC5C,oCAA0D;AA+BnD,IAAM,aAAa,GAAnB,MAAM,aAAa;IACxB,YAA6B,MAAqB;QAArB,WAAM,GAAN,MAAM,CAAe;IAAG,CAAC;IAE9C,aAAa,CAAC,MAAyB;QAC7C,OAAO;YACL,EAAE,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;YACrB,SAAS,EAAE,MAAM,CAAC,UAAU;YAC5B,YAAY,EAAE,MAAM,CAAC,aAAa;YAClC,aAAa,EAAE,MAAM,CAAC,cAAc;YACpC,WAAW,EAAE,MAAM,CAAC,YAAY;YAChC,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,YAAY,EAAE,MAAM,CAAC,aAAa;YAClC,SAAS,EAAE,MAAM,CAAC,UAAU;YAC5B,WAAW,EAAE,MAAM,CAAC,YAAY;YAChC,WAAW,EAAE,MAAM,CAAC,YAAY;YAChC,SAAS,EAAE,MAAM,CAAC,UAAU;YAC5B,SAAS,EAAE,MAAM,CAAC,UAAU;SAC7B,CAAC;IACJ,CAAC;IAEO,YAAY,CAAC,OAAwB;QAC3C,OAAO,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACjE,CAAC;IAEO,gBAAgB,CACtB,aAKC;QAED,IAAI,CAAC,aAAa,EAAE,CAAC;YACnB,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,OAAO;YACL,aAAa,EAAE,aAAa,CAAC,YAAY;YACzC,UAAU,EAAE,aAAa,CAAC,SAAS;YACnC,YAAY,EAAE,aAAa,CAAC,WAAW;YACvC,YAAY,EAAE,aAAa,CAAC,WAAW;SACxC,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,WAAW,CACf,GAAyB,EACzB,iBAAgD;QAEhD,MAAM,MAAM,GAAG,iBAAiB,aAAjB,iBAAiB,cAAjB,iBAAiB,GAAI,IAAI,CAAC,MAAM,CAAC;QAEhD,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC;YAC9C,IAAI,EAAE;gBACJ,UAAU,EAAE,GAAG,CAAC,SAAS;gBACzB,aAAa,EAAE,GAAG,CAAC,YAAY;gBAC/B,cAAc,EAAE,GAAG,CAAC,aAAa;gBACjC,YAAY,EAAE,GAAG,CAAC,WAAW;gBAC7B,OAAO,EAAE,GAAG,CAAC,OAAO;gBACpB,MAAM,EAAE,yBAAiB,CAAC,OAAO;gBACjC,YAAY,EAAE,IAAI,IAAI,EAAE;gBACxB,aAAa,EAAE,CAAC;aACjB;SACF,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC,aAAa,CAAC,MAA2B,CAAC,CAAC;IACzD,CAAC;IAED
|
|
1
|
+
{"version":3,"file":"outbox.service.js","sourceRoot":"","sources":["../../../src/integration/services/outbox.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAoD;AACpD,2CAA4C;AAC5C,oCAA0D;AA+BnD,IAAM,aAAa,GAAnB,MAAM,aAAa;IACxB,YAA6B,MAAqB;QAArB,WAAM,GAAN,MAAM,CAAe;IAAG,CAAC;IAE9C,aAAa,CAAC,MAAyB;QAC7C,OAAO;YACL,EAAE,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;YACrB,SAAS,EAAE,MAAM,CAAC,UAAU;YAC5B,YAAY,EAAE,MAAM,CAAC,aAAa;YAClC,aAAa,EAAE,MAAM,CAAC,cAAc;YACpC,WAA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YAAY,CAAC,UAAU,CAAC;YACvD,KAAK,EAAE,EAAE,EAAE,EAAE,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE;SAC1C,CAAC,CAAC;QAEH,OAAO,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,MAA2B,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACzE,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,aAAa,CAAC,MAAyB;QAC3C,OAAO,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC;YACpC,KAAK,EAAE,EAAE,MAAM,EAAE;SAClB,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AAjMY,sCAAa;wBAAb,aAAa;IADzB,IAAA,mBAAU,GAAE;qCAE0B,0BAAa;GADvC,aAAa,CAiMzB"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { OnModuleInit } from '@nestjs/common';
|
|
2
|
+
import { SecurityService } from '../security/security.service';
|
|
3
|
+
/** Prefixo de envelope dos segredos cifrados em repouso. */
|
|
4
|
+
export declare const ENC_ENVELOPE_PREFIX = "enc.v1.";
|
|
5
|
+
/** Placeholder devolvido à UI no lugar de um segredo armazenado. */
|
|
6
|
+
export declare const SECRET_MASK = "********";
|
|
7
|
+
type Config = Record<string, unknown> | null | undefined;
|
|
8
|
+
/**
|
|
9
|
+
* Cifra/decifra os segredos dos Perfis de Integração em repouso.
|
|
10
|
+
*
|
|
11
|
+
* - Escrita: `encryptConfig` cifra (envelope `enc.v1.`) as chaves sensíveis do provider.
|
|
12
|
+
* - Leitura: um middleware Prisma `$use` (registrado em onModuleInit) decifra
|
|
13
|
+
* `integration_profile.config` de forma transparente em toda leitura/resultado, então os
|
|
14
|
+
* ~25 consumidores que leem o perfil direto via Prisma não mudam.
|
|
15
|
+
* - UI: `maskConfig` esconde segredos; `mergeKeepingStoredSecrets` implementa
|
|
16
|
+
* "deixe em branco para manter".
|
|
17
|
+
*
|
|
18
|
+
* Valores legados sem o prefixo passam intactos (sem janela de quebra antes do backfill).
|
|
19
|
+
*/
|
|
20
|
+
export declare class IntegrationCredentialCryptoService implements OnModuleInit {
|
|
21
|
+
private readonly securityService;
|
|
22
|
+
private readonly logger;
|
|
23
|
+
constructor(securityService: SecurityService);
|
|
24
|
+
onModuleInit(): void;
|
|
25
|
+
private isEnveloped;
|
|
26
|
+
/** Cifra um valor único com envelope (idempotente). */
|
|
27
|
+
encryptValue(value: string): string;
|
|
28
|
+
/** Decifra um valor com envelope; valores sem envelope passam intactos. */
|
|
29
|
+
decryptValue(value: unknown): unknown;
|
|
30
|
+
/** Cifra as chaves sensíveis do provider no config (idempotente, ignora vazios). */
|
|
31
|
+
encryptConfig(providerSlug: string, config: Config): Config;
|
|
32
|
+
/** Decifra qualquer valor com envelope no config (não precisa do provider slug). */
|
|
33
|
+
decryptConfig(config: Config): Config;
|
|
34
|
+
/** Mascara os segredos do provider para resposta à UI (não envia o valor real). */
|
|
35
|
+
maskConfig(providerSlug: string, config: Config, placeholder?: string): Config;
|
|
36
|
+
/**
|
|
37
|
+
* "Deixe em branco para manter": para cada chave sensível, se o valor recebido está
|
|
38
|
+
* vazio ou é o placeholder de máscara, herda o valor já armazenado (decifrado).
|
|
39
|
+
*/
|
|
40
|
+
mergeKeepingStoredSecrets(providerSlug: string, incoming: Config, storedDecrypted: Config): Config;
|
|
41
|
+
}
|
|
42
|
+
export {};
|
|
43
|
+
//# sourceMappingURL=integration-credential-crypto.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integration-credential-crypto.service.d.ts","sourceRoot":"","sources":["../../src/integration-profile/integration-credential-crypto.service.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,YAAY,EAEb,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAG/D,4DAA4D;AAC5D,eAAO,MAAM,mBAAmB,YAAY,CAAC;AAE7C,oEAAoE;AACpE,eAAO,MAAM,WAAW,aAAa,CAAC;AAEtC,KAAK,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC;AAEzD;;;;;;;;;;;GAWG;AACH,qBACa,kCAAmC,YAAW,YAAY;IAKnE,OAAO,CAAC,QAAQ,CAAC,eAAe;IAJlC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAuD;gBAI3D,eAAe,EAAE,eAAe;IAGnD,YAAY;IASZ,OAAO,CAAC,WAAW;IAInB,uDAAuD;IACvD,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAKnC,2EAA2E;IAC3E,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO;IAarC,oFAAoF;IACpF,aAAa,CAAC,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM;IAc3D,oFAAoF;IACpF,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;IAarC,mFAAmF;IACnF,UAAU,CACR,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,MAAM,EACd,WAAW,SAAc,GACxB,MAAM;IAcT;;;OAGG;IACH,yBAAyB,CACvB,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,MAAM,EAChB,eAAe,EAAE,MAAM,GACtB,MAAM;CAgBV"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
var IntegrationCredentialCryptoService_1;
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.IntegrationCredentialCryptoService = exports.SECRET_MASK = exports.ENC_ENVELOPE_PREFIX = void 0;
|
|
17
|
+
const api_prisma_1 = require("@hed-hog/api-prisma");
|
|
18
|
+
const common_1 = require("@nestjs/common");
|
|
19
|
+
const security_service_1 = require("../security/security.service");
|
|
20
|
+
const integration_profile_secrets_1 = require("./integration-profile.secrets");
|
|
21
|
+
/** Prefixo de envelope dos segredos cifrados em repouso. */
|
|
22
|
+
exports.ENC_ENVELOPE_PREFIX = 'enc.v1.';
|
|
23
|
+
/** Placeholder devolvido à UI no lugar de um segredo armazenado. */
|
|
24
|
+
exports.SECRET_MASK = '********';
|
|
25
|
+
/**
|
|
26
|
+
* Cifra/decifra os segredos dos Perfis de Integração em repouso.
|
|
27
|
+
*
|
|
28
|
+
* - Escrita: `encryptConfig` cifra (envelope `enc.v1.`) as chaves sensíveis do provider.
|
|
29
|
+
* - Leitura: um middleware Prisma `$use` (registrado em onModuleInit) decifra
|
|
30
|
+
* `integration_profile.config` de forma transparente em toda leitura/resultado, então os
|
|
31
|
+
* ~25 consumidores que leem o perfil direto via Prisma não mudam.
|
|
32
|
+
* - UI: `maskConfig` esconde segredos; `mergeKeepingStoredSecrets` implementa
|
|
33
|
+
* "deixe em branco para manter".
|
|
34
|
+
*
|
|
35
|
+
* Valores legados sem o prefixo passam intactos (sem janela de quebra antes do backfill).
|
|
36
|
+
*/
|
|
37
|
+
let IntegrationCredentialCryptoService = IntegrationCredentialCryptoService_1 = class IntegrationCredentialCryptoService {
|
|
38
|
+
constructor(securityService) {
|
|
39
|
+
this.securityService = securityService;
|
|
40
|
+
this.logger = new common_1.Logger(IntegrationCredentialCryptoService_1.name);
|
|
41
|
+
}
|
|
42
|
+
onModuleInit() {
|
|
43
|
+
// Registra a decifra transparente de integration_profile.config (query extension
|
|
44
|
+
// no PrismaService). A partir daqui, toda leitura do perfil devolve config decifrado.
|
|
45
|
+
(0, api_prisma_1.registerIntegrationConfigTransformer)((config) => this.decryptConfig(config));
|
|
46
|
+
this.logger.log('Integration credential decryption registered (integration_profile.config).');
|
|
47
|
+
}
|
|
48
|
+
isEnveloped(value) {
|
|
49
|
+
return typeof value === 'string' && value.startsWith(exports.ENC_ENVELOPE_PREFIX);
|
|
50
|
+
}
|
|
51
|
+
/** Cifra um valor único com envelope (idempotente). */
|
|
52
|
+
encryptValue(value) {
|
|
53
|
+
if (this.isEnveloped(value))
|
|
54
|
+
return value;
|
|
55
|
+
return exports.ENC_ENVELOPE_PREFIX + this.securityService.encrypt(value);
|
|
56
|
+
}
|
|
57
|
+
/** Decifra um valor com envelope; valores sem envelope passam intactos. */
|
|
58
|
+
decryptValue(value) {
|
|
59
|
+
if (!this.isEnveloped(value))
|
|
60
|
+
return value;
|
|
61
|
+
try {
|
|
62
|
+
return this.securityService.decrypt(value.slice(exports.ENC_ENVELOPE_PREFIX.length));
|
|
63
|
+
}
|
|
64
|
+
catch (err) {
|
|
65
|
+
// Não derruba a query: loga e devolve como veio (ex.: ENCRYPTION_SECRET trocado).
|
|
66
|
+
this.logger.error(`Failed to decrypt integration secret: ${err instanceof Error ? err.message : String(err)}`);
|
|
67
|
+
return value;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
/** Cifra as chaves sensíveis do provider no config (idempotente, ignora vazios). */
|
|
71
|
+
encryptConfig(providerSlug, config) {
|
|
72
|
+
if (!config)
|
|
73
|
+
return config;
|
|
74
|
+
const keys = (0, integration_profile_secrets_1.getSensitiveConfigKeys)(providerSlug);
|
|
75
|
+
if (keys.length === 0)
|
|
76
|
+
return config;
|
|
77
|
+
const out = Object.assign({}, config);
|
|
78
|
+
for (const key of keys) {
|
|
79
|
+
const value = out[key];
|
|
80
|
+
if (typeof value === 'string' && value.length > 0) {
|
|
81
|
+
out[key] = this.encryptValue(value);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return out;
|
|
85
|
+
}
|
|
86
|
+
/** Decifra qualquer valor com envelope no config (não precisa do provider slug). */
|
|
87
|
+
decryptConfig(config) {
|
|
88
|
+
if (!config)
|
|
89
|
+
return config;
|
|
90
|
+
let changed = false;
|
|
91
|
+
const out = Object.assign({}, config);
|
|
92
|
+
for (const [key, value] of Object.entries(out)) {
|
|
93
|
+
if (this.isEnveloped(value)) {
|
|
94
|
+
out[key] = this.decryptValue(value);
|
|
95
|
+
changed = true;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return changed ? out : config;
|
|
99
|
+
}
|
|
100
|
+
/** Mascara os segredos do provider para resposta à UI (não envia o valor real). */
|
|
101
|
+
maskConfig(providerSlug, config, placeholder = exports.SECRET_MASK) {
|
|
102
|
+
if (!config)
|
|
103
|
+
return config;
|
|
104
|
+
const keys = (0, integration_profile_secrets_1.getSensitiveConfigKeys)(providerSlug);
|
|
105
|
+
if (keys.length === 0)
|
|
106
|
+
return config;
|
|
107
|
+
const out = Object.assign({}, config);
|
|
108
|
+
for (const key of keys) {
|
|
109
|
+
const value = out[key];
|
|
110
|
+
if (typeof value === 'string' && value.length > 0) {
|
|
111
|
+
out[key] = placeholder;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return out;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* "Deixe em branco para manter": para cada chave sensível, se o valor recebido está
|
|
118
|
+
* vazio ou é o placeholder de máscara, herda o valor já armazenado (decifrado).
|
|
119
|
+
*/
|
|
120
|
+
mergeKeepingStoredSecrets(providerSlug, incoming, storedDecrypted) {
|
|
121
|
+
const merged = Object.assign({}, (incoming !== null && incoming !== void 0 ? incoming : {}));
|
|
122
|
+
const stored = storedDecrypted !== null && storedDecrypted !== void 0 ? storedDecrypted : {};
|
|
123
|
+
for (const key of (0, integration_profile_secrets_1.getSensitiveConfigKeys)(providerSlug)) {
|
|
124
|
+
const value = merged[key];
|
|
125
|
+
const isBlank = value === undefined ||
|
|
126
|
+
value === null ||
|
|
127
|
+
value === '' ||
|
|
128
|
+
value === exports.SECRET_MASK;
|
|
129
|
+
if (isBlank && typeof stored[key] === 'string') {
|
|
130
|
+
merged[key] = stored[key];
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
return merged;
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
exports.IntegrationCredentialCryptoService = IntegrationCredentialCryptoService;
|
|
137
|
+
exports.IntegrationCredentialCryptoService = IntegrationCredentialCryptoService = IntegrationCredentialCryptoService_1 = __decorate([
|
|
138
|
+
(0, common_1.Injectable)(),
|
|
139
|
+
__param(0, (0, common_1.Inject)((0, common_1.forwardRef)(() => security_service_1.SecurityService))),
|
|
140
|
+
__metadata("design:paramtypes", [security_service_1.SecurityService])
|
|
141
|
+
], IntegrationCredentialCryptoService);
|
|
142
|
+
//# sourceMappingURL=integration-credential-crypto.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integration-credential-crypto.service.js","sourceRoot":"","sources":["../../src/integration-profile/integration-credential-crypto.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAA2E;AAC3E,2CAMwB;AACxB,mEAA+D;AAC/D,+EAAuE;AAEvE,4DAA4D;AAC/C,QAAA,mBAAmB,GAAG,SAAS,CAAC;AAE7C,oEAAoE;AACvD,QAAA,WAAW,GAAG,UAAU,CAAC;AAItC;;;;;;;;;;;GAWG;AAEI,IAAM,kCAAkC,0CAAxC,MAAM,kCAAkC;IAG7C,YAEE,eAAiD;QAAhC,oBAAe,GAAf,eAAe,CAAiB;QAJlC,WAAM,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AAC,kCAAe,CAAC,CAAC,CAAA;qCACR,kCAAe;GALxC,kCAAkC,CAiH9C"}
|
|
@@ -11,13 +11,13 @@ export declare class IntegrationProfileController {
|
|
|
11
11
|
listTypes(): Promise<{
|
|
12
12
|
id: number;
|
|
13
13
|
slug: string;
|
|
14
|
-
icon: string;
|
|
15
14
|
integration_type_locale: {
|
|
16
15
|
name: string;
|
|
17
16
|
locale: {
|
|
18
17
|
code: string;
|
|
19
18
|
};
|
|
20
19
|
}[];
|
|
20
|
+
icon: string;
|
|
21
21
|
}[]>;
|
|
22
22
|
listProviders(typeId?: string, typeSlug?: string): Promise<{
|
|
23
23
|
id: number;
|
|
@@ -30,7 +30,7 @@ export declare class IntegrationProfileController {
|
|
|
30
30
|
}[];
|
|
31
31
|
type_id: number;
|
|
32
32
|
}[]>;
|
|
33
|
-
list(paginationParams: any, typeId?: string, typeSlug?: string, providerSlug?: string): Promise<{
|
|
33
|
+
list(paginationParams: any, typeId?: string, typeSlug?: string, providerSlug?: string, slug?: string): Promise<{
|
|
34
34
|
total: any;
|
|
35
35
|
lastPage: number;
|
|
36
36
|
page: number;
|
|
@@ -41,6 +41,7 @@ export declare class IntegrationProfileController {
|
|
|
41
41
|
}>;
|
|
42
42
|
export({ ids, include_secrets }: ExportDTO, res: Response): Promise<void>;
|
|
43
43
|
get(id: number): Promise<{
|
|
44
|
+
config: Record<string, unknown>;
|
|
44
45
|
integration_provider: {
|
|
45
46
|
slug: string;
|
|
46
47
|
integration_provider_locale: {
|
|
@@ -52,15 +53,14 @@ export declare class IntegrationProfileController {
|
|
|
52
53
|
};
|
|
53
54
|
integration_type: {
|
|
54
55
|
slug: string;
|
|
55
|
-
icon: string;
|
|
56
56
|
integration_type_locale: {
|
|
57
57
|
name: string;
|
|
58
58
|
locale: {
|
|
59
59
|
code: string;
|
|
60
60
|
};
|
|
61
61
|
}[];
|
|
62
|
+
icon: string;
|
|
62
63
|
};
|
|
63
|
-
} & {
|
|
64
64
|
id: number;
|
|
65
65
|
created_at: Date;
|
|
66
66
|
name: string;
|
|
@@ -68,7 +68,6 @@ export declare class IntegrationProfileController {
|
|
|
68
68
|
provider_id: number;
|
|
69
69
|
slug: string;
|
|
70
70
|
is_active: boolean;
|
|
71
|
-
config: import("@prisma/client/runtime/library").JsonValue | null;
|
|
72
71
|
type_id: number;
|
|
73
72
|
}>;
|
|
74
73
|
create(data: CreateDTO): Promise<{
|
|
@@ -79,8 +78,8 @@ export declare class IntegrationProfileController {
|
|
|
79
78
|
provider_id: number;
|
|
80
79
|
slug: string;
|
|
81
80
|
is_active: boolean;
|
|
82
|
-
config: import("@prisma/client/runtime/library").JsonValue | null;
|
|
83
81
|
type_id: number;
|
|
82
|
+
config: import("@prisma/client/runtime/library").JsonValue | null;
|
|
84
83
|
}>;
|
|
85
84
|
test(data: CreateDTO): Promise<{
|
|
86
85
|
success: boolean;
|
|
@@ -94,8 +93,8 @@ export declare class IntegrationProfileController {
|
|
|
94
93
|
provider_id: number;
|
|
95
94
|
slug: string;
|
|
96
95
|
is_active: boolean;
|
|
97
|
-
config: import("@prisma/client/runtime/library").JsonValue | null;
|
|
98
96
|
type_id: number;
|
|
97
|
+
config: import("@prisma/client/runtime/library").JsonValue | null;
|
|
99
98
|
}>;
|
|
100
99
|
delete(data: DeleteDTO): Promise<{
|
|
101
100
|
count: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integration-profile.controller.d.ts","sourceRoot":"","sources":["../../src/integration-profile/integration-profile.controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAQ,MAAM,cAAc,CAAC;AAoB/C,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAE1E,qBAEa,4BAA4B;IAGrC,OAAO,CAAC,QAAQ,CAAC,yBAAyB;gBAAzB,yBAAyB,EAAE,yBAAyB;IAIjE,SAAS;;;;;;;;;;;IAKT,aAAa,CACA,MAAM,CAAC,EAAE,MAAM,EACb,QAAQ,CAAC,EAAE,MAAM;;;;;;;;;;;IAShC,IAAI,CACM,gBAAgB,KAAA,EACb,MAAM,CAAC,EAAE,MAAM,EACb,QAAQ,CAAC,EAAE,MAAM,EACb,YAAY,CAAC,EAAE,MAAM;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"integration-profile.controller.d.ts","sourceRoot":"","sources":["../../src/integration-profile/integration-profile.controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAQ,MAAM,cAAc,CAAC;AAoB/C,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAE1E,qBAEa,4BAA4B;IAGrC,OAAO,CAAC,QAAQ,CAAC,yBAAyB;gBAAzB,yBAAyB,EAAE,yBAAyB;IAIjE,SAAS;;;;;;;;;;;IAKT,aAAa,CACA,MAAM,CAAC,EAAE,MAAM,EACb,QAAQ,CAAC,EAAE,MAAM;;;;;;;;;;;IAShC,IAAI,CACM,gBAAgB,KAAA,EACb,MAAM,CAAC,EAAE,MAAM,EACb,QAAQ,CAAC,EAAE,MAAM,EACb,YAAY,CAAC,EAAE,MAAM,EAC7B,IAAI,CAAC,EAAE,MAAM;;;;;;;;;IAiBxB,MAAM,CACD,EAAE,GAAG,EAAE,eAAuB,EAAE,EAAE,SAAS,EAC7C,GAAG,EAAE,QAAQ;IAgBhB,GAAG,CAA4B,EAAE,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAKzC,MAAM,CAAS,IAAI,EAAE,SAAS;;;;;;;;;;;IAK9B,IAAI,CAAS,IAAI,EAAE,SAAS;;;;IAK5B,MAAM,CACiB,EAAE,EAAE,MAAM,EAC7B,IAAI,EAAE,SAAS;;;;;;;;;;;IAMnB,MAAM,CAAS,IAAI,EAAE,SAAS;;;IAM9B,cAAc,CAAiB,IAAI,EAAE,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAK/C,aAAa,CAAS,IAAI,EAAE,gBAAgB;;;;;;;;;CAMnD"}
|
|
@@ -32,8 +32,8 @@ let IntegrationProfileController = class IntegrationProfileController {
|
|
|
32
32
|
async listProviders(typeId, typeSlug) {
|
|
33
33
|
return this.integrationProfileService.listProviders(typeId ? parseInt(typeId, 10) : undefined, typeSlug);
|
|
34
34
|
}
|
|
35
|
-
async list(paginationParams, typeId, typeSlug, providerSlug) {
|
|
36
|
-
return this.integrationProfileService.list(paginationParams, typeId ? parseInt(typeId, 10) : undefined, typeSlug, providerSlug);
|
|
35
|
+
async list(paginationParams, typeId, typeSlug, providerSlug, slug) {
|
|
36
|
+
return this.integrationProfileService.list(paginationParams, typeId ? parseInt(typeId, 10) : undefined, typeSlug, providerSlug, slug);
|
|
37
37
|
}
|
|
38
38
|
async export({ ids, include_secrets = false }, res) {
|
|
39
39
|
const parsedIds = String(ids !== null && ids !== void 0 ? ids : '')
|
|
@@ -92,8 +92,9 @@ __decorate([
|
|
|
92
92
|
__param(1, (0, common_1.Query)('typeId')),
|
|
93
93
|
__param(2, (0, common_1.Query)('typeSlug')),
|
|
94
94
|
__param(3, (0, common_1.Query)('providerSlug')),
|
|
95
|
+
__param(4, (0, common_1.Query)('slug')),
|
|
95
96
|
__metadata("design:type", Function),
|
|
96
|
-
__metadata("design:paramtypes", [Object, String, String, String]),
|
|
97
|
+
__metadata("design:paramtypes", [Object, String, String, String, String]),
|
|
97
98
|
__metadata("design:returntype", Promise)
|
|
98
99
|
], IntegrationProfileController.prototype, "list", null);
|
|
99
100
|
__decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integration-profile.controller.js","sourceRoot":"","sources":["../../src/integration-profile/integration-profile.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,sCAA+C;AAC/C,4DAAqD;AACrD,2CAgBwB;AACxB,+DAA2D;AAE3D,iDAA6C;AAC7C,iDAA6C;AAC7C,iEAA4D;AAC5D,iDAA6C;AAC7C,+EAA0E;AAInE,IAAM,4BAA4B,GAAlC,MAAM,4BAA4B;IACvC,YAEmB,yBAAoD;QAApD,8BAAyB,GAAzB,yBAAyB,CAA2B;IACpE,CAAC;IAGE,AAAN,KAAK,CAAC,SAAS;QACb,OAAO,IAAI,CAAC,yBAAyB,CAAC,SAAS,EAAE,CAAC;IACpD,CAAC;IAGK,AAAN,KAAK,CAAC,aAAa,CACA,MAAe,EACb,QAAiB;QAEpC,OAAO,IAAI,CAAC,yBAAyB,CAAC,aAAa,CACjD,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,EACzC,QAAQ,CACT,CAAC;IACJ,CAAC;IAGK,AAAN,KAAK,CAAC,IAAI,CACM,gBAAgB,EACb,MAAe,EACb,QAAiB,EACb,YAAqB;
|
|
1
|
+
{"version":3,"file":"integration-profile.controller.js","sourceRoot":"","sources":["../../src/integration-profile/integration-profile.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,sCAA+C;AAC/C,4DAAqD;AACrD,2CAgBwB;AACxB,+DAA2D;AAE3D,iDAA6C;AAC7C,iDAA6C;AAC7C,iEAA4D;AAC5D,iDAA6C;AAC7C,+EAA0E;AAInE,IAAM,4BAA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;IAFL,IAAA,wBAAe,EAAC,IAAA,kCAAe,EAAC,MAAM,CAAC,CAAC;IACxC,IAAA,aAAI,EAAC,iBAAiB,CAAC;IACF,WAAA,IAAA,qBAAY,GAAE,CAAA;;;;kEAEnC;AAGK;IADL,IAAA,aAAI,EAAC,gBAAgB,CAAC;IACF,WAAA,IAAA,aAAI,GAAE,CAAA;;qCAAO,qCAAgB;;iEAKjD;uCAtGU,4BAA4B;IAFxC,IAAA,UAAI,GAAE;IACN,IAAA,mBAAU,EAAC,qBAAqB,CAAC;IAG7B,WAAA,IAAA,eAAM,EAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,uDAAyB,CAAC,CAAC,CAAA;qCACR,uDAAyB;GAH5D,4BAA4B,CAuGxC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integration-profile.module.d.ts","sourceRoot":"","sources":["../../src/integration-profile/integration-profile.module.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"integration-profile.module.d.ts","sourceRoot":"","sources":["../../src/integration-profile/integration-profile.module.ts"],"names":[],"mappings":"AAQA,qBAUa,wBAAwB;CAAG"}
|
|
@@ -10,6 +10,8 @@ exports.IntegrationProfileModule = void 0;
|
|
|
10
10
|
const api_pagination_1 = require("@hed-hog/api-pagination");
|
|
11
11
|
const api_prisma_1 = require("@hed-hog/api-prisma");
|
|
12
12
|
const common_1 = require("@nestjs/common");
|
|
13
|
+
const security_module_1 = require("../security/security.module");
|
|
14
|
+
const integration_credential_crypto_service_1 = require("./integration-credential-crypto.service");
|
|
13
15
|
const integration_profile_controller_1 = require("./integration-profile.controller");
|
|
14
16
|
const integration_profile_service_1 = require("./integration-profile.service");
|
|
15
17
|
let IntegrationProfileModule = class IntegrationProfileModule {
|
|
@@ -20,10 +22,11 @@ exports.IntegrationProfileModule = IntegrationProfileModule = __decorate([
|
|
|
20
22
|
imports: [
|
|
21
23
|
(0, common_1.forwardRef)(() => api_prisma_1.PrismaModule),
|
|
22
24
|
(0, common_1.forwardRef)(() => api_pagination_1.PaginationModule),
|
|
25
|
+
(0, common_1.forwardRef)(() => security_module_1.SecurityModule),
|
|
23
26
|
],
|
|
24
27
|
controllers: [integration_profile_controller_1.IntegrationProfileController],
|
|
25
|
-
providers: [integration_profile_service_1.IntegrationProfileService],
|
|
26
|
-
exports: [integration_profile_service_1.IntegrationProfileService],
|
|
28
|
+
providers: [integration_profile_service_1.IntegrationProfileService, integration_credential_crypto_service_1.IntegrationCredentialCryptoService],
|
|
29
|
+
exports: [integration_profile_service_1.IntegrationProfileService, integration_credential_crypto_service_1.IntegrationCredentialCryptoService],
|
|
27
30
|
})
|
|
28
31
|
], IntegrationProfileModule);
|
|
29
32
|
//# sourceMappingURL=integration-profile.module.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integration-profile.module.js","sourceRoot":"","sources":["../../src/integration-profile/integration-profile.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,4DAA2D;AAC3D,oDAAmD;AACnD,2CAAoD;AACpD,qFAAgF;AAChF,+EAA0E;
|
|
1
|
+
{"version":3,"file":"integration-profile.module.js","sourceRoot":"","sources":["../../src/integration-profile/integration-profile.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,4DAA2D;AAC3D,oDAAmD;AACnD,2CAAoD;AACpD,iEAA6D;AAC7D,mGAA6F;AAC7F,qFAAgF;AAChF,+EAA0E;AAYnE,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;CAAG,CAAA;AAA3B,4DAAwB;mCAAxB,wBAAwB;IAVpC,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,yBAAY,CAAC;YAC9B,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,iCAAgB,CAAC;YAClC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,gCAAc,CAAC;SACjC;QACD,WAAW,EAAE,CAAC,6DAA4B,CAAC;QAC3C,SAAS,EAAE,CAAC,uDAAyB,EAAE,0EAAkC,CAAC;QAC1E,OAAO,EAAE,CAAC,uDAAyB,EAAE,0EAAkC,CAAC;KACzE,CAAC;GACW,wBAAwB,CAAG"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mapa AUTORITATIVO das chaves sensíveis (segredos) por provider de integração.
|
|
3
|
+
*
|
|
4
|
+
* SEGURANÇA-CRÍTICO: este mapa é a fonte única de verdade do que é cifrado em repouso
|
|
5
|
+
* (integration-credential-crypto.service) e mascarado na exportação/UI. Qualquer chave
|
|
6
|
+
* esquecida aqui NÃO será cifrada. Deve ser mantido em sincronia com os campos
|
|
7
|
+
* `type: 'password'` do form do admin (PROVIDER_FIELDS em
|
|
8
|
+
* apps/admin/src/app/(app)/(libraries)/core/integration/profiles/page.tsx).
|
|
9
|
+
*
|
|
10
|
+
* Não usar heurística por nome de chave: campos públicos como `site_key`, `public_key` e
|
|
11
|
+
* `access_key_id` contêm "key" mas NÃO são segredos.
|
|
12
|
+
*/
|
|
13
|
+
export declare const INTEGRATION_SECRET_KEYS: Record<string, string[]>;
|
|
14
|
+
/** Chaves sensíveis de um provider (vazio se desconhecido). */
|
|
15
|
+
export declare function getSensitiveConfigKeys(providerSlug: string): string[];
|
|
16
|
+
//# sourceMappingURL=integration-profile.secrets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integration-profile.secrets.d.ts","sourceRoot":"","sources":["../../src/integration-profile/integration-profile.secrets.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,uBAAuB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAiC5D,CAAC;AAEF,+DAA+D;AAC/D,wBAAgB,sBAAsB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,EAAE,CAErE"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.INTEGRATION_SECRET_KEYS = void 0;
|
|
4
|
+
exports.getSensitiveConfigKeys = getSensitiveConfigKeys;
|
|
5
|
+
/**
|
|
6
|
+
* Mapa AUTORITATIVO das chaves sensíveis (segredos) por provider de integração.
|
|
7
|
+
*
|
|
8
|
+
* SEGURANÇA-CRÍTICO: este mapa é a fonte única de verdade do que é cifrado em repouso
|
|
9
|
+
* (integration-credential-crypto.service) e mascarado na exportação/UI. Qualquer chave
|
|
10
|
+
* esquecida aqui NÃO será cifrada. Deve ser mantido em sincronia com os campos
|
|
11
|
+
* `type: 'password'` do form do admin (PROVIDER_FIELDS em
|
|
12
|
+
* apps/admin/src/app/(app)/(libraries)/core/integration/profiles/page.tsx).
|
|
13
|
+
*
|
|
14
|
+
* Não usar heurística por nome de chave: campos públicos como `site_key`, `public_key` e
|
|
15
|
+
* `access_key_id` contêm "key" mas NÃO são segredos.
|
|
16
|
+
*/
|
|
17
|
+
exports.INTEGRATION_SECRET_KEYS = {
|
|
18
|
+
// Email
|
|
19
|
+
smtp: ['password'],
|
|
20
|
+
gmail: ['client_secret', 'refresh_token'],
|
|
21
|
+
ses: ['secret_access_key'],
|
|
22
|
+
// Mensageria
|
|
23
|
+
'evolution-api': ['token'],
|
|
24
|
+
'whatsapp-official': ['access_token'],
|
|
25
|
+
// Storage
|
|
26
|
+
s3: ['secret_access_key'],
|
|
27
|
+
gcs: ['key_file_json'],
|
|
28
|
+
'azure-blob': ['key'],
|
|
29
|
+
's3-compatible': ['secret_access_key'],
|
|
30
|
+
// IA
|
|
31
|
+
openai: ['api_key'],
|
|
32
|
+
gemini: ['api_key'],
|
|
33
|
+
claude: ['api_key'],
|
|
34
|
+
// OAuth
|
|
35
|
+
'google-oauth': ['client_secret'],
|
|
36
|
+
'github-oauth': ['client_secret'],
|
|
37
|
+
'microsoft-oauth': ['client_secret'],
|
|
38
|
+
'facebook-oauth': ['client_secret'],
|
|
39
|
+
'microsoft-entra-id-oauth': ['client_secret'],
|
|
40
|
+
// Pagamento
|
|
41
|
+
stripe: ['secret_key', 'webhook_secret'],
|
|
42
|
+
mercado_pago: ['access_token', 'webhook_secret'],
|
|
43
|
+
// Captcha
|
|
44
|
+
recaptcha: ['secret_key'],
|
|
45
|
+
'cloudflare-turnstile': ['secret_key'],
|
|
46
|
+
altcha: ['hmac_key'],
|
|
47
|
+
// Infraestrutura (autoscaling)
|
|
48
|
+
digitalocean: ['api_token'],
|
|
49
|
+
kubernetes: ['token', 'ca_cert'],
|
|
50
|
+
};
|
|
51
|
+
/** Chaves sensíveis de um provider (vazio se desconhecido). */
|
|
52
|
+
function getSensitiveConfigKeys(providerSlug) {
|
|
53
|
+
var _a;
|
|
54
|
+
return (_a = exports.INTEGRATION_SECRET_KEYS[providerSlug.toLowerCase()]) !== null && _a !== void 0 ? _a : [];
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=integration-profile.secrets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integration-profile.secrets.js","sourceRoot":"","sources":["../../src/integration-profile/integration-profile.secrets.ts"],"names":[],"mappings":";;;AAgDA,wDAEC;AAlDD;;;;;;;;;;;GAWG;AACU,QAAA,uBAAuB,GAA6B;IAC/D,QAAQ;IACR,IAAI,EAAE,CAAC,UAAU,CAAC;IAClB,KAAK,EAAE,CAAC,eAAe,EAAE,eAAe,CAAC;IACzC,GAAG,EAAE,CAAC,mBAAmB,CAAC;IAC1B,aAAa;IACb,eAAe,EAAE,CAAC,OAAO,CAAC;IAC1B,mBAAmB,EAAE,CAAC,cAAc,CAAC;IACrC,UAAU;IACV,EAAE,EAAE,CAAC,mBAAmB,CAAC;IACzB,GAAG,EAAE,CAAC,eAAe,CAAC;IACtB,YAAY,EAAE,CAAC,KAAK,CAAC;IACrB,eAAe,EAAE,CAAC,mBAAmB,CAAC;IACtC,KAAK;IACL,MAAM,EAAE,CAAC,SAAS,CAAC;IACnB,MAAM,EAAE,CAAC,SAAS,CAAC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