@agentforge-io/nest 2.0.21 → 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 (144) hide show
  1. package/dist/modules/public-chat/public-chat.controller.js +0 -12
  2. package/dist/modules/public-chat/public-chat.controller.js.map +1 -1
  3. package/dist/providers/services.providers.js +16 -3
  4. package/dist/providers/services.providers.js.map +1 -1
  5. package/dist/tsconfig.build.tsbuildinfo +1 -1
  6. package/package.json +2 -2
  7. package/dist/database/entities/auth-identity.entity.d.ts +0 -1
  8. package/dist/database/entities/auth-identity.entity.js +0 -6
  9. package/dist/database/entities/auth-identity.entity.js.map +0 -1
  10. package/dist/database/entities/conversation.entity.d.ts +0 -1
  11. package/dist/database/entities/conversation.entity.js +0 -6
  12. package/dist/database/entities/conversation.entity.js.map +0 -1
  13. package/dist/database/entities/email-token.entity.d.ts +0 -1
  14. package/dist/database/entities/email-token.entity.js +0 -6
  15. package/dist/database/entities/email-token.entity.js.map +0 -1
  16. package/dist/database/entities/index.d.ts +0 -7
  17. package/dist/database/entities/index.js +0 -16
  18. package/dist/database/entities/index.js.map +0 -1
  19. package/dist/database/entities/message.entity.d.ts +0 -1
  20. package/dist/database/entities/message.entity.js +0 -6
  21. package/dist/database/entities/message.entity.js.map +0 -1
  22. package/dist/database/entities/refresh-token.entity.d.ts +0 -1
  23. package/dist/database/entities/refresh-token.entity.js +0 -6
  24. package/dist/database/entities/refresh-token.entity.js.map +0 -1
  25. package/dist/database/entities/subscription.entity.d.ts +0 -1
  26. package/dist/database/entities/subscription.entity.js +0 -6
  27. package/dist/database/entities/subscription.entity.js.map +0 -1
  28. package/dist/database/entities/usage-record.entity.d.ts +0 -1
  29. package/dist/database/entities/usage-record.entity.js +0 -6
  30. package/dist/database/entities/usage-record.entity.js.map +0 -1
  31. package/dist/database/entities/user.entity.d.ts +0 -1
  32. package/dist/database/entities/user.entity.js +0 -6
  33. package/dist/database/entities/user.entity.js.map +0 -1
  34. package/dist/decorators/require-plan.decorator.d.ts +0 -2
  35. package/dist/decorators/require-plan.decorator.js +0 -8
  36. package/dist/decorators/require-plan.decorator.js.map +0 -1
  37. package/dist/guards/usage-limit.guard.d.ts +0 -11
  38. package/dist/guards/usage-limit.guard.js +0 -57
  39. package/dist/guards/usage-limit.guard.js.map +0 -1
  40. package/dist/modules/admin/admin-plans.controller.d.ts +0 -11
  41. package/dist/modules/admin/admin-plans.controller.js +0 -97
  42. package/dist/modules/admin/admin-plans.controller.js.map +0 -1
  43. package/dist/modules/admin/admin-tenant-agents.controller.d.ts +0 -61
  44. package/dist/modules/admin/admin-tenant-agents.controller.js +0 -424
  45. package/dist/modules/admin/admin-tenant-agents.controller.js.map +0 -1
  46. package/dist/modules/admin/admin-tenant-billing.controller.d.ts +0 -51
  47. package/dist/modules/admin/admin-tenant-billing.controller.js +0 -119
  48. package/dist/modules/admin/admin-tenant-billing.controller.js.map +0 -1
  49. package/dist/modules/admin/admin-tenants.controller.d.ts +0 -43
  50. package/dist/modules/admin/admin-tenants.controller.js +0 -178
  51. package/dist/modules/admin/admin-tenants.controller.js.map +0 -1
  52. package/dist/modules/admin/admin-users.controller.d.ts +0 -41
  53. package/dist/modules/admin/admin-users.controller.js +0 -121
  54. package/dist/modules/admin/admin-users.controller.js.map +0 -1
  55. package/dist/modules/admin/admin.module.d.ts +0 -2
  56. package/dist/modules/admin/admin.module.js +0 -26
  57. package/dist/modules/admin/admin.module.js.map +0 -1
  58. package/dist/modules/admin/platform-admin.guard.d.ts +0 -7
  59. package/dist/modules/admin/platform-admin.guard.js +0 -52
  60. package/dist/modules/admin/platform-admin.guard.js.map +0 -1
  61. package/dist/modules/auth/auth.controller.d.ts +0 -63
  62. package/dist/modules/auth/auth.controller.js +0 -255
  63. package/dist/modules/auth/auth.controller.js.map +0 -1
  64. package/dist/modules/auth/auth.module.d.ts +0 -4
  65. package/dist/modules/auth/auth.module.js +0 -71
  66. package/dist/modules/auth/auth.module.js.map +0 -1
  67. package/dist/modules/auth/auth.service.d.ts +0 -2
  68. package/dist/modules/auth/auth.service.js +0 -7
  69. package/dist/modules/auth/auth.service.js.map +0 -1
  70. package/dist/modules/auth/decorators/current-user.decorator.d.ts +0 -8
  71. package/dist/modules/auth/decorators/current-user.decorator.js +0 -12
  72. package/dist/modules/auth/decorators/current-user.decorator.js.map +0 -1
  73. package/dist/modules/auth/decorators/public.decorator.d.ts +0 -2
  74. package/dist/modules/auth/decorators/public.decorator.js +0 -8
  75. package/dist/modules/auth/decorators/public.decorator.js.map +0 -1
  76. package/dist/modules/auth/dto/login.dto.d.ts +0 -4
  77. package/dist/modules/auth/dto/login.dto.js +0 -29
  78. package/dist/modules/auth/dto/login.dto.js.map +0 -1
  79. package/dist/modules/auth/dto/register.dto.d.ts +0 -5
  80. package/dist/modules/auth/dto/register.dto.js +0 -36
  81. package/dist/modules/auth/dto/register.dto.js.map +0 -1
  82. package/dist/modules/auth/guards/jwt-auth.guard.d.ts +0 -9
  83. package/dist/modules/auth/guards/jwt-auth.guard.js +0 -37
  84. package/dist/modules/auth/guards/jwt-auth.guard.js.map +0 -1
  85. package/dist/modules/auth/guards/local-auth.guard.d.ts +0 -4
  86. package/dist/modules/auth/guards/local-auth.guard.js +0 -18
  87. package/dist/modules/auth/guards/local-auth.guard.js.map +0 -1
  88. package/dist/modules/auth/guards/oauth-configured.guard.d.ts +0 -11
  89. package/dist/modules/auth/guards/oauth-configured.guard.js +0 -51
  90. package/dist/modules/auth/guards/oauth-configured.guard.js.map +0 -1
  91. package/dist/modules/auth/oauth.controller.d.ts +0 -20
  92. package/dist/modules/auth/oauth.controller.js +0 -208
  93. package/dist/modules/auth/oauth.controller.js.map +0 -1
  94. package/dist/modules/auth/refresh-token.service.d.ts +0 -2
  95. package/dist/modules/auth/refresh-token.service.js +0 -7
  96. package/dist/modules/auth/refresh-token.service.js.map +0 -1
  97. package/dist/modules/auth/strategies/github.strategy.d.ts +0 -12
  98. package/dist/modules/auth/strategies/github.strategy.js +0 -57
  99. package/dist/modules/auth/strategies/github.strategy.js.map +0 -1
  100. package/dist/modules/auth/strategies/google.strategy.d.ts +0 -19
  101. package/dist/modules/auth/strategies/google.strategy.js +0 -56
  102. package/dist/modules/auth/strategies/google.strategy.js.map +0 -1
  103. package/dist/modules/auth/strategies/jwt.strategy.d.ts +0 -18
  104. package/dist/modules/auth/strategies/jwt.strategy.js +0 -49
  105. package/dist/modules/auth/strategies/jwt.strategy.js.map +0 -1
  106. package/dist/modules/auth/strategies/local.strategy.d.ts +0 -11
  107. package/dist/modules/auth/strategies/local.strategy.js +0 -31
  108. package/dist/modules/auth/strategies/local.strategy.js.map +0 -1
  109. package/dist/modules/billing/adapters/billing-adapter.interface.d.ts +0 -1
  110. package/dist/modules/billing/adapters/billing-adapter.interface.js +0 -6
  111. package/dist/modules/billing/adapters/billing-adapter.interface.js.map +0 -1
  112. package/dist/modules/billing/adapters/stripe/stripe.adapter.d.ts +0 -19
  113. package/dist/modules/billing/adapters/stripe/stripe.adapter.js +0 -118
  114. package/dist/modules/billing/adapters/stripe/stripe.adapter.js.map +0 -1
  115. package/dist/modules/billing/billing.controller.d.ts +0 -54
  116. package/dist/modules/billing/billing.controller.js +0 -180
  117. package/dist/modules/billing/billing.controller.js.map +0 -1
  118. package/dist/modules/billing/billing.module.d.ts +0 -2
  119. package/dist/modules/billing/billing.module.js +0 -57
  120. package/dist/modules/billing/billing.module.js.map +0 -1
  121. package/dist/modules/billing/billing.service.d.ts +0 -2
  122. package/dist/modules/billing/billing.service.js +0 -7
  123. package/dist/modules/billing/billing.service.js.map +0 -1
  124. package/dist/modules/billing/usage.service.d.ts +0 -2
  125. package/dist/modules/billing/usage.service.js +0 -6
  126. package/dist/modules/billing/usage.service.js.map +0 -1
  127. package/dist/modules/email/adapters/email-adapter.interface.d.ts +0 -1
  128. package/dist/modules/email/adapters/email-adapter.interface.js +0 -6
  129. package/dist/modules/email/adapters/email-adapter.interface.js.map +0 -1
  130. package/dist/modules/email/adapters/noop.adapter.d.ts +0 -1
  131. package/dist/modules/email/adapters/noop.adapter.js +0 -6
  132. package/dist/modules/email/adapters/noop.adapter.js.map +0 -1
  133. package/dist/modules/email/adapters/resend.adapter.d.ts +0 -1
  134. package/dist/modules/email/adapters/resend.adapter.js +0 -6
  135. package/dist/modules/email/adapters/resend.adapter.js.map +0 -1
  136. package/dist/modules/email/email.module.d.ts +0 -2
  137. package/dist/modules/email/email.module.js +0 -17
  138. package/dist/modules/email/email.module.js.map +0 -1
  139. package/dist/modules/email/email.service.d.ts +0 -1
  140. package/dist/modules/email/email.service.js +0 -6
  141. package/dist/modules/email/email.service.js.map +0 -1
  142. package/dist/modules/email/templates/transactional.template.d.ts +0 -18
  143. package/dist/modules/email/templates/transactional.template.js +0 -43
  144. package/dist/modules/email/templates/transactional.template.js.map +0 -1
@@ -1,51 +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.OAuthConfiguredGuard = exports.OAuthProvider = exports.OAUTH_PROVIDER_KEY = void 0;
16
- const common_1 = require("@nestjs/common");
17
- const core_1 = require("@nestjs/core");
18
- const constants_1 = require("../../../constants");
19
- exports.OAUTH_PROVIDER_KEY = 'agentforge:oauthProvider';
20
- const OAuthProvider = (provider) => (0, common_1.SetMetadata)(exports.OAUTH_PROVIDER_KEY, provider);
21
- exports.OAuthProvider = OAuthProvider;
22
- let OAuthConfiguredGuard = class OAuthConfiguredGuard {
23
- constructor(reflector, config) {
24
- this.reflector = reflector;
25
- this.config = config;
26
- }
27
- canActivate(ctx) {
28
- const provider = this.reflector.getAllAndOverride(exports.OAUTH_PROVIDER_KEY, [
29
- ctx.getHandler(),
30
- ctx.getClass(),
31
- ]);
32
- if (!provider)
33
- return true;
34
- const strategies = this.config.auth?.strategies ?? [];
35
- const enabled = strategies.includes(provider);
36
- const hasCreds = provider === 'google' ? !!this.config.auth?.google :
37
- provider === 'github' ? !!this.config.auth?.github :
38
- false;
39
- if (!enabled || !hasCreds) {
40
- throw new common_1.NotFoundException(`OAuth provider "${provider}" is not configured`);
41
- }
42
- return true;
43
- }
44
- };
45
- exports.OAuthConfiguredGuard = OAuthConfiguredGuard;
46
- exports.OAuthConfiguredGuard = OAuthConfiguredGuard = __decorate([
47
- (0, common_1.Injectable)(),
48
- __param(1, (0, common_1.Inject)(constants_1.AGENT_FORGE_CONFIG)),
49
- __metadata("design:paramtypes", [core_1.Reflector, Object])
50
- ], OAuthConfiguredGuard);
51
- //# sourceMappingURL=oauth-configured.guard.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"oauth-configured.guard.js","sourceRoot":"","sources":["../../../../src/modules/auth/guards/oauth-configured.guard.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAOwB;AACxB,uCAAyC;AACzC,kDAAwD;AAG3C,QAAA,kBAAkB,GAAG,0BAA0B,CAAC;AAGtD,MAAM,aAAa,GAAG,CAAC,QAA0B,EAAE,EAAE,CAC1D,IAAA,oBAAW,EAAC,0BAAkB,EAAE,QAAQ,CAAC,CAAC;AAD/B,QAAA,aAAa,iBACkB;AAQrC,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAC/B,YACmB,SAAoB,EACQ,MAAwB;QADpD,cAAS,GAAT,SAAS,CAAW;QACQ,WAAM,GAAN,MAAM,CAAkB;IACpE,CAAC;IAEJ,WAAW,CAAC,GAAqB;QAC/B,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAmB,0BAAkB,EAAE;YACtF,GAAG,CAAC,UAAU,EAAE;YAChB,GAAG,CAAC,QAAQ,EAAE;SACf,CAAC,CAAC;QACH,IAAI,CAAC,QAAQ;YAAE,OAAO,IAAI,CAAC;QAE3B,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,UAAU,IAAI,EAAE,CAAC;QACtD,MAAM,OAAO,GAAG,UAAU,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QAC9C,MAAM,QAAQ,GACZ,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;YACpD,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;gBACpD,KAAK,CAAC;QAER,IAAI,CAAC,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC;YAC1B,MAAM,IAAI,0BAAiB,CAAC,mBAAmB,QAAQ,qBAAqB,CAAC,CAAC;QAChF,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF,CAAA;AAzBY,oDAAoB;+BAApB,oBAAoB;IADhC,IAAA,mBAAU,GAAE;IAIR,WAAA,IAAA,eAAM,EAAC,8BAAkB,CAAC,CAAA;qCADC,gBAAS;GAF5B,oBAAoB,CAyBhC"}
@@ -1,20 +0,0 @@
1
- import type { Request, Response } from 'express';
2
- import { AuthService } from '@agentforge/core';
3
- import type { AgentForgeConfig } from '../../types';
4
- export declare class OAuthController {
5
- private readonly config;
6
- private readonly auth;
7
- private readonly logger;
8
- constructor(config: AgentForgeConfig, auth: AuthService);
9
- google(res: Response): void;
10
- googleCallback(code: string | undefined, state: string | undefined, providerError: string | undefined, req: Request, res: Response): Promise<void>;
11
- github(res: Response): void;
12
- githubCallback(code: string | undefined, state: string | undefined, providerError: string | undefined, req: Request, res: Response): Promise<void>;
13
- private startFlow;
14
- private finishFlow;
15
- private successRedirect;
16
- private redirectFailure;
17
- private metaFrom;
18
- private setSessionCookies;
19
- private parseAccessTtlMs;
20
- }
@@ -1,208 +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
- var OAuthController_1;
15
- Object.defineProperty(exports, "__esModule", { value: true });
16
- exports.OAuthController = void 0;
17
- const common_1 = require("@nestjs/common");
18
- const swagger_1 = require("@nestjs/swagger");
19
- const core_1 = require("@agentforge/core");
20
- const public_decorator_1 = require("./decorators/public.decorator");
21
- const oauth_configured_guard_1 = require("./guards/oauth-configured.guard");
22
- const constants_1 = require("../../constants");
23
- const ACCESS_COOKIE_DEFAULT_MS = 15 * 60 * 1000;
24
- const ONE_DAY_MS = 24 * 60 * 60 * 1000;
25
- let OAuthController = OAuthController_1 = class OAuthController {
26
- constructor(config, auth) {
27
- this.config = config;
28
- this.auth = auth;
29
- this.logger = new common_1.Logger(OAuthController_1.name);
30
- }
31
- google(res) {
32
- this.startFlow('google', res);
33
- }
34
- googleCallback(code, state, providerError, req, res) {
35
- return this.finishFlow('google', { code, state, providerError, req, res });
36
- }
37
- github(res) {
38
- this.startFlow('github', res);
39
- }
40
- githubCallback(code, state, providerError, req, res) {
41
- return this.finishFlow('github', { code, state, providerError, req, res });
42
- }
43
- startFlow(provider, res) {
44
- const spec = (0, core_1.getOAuthProviderSpec)(provider);
45
- const cfg = provider === 'google'
46
- ? this.config.auth?.google
47
- : provider === 'github'
48
- ? this.config.auth?.github
49
- : undefined;
50
- if (!spec || !cfg)
51
- throw new common_1.NotFoundException(`OAuth provider "${provider}" not configured`);
52
- const { authorizeUrl, state } = (0, core_1.buildAuthorizeUrl)(spec, cfg);
53
- res.cookie(core_1.OAUTH_STATE_COOKIE_PREFIX + provider, state, {
54
- httpOnly: true,
55
- sameSite: 'lax',
56
- secure: this.config.auth?.cookieSecure ?? process.env.NODE_ENV === 'production',
57
- maxAge: core_1.OAUTH_STATE_TTL_MS,
58
- path: `/auth/${provider}/callback`,
59
- });
60
- res.redirect(authorizeUrl);
61
- }
62
- async finishFlow(provider, input) {
63
- const spec = (0, core_1.getOAuthProviderSpec)(provider);
64
- const cfg = provider === 'google'
65
- ? this.config.auth?.google
66
- : provider === 'github'
67
- ? this.config.auth?.github
68
- : undefined;
69
- if (!spec || !cfg) {
70
- this.redirectFailure(input.res, 'not_configured');
71
- return;
72
- }
73
- const cookieName = core_1.OAUTH_STATE_COOKIE_PREFIX + provider;
74
- const cookies = input.req.cookies ?? {};
75
- const expectedState = cookies[cookieName];
76
- input.res.clearCookie(cookieName, { path: `/auth/${provider}/callback` });
77
- let profile;
78
- try {
79
- profile = await (0, core_1.completeAuthorization)({
80
- spec,
81
- cfg,
82
- returnedState: input.state,
83
- expectedState,
84
- code: input.code,
85
- providerError: input.providerError,
86
- });
87
- }
88
- catch (err) {
89
- if (err instanceof core_1.OAuthCallbackError) {
90
- this.redirectFailure(input.res, err.code);
91
- return;
92
- }
93
- this.logger.warn(`OAuth callback failed: ${err.message}`);
94
- this.redirectFailure(input.res, 'callback_failed');
95
- return;
96
- }
97
- try {
98
- const result = await this.auth.signInWithProvider(profile, this.metaFrom(input.req));
99
- this.setSessionCookies(input.res, result);
100
- input.res.redirect(this.successRedirect());
101
- }
102
- catch (err) {
103
- this.logger.warn(`OAuth signIn failed: ${err.message}`);
104
- this.redirectFailure(input.res, 'signin_failed');
105
- }
106
- }
107
- successRedirect() {
108
- return this.config.auth?.oauthSuccessRedirect ?? '/';
109
- }
110
- redirectFailure(res, code) {
111
- const base = this.config.auth?.oauthFailureRedirect ?? '/';
112
- const sep = base.includes('?') ? '&' : '?';
113
- res.redirect(`${base}${sep}auth_error=${encodeURIComponent(code)}`);
114
- }
115
- metaFrom(req) {
116
- return {
117
- userAgent: req.headers['user-agent'],
118
- ip: req.headers['x-forwarded-for']?.split(',')[0]?.trim() || req.ip,
119
- };
120
- }
121
- setSessionCookies(res, r) {
122
- const secure = this.config.auth?.cookieSecure ?? process.env.NODE_ENV === 'production';
123
- const accessTtlMs = this.parseAccessTtlMs();
124
- const refreshTtlMs = (this.config.auth?.refreshTokenTtlDays ?? 30) * ONE_DAY_MS;
125
- const accessName = this.config.auth?.cookieName ?? 'af_session';
126
- const refreshName = this.config.auth?.refreshCookieName ?? 'af_refresh';
127
- res.cookie(accessName, r.accessToken, {
128
- httpOnly: true, secure, sameSite: 'lax', maxAge: accessTtlMs, path: '/',
129
- });
130
- res.cookie(refreshName, r.refreshToken, {
131
- httpOnly: true, secure, sameSite: 'lax', maxAge: refreshTtlMs, path: '/auth',
132
- });
133
- }
134
- parseAccessTtlMs() {
135
- const ttl = this.config.auth?.accessTokenTtl ?? '15m';
136
- const m = /^(\d+)\s*(s|m|h|d)$/.exec(ttl.trim());
137
- if (!m)
138
- return ACCESS_COOKIE_DEFAULT_MS;
139
- const n = Number(m[1]);
140
- switch (m[2]) {
141
- case 's': return n * 1000;
142
- case 'm': return n * 60_000;
143
- case 'h': return n * 3_600_000;
144
- case 'd': return n * 86_400_000;
145
- default: return ACCESS_COOKIE_DEFAULT_MS;
146
- }
147
- }
148
- };
149
- exports.OAuthController = OAuthController;
150
- __decorate([
151
- (0, public_decorator_1.Public)(),
152
- (0, oauth_configured_guard_1.OAuthProvider)('google'),
153
- (0, common_1.Get)('google'),
154
- (0, common_1.UseGuards)(oauth_configured_guard_1.OAuthConfiguredGuard),
155
- (0, swagger_1.ApiOperation)({ summary: 'Begin Google OAuth flow (redirects to Google)' }),
156
- __param(0, (0, common_1.Res)()),
157
- __metadata("design:type", Function),
158
- __metadata("design:paramtypes", [Object]),
159
- __metadata("design:returntype", void 0)
160
- ], OAuthController.prototype, "google", null);
161
- __decorate([
162
- (0, public_decorator_1.Public)(),
163
- (0, oauth_configured_guard_1.OAuthProvider)('google'),
164
- (0, common_1.Get)('google/callback'),
165
- (0, common_1.UseGuards)(oauth_configured_guard_1.OAuthConfiguredGuard),
166
- (0, swagger_1.ApiOperation)({ summary: 'Google OAuth callback — issues session cookies and redirects' }),
167
- __param(0, (0, common_1.Query)('code')),
168
- __param(1, (0, common_1.Query)('state')),
169
- __param(2, (0, common_1.Query)('error')),
170
- __param(3, (0, common_1.Req)()),
171
- __param(4, (0, common_1.Res)()),
172
- __metadata("design:type", Function),
173
- __metadata("design:paramtypes", [Object, Object, Object, Object, Object]),
174
- __metadata("design:returntype", Promise)
175
- ], OAuthController.prototype, "googleCallback", null);
176
- __decorate([
177
- (0, public_decorator_1.Public)(),
178
- (0, oauth_configured_guard_1.OAuthProvider)('github'),
179
- (0, common_1.Get)('github'),
180
- (0, common_1.UseGuards)(oauth_configured_guard_1.OAuthConfiguredGuard),
181
- (0, swagger_1.ApiOperation)({ summary: 'Begin GitHub OAuth flow (redirects to GitHub)' }),
182
- __param(0, (0, common_1.Res)()),
183
- __metadata("design:type", Function),
184
- __metadata("design:paramtypes", [Object]),
185
- __metadata("design:returntype", void 0)
186
- ], OAuthController.prototype, "github", null);
187
- __decorate([
188
- (0, public_decorator_1.Public)(),
189
- (0, oauth_configured_guard_1.OAuthProvider)('github'),
190
- (0, common_1.Get)('github/callback'),
191
- (0, common_1.UseGuards)(oauth_configured_guard_1.OAuthConfiguredGuard),
192
- (0, swagger_1.ApiOperation)({ summary: 'GitHub OAuth callback — issues session cookies and redirects' }),
193
- __param(0, (0, common_1.Query)('code')),
194
- __param(1, (0, common_1.Query)('state')),
195
- __param(2, (0, common_1.Query)('error')),
196
- __param(3, (0, common_1.Req)()),
197
- __param(4, (0, common_1.Res)()),
198
- __metadata("design:type", Function),
199
- __metadata("design:paramtypes", [Object, Object, Object, Object, Object]),
200
- __metadata("design:returntype", Promise)
201
- ], OAuthController.prototype, "githubCallback", null);
202
- exports.OAuthController = OAuthController = OAuthController_1 = __decorate([
203
- (0, swagger_1.ApiTags)('Auth (OAuth)'),
204
- (0, common_1.Controller)('auth'),
205
- __param(0, (0, common_1.Inject)(constants_1.AGENT_FORGE_CONFIG)),
206
- __metadata("design:paramtypes", [Object, core_1.AuthService])
207
- ], OAuthController);
208
- //# sourceMappingURL=oauth.controller.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"oauth.controller.js","sourceRoot":"","sources":["../../../src/modules/auth/oauth.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAUwB;AACxB,6CAAwD;AAExD,2CAS0B;AAE1B,oEAAuD;AACvD,4EAAsF;AACtF,+CAAqD;AAGrD,MAAM,wBAAwB,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAChD,MAAM,UAAU,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAUhC,IAAM,eAAe,uBAArB,MAAM,eAAe;IAG1B,YAC8B,MAAyC,EACpD,IAAiB;QADW,WAAM,GAAN,MAAM,CAAkB;QACpD,SAAI,GAAJ,IAAI,CAAa;QAJnB,WAAM,GAAG,IAAI,eAAM,CAAC,iBAAe,CAAC,IAAI,CAAC,CAAC;IAKxD,CAAC;IASJ,MAAM,CA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0 @@
1
- export { RefreshTokenService, RefreshTokenError, } from '@agentforge/core';
2
- export type { MintedRefreshToken, IssueOptions, RefreshTokenServiceOptions, } from '@agentforge/core';
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RefreshTokenError = exports.RefreshTokenService = void 0;
4
- var core_1 = require("@agentforge/core");
5
- Object.defineProperty(exports, "RefreshTokenService", { enumerable: true, get: function () { return core_1.RefreshTokenService; } });
6
- Object.defineProperty(exports, "RefreshTokenError", { enumerable: true, get: function () { return core_1.RefreshTokenError; } });
7
- //# sourceMappingURL=refresh-token.service.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"refresh-token.service.js","sourceRoot":"","sources":["../../../src/modules/auth/refresh-token.service.ts"],"names":[],"mappings":";;;AAAA,yCAG0B;AAFxB,2GAAA,mBAAmB,OAAA;AACnB,yGAAA,iBAAiB,OAAA"}
@@ -1,12 +0,0 @@
1
- import { Strategy, type Profile } from 'passport-github2';
2
- import type { AgentForgeConfig } from '../../../types';
3
- import type { NormalizedOAuthProfile } from './google.strategy';
4
- declare const GithubStrategy_base: new (...args: [options: import("passport-github2").StrategyOptionsWithRequest] | [options: import("passport-github2").StrategyOptions]) => Strategy & {
5
- validate(...args: any[]): unknown;
6
- };
7
- export declare class GithubStrategy extends GithubStrategy_base {
8
- private readonly logger;
9
- constructor(config: AgentForgeConfig);
10
- validate(_accessToken: string, _refreshToken: string, profile: Profile): Promise<NormalizedOAuthProfile>;
11
- }
12
- export {};
@@ -1,57 +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
- var GithubStrategy_1;
15
- Object.defineProperty(exports, "__esModule", { value: true });
16
- exports.GithubStrategy = void 0;
17
- const common_1 = require("@nestjs/common");
18
- const passport_1 = require("@nestjs/passport");
19
- const passport_github2_1 = require("passport-github2");
20
- const constants_1 = require("../../../constants");
21
- let GithubStrategy = GithubStrategy_1 = class GithubStrategy extends (0, passport_1.PassportStrategy)(passport_github2_1.Strategy, 'agentforge-github') {
22
- constructor(config) {
23
- const github = config.auth?.github;
24
- if (!github?.clientId || !github?.clientSecret || !github?.callbackURL) {
25
- throw new Error('AgentForge GitHub OAuth: clientId, clientSecret, and callbackURL are required when "github" is in auth.strategies');
26
- }
27
- super({
28
- clientID: github.clientId,
29
- clientSecret: github.clientSecret,
30
- callbackURL: github.callbackURL,
31
- scope: ['user:email'],
32
- });
33
- this.logger = new common_1.Logger(GithubStrategy_1.name);
34
- }
35
- async validate(_accessToken, _refreshToken, profile) {
36
- const primaryEmail = profile.emails?.[0];
37
- return {
38
- provider: 'github',
39
- providerId: profile.id,
40
- email: primaryEmail?.value,
41
- emailVerified: true,
42
- name: profile.displayName || profile.username,
43
- metadata: {
44
- username: profile.username,
45
- avatar: profile.photos?.[0]?.value,
46
- profileUrl: profile.profileUrl,
47
- },
48
- };
49
- }
50
- };
51
- exports.GithubStrategy = GithubStrategy;
52
- exports.GithubStrategy = GithubStrategy = GithubStrategy_1 = __decorate([
53
- (0, common_1.Injectable)(),
54
- __param(0, (0, common_1.Inject)(constants_1.AGENT_FORGE_CONFIG)),
55
- __metadata("design:paramtypes", [Object])
56
- ], GithubStrategy);
57
- //# sourceMappingURL=github.strategy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AE,CAAC,CAAC,CAAC,EAAE,KAAK;gBAClC,UAAU,EAAE,OAAO,CAAC,UAAU;aAC/B;SACF,CAAC;IACJ,CAAC;CACF,CAAA;AAzCY,wCAAc;yBAAd,cAAc;IAD1B,IAAA,mBAAU,GAAE;IAIE,WAAA,IAAA,eAAM,EAAC,8BAAkB,CAAC,CAAA;;GAH5B,cAAc,CAyC1B"}
@@ -1,19 +0,0 @@
1
- import { Strategy, type Profile } from 'passport-google-oauth20';
2
- import type { AgentForgeConfig } from '../../../types';
3
- export interface NormalizedOAuthProfile {
4
- provider: string;
5
- providerId: string;
6
- email?: string;
7
- emailVerified?: boolean;
8
- name?: string;
9
- metadata?: Record<string, unknown>;
10
- }
11
- declare const GoogleStrategy_base: new (...args: [options: import("passport-google-oauth20").StrategyOptionsWithRequest] | [options: import("passport-google-oauth20").StrategyOptions] | [options: import("passport-google-oauth20").StrategyOptions] | [options: import("passport-google-oauth20").StrategyOptionsWithRequest]) => Strategy & {
12
- validate(...args: any[]): unknown;
13
- };
14
- export declare class GoogleStrategy extends GoogleStrategy_base {
15
- private readonly logger;
16
- constructor(config: AgentForgeConfig);
17
- validate(_accessToken: string, _refreshToken: string, profile: Profile): Promise<NormalizedOAuthProfile>;
18
- }
19
- export {};
@@ -1,56 +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
- var GoogleStrategy_1;
15
- Object.defineProperty(exports, "__esModule", { value: true });
16
- exports.GoogleStrategy = void 0;
17
- const common_1 = require("@nestjs/common");
18
- const passport_1 = require("@nestjs/passport");
19
- const passport_google_oauth20_1 = require("passport-google-oauth20");
20
- const constants_1 = require("../../../constants");
21
- let GoogleStrategy = GoogleStrategy_1 = class GoogleStrategy extends (0, passport_1.PassportStrategy)(passport_google_oauth20_1.Strategy, 'agentforge-google') {
22
- constructor(config) {
23
- const google = config.auth?.google;
24
- if (!google?.clientId || !google?.clientSecret || !google?.callbackURL) {
25
- throw new Error('AgentForge Google OAuth: clientId, clientSecret, and callbackURL are required when "google" is in auth.strategies');
26
- }
27
- super({
28
- clientID: google.clientId,
29
- clientSecret: google.clientSecret,
30
- callbackURL: google.callbackURL,
31
- scope: ['email', 'profile'],
32
- });
33
- this.logger = new common_1.Logger(GoogleStrategy_1.name);
34
- }
35
- async validate(_accessToken, _refreshToken, profile) {
36
- const primaryEmail = profile.emails?.[0];
37
- return {
38
- provider: 'google',
39
- providerId: profile.id,
40
- email: primaryEmail?.value,
41
- emailVerified: primaryEmail?.verified ?? true,
42
- name: profile.displayName,
43
- metadata: {
44
- avatar: profile.photos?.[0]?.value,
45
- locale: profile._json?.locale,
46
- },
47
- };
48
- }
49
- };
50
- exports.GoogleStrategy = GoogleStrategy;
51
- exports.GoogleStrategy = GoogleStrategy = GoogleStrategy_1 = __decorate([
52
- (0, common_1.Injectable)(),
53
- __param(0, (0, common_1.Inject)(constants_1.AGENT_FORGE_CONFIG)),
54
- __metadata("design:paramtypes", [Object])
55
- ], GoogleStrategy);
56
- //# sourceMappingURL=google.strategy.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"google.strategy.js","sourceRoot":"","sources":["../../../../src/modules/auth/strategies/google.strategy.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAA4D;AA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,GAAE;IAIE,WAAA,IAAA,eAAM,EAAC,8BAAkB,CAAC,CAAA;;GAH5B,cAAc,CAoC1B"}
@@ -1,18 +0,0 @@
1
- import { Strategy } from 'passport-jwt';
2
- import { AuthService } from '../auth.service';
3
- import type { AgentForgeConfig } from '../../../types';
4
- import type { AuthUser } from '../decorators/current-user.decorator';
5
- interface JwtPayload {
6
- sub: string;
7
- email?: string;
8
- name?: string;
9
- }
10
- declare const JwtStrategy_base: new (...args: [opt: import("passport-jwt").StrategyOptionsWithoutRequest] | [opt: import("passport-jwt").StrategyOptionsWithRequest]) => Strategy & {
11
- validate(...args: any[]): unknown;
12
- };
13
- export declare class JwtStrategy extends JwtStrategy_base {
14
- private readonly auth;
15
- constructor(config: AgentForgeConfig, auth: AuthService);
16
- validate(payload: JwtPayload): Promise<AuthUser>;
17
- }
18
- export {};
@@ -1,49 +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.JwtStrategy = void 0;
16
- const common_1 = require("@nestjs/common");
17
- const passport_1 = require("@nestjs/passport");
18
- const passport_jwt_1 = require("passport-jwt");
19
- const auth_service_1 = require("../auth.service");
20
- const constants_1 = require("../../../constants");
21
- let JwtStrategy = class JwtStrategy extends (0, passport_1.PassportStrategy)(passport_jwt_1.Strategy, 'agentforge-jwt') {
22
- constructor(config, auth) {
23
- const cookieName = config.auth?.cookieName ?? 'af_session';
24
- super({
25
- jwtFromRequest: passport_jwt_1.ExtractJwt.fromExtractors([
26
- passport_jwt_1.ExtractJwt.fromAuthHeaderAsBearerToken(),
27
- (req) => (req?.cookies && req.cookies[cookieName]) || null,
28
- ]),
29
- ignoreExpiration: false,
30
- secretOrKey: config.auth?.jwtSecret ?? 'unset-secret',
31
- });
32
- this.auth = auth;
33
- }
34
- async validate(payload) {
35
- if (!payload?.sub)
36
- throw new common_1.UnauthorizedException();
37
- const user = await this.auth.getById(payload.sub);
38
- if (!user)
39
- throw new common_1.UnauthorizedException('User no longer exists or is disabled');
40
- return user;
41
- }
42
- };
43
- exports.JwtStrategy = JwtStrategy;
44
- exports.JwtStrategy = JwtStrategy = __decorate([
45
- (0, common_1.Injectable)(),
46
- __param(0, (0, common_1.Inject)(constants_1.AGENT_FORGE_CONFIG)),
47
- __metadata("design:paramtypes", [Object, auth_service_1.AuthService])
48
- ], JwtStrategy);
49
- //# sourceMappingURL=jwt.strategy.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"jwt.strategy.js","sourceRoot":"","sources":["../../../../src/modules/auth/strategies/jwt.strategy.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA2E;AAC3E,+CAAoD;AACpD,+CAAoD;AAEpD,kDAA8C;AAC9C,kDAAwD;AAWjD,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,IAAA,2BAAgB,EAAC,uBAAQ,EAAE,gBAAgB,CAAC;IAC3E,YAC8B,MAAwB,EACnC,IAAiB;QAElC,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,EAAE,UAAU,IAAI,YAAY,CAAC;QAC3D,KAAK,CAAC;YACJ,cAAc,EAAE,yBAAU,CAAC,cAAc,CAAC;gBACxC,yBAAU,CAAC,2BAA2B,EAAE;gBACxC,CAAC,GAAY,EAAE,EAAE,CACf,CAAC,GAAG,EAAE,OAAO,IAAK,GAAG,CAAC,OAAkC,CAAC,UAAU,CAAC,CAAC,IAAI,IAAI;aAChF,CAAC;YACF,gBAAgB,EAAE,KAAK;YACvB,WAAW,EAAE,MAAM,CAAC,IAAI,EAAE,SAAS,IAAI,cAAc;SACtD,CAAC,CAAC;QAXc,SAAI,GAAJ,IAAI,CAAa;IAYpC,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,OAAmB;QAChC,IAAI,CAAC,OAAO,EAAE,GAAG;YAAE,MAAM,IAAI,8BAAqB,EAAE,CAAC;QACrD,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAClD,IAAI,CAAC,IAAI;YAAE,MAAM,IAAI,8BAAqB,CAAC,sCAAsC,CAAC,CAAC;QACnF,OAAO,IAAI,CAAC;IACd,CAAC;CACF,CAAA;AAvBY,kCAAW;sBAAX,WAAW;IADvB,IAAA,mBAAU,GAAE;IAGR,WAAA,IAAA,eAAM,EAAC,8BAAkB,CAAC,CAAA;6CACJ,0BAAW;GAHzB,WAAW,CAuBvB"}
@@ -1,11 +0,0 @@
1
- import { Strategy } from 'passport-local';
2
- import { AuthService } from '../auth.service';
3
- declare const LocalStrategy_base: new (...args: [] | [options: import("passport-local").IStrategyOptionsWithRequest] | [options: import("passport-local").IStrategyOptions]) => Strategy & {
4
- validate(...args: any[]): unknown;
5
- };
6
- export declare class LocalStrategy extends LocalStrategy_base {
7
- private readonly auth;
8
- constructor(auth: AuthService);
9
- validate(email: string, password: string): Promise<import("@agentforge/core").User>;
10
- }
11
- export {};
@@ -1,31 +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.LocalStrategy = void 0;
13
- const common_1 = require("@nestjs/common");
14
- const passport_1 = require("@nestjs/passport");
15
- const passport_local_1 = require("passport-local");
16
- const auth_service_1 = require("../auth.service");
17
- let LocalStrategy = class LocalStrategy extends (0, passport_1.PassportStrategy)(passport_local_1.Strategy, 'agentforge-local') {
18
- constructor(auth) {
19
- super({ usernameField: 'email', passwordField: 'password' });
20
- this.auth = auth;
21
- }
22
- async validate(email, password) {
23
- return this.auth.validateCredentials(email, password);
24
- }
25
- };
26
- exports.LocalStrategy = LocalStrategy;
27
- exports.LocalStrategy = LocalStrategy = __decorate([
28
- (0, common_1.Injectable)(),
29
- __metadata("design:paramtypes", [auth_service_1.AuthService])
30
- ], LocalStrategy);
31
- //# sourceMappingURL=local.strategy.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"local.strategy.js","sourceRoot":"","sources":["../../../../src/modules/auth/strategies/local.strategy.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,+CAAoD;AACpD,mDAA0C;AAC1C,kDAA8C;AAGvC,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,IAAA,2BAAgB,EAAC,yBAAQ,EAAE,kBAAkB,CAAC;IAC/E,YAA6B,IAAiB;QAC5C,KAAK,CAAC,EAAE,aAAa,EAAE,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,CAAC,CAAC;QADlC,SAAI,GAAJ,IAAI,CAAa;IAE9C,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,KAAa,EAAE,QAAgB;QAC5C,OAAO,IAAI,CAAC,IAAI,CAAC,mBAAmB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IACxD,CAAC;CACF,CAAA;AARY,sCAAa;wBAAb,aAAa;IADzB,IAAA,mBAAU,GAAE;qCAEwB,0BAAW;GADnC,aAAa,CAQzB"}
@@ -1 +0,0 @@
1
- export { BILLING_ADAPTER, type IBillingAdapter } from '@agentforge/core';
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BILLING_ADAPTER = void 0;
4
- var core_1 = require("@agentforge/core");
5
- Object.defineProperty(exports, "BILLING_ADAPTER", { enumerable: true, get: function () { return core_1.BILLING_ADAPTER; } });
6
- //# sourceMappingURL=billing-adapter.interface.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"billing-adapter.interface.js","sourceRoot":"","sources":["../../../../src/modules/billing/adapters/billing-adapter.interface.ts"],"names":[],"mappings":";;;AAEA,yCAAyE;AAAhE,uGAAA,eAAe,OAAA"}
@@ -1,19 +0,0 @@
1
- import Stripe from 'stripe';
2
- import type { IBillingAdapter } from '../billing-adapter.interface';
3
- import type { CheckoutSession, CreateCheckoutParams, CreateCustomerParams, CreateSubscriptionParams, PlanDefinition, StripeConfig, SubscriptionResult, WebhookEvent } from '../../../../types';
4
- export declare class StripeAdapter implements IBillingAdapter {
5
- private readonly logger;
6
- private readonly stripe;
7
- private readonly plans;
8
- constructor(config: StripeConfig, plans?: PlanDefinition[]);
9
- createCustomer(params: CreateCustomerParams): Promise<string>;
10
- createCheckoutSession(params: CreateCheckoutParams): Promise<CheckoutSession>;
11
- createSubscription(params: CreateSubscriptionParams): Promise<SubscriptionResult>;
12
- cancelSubscription(subscriptionId: string, atPeriodEnd?: boolean): Promise<void>;
13
- getSubscription(subscriptionId: string): Promise<SubscriptionResult & {
14
- status: string;
15
- }>;
16
- getPortalUrl(customerId: string, returnUrl: string): Promise<string>;
17
- handleWebhook(payload: Buffer, signature: string): Promise<WebhookEvent>;
18
- getStripeInstance(): Stripe;
19
- }