@solidxai/core 0.1.18-beta.1 → 0.1.19-beta.1
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/CHANGELOG.md +14 -24178
- package/dist/commands/seed.command.d.ts +2 -0
- package/dist/commands/seed.command.d.ts.map +1 -1
- package/dist/commands/seed.command.js +10 -2
- package/dist/commands/seed.command.js.map +1 -1
- package/dist/helpers/bootstrap.helper.d.ts +1 -0
- package/dist/helpers/bootstrap.helper.d.ts.map +1 -1
- package/dist/helpers/bootstrap.helper.js +7 -6
- package/dist/helpers/bootstrap.helper.js.map +1 -1
- package/dist/seeders/seed-data/solid-core-metadata.json +1 -0
- package/dist/services/dashboard-providers/mq-dashboard-recent-failures-provider.service.d.ts +21 -1
- package/dist/services/dashboard-providers/mq-dashboard-recent-failures-provider.service.d.ts.map +1 -1
- package/dist/services/dashboard-providers/mq-dashboard-recent-failures-provider.service.js +10 -10
- package/dist/services/dashboard-providers/mq-dashboard-recent-failures-provider.service.js.map +1 -1
- package/package.json +1 -1
- package/src/commands/seed.command.ts +7 -2
- package/src/helpers/bootstrap.helper.ts +31 -8
- package/src/seeders/seed-data/solid-core-metadata.json +1 -0
- package/src/services/dashboard-providers/mq-dashboard-recent-failures-provider.service.ts +31 -13
|
@@ -5,6 +5,7 @@ interface SeedCommandOptions {
|
|
|
5
5
|
modulesToSeed?: string;
|
|
6
6
|
prune?: boolean;
|
|
7
7
|
skipHooks?: boolean;
|
|
8
|
+
verbose?: boolean;
|
|
8
9
|
}
|
|
9
10
|
export declare class SeedCommand extends CommandRunner {
|
|
10
11
|
private readonly solidRegistry;
|
|
@@ -15,6 +16,7 @@ export declare class SeedCommand extends CommandRunner {
|
|
|
15
16
|
parseString(val: string): string;
|
|
16
17
|
parsePrune(): boolean;
|
|
17
18
|
parseSkipHooks(): boolean;
|
|
19
|
+
parseVerbose(): boolean;
|
|
18
20
|
}
|
|
19
21
|
export {};
|
|
20
22
|
//# sourceMappingURL=seed.command.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"seed.command.d.ts","sourceRoot":"","sources":["../../src/commands/seed.command.ts"],"names":[],"mappings":"AACA,OAAO,EAAW,aAAa,EAAU,MAAM,gBAAgB,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAG3D,UAAU,kBAAkB;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"seed.command.d.ts","sourceRoot":"","sources":["../../src/commands/seed.command.ts"],"names":[],"mappings":"AACA,OAAO,EAAW,aAAa,EAAU,MAAM,gBAAgB,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAG3D,UAAU,kBAAkB;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,qBACa,WAAY,SAAQ,aAAa;IAGhC,OAAO,CAAC,QAAQ,CAAC,aAAa;IAF1C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAgC;gBAE1B,aAAa,EAAE,aAAa;IAInD,GAAG,CAAC,WAAW,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAwD7E,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAKvC,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAKhC,UAAU,IAAI,OAAO;IAKrB,cAAc,IAAI,OAAO;IAKzB,YAAY,IAAI,OAAO;CAGxB"}
|
|
@@ -63,8 +63,7 @@ let SeedCommand = SeedCommand_1 = class SeedCommand extends nest_commander_1.Com
|
|
|
63
63
|
.map((seeder) => seeder.instance)
|
|
64
64
|
.pop();
|
|
65
65
|
if (!seeder) {
|
|
66
|
-
|
|
67
|
-
return;
|
|
66
|
+
throw new Error(`Seeder service ${options.seeder} not found. Does your service have a seed() method?`);
|
|
68
67
|
}
|
|
69
68
|
this.logger.log(`Running the seed() method for seeder: ${seeder.constructor.name}`);
|
|
70
69
|
await seeder.seed(parsedConf);
|
|
@@ -81,6 +80,9 @@ let SeedCommand = SeedCommand_1 = class SeedCommand extends nest_commander_1.Com
|
|
|
81
80
|
parseSkipHooks() {
|
|
82
81
|
return true;
|
|
83
82
|
}
|
|
83
|
+
parseVerbose() {
|
|
84
|
+
return true;
|
|
85
|
+
}
|
|
84
86
|
};
|
|
85
87
|
exports.SeedCommand = SeedCommand;
|
|
86
88
|
__decorate([
|
|
@@ -107,6 +109,12 @@ __decorate([
|
|
|
107
109
|
__metadata("design:paramtypes", []),
|
|
108
110
|
__metadata("design:returntype", Boolean)
|
|
109
111
|
], SeedCommand.prototype, "parseSkipHooks", null);
|
|
112
|
+
__decorate([
|
|
113
|
+
(0, nest_commander_1.Option)({ flags: '-v, --verbose', description: 'Show detailed Nest/Winston logs during seeding.' }),
|
|
114
|
+
__metadata("design:type", Function),
|
|
115
|
+
__metadata("design:paramtypes", []),
|
|
116
|
+
__metadata("design:returntype", Boolean)
|
|
117
|
+
], SeedCommand.prototype, "parseVerbose", null);
|
|
110
118
|
exports.SeedCommand = SeedCommand = SeedCommand_1 = __decorate([
|
|
111
119
|
(0, nest_commander_1.Command)({ name: 'seed', description: 'Install seed data for a given module' }),
|
|
112
120
|
__metadata("design:paramtypes", [solid_registry_1.SolidRegistry])
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"seed.command.js","sourceRoot":"","sources":["../../src/commands/seed.command.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAwC;AACxC,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+CAA+C,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;;;;qDAGxI;AAGD;IADC,IAAA,uBAAM,EAAC,EAAE,KAAK,EAAE,4BAA4B,EAAE,WAAW,EAAE,oBAAoB,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,EAAE,6BAA6B,EAAE,CAAC;;;;8CAG/I;AAGD;IADC,IAAA,uBAAM,EAAC,EAAE,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,qCAAqC,EAAE,CAAC;;;;6CAGhF;AAGD;IADC,IAAA,uBAAM,EAAC,EAAE,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,8DAA8D,EAAE,CAAC;;;;iDAG9G;AAGD;IADC,IAAA,uBAAM,EAAC,EAAE,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,iDAAiD,EAAE,CAAC;;;;+CAGlG;sBArFU,WAAW;IADvB,IAAA,wBAAO,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,sCAAsC,EAAE,CAAC;qCAIjC,8BAAa;GAH9C,WAAW,CAsFvB","sourcesContent":["import { Logger } from '@nestjs/common';\nimport { Command, CommandRunner, Option } from 'nest-commander';\nimport { SolidRegistry } from 'src/helpers/solid-registry';\nimport { ModuleMetadataSeederOptions } from 'src/interfaces';\n\ninterface SeedCommandOptions {\n seeder?: string;\n modulesToSeed?: string;\n prune?: boolean;\n skipHooks?: boolean;\n verbose?: boolean;\n}\n\n@Command({ name: 'seed', description: 'Install seed data for a given module' })\nexport class SeedCommand extends CommandRunner {\n private readonly logger = new Logger(SeedCommand.name);\n\n constructor(private readonly solidRegistry: SolidRegistry) {\n super();\n }\n\n async run(passedParam: string[], options?: SeedCommandOptions): Promise<void> {\n let parsedConf: ModuleMetadataSeederOptions | null = null;\n if (options?.modulesToSeed) {\n const modulesToSeed = options.modulesToSeed\n .split(',')\n .map((m) => m.trim())\n .filter(Boolean);\n parsedConf = {\n modulesToSeed,\n pruneMetadata: false,\n seedGlobalMetadata: true,\n skipHooks: false,\n };\n this.logger.log(`Modules to seed: ${modulesToSeed.join(', ')}`);\n } else {\n this.logger.log('No --modules-to-seed flag provided. Running with default seeder behavior.');\n }\n\n if (options?.prune) {\n parsedConf = parsedConf ?? {\n modulesToSeed: null,\n pruneMetadata: false,\n seedGlobalMetadata: true,\n skipHooks: false,\n };\n parsedConf.pruneMetadata = true;\n }\n\n if (options?.skipHooks) {\n parsedConf = parsedConf ?? {\n modulesToSeed: null,\n pruneMetadata: false,\n seedGlobalMetadata: true,\n skipHooks: false,\n };\n parsedConf.skipHooks = true;\n this.logger.log('Skipping pre-seed and post-seed hooks.');\n }\n\n const seeder = this.solidRegistry\n .getSeeders()\n .filter((seeder) => seeder.name === options.seeder)\n .map((seeder) => seeder.instance)\n .pop();\n if (!seeder) {\n throw new Error(`Seeder service ${options.seeder} not found. Does your service have a seed() method?`);\n }\n this.logger.log(`Running the seed() method for seeder: ${seeder.constructor.name}`);\n await seeder.seed(parsedConf);\n }\n\n /**\n * This parameter will be useful, to support seeders with the same name in different modules\n * Currently the seeder service won't support seeder with same classname within a module\n **/\n @Option({ flags: '-m, --modules-to-seed [module names]', description: 'Comma-separated list of module names to seed.', required: false })\n parseModulesToSeed(val: string): string {\n return val;\n }\n\n @Option({ flags: '-s, --seeder [seeder name]', description: 'The seeder to run.', required: true, defaultValue: 'ModuleMetadataSeederService' })\n parseString(val: string): string {\n return val;\n }\n\n @Option({ flags: '--prune', description: 'Prune metadata not present in JSON.' })\n parsePrune(): boolean {\n return true;\n }\n\n @Option({ flags: '--skip-hooks', description: 'Skip emitting pre-seed and post-seed lifecycle hooks/events.' })\n parseSkipHooks(): boolean {\n return true;\n }\n\n @Option({ flags: '-v, --verbose', description: 'Show detailed Nest/Winston logs during seeding.' })\n parseVerbose(): boolean {\n return true;\n }\n}\n"]}
|
|
@@ -12,6 +12,7 @@ export interface SolidBootstrapOptions {
|
|
|
12
12
|
security?: SolidSecurityOptions;
|
|
13
13
|
verboseBootstrap?: boolean;
|
|
14
14
|
bodyLimit?: string;
|
|
15
|
+
captureRawBody?: boolean;
|
|
15
16
|
}
|
|
16
17
|
export declare function bootstrapSolidApp(appModuleFactory: () => Promise<any>, options?: SolidBootstrapOptions): Promise<NestExpressApplication>;
|
|
17
18
|
export declare function bootstrapSolidCli(appModuleFactory: () => Promise<any>): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrap.helper.d.ts","sourceRoot":"","sources":["../../src/helpers/bootstrap.helper.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAalE,OAAO,EAGL,uBAAuB,EACvB,oBAAoB,EACrB,MAAM,mBAAmB,CAAC;AAyB3B,MAAM,WAAW,mBAAmB;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,qBAAqB;IAEpC,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB,OAAO,CAAC,EAAE,mBAAmB,GAAG,KAAK,CAAC;IAEtC,0BAA0B,CAAC,EAAE,OAAO,CAAC,uBAAuB,CAAC,CAAC;IAE9D,QAAQ,CAAC,EAAE,oBAAoB,CAAC;IAEhC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAU3B,SAAS,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"bootstrap.helper.d.ts","sourceRoot":"","sources":["../../src/helpers/bootstrap.helper.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAalE,OAAO,EAGL,uBAAuB,EACvB,oBAAoB,EACrB,MAAM,mBAAmB,CAAC;AAyB3B,MAAM,WAAW,mBAAmB;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,qBAAqB;IAEpC,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB,OAAO,CAAC,EAAE,mBAAmB,GAAG,KAAK,CAAC;IAEtC,0BAA0B,CAAC,EAAE,OAAO,CAAC,uBAAuB,CAAC,CAAC;IAE9D,QAAQ,CAAC,EAAE,oBAAoB,CAAC;IAEhC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAU3B,SAAS,CAAC,EAAE,MAAM,CAAC;IAYnB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAeD,wBAAsB,iBAAiB,CACrC,gBAAgB,EAAE,MAAM,OAAO,CAAC,GAAG,CAAC,EACpC,OAAO,GAAE,qBAA0B,GAClC,OAAO,CAAC,sBAAsB,CAAC,CAuJjC;AAgBD,wBAAsB,iBAAiB,CACrC,gBAAgB,EAAE,MAAM,OAAO,CAAC,GAAG,CAAC,GACnC,OAAO,CAAC,IAAI,CAAC,CA4Cf"}
|
|
@@ -36,11 +36,12 @@ function registerGlobalProcessHandlers() {
|
|
|
36
36
|
}
|
|
37
37
|
async function bootstrapSolidApp(appModuleFactory, options = {}) {
|
|
38
38
|
registerGlobalProcessHandlers();
|
|
39
|
-
const { globalPrefix = 'api', swagger = {}, permissionsPolicyOverrides = {}, security = {}, verboseBootstrap = false, bodyLimit = '10mb', } = options;
|
|
39
|
+
const { globalPrefix = 'api', swagger = {}, permissionsPolicyOverrides = {}, security = {}, verboseBootstrap = false, bodyLimit = '10mb', captureRawBody = false, } = options;
|
|
40
40
|
const startTime = Date.now();
|
|
41
41
|
const appModule = await appModuleFactory();
|
|
42
42
|
const app = await core_1.NestFactory.create(appModule, {
|
|
43
43
|
bodyParser: false,
|
|
44
|
+
rawBody: captureRawBody,
|
|
44
45
|
logger: nest_winston_1.WinstonModule.createLogger({ ...(0, winston_logger_1.createWinstonLoggerConfig)(), level: verboseBootstrap ? 'debug' : 'error' }),
|
|
45
46
|
});
|
|
46
47
|
const apiEnabled = (0, environment_helper_1.parseBooleanEnv)('API_ENABLED', true);
|
|
@@ -140,12 +141,12 @@ async function bootstrapSolidCli(appModuleFactory) {
|
|
|
140
141
|
if (idx !== -1)
|
|
141
142
|
process.argv.splice(idx, 1);
|
|
142
143
|
}
|
|
143
|
-
const appModule = await appModuleFactory();
|
|
144
|
-
process.env.SOLID_CLI_RUNNING = 'true';
|
|
145
|
-
const app = await nest_commander_1.CommandFactory.createWithoutRunning(appModule, {
|
|
146
|
-
logger: showLogs ? ['debug', 'error', 'fatal', 'log', 'verbose', 'warn'] : false,
|
|
147
|
-
});
|
|
148
144
|
try {
|
|
145
|
+
const appModule = await appModuleFactory();
|
|
146
|
+
process.env.SOLID_CLI_RUNNING = 'true';
|
|
147
|
+
const app = await nest_commander_1.CommandFactory.createWithoutRunning(appModule, {
|
|
148
|
+
logger: showLogs ? ['debug', 'error', 'fatal', 'log', 'verbose', 'warn'] : ['error', 'fatal'],
|
|
149
|
+
});
|
|
149
150
|
await nest_commander_1.CommandFactory.runApplication(app);
|
|
150
151
|
}
|
|
151
152
|
catch (e) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrap.helper.js","sourceRoot":"","sources":["../../src/helpers/bootstrap.helper.ts"],"names":[],"mappings":";;;;;AAuFA,8CAmJC;AAgBD,8CA0CC;AApSD,2CAA4E;AAC5E,uCAAsD;AAEtD,qDAAgD;AAChD,6CAAiE;AAEjE,oDAA4B;AAC5B,4CAAoB;AACpB,2BAAgC;AAChC,+BAA+B;AAC/B,+CAA2E;AAC3E,mDAAgD;AAChD,sDAA8D;AAC9D,yFAAoF;AACpF,+CAAwD;AACxD,uDAK2B;AAC3B,6DAAuD;AAIvD,SAAS,6BAA6B;IACpC,OAAO,CAAC,EAAE,CAAC,oBAAoB,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE;QACnD,OAAO,CAAC,KAAK,CAAC,yBAAyB,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC,CAA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vC,MAAM,GAAG,GAAG,MAAM,+BAAc,CAAC,oBAAoB,CAAC,SAAS,EAAE;QAC/D,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK;KACjF,CAAC,CAAC;IAEH,IAAI,CAAC;QACH,MAAM,+BAAc,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;IAC3C,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,OAAO,CAAC,KAAK,CAAC,sCAAsC,EAAE,CAAC,CAAC,CAAC;QACzD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC","sourcesContent":["import { ClassSerializerInterceptor, ValidationPipe } from '@nestjs/common';\nimport { NestFactory, Reflector } from '@nestjs/core';\nimport { NestExpressApplication } from '@nestjs/platform-express';\nimport { WsAdapter } from '@nestjs/platform-ws';\nimport { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';\nimport { NextFunction, Request, Response } from 'express';\nimport helmet from 'helmet';\nimport qs from 'qs';\nimport { existsSync } from 'fs';\nimport { resolve } from 'path';\nimport { WINSTON_MODULE_NEST_PROVIDER, WinstonModule } from 'nest-winston';\nimport { CommandFactory } from 'nest-commander';\nimport { createWinstonLoggerConfig } from '../winston.logger';\nimport { WrapResponseInterceptor } from '../interceptors/wrap-response.interceptor';\nimport { buildDefaultCorsOptions } from './cors.helper';\nimport {\n buildDefaultSecurityHeaderOptions,\n buildPermissionsPolicyHeader,\n PermissionsPolicyConfig,\n SolidSecurityOptions,\n} from './security.helper';\nimport { parseBooleanEnv } from './environment.helper';\n\n// ---- Shared process handlers ----\n\nfunction registerGlobalProcessHandlers() {\n process.on('unhandledRejection', (reason, promise) => {\n console.error('Unhandled Rejection at:', promise, 'reason:', reason);\n });\n\n process.on('uncaughtException', (err) => {\n console.error('Uncaught Exception thrown:', err);\n });\n\n // Suppress pg deprecation warning caused by TypeORM's internal query scheduling\n process.on('warning', (warning) => {\n if (warning.name === 'DeprecationWarning' && (warning.message.includes('client.query()') || warning.message.includes('punycode'))) {\n return;\n }\n console.warn(warning);\n });\n}\n\n// ---- HTTP server bootstrap ----\n\nexport interface SolidSwaggerOptions {\n title?: string;\n description?: string;\n version?: string;\n}\n\nexport interface SolidBootstrapOptions {\n /** Global API prefix. Defaults to 'api'. Set to '' to disable. */\n globalPrefix?: string;\n /** Swagger configuration. Set to false to disable Swagger entirely. */\n swagger?: SolidSwaggerOptions | false;\n /** Permissions-Policy header overrides (merged with defaults). */\n permissionsPolicyOverrides?: Partial<PermissionsPolicyConfig>;\n /** Security header overrides, including iframe frame-ancestor allowlists. */\n security?: SolidSecurityOptions;\n /** Show full NestJS init logs during bootstrap (route mapping, module deps, pollers). Defaults to false. */\n verboseBootstrap?: boolean;\n /**\n * Max request body size for JSON and urlencoded payloads, as a `bytes`-compatible\n * string (e.g. '10mb', '512kb'). Defaults to '10mb'.\n *\n * Does NOT apply to multipart/form-data uploads: body-parser matches on Content-Type,\n * so multipart requests skip these parsers entirely and are handled by Multer. Raise\n * this only for large structured JSON (e.g. /bulk arrays), bearing in mind the parsed\n * object graph can retain several times the raw byte size.\n */\n bodyLimit?: string;\n}\n\n/**\n * Bootstraps a SolidX NestJS HTTP application with sensible defaults:\n * security headers, CORS, Winston logger, ValidationPipe,\n * WrapResponseInterceptor, qs deep query parsing, Swagger, and the\n * pg BIGINT type parser.\n *\n * @example\n * // main.ts\n * bootstrapSolidApp(() => AppModule.forRoot(), {\n * swagger: { title: 'My API', description: 'My API description' },\n * security: { frameAncestors: [\"'self'\", 'https://portal.example.com'] },\n * });\n */\nexport async function bootstrapSolidApp(\n appModuleFactory: () => Promise<any>,\n options: SolidBootstrapOptions = {},\n): Promise<NestExpressApplication> {\n registerGlobalProcessHandlers();\n\n const {\n globalPrefix = 'api',\n swagger = {},\n permissionsPolicyOverrides = {},\n security = {},\n verboseBootstrap = false,\n bodyLimit = '10mb',\n } = options;\n\n const startTime = Date.now();\n const appModule = await appModuleFactory();\n const app = await NestFactory.create<NestExpressApplication>(appModule, {\n // Nest's default parsers are registered during init() with a 100kb limit, ahead of\n // any module middleware. Disable them so the parsers below own the limit outright.\n bodyParser: false,\n logger: WinstonModule.createLogger({ ...createWinstonLoggerConfig(), level: verboseBootstrap ? 'debug' : 'error' }),\n });\n\n const apiEnabled = parseBooleanEnv('API_ENABLED', true);\n\n if (!apiEnabled) {\n await app.init();\n app\n .get(WINSTON_MODULE_NEST_PROVIDER)\n .log('API server disabled via API_ENABLED=false. Skipping HTTP listen.', 'Bootstrap');\n return app;\n }\n\n // Health check at root path\n const server = app.getHttpAdapter().getInstance();\n server.get('/', (_req, res) => res.status(200).send('SOLID OK'));\n\n // Security headers\n app.use(helmet(buildDefaultSecurityHeaderOptions(security)));\n\n // Nest's Swagger UI HTML injects inline styles; keep CSP strict elsewhere.\n const isSwaggerPath = (path: string) =>\n path === '/docs' ||\n path === '/docs/' ||\n path.startsWith('/docs/') ||\n path === '/docs-json' ||\n path === '/docs-yaml';\n\n app.use((req: Request, res: Response, next: NextFunction) => {\n if (isSwaggerPath(req.path)) {\n res.removeHeader('Content-Security-Policy');\n }\n next();\n });\n\n // Permissions-Policy header\n app.use((_req: Request, res: Response, next: NextFunction) => {\n res.setHeader('Permissions-Policy', buildPermissionsPolicyHeader(permissionsPolicyOverrides));\n next();\n });\n\n const port = process.env.PORT || 3000;\n\n if (globalPrefix) {\n app.setGlobalPrefix(globalPrefix);\n }\n\n // qs-based deep query parsing (dot notation, nested objects, arrays)\n app.use((req: Request, _res: Response, next: NextFunction) => {\n if (req.query) {\n req.query = qs.parse(req.url.split('?')[1], {\n allowDots: true,\n depth: 20,\n arrayLimit: 100,\n });\n }\n next();\n });\n\n // Body parsers — replaces Nest's default 100kb parsers (disabled via bodyParser: false).\n // Registered here so the middleware order Nest applied by default is preserved:\n // helmet -> CSP -> Permissions-Policy -> qs -> body parsers -> routes.\n app.useBodyParser('json', { limit: bodyLimit });\n app.useBodyParser('urlencoded', { limit: bodyLimit, extended: true });\n\n // Global ValidationPipe\n app.useGlobalPipes(\n new ValidationPipe({\n transform: true,\n transformOptions: { enableImplicitConversion: true },\n }),\n );\n\n // Swagger\n if (swagger !== false) {\n const { title = process.env.SOLID_APP_NAME, description = process.env.SOLID_APP_DESCRIPTION, version = '1.0' } = swagger;\n const swaggerConfig = new DocumentBuilder()\n .setTitle(title)\n .setDescription(description)\n .setVersion(version)\n .setExternalDoc('Postman Collection', '/docs-json')\n .addBearerAuth(\n {\n description: 'Please enter token in following format: Bearer <JWT>',\n name: 'Authorization',\n bearerFormat: 'Bearer',\n scheme: 'Bearer',\n type: 'http',\n in: 'Header',\n },\n 'jwt',\n )\n .build();\n const document = SwaggerModule.createDocument(app, swaggerConfig);\n SwaggerModule.setup('/docs', app, document);\n }\n\n // Global interceptor\n app.useGlobalInterceptors(\n new ClassSerializerInterceptor(app.get(Reflector), {\n enableImplicitConversion: true, // optional but handy\n // groups: ['client'], // if you use groups\n }),\n new WrapResponseInterceptor()\n );\n\n // CORS\n app.enableCors(buildDefaultCorsOptions());\n\n // Fix pg returning BIGINT columns as strings\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const types = require('pg').types;\n types.setTypeParser(types.builtins.INT8, (val: string) => parseInt(val));\n\n app.useWebSocketAdapter(new WsAdapter(app));\n\n await app.listen(port);\n\n // Wire up Winston as the runtime logger only AFTER listen — this suppresses all\n // framework init noise (route mapping, module deps, onModuleInit) during boot.\n app.useLogger(app.get(WINSTON_MODULE_NEST_PROVIDER));\n\n const elapsed = ((Date.now() - startTime) / 1000).toFixed(2);\n process.stdout.write(`\\x1b[32mServer started on port ${port} in ${elapsed}s\\x1b[0m\\n`);\n\n return app;\n}\n\n// ---- CLI bootstrap ----\n\n/**\n * Bootstraps a SolidX NestJS CLI application using nest-commander.\n * Handles verbose flag stripping, project root validation, and clean process exit.\n *\n * @example\n * // main-cli.ts\n * #!/usr/bin/env node\n * import { bootstrapSolidCli } from '@solidxai/core';\n * import { AppModule } from './app.module';\n *\n * bootstrapSolidCli(() => AppModule.forRoot());\n */\nexport async function bootstrapSolidCli(\n appModuleFactory: () => Promise<any>,\n): Promise<void> {\n registerGlobalProcessHandlers();\n\n process.on('exit', (code) => {\n if (code !== 0) {\n console.error(`Exiting with error status code: ${code}`);\n }\n });\n\n // Validate that cwd is a valid Solid API project\n const packageJsonPath = resolve(process.cwd(), 'package.json');\n if (!existsSync(packageJsonPath)) {\n console.error('Does not seem to be a valid solid-api project.');\n console.error('Exit reason: missing package.json in the current directory.');\n process.exit(1);\n }\n\n // Strip --verbose / -v before nest-commander processes argv\n const showLogs = process.argv.includes('--verbose') || process.argv.includes('-v');\n for (const flag of ['--verbose', '-v']) {\n const idx = process.argv.indexOf(flag);\n if (idx !== -1) process.argv.splice(idx, 1);\n }\n\n const appModule = await appModuleFactory();\n process.env.SOLID_CLI_RUNNING = 'true';\n\n // @ts-ignore\n const app = await CommandFactory.createWithoutRunning(appModule, {\n logger: showLogs ? ['debug', 'error', 'fatal', 'log', 'verbose', 'warn'] : false,\n });\n\n try {\n await CommandFactory.runApplication(app);\n } catch (e) {\n console.error('CLI exited abruptly due to an error:', e);\n process.exit(1);\n }\n\n process.exit(0);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"bootstrap.helper.js","sourceRoot":"","sources":["../../src/helpers/bootstrap.helper.ts"],"names":[],"mappings":";;;;;AAmGA,8CA0JC;AAgBD,8CA8CC;AA3TD,2CAA4E;AAC5E,uCAAsD;AAEtD,qDAAgD;AAChD,6CAAiE;AAEjE,oDAA4B;AAC5B,4CAAoB;AACpB,2BAAgC;AAChC,+BAA+B;AAC/B,+CAA2E;AAC3E,mDAAgD;AAChD,sDAA8D;AAC9D,yFAAoF;AACpF,+CAAwD;AACxD,uDAK2B;AAC3B,6DAAuD;AAIvD,SA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IAAI,GAAG,KAAK,CAAC,CAAC;YAAE,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;IAC9C,CAAC;IAED,IAAI,CAAC;QACH,MAAM,SAAS,GAAG,MAAM,gBAAgB,EAAE,CAAC;QAC3C,OAAO,CAAC,GAAG,CAAC,iBAAiB,GAAG,MAAM,CAAC;QAGvC,MAAM,GAAG,GAAG,MAAM,+BAAc,CAAC,oBAAoB,CAAC,SAAS,EAAE;YAK/D,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC;SAC9F,CAAC,CAAC;QAEH,MAAM,+BAAc,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;IAC3C,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,OAAO,CAAC,KAAK,CAAC,sCAAsC,EAAE,CAAC,CAAC,CAAC;QACzD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC","sourcesContent":["import { ClassSerializerInterceptor, ValidationPipe } from '@nestjs/common';\nimport { NestFactory, Reflector } from '@nestjs/core';\nimport { NestExpressApplication } from '@nestjs/platform-express';\nimport { WsAdapter } from '@nestjs/platform-ws';\nimport { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';\nimport { NextFunction, Request, Response } from 'express';\nimport helmet from 'helmet';\nimport qs from 'qs';\nimport { existsSync } from 'fs';\nimport { resolve } from 'path';\nimport { WINSTON_MODULE_NEST_PROVIDER, WinstonModule } from 'nest-winston';\nimport { CommandFactory } from 'nest-commander';\nimport { createWinstonLoggerConfig } from '../winston.logger';\nimport { WrapResponseInterceptor } from '../interceptors/wrap-response.interceptor';\nimport { buildDefaultCorsOptions } from './cors.helper';\nimport {\n buildDefaultSecurityHeaderOptions,\n buildPermissionsPolicyHeader,\n PermissionsPolicyConfig,\n SolidSecurityOptions,\n} from './security.helper';\nimport { parseBooleanEnv } from './environment.helper';\n\n// ---- Shared process handlers ----\n\nfunction registerGlobalProcessHandlers() {\n process.on('unhandledRejection', (reason, promise) => {\n console.error('Unhandled Rejection at:', promise, 'reason:', reason);\n });\n\n process.on('uncaughtException', (err) => {\n console.error('Uncaught Exception thrown:', err);\n });\n\n // Suppress pg deprecation warning caused by TypeORM's internal query scheduling\n process.on('warning', (warning) => {\n if (warning.name === 'DeprecationWarning' && (warning.message.includes('client.query()') || warning.message.includes('punycode'))) {\n return;\n }\n console.warn(warning);\n });\n}\n\n// ---- HTTP server bootstrap ----\n\nexport interface SolidSwaggerOptions {\n title?: string;\n description?: string;\n version?: string;\n}\n\nexport interface SolidBootstrapOptions {\n /** Global API prefix. Defaults to 'api'. Set to '' to disable. */\n globalPrefix?: string;\n /** Swagger configuration. Set to false to disable Swagger entirely. */\n swagger?: SolidSwaggerOptions | false;\n /** Permissions-Policy header overrides (merged with defaults). */\n permissionsPolicyOverrides?: Partial<PermissionsPolicyConfig>;\n /** Security header overrides, including iframe frame-ancestor allowlists. */\n security?: SolidSecurityOptions;\n /** Show full NestJS init logs during bootstrap (route mapping, module deps, pollers). Defaults to false. */\n verboseBootstrap?: boolean;\n /**\n * Max request body size for JSON and urlencoded payloads, as a `bytes`-compatible\n * string (e.g. '10mb', '512kb'). Defaults to '10mb'.\n *\n * Does NOT apply to multipart/form-data uploads: body-parser matches on Content-Type,\n * so multipart requests skip these parsers entirely and are handled by Multer. Raise\n * this only for large structured JSON (e.g. /bulk arrays), bearing in mind the parsed\n * object graph can retain several times the raw byte size.\n */\n bodyLimit?: string;\n /**\n * When true, the original request bytes are captured onto `request.rawBody` (a `Buffer`)\n * alongside the normal parsed `request.body`, for JSON and urlencoded requests. Needed to verify\n * a webhook's HMAC signature (GitHub, GitLab, Stripe, ...): the signature is computed over the\n * exact bytes the sender transmitted, and `JSON.stringify(request.body)` is not guaranteed to\n * reproduce them byte-for-byte (key order, numeric formatting, unicode escaping can all differ).\n *\n * Defaults to false — capturing every request body a second time has a real memory cost at scale,\n * and only a route that actually verifies a signature needs it. Opt in per application, not per\n * route: NestJS wires this at `NestFactory.create()` time, before any route exists to opt out.\n */\n captureRawBody?: boolean;\n}\n\n/**\n * Bootstraps a SolidX NestJS HTTP application with sensible defaults:\n * security headers, CORS, Winston logger, ValidationPipe,\n * WrapResponseInterceptor, qs deep query parsing, Swagger, and the\n * pg BIGINT type parser.\n *\n * @example\n * // main.ts\n * bootstrapSolidApp(() => AppModule.forRoot(), {\n * swagger: { title: 'My API', description: 'My API description' },\n * security: { frameAncestors: [\"'self'\", 'https://portal.example.com'] },\n * });\n */\nexport async function bootstrapSolidApp(\n appModuleFactory: () => Promise<any>,\n options: SolidBootstrapOptions = {},\n): Promise<NestExpressApplication> {\n registerGlobalProcessHandlers();\n\n const {\n globalPrefix = 'api',\n swagger = {},\n permissionsPolicyOverrides = {},\n security = {},\n verboseBootstrap = false,\n bodyLimit = '10mb',\n captureRawBody = false,\n } = options;\n\n const startTime = Date.now();\n const appModule = await appModuleFactory();\n const app = await NestFactory.create<NestExpressApplication>(appModule, {\n // Nest's default parsers are registered during init() with a 100kb limit, ahead of\n // any module middleware. Disable them so the parsers below own the limit outright.\n bodyParser: false,\n // Raw-body capture is threaded through by NestApplication.useBodyParser() from THIS option —\n // not from any argument passed to the useBodyParser() calls below. It must be requested here,\n // at creation time, or request.rawBody is never populated no matter how useBodyParser is called\n // later (verified against the installed @nestjs/core: NestApplication#useBodyParser reads\n // `this.appOptions.rawBody` itself and ignores any rawBody-shaped argument a caller supplies).\n rawBody: captureRawBody,\n logger: WinstonModule.createLogger({ ...createWinstonLoggerConfig(), level: verboseBootstrap ? 'debug' : 'error' }),\n });\n\n const apiEnabled = parseBooleanEnv('API_ENABLED', true);\n\n if (!apiEnabled) {\n await app.init();\n app\n .get(WINSTON_MODULE_NEST_PROVIDER)\n .log('API server disabled via API_ENABLED=false. Skipping HTTP listen.', 'Bootstrap');\n return app;\n }\n\n // Health check at root path\n const server = app.getHttpAdapter().getInstance();\n server.get('/', (_req, res) => res.status(200).send('SOLID OK'));\n\n // Security headers\n app.use(helmet(buildDefaultSecurityHeaderOptions(security)));\n\n // Nest's Swagger UI HTML injects inline styles; keep CSP strict elsewhere.\n const isSwaggerPath = (path: string) =>\n path === '/docs' ||\n path === '/docs/' ||\n path.startsWith('/docs/') ||\n path === '/docs-json' ||\n path === '/docs-yaml';\n\n app.use((req: Request, res: Response, next: NextFunction) => {\n if (isSwaggerPath(req.path)) {\n res.removeHeader('Content-Security-Policy');\n }\n next();\n });\n\n // Permissions-Policy header\n app.use((_req: Request, res: Response, next: NextFunction) => {\n res.setHeader('Permissions-Policy', buildPermissionsPolicyHeader(permissionsPolicyOverrides));\n next();\n });\n\n const port = process.env.PORT || 3000;\n\n if (globalPrefix) {\n app.setGlobalPrefix(globalPrefix);\n }\n\n // qs-based deep query parsing (dot notation, nested objects, arrays)\n app.use((req: Request, _res: Response, next: NextFunction) => {\n if (req.query) {\n req.query = qs.parse(req.url.split('?')[1], {\n allowDots: true,\n depth: 20,\n arrayLimit: 100,\n });\n }\n next();\n });\n\n // Body parsers — replaces Nest's default 100kb parsers (disabled via bodyParser: false).\n // Registered here so the middleware order Nest applied by default is preserved:\n // helmet -> CSP -> Permissions-Policy -> qs -> body parsers -> routes.\n app.useBodyParser('json', { limit: bodyLimit });\n app.useBodyParser('urlencoded', { limit: bodyLimit, extended: true });\n\n // Global ValidationPipe\n app.useGlobalPipes(\n new ValidationPipe({\n transform: true,\n transformOptions: { enableImplicitConversion: true },\n }),\n );\n\n // Swagger\n if (swagger !== false) {\n const { title = process.env.SOLID_APP_NAME, description = process.env.SOLID_APP_DESCRIPTION, version = '1.0' } = swagger;\n const swaggerConfig = new DocumentBuilder()\n .setTitle(title)\n .setDescription(description)\n .setVersion(version)\n .setExternalDoc('Postman Collection', '/docs-json')\n .addBearerAuth(\n {\n description: 'Please enter token in following format: Bearer <JWT>',\n name: 'Authorization',\n bearerFormat: 'Bearer',\n scheme: 'Bearer',\n type: 'http',\n in: 'Header',\n },\n 'jwt',\n )\n .build();\n const document = SwaggerModule.createDocument(app, swaggerConfig);\n SwaggerModule.setup('/docs', app, document);\n }\n\n // Global interceptor\n app.useGlobalInterceptors(\n new ClassSerializerInterceptor(app.get(Reflector), {\n enableImplicitConversion: true, // optional but handy\n // groups: ['client'], // if you use groups\n }),\n new WrapResponseInterceptor()\n );\n\n // CORS\n app.enableCors(buildDefaultCorsOptions());\n\n // Fix pg returning BIGINT columns as strings\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const types = require('pg').types;\n types.setTypeParser(types.builtins.INT8, (val: string) => parseInt(val));\n\n app.useWebSocketAdapter(new WsAdapter(app));\n\n await app.listen(port);\n\n // Wire up Winston as the runtime logger only AFTER listen — this suppresses all\n // framework init noise (route mapping, module deps, onModuleInit) during boot.\n app.useLogger(app.get(WINSTON_MODULE_NEST_PROVIDER));\n\n const elapsed = ((Date.now() - startTime) / 1000).toFixed(2);\n process.stdout.write(`\\x1b[32mServer started on port ${port} in ${elapsed}s\\x1b[0m\\n`);\n\n return app;\n}\n\n// ---- CLI bootstrap ----\n\n/**\n * Bootstraps a SolidX NestJS CLI application using nest-commander.\n * Handles verbose flag stripping, project root validation, and clean process exit.\n *\n * @example\n * // main-cli.ts\n * #!/usr/bin/env node\n * import { bootstrapSolidCli } from '@solidxai/core';\n * import { AppModule } from './app.module';\n *\n * bootstrapSolidCli(() => AppModule.forRoot());\n */\nexport async function bootstrapSolidCli(\n appModuleFactory: () => Promise<any>,\n): Promise<void> {\n registerGlobalProcessHandlers();\n\n process.on('exit', (code) => {\n if (code !== 0) {\n console.error(`Exiting with error status code: ${code}`);\n }\n });\n\n // Validate that cwd is a valid Solid API project\n const packageJsonPath = resolve(process.cwd(), 'package.json');\n if (!existsSync(packageJsonPath)) {\n console.error('Does not seem to be a valid solid-api project.');\n console.error('Exit reason: missing package.json in the current directory.');\n process.exit(1);\n }\n\n // Strip --verbose / -v before nest-commander processes argv\n const showLogs = process.argv.includes('--verbose') || process.argv.includes('-v');\n for (const flag of ['--verbose', '-v']) {\n const idx = process.argv.indexOf(flag);\n if (idx !== -1) process.argv.splice(idx, 1);\n }\n\n try {\n const appModule = await appModuleFactory();\n process.env.SOLID_CLI_RUNNING = 'true';\n\n // @ts-ignore\n const app = await CommandFactory.createWithoutRunning(appModule, {\n // Keep normal CLI runs quiet, but never hide errors. Seeders and other CLI\n // commands often catch domain/database errors and report them through the\n // Nest logger; disabling the logger entirely would leave the wrapper with\n // only the generic non-zero exit status.\n logger: showLogs ? ['debug', 'error', 'fatal', 'log', 'verbose', 'warn'] : ['error', 'fatal'],\n });\n\n await CommandFactory.runApplication(app);\n } catch (e) {\n console.error('CLI exited abruptly due to an error:', e);\n process.exit(1);\n }\n\n process.exit(0);\n}\n"]}
|
|
@@ -8000,6 +8000,7 @@
|
|
|
8000
8000
|
"ViewMetadataController.findOne",
|
|
8001
8001
|
"ActionMetadataController.findMany",
|
|
8002
8002
|
"ActionMetadataController.findOne",
|
|
8003
|
+
"UserViewMetadataController.create",
|
|
8003
8004
|
"UserViewMetadataController.upsert",
|
|
8004
8005
|
"UserViewMetadataController.findMany",
|
|
8005
8006
|
"UserViewMetadataController.findOne",
|
package/dist/services/dashboard-providers/mq-dashboard-recent-failures-provider.service.d.ts
CHANGED
|
@@ -1,10 +1,30 @@
|
|
|
1
1
|
import { MqMessageRepository } from "../../repository/mq-message.repository";
|
|
2
2
|
import { IDashboardWidgetDataProvider, IDashboardWidgetDataProviderContext, IDashboardWidgetDataResponseEnvelope } from "../../interfaces";
|
|
3
|
+
type RecentFailureRecord = {
|
|
4
|
+
id: any;
|
|
5
|
+
messageId: any;
|
|
6
|
+
queueName: any;
|
|
7
|
+
stage: any;
|
|
8
|
+
retryCount: any;
|
|
9
|
+
elapsedMillis: any;
|
|
10
|
+
startedAt: any;
|
|
11
|
+
finishedAt: any;
|
|
12
|
+
error: any;
|
|
13
|
+
createdAt: any;
|
|
14
|
+
};
|
|
15
|
+
type TableColumn = {
|
|
16
|
+
field: keyof RecentFailureRecord;
|
|
17
|
+
header: string;
|
|
18
|
+
};
|
|
3
19
|
export declare class MqDashboardRecentFailuresProvider implements IDashboardWidgetDataProvider {
|
|
4
20
|
private readonly mqMessageRepository;
|
|
5
21
|
constructor(mqMessageRepository: MqMessageRepository);
|
|
6
22
|
name(): string;
|
|
7
23
|
help(): string;
|
|
8
|
-
getData(widgetDefinition: Record<string, any>, ctxt: IDashboardWidgetDataProviderContext): Promise<IDashboardWidgetDataResponseEnvelope<
|
|
24
|
+
getData(widgetDefinition: Record<string, any>, ctxt: IDashboardWidgetDataProviderContext): Promise<IDashboardWidgetDataResponseEnvelope<{
|
|
25
|
+
columns: TableColumn[];
|
|
26
|
+
records: RecentFailureRecord[];
|
|
27
|
+
}>>;
|
|
9
28
|
}
|
|
29
|
+
export {};
|
|
10
30
|
//# sourceMappingURL=mq-dashboard-recent-failures-provider.service.d.ts.map
|
package/dist/services/dashboard-providers/mq-dashboard-recent-failures-provider.service.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mq-dashboard-recent-failures-provider.service.d.ts","sourceRoot":"","sources":["../../../src/services/dashboard-providers/mq-dashboard-recent-failures-provider.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAC3E,OAAO,EAAE,4BAA4B,EAAE,mCAAmC,EAAE,oCAAoC,EAAE,MAAM,gBAAgB,CAAC;AAGzI,qBAEa,iCAAkC,YAAW,4BAA4B;IAE9E,OAAO,CAAC,QAAQ,CAAC,mBAAmB;gBAAnB,mBAAmB,EAAE,mBAAmB;IAG7D,IAAI,IAAI,MAAM;IAId,IAAI,IAAI,MAAM;IAIR,OAAO,CACT,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACrC,IAAI,EAAE,mCAAmC,GAC1C,OAAO,CAAC,oCAAoC,CAAC,
|
|
1
|
+
{"version":3,"file":"mq-dashboard-recent-failures-provider.service.d.ts","sourceRoot":"","sources":["../../../src/services/dashboard-providers/mq-dashboard-recent-failures-provider.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAC3E,OAAO,EAAE,4BAA4B,EAAE,mCAAmC,EAAE,oCAAoC,EAAE,MAAM,gBAAgB,CAAC;AAGzI,KAAK,mBAAmB,GAAG;IACvB,EAAE,EAAE,GAAG,CAAC;IACR,SAAS,EAAE,GAAG,CAAC;IACf,SAAS,EAAE,GAAG,CAAC;IACf,KAAK,EAAE,GAAG,CAAC;IACX,UAAU,EAAE,GAAG,CAAC;IAChB,aAAa,EAAE,GAAG,CAAC;IACnB,SAAS,EAAE,GAAG,CAAC;IACf,UAAU,EAAE,GAAG,CAAC;IAChB,KAAK,EAAE,GAAG,CAAC;IACX,SAAS,EAAE,GAAG,CAAC;CAClB,CAAC;AAEF,KAAK,WAAW,GAAG;IACf,KAAK,EAAE,MAAM,mBAAmB,CAAC;IACjC,MAAM,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,qBAEa,iCAAkC,YAAW,4BAA4B;IAE9E,OAAO,CAAC,QAAQ,CAAC,mBAAmB;gBAAnB,mBAAmB,EAAE,mBAAmB;IAG7D,IAAI,IAAI,MAAM;IAId,IAAI,IAAI,MAAM;IAIR,OAAO,CACT,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACrC,IAAI,EAAE,mCAAmC,GAC1C,OAAO,CAAC,oCAAoC,CAAC;QAAE,OAAO,EAAE,WAAW,EAAE,CAAC;QAAC,OAAO,EAAE,mBAAmB,EAAE,CAAA;KAAE,CAAC,CAAC;CAgE/G"}
|
|
@@ -47,16 +47,16 @@ let MqDashboardRecentFailuresProvider = class MqDashboardRecentFailuresProvider
|
|
|
47
47
|
.take(limit)
|
|
48
48
|
.getRawMany();
|
|
49
49
|
const columns = [
|
|
50
|
-
"id",
|
|
51
|
-
"messageId",
|
|
52
|
-
"queueName",
|
|
53
|
-
"stage",
|
|
54
|
-
"retryCount",
|
|
55
|
-
"elapsedMillis",
|
|
56
|
-
"startedAt",
|
|
57
|
-
"finishedAt",
|
|
58
|
-
"error",
|
|
59
|
-
"createdAt",
|
|
50
|
+
{ field: "id", header: "ID" },
|
|
51
|
+
{ field: "messageId", header: "Message ID" },
|
|
52
|
+
{ field: "queueName", header: "Queue Name" },
|
|
53
|
+
{ field: "stage", header: "Stage" },
|
|
54
|
+
{ field: "retryCount", header: "Retry Count" },
|
|
55
|
+
{ field: "elapsedMillis", header: "Elapsed Millis" },
|
|
56
|
+
{ field: "startedAt", header: "Started At" },
|
|
57
|
+
{ field: "finishedAt", header: "Finished At" },
|
|
58
|
+
{ field: "error", header: "Error" },
|
|
59
|
+
{ field: "createdAt", header: "Created At" },
|
|
60
60
|
];
|
|
61
61
|
const records = rows.map((row) => ({
|
|
62
62
|
id: row.id ?? null,
|
package/dist/services/dashboard-providers/mq-dashboard-recent-failures-provider.service.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mq-dashboard-recent-failures-provider.service.js","sourceRoot":"","sources":["../../../src/services/dashboard-providers/mq-dashboard-recent-failures-provider.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,wHAAsG;AACtG,kFAA2E;AAE3E,+EAAuG;
|
|
1
|
+
{"version":3,"file":"mq-dashboard-recent-failures-provider.service.js","sourceRoot":"","sources":["../../../src/services/dashboard-providers/mq-dashboard-recent-failures-provider.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,wHAAsG;AACtG,kFAA2E;AAE3E,+EAAuG;AAsBhG,IAAM,iCAAiC,GAAvC,MAAM,iCAAiC;IAC1C,YACqB,mBA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AI,IAAI,EAAE,cAAc,CAAC;YACxD,SAAS,EAAE,GAAG,CAAC,SAAS,IAAI,GAAG,CAAC,SAAS,IAAI,IAAI;SACpD,CAAC,CAAC,CAAC;QAEJ,OAAO;YACH,IAAI,EAAE;gBACF,YAAY,EAAE,IAAI,CAAC,IAAI,EAAE;gBACzB,WAAW,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;gBACrC,UAAU,EAAE,IAAI,CAAC,UAAU;gBAC3B,UAAU,EAAE,CAAC;aAChB;YACD,IAAI,EAAE;gBACF,OAAO;gBACP,OAAO;aACV;SACJ,CAAC;IACN,CAAC;CACJ,CAAA;AAhFY,8EAAiC;4CAAjC,iCAAiC;IAF7C,IAAA,sEAA2B,GAAE;IAC7B,IAAA,mBAAU,GAAE;qCAGiC,2CAAmB;GAFpD,iCAAiC,CAgF7C;AAED,SAAS,cAAc,CAAC,KAAU,EAAE,SAAiB;IACjD,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IACtD,IAAI,SAAS,IAAI,CAAC,IAAI,KAAK,CAAC,MAAM,IAAI,SAAS;QAAE,OAAO,KAAK,CAAC;IAC9D,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC,KAAK,CAAC;AAC7C,CAAC","sourcesContent":["import { Injectable } from \"@nestjs/common\";\nimport { DashboardWidgetDataProvider } from \"src/decorators/dashboard-widget-data-provider.decorator\";\nimport { MqMessageRepository } from \"src/repository/mq-message.repository\";\nimport { IDashboardWidgetDataProvider, IDashboardWidgetDataProviderContext, IDashboardWidgetDataResponseEnvelope } from \"src/interfaces\";\nimport { applyMqDashboardFilters } from \"src/services/dashboard-providers/mq-dashboard-provider-utils\";\n\ntype RecentFailureRecord = {\n id: any;\n messageId: any;\n queueName: any;\n stage: any;\n retryCount: any;\n elapsedMillis: any;\n startedAt: any;\n finishedAt: any;\n error: any;\n createdAt: any;\n};\n\ntype TableColumn = {\n field: keyof RecentFailureRecord;\n header: string;\n};\n\n@DashboardWidgetDataProvider()\n@Injectable()\nexport class MqDashboardRecentFailuresProvider implements IDashboardWidgetDataProvider {\n constructor(\n private readonly mqMessageRepository: MqMessageRepository,\n ) { }\n\n name(): string {\n return \"MqDashboardRecentFailuresProvider\";\n }\n\n help(): string {\n return \"Returns recent failed mq messages in a tabular payload after applying dashboard variables.\";\n }\n\n async getData(\n widgetDefinition: Record<string, any>,\n ctxt: IDashboardWidgetDataProviderContext,\n ): Promise<IDashboardWidgetDataResponseEnvelope<{ columns: TableColumn[]; records: RecentFailureRecord[] }>> {\n const limit = Math.min(Math.max(Number(ctxt?.providerContext?.limit ?? 25), 1), 200);\n const errorMaxLength = Math.max(Number(ctxt?.providerContext?.errorMaxLength ?? 160), 0);\n\n const qb = await this.mqMessageRepository.createSecurityRuleAwareQueryBuilder(\"mqMessage\");\n applyMqDashboardFilters(qb, ctxt.variables ?? {}, { ignoreStage: true, ensureQueueJoin: true });\n qb.andWhere(\"mqMessage.stage = :failedStage\", { failedStage: \"failed\" });\n\n const rows = await qb\n .select([\n \"mqMessage.id AS id\",\n \"mqMessage.messageId AS messageId\",\n \"mqMessageQueue.name AS queueName\",\n \"mqMessage.stage AS stage\",\n \"mqMessage.retryCount AS retryCount\",\n \"mqMessage.elapsedMillis AS elapsedMillis\",\n \"mqMessage.startedAt AS startedAt\",\n \"mqMessage.finishedAt AS finishedAt\",\n \"mqMessage.error AS error\",\n \"mqMessage.createdAt AS createdAt\",\n ])\n .orderBy(\"mqMessage.createdAt\", \"DESC\")\n .take(limit)\n .getRawMany<Record<string, any>>();\n\n const columns: TableColumn[] = [\n { field: \"id\", header: \"ID\" },\n { field: \"messageId\", header: \"Message ID\" },\n { field: \"queueName\", header: \"Queue Name\" },\n { field: \"stage\", header: \"Stage\" },\n { field: \"retryCount\", header: \"Retry Count\" },\n { field: \"elapsedMillis\", header: \"Elapsed Millis\" },\n { field: \"startedAt\", header: \"Started At\" },\n { field: \"finishedAt\", header: \"Finished At\" },\n { field: \"error\", header: \"Error\" },\n { field: \"createdAt\", header: \"Created At\" },\n ];\n\n const records: RecentFailureRecord[] = rows.map((row) => ({\n id: row.id ?? null,\n messageId: row.messageId ?? row.messageid ?? null,\n queueName: row.queueName ?? row.queuename ?? null,\n stage: row.stage ?? null,\n retryCount: row.retryCount ?? row.retrycount ?? null,\n elapsedMillis: row.elapsedMillis ?? row.elapsedmillis ?? null,\n startedAt: row.startedAt ?? row.startedat ?? null,\n finishedAt: row.finishedAt ?? row.finishedat ?? null,\n error: truncateString(row.error ?? null, errorMaxLength),\n createdAt: row.createdAt ?? row.createdat ?? null,\n }));\n\n return {\n meta: {\n providerName: this.name(),\n generatedAt: new Date().toISOString(),\n widgetName: ctxt.widgetName,\n durationMs: 0,\n },\n data: {\n columns,\n records,\n },\n };\n }\n}\n\nfunction truncateString(value: any, maxLength: number): any {\n if (!value || typeof value !== 'string') return value;\n if (maxLength <= 0 || value.length <= maxLength) return value;\n return `${value.slice(0, maxLength)}...`;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solidxai/core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.19-beta.1",
|
|
4
4
|
"description": "This module is a NestJS module containing all the required core providers required by a Solid application",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -8,6 +8,7 @@ interface SeedCommandOptions {
|
|
|
8
8
|
modulesToSeed?: string;
|
|
9
9
|
prune?: boolean;
|
|
10
10
|
skipHooks?: boolean;
|
|
11
|
+
verbose?: boolean;
|
|
11
12
|
}
|
|
12
13
|
|
|
13
14
|
@Command({ name: 'seed', description: 'Install seed data for a given module' })
|
|
@@ -63,8 +64,7 @@ export class SeedCommand extends CommandRunner {
|
|
|
63
64
|
.map((seeder) => seeder.instance)
|
|
64
65
|
.pop();
|
|
65
66
|
if (!seeder) {
|
|
66
|
-
|
|
67
|
-
return;
|
|
67
|
+
throw new Error(`Seeder service ${options.seeder} not found. Does your service have a seed() method?`);
|
|
68
68
|
}
|
|
69
69
|
this.logger.log(`Running the seed() method for seeder: ${seeder.constructor.name}`);
|
|
70
70
|
await seeder.seed(parsedConf);
|
|
@@ -93,4 +93,9 @@ export class SeedCommand extends CommandRunner {
|
|
|
93
93
|
parseSkipHooks(): boolean {
|
|
94
94
|
return true;
|
|
95
95
|
}
|
|
96
|
+
|
|
97
|
+
@Option({ flags: '-v, --verbose', description: 'Show detailed Nest/Winston logs during seeding.' })
|
|
98
|
+
parseVerbose(): boolean {
|
|
99
|
+
return true;
|
|
100
|
+
}
|
|
96
101
|
}
|
|
@@ -70,6 +70,18 @@ export interface SolidBootstrapOptions {
|
|
|
70
70
|
* object graph can retain several times the raw byte size.
|
|
71
71
|
*/
|
|
72
72
|
bodyLimit?: string;
|
|
73
|
+
/**
|
|
74
|
+
* When true, the original request bytes are captured onto `request.rawBody` (a `Buffer`)
|
|
75
|
+
* alongside the normal parsed `request.body`, for JSON and urlencoded requests. Needed to verify
|
|
76
|
+
* a webhook's HMAC signature (GitHub, GitLab, Stripe, ...): the signature is computed over the
|
|
77
|
+
* exact bytes the sender transmitted, and `JSON.stringify(request.body)` is not guaranteed to
|
|
78
|
+
* reproduce them byte-for-byte (key order, numeric formatting, unicode escaping can all differ).
|
|
79
|
+
*
|
|
80
|
+
* Defaults to false — capturing every request body a second time has a real memory cost at scale,
|
|
81
|
+
* and only a route that actually verifies a signature needs it. Opt in per application, not per
|
|
82
|
+
* route: NestJS wires this at `NestFactory.create()` time, before any route exists to opt out.
|
|
83
|
+
*/
|
|
84
|
+
captureRawBody?: boolean;
|
|
73
85
|
}
|
|
74
86
|
|
|
75
87
|
/**
|
|
@@ -98,6 +110,7 @@ export async function bootstrapSolidApp(
|
|
|
98
110
|
security = {},
|
|
99
111
|
verboseBootstrap = false,
|
|
100
112
|
bodyLimit = '10mb',
|
|
113
|
+
captureRawBody = false,
|
|
101
114
|
} = options;
|
|
102
115
|
|
|
103
116
|
const startTime = Date.now();
|
|
@@ -106,6 +119,12 @@ export async function bootstrapSolidApp(
|
|
|
106
119
|
// Nest's default parsers are registered during init() with a 100kb limit, ahead of
|
|
107
120
|
// any module middleware. Disable them so the parsers below own the limit outright.
|
|
108
121
|
bodyParser: false,
|
|
122
|
+
// Raw-body capture is threaded through by NestApplication.useBodyParser() from THIS option —
|
|
123
|
+
// not from any argument passed to the useBodyParser() calls below. It must be requested here,
|
|
124
|
+
// at creation time, or request.rawBody is never populated no matter how useBodyParser is called
|
|
125
|
+
// later (verified against the installed @nestjs/core: NestApplication#useBodyParser reads
|
|
126
|
+
// `this.appOptions.rawBody` itself and ignores any rawBody-shaped argument a caller supplies).
|
|
127
|
+
rawBody: captureRawBody,
|
|
109
128
|
logger: WinstonModule.createLogger({ ...createWinstonLoggerConfig(), level: verboseBootstrap ? 'debug' : 'error' }),
|
|
110
129
|
});
|
|
111
130
|
|
|
@@ -274,15 +293,19 @@ export async function bootstrapSolidCli(
|
|
|
274
293
|
if (idx !== -1) process.argv.splice(idx, 1);
|
|
275
294
|
}
|
|
276
295
|
|
|
277
|
-
const appModule = await appModuleFactory();
|
|
278
|
-
process.env.SOLID_CLI_RUNNING = 'true';
|
|
279
|
-
|
|
280
|
-
// @ts-ignore
|
|
281
|
-
const app = await CommandFactory.createWithoutRunning(appModule, {
|
|
282
|
-
logger: showLogs ? ['debug', 'error', 'fatal', 'log', 'verbose', 'warn'] : false,
|
|
283
|
-
});
|
|
284
|
-
|
|
285
296
|
try {
|
|
297
|
+
const appModule = await appModuleFactory();
|
|
298
|
+
process.env.SOLID_CLI_RUNNING = 'true';
|
|
299
|
+
|
|
300
|
+
// @ts-ignore
|
|
301
|
+
const app = await CommandFactory.createWithoutRunning(appModule, {
|
|
302
|
+
// Keep normal CLI runs quiet, but never hide errors. Seeders and other CLI
|
|
303
|
+
// commands often catch domain/database errors and report them through the
|
|
304
|
+
// Nest logger; disabling the logger entirely would leave the wrapper with
|
|
305
|
+
// only the generic non-zero exit status.
|
|
306
|
+
logger: showLogs ? ['debug', 'error', 'fatal', 'log', 'verbose', 'warn'] : ['error', 'fatal'],
|
|
307
|
+
});
|
|
308
|
+
|
|
286
309
|
await CommandFactory.runApplication(app);
|
|
287
310
|
} catch (e) {
|
|
288
311
|
console.error('CLI exited abruptly due to an error:', e);
|
|
@@ -8000,6 +8000,7 @@
|
|
|
8000
8000
|
"ViewMetadataController.findOne",
|
|
8001
8001
|
"ActionMetadataController.findMany",
|
|
8002
8002
|
"ActionMetadataController.findOne",
|
|
8003
|
+
"UserViewMetadataController.create",
|
|
8003
8004
|
"UserViewMetadataController.upsert",
|
|
8004
8005
|
"UserViewMetadataController.findMany",
|
|
8005
8006
|
"UserViewMetadataController.findOne",
|
|
@@ -4,6 +4,24 @@ import { MqMessageRepository } from "src/repository/mq-message.repository";
|
|
|
4
4
|
import { IDashboardWidgetDataProvider, IDashboardWidgetDataProviderContext, IDashboardWidgetDataResponseEnvelope } from "src/interfaces";
|
|
5
5
|
import { applyMqDashboardFilters } from "src/services/dashboard-providers/mq-dashboard-provider-utils";
|
|
6
6
|
|
|
7
|
+
type RecentFailureRecord = {
|
|
8
|
+
id: any;
|
|
9
|
+
messageId: any;
|
|
10
|
+
queueName: any;
|
|
11
|
+
stage: any;
|
|
12
|
+
retryCount: any;
|
|
13
|
+
elapsedMillis: any;
|
|
14
|
+
startedAt: any;
|
|
15
|
+
finishedAt: any;
|
|
16
|
+
error: any;
|
|
17
|
+
createdAt: any;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
type TableColumn = {
|
|
21
|
+
field: keyof RecentFailureRecord;
|
|
22
|
+
header: string;
|
|
23
|
+
};
|
|
24
|
+
|
|
7
25
|
@DashboardWidgetDataProvider()
|
|
8
26
|
@Injectable()
|
|
9
27
|
export class MqDashboardRecentFailuresProvider implements IDashboardWidgetDataProvider {
|
|
@@ -22,7 +40,7 @@ export class MqDashboardRecentFailuresProvider implements IDashboardWidgetDataPr
|
|
|
22
40
|
async getData(
|
|
23
41
|
widgetDefinition: Record<string, any>,
|
|
24
42
|
ctxt: IDashboardWidgetDataProviderContext,
|
|
25
|
-
): Promise<IDashboardWidgetDataResponseEnvelope<
|
|
43
|
+
): Promise<IDashboardWidgetDataResponseEnvelope<{ columns: TableColumn[]; records: RecentFailureRecord[] }>> {
|
|
26
44
|
const limit = Math.min(Math.max(Number(ctxt?.providerContext?.limit ?? 25), 1), 200);
|
|
27
45
|
const errorMaxLength = Math.max(Number(ctxt?.providerContext?.errorMaxLength ?? 160), 0);
|
|
28
46
|
|
|
@@ -47,20 +65,20 @@ export class MqDashboardRecentFailuresProvider implements IDashboardWidgetDataPr
|
|
|
47
65
|
.take(limit)
|
|
48
66
|
.getRawMany<Record<string, any>>();
|
|
49
67
|
|
|
50
|
-
const columns = [
|
|
51
|
-
"id",
|
|
52
|
-
"messageId",
|
|
53
|
-
"queueName",
|
|
54
|
-
"stage",
|
|
55
|
-
"retryCount",
|
|
56
|
-
"elapsedMillis",
|
|
57
|
-
"startedAt",
|
|
58
|
-
"finishedAt",
|
|
59
|
-
"error",
|
|
60
|
-
"createdAt",
|
|
68
|
+
const columns: TableColumn[] = [
|
|
69
|
+
{ field: "id", header: "ID" },
|
|
70
|
+
{ field: "messageId", header: "Message ID" },
|
|
71
|
+
{ field: "queueName", header: "Queue Name" },
|
|
72
|
+
{ field: "stage", header: "Stage" },
|
|
73
|
+
{ field: "retryCount", header: "Retry Count" },
|
|
74
|
+
{ field: "elapsedMillis", header: "Elapsed Millis" },
|
|
75
|
+
{ field: "startedAt", header: "Started At" },
|
|
76
|
+
{ field: "finishedAt", header: "Finished At" },
|
|
77
|
+
{ field: "error", header: "Error" },
|
|
78
|
+
{ field: "createdAt", header: "Created At" },
|
|
61
79
|
];
|
|
62
80
|
|
|
63
|
-
const records = rows.map((row) => ({
|
|
81
|
+
const records: RecentFailureRecord[] = rows.map((row) => ({
|
|
64
82
|
id: row.id ?? null,
|
|
65
83
|
messageId: row.messageId ?? row.messageid ?? null,
|
|
66
84
|
queueName: row.queueName ?? row.queuename ?? null,
|