@solidxai/core 0.1.10-beta.11 → 0.1.10-beta.14
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/commands/refresh-model.command.d.ts +1 -3
- package/dist/commands/refresh-model.command.d.ts.map +1 -1
- package/dist/commands/refresh-model.command.js +4 -17
- package/dist/commands/refresh-model.command.js.map +1 -1
- package/dist/commands/refresh-module.command.d.ts +0 -2
- package/dist/commands/refresh-module.command.d.ts.map +1 -1
- package/dist/commands/refresh-module.command.js +3 -16
- package/dist/commands/refresh-module.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 +6 -3
- package/dist/helpers/bootstrap.helper.js.map +1 -1
- package/dist/services/model-metadata.service.d.ts.map +1 -1
- package/dist/services/model-metadata.service.js +2 -1
- package/dist/services/model-metadata.service.js.map +1 -1
- package/dist/services/module-metadata.service.d.ts.map +1 -1
- package/dist/services/module-metadata.service.js +2 -1
- package/dist/services/module-metadata.service.js.map +1 -1
- package/dist/winston.logger.d.ts +5 -0
- package/dist/winston.logger.d.ts.map +1 -1
- package/dist/winston.logger.js +6 -4
- package/dist/winston.logger.js.map +1 -1
- package/package.json +1 -1
- package/src/commands/refresh-model.command.ts +5 -19
- package/src/commands/refresh-module.command.ts +3 -16
- package/src/helpers/bootstrap.helper.ts +13 -6
- package/src/services/model-metadata.service.ts +2 -1
- package/src/services/module-metadata.service.ts +2 -1
- package/src/winston.logger.ts +5 -7
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { CommandRunner } from 'nest-commander';
|
|
2
2
|
import { ModelMetadataService } from '../services/model-metadata.service';
|
|
3
3
|
interface CommandOptions {
|
|
4
|
-
name
|
|
5
|
-
id?: number;
|
|
4
|
+
name: string;
|
|
6
5
|
dryRun?: boolean;
|
|
7
6
|
}
|
|
8
7
|
export declare class RefreshModelCommand extends CommandRunner {
|
|
@@ -10,7 +9,6 @@ export declare class RefreshModelCommand extends CommandRunner {
|
|
|
10
9
|
constructor(modelMetadataService: ModelMetadataService);
|
|
11
10
|
private readonly logger;
|
|
12
11
|
run(_passedParam: string[], options?: CommandOptions): Promise<void>;
|
|
13
|
-
parseId(val: string): number;
|
|
14
12
|
parseName(val: string): string;
|
|
15
13
|
parseDryRun(val: string): boolean;
|
|
16
14
|
private validate;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"refresh-model.command.d.ts","sourceRoot":"","sources":["../../src/commands/refresh-model.command.ts"],"names":[],"mappings":"AACA,OAAO,EAAW,aAAa,EAAU,MAAM,gBAAgB,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAG3E,UAAU,cAAc;IACtB,IAAI,
|
|
1
|
+
{"version":3,"file":"refresh-model.command.d.ts","sourceRoot":"","sources":["../../src/commands/refresh-model.command.ts"],"names":[],"mappings":"AACA,OAAO,EAAW,aAAa,EAAU,MAAM,gBAAgB,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAG3E,UAAU,cAAc;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,qBAIa,mBAAoB,SAAQ,aAAa;IAGlD,OAAO,CAAC,QAAQ,CAAC,oBAAoB;gBAApB,oBAAoB,EAAE,oBAAoB;IAI7D,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAwC;IAEzD,GAAG,CAAC,YAAY,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAkB1E,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAQ9B,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAKjC,OAAO,CAAC,QAAQ;CAOjB"}
|
|
@@ -31,15 +31,11 @@ let RefreshModelCommand = RefreshModelCommand_1 = class RefreshModelCommand exte
|
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
33
33
|
const codeGenerationOptions = {
|
|
34
|
-
modelId: options.id,
|
|
35
34
|
modelUserKey: options.name,
|
|
36
35
|
dryRun: options.dryRun,
|
|
37
36
|
};
|
|
38
37
|
await this.modelMetadataService.handleGenerateCode(codeGenerationOptions);
|
|
39
38
|
}
|
|
40
|
-
parseId(val) {
|
|
41
|
-
return +val;
|
|
42
|
-
}
|
|
43
39
|
parseName(val) {
|
|
44
40
|
return val;
|
|
45
41
|
}
|
|
@@ -48,8 +44,8 @@ let RefreshModelCommand = RefreshModelCommand_1 = class RefreshModelCommand exte
|
|
|
48
44
|
return (val === 'false') ? false : true;
|
|
49
45
|
}
|
|
50
46
|
validate(options) {
|
|
51
|
-
if (!options.
|
|
52
|
-
return [new helper_1.CommandError('Model
|
|
47
|
+
if (!options.name) {
|
|
48
|
+
return [new helper_1.CommandError('Model Name is required')];
|
|
53
49
|
}
|
|
54
50
|
return [];
|
|
55
51
|
}
|
|
@@ -57,17 +53,8 @@ let RefreshModelCommand = RefreshModelCommand_1 = class RefreshModelCommand exte
|
|
|
57
53
|
exports.RefreshModelCommand = RefreshModelCommand;
|
|
58
54
|
__decorate([
|
|
59
55
|
(0, nest_commander_1.Option)({
|
|
60
|
-
flags: '-
|
|
61
|
-
description: 'Model
|
|
62
|
-
}),
|
|
63
|
-
__metadata("design:type", Function),
|
|
64
|
-
__metadata("design:paramtypes", [String]),
|
|
65
|
-
__metadata("design:returntype", Number)
|
|
66
|
-
], RefreshModelCommand.prototype, "parseId", null);
|
|
67
|
-
__decorate([
|
|
68
|
-
(0, nest_commander_1.Option)({
|
|
69
|
-
flags: '-n, --name [model name]',
|
|
70
|
-
description: 'Model Name from the ss_model_metadata table',
|
|
56
|
+
flags: '-n, --name <model name>',
|
|
57
|
+
description: 'Model name (singularName) from the ss_model_metadata table',
|
|
71
58
|
}),
|
|
72
59
|
__metadata("design:type", Function),
|
|
73
60
|
__metadata("design:paramtypes", [String]),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"refresh-model.command.js","sourceRoot":"","sources":["../../src/commands/refresh-model.command.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAA4D;AAC5D,mDAAgE;AAChE,+EAA2E;AAC3E,qCAAwC;
|
|
1
|
+
{"version":3,"file":"refresh-model.command.js","sourceRoot":"","sources":["../../src/commands/refresh-model.command.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAA4D;AAC5D,mDAAgE;AAChE,+EAA2E;AAC3E,qCAAwC;AAWjC,IAAM,mBAAmB,2BAAzB,MAAM,mBAAoB,SAAQ,8BAAa;IACpD,YAEE,oBAA2D;QAE3D,KAAK,EAAE,CAAC;QAFS,yBAAoB,GAApB,oBAAoB,CAAsB;QAI5C,WAAM,GAAG,IAAI,eAAM,CAAC,qBAAmB,CAAC,IAAI,CAAC,CAAC;IAD/D,CAAC;IAGD,KAAK,CAAC,GAAG,CAAC,YAAsB,EAAE,OAAwB;QACxD,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QACtC,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;YAClB,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;YACpD,OAAO;QACT,CAAC;QAED,MAAM,qBAAqB,GAAG;YAC5B,YAAY,EAAE,OAAO,CAAC,IAAI;YAC1B,MAAM,EAAE,OAAO,CAAC,MAAM;SACvB,CAAC;QACF,MAAM,IAAI,CAAC,oBAAoB,CAAC,kBAAkB,CAAC,qBAAqB,CAAC,CAAC;IAC5E,CAAC;IAMD,SAAS,CAAC,GAAW;QACnB,OAAO,GAAG,CAAC;IACb,CAAC;IAMD,WAAW,CAAC,GAAW;QACrB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,aAAa,GAAG,EAAE,CAAC,CAAC;QACtC,OAAO,CAAC,GAAG,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;IAC1C,CAAC;IAEO,QAAQ,CAAC,OAAuB;QACtC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;YAClB,OAAO,CAAC,IAAI,qBAAY,CAAC,wBAAwB,CAAC,CAAC,CAAC;QACtD,CAAC;QACD,OAAO,EAAE,CAAC;IACZ,CAAC;CAEF,CAAA;AA/CY,kDAAmB;AA2B9B;IAJC,IAAA,uBAAM,EAAC;QACN,KAAK,EAAE,yBAAyB;QAChC,WAAW,EAAE,4DAA4D;KAC1E,CAAC;;;;oDAGD;AAMD;IAJC,IAAA,uBAAM,EAAC;QACN,KAAK,EAAE,wBAAwB;QAC/B,WAAW,EAAE,qBAAqB;KACnC,CAAC;;;;sDAID;8BAtCU,mBAAmB;IAJ/B,IAAA,wBAAO,EAAC;QACP,IAAI,EAAE,eAAe;QACrB,WAAW,EAAE,0EAA0E;KACxF,CAAC;IAGG,WAAA,IAAA,eAAM,EAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,6CAAoB,CAAC,CAAC,CAAA;qCACR,6CAAoB;GAHlD,mBAAmB,CA+C/B","sourcesContent":["import { forwardRef, Inject, Logger } from '@nestjs/common';\nimport { Command, CommandRunner, Option } from 'nest-commander';\nimport { ModelMetadataService } from 'src/services/model-metadata.service';\nimport { CommandError } from './helper';\n\ninterface CommandOptions {\n name: string;\n dryRun?: boolean;\n}\n\n@Command({\n name: 'refresh-model',\n description: 'Updates a model and its fields i.e (entity,dto,service,controller files)',\n})\nexport class RefreshModelCommand extends CommandRunner {\n constructor(\n @Inject(forwardRef(() => ModelMetadataService))\n private readonly modelMetadataService: ModelMetadataService,\n ) {\n super();\n }\n private readonly logger = new Logger(RefreshModelCommand.name);\n\n async run(_passedParam: string[], options?: CommandOptions): Promise<void> {\n const errors = this.validate(options);\n if (errors.length) {\n errors.forEach((error) => this.logger.error(error));\n return;\n }\n\n const codeGenerationOptions = {\n modelUserKey: options.name,\n dryRun: options.dryRun,\n };\n await this.modelMetadataService.handleGenerateCode(codeGenerationOptions);\n }\n\n @Option({\n flags: '-n, --name <model name>',\n description: 'Model name (singularName) from the ss_model_metadata table',\n })\n parseName(val: string): string {\n return val;\n }\n\n @Option({\n flags: '-d, --dryRun [dry run]',\n description: 'Dry run the command',\n })\n parseDryRun(val: string): boolean {\n this.logger.debug(`Dry run : ${val}`);\n return (val === 'false') ? false : true;\n }\n\n private validate(options: CommandOptions): CommandError[] {\n if (!options.name) {\n return [new CommandError('Model Name is required')];\n }\n return [];\n }\n\n}\n"]}
|
|
@@ -2,7 +2,6 @@ import { CommandRunner } from 'nest-commander';
|
|
|
2
2
|
import { ModuleMetadataService } from '../services/module-metadata.service';
|
|
3
3
|
import { CommandError } from './helper';
|
|
4
4
|
interface CommandOptions {
|
|
5
|
-
id: number;
|
|
6
5
|
name: string;
|
|
7
6
|
dryRun: boolean;
|
|
8
7
|
}
|
|
@@ -11,7 +10,6 @@ export declare class RefreshModuleCommand extends CommandRunner {
|
|
|
11
10
|
constructor(moduleMetadataService: ModuleMetadataService);
|
|
12
11
|
private readonly logger;
|
|
13
12
|
run(_passedParam: string[], options?: CommandOptions): Promise<void>;
|
|
14
|
-
parseId(val: string): number;
|
|
15
13
|
parseName(val: string): string;
|
|
16
14
|
parseDryRun(val: string): boolean;
|
|
17
15
|
validate(options: CommandOptions): CommandError[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"refresh-module.command.d.ts","sourceRoot":"","sources":["../../src/commands/refresh-module.command.ts"],"names":[],"mappings":"AACA,OAAO,EAAW,aAAa,EAAU,MAAM,gBAAgB,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,UAAU,cAAc;IACtB,
|
|
1
|
+
{"version":3,"file":"refresh-module.command.d.ts","sourceRoot":"","sources":["../../src/commands/refresh-module.command.ts"],"names":[],"mappings":"AACA,OAAO,EAAW,aAAa,EAAU,MAAM,gBAAgB,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,UAAU,cAAc;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,qBAIa,oBAAqB,SAAQ,aAAa;IAEnD,OAAO,CAAC,QAAQ,CAAC,qBAAqB;gBAArB,qBAAqB,EAAE,qBAAqB;IAI/D,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAyC;IAE1D,GAAG,CAAC,YAAY,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAiB1E,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAQ9B,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAKjC,QAAQ,CAAC,OAAO,EAAE,cAAc,GAAG,YAAY,EAAE;CAOlD"}
|
|
@@ -28,15 +28,11 @@ let RefreshModuleCommand = RefreshModuleCommand_1 = class RefreshModuleCommand e
|
|
|
28
28
|
return;
|
|
29
29
|
}
|
|
30
30
|
const codeGenerationOptions = {
|
|
31
|
-
moduleId: options.id,
|
|
32
31
|
moduleUserKey: options.name,
|
|
33
32
|
dryRun: options.dryRun,
|
|
34
33
|
};
|
|
35
34
|
await this.moduleMetadataService.generateCode(codeGenerationOptions);
|
|
36
35
|
}
|
|
37
|
-
parseId(val) {
|
|
38
|
-
return +val;
|
|
39
|
-
}
|
|
40
36
|
parseName(val) {
|
|
41
37
|
return val;
|
|
42
38
|
}
|
|
@@ -45,8 +41,8 @@ let RefreshModuleCommand = RefreshModuleCommand_1 = class RefreshModuleCommand e
|
|
|
45
41
|
return (val === 'false') ? false : true;
|
|
46
42
|
}
|
|
47
43
|
validate(options) {
|
|
48
|
-
if (!options.
|
|
49
|
-
return [new helper_1.CommandError('Module
|
|
44
|
+
if (!options.name) {
|
|
45
|
+
return [new helper_1.CommandError('Module Name is required')];
|
|
50
46
|
}
|
|
51
47
|
return [];
|
|
52
48
|
}
|
|
@@ -54,16 +50,7 @@ let RefreshModuleCommand = RefreshModuleCommand_1 = class RefreshModuleCommand e
|
|
|
54
50
|
exports.RefreshModuleCommand = RefreshModuleCommand;
|
|
55
51
|
__decorate([
|
|
56
52
|
(0, nest_commander_1.Option)({
|
|
57
|
-
flags: '-
|
|
58
|
-
description: 'Module ID from the ss_module_metadata table',
|
|
59
|
-
}),
|
|
60
|
-
__metadata("design:type", Function),
|
|
61
|
-
__metadata("design:paramtypes", [String]),
|
|
62
|
-
__metadata("design:returntype", Number)
|
|
63
|
-
], RefreshModuleCommand.prototype, "parseId", null);
|
|
64
|
-
__decorate([
|
|
65
|
-
(0, nest_commander_1.Option)({
|
|
66
|
-
flags: '-n, --name [module name]',
|
|
53
|
+
flags: '-n, --name <module name>',
|
|
67
54
|
description: 'Module Name from the ss_module_metadata table',
|
|
68
55
|
}),
|
|
69
56
|
__metadata("design:type", Function),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"refresh-module.command.js","sourceRoot":"","sources":["../../src/commands/refresh-module.command.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAwC;AACxC,mDAAgE;AAChE,iFAA4E;AAC5E,qCAAwC;
|
|
1
|
+
{"version":3,"file":"refresh-module.command.js","sourceRoot":"","sources":["../../src/commands/refresh-module.command.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAwC;AACxC,mDAAgE;AAChE,iFAA4E;AAC5E,qCAAwC;AAWjC,IAAM,oBAAoB,4BAA1B,MAAM,oBAAqB,SAAQ,8BAAa;IACrD,YACmB,qBAA4C;QAE7D,KAAK,EAAE,CAAC;QAFS,0BAAqB,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AE,wBAAwB;QAC/B,WAAW,EAAE,qBAAqB;KACnC,CAAC;;;;uDAID;+BApCU,oBAAoB;IAJhC,IAAA,wBAAO,EAAC;QACP,IAAI,EAAE,gBAAgB;QACtB,WAAW,EAAE,uFAAuF;KACrG,CAAC;qCAG0C,+CAAqB;GAFpD,oBAAoB,CA6ChC","sourcesContent":["import { Logger } from '@nestjs/common';\nimport { Command, CommandRunner, Option } from 'nest-commander';\nimport { ModuleMetadataService } from '../services/module-metadata.service';\nimport { CommandError } from './helper';\n\ninterface CommandOptions {\n name: string;\n dryRun: boolean;\n}\n\n@Command({\n name: 'refresh-module',\n description: 'Refreshes a module and its model and fields i.e (entity,dto,service,controller files)',\n})\nexport class RefreshModuleCommand extends CommandRunner {\n constructor(\n private readonly moduleMetadataService: ModuleMetadataService,\n ) {\n super();\n }\n private readonly logger = new Logger(RefreshModuleCommand.name);\n\n async run(_passedParam: string[], options?: CommandOptions): Promise<void> {\n const errors = this.validate(options);\n if (errors.length) {\n errors.forEach((error) => this.logger.error(error));\n return;\n }\n const codeGenerationOptions = {\n moduleUserKey: options.name,\n dryRun: options.dryRun,\n };\n await this.moduleMetadataService.generateCode(codeGenerationOptions);\n }\n\n @Option({\n flags: '-n, --name <module name>',\n description: 'Module Name from the ss_module_metadata table',\n })\n parseName(val: string): string {\n return val;\n }\n\n @Option({\n flags: '-d, --dryRun [dry run]',\n description: 'Dry run the command',\n })\n parseDryRun(val: string): boolean {\n this.logger.debug(`Dry run : ${val}`);\n return (val === 'false') ? false : true;\n }\n\n validate(options: CommandOptions): CommandError[] {\n if (!options.name) {\n return [new CommandError('Module Name is required')];\n }\n return [];\n }\n\n}\n"]}
|
|
@@ -8,6 +8,7 @@ export interface SolidBootstrapOptions {
|
|
|
8
8
|
globalPrefix?: string;
|
|
9
9
|
swagger?: SolidSwaggerOptions | false;
|
|
10
10
|
permissionsPolicyOverrides?: Partial<PermissionsPolicyConfig>;
|
|
11
|
+
verboseBootstrap?: boolean;
|
|
11
12
|
}
|
|
12
13
|
export declare function bootstrapSolidApp(appModuleFactory: () => Promise<any>, options?: SolidBootstrapOptions): Promise<void>;
|
|
13
14
|
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":"AAcA,OAAO,EAAmE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAyB7H,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;
|
|
1
|
+
{"version":3,"file":"bootstrap.helper.d.ts","sourceRoot":"","sources":["../../src/helpers/bootstrap.helper.ts"],"names":[],"mappings":"AAcA,OAAO,EAAmE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAyB7H,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,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAcD,wBAAsB,iBAAiB,CACrC,gBAAgB,EAAE,MAAM,OAAO,CAAC,GAAG,CAAC,EACpC,OAAO,GAAE,qBAA0B,GAClC,OAAO,CAAC,IAAI,CAAC,CAwHf;AAgBD,wBAAsB,iBAAiB,CACrC,gBAAgB,EAAE,MAAM,OAAO,CAAC,GAAG,CAAC,GACnC,OAAO,CAAC,IAAI,CAAC,CAwCf"}
|
|
@@ -36,10 +36,11 @@ function registerGlobalProcessHandlers() {
|
|
|
36
36
|
}
|
|
37
37
|
async function bootstrapSolidApp(appModuleFactory, options = {}) {
|
|
38
38
|
registerGlobalProcessHandlers();
|
|
39
|
-
const { globalPrefix = 'api', swagger = {}, permissionsPolicyOverrides = {} } = options;
|
|
39
|
+
const { globalPrefix = 'api', swagger = {}, permissionsPolicyOverrides = {}, verboseBootstrap = false } = options;
|
|
40
|
+
const startTime = Date.now();
|
|
40
41
|
const appModule = await appModuleFactory();
|
|
41
42
|
const app = await core_1.NestFactory.create(appModule, {
|
|
42
|
-
logger: nest_winston_1.WinstonModule.createLogger(winston_logger_1.
|
|
43
|
+
logger: nest_winston_1.WinstonModule.createLogger({ ...(0, winston_logger_1.createWinstonLoggerConfig)(), level: verboseBootstrap ? 'debug' : 'error' }),
|
|
43
44
|
});
|
|
44
45
|
const apiEnabled = (0, environment_helper_1.parseBooleanEnv)('API_ENABLED', true);
|
|
45
46
|
if (!apiEnabled) {
|
|
@@ -67,7 +68,6 @@ async function bootstrapSolidApp(appModuleFactory, options = {}) {
|
|
|
67
68
|
res.setHeader('Permissions-Policy', (0, security_helper_1.buildPermissionsPolicyHeader)(permissionsPolicyOverrides));
|
|
68
69
|
next();
|
|
69
70
|
});
|
|
70
|
-
app.useLogger(app.get(nest_winston_1.WINSTON_MODULE_NEST_PROVIDER));
|
|
71
71
|
const port = process.env.PORT || 3000;
|
|
72
72
|
if (globalPrefix) {
|
|
73
73
|
app.setGlobalPrefix(globalPrefix);
|
|
@@ -111,6 +111,9 @@ async function bootstrapSolidApp(appModuleFactory, options = {}) {
|
|
|
111
111
|
types.setTypeParser(types.builtins.INT8, (val) => parseInt(val));
|
|
112
112
|
app.useWebSocketAdapter(new platform_ws_1.WsAdapter(app));
|
|
113
113
|
await app.listen(port);
|
|
114
|
+
app.useLogger(app.get(nest_winston_1.WINSTON_MODULE_NEST_PROVIDER));
|
|
115
|
+
const elapsed = ((Date.now() - startTime) / 1000).toFixed(2);
|
|
116
|
+
app.get(nest_winston_1.WINSTON_MODULE_NEST_PROVIDER).log(`Server started on port ${port} in ${elapsed}s`, 'Bootstrap');
|
|
114
117
|
}
|
|
115
118
|
async function bootstrapSolidCli(appModuleFactory) {
|
|
116
119
|
registerGlobalProcessHandlers();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrap.helper.js","sourceRoot":"","sources":["../../src/helpers/bootstrap.helper.ts"],"names":[],"mappings":";;;;;AAkEA,8CAsHC;AAgBD,8CA0CC;AAlPD,2CAAgD;AAChD,uCAA2C;AAC3C,qDAAgD;AAChD,6CAAiE;AAEjE,oDAA4B;AAC5B,4CAAoB;AACpB,2BAAgC;AAChC,+BAA+B;AAC/B,+CAA2E;AAC3E,mDAAgD;AAChD,sDAAwD;AACxD,yFAAoF;AACpF,+CAAwD;AACxD,uDAA6H;AAC7H,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,CAAC;IACvE,CAAC,CAAC,CAAC;IAEH,OAAO,CAAC,EAAE,CAAC,mBAAmB,EAAE,CAAC,GAAG,EAAE,EAAE;QACtC,OAAO,CAAC,KAAK,CAAC,4BAA4B,EAAE,GAAG,CAAC,CAAC;IACnD,CAAC,CAAC,CAAC;IAGH,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,OAAO,EAAE,EAAE;QAChC,IAAI,OAAO,CAAC,IAAI,KAAK,oBAAoB,IAAI,CAAC,OAAO,CAAC,OAAO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,EAAE,CAAC;IAC3C,OAAO,CAAC,GAAG,CAAC,iBAAiB,GAAG,MAAM,CAAC;IAGvC,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 { ValidationPipe } from '@nestjs/common';\nimport { NestFactory } from '@nestjs/core';\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 { WinstonLoggerConfig } from '../winston.logger';\nimport { WrapResponseInterceptor } from '../interceptors/wrap-response.interceptor';\nimport { buildDefaultCorsOptions } from './cors.helper';\nimport { buildDefaultSecurityHeaderOptions, buildPermissionsPolicyHeader, PermissionsPolicyConfig } 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}\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 * });\n */\nexport async function bootstrapSolidApp(\n appModuleFactory: () => Promise<any>,\n options: SolidBootstrapOptions = {},\n): Promise<void> {\n registerGlobalProcessHandlers();\n\n const { globalPrefix = 'api', swagger = {}, permissionsPolicyOverrides = {} } = options;\n\n const appModule = await appModuleFactory();\n const app = await NestFactory.create(appModule, {\n logger: WinstonModule.createLogger(WinstonLoggerConfig),\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;\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()));\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 // Winston logger\n app.useLogger(app.get(WINSTON_MODULE_NEST_PROVIDER));\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 // 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(new WrapResponseInterceptor());\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\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":";;;;;AAoEA,8CA2HC;AAgBD,8CA0CC;AAzPD,2CAAgD;AAChD,uCAA2C;AAC3C,qDAAgD;AAChD,6CAAiE;AAEjE,oD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AC,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 { ValidationPipe } from '@nestjs/common';\nimport { NestFactory } from '@nestjs/core';\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 { buildDefaultSecurityHeaderOptions, buildPermissionsPolicyHeader, PermissionsPolicyConfig } 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 /** Show full NestJS init logs during bootstrap (route mapping, module deps, pollers). Defaults to false. */\n verboseBootstrap?: 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 * });\n */\nexport async function bootstrapSolidApp(\n appModuleFactory: () => Promise<any>,\n options: SolidBootstrapOptions = {},\n): Promise<void> {\n registerGlobalProcessHandlers();\n\n const { globalPrefix = 'api', swagger = {}, permissionsPolicyOverrides = {}, verboseBootstrap = false } = options;\n\n const startTime = Date.now();\n const appModule = await appModuleFactory();\n const app = await NestFactory.create(appModule, {\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;\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()));\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 // 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(new WrapResponseInterceptor());\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 app.get(WINSTON_MODULE_NEST_PROVIDER).log(`Server started on port ${port} in ${elapsed}s`, 'Bootstrap');\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 +1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;;;;;IAkB3C,wBAAwB,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,MAAM,CAAC;IAuDzE,iBAAiB,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,MAAM,CAAC;YAgB1D,0BAA0B;YAa1B,0BAA0B;IAkBlC,aAAa,CAAC,IAAI,EAAE,GAAG;;;;YAiCf,wBAAwB;IAiBhC,UAAU,CAAC,aAAa,EAAE,aAAa;;;;;;;;;;;;;;;;;;;;;;;;CAgJ9C"}
|
|
@@ -547,9 +547,10 @@ let ModelMetadataService = class ModelMetadataService {
|
|
|
547
547
|
}
|
|
548
548
|
}
|
|
549
549
|
async generateCodeViaCtl(modelId) {
|
|
550
|
+
const model = await this.findOne(modelId);
|
|
550
551
|
return this.commandService.executeCommandWithArgs({
|
|
551
552
|
command: 'npx',
|
|
552
|
-
args: ['@solixai/solidctl@latest', 'generate', 'model', `--
|
|
553
|
+
args: ['@solixai/solidctl@latest', 'generate', 'model', `--name=${model.singularName}`],
|
|
553
554
|
cwd: path.join(process.cwd(), '..'),
|
|
554
555
|
});
|
|
555
556
|
}
|