@agentforge-io/nest 0.2.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.
- package/README.md +486 -0
- package/dist/agent-forge.module.d.ts +21 -0
- package/dist/agent-forge.module.js +144 -0
- package/dist/agent-forge.module.js.map +1 -0
- package/dist/auth/current-user.decorator.d.ts +8 -0
- package/dist/auth/current-user.decorator.js +9 -0
- package/dist/auth/current-user.decorator.js.map +1 -0
- package/dist/auth/public.decorator.d.ts +2 -0
- package/dist/auth/public.decorator.js +8 -0
- package/dist/auth/public.decorator.js.map +1 -0
- package/dist/constants.d.ts +2 -0
- package/dist/constants.js +9 -0
- package/dist/constants.js.map +1 -0
- package/dist/core/agent-runner.service.d.ts +1 -0
- package/dist/core/agent-runner.service.js +6 -0
- package/dist/core/agent-runner.service.js.map +1 -0
- package/dist/core/orchestrator.service.d.ts +2 -0
- package/dist/core/orchestrator.service.js +7 -0
- package/dist/core/orchestrator.service.js.map +1 -0
- package/dist/core/tool-registry.service.d.ts +1 -0
- package/dist/core/tool-registry.service.js +6 -0
- package/dist/core/tool-registry.service.js.map +1 -0
- package/dist/database/entities/auth-identity.entity.d.ts +1 -0
- package/dist/database/entities/auth-identity.entity.js +6 -0
- package/dist/database/entities/auth-identity.entity.js.map +1 -0
- package/dist/database/entities/conversation.entity.d.ts +1 -0
- package/dist/database/entities/conversation.entity.js +6 -0
- package/dist/database/entities/conversation.entity.js.map +1 -0
- package/dist/database/entities/email-token.entity.d.ts +1 -0
- package/dist/database/entities/email-token.entity.js +6 -0
- package/dist/database/entities/email-token.entity.js.map +1 -0
- package/dist/database/entities/index.d.ts +7 -0
- package/dist/database/entities/index.js +16 -0
- package/dist/database/entities/index.js.map +1 -0
- package/dist/database/entities/message.entity.d.ts +1 -0
- package/dist/database/entities/message.entity.js +6 -0
- package/dist/database/entities/message.entity.js.map +1 -0
- package/dist/database/entities/refresh-token.entity.d.ts +1 -0
- package/dist/database/entities/refresh-token.entity.js +6 -0
- package/dist/database/entities/refresh-token.entity.js.map +1 -0
- package/dist/database/entities/subscription.entity.d.ts +1 -0
- package/dist/database/entities/subscription.entity.js +6 -0
- package/dist/database/entities/subscription.entity.js.map +1 -0
- package/dist/database/entities/usage-record.entity.d.ts +1 -0
- package/dist/database/entities/usage-record.entity.js +6 -0
- package/dist/database/entities/usage-record.entity.js.map +1 -0
- package/dist/database/entities/user.entity.d.ts +1 -0
- package/dist/database/entities/user.entity.js +6 -0
- package/dist/database/entities/user.entity.js.map +1 -0
- package/dist/decorators/agent-tool.decorator.d.ts +21 -0
- package/dist/decorators/agent-tool.decorator.js +12 -0
- package/dist/decorators/agent-tool.decorator.js.map +1 -0
- package/dist/decorators/rate-limit.decorator.d.ts +9 -0
- package/dist/decorators/rate-limit.decorator.js +11 -0
- package/dist/decorators/rate-limit.decorator.js.map +1 -0
- package/dist/decorators/require-plan.decorator.d.ts +2 -0
- package/dist/decorators/require-plan.decorator.js +8 -0
- package/dist/decorators/require-plan.decorator.js.map +1 -0
- package/dist/filters/agentforge-exception.filter.d.ts +5 -0
- package/dist/filters/agentforge-exception.filter.js +40 -0
- package/dist/filters/agentforge-exception.filter.js.map +1 -0
- package/dist/guards/rate-limit.guard.d.ts +10 -0
- package/dist/guards/rate-limit.guard.js +73 -0
- package/dist/guards/rate-limit.guard.js.map +1 -0
- package/dist/guards/usage-limit.guard.d.ts +11 -0
- package/dist/guards/usage-limit.guard.js +57 -0
- package/dist/guards/usage-limit.guard.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +35 -0
- package/dist/index.js.map +1 -0
- package/dist/interceptors/usage-tracking.interceptor.d.ts +6 -0
- package/dist/interceptors/usage-tracking.interceptor.js +30 -0
- package/dist/interceptors/usage-tracking.interceptor.js.map +1 -0
- package/dist/modules/admin/admin-plans.controller.d.ts +11 -0
- package/dist/modules/admin/admin-plans.controller.js +97 -0
- package/dist/modules/admin/admin-plans.controller.js.map +1 -0
- package/dist/modules/admin/admin-tenant-agents.controller.d.ts +61 -0
- package/dist/modules/admin/admin-tenant-agents.controller.js +424 -0
- package/dist/modules/admin/admin-tenant-agents.controller.js.map +1 -0
- package/dist/modules/admin/admin-tenant-billing.controller.d.ts +51 -0
- package/dist/modules/admin/admin-tenant-billing.controller.js +119 -0
- package/dist/modules/admin/admin-tenant-billing.controller.js.map +1 -0
- package/dist/modules/admin/admin-tenants.controller.d.ts +43 -0
- package/dist/modules/admin/admin-tenants.controller.js +178 -0
- package/dist/modules/admin/admin-tenants.controller.js.map +1 -0
- package/dist/modules/admin/admin-users.controller.d.ts +41 -0
- package/dist/modules/admin/admin-users.controller.js +121 -0
- package/dist/modules/admin/admin-users.controller.js.map +1 -0
- package/dist/modules/admin/admin.module.d.ts +2 -0
- package/dist/modules/admin/admin.module.js +26 -0
- package/dist/modules/admin/admin.module.js.map +1 -0
- package/dist/modules/admin/platform-admin.guard.d.ts +7 -0
- package/dist/modules/admin/platform-admin.guard.js +52 -0
- package/dist/modules/admin/platform-admin.guard.js.map +1 -0
- package/dist/modules/agent/agent.controller.d.ts +34 -0
- package/dist/modules/agent/agent.controller.js +178 -0
- package/dist/modules/agent/agent.controller.js.map +1 -0
- package/dist/modules/agent/agent.module.d.ts +2 -0
- package/dist/modules/agent/agent.module.js +23 -0
- package/dist/modules/agent/agent.module.js.map +1 -0
- package/dist/modules/agent/agent.service.d.ts +2 -0
- package/dist/modules/agent/agent.service.js +7 -0
- package/dist/modules/agent/agent.service.js.map +1 -0
- package/dist/modules/agent/dto/create-conversation.dto.d.ts +8 -0
- package/dist/modules/agent/dto/create-conversation.dto.js +48 -0
- package/dist/modules/agent/dto/create-conversation.dto.js.map +1 -0
- package/dist/modules/agent/dto/send-message.dto.d.ts +12 -0
- package/dist/modules/agent/dto/send-message.dto.js +42 -0
- package/dist/modules/agent/dto/send-message.dto.js.map +1 -0
- package/dist/modules/agent/in-memory-prepared-stream.store.d.ts +1 -0
- package/dist/modules/agent/in-memory-prepared-stream.store.js +6 -0
- package/dist/modules/agent/in-memory-prepared-stream.store.js.map +1 -0
- package/dist/modules/agent/prepared-stream.service.d.ts +1 -0
- package/dist/modules/agent/prepared-stream.service.js +7 -0
- package/dist/modules/agent/prepared-stream.service.js.map +1 -0
- package/dist/modules/agent/prepared-stream.types.d.ts +1 -0
- package/dist/modules/agent/prepared-stream.types.js +6 -0
- package/dist/modules/agent/prepared-stream.types.js.map +1 -0
- package/dist/modules/agent/redis-prepared-stream.store.d.ts +9 -0
- package/dist/modules/agent/redis-prepared-stream.store.js +48 -0
- package/dist/modules/agent/redis-prepared-stream.store.js.map +1 -0
- package/dist/modules/auth/auth.controller.d.ts +63 -0
- package/dist/modules/auth/auth.controller.js +255 -0
- package/dist/modules/auth/auth.controller.js.map +1 -0
- package/dist/modules/auth/auth.module.d.ts +4 -0
- package/dist/modules/auth/auth.module.js +71 -0
- package/dist/modules/auth/auth.module.js.map +1 -0
- package/dist/modules/auth/auth.service.d.ts +2 -0
- package/dist/modules/auth/auth.service.js +7 -0
- package/dist/modules/auth/auth.service.js.map +1 -0
- package/dist/modules/auth/decorators/current-user.decorator.d.ts +8 -0
- package/dist/modules/auth/decorators/current-user.decorator.js +12 -0
- package/dist/modules/auth/decorators/current-user.decorator.js.map +1 -0
- package/dist/modules/auth/decorators/public.decorator.d.ts +2 -0
- package/dist/modules/auth/decorators/public.decorator.js +8 -0
- package/dist/modules/auth/decorators/public.decorator.js.map +1 -0
- package/dist/modules/auth/dto/login.dto.d.ts +4 -0
- package/dist/modules/auth/dto/login.dto.js +29 -0
- package/dist/modules/auth/dto/login.dto.js.map +1 -0
- package/dist/modules/auth/dto/register.dto.d.ts +5 -0
- package/dist/modules/auth/dto/register.dto.js +36 -0
- package/dist/modules/auth/dto/register.dto.js.map +1 -0
- package/dist/modules/auth/guards/jwt-auth.guard.d.ts +9 -0
- package/dist/modules/auth/guards/jwt-auth.guard.js +37 -0
- package/dist/modules/auth/guards/jwt-auth.guard.js.map +1 -0
- package/dist/modules/auth/guards/local-auth.guard.d.ts +4 -0
- package/dist/modules/auth/guards/local-auth.guard.js +18 -0
- package/dist/modules/auth/guards/local-auth.guard.js.map +1 -0
- package/dist/modules/auth/guards/oauth-configured.guard.d.ts +11 -0
- package/dist/modules/auth/guards/oauth-configured.guard.js +51 -0
- package/dist/modules/auth/guards/oauth-configured.guard.js.map +1 -0
- package/dist/modules/auth/oauth.controller.d.ts +20 -0
- package/dist/modules/auth/oauth.controller.js +208 -0
- package/dist/modules/auth/oauth.controller.js.map +1 -0
- package/dist/modules/auth/refresh-token.service.d.ts +2 -0
- package/dist/modules/auth/refresh-token.service.js +7 -0
- package/dist/modules/auth/refresh-token.service.js.map +1 -0
- package/dist/modules/auth/strategies/github.strategy.d.ts +12 -0
- package/dist/modules/auth/strategies/github.strategy.js +57 -0
- package/dist/modules/auth/strategies/github.strategy.js.map +1 -0
- package/dist/modules/auth/strategies/google.strategy.d.ts +19 -0
- package/dist/modules/auth/strategies/google.strategy.js +56 -0
- package/dist/modules/auth/strategies/google.strategy.js.map +1 -0
- package/dist/modules/auth/strategies/jwt.strategy.d.ts +18 -0
- package/dist/modules/auth/strategies/jwt.strategy.js +49 -0
- package/dist/modules/auth/strategies/jwt.strategy.js.map +1 -0
- package/dist/modules/auth/strategies/local.strategy.d.ts +11 -0
- package/dist/modules/auth/strategies/local.strategy.js +31 -0
- package/dist/modules/auth/strategies/local.strategy.js.map +1 -0
- package/dist/modules/billing/adapters/billing-adapter.interface.d.ts +1 -0
- package/dist/modules/billing/adapters/billing-adapter.interface.js +6 -0
- package/dist/modules/billing/adapters/billing-adapter.interface.js.map +1 -0
- package/dist/modules/billing/adapters/stripe/stripe.adapter.d.ts +19 -0
- package/dist/modules/billing/adapters/stripe/stripe.adapter.js +118 -0
- package/dist/modules/billing/adapters/stripe/stripe.adapter.js.map +1 -0
- package/dist/modules/billing/billing.controller.d.ts +54 -0
- package/dist/modules/billing/billing.controller.js +180 -0
- package/dist/modules/billing/billing.controller.js.map +1 -0
- package/dist/modules/billing/billing.module.d.ts +2 -0
- package/dist/modules/billing/billing.module.js +57 -0
- package/dist/modules/billing/billing.module.js.map +1 -0
- package/dist/modules/billing/billing.service.d.ts +2 -0
- package/dist/modules/billing/billing.service.js +7 -0
- package/dist/modules/billing/billing.service.js.map +1 -0
- package/dist/modules/billing/usage.service.d.ts +2 -0
- package/dist/modules/billing/usage.service.js +6 -0
- package/dist/modules/billing/usage.service.js.map +1 -0
- package/dist/modules/connectors/connectors.controller.d.ts +16 -0
- package/dist/modules/connectors/connectors.controller.js +142 -0
- package/dist/modules/connectors/connectors.controller.js.map +1 -0
- package/dist/modules/connectors/connectors.module.d.ts +2 -0
- package/dist/modules/connectors/connectors.module.js +20 -0
- package/dist/modules/connectors/connectors.module.js.map +1 -0
- package/dist/modules/conversation/conversation.module.d.ts +2 -0
- package/dist/modules/conversation/conversation.module.js +17 -0
- package/dist/modules/conversation/conversation.module.js.map +1 -0
- package/dist/modules/conversation/conversation.service.d.ts +1 -0
- package/dist/modules/conversation/conversation.service.js +7 -0
- package/dist/modules/conversation/conversation.service.js.map +1 -0
- package/dist/modules/email/adapters/email-adapter.interface.d.ts +1 -0
- package/dist/modules/email/adapters/email-adapter.interface.js +6 -0
- package/dist/modules/email/adapters/email-adapter.interface.js.map +1 -0
- package/dist/modules/email/adapters/noop.adapter.d.ts +1 -0
- package/dist/modules/email/adapters/noop.adapter.js +6 -0
- package/dist/modules/email/adapters/noop.adapter.js.map +1 -0
- package/dist/modules/email/adapters/resend.adapter.d.ts +1 -0
- package/dist/modules/email/adapters/resend.adapter.js +6 -0
- package/dist/modules/email/adapters/resend.adapter.js.map +1 -0
- package/dist/modules/email/email.module.d.ts +2 -0
- package/dist/modules/email/email.module.js +17 -0
- package/dist/modules/email/email.module.js.map +1 -0
- package/dist/modules/email/email.service.d.ts +1 -0
- package/dist/modules/email/email.service.js +6 -0
- package/dist/modules/email/email.service.js.map +1 -0
- package/dist/modules/email/templates/transactional.template.d.ts +18 -0
- package/dist/modules/email/templates/transactional.template.js +43 -0
- package/dist/modules/email/templates/transactional.template.js.map +1 -0
- package/dist/modules/mcp/mcp-admin.controller.d.ts +35 -0
- package/dist/modules/mcp/mcp-admin.controller.js +111 -0
- package/dist/modules/mcp/mcp-admin.controller.js.map +1 -0
- package/dist/modules/mcp/mcp.module.d.ts +8 -0
- package/dist/modules/mcp/mcp.module.js +38 -0
- package/dist/modules/mcp/mcp.module.js.map +1 -0
- package/dist/modules/public-chat/public-chat.controller.d.ts +54 -0
- package/dist/modules/public-chat/public-chat.controller.js +279 -0
- package/dist/modules/public-chat/public-chat.controller.js.map +1 -0
- package/dist/modules/public-chat/public-chat.module.d.ts +2 -0
- package/dist/modules/public-chat/public-chat.module.js +20 -0
- package/dist/modules/public-chat/public-chat.module.js.map +1 -0
- package/dist/modules/queue/jobs.controller.d.ts +23 -0
- package/dist/modules/queue/jobs.controller.js +98 -0
- package/dist/modules/queue/jobs.controller.js.map +1 -0
- package/dist/modules/queue/processors/agent.processor.d.ts +12 -0
- package/dist/modules/queue/processors/agent.processor.js +65 -0
- package/dist/modules/queue/processors/agent.processor.js.map +1 -0
- package/dist/modules/queue/queue.module.d.ts +5 -0
- package/dist/modules/queue/queue.module.js +55 -0
- package/dist/modules/queue/queue.module.js.map +1 -0
- package/dist/modules/queue/queue.service.d.ts +15 -0
- package/dist/modules/queue/queue.service.js +86 -0
- package/dist/modules/queue/queue.service.js.map +1 -0
- package/dist/providers/repositories.providers.d.ts +3 -0
- package/dist/providers/repositories.providers.js +35 -0
- package/dist/providers/repositories.providers.js.map +1 -0
- package/dist/providers/services.providers.d.ts +4 -0
- package/dist/providers/services.providers.js +142 -0
- package/dist/providers/services.providers.js.map +1 -0
- package/dist/redis/redis.provider.d.ts +3 -0
- package/dist/redis/redis.provider.js +48 -0
- package/dist/redis/redis.provider.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +18 -0
- package/dist/types/index.js.map +1 -0
- package/package.json +63 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { TenantBillingService, TenantService } from '@agentforge/core';
|
|
2
|
+
import { type AuthUser } from '../auth/decorators/current-user.decorator';
|
|
3
|
+
export declare class AdminTenantBillingController {
|
|
4
|
+
private readonly tenants?;
|
|
5
|
+
private readonly billing?;
|
|
6
|
+
constructor(tenants?: TenantService | undefined, billing?: TenantBillingService | undefined);
|
|
7
|
+
getOverview(tenantId: string, user: AuthUser): Promise<{
|
|
8
|
+
availablePlans: import("@agentforge/core").Plan[];
|
|
9
|
+
plan: {
|
|
10
|
+
id: string;
|
|
11
|
+
name: string;
|
|
12
|
+
features: string[];
|
|
13
|
+
limits: {
|
|
14
|
+
requestsPerMonth: number;
|
|
15
|
+
tokensPerMonth: number;
|
|
16
|
+
};
|
|
17
|
+
priceInCents?: number;
|
|
18
|
+
interval?: "month" | "year";
|
|
19
|
+
};
|
|
20
|
+
usage: {
|
|
21
|
+
period: string;
|
|
22
|
+
requestCount: number;
|
|
23
|
+
totalTokens: number;
|
|
24
|
+
requestLimit: number;
|
|
25
|
+
tokenLimit: number;
|
|
26
|
+
};
|
|
27
|
+
subscription: {
|
|
28
|
+
id: string;
|
|
29
|
+
planId: string;
|
|
30
|
+
status: import("@agentforge/core").SubscriptionStatus;
|
|
31
|
+
currentPeriodStart?: Date;
|
|
32
|
+
currentPeriodEnd?: Date;
|
|
33
|
+
cancelAtPeriodEnd: boolean;
|
|
34
|
+
} | null;
|
|
35
|
+
}>;
|
|
36
|
+
createCheckout(tenantId: string, body: {
|
|
37
|
+
planId: string;
|
|
38
|
+
successUrl?: string;
|
|
39
|
+
cancelUrl?: string;
|
|
40
|
+
appUrl?: string;
|
|
41
|
+
}, user: AuthUser): Promise<import("@agentforge/core").TenantCheckoutResult>;
|
|
42
|
+
getPortalUrl(tenantId: string, body: {
|
|
43
|
+
returnUrl?: string;
|
|
44
|
+
}, user: AuthUser): Promise<{
|
|
45
|
+
url: string;
|
|
46
|
+
}>;
|
|
47
|
+
cancelSubscription(tenantId: string, body: {
|
|
48
|
+
immediately?: boolean;
|
|
49
|
+
}, user: AuthUser): Promise<void>;
|
|
50
|
+
private ensureWired;
|
|
51
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
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.AdminTenantBillingController = void 0;
|
|
16
|
+
const common_1 = require("@nestjs/common");
|
|
17
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
18
|
+
const core_1 = require("@agentforge/core");
|
|
19
|
+
const current_user_decorator_1 = require("../auth/decorators/current-user.decorator");
|
|
20
|
+
const platform_admin_guard_1 = require("./platform-admin.guard");
|
|
21
|
+
let AdminTenantBillingController = class AdminTenantBillingController {
|
|
22
|
+
constructor(tenants, billing) {
|
|
23
|
+
this.tenants = tenants;
|
|
24
|
+
this.billing = billing;
|
|
25
|
+
}
|
|
26
|
+
async getOverview(tenantId, user) {
|
|
27
|
+
this.ensureWired();
|
|
28
|
+
const userId = user.userId;
|
|
29
|
+
await this.tenants.assertOwner(tenantId, userId, { allowAnyOwner: user.isPlatformAdmin });
|
|
30
|
+
const overview = await this.billing.getOverview(tenantId);
|
|
31
|
+
return { ...overview, availablePlans: await this.billing.getPlans() };
|
|
32
|
+
}
|
|
33
|
+
async createCheckout(tenantId, body, user) {
|
|
34
|
+
this.ensureWired();
|
|
35
|
+
const userId = user.userId;
|
|
36
|
+
await this.tenants.assertOwner(tenantId, userId, { allowAnyOwner: user.isPlatformAdmin });
|
|
37
|
+
return this.billing.createCheckout({
|
|
38
|
+
tenantId,
|
|
39
|
+
planId: body.planId,
|
|
40
|
+
successUrl: body.successUrl,
|
|
41
|
+
cancelUrl: body.cancelUrl,
|
|
42
|
+
appUrl: body.appUrl,
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
async getPortalUrl(tenantId, body, user) {
|
|
46
|
+
this.ensureWired();
|
|
47
|
+
const userId = user.userId;
|
|
48
|
+
await this.tenants.assertOwner(tenantId, userId, { allowAnyOwner: user.isPlatformAdmin });
|
|
49
|
+
return this.billing.getPortalUrl(tenantId, body.returnUrl);
|
|
50
|
+
}
|
|
51
|
+
async cancelSubscription(tenantId, body, user) {
|
|
52
|
+
this.ensureWired();
|
|
53
|
+
const userId = user.userId;
|
|
54
|
+
await this.tenants.assertOwner(tenantId, userId, { allowAnyOwner: user.isPlatformAdmin });
|
|
55
|
+
await this.billing.cancelSubscription(tenantId, body.immediately);
|
|
56
|
+
}
|
|
57
|
+
ensureWired() {
|
|
58
|
+
if (!this.tenants || !this.billing) {
|
|
59
|
+
throw new common_1.NotImplementedException({
|
|
60
|
+
error: 'b2b_billing_not_configured',
|
|
61
|
+
message: 'B2B billing requires a billing adapter and tenant/apiKey/externalUser repositories.',
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
exports.AdminTenantBillingController = AdminTenantBillingController;
|
|
67
|
+
__decorate([
|
|
68
|
+
(0, common_1.Get)(),
|
|
69
|
+
(0, swagger_1.ApiOperation)({
|
|
70
|
+
summary: 'Tenant billing overview — current plan, usage, subscription, available plans',
|
|
71
|
+
}),
|
|
72
|
+
__param(0, (0, common_1.Param)('tenantId')),
|
|
73
|
+
__param(1, (0, current_user_decorator_1.CurrentUser)()),
|
|
74
|
+
__metadata("design:type", Function),
|
|
75
|
+
__metadata("design:paramtypes", [String, Object]),
|
|
76
|
+
__metadata("design:returntype", Promise)
|
|
77
|
+
], AdminTenantBillingController.prototype, "getOverview", null);
|
|
78
|
+
__decorate([
|
|
79
|
+
(0, common_1.Post)('checkout'),
|
|
80
|
+
(0, swagger_1.ApiOperation)({ summary: 'Start a checkout session for a tenant plan' }),
|
|
81
|
+
(0, common_1.HttpCode)(common_1.HttpStatus.CREATED),
|
|
82
|
+
__param(0, (0, common_1.Param)('tenantId')),
|
|
83
|
+
__param(1, (0, common_1.Body)()),
|
|
84
|
+
__param(2, (0, current_user_decorator_1.CurrentUser)()),
|
|
85
|
+
__metadata("design:type", Function),
|
|
86
|
+
__metadata("design:paramtypes", [String, Object, Object]),
|
|
87
|
+
__metadata("design:returntype", Promise)
|
|
88
|
+
], AdminTenantBillingController.prototype, "createCheckout", null);
|
|
89
|
+
__decorate([
|
|
90
|
+
(0, common_1.Post)('portal'),
|
|
91
|
+
(0, swagger_1.ApiOperation)({ summary: 'Get a customer-portal URL for the tenant' }),
|
|
92
|
+
__param(0, (0, common_1.Param)('tenantId')),
|
|
93
|
+
__param(1, (0, common_1.Body)()),
|
|
94
|
+
__param(2, (0, current_user_decorator_1.CurrentUser)()),
|
|
95
|
+
__metadata("design:type", Function),
|
|
96
|
+
__metadata("design:paramtypes", [String, Object, Object]),
|
|
97
|
+
__metadata("design:returntype", Promise)
|
|
98
|
+
], AdminTenantBillingController.prototype, "getPortalUrl", null);
|
|
99
|
+
__decorate([
|
|
100
|
+
(0, common_1.Delete)('subscription'),
|
|
101
|
+
(0, swagger_1.ApiOperation)({ summary: 'Cancel the tenant subscription' }),
|
|
102
|
+
(0, common_1.HttpCode)(common_1.HttpStatus.NO_CONTENT),
|
|
103
|
+
__param(0, (0, common_1.Param)('tenantId')),
|
|
104
|
+
__param(1, (0, common_1.Body)()),
|
|
105
|
+
__param(2, (0, current_user_decorator_1.CurrentUser)()),
|
|
106
|
+
__metadata("design:type", Function),
|
|
107
|
+
__metadata("design:paramtypes", [String, Object, Object]),
|
|
108
|
+
__metadata("design:returntype", Promise)
|
|
109
|
+
], AdminTenantBillingController.prototype, "cancelSubscription", null);
|
|
110
|
+
exports.AdminTenantBillingController = AdminTenantBillingController = __decorate([
|
|
111
|
+
(0, swagger_1.ApiTags)('Admin: Tenant Billing'),
|
|
112
|
+
(0, common_1.Controller)('admin/tenants/:tenantId/billing'),
|
|
113
|
+
(0, common_1.UseGuards)(platform_admin_guard_1.RequireUserSessionGuard),
|
|
114
|
+
__param(0, (0, common_1.Optional)()),
|
|
115
|
+
__param(1, (0, common_1.Optional)()),
|
|
116
|
+
__metadata("design:paramtypes", [core_1.TenantService,
|
|
117
|
+
core_1.TenantBillingService])
|
|
118
|
+
], AdminTenantBillingController);
|
|
119
|
+
//# sourceMappingURL=admin-tenant-billing.controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin-tenant-billing.controller.js","sourceRoot":"","sources":["../../../src/modules/admin/admin-tenant-billing.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAYwB;AACxB,6CAAwD;AACxD,2CAAuE;AACvE,sFAAuF;AACvF,iEAAiE;AAU1D,IAAM,4BAA4B,GAAlC,MAAM,4BAA4B;IACvC,YAC+B,OAAuB,EACvB,OAA8B;QAD9B,YAAO,GAAP,OAAO,CAAgB;QACvB,YAAO,GAAP,OAAO,CAAuB;IAC1D,CAAC;IAOE,AAAN,KAAK,CAAC,WAAW,CACI,QAAgB,EACpB,IAAc;QAE7B,IAAI,CAAC,WAAW,EAAE,CAAC;QACnB,MAAM,MAAM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AAE,OAAO,EAAE,0CAA0C,EAAE,CAAC;IAEnE,WAAA,IAAA,cAAK,EAAC,UAAU,CAAC,CAAA;IACjB,WAAA,IAAA,aAAI,GAAE,CAAA;IACN,WAAA,IAAA,oCAAW,GAAE,CAAA;;;;gEAMf;AAKK;IAHL,IAAA,eAAM,EAAC,cAAc,CAAC;IACtB,IAAA,sBAAY,EAAC,EAAE,OAAO,EAAE,gCAAgC,EAAE,CAAC;IAC3D,IAAA,iBAAQ,EAAC,mBAAU,CAAC,UAAU,CAAC;IAE7B,WAAA,IAAA,cAAK,EAAC,UAAU,CAAC,CAAA;IACjB,WAAA,IAAA,aAAI,GAAE,CAAA;IACN,WAAA,IAAA,oCAAW,GAAE,CAAA;;;;sEAMf;uCAxEU,4BAA4B;IAHxC,IAAA,iBAAO,EAAC,uBAAuB,CAAC;IAChC,IAAA,mBAAU,EAAC,iCAAiC,CAAC;IAC7C,IAAA,kBAAS,EAAC,8CAAuB,CAAC;IAG9B,WAAA,IAAA,iBAAQ,GAAE,CAAA;IACV,WAAA,IAAA,iBAAQ,GAAE,CAAA;qCAD4B,oBAAa;QACb,2BAAoB;GAHlD,4BAA4B,CAmFxC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { ApiKeyService, TenantService } from '@agentforge/core';
|
|
2
|
+
import { type AuthUser } from '../auth/decorators/current-user.decorator';
|
|
3
|
+
export declare class AdminTenantsController {
|
|
4
|
+
private readonly tenants?;
|
|
5
|
+
private readonly apiKeys?;
|
|
6
|
+
constructor(tenants?: TenantService | undefined, apiKeys?: ApiKeyService | undefined);
|
|
7
|
+
createTenant(body: {
|
|
8
|
+
name?: string;
|
|
9
|
+
planId?: string;
|
|
10
|
+
}, userId: string): Promise<import("@agentforge/core").Tenant>;
|
|
11
|
+
listMyTenants(user: AuthUser, q?: string, status?: string, limit?: string, offset?: string): Promise<{
|
|
12
|
+
items: import("@agentforge/core").Tenant[];
|
|
13
|
+
total: number;
|
|
14
|
+
limit: number | null;
|
|
15
|
+
offset: number;
|
|
16
|
+
}>;
|
|
17
|
+
issueApiKey(tenantId: string, body: {
|
|
18
|
+
name?: string;
|
|
19
|
+
scopes?: string[];
|
|
20
|
+
expiresAt?: string;
|
|
21
|
+
}, user: AuthUser): Promise<{
|
|
22
|
+
key: string;
|
|
23
|
+
id: string;
|
|
24
|
+
name: string;
|
|
25
|
+
keyPrefix: string;
|
|
26
|
+
scopes: string[] | undefined;
|
|
27
|
+
expiresAt: Date | undefined;
|
|
28
|
+
createdAt: Date;
|
|
29
|
+
}>;
|
|
30
|
+
listApiKeys(tenantId: string, user: AuthUser): Promise<{
|
|
31
|
+
id: string;
|
|
32
|
+
name: string;
|
|
33
|
+
keyPrefix: string;
|
|
34
|
+
scopes: string[] | undefined;
|
|
35
|
+
createdAt: Date;
|
|
36
|
+
lastUsedAt: Date | undefined;
|
|
37
|
+
expiresAt: Date | undefined;
|
|
38
|
+
revokedAt: Date | undefined;
|
|
39
|
+
}[]>;
|
|
40
|
+
revokeApiKey(tenantId: string, keyId: string, user: AuthUser): Promise<void>;
|
|
41
|
+
private ensureB2B;
|
|
42
|
+
private ensureB2BWithApiKeys;
|
|
43
|
+
}
|
|
@@ -0,0 +1,178 @@
|
|
|
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.AdminTenantsController = void 0;
|
|
16
|
+
const common_1 = require("@nestjs/common");
|
|
17
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
18
|
+
const core_1 = require("@agentforge/core");
|
|
19
|
+
const current_user_decorator_1 = require("../auth/decorators/current-user.decorator");
|
|
20
|
+
const platform_admin_guard_1 = require("./platform-admin.guard");
|
|
21
|
+
let AdminTenantsController = class AdminTenantsController {
|
|
22
|
+
constructor(tenants, apiKeys) {
|
|
23
|
+
this.tenants = tenants;
|
|
24
|
+
this.apiKeys = apiKeys;
|
|
25
|
+
}
|
|
26
|
+
async createTenant(body, userId) {
|
|
27
|
+
this.ensureB2B();
|
|
28
|
+
if (!body?.name)
|
|
29
|
+
throw new common_1.BadRequestException('name is required');
|
|
30
|
+
return this.tenants.create({
|
|
31
|
+
name: body.name,
|
|
32
|
+
ownerUserId: userId,
|
|
33
|
+
planId: body.planId,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
async listMyTenants(user, q, status, limit, offset) {
|
|
37
|
+
this.ensureB2B();
|
|
38
|
+
const limitNum = limit ? Number(limit) : undefined;
|
|
39
|
+
const offsetNum = offset ? Number(offset) : undefined;
|
|
40
|
+
const isActive = status === 'active' ? true : status === 'inactive' ? false : undefined;
|
|
41
|
+
const opts = { q, isActive, limit: limitNum, offset: offsetNum };
|
|
42
|
+
const result = user.isPlatformAdmin
|
|
43
|
+
? await this.tenants.listAll(opts)
|
|
44
|
+
: await this.tenants.listForOwner(user.userId, opts);
|
|
45
|
+
return {
|
|
46
|
+
items: result.items,
|
|
47
|
+
total: result.total,
|
|
48
|
+
limit: limitNum ?? null,
|
|
49
|
+
offset: offsetNum ?? 0,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
async issueApiKey(tenantId, body, user) {
|
|
53
|
+
this.ensureB2BWithApiKeys();
|
|
54
|
+
const userId = user.userId;
|
|
55
|
+
if (!body?.name)
|
|
56
|
+
throw new common_1.BadRequestException('name is required');
|
|
57
|
+
await this.tenants.assertOwner(tenantId, userId, { allowAnyOwner: user.isPlatformAdmin });
|
|
58
|
+
const minted = await this.apiKeys.issue({
|
|
59
|
+
tenantId,
|
|
60
|
+
name: body.name,
|
|
61
|
+
scopes: body.scopes,
|
|
62
|
+
expiresAt: body.expiresAt ? new Date(body.expiresAt) : undefined,
|
|
63
|
+
});
|
|
64
|
+
return {
|
|
65
|
+
key: minted.key,
|
|
66
|
+
id: minted.entity.id,
|
|
67
|
+
name: minted.entity.name,
|
|
68
|
+
keyPrefix: minted.entity.keyPrefix,
|
|
69
|
+
scopes: minted.entity.scopes,
|
|
70
|
+
expiresAt: minted.entity.expiresAt,
|
|
71
|
+
createdAt: minted.entity.createdAt,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
async listApiKeys(tenantId, user) {
|
|
75
|
+
this.ensureB2BWithApiKeys();
|
|
76
|
+
const userId = user.userId;
|
|
77
|
+
await this.tenants.assertOwner(tenantId, userId, { allowAnyOwner: user.isPlatformAdmin });
|
|
78
|
+
const keys = await this.apiKeys.listForTenant(tenantId);
|
|
79
|
+
return keys.map((k) => ({
|
|
80
|
+
id: k.id,
|
|
81
|
+
name: k.name,
|
|
82
|
+
keyPrefix: k.keyPrefix,
|
|
83
|
+
scopes: k.scopes,
|
|
84
|
+
createdAt: k.createdAt,
|
|
85
|
+
lastUsedAt: k.lastUsedAt,
|
|
86
|
+
expiresAt: k.expiresAt,
|
|
87
|
+
revokedAt: k.revokedAt,
|
|
88
|
+
}));
|
|
89
|
+
}
|
|
90
|
+
async revokeApiKey(tenantId, keyId, user) {
|
|
91
|
+
this.ensureB2BWithApiKeys();
|
|
92
|
+
const userId = user.userId;
|
|
93
|
+
await this.tenants.assertOwner(tenantId, userId, { allowAnyOwner: user.isPlatformAdmin });
|
|
94
|
+
await this.apiKeys.revoke(keyId);
|
|
95
|
+
}
|
|
96
|
+
ensureB2B() {
|
|
97
|
+
if (!this.tenants) {
|
|
98
|
+
throw new common_1.NotImplementedException({
|
|
99
|
+
error: 'b2b_not_configured',
|
|
100
|
+
message: 'B2B mode is not configured. Pass tenant/apiKey/externalUser repositories to createAgentForge.',
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
ensureB2BWithApiKeys() {
|
|
105
|
+
if (!this.tenants || !this.apiKeys) {
|
|
106
|
+
throw new common_1.NotImplementedException({
|
|
107
|
+
error: 'b2b_not_configured',
|
|
108
|
+
message: 'B2B mode is not configured. Pass tenant/apiKey/externalUser repositories to createAgentForge.',
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
exports.AdminTenantsController = AdminTenantsController;
|
|
114
|
+
__decorate([
|
|
115
|
+
(0, common_1.Post)(),
|
|
116
|
+
(0, swagger_1.ApiOperation)({ summary: 'Create a tenant owned by the current user' }),
|
|
117
|
+
(0, common_1.HttpCode)(common_1.HttpStatus.CREATED),
|
|
118
|
+
__param(0, (0, common_1.Body)()),
|
|
119
|
+
__param(1, (0, current_user_decorator_1.CurrentUser)('userId')),
|
|
120
|
+
__metadata("design:type", Function),
|
|
121
|
+
__metadata("design:paramtypes", [Object, String]),
|
|
122
|
+
__metadata("design:returntype", Promise)
|
|
123
|
+
], AdminTenantsController.prototype, "createTenant", null);
|
|
124
|
+
__decorate([
|
|
125
|
+
(0, common_1.Get)(),
|
|
126
|
+
(0, swagger_1.ApiOperation)({
|
|
127
|
+
summary: 'List tenants. Platform admins see all; everyone else sees only the tenants they own.',
|
|
128
|
+
}),
|
|
129
|
+
__param(0, (0, current_user_decorator_1.CurrentUser)()),
|
|
130
|
+
__param(1, (0, common_1.Query)('q')),
|
|
131
|
+
__param(2, (0, common_1.Query)('status')),
|
|
132
|
+
__param(3, (0, common_1.Query)('limit')),
|
|
133
|
+
__param(4, (0, common_1.Query)('offset')),
|
|
134
|
+
__metadata("design:type", Function),
|
|
135
|
+
__metadata("design:paramtypes", [Object, String, String, String, String]),
|
|
136
|
+
__metadata("design:returntype", Promise)
|
|
137
|
+
], AdminTenantsController.prototype, "listMyTenants", null);
|
|
138
|
+
__decorate([
|
|
139
|
+
(0, common_1.Post)(':tenantId/api-keys'),
|
|
140
|
+
(0, swagger_1.ApiOperation)({ summary: 'Issue a new API key for a tenant (owner-only)' }),
|
|
141
|
+
(0, common_1.HttpCode)(common_1.HttpStatus.CREATED),
|
|
142
|
+
__param(0, (0, common_1.Param)('tenantId')),
|
|
143
|
+
__param(1, (0, common_1.Body)()),
|
|
144
|
+
__param(2, (0, current_user_decorator_1.CurrentUser)()),
|
|
145
|
+
__metadata("design:type", Function),
|
|
146
|
+
__metadata("design:paramtypes", [String, Object, Object]),
|
|
147
|
+
__metadata("design:returntype", Promise)
|
|
148
|
+
], AdminTenantsController.prototype, "issueApiKey", null);
|
|
149
|
+
__decorate([
|
|
150
|
+
(0, common_1.Get)(':tenantId/api-keys'),
|
|
151
|
+
(0, swagger_1.ApiOperation)({ summary: 'List API keys for a tenant (owner-only)' }),
|
|
152
|
+
__param(0, (0, common_1.Param)('tenantId')),
|
|
153
|
+
__param(1, (0, current_user_decorator_1.CurrentUser)()),
|
|
154
|
+
__metadata("design:type", Function),
|
|
155
|
+
__metadata("design:paramtypes", [String, Object]),
|
|
156
|
+
__metadata("design:returntype", Promise)
|
|
157
|
+
], AdminTenantsController.prototype, "listApiKeys", null);
|
|
158
|
+
__decorate([
|
|
159
|
+
(0, common_1.Delete)(':tenantId/api-keys/:keyId'),
|
|
160
|
+
(0, swagger_1.ApiOperation)({ summary: 'Revoke an API key (owner-only)' }),
|
|
161
|
+
(0, common_1.HttpCode)(common_1.HttpStatus.NO_CONTENT),
|
|
162
|
+
__param(0, (0, common_1.Param)('tenantId')),
|
|
163
|
+
__param(1, (0, common_1.Param)('keyId')),
|
|
164
|
+
__param(2, (0, current_user_decorator_1.CurrentUser)()),
|
|
165
|
+
__metadata("design:type", Function),
|
|
166
|
+
__metadata("design:paramtypes", [String, String, Object]),
|
|
167
|
+
__metadata("design:returntype", Promise)
|
|
168
|
+
], AdminTenantsController.prototype, "revokeApiKey", null);
|
|
169
|
+
exports.AdminTenantsController = AdminTenantsController = __decorate([
|
|
170
|
+
(0, swagger_1.ApiTags)('Admin: Tenants'),
|
|
171
|
+
(0, common_1.Controller)('admin/tenants'),
|
|
172
|
+
(0, common_1.UseGuards)(platform_admin_guard_1.RequireUserSessionGuard),
|
|
173
|
+
__param(0, (0, common_1.Optional)()),
|
|
174
|
+
__param(1, (0, common_1.Optional)()),
|
|
175
|
+
__metadata("design:paramtypes", [core_1.TenantService,
|
|
176
|
+
core_1.ApiKeyService])
|
|
177
|
+
], AdminTenantsController);
|
|
178
|
+
//# sourceMappingURL=admin-tenants.controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin-tenants.controller.js","sourceRoot":"","sources":["../../../src/modules/admin/admin-tenants.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAcwB;AACxB,6CAAwD;AACxD,2CAAgE;AAChE,sFAAuF;AACvF,iEAAiE;AAc1D,IAAM,sBAAsB,GAA5B,MAAM,sBAAsB;IACjC,YAC+B,OAAuB,EACvB,OAAuB;QADvB,YAAO,GAAP,OAAO,CAAgB;QACvB,YAAO,GAAP,OAAO,CAAgB;IACnD,CAAC;IAOE,AAAN,KAAK,CAAC,YAAY,CACR,IAAwC,EACzB,MAAc;QAErC,IAAI,CAAC,SAAS,EAAE,CAAC;QACjB,IAAI,CAAC,IAAI,EAAE,IAAI;YAAE,MAAM,IAAI,4BAAmB,CAAC,kBAAkB,CAAC,CAAC;QACnE,OAAO,IAAI,CAAC,OAAQ,CAAC,MAAM,CAAC;YAC1B,IAAI,EAAE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E7B,WAAA,IAAA,cAAK,EAAC,UAAU,CAAC,CAAA;IACjB,WAAA,IAAA,cAAK,EAAC,OAAO,CAAC,CAAA;IACd,WAAA,IAAA,oCAAW,GAAE,CAAA;;;;0DAMf;iCA5HU,sBAAsB;IAHlC,IAAA,iBAAO,EAAC,gBAAgB,CAAC;IACzB,IAAA,mBAAU,EAAC,eAAe,CAAC;IAC3B,IAAA,kBAAS,EAAC,8CAAuB,CAAC;IAG9B,WAAA,IAAA,iBAAQ,GAAE,CAAA;IACV,WAAA,IAAA,iBAAQ,GAAE,CAAA;qCAD4B,oBAAa;QACb,oBAAa;GAH3C,sBAAsB,CAmJlC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { AuthService } from '@agentforge/core';
|
|
2
|
+
export declare class AdminUsersController {
|
|
3
|
+
private readonly auth;
|
|
4
|
+
constructor(auth: AuthService);
|
|
5
|
+
list(q?: string, role?: string, status?: string, emailVerified?: string, limit?: string, offset?: string): Promise<{
|
|
6
|
+
items: {
|
|
7
|
+
id: string;
|
|
8
|
+
email: string | undefined;
|
|
9
|
+
name: string | undefined;
|
|
10
|
+
role: import("@agentforge/core").UserRole;
|
|
11
|
+
isActive: boolean;
|
|
12
|
+
currentPlanId: string;
|
|
13
|
+
createdAt: Date;
|
|
14
|
+
lastLoginAt: Date | undefined;
|
|
15
|
+
emailVerifiedAt: Date | undefined;
|
|
16
|
+
}[];
|
|
17
|
+
total: number;
|
|
18
|
+
limit: number | null;
|
|
19
|
+
offset: number;
|
|
20
|
+
}>;
|
|
21
|
+
get(userId: string): Promise<{
|
|
22
|
+
id: string;
|
|
23
|
+
email: string | undefined;
|
|
24
|
+
name: string | undefined;
|
|
25
|
+
role: import("@agentforge/core").UserRole;
|
|
26
|
+
isActive: boolean;
|
|
27
|
+
currentPlanId: string;
|
|
28
|
+
creditsBalance: number;
|
|
29
|
+
providerCustomerId: string | undefined;
|
|
30
|
+
createdAt: Date;
|
|
31
|
+
lastLoginAt: Date | undefined;
|
|
32
|
+
emailVerifiedAt: Date | undefined;
|
|
33
|
+
}>;
|
|
34
|
+
setRole(userId: string, body: {
|
|
35
|
+
role?: 'user' | 'platform_admin';
|
|
36
|
+
}): Promise<{
|
|
37
|
+
id: string;
|
|
38
|
+
email: string | undefined;
|
|
39
|
+
role: import("@agentforge/core").UserRole;
|
|
40
|
+
}>;
|
|
41
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
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.AdminUsersController = void 0;
|
|
16
|
+
const common_1 = require("@nestjs/common");
|
|
17
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
18
|
+
const core_1 = require("@agentforge/core");
|
|
19
|
+
const platform_admin_guard_1 = require("./platform-admin.guard");
|
|
20
|
+
let AdminUsersController = class AdminUsersController {
|
|
21
|
+
constructor(auth) {
|
|
22
|
+
this.auth = auth;
|
|
23
|
+
}
|
|
24
|
+
async list(q, role, status, emailVerified, limit, offset) {
|
|
25
|
+
const roleFilter = role === 'platform_admin' || role === 'user' ? role : undefined;
|
|
26
|
+
const isActive = status === 'active' ? true : status === 'inactive' ? false : undefined;
|
|
27
|
+
const verified = emailVerified === 'true' ? true : emailVerified === 'false' ? false : undefined;
|
|
28
|
+
const limitNum = limit ? Number(limit) : undefined;
|
|
29
|
+
const offsetNum = offset ? Number(offset) : undefined;
|
|
30
|
+
const result = await this.auth.listUsers({
|
|
31
|
+
q,
|
|
32
|
+
role: roleFilter,
|
|
33
|
+
isActive,
|
|
34
|
+
emailVerified: verified,
|
|
35
|
+
limit: limitNum,
|
|
36
|
+
offset: offsetNum,
|
|
37
|
+
});
|
|
38
|
+
return {
|
|
39
|
+
items: result.items.map((u) => ({
|
|
40
|
+
id: u.id,
|
|
41
|
+
email: u.email,
|
|
42
|
+
name: u.name,
|
|
43
|
+
role: u.role,
|
|
44
|
+
isActive: u.isActive,
|
|
45
|
+
currentPlanId: u.currentPlanId,
|
|
46
|
+
createdAt: u.createdAt,
|
|
47
|
+
lastLoginAt: u.lastLoginAt,
|
|
48
|
+
emailVerifiedAt: u.emailVerifiedAt,
|
|
49
|
+
})),
|
|
50
|
+
total: result.total,
|
|
51
|
+
limit: limitNum ?? null,
|
|
52
|
+
offset: offsetNum ?? 0,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
async get(userId) {
|
|
56
|
+
const user = await this.auth.getFullUserById(userId);
|
|
57
|
+
if (!user)
|
|
58
|
+
throw new common_1.NotFoundException(`User "${userId}" not found`);
|
|
59
|
+
return {
|
|
60
|
+
id: user.id,
|
|
61
|
+
email: user.email,
|
|
62
|
+
name: user.name,
|
|
63
|
+
role: user.role,
|
|
64
|
+
isActive: user.isActive,
|
|
65
|
+
currentPlanId: user.currentPlanId,
|
|
66
|
+
creditsBalance: user.creditsBalance,
|
|
67
|
+
providerCustomerId: user.providerCustomerId,
|
|
68
|
+
createdAt: user.createdAt,
|
|
69
|
+
lastLoginAt: user.lastLoginAt,
|
|
70
|
+
emailVerifiedAt: user.emailVerifiedAt,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
async setRole(userId, body) {
|
|
74
|
+
const role = body?.role;
|
|
75
|
+
if (role !== 'user' && role !== 'platform_admin') {
|
|
76
|
+
throw new common_1.BadRequestException('role must be "user" or "platform_admin"');
|
|
77
|
+
}
|
|
78
|
+
const updated = await this.auth.setUserRole(userId, role);
|
|
79
|
+
return { id: updated.id, email: updated.email, role: updated.role };
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
exports.AdminUsersController = AdminUsersController;
|
|
83
|
+
__decorate([
|
|
84
|
+
(0, common_1.Get)(),
|
|
85
|
+
(0, swagger_1.ApiOperation)({ summary: 'List users (paginated, newest first)' }),
|
|
86
|
+
__param(0, (0, common_1.Query)('q')),
|
|
87
|
+
__param(1, (0, common_1.Query)('role')),
|
|
88
|
+
__param(2, (0, common_1.Query)('status')),
|
|
89
|
+
__param(3, (0, common_1.Query)('emailVerified')),
|
|
90
|
+
__param(4, (0, common_1.Query)('limit')),
|
|
91
|
+
__param(5, (0, common_1.Query)('offset')),
|
|
92
|
+
__metadata("design:type", Function),
|
|
93
|
+
__metadata("design:paramtypes", [String, String, String, String, String, String]),
|
|
94
|
+
__metadata("design:returntype", Promise)
|
|
95
|
+
], AdminUsersController.prototype, "list", null);
|
|
96
|
+
__decorate([
|
|
97
|
+
(0, common_1.Get)(':userId'),
|
|
98
|
+
(0, swagger_1.ApiOperation)({ summary: 'Get a single user by id' }),
|
|
99
|
+
__param(0, (0, common_1.Param)('userId')),
|
|
100
|
+
__metadata("design:type", Function),
|
|
101
|
+
__metadata("design:paramtypes", [String]),
|
|
102
|
+
__metadata("design:returntype", Promise)
|
|
103
|
+
], AdminUsersController.prototype, "get", null);
|
|
104
|
+
__decorate([
|
|
105
|
+
(0, common_1.Patch)(':userId/role'),
|
|
106
|
+
(0, swagger_1.ApiOperation)({
|
|
107
|
+
summary: 'Change a user role. Refuses to demote the last platform_admin (409).',
|
|
108
|
+
}),
|
|
109
|
+
__param(0, (0, common_1.Param)('userId')),
|
|
110
|
+
__param(1, (0, common_1.Body)()),
|
|
111
|
+
__metadata("design:type", Function),
|
|
112
|
+
__metadata("design:paramtypes", [String, Object]),
|
|
113
|
+
__metadata("design:returntype", Promise)
|
|
114
|
+
], AdminUsersController.prototype, "setRole", null);
|
|
115
|
+
exports.AdminUsersController = AdminUsersController = __decorate([
|
|
116
|
+
(0, swagger_1.ApiTags)('Admin: Users'),
|
|
117
|
+
(0, common_1.Controller)('admin/users'),
|
|
118
|
+
(0, common_1.UseGuards)(platform_admin_guard_1.PlatformAdminGuard),
|
|
119
|
+
__metadata("design:paramtypes", [core_1.AuthService])
|
|
120
|
+
], AdminUsersController);
|
|
121
|
+
//# sourceMappingURL=admin-users.controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin-users.controller.js","sourceRoot":"","sources":["../../../src/modules/admin/admin-users.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAUwB;AACxB,6CAAwD;AACxD,2CAA+C;AAC/C,iEAA4D;AAYrD,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAC/B,YAA6B,IAAiB;QAAjB,SAAI,GAAJ,IAAI,CAAa;IAAG,CAAC;IAI5C,AAAN,KAAK,CAAC,IAAI,CACI,CAAU,EACP,IAAa,EACX,MAAe,EACR,aAAsB,EAC9B,KAAc,EACb,MAAe;QAEhC,MAAM,UAAU,GACd,IAAI,KAAK,gBAAgB,IAAI,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;QAClE,MAAM,QAAQ,GACZ,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;QACzE,MAAM,QAAQ,GACZ,aAAa,KAAK,MAAM,CAAC,CA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IAAA,cAAK,EAAC,QAAQ,CAAC,CAAA;IACf,WAAA,IAAA,cAAK,EAAC,eAAe,CAAC,CAAA;IACtB,WAAA,IAAA,cAAK,EAAC,OAAO,CAAC,CAAA;IACd,WAAA,IAAA,cAAK,EAAC,QAAQ,CAAC,CAAA;;;;gDAoCjB;AAIK;IAFL,IAAA,YAAG,EAAC,SAAS,CAAC;IACd,IAAA,sBAAY,EAAC,EAAE,OAAO,EAAE,yBAAyB,EAAE,CAAC;IAC1C,WAAA,IAAA,cAAK,EAAC,QAAQ,CAAC,CAAA;;;;+CAgBzB;AAOK;IALL,IAAA,cAAK,EAAC,cAAc,CAAC;IACrB,IAAA,sBAAY,EAAC;QACZ,OAAO,EACL,sEAAsE;KACzE,CAAC;IAEC,WAAA,IAAA,cAAK,EAAC,QAAQ,CAAC,CAAA;IACf,WAAA,IAAA,aAAI,GAAE,CAAA;;;;mDAQR;+BApFU,oBAAoB;IAHhC,IAAA,iBAAO,EAAC,cAAc,CAAC;IACvB,IAAA,mBAAU,EAAC,aAAa,CAAC;IACzB,IAAA,kBAAS,EAAC,yCAAkB,CAAC;qCAEO,kBAAW;GADnC,oBAAoB,CAqFhC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
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.AdminModule = void 0;
|
|
10
|
+
const common_1 = require("@nestjs/common");
|
|
11
|
+
const admin_tenants_controller_1 = require("./admin-tenants.controller");
|
|
12
|
+
const admin_tenant_agents_controller_1 = require("./admin-tenant-agents.controller");
|
|
13
|
+
const admin_users_controller_1 = require("./admin-users.controller");
|
|
14
|
+
let AdminModule = class AdminModule {
|
|
15
|
+
};
|
|
16
|
+
exports.AdminModule = AdminModule;
|
|
17
|
+
exports.AdminModule = AdminModule = __decorate([
|
|
18
|
+
(0, common_1.Module)({
|
|
19
|
+
controllers: [
|
|
20
|
+
admin_tenants_controller_1.AdminTenantsController,
|
|
21
|
+
admin_tenant_agents_controller_1.AdminTenantAgentsController,
|
|
22
|
+
admin_users_controller_1.AdminUsersController,
|
|
23
|
+
],
|
|
24
|
+
})
|
|
25
|
+
], AdminModule);
|
|
26
|
+
//# sourceMappingURL=admin.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin.module.js","sourceRoot":"","sources":["../../../src/modules/admin/admin.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,yEAAoE;AACpE,qFAA+E;AAC/E,qEAAgE;AAoBzD,IAAM,WAAW,GAAjB,MAAM,WAAW;CAAG,CAAA;AAAd,kCAAW;sBAAX,WAAW;IAPvB,IAAA,eAAM,EAAC;QACN,WAAW,EAAE;YACX,iDAAsB;YACtB,4DAA2B;YAC3B,6CAAoB;SACrB;KACF,CAAC;GACW,WAAW,CAAG"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CanActivate, ExecutionContext } from '@nestjs/common';
|
|
2
|
+
export declare class RequireUserSessionGuard implements CanActivate {
|
|
3
|
+
canActivate(context: ExecutionContext): boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare class PlatformAdminGuard implements CanActivate {
|
|
6
|
+
canActivate(context: ExecutionContext): boolean;
|
|
7
|
+
}
|