@agentforge-io/nest 2.0.22 → 2.0.23

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 (142) hide show
  1. package/dist/providers/services.providers.js +16 -3
  2. package/dist/providers/services.providers.js.map +1 -1
  3. package/dist/tsconfig.build.tsbuildinfo +1 -1
  4. package/package.json +2 -2
  5. package/dist/database/entities/auth-identity.entity.d.ts +0 -1
  6. package/dist/database/entities/auth-identity.entity.js +0 -6
  7. package/dist/database/entities/auth-identity.entity.js.map +0 -1
  8. package/dist/database/entities/conversation.entity.d.ts +0 -1
  9. package/dist/database/entities/conversation.entity.js +0 -6
  10. package/dist/database/entities/conversation.entity.js.map +0 -1
  11. package/dist/database/entities/email-token.entity.d.ts +0 -1
  12. package/dist/database/entities/email-token.entity.js +0 -6
  13. package/dist/database/entities/email-token.entity.js.map +0 -1
  14. package/dist/database/entities/index.d.ts +0 -7
  15. package/dist/database/entities/index.js +0 -16
  16. package/dist/database/entities/index.js.map +0 -1
  17. package/dist/database/entities/message.entity.d.ts +0 -1
  18. package/dist/database/entities/message.entity.js +0 -6
  19. package/dist/database/entities/message.entity.js.map +0 -1
  20. package/dist/database/entities/refresh-token.entity.d.ts +0 -1
  21. package/dist/database/entities/refresh-token.entity.js +0 -6
  22. package/dist/database/entities/refresh-token.entity.js.map +0 -1
  23. package/dist/database/entities/subscription.entity.d.ts +0 -1
  24. package/dist/database/entities/subscription.entity.js +0 -6
  25. package/dist/database/entities/subscription.entity.js.map +0 -1
  26. package/dist/database/entities/usage-record.entity.d.ts +0 -1
  27. package/dist/database/entities/usage-record.entity.js +0 -6
  28. package/dist/database/entities/usage-record.entity.js.map +0 -1
  29. package/dist/database/entities/user.entity.d.ts +0 -1
  30. package/dist/database/entities/user.entity.js +0 -6
  31. package/dist/database/entities/user.entity.js.map +0 -1
  32. package/dist/decorators/require-plan.decorator.d.ts +0 -2
  33. package/dist/decorators/require-plan.decorator.js +0 -8
  34. package/dist/decorators/require-plan.decorator.js.map +0 -1
  35. package/dist/guards/usage-limit.guard.d.ts +0 -11
  36. package/dist/guards/usage-limit.guard.js +0 -57
  37. package/dist/guards/usage-limit.guard.js.map +0 -1
  38. package/dist/modules/admin/admin-plans.controller.d.ts +0 -11
  39. package/dist/modules/admin/admin-plans.controller.js +0 -97
  40. package/dist/modules/admin/admin-plans.controller.js.map +0 -1
  41. package/dist/modules/admin/admin-tenant-agents.controller.d.ts +0 -61
  42. package/dist/modules/admin/admin-tenant-agents.controller.js +0 -424
  43. package/dist/modules/admin/admin-tenant-agents.controller.js.map +0 -1
  44. package/dist/modules/admin/admin-tenant-billing.controller.d.ts +0 -51
  45. package/dist/modules/admin/admin-tenant-billing.controller.js +0 -119
  46. package/dist/modules/admin/admin-tenant-billing.controller.js.map +0 -1
  47. package/dist/modules/admin/admin-tenants.controller.d.ts +0 -43
  48. package/dist/modules/admin/admin-tenants.controller.js +0 -178
  49. package/dist/modules/admin/admin-tenants.controller.js.map +0 -1
  50. package/dist/modules/admin/admin-users.controller.d.ts +0 -41
  51. package/dist/modules/admin/admin-users.controller.js +0 -121
  52. package/dist/modules/admin/admin-users.controller.js.map +0 -1
  53. package/dist/modules/admin/admin.module.d.ts +0 -2
  54. package/dist/modules/admin/admin.module.js +0 -26
  55. package/dist/modules/admin/admin.module.js.map +0 -1
  56. package/dist/modules/admin/platform-admin.guard.d.ts +0 -7
  57. package/dist/modules/admin/platform-admin.guard.js +0 -52
  58. package/dist/modules/admin/platform-admin.guard.js.map +0 -1
  59. package/dist/modules/auth/auth.controller.d.ts +0 -63
  60. package/dist/modules/auth/auth.controller.js +0 -255
  61. package/dist/modules/auth/auth.controller.js.map +0 -1
  62. package/dist/modules/auth/auth.module.d.ts +0 -4
  63. package/dist/modules/auth/auth.module.js +0 -71
  64. package/dist/modules/auth/auth.module.js.map +0 -1
  65. package/dist/modules/auth/auth.service.d.ts +0 -2
  66. package/dist/modules/auth/auth.service.js +0 -7
  67. package/dist/modules/auth/auth.service.js.map +0 -1
  68. package/dist/modules/auth/decorators/current-user.decorator.d.ts +0 -8
  69. package/dist/modules/auth/decorators/current-user.decorator.js +0 -12
  70. package/dist/modules/auth/decorators/current-user.decorator.js.map +0 -1
  71. package/dist/modules/auth/decorators/public.decorator.d.ts +0 -2
  72. package/dist/modules/auth/decorators/public.decorator.js +0 -8
  73. package/dist/modules/auth/decorators/public.decorator.js.map +0 -1
  74. package/dist/modules/auth/dto/login.dto.d.ts +0 -4
  75. package/dist/modules/auth/dto/login.dto.js +0 -29
  76. package/dist/modules/auth/dto/login.dto.js.map +0 -1
  77. package/dist/modules/auth/dto/register.dto.d.ts +0 -5
  78. package/dist/modules/auth/dto/register.dto.js +0 -36
  79. package/dist/modules/auth/dto/register.dto.js.map +0 -1
  80. package/dist/modules/auth/guards/jwt-auth.guard.d.ts +0 -9
  81. package/dist/modules/auth/guards/jwt-auth.guard.js +0 -37
  82. package/dist/modules/auth/guards/jwt-auth.guard.js.map +0 -1
  83. package/dist/modules/auth/guards/local-auth.guard.d.ts +0 -4
  84. package/dist/modules/auth/guards/local-auth.guard.js +0 -18
  85. package/dist/modules/auth/guards/local-auth.guard.js.map +0 -1
  86. package/dist/modules/auth/guards/oauth-configured.guard.d.ts +0 -11
  87. package/dist/modules/auth/guards/oauth-configured.guard.js +0 -51
  88. package/dist/modules/auth/guards/oauth-configured.guard.js.map +0 -1
  89. package/dist/modules/auth/oauth.controller.d.ts +0 -20
  90. package/dist/modules/auth/oauth.controller.js +0 -208
  91. package/dist/modules/auth/oauth.controller.js.map +0 -1
  92. package/dist/modules/auth/refresh-token.service.d.ts +0 -2
  93. package/dist/modules/auth/refresh-token.service.js +0 -7
  94. package/dist/modules/auth/refresh-token.service.js.map +0 -1
  95. package/dist/modules/auth/strategies/github.strategy.d.ts +0 -12
  96. package/dist/modules/auth/strategies/github.strategy.js +0 -57
  97. package/dist/modules/auth/strategies/github.strategy.js.map +0 -1
  98. package/dist/modules/auth/strategies/google.strategy.d.ts +0 -19
  99. package/dist/modules/auth/strategies/google.strategy.js +0 -56
  100. package/dist/modules/auth/strategies/google.strategy.js.map +0 -1
  101. package/dist/modules/auth/strategies/jwt.strategy.d.ts +0 -18
  102. package/dist/modules/auth/strategies/jwt.strategy.js +0 -49
  103. package/dist/modules/auth/strategies/jwt.strategy.js.map +0 -1
  104. package/dist/modules/auth/strategies/local.strategy.d.ts +0 -11
  105. package/dist/modules/auth/strategies/local.strategy.js +0 -31
  106. package/dist/modules/auth/strategies/local.strategy.js.map +0 -1
  107. package/dist/modules/billing/adapters/billing-adapter.interface.d.ts +0 -1
  108. package/dist/modules/billing/adapters/billing-adapter.interface.js +0 -6
  109. package/dist/modules/billing/adapters/billing-adapter.interface.js.map +0 -1
  110. package/dist/modules/billing/adapters/stripe/stripe.adapter.d.ts +0 -19
  111. package/dist/modules/billing/adapters/stripe/stripe.adapter.js +0 -118
  112. package/dist/modules/billing/adapters/stripe/stripe.adapter.js.map +0 -1
  113. package/dist/modules/billing/billing.controller.d.ts +0 -54
  114. package/dist/modules/billing/billing.controller.js +0 -180
  115. package/dist/modules/billing/billing.controller.js.map +0 -1
  116. package/dist/modules/billing/billing.module.d.ts +0 -2
  117. package/dist/modules/billing/billing.module.js +0 -57
  118. package/dist/modules/billing/billing.module.js.map +0 -1
  119. package/dist/modules/billing/billing.service.d.ts +0 -2
  120. package/dist/modules/billing/billing.service.js +0 -7
  121. package/dist/modules/billing/billing.service.js.map +0 -1
  122. package/dist/modules/billing/usage.service.d.ts +0 -2
  123. package/dist/modules/billing/usage.service.js +0 -6
  124. package/dist/modules/billing/usage.service.js.map +0 -1
  125. package/dist/modules/email/adapters/email-adapter.interface.d.ts +0 -1
  126. package/dist/modules/email/adapters/email-adapter.interface.js +0 -6
  127. package/dist/modules/email/adapters/email-adapter.interface.js.map +0 -1
  128. package/dist/modules/email/adapters/noop.adapter.d.ts +0 -1
  129. package/dist/modules/email/adapters/noop.adapter.js +0 -6
  130. package/dist/modules/email/adapters/noop.adapter.js.map +0 -1
  131. package/dist/modules/email/adapters/resend.adapter.d.ts +0 -1
  132. package/dist/modules/email/adapters/resend.adapter.js +0 -6
  133. package/dist/modules/email/adapters/resend.adapter.js.map +0 -1
  134. package/dist/modules/email/email.module.d.ts +0 -2
  135. package/dist/modules/email/email.module.js +0 -17
  136. package/dist/modules/email/email.module.js.map +0 -1
  137. package/dist/modules/email/email.service.d.ts +0 -1
  138. package/dist/modules/email/email.service.js +0 -6
  139. package/dist/modules/email/email.service.js.map +0 -1
  140. package/dist/modules/email/templates/transactional.template.d.ts +0 -18
  141. package/dist/modules/email/templates/transactional.template.js +0 -43
  142. package/dist/modules/email/templates/transactional.template.js.map +0 -1
@@ -1,255 +0,0 @@
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
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.AuthController = void 0;
16
- const common_1 = require("@nestjs/common");
17
- const swagger_1 = require("@nestjs/swagger");
18
- const rate_limit_decorator_1 = require("../../decorators/rate-limit.decorator");
19
- const auth_service_1 = require("./auth.service");
20
- const register_dto_1 = require("./dto/register.dto");
21
- const login_dto_1 = require("./dto/login.dto");
22
- const public_decorator_1 = require("./decorators/public.decorator");
23
- const current_user_decorator_1 = require("./decorators/current-user.decorator");
24
- const constants_1 = require("../../constants");
25
- const ACCESS_COOKIE_DEFAULT_MS = 15 * 60 * 1000;
26
- const ONE_DAY_MS = 24 * 60 * 60 * 1000;
27
- let AuthController = class AuthController {
28
- constructor(config, auth) {
29
- this.config = config;
30
- this.auth = auth;
31
- }
32
- async register(dto, req, res) {
33
- const result = await this.auth.register(dto, this.metaFrom(req));
34
- this.setSessionCookies(res, result);
35
- return this.publicResult(result);
36
- }
37
- async login(dto, req, res) {
38
- const result = await this.auth.login(dto.email, dto.password, this.metaFrom(req));
39
- this.setSessionCookies(res, result);
40
- return this.publicResult(result);
41
- }
42
- async refresh(req, res) {
43
- const refreshCookie = req.cookies?.[this.refreshCookieName()];
44
- if (!refreshCookie)
45
- throw new common_1.UnauthorizedException('Missing refresh token');
46
- try {
47
- const result = await this.auth.refresh(refreshCookie, this.metaFrom(req));
48
- this.setSessionCookies(res, result);
49
- return this.publicResult(result);
50
- }
51
- catch (err) {
52
- this.clearSessionCookies(res);
53
- throw err;
54
- }
55
- }
56
- async logout(req, res) {
57
- const refreshCookie = req.cookies?.[this.refreshCookieName()];
58
- await this.auth.logout(refreshCookie);
59
- this.clearSessionCookies(res);
60
- }
61
- async logoutAll(userId, res) {
62
- await this.auth.logoutEverywhere(userId);
63
- this.clearSessionCookies(res);
64
- }
65
- me(user) {
66
- return user;
67
- }
68
- async verifyEmail(body) {
69
- if (!body?.token)
70
- throw new (await Promise.resolve().then(() => require('@nestjs/common'))).BadRequestException('token is required');
71
- return this.auth.verifyEmail(body.token);
72
- }
73
- async resendVerification(userId) {
74
- await this.auth.resendVerificationEmail(userId);
75
- }
76
- async requestPasswordReset(body) {
77
- if (!body?.email)
78
- throw new (await Promise.resolve().then(() => require('@nestjs/common'))).BadRequestException('email is required');
79
- await this.auth.requestPasswordReset(body.email);
80
- return { ok: true };
81
- }
82
- async resetPassword(body) {
83
- if (!body?.token || !body?.password) {
84
- throw new (await Promise.resolve().then(() => require('@nestjs/common'))).BadRequestException('token and password are required');
85
- }
86
- await this.auth.resetPassword(body.token, body.password);
87
- return { ok: true };
88
- }
89
- accessCookieName() {
90
- return this.config.auth?.cookieName ?? 'af_session';
91
- }
92
- refreshCookieName() {
93
- return this.config.auth?.refreshCookieName ?? 'af_refresh';
94
- }
95
- cookieSecure() {
96
- return this.config.auth?.cookieSecure ?? process.env.NODE_ENV === 'production';
97
- }
98
- metaFrom(req) {
99
- return {
100
- userAgent: req.headers['user-agent'],
101
- ip: req.headers['x-forwarded-for']?.split(',')[0]?.trim() || req.ip,
102
- };
103
- }
104
- setSessionCookies(res, r) {
105
- const secure = this.cookieSecure();
106
- const accessTtlMs = this.parseAccessTtlMs();
107
- const refreshTtlMs = (this.config.auth?.refreshTokenTtlDays ?? 30) * ONE_DAY_MS;
108
- res.cookie(this.accessCookieName(), r.accessToken, {
109
- httpOnly: true, secure, sameSite: 'lax', maxAge: accessTtlMs, path: '/',
110
- });
111
- res.cookie(this.refreshCookieName(), r.refreshToken, {
112
- httpOnly: true, secure, sameSite: 'lax', maxAge: refreshTtlMs,
113
- path: '/auth',
114
- });
115
- }
116
- clearSessionCookies(res) {
117
- const opts = { httpOnly: true, sameSite: 'lax' };
118
- res.clearCookie(this.accessCookieName(), { ...opts, path: '/' });
119
- res.clearCookie(this.refreshCookieName(), { ...opts, path: '/auth' });
120
- }
121
- publicResult(r) {
122
- return { accessToken: r.accessToken, user: r.user };
123
- }
124
- parseAccessTtlMs() {
125
- const ttl = this.config.auth?.accessTokenTtl ?? '15m';
126
- const m = /^(\d+)\s*(s|m|h|d)$/.exec(ttl.trim());
127
- if (!m)
128
- return ACCESS_COOKIE_DEFAULT_MS;
129
- const n = Number(m[1]);
130
- switch (m[2]) {
131
- case 's': return n * 1000;
132
- case 'm': return n * 60_000;
133
- case 'h': return n * 3_600_000;
134
- case 'd': return n * 86_400_000;
135
- default: return ACCESS_COOKIE_DEFAULT_MS;
136
- }
137
- }
138
- };
139
- exports.AuthController = AuthController;
140
- __decorate([
141
- (0, public_decorator_1.Public)(),
142
- (0, rate_limit_decorator_1.AgentForgeRateLimit)({ bucket: 'auth', limit: 6, windowMs: 60_000 }),
143
- (0, common_1.Post)('register'),
144
- (0, swagger_1.ApiOperation)({ summary: 'Create a new account (local strategy)' }),
145
- (0, common_1.HttpCode)(common_1.HttpStatus.CREATED),
146
- __param(0, (0, common_1.Body)()),
147
- __param(1, (0, common_1.Req)()),
148
- __param(2, (0, common_1.Res)({ passthrough: true })),
149
- __metadata("design:type", Function),
150
- __metadata("design:paramtypes", [register_dto_1.RegisterDto, Object, Object]),
151
- __metadata("design:returntype", Promise)
152
- ], AuthController.prototype, "register", null);
153
- __decorate([
154
- (0, public_decorator_1.Public)(),
155
- (0, rate_limit_decorator_1.AgentForgeRateLimit)({ bucket: 'auth', limit: 6, windowMs: 60_000 }),
156
- (0, common_1.Post)('login'),
157
- (0, swagger_1.ApiOperation)({ summary: 'Sign in with email and password (local strategy)' }),
158
- (0, common_1.HttpCode)(common_1.HttpStatus.OK),
159
- __param(0, (0, common_1.Body)()),
160
- __param(1, (0, common_1.Req)()),
161
- __param(2, (0, common_1.Res)({ passthrough: true })),
162
- __metadata("design:type", Function),
163
- __metadata("design:paramtypes", [login_dto_1.LoginDto, Object, Object]),
164
- __metadata("design:returntype", Promise)
165
- ], AuthController.prototype, "login", null);
166
- __decorate([
167
- (0, public_decorator_1.Public)(),
168
- (0, rate_limit_decorator_1.AgentForgeRateLimit)({ bucket: 'auth', limit: 30, windowMs: 60_000 }),
169
- (0, common_1.Post)('refresh'),
170
- (0, swagger_1.ApiOperation)({ summary: 'Exchange a refresh token for a new access+refresh pair' }),
171
- (0, common_1.HttpCode)(common_1.HttpStatus.OK),
172
- __param(0, (0, common_1.Req)()),
173
- __param(1, (0, common_1.Res)({ passthrough: true })),
174
- __metadata("design:type", Function),
175
- __metadata("design:paramtypes", [Object, Object]),
176
- __metadata("design:returntype", Promise)
177
- ], AuthController.prototype, "refresh", null);
178
- __decorate([
179
- (0, common_1.Post)('logout'),
180
- (0, swagger_1.ApiOperation)({ summary: 'Revoke the current refresh token and clear cookies' }),
181
- (0, common_1.HttpCode)(common_1.HttpStatus.NO_CONTENT),
182
- __param(0, (0, common_1.Req)()),
183
- __param(1, (0, common_1.Res)({ passthrough: true })),
184
- __metadata("design:type", Function),
185
- __metadata("design:paramtypes", [Object, Object]),
186
- __metadata("design:returntype", Promise)
187
- ], AuthController.prototype, "logout", null);
188
- __decorate([
189
- (0, common_1.Post)('logout-all'),
190
- (0, swagger_1.ApiOperation)({ summary: 'Revoke ALL refresh tokens for the current user (sign out everywhere)' }),
191
- (0, common_1.HttpCode)(common_1.HttpStatus.NO_CONTENT),
192
- __param(0, (0, current_user_decorator_1.CurrentUser)('userId')),
193
- __param(1, (0, common_1.Res)({ passthrough: true })),
194
- __metadata("design:type", Function),
195
- __metadata("design:paramtypes", [String, Object]),
196
- __metadata("design:returntype", Promise)
197
- ], AuthController.prototype, "logoutAll", null);
198
- __decorate([
199
- (0, common_1.Get)('me'),
200
- (0, swagger_1.ApiOperation)({ summary: 'Return the currently authenticated user' }),
201
- __param(0, (0, current_user_decorator_1.CurrentUser)()),
202
- __metadata("design:type", Function),
203
- __metadata("design:paramtypes", [Object]),
204
- __metadata("design:returntype", void 0)
205
- ], AuthController.prototype, "me", null);
206
- __decorate([
207
- (0, public_decorator_1.Public)(),
208
- (0, rate_limit_decorator_1.AgentForgeRateLimit)({ bucket: 'auth', limit: 10, windowMs: 60_000 }),
209
- (0, common_1.Post)('verify-email'),
210
- (0, swagger_1.ApiOperation)({ summary: 'Confirm an email using a token issued by /auth/register' }),
211
- (0, common_1.HttpCode)(common_1.HttpStatus.OK),
212
- __param(0, (0, common_1.Body)()),
213
- __metadata("design:type", Function),
214
- __metadata("design:paramtypes", [Object]),
215
- __metadata("design:returntype", Promise)
216
- ], AuthController.prototype, "verifyEmail", null);
217
- __decorate([
218
- (0, rate_limit_decorator_1.AgentForgeRateLimit)({ bucket: 'auth', limit: 3, windowMs: 60_000 }),
219
- (0, common_1.Post)('resend-verification'),
220
- (0, swagger_1.ApiOperation)({ summary: 'Re-send the verification email to the authenticated user' }),
221
- (0, common_1.HttpCode)(common_1.HttpStatus.NO_CONTENT),
222
- __param(0, (0, current_user_decorator_1.CurrentUser)('userId')),
223
- __metadata("design:type", Function),
224
- __metadata("design:paramtypes", [String]),
225
- __metadata("design:returntype", Promise)
226
- ], AuthController.prototype, "resendVerification", null);
227
- __decorate([
228
- (0, public_decorator_1.Public)(),
229
- (0, rate_limit_decorator_1.AgentForgeRateLimit)({ bucket: 'auth', limit: 3, windowMs: 60_000 }),
230
- (0, common_1.Post)('request-password-reset'),
231
- (0, swagger_1.ApiOperation)({ summary: 'Request a password-reset email (always returns 200, never reveals existence)' }),
232
- (0, common_1.HttpCode)(common_1.HttpStatus.OK),
233
- __param(0, (0, common_1.Body)()),
234
- __metadata("design:type", Function),
235
- __metadata("design:paramtypes", [Object]),
236
- __metadata("design:returntype", Promise)
237
- ], AuthController.prototype, "requestPasswordReset", null);
238
- __decorate([
239
- (0, public_decorator_1.Public)(),
240
- (0, rate_limit_decorator_1.AgentForgeRateLimit)({ bucket: 'auth', limit: 6, windowMs: 60_000 }),
241
- (0, common_1.Post)('reset-password'),
242
- (0, swagger_1.ApiOperation)({ summary: 'Use a reset token to set a new password (revokes all sessions)' }),
243
- (0, common_1.HttpCode)(common_1.HttpStatus.OK),
244
- __param(0, (0, common_1.Body)()),
245
- __metadata("design:type", Function),
246
- __metadata("design:paramtypes", [Object]),
247
- __metadata("design:returntype", Promise)
248
- ], AuthController.prototype, "resetPassword", null);
249
- exports.AuthController = AuthController = __decorate([
250
- (0, swagger_1.ApiTags)('Auth'),
251
- (0, common_1.Controller)('auth'),
252
- __param(0, (0, common_1.Inject)(constants_1.AGENT_FORGE_CONFIG)),
253
- __metadata("design:paramtypes", [Object, auth_service_1.AuthService])
254
- ], AuthController);
255
- //# sourceMappingURL=auth.controller.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"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AC,QAAQ,CAAC,CAAA;;;;wDAE9C;AASK;IALL,IAAA,yBAAM,GAAE;IACR,IAAA,0CAAmB,EAAC,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnE,IAAA,aAAI,EAAC,wBAAwB,CAAC;IAC9B,IAAA,sBAAY,EAAC,EAAE,OAAO,EAAE,8EAA8E,EAAE,CAAC;IACzG,IAAA,iBAAQ,EAAC,mBAAU,CAAC,EAAE,CAAC;IACI,WAAA,IAAA,aAAI,GAAE,CAAA;;;;0DAIjC;AAOK;IALL,IAAA,yBAAM,GAAE;IACR,IAAA,0CAAmB,EAAC,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnE,IAAA,aAAI,EAAC,gBAAgB,CAAC;IACtB,IAAA,sBAAY,EAAC,EAAE,OAAO,EAAE,gEAAgE,EAAE,CAAC;IAC3F,IAAA,iBAAQ,EAAC,mBAAU,CAAC,EAAE,CAAC;IACH,WAAA,IAAA,aAAI,GAAE,CAAA;;;;mDAM1B;yBAtIU,cAAc;IAF1B,IAAA,iBAAO,EAAC,MAAM,CAAC;IACf,IAAA,mBAAU,EAAC,MAAM,CAAC;IAGd,WAAA,IAAA,eAAM,EAAC,8BAAkB,CAAC,CAAA;6CACJ,0BAAW;GAHzB,cAAc,CAwM1B"}
@@ -1,4 +0,0 @@
1
- import { DynamicModule } from '@nestjs/common';
2
- export declare class AuthModule {
3
- static forFeature(): DynamicModule;
4
- }
@@ -1,71 +0,0 @@
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 AuthModule_1;
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.AuthModule = void 0;
11
- const common_1 = require("@nestjs/common");
12
- const core_1 = require("@nestjs/core");
13
- const jwt_1 = require("@nestjs/jwt");
14
- const passport_1 = require("@nestjs/passport");
15
- const typeorm_1 = require("@nestjs/typeorm");
16
- const user_entity_1 = require("../../database/entities/user.entity");
17
- const refresh_token_entity_1 = require("../../database/entities/refresh-token.entity");
18
- const auth_identity_entity_1 = require("../../database/entities/auth-identity.entity");
19
- const email_token_entity_1 = require("../../database/entities/email-token.entity");
20
- const email_module_1 = require("../email/email.module");
21
- const constants_1 = require("../../constants");
22
- const auth_controller_1 = require("./auth.controller");
23
- const oauth_controller_1 = require("./oauth.controller");
24
- const jwt_strategy_1 = require("./strategies/jwt.strategy");
25
- const local_strategy_1 = require("./strategies/local.strategy");
26
- const jwt_auth_guard_1 = require("./guards/jwt-auth.guard");
27
- let AuthModule = AuthModule_1 = class AuthModule {
28
- static forFeature() {
29
- return {
30
- module: AuthModule_1,
31
- imports: [
32
- typeorm_1.TypeOrmModule.forFeature([user_entity_1.UserEntity, refresh_token_entity_1.RefreshTokenEntity, auth_identity_entity_1.AuthIdentityEntity, email_token_entity_1.EmailTokenEntity]),
33
- email_module_1.EmailModule,
34
- passport_1.PassportModule.register({ defaultStrategy: 'agentforge-jwt' }),
35
- jwt_1.JwtModule.registerAsync({
36
- inject: [constants_1.AGENT_FORGE_CONFIG],
37
- useFactory: (cfg) => {
38
- const enabled = cfg.auth?.enabled === true;
39
- if (enabled && !cfg.auth?.jwtSecret) {
40
- throw new Error('AgentForge auth: jwtSecret is required when auth.enabled is true');
41
- }
42
- return {
43
- secret: cfg.auth?.jwtSecret ?? 'agentforge-auth-disabled',
44
- signOptions: { expiresIn: cfg.auth?.accessTokenTtl ?? '7d' },
45
- };
46
- },
47
- }),
48
- ],
49
- controllers: [auth_controller_1.AuthController, oauth_controller_1.OAuthController],
50
- providers: [
51
- local_strategy_1.LocalStrategy,
52
- jwt_strategy_1.JwtStrategy,
53
- {
54
- provide: core_1.APP_GUARD,
55
- inject: [core_1.Reflector, constants_1.AGENT_FORGE_CONFIG],
56
- useFactory: (reflector, cfg) => {
57
- if (!cfg.auth?.enabled) {
58
- return { canActivate: () => true };
59
- }
60
- return new jwt_auth_guard_1.JwtAuthGuard(reflector);
61
- },
62
- },
63
- ],
64
- };
65
- }
66
- };
67
- exports.AuthModule = AuthModule;
68
- exports.AuthModule = AuthModule = AuthModule_1 = __decorate([
69
- (0, common_1.Module)({})
70
- ], AuthModule);
71
- //# sourceMappingURL=auth.module.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auth.module.js","sourceRoot":"","sources":["../../../src/modules/auth/auth.module.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAAuD;AACvD,uCAAoD;AACpD,qCAAwC;AACxC,+CAAkD;AAClD,6CAAgD;AAChD,qEAAiE;AACjE,uFAAkF;AAClF,uFAAkF;AAClF,mFAA8E;AAC9E,wDAAoD;AACpD,+CAAqD;AAErD,uDAAmD;AACnD,yDAAqD;AAErD,4DAAwD;AACxD,gEAA4D;AAC5D,4DAAuD;AAkBhD,IAAM,UAAU,kBAAhB,MAAM,UAAU;IACrB,MAAM,CAAC,UAAU;QACf,OAAO;YACL,MAAM,EAAE,YAAU;YAClB,OAAO,EAAE;gBACP,uBAAa,CAAC,UAAU,CAAC,CAAC,wBAAU,EAAE,yCAAkB,EAAE,yCAAkB,EAAE,qCAAgB,CAAC,CAAC;gBAChG,0BAAW;gBACX,yBAAc,CAAC,QAAQ,CAAC,EAAE,eAAe,EAAE,gBAAgB,EAAE,CAAC;gBAC9D,eAAS,CAAC,aAAa,CAAC;oBACtB,MAAM,EAAE,CAAC,8BAAkB,CAAC;oBAC5B,UAAU,EAAE,CAAC,GAAqB,EAAE,EAAE;wBACpC,MAAM,OAAO,GAAG,GAAG,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;wBAC3C,IAAI,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,SAAS,EAAE,CAAC;4BACpC,MAAM,IAAI,KAAK,CACb,kEAAkE,CACnE,CAAC;wBACJ,CAAC;wBACD,OAAO;4BACL,MAAM,EAAE,GAAG,CAAC,IAAI,EAAE,SAAS,IAAI,0BAA0B;4BACzD,WAAW,EAAE,EAAE,SAAS,EAAE,GAAG,CAAC,IAAI,EAAE,cAAc,IAAI,IAAI,EAAE;yBAC7D,CAAC;oBACJ,CAAC;iBACF,CAAC;aACH;YACD,WAAW,EAAE,CAAC,gCAAc,EAAE,kCAAe,CAAC;YAC9C,SAAS,EAAE;gBAMT,8BAAa;gBACb,0BAAW;gBAKX;oBACE,OAAO,EAAE,gBAAS;oBAClB,MAAM,EAAE,CAAC,gBAAS,EAAE,8BAAkB,CAAC;oBACvC,UAAU,EAAE,CAAC,SAAoB,EAAE,GAAqB,EAAE,EAAE;wBAC1D,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,EAAE,CAAC;4BACvB,OAAO,EAAE,WAAW,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC;wBACrC,CAAC;wBACD,OAAO,IAAI,6BAAY,CAAC,SAAS,CAAC,CAAC;oBACrC,CAAC;iBACF;aACF;SACF,CAAC;IACJ,CAAC;CACF,CAAA;AAlDY,gCAAU;qBAAV,UAAU;IADtB,IAAA,eAAM,EAAC,EAAE,CAAC;GACE,UAAU,CAkDtB"}
@@ -1,2 +0,0 @@
1
- export { AuthService, AuthError } from '@agentforge/core';
2
- export type { AuthErrorCode, AuthResult, SessionMeta, AuthServiceOptions, } from '@agentforge/core';
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AuthError = exports.AuthService = void 0;
4
- var core_1 = require("@agentforge/core");
5
- Object.defineProperty(exports, "AuthService", { enumerable: true, get: function () { return core_1.AuthService; } });
6
- Object.defineProperty(exports, "AuthError", { enumerable: true, get: function () { return core_1.AuthError; } });
7
- //# sourceMappingURL=auth.service.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auth.service.js","sourceRoot":"","sources":["../../../src/modules/auth/auth.service.ts"],"names":[],"mappings":";;;AAAA,yCAA0D;AAAjD,mGAAA,WAAW,OAAA;AAAE,iGAAA,SAAS,OAAA"}
@@ -1,8 +0,0 @@
1
- export interface AuthUser {
2
- userId: string;
3
- email?: string;
4
- name?: string;
5
- role?: 'user' | 'platform_admin';
6
- isPlatformAdmin?: boolean;
7
- }
8
- export declare const CurrentUser: (...dataOrPipes: (import("@nestjs/common").PipeTransform<any, any> | import("@nestjs/common").Type<import("@nestjs/common").PipeTransform<any, any>> | keyof AuthUser | undefined)[]) => ParameterDecorator;
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CurrentUser = void 0;
4
- const common_1 = require("@nestjs/common");
5
- exports.CurrentUser = (0, common_1.createParamDecorator)((data, ctx) => {
6
- const request = ctx.switchToHttp().getRequest();
7
- const user = request.user;
8
- if (!user)
9
- return undefined;
10
- return data ? user[data] : user;
11
- });
12
- //# sourceMappingURL=current-user.decorator.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"current-user.decorator.js","sourceRoot":"","sources":["../../../../src/modules/auth/decorators/current-user.decorator.ts"],"names":[],"mappings":";;;AAAA,2CAAwE;AAqB3D,QAAA,WAAW,GAAG,IAAA,6BAAoB,EAC7C,CACE,IAAgC,EAChC,GAAqB,EAC4B,EAAE;IACnD,MAAM,OAAO,GAAG,GAAG,CAAC,YAAY,EAAE,CAAC,UAAU,EAAuB,CAAC;IACrE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAC1B,IAAI,CAAC,IAAI;QAAE,OAAO,SAAS,CAAC;IAC5B,OAAO,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAClC,CAAC,CACF,CAAC"}
@@ -1,2 +0,0 @@
1
- export declare const IS_PUBLIC_KEY = "agentforge:isPublic";
2
- export declare const Public: () => import("@nestjs/common").CustomDecorator<string>;
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Public = exports.IS_PUBLIC_KEY = void 0;
4
- const common_1 = require("@nestjs/common");
5
- exports.IS_PUBLIC_KEY = 'agentforge:isPublic';
6
- const Public = () => (0, common_1.SetMetadata)(exports.IS_PUBLIC_KEY, true);
7
- exports.Public = Public;
8
- //# sourceMappingURL=public.decorator.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"public.decorator.js","sourceRoot":"","sources":["../../../../src/modules/auth/decorators/public.decorator.ts"],"names":[],"mappings":";;;AAAA,2CAA6C;AAEhC,QAAA,aAAa,GAAG,qBAAqB,CAAC;AAY5C,MAAM,MAAM,GAAG,GAAG,EAAE,CAAC,IAAA,oBAAW,EAAC,qBAAa,EAAE,IAAI,CAAC,CAAC;AAAhD,QAAA,MAAM,UAA0C"}
@@ -1,4 +0,0 @@
1
- export declare class LoginDto {
2
- email: string;
3
- password: string;
4
- }
@@ -1,29 +0,0 @@
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.LoginDto = void 0;
13
- const class_validator_1 = require("class-validator");
14
- const swagger_1 = require("@nestjs/swagger");
15
- class LoginDto {
16
- }
17
- exports.LoginDto = LoginDto;
18
- __decorate([
19
- (0, swagger_1.ApiProperty)(),
20
- (0, class_validator_1.IsEmail)(),
21
- __metadata("design:type", String)
22
- ], LoginDto.prototype, "email", void 0);
23
- __decorate([
24
- (0, swagger_1.ApiProperty)(),
25
- (0, class_validator_1.IsString)(),
26
- (0, class_validator_1.IsNotEmpty)(),
27
- __metadata("design:type", String)
28
- ], LoginDto.prototype, "password", void 0);
29
- //# sourceMappingURL=login.dto.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"login.dto.js","sourceRoot":"","sources":["../../../../src/modules/auth/dto/login.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAgE;AAChE,6CAA8C;AAE9C,MAAa,QAAQ;CASpB;AATD,4BASC;AANC;IAFC,IAAA,qBAAW,GAAE;IACb,IAAA,yBAAO,GAAE;;uCACK;AAKf;IAHC,IAAA,qBAAW,GAAE;IACb,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;0CACK"}
@@ -1,5 +0,0 @@
1
- export declare class RegisterDto {
2
- email: string;
3
- password: string;
4
- name?: string;
5
- }
@@ -1,36 +0,0 @@
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.RegisterDto = void 0;
13
- const class_validator_1 = require("class-validator");
14
- const swagger_1 = require("@nestjs/swagger");
15
- class RegisterDto {
16
- }
17
- exports.RegisterDto = RegisterDto;
18
- __decorate([
19
- (0, swagger_1.ApiProperty)(),
20
- (0, class_validator_1.IsEmail)(),
21
- __metadata("design:type", String)
22
- ], RegisterDto.prototype, "email", void 0);
23
- __decorate([
24
- (0, swagger_1.ApiProperty)({ minLength: 8 }),
25
- (0, class_validator_1.IsString)(),
26
- (0, class_validator_1.MinLength)(8, { message: 'Password must be at least 8 characters' }),
27
- __metadata("design:type", String)
28
- ], RegisterDto.prototype, "password", void 0);
29
- __decorate([
30
- (0, swagger_1.ApiProperty)({ required: false }),
31
- (0, class_validator_1.IsOptional)(),
32
- (0, class_validator_1.IsString)(),
33
- (0, class_validator_1.IsNotEmpty)(),
34
- __metadata("design:type", String)
35
- ], RegisterDto.prototype, "name", void 0);
36
- //# sourceMappingURL=register.dto.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"register.dto.js","sourceRoot":"","sources":["../../../../src/modules/auth/dto/register.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAuF;AACvF,6CAA8C;AAE9C,MAAa,WAAW;CAevB;AAfD,kCAeC;AAZC;IAFC,IAAA,qBAAW,GAAE;IACb,IAAA,yBAAO,GAAE;;0CACK;AAKf;IAHC,IAAA,qBAAW,EAAC,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC;IAC7B,IAAA,0BAAQ,GAAE;IACV,IAAA,2BAAS,EAAC,CAAC,EAAE,EAAE,OAAO,EAAE,wCAAwC,EAAE,CAAC;;6CAClD;AAMlB;IAJC,IAAA,qBAAW,EAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;IAChC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;yCACC"}
@@ -1,9 +0,0 @@
1
- import { ExecutionContext } from '@nestjs/common';
2
- import { Reflector } from '@nestjs/core';
3
- declare const JwtAuthGuard_base: import("@nestjs/passport").Type<import("@nestjs/passport").IAuthGuard>;
4
- export declare class JwtAuthGuard extends JwtAuthGuard_base {
5
- private readonly reflector;
6
- constructor(reflector: Reflector);
7
- canActivate(context: ExecutionContext): boolean | Promise<boolean> | import("rxjs").Observable<boolean>;
8
- }
9
- export {};
@@ -1,37 +0,0 @@
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.JwtAuthGuard = void 0;
13
- const common_1 = require("@nestjs/common");
14
- const core_1 = require("@nestjs/core");
15
- const passport_1 = require("@nestjs/passport");
16
- const public_decorator_1 = require("../decorators/public.decorator");
17
- let JwtAuthGuard = class JwtAuthGuard extends (0, passport_1.AuthGuard)('agentforge-jwt') {
18
- constructor(reflector) {
19
- super();
20
- this.reflector = reflector;
21
- }
22
- canActivate(context) {
23
- const isPublic = this.reflector.getAllAndOverride(public_decorator_1.IS_PUBLIC_KEY, [
24
- context.getHandler(),
25
- context.getClass(),
26
- ]);
27
- if (isPublic)
28
- return true;
29
- return super.canActivate(context);
30
- }
31
- };
32
- exports.JwtAuthGuard = JwtAuthGuard;
33
- exports.JwtAuthGuard = JwtAuthGuard = __decorate([
34
- (0, common_1.Injectable)(),
35
- __metadata("design:paramtypes", [core_1.Reflector])
36
- ], JwtAuthGuard);
37
- //# sourceMappingURL=jwt-auth.guard.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"jwt-auth.guard.js","sourceRoot":"","sources":["../../../../src/modules/auth/guards/jwt-auth.guard.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA8D;AAC9D,uCAAyC;AACzC,+CAA6C;AAC7C,qEAA+D;AAOxD,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,IAAA,oBAAS,EAAC,gBAAgB,CAAC;IAC3D,YAA6B,SAAoB;QAC/C,KAAK,EAAE,CAAC;QADmB,cAAS,GAAT,SAAS,CAAW;IAEjD,CAAC;IAED,WAAW,CAAC,OAAyB;QACnC,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAU,gCAAa,EAAE;YACxE,OAAO,CAAC,UAAU,EAAE;YACpB,OAAO,CAAC,QAAQ,EAAE;SACnB,CAAC,CAAC;QACH,IAAI,QAAQ;YAAE,OAAO,IAAI,CAAC;QAC1B,OAAO,KAAK,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IACpC,CAAC;CACF,CAAA;AAbY,oCAAY;uBAAZ,YAAY;IADxB,IAAA,mBAAU,GAAE;qCAE6B,gBAAS;GADtC,YAAY,CAaxB"}
@@ -1,4 +0,0 @@
1
- declare const LocalAuthGuard_base: import("@nestjs/passport").Type<import("@nestjs/passport").IAuthGuard>;
2
- export declare class LocalAuthGuard extends LocalAuthGuard_base {
3
- }
4
- export {};
@@ -1,18 +0,0 @@
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
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.LocalAuthGuard = void 0;
10
- const common_1 = require("@nestjs/common");
11
- const passport_1 = require("@nestjs/passport");
12
- let LocalAuthGuard = class LocalAuthGuard extends (0, passport_1.AuthGuard)('agentforge-local') {
13
- };
14
- exports.LocalAuthGuard = LocalAuthGuard;
15
- exports.LocalAuthGuard = LocalAuthGuard = __decorate([
16
- (0, common_1.Injectable)()
17
- ], LocalAuthGuard);
18
- //# sourceMappingURL=local-auth.guard.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"local-auth.guard.js","sourceRoot":"","sources":["../../../../src/modules/auth/guards/local-auth.guard.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA4C;AAC5C,+CAA6C;AAGtC,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,IAAA,oBAAS,EAAC,kBAAkB,CAAC;CAAG,CAAA;AAAvD,wCAAc;yBAAd,cAAc;IAD1B,IAAA,mBAAU,GAAE;GACA,cAAc,CAAyC"}
@@ -1,11 +0,0 @@
1
- import { CanActivate, ExecutionContext } from '@nestjs/common';
2
- import { Reflector } from '@nestjs/core';
3
- import type { AgentForgeConfig, AuthStrategyName } from '../../../types';
4
- export declare const OAUTH_PROVIDER_KEY = "agentforge:oauthProvider";
5
- export declare const OAuthProvider: (provider: AuthStrategyName) => import("@nestjs/common").CustomDecorator<string>;
6
- export declare class OAuthConfiguredGuard implements CanActivate {
7
- private readonly reflector;
8
- private readonly config;
9
- constructor(reflector: Reflector, config: AgentForgeConfig);
10
- canActivate(ctx: ExecutionContext): boolean;
11
- }