@hed-hog/core 0.0.294 → 0.0.296
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/auth/auth.controller.d.ts +4 -4
- package/dist/auth/auth.service.d.ts +4 -4
- package/dist/challenge/challenge.service.d.ts +2 -2
- package/dist/core.module.d.ts.map +1 -1
- package/dist/core.module.js +4 -1
- package/dist/core.module.js.map +1 -1
- package/dist/dashboard/dashboard-core/dashboard-core.controller.d.ts +1 -1
- package/dist/dashboard/dashboard-core/dashboard-core.service.d.ts +2 -2
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -1
- package/dist/integration/index.d.ts +4 -0
- package/dist/integration/index.d.ts.map +1 -0
- package/dist/integration/index.js +20 -0
- package/dist/integration/index.js.map +1 -0
- package/dist/integration/integration-api.validation.d.ts +2 -0
- package/dist/integration/integration-api.validation.d.ts.map +1 -0
- package/dist/integration/integration-api.validation.js +126 -0
- package/dist/integration/integration-api.validation.js.map +1 -0
- package/dist/integration/integration.module.d.ts +3 -0
- package/dist/integration/integration.module.d.ts.map +1 -0
- package/dist/integration/integration.module.js +54 -0
- package/dist/integration/integration.module.js.map +1 -0
- package/dist/integration/services/domain-event.publisher.d.ts +31 -0
- package/dist/integration/services/domain-event.publisher.d.ts.map +1 -0
- package/dist/integration/services/domain-event.publisher.js +79 -0
- package/dist/integration/services/domain-event.publisher.js.map +1 -0
- package/dist/integration/services/event-subscriber.registry.d.ts +37 -0
- package/dist/integration/services/event-subscriber.registry.d.ts.map +1 -0
- package/dist/integration/services/event-subscriber.registry.js +86 -0
- package/dist/integration/services/event-subscriber.registry.js.map +1 -0
- package/dist/integration/services/inbox.service.d.ts +55 -0
- package/dist/integration/services/inbox.service.d.ts.map +1 -0
- package/dist/integration/services/inbox.service.js +173 -0
- package/dist/integration/services/inbox.service.js.map +1 -0
- package/dist/integration/services/index.d.ts +12 -0
- package/dist/integration/services/index.d.ts.map +1 -0
- package/dist/integration/services/index.js +28 -0
- package/dist/integration/services/index.js.map +1 -0
- package/dist/integration/services/integration-developer-api.service.d.ts +30 -0
- package/dist/integration/services/integration-developer-api.service.d.ts.map +1 -0
- package/dist/integration/services/integration-developer-api.service.js +55 -0
- package/dist/integration/services/integration-developer-api.service.js.map +1 -0
- package/dist/integration/services/integration-link.service.d.ts +52 -0
- package/dist/integration/services/integration-link.service.d.ts.map +1 -0
- package/dist/integration/services/integration-link.service.js +128 -0
- package/dist/integration/services/integration-link.service.js.map +1 -0
- package/dist/integration/services/integration-settings.service.d.ts +23 -0
- package/dist/integration/services/integration-settings.service.d.ts.map +1 -0
- package/dist/integration/services/integration-settings.service.js +81 -0
- package/dist/integration/services/integration-settings.service.js.map +1 -0
- package/dist/integration/services/outbox-polling.coordinator.d.ts +45 -0
- package/dist/integration/services/outbox-polling.coordinator.d.ts.map +1 -0
- package/dist/integration/services/outbox-polling.coordinator.js +143 -0
- package/dist/integration/services/outbox-polling.coordinator.js.map +1 -0
- package/dist/integration/services/outbox.notifier.d.ts +30 -0
- package/dist/integration/services/outbox.notifier.d.ts.map +1 -0
- package/dist/integration/services/outbox.notifier.js +57 -0
- package/dist/integration/services/outbox.notifier.js.map +1 -0
- package/dist/integration/services/outbox.processor.d.ts +42 -0
- package/dist/integration/services/outbox.processor.d.ts.map +1 -0
- package/dist/integration/services/outbox.processor.job.d.ts +43 -0
- package/dist/integration/services/outbox.processor.job.d.ts.map +1 -0
- package/dist/integration/services/outbox.processor.job.js +100 -0
- package/dist/integration/services/outbox.processor.job.js.map +1 -0
- package/dist/integration/services/outbox.processor.js +208 -0
- package/dist/integration/services/outbox.processor.js.map +1 -0
- package/dist/integration/services/outbox.service.d.ts +53 -0
- package/dist/integration/services/outbox.service.d.ts.map +1 -0
- package/dist/integration/services/outbox.service.js +149 -0
- package/dist/integration/services/outbox.service.js.map +1 -0
- package/dist/integration/types/event.types.d.ts +88 -0
- package/dist/integration/types/event.types.d.ts.map +1 -0
- package/dist/integration/types/event.types.js +35 -0
- package/dist/integration/types/event.types.js.map +1 -0
- package/dist/integration/types/index.d.ts +3 -0
- package/dist/integration/types/index.d.ts.map +1 -0
- package/dist/integration/types/index.js +19 -0
- package/dist/integration/types/index.js.map +1 -0
- package/dist/integration/types/subscriber.types.d.ts +31 -0
- package/dist/integration/types/subscriber.types.d.ts.map +1 -0
- package/dist/integration/types/subscriber.types.js +3 -0
- package/dist/integration/types/subscriber.types.js.map +1 -0
- package/dist/mail/mail.controller.d.ts +2 -2
- package/dist/mail/mail.service.d.ts +2 -2
- package/dist/mail-sent/mail-sent.controller.d.ts +3 -3
- package/dist/mail-sent/mail-sent.service.d.ts +3 -3
- package/dist/oauth/oauth.controller.js.map +1 -1
- package/dist/oauth/oauth.service.d.ts +3 -3
- package/dist/oauth/oauth.service.d.ts.map +1 -1
- package/dist/oauth/oauth.service.js.map +1 -1
- package/dist/profile/profile.controller.d.ts +3 -3
- package/dist/profile/profile.service.d.ts +3 -3
- package/dist/setting/setting.controller.d.ts +12 -8
- package/dist/setting/setting.controller.d.ts.map +1 -1
- package/dist/setting/setting.service.d.ts +12 -8
- package/dist/setting/setting.service.d.ts.map +1 -1
- package/dist/setting/setting.service.js +21 -1
- package/dist/setting/setting.service.js.map +1 -1
- package/dist/user/user.controller.d.ts +4 -4
- package/dist/user/user.service.d.ts +9 -9
- package/hedhog/data/route.yaml +2 -0
- package/hedhog/data/setting_group.yaml +955 -470
- package/hedhog/data/setting_subgroup.yaml +303 -0
- package/hedhog/frontend/app/configurations/[slug]/components/setting-field.tsx.ejs +44 -18
- package/hedhog/frontend/app/configurations/[slug]/page.tsx.ejs +134 -27
- package/hedhog/frontend/app/configurations/layout.tsx.ejs +84 -23
- package/hedhog/frontend/app/preferences/page.tsx.ejs +45 -48
- package/hedhog/table/inbox_event.yaml +40 -0
- package/hedhog/table/integration_link.yaml +33 -0
- package/hedhog/table/outbox_event.yaml +45 -0
- package/hedhog/table/setting.yaml +7 -0
- package/hedhog/table/setting_subgroup.yaml +19 -0
- package/package.json +8 -8
- package/src/core.module.ts +4 -1
- package/src/index.ts +15 -0
- package/src/integration/README.md +397 -0
- package/src/integration/USAGE_EXAMPLE.md +279 -0
- package/src/integration/index.ts +4 -0
- package/src/integration/integration-api.validation.ts +154 -0
- package/src/integration/integration.module.ts +53 -0
- package/src/integration/services/domain-event.publisher.ts +136 -0
- package/src/integration/services/event-subscriber.registry.ts +89 -0
- package/src/integration/services/inbox.service.ts +218 -0
- package/src/integration/services/index.ts +12 -0
- package/src/integration/services/integration-developer-api.service.ts +96 -0
- package/src/integration/services/integration-link.service.ts +154 -0
- package/src/integration/services/integration-settings.service.ts +128 -0
- package/src/integration/services/outbox-polling.coordinator.ts +146 -0
- package/src/integration/services/outbox.notifier.ts +48 -0
- package/src/integration/services/outbox.processor.job.ts +97 -0
- package/src/integration/services/outbox.processor.ts +266 -0
- package/src/integration/services/outbox.service.ts +209 -0
- package/src/integration/types/event.types.ts +93 -0
- package/src/integration/types/index.ts +3 -0
- package/src/integration/types/subscriber.types.ts +37 -0
- package/src/oauth/oauth.controller.ts +17 -17
- package/src/oauth/oauth.service.ts +20 -20
- package/src/setting/setting.service.ts +27 -2
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { PrismaService,
|
|
1
|
+
import { PrismaService, user_account_provider_52222e2ecb_enum } from '@hed-hog/api-prisma';
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
BadRequestException,
|
|
4
|
+
ConflictException,
|
|
5
|
+
Inject,
|
|
6
|
+
Injectable,
|
|
7
|
+
NotFoundException,
|
|
8
|
+
forwardRef
|
|
9
9
|
} from '@nestjs/common';
|
|
10
10
|
import { AuthService } from '../auth/auth.service';
|
|
11
11
|
import { FileService } from '../file/file.service';
|
|
@@ -26,7 +26,7 @@ type HandleCallbackProps = {
|
|
|
26
26
|
ipAddress: string;
|
|
27
27
|
userAgent: string;
|
|
28
28
|
res: Response;
|
|
29
|
-
provider:
|
|
29
|
+
provider: user_account_provider_52222e2ecb_enum;
|
|
30
30
|
code?: string;
|
|
31
31
|
type: 'login' | 'register' | 'connect' | 'disconnect';
|
|
32
32
|
userId?: number;
|
|
@@ -61,7 +61,7 @@ export class OAuthService {
|
|
|
61
61
|
this.providers.set(microsoftEntraId.getProviderType(), microsoftEntraId);
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
getAuthUrl(provider:
|
|
64
|
+
getAuthUrl(provider: user_account_provider_52222e2ecb_enum, callbackPath: string) {
|
|
65
65
|
return this.getProvider(provider).getAuthUrl(callbackPath);
|
|
66
66
|
}
|
|
67
67
|
|
|
@@ -96,14 +96,14 @@ export class OAuthService {
|
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
private getProvider(provider:
|
|
99
|
+
private getProvider(provider: user_account_provider_52222e2ecb_enum) {
|
|
100
100
|
const prov = this.providers.get(String(provider).toUpperCase());
|
|
101
101
|
if (!prov)
|
|
102
102
|
throw new BadRequestException(`Provider ${provider} não suportado`);
|
|
103
103
|
return prov;
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
-
private async getProviderScopes(provider:
|
|
106
|
+
private async getProviderScopes(provider: user_account_provider_52222e2ecb_enum) {
|
|
107
107
|
const settingKey = `${String(provider).toLowerCase().replace(/-/g, '_')}_scopes`;
|
|
108
108
|
|
|
109
109
|
const settings = await this.setting.getSettingValues([
|
|
@@ -118,13 +118,13 @@ export class OAuthService {
|
|
|
118
118
|
return settings[settingKey].join(',') || '';
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
-
private async handleLogin(res: Response, locale: string, ipAddress: string, userAgent: string, provider:
|
|
121
|
+
private async handleLogin(res: Response, locale: string, ipAddress: string, userAgent: string, provider: user_account_provider_52222e2ecb_enum, profile: any) {
|
|
122
122
|
|
|
123
123
|
console.log('[OAuthService] Handling login for provider:', provider);
|
|
124
124
|
|
|
125
125
|
const userAccount = await this.prisma.user_account.findFirst({
|
|
126
126
|
where: {
|
|
127
|
-
provider: String(provider).toLowerCase().replace(/-/g, '_') as
|
|
127
|
+
provider: String(provider).toLowerCase().replace(/-/g, '_') as user_account_provider_52222e2ecb_enum,
|
|
128
128
|
email: profile.email,
|
|
129
129
|
},
|
|
130
130
|
include: {
|
|
@@ -177,7 +177,7 @@ export class OAuthService {
|
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
179
|
|
|
180
|
-
private async handleRegister(res: Response, locale: string, ipAddress: string, userAgent: string, provider:
|
|
180
|
+
private async handleRegister(res: Response, locale: string, ipAddress: string, userAgent: string, provider: user_account_provider_52222e2ecb_enum, profile: any) {
|
|
181
181
|
const existingUser = await this.prisma.user_identifier.findFirst({
|
|
182
182
|
where: {
|
|
183
183
|
type: 'email',
|
|
@@ -223,7 +223,7 @@ export class OAuthService {
|
|
|
223
223
|
},
|
|
224
224
|
user_account: {
|
|
225
225
|
create: {
|
|
226
|
-
provider: String(provider).toLowerCase().replace(/-/g, '_') as
|
|
226
|
+
provider: String(provider).toLowerCase().replace(/-/g, '_') as user_account_provider_52222e2ecb_enum,
|
|
227
227
|
provider_user_id: profile.id,
|
|
228
228
|
email: profile.email,
|
|
229
229
|
refresh_token: encryptedRefreshToken ? Buffer.from(encryptedRefreshToken) : null,
|
|
@@ -272,14 +272,14 @@ export class OAuthService {
|
|
|
272
272
|
locale: string,
|
|
273
273
|
ipAddress: string,
|
|
274
274
|
userAgent: string,
|
|
275
|
-
provider:
|
|
275
|
+
provider: user_account_provider_52222e2ecb_enum,
|
|
276
276
|
profile: any,
|
|
277
277
|
userId: number,
|
|
278
278
|
) {
|
|
279
279
|
const existingAccount = await this.prisma.user_account.findFirst({
|
|
280
280
|
where: {
|
|
281
281
|
user_id: userId,
|
|
282
|
-
provider: String(provider).toLowerCase().replace(/-/g, '_') as
|
|
282
|
+
provider: String(provider).toLowerCase().replace(/-/g, '_') as user_account_provider_52222e2ecb_enum,
|
|
283
283
|
},
|
|
284
284
|
});
|
|
285
285
|
|
|
@@ -292,7 +292,7 @@ export class OAuthService {
|
|
|
292
292
|
await this.prisma.user_account.create({
|
|
293
293
|
data: {
|
|
294
294
|
user_id: userId,
|
|
295
|
-
provider: String(provider).toLowerCase().replace(/-/g, '_') as
|
|
295
|
+
provider: String(provider).toLowerCase().replace(/-/g, '_') as user_account_provider_52222e2ecb_enum,
|
|
296
296
|
provider_user_id: profile.id,
|
|
297
297
|
email: profile.email,
|
|
298
298
|
refresh_token: Buffer.from(encryptedRefreshToken),
|
|
@@ -334,11 +334,11 @@ export class OAuthService {
|
|
|
334
334
|
return { accessToken };
|
|
335
335
|
}
|
|
336
336
|
|
|
337
|
-
private async handleDisconnect(res: Response, locale: string, ipAddress: string, userAgent: string, provider:
|
|
337
|
+
private async handleDisconnect(res: Response, locale: string, ipAddress: string, userAgent: string, provider: user_account_provider_52222e2ecb_enum, email: string) {
|
|
338
338
|
const userAccount = await this.prisma.user_account.findFirst({
|
|
339
339
|
where: {
|
|
340
340
|
email,
|
|
341
|
-
provider: String(provider).toLowerCase().replace(/-/g, '_') as
|
|
341
|
+
provider: String(provider).toLowerCase().replace(/-/g, '_') as user_account_provider_52222e2ecb_enum,
|
|
342
342
|
},
|
|
343
343
|
include: { user: true }
|
|
344
344
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { itemTranslations } from '@hed-hog/api';
|
|
2
2
|
import { getLocaleText, LocaleService } from '@hed-hog/api-locale';
|
|
3
3
|
import { PaginationDTO, PaginationService } from '@hed-hog/api-pagination';
|
|
4
|
-
import { PrismaService,
|
|
4
|
+
import { PrismaService, setting_type_0f055cd5ea_enum } from '@hed-hog/api-prisma';
|
|
5
5
|
import {
|
|
6
6
|
BadRequestException,
|
|
7
7
|
forwardRef,
|
|
@@ -36,7 +36,7 @@ export class SettingService {
|
|
|
36
36
|
where: {
|
|
37
37
|
...( !includeSecrets ? {
|
|
38
38
|
NOT: [
|
|
39
|
-
{ type:
|
|
39
|
+
{ type: setting_type_0f055cd5ea_enum.secret },
|
|
40
40
|
],
|
|
41
41
|
} : {}),
|
|
42
42
|
},
|
|
@@ -294,6 +294,21 @@ export class SettingService {
|
|
|
294
294
|
},
|
|
295
295
|
},
|
|
296
296
|
},
|
|
297
|
+
setting_subgroup: {
|
|
298
|
+
include: {
|
|
299
|
+
setting_subgroup_locale: {
|
|
300
|
+
where: {
|
|
301
|
+
locale: {
|
|
302
|
+
code: locale,
|
|
303
|
+
},
|
|
304
|
+
},
|
|
305
|
+
select: {
|
|
306
|
+
name: true,
|
|
307
|
+
description: true,
|
|
308
|
+
},
|
|
309
|
+
},
|
|
310
|
+
},
|
|
311
|
+
},
|
|
297
312
|
setting_locale: {
|
|
298
313
|
where: {
|
|
299
314
|
locale: {
|
|
@@ -334,6 +349,16 @@ export class SettingService {
|
|
|
334
349
|
'setting_group_locale',
|
|
335
350
|
setting.setting_group,
|
|
336
351
|
);
|
|
352
|
+
|
|
353
|
+
if (setting.setting_subgroup) {
|
|
354
|
+
setting.setting_subgroup = itemTranslations(
|
|
355
|
+
'setting_subgroup_locale',
|
|
356
|
+
setting.setting_subgroup,
|
|
357
|
+
);
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
setting.subgroupId ??= setting.subgroup_id ?? setting.setting_subgroup?.id ?? null;
|
|
361
|
+
|
|
337
362
|
return setting;
|
|
338
363
|
});
|
|
339
364
|
|