@solidstarters/solid-core 1.2.187 → 1.2.188
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/config/iam.config.d.ts +0 -13
- package/dist/config/iam.config.d.ts.map +1 -1
- package/dist/config/iam.config.js +2 -12
- package/dist/config/iam.config.js.map +1 -1
- package/dist/config/jwt.config.d.ts +14 -0
- package/dist/config/jwt.config.d.ts.map +1 -0
- package/dist/config/jwt.config.js +15 -0
- package/dist/config/jwt.config.js.map +1 -0
- package/dist/decorators/active-user.decorator.d.ts +1 -1
- package/dist/guards/access-token.guard.d.ts +1 -1
- package/dist/guards/access-token.guard.d.ts.map +1 -1
- package/dist/guards/access-token.guard.js +2 -2
- package/dist/guards/access-token.guard.js.map +1 -1
- package/dist/interfaces.d.ts +16 -1
- package/dist/interfaces.d.ts.map +1 -1
- package/dist/interfaces.js.map +1 -1
- package/dist/jobs/database/trigger-mcp-client-subscriber-database.service.d.ts.map +1 -1
- package/dist/jobs/database/trigger-mcp-client-subscriber-database.service.js +7 -0
- package/dist/jobs/database/trigger-mcp-client-subscriber-database.service.js.map +1 -1
- package/dist/services/authentication.service.d.ts +8 -7
- package/dist/services/authentication.service.d.ts.map +1 -1
- package/dist/services/authentication.service.js +12 -11
- package/dist/services/authentication.service.js.map +1 -1
- package/dist/services/crud.service.d.ts +1 -0
- package/dist/services/crud.service.d.ts.map +1 -1
- package/dist/services/crud.service.js +14 -12
- package/dist/services/crud.service.js.map +1 -1
- package/dist/services/dashboard-question.service.d.ts.map +1 -1
- package/dist/services/dashboard-question.service.js +23 -2
- package/dist/services/dashboard-question.service.js.map +1 -1
- package/dist/services/genai/mcp-handlers/solid-add-button-to-form-view-mcp-handler.service.d.ts +16 -0
- package/dist/services/genai/mcp-handlers/solid-add-button-to-form-view-mcp-handler.service.d.ts.map +1 -0
- package/dist/services/genai/mcp-handlers/solid-add-button-to-form-view-mcp-handler.service.js +151 -0
- package/dist/services/genai/mcp-handlers/solid-add-button-to-form-view-mcp-handler.service.js.map +1 -0
- package/dist/services/genai/mcp-handlers/solid-add-controller-handler-method-mcp-handler.service.d.ts +1 -0
- package/dist/services/genai/mcp-handlers/solid-add-controller-handler-method-mcp-handler.service.d.ts.map +1 -1
- package/dist/services/genai/mcp-handlers/solid-add-controller-handler-method-mcp-handler.service.js +8 -1
- package/dist/services/genai/mcp-handlers/solid-add-controller-handler-method-mcp-handler.service.js.map +1 -1
- package/dist/services/genai/mcp-handlers/solid-create-custom-form-view-widget-mcp-handler.service.d.ts +14 -0
- package/dist/services/genai/mcp-handlers/solid-create-custom-form-view-widget-mcp-handler.service.d.ts.map +1 -0
- package/dist/services/genai/mcp-handlers/solid-create-custom-form-view-widget-mcp-handler.service.js +73 -0
- package/dist/services/genai/mcp-handlers/solid-create-custom-form-view-widget-mcp-handler.service.js.map +1 -0
- package/dist/services/setting.service.d.ts.map +1 -1
- package/dist/services/setting.service.js +3 -2
- package/dist/services/setting.service.js.map +1 -1
- package/dist/solid-core.module.d.ts.map +1 -1
- package/dist/solid-core.module.js +7 -2
- package/dist/solid-core.module.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/config/iam.config.ts +1 -11
- package/src/config/jwt.config.ts +13 -0
- package/src/guards/access-token.guard.ts +1 -1
- package/src/interfaces.ts +17 -1
- package/src/jobs/database/trigger-mcp-client-subscriber-database.service.ts +18 -0
- package/src/services/authentication.service.ts +17 -17
- package/src/services/crud.service.ts +17 -31
- package/src/services/dashboard-question.service.ts +29 -2
- package/src/services/genai/mcp-handlers/solid-add-button-to-form-view-mcp-handler.service.ts +137 -0
- package/src/services/genai/mcp-handlers/solid-add-controller-handler-method-mcp-handler.service.ts +21 -7
- package/src/services/genai/mcp-handlers/solid-create-custom-form-view-widget-mcp-handler.service.ts +72 -0
- package/src/services/setting.service.ts +3 -2
- package/src/solid-core.module.ts +7 -1
|
@@ -47,17 +47,4 @@ export declare const iamConfig: (() => {
|
|
|
47
47
|
passwordPepper: string;
|
|
48
48
|
showNameFieldsForRegistration: boolean;
|
|
49
49
|
}>;
|
|
50
|
-
export declare const jwtConfig: (() => {
|
|
51
|
-
secret: string;
|
|
52
|
-
audience: string;
|
|
53
|
-
issuer: string;
|
|
54
|
-
accessTokenTtl: number;
|
|
55
|
-
refreshTokenTtl: number;
|
|
56
|
-
}) & import("@nestjs/config").ConfigFactoryKeyHost<{
|
|
57
|
-
secret: string;
|
|
58
|
-
audience: string;
|
|
59
|
-
issuer: string;
|
|
60
|
-
accessTokenTtl: number;
|
|
61
|
-
refreshTokenTtl: number;
|
|
62
|
-
}>;
|
|
63
50
|
//# sourceMappingURL=iam.config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"iam.config.d.ts","sourceRoot":"","sources":["../../src/config/iam.config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"iam.config.d.ts","sourceRoot":"","sources":["../../src/config/iam.config.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0BpB,CAAA"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.iamConfig = void 0;
|
|
4
4
|
const config_1 = require("@nestjs/config");
|
|
5
|
-
const src_1 = require("..");
|
|
6
5
|
exports.iamConfig = (0, config_1.registerAs)('iam', () => {
|
|
7
6
|
return {
|
|
8
7
|
passwordlessRegistration: (process.env.IAM_PASSWORD_LESS_REGISTRATION ?? 'false') === 'true',
|
|
@@ -16,7 +15,7 @@ exports.iamConfig = (0, config_1.registerAs)('iam', () => {
|
|
|
16
15
|
defaultRole: process.env.IAM_DEFAULT_ROLE ?? 'Public',
|
|
17
16
|
dummyOtp: process.env.IAM_OTP_DUMMY,
|
|
18
17
|
forgotPasswordSendVerificationTokenOn: process.env.IAM_FORGOT_PASSWORD_SEND_VERIFICATION_TOKEN_ON ?? 'email',
|
|
19
|
-
forceChangePasswordOnFirstLogin:
|
|
18
|
+
forceChangePasswordOnFirstLogin: false,
|
|
20
19
|
PASSWORD_REGEX: process.env.PASSWORD_REGEX || '^$|^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[^\\da-zA-Z]).*$',
|
|
21
20
|
PASSWORD_COMPLEXITY_DESC: process.env.PASSWORD_COMPLEXITY_DESC || 'Password must contain at least one uppercase, one lowercase, one number, and one special character.',
|
|
22
21
|
googleOauth: {
|
|
@@ -30,13 +29,4 @@ exports.iamConfig = (0, config_1.registerAs)('iam', () => {
|
|
|
30
29
|
showNameFieldsForRegistration: process.env.IAM_SHOW_NAME_FIELDS_FOR_REGISTRATION === 'true' ? true : false,
|
|
31
30
|
};
|
|
32
31
|
});
|
|
33
|
-
exports.jwtConfig = (0, config_1.registerAs)('jwt', () => {
|
|
34
|
-
return {
|
|
35
|
-
secret: process.env.IAM_JWT_SECRET,
|
|
36
|
-
audience: process.env.IAM_JWT_TOKEN_AUDIENCE,
|
|
37
|
-
issuer: process.env.IAM_JWT_TOKEN_ISSUER,
|
|
38
|
-
accessTokenTtl: parseInt((process.env.IAM_JWT_ACCESS_TOKEN_TTL ?? process.env.ENV === src_1.Environment.Production) ? '1200' : '86400', 10),
|
|
39
|
-
refreshTokenTtl: parseInt(process.env.IAM_JWT_REFRESH_TOKEN_TTL ?? '604800', 10),
|
|
40
|
-
};
|
|
41
|
-
});
|
|
42
32
|
//# sourceMappingURL=iam.config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"iam.config.js","sourceRoot":"","sources":["../../src/config/iam.config.ts"],"names":[],"mappings":";;;AAAA,2CAA4C;
|
|
1
|
+
{"version":3,"file":"iam.config.js","sourceRoot":"","sources":["../../src/config/iam.config.ts"],"names":[],"mappings":";;;AAAA,2CAA4C;AAE/B,QAAA,SAAS,GAAG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AAC,GAAG,CAAC,0BAA0B;YAChD,YAAY,EAAE,OAAO,CAAC,GAAG,CAAC,8BAA8B;YACxD,WAAW,EAAE,OAAO,CAAC,GAAG,CAAC,6BAA6B;YACtD,WAAW,EAAE,OAAO,CAAC,GAAG,CAAC,6BAA6B;SACzD;QACD,wBAAwB,EAAC,OAAO,CAAC,GAAG,CAAC,0BAA0B,IAAI,IAAI;QACvE,cAAc,EAAE,OAAO,CAAC,GAAG,CAAC,mBAAmB,IAAI,EAAE;QACrD,6BAA6B,EAAC,OAAO,CAAC,GAAG,CAAC,qCAAqC,KAAK,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK;KAC5G,CAAC;AACN,CAAC,CAAC,CAAA","sourcesContent":["import { registerAs } from '@nestjs/config';\n\nexport const iamConfig = registerAs('iam', () => {\n return {\n passwordlessRegistration: (process.env.IAM_PASSWORD_LESS_REGISTRATION ?? 'false') === 'true',\n iamPasswordRegistrationEnabled: (process.env.IAM_PASSWORD_REGISTRATION_ENABLED ?? 'true') === 'true',\n passwordlessRegistrationValidateWhat: (process.env.IAM_PASSWORD_LESS_REGISTRATION_VALIDATE_WHAT ?? 'email').split(',').map((item) => item.trim()),\n allowPublicRegistration: (process.env.IAM_ALLOW_PUBLIC_REGISTRATION ?? 'true') === 'true',\n activateUserOnRegistration: (process.env.IAM_ACTIVATE_USER_ON_REGISTRATION ?? 'true') === 'true',\n autoLoginUserOnRegistration: (process.env.IAM_AUTO_LOGIN_USER_ON_REGISTRATION ?? 'false') === 'true',\n otpExpiry: parseInt(process.env.IAM_OTP_EXPIRY ?? '10'),\n forgotPasswordVerificationTokenExpiry: parseInt(process.env.IAM_FORGOT_PASSWORD_VERIFICATION_TOKEN_EXPIRY ?? '10'),\n defaultRole: process.env.IAM_DEFAULT_ROLE ?? 'Public',\n dummyOtp: process.env.IAM_OTP_DUMMY,\n forgotPasswordSendVerificationTokenOn: process.env.IAM_FORGOT_PASSWORD_SEND_VERIFICATION_TOKEN_ON ?? 'email',\n forceChangePasswordOnFirstLogin:false,\n PASSWORD_REGEX: process.env.PASSWORD_REGEX || '^$|^(?=.*[a-z])(?=.*[A-Z])(?=.*\\\\d)(?=.*[^\\\\da-zA-Z]).*$',\n PASSWORD_COMPLEXITY_DESC : process.env.PASSWORD_COMPLEXITY_DESC || 'Password must contain at least one uppercase, one lowercase, one number, and one special character.',\n googleOauth: {\n clientID: process.env.IAM_GOOGLE_OAUTH_CLIENT_ID,\n clientSecret: process.env.IAM_GOOGLE_OAUTH_CLIENT_SECRET,\n callbackURL: process.env.IAM_GOOGLE_OAUTH_CALLBACK_URL,\n redirectURL: process.env.IAM_GOOGLE_OAUTH_REDIRECT_URL,\n },\n iamAutoGeneratedPassword:process.env.IAM_AUTOGENERATED_PASSWORD || true,\n passwordPepper: process.env.IAM_PASSWORD_PEPPER || '', // Adding a pepper to the password hashing process for extra security,\n showNameFieldsForRegistration:process.env.IAM_SHOW_NAME_FIELDS_FOR_REGISTRATION === 'true' ? true : false,\n };\n})\n\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const jwtConfig: (() => {
|
|
2
|
+
secret: string;
|
|
3
|
+
audience: string;
|
|
4
|
+
issuer: string;
|
|
5
|
+
accessTokenTtl: number;
|
|
6
|
+
refreshTokenTtl: number;
|
|
7
|
+
}) & import("@nestjs/config").ConfigFactoryKeyHost<{
|
|
8
|
+
secret: string;
|
|
9
|
+
audience: string;
|
|
10
|
+
issuer: string;
|
|
11
|
+
accessTokenTtl: number;
|
|
12
|
+
refreshTokenTtl: number;
|
|
13
|
+
}>;
|
|
14
|
+
//# sourceMappingURL=jwt.config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jwt.config.d.ts","sourceRoot":"","sources":["../../src/config/jwt.config.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,SAAS;;;;;;;;;;;;EAQpB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.jwtConfig = void 0;
|
|
4
|
+
const config_1 = require("@nestjs/config");
|
|
5
|
+
const disallow_in_production_decorator_1 = require("../decorators/disallow-in-production.decorator");
|
|
6
|
+
exports.jwtConfig = (0, config_1.registerAs)('jwt', () => {
|
|
7
|
+
return {
|
|
8
|
+
secret: process.env.IAM_JWT_SECRET,
|
|
9
|
+
audience: process.env.IAM_JWT_TOKEN_AUDIENCE,
|
|
10
|
+
issuer: process.env.IAM_JWT_TOKEN_ISSUER,
|
|
11
|
+
accessTokenTtl: parseInt((process.env.IAM_JWT_ACCESS_TOKEN_TTL ?? process.env.ENV === disallow_in_production_decorator_1.Environment.Production) ? '1200' : '86400', 10),
|
|
12
|
+
refreshTokenTtl: parseInt(process.env.IAM_JWT_REFRESH_TOKEN_TTL ?? '604800', 10),
|
|
13
|
+
};
|
|
14
|
+
});
|
|
15
|
+
//# sourceMappingURL=jwt.config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jwt.config.js","sourceRoot":"","sources":["../../src/config/jwt.config.ts"],"names":[],"mappings":";;;AAAA,2CAA4C;AAC5C,qGAA8E;AAGjE,QAAA,SAAS,GAAG,IAAA,mBAAU,EAAC,KAAK,EAAE,GAAG,EAAE;IAC5C,OAAO;QACH,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,cAAc;QAClC,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,sBAAsB;QAC5C,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,oBAAoB;QACxC,cAAc,EAAE,QAAQ,CAAC,CAAA,OAAO,CAAC,GAAG,CAAC,wBAAwB,IAAK,OAAO,CAAC,GAAG,CAAC,GAAmB,KAAK,8CAAW,CAAC,UAAU,EAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC;QACpJ,eAAe,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,yBAAyB,IAAI,QAAQ,EAAE,EAAE,CAAC;KACnF,CAAC;AACN,CAAC,CAAC,CAAC","sourcesContent":["import { registerAs } from '@nestjs/config';\nimport { Environment } from 'src/decorators/disallow-in-production.decorator';\n\n\nexport const jwtConfig = registerAs('jwt', () => {\n return {\n secret: process.env.IAM_JWT_SECRET,\n audience: process.env.IAM_JWT_TOKEN_AUDIENCE,\n issuer: process.env.IAM_JWT_TOKEN_ISSUER,\n accessTokenTtl: parseInt(process.env.IAM_JWT_ACCESS_TOKEN_TTL ?? (process.env.ENV as Environment) === Environment.Production ? '1200' : '86400', 10), // 20 minutes in prod, 1 day otherwise\n refreshTokenTtl: parseInt(process.env.IAM_JWT_REFRESH_TOKEN_TTL ?? '604800', 10), // 7 days\n };\n});\n"]}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ActiveUserData } from '../interfaces/active-user-data.interface';
|
|
2
|
-
export declare const ActiveUser: (...dataOrPipes: (
|
|
2
|
+
export declare const ActiveUser: (...dataOrPipes: (import("@nestjs/common").PipeTransform<any, any> | import("@nestjs/common").Type<import("@nestjs/common").PipeTransform<any, any>> | keyof ActiveUserData)[]) => ParameterDecorator;
|
|
3
3
|
//# sourceMappingURL=active-user.decorator.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CanActivate, ExecutionContext } from '@nestjs/common';
|
|
2
2
|
import { ConfigType } from '@nestjs/config';
|
|
3
3
|
import { JwtService } from '@nestjs/jwt';
|
|
4
|
-
import { jwtConfig } from '
|
|
4
|
+
import { jwtConfig } from 'src/config/jwt.config';
|
|
5
5
|
import { PermissionMetadataService } from '../services/permission-metadata.service';
|
|
6
6
|
import { ClsService } from 'nestjs-cls';
|
|
7
7
|
export declare class AccessTokenGuard implements CanActivate {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"access-token.guard.d.ts","sourceRoot":"","sources":["../../src/guards/access-token.guard.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,gBAAgB,EAIjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzC,OAAO,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"access-token.guard.d.ts","sourceRoot":"","sources":["../../src/guards/access-token.guard.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,gBAAgB,EAIjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzC,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElD,OAAO,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAC;AACpF,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,qBACa,gBAAiB,YAAW,WAAW;IAEhD,OAAO,CAAC,QAAQ,CAAC,UAAU;IAE3B,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IACjC,OAAO,CAAC,QAAQ,CAAC,kBAAkB;IACnC,OAAO,CAAC,QAAQ,CAAC,GAAG;gBAJH,UAAU,EAAE,UAAU,EAEtB,gBAAgB,EAAE,UAAU,CAAC,OAAO,SAAS,CAAC,EAC9C,kBAAkB,EAAE,yBAAyB,EAC7C,GAAG,EAAE,UAAU;IAG5B,WAAW,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,OAAO,CAAC;IA2B9D,OAAO,CAAC,sBAAsB;CAM/B"}
|
|
@@ -15,7 +15,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
15
15
|
exports.AccessTokenGuard = void 0;
|
|
16
16
|
const common_1 = require("@nestjs/common");
|
|
17
17
|
const jwt_1 = require("@nestjs/jwt");
|
|
18
|
-
const
|
|
18
|
+
const jwt_config_1 = require("../config/jwt.config");
|
|
19
19
|
const constants_1 = require("../constants");
|
|
20
20
|
const permission_metadata_service_1 = require("../services/permission-metadata.service");
|
|
21
21
|
const nestjs_cls_1 = require("nestjs-cls");
|
|
@@ -52,7 +52,7 @@ let AccessTokenGuard = class AccessTokenGuard {
|
|
|
52
52
|
exports.AccessTokenGuard = AccessTokenGuard;
|
|
53
53
|
exports.AccessTokenGuard = AccessTokenGuard = __decorate([
|
|
54
54
|
(0, common_1.Injectable)(),
|
|
55
|
-
__param(1, (0, common_1.Inject)(
|
|
55
|
+
__param(1, (0, common_1.Inject)(jwt_config_1.jwtConfig.KEY)),
|
|
56
56
|
__metadata("design:paramtypes", [jwt_1.JwtService, void 0, permission_metadata_service_1.PermissionMetadataService,
|
|
57
57
|
nestjs_cls_1.ClsService])
|
|
58
58
|
], AccessTokenGuard);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"access-token.guard.js","sourceRoot":"","sources":["../../src/guards/access-token.guard.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAMwB;AAExB,qCAAyC;AAGzC,
|
|
1
|
+
{"version":3,"file":"access-token.guard.js","sourceRoot":"","sources":["../../src/guards/access-token.guard.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAMwB;AAExB,qCAAyC;AAGzC,qDAAkD;AAClD,4CAAgD;AAChD,yFAAoF;AACpF,2CAAwC;AAGjC,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAC3B,YACmB,UAAsB,EAEtB,gBAA8C,EAC9C,kBAA6C,EAC7C,GAAe;QAJf,eAAU,GAAV,UAAU,CAAY;QAEtB,qBAAgB,GAAhB,gBAAgB,CAA8B;QAC9C,uBAAkB,GAAlB,kBAAkB,CAA2B;QAC7C,QAAG,GAAH,GAAG,CAAY;IAC9B,CAAC;IAEL,KAAK,CAAC,WAAW,CAAC,OAAyB;QAEzC,MAAM,OAAO,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,UAAU,EAAE,CAAC;QACpD,MAAM,KAAK,GAAG,IAAI,CAAC,sBAAsB,CAAC,OAAO,CAAC,CAAC;QACnD,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,MAAM,IAAI,8BAAqB,EAAE,CAAC;QACpC,CAAC;QACD,IAAI,CAAC;YACH,MAAM,OAAO,GAAmB,MAAM,IAAI,CAAC,UAAU,CAAC,WAAW,CAC/D,KAAK,EACL,IAAI,CAAC,gBAAgB,CACtB,CAAC;YAGF,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,iBAAiB,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YACnF,OAAO,CAAC,WAAW,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;YAEvE,OAAO,CAAC,4BAAgB,CAAC,GAAG,OAAO,CAAC;YACpC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,4BAAgB,EAAE,OAAO,CAAC,CAAC;QAG1C,CAAC;QAAC,MAAM,CAAC;YACP,MAAM,IAAI,8BAAqB,EAAE,CAAC;QACpC,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAEO,sBAAsB,CAAC,OAAgB;QAG7C,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,aAAa,EAAE,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;QACnE,OAAO,KAAK,CAAC;IACf,CAAC;CACF,CAAA;AA1CY,4CAAgB;2BAAhB,gBAAgB;IAD5B,IAAA,mBAAU,GAAE;IAIR,WAAA,IAAA,eAAM,EAAC,sBAAS,CAAC,GAAG,CAAC,CAAA;qCADO,gBAAU,UAGF,uDAAyB;QACxC,uBAAU;GANvB,gBAAgB,CA0C5B","sourcesContent":["import {\n CanActivate,\n ExecutionContext,\n Inject,\n Injectable,\n UnauthorizedException,\n} from '@nestjs/common';\nimport { ConfigType } from '@nestjs/config';\nimport { JwtService } from '@nestjs/jwt';\nimport { Request } from 'express';\nimport { ActiveUserData } from '../interfaces/active-user-data.interface';\nimport { jwtConfig } from 'src/config/jwt.config';\nimport { REQUEST_USER_KEY } from \"../constants\";\nimport { PermissionMetadataService } from '../services/permission-metadata.service';\nimport { ClsService } from 'nestjs-cls';\n\n@Injectable()\nexport class AccessTokenGuard implements CanActivate {\n constructor(\n private readonly jwtService: JwtService,\n @Inject(jwtConfig.KEY)\n private readonly jwtConfiguration: ConfigType<typeof jwtConfig>,\n private readonly permissionsService: PermissionMetadataService,\n private readonly cls: ClsService\n ) { }\n\n async canActivate(context: ExecutionContext): Promise<boolean> {\n // 💡 NOTE: For GraphQL applications, you'd have to use the wrapper GqlExecutionContext here instead.\n const request = context.switchToHttp().getRequest();\n const token = this.extractTokenFromHeader(request);\n if (!token) {\n throw new UnauthorizedException();\n }\n try {\n const payload: ActiveUserData = await this.jwtService.verifyAsync(\n token,\n this.jwtConfiguration,\n );\n\n // Load permissions given the user. \n const permissions = await this.permissionsService.findAllUsingRoles(payload.roles);\n payload.permissions = permissions.map((permission) => permission.name);\n\n request[REQUEST_USER_KEY] = payload;\n this.cls.set(REQUEST_USER_KEY, payload);\n // console.log(`About to set payload in the request user key:`);\n // console.log(payload);\n } catch {\n throw new UnauthorizedException();\n }\n return true;\n }\n\n private extractTokenFromHeader(request: Request): string | undefined {\n // Since token is included in the Authorization header something like \n // Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOjEsImVtYWlsIjoidXNlcjFAbmVzdGpzLmNvbSIsImlhdCI6MTcwMDk5NTk1MywiZXhwIjoxNzAwOTk5NTUzLCJhdWQiOiJsb2NhbGhvc3Q6MzAwMCIsImlzcyI6ImxvY2FsaG9zdDozMDAwIn0.303Y04SZjKqoPjJRq4hXHcarHeZYS878gPGWmw2SoUc\n const [_, token] = request.headers.authorization?.split(' ') ?? [];\n return token;\n }\n}\n"]}
|
package/dist/interfaces.d.ts
CHANGED
|
@@ -169,7 +169,14 @@ export interface IErrorCodeProvider {
|
|
|
169
169
|
rules(): ReadonlyArray<ErrorRule>;
|
|
170
170
|
resolve?(code: ErrorCode): ErrorMeta | undefined;
|
|
171
171
|
}
|
|
172
|
-
export type PlanStep = CreateNewFileStep | RegisterNestProviderStep | AddMethodToExistingClassStep | RegisterSolidXExtensionComponentStep | AddListViewButtonStep;
|
|
172
|
+
export type PlanStep = CreateNewFileStep | RegisterNestProviderStep | AddMethodToExistingClassStep | RegisterSolidXExtensionComponentStep | AddListViewButtonStep | AddFormViewButtonStep | AddImportStep;
|
|
173
|
+
export interface AddImportStep {
|
|
174
|
+
type: "addImport";
|
|
175
|
+
path: string;
|
|
176
|
+
importStatement: string;
|
|
177
|
+
overwrite?: boolean;
|
|
178
|
+
rationale?: string;
|
|
179
|
+
}
|
|
173
180
|
export interface CreateNewFileStep {
|
|
174
181
|
type: "createNewFile";
|
|
175
182
|
path: string;
|
|
@@ -192,6 +199,7 @@ export interface AddMethodToExistingClassStep {
|
|
|
192
199
|
className: string;
|
|
193
200
|
methodName: string;
|
|
194
201
|
content: string;
|
|
202
|
+
importStatements?: string[];
|
|
195
203
|
rationale?: string;
|
|
196
204
|
}
|
|
197
205
|
export interface RegisterSolidXExtensionComponentStep {
|
|
@@ -207,6 +215,13 @@ export interface AddListViewButtonStep {
|
|
|
207
215
|
buttonType?: string;
|
|
208
216
|
content?: string;
|
|
209
217
|
}
|
|
218
|
+
export interface AddFormViewButtonStep {
|
|
219
|
+
type: "addFormViewButton";
|
|
220
|
+
moduleName?: string;
|
|
221
|
+
modelName?: string;
|
|
222
|
+
buttonType?: string;
|
|
223
|
+
content?: string;
|
|
224
|
+
}
|
|
210
225
|
export interface McpComputedProviderResponse {
|
|
211
226
|
plan: PlanStep[];
|
|
212
227
|
}
|
package/dist/interfaces.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["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
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":";;;AA0JA,IAAY,SAEX;AAFD,WAAY,SAAS;IACnB,gDAAmC,CAAA;AACrC,CAAC,EAFW,SAAS,yBAAT,SAAS,QAEpB;AAED,MAAa,YAAY;IACvB,YACS,IAAS,EACT,OAAU;QADV,SAAI,GAAJ,IAAI,CAAK;QACT,YAAO,GAAP,OAAO,CAAG;IACf,CAAC;CACN;AALD,oCAKC;AAmED,IAAY,UAGX;AAHD,WAAY,UAAU;IACpB,mCAAqB,CAAA;IACrB,mCAAqB,CAAA;AACvB,CAAC,EAHW,UAAU,0BAAV,UAAU,QAGrB","sourcesContent":["import { CreateEmailTemplateDto } from 'src/dtos/create-email-template.dto';\nimport { CreateSmsTemplateDto } from 'src/dtos/create-sms-template.dto';\nimport { SignUpDto } from 'src/dtos/sign-up.dto';\nimport { Readable } from 'stream';\nimport { CreateMediaStorageProviderMetadataDto } from './dtos/create-media-storage-provider-metadata.dto';\nimport { DatasourceType } from './dtos/create-model-metadata.dto';\nimport { CreateModuleMetadataDto } from './dtos/create-module-metadata.dto';\nimport { CreateRoleMetadataDto } from './dtos/create-role-metadata.dto';\nimport { CreateSecurityRuleDto } from './dtos/create-security-rule.dto';\nimport { FieldMetadata } from './entities/field-metadata.entity';\nimport { Media } from './entities/media.entity';\nimport { DashboardQuestion } from './entities/dashboard-question.entity';\nimport { ComputedFieldMetadata } from './helpers/solid-registry';\nimport { SqlExpression } from './services/question-data-providers/chartjs-sql-data-provider.service';\nimport { CreateDashboardDto } from './dtos/create-dashboard.dto';\nimport { AiInteraction } from './entities/ai-interaction.entity';\n\nexport interface FieldCrudManager {\n // fieldMetadata: FieldMetadata;\n // entityManager?: EntityManager;\n // createDto: any;\n // files : Array<Express.Multer.File>;\n validate(\n dto: any,\n files: Array<Express.Multer.File>,\n ): ValidationError[] | Promise<ValidationError[]>;\n transformForCreate(dto: any, ctxt?: any): any | Promise<any>;\n}\n\nexport interface ValidationError {\n field: string;\n error: string;\n}\n\n// export interface MediaStorage\nexport interface MediaStorageProvider<T> {\n store(files: Express.Multer.File[], entity: T, mediaFieldMetadata: FieldMetadata): Promise<Media[]>;\n delete(entity: T, mediaFieldMetadata: FieldMetadata): Promise<void>;\n retrieve(entity: T, mediaFieldMetadata: FieldMetadata): Promise<Media[]>;\n storeStreams(streamPairs: [Readable, string][], entity: T, mediaFieldMetadata: FieldMetadata): Promise<Media[]>;\n // delete(file: string): Promise<void>;\n}\n\nexport interface ModuleMetadataConfiguration {\n moduleMetadata?: CreateModuleMetadataDto,\n roles?: CreateRoleMetadataDto[],\n users?: SignUpDto[],\n actions?: any[],\n menus?: any[],\n views?: any[],\n emailTemplates?: CreateEmailTemplateDto[],\n smsTemplates?: CreateSmsTemplateDto[],\n mediaStorageProviders?: CreateMediaStorageProviderMetadataDto[]\n securityRules?: CreateSecurityRuleDto[],\n dashboards?: CreateDashboardDto[],\n}\n\nexport interface CodeGenerationOptions {\n moduleId?: number;\n moduleUserKey?: string;\n modelId?: number;\n modelUserKey?: string;\n fieldIdsForRemoval?: number[];\n dryRun?: boolean;\n}\n\nexport interface TriggerMcpClientOptions {\n aiInteractionId: number;\n moduleName: string;\n}\n\nexport interface McpResponse {\n success: boolean;\n request: string;\n response: string;\n model?: string;\n tools_invoked?: string[];\n tool_calls?: any[];\n duration_ms?: number;\n errors?: string[];\n error_trace?: string[];\n content_type?: string;\n}\n\nexport interface ISelectionProviderContext {\n limit: number;\n offset: number;\n formValues: Record<string, any>;\n // query: string;\n}\n\nexport interface ISelectionProviderValues {\n label: string;\n value: string;\n}\n\nexport interface ISelectionProvider<T extends ISelectionProviderContext> {\n help(): string;\n\n name(): string;\n\n value(optionValue: string, ctxt: T): Promise<ISelectionProviderValues | any>;\n\n values(query: any, ctxt: T): Promise<readonly ISelectionProviderValues[]>;\n}\n\nexport interface IDashboardVariableSelectionProvider<T extends ISelectionProviderContext> extends ISelectionProvider<T> {\n}\n\nexport interface IMcpToolResponseHandler {\n apply(aiInteraction: AiInteraction);\n}\n\nexport interface IDashboardQuestionDataProvider<TContext, TData> {\n help(): string;\n\n name(): string;\n\n getData(question: DashboardQuestion, expressions?: SqlExpression[], ctxt?: TContext): Promise<TData[] | TData>;\n}\n\n/**\n * @deprecated Use `IEntityComputedFieldProvider` instead.\n */\nexport interface IComputedFieldProvider<T> {\n help(): string;\n\n name(): string;\n\n valueType(): string;\n\n computeValue(dto: any, ctxt: T): Promise<string | number>; // FIXME : Improve the types to make it more specific using generics\n}\n\nexport interface IEntityComputedFieldProvider {\n help(): string;\n\n name(): string;\n}\n\nexport interface IEntityPreComputeFieldProvider<TTriggerEntity, TContext, TValue = void> extends IEntityComputedFieldProvider {\n preComputeValue(triggerEntity: TTriggerEntity, computedFieldMetadata: ComputedFieldMetadata<TContext>): Promise<TValue>;\n}\n\nexport interface IEntityPostComputeFieldProvider<TTriggerEntity, TContext> extends IEntityComputedFieldProvider {\n postComputeAndSaveValue(triggerEntity: TTriggerEntity, computedFieldMetadata: ComputedFieldMetadata<TContext>): Promise<void>;\n}\n\nexport interface ISolidDatabaseModule {\n name(): string;\n\n type(): DatasourceType;\n}\n\nexport enum EventType {\n USER_REGISTERED = 'user.registered',\n}\n\nexport class EventDetails<T> {\n constructor(\n public type: any,\n public payload: T,\n ) { }\n}\n\nexport interface IMail<TResponse = unknown> {\n sendEmail(\n to: string,\n subject: string,\n body: string,\n shouldQueueEmails: boolean,\n wrapperAttachments?: MailAttachmentWrapper[],\n attachments?: MailAttachment[],\n parentEntity?: any,\n parentEntityId?: any,\n cc?: string[],\n bcc?: string[],\n from?: string,\n ): Promise<TResponse>;\n\n sendEmailUsingTemplate(\n to: string,\n templateName: string,\n templateParams: any,\n shouldQueueEmails: boolean,\n wrapperAttachments?: MailAttachmentWrapper[],\n attachments?: MailAttachment[],\n parentEntity?: any,\n parentEntityId?: any,\n cc?: string[],\n bcc?: string[],\n from?: string,\n ): Promise<TResponse>;\n}\n\nexport interface ISMS {\n sendSMS(to: string, body: string, shouldQueueSms: boolean): Promise<any>;\n\n sendSMSUsingTemplate(\n to: string,\n templateName: string,\n templateParams: any,\n shouldQueueSms: boolean,\n ): Promise<any>;\n}\n\nexport interface IWhatsAppTransport {\n sendWhatsAppMessage(\n to: string,\n templateId: string,\n parameters: any,\n parentEntity?: any,\n parentEntityId?: any\n ): Promise<any>;\n}\n\nexport interface MailAttachmentWrapper {\n relativePath?: string;\n attachment?: MailAttachment;\n}\n\nexport interface MailAttachment {\n filename: string;\n templatePath?: string; // deprecated\n templateParams?: any; // deprecated\n content?: string | Buffer;\n contentType?: string;\n path?: string; //Filesystem absolute path or URL. \n}\n\nexport enum BrokerType {\n RabbitMQ = 'rabbitmq',\n Database = 'database'\n}\n\nexport interface QueuesModuleOptions {\n name: string;\n type: BrokerType;\n queueName: string;\n}\n\nexport type MediaWithFullUrl = Media & {\n _full_url: string;\n};\n\n\nexport type ErrorCode = string;\n\nexport type ErrorMeta = {\n message: string;\n httpStatus?: number;\n};\n\nexport type ErrorRule = {\n /** Canonical error code. Keep them kebab-case for consistency. */\n code: ErrorCode;\n /** Higher runs earlier. Defaults to 0 if not provided. */\n priority?: number;\n /** Return true if this rule matches the combined error text. */\n match: (combinedErrorText: string) => boolean;\n /** Display + HTTP mapping for this code. */\n meta: ErrorMeta;\n};\n\nexport interface IErrorCodeProvider {\n /** Used for registry identity & logs */\n name(): string;\n\n /**\n * Return all rules this provider contributes.\n * These will be merged with other providers’ rules, then sorted by priority.\n */\n rules(): ReadonlyArray<ErrorRule>;\n\n /**\n * Optional fallback meta for codes this provider owns (when called by getMessage/getHttpStatus).\n * If omitted, the ErrorMapperService will rely on the rule.meta of the first matching rule.\n */\n resolve?(code: ErrorCode): ErrorMeta | undefined;\n}\n\n// MCP Tool Related\n\nexport type PlanStep = CreateNewFileStep | RegisterNestProviderStep | AddMethodToExistingClassStep | RegisterSolidXExtensionComponentStep | AddListViewButtonStep;\n\nexport interface CreateNewFileStep {\n type: \"createNewFile\";\n path: string; // repo-relative e.g. solid-api/api/src/computed-providers/foo.provider.ts\n content: string; // full file content\n overwrite?: boolean; // default=false\n rationale?: string; // optional, ignored by executor\n}\n\nexport interface RegisterNestProviderStep {\n type: \"registerNestProvider\";\n modulePath: string; // e.g. apps/api/src/address-master/address-master.module.ts\n providerClassName: string; // e.g. StateTotalCitiesComputedFieldProvider\n importFrom: string; // e.g. \"@/computed-providers/state-total-cities.provider\"\n registerIn: Array<\"providers\" | \"exports\">; // which arrays to add to\n uniqueGuard?: boolean; // default=true\n rationale?: string; // optional, ignored by executor\n}\n\nexport interface AddMethodToExistingClassStep {\n type: \"addMethodToExistingClass\";\n path: string; // e.g. apps/api/src/address-master/services/address-master.service.ts\n className: string // e.g. CountryService\n methodName: string // e.g. addCountry\n content: string // Full Method Code\n rationale?: string; // optional, ignored by executor\n}\n\nexport interface RegisterSolidXExtensionComponentStep {\n type: \"registerSolidXExtensionComponent\";\n path: string; // e.g. apps/api/src/address-master/services/address-master.service.ts\n content?: string; // Code\n importExtensionComponent?: string;\n}\n\nexport interface AddListViewButtonStep {\n type: \"addListViewButton\";\n moduleName?: string;\n modelName?: string;\n buttonType?: string;\n content?: string; // Code\n}\n\nexport interface McpComputedProviderResponse {\n plan: PlanStep[];\n // provider?: any; // (intentionally ignored per your note)\n}\n"]}
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":";;;AA0JA,IAAY,SAEX;AAFD,WAAY,SAAS;IACnB,gDAAmC,CAAA;AACrC,CAAC,EAFW,SAAS,yBAAT,SAAS,QAEpB;AAED,MAAa,YAAY;IACvB,YACS,IAAS,EACT,OAAU;QADV,SAAI,GAAJ,IAAI,CAAK;QACT,YAAO,GAAP,OAAO,CAAG;IACf,CAAC;CACN;AALD,oCAKC;AAmED,IAAY,UAGX;AAHD,WAAY,UAAU;IACpB,mCAAqB,CAAA;IACrB,mCAAqB,CAAA;AACvB,CAAC,EAHW,UAAU,0BAAV,UAAU,QAGrB","sourcesContent":["import { CreateEmailTemplateDto } from 'src/dtos/create-email-template.dto';\nimport { CreateSmsTemplateDto } from 'src/dtos/create-sms-template.dto';\nimport { SignUpDto } from 'src/dtos/sign-up.dto';\nimport { Readable } from 'stream';\nimport { CreateMediaStorageProviderMetadataDto } from './dtos/create-media-storage-provider-metadata.dto';\nimport { DatasourceType } from './dtos/create-model-metadata.dto';\nimport { CreateModuleMetadataDto } from './dtos/create-module-metadata.dto';\nimport { CreateRoleMetadataDto } from './dtos/create-role-metadata.dto';\nimport { CreateSecurityRuleDto } from './dtos/create-security-rule.dto';\nimport { FieldMetadata } from './entities/field-metadata.entity';\nimport { Media } from './entities/media.entity';\nimport { DashboardQuestion } from './entities/dashboard-question.entity';\nimport { ComputedFieldMetadata } from './helpers/solid-registry';\nimport { SqlExpression } from './services/question-data-providers/chartjs-sql-data-provider.service';\nimport { CreateDashboardDto } from './dtos/create-dashboard.dto';\nimport { AiInteraction } from './entities/ai-interaction.entity';\n\nexport interface FieldCrudManager {\n // fieldMetadata: FieldMetadata;\n // entityManager?: EntityManager;\n // createDto: any;\n // files : Array<Express.Multer.File>;\n validate(\n dto: any,\n files: Array<Express.Multer.File>,\n ): ValidationError[] | Promise<ValidationError[]>;\n transformForCreate(dto: any, ctxt?: any): any | Promise<any>;\n}\n\nexport interface ValidationError {\n field: string;\n error: string;\n}\n\n// export interface MediaStorage\nexport interface MediaStorageProvider<T> {\n store(files: Express.Multer.File[], entity: T, mediaFieldMetadata: FieldMetadata): Promise<Media[]>;\n delete(entity: T, mediaFieldMetadata: FieldMetadata): Promise<void>;\n retrieve(entity: T, mediaFieldMetadata: FieldMetadata): Promise<Media[]>;\n storeStreams(streamPairs: [Readable, string][], entity: T, mediaFieldMetadata: FieldMetadata): Promise<Media[]>;\n // delete(file: string): Promise<void>;\n}\n\nexport interface ModuleMetadataConfiguration {\n moduleMetadata?: CreateModuleMetadataDto,\n roles?: CreateRoleMetadataDto[],\n users?: SignUpDto[],\n actions?: any[],\n menus?: any[],\n views?: any[],\n emailTemplates?: CreateEmailTemplateDto[],\n smsTemplates?: CreateSmsTemplateDto[],\n mediaStorageProviders?: CreateMediaStorageProviderMetadataDto[]\n securityRules?: CreateSecurityRuleDto[],\n dashboards?: CreateDashboardDto[],\n}\n\nexport interface CodeGenerationOptions {\n moduleId?: number;\n moduleUserKey?: string;\n modelId?: number;\n modelUserKey?: string;\n fieldIdsForRemoval?: number[];\n dryRun?: boolean;\n}\n\nexport interface TriggerMcpClientOptions {\n aiInteractionId: number;\n moduleName: string;\n}\n\nexport interface McpResponse {\n success: boolean;\n request: string;\n response: string;\n model?: string;\n tools_invoked?: string[];\n tool_calls?: any[];\n duration_ms?: number;\n errors?: string[];\n error_trace?: string[];\n content_type?: string;\n}\n\nexport interface ISelectionProviderContext {\n limit: number;\n offset: number;\n formValues: Record<string, any>;\n // query: string;\n}\n\nexport interface ISelectionProviderValues {\n label: string;\n value: string;\n}\n\nexport interface ISelectionProvider<T extends ISelectionProviderContext> {\n help(): string;\n\n name(): string;\n\n value(optionValue: string, ctxt: T): Promise<ISelectionProviderValues | any>;\n\n values(query: any, ctxt: T): Promise<readonly ISelectionProviderValues[]>;\n}\n\nexport interface IDashboardVariableSelectionProvider<T extends ISelectionProviderContext> extends ISelectionProvider<T> {\n}\n\nexport interface IMcpToolResponseHandler {\n apply(aiInteraction: AiInteraction);\n}\n\nexport interface IDashboardQuestionDataProvider<TContext, TData> {\n help(): string;\n\n name(): string;\n\n getData(question: DashboardQuestion, expressions?: SqlExpression[], ctxt?: TContext): Promise<TData[] | TData>;\n}\n\n/**\n * @deprecated Use `IEntityComputedFieldProvider` instead.\n */\nexport interface IComputedFieldProvider<T> {\n help(): string;\n\n name(): string;\n\n valueType(): string;\n\n computeValue(dto: any, ctxt: T): Promise<string | number>; // FIXME : Improve the types to make it more specific using generics\n}\n\nexport interface IEntityComputedFieldProvider {\n help(): string;\n\n name(): string;\n}\n\nexport interface IEntityPreComputeFieldProvider<TTriggerEntity, TContext, TValue = void> extends IEntityComputedFieldProvider {\n preComputeValue(triggerEntity: TTriggerEntity, computedFieldMetadata: ComputedFieldMetadata<TContext>): Promise<TValue>;\n}\n\nexport interface IEntityPostComputeFieldProvider<TTriggerEntity, TContext> extends IEntityComputedFieldProvider {\n postComputeAndSaveValue(triggerEntity: TTriggerEntity, computedFieldMetadata: ComputedFieldMetadata<TContext>): Promise<void>;\n}\n\nexport interface ISolidDatabaseModule {\n name(): string;\n\n type(): DatasourceType;\n}\n\nexport enum EventType {\n USER_REGISTERED = 'user.registered',\n}\n\nexport class EventDetails<T> {\n constructor(\n public type: any,\n public payload: T,\n ) { }\n}\n\nexport interface IMail<TResponse = unknown> {\n sendEmail(\n to: string,\n subject: string,\n body: string,\n shouldQueueEmails: boolean,\n wrapperAttachments?: MailAttachmentWrapper[],\n attachments?: MailAttachment[],\n parentEntity?: any,\n parentEntityId?: any,\n cc?: string[],\n bcc?: string[],\n from?: string,\n ): Promise<TResponse>;\n\n sendEmailUsingTemplate(\n to: string,\n templateName: string,\n templateParams: any,\n shouldQueueEmails: boolean,\n wrapperAttachments?: MailAttachmentWrapper[],\n attachments?: MailAttachment[],\n parentEntity?: any,\n parentEntityId?: any,\n cc?: string[],\n bcc?: string[],\n from?: string,\n ): Promise<TResponse>;\n}\n\nexport interface ISMS {\n sendSMS(to: string, body: string, shouldQueueSms: boolean): Promise<any>;\n\n sendSMSUsingTemplate(\n to: string,\n templateName: string,\n templateParams: any,\n shouldQueueSms: boolean,\n ): Promise<any>;\n}\n\nexport interface IWhatsAppTransport {\n sendWhatsAppMessage(\n to: string,\n templateId: string,\n parameters: any,\n parentEntity?: any,\n parentEntityId?: any\n ): Promise<any>;\n}\n\nexport interface MailAttachmentWrapper {\n relativePath?: string;\n attachment?: MailAttachment;\n}\n\nexport interface MailAttachment {\n filename: string;\n templatePath?: string; // deprecated\n templateParams?: any; // deprecated\n content?: string | Buffer;\n contentType?: string;\n path?: string; //Filesystem absolute path or URL. \n}\n\nexport enum BrokerType {\n RabbitMQ = 'rabbitmq',\n Database = 'database'\n}\n\nexport interface QueuesModuleOptions {\n name: string;\n type: BrokerType;\n queueName: string;\n}\n\nexport type MediaWithFullUrl = Media & {\n _full_url: string;\n};\n\n\nexport type ErrorCode = string;\n\nexport type ErrorMeta = {\n message: string;\n httpStatus?: number;\n};\n\nexport type ErrorRule = {\n /** Canonical error code. Keep them kebab-case for consistency. */\n code: ErrorCode;\n /** Higher runs earlier. Defaults to 0 if not provided. */\n priority?: number;\n /** Return true if this rule matches the combined error text. */\n match: (combinedErrorText: string) => boolean;\n /** Display + HTTP mapping for this code. */\n meta: ErrorMeta;\n};\n\nexport interface IErrorCodeProvider {\n /** Used for registry identity & logs */\n name(): string;\n\n /**\n * Return all rules this provider contributes.\n * These will be merged with other providers’ rules, then sorted by priority.\n */\n rules(): ReadonlyArray<ErrorRule>;\n\n /**\n * Optional fallback meta for codes this provider owns (when called by getMessage/getHttpStatus).\n * If omitted, the ErrorMapperService will rely on the rule.meta of the first matching rule.\n */\n resolve?(code: ErrorCode): ErrorMeta | undefined;\n}\n\n// MCP Tool Related\n\nexport type PlanStep = CreateNewFileStep | RegisterNestProviderStep | AddMethodToExistingClassStep | RegisterSolidXExtensionComponentStep | AddListViewButtonStep | AddFormViewButtonStep | AddImportStep;\nexport interface AddImportStep {\n type: \"addImport\";\n path: string; // e.g. apps/api/src/address-master/services/address-master.service.ts\n importStatement: string; // e.g. import { Something } from 'somewhere';\n overwrite?: boolean; // default=false\n rationale?: string; // optional, ignored by executor\n}\n\nexport interface CreateNewFileStep {\n type: \"createNewFile\";\n path: string; // repo-relative e.g. solid-api/api/src/computed-providers/foo.provider.ts\n content: string; // full file content\n overwrite?: boolean; // default=false\n rationale?: string; // optional, ignored by executor\n}\n\nexport interface RegisterNestProviderStep {\n type: \"registerNestProvider\";\n modulePath: string; // e.g. apps/api/src/address-master/address-master.module.ts\n providerClassName: string; // e.g. StateTotalCitiesComputedFieldProvider\n importFrom: string; // e.g. \"@/computed-providers/state-total-cities.provider\"\n registerIn: Array<\"providers\" | \"exports\">; // which arrays to add to\n uniqueGuard?: boolean; // default=true\n rationale?: string; // optional, ignored by executor\n}\n\nexport interface AddMethodToExistingClassStep {\n type: \"addMethodToExistingClass\";\n path: string; // e.g. apps/api/src/address-master/services/address-master.service.ts\n className: string // e.g. CountryService\n methodName: string // e.g. addCountry\n content: string // Full Method Code\n importStatements?: string[]; // e.g. [ \"import { X } from 'y';\" ]\n rationale?: string; // optional, ignored by executor\n}\n\nexport interface RegisterSolidXExtensionComponentStep {\n type: \"registerSolidXExtensionComponent\";\n path: string; // e.g. apps/api/src/address-master/services/address-master.service.ts\n content?: string; // Code\n importExtensionComponent?: string;\n}\n\nexport interface AddListViewButtonStep {\n type: \"addListViewButton\";\n moduleName?: string;\n modelName?: string;\n buttonType?: string;\n content?: string; // Code\n}\n\nexport interface AddFormViewButtonStep {\n type: \"addFormViewButton\";\n moduleName?: string;\n modelName?: string;\n buttonType?: string;\n content?: string; // Code\n}\n\nexport interface McpComputedProviderResponse {\n plan: PlanStep[];\n // provider?: any; // (intentionally ignored per your note)\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trigger-mcp-client-subscriber-database.service.d.ts","sourceRoot":"","sources":["../../../src/jobs/database/trigger-mcp-client-subscriber-database.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,KAAK,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iDAAiD,CAAC;AAErF,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAC7F,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAChF,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAGrE,qBACa,kCAAmC,SAAQ,kBAAkB,CAAC,uBAAuB,CAAC;IAI3F,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB;IAC3C,QAAQ,CAAC,qBAAqB,EAAE,qBAAqB;IACrD,QAAQ,CAAC,MAAM,EAAE,aAAa;IAC9B,QAAQ,CAAC,oBAAoB,EAAE,oBAAoB;IACnD,QAAQ,CAAC,qBAAqB,EAAE,qBAAqB;IACrD,QAAQ,CAAC,oBAAoB,EAAE,oBAAoB;IACnD,OAAO,CAAC,QAAQ,CAAC,aAAa;IAE9B,OAAO,CAAC,QAAQ,CAAC,mBAAmB;IAXxC,OAAO,CAAC,QAAQ,CAAC,gCAAgC,CAAuD;gBAG3F,gBAAgB,EAAE,gBAAgB,EAClC,qBAAqB,EAAE,qBAAqB,EAC5C,MAAM,EAAE,aAAa,EACrB,oBAAoB,EAAE,oBAAoB,EAC1C,qBAAqB,EAAE,qBAAqB,EAC5C,oBAAoB,EAAE,oBAAoB,EAClC,aAAa,EAAE,aAAa,EAE5B,mBAAmB,EAAE,mBAAmB;IAM7D,OAAO,IAAI,mBAAmB;IAM9B,mBAAmB,CAAC,UAAU,EAAE,WAAW;IA8BrC,SAAS,CAAC,OAAO,EAAE,YAAY,CAAC,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"trigger-mcp-client-subscriber-database.service.d.ts","sourceRoot":"","sources":["../../../src/jobs/database/trigger-mcp-client-subscriber-database.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,KAAK,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE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B,CAAC,UAAU,EAAE,WAAW;IA8BrC,SAAS,CAAC,OAAO,EAAE,YAAY,CAAC,uBAAuB,CAAC;CAoPjE"}
|
|
@@ -122,6 +122,7 @@ let TriggerMcpClientSubscriberDatabase = TriggerMcpClientSubscriberDatabase_1 =
|
|
|
122
122
|
}
|
|
123
123
|
},
|
|
124
124
|
});
|
|
125
|
+
const existingControllerAndTheirMethods = this.solidRegistry.getControllers();
|
|
125
126
|
const modulesSection = (existingModules ?? [])
|
|
126
127
|
.map(m => [
|
|
127
128
|
`### ${m.displayName}`,
|
|
@@ -151,6 +152,12 @@ let TriggerMcpClientSubscriberDatabase = TriggerMcpClientSubscriberDatabase_1 =
|
|
|
151
152
|
`- description: ${m.instance.help() ?? ""}`,
|
|
152
153
|
].join('\n'))
|
|
153
154
|
.join('\n\n');
|
|
155
|
+
const controllersAndTheirMethods = (existingControllerAndTheirMethods ?? [])
|
|
156
|
+
.map(m => [
|
|
157
|
+
`### ${m.name}`,
|
|
158
|
+
`- methods: ${m.methods.length ? m.methods.map(m => `- ${m}`).join('\n') : '- No methods found'}`,
|
|
159
|
+
].join('\n'))
|
|
160
|
+
.join('\n\n');
|
|
154
161
|
const finalPrompt = `
|
|
155
162
|
# User Prompt:
|
|
156
163
|
${prompt}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trigger-mcp-client-subscriber-database.service.js","sourceRoot":"","sources":["../../../src/jobs/database/trigger-mcp-client-subscriber-database.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAoD;AACpD,+BAA2C;AAC3C,iEAA2D;AAE3D,gFAA0E;AAC1E,kFAA2E;AAC3E,oFAA6E;AAC7E,kEAA4D;AAC5D,mGAAqF;AACrF,qCAA8B;AAE9B,sFAAgF;AAChF,0EAAqE;AACrE,0GAA8E;AAGvE,IAAM,kCAAkC,0CAAxC,MAAM,kCAAmC,SAAQ,gDAA2C;IAG/F,YACa,gBAAkC,EAClC,qBAA4C,EAC5C,MA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E,UAAU,CAAC,WAAW;gBACtC,SAAS,EAAE,aAAa,CAAC,SAAS;gBAGlC,MAAM,EAAE,UAAU,CAAC,OAAO,IAAI,cAAc,CAAC,MAAM,IAAI,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,QAAQ;aAC5F,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC;YAGb,IAAI,aAAa,CAAC,WAAW,EAAE,CAAC;gBAC5B,IAAI,CAAC,oBAAoB,CAAC,uBAAuB,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC;YAC3E,CAAC;QACL,CAAC;QAED,OAAO,UAAU,CAAC;IACtB,CAAC;CACJ,CAAA;AAxRY,gFAAkC;6CAAlC,kCAAkC;IAD9C,IAAA,mBAAU,GAAE;qCAKsB,qCAAgB;QACX,gDAAqB;QACpC,8BAAa;QACC,6CAAoB;QACnB,+CAAqB;QACtB,0BAAoB;QACnB,8BAAa;QAEP,0CAAmB;GAZpD,kCAAkC,CAwR9C","sourcesContent":["import { Injectable, Logger } from '@nestjs/common';\nimport { ModelMetadataService } from 'src';\nimport { SolidRegistry } from 'src/helpers/solid-registry';\nimport { QueueMessage } from 'src/interfaces/mq';\nimport { DashboardRepository } from 'src/repository/dashboard.repository';\nimport { AiInteractionService } from 'src/services/ai-interaction.service';\nimport { ModuleMetadataService } from 'src/services/module-metadata.service';\nimport { PollerService } from 'src/services/poller.service';\nimport { DatabaseSubscriber } from 'src/services/queues/database-subscriber.service';\nimport { Not } from 'typeorm';\nimport { McpResponse, QueuesModuleOptions, TriggerMcpClientOptions } from \"../../interfaces\";\nimport { MqMessageQueueService } from '../../services/mq-message-queue.service';\nimport { MqMessageService } from '../../services/mq-message.service';\nimport triggerMcpClientQueueOptions from \"./trigger-mcp-client-queue-options\";\n\n@Injectable()\nexport class TriggerMcpClientSubscriberDatabase extends DatabaseSubscriber<TriggerMcpClientOptions> {\n private readonly triggerMcpClientSubscriberLogger = new Logger(TriggerMcpClientSubscriberDatabase.name);\n\n constructor(\n readonly mqMessageService: MqMessageService,\n readonly mqMessageQueueService: MqMessageQueueService,\n readonly poller: PollerService,\n readonly aiInteractionService: AiInteractionService,\n readonly moduleMetadataService: ModuleMetadataService,\n readonly modelMetadataService: ModelMetadataService,\n private readonly solidRegistry: SolidRegistry,\n // private readonly dashboardService: DashboardService\n private readonly dashboardRepository: DashboardRepository\n\n ) {\n super(mqMessageService, mqMessageQueueService, poller);\n }\n\n options(): QueuesModuleOptions {\n return {\n ...triggerMcpClientQueueOptions\n }\n }\n\n cleanNestedResponse(aiResponse: McpResponse) {\n let nestedResponse: any;\n\n try {\n let raw = aiResponse.response;\n\n if (typeof raw === \"string\") {\n raw = raw.trim();\n try {\n // Try to parse as JSON\n nestedResponse = JSON.parse(raw);\n } catch {\n // Not JSON, just keep as string\n nestedResponse = raw;\n }\n } else if (typeof raw === \"object\" && raw !== null) {\n // Already JSON\n nestedResponse = raw;\n } else {\n // Fallback\n nestedResponse = String(raw);\n }\n } catch (err) {\n this.triggerMcpClientSubscriberLogger.error(\"Error processing AI response:\", err);\n nestedResponse = `Error handling response: ${err?.message || String(err)}`;\n }\n\n return nestedResponse;\n }\n\n async subscribe(message: QueueMessage<TriggerMcpClientOptions>) {\n this.triggerMcpClientSubscriberLogger.debug(`Received message: ${JSON.stringify(message)}`);\n\n const codeGnerationOptions = message.payload;\n\n const aiInteraction = await this.aiInteractionService.findOne(codeGnerationOptions.aiInteractionId, {\n populate: ['user']\n });\n if (!aiInteraction) {\n const m = `Unable to identified the aiInteraction entry that triggered this job... using id: ${codeGnerationOptions.aiInteractionId}`\n this.triggerMcpClientSubscriberLogger.log(m);\n throw new Error(m);\n }\n\n // The message contains the users prompt.\n const prompt = aiInteraction.message;\n\n // Use this to invoke our mcp client\n // TODO: try / catch ... \n // Handle the rejection gracefully...\n\n // We create the aiInteraction entry first \n const genAiInteraction = await this.aiInteractionService.create({\n userId: aiInteraction.user.id,\n threadId: aiInteraction.threadId,\n parentInteractionId: aiInteraction.id,\n role: 'gen-ai',\n message: '...', // Updated in the tool\n contentType: '', // Updated in the tool\n errorMessage: '', // Updated after we receive the response\n modelUsed: '', // Updated after we receive the response\n responseTimeMs: 0, // Updated after we receive the response\n metadata: '', // Updated in the tool\n isApplied: false, // Updated after we receive the response\n status: 'pending' // Updated after we receive the response\n });\n\n const existingComputationProviders = this.solidRegistry.getComputedFieldProviders();\n\n const { records: existingModules } = await this.moduleMetadataService.findMany({\n filters: {\n name: { $ne: 'solid-core' }\n },\n fields: ['id', 'name', 'displayName', 'description'],\n limit: 1000\n });\n const { records: existingModels } = await this.modelMetadataService.findMany({\n filters: {\n module: {\n name: {\n $ne: 'solid-core',\n }\n }\n },\n limit: 1000,\n populate: ['module']\n });\n\n // Get the list of dashboards\n // TODO: Ideally we should fetch dashboard like below, but used below approach to avoid below CLS issues for now.\n // Cannot set the key \"filter\". No CLS context available, please make sure that a ClsMiddleware/Guard/Interceptor has set up the context, or wrap any calls that depend on CLS with \"ClsService#run\"\n // const { records: existingDashboards } = await this.dashboardService.find({\n // fields\n // })\n const existingDashboards = await this.dashboardRepository.find(\n {\n where: {\n module: {\n name: Not('solid-core')\n }\n },\n }\n );\n\n // Build markdown sections using template interpolation\n const modulesSection = (existingModules ?? [])\n .map(m => [\n `### ${m.displayName}`,\n `- name: ${m.name}`,\n `- description: ${m.description ?? \"\"}`,\n ].join('\\n'))\n .join('\\n\\n');\n\n const modelsSection = (existingModels ?? [])\n .map(m => [\n `### ${m.displayName}`,\n `- singularName: ${m.singularName}`,\n `- description: ${m.description ?? \"\"}`,\n `- moduleName: ${m.module.name}`,\n ].join('\\n'))\n .join('\\n\\n');\n\n const dashboardsSection = (existingDashboards ?? [])\n .map(d => [\n `### ${d.displayName}`,\n `- name: ${d.name}`,\n `- description: ${d.description ?? \"\"}`,\n ].join('\\n'))\n .join('\\n\\n'); \n\n const computationProvidersSection = (existingComputationProviders ?? [])\n .map(m => [\n `### ${m.instance.name()}`,\n `- name: ${m.instance.name()}`,\n `- description: ${m.instance.help() ?? \"\"}`,\n ].join('\\n'))\n .join('\\n\\n');\n\n\n const finalPrompt = `\n# User Prompt: \n${prompt}\n\n# System Instructions:\n- aiInteractionId: ${genAiInteraction.id}\n- You will be invoking tools if needed, hence you will have to choose the applicable tools based on the tool context given to you.\n- If a tool is invoked, you must return **exactly** the raw output from the tool, without any json envelopes, additional formatting, commentary, or text.\n- Do not wrap the result in quotes, JSON, or markdown fences.\n- Do not explain what the result means.\n\n# LISTS FOR REFERENCE AND VALIDATIONS\n\n## LIST OF EXISTING MODULES\nUse the below list of modules to infer which module the user is referring to, .\n\n${modulesSection}\n\n## LIST OF EXISTING MODELS\nUse the below list of models to infer which model the user is referring to.\nYou need to pull out the singularName for the model from the user prompt to match against the below list.\n\n${modelsSection}\n\n## LIST OF EXISTING DASHBOARDS\nUse the below list of dashboards to infer which dashboard the user is referring to.\n\n${dashboardsSection}\n\n## LIST OF EXISTING COMPUTED FIELD PROVIDERS\nUse the below list of computed field providers to infer which provider the user is referring to.\n\n${computationProvidersSection}\n`.trim();\n\n const aiResponse = await this.aiInteractionService.runMcpPrompt(finalPrompt);\n this.triggerMcpClientSubscriberLogger.log(`aiResponse: `);\n this.triggerMcpClientSubscriberLogger.log(JSON.stringify(aiResponse));\n\n if (!aiResponse.success) {\n this.triggerMcpClientSubscriberLogger.log(`Gen ai has returned with a false status code`);\n\n const errorsStr = aiResponse.errors?.join('\\n ');\n const errorTrace = aiResponse.error_trace?.join('\\n');\n\n // await this.aiInteractionService.create({\n // userId: aiInteraction.user.id,\n // threadId: aiInteraction.threadId,\n // parentInteractionId: aiInteraction.id,\n // role: 'gen-ai',\n // message: '-',\n // contentType: aiResponse.content_type,\n // errorMessage: errorsStr,\n // modelUsed: aiResponse.model,\n // responseTimeMs: aiResponse.duration_ms,\n // metadata: JSON.stringify(aiResponse, null, 2),\n // isApplied: aiInteraction.isApplied,\n // status: aiResponse.success ? 'succeeded' : 'failed'\n // });\n\n // TODO: Update the previously created genAiInteraction record with the respective error fields and save to DB\n await this.aiInteractionService.update(genAiInteraction.id, {\n // contentType: aiResponse.content_type,\n errorMessage: `${errorsStr}\\n\\n${errorTrace}`,\n modelUsed: aiResponse.model,\n responseTimeMs: aiResponse.duration_ms,\n isApplied: aiInteraction.isApplied,\n status: aiResponse.success ? 'succeeded' : 'failed'\n }, [], true);\n\n // update the job entry with failure... raising an error will lead the job to be marked as failed...\n throw new Error(errorsStr);\n }\n else {\n let nestedResponse = this.cleanNestedResponse(aiResponse);\n\n // const genAiInteraction = await this.aiInteractionService.create({\n // userId: aiInteraction.user.id,\n // threadId: aiInteraction.threadId,\n // parentInteractionId: aiInteraction.id,\n // role: 'gen-ai',\n // message: nestedResponse,\n // contentType: aiResponse.content_type,\n // errorMessage: '',\n // modelUsed: aiResponse.model,\n // responseTimeMs: aiResponse.duration_ms,\n // metadata: JSON.stringify(aiResponse, null, 2),\n // isApplied: aiInteraction.isApplied,\n // status: aiResponse.success ? 'succeeded' : 'failed'\n // });\n\n // TODO: Update the previously created genAiInteraction record with the respective success fields and save to DB\n const errorsStr = nestedResponse?.status == \"error\" && nestedResponse?.errors.join('\\n ');\n // const errorTrace = nestedResponse?.status == \"error\" && nestedResponse?.error_trace?.join('\\n');\n\n\n await this.aiInteractionService.update(genAiInteraction.id, {\n errorMessage: nestedResponse.status == \"error\" ? `${errorsStr}` : \"\",\n // errorMessage:\"\",\n // contentType: aiResponse.content_type,\n // message: nestedResponse,\n modelUsed: aiResponse.model,\n responseTimeMs: aiResponse.duration_ms,\n isApplied: aiInteraction.isApplied,\n\n // status: aiResponse.success ? 'succeeded' : 'failed'\n status: aiResponse.success && nestedResponse.status == \"success\" ? 'succeeded' : 'failed'\n }, [], true);\n\n // If the human interaction was with isAutoApply=true, then we can go ahead and autoApply.\n if (aiInteraction.isAutoApply) {\n this.aiInteractionService.applySolidAiInteraction(genAiInteraction.id);\n }\n }\n\n return aiResponse;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"trigger-mcp-client-subscriber-database.service.js","sourceRoot":"","sources":["../../../src/jobs/database/trigger-mcp-client-subscriber-database.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAoD;AACpD,+BAA2C;AAC3C,iEAA2D;AAE3D,gFAA0E;AAC1E,kFAA2E;AAC3E,oFAA6E;AAC7E,kEAA4D;AAC5D,mGAAqF;AACrF,qCAA8B;AAE9B,sFAAgF;AAChF,0EAAqE;AACrE,0GAA8E;AAGvE,IAAM,kCAAkC,0CAAxC,MAAM,kCAAmC,SAAQ,gDAA2C;IAG/F,YACa,gBAAkC,EAClC,qBAA4C,EAC5C,MAAqB,EACrB,oBAA0C,EAC1C,qBAA4C,EAC5C,oBAA0C,EAClC,aAA4B,EAE5B,mBAAwC;QAGzD,KAAK,CAAC,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,CAAC,CAAC;QAX9C,qBAAgB,GAAhB,gBAAgB,CAAkB;QAClC,0BAAqB,GAArB,qBAAqB,CAAuB;QAC5C,WAAM,GAAN,MAAM,CAAe;QACrB,yBAAoB,GAApB,oBAAoB,CAAsB;QAC1C,0BAAqB,GAArB,qBAAqB,CAAuB;QAC5C,yBAAoB,GAApB,oBAAoB,CAAsB;QAClC,kBAAa,GAAb,aAAa,CAAe;QAE5B,wBAAmB,GAAnB,mBAAmB,CAAqB;QAX5C,qCAAgC,GAAG,IAAI,eAAM,CAAC,oCAAkC,CAAC,IAAI,CAAC,CAAC;IAexG,CAAC;IAED,OAAO;QACH,OAAO;YACH,GAAG,0CAA4B;SAClC,CAAA;IACL,CAAC;IAED,mBAAmB,CAAC,UAAuB;QACvC,IAAI,cAAmB,CAAC;QAExB,IAAI,CAAC;YACD,IAAI,GAAG,GAAG,UAAU,CAAC,QAAQ,CAAC;YAE9B,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;gBAC1B,GAAG,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;gBACjB,IAAI,CAAC;oBAED,cAAc,GAAG,IAAI,CA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E,CAAC;QACL,CAAC;QAED,OAAO,UAAU,CAAC;IACtB,CAAC;CACJ,CAAA;AA1SY,gFAAkC;6CAAlC,kCAAkC;IAD9C,IAAA,mBAAU,GAAE;qCAKsB,qCAAgB;QACX,gDAAqB;QACpC,8BAAa;QACC,6CAAoB;QACnB,+CAAqB;QACtB,0BAAoB;QACnB,8BAAa;QAEP,0CAAmB;GAZpD,kCAAkC,CA0S9C","sourcesContent":["import { Injectable, Logger } from '@nestjs/common';\nimport { ModelMetadataService } from 'src';\nimport { SolidRegistry } from 'src/helpers/solid-registry';\nimport { QueueMessage } from 'src/interfaces/mq';\nimport { DashboardRepository } from 'src/repository/dashboard.repository';\nimport { AiInteractionService } from 'src/services/ai-interaction.service';\nimport { ModuleMetadataService } from 'src/services/module-metadata.service';\nimport { PollerService } from 'src/services/poller.service';\nimport { DatabaseSubscriber } from 'src/services/queues/database-subscriber.service';\nimport { Not } from 'typeorm';\nimport { McpResponse, QueuesModuleOptions, TriggerMcpClientOptions } from \"../../interfaces\";\nimport { MqMessageQueueService } from '../../services/mq-message-queue.service';\nimport { MqMessageService } from '../../services/mq-message.service';\nimport triggerMcpClientQueueOptions from \"./trigger-mcp-client-queue-options\";\n\n@Injectable()\nexport class TriggerMcpClientSubscriberDatabase extends DatabaseSubscriber<TriggerMcpClientOptions> {\n private readonly triggerMcpClientSubscriberLogger = new Logger(TriggerMcpClientSubscriberDatabase.name);\n\n constructor(\n readonly mqMessageService: MqMessageService,\n readonly mqMessageQueueService: MqMessageQueueService,\n readonly poller: PollerService,\n readonly aiInteractionService: AiInteractionService,\n readonly moduleMetadataService: ModuleMetadataService,\n readonly modelMetadataService: ModelMetadataService,\n private readonly solidRegistry: SolidRegistry,\n // private readonly dashboardService: DashboardService\n private readonly dashboardRepository: DashboardRepository\n\n ) {\n super(mqMessageService, mqMessageQueueService, poller);\n }\n\n options(): QueuesModuleOptions {\n return {\n ...triggerMcpClientQueueOptions\n }\n }\n\n cleanNestedResponse(aiResponse: McpResponse) {\n let nestedResponse: any;\n\n try {\n let raw = aiResponse.response;\n\n if (typeof raw === \"string\") {\n raw = raw.trim();\n try {\n // Try to parse as JSON\n nestedResponse = JSON.parse(raw);\n } catch {\n // Not JSON, just keep as string\n nestedResponse = raw;\n }\n } else if (typeof raw === \"object\" && raw !== null) {\n // Already JSON\n nestedResponse = raw;\n } else {\n // Fallback\n nestedResponse = String(raw);\n }\n } catch (err) {\n this.triggerMcpClientSubscriberLogger.error(\"Error processing AI response:\", err);\n nestedResponse = `Error handling response: ${err?.message || String(err)}`;\n }\n\n return nestedResponse;\n }\n\n async subscribe(message: QueueMessage<TriggerMcpClientOptions>) {\n this.triggerMcpClientSubscriberLogger.debug(`Received message: ${JSON.stringify(message)}`);\n\n const codeGnerationOptions = message.payload;\n\n const aiInteraction = await this.aiInteractionService.findOne(codeGnerationOptions.aiInteractionId, {\n populate: ['user']\n });\n if (!aiInteraction) {\n const m = `Unable to identified the aiInteraction entry that triggered this job... using id: ${codeGnerationOptions.aiInteractionId}`\n this.triggerMcpClientSubscriberLogger.log(m);\n throw new Error(m);\n }\n\n // The message contains the users prompt.\n const prompt = aiInteraction.message;\n\n // Use this to invoke our mcp client\n // TODO: try / catch ... \n // Handle the rejection gracefully...\n\n // We create the aiInteraction entry first \n const genAiInteraction = await this.aiInteractionService.create({\n userId: aiInteraction.user.id,\n threadId: aiInteraction.threadId,\n parentInteractionId: aiInteraction.id,\n role: 'gen-ai',\n message: '...', // Updated in the tool\n contentType: '', // Updated in the tool\n errorMessage: '', // Updated after we receive the response\n modelUsed: '', // Updated after we receive the response\n responseTimeMs: 0, // Updated after we receive the response\n metadata: '', // Updated in the tool\n isApplied: false, // Updated after we receive the response\n status: 'pending' // Updated after we receive the response\n });\n\n const existingComputationProviders = this.solidRegistry.getComputedFieldProviders();\n\n const { records: existingModules } = await this.moduleMetadataService.findMany({\n filters: {\n name: { $ne: 'solid-core' }\n },\n fields: ['id', 'name', 'displayName', 'description'],\n limit: 1000\n });\n const { records: existingModels } = await this.modelMetadataService.findMany({\n filters: {\n module: {\n name: {\n $ne: 'solid-core',\n }\n }\n },\n limit: 1000,\n populate: ['module']\n });\n\n // Get the list of dashboards\n // TODO: Ideally we should fetch dashboard like below, but used below approach to avoid below CLS issues for now.\n // Cannot set the key \"filter\". No CLS context available, please make sure that a ClsMiddleware/Guard/Interceptor has set up the context, or wrap any calls that depend on CLS with \"ClsService#run\"\n // const { records: existingDashboards } = await this.dashboardService.find({\n // fields\n // })\n const existingDashboards = await this.dashboardRepository.find(\n {\n where: {\n module: {\n name: Not('solid-core')\n }\n },\n }\n );\n\n const existingControllerAndTheirMethods = this.solidRegistry.getControllers();\n\n \n\n // Build markdown sections using template interpolation\n const modulesSection = (existingModules ?? [])\n .map(m => [\n `### ${m.displayName}`,\n `- name: ${m.name}`,\n `- description: ${m.description ?? \"\"}`,\n ].join('\\n'))\n .join('\\n\\n');\n\n const modelsSection = (existingModels ?? [])\n .map(m => [\n `### ${m.displayName}`,\n `- singularName: ${m.singularName}`,\n `- description: ${m.description ?? \"\"}`,\n `- moduleName: ${m.module.name}`,\n ].join('\\n'))\n .join('\\n\\n');\n\n const dashboardsSection = (existingDashboards ?? [])\n .map(d => [\n `### ${d.displayName}`,\n `- name: ${d.name}`,\n `- description: ${d.description ?? \"\"}`,\n ].join('\\n'))\n .join('\\n\\n'); \n\n const computationProvidersSection = (existingComputationProviders ?? [])\n .map(m => [\n `### ${m.instance.name()}`,\n `- name: ${m.instance.name()}`,\n `- description: ${m.instance.help() ?? \"\"}`,\n ].join('\\n'))\n .join('\\n\\n');\n\n const controllersAndTheirMethods = (existingControllerAndTheirMethods ?? [])\n .map(m => [\n `### ${m.name}`,\n `- methods: ${m.methods.length ? m.methods.map(m => `- ${m}`).join('\\n'): '- No methods found'}`,\n ].join('\\n'))\n .join('\\n\\n');\n\n\n\n const finalPrompt = `\n# User Prompt: \n${prompt}\n\n# System Instructions:\n- aiInteractionId: ${genAiInteraction.id}\n- You will be invoking tools if needed, hence you will have to choose the applicable tools based on the tool context given to you.\n- If a tool is invoked, you must return **exactly** the raw output from the tool, without any json envelopes, additional formatting, commentary, or text.\n- Do not wrap the result in quotes, JSON, or markdown fences.\n- Do not explain what the result means.\n\n# LISTS FOR REFERENCE AND VALIDATIONS\n\n## LIST OF EXISTING MODULES\nUse the below list of modules to infer which module the user is referring to, .\n\n${modulesSection}\n\n## LIST OF EXISTING MODELS\nUse the below list of models to infer which model the user is referring to.\nYou need to pull out the singularName for the model from the user prompt to match against the below list.\n\n${modelsSection}\n\n## LIST OF EXISTING DASHBOARDS\nUse the below list of dashboards to infer which dashboard the user is referring to.\n\n${dashboardsSection}\n\n## LIST OF EXISTING COMPUTED FIELD PROVIDERS\nUse the below list of computed field providers to infer which provider the user is referring to.\n\n${computationProvidersSection}\n`.trim();\n\n\n// ## LIST OF EXISTING CONTROLLERS AND THEIR METHODS\n// Use the below list of controllers and their methods to infer whether the api call being made to a particular controller exists or not.\n\n// ${controllersAndTheirMethods}\n\n const aiResponse = await this.aiInteractionService.runMcpPrompt(finalPrompt);\n this.triggerMcpClientSubscriberLogger.log(`aiResponse: `);\n this.triggerMcpClientSubscriberLogger.log(JSON.stringify(aiResponse));\n\n if (!aiResponse.success) {\n this.triggerMcpClientSubscriberLogger.log(`Gen ai has returned with a false status code`);\n\n const errorsStr = aiResponse.errors?.join('\\n ');\n const errorTrace = aiResponse.error_trace?.join('\\n');\n\n // await this.aiInteractionService.create({\n // userId: aiInteraction.user.id,\n // threadId: aiInteraction.threadId,\n // parentInteractionId: aiInteraction.id,\n // role: 'gen-ai',\n // message: '-',\n // contentType: aiResponse.content_type,\n // errorMessage: errorsStr,\n // modelUsed: aiResponse.model,\n // responseTimeMs: aiResponse.duration_ms,\n // metadata: JSON.stringify(aiResponse, null, 2),\n // isApplied: aiInteraction.isApplied,\n // status: aiResponse.success ? 'succeeded' : 'failed'\n // });\n\n // TODO: Update the previously created genAiInteraction record with the respective error fields and save to DB\n await this.aiInteractionService.update(genAiInteraction.id, {\n // contentType: aiResponse.content_type,\n errorMessage: `${errorsStr}\\n\\n${errorTrace}`,\n modelUsed: aiResponse.model,\n responseTimeMs: aiResponse.duration_ms,\n isApplied: aiInteraction.isApplied,\n status: aiResponse.success ? 'succeeded' : 'failed'\n }, [], true);\n\n // update the job entry with failure... raising an error will lead the job to be marked as failed...\n throw new Error(errorsStr);\n }\n else {\n let nestedResponse = this.cleanNestedResponse(aiResponse);\n\n // const genAiInteraction = await this.aiInteractionService.create({\n // userId: aiInteraction.user.id,\n // threadId: aiInteraction.threadId,\n // parentInteractionId: aiInteraction.id,\n // role: 'gen-ai',\n // message: nestedResponse,\n // contentType: aiResponse.content_type,\n // errorMessage: '',\n // modelUsed: aiResponse.model,\n // responseTimeMs: aiResponse.duration_ms,\n // metadata: JSON.stringify(aiResponse, null, 2),\n // isApplied: aiInteraction.isApplied,\n // status: aiResponse.success ? 'succeeded' : 'failed'\n // });\n\n // TODO: Update the previously created genAiInteraction record with the respective success fields and save to DB\n const errorsStr = nestedResponse?.status == \"error\" && nestedResponse?.errors.join('\\n ');\n // const errorTrace = nestedResponse?.status == \"error\" && nestedResponse?.error_trace?.join('\\n');\n\n\n await this.aiInteractionService.update(genAiInteraction.id, {\n errorMessage: nestedResponse.status == \"error\" ? `${errorsStr}` : \"\",\n // errorMessage:\"\",\n // contentType: aiResponse.content_type,\n // message: nestedResponse,\n modelUsed: aiResponse.model,\n responseTimeMs: aiResponse.duration_ms,\n isApplied: aiInteraction.isApplied,\n\n // status: aiResponse.success ? 'succeeded' : 'failed'\n status: aiResponse.success && nestedResponse.status == \"success\" ? 'succeeded' : 'failed'\n }, [], true);\n\n // If the human interaction was with isAutoApply=true, then we can go ahead and autoApply.\n if (aiInteraction.isAutoApply) {\n this.aiInteractionService.applySolidAiInteraction(genAiInteraction.id);\n }\n }\n\n return aiResponse;\n }\n}\n"]}
|
|
@@ -2,9 +2,13 @@ import { HttpService } from '@nestjs/axios';
|
|
|
2
2
|
import { ConfigType } from '@nestjs/config';
|
|
3
3
|
import { EventEmitter2 } from '@nestjs/event-emitter';
|
|
4
4
|
import { JwtService } from '@nestjs/jwt';
|
|
5
|
+
import commonConfig from 'src/config/common.config';
|
|
6
|
+
import { jwtConfig } from 'src/config/jwt.config';
|
|
7
|
+
import { CreateUserDto } from 'src/dtos/create-user.dto';
|
|
8
|
+
import { MailFactory } from 'src/factories/mail.factory';
|
|
5
9
|
import { Msg91OTPService } from 'src/services/sms/Msg91OTPService';
|
|
6
10
|
import { DataSource, Repository } from 'typeorm';
|
|
7
|
-
import { iamConfig
|
|
11
|
+
import { iamConfig } from '../config/iam.config';
|
|
8
12
|
import { ChangePasswordDto } from "../dtos/change-password.dto";
|
|
9
13
|
import { ConfirmForgotPasswordDto } from '../dtos/confirm-forgot-password.dto';
|
|
10
14
|
import { InitiateForgotPasswordDto } from '../dtos/initiate-forgot-password.dto';
|
|
@@ -18,14 +22,11 @@ import { User } from '../entities/user.entity';
|
|
|
18
22
|
import { ActiveUserData } from '../interfaces/active-user-data.interface';
|
|
19
23
|
import { HashingService } from './hashing.service';
|
|
20
24
|
import { RefreshTokenIdsStorageService } from './refresh-token-ids-storage.service';
|
|
21
|
-
import {
|
|
22
|
-
import { SettingService } from './setting.service';
|
|
23
|
-
import { CreateUserDto } from 'src/dtos/create-user.dto';
|
|
25
|
+
import { RequestContextService } from './request-context.service';
|
|
24
26
|
import { RoleMetadataService } from './role-metadata.service';
|
|
25
|
-
import
|
|
27
|
+
import { SettingService } from './setting.service';
|
|
26
28
|
import { UserActivityHistoryService } from './user-activity-history.service';
|
|
27
|
-
import {
|
|
28
|
-
import { MailFactory } from 'src/factories/mail.factory';
|
|
29
|
+
import { UserService } from './user.service';
|
|
29
30
|
export declare class AuthenticationService {
|
|
30
31
|
private readonly userService;
|
|
31
32
|
private readonly userRepository;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authentication.service.d.ts","sourceRoot":"","sources":["../../src/services/authentication.service.ts"],"names":[],"mapp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ator");
|
|
26
26
|
const crypto_1 = require("crypto");
|
|
27
|
+
const common_config_1 = __importDefault(require("../config/common.config"));
|
|
28
|
+
const jwt_config_1 = require("../config/jwt.config");
|
|
29
|
+
const error_messages_1 = require("../constants/error-messages");
|
|
30
|
+
const success_messages_1 = require("../constants/success-messages");
|
|
31
|
+
const mail_factory_1 = require("../factories/mail.factory");
|
|
27
32
|
const Msg91OTPService_1 = require("./sms/Msg91OTPService");
|
|
28
33
|
const typeorm_2 = require("typeorm");
|
|
34
|
+
const uuid_1 = require("uuid");
|
|
29
35
|
const iam_config_1 = require("../config/iam.config");
|
|
36
|
+
const constants_1 = require("../constants");
|
|
30
37
|
const user_entity_1 = require("../entities/user.entity");
|
|
38
|
+
const interfaces_1 = require("../interfaces");
|
|
31
39
|
const hashing_service_1 = require("./hashing.service");
|
|
32
40
|
const refresh_token_ids_storage_service_1 = require("./refresh-token-ids-storage.service");
|
|
33
|
-
const
|
|
34
|
-
const interfaces_1 = require("../interfaces");
|
|
35
|
-
const constants_1 = require("../constants");
|
|
36
|
-
const setting_service_1 = require("./setting.service");
|
|
41
|
+
const request_context_service_1 = require("./request-context.service");
|
|
37
42
|
const role_metadata_service_1 = require("./role-metadata.service");
|
|
38
|
-
const
|
|
43
|
+
const setting_service_1 = require("./setting.service");
|
|
39
44
|
const user_activity_history_service_1 = require("./user-activity-history.service");
|
|
40
|
-
const
|
|
41
|
-
const error_messages_1 = require("../constants/error-messages");
|
|
42
|
-
const success_messages_1 = require("../constants/success-messages");
|
|
43
|
-
const mail_factory_1 = require("../factories/mail.factory");
|
|
44
|
-
const uuid_1 = require("uuid");
|
|
45
|
+
const user_service_1 = require("./user.service");
|
|
45
46
|
var LoginProvider;
|
|
46
47
|
(function (LoginProvider) {
|
|
47
48
|
LoginProvider["LOCAL"] = "local";
|
|
@@ -892,7 +893,7 @@ exports.AuthenticationService = AuthenticationService;
|
|
|
892
893
|
exports.AuthenticationService = AuthenticationService = AuthenticationService_1 = __decorate([
|
|
893
894
|
(0, common_1.Injectable)(),
|
|
894
895
|
__param(1, (0, typeorm_1.InjectRepository)(user_entity_1.User)),
|
|
895
|
-
__param(4, (0, common_1.Inject)(
|
|
896
|
+
__param(4, (0, common_1.Inject)(jwt_config_1.jwtConfig.KEY)),
|
|
896
897
|
__param(5, (0, common_1.Inject)(iam_config_1.iamConfig.KEY)),
|
|
897
898
|
__param(13, (0, common_1.Inject)(common_config_1.default.KEY)),
|
|
898
899
|
__param(16, (0, typeorm_1.InjectDataSource)()),
|