@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.
Files changed (248) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +2 -0
  3. package/dist/ai/ai.service.d.ts.map +1 -1
  4. package/dist/ai/ai.service.js +10 -7
  5. package/dist/ai/ai.service.js.map +1 -1
  6. package/dist/app-command/app-command.module.d.ts +3 -0
  7. package/dist/app-command/app-command.module.d.ts.map +1 -0
  8. package/dist/app-command/app-command.module.js +22 -0
  9. package/dist/app-command/app-command.module.js.map +1 -0
  10. package/dist/app-command/app-command.registry.d.ts +22 -0
  11. package/dist/app-command/app-command.registry.d.ts.map +1 -0
  12. package/dist/{webhook-integration/webhook-command.registry.js → app-command/app-command.registry.js} +6 -6
  13. package/dist/app-command/app-command.registry.js.map +1 -0
  14. package/dist/auth/auth.controller.d.ts +2 -2
  15. package/dist/auth/auth.controller.d.ts.map +1 -1
  16. package/dist/auth/auth.controller.js +20 -7
  17. package/dist/auth/auth.controller.js.map +1 -1
  18. package/dist/auth/auth.service.d.ts +3 -3
  19. package/dist/auth/auth.service.d.ts.map +1 -1
  20. package/dist/auth/auth.service.js +10 -36
  21. package/dist/auth/auth.service.js.map +1 -1
  22. package/dist/auth/dto/forget.dto.d.ts +1 -0
  23. package/dist/auth/dto/forget.dto.d.ts.map +1 -1
  24. package/dist/auth/dto/forget.dto.js +5 -0
  25. package/dist/auth/dto/forget.dto.js.map +1 -1
  26. package/dist/auth/guards/auth.guard.d.ts.map +1 -1
  27. package/dist/auth/guards/auth.guard.js +4 -1
  28. package/dist/auth/guards/auth.guard.js.map +1 -1
  29. package/dist/challenge/challenge.service.d.ts +8 -7
  30. package/dist/challenge/challenge.service.d.ts.map +1 -1
  31. package/dist/challenge/challenge.service.js +27 -19
  32. package/dist/challenge/challenge.service.js.map +1 -1
  33. package/dist/file/dto/upload.dto.d.ts +3 -0
  34. package/dist/file/dto/upload.dto.d.ts.map +1 -1
  35. package/dist/file/dto/upload.dto.js +22 -0
  36. package/dist/file/dto/upload.dto.js.map +1 -1
  37. package/dist/file/file.controller.d.ts +2 -1
  38. package/dist/file/file.controller.d.ts.map +1 -1
  39. package/dist/file/file.controller.js +29 -16
  40. package/dist/file/file.controller.js.map +1 -1
  41. package/dist/file/file.service.d.ts +51 -1
  42. package/dist/file/file.service.d.ts.map +1 -1
  43. package/dist/file/file.service.js +250 -18
  44. package/dist/file/file.service.js.map +1 -1
  45. package/dist/file/image-optimization.service.d.ts +17 -4
  46. package/dist/file/image-optimization.service.d.ts.map +1 -1
  47. package/dist/file/image-optimization.service.js +101 -46
  48. package/dist/file/image-optimization.service.js.map +1 -1
  49. package/dist/file/provider/s3.provider.d.ts.map +1 -1
  50. package/dist/file/provider/s3.provider.js +15 -7
  51. package/dist/file/provider/s3.provider.js.map +1 -1
  52. package/dist/file/provider/spaces.provider.d.ts.map +1 -1
  53. package/dist/file/provider/spaces.provider.js +18 -8
  54. package/dist/file/provider/spaces.provider.js.map +1 -1
  55. package/dist/index.d.ts +4 -1
  56. package/dist/index.d.ts.map +1 -1
  57. package/dist/index.js +4 -1
  58. package/dist/index.js.map +1 -1
  59. package/dist/integration/services/event-subscriber.registry.d.ts +5 -0
  60. package/dist/integration/services/event-subscriber.registry.d.ts.map +1 -1
  61. package/dist/integration/services/event-subscriber.registry.js +15 -0
  62. package/dist/integration/services/event-subscriber.registry.js.map +1 -1
  63. package/dist/integration/services/outbox.processor.d.ts.map +1 -1
  64. package/dist/integration/services/outbox.processor.js +2 -4
  65. package/dist/integration/services/outbox.processor.js.map +1 -1
  66. package/dist/integration/services/outbox.service.d.ts +4 -2
  67. package/dist/integration/services/outbox.service.d.ts.map +1 -1
  68. package/dist/integration/services/outbox.service.js +26 -15
  69. package/dist/integration/services/outbox.service.js.map +1 -1
  70. package/dist/integration-profile/integration-credential-crypto.service.d.ts +43 -0
  71. package/dist/integration-profile/integration-credential-crypto.service.d.ts.map +1 -0
  72. package/dist/integration-profile/integration-credential-crypto.service.js +142 -0
  73. package/dist/integration-profile/integration-credential-crypto.service.js.map +1 -0
  74. package/dist/integration-profile/integration-profile.controller.d.ts +6 -7
  75. package/dist/integration-profile/integration-profile.controller.d.ts.map +1 -1
  76. package/dist/integration-profile/integration-profile.controller.js +4 -3
  77. package/dist/integration-profile/integration-profile.controller.js.map +1 -1
  78. package/dist/integration-profile/integration-profile.module.d.ts.map +1 -1
  79. package/dist/integration-profile/integration-profile.module.js +5 -2
  80. package/dist/integration-profile/integration-profile.module.js.map +1 -1
  81. package/dist/integration-profile/integration-profile.secrets.d.ts +16 -0
  82. package/dist/integration-profile/integration-profile.secrets.d.ts.map +1 -0
  83. package/dist/integration-profile/integration-profile.secrets.js +56 -0
  84. package/dist/integration-profile/integration-profile.secrets.js.map +1 -0
  85. package/dist/integration-profile/integration-profile.service.d.ts +125 -8
  86. package/dist/integration-profile/integration-profile.service.d.ts.map +1 -1
  87. package/dist/integration-profile/integration-profile.service.js +257 -68
  88. package/dist/integration-profile/integration-profile.service.js.map +1 -1
  89. package/dist/integration-profile/integration-profile.utils.d.ts +17 -0
  90. package/dist/integration-profile/integration-profile.utils.d.ts.map +1 -1
  91. package/dist/integration-profile/integration-profile.utils.js +31 -0
  92. package/dist/integration-profile/integration-profile.utils.js.map +1 -1
  93. package/dist/language/en.json +178 -0
  94. package/dist/language/pt.json +178 -0
  95. package/dist/mail/mail.controller.d.ts.map +1 -1
  96. package/dist/mail/mail.controller.js +5 -28
  97. package/dist/mail/mail.controller.js.map +1 -1
  98. package/dist/mail/mail.module.js +18 -18
  99. package/dist/mail/mail.module.js.map +1 -1
  100. package/dist/mail/mail.service.d.ts +13 -2
  101. package/dist/mail/mail.service.d.ts.map +1 -1
  102. package/dist/mail/mail.service.js +25 -15
  103. package/dist/mail/mail.service.js.map +1 -1
  104. package/dist/mcp-chat/mcp-chat.service.js +6 -5
  105. package/dist/mcp-chat/mcp-chat.service.js.map +1 -1
  106. package/dist/oauth/providers/facebook.provider.js +5 -5
  107. package/dist/oauth/providers/facebook.provider.js.map +1 -1
  108. package/dist/oauth/providers/github.provider.js +5 -5
  109. package/dist/oauth/providers/github.provider.js.map +1 -1
  110. package/dist/oauth/providers/google.provider.js +5 -5
  111. package/dist/oauth/providers/google.provider.js.map +1 -1
  112. package/dist/oauth/providers/microsoft-entra-id.provider.js +5 -5
  113. package/dist/oauth/providers/microsoft-entra-id.provider.js.map +1 -1
  114. package/dist/oauth/providers/microsoft.provider.js +5 -5
  115. package/dist/oauth/providers/microsoft.provider.js.map +1 -1
  116. package/dist/pdf/pdf.service.d.ts +4 -0
  117. package/dist/pdf/pdf.service.d.ts.map +1 -1
  118. package/dist/pdf/pdf.service.js +16 -9
  119. package/dist/pdf/pdf.service.js.map +1 -1
  120. package/dist/profile/profile.controller.d.ts +7 -7
  121. package/dist/profile/profile.controller.d.ts.map +1 -1
  122. package/dist/profile/profile.controller.js +28 -21
  123. package/dist/profile/profile.controller.js.map +1 -1
  124. package/dist/profile/profile.service.d.ts +7 -7
  125. package/dist/profile/profile.service.d.ts.map +1 -1
  126. package/dist/profile/profile.service.js +21 -25
  127. package/dist/profile/profile.service.js.map +1 -1
  128. package/dist/setting/setting.service.d.ts +1 -0
  129. package/dist/setting/setting.service.d.ts.map +1 -1
  130. package/dist/setting/setting.service.js +15 -2
  131. package/dist/setting/setting.service.js.map +1 -1
  132. package/dist/token/token.service.d.ts.map +1 -1
  133. package/dist/token/token.service.js +2 -1
  134. package/dist/token/token.service.js.map +1 -1
  135. package/dist/user/user.controller.d.ts +9 -0
  136. package/dist/user/user.controller.d.ts.map +1 -1
  137. package/dist/user/user.controller.js +13 -0
  138. package/dist/user/user.controller.js.map +1 -1
  139. package/dist/user/user.service.d.ts +7 -0
  140. package/dist/user/user.service.d.ts.map +1 -1
  141. package/dist/user/user.service.js +19 -0
  142. package/dist/user/user.service.js.map +1 -1
  143. package/dist/utils/webauthn-origin.d.ts +11 -0
  144. package/dist/utils/webauthn-origin.d.ts.map +1 -0
  145. package/dist/utils/webauthn-origin.js +37 -0
  146. package/dist/utils/webauthn-origin.js.map +1 -0
  147. package/dist/webhook-integration/webhook-integration.controller.d.ts +13 -0
  148. package/dist/webhook-integration/webhook-integration.controller.d.ts.map +1 -1
  149. package/dist/webhook-integration/webhook-integration.controller.js +29 -0
  150. package/dist/webhook-integration/webhook-integration.controller.js.map +1 -1
  151. package/dist/webhook-integration/webhook-integration.module.js +3 -3
  152. package/dist/webhook-integration/webhook-integration.module.js.map +1 -1
  153. package/dist/webhook-integration/webhook-integration.service.d.ts +18 -2
  154. package/dist/webhook-integration/webhook-integration.service.d.ts.map +1 -1
  155. package/dist/webhook-integration/webhook-integration.service.js +110 -6
  156. package/dist/webhook-integration/webhook-integration.service.js.map +1 -1
  157. package/hedhog/data/integration_provider.yaml +9 -0
  158. package/hedhog/data/integration_type.yaml +6 -0
  159. package/hedhog/data/menu.yaml +6 -0
  160. package/hedhog/data/role.yaml +7 -0
  161. package/hedhog/data/route.yaml +36 -0
  162. package/hedhog/data/setting_group.yaml +119 -13
  163. package/hedhog/frontend/app/access-log/page.tsx.ejs +35 -3
  164. package/hedhog/frontend/app/account/components/active-sessions.tsx.ejs +36 -3
  165. package/hedhog/frontend/app/account/components/mcp-tokens.tsx.ejs +39 -4
  166. package/hedhog/frontend/app/account/components/tokens.tsx.ejs +39 -4
  167. package/hedhog/frontend/app/ai_agent/page.tsx.ejs +35 -2
  168. package/hedhog/frontend/app/configurations/[slug]/components/byte-size-input.tsx.ejs +160 -0
  169. package/hedhog/frontend/app/configurations/[slug]/components/duration-input.tsx.ejs +157 -0
  170. package/hedhog/frontend/app/configurations/[slug]/components/setting-field.tsx.ejs +244 -63
  171. package/hedhog/frontend/app/dashboard/[slug]/dashboard-content.tsx.ejs +33 -1
  172. package/hedhog/frontend/app/dashboard/management/tabs/component-roles-tab.tsx.ejs +35 -3
  173. package/hedhog/frontend/app/dashboard/management/tabs/components-tab.tsx.ejs +36 -4
  174. package/hedhog/frontend/app/dashboard/management/tabs/dashboard-roles-tab.tsx.ejs +35 -3
  175. package/hedhog/frontend/app/dashboard/management/tabs/dashboards-tab.tsx.ejs +36 -4
  176. package/hedhog/frontend/app/dashboard/management/tabs/items-tab.tsx.ejs +35 -3
  177. package/hedhog/frontend/app/integration/profiles/page.tsx.ejs +156 -38
  178. package/hedhog/frontend/app/integrations-webhooks/page.tsx.ejs +118 -11
  179. package/hedhog/frontend/app/mail/log/page.tsx.ejs +37 -4
  180. package/hedhog/frontend/app/menu/page.tsx.ejs +34 -2
  181. package/hedhog/frontend/app/preferences/page.tsx.ejs +77 -0
  182. package/hedhog/frontend/app/roles/menus.tsx.ejs +35 -3
  183. package/hedhog/frontend/app/roles/page.tsx.ejs +34 -2
  184. package/hedhog/frontend/app/roles/routes.tsx.ejs +36 -4
  185. package/hedhog/frontend/app/roles/users.tsx.ejs +36 -4
  186. package/hedhog/frontend/app/routes/page.tsx.ejs +34 -2
  187. package/hedhog/frontend/app/setting-list/page.tsx.ejs +34 -2
  188. package/hedhog/frontend/app/users/page.tsx.ejs +51 -21
  189. package/hedhog/frontend/messages/en.json +69 -4
  190. package/hedhog/frontend/messages/pt.json +69 -4
  191. package/hedhog/table/setting.yaml +2 -0
  192. package/hedhog/table/webhook_call_log.yaml +49 -46
  193. package/package.json +9 -4
  194. package/src/ai/ai.service.ts +9 -6
  195. package/src/app-command/app-command.module.ts +9 -0
  196. package/src/{webhook-integration/webhook-command.registry.ts → app-command/app-command.registry.ts} +9 -9
  197. package/src/auth/auth.controller.ts +20 -4
  198. package/src/auth/auth.service.ts +10 -36
  199. package/src/auth/dto/forget.dto.ts +5 -1
  200. package/src/auth/guards/auth.guard.ts +4 -1
  201. package/src/challenge/challenge.service.ts +30 -19
  202. package/src/file/dto/upload.dto.ts +25 -1
  203. package/src/file/file.controller.ts +31 -18
  204. package/src/file/file.service.ts +341 -16
  205. package/src/file/image-optimization.service.ts +111 -46
  206. package/src/file/provider/s3.provider.ts +16 -7
  207. package/src/file/provider/spaces.provider.ts +15 -5
  208. package/src/index.ts +4 -1
  209. package/src/integration/services/event-subscriber.registry.ts +15 -0
  210. package/src/integration/services/outbox.processor.ts +2 -5
  211. package/src/integration/services/outbox.service.ts +35 -17
  212. package/src/integration-profile/integration-credential-crypto.service.ts +146 -0
  213. package/src/integration-profile/integration-profile.controller.ts +2 -0
  214. package/src/integration-profile/integration-profile.module.ts +5 -2
  215. package/src/integration-profile/integration-profile.secrets.ts +51 -0
  216. package/src/integration-profile/integration-profile.service.ts +335 -54
  217. package/src/integration-profile/integration-profile.utils.ts +56 -0
  218. package/src/language/en.json +5 -1
  219. package/src/language/pt.json +5 -1
  220. package/src/mail/mail.controller.ts +5 -29
  221. package/src/mail/mail.module.ts +5 -5
  222. package/src/mail/mail.service.ts +37 -13
  223. package/src/mcp-chat/mcp-chat.service.ts +5 -5
  224. package/src/oauth/oauth-callback-coordinator.service.spec.ts +159 -0
  225. package/src/oauth/providers/facebook.provider.ts +3 -3
  226. package/src/oauth/providers/github.provider.ts +3 -3
  227. package/src/oauth/providers/google.provider.ts +3 -3
  228. package/src/oauth/providers/microsoft-entra-id.provider.ts +3 -3
  229. package/src/oauth/providers/microsoft.provider.ts +3 -3
  230. package/src/pdf/pdf.service.ts +19 -6
  231. package/src/profile/profile.controller.ts +21 -14
  232. package/src/profile/profile.service.ts +23 -20
  233. package/src/security/security.service.spec.ts +222 -0
  234. package/src/setting/setting.service.ts +15 -2
  235. package/src/token/token.service.ts +2 -1
  236. package/src/user/user.controller.ts +26 -16
  237. package/src/user/user.service.ts +25 -0
  238. package/src/utils/webauthn-origin.ts +38 -0
  239. package/src/webhook-integration/webhook-integration.controller.ts +23 -0
  240. package/src/webhook-integration/webhook-integration.module.ts +3 -3
  241. package/src/webhook-integration/webhook-integration.service.ts +115 -5
  242. package/dist/webhook-integration/webhook-command.registry.d.ts +0 -22
  243. package/dist/webhook-integration/webhook-command.registry.d.ts.map +0 -1
  244. package/dist/webhook-integration/webhook-command.registry.js.map +0 -1
  245. package/src/menu/menu.service.spec.ts +0 -247
  246. package/src/route/route.service.spec.ts +0 -300
  247. package/src/screen/screen.service.spec.ts +0 -298
  248. package/src/user/user.service.spec.ts +0 -294
@@ -4,6 +4,15 @@ import { PrismaService } from '@hed-hog/api-prisma';
4
4
  import { CreateDTO } from './dto/create.dto';
5
5
  import { ConflictResolutionDTO, ImportProfileItemDTO } from './dto/import-confirm.dto';
6
6
  import { UpdateDTO } from './dto/update.dto';
7
+ import { IntegrationCredentialCryptoService } from './integration-credential-crypto.service';
8
+ type IntegrationProfileExportItem = {
9
+ slug: string;
10
+ name: string;
11
+ type_slug: string;
12
+ provider_slug: string;
13
+ config: Record<string, unknown> | null;
14
+ is_active: boolean;
15
+ };
7
16
  type ValidatedImportItem = {
8
17
  index: number;
9
18
  slug: string;
@@ -22,17 +31,18 @@ type InvalidImportItem = {
22
31
  export declare class IntegrationProfileService {
23
32
  private readonly prismaService;
24
33
  private readonly paginationService;
25
- constructor(prismaService: PrismaService, paginationService: PaginationService);
34
+ private readonly credentialCrypto;
35
+ constructor(prismaService: PrismaService, paginationService: PaginationService, credentialCrypto: IntegrationCredentialCryptoService);
26
36
  listTypes(): Promise<{
27
37
  id: number;
28
38
  slug: string;
29
- icon: string;
30
39
  integration_type_locale: {
31
40
  name: string;
32
41
  locale: {
33
42
  code: string;
34
43
  };
35
44
  }[];
45
+ icon: string;
36
46
  }[]>;
37
47
  listProviders(typeId?: number, typeSlug?: string): Promise<{
38
48
  id: number;
@@ -45,7 +55,7 @@ export declare class IntegrationProfileService {
45
55
  }[];
46
56
  type_id: number;
47
57
  }[]>;
48
- list(paginationParams: PaginationDTO, typeId?: number, typeSlug?: string, providerSlug?: string): Promise<{
58
+ list(paginationParams: PaginationDTO, typeId?: number, typeSlug?: string, providerSlug?: string, slug?: string): Promise<{
49
59
  total: any;
50
60
  lastPage: number;
51
61
  page: number;
@@ -54,7 +64,37 @@ export declare class IntegrationProfileService {
54
64
  next: number;
55
65
  data: any[];
56
66
  }>;
67
+ /**
68
+ * Resolve o config do perfil de integração ATIVO para um par tipo/provider — uso
69
+ * server-side por serviços que precisam das credenciais (ex.: InfraScaler do
70
+ * autoscaling). Opcionalmente fixa um slug específico (vindo de uma setting). É o ponto
71
+ * único de acesso às credenciais armazenadas no Perfil de Integração.
72
+ */
73
+ getActiveProfileConfig(typeSlug: string, providerSlug: string, options?: {
74
+ profileSlug?: string;
75
+ profileId?: number;
76
+ }): Promise<{
77
+ id: number;
78
+ slug: string;
79
+ config: Record<string, unknown>;
80
+ }>;
81
+ /**
82
+ * Resolve um perfil ATIVO do tipo `infrastructure` (DigitalOcean, Kubernetes, …) por
83
+ * SLUG (vindo de uma setting) ou por ID (seleção direta na UI) — ou o mais recente se
84
+ * nada for dado. Retorna o slug do provider (para dispatch) e o config já decifrado
85
+ * pelo middleware. Uso interno do autoscaling.
86
+ */
87
+ getActiveInfrastructureProfile(options?: {
88
+ profileSlug?: string;
89
+ profileId?: number;
90
+ }): Promise<{
91
+ id: number;
92
+ slug: string;
93
+ providerSlug: string;
94
+ config: Record<string, unknown>;
95
+ }>;
57
96
  get(id: number): Promise<{
97
+ config: Record<string, unknown>;
58
98
  integration_provider: {
59
99
  slug: string;
60
100
  integration_provider_locale: {
@@ -66,15 +106,48 @@ export declare class IntegrationProfileService {
66
106
  };
67
107
  integration_type: {
68
108
  slug: string;
109
+ integration_type_locale: {
110
+ name: string;
111
+ locale: {
112
+ code: string;
113
+ };
114
+ }[];
69
115
  icon: string;
116
+ };
117
+ id: number;
118
+ created_at: Date;
119
+ name: string;
120
+ updated_at: Date;
121
+ provider_id: number;
122
+ slug: string;
123
+ is_active: boolean;
124
+ type_id: number;
125
+ }>;
126
+ /**
127
+ * Igual a `get(id)`, porém resolvendo o perfil pelo SLUG (valor estável guardado em
128
+ * settings). Reusa `get()` para manter o mesmo include e o mascaramento de segredos.
129
+ */
130
+ getBySlug(slug: string): Promise<{
131
+ config: Record<string, unknown>;
132
+ integration_provider: {
133
+ slug: string;
134
+ integration_provider_locale: {
135
+ name: string;
136
+ locale: {
137
+ code: string;
138
+ };
139
+ }[];
140
+ };
141
+ integration_type: {
142
+ slug: string;
70
143
  integration_type_locale: {
71
144
  name: string;
72
145
  locale: {
73
146
  code: string;
74
147
  };
75
148
  }[];
149
+ icon: string;
76
150
  };
77
- } & {
78
151
  id: number;
79
152
  created_at: Date;
80
153
  name: string;
@@ -82,7 +155,6 @@ export declare class IntegrationProfileService {
82
155
  provider_id: number;
83
156
  slug: string;
84
157
  is_active: boolean;
85
- config: import("@prisma/client/runtime/library").JsonValue | null;
86
158
  type_id: number;
87
159
  }>;
88
160
  create(data: CreateDTO): Promise<{
@@ -93,9 +165,11 @@ export declare class IntegrationProfileService {
93
165
  provider_id: number;
94
166
  slug: string;
95
167
  is_active: boolean;
96
- config: import("@prisma/client/runtime/library").JsonValue | null;
97
168
  type_id: number;
169
+ config: import("@prisma/client/runtime/library").JsonValue | null;
98
170
  }>;
171
+ /** Resolve o slug do provider a partir do id (para saber as chaves sensíveis). */
172
+ private getProviderSlug;
99
173
  update({ id, data }: {
100
174
  id: number;
101
175
  data: UpdateDTO;
@@ -107,8 +181,8 @@ export declare class IntegrationProfileService {
107
181
  provider_id: number;
108
182
  slug: string;
109
183
  is_active: boolean;
110
- config: import("@prisma/client/runtime/library").JsonValue | null;
111
184
  type_id: number;
185
+ config: import("@prisma/client/runtime/library").JsonValue | null;
112
186
  }>;
113
187
  delete({ ids }: DeleteDTO): Promise<{
114
188
  count: number;
@@ -121,6 +195,27 @@ export declare class IntegrationProfileService {
121
195
  ids?: number[];
122
196
  includeSecrets?: boolean;
123
197
  }): Promise<Buffer>;
198
+ /**
199
+ * Returns export-ready profile items (slug/name/type_slug/provider_slug/config/
200
+ * is_active) plus the source-environment `id`. Used by callers that must reference
201
+ * profiles by id — e.g. the agent workflow export, which remaps node
202
+ * `integrationProfileId` through id → slug → (destination) id. `config` is decrypted
203
+ * defensively and sanitized per `includeSecrets`.
204
+ */
205
+ exportProfileItemsByIds(ids: number[] | undefined, includeSecrets: boolean): Promise<(IntegrationProfileExportItem & {
206
+ id: number;
207
+ })[]>;
208
+ /**
209
+ * Validates that each item's type_slug/provider_slug exist and that the provider
210
+ * belongs to the type. Returns a map of item slug → list of errors (empty = valid).
211
+ * Reused by external importers (e.g. the agent workflow import) to validate the
212
+ * credential profiles bundled inside a workflow file.
213
+ */
214
+ validateImportItems(items: {
215
+ slug: string;
216
+ type_slug: string;
217
+ provider_slug: string;
218
+ }[]): Promise<Map<string, string[]>>;
124
219
  validateImportFile(file: MulterFile): Promise<{
125
220
  format: {
126
221
  type: "integration-profile";
@@ -149,11 +244,33 @@ export declare class IntegrationProfileService {
149
244
  ignored: number;
150
245
  imported: number;
151
246
  }>;
247
+ /**
248
+ * Creates/updates integration profiles from import items, applying per-slug
249
+ * conflict resolutions, and returns a map from each item's (original) slug to the
250
+ * resulting profile id + applied action — plus aggregate counts. Re-encrypts config
251
+ * with the destination system key. Used by `confirmImport` (counts) and by the agent
252
+ * workflow import (which needs the resulting ids to remap node integrationProfileId).
253
+ *
254
+ * For `ignore` on a conflicting slug, the existing profile is left untouched but its
255
+ * id is still returned so callers can relink references to the local profile.
256
+ */
257
+ ensureProfilesBySlug(profiles: ImportProfileItemDTO[], conflictResolutions?: ConflictResolutionDTO[]): Promise<{
258
+ results: Map<string, {
259
+ id: number;
260
+ slug: string;
261
+ action: 'created' | 'replaced' | 'renamed' | 'ignored';
262
+ }>;
263
+ counts: {
264
+ created: number;
265
+ replaced: number;
266
+ renamed: number;
267
+ ignored: number;
268
+ };
269
+ }>;
152
270
  private ensureSlugIsAvailable;
153
271
  private validateTypeAndProvider;
154
272
  private parseImportEnvelope;
155
273
  private sanitizeConfigForExport;
156
- private getSensitiveConfigKeys;
157
274
  private generateUniqueSlug;
158
275
  }
159
276
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"integration-profile.service.d.ts","sourceRoot":"","sources":["../../src/integration-profile/integration-profile.service.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CAAC,EAAE,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAiCd,MAAM,CAAC,IAAI,EAAE,SAAS;;;;;;;;;;;IAgBtB,MAAM,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,SAAS,CAAA;KAAE;;;;;;;;;;;IAmCpD,MAAM,CAAC,EAAE,GAAG,EAAE,EAAE,SAAS,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAYtD,IAAI,CAAC,IAAI,EAAE,SAAS;;;;IA4CpB,cAAc,CAAC,EACnB,GAAG,EACH,cAAsB,GACvB,EAAE;QACD,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;QACf,cAAc,CAAC,EAAE,OAAO,CAAC;KAC1B,GAAG,OAAO,CAAC,MAAM,CAAC;IA2Cb,kBAAkB,CAAC,IAAI,EAAE,UAAU;;;;;;;;;;;;;;;;IAwInC,aAAa,CAAC,EAClB,QAAQ,EACR,mBAAmB,GACpB,EAAE;QACD,QAAQ,EAAE,oBAAoB,EAAE,CAAC;QACjC,mBAAmB,CAAC,EAAE,qBAAqB,EAAE,CAAC;KAC/C;;;;;;;;;YAgJa,qBAAqB;YAarB,uBAAuB;IAmBrC,OAAO,CAAC,mBAAmB;IA4C3B,OAAO,CAAC,uBAAuB;IAkB/B,OAAO,CAAC,sBAAsB;YAsBhB,kBAAkB;CAiBjC"}
1
+ {"version":3,"file":"integration-profile.service.d.ts","sourceRoot":"","sources":["../../src/integration-profile/integration-profile.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAUpD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC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