@loopstack/auth 0.8.1 → 0.10.0

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 (105) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/LICENSE +43 -21
  3. package/dist/auth.module.d.ts +2 -2
  4. package/dist/auth.module.js +29 -24
  5. package/dist/auth.module.js.map +1 -1
  6. package/dist/controllers/auth.controller.d.ts +9 -16
  7. package/dist/controllers/auth.controller.js +40 -95
  8. package/dist/controllers/auth.controller.js.map +1 -1
  9. package/dist/dtos/hub-login-request.dto.d.ts +4 -0
  10. package/dist/dtos/hub-login-request.dto.js +30 -0
  11. package/dist/dtos/hub-login-request.dto.js.map +1 -0
  12. package/dist/dtos/worker-info.dto.d.ts +5 -0
  13. package/dist/dtos/worker-info.dto.js +42 -0
  14. package/dist/dtos/worker-info.dto.js.map +1 -0
  15. package/dist/exceptions/hub.exceptions.d.ts +16 -0
  16. package/dist/exceptions/hub.exceptions.js +35 -0
  17. package/dist/exceptions/hub.exceptions.js.map +1 -0
  18. package/dist/guards/hub-auth.guard.d.ts +4 -0
  19. package/dist/guards/{dev-auth.guard.js → hub-auth.guard.js} +6 -6
  20. package/dist/guards/hub-auth.guard.js.map +1 -0
  21. package/dist/guards/index.d.ts +0 -3
  22. package/dist/guards/index.js +0 -3
  23. package/dist/guards/index.js.map +1 -1
  24. package/dist/guards/jwt-auth.guard.d.ts +5 -3
  25. package/dist/guards/jwt-auth.guard.js +14 -4
  26. package/dist/guards/jwt-auth.guard.js.map +1 -1
  27. package/dist/guards/worker-auth.guard.d.ts +7 -0
  28. package/dist/{strategies/dev.strategy.js → guards/worker-auth.guard.js} +15 -20
  29. package/dist/guards/worker-auth.guard.js.map +1 -0
  30. package/dist/index.d.ts +0 -1
  31. package/dist/index.js +0 -1
  32. package/dist/index.js.map +1 -1
  33. package/dist/interfaces/auth-config.interface.d.ts +3 -13
  34. package/dist/interfaces/hub-service.interfaces.d.ts +16 -0
  35. package/dist/interfaces/hub-service.interfaces.js +3 -0
  36. package/dist/interfaces/hub-service.interfaces.js.map +1 -0
  37. package/dist/repositories/user.repository.d.ts +0 -1
  38. package/dist/repositories/user.repository.js +0 -6
  39. package/dist/repositories/user.repository.js.map +1 -1
  40. package/dist/services/auth.service.d.ts +7 -11
  41. package/dist/services/auth.service.js +32 -46
  42. package/dist/services/auth.service.js.map +1 -1
  43. package/dist/services/config-validation.service.d.ts +8 -0
  44. package/dist/services/config-validation.service.js +44 -0
  45. package/dist/services/config-validation.service.js.map +1 -0
  46. package/dist/services/hub-audit.service.d.ts +14 -0
  47. package/dist/services/hub-audit.service.js +47 -0
  48. package/dist/services/hub-audit.service.js.map +1 -0
  49. package/dist/services/hub.service.d.ts +20 -0
  50. package/dist/services/hub.service.js +179 -0
  51. package/dist/services/hub.service.js.map +1 -0
  52. package/dist/services/index.d.ts +1 -2
  53. package/dist/services/index.js +1 -2
  54. package/dist/services/index.js.map +1 -1
  55. package/dist/services/token.service.d.ts +10 -6
  56. package/dist/services/token.service.js +26 -23
  57. package/dist/services/token.service.js.map +1 -1
  58. package/dist/strategies/hub.strategy.d.ts +17 -0
  59. package/dist/strategies/hub.strategy.js +67 -0
  60. package/dist/strategies/hub.strategy.js.map +1 -0
  61. package/dist/strategies/index.d.ts +1 -3
  62. package/dist/strategies/index.js +1 -3
  63. package/dist/strategies/index.js.map +1 -1
  64. package/dist/strategies/jwt.strategy.d.ts +1 -1
  65. package/dist/strategies/jwt.strategy.js +10 -7
  66. package/dist/strategies/jwt.strategy.js.map +1 -1
  67. package/dist/tsconfig.tsbuildinfo +1 -1
  68. package/package.json +12 -11
  69. package/dist/decorators/current-user.decorator.d.ts +0 -1
  70. package/dist/decorators/current-user.decorator.js +0 -9
  71. package/dist/decorators/current-user.decorator.js.map +0 -1
  72. package/dist/decorators/index.d.ts +0 -3
  73. package/dist/decorators/index.js +0 -20
  74. package/dist/decorators/index.js.map +0 -1
  75. package/dist/decorators/public.decorator.d.ts +0 -1
  76. package/dist/decorators/public.decorator.js +0 -8
  77. package/dist/decorators/public.decorator.js.map +0 -1
  78. package/dist/decorators/roles.decorator.d.ts +0 -1
  79. package/dist/decorators/roles.decorator.js +0 -8
  80. package/dist/decorators/roles.decorator.js.map +0 -1
  81. package/dist/guards/dev-auth.guard.d.ts +0 -4
  82. package/dist/guards/dev-auth.guard.js.map +0 -1
  83. package/dist/guards/google-auth.guard.d.ts +0 -5
  84. package/dist/guards/google-auth.guard.js +0 -23
  85. package/dist/guards/google-auth.guard.js.map +0 -1
  86. package/dist/guards/local-auth.guard.d.ts +0 -4
  87. package/dist/guards/local-auth.guard.js +0 -18
  88. package/dist/guards/local-auth.guard.js.map +0 -1
  89. package/dist/repositories/auth-provider.repository.d.ts +0 -9
  90. package/dist/repositories/auth-provider.repository.js +0 -47
  91. package/dist/repositories/auth-provider.repository.js.map +0 -1
  92. package/dist/services/oauth.service.d.ts +0 -15
  93. package/dist/services/oauth.service.js +0 -91
  94. package/dist/services/oauth.service.js.map +0 -1
  95. package/dist/services/password.service.d.ts +0 -5
  96. package/dist/services/password.service.js +0 -25
  97. package/dist/services/password.service.js.map +0 -1
  98. package/dist/strategies/dev.strategy.d.ts +0 -9
  99. package/dist/strategies/dev.strategy.js.map +0 -1
  100. package/dist/strategies/google.strategy.d.ts +0 -8
  101. package/dist/strategies/google.strategy.js +0 -51
  102. package/dist/strategies/google.strategy.js.map +0 -1
  103. package/dist/strategies/local.strategy.d.ts +0 -8
  104. package/dist/strategies/local.strategy.js +0 -36
  105. package/dist/strategies/local.strategy.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # @loopstack/auth
2
2
 
3
+ ## 0.10.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Implement Block Processing
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies
12
+ - @loopstack/core@0.10.0
13
+ - @loopstack/shared@0.10.0
14
+
15
+ ## 0.9.0
16
+
17
+ ### Minor Changes
18
+
19
+ - Implement block scopes for automation components
20
+
21
+ ### Patch Changes
22
+
23
+ - Updated dependencies
24
+ - @loopstack/core@0.9.0
25
+ - @loopstack/shared@0.9.0
26
+
3
27
  ## 0.8.1
4
28
 
5
29
  ### Patch Changes
package/LICENSE CHANGED
@@ -1,21 +1,43 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 Loopstack GmbH
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ Business Source License 1.1
2
+
3
+ Parameters
4
+ ----------
5
+ Licensor: Loopstack GmbH
6
+ Licensed Work: Loopstack Auth Module (the "Licensed Work")
7
+ Additional Use Grant: You may freely use, copy, modify, and distribute the Licensed Work
8
+ for both personal and commercial purposes, subject to the conditions below.
9
+ Change Date: Four years after the release date of each version.
10
+ Change License: Apache License, Version 2.0
11
+
12
+ Terms
13
+ -----
14
+ 1. License Grant
15
+ The Licensed Work is made available under the terms of this Business Source License (the "License").
16
+ You are granted the right to use, copy, modify, and distribute the Licensed Work for any
17
+ personal or commercial purpose, provided that:
18
+
19
+ - You do not provide the Licensed Work to third parties as a managed or hosted service
20
+ where the primary value of the service is the Licensed Work itself, or a substantial
21
+ substitute for it.
22
+ - You comply with attribution requirements by including this License file with any distribution.
23
+
24
+ 2. Change License
25
+ On the Change Date, each version of the Licensed Work will automatically be
26
+ made available under the Change License (Apache License 2.0).
27
+
28
+ 3. Contributions
29
+ Any contributions to the Licensed Work will be licensed under the terms of this License
30
+ until the Change Date, and under the Change License thereafter.
31
+
32
+ 4. Disclaimer
33
+ The Licensed Work is provided "as is," without warranty of any kind, express or implied.
34
+
35
+ Additional Terms
36
+ ----------------
37
+ - This License does not grant you any rights to use the Licensor's trademarks or brand.
38
+ - This License explicitly permits both personal and commercial use of the Licensed Work,
39
+ including incorporation into commercial products and services, subject to the restrictions
40
+ outlined in Section 1.
41
+
42
+ For details on the Apache License 2.0 (effective after the Change Date), see:
43
+ https://www.apache.org/licenses/LICENSE-2.0
@@ -1,5 +1,5 @@
1
1
  import { DynamicModule } from '@nestjs/common';
2
- import { AuthConfig } from './interfaces';
3
2
  export declare class AuthModule {
4
- static forRoot(config: AuthConfig): DynamicModule;
3
+ static forRoot(): DynamicModule;
4
+ static forRootAsync(): DynamicModule;
5
5
  }
@@ -12,51 +12,56 @@ const common_1 = require("@nestjs/common");
12
12
  const jwt_1 = require("@nestjs/jwt");
13
13
  const passport_1 = require("@nestjs/passport");
14
14
  const typeorm_1 = require("@nestjs/typeorm");
15
+ const config_1 = require("@nestjs/config");
15
16
  const services_1 = require("./services");
16
17
  const strategies_1 = require("./strategies");
17
18
  const controllers_1 = require("./controllers");
18
19
  const repositories_1 = require("./repositories");
19
20
  const constants_1 = require("./constants");
20
21
  const shared_1 = require("@loopstack/shared");
21
- const auth_provider_repository_1 = require("./repositories/auth-provider.repository");
22
+ const core_1 = require("@nestjs/core");
23
+ const guards_1 = require("./guards");
24
+ const config_validation_service_1 = require("./services/config-validation.service");
25
+ const hub_audit_service_1 = require("./services/hub-audit.service");
22
26
  let AuthModule = AuthModule_1 = class AuthModule {
23
- static forRoot(config) {
24
- const strategies = [];
25
- if (config.strategies.includes('local')) {
26
- strategies.push(strategies_1.LocalStrategy);
27
- }
28
- if (config.strategies.includes('jwt')) {
29
- strategies.push(strategies_1.JwtStrategy);
30
- }
31
- if (config.strategies.includes('google') && config.oauth?.google) {
32
- strategies.push(strategies_1.GoogleStrategy);
33
- }
34
- if (config.strategies.includes('dev')) {
35
- strategies.push(strategies_1.DevStrategy);
36
- }
27
+ static forRoot() {
28
+ return this.forRootAsync();
29
+ }
30
+ static forRootAsync() {
37
31
  return {
38
32
  module: AuthModule_1,
39
33
  imports: [
40
34
  passport_1.PassportModule.register({ defaultStrategy: 'jwt' }),
41
- jwt_1.JwtModule.register({
42
- secret: config.jwt?.secret,
43
- signOptions: { expiresIn: config.jwt?.expiresIn || '1h' },
35
+ jwt_1.JwtModule.registerAsync({
36
+ useFactory: (configService) => ({
37
+ secret: configService.get('auth.jwt.secret'),
38
+ signOptions: {
39
+ expiresIn: configService.get('auth.jwt.expiresIn') || '1h'
40
+ },
41
+ }),
42
+ inject: [config_1.ConfigService],
44
43
  }),
45
- typeorm_1.TypeOrmModule.forFeature([shared_1.User, shared_1.Permission, shared_1.Role, shared_1.AuthProvider]),
44
+ typeorm_1.TypeOrmModule.forFeature([shared_1.User, shared_1.Permission, shared_1.Role]),
46
45
  ],
47
46
  controllers: [controllers_1.AuthController],
48
47
  providers: [
48
+ {
49
+ provide: core_1.APP_GUARD,
50
+ useClass: guards_1.JwtAuthGuard,
51
+ },
49
52
  {
50
53
  provide: constants_1.AUTH_CONFIG,
51
- useValue: config,
54
+ useFactory: (configService) => configService.get('auth'),
55
+ inject: [config_1.ConfigService],
52
56
  },
57
+ config_validation_service_1.ConfigValidationService,
53
58
  services_1.AuthService,
54
- services_1.OAuthService,
55
59
  repositories_1.UserRepository,
56
- auth_provider_repository_1.AuthProviderRepository,
57
- services_1.PasswordService,
58
60
  services_1.TokenService,
59
- ...strategies,
61
+ strategies_1.JwtStrategy,
62
+ services_1.HubService,
63
+ strategies_1.HubStrategy,
64
+ hub_audit_service_1.HubAuditService,
60
65
  ],
61
66
  exports: [services_1.AuthService, repositories_1.UserRepository],
62
67
  };
@@ -1 +1 @@
1
- {"version":3,"file":"auth.module.js","sourceRoot":"","sources":["../src/auth.module.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAAuD;AACvD,qCAAwC;AACxC,+CAAkD;AAClD,6CAAgD;AAChD,yCAAsF;AACtF,6CAAuF;AACvF,+CAA+C;AAC/C,iDAAgD;AAEhD,2CAA0C;AAC1C,8CAAyE;AACzE,sFAAiF;AAG1E,IAAM,UAAU,kBAAhB,MAAM,UAAU;IACrB,MAAM,CAAC,OAAO,CAAC,MAAkB;QAC/B,MAAM,UAAU,GAAU,EAAE,CAAC;QAE7B,IAAI,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,OAAc,CAAC,EAAE,CAAC;YAC/C,UAAU,CAAC,IAAI,CAAC,0BAAa,CAAC,CAAC;QACjC,CAAC;QAED,IAAI,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,KAAY,CAAC,EAAE,CAAC;YAC7C,UAAU,CAAC,IAAI,CAAC,wBAAW,CAAC,CAAC;QAC/B,CAAC;QAED,IAAI,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,QAAe,CAAC,IAAI,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC;YACxE,UAAU,CAAC,IAAI,CAAC,2BAAc,CAAC,CAAC;QAClC,CAAC;QAED,IAAI,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,KAAY,CAAC,EAAE,CAAC;YAC7C,UAAU,CAAC,IAAI,CAAC,wBAAW,CAAC,CAAC;QAC/B,CAAC;QAED,OAAO;YACL,MAAM,EAAE,YAAU;YAClB,OAAO,EAAE;gBACP,yBAAc,CAAC,QAAQ,CAAC,EAAE,eAAe,EAAE,KAAK,EAAE,CAAC;gBACnD,eAAS,CA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;gBACnD,eAAS,CAAC,aAAa,CAAC;oBACtB,UAAU,EAAE,CAAC,aAA4B,EAAE,EAAE,CAAC,CAAC;wBAC7C,MAAM,EAAE,aAAa,CAAC,GAAG,CAAS,iBAAiB,CAAC;wBACpD,WAAW,EAAE;4BACX,SAAS,EAAE,aAAa,CAAC,GAAG,CAAS,oBAAoB,CAAC,IAAI,IAAI;yBACnE;qBACF,CAAC;oBACF,MAAM,EAAE,CAAC,sBAAa,CAAC;iBACxB,CAAC;gBACF,uBAAa,CAAC,UAAU,CAAC,CAAC,aAAI,EAAE,mBAAU,EAAE,aAAI,CAAC,CAAC;aACnD;YACD,WAAW,EAAE,CAAC,4BAAc,CAAC;YAC7B,SAAS,EAAE;gBACT;oBACE,OAAO,EAAE,gBAAS;oBAClB,QAAQ,EAAE,qBAAY;iBACvB;gBACD;oBACE,OAAO,EAAE,uBAAW;oBACpB,UAAU,EAAE,CAAC,aAA4B,EAAE,EAAE,CAAC,aAAa,CAAC,GAAG,CAAa,MAAM,CAAC;oBACnF,MAAM,EAAE,CAAC,sBAAa,CAAC;iBACxB;gBACD,mDAAuB;gBACvB,sBAAW;gBACX,6BAAc;gBACd,uBAAY;gBACZ,wBAAW;gBACX,qBAAU;gBACV,wBAAW;gBACX,mCAAe;aAChB;YACD,OAAO,EAAE,CAAC,sBAAW,EAAE,6BAAc,CAAC;SACvC,CAAC;IACJ,CAAC;CACF,CAAA;AA5CY,gCAAU;qBAAV,UAAU;IADtB,IAAA,eAAM,EAAC,EAAE,CAAC;GACE,UAAU,CA4CtB"}
@@ -1,28 +1,21 @@
1
- import { AuthService, OAuthService, TokenService } from '../services';
2
- import { LinkProviderDto, LoginDto, RegisterDto, UserResponseDto } from '@loopstack/shared';
1
+ import { AuthService, TokenService } from '../services';
2
+ import { CurrentUserInterface, UserResponseDto } from '@loopstack/shared';
3
+ import { WorkerInfoDto } from '../dtos/worker-info.dto';
4
+ import { HubLoginRequestDto } from '../dtos/hub-login-request.dto';
3
5
  export declare class AuthController {
4
6
  private readonly authService;
5
7
  private readonly tokenService;
6
- private readonly oauthService;
7
- constructor(authService: AuthService, tokenService: TokenService, oauthService: OAuthService);
8
- login(req: any, res: any, loginDto: LoginDto): Promise<{
9
- message: string;
10
- }>;
11
- register(registerDto: RegisterDto): Promise<UserResponseDto>;
8
+ constructor(authService: AuthService, tokenService: TokenService);
9
+ private setCookies;
12
10
  refresh(req: any, res: any): Promise<{
13
11
  message: string;
14
12
  }>;
15
13
  logout(res: any): Promise<{
16
14
  message: string;
17
15
  }>;
18
- googleAuth(): Promise<void>;
19
- googleCallback(req: any, res: any): Promise<{
20
- message: string;
21
- }>;
22
- linkProvider(user: any, linkProviderDto: LinkProviderDto): Promise<UserResponseDto>;
23
- getProviders(user: any): Promise<string[]>;
24
- me(user: any): Promise<UserResponseDto>;
25
- devLogin(req: any, res: any): Promise<{
16
+ me(user: CurrentUserInterface): Promise<UserResponseDto>;
17
+ getInfo(): WorkerInfoDto;
18
+ hubLogin(hubLoginRequestDto: HubLoginRequestDto, req: any, res: any): Promise<{
26
19
  message: string;
27
20
  }>;
28
21
  }
@@ -15,84 +15,48 @@ Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.AuthController = void 0;
16
16
  const common_1 = require("@nestjs/common");
17
17
  const services_1 = require("../services");
18
- const guards_1 = require("../guards");
19
18
  const shared_1 = require("@loopstack/shared");
20
19
  const swagger_1 = require("@nestjs/swagger");
20
+ const hub_auth_guard_1 = require("../guards/hub-auth.guard");
21
+ const worker_info_dto_1 = require("../dtos/worker-info.dto");
22
+ const api_response_decorator_1 = require("@nestjs/swagger/dist/decorators/api-response.decorator");
23
+ const hub_login_request_dto_1 = require("../dtos/hub-login-request.dto");
21
24
  let AuthController = class AuthController {
22
25
  authService;
23
26
  tokenService;
24
- oauthService;
25
- constructor(authService, tokenService, oauthService) {
27
+ constructor(authService, tokenService) {
26
28
  this.authService = authService;
27
29
  this.tokenService = tokenService;
28
- this.oauthService = oauthService;
29
30
  }
30
- async login(req, res, loginDto) {
31
- const tokens = await this.authService.login(req.user);
32
- res.cookie('accessToken', tokens.accessToken, this.tokenService.createAccessTokenCookieOptions());
33
- res.cookie('refreshToken', tokens.refreshToken, this.tokenService.createRefreshTokenCookieOptions());
34
- return { message: 'Login successful' };
35
- }
36
- async register(registerDto) {
37
- return this.authService.register(registerDto);
31
+ setCookies(res, tokens) {
32
+ res.cookie(this.tokenService.getCookieName('access'), tokens.accessToken, this.tokenService.createAccessTokenCookieOptions());
33
+ res.cookie(this.tokenService.getCookieName('refresh'), tokens.refreshToken, this.tokenService.createRefreshTokenCookieOptions());
38
34
  }
39
35
  async refresh(req, res) {
40
- const refreshToken = req.cookies?.refreshToken;
36
+ const refreshTokenName = this.tokenService.getCookieName('refresh');
37
+ const refreshToken = req.cookies?.[refreshTokenName];
41
38
  const tokens = await this.authService.refresh(refreshToken);
42
- res.cookie('accessToken', tokens.accessToken, this.tokenService.createAccessTokenCookieOptions());
43
- res.cookie('refreshToken', tokens.refreshToken, this.tokenService.createRefreshTokenCookieOptions());
39
+ this.setCookies(res, tokens);
44
40
  return { message: 'Token refreshed successfully' };
45
41
  }
46
42
  async logout(res) {
47
- res.clearCookie('accessToken');
48
- res.clearCookie('refreshToken');
43
+ res.clearCookie(this.tokenService.getCookieName('access'));
44
+ res.clearCookie(this.tokenService.getCookieName('refresh'));
49
45
  return { message: 'Logout successful' };
50
46
  }
51
- async googleAuth() {
52
- }
53
- async googleCallback(req, res) {
54
- const tokens = await this.oauthService.handleOAuthLogin(req.user);
55
- res.cookie('accessToken', tokens.accessToken, this.tokenService.createAccessTokenCookieOptions());
56
- res.cookie('refreshToken', tokens.refreshToken, this.tokenService.createRefreshTokenCookieOptions());
57
- return { message: 'Login successful' };
58
- }
59
- async linkProvider(user, linkProviderDto) {
60
- return this.oauthService.linkProvider(user.userId, linkProviderDto);
61
- }
62
- async getProviders(user) {
63
- return this.oauthService.getUserProviders(user.userId);
64
- }
65
47
  async me(user) {
66
48
  return this.authService.getCurrentUser(user.userId);
67
49
  }
68
- async devLogin(req, res) {
50
+ getInfo() {
51
+ return this.authService.getWorkerHealthInfo();
52
+ }
53
+ async hubLogin(hubLoginRequestDto, req, res) {
69
54
  const tokens = await this.authService.login(req.user);
70
- res.cookie('accessToken', tokens.accessToken, this.tokenService.createAccessTokenCookieOptions());
71
- res.cookie('refreshToken', tokens.refreshToken, this.tokenService.createRefreshTokenCookieOptions());
55
+ this.setCookies(res, tokens);
72
56
  return { message: 'Login successful' };
73
57
  }
74
58
  };
75
59
  exports.AuthController = AuthController;
76
- __decorate([
77
- (0, shared_1.Public)(),
78
- (0, common_1.HttpCode)(common_1.HttpStatus.OK),
79
- (0, common_1.UseGuards)(guards_1.LocalAuthGuard),
80
- (0, common_1.Post)('login'),
81
- __param(0, (0, common_1.Request)()),
82
- __param(1, (0, common_1.Response)({ passthrough: true })),
83
- __param(2, (0, common_1.Body)()),
84
- __metadata("design:type", Function),
85
- __metadata("design:paramtypes", [Object, Object, shared_1.LoginDto]),
86
- __metadata("design:returntype", Promise)
87
- ], AuthController.prototype, "login", null);
88
- __decorate([
89
- (0, shared_1.Public)(),
90
- (0, common_1.Post)('register'),
91
- __param(0, (0, common_1.Body)()),
92
- __metadata("design:type", Function),
93
- __metadata("design:paramtypes", [shared_1.RegisterDto]),
94
- __metadata("design:returntype", Promise)
95
- ], AuthController.prototype, "register", null);
96
60
  __decorate([
97
61
  (0, shared_1.Public)(),
98
62
  (0, common_1.HttpCode)(common_1.HttpStatus.OK),
@@ -111,39 +75,6 @@ __decorate([
111
75
  __metadata("design:paramtypes", [Object]),
112
76
  __metadata("design:returntype", Promise)
113
77
  ], AuthController.prototype, "logout", null);
114
- __decorate([
115
- (0, shared_1.Public)(),
116
- (0, common_1.Get)('oauth/google'),
117
- (0, common_1.UseGuards)(guards_1.GoogleAuthGuard),
118
- __metadata("design:type", Function),
119
- __metadata("design:paramtypes", []),
120
- __metadata("design:returntype", Promise)
121
- ], AuthController.prototype, "googleAuth", null);
122
- __decorate([
123
- (0, shared_1.Public)(),
124
- (0, common_1.Get)('oauth/google/callback'),
125
- (0, common_1.UseGuards)(guards_1.GoogleAuthGuard),
126
- __param(0, (0, common_1.Request)()),
127
- __param(1, (0, common_1.Response)({ passthrough: true })),
128
- __metadata("design:type", Function),
129
- __metadata("design:paramtypes", [Object, Object]),
130
- __metadata("design:returntype", Promise)
131
- ], AuthController.prototype, "googleCallback", null);
132
- __decorate([
133
- (0, common_1.Post)('link-provider'),
134
- __param(0, (0, shared_1.CurrentUser)()),
135
- __param(1, (0, common_1.Body)()),
136
- __metadata("design:type", Function),
137
- __metadata("design:paramtypes", [Object, shared_1.LinkProviderDto]),
138
- __metadata("design:returntype", Promise)
139
- ], AuthController.prototype, "linkProvider", null);
140
- __decorate([
141
- (0, common_1.Get)('providers'),
142
- __param(0, (0, shared_1.CurrentUser)()),
143
- __metadata("design:type", Function),
144
- __metadata("design:paramtypes", [Object]),
145
- __metadata("design:returntype", Promise)
146
- ], AuthController.prototype, "getProviders", null);
147
78
  __decorate([
148
79
  (0, common_1.Get)('me'),
149
80
  __param(0, (0, shared_1.CurrentUser)()),
@@ -153,20 +84,34 @@ __decorate([
153
84
  ], AuthController.prototype, "me", null);
154
85
  __decorate([
155
86
  (0, shared_1.Public)(),
87
+ (0, common_1.Get)('worker/health'),
88
+ (0, api_response_decorator_1.ApiResponse)({ type: worker_info_dto_1.WorkerInfoDto }),
89
+ (0, swagger_1.ApiExtraModels)(worker_info_dto_1.WorkerInfoDto),
90
+ __metadata("design:type", Function),
91
+ __metadata("design:paramtypes", []),
92
+ __metadata("design:returntype", worker_info_dto_1.WorkerInfoDto)
93
+ ], AuthController.prototype, "getInfo", null);
94
+ __decorate([
95
+ (0, shared_1.Public)(),
96
+ (0, common_1.Post)('oauth/hub'),
156
97
  (0, common_1.HttpCode)(common_1.HttpStatus.OK),
157
- (0, common_1.UseGuards)(guards_1.DevAuthGuard),
158
- (0, common_1.Post)('login-dev'),
159
- __param(0, (0, common_1.Request)()),
160
- __param(1, (0, common_1.Response)({ passthrough: true })),
98
+ (0, common_1.UseGuards)(hub_auth_guard_1.HubAuthGuard),
99
+ (0, swagger_1.ApiOperation)({ summary: 'Login via Hub' }),
100
+ (0, swagger_1.ApiBody)({ type: hub_login_request_dto_1.HubLoginRequestDto }),
101
+ (0, swagger_1.ApiExtraModels)(hub_login_request_dto_1.HubLoginRequestDto),
102
+ (0, swagger_1.ApiOkResponse)(),
103
+ (0, swagger_1.ApiUnauthorizedResponse)(),
104
+ __param(0, (0, common_1.Body)()),
105
+ __param(1, (0, common_1.Request)()),
106
+ __param(2, (0, common_1.Response)({ passthrough: true })),
161
107
  __metadata("design:type", Function),
162
- __metadata("design:paramtypes", [Object, Object]),
108
+ __metadata("design:paramtypes", [hub_login_request_dto_1.HubLoginRequestDto, Object, Object]),
163
109
  __metadata("design:returntype", Promise)
164
- ], AuthController.prototype, "devLogin", null);
110
+ ], AuthController.prototype, "hubLogin", null);
165
111
  exports.AuthController = AuthController = __decorate([
166
112
  (0, swagger_1.ApiTags)('api/v1/auth'),
167
113
  (0, common_1.Controller)('api/v1/auth'),
168
114
  __metadata("design:paramtypes", [services_1.AuthService,
169
- services_1.TokenService,
170
- services_1.OAuthService])
115
+ services_1.TokenService])
171
116
  ], AuthController);
172
117
  //# sourceMappingURL=auth.controller.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"auth.controller.js","sourceRoot":"","sources":["../../src/controllers/auth.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAiH;AACjH,0CAAsE;AACtE,sCAA0E;AAC1E,8CAQ2B;AAC3B,6CAA0C;AAInC,IAAM,cAAc,GAApB,MAAM,cAAc;IAEN;IACA;IACA;IAHnB,YACmB,WAAwB,EACxB,YAA0B,EAC1B,YAA0B;QAF1B,gBAAW,GAAX,WAAW,CAAa;QACxB,iBAAY,GAAZ,YAAY,CAAc;QAC1B,iBAAY,GAAZ,YAAY,CAAc;IAC1C,CAAC;IAME,AAAN,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,CAAC;IACjB,IAAA,iBAAQ,EAAC,mBAAU,CAAC,EAAE,CAAC;IACvB,IAAA,kBAAS,EAAC,6BAAY,CAAC;IACvB,IAAA,sBAAY,EAAC,EAAE,OAAO,EAAE,eAAe,EAAE,CAAC;IAC1C,IAAA,iBAAO,EAAC,EAAE,IAAI,EAAE,0CAAkB,EAAE,CAAC;IACrC,IAAA,wBAAc,EAAC,0CAAkB,CAAC;IAClC,IAAA,uBAAa,GAAE;IACf,IAAA,iCAAuB,GAAE;IAEvB,WAAA,IAAA,aAAI,GAAE,CAAA;IACN,WAAA,IAAA,gBAAO,GAAE,CAAA;IACT,WAAA,IAAA,iBAAQ,EAAC,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAA;;qCAFJ,0CAAkB;;8CAU/C;yBApEU,cAAc;IAF1B,IAAA,iBAAO,EAAC,aAAa,CAAC;IACtB,IAAA,mBAAU,EAAC,aAAa,CAAC;qCAGQ,sBAAW;QACV,uBAAY;GAHlC,cAAc,CAqE1B"}
@@ -0,0 +1,4 @@
1
+ export declare class HubLoginRequestDto {
2
+ code: string;
3
+ grantType: string;
4
+ }
@@ -0,0 +1,30 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.HubLoginRequestDto = void 0;
13
+ const class_transformer_1 = require("class-transformer");
14
+ const swagger_1 = require("@nestjs/swagger");
15
+ class HubLoginRequestDto {
16
+ code;
17
+ grantType;
18
+ }
19
+ exports.HubLoginRequestDto = HubLoginRequestDto;
20
+ __decorate([
21
+ (0, class_transformer_1.Expose)(),
22
+ (0, swagger_1.ApiProperty)({ description: 'The authorization code' }),
23
+ __metadata("design:type", String)
24
+ ], HubLoginRequestDto.prototype, "code", void 0);
25
+ __decorate([
26
+ (0, class_transformer_1.Expose)(),
27
+ (0, swagger_1.ApiProperty)({ description: 'The grant type', example: 'authorization_code' }),
28
+ __metadata("design:type", String)
29
+ ], HubLoginRequestDto.prototype, "grantType", void 0);
30
+ //# sourceMappingURL=hub-login-request.dto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hub-login-request.dto.js","sourceRoot":"","sources":["../../src/dtos/hub-login-request.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yDAA2C;AAC3C,6CAA8C;AAE9C,MAAa,kBAAkB;IAG7B,IAAI,CAAS;IAIb,SAAS,CAAS;CACnB;AARD,gDAQC;AALC;IAFC,IAAA,0BAAM,GAAE;IACR,IAAA,qBAAW,EAAC,EAAE,WAAW,EAAE,wBAAwB,EAAE,CAAC;;gDAC1C;AAIb;IAFC,IAAA,0BAAM,GAAE;IACR,IAAA,qBAAW,EAAC,EAAE,WAAW,EAAE,gBAAgB,EAAE,OAAO,EAAE,oBAAoB,EAAE,CAAC;;qDAC5D"}
@@ -0,0 +1,5 @@
1
+ export declare class WorkerInfoDto {
2
+ clientId?: string;
3
+ isConfigured: boolean;
4
+ timestamp: string;
5
+ }
@@ -0,0 +1,42 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.WorkerInfoDto = void 0;
13
+ const class_transformer_1 = require("class-transformer");
14
+ const swagger_1 = require("@nestjs/swagger");
15
+ class WorkerInfoDto {
16
+ clientId;
17
+ isConfigured;
18
+ timestamp;
19
+ }
20
+ exports.WorkerInfoDto = WorkerInfoDto;
21
+ __decorate([
22
+ (0, class_transformer_1.Expose)(),
23
+ (0, swagger_1.ApiPropertyOptional)({
24
+ description: 'Worker Client ID',
25
+ }),
26
+ __metadata("design:type", String)
27
+ ], WorkerInfoDto.prototype, "clientId", void 0);
28
+ __decorate([
29
+ (0, class_transformer_1.Expose)(),
30
+ (0, swagger_1.ApiProperty)({
31
+ description: 'Is worker configured.',
32
+ }),
33
+ __metadata("design:type", Boolean)
34
+ ], WorkerInfoDto.prototype, "isConfigured", void 0);
35
+ __decorate([
36
+ (0, class_transformer_1.Expose)(),
37
+ (0, swagger_1.ApiProperty)({
38
+ description: 'Current Timestamp.',
39
+ }),
40
+ __metadata("design:type", String)
41
+ ], WorkerInfoDto.prototype, "timestamp", void 0);
42
+ //# sourceMappingURL=worker-info.dto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"worker-info.dto.js","sourceRoot":"","sources":["../../src/dtos/worker-info.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yDAAsD;AACtD,6CAAmE;AAEnE,MAAa,aAAa;IAKxB,QAAQ,CAAU;IAMlB,YAAY,CAAU;IAMtB,SAAS,CAAS;CACnB;AAlBD,sCAkBC;AAbC;IAJC,IAAA,0BAAM,GAAE;IACR,IAAA,6BAAmB,EAAC;QACnB,WAAW,EAAE,kBAAkB;KAChC,CAAC;;+CACgB;AAMlB;IAJC,IAAA,0BAAM,GAAE;IACR,IAAA,qBAAW,EAAC;QACX,WAAW,EAAE,uBAAuB;KACrC,CAAC;;mDACoB;AAMtB;IAJC,IAAA,0BAAM,GAAE;IACR,IAAA,qBAAW,EAAC;QACX,WAAW,EAAE,oBAAoB;KAClC,CAAC;;gDACgB"}
@@ -0,0 +1,16 @@
1
+ import { HttpException } from '@nestjs/common';
2
+ export declare class HubConfigurationException extends HttpException {
3
+ constructor(message: string);
4
+ }
5
+ export declare class HubServiceUnavailableException extends HttpException {
6
+ constructor();
7
+ }
8
+ export declare class InvalidAuthCodeException extends HttpException {
9
+ constructor();
10
+ }
11
+ export declare class HubAuthenticationException extends HttpException {
12
+ constructor();
13
+ }
14
+ export declare class HubTimeoutException extends HttpException {
15
+ constructor();
16
+ }
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HubTimeoutException = exports.HubAuthenticationException = exports.InvalidAuthCodeException = exports.HubServiceUnavailableException = exports.HubConfigurationException = void 0;
4
+ const common_1 = require("@nestjs/common");
5
+ class HubConfigurationException extends common_1.HttpException {
6
+ constructor(message) {
7
+ super(`Hub service configuration error: ${message}`, common_1.HttpStatus.INTERNAL_SERVER_ERROR);
8
+ }
9
+ }
10
+ exports.HubConfigurationException = HubConfigurationException;
11
+ class HubServiceUnavailableException extends common_1.HttpException {
12
+ constructor() {
13
+ super('Hub service is temporarily unavailable', common_1.HttpStatus.SERVICE_UNAVAILABLE);
14
+ }
15
+ }
16
+ exports.HubServiceUnavailableException = HubServiceUnavailableException;
17
+ class InvalidAuthCodeException extends common_1.HttpException {
18
+ constructor() {
19
+ super('Invalid or expired authorization code', common_1.HttpStatus.UNAUTHORIZED);
20
+ }
21
+ }
22
+ exports.InvalidAuthCodeException = InvalidAuthCodeException;
23
+ class HubAuthenticationException extends common_1.HttpException {
24
+ constructor() {
25
+ super('Failed to authenticate with hub service', common_1.HttpStatus.UNAUTHORIZED);
26
+ }
27
+ }
28
+ exports.HubAuthenticationException = HubAuthenticationException;
29
+ class HubTimeoutException extends common_1.HttpException {
30
+ constructor() {
31
+ super('Hub service request timeout', common_1.HttpStatus.REQUEST_TIMEOUT);
32
+ }
33
+ }
34
+ exports.HubTimeoutException = HubTimeoutException;
35
+ //# sourceMappingURL=hub.exceptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hub.exceptions.js","sourceRoot":"","sources":["../../src/exceptions/hub.exceptions.ts"],"names":[],"mappings":";;;AAAA,2CAA2D;AAE3D,MAAa,yBAA0B,SAAQ,sBAAa;IAC1D,YAAY,OAAe;QACzB,KAAK,CAAC,oCAAoC,OAAO,EAAE,EAAE,mBAAU,CAAC,qBAAqB,CAAC,CAAC;IACzF,CAAC;CACF;AAJD,8DAIC;AAED,MAAa,8BAA+B,SAAQ,sBAAa;IAC/D;QACE,KAAK,CAAC,wCAAwC,EAAE,mBAAU,CAAC,mBAAmB,CAAC,CAAC;IAClF,CAAC;CACF;AAJD,wEAIC;AAED,MAAa,wBAAyB,SAAQ,sBAAa;IACzD;QACE,KAAK,CAAC,uCAAuC,EAAE,mBAAU,CAAC,YAAY,CAAC,CAAC;IAC1E,CAAC;CACF;AAJD,4DAIC;AAED,MAAa,0BAA2B,SAAQ,sBAAa;IAC3D;QACE,KAAK,CAAC,yCAAyC,EAAE,mBAAU,CAAC,YAAY,CAAC,CAAC;IAC5E,CAAC;CACF;AAJD,gEAIC;AAED,MAAa,mBAAoB,SAAQ,sBAAa;IACpD;QACE,KAAK,CAAC,6BAA6B,EAAE,mBAAU,CAAC,eAAe,CAAC,CAAC;IACnE,CAAC;CACF;AAJD,kDAIC"}
@@ -0,0 +1,4 @@
1
+ declare const HubAuthGuard_base: import("@nestjs/passport").Type<import("@nestjs/passport").IAuthGuard>;
2
+ export declare class HubAuthGuard extends HubAuthGuard_base {
3
+ }
4
+ export {};
@@ -6,13 +6,13 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
6
6
  return c > 3 && r && Object.defineProperty(target, key, r), r;
7
7
  };
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.DevAuthGuard = void 0;
9
+ exports.HubAuthGuard = void 0;
10
10
  const common_1 = require("@nestjs/common");
11
11
  const passport_1 = require("@nestjs/passport");
12
- let DevAuthGuard = class DevAuthGuard extends (0, passport_1.AuthGuard)('dev') {
12
+ let HubAuthGuard = class HubAuthGuard extends (0, passport_1.AuthGuard)('hub') {
13
13
  };
14
- exports.DevAuthGuard = DevAuthGuard;
15
- exports.DevAuthGuard = DevAuthGuard = __decorate([
14
+ exports.HubAuthGuard = HubAuthGuard;
15
+ exports.HubAuthGuard = HubAuthGuard = __decorate([
16
16
  (0, common_1.Injectable)()
17
- ], DevAuthGuard);
18
- //# sourceMappingURL=dev-auth.guard.js.map
17
+ ], HubAuthGuard);
18
+ //# sourceMappingURL=hub-auth.guard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hub-auth.guard.js","sourceRoot":"","sources":["../../src/guards/hub-auth.guard.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA4C;AAC5C,+CAA6C;AAGtC,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,IAAA,oBAAS,EAAC,KAAK,CAAC;CAAG,CAAA;AAAxC,oCAAY;uBAAZ,YAAY;IADxB,IAAA,mBAAU,GAAE;GACA,YAAY,CAA4B"}