@solidstarters/solid-core 1.2.206 → 1.2.208
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/seed.command.js +1 -1
- package/dist/commands/seed.command.js.map +1 -1
- package/dist/controllers/test.controller.d.ts.map +1 -1
- package/dist/controllers/test.controller.js.map +1 -1
- package/dist/dtos/create-scheduled-job.dto.d.ts +1 -0
- package/dist/dtos/create-scheduled-job.dto.d.ts.map +1 -1
- package/dist/dtos/create-scheduled-job.dto.js +7 -1
- package/dist/dtos/create-scheduled-job.dto.js.map +1 -1
- package/dist/dtos/update-scheduled-job.dto.d.ts +1 -0
- package/dist/dtos/update-scheduled-job.dto.d.ts.map +1 -1
- package/dist/dtos/update-scheduled-job.dto.js +7 -1
- package/dist/dtos/update-scheduled-job.dto.js.map +1 -1
- package/dist/entities/scheduled-job.entity.d.ts +1 -0
- package/dist/entities/scheduled-job.entity.d.ts.map +1 -1
- package/dist/entities/scheduled-job.entity.js +5 -1
- package/dist/entities/scheduled-job.entity.js.map +1 -1
- package/dist/helpers/command.service.d.ts +6 -1
- package/dist/helpers/command.service.d.ts.map +1 -1
- package/dist/helpers/command.service.js +34 -11
- package/dist/helpers/command.service.js.map +1 -1
- package/dist/helpers/field-crud-managers/ManyToOneRelationFieldCrudManager.js +2 -2
- package/dist/helpers/field-crud-managers/ManyToOneRelationFieldCrudManager.js.map +1 -1
- package/dist/helpers/schematic.service.d.ts +3 -2
- package/dist/helpers/schematic.service.d.ts.map +1 -1
- package/dist/helpers/schematic.service.js +32 -27
- package/dist/helpers/schematic.service.js.map +1 -1
- package/dist/repository/scheduled-job.repository.d.ts.map +1 -1
- package/dist/repository/scheduled-job.repository.js +1 -0
- package/dist/repository/scheduled-job.repository.js.map +1 -1
- package/dist/seeders/module-metadata-seeder.service.js +1 -1
- package/dist/seeders/module-metadata-seeder.service.js.map +1 -1
- package/dist/seeders/seed-data/solid-core-metadata.json +21 -1
- package/dist/seeders/system-fields-seeder.service.d.ts.map +1 -1
- package/dist/seeders/system-fields-seeder.service.js +3 -0
- package/dist/seeders/system-fields-seeder.service.js.map +1 -1
- package/dist/services/authentication.service.js +0 -3
- package/dist/services/authentication.service.js.map +1 -1
- package/dist/services/file.service.d.ts.map +1 -1
- package/dist/services/file.service.js +1 -1
- package/dist/services/file.service.js.map +1 -1
- package/dist/services/scheduled-jobs/scheduler.service.d.ts +1 -0
- package/dist/services/scheduled-jobs/scheduler.service.d.ts.map +1 -1
- package/dist/services/scheduled-jobs/scheduler.service.js +29 -0
- package/dist/services/scheduled-jobs/scheduler.service.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/docs/type-declaration-import-issue.md +24 -0
- package/package.json +2 -1
- package/src/commands/seed.command.ts +1 -1
- package/src/controllers/test.controller.ts +0 -18
- package/src/dtos/create-scheduled-job.dto.ts +4 -0
- package/src/dtos/update-scheduled-job.dto.ts +4 -0
- package/src/entities/scheduled-job.entity.ts +2 -0
- package/src/helpers/command.service.ts +60 -12
- package/src/helpers/field-crud-managers/ManyToOneRelationFieldCrudManager.ts +2 -2
- package/src/helpers/schematic.service.ts +41 -35
- package/src/repository/scheduled-job.repository.ts +1 -0
- package/src/seeders/module-metadata-seeder.service.ts +1 -1
- package/src/seeders/seed-data/solid-core-metadata.json +21 -1
- package/src/seeders/system-fields-seeder.service.ts +3 -0
- package/src/services/authentication.service.ts +3 -3
- package/src/services/file.service.ts +4 -5
- package/src/services/scheduled-jobs/scheduler.service.ts +40 -3
- package/# Password field.md +0 -8
- package/dist/services/file/file-service.interface.d.ts +0 -22
- package/dist/services/file/file-service.interface.d.ts.map +0 -1
- package/dist/services/file/file-service.interface.js +0 -5
- package/dist/services/file/file-service.interface.js.map +0 -1
- package/sql-server-changes.txt +0 -88
- package/src/services/file/file-service.interface.ts +0 -74
|
@@ -44,7 +44,7 @@ let SeedCommand = SeedCommand_1 = class SeedCommand extends nest_commander_1.Com
|
|
|
44
44
|
this.logger.error(`Seeder service ${options.seeder} not found. Does your service have a seed() method?`);
|
|
45
45
|
return;
|
|
46
46
|
}
|
|
47
|
-
this.logger.log(`Running the seed() method for seeder
|
|
47
|
+
this.logger.log(`Running the seed() method for seeder: ${seeder.constructor.name}`);
|
|
48
48
|
await seeder.seed(parsedConf);
|
|
49
49
|
}
|
|
50
50
|
parseConf(val) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"seed.command.js","sourceRoot":"","sources":["../../src/commands/seed.command.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAwC;AACxC,mDAAgE;AAChE,8DAA2D;AAQpD,IAAM,WAAW,mBAAjB,MAAM,WAAY,SAAQ,8BAAa;IAG5C,YAA6B,aAA4B;QACvD,KAAK,EAAE,CAAC;QADmB,kBAAa,GAAb,aAAa,CAAe;QAFxC,WAAM,GAAG,IAAI,eAAM,CAAC,aAAW,CAAC,IAAI,CAAC,CAAC;IAIvD,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,WAAqB,EAAE,OAA4B;QAG3D,IAAI,UAAU,GAAQ,IAAI,CAAC;QAG3B,IAAI,OAAO,EAAE,IAAI,KAAK,SAAS,EAAE,CAAC;YAChC,IAAI,CAAC;gBACH,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;gBACtC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,gBAAgB,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;YACzE,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,oDAAoD,CAAC,CAAC;gBACxE,OAAO;YACT,CAAC;QACH,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,gEAAgE,CAAC,CAAC;QACpF,CAAC;QAED,MAAM,MAAM,GAAG,IAAI,CAAC,aAAa;aAC9B,UAAU,EAAE;aACZ,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,OAAO,CAAC,MAAM,CAAC;aAClD,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC;aAChC,GAAG,EAAE,CAAC;QACT,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,kBAAkB,OAAO,CAAC,MAAM,qDAAqD,CAAC,CAAC;YACzG,OAAO;QACT,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,yCAAyC,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC,CAAC;QACpF,MAAM,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAChC,CAAC;IAOD,SAAS,CAAC,GAAW;QACnB,OAAO,GAAG,CAAC;IACb,CAAC;IAGD,WAAW,CAAC,GAAW;QACrB,OAAO,GAAG,CAAC;IACb,CAAC;CACF,CAAA;AAnDY,kCAAW;AA2CtB;IADC,IAAA,uBAAM,EAAC,EAAE,KAAK,EAAE,iCAAiC,EAAE,WAAW,EAAE,iDAAiD,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;;;;4CAGrI;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;sBAlDU,WAAW;IADvB,IAAA,wBAAO,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,sCAAsC,EAAE,CAAC;qCAIjC,8BAAa;GAH9C,WAAW,CAmDvB","sourcesContent":["import { Logger } from '@nestjs/common';\nimport { Command, CommandRunner, Option } from 'nest-commander';\nimport { SolidRegistry } from 'src/helpers/solid-registry';\n\ninterface SeedCommandOptions {\n conf?: string;\n seeder?: string;\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 // check if options.conf is non empty and a valid json string only is -c flag is passed.\n // convert to json object JSON.parse\n let parsedConf: any = null;\n\n // Parse conf only if provided\n if (options?.conf !== undefined) {\n try {\n parsedConf = JSON.parse(options.conf);\n this.logger.log(`Parsed conf: ${JSON.stringify(parsedConf, null, 2)}`);\n } catch (err) {\n this.logger.error('Failed to parse --conf. Please provide valid JSON.');\n return;\n }\n } else {\n this.logger.log('No --conf flag provided. Running with default seeder behavior.');\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 this.logger.error(`Seeder service ${options.seeder} not found. Does your service have a seed() method?`);\n return;\n }\n this.logger.log(`Running the seed() method for seeder
|
|
1
|
+
{"version":3,"file":"seed.command.js","sourceRoot":"","sources":["../../src/commands/seed.command.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAwC;AACxC,mDAAgE;AAChE,8DAA2D;AAQpD,IAAM,WAAW,mBAAjB,MAAM,WAAY,SAAQ,8BAAa;IAG5C,YAA6B,aAA4B;QACvD,KAAK,EAAE,CAAC;QADmB,kBAAa,GAAb,aAAa,CAAe;QAFxC,WAAM,GAAG,IAAI,eAAM,CAAC,aAAW,CAAC,IAAI,CAAC,CAAC;IAIvD,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,WAAqB,EAAE,OAA4B;QAG3D,IAAI,UAAU,GAAQ,IAAI,CAAC;QAG3B,IAAI,OAAO,EAAE,IAAI,KAAK,SAAS,EAAE,CAAC;YAChC,IAAI,CAAC;gBACH,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;gBACtC,IAA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E,4BAA4B,EAAE,WAAW,EAAE,oBAAoB,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,EAAE,6BAA6B,EAAE,CAAC;;;;8CAG/I;sBAlDU,WAAW;IADvB,IAAA,wBAAO,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,sCAAsC,EAAE,CAAC;qCAIjC,8BAAa;GAH9C,WAAW,CAmDvB","sourcesContent":["import { Logger } from '@nestjs/common';\nimport { Command, CommandRunner, Option } from 'nest-commander';\nimport { SolidRegistry } from 'src/helpers/solid-registry';\n\ninterface SeedCommandOptions {\n conf?: string;\n seeder?: string;\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 // check if options.conf is non empty and a valid json string only is -c flag is passed.\n // convert to json object JSON.parse\n let parsedConf: any = null;\n\n // Parse conf only if provided\n if (options?.conf !== undefined) {\n try {\n parsedConf = JSON.parse(options.conf);\n this.logger.log(`Parsed conf: ${JSON.stringify(parsedConf, null, 2)}`);\n } catch (err) {\n this.logger.error('Failed to parse --conf. Please provide valid JSON.');\n return;\n }\n } else {\n this.logger.log('No --conf flag provided. Running with default seeder behavior.');\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 this.logger.error(`Seeder service ${options.seeder} not found. Does your service have a seed() method?`);\n return;\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: '-c, --conf [configuration json]', description: 'A configuration json, pass a valid json string.', required: false })\n parseConf(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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test.controller.d.ts","sourceRoot":"","sources":["../../src/controllers/test.controller.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAG3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,4CAA4C,CAAC;AAEnF,qBAAa,QAAQ;IACnB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,qBAEa,cAAc;IAGvB,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,qBAAqB;IAHxC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAmC;gBAEvC,aAAa,EAAE,aAAa,EAC5B,qBAAqB,EAAE,qBAAqB;IAM/D,UAAU,CAAkB,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,EAAU,IAAI,EAAE,GAAG;;;;;IAOhF,UAAU,CAAiB,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,IAAI,EAAU,IAAI,EAAE,GAAG;;;IAWjE,SAAS,CAAiB,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,IAAI,EAAU,IAAI,EAAE,GAAG;;;
|
|
1
|
+
{"version":3,"file":"test.controller.d.ts","sourceRoot":"","sources":["../../src/controllers/test.controller.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAG3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,4CAA4C,CAAC;AAEnF,qBAAa,QAAQ;IACnB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,qBAEa,cAAc;IAGvB,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,qBAAqB;IAHxC,OAAO,CAAC,QAAQ,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C1E,MAAM,IAAI,CAAC,qBAAqB,CAAC,MAAM,EAAE,CAAC;QAC1C,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;IACtB,CAAC;CACF,CAAA;AAhCY,wCAAc;AAUzB;IAHC,IAAA,qBAAI,EAAC,yBAAQ,CAAC,IAAI,CAAC;IACnB,IAAA,wBAAe,EAAC,IAAA,sCAAmB,GAAE,CAAC;IACtC,IAAA,aAAI,EAAC,SAAS,CAAC;;IACJ,WAAA,IAAA,sBAAa,GAAE,CAAA;IAAqC,WAAA,IAAA,aAAI,GAAE,CAAA;;qCAAnC,KAAK;;gDAEvC;AAKD;IAHC,IAAA,qBAAI,EAAC,yBAAQ,CAAC,IAAI,CAAC;IACnB,IAAA,aAAI,EAAC,QAAQ,CAAC;IACd,IAAA,wBAAe,EAAC,IAAA,kCAAe,EAAC,MAAM,CAAC,CAAC;;IAC7B,WAAA,IAAA,qBAAY,GAAE,CAAA;IAA6B,WAAA,IAAA,aAAI,GAAE,CAAA;;;;gDAM5D;AAKK;IAHL,IAAA,uBAAa,EAAC,KAAK,CAAC;IACpB,IAAA,aAAI,EAAC,YAAY,CAAC;IAClB,IAAA,wBAAe,EAAC,IAAA,kCAAe,EAAC,MAAM,CAAC,CAAC;;IACxB,WAAA,IAAA,qBAAY,GAAE,CAAA;IAA6B,WAAA,IAAA,aAAI,GAAE,CAAA;;;;+CAGjE;yBA/BU,cAAc;IAF1B,IAAA,mBAAU,EAAC,MAAM,CAAC;IAClB,IAAA,iBAAO,EAAC,YAAY,CAAC;qCAIc,8BAAa;QACL,+CAAqB;GAJpD,cAAc,CAgC1B","sourcesContent":["import { Body, Controller, Logger, Post, UploadedFile, UploadedFiles, UseInterceptors } from \"@nestjs/common\";\nimport { AnyFilesInterceptor, FileInterceptor } from \"@nestjs/platform-express\";\nimport { ApiBearerAuth, ApiTags } from \"@nestjs/swagger\";\nimport { SolidRegistry } from \"src/helpers/solid-registry\";\nimport { Auth } from \"src/decorators/auth.decorator\";\nimport { AuthType } from \"src/enums/auth-type.enum\";\nimport { IngestMetadataService } from \"src/services/genai/ingest-metadata.service\";\n\nexport class SeedData {\n seeder: string;\n}\n\n@Controller('test')\n@ApiTags(\"Solid Core\")\nexport class TestController {\n private readonly logger = new Logger(TestController.name);\n constructor(\n private readonly solidRegistry: SolidRegistry,\n private readonly ingestMetadataService: IngestMetadataService,\n ) { }\n\n @Auth(AuthType.None)\n @UseInterceptors(AnyFilesInterceptor())\n @Post('uploads')\n uploadData(@UploadedFiles() files: Array<Express.Multer.File>, @Body() body: any) {\n return { message: 'file uploaded', fileNames: files.map(f => f.originalname), formData: body };\n }\n\n @Auth(AuthType.None)\n @Post('upload')\n @UseInterceptors(FileInterceptor('file')) // 'file' here is the name of the field in the form\n uploadFile(@UploadedFile() file: Express.Multer.File, @Body() body: any) {\n // console.log(file);\n this.logger.debug(file);\n // console.log(body);\n this.logger.debug(body);\n return { filename: file.originalname };\n }\n\n @ApiBearerAuth(\"jwt\")\n @Post('mcp/ingest')\n @UseInterceptors(FileInterceptor('file'))\n async mcpIngest(@UploadedFile() file: Express.Multer.File, @Body() body: any) {\n await this.ingestMetadataService.ingest();\n return { ok: true };\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-scheduled-job.dto.d.ts","sourceRoot":"","sources":["../../src/dtos/create-scheduled-job.dto.ts"],"names":[],"mappings":"AAIA,qBAAa,qBAAqB;IAI9B,YAAY,EAAE,MAAM,CAAC;IAIrB,QAAQ,EAAE,OAAO,CAAS;IAI1B,SAAS,EAAE,MAAM,CAAC;IAIlB,SAAS,EAAE,IAAI,CAAC;IAIhB,OAAO,EAAE,IAAI,CAAC;IAId,SAAS,EAAE,IAAI,CAAC;IAIhB,OAAO,EAAE,IAAI,CAAC;IAId,UAAU,EAAE,MAAM,CAAC;IAInB,SAAS,EAAE,IAAI,CAAC;IAIhB,SAAS,EAAE,IAAI,CAAC;IAIhB,SAAS,EAAE,MAAM,CAAC;IAIlB,GAAG,EAAE,MAAM,CAAC;IAIZ,QAAQ,EAAE,MAAM,CAAC;IAIjB,aAAa,EAAE,MAAM,CAAC;CACzB"}
|
|
1
|
+
{"version":3,"file":"create-scheduled-job.dto.d.ts","sourceRoot":"","sources":["../../src/dtos/create-scheduled-job.dto.ts"],"names":[],"mappings":"AAIA,qBAAa,qBAAqB;IAI9B,YAAY,EAAE,MAAM,CAAC;IAIrB,QAAQ,EAAE,OAAO,CAAS;IAI1B,SAAS,EAAE,MAAM,CAAC;IAIlB,SAAS,EAAE,IAAI,CAAC;IAIhB,OAAO,EAAE,IAAI,CAAC;IAId,SAAS,EAAE,IAAI,CAAC;IAIhB,OAAO,EAAE,IAAI,CAAC;IAId,UAAU,EAAE,MAAM,CAAC;IAInB,SAAS,EAAE,IAAI,CAAC;IAIhB,SAAS,EAAE,IAAI,CAAC;IAIhB,SAAS,EAAE,MAAM,CAAC;IAIlB,GAAG,EAAE,MAAM,CAAC;IAIZ,cAAc,EAAE,MAAM,CAAC;IAIvB,QAAQ,EAAE,MAAM,CAAC;IAIjB,aAAa,EAAE,MAAM,CAAC;CACzB"}
|
|
@@ -19,7 +19,7 @@ class CreateScheduledJobDto {
|
|
|
19
19
|
this.isActive = false;
|
|
20
20
|
}
|
|
21
21
|
static _OPENAPI_METADATA_FACTORY() {
|
|
22
|
-
return { scheduleName: { required: true, type: () => String }, isActive: { required: true, type: () => Boolean, default: false }, frequency: { required: true, type: () => String }, startTime: { required: true, type: () => Date }, endTime: { required: true, type: () => Date }, startDate: { required: true, type: () => Date }, endDate: { required: true, type: () => Date }, dayOfMonth: { required: true, type: () => Number }, lastRunAt: { required: true, type: () => Date }, nextRunAt: { required: true, type: () => Date }, dayOfWeek: { required: true, type: () => String }, job: { required: true, type: () => String }, moduleId: { required: true, type: () => Number }, moduleUserKey: { required: true, type: () => String } };
|
|
22
|
+
return { scheduleName: { required: true, type: () => String }, isActive: { required: true, type: () => Boolean, default: false }, frequency: { required: true, type: () => String }, startTime: { required: true, type: () => Date }, endTime: { required: true, type: () => Date }, startDate: { required: true, type: () => Date }, endDate: { required: true, type: () => Date }, dayOfMonth: { required: true, type: () => Number }, lastRunAt: { required: true, type: () => Date }, nextRunAt: { required: true, type: () => Date }, dayOfWeek: { required: true, type: () => String }, job: { required: true, type: () => String }, cronExpression: { required: true, type: () => String }, moduleId: { required: true, type: () => Number }, moduleUserKey: { required: true, type: () => String } };
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
exports.CreateScheduledJobDto = CreateScheduledJobDto;
|
|
@@ -95,6 +95,12 @@ __decorate([
|
|
|
95
95
|
(0, swagger_1.ApiProperty)(),
|
|
96
96
|
__metadata("design:type", String)
|
|
97
97
|
], CreateScheduledJobDto.prototype, "job", void 0);
|
|
98
|
+
__decorate([
|
|
99
|
+
(0, class_validator_2.IsOptional)(),
|
|
100
|
+
(0, class_validator_1.IsString)(),
|
|
101
|
+
(0, swagger_1.ApiProperty)(),
|
|
102
|
+
__metadata("design:type", String)
|
|
103
|
+
], CreateScheduledJobDto.prototype, "cronExpression", void 0);
|
|
98
104
|
__decorate([
|
|
99
105
|
(0, class_validator_2.IsOptional)(),
|
|
100
106
|
(0, class_validator_2.IsInt)(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-scheduled-job.dto.js","sourceRoot":"","sources":["../../src/dtos/create-scheduled-job.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,6CAA8C;AAC9C,qDAA2C;AAC3C,qDAAmF;AAEnF,MAAa,qBAAqB;IAAlC;QAQI,aAAQ,GAAY,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"create-scheduled-job.dto.js","sourceRoot":"","sources":["../../src/dtos/create-scheduled-job.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,6CAA8C;AAC9C,qDAA2C;AAC3C,qDAAmF;AAEnF,MAAa,qBAAqB;IAAlC;QAQI,aAAQ,GAAY,KAAK,CAAC;KAqD7B;;iIArDuB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ACV,IAAA,qBAAW,GAAE;;6DACS;AAIvB;IAHC,IAAA,4BAAU,GAAE;IACZ,IAAA,uBAAK,GAAE;IACP,IAAA,qBAAW,GAAE;;uDACG;AAIjB;IAHC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;IACZ,IAAA,qBAAW,GAAE;;4DACQ","sourcesContent":["import { ApiProperty } from '@nestjs/swagger';\nimport { IsString } from 'class-validator';\nimport { IsNotEmpty, IsBoolean, IsDate, IsOptional, IsInt } from 'class-validator';\n\nexport class CreateScheduledJobDto {\n @IsNotEmpty()\n @IsString()\n @ApiProperty()\n scheduleName: string;\n @IsNotEmpty()\n @IsBoolean()\n @ApiProperty()\n isActive: boolean = false;\n @IsNotEmpty()\n @IsString()\n @ApiProperty()\n frequency: string;\n @IsOptional()\n @IsDate()\n @ApiProperty()\n startTime: Date;\n @IsOptional()\n @IsDate()\n @ApiProperty()\n endTime: Date;\n @IsOptional()\n @IsDate()\n @ApiProperty()\n startDate: Date;\n @IsOptional()\n @IsDate()\n @ApiProperty()\n endDate: Date;\n @IsOptional()\n @IsInt()\n @ApiProperty()\n dayOfMonth: number;\n @IsOptional()\n @IsDate()\n @ApiProperty()\n lastRunAt: Date;\n @IsOptional()\n @IsDate()\n @ApiProperty()\n nextRunAt: Date;\n @IsOptional()\n @IsString()\n @ApiProperty()\n dayOfWeek: string;\n @IsNotEmpty()\n @IsString()\n @ApiProperty()\n job: string;\n @IsOptional()\n @IsString()\n @ApiProperty()\n cronExpression: string;\n @IsOptional()\n @IsInt()\n @ApiProperty()\n moduleId: number;\n @IsString()\n @IsOptional()\n @ApiProperty()\n moduleUserKey: string;\n}"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-scheduled-job.dto.d.ts","sourceRoot":"","sources":["../../src/dtos/update-scheduled-job.dto.ts"],"names":[],"mappings":"AAGA,qBAAa,qBAAqB;IAG9B,EAAE,EAAE,MAAM,CAAC;IAKX,YAAY,EAAE,MAAM,CAAC;IAKrB,QAAQ,EAAE,OAAO,CAAC;IAKlB,SAAS,EAAE,MAAM,CAAC;IAIlB,SAAS,EAAE,IAAI,CAAC;IAIhB,OAAO,EAAE,IAAI,CAAC;IAId,SAAS,EAAE,IAAI,CAAC;IAIhB,OAAO,EAAE,IAAI,CAAC;IAId,UAAU,EAAE,MAAM,CAAC;IAInB,SAAS,EAAE,IAAI,CAAC;IAIhB,SAAS,EAAE,IAAI,CAAC;IAIhB,SAAS,EAAE,MAAM,CAAC;IAKlB,GAAG,EAAE,MAAM,CAAC;IAIZ,QAAQ,EAAE,MAAM,CAAC;IAIjB,aAAa,EAAE,MAAM,CAAC;CACzB"}
|
|
1
|
+
{"version":3,"file":"update-scheduled-job.dto.d.ts","sourceRoot":"","sources":["../../src/dtos/update-scheduled-job.dto.ts"],"names":[],"mappings":"AAGA,qBAAa,qBAAqB;IAG9B,EAAE,EAAE,MAAM,CAAC;IAKX,YAAY,EAAE,MAAM,CAAC;IAKrB,QAAQ,EAAE,OAAO,CAAC;IAKlB,SAAS,EAAE,MAAM,CAAC;IAIlB,SAAS,EAAE,IAAI,CAAC;IAIhB,OAAO,EAAE,IAAI,CAAC;IAId,SAAS,EAAE,IAAI,CAAC;IAIhB,OAAO,EAAE,IAAI,CAAC;IAId,UAAU,EAAE,MAAM,CAAC;IAInB,SAAS,EAAE,IAAI,CAAC;IAIhB,SAAS,EAAE,IAAI,CAAC;IAIhB,SAAS,EAAE,MAAM,CAAC;IAKlB,GAAG,EAAE,MAAM,CAAC;IAIZ,cAAc,EAAE,MAAM,CAAC;IAIvB,QAAQ,EAAE,MAAM,CAAC;IAIjB,aAAa,EAAE,MAAM,CAAC;CACzB"}
|
|
@@ -15,7 +15,7 @@ const class_validator_1 = require("class-validator");
|
|
|
15
15
|
const swagger_1 = require("@nestjs/swagger");
|
|
16
16
|
class UpdateScheduledJobDto {
|
|
17
17
|
static _OPENAPI_METADATA_FACTORY() {
|
|
18
|
-
return { id: { required: true, type: () => Number }, scheduleName: { required: true, type: () => String }, isActive: { required: true, type: () => Boolean }, frequency: { required: true, type: () => String }, startTime: { required: true, type: () => Date }, endTime: { required: true, type: () => Date }, startDate: { required: true, type: () => Date }, endDate: { required: true, type: () => Date }, dayOfMonth: { required: true, type: () => Number }, lastRunAt: { required: true, type: () => Date }, nextRunAt: { required: true, type: () => Date }, dayOfWeek: { required: true, type: () => String }, job: { required: true, type: () => String }, moduleId: { required: true, type: () => Number }, moduleUserKey: { required: true, type: () => String } };
|
|
18
|
+
return { id: { required: true, type: () => Number }, scheduleName: { required: true, type: () => String }, isActive: { required: true, type: () => Boolean }, frequency: { required: true, type: () => String }, startTime: { required: true, type: () => Date }, endTime: { required: true, type: () => Date }, startDate: { required: true, type: () => Date }, endDate: { required: true, type: () => Date }, dayOfMonth: { required: true, type: () => Number }, lastRunAt: { required: true, type: () => Date }, nextRunAt: { required: true, type: () => Date }, dayOfWeek: { required: true, type: () => String }, job: { required: true, type: () => String }, cronExpression: { required: true, type: () => String }, moduleId: { required: true, type: () => Number }, moduleUserKey: { required: true, type: () => String } };
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
exports.UpdateScheduledJobDto = UpdateScheduledJobDto;
|
|
@@ -100,6 +100,12 @@ __decorate([
|
|
|
100
100
|
(0, swagger_1.ApiProperty)(),
|
|
101
101
|
__metadata("design:type", String)
|
|
102
102
|
], UpdateScheduledJobDto.prototype, "job", void 0);
|
|
103
|
+
__decorate([
|
|
104
|
+
(0, class_validator_1.IsOptional)(),
|
|
105
|
+
(0, class_validator_1.IsString)(),
|
|
106
|
+
(0, swagger_1.ApiProperty)(),
|
|
107
|
+
__metadata("design:type", String)
|
|
108
|
+
], UpdateScheduledJobDto.prototype, "cronExpression", void 0);
|
|
103
109
|
__decorate([
|
|
104
110
|
(0, class_validator_1.IsOptional)(),
|
|
105
111
|
(0, class_validator_1.IsInt)(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-scheduled-job.dto.js","sourceRoot":"","sources":["../../src/dtos/update-scheduled-job.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,qDAA6F;AAC7F,6CAA8C;AAE9C,MAAa,qBAAqB;;;;
|
|
1
|
+
{"version":3,"file":"update-scheduled-job.dto.js","sourceRoot":"","sources":["../../src/dtos/update-scheduled-job.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,qDAA6F;AAC7F,6CAA8C;AAE9C,MAAa,qBAAqB;;;;CAoEjC;AApED,sDAoEC;AAjEG;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,uBAAK,GAAE;;iDACG;AAKX;IAJC,IAAA,4BAAU,GAAE;IACZ,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;IACV,IAAA,qBAAW,GAAE;;2DACO;AAKrB;IAJC,IAAA,4BAAU,GAAE;IACZ,IAAA,4BAAU,GAAE;IACZ,IAAA,2BAAS,GAAE;IACX,IAAA,qBAAW,GAAE;;uDACI;AAKlB;IAJC,IAAA,4BAAU,GAAE;IACZ,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;IACV,IAAA,qBAAW,GAAE;;wDACI;AAIlB;IAHC,IAAA,4BAAU,GAAE;IACZ,IAAA,wBAAM,GAAE;IACR,IAAA,qBAAW,GAAE;8BACH,IAAI;wDAAC;AAIhB;IAHC,IAAA,4BAAU,GAAE;IACZ,IAAA,wBAAM,GAAE;IACR,IAAA,qBAAW,GAAE;8BACL,IAAI;sDAAC;AAId;IAHC,IAAA,4BAAU,GAAE;IACZ,IAAA,wBAAM,GAAE;IACR,IAAA,qBAAW,GAAE;8BACH,IAAI;wDAAC;AAIhB;IAHC,IAAA,4BAAU,GAAE;IACZ,IAAA,wBAAM,GAAE;IACR,IAAA,qBAAW,GAAE;8BACL,IAAI;sDAAC;AAId;IAHC,IAAA,4BAAU,GAAE;IACZ,IAAA,uBAAK,GAAE;IACP,IAAA,qBAAW,GAAE;;yDACK;AAInB;IAHC,IAAA,4BAAU,GAAE;IACZ,IAAA,wBAAM,GAAE;IACR,IAAA,qBAAW,GAAE;8BACH,IAAI;wDAAC;AAIhB;IAHC,IAAA,4BAAU,GAAE;IACZ,IAAA,wBAAM,GAAE;IACR,IAAA,qBAAW,GAAE;8BACH,IAAI;wDAAC;AAIhB;IAHC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;IACV,IAAA,qBAAW,GAAE;;wDACI;AAKlB;IAJC,IAAA,4BAAU,GAAE;IACZ,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;IACV,IAAA,qBAAW,GAAE;;kDACF;AAIZ;IAHC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;IACV,IAAA,qBAAW,GAAE;;6DACS;AAIvB;IAHC,IAAA,4BAAU,GAAE;IACZ,IAAA,uBAAK,GAAE;IACP,IAAA,qBAAW,GAAE;;uDACG;AAIjB;IAHC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;IACZ,IAAA,qBAAW,GAAE;;4DACQ","sourcesContent":["import { IsInt, IsOptional, IsString, IsNotEmpty, IsBoolean, IsDate } from 'class-validator';\nimport { ApiProperty } from '@nestjs/swagger';\n\nexport class UpdateScheduledJobDto {\n @IsOptional()\n @IsInt()\n id: number;\n @IsNotEmpty()\n @IsOptional()\n @IsString()\n @ApiProperty()\n scheduleName: string;\n @IsNotEmpty()\n @IsOptional()\n @IsBoolean()\n @ApiProperty()\n isActive: boolean;\n @IsNotEmpty()\n @IsOptional()\n @IsString()\n @ApiProperty()\n frequency: string;\n @IsOptional()\n @IsDate()\n @ApiProperty()\n startTime: Date;\n @IsOptional()\n @IsDate()\n @ApiProperty()\n endTime: Date;\n @IsOptional()\n @IsDate()\n @ApiProperty()\n startDate: Date;\n @IsOptional()\n @IsDate()\n @ApiProperty()\n endDate: Date;\n @IsOptional()\n @IsInt()\n @ApiProperty()\n dayOfMonth: number;\n @IsOptional()\n @IsDate()\n @ApiProperty()\n lastRunAt: Date;\n @IsOptional()\n @IsDate()\n @ApiProperty()\n nextRunAt: Date;\n @IsOptional()\n @IsString()\n @ApiProperty()\n dayOfWeek: string;\n @IsNotEmpty()\n @IsOptional()\n @IsString()\n @ApiProperty()\n job: string;\n @IsOptional()\n @IsString()\n @ApiProperty()\n cronExpression: string;\n @IsOptional()\n @IsInt()\n @ApiProperty()\n moduleId: number;\n @IsString()\n @IsOptional()\n @ApiProperty()\n moduleUserKey: string;\n}"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scheduled-job.entity.d.ts","sourceRoot":"","sources":["../../src/entities/scheduled-job.entity.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAErE,qBACa,YAAa,SAAQ,YAAY;IAG1C,YAAY,EAAE,MAAM,CAAC;IAErB,QAAQ,EAAE,OAAO,CAAS;IAE1B,SAAS,EAAE,MAAM,CAAC;IAElB,SAAS,EAAE,IAAI,CAAC;IAEhB,OAAO,EAAE,IAAI,CAAC;IAEd,SAAS,EAAE,IAAI,CAAC;IAEhB,OAAO,EAAE,IAAI,CAAC;IAEd,UAAU,EAAE,MAAM,CAAC;IAEnB,SAAS,EAAE,IAAI,CAAC;IAEhB,SAAS,EAAE,IAAI,CAAC;IAEhB,SAAS,EAAE,MAAM,CAAC;IAElB,GAAG,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"scheduled-job.entity.d.ts","sourceRoot":"","sources":["../../src/entities/scheduled-job.entity.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAErE,qBACa,YAAa,SAAQ,YAAY;IAG1C,YAAY,EAAE,MAAM,CAAC;IAErB,QAAQ,EAAE,OAAO,CAAS;IAE1B,SAAS,EAAE,MAAM,CAAC;IAElB,SAAS,EAAE,IAAI,CAAC;IAEhB,OAAO,EAAE,IAAI,CAAC;IAEd,SAAS,EAAE,IAAI,CAAC;IAEhB,OAAO,EAAE,IAAI,CAAC;IAEd,UAAU,EAAE,MAAM,CAAC;IAEnB,SAAS,EAAE,IAAI,CAAC;IAEhB,SAAS,EAAE,IAAI,CAAC;IAEhB,SAAS,EAAE,MAAM,CAAC;IAElB,GAAG,EAAE,MAAM,CAAC;IAEZ,cAAc,EAAE,MAAM,CAAC;IAIvB,MAAM,EAAE,cAAc,CAAC;CAC1B"}
|
|
@@ -20,7 +20,7 @@ let ScheduledJob = class ScheduledJob extends common_entity_1.CommonEntity {
|
|
|
20
20
|
this.isActive = false;
|
|
21
21
|
}
|
|
22
22
|
static _OPENAPI_METADATA_FACTORY() {
|
|
23
|
-
return { scheduleName: { required: true, type: () => String }, isActive: { required: true, type: () => Boolean, default: false }, frequency: { required: true, type: () => String }, startTime: { required: true, type: () => Date }, endTime: { required: true, type: () => Date }, startDate: { required: true, type: () => Date }, endDate: { required: true, type: () => Date }, dayOfMonth: { required: true, type: () => Number }, lastRunAt: { required: true, type: () => Date }, nextRunAt: { required: true, type: () => Date }, dayOfWeek: { required: true, type: () => String }, job: { required: true, type: () => String }, module: { required: true, type: () => require("./module-metadata.entity").ModuleMetadata } };
|
|
23
|
+
return { scheduleName: { required: true, type: () => String }, isActive: { required: true, type: () => Boolean, default: false }, frequency: { required: true, type: () => String }, startTime: { required: true, type: () => Date }, endTime: { required: true, type: () => Date }, startDate: { required: true, type: () => Date }, endDate: { required: true, type: () => Date }, dayOfMonth: { required: true, type: () => Number }, lastRunAt: { required: true, type: () => Date }, nextRunAt: { required: true, type: () => Date }, dayOfWeek: { required: true, type: () => String }, job: { required: true, type: () => String }, cronExpression: { required: true, type: () => String }, module: { required: true, type: () => require("./module-metadata.entity").ModuleMetadata } };
|
|
24
24
|
}
|
|
25
25
|
};
|
|
26
26
|
exports.ScheduledJob = ScheduledJob;
|
|
@@ -73,6 +73,10 @@ __decorate([
|
|
|
73
73
|
(0, typeorm_1.Column)({ type: "varchar" }),
|
|
74
74
|
__metadata("design:type", String)
|
|
75
75
|
], ScheduledJob.prototype, "job", void 0);
|
|
76
|
+
__decorate([
|
|
77
|
+
(0, typeorm_1.Column)({ type: "varchar", nullable: true }),
|
|
78
|
+
__metadata("design:type", String)
|
|
79
|
+
], ScheduledJob.prototype, "cronExpression", void 0);
|
|
76
80
|
__decorate([
|
|
77
81
|
(0, typeorm_1.Index)(),
|
|
78
82
|
(0, typeorm_1.ManyToOne)(() => module_metadata_entity_1.ModuleMetadata, { nullable: false }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scheduled-job.entity.js","sourceRoot":"","sources":["../../src/entities/scheduled-job.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,qCAAuE;AACvE,mDAA+C;AAC/C,qEAAqE;AAG9D,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,4BAAY;IAAvC;;QAKH,aAAQ,GAAY,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"scheduled-job.entity.js","sourceRoot":"","sources":["../../src/entities/scheduled-job.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,qCAAuE;AACvE,mDAA+C;AAC/C,qEAAqE;AAG9D,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,4BAAY;IAAvC;;QAKH,aAAQ,GAAY,KAAK,CAAC;KA2B7B;;iIA3BuB,KAAK;;CA2B5B,CAAA;AAhCY,oCAAY;AAGrB;IAFC,IAAA,eAAK,EAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IACvB,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;;kDACP;AAErB;IADC,IAAA,gBAAM,EAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;;8CACD;AAE1B;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,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BA/Bd,YAAY;IADxB,IAAA,gBAAM,EAAC,kBAAkB,CAAC;GACd,YAAY,CAgCxB","sourcesContent":["import { Entity, Column, ManyToOne, JoinColumn, Index } from 'typeorm';\nimport { CommonEntity } from './common.entity';\nimport { ModuleMetadata } from 'src/entities/module-metadata.entity';\n\n@Entity('ss_scheduled_job')\nexport class ScheduledJob extends CommonEntity {\n @Index({ unique: true })\n @Column({ type: \"varchar\" })\n scheduleName: string;\n @Column({ default: false })\n isActive: boolean = false;\n @Column({ type: \"varchar\" })\n frequency: string;\n @Column({ type: \"time\", nullable: true })\n startTime: Date;\n @Column({ type: \"time\", nullable: true })\n endTime: Date;\n @Column({ type: \"date\", nullable: true })\n startDate: Date;\n @Column({ type: \"date\", nullable: true })\n endDate: Date;\n @Column({ type: \"integer\", nullable: true })\n dayOfMonth: number;\n @Column({ nullable: true })\n lastRunAt: Date;\n @Column({ nullable: true })\n nextRunAt: Date;\n @Column({ type: \"varchar\", nullable: true })\n dayOfWeek: string;\n @Column({ type: \"varchar\" })\n job: string;\n @Column({ type: \"varchar\", nullable: true })\n cronExpression: string;\n @Index()\n @ManyToOne(() => ModuleMetadata, { nullable: false })\n @JoinColumn({ referencedColumnName: 'id' })\n module: ModuleMetadata;\n}\n"]}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
export type CommandWithArgs = {
|
|
2
|
+
command: string;
|
|
3
|
+
args: string[];
|
|
4
|
+
};
|
|
1
5
|
export declare class CommandService {
|
|
2
6
|
private readonly logger;
|
|
3
|
-
|
|
7
|
+
private escapeArgForWindows;
|
|
8
|
+
executeCommandWithArgs(commandWithArgs: CommandWithArgs): Promise<string>;
|
|
4
9
|
}
|
|
5
10
|
//# sourceMappingURL=command.service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.service.d.ts","sourceRoot":"","sources":["../../src/helpers/command.service.ts"],"names":[],"mappings":"AAGA,qBACa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAmC;
|
|
1
|
+
{"version":3,"file":"command.service.d.ts","sourceRoot":"","sources":["../../src/helpers/command.service.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB,CAAC;AAEF,qBACa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAmC;IAM1D,OAAO,CAAC,mBAAmB;IAcrB,sBAAsB,CAAC,eAAe,EAAE,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC;CA2ChF"}
|
|
@@ -14,18 +14,41 @@ let CommandService = CommandService_1 = class CommandService {
|
|
|
14
14
|
constructor() {
|
|
15
15
|
this.logger = new common_1.Logger(CommandService_1.name);
|
|
16
16
|
}
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
escapeArgForWindows(arg) {
|
|
18
|
+
if (/[{}\s"^&|<>]/.test(arg)) {
|
|
19
|
+
const escaped = arg.replace(/"/g, '\\"');
|
|
20
|
+
return `"${escaped}"`;
|
|
21
|
+
}
|
|
22
|
+
return arg;
|
|
23
|
+
}
|
|
24
|
+
async executeCommandWithArgs(commandWithArgs) {
|
|
25
|
+
const { command, args } = commandWithArgs;
|
|
26
|
+
this.logger.debug(`Executing command: ${command} ${args.join(' ')}`);
|
|
19
27
|
return new Promise((resolve, reject) => {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
const isWindows = process.platform === 'win32';
|
|
29
|
+
const spawnArgs = isWindows
|
|
30
|
+
? args.map(arg => this.escapeArgForWindows(arg))
|
|
31
|
+
: args;
|
|
32
|
+
const child = (0, child_process_1.spawn)(command, spawnArgs, {
|
|
33
|
+
shell: isWindows,
|
|
34
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
35
|
+
});
|
|
36
|
+
let stdout = '';
|
|
37
|
+
let stderr = '';
|
|
38
|
+
child.stdout.on('data', (data) => {
|
|
39
|
+
stdout += data.toString();
|
|
40
|
+
});
|
|
41
|
+
child.stderr.on('data', (data) => {
|
|
42
|
+
stderr += data.toString();
|
|
43
|
+
});
|
|
44
|
+
child.on('error', (error) => {
|
|
45
|
+
this.logger.error(`Error executing command: ${command}`, error);
|
|
46
|
+
reject(error);
|
|
47
|
+
});
|
|
48
|
+
child.on('close', (code) => {
|
|
49
|
+
if (code !== 0) {
|
|
50
|
+
this.logger.error(`Command failed with code ${code}: ${command}`, stderr);
|
|
51
|
+
reject(new Error(stderr || `Command failed with exit code ${code}`));
|
|
29
52
|
return;
|
|
30
53
|
}
|
|
31
54
|
resolve(stdout);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.service.js","sourceRoot":"","sources":["../../src/helpers/command.service.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAAoD;AACpD,
|
|
1
|
+
{"version":3,"file":"command.service.js","sourceRoot":"","sources":["../../src/helpers/command.service.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAAoD;AACpD,iDAAsC;AAQ/B,IAAM,cAAc,sBAApB,MAAM,cAAc;IAApB;QACY,WAAM,GAAG,IAAI,eAAM,CAAC,gBAAc,CAAC,IAAI,CAAC,CAAC;IA+D5D,CAAC;IAzDS,mBAAmB,CAAC,GAAW;QAGrC,IAAI,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;YAE7B,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;YACzC,OAAO,IAAI,OAAO,GAAG,CAAC;QACxB,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;IAKD,KAAK,CAAC,sBAAsB,CAAC,eAAgC;QAC3D,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,eAAe,CAAC;QAC1C,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC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AI,KAAK,CAAC,EAAE,CAAC;oBACf,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,4BAA4B,IAAI,KAAK,OAAO,EAAE,EAAE,MAAM,CAAC,CAAC;oBAC1E,MAAM,CAAC,IAAI,KAAK,CAAC,MAAM,IAAI,iCAAiC,IAAI,EAAE,CAAC,CAAC,CAAC;oBACrE,OAAO;gBACT,CAAC;gBACD,OAAO,CAAC,MAAM,CAAC,CAAC;YAClB,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AAhEY,wCAAc;yBAAd,cAAc;IAD1B,IAAA,mBAAU,GAAE;GACA,cAAc,CAgE1B","sourcesContent":["import { Injectable, Logger } from '@nestjs/common';\nimport { spawn } from 'child_process';\n\nexport type CommandWithArgs = {\n command: string;\n args: string[];\n};\n\n@Injectable()\nexport class CommandService {\n private readonly logger = new Logger(CommandService.name);\n\n /**\n * Escape an argument for Windows CMD shell\n * Wraps in double quotes and escapes internal double quotes\n */\n private escapeArgForWindows(arg: string): string {\n // If arg contains special characters, wrap in double quotes\n // and escape internal double quotes with backslash\n if (/[{}\\s\"^&|<>]/.test(arg)) {\n // Escape internal double quotes with backslash for CMD\n const escaped = arg.replace(/\"/g, '\\\\\"');\n return `\"${escaped}\"`;\n }\n return arg;\n }\n\n /**\n * Execute a command with arguments array (cross-platform compatible)\n */\n async executeCommandWithArgs(commandWithArgs: CommandWithArgs): Promise<string> {\n const { command, args } = commandWithArgs;\n this.logger.debug(`Executing command: ${command} ${args.join(' ')}`);\n\n return new Promise<string>((resolve, reject) => {\n const isWindows = process.platform === 'win32';\n\n // On Windows with shell: true, we need to escape args containing special characters\n const spawnArgs = isWindows\n ? args.map(arg => this.escapeArgForWindows(arg))\n : args;\n\n const child = spawn(command, spawnArgs, {\n shell: isWindows, // Use shell on Windows to handle .cmd files\n stdio: ['pipe', 'pipe', 'pipe'],\n });\n\n let stdout = '';\n let stderr = '';\n\n child.stdout.on('data', (data) => {\n stdout += data.toString();\n });\n\n child.stderr.on('data', (data) => {\n stderr += data.toString();\n });\n\n child.on('error', (error) => {\n this.logger.error(`Error executing command: ${command}`, error);\n reject(error);\n });\n\n child.on('close', (code) => {\n if (code !== 0) {\n this.logger.error(`Command failed with code ${code}: ${command}`, stderr);\n reject(new Error(stderr || `Command failed with exit code ${code}`));\n return;\n }\n resolve(stdout);\n });\n });\n }\n}\n"]}
|
|
@@ -52,13 +52,13 @@ class ManyToOneRelationFieldCrudManager {
|
|
|
52
52
|
if ((0, class_validator_1.isNotEmpty)(fieldId)) {
|
|
53
53
|
dto[this.options.fieldName] = await this.options.entityManager.getRepository(coModelEntityName).findOneBy({ id: fieldId });
|
|
54
54
|
if (this.options.required && (0, class_validator_1.isEmpty)(dto[this.options.fieldName])) {
|
|
55
|
-
throw new Error(`
|
|
55
|
+
throw new Error(`Field ${this.options.fieldName} resolution failed. Record with id: ${fieldId} not found in ${this.options.relationCoModelSingularName}`);
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
else {
|
|
59
59
|
dto[this.options.fieldName] = await this.options.entityManager.getRepository(coModelEntityName).findOneBy({ [this.options.relationCoModelUserKeyFieldName]: fieldUserKeyValue });
|
|
60
60
|
if (this.options.required && (0, class_validator_1.isEmpty)(dto[this.options.fieldName])) {
|
|
61
|
-
throw new Error(`
|
|
61
|
+
throw new Error(`Field ${this.options.fieldName} resolution failed. Record with userKey: ${this.options.relationCoModelUserKeyFieldName}: ${fieldUserKeyValue} not found in ${this.options.relationCoModelSingularName}`);
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
return dto;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ManyToOneRelationFieldCrudManager.js","sourceRoot":"","sources":["../../../src/helpers/field-crud-managers/ManyToOneRelationFieldCrudManager.ts"],"names":[],"mappings":";;;AAAA,oEAAkE;AAClE,2CAAqD;AACrD,qDAAgE;AAEhE,sEAA+D;AAe/D,MAAa,iCAAiC;IAG1C,YAA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AO,CAAC,QAAQ,IAAI,IAAA,yBAAO,EAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC;gBAChE,MAAM,IAAI,KAAK,CAAC,SAAS,IAAI,CAAC,OAAO,CAAC,SAAS,uCAAuC,OAAO,iBAAiB,IAAI,CAAC,OAAO,CAAC,2BAA2B,EAAE,CAAC,CAAC;YAC9J,CAAC;QACL,CAAC;aACI,CAAC;YACF,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,aAAa,CAAC,iBAAiB,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,+BAA+B,CAAC,EAAE,iBAAiB,EAAE,CAAC,CAAC;YACjL,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,IAAI,IAAA,yBAAO,EAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC;gBAChE,MAAM,IAAI,KAAK,CAAC,SAAS,IAAI,CAAC,OAAO,CAAC,SAAS,4CAA4C,IAAI,CAAC,OAAO,CAAC,+BAA+B,KAAK,iBAAiB,iBAAiB,IAAI,CAAC,OAAO,CAAC,2BAA2B,EAAE,CAAC,CAAC;YAC9N,CAAC;QACL,CAAC;QAGD,OAAO,GAAG,CAAC;IACf,CAAC;IAEO,yBAAyB;QAC7B,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC;IACjC,CAAC;CASJ;AArFD,8EAqFC","sourcesContent":["import { classify } from \"@angular-devkit/core/src/utils/strings\";\nimport { BadRequestException } from \"@nestjs/common\";\nimport { isEmpty, isNotEmpty, isString } from \"class-validator\";\nimport { FieldCrudManager, ValidationError } from \"src/interfaces\";\nimport { IsParsableInt } from \"src/validators/is-parsable-int\";\nimport { EntityManager } from \"typeorm\";\n\nexport interface ManyToOneRelationFieldOptions {\n // Add options for relation field\n required: boolean | undefined | null;\n relationCoModelSingularName: string | undefined | null;\n fieldName: string | undefined | null;\n // modelUserKeyFieldName: string | undefined | null;\n modelSingularName: string | undefined | null;\n entityManager: EntityManager;\n relationCoModelUserKeyFieldName: string | undefined | null; \n}\n\n// This implementation is meant to be used for many-to-one relation field\nexport class ManyToOneRelationFieldCrudManager implements FieldCrudManager {\n private idFieldName: string;\n private userKeyFieldName: string;\n constructor(private readonly options: ManyToOneRelationFieldOptions) {\n // this.options = options;\n this.idFieldName = `${options.fieldName}Id`;\n this.userKeyFieldName = `${options.fieldName}UserKey`;\n }\n validate(dto: any) {\n const fieldId: number = dto[this.idFieldName];\n const fieldUserKey: string = dto[this.userKeyFieldName];\n return this.applyValidations(fieldId, fieldUserKey);\n }\n\n private applyValidations(fieldId: any, fieldUserKey: string): ValidationError[] {\n const errors: ValidationError[] = [];\n this.isApplyRequiredValidation() && isEmpty(fieldId) && isEmpty(fieldUserKey) ? errors.push({ field: this.options.fieldName, error: `Field: ${this.options.fieldName} is required. Either pass ${this.idFieldName} or ${this.userKeyFieldName}.` }) : \"no errors\";\n if (isNotEmpty(fieldId)) {\n errors.push(...this.applyIdFormatValidations(fieldId));\n }\n if (isNotEmpty(fieldUserKey)) {\n errors.push(...this.applyUserKeyFormatValidations(fieldUserKey));\n }\n return errors;\n }\n\n private applyIdFormatValidations(fieldId: any): ValidationError[] { //FIXME fieldId is any because it can be string or number. Keeping it any for compatibility with isParsableInt. \n const errors: ValidationError[] = [];\n !IsParsableInt(fieldId) ? errors.push({ field: this.options.fieldName, error: 'Field is not a integer' }) : \"no errors\";\n return errors;\n }\n\n private applyUserKeyFormatValidations(fieldUserKey: string): ValidationError[] {\n const errors: ValidationError[] = [];\n !isString(fieldUserKey) ? errors.push({ field: this.options.fieldName, error: 'Field is not a string' }) : \"no errors\";\n if (isEmpty(this.options.relationCoModelUserKeyFieldName)) {\n errors.push({ field: this.options.fieldName, error: `UserKey field name is not defined in the model ${this.options.relationCoModelSingularName}` });\n }\n return errors;\n }\n\n async transformForCreate(dto: any): Promise<any> {\n const fieldId: number = dto[this.idFieldName];\n const fieldUserKeyValue: string = dto[this.userKeyFieldName];\n\n // Avoid transforming if both fieldId and fieldUserKey is empty\n if ((isEmpty(fieldId)) && isEmpty(fieldUserKeyValue)) return dto;\n\n if (!this.options.relationCoModelSingularName) {\n throw new BadRequestException(`ManyToOneRelationFieldCrudManager: relationCoModelSingularName is not defined in the field: ${this.options.fieldName}`);\n }\n // // Load the related entity from the database, using the repository of the related entity\n //const entityTarget = this.getRelatedEntityTarget(classify(this.options.relationCoModelSingularName));\n const coModelEntityName = classify(this.options.relationCoModelSingularName);\n\n //Load the related entity from the database, using the repository of the related entity\n //const entityTarget = this.getRelatedEntityTarget(classify(this.options.relationCoModelSingularName));\n if (isNotEmpty(fieldId)) {\n dto[this.options.fieldName] = await this.options.entityManager.getRepository(coModelEntityName).findOneBy({ id: fieldId });\n if (this.options.required && isEmpty(dto[this.options.fieldName])) {\n throw new Error(`Field ${this.options.fieldName} resolution failed. Record with id: ${fieldId} not found in ${this.options.relationCoModelSingularName}`);\n }\n }\n else {\n dto[this.options.fieldName] = await this.options.entityManager.getRepository(coModelEntityName).findOneBy({ [this.options.relationCoModelUserKeyFieldName]: fieldUserKeyValue });\n if (this.options.required && isEmpty(dto[this.options.fieldName])) {\n throw new Error(`Field ${this.options.fieldName} resolution failed. Record with userKey: ${this.options.relationCoModelUserKeyFieldName}: ${fieldUserKeyValue} not found in ${this.options.relationCoModelSingularName}`);\n }\n }\n\n\n return dto;\n }\n\n private isApplyRequiredValidation(): boolean {\n return this.options.required;\n }\n\n // Returns the entity target class from the entity name\n // private getRelatedEntityTarget(relatedEntityName: string): any {\n // const entityMetadatas = this.options.entityManager.connection.entityMetadatas;\n // const relatedEntityMetadata = entityMetadatas.find(em => em.name === relatedEntityName);\n // return relatedEntityMetadata.target;\n // }\n\n}"]}
|
|
@@ -27,11 +27,12 @@ export declare class SchematicService {
|
|
|
27
27
|
private readonly solidRegistry;
|
|
28
28
|
private readonly logger;
|
|
29
29
|
private readonly SCHEMATIC_PROJECT;
|
|
30
|
+
private readonly SCHEMATICS_COMMAND;
|
|
30
31
|
constructor(commandService: CommandService, solidRegistry: SolidRegistry);
|
|
31
32
|
executeSchematicCommand(command: string, options: GenerateModuleOptions | ModelAndFieldGenerationOptions, debug?: boolean): Promise<string>;
|
|
32
33
|
private generateSchematicCommand;
|
|
33
|
-
private
|
|
34
|
-
private
|
|
34
|
+
private buildFieldGenerationArgs;
|
|
35
|
+
private buildModelGenerationArgs;
|
|
35
36
|
}
|
|
36
37
|
export {};
|
|
37
38
|
//# sourceMappingURL=schematic.service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schematic.service.d.ts","sourceRoot":"","sources":["../../src/helpers/schematic.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"schematic.service.d.ts","sourceRoot":"","sources":["../../src/helpers/schematic.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAE,cAAc,EAAmB,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,eAAO,MAAM,kBAAkB,eAAe,CAAC;AAC/C,MAAM,MAAM,qBAAqB,GAAG;IAClC,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAGF,KAAK,8BAA8B,GAAG;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,iBAAiB,EAAE,MAAM,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,2BAA2B,CAAC,EAAE,OAAO,CAAC;IACtC,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,aAAa,EAAE,CAAC;CACzB,CAAC;AACF,eAAO,MAAM,qBAAqB,kBAAkB,CAAC;AACrD,eAAO,MAAM,qBAAqB,kBAAkB,CAAC;AAGrD,qBACa,gBAAgB;IAKf,OAAO,CAAC,QAAQ,CAAC,cAAc;IAAkB,OAAO,CAAC,QAAQ,CAAC,aAAa;IAJ3F,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAqC;IAC5D,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAuC;IACzE,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAgB;gBAEtB,cAAc,EAAE,cAAc,EAAmB,aAAa,EAAE,aAAa;IAEpG,uBAAuB,CAC3B,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,qBAAqB,GAAG,8BAA8B,EAC/D,KAAK,UAAQ,GACZ,OAAO,CAAC,MAAM,CAAC;IAKlB,OAAO,CAAC,wBAAwB;IA4BhC,OAAO,CAAC,wBAAwB;IAWhC,OAAO,CAAC,wBAAwB;CAgDjC"}
|
|
@@ -24,74 +24,79 @@ let SchematicService = SchematicService_1 = class SchematicService {
|
|
|
24
24
|
this.solidRegistry = solidRegistry;
|
|
25
25
|
this.logger = new common_1.Logger(SchematicService_1.name);
|
|
26
26
|
this.SCHEMATIC_PROJECT = '@solidstarters/solid-code-builder';
|
|
27
|
+
this.SCHEMATICS_COMMAND = 'schematics';
|
|
27
28
|
}
|
|
28
29
|
async executeSchematicCommand(command, options, debug = false) {
|
|
29
|
-
|
|
30
|
+
const commandWithArgs = this.generateSchematicCommand(command, options, debug);
|
|
31
|
+
return await this.commandService.executeCommandWithArgs(commandWithArgs);
|
|
30
32
|
}
|
|
31
33
|
generateSchematicCommand(command, options, debug) {
|
|
32
|
-
const
|
|
34
|
+
const schematicName = `${this.SCHEMATIC_PROJECT}:${command}`;
|
|
35
|
+
const baseArgs = [schematicName, `--debug=${debug}`];
|
|
33
36
|
if (command === exports.REMOVE_FIELDS_COMMAND ||
|
|
34
37
|
command === exports.REFRESH_MODEL_COMMAND) {
|
|
35
38
|
const { fields, ...modelSpecificOptions } = options;
|
|
36
|
-
const
|
|
37
|
-
const
|
|
38
|
-
const
|
|
39
|
-
this.logger.debug('schematicCommand',
|
|
40
|
-
return
|
|
39
|
+
const modelArgs = this.buildModelGenerationArgs(modelSpecificOptions);
|
|
40
|
+
const fieldArgs = this.buildFieldGenerationArgs(fields);
|
|
41
|
+
const args = [...baseArgs, ...modelArgs, ...fieldArgs];
|
|
42
|
+
this.logger.debug('schematicCommand args', args);
|
|
43
|
+
return { command: this.SCHEMATICS_COMMAND, args };
|
|
41
44
|
}
|
|
42
45
|
else if (command === exports.ADD_MODULE_COMMAND) {
|
|
43
46
|
const moduleOptions = options;
|
|
44
|
-
const
|
|
45
|
-
this.logger.debug('schematicCommand',
|
|
46
|
-
return
|
|
47
|
+
const args = [...baseArgs, `--module=${moduleOptions.module}`];
|
|
48
|
+
this.logger.debug('schematicCommand args', args);
|
|
49
|
+
return { command: this.SCHEMATICS_COMMAND, args };
|
|
47
50
|
}
|
|
48
51
|
else {
|
|
49
52
|
throw new Error('Schematic command not supported.');
|
|
50
53
|
}
|
|
51
54
|
}
|
|
52
|
-
|
|
55
|
+
buildFieldGenerationArgs(fields) {
|
|
53
56
|
return fields
|
|
54
57
|
.filter((field) => {
|
|
55
58
|
return !this.solidRegistry.getCommonEntityKeys().map(key => key.toString()).includes(field.name);
|
|
56
59
|
})
|
|
57
60
|
.map((field) => {
|
|
58
|
-
return `--fields
|
|
59
|
-
})
|
|
60
|
-
.join(' ');
|
|
61
|
+
return `--fields=${JSON.stringify(field)}`;
|
|
62
|
+
});
|
|
61
63
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
+
buildModelGenerationArgs(modelSpecificOptions) {
|
|
65
|
+
const args = [
|
|
66
|
+
`--module=${modelSpecificOptions.module}`,
|
|
67
|
+
`--model=${modelSpecificOptions.model}`,
|
|
68
|
+
];
|
|
64
69
|
if (modelSpecificOptions.moduleDisplayName) {
|
|
65
|
-
|
|
70
|
+
args.push(`--module-display-name=${(0, lodash_1.snakeCase)(modelSpecificOptions.moduleDisplayName)}`);
|
|
66
71
|
}
|
|
67
72
|
if (modelSpecificOptions.table) {
|
|
68
|
-
|
|
73
|
+
args.push(`--table=${modelSpecificOptions.table}`);
|
|
69
74
|
}
|
|
70
75
|
if (modelSpecificOptions.dataSource) {
|
|
71
|
-
|
|
76
|
+
args.push(`--data-source=${modelSpecificOptions.dataSource}`);
|
|
72
77
|
}
|
|
73
78
|
if (modelSpecificOptions.modelEnableSoftDelete) {
|
|
74
|
-
|
|
79
|
+
args.push(`--model-enable-soft-delete=${modelSpecificOptions.modelEnableSoftDelete}`);
|
|
75
80
|
}
|
|
76
81
|
if (modelSpecificOptions.parentModel) {
|
|
77
|
-
|
|
82
|
+
args.push(`--parent-model=${modelSpecificOptions.parentModel}`);
|
|
78
83
|
}
|
|
79
84
|
if (modelSpecificOptions.parentModule) {
|
|
80
|
-
|
|
85
|
+
args.push(`--parent-module=${modelSpecificOptions.parentModule}`);
|
|
81
86
|
}
|
|
82
87
|
if (modelSpecificOptions.draftPublishWorkflowEnabled) {
|
|
83
|
-
|
|
88
|
+
args.push(`--draft-publish-workflow-enabled=${modelSpecificOptions.draftPublishWorkflowEnabled}`);
|
|
84
89
|
}
|
|
85
90
|
if (modelSpecificOptions.isLegacyTable) {
|
|
86
|
-
|
|
91
|
+
args.push(`--is-legacy-table=${modelSpecificOptions.isLegacyTable}`);
|
|
87
92
|
}
|
|
88
93
|
if (modelSpecificOptions.isLegacyTableWithId) {
|
|
89
|
-
|
|
94
|
+
args.push(`--is-legacy-table-with-id=${modelSpecificOptions.isLegacyTableWithId}`);
|
|
90
95
|
}
|
|
91
96
|
if (modelSpecificOptions.dataSourceType) {
|
|
92
|
-
|
|
97
|
+
args.push(`--data-source-type=${modelSpecificOptions.dataSourceType}`);
|
|
93
98
|
}
|
|
94
|
-
return
|
|
99
|
+
return args;
|
|
95
100
|
}
|
|
96
101
|
};
|
|
97
102
|
exports.SchematicService = SchematicService;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schematic.service.js","sourceRoot":"","sources":["../../src/helpers/schematic.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAoD;AACpD,mCAAmC;AAEnC,
|
|
1
|
+
{"version":3,"file":"schematic.service.js","sourceRoot":"","sources":["../../src/helpers/schematic.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAoD;AACpD,mCAAmC;AAEnC,uDAAoE;AACpE,qDAAiD;AAEpC,QAAA,kBAAkB,GAAG,YAAY,CAAC;AAqBlC,QAAA,qBAAqB,GAAG,eAAe,CAAC;AACxC,QAAA,qBAAqB,GAAG,eAAe,CAAC;AAI9C,IAAM,gBAAgB,wBAAtB,MAAM,gBAAgB;IAK3B,YAA6B,cAA8B,EAAmB,aAA4B;QAA7E,mBAAc,GAAd,cAAc,CAAgB;QAAmB,kBAAa,GAAb,aAAa,CAAe;QAJzF,WAAM,GAAG,IAAI,eAAM,CAAC,kBAAgB,CAAC,IAAI,CAAC,CAAC;QAC3C,sBAAiB,GAAG,mCAAmC,CAAC;QACxD,uBAAkB,GAAG,YAAY,CAAC;IAE2D,CAAC;IAE/G,KAAK,CAAC,uBAAuB,CAC3B,OAAe,EACf,OAA+D,EAC/D,KAAK,GAAG,KAAK;QAEb,MAAM,eAAe,GAAG,IAAI,CAAC,wBAAwB,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;QAC/E,OAAO,MAAM,IAAI,CAAC,cAAc,CAAC,sBAAsB,CAAC,eAAe,CAAC,CAAC;IAC3E,CAAC;IAEO,wBAAwB,CA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AAC,IAAI,CAAC,mBAAmB,oBAAoB,CAAC,YAAY,EAAE,CAAC,CAAC;QACpE,CAAC;QAED,IAAI,oBAAoB,CAAC,2BAA2B,EAAE,CAAC;YACrD,IAAI,CAAC,IAAI,CAAC,oCAAoC,oBAAoB,CAAC,2BAA2B,EAAE,CAAC,CAAC;QACpG,CAAC;QAED,IAAI,oBAAoB,CAAC,aAAa,EAAE,CAAC;YACvC,IAAI,CAAC,IAAI,CAAC,qBAAqB,oBAAoB,CAAC,aAAa,EAAE,CAAC,CAAC;QACvE,CAAC;QAED,IAAI,oBAAoB,CAAC,mBAAmB,EAAE,CAAC;YAC7C,IAAI,CAAC,IAAI,CAAC,6BAA6B,oBAAoB,CAAC,mBAAmB,EAAE,CAAC,CAAC;QACrF,CAAC;QAED,IAAI,oBAAoB,CAAC,cAAc,EAAE,CAAC;YACxC,IAAI,CAAC,IAAI,CAAC,sBAAsB,oBAAoB,CAAC,cAAc,EAAE,CAAC,CAAC;QACzE,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF,CAAA;AAvGY,4CAAgB;2BAAhB,gBAAgB;IAD5B,IAAA,mBAAU,GAAE;qCAMkC,gCAAc,EAAkC,8BAAa;GAL/F,gBAAgB,CAuG5B","sourcesContent":["import { Injectable, Logger } from '@nestjs/common';\nimport { snakeCase } from \"lodash\";\nimport { FieldMetadata } from 'src/entities/field-metadata.entity';\nimport { CommandService, CommandWithArgs } from './command.service';\nimport { SolidRegistry } from './solid-registry';\n\nexport const ADD_MODULE_COMMAND = 'add-module';\nexport type GenerateModuleOptions = {\n module: string;\n};\ntype ModelGenerationOptions = Omit<ModelAndFieldGenerationOptions, 'fields'>;\n\ntype ModelAndFieldGenerationOptions = {\n module: string;\n model: string;\n moduleDisplayName: string;\n table?: string;\n dataSource: string;\n modelEnableSoftDelete?: boolean;\n parentModel?: string;\n parentModule?: string;\n draftPublishWorkflowEnabled?: boolean;\n isLegacyTable?: boolean;\n isLegacyTableWithId?: boolean;\n dataSourceType?: string;\n fields: FieldMetadata[]; //FIXME This type can be improved\n};\nexport const REMOVE_FIELDS_COMMAND = 'remove-fields';\nexport const REFRESH_MODEL_COMMAND = 'refresh-model';\n\n//TODO Rename to CodeBuilder service\n@Injectable()\nexport class SchematicService {\n private readonly logger = new Logger(SchematicService.name);\n private readonly SCHEMATIC_PROJECT = '@solidstarters/solid-code-builder';\n private readonly SCHEMATICS_COMMAND = 'schematics';\n\n constructor(private readonly commandService: CommandService, private readonly solidRegistry: SolidRegistry) { }\n\n async executeSchematicCommand(\n command: string,\n options: GenerateModuleOptions | ModelAndFieldGenerationOptions,\n debug = false,\n ): Promise<string> {\n const commandWithArgs = this.generateSchematicCommand(command, options, debug);\n return await this.commandService.executeCommandWithArgs(commandWithArgs);\n }\n\n private generateSchematicCommand(\n command: string,\n options: GenerateModuleOptions | ModelAndFieldGenerationOptions,\n debug: boolean,\n ): CommandWithArgs {\n const schematicName = `${this.SCHEMATIC_PROJECT}:${command}`;\n const baseArgs = [schematicName, `--debug=${debug}`];\n\n if (\n command === REMOVE_FIELDS_COMMAND ||\n command === REFRESH_MODEL_COMMAND\n ) {\n const { fields, ...modelSpecificOptions } = options as ModelAndFieldGenerationOptions;\n const modelArgs = this.buildModelGenerationArgs(modelSpecificOptions);\n const fieldArgs = this.buildFieldGenerationArgs(fields);\n const args = [...baseArgs, ...modelArgs, ...fieldArgs];\n this.logger.debug('schematicCommand args', args);\n return { command: this.SCHEMATICS_COMMAND, args };\n } else if (command === ADD_MODULE_COMMAND) {\n const moduleOptions = options as GenerateModuleOptions;\n const args = [...baseArgs, `--module=${moduleOptions.module}`];\n this.logger.debug('schematicCommand args', args);\n return { command: this.SCHEMATICS_COMMAND, args };\n } else {\n throw new Error('Schematic command not supported.');\n }\n }\n\n private buildFieldGenerationArgs(fields: FieldMetadata[]): string[] {\n return fields\n .filter((field) => {\n return !this.solidRegistry.getCommonEntityKeys().map(key => key.toString()).includes(field.name);\n })\n .map((field) => {\n // Using argument array eliminates the need for shell-specific quoting\n return `--fields=${JSON.stringify(field)}`;\n });\n }\n\n private buildModelGenerationArgs(modelSpecificOptions: ModelGenerationOptions): string[] {\n const args: string[] = [\n `--module=${modelSpecificOptions.module}`,\n `--model=${modelSpecificOptions.model}`,\n ];\n\n if (modelSpecificOptions.moduleDisplayName) {\n args.push(`--module-display-name=${snakeCase(modelSpecificOptions.moduleDisplayName)}`);\n }\n\n if (modelSpecificOptions.table) {\n args.push(`--table=${modelSpecificOptions.table}`);\n }\n\n if (modelSpecificOptions.dataSource) {\n args.push(`--data-source=${modelSpecificOptions.dataSource}`);\n }\n\n if (modelSpecificOptions.modelEnableSoftDelete) {\n args.push(`--model-enable-soft-delete=${modelSpecificOptions.modelEnableSoftDelete}`);\n }\n\n if (modelSpecificOptions.parentModel) {\n args.push(`--parent-model=${modelSpecificOptions.parentModel}`);\n }\n\n if (modelSpecificOptions.parentModule) {\n args.push(`--parent-module=${modelSpecificOptions.parentModule}`);\n }\n\n if (modelSpecificOptions.draftPublishWorkflowEnabled) {\n args.push(`--draft-publish-workflow-enabled=${modelSpecificOptions.draftPublishWorkflowEnabled}`);\n }\n\n if (modelSpecificOptions.isLegacyTable) {\n args.push(`--is-legacy-table=${modelSpecificOptions.isLegacyTable}`);\n }\n\n if (modelSpecificOptions.isLegacyTableWithId) {\n args.push(`--is-legacy-table-with-id=${modelSpecificOptions.isLegacyTableWithId}`);\n }\n\n if (modelSpecificOptions.dataSourceType) {\n args.push(`--data-source-type=${modelSpecificOptions.dataSourceType}`);\n }\n\n return args;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scheduled-job.repository.d.ts","sourceRoot":"","sources":["../../src/repository/scheduled-job.repository.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAE1E,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACjE,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAA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