@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.
- package/dist/providers/services.providers.js +16 -3
- package/dist/providers/services.providers.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/dist/database/entities/auth-identity.entity.d.ts +0 -1
- package/dist/database/entities/auth-identity.entity.js +0 -6
- package/dist/database/entities/auth-identity.entity.js.map +0 -1
- package/dist/database/entities/conversation.entity.d.ts +0 -1
- package/dist/database/entities/conversation.entity.js +0 -6
- package/dist/database/entities/conversation.entity.js.map +0 -1
- package/dist/database/entities/email-token.entity.d.ts +0 -1
- package/dist/database/entities/email-token.entity.js +0 -6
- package/dist/database/entities/email-token.entity.js.map +0 -1
- package/dist/database/entities/index.d.ts +0 -7
- package/dist/database/entities/index.js +0 -16
- package/dist/database/entities/index.js.map +0 -1
- package/dist/database/entities/message.entity.d.ts +0 -1
- package/dist/database/entities/message.entity.js +0 -6
- package/dist/database/entities/message.entity.js.map +0 -1
- package/dist/database/entities/refresh-token.entity.d.ts +0 -1
- package/dist/database/entities/refresh-token.entity.js +0 -6
- package/dist/database/entities/refresh-token.entity.js.map +0 -1
- package/dist/database/entities/subscription.entity.d.ts +0 -1
- package/dist/database/entities/subscription.entity.js +0 -6
- package/dist/database/entities/subscription.entity.js.map +0 -1
- package/dist/database/entities/usage-record.entity.d.ts +0 -1
- package/dist/database/entities/usage-record.entity.js +0 -6
- package/dist/database/entities/usage-record.entity.js.map +0 -1
- package/dist/database/entities/user.entity.d.ts +0 -1
- package/dist/database/entities/user.entity.js +0 -6
- package/dist/database/entities/user.entity.js.map +0 -1
- package/dist/decorators/require-plan.decorator.d.ts +0 -2
- package/dist/decorators/require-plan.decorator.js +0 -8
- package/dist/decorators/require-plan.decorator.js.map +0 -1
- package/dist/guards/usage-limit.guard.d.ts +0 -11
- package/dist/guards/usage-limit.guard.js +0 -57
- package/dist/guards/usage-limit.guard.js.map +0 -1
- package/dist/modules/admin/admin-plans.controller.d.ts +0 -11
- package/dist/modules/admin/admin-plans.controller.js +0 -97
- package/dist/modules/admin/admin-plans.controller.js.map +0 -1
- package/dist/modules/admin/admin-tenant-agents.controller.d.ts +0 -61
- package/dist/modules/admin/admin-tenant-agents.controller.js +0 -424
- package/dist/modules/admin/admin-tenant-agents.controller.js.map +0 -1
- package/dist/modules/admin/admin-tenant-billing.controller.d.ts +0 -51
- package/dist/modules/admin/admin-tenant-billing.controller.js +0 -119
- package/dist/modules/admin/admin-tenant-billing.controller.js.map +0 -1
- package/dist/modules/admin/admin-tenants.controller.d.ts +0 -43
- package/dist/modules/admin/admin-tenants.controller.js +0 -178
- package/dist/modules/admin/admin-tenants.controller.js.map +0 -1
- package/dist/modules/admin/admin-users.controller.d.ts +0 -41
- package/dist/modules/admin/admin-users.controller.js +0 -121
- package/dist/modules/admin/admin-users.controller.js.map +0 -1
- package/dist/modules/admin/admin.module.d.ts +0 -2
- package/dist/modules/admin/admin.module.js +0 -26
- package/dist/modules/admin/admin.module.js.map +0 -1
- package/dist/modules/admin/platform-admin.guard.d.ts +0 -7
- package/dist/modules/admin/platform-admin.guard.js +0 -52
- package/dist/modules/admin/platform-admin.guard.js.map +0 -1
- package/dist/modules/auth/auth.controller.d.ts +0 -63
- package/dist/modules/auth/auth.controller.js +0 -255
- package/dist/modules/auth/auth.controller.js.map +0 -1
- package/dist/modules/auth/auth.module.d.ts +0 -4
- package/dist/modules/auth/auth.module.js +0 -71
- package/dist/modules/auth/auth.module.js.map +0 -1
- package/dist/modules/auth/auth.service.d.ts +0 -2
- package/dist/modules/auth/auth.service.js +0 -7
- package/dist/modules/auth/auth.service.js.map +0 -1
- package/dist/modules/auth/decorators/current-user.decorator.d.ts +0 -8
- package/dist/modules/auth/decorators/current-user.decorator.js +0 -12
- package/dist/modules/auth/decorators/current-user.decorator.js.map +0 -1
- package/dist/modules/auth/decorators/public.decorator.d.ts +0 -2
- package/dist/modules/auth/decorators/public.decorator.js +0 -8
- package/dist/modules/auth/decorators/public.decorator.js.map +0 -1
- package/dist/modules/auth/dto/login.dto.d.ts +0 -4
- package/dist/modules/auth/dto/login.dto.js +0 -29
- package/dist/modules/auth/dto/login.dto.js.map +0 -1
- package/dist/modules/auth/dto/register.dto.d.ts +0 -5
- package/dist/modules/auth/dto/register.dto.js +0 -36
- package/dist/modules/auth/dto/register.dto.js.map +0 -1
- package/dist/modules/auth/guards/jwt-auth.guard.d.ts +0 -9
- package/dist/modules/auth/guards/jwt-auth.guard.js +0 -37
- package/dist/modules/auth/guards/jwt-auth.guard.js.map +0 -1
- package/dist/modules/auth/guards/local-auth.guard.d.ts +0 -4
- package/dist/modules/auth/guards/local-auth.guard.js +0 -18
- package/dist/modules/auth/guards/local-auth.guard.js.map +0 -1
- package/dist/modules/auth/guards/oauth-configured.guard.d.ts +0 -11
- package/dist/modules/auth/guards/oauth-configured.guard.js +0 -51
- package/dist/modules/auth/guards/oauth-configured.guard.js.map +0 -1
- package/dist/modules/auth/oauth.controller.d.ts +0 -20
- package/dist/modules/auth/oauth.controller.js +0 -208
- package/dist/modules/auth/oauth.controller.js.map +0 -1
- package/dist/modules/auth/refresh-token.service.d.ts +0 -2
- package/dist/modules/auth/refresh-token.service.js +0 -7
- package/dist/modules/auth/refresh-token.service.js.map +0 -1
- package/dist/modules/auth/strategies/github.strategy.d.ts +0 -12
- package/dist/modules/auth/strategies/github.strategy.js +0 -57
- package/dist/modules/auth/strategies/github.strategy.js.map +0 -1
- package/dist/modules/auth/strategies/google.strategy.d.ts +0 -19
- package/dist/modules/auth/strategies/google.strategy.js +0 -56
- package/dist/modules/auth/strategies/google.strategy.js.map +0 -1
- package/dist/modules/auth/strategies/jwt.strategy.d.ts +0 -18
- package/dist/modules/auth/strategies/jwt.strategy.js +0 -49
- package/dist/modules/auth/strategies/jwt.strategy.js.map +0 -1
- package/dist/modules/auth/strategies/local.strategy.d.ts +0 -11
- package/dist/modules/auth/strategies/local.strategy.js +0 -31
- package/dist/modules/auth/strategies/local.strategy.js.map +0 -1
- package/dist/modules/billing/adapters/billing-adapter.interface.d.ts +0 -1
- package/dist/modules/billing/adapters/billing-adapter.interface.js +0 -6
- package/dist/modules/billing/adapters/billing-adapter.interface.js.map +0 -1
- package/dist/modules/billing/adapters/stripe/stripe.adapter.d.ts +0 -19
- package/dist/modules/billing/adapters/stripe/stripe.adapter.js +0 -118
- package/dist/modules/billing/adapters/stripe/stripe.adapter.js.map +0 -1
- package/dist/modules/billing/billing.controller.d.ts +0 -54
- package/dist/modules/billing/billing.controller.js +0 -180
- package/dist/modules/billing/billing.controller.js.map +0 -1
- package/dist/modules/billing/billing.module.d.ts +0 -2
- package/dist/modules/billing/billing.module.js +0 -57
- package/dist/modules/billing/billing.module.js.map +0 -1
- package/dist/modules/billing/billing.service.d.ts +0 -2
- package/dist/modules/billing/billing.service.js +0 -7
- package/dist/modules/billing/billing.service.js.map +0 -1
- package/dist/modules/billing/usage.service.d.ts +0 -2
- package/dist/modules/billing/usage.service.js +0 -6
- package/dist/modules/billing/usage.service.js.map +0 -1
- package/dist/modules/email/adapters/email-adapter.interface.d.ts +0 -1
- package/dist/modules/email/adapters/email-adapter.interface.js +0 -6
- package/dist/modules/email/adapters/email-adapter.interface.js.map +0 -1
- package/dist/modules/email/adapters/noop.adapter.d.ts +0 -1
- package/dist/modules/email/adapters/noop.adapter.js +0 -6
- package/dist/modules/email/adapters/noop.adapter.js.map +0 -1
- package/dist/modules/email/adapters/resend.adapter.d.ts +0 -1
- package/dist/modules/email/adapters/resend.adapter.js +0 -6
- package/dist/modules/email/adapters/resend.adapter.js.map +0 -1
- package/dist/modules/email/email.module.d.ts +0 -2
- package/dist/modules/email/email.module.js +0 -17
- package/dist/modules/email/email.module.js.map +0 -1
- package/dist/modules/email/email.service.d.ts +0 -1
- package/dist/modules/email/email.service.js +0 -6
- package/dist/modules/email/email.service.js.map +0 -1
- package/dist/modules/email/templates/transactional.template.d.ts +0 -18
- package/dist/modules/email/templates/transactional.template.js +0 -43
- package/dist/modules/email/templates/transactional.template.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentforge-io/nest",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.23",
|
|
4
4
|
"description": "NestJS bindings for AgentForge — `AgentForgeModule.forRoot/forRootAsync` plus controllers, guards and decorators. Wraps @agentforge-io/core.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"rxjs": "^7.0.0"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@agentforge-io/core": "^2.0
|
|
24
|
+
"@agentforge-io/core": "^2.1.0",
|
|
25
25
|
"@agentforge-io/typeorm": "^2.0.17",
|
|
26
26
|
"@anthropic-ai/sdk": "^0.32.0",
|
|
27
27
|
"@nestjs/bull": "^10.0.0",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { AuthIdentityEntity } from '@agentforge/typeorm';
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AuthIdentityEntity = void 0;
|
|
4
|
-
var typeorm_1 = require("@agentforge/typeorm");
|
|
5
|
-
Object.defineProperty(exports, "AuthIdentityEntity", { enumerable: true, get: function () { return typeorm_1.AuthIdentityEntity; } });
|
|
6
|
-
//# sourceMappingURL=auth-identity.entity.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth-identity.entity.js","sourceRoot":"","sources":["../../../src/database/entities/auth-identity.entity.ts"],"names":[],"mappings":";;;AAEA,+CAAyD;AAAhD,6GAAA,kBAAkB,OAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { ConversationEntity } from '@agentforge/typeorm';
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ConversationEntity = void 0;
|
|
4
|
-
var typeorm_1 = require("@agentforge/typeorm");
|
|
5
|
-
Object.defineProperty(exports, "ConversationEntity", { enumerable: true, get: function () { return typeorm_1.ConversationEntity; } });
|
|
6
|
-
//# sourceMappingURL=conversation.entity.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"conversation.entity.js","sourceRoot":"","sources":["../../../src/database/entities/conversation.entity.ts"],"names":[],"mappings":";;;AAEA,+CAAyD;AAAhD,6GAAA,kBAAkB,OAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { EmailTokenEntity } from '@agentforge/typeorm';
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EmailTokenEntity = void 0;
|
|
4
|
-
var typeorm_1 = require("@agentforge/typeorm");
|
|
5
|
-
Object.defineProperty(exports, "EmailTokenEntity", { enumerable: true, get: function () { return typeorm_1.EmailTokenEntity; } });
|
|
6
|
-
//# sourceMappingURL=email-token.entity.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"email-token.entity.js","sourceRoot":"","sources":["../../../src/database/entities/email-token.entity.ts"],"names":[],"mappings":";;;AAEA,+CAAuD;AAA9C,2GAAA,gBAAgB,OAAA"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export { UserEntity } from './user.entity';
|
|
2
|
-
export { ConversationEntity } from './conversation.entity';
|
|
3
|
-
export { MessageEntity } from './message.entity';
|
|
4
|
-
export { RefreshTokenEntity } from './refresh-token.entity';
|
|
5
|
-
export { AuthIdentityEntity } from './auth-identity.entity';
|
|
6
|
-
export { EmailTokenEntity } from './email-token.entity';
|
|
7
|
-
export type { EmailTokenPurpose } from '@agentforge/core';
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EmailTokenEntity = exports.AuthIdentityEntity = exports.RefreshTokenEntity = exports.MessageEntity = exports.ConversationEntity = exports.UserEntity = void 0;
|
|
4
|
-
var user_entity_1 = require("./user.entity");
|
|
5
|
-
Object.defineProperty(exports, "UserEntity", { enumerable: true, get: function () { return user_entity_1.UserEntity; } });
|
|
6
|
-
var conversation_entity_1 = require("./conversation.entity");
|
|
7
|
-
Object.defineProperty(exports, "ConversationEntity", { enumerable: true, get: function () { return conversation_entity_1.ConversationEntity; } });
|
|
8
|
-
var message_entity_1 = require("./message.entity");
|
|
9
|
-
Object.defineProperty(exports, "MessageEntity", { enumerable: true, get: function () { return message_entity_1.MessageEntity; } });
|
|
10
|
-
var refresh_token_entity_1 = require("./refresh-token.entity");
|
|
11
|
-
Object.defineProperty(exports, "RefreshTokenEntity", { enumerable: true, get: function () { return refresh_token_entity_1.RefreshTokenEntity; } });
|
|
12
|
-
var auth_identity_entity_1 = require("./auth-identity.entity");
|
|
13
|
-
Object.defineProperty(exports, "AuthIdentityEntity", { enumerable: true, get: function () { return auth_identity_entity_1.AuthIdentityEntity; } });
|
|
14
|
-
var email_token_entity_1 = require("./email-token.entity");
|
|
15
|
-
Object.defineProperty(exports, "EmailTokenEntity", { enumerable: true, get: function () { return email_token_entity_1.EmailTokenEntity; } });
|
|
16
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/database/entities/index.ts"],"names":[],"mappings":";;;AAAA,6CAA2C;AAAlC,yGAAA,UAAU,OAAA;AACnB,6DAA2D;AAAlD,yHAAA,kBAAkB,OAAA;AAC3B,mDAAiD;AAAxC,+GAAA,aAAa,OAAA;AACtB,+DAA4D;AAAnD,0HAAA,kBAAkB,OAAA;AAC3B,+DAA4D;AAAnD,0HAAA,kBAAkB,OAAA;AAC3B,2DAAwD;AAA/C,sHAAA,gBAAgB,OAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { MessageEntity } from '@agentforge/typeorm';
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MessageEntity = void 0;
|
|
4
|
-
var typeorm_1 = require("@agentforge/typeorm");
|
|
5
|
-
Object.defineProperty(exports, "MessageEntity", { enumerable: true, get: function () { return typeorm_1.MessageEntity; } });
|
|
6
|
-
//# sourceMappingURL=message.entity.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"message.entity.js","sourceRoot":"","sources":["../../../src/database/entities/message.entity.ts"],"names":[],"mappings":";;;AAEA,+CAAoD;AAA3C,wGAAA,aAAa,OAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { RefreshTokenEntity } from '@agentforge/typeorm';
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RefreshTokenEntity = void 0;
|
|
4
|
-
var typeorm_1 = require("@agentforge/typeorm");
|
|
5
|
-
Object.defineProperty(exports, "RefreshTokenEntity", { enumerable: true, get: function () { return typeorm_1.RefreshTokenEntity; } });
|
|
6
|
-
//# sourceMappingURL=refresh-token.entity.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"refresh-token.entity.js","sourceRoot":"","sources":["../../../src/database/entities/refresh-token.entity.ts"],"names":[],"mappings":";;;AAEA,+CAAyD;AAAhD,6GAAA,kBAAkB,OAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { SubscriptionEntity } from '@agentforge/typeorm';
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SubscriptionEntity = void 0;
|
|
4
|
-
var typeorm_1 = require("@agentforge/typeorm");
|
|
5
|
-
Object.defineProperty(exports, "SubscriptionEntity", { enumerable: true, get: function () { return typeorm_1.SubscriptionEntity; } });
|
|
6
|
-
//# sourceMappingURL=subscription.entity.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"subscription.entity.js","sourceRoot":"","sources":["../../../src/database/entities/subscription.entity.ts"],"names":[],"mappings":";;;AAEA,+CAAyD;AAAhD,6GAAA,kBAAkB,OAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { UsageRecordEntity } from '@agentforge/typeorm';
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UsageRecordEntity = void 0;
|
|
4
|
-
var typeorm_1 = require("@agentforge/typeorm");
|
|
5
|
-
Object.defineProperty(exports, "UsageRecordEntity", { enumerable: true, get: function () { return typeorm_1.UsageRecordEntity; } });
|
|
6
|
-
//# sourceMappingURL=usage-record.entity.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"usage-record.entity.js","sourceRoot":"","sources":["../../../src/database/entities/usage-record.entity.ts"],"names":[],"mappings":";;;AAEA,+CAAwD;AAA/C,4GAAA,iBAAiB,OAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { UserEntity } from '@agentforge/typeorm';
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UserEntity = void 0;
|
|
4
|
-
var typeorm_1 = require("@agentforge/typeorm");
|
|
5
|
-
Object.defineProperty(exports, "UserEntity", { enumerable: true, get: function () { return typeorm_1.UserEntity; } });
|
|
6
|
-
//# sourceMappingURL=user.entity.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"user.entity.js","sourceRoot":"","sources":["../../../src/database/entities/user.entity.ts"],"names":[],"mappings":";;;AAEA,+CAAiD;AAAxC,qGAAA,UAAU,OAAA"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RequirePlan = exports.REQUIRED_PLAN_KEY = void 0;
|
|
4
|
-
const common_1 = require("@nestjs/common");
|
|
5
|
-
exports.REQUIRED_PLAN_KEY = 'REQUIRED_PLAN';
|
|
6
|
-
const RequirePlan = (...planIds) => (0, common_1.SetMetadata)(exports.REQUIRED_PLAN_KEY, planIds);
|
|
7
|
-
exports.RequirePlan = RequirePlan;
|
|
8
|
-
//# sourceMappingURL=require-plan.decorator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"require-plan.decorator.js","sourceRoot":"","sources":["../../src/decorators/require-plan.decorator.ts"],"names":[],"mappings":";;;AAAA,2CAA6C;AAEhC,QAAA,iBAAiB,GAAG,eAAe,CAAC;AAY1C,MAAM,WAAW,GAAG,CAAC,GAAG,OAAiB,EAAE,EAAE,CAClD,IAAA,oBAAW,EAAC,yBAAiB,EAAE,OAAO,CAAC,CAAC;AAD7B,QAAA,WAAW,eACkB"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { CanActivate, ExecutionContext } from '@nestjs/common';
|
|
2
|
-
import { Reflector } from '@nestjs/core';
|
|
3
|
-
import { type UserRepository, UsageService } from '@agentforge/core';
|
|
4
|
-
export declare class UsageLimitGuard implements CanActivate {
|
|
5
|
-
private readonly reflector;
|
|
6
|
-
private readonly usageService;
|
|
7
|
-
private readonly users;
|
|
8
|
-
private readonly logger;
|
|
9
|
-
constructor(reflector: Reflector, usageService: UsageService, users: UserRepository);
|
|
10
|
-
canActivate(context: ExecutionContext): Promise<boolean>;
|
|
11
|
-
}
|
|
@@ -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 UsageLimitGuard_1;
|
|
15
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
exports.UsageLimitGuard = void 0;
|
|
17
|
-
const common_1 = require("@nestjs/common");
|
|
18
|
-
const core_1 = require("@nestjs/core");
|
|
19
|
-
const core_2 = require("@agentforge/core");
|
|
20
|
-
const require_plan_decorator_1 = require("../decorators/require-plan.decorator");
|
|
21
|
-
let UsageLimitGuard = UsageLimitGuard_1 = class UsageLimitGuard {
|
|
22
|
-
constructor(reflector, usageService, users) {
|
|
23
|
-
this.reflector = reflector;
|
|
24
|
-
this.usageService = usageService;
|
|
25
|
-
this.users = users;
|
|
26
|
-
this.logger = new common_1.Logger(UsageLimitGuard_1.name);
|
|
27
|
-
}
|
|
28
|
-
async canActivate(context) {
|
|
29
|
-
const request = context.switchToHttp().getRequest();
|
|
30
|
-
const userId = request.user?.userId;
|
|
31
|
-
if (!userId)
|
|
32
|
-
return true;
|
|
33
|
-
const requiredPlans = this.reflector.getAllAndOverride(require_plan_decorator_1.REQUIRED_PLAN_KEY, [
|
|
34
|
-
context.getHandler(),
|
|
35
|
-
context.getClass(),
|
|
36
|
-
]);
|
|
37
|
-
if (requiredPlans?.length) {
|
|
38
|
-
const user = await this.users.findById(userId);
|
|
39
|
-
if (!user || !requiredPlans.includes(user.currentPlanId)) {
|
|
40
|
-
throw new common_1.ForbiddenException(`This feature requires one of these plans: ${requiredPlans.join(', ')}`);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
const { allowed, reason } = await this.usageService.checkLimits(userId);
|
|
44
|
-
if (!allowed) {
|
|
45
|
-
throw new common_1.ForbiddenException(`Usage limit exceeded: ${reason}`);
|
|
46
|
-
}
|
|
47
|
-
return true;
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
exports.UsageLimitGuard = UsageLimitGuard;
|
|
51
|
-
exports.UsageLimitGuard = UsageLimitGuard = UsageLimitGuard_1 = __decorate([
|
|
52
|
-
(0, common_1.Injectable)(),
|
|
53
|
-
__param(2, (0, common_1.Inject)(core_2.USER_REPOSITORY)),
|
|
54
|
-
__metadata("design:paramtypes", [core_1.Reflector,
|
|
55
|
-
core_2.UsageService, Object])
|
|
56
|
-
], UsageLimitGuard);
|
|
57
|
-
//# sourceMappingURL=usage-limit.guard.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"usage-limit.guard.js","sourceRoot":"","sources":["../../src/guards/usage-limit.guard.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAOwB;AACxB,uCAAyC;AACzC,2CAAsF;AACtF,iFAAyE;AAalE,IAAM,eAAe,uBAArB,MAAM,eAAe;IAG1B,YACmB,SAAoB,EACpB,YAA0B,EAClB,KAAsC;QAF9C,cAAS,GAAT,SAAS,CAAW;QACpB,iBAAY,GAAZ,YAAY,CAAc;QACD,UAAK,GAAL,KAAK,CAAgB;QALhD,WAAM,GAAG,IAAI,eAAM,CAAC,iBAAe,CAAC,IAAI,CAAC,CAAC;IAMxD,CAAC;IAEJ,KAAK,CAAC,WAAW,CAAC,O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class AdminPlansController {
|
|
4
|
-
private readonly plans;
|
|
5
|
-
constructor(plans: PlanService);
|
|
6
|
-
listAll(): Promise<import("@agentforge/core").Plan[]>;
|
|
7
|
-
get(planId: string): Promise<import("@agentforge/core").Plan>;
|
|
8
|
-
create(body: NewPlan): Promise<import("@agentforge/core").Plan>;
|
|
9
|
-
update(planId: string, patch: PlanPatch): Promise<import("@agentforge/core").Plan>;
|
|
10
|
-
deactivate(planId: string): Promise<void>;
|
|
11
|
-
}
|
|
@@ -1,97 +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.AdminPlansController = 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 AdminPlansController = class AdminPlansController {
|
|
21
|
-
constructor(plans) {
|
|
22
|
-
this.plans = plans;
|
|
23
|
-
}
|
|
24
|
-
listAll() {
|
|
25
|
-
return this.plans.listAll();
|
|
26
|
-
}
|
|
27
|
-
async get(planId) {
|
|
28
|
-
const plan = await this.plans.getPlan(planId);
|
|
29
|
-
if (!plan)
|
|
30
|
-
throw new common_1.NotFoundException(`Plan "${planId}" not found`);
|
|
31
|
-
return plan;
|
|
32
|
-
}
|
|
33
|
-
async create(body) {
|
|
34
|
-
if (!body?.id || !body?.name || !body?.limits) {
|
|
35
|
-
throw new common_1.BadRequestException('id, name, limits are required');
|
|
36
|
-
}
|
|
37
|
-
return this.plans.create(body);
|
|
38
|
-
}
|
|
39
|
-
async update(planId, patch) {
|
|
40
|
-
return this.plans.update(planId, patch ?? {});
|
|
41
|
-
}
|
|
42
|
-
async deactivate(planId) {
|
|
43
|
-
await this.plans.deactivate(planId);
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
exports.AdminPlansController = AdminPlansController;
|
|
47
|
-
__decorate([
|
|
48
|
-
(0, common_1.Get)(),
|
|
49
|
-
(0, swagger_1.ApiOperation)({ summary: 'List every plan, including inactive ones' }),
|
|
50
|
-
__metadata("design:type", Function),
|
|
51
|
-
__metadata("design:paramtypes", []),
|
|
52
|
-
__metadata("design:returntype", void 0)
|
|
53
|
-
], AdminPlansController.prototype, "listAll", null);
|
|
54
|
-
__decorate([
|
|
55
|
-
(0, common_1.Get)(':planId'),
|
|
56
|
-
(0, swagger_1.ApiOperation)({ summary: 'Get a single plan by id' }),
|
|
57
|
-
__param(0, (0, common_1.Param)('planId')),
|
|
58
|
-
__metadata("design:type", Function),
|
|
59
|
-
__metadata("design:paramtypes", [String]),
|
|
60
|
-
__metadata("design:returntype", Promise)
|
|
61
|
-
], AdminPlansController.prototype, "get", null);
|
|
62
|
-
__decorate([
|
|
63
|
-
(0, common_1.Post)(),
|
|
64
|
-
(0, swagger_1.ApiOperation)({ summary: 'Create a plan' }),
|
|
65
|
-
(0, common_1.HttpCode)(common_1.HttpStatus.CREATED),
|
|
66
|
-
__param(0, (0, common_1.Body)()),
|
|
67
|
-
__metadata("design:type", Function),
|
|
68
|
-
__metadata("design:paramtypes", [Object]),
|
|
69
|
-
__metadata("design:returntype", Promise)
|
|
70
|
-
], AdminPlansController.prototype, "create", null);
|
|
71
|
-
__decorate([
|
|
72
|
-
(0, common_1.Patch)(':planId'),
|
|
73
|
-
(0, swagger_1.ApiOperation)({ summary: 'Update a plan (partial — only changed fields)' }),
|
|
74
|
-
__param(0, (0, common_1.Param)('planId')),
|
|
75
|
-
__param(1, (0, common_1.Body)()),
|
|
76
|
-
__metadata("design:type", Function),
|
|
77
|
-
__metadata("design:paramtypes", [String, Object]),
|
|
78
|
-
__metadata("design:returntype", Promise)
|
|
79
|
-
], AdminPlansController.prototype, "update", null);
|
|
80
|
-
__decorate([
|
|
81
|
-
(0, common_1.Delete)(':planId'),
|
|
82
|
-
(0, swagger_1.ApiOperation)({
|
|
83
|
-
summary: 'Soft-delete a plan (sets isActive=false). Hard delete is not exposed — existing subscriptions still reference plans by id.',
|
|
84
|
-
}),
|
|
85
|
-
(0, common_1.HttpCode)(common_1.HttpStatus.NO_CONTENT),
|
|
86
|
-
__param(0, (0, common_1.Param)('planId')),
|
|
87
|
-
__metadata("design:type", Function),
|
|
88
|
-
__metadata("design:paramtypes", [String]),
|
|
89
|
-
__metadata("design:returntype", Promise)
|
|
90
|
-
], AdminPlansController.prototype, "deactivate", null);
|
|
91
|
-
exports.AdminPlansController = AdminPlansController = __decorate([
|
|
92
|
-
(0, swagger_1.ApiTags)('Admin: Plans'),
|
|
93
|
-
(0, common_1.Controller)('admin/plans'),
|
|
94
|
-
(0, common_1.UseGuards)(platform_admin_guard_1.PlatformAdminGuard),
|
|
95
|
-
__metadata("design:paramtypes", [core_1.PlanService])
|
|
96
|
-
], AdminPlansController);
|
|
97
|
-
//# sourceMappingURL=admin-plans.controller.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"admin-plans.controller.js","sourceR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,EAAE,0CAA0C,EAAE,CAAC;;;;mDAGrE;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;;;;+CAIzB;AAKK;IAHL,IAAA,aAAI,GAAE;IACN,IAAA,sBAAY,EAAC,EAAE,OAAO,EAAE,eAAe,EAAE,CAAC;IAC1C,IAAA,iBAAQ,EAAC,mBAAU,CAAC,OAAO,CAAC;IACf,WAAA,IAAA,aAAI,GAAE,CAAA;;;;kDAKnB;AAIK;IAFL,IAAA,cAAK,EAAC,SAAS,CAAC;IAChB,IAAA,sBAAY,EAAC,EAAE,OAAO,EAAE,+CAA+C,EAAE,CAAC;IAC7D,WAAA,IAAA,cAAK,EAAC,QAAQ,CAAC,CAAA;IAAkB,WAAA,IAAA,aAAI,GAAE,CAAA;;;;kDAEpD;AAQK;IANL,IAAA,eAAM,EAAC,SAAS,CAAC;IACjB,IAAA,sBAAY,EAAC;QACZ,OAAO,EACL,4HAA4H;KAC/H,CAAC;IACD,IAAA,iBAAQ,EAAC,mBAAU,CAAC,UAAU,CAAC;IACd,WAAA,IAAA,cAAK,EAAC,QAAQ,CAAC,CAAA;;;;sDAEhC;+BAzCU,oBAAoB;IAHhC,IAAA,iBAAO,EAAC,cAAc,CAAC;IACvB,IAAA,mBAAU,EAAC,aAAa,CAAC;IACzB,IAAA,kBAAS,EAAC,yCAAkB,CAAC;qCAEQ,kBAAW;GADpC,oBAAoB,CA0ChC"}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { AgentConfigService, ApiKeyService, ChatTokenService, TenantService, UploadService } from '@agentforge/core';
|
|
2
|
-
import { type AuthUser } from '../auth/decorators/current-user.decorator';
|
|
3
|
-
export declare class AdminTenantAgentsController {
|
|
4
|
-
private readonly tenants?;
|
|
5
|
-
private readonly agentConfigs?;
|
|
6
|
-
private readonly chatTokens?;
|
|
7
|
-
private readonly apiKeys?;
|
|
8
|
-
private readonly uploads?;
|
|
9
|
-
constructor(tenants?: TenantService | undefined, agentConfigs?: AgentConfigService | undefined, chatTokens?: ChatTokenService | undefined, apiKeys?: ApiKeyService | undefined, uploads?: UploadService | undefined);
|
|
10
|
-
list(tenantId: string, user: AuthUser, q?: string, status?: string, limit?: string, offset?: string): Promise<{
|
|
11
|
-
items: import("@agentforge/core").AgentRecord[];
|
|
12
|
-
total: number;
|
|
13
|
-
limit: number | null;
|
|
14
|
-
offset: number;
|
|
15
|
-
}>;
|
|
16
|
-
create(tenantId: string, body: Record<string, unknown>, user: AuthUser): Promise<import("@agentforge/core").AgentRecord>;
|
|
17
|
-
getOne(tenantId: string, agentId: string, user: AuthUser): Promise<import("@agentforge/core").AgentRecord>;
|
|
18
|
-
update(tenantId: string, agentId: string, body: Record<string, unknown>, user: AuthUser): Promise<import("@agentforge/core").AgentRecord>;
|
|
19
|
-
deactivate(tenantId: string, agentId: string, user: AuthUser): Promise<void>;
|
|
20
|
-
signAvatar(tenantId: string, agentId: string, body: {
|
|
21
|
-
contentType?: string;
|
|
22
|
-
contentLength?: number;
|
|
23
|
-
}, user: AuthUser): Promise<import("@agentforge/core").SignedUploadTarget>;
|
|
24
|
-
listChatTokens(tenantId: string, agentId: string, user: AuthUser): Promise<{
|
|
25
|
-
items: import("@agentforge/core").ChatToken[];
|
|
26
|
-
}>;
|
|
27
|
-
createChatToken(tenantId: string, agentId: string, body: {
|
|
28
|
-
name?: string;
|
|
29
|
-
allowedOrigins?: string[];
|
|
30
|
-
}, user: AuthUser): Promise<import("@agentforge/core").ChatToken>;
|
|
31
|
-
updateChatToken(tenantId: string, agentId: string, token: string, body: Record<string, unknown>, user: AuthUser): Promise<void>;
|
|
32
|
-
deactivateChatToken(tenantId: string, agentId: string, token: string, user: AuthUser): Promise<void>;
|
|
33
|
-
listAgentApiKeys(tenantId: string, agentId: string, user: AuthUser): Promise<{
|
|
34
|
-
id: string;
|
|
35
|
-
name: string;
|
|
36
|
-
keyPrefix: string;
|
|
37
|
-
agentId: string | undefined;
|
|
38
|
-
scopes: string[] | undefined;
|
|
39
|
-
createdAt: Date;
|
|
40
|
-
lastUsedAt: Date | undefined;
|
|
41
|
-
expiresAt: Date | undefined;
|
|
42
|
-
revokedAt: Date | undefined;
|
|
43
|
-
}[]>;
|
|
44
|
-
issueAgentApiKey(tenantId: string, agentId: string, body: {
|
|
45
|
-
name?: string;
|
|
46
|
-
scopes?: string[];
|
|
47
|
-
expiresAt?: string;
|
|
48
|
-
}, user: AuthUser): Promise<{
|
|
49
|
-
key: string;
|
|
50
|
-
id: string;
|
|
51
|
-
name: string;
|
|
52
|
-
keyPrefix: string;
|
|
53
|
-
agentId: string | undefined;
|
|
54
|
-
scopes: string[] | undefined;
|
|
55
|
-
expiresAt: Date | undefined;
|
|
56
|
-
createdAt: Date;
|
|
57
|
-
}>;
|
|
58
|
-
revokeAgentApiKey(tenantId: string, agentId: string, keyId: string, user: AuthUser): Promise<void>;
|
|
59
|
-
private ensureB2B;
|
|
60
|
-
private ensureB2BWithApiKeys;
|
|
61
|
-
}
|