@solidstarters/solid-core 1.2.154 → 1.2.156
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/dtos/create-list-of-values.dto.d.ts +2 -0
- package/dist/dtos/create-list-of-values.dto.d.ts.map +1 -1
- package/dist/dtos/create-list-of-values.dto.js +12 -1
- package/dist/dtos/create-list-of-values.dto.js.map +1 -1
- package/dist/dtos/update-list-of-values.dto.d.ts +2 -0
- package/dist/dtos/update-list-of-values.dto.d.ts.map +1 -1
- package/dist/dtos/update-list-of-values.dto.js +12 -1
- package/dist/dtos/update-list-of-values.dto.js.map +1 -1
- package/dist/entities/list-of-values.entity.d.ts +2 -0
- package/dist/entities/list-of-values.entity.d.ts.map +1 -1
- package/dist/entities/list-of-values.entity.js +7 -1
- package/dist/entities/list-of-values.entity.js.map +1 -1
- package/dist/helpers/cors.helper.js +1 -1
- package/dist/helpers/cors.helper.js.map +1 -1
- package/dist/mappers/list-of-values-mapper.d.ts +5 -0
- package/dist/mappers/list-of-values-mapper.d.ts.map +1 -0
- package/dist/mappers/list-of-values-mapper.js +28 -0
- package/dist/mappers/list-of-values-mapper.js.map +1 -0
- 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 +27 -137
- package/dist/services/list-of-values-metadata.service.d.ts +34 -0
- package/dist/services/list-of-values-metadata.service.d.ts.map +1 -0
- package/dist/services/list-of-values-metadata.service.js +213 -0
- package/dist/services/list-of-values-metadata.service.js.map +1 -0
- package/dist/solid-core.module.d.ts.map +1 -1
- package/dist/solid-core.module.js +6 -0
- package/dist/solid-core.module.js.map +1 -1
- package/dist/subscribers/list-of-values-metadata.subscriber.d.ts +18 -0
- package/dist/subscribers/list-of-values-metadata.subscriber.d.ts.map +1 -0
- package/dist/subscribers/list-of-values-metadata.subscriber.js +101 -0
- package/dist/subscribers/list-of-values-metadata.subscriber.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/dtos/create-list-of-values.dto.ts +7 -0
- package/src/dtos/update-list-of-values.dto.ts +8 -1
- package/src/entities/list-of-values.entity.ts +5 -1
- package/src/helpers/cors.helper.ts +1 -1
- package/src/mappers/list-of-values-mapper.ts +17 -0
- package/src/seeders/module-metadata-seeder.service.ts +1 -1
- package/src/seeders/seed-data/solid-core-metadata.json +27 -137
- package/src/services/list-of-values-metadata.service.ts +219 -0
- package/src/solid-core.module.ts +6 -0
- package/src/subscribers/list-of-values-metadata.subscriber.ts +115 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-list-of-values.dto.d.ts","sourceRoot":"","sources":["../../src/dtos/create-list-of-values.dto.ts"],"names":[],"mappings":"AAIA,qBAAa,qBAAqB;IAI9B,IAAI,EAAE,MAAM,CAAC;IAIb,KAAK,EAAE,MAAM,CAAC;IAId,OAAO,EAAE,MAAM,CAAC;IAIhB,WAAW,EAAE,MAAM,CAAC;IAIpB,OAAO,EAAE,OAAO,CAAS;IAIzB,QAAQ,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"create-list-of-values.dto.d.ts","sourceRoot":"","sources":["../../src/dtos/create-list-of-values.dto.ts"],"names":[],"mappings":"AAIA,qBAAa,qBAAqB;IAI9B,IAAI,EAAE,MAAM,CAAC;IAIb,KAAK,EAAE,MAAM,CAAC;IAId,OAAO,EAAE,MAAM,CAAC;IAIhB,WAAW,EAAE,MAAM,CAAC;IAIpB,OAAO,EAAE,OAAO,CAAS;IAIzB,QAAQ,EAAE,MAAM,CAAC;IAIjB,QAAQ,EAAE,MAAM,CAAC;IAGjB,aAAa,EAAE,MAAM,CAAC;CACzB"}
|
|
@@ -19,7 +19,7 @@ class CreateListOfValuesDto {
|
|
|
19
19
|
this.default = false;
|
|
20
20
|
}
|
|
21
21
|
static _OPENAPI_METADATA_FACTORY() {
|
|
22
|
-
return { type: { required: true, type: () => String }, value: { required: true, type: () => String }, display: { required: true, type: () => String }, description: { required: true, type: () => String }, default: { required: true, type: () => Boolean, default: false }, sequence: { required: true, type: () => Number } };
|
|
22
|
+
return { type: { required: true, type: () => String }, value: { required: true, type: () => String }, display: { required: true, type: () => String }, description: { required: true, type: () => String }, default: { required: true, type: () => Boolean, default: false }, sequence: { required: true, type: () => Number }, moduleId: { required: true, type: () => Number }, moduleUserKey: { required: true, type: () => String } };
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
exports.CreateListOfValuesDto = CreateListOfValuesDto;
|
|
@@ -59,4 +59,15 @@ __decorate([
|
|
|
59
59
|
(0, swagger_1.ApiProperty)(),
|
|
60
60
|
__metadata("design:type", Number)
|
|
61
61
|
], CreateListOfValuesDto.prototype, "sequence", void 0);
|
|
62
|
+
__decorate([
|
|
63
|
+
(0, class_validator_2.IsOptional)(),
|
|
64
|
+
(0, class_validator_2.IsInt)(),
|
|
65
|
+
(0, swagger_1.ApiProperty)(),
|
|
66
|
+
__metadata("design:type", Number)
|
|
67
|
+
], CreateListOfValuesDto.prototype, "moduleId", void 0);
|
|
68
|
+
__decorate([
|
|
69
|
+
(0, class_validator_1.IsString)(),
|
|
70
|
+
(0, class_validator_2.IsOptional)(),
|
|
71
|
+
__metadata("design:type", String)
|
|
72
|
+
], CreateListOfValuesDto.prototype, "moduleUserKey", void 0);
|
|
62
73
|
//# sourceMappingURL=create-list-of-values.dto.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-list-of-values.dto.js","sourceRoot":"","sources":["../../src/dtos/create-list-of-values.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,6CAA8C;AAC9C,qDAA2C;AAC3C,qDAA2E;AAE3E,MAAa,qBAAqB;IAAlC;QAoBI,YAAO,GAAY,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"create-list-of-values.dto.js","sourceRoot":"","sources":["../../src/dtos/create-list-of-values.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,6CAA8C;AAC9C,qDAA2C;AAC3C,qDAA2E;AAE3E,MAAa,qBAAqB;IAAlC;QAoBI,YAAO,GAAY,KAAK,CAAC;KAY5B;;6QAZsB,KAAK;;CAY3B;AAhCD,sDAgCC;AA5BG;IAHC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;IACV,IAAA,qBAAW,GAAE;;mDACD;AAIb;IAHC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;IACV,IAAA,qBAAW,GAAE;;oDACA;AAId;IAHC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;IACV,IAAA,qBAAW,GAAE;;sDACE;AAIhB;IAHC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;IACV,IAAA,qBAAW,GAAE;;0DACM;AAIpB;IAHC,IAAA,4BAAU,GAAE;IACZ,IAAA,2BAAS,GAAE;IACX,IAAA,qBAAW,GAAE;;sDACW;AAIzB;IAHC,IAAA,4BAAU,GAAE;IACZ,IAAA,uBAAK,GAAE;IACP,IAAA,qBAAW,GAAE;;uDACG;AAIjB;IAHC,IAAA,4BAAU,GAAE;IACZ,IAAA,uBAAK,GAAE;IACP,IAAA,qBAAW,GAAE;;uDACG;AAGjB;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;4DACS","sourcesContent":["import { ApiProperty } from '@nestjs/swagger';\nimport { IsString } from 'class-validator';\nimport { IsNotEmpty, IsBoolean, IsOptional, IsInt } from 'class-validator';\n\nexport class CreateListOfValuesDto {\n @IsNotEmpty()\n @IsString()\n @ApiProperty()\n type: string;\n @IsNotEmpty()\n @IsString()\n @ApiProperty()\n value: string;\n @IsNotEmpty()\n @IsString()\n @ApiProperty()\n display: string;\n @IsNotEmpty()\n @IsString()\n @ApiProperty()\n description: string;\n @IsOptional()\n @IsBoolean()\n @ApiProperty()\n default: boolean = false;\n @IsOptional()\n @IsInt()\n @ApiProperty()\n sequence: number;\n @IsOptional()\n @IsInt()\n @ApiProperty()\n moduleId: number;\n @IsString()\n @IsOptional()\n moduleUserKey: string;\n}"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-list-of-values.dto.d.ts","sourceRoot":"","sources":["../../src/dtos/update-list-of-values.dto.ts"],"names":[],"mappings":"AAGA,qBAAa,qBAAqB;IAG9B,EAAE,EAAE,MAAM,CAAC;IAKX,IAAI,EAAE,MAAM,CAAC;IAKb,KAAK,EAAE,MAAM,CAAC;IAKd,OAAO,EAAE,MAAM,CAAC;IAKhB,WAAW,EAAE,MAAM,CAAC;IAIpB,OAAO,EAAE,OAAO,CAAC;IAIjB,QAAQ,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"update-list-of-values.dto.d.ts","sourceRoot":"","sources":["../../src/dtos/update-list-of-values.dto.ts"],"names":[],"mappings":"AAGA,qBAAa,qBAAqB;IAG9B,EAAE,EAAE,MAAM,CAAC;IAKX,IAAI,EAAE,MAAM,CAAC;IAKb,KAAK,EAAE,MAAM,CAAC;IAKd,OAAO,EAAE,MAAM,CAAC;IAKhB,WAAW,EAAE,MAAM,CAAC;IAIpB,OAAO,EAAE,OAAO,CAAC;IAIjB,QAAQ,EAAE,MAAM,CAAC;IAIjB,QAAQ,EAAE,MAAM,CAAC;IAGjB,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 UpdateListOfValuesDto {
|
|
17
17
|
static _OPENAPI_METADATA_FACTORY() {
|
|
18
|
-
return { id: { required: true, type: () => Number }, type: { required: true, type: () => String }, value: { required: true, type: () => String }, display: { required: true, type: () => String }, description: { required: true, type: () => String }, default: { required: true, type: () => Boolean }, sequence: { required: true, type: () => Number } };
|
|
18
|
+
return { id: { required: true, type: () => Number }, type: { required: true, type: () => String }, value: { required: true, type: () => String }, display: { required: true, type: () => String }, description: { required: true, type: () => String }, default: { required: true, type: () => Boolean }, sequence: { required: true, type: () => Number }, moduleId: { required: true, type: () => Number }, moduleUserKey: { required: true, type: () => String } };
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
exports.UpdateListOfValuesDto = UpdateListOfValuesDto;
|
|
@@ -64,4 +64,15 @@ __decorate([
|
|
|
64
64
|
(0, swagger_1.ApiProperty)(),
|
|
65
65
|
__metadata("design:type", Number)
|
|
66
66
|
], UpdateListOfValuesDto.prototype, "sequence", void 0);
|
|
67
|
+
__decorate([
|
|
68
|
+
(0, class_validator_1.IsOptional)(),
|
|
69
|
+
(0, class_validator_1.IsInt)(),
|
|
70
|
+
(0, swagger_1.ApiProperty)(),
|
|
71
|
+
__metadata("design:type", Number)
|
|
72
|
+
], UpdateListOfValuesDto.prototype, "moduleId", void 0);
|
|
73
|
+
__decorate([
|
|
74
|
+
(0, class_validator_1.IsString)(),
|
|
75
|
+
(0, class_validator_1.IsOptional)(),
|
|
76
|
+
__metadata("design:type", String)
|
|
77
|
+
], UpdateListOfValuesDto.prototype, "moduleUserKey", void 0);
|
|
67
78
|
//# sourceMappingURL=update-list-of-values.dto.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-list-of-values.dto.js","sourceRoot":"","sources":["../../src/dtos/update-list-of-values.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"update-list-of-values.dto.js","sourceRoot":"","sources":["../../src/dtos/update-list-of-values.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,qDAAqF;AACrF,6CAA8C;AAE9C,MAAa,qBAAqB;;;;CAuCjC;AAvCD,sDAuCC;AApCG;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;;mDACD;AAKb;IAJC,IAAA,4BAAU,GAAE;IACZ,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;IACV,IAAA,qBAAW,GAAE;;oDACA;AAKd;IAJC,IAAA,4BAAU,GAAE;IACZ,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;IACV,IAAA,qBAAW,GAAE;;sDACE;AAKhB;IAJC,IAAA,4BAAU,GAAE;IACZ,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;IACV,IAAA,qBAAW,GAAE;;0DACM;AAIpB;IAHC,IAAA,4BAAU,GAAE;IACZ,IAAA,2BAAS,GAAE;IACX,IAAA,qBAAW,GAAE;;sDACG;AAIjB;IAHC,IAAA,4BAAU,GAAE;IACZ,IAAA,uBAAK,GAAE;IACP,IAAA,qBAAW,GAAE;;uDACG;AAIjB;IAHC,IAAA,4BAAU,GAAE;IACZ,IAAA,uBAAK,GAAE;IACP,IAAA,qBAAW,GAAE;;uDACG;AAGjB;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;4DACS","sourcesContent":["import { IsInt, IsOptional, IsString, IsNotEmpty, IsBoolean } from 'class-validator';\nimport { ApiProperty } from '@nestjs/swagger';\n\nexport class UpdateListOfValuesDto {\n @IsOptional()\n @IsInt()\n id: number;\n @IsNotEmpty()\n @IsOptional()\n @IsString()\n @ApiProperty()\n type: string;\n @IsNotEmpty()\n @IsOptional()\n @IsString()\n @ApiProperty()\n value: string;\n @IsNotEmpty()\n @IsOptional()\n @IsString()\n @ApiProperty()\n display: string;\n @IsNotEmpty()\n @IsOptional()\n @IsString()\n @ApiProperty()\n description: string;\n @IsOptional()\n @IsBoolean()\n @ApiProperty()\n default: boolean;\n @IsOptional()\n @IsInt()\n @ApiProperty()\n sequence: number;\n @IsOptional()\n @IsInt()\n @ApiProperty()\n moduleId: number;\n @IsString()\n @IsOptional()\n moduleUserKey: string;\n}"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { CommonEntity } from 'src/entities/common.entity';
|
|
2
|
+
import { ModuleMetadata } from 'src/entities/module-metadata.entity';
|
|
2
3
|
export declare class ListOfValues extends CommonEntity {
|
|
3
4
|
type: string;
|
|
4
5
|
value: string;
|
|
@@ -6,5 +7,6 @@ export declare class ListOfValues extends CommonEntity {
|
|
|
6
7
|
description: string;
|
|
7
8
|
default: boolean;
|
|
8
9
|
sequence: number;
|
|
10
|
+
module: ModuleMetadata;
|
|
9
11
|
}
|
|
10
12
|
//# sourceMappingURL=list-of-values.entity.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-of-values.entity.d.ts","sourceRoot":"","sources":["../../src/entities/list-of-values.entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;
|
|
1
|
+
{"version":3,"file":"list-of-values.entity.d.ts","sourceRoot":"","sources":["../../src/entities/list-of-values.entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AAEzD,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAA;AAEpE,qBACa,YAAa,SAAQ,YAAY;IAE1C,IAAI,EAAE,MAAM,CAAC;IAEb,KAAK,EAAE,MAAM,CAAC;IAEd,OAAO,EAAE,MAAM,CAAC;IAEhB,WAAW,EAAE,MAAM,CAAC;IAEpB,OAAO,EAAE,OAAO,CAAS;IAEzB,QAAQ,EAAE,MAAM,CAAC;IAGjB,MAAM,EAAE,cAAc,CAAC;CAC1B"}
|
|
@@ -13,13 +13,14 @@ exports.ListOfValues = void 0;
|
|
|
13
13
|
const openapi = require("@nestjs/swagger");
|
|
14
14
|
const common_entity_1 = require("./common.entity");
|
|
15
15
|
const typeorm_1 = require("typeorm");
|
|
16
|
+
const module_metadata_entity_1 = require("./module-metadata.entity");
|
|
16
17
|
let ListOfValues = class ListOfValues extends common_entity_1.CommonEntity {
|
|
17
18
|
constructor() {
|
|
18
19
|
super(...arguments);
|
|
19
20
|
this.default = false;
|
|
20
21
|
}
|
|
21
22
|
static _OPENAPI_METADATA_FACTORY() {
|
|
22
|
-
return { type: { required: true, type: () => String }, value: { required: true, type: () => String }, display: { required: true, type: () => String }, description: { required: true, type: () => String }, default: { required: true, type: () => Boolean, default: false }, sequence: { required: true, type: () => Number } };
|
|
23
|
+
return { type: { required: true, type: () => String }, value: { required: true, type: () => String }, display: { required: true, type: () => String }, description: { required: true, type: () => String }, default: { required: true, type: () => Boolean, default: false }, sequence: { required: true, type: () => Number }, module: { required: true, type: () => require("./module-metadata.entity").ModuleMetadata } };
|
|
23
24
|
}
|
|
24
25
|
};
|
|
25
26
|
exports.ListOfValues = ListOfValues;
|
|
@@ -47,6 +48,11 @@ __decorate([
|
|
|
47
48
|
(0, typeorm_1.Column)({ type: "int", nullable: true }),
|
|
48
49
|
__metadata("design:type", Number)
|
|
49
50
|
], ListOfValues.prototype, "sequence", void 0);
|
|
51
|
+
__decorate([
|
|
52
|
+
(0, typeorm_1.ManyToOne)(() => module_metadata_entity_1.ModuleMetadata, { onDelete: "CASCADE", nullable: true }),
|
|
53
|
+
(0, typeorm_1.JoinColumn)(),
|
|
54
|
+
__metadata("design:type", module_metadata_entity_1.ModuleMetadata)
|
|
55
|
+
], ListOfValues.prototype, "module", void 0);
|
|
50
56
|
exports.ListOfValues = ListOfValues = __decorate([
|
|
51
57
|
(0, typeorm_1.Entity)("ss_list_of_values")
|
|
52
58
|
], ListOfValues);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-of-values.entity.js","sourceRoot":"","sources":["../../src/entities/list-of-values.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,mDAAyD;AACzD,
|
|
1
|
+
{"version":3,"file":"list-of-values.entity.js","sourceRoot":"","sources":["../../src/entities/list-of-values.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,mDAAyD;AACzD,qCAA+D;AAC/D,qEAAoE;AAG7D,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,4BAAY;IAAvC;;QAUH,YAAO,GAAY,KAAK,CAAC;KAM5B;;6QANsB,KAAK;;CAM3B,CAAA;AAhBY,oCAAY;AAErB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;;0CACf;AAEb;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;;2CACd;AAEd;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;;6CACZ;AAEhB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;;iDACR;AAEpB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;;6CACnC;AAEzB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;8CACvB;AAGjB;IAFC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,uCAAc,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IACxE,IAAA,oBAAU,GAAE;8BACL,uCAAc;4CAAC;uBAfd,YAAY;IADxB,IAAA,gBAAM,EAAC,mBAAmB,CAAC;GACf,YAAY,CAgBxB","sourcesContent":["import { CommonEntity } from 'src/entities/common.entity'\nimport { Entity, Column, ManyToOne, JoinColumn } from 'typeorm'\nimport { ModuleMetadata } from 'src/entities/module-metadata.entity'\n\n@Entity(\"ss_list_of_values\")\nexport class ListOfValues extends CommonEntity {\n @Column({ type: \"varchar\" })\n type: string;\n @Column({ type: \"varchar\" })\n value: string;\n @Column({ type: \"varchar\" })\n display: string;\n @Column({ type: \"varchar\" })\n description: string;\n @Column({ type: \"boolean\", nullable: true, default: false })\n default: boolean = false;\n @Column({ type: \"int\", nullable: true })\n sequence: number;\n @ManyToOne(() => ModuleMetadata, { onDelete: \"CASCADE\", nullable: true })\n @JoinColumn()\n module: ModuleMetadata;\n}"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.buildDefaultCorsOptions = buildDefaultCorsOptions;
|
|
4
4
|
function buildDefaultCorsOptions(configService) {
|
|
5
|
-
const rawOrigins = configService.get('
|
|
5
|
+
const rawOrigins = configService.get('SECURITY_CORS_ORIGINS') ?? '*';
|
|
6
6
|
const allowed = rawOrigins.split(',').map(s => s.trim()).filter(Boolean);
|
|
7
7
|
const escapeRx = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
8
8
|
const patternToRegex = (pattern) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cors.helper.js","sourceRoot":"","sources":["../../src/helpers/cors.helper.ts"],"names":[],"mappings":";;AAIA,0DA6BC;AA7BD,SAAgB,uBAAuB,CAAC,aAA4B;IAClE,MAAM,UAAU,GAAG,aAAa,CAAC,GAAG,CAAS,
|
|
1
|
+
{"version":3,"file":"cors.helper.js","sourceRoot":"","sources":["../../src/helpers/cors.helper.ts"],"names":[],"mappings":";;AAIA,0DA6BC;AA7BD,SAAgB,uBAAuB,CAAC,aAA4B;IAClE,MAAM,UAAU,GAAG,aAAa,CAAC,GAAG,CAAS,uBAAuB,CAAC,IAAI,GAAG,CAAC;IAC7E,MAAM,OAAO,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAEzE,MAAM,QAAQ,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;IACzE,MAAM,cAAc,GAAG,C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AAe,CAAC;QACjD,WAAW,EAAE,IAAI;KAClB,CAAC;AACJ,CAAC","sourcesContent":["import { CorsOptions } from 'cors';\nimport { ConfigService } from '@nestjs/config';\n\n/** Build CorsOptions from env; supports wildcards like https://*.example.com */\nexport function buildDefaultCorsOptions(configService: ConfigService): CorsOptions {\n const rawOrigins = configService.get<string>('SECURITY_CORS_ORIGINS') ?? '*';\n const allowed = rawOrigins.split(',').map(s => s.trim()).filter(Boolean);\n\n const escapeRx = (s: string) => s.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n const patternToRegex = (pattern: string): RegExp => {\n const hasScheme = /^https?:\\/\\//i.test(pattern);\n const schemePart = hasScheme ? '' : 'https?:\\\\/\\\\/';\n if (pattern === '*' || pattern === '.*') return /^.*$/i;\n const escaped = escapeRx(pattern)\n .replace(/^https?:\\/\\//i, '') // strip scheme if present\n .replace(/\\*/g, '[^.]+'); // * => one subdomain segment\n return new RegExp(`^${schemePart}${escaped}(?::\\\\d+)?$`, 'i');\n };\n\n const matchers = allowed.map(patternToRegex);\n const isAllowed = (origin: string) =>\n matchers.length > 0 && matchers.some(rx => rx.test(origin));\n\n return {\n origin: (origin, cb) => {\n if (!origin) return cb(null, true); // allow no-origin (CLI/mobile/internal)\n if (isAllowed(origin)) return cb(null, true);\n return cb(new Error(`Origin ${origin} not allowed by CORS`), false);\n },\n methods: ['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS'],\n allowedHeaders: ['Content-Type', 'Authorization'],\n credentials: true,\n };\n}"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-of-values-mapper.d.ts","sourceRoot":"","sources":["../../src/mappers/list-of-values-mapper.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAElE,qBACa,kBAAkB;IAC3B,KAAK,CAAC,WAAW,EAAE,YAAY,GAAG,GAAG;CAWxC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.ListOfValuesMapper = void 0;
|
|
10
|
+
const common_1 = require("@nestjs/common");
|
|
11
|
+
let ListOfValuesMapper = class ListOfValuesMapper {
|
|
12
|
+
toDto(listOfValue) {
|
|
13
|
+
return {
|
|
14
|
+
type: listOfValue.type,
|
|
15
|
+
value: listOfValue.value,
|
|
16
|
+
display: listOfValue.display,
|
|
17
|
+
description: listOfValue.description,
|
|
18
|
+
default: listOfValue.default,
|
|
19
|
+
sequence: listOfValue.sequence,
|
|
20
|
+
module: listOfValue.module ? listOfValue.module.id : null
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
exports.ListOfValuesMapper = ListOfValuesMapper;
|
|
25
|
+
exports.ListOfValuesMapper = ListOfValuesMapper = __decorate([
|
|
26
|
+
(0, common_1.Injectable)()
|
|
27
|
+
], ListOfValuesMapper);
|
|
28
|
+
//# sourceMappingURL=list-of-values-mapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-of-values-mapper.js","sourceRoot":"","sources":["../../src/mappers/list-of-values-mapper.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA4C;AAIrC,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAC3B,KAAK,CAAC,WAAyB;QAC3B,OAAO;YACH,IAAI,EAAE,WAAW,CAAC,IAAI;YACtB,KAAK,EAAE,WAAW,CAAC,KAAK;YACxB,OAAO,EAAE,WAAW,CAAC,OAAO;YAC5B,WAAW,EAAE,WAAW,CAAC,WAAW;YACpC,OAAO,EAAE,WAAW,CAAC,OAAO;YAC5B,QAAQ,EAAE,WAAW,CAAC,QAAQ;YAC9B,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI;SAC5D,CAAC;IACN,CAAC;CACJ,CAAA;AAZY,gDAAkB;6BAAlB,kBAAkB;IAD9B,IAAA,mBAAU,GAAE;GACA,kBAAkB,CAY9B","sourcesContent":["import { Injectable } from \"@nestjs/common\";\nimport { ListOfValues } from \"src/entities/list-of-values.entity\";\n\n@Injectable()\nexport class ListOfValuesMapper {\n toDto(listOfValue: ListOfValues): any {\n return {\n type: listOfValue.type,\n value: listOfValue.value,\n display: listOfValue.display,\n description: listOfValue.description,\n default: listOfValue.default,\n sequence: listOfValue.sequence,\n module: listOfValue.module ? listOfValue.module.id : null\n };\n }\n}"]}
|
|
@@ -461,7 +461,7 @@ let ModuleMetadataSeederService = ModuleMetadataSeederService_1 = class ModuleMe
|
|
|
461
461
|
return;
|
|
462
462
|
}
|
|
463
463
|
for (let j = 0; j < listOfValuesDto.length; j++) {
|
|
464
|
-
await this.listOfValuesService.upsert(listOfValuesDto);
|
|
464
|
+
await this.listOfValuesService.upsert(listOfValuesDto[j]);
|
|
465
465
|
}
|
|
466
466
|
}
|
|
467
467
|
async seedDashboards(dashboardDtos) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module-metadata-seeder.service.js","sourceRoot":"","sources":["../../src/seeders/module-metadata-seeder.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA4D;AAC5D,uCAAyB;AACzB,2CAA6B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K,CAAC,iBAAiB,CAAC,qBAA8C;QAClE,IAAI,CAAC,qBAAqB,IAAI,qBAAqB,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC/D,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,iCAAiC,CAAC,CAAC;YACrD,OAAO;QACX,CAAC;QACD,KAAK,MAAM,GAAG,IAAI,qBAAqB,EAAE,CAAC;YACtC,MAAM,IAAI,CAAC,sBAAsB,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;QACzD,CAAC;IACL,CAAC;CAEJ,CAAA;AApjBY,kEAA2B;sCAA3B,2BAA2B;IADvC,IAAA,mBAAU,GAAE;IAmBJ,YAAA,IAAA,0BAAgB,EAAC,+CAAkB,CAAC,CAAA;IAGpC,YAAA,IAAA,eAAM,EAAC,4BAAgB,CAAC,GAAG,CAAC,CAAA;IAE5B,YAAA,IAAA,eAAM,EAAC,sBAAS,CAAC,GAAG,CAAC,CAAA;IACrB,YAAA,IAAA,eAAM,EAAC,uBAAY,CAAC,GAAG,CAAC,CAAA;IAGxB,YAAA,IAAA,0BAAgB,EAAC,wBAAO,EAAE,SAAS,CAAC,CAAA;qCAvBG,+CAAqB;QACtB,6CAAoB;QACpB,6CAAoB;QACL,6EAAmC;QAC3D,2CAAmB;QACnB,0BAAW;QACD,8CAAqB;QACxB,+CAAqB;QACnB,oDAAuB;QAC3B,2CAAmB;QACF,0FAAyC;QACtD,6CAAoB;QACtB,yCAAkB;QACjB,4CAAmB;QAExB,oBAAU;QACX,8BAAa,0BAMZ,gCAAc;QAExB,oBAAU;QACN,iDAAsB;QACb,wDAAyB;QACrC,0CAAmB;QACV,iDAAsB;GAhClD,2BAA2B,CAojBvC","sourcesContent":["import { Inject, Injectable, Logger } from '@nestjs/common';\nimport * as fs from 'fs';\nimport * as path from 'path';\n\nimport appBuilderConfig from '../config/app-builder.config';\nimport { ConfigType } from '@nestjs/config';\nimport { CreateModuleMetadataDto } from '../dtos/create-module-metadata.dto';\nimport { ModuleMetadataService } from '../services/module-metadata.service';\nimport { CreateModelMetadataDto } from '../dtos/create-model-metadata.dto';\nimport { ModelMetadataService } from '../services/model-metadata.service';\nimport { MediaStorageProviderMetadataService } from '../services/media-storage-provider-metadata.service';\nimport { FieldMetadataService } from '../services/field-metadata.service';\nimport { UserService } from 'src/services/user.service';\nimport { AuthenticationService } from 'src/services/authentication.service';\nimport { MediaStorageProviderMetadataSeederService } from '../services/media-storage-provider-metadata-seeder.service';\nimport { CreateEmailTemplateDto } from 'src/dtos/create-email-template.dto';\nimport { EmailTemplateService } from 'src/services/email-template.service';\nimport { SmsTemplateService } from 'src/services/sms-template.service';\nimport { CreateSmsTemplateDto } from 'src/dtos/create-sms-template.dto';\nimport { ViewMetadataService } from '../services/view-metadata.service';\nimport { ActionMetadataService } from '../services/action-metadata.service';\nimport { MenuItemMetadataService } from '../services/menu-item-metadata.service';\nimport { InjectRepository } from '@nestjs/typeorm';\nimport { PermissionMetadata } from '../entities/permission-metadata.entity';\nimport { Repository } from 'typeorm';\nimport { SolidRegistry } from '../helpers/solid-registry';\nimport { RoleMetadataService } from '../services/role-metadata.service';\nimport { getCoreModuleNames, getDynamicModuleNames } from '../helpers/module.helper';\nimport solidCoreMetadata from './seed-data/solid-core-metadata.json';\nimport { iamConfig } from 'src/config/iam.config';\nimport commonConfig from 'src/config/common.config';\nimport { CreateSettingDto } from 'src/dtos/create-setting.dto';\nimport { SettingService } from 'src/services/setting.service';\nimport { Setting } from 'src/entities/setting.entity';\nimport { CreateSecurityRuleDto } from 'src/dtos/create-security-rule.dto';\nimport { SecurityRuleRepository } from 'src/repository/security-rule.repository';\nimport { ListOfValuesService } from 'src/services/list-of-values.service';\nimport { CreateListOfValuesDto } from 'src/dtos/create-list-of-values.dto';\nimport { SystemFieldsSeederService } from './system-fields-seeder.service';\nimport { CreateDashboardDto } from 'src/dtos/create-dashboard.dto';\nimport { DashboardRepository } from 'src/repository/dashboard.repository';\n// import { CreateScheduledJobDto } from 'src/dtos/create-scheduled-job.dto';\nimport { ScheduledJobRepository } from 'src/repository/scheduled-job.repository';\nimport { CreateScheduledJobDto } from 'src/dtos/create-scheduled-job.dto';\n\n@Injectable()\nexport class ModuleMetadataSeederService {\n private readonly logger = new Logger(ModuleMetadataSeederService.name);\n\n constructor(\n private readonly moduleMetadataService: ModuleMetadataService,\n private readonly modelMetadataService: ModelMetadataService,\n private readonly fieldMetadataService: FieldMetadataService,\n private readonly mediaStorageProviderMetadataService: MediaStorageProviderMetadataService,\n private readonly roleService: RoleMetadataService,\n private readonly userService: UserService,\n private readonly authenticationService: AuthenticationService,\n private readonly solidActionService: ActionMetadataService,\n private readonly solidMenuItemService: MenuItemMetadataService,\n private readonly solidViewService: ViewMetadataService,\n private readonly mediaStorageProviderSeederService: MediaStorageProviderMetadataSeederService,\n private readonly emailTemplateService: EmailTemplateService,\n private readonly smsTemplateService: SmsTemplateService,\n private readonly listOfValuesService: ListOfValuesService,\n @InjectRepository(PermissionMetadata)\n private readonly permissionRepo: Repository<PermissionMetadata>,\n private readonly solidRegistry: SolidRegistry,\n @Inject(appBuilderConfig.KEY)\n private readonly appBuilderConfiguration: ConfigType<typeof appBuilderConfig>,\n @Inject(iamConfig.KEY) private readonly iamConfiguration: ConfigType<typeof iamConfig>,\n @Inject(commonConfig.KEY)\n private readonly commonConfiguration: ConfigType<typeof commonConfig>,\n private readonly seetingService: SettingService,\n @InjectRepository(Setting, 'default')\n readonly settingsRepo: Repository<Setting>,\n readonly securityRuleRepo: SecurityRuleRepository,\n readonly systemFieldsSeederService: SystemFieldsSeederService,\n readonly dashboardRepo: DashboardRepository,\n readonly scheduledJobRepository: ScheduledJobRepository,\n ) { }\n\n async seed() {\n\n const typedSolidCoreMetadata: any = structuredClone(solidCoreMetadata);\n\n // Run the permissions seeder. \n // await this.permissionsSeederService.seed();\n this.logger.log(`Seeding permissions`);\n await this.seedPermissions();\n\n // TODO: move this also the main loop processing. Generate the media storage providers required by default\n this.logger.log(`Seeding media storage providers`);\n await this.mediaStorageProviderSeederService.seed();\n\n // Seed any missing system fields metadata for all models.\n this.logger.log(`Seeding system fields metadata`);\n await this.systemFieldsSeederService.seed();\n\n // Read the module metadata from a file specified in the .env \n // Add the core json file as the first entry in the above array.\n // Please note the sequence of core files is important below...\n const coreModules = getCoreModuleNames();\n const seedDataFiles = [\n // 'src/common/seeders/seed-data/common-metadata.json',\n // 'src/iam/seeders/seed-data/iam-metadata.json',\n // 'src/app-builder/seeders/seed-data/app-builder-metadata.json',\n // 'src/queues/seeders/seed-data/queues-metadata.json',\n // ...coreModules.map(module => `src/${module}/seeders/seed-data/${module}-metadata.json`),\n typedSolidCoreMetadata\n ];\n this.logger.debug(`getting dynamics modules`);\n const enabledModules = getDynamicModuleNames();\n this.logger.log(`Seeding metadata`);\n\n for (let i = 0; i < enabledModules.length; i++) {\n const enabledModule = enabledModules[i];\n const enabledModuleSeedFile = `module-metadata/${enabledModule}/${enabledModule}-metadata.json`\n const fullPath = path.join(process.cwd(), enabledModuleSeedFile);\n if (fs.existsSync(fullPath)) {\n const overallMetadata: any = JSON.parse(fs.readFileSync(fullPath, 'utf-8').toString());\n\n seedDataFiles.push(overallMetadata)\n }\n }\n\n this.logger.debug(`Seed data files are: ${seedDataFiles}`);\n let usersDetail;\n for (let i = 0; i < seedDataFiles.length; i++) {\n\n // Module, model & field handling.\n const overallMetadata = seedDataFiles[i];\n // const fullPath = path.join(process.cwd(), seedDataFile);\n\n // For each module metadata seed file provided, read contents, parse & convert to a variable. \n // this.logger.log(`[Start] module seed data: ${fullPath}`);\n\n // const overallMetadata: any = JSON.parse(fs.readFileSync(fullPath, 'utf-8').toString());\n\n // Process module metadata first. \n const moduleMetadata: CreateModuleMetadataDto = overallMetadata.moduleMetadata;\n this.logger.log(`[Start] Processing module metadata for ${moduleMetadata.name}`)\n await this.seedModuleModelFields(moduleMetadata);\n this.logger.log(`[End] Processing module metadata for ${moduleMetadata.name}`)\n\n // Media Storage provider templates\n this.logger.log(`[Start] Processing Media Storage Provider for ${moduleMetadata.name}`);\n const mediaStorageProviders = overallMetadata.mediaStorageProviders;\n await this.seedMediaStorageProviders(mediaStorageProviders);\n this.logger.log(`[End] Processing Media Storage Provider for ${moduleMetadata.name}`);\n\n // Custom role handling\n this.logger.log(`[End] Processing roles for ${moduleMetadata.name}`)\n const roles = overallMetadata.roles;\n\n // Every role configuration in the seeder json can optionally have a permissions attribute. \n // While creating roles we are only passing the role name to be used. \n await this.roleService.createRolesIfNotExists(roles.map(role => { return { name: role.name } }));\n\n // After roles are created, we iterate over all roles and attach permissions (if specified in the seeder json) to the respective role.\n for (let roleI = 0; roleI < roles.length; roleI++) {\n const role = roles[roleI];\n if (role.permissions) {\n await this.roleService.addPermissionsToRole(role.name, role.permissions)\n }\n }\n this.logger.log(`[End] Processing roles for ${moduleMetadata.name}`)\n\n // Custom user handling\n this.logger.log(`[Start] Processing users for ${moduleMetadata.name}`);\n const users = overallMetadata.users;\n usersDetail = users;\n await this.seedUsers(users);\n this.logger.log(`[End] Processing users for ${moduleMetadata.name}`)\n\n // Application Module View handling \n this.logger.log(`[Start] Processing views for ${moduleMetadata.name}`);\n const views = overallMetadata.views;\n await this.seedViews(views);\n this.logger.log(`[End] Processing views for ${moduleMetadata.name}`)\n\n // Application Module Action handling\n this.logger.log(`[Start] Processing actions for ${moduleMetadata.name}`);\n const actions = overallMetadata.actions;\n await this.seedActions(actions);\n this.logger.log(`[End] Processing actions for ${moduleMetadata.name}`)\n\n // Application Module Menu handling \n this.logger.log(`[Start] Processing menus for ${moduleMetadata.name}`);\n const menus = overallMetadata.menus;\n await this.seedMenus(menus);\n this.logger.log(`[End] Processing menus for ${moduleMetadata.name}`)\n\n // Email templates \n this.logger.log(`[Start] Processing email templates for ${moduleMetadata.name}`);\n const emailTemplates: CreateEmailTemplateDto[] = overallMetadata.emailTemplates;\n await this.seedEmailTemplates(emailTemplates, moduleMetadata);\n this.logger.log(`[End] Processing email templates for ${moduleMetadata.name}`);\n\n // Sms templates\n this.logger.log(`[Start] Processing sms templates for ${moduleMetadata.name}`);\n const smsTemplates: CreateSmsTemplateDto[] = overallMetadata.smsTemplates;\n await this.seedSmsTemplates(smsTemplates, moduleMetadata);\n this.logger.log(`[End] Processing sms templates for ${moduleMetadata.name}`);\n\n // Settings\n this.logger.log(`[Start] Processing settings for ${moduleMetadata.name}`);\n await this.seetingService.seedDefaultSettings();\n this.logger.log(`[End] Processing settings for ${moduleMetadata.name}`);\n\n // Security rules\n this.logger.log(`[Start] Processing security rules for ${moduleMetadata.name}`);\n const securityRules: CreateSecurityRuleDto[] = overallMetadata.securityRules;\n await this.seedSecurityRules(securityRules);\n this.logger.log(`[End] Processing security rules for ${moduleMetadata.name}`);\n\n // List Of Values\n this.logger.log(`[Start] Processing List Of Values for ${moduleMetadata.name}`);\n const listOfValues: CreateListOfValuesDto[] = overallMetadata.listOfValues;\n await this.seedListOfValues(listOfValues);\n this.logger.log(`[End] Processing List Of Values for ${moduleMetadata.name}`);\n\n // Dashboards\n this.logger.log(`[Start] Processing dashboards for ${moduleMetadata.name}`);\n const dashboards: CreateDashboardDto[] = overallMetadata.dashboards;\n await this.seedDashboards(dashboards);\n this.logger.log(`[End] Processing dashboards for ${moduleMetadata.name}`);\n\n // Scheduled Jobs\n this.logger.debug(`[Start] Processing scheduled jobs for ${moduleMetadata.name}`);\n const scheduledJobs: CreateScheduledJobDto[] = overallMetadata.scheduledJobs;\n if (scheduledJobs?.length > 0) {\n await this.seedScheduledJobs(scheduledJobs);\n }\n this.logger.debug(`[End] Processing scheduled jobs for ${moduleMetadata.name}`);\n\n this.logger.debug(`[End] module seed data: ${overallMetadata}`);\n }\n\n // Post seed data file processing. \n\n // 1. Give all permissions to the Admin role.\n this.logger.log(`About to add all permissions to the Admin role`);\n await this.roleService.addAllPermissionsToRole(\"Admin\");\n // 2. Give wrapSettings permissions to the Public role.\n const internalRolePermission = [\n 'UserController.findMany',\n 'UserController.checkIfPermissionExists',\n 'UserController.findOne',\n 'MenuItemMetadataController.findMany',\n 'MenuItemMetadataController.findUserMenus',\n 'MenuItemMetadataController.findOne',\n 'ViewMetadataController.getLayout',\n 'ViewMetadataController.findMany',\n 'ViewMetadataController.findOne',\n 'AuthenticationController.changePassword',\n 'FieldMetadataController.getSelectionDynamicValues',\n 'FieldMetadataController.getSelectionDynamicValue',\n 'FieldMetadataController.findFieldDefaultMetaData',\n 'SavedFiltersController.delete',\n 'SavedFiltersController.deleteMany',\n 'SavedFiltersController.findOne',\n 'SavedFiltersController.findMany',\n 'SavedFiltersController.recover',\n 'SavedFiltersController.recoverMany',\n 'SavedFiltersController.partialUpdate',\n 'SavedFiltersController.update',\n 'SavedFiltersController.insertMany',\n 'SavedFiltersController.create',\n 'AuthenticationController.logout'\n ]\n await this.roleService.addPermissionToRole('Internal User', internalRolePermission);\n await this.roleService.addPermissionToRole('Public', ['SettingController.wrapSettings', 'AuthenticationController.logout']);\n this.logger.log(`All Seeders finished`);\n this.logger.log(`Newly created username is: ${usersDetail?.length > 0 ? usersDetail[0]?.username : ''} and password is ${usersDetail?.length > 0 ? usersDetail[0]?.password : ''}`);\n }\n\n\n async seedPermissions() {\n\n const controllers = this.solidRegistry.getControllers();\n\n // Loop over the countries and create them.\n for (let id = 0; id < controllers.length; id++) {\n try {\n const controller = controllers[id];\n this.logger.log(`Resolving controller: ${controller.name}`);\n\n const methods = controller.methods;\n for (let mId = 0; mId < methods.length; mId++) {\n\n const methodName = methods[mId];\n const permissionName = `${controller.name}.${methodName}`;\n\n const existingPermission = await this.permissionRepo.findOne({\n where: {\n name: permissionName\n }\n });\n\n if (existingPermission) {\n this.logger.log(`Permission ${permissionName} already exists.`);\n }\n else {\n this.logger.log(`Permission ${permissionName} does not exist, creating new.`);\n\n const newPermission = this.permissionRepo.create({\n name: permissionName\n });\n await this.permissionRepo.save(newPermission);\n\n }\n }\n\n } catch (error) {\n this.logger.error(error);\n }\n }\n }\n\n async seedMediaStorageProviders(mediaStorageProviders: any) {\n for (let i = 0; i < mediaStorageProviders.length; i++) {\n const mediaStorageProivder = mediaStorageProviders[i];\n await this.mediaStorageProviderMetadataService.upsert(mediaStorageProivder);\n }\n }\n\n async seedEmailTemplates(emailTemplates: CreateEmailTemplateDto[], moduleMetadata: CreateModuleMetadataDto) {\n if (!emailTemplates) {\n return;\n }\n\n for (let i = 0; i < emailTemplates.length; i++) {\n const emailTemplate = emailTemplates[i];\n this.logger.log(`Found ${emailTemplate.name} email template`);\n\n // We need to load the actual template contents. \n if (moduleMetadata.name === 'solid-core') {\n const modulePath = path.dirname(require.resolve('@solidstarters/solid-core'));\n const seedDataPath = path.join(modulePath, '../src/seeders/seed-data/email-templates');\n const filePath = path.join(seedDataPath, emailTemplate.body);\n this.logger.log(`Seeding email template from solid-core at path: ${filePath}`);\n if (fs.existsSync(filePath)) {\n emailTemplate.body = fs.readFileSync(filePath, 'utf-8').toString();\n }\n }\n else {\n // Check if file exists\n const emailTemplateHandlebar = `module-metadata/${moduleMetadata.name}/email-templates/${emailTemplate.body}`\n const fullPath = path.join(process.cwd(), emailTemplateHandlebar);\n this.logger.log(`Seeding custom email template from consuming model at path: ${fullPath}`);\n if (fs.existsSync(fullPath)) {\n emailTemplate.body = fs.readFileSync(fullPath, 'utf-8').toString();\n }\n }\n\n // Save to DB.\n await this.emailTemplateService.removeByName(emailTemplate.name);\n await this.emailTemplateService.create(emailTemplate);\n }\n\n }\n\n async seedSmsTemplates(smsTemplates: CreateSmsTemplateDto[], moduleMetadata: CreateModuleMetadataDto) {\n if (!smsTemplates) {\n return;\n }\n\n for (let i = 0; i < smsTemplates.length; i++) {\n const smsTemplate = smsTemplates[i];\n this.logger.log(`Found ${smsTemplate.name} sms template`);\n\n // We need to load the actual template contents. \n if (moduleMetadata.name === 'solid-core') {\n const modulePath = path.dirname(require.resolve('@solidstarters/solid-core'));\n const seedDataPath = path.join(modulePath, '../src/seeders/seed-data/sms-templates');\n const filePath = path.join(seedDataPath, smsTemplate.body);\n this.logger.log(`Seeding sms template from solid-core at path: ${filePath}`);\n if (fs.existsSync(filePath)) {\n smsTemplate.body = fs.readFileSync(filePath, 'utf-8').toString();\n }\n }\n else {\n // Check if file exists\n const emailTemplateHandlebar = `module-metadata/${moduleMetadata.name}/sms-templates/${smsTemplate.body}`\n const fullPath = path.join(process.cwd(), emailTemplateHandlebar);\n this.logger.log(`Seeding custom sms template from consuming model at path: ${fullPath}`);\n if (fs.existsSync(fullPath)) {\n smsTemplate.body = fs.readFileSync(fullPath, 'utf-8').toString();\n }\n }\n\n\n // Save to DB.\n await this.smsTemplateService.removeByName(smsTemplate.name);\n await this.smsTemplateService.create(smsTemplate);\n }\n }\n\n async seedMenus(menus: any) {\n if (!menus) {\n return;\n }\n\n for (let j = 0; j < menus.length; j++) {\n const menuData = menus[j];\n\n const adminRole = await this.roleService.findRoleByName('Admin');\n\n const specifiedRoles = menuData['roles'];\n\n // If the developer has specified roles, then resolve them, making sure that admin role is also given.\n const specifiedRoleObjects = [adminRole];\n if (specifiedRoles) {\n for (let i = 0; i < specifiedRoles.length; i++) {\n const specifiedRole = specifiedRoles[i];\n const specifiedRoleObject = await this.roleService.findRoleByName(specifiedRole);\n if (!specifiedRoleObject) {\n throw new Error(`Invalid role: (${specifiedRole}) specified against menu with display name ${menuData.displayName}.`);\n }\n specifiedRoleObjects.push(specifiedRoleObject);\n }\n }\n\n menuData['roles'] = specifiedRoleObjects;\n menuData['action'] = await this.solidActionService.findOneByUserKey(menuData.actionUserKey);\n menuData['module'] = await this.moduleMetadataService.findOneByUserKey(menuData.moduleUserKey);\n\n if (menuData.parentMenuItemUserKey) {\n menuData['parentMenuItem'] = await this.solidMenuItemService.findOneByUserKey(menuData.parentMenuItemUserKey);\n } else {\n menuData['parentMenuItem'] = null\n }\n await this.solidMenuItemService.upsert(menuData);\n }\n }\n\n async seedActions(actions: any) {\n if (!actions) {\n return;\n }\n\n for (let j = 0; j < actions.length; j++) {\n const actionData = actions[j];\n actionData['module'] = await this.moduleMetadataService.findOneByUserKey(actionData.moduleUserKey);\n if (actionData.type === 'solid') {\n actionData['model'] = await this.modelMetadataService.findOneByUserKey(actionData.modelUserKey);\n actionData['view'] = await this.solidViewService.findOneByUserKey(actionData.viewUserKey);\n }\n else {\n if (actionData.modelUserKey) {\n actionData['model'] = await this.modelMetadataService.findOneByUserKey(actionData.modelUserKey);\n }\n }\n await this.solidActionService.upsert(actionData);\n }\n }\n\n async seedViews(views: any) {\n if (!views) {\n return;\n }\n\n for (let j = 0; j < views.length; j++) {\n const viewData = views[j];\n\n // preety format the layout & context. \n viewData['layout'] = JSON.stringify(viewData['layout'], null, 2);\n // viewData['context'] = JSON.stringify(viewData['context'], null, 2);\n\n viewData['module'] = await this.moduleMetadataService.findOneByUserKey(viewData.moduleUserKey);\n viewData['model'] = await this.modelMetadataService.findOneByUserKey(viewData.modelUserKey);\n // await this.solidViewService.upsert(viewData);\n // First check if module already exists using name\n\n // Changed the below to upsert as now we are saving modifications to the view json to file system also.\n // await this.solidViewService.createIfNotPresent(viewData);\n await this.solidViewService.upsert(viewData);\n }\n }\n\n async seedUsers(users) {\n if (!users) {\n return;\n }\n\n for (let l = 0; l < users.length; l++) {\n const user = users[l];\n let exisitingUser = await this.userService.findOneByUsername(user.username);\n if (!exisitingUser) {\n exisitingUser = await this.authenticationService.signUp(user);\n\n this.logger.log(`Newly created user is ${user}`);\n }\n // now add Roles to user.\n // for (let m = 0; m < roles.length; m++) {\n // const role = roles[m];\n // await this.userService.addRoleToUser(user.email, role.name);\n // }\n }\n }\n\n async seedModuleModelFields(moduleMetadata: CreateModuleMetadataDto) {\n\n // First we create the module. \n // await this.moduleMetadataService.removeByName(moduleMetadata.name);\n // const module = await this.moduleMetadataService.create(moduleMetadata);\n const module = await this.moduleMetadataService.upsert(moduleMetadata);\n\n // Next create all the models. \n const modelsMetadata: CreateModelMetadataDto[] = moduleMetadata.models;\n for (let j = 0; j < modelsMetadata.length; j++) {\n const modelMetadata = modelsMetadata[j];\n\n // Before creating the model, we need to make sure we are linking it to the newly created module.\n // modelMetdata['moduleId'] = module.id;\n modelMetadata['module'] = module;\n\n // Please note that all the fields will also get created as we have setup the relation in model.entity.ts as cascade=true\n // await this.modelMetadataService.removeBySingularName(modelMetdata.singularName);\n // await this.modelMetadataService.modelSeeder(modelMetdata);\n\n // upsert the model information.\n // const fieldsMetadata = modelMetdata.fields;\n // delete modelMetdata['fields'];\n const { fields: fieldsMetadata, ...modelMetaDataWithoutFields } = modelMetadata;\n\n // Load and set the parent model if it exists.\n if (modelMetadata.isChild && modelMetadata.parentModelUserKey) {\n const parentModel = await this.modelMetadataService.findOneByUserKey(modelMetadata.parentModelUserKey);\n modelMetaDataWithoutFields['parentModel'] = parentModel;\n }\n\n await this.modelMetadataService.upsert(modelMetaDataWithoutFields);\n const model = await this.modelMetadataService.findOneBySingularName(modelMetadata.singularName)\n\n // iterate over all fields and upsert. \n let userKeyField = null;\n const userKeyFieldName = modelMetadata.userKeyFieldUserKey;\n for (let k = 0; k < fieldsMetadata.length; k++) {\n const fieldMetadata = fieldsMetadata[k];\n\n // TODO: resolve model & mediaStorageProvider. \n fieldMetadata['model'] = model;\n if (fieldMetadata.mediaStorageProviderUserKey) {\n fieldMetadata['mediaStorageProvider'] = await this.mediaStorageProviderMetadataService.findOneByUserKey(fieldMetadata.mediaStorageProviderUserKey);\n }\n // console.log(fieldMetadata.displayName);\n\n const affectedField = await this.fieldMetadataService.upsert(fieldMetadata);\n if (fieldMetadata.name === userKeyFieldName) {\n const { model, ...fieldData } = affectedField;\n userKeyField = fieldData;\n }\n }\n\n // Now that we have created fields & model update the model to stamp the userKeyField. \n if (userKeyField) {\n modelMetaDataWithoutFields['userKeyField'] = userKeyField;\n await this.modelMetadataService.upsert(modelMetaDataWithoutFields);\n }\n }\n }\n\n async seedSettings(createDto: CreateSettingDto) {\n const settingsArray: any[] = await this.settingsRepo.find();\n if (!settingsArray || settingsArray.length === 0) {\n this.seetingService.create(createDto);\n }\n }\n\n async seedSecurityRules(rulesDto: CreateSecurityRuleDto[]) {\n if (!rulesDto || rulesDto.length === 0) {\n this.logger.debug(`No security rules found to seed`);\n return;\n }\n for (const dto of rulesDto) {\n await this.securityRuleRepo.upsertWithDto({ ...dto, securityRuleConfig: JSON.stringify(dto.securityRuleConfig) });\n }\n }\n\n async seedListOfValues(listOfValuesDto: CreateListOfValuesDto[]) {\n if (!listOfValuesDto || listOfValuesDto.length === 0) {\n this.logger.debug(`No List Of Values found to seed`);\n return;\n }\n for (let j = 0; j < listOfValuesDto.length; j++) {\n await this.listOfValuesService.upsert(listOfValuesDto);\n }\n }\n\n async seedDashboards(dashboardDtos: CreateDashboardDto[]) {\n if (!dashboardDtos || dashboardDtos.length === 0) {\n this.logger.debug(`No dashboards found to seed`);\n return;\n }\n for (const dto of dashboardDtos) {\n await this.dashboardRepo.upsertWithDto(dto);\n }\n }\n\n async seedScheduledJobs(createScheduledJobDto: CreateScheduledJobDto[]) {\n if (!createScheduledJobDto || createScheduledJobDto.length === 0) {\n this.logger.debug(`No scheduled jobs found to seed`);\n return;\n }\n for (const dto of createScheduledJobDto) {\n await this.scheduledJobRepository.upsertWithDto(dto);\n }\n }\n\n}"]}
|
|
1
|
+
{"version":3,"file":"module-metadata-seeder.service.js","sourceRoot":"","sources":["../../src/seeders/module-metadata-seeder.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA4D;AAC5D,uCAAyB;AACzB,2CAA6B;AAE7B,sFAA4D;AAG5D,iFAA4E;AAE5E,+EAA0E;AAC1E,iHAA0G;AAC1G,+EAA0E;AAC1E,2DAAwD;AACxD,+EAA4E;AAC5E,+HAAuH;AAEvH,+EAA2E;AAC3E,2EAAuE;AAEvE,6EAAwE;AACxE,iFAA4E;AAC5E,uFAAiF;AACjF,6CAAmD;AACnD,uFAA4E;AAC5E,qCAAqC;AACrC,8DAA0D;AAC1D,6EAAwE;AACxE,4DAAqF;AACrF,oGAAqE;AACrE,qDAAkD;AAClD,4EAAoD;AAEpD,iE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ACL,CAAC;CAEJ,CAAA;AApjBY,kEAA2B;sCAA3B,2BAA2B;IADvC,IAAA,mBAAU,GAAE;IAmBJ,YAAA,IAAA,0BAAgB,EAAC,+CAAkB,CAAC,CAAA;IAGpC,YAAA,IAAA,eAAM,EAAC,4BAAgB,CAAC,GAAG,CAAC,CAAA;IAE5B,YAAA,IAAA,eAAM,EAAC,sBAAS,CAAC,GAAG,CAAC,CAAA;IACrB,YAAA,IAAA,eAAM,EAAC,uBAAY,CAAC,GAAG,CAAC,CAAA;IAGxB,YAAA,IAAA,0BAAgB,EAAC,wBAAO,EAAE,SAAS,CAAC,CAAA;qCAvBG,+CAAqB;QACtB,6CAAoB;QACpB,6CAAoB;QACL,6EAAmC;QAC3D,2CAAmB;QACnB,0BAAW;QACD,8CAAqB;QACxB,+CAAqB;QACnB,oDAAuB;QAC3B,2CAAmB;QACF,0FAAyC;QACtD,6CAAoB;QACtB,yCAAkB;QACjB,4CAAmB;QAExB,oBAAU;QACX,8BAAa,0BAMZ,gCAAc;QAExB,oBAAU;QACN,iDAAsB;QACb,wDAAyB;QACrC,0CAAmB;QACV,iDAAsB;GAhClD,2BAA2B,CAojBvC","sourcesContent":["import { Inject, Injectable, Logger } from '@nestjs/common';\nimport * as fs from 'fs';\nimport * as path from 'path';\n\nimport appBuilderConfig from '../config/app-builder.config';\nimport { ConfigType } from '@nestjs/config';\nimport { CreateModuleMetadataDto } from '../dtos/create-module-metadata.dto';\nimport { ModuleMetadataService } from '../services/module-metadata.service';\nimport { CreateModelMetadataDto } from '../dtos/create-model-metadata.dto';\nimport { ModelMetadataService } from '../services/model-metadata.service';\nimport { MediaStorageProviderMetadataService } from '../services/media-storage-provider-metadata.service';\nimport { FieldMetadataService } from '../services/field-metadata.service';\nimport { UserService } from 'src/services/user.service';\nimport { AuthenticationService } from 'src/services/authentication.service';\nimport { MediaStorageProviderMetadataSeederService } from '../services/media-storage-provider-metadata-seeder.service';\nimport { CreateEmailTemplateDto } from 'src/dtos/create-email-template.dto';\nimport { EmailTemplateService } from 'src/services/email-template.service';\nimport { SmsTemplateService } from 'src/services/sms-template.service';\nimport { CreateSmsTemplateDto } from 'src/dtos/create-sms-template.dto';\nimport { ViewMetadataService } from '../services/view-metadata.service';\nimport { ActionMetadataService } from '../services/action-metadata.service';\nimport { MenuItemMetadataService } from '../services/menu-item-metadata.service';\nimport { InjectRepository } from '@nestjs/typeorm';\nimport { PermissionMetadata } from '../entities/permission-metadata.entity';\nimport { Repository } from 'typeorm';\nimport { SolidRegistry } from '../helpers/solid-registry';\nimport { RoleMetadataService } from '../services/role-metadata.service';\nimport { getCoreModuleNames, getDynamicModuleNames } from '../helpers/module.helper';\nimport solidCoreMetadata from './seed-data/solid-core-metadata.json';\nimport { iamConfig } from 'src/config/iam.config';\nimport commonConfig from 'src/config/common.config';\nimport { CreateSettingDto } from 'src/dtos/create-setting.dto';\nimport { SettingService } from 'src/services/setting.service';\nimport { Setting } from 'src/entities/setting.entity';\nimport { CreateSecurityRuleDto } from 'src/dtos/create-security-rule.dto';\nimport { SecurityRuleRepository } from 'src/repository/security-rule.repository';\nimport { ListOfValuesService } from 'src/services/list-of-values.service';\nimport { CreateListOfValuesDto } from 'src/dtos/create-list-of-values.dto';\nimport { SystemFieldsSeederService } from './system-fields-seeder.service';\nimport { CreateDashboardDto } from 'src/dtos/create-dashboard.dto';\nimport { DashboardRepository } from 'src/repository/dashboard.repository';\n// import { CreateScheduledJobDto } from 'src/dtos/create-scheduled-job.dto';\nimport { ScheduledJobRepository } from 'src/repository/scheduled-job.repository';\nimport { CreateScheduledJobDto } from 'src/dtos/create-scheduled-job.dto';\n\n@Injectable()\nexport class ModuleMetadataSeederService {\n private readonly logger = new Logger(ModuleMetadataSeederService.name);\n\n constructor(\n private readonly moduleMetadataService: ModuleMetadataService,\n private readonly modelMetadataService: ModelMetadataService,\n private readonly fieldMetadataService: FieldMetadataService,\n private readonly mediaStorageProviderMetadataService: MediaStorageProviderMetadataService,\n private readonly roleService: RoleMetadataService,\n private readonly userService: UserService,\n private readonly authenticationService: AuthenticationService,\n private readonly solidActionService: ActionMetadataService,\n private readonly solidMenuItemService: MenuItemMetadataService,\n private readonly solidViewService: ViewMetadataService,\n private readonly mediaStorageProviderSeederService: MediaStorageProviderMetadataSeederService,\n private readonly emailTemplateService: EmailTemplateService,\n private readonly smsTemplateService: SmsTemplateService,\n private readonly listOfValuesService: ListOfValuesService,\n @InjectRepository(PermissionMetadata)\n private readonly permissionRepo: Repository<PermissionMetadata>,\n private readonly solidRegistry: SolidRegistry,\n @Inject(appBuilderConfig.KEY)\n private readonly appBuilderConfiguration: ConfigType<typeof appBuilderConfig>,\n @Inject(iamConfig.KEY) private readonly iamConfiguration: ConfigType<typeof iamConfig>,\n @Inject(commonConfig.KEY)\n private readonly commonConfiguration: ConfigType<typeof commonConfig>,\n private readonly seetingService: SettingService,\n @InjectRepository(Setting, 'default')\n readonly settingsRepo: Repository<Setting>,\n readonly securityRuleRepo: SecurityRuleRepository,\n readonly systemFieldsSeederService: SystemFieldsSeederService,\n readonly dashboardRepo: DashboardRepository,\n readonly scheduledJobRepository: ScheduledJobRepository,\n ) { }\n\n async seed() {\n\n const typedSolidCoreMetadata: any = structuredClone(solidCoreMetadata);\n\n // Run the permissions seeder. \n // await this.permissionsSeederService.seed();\n this.logger.log(`Seeding permissions`);\n await this.seedPermissions();\n\n // TODO: move this also the main loop processing. Generate the media storage providers required by default\n this.logger.log(`Seeding media storage providers`);\n await this.mediaStorageProviderSeederService.seed();\n\n // Seed any missing system fields metadata for all models.\n this.logger.log(`Seeding system fields metadata`);\n await this.systemFieldsSeederService.seed();\n\n // Read the module metadata from a file specified in the .env \n // Add the core json file as the first entry in the above array.\n // Please note the sequence of core files is important below...\n const coreModules = getCoreModuleNames();\n const seedDataFiles = [\n // 'src/common/seeders/seed-data/common-metadata.json',\n // 'src/iam/seeders/seed-data/iam-metadata.json',\n // 'src/app-builder/seeders/seed-data/app-builder-metadata.json',\n // 'src/queues/seeders/seed-data/queues-metadata.json',\n // ...coreModules.map(module => `src/${module}/seeders/seed-data/${module}-metadata.json`),\n typedSolidCoreMetadata\n ];\n this.logger.debug(`getting dynamics modules`);\n const enabledModules = getDynamicModuleNames();\n this.logger.log(`Seeding metadata`);\n\n for (let i = 0; i < enabledModules.length; i++) {\n const enabledModule = enabledModules[i];\n const enabledModuleSeedFile = `module-metadata/${enabledModule}/${enabledModule}-metadata.json`\n const fullPath = path.join(process.cwd(), enabledModuleSeedFile);\n if (fs.existsSync(fullPath)) {\n const overallMetadata: any = JSON.parse(fs.readFileSync(fullPath, 'utf-8').toString());\n\n seedDataFiles.push(overallMetadata)\n }\n }\n\n this.logger.debug(`Seed data files are: ${seedDataFiles}`);\n let usersDetail;\n for (let i = 0; i < seedDataFiles.length; i++) {\n\n // Module, model & field handling.\n const overallMetadata = seedDataFiles[i];\n // const fullPath = path.join(process.cwd(), seedDataFile);\n\n // For each module metadata seed file provided, read contents, parse & convert to a variable. \n // this.logger.log(`[Start] module seed data: ${fullPath}`);\n\n // const overallMetadata: any = JSON.parse(fs.readFileSync(fullPath, 'utf-8').toString());\n\n // Process module metadata first. \n const moduleMetadata: CreateModuleMetadataDto = overallMetadata.moduleMetadata;\n this.logger.log(`[Start] Processing module metadata for ${moduleMetadata.name}`)\n await this.seedModuleModelFields(moduleMetadata);\n this.logger.log(`[End] Processing module metadata for ${moduleMetadata.name}`)\n\n // Media Storage provider templates\n this.logger.log(`[Start] Processing Media Storage Provider for ${moduleMetadata.name}`);\n const mediaStorageProviders = overallMetadata.mediaStorageProviders;\n await this.seedMediaStorageProviders(mediaStorageProviders);\n this.logger.log(`[End] Processing Media Storage Provider for ${moduleMetadata.name}`);\n\n // Custom role handling\n this.logger.log(`[End] Processing roles for ${moduleMetadata.name}`)\n const roles = overallMetadata.roles;\n\n // Every role configuration in the seeder json can optionally have a permissions attribute. \n // While creating roles we are only passing the role name to be used. \n await this.roleService.createRolesIfNotExists(roles.map(role => { return { name: role.name } }));\n\n // After roles are created, we iterate over all roles and attach permissions (if specified in the seeder json) to the respective role.\n for (let roleI = 0; roleI < roles.length; roleI++) {\n const role = roles[roleI];\n if (role.permissions) {\n await this.roleService.addPermissionsToRole(role.name, role.permissions)\n }\n }\n this.logger.log(`[End] Processing roles for ${moduleMetadata.name}`)\n\n // Custom user handling\n this.logger.log(`[Start] Processing users for ${moduleMetadata.name}`);\n const users = overallMetadata.users;\n usersDetail = users;\n await this.seedUsers(users);\n this.logger.log(`[End] Processing users for ${moduleMetadata.name}`)\n\n // Application Module View handling \n this.logger.log(`[Start] Processing views for ${moduleMetadata.name}`);\n const views = overallMetadata.views;\n await this.seedViews(views);\n this.logger.log(`[End] Processing views for ${moduleMetadata.name}`)\n\n // Application Module Action handling\n this.logger.log(`[Start] Processing actions for ${moduleMetadata.name}`);\n const actions = overallMetadata.actions;\n await this.seedActions(actions);\n this.logger.log(`[End] Processing actions for ${moduleMetadata.name}`)\n\n // Application Module Menu handling \n this.logger.log(`[Start] Processing menus for ${moduleMetadata.name}`);\n const menus = overallMetadata.menus;\n await this.seedMenus(menus);\n this.logger.log(`[End] Processing menus for ${moduleMetadata.name}`)\n\n // Email templates \n this.logger.log(`[Start] Processing email templates for ${moduleMetadata.name}`);\n const emailTemplates: CreateEmailTemplateDto[] = overallMetadata.emailTemplates;\n await this.seedEmailTemplates(emailTemplates, moduleMetadata);\n this.logger.log(`[End] Processing email templates for ${moduleMetadata.name}`);\n\n // Sms templates\n this.logger.log(`[Start] Processing sms templates for ${moduleMetadata.name}`);\n const smsTemplates: CreateSmsTemplateDto[] = overallMetadata.smsTemplates;\n await this.seedSmsTemplates(smsTemplates, moduleMetadata);\n this.logger.log(`[End] Processing sms templates for ${moduleMetadata.name}`);\n\n // Settings\n this.logger.log(`[Start] Processing settings for ${moduleMetadata.name}`);\n await this.seetingService.seedDefaultSettings();\n this.logger.log(`[End] Processing settings for ${moduleMetadata.name}`);\n\n // Security rules\n this.logger.log(`[Start] Processing security rules for ${moduleMetadata.name}`);\n const securityRules: CreateSecurityRuleDto[] = overallMetadata.securityRules;\n await this.seedSecurityRules(securityRules);\n this.logger.log(`[End] Processing security rules for ${moduleMetadata.name}`);\n\n // List Of Values\n this.logger.log(`[Start] Processing List Of Values for ${moduleMetadata.name}`);\n const listOfValues: CreateListOfValuesDto[] = overallMetadata.listOfValues;\n await this.seedListOfValues(listOfValues);\n this.logger.log(`[End] Processing List Of Values for ${moduleMetadata.name}`);\n\n // Dashboards\n this.logger.log(`[Start] Processing dashboards for ${moduleMetadata.name}`);\n const dashboards: CreateDashboardDto[] = overallMetadata.dashboards;\n await this.seedDashboards(dashboards);\n this.logger.log(`[End] Processing dashboards for ${moduleMetadata.name}`);\n\n // Scheduled Jobs\n this.logger.debug(`[Start] Processing scheduled jobs for ${moduleMetadata.name}`);\n const scheduledJobs: CreateScheduledJobDto[] = overallMetadata.scheduledJobs;\n if (scheduledJobs?.length > 0) {\n await this.seedScheduledJobs(scheduledJobs);\n }\n this.logger.debug(`[End] Processing scheduled jobs for ${moduleMetadata.name}`);\n\n this.logger.debug(`[End] module seed data: ${overallMetadata}`);\n }\n\n // Post seed data file processing. \n\n // 1. Give all permissions to the Admin role.\n this.logger.log(`About to add all permissions to the Admin role`);\n await this.roleService.addAllPermissionsToRole(\"Admin\");\n // 2. Give wrapSettings permissions to the Public role.\n const internalRolePermission = [\n 'UserController.findMany',\n 'UserController.checkIfPermissionExists',\n 'UserController.findOne',\n 'MenuItemMetadataController.findMany',\n 'MenuItemMetadataController.findUserMenus',\n 'MenuItemMetadataController.findOne',\n 'ViewMetadataController.getLayout',\n 'ViewMetadataController.findMany',\n 'ViewMetadataController.findOne',\n 'AuthenticationController.changePassword',\n 'FieldMetadataController.getSelectionDynamicValues',\n 'FieldMetadataController.getSelectionDynamicValue',\n 'FieldMetadataController.findFieldDefaultMetaData',\n 'SavedFiltersController.delete',\n 'SavedFiltersController.deleteMany',\n 'SavedFiltersController.findOne',\n 'SavedFiltersController.findMany',\n 'SavedFiltersController.recover',\n 'SavedFiltersController.recoverMany',\n 'SavedFiltersController.partialUpdate',\n 'SavedFiltersController.update',\n 'SavedFiltersController.insertMany',\n 'SavedFiltersController.create',\n 'AuthenticationController.logout'\n ]\n await this.roleService.addPermissionToRole('Internal User', internalRolePermission);\n await this.roleService.addPermissionToRole('Public', ['SettingController.wrapSettings', 'AuthenticationController.logout']);\n this.logger.log(`All Seeders finished`);\n this.logger.log(`Newly created username is: ${usersDetail?.length > 0 ? usersDetail[0]?.username : ''} and password is ${usersDetail?.length > 0 ? usersDetail[0]?.password : ''}`);\n }\n\n\n async seedPermissions() {\n\n const controllers = this.solidRegistry.getControllers();\n\n // Loop over the countries and create them.\n for (let id = 0; id < controllers.length; id++) {\n try {\n const controller = controllers[id];\n this.logger.log(`Resolving controller: ${controller.name}`);\n\n const methods = controller.methods;\n for (let mId = 0; mId < methods.length; mId++) {\n\n const methodName = methods[mId];\n const permissionName = `${controller.name}.${methodName}`;\n\n const existingPermission = await this.permissionRepo.findOne({\n where: {\n name: permissionName\n }\n });\n\n if (existingPermission) {\n this.logger.log(`Permission ${permissionName} already exists.`);\n }\n else {\n this.logger.log(`Permission ${permissionName} does not exist, creating new.`);\n\n const newPermission = this.permissionRepo.create({\n name: permissionName\n });\n await this.permissionRepo.save(newPermission);\n\n }\n }\n\n } catch (error) {\n this.logger.error(error);\n }\n }\n }\n\n async seedMediaStorageProviders(mediaStorageProviders: any) {\n for (let i = 0; i < mediaStorageProviders.length; i++) {\n const mediaStorageProivder = mediaStorageProviders[i];\n await this.mediaStorageProviderMetadataService.upsert(mediaStorageProivder);\n }\n }\n\n async seedEmailTemplates(emailTemplates: CreateEmailTemplateDto[], moduleMetadata: CreateModuleMetadataDto) {\n if (!emailTemplates) {\n return;\n }\n\n for (let i = 0; i < emailTemplates.length; i++) {\n const emailTemplate = emailTemplates[i];\n this.logger.log(`Found ${emailTemplate.name} email template`);\n\n // We need to load the actual template contents. \n if (moduleMetadata.name === 'solid-core') {\n const modulePath = path.dirname(require.resolve('@solidstarters/solid-core'));\n const seedDataPath = path.join(modulePath, '../src/seeders/seed-data/email-templates');\n const filePath = path.join(seedDataPath, emailTemplate.body);\n this.logger.log(`Seeding email template from solid-core at path: ${filePath}`);\n if (fs.existsSync(filePath)) {\n emailTemplate.body = fs.readFileSync(filePath, 'utf-8').toString();\n }\n }\n else {\n // Check if file exists\n const emailTemplateHandlebar = `module-metadata/${moduleMetadata.name}/email-templates/${emailTemplate.body}`\n const fullPath = path.join(process.cwd(), emailTemplateHandlebar);\n this.logger.log(`Seeding custom email template from consuming model at path: ${fullPath}`);\n if (fs.existsSync(fullPath)) {\n emailTemplate.body = fs.readFileSync(fullPath, 'utf-8').toString();\n }\n }\n\n // Save to DB.\n await this.emailTemplateService.removeByName(emailTemplate.name);\n await this.emailTemplateService.create(emailTemplate);\n }\n\n }\n\n async seedSmsTemplates(smsTemplates: CreateSmsTemplateDto[], moduleMetadata: CreateModuleMetadataDto) {\n if (!smsTemplates) {\n return;\n }\n\n for (let i = 0; i < smsTemplates.length; i++) {\n const smsTemplate = smsTemplates[i];\n this.logger.log(`Found ${smsTemplate.name} sms template`);\n\n // We need to load the actual template contents. \n if (moduleMetadata.name === 'solid-core') {\n const modulePath = path.dirname(require.resolve('@solidstarters/solid-core'));\n const seedDataPath = path.join(modulePath, '../src/seeders/seed-data/sms-templates');\n const filePath = path.join(seedDataPath, smsTemplate.body);\n this.logger.log(`Seeding sms template from solid-core at path: ${filePath}`);\n if (fs.existsSync(filePath)) {\n smsTemplate.body = fs.readFileSync(filePath, 'utf-8').toString();\n }\n }\n else {\n // Check if file exists\n const emailTemplateHandlebar = `module-metadata/${moduleMetadata.name}/sms-templates/${smsTemplate.body}`\n const fullPath = path.join(process.cwd(), emailTemplateHandlebar);\n this.logger.log(`Seeding custom sms template from consuming model at path: ${fullPath}`);\n if (fs.existsSync(fullPath)) {\n smsTemplate.body = fs.readFileSync(fullPath, 'utf-8').toString();\n }\n }\n\n\n // Save to DB.\n await this.smsTemplateService.removeByName(smsTemplate.name);\n await this.smsTemplateService.create(smsTemplate);\n }\n }\n\n async seedMenus(menus: any) {\n if (!menus) {\n return;\n }\n\n for (let j = 0; j < menus.length; j++) {\n const menuData = menus[j];\n\n const adminRole = await this.roleService.findRoleByName('Admin');\n\n const specifiedRoles = menuData['roles'];\n\n // If the developer has specified roles, then resolve them, making sure that admin role is also given.\n const specifiedRoleObjects = [adminRole];\n if (specifiedRoles) {\n for (let i = 0; i < specifiedRoles.length; i++) {\n const specifiedRole = specifiedRoles[i];\n const specifiedRoleObject = await this.roleService.findRoleByName(specifiedRole);\n if (!specifiedRoleObject) {\n throw new Error(`Invalid role: (${specifiedRole}) specified against menu with display name ${menuData.displayName}.`);\n }\n specifiedRoleObjects.push(specifiedRoleObject);\n }\n }\n\n menuData['roles'] = specifiedRoleObjects;\n menuData['action'] = await this.solidActionService.findOneByUserKey(menuData.actionUserKey);\n menuData['module'] = await this.moduleMetadataService.findOneByUserKey(menuData.moduleUserKey);\n\n if (menuData.parentMenuItemUserKey) {\n menuData['parentMenuItem'] = await this.solidMenuItemService.findOneByUserKey(menuData.parentMenuItemUserKey);\n } else {\n menuData['parentMenuItem'] = null\n }\n await this.solidMenuItemService.upsert(menuData);\n }\n }\n\n async seedActions(actions: any) {\n if (!actions) {\n return;\n }\n\n for (let j = 0; j < actions.length; j++) {\n const actionData = actions[j];\n actionData['module'] = await this.moduleMetadataService.findOneByUserKey(actionData.moduleUserKey);\n if (actionData.type === 'solid') {\n actionData['model'] = await this.modelMetadataService.findOneByUserKey(actionData.modelUserKey);\n actionData['view'] = await this.solidViewService.findOneByUserKey(actionData.viewUserKey);\n }\n else {\n if (actionData.modelUserKey) {\n actionData['model'] = await this.modelMetadataService.findOneByUserKey(actionData.modelUserKey);\n }\n }\n await this.solidActionService.upsert(actionData);\n }\n }\n\n async seedViews(views: any) {\n if (!views) {\n return;\n }\n\n for (let j = 0; j < views.length; j++) {\n const viewData = views[j];\n\n // preety format the layout & context. \n viewData['layout'] = JSON.stringify(viewData['layout'], null, 2);\n // viewData['context'] = JSON.stringify(viewData['context'], null, 2);\n\n viewData['module'] = await this.moduleMetadataService.findOneByUserKey(viewData.moduleUserKey);\n viewData['model'] = await this.modelMetadataService.findOneByUserKey(viewData.modelUserKey);\n // await this.solidViewService.upsert(viewData);\n // First check if module already exists using name\n\n // Changed the below to upsert as now we are saving modifications to the view json to file system also.\n // await this.solidViewService.createIfNotPresent(viewData);\n await this.solidViewService.upsert(viewData);\n }\n }\n\n async seedUsers(users) {\n if (!users) {\n return;\n }\n\n for (let l = 0; l < users.length; l++) {\n const user = users[l];\n let exisitingUser = await this.userService.findOneByUsername(user.username);\n if (!exisitingUser) {\n exisitingUser = await this.authenticationService.signUp(user);\n\n this.logger.log(`Newly created user is ${user}`);\n }\n // now add Roles to user.\n // for (let m = 0; m < roles.length; m++) {\n // const role = roles[m];\n // await this.userService.addRoleToUser(user.email, role.name);\n // }\n }\n }\n\n async seedModuleModelFields(moduleMetadata: CreateModuleMetadataDto) {\n\n // First we create the module. \n // await this.moduleMetadataService.removeByName(moduleMetadata.name);\n // const module = await this.moduleMetadataService.create(moduleMetadata);\n const module = await this.moduleMetadataService.upsert(moduleMetadata);\n\n // Next create all the models. \n const modelsMetadata: CreateModelMetadataDto[] = moduleMetadata.models;\n for (let j = 0; j < modelsMetadata.length; j++) {\n const modelMetadata = modelsMetadata[j];\n\n // Before creating the model, we need to make sure we are linking it to the newly created module.\n // modelMetdata['moduleId'] = module.id;\n modelMetadata['module'] = module;\n\n // Please note that all the fields will also get created as we have setup the relation in model.entity.ts as cascade=true\n // await this.modelMetadataService.removeBySingularName(modelMetdata.singularName);\n // await this.modelMetadataService.modelSeeder(modelMetdata);\n\n // upsert the model information.\n // const fieldsMetadata = modelMetdata.fields;\n // delete modelMetdata['fields'];\n const { fields: fieldsMetadata, ...modelMetaDataWithoutFields } = modelMetadata;\n\n // Load and set the parent model if it exists.\n if (modelMetadata.isChild && modelMetadata.parentModelUserKey) {\n const parentModel = await this.modelMetadataService.findOneByUserKey(modelMetadata.parentModelUserKey);\n modelMetaDataWithoutFields['parentModel'] = parentModel;\n }\n\n await this.modelMetadataService.upsert(modelMetaDataWithoutFields);\n const model = await this.modelMetadataService.findOneBySingularName(modelMetadata.singularName)\n\n // iterate over all fields and upsert. \n let userKeyField = null;\n const userKeyFieldName = modelMetadata.userKeyFieldUserKey;\n for (let k = 0; k < fieldsMetadata.length; k++) {\n const fieldMetadata = fieldsMetadata[k];\n\n // TODO: resolve model & mediaStorageProvider. \n fieldMetadata['model'] = model;\n if (fieldMetadata.mediaStorageProviderUserKey) {\n fieldMetadata['mediaStorageProvider'] = await this.mediaStorageProviderMetadataService.findOneByUserKey(fieldMetadata.mediaStorageProviderUserKey);\n }\n // console.log(fieldMetadata.displayName);\n\n const affectedField = await this.fieldMetadataService.upsert(fieldMetadata);\n if (fieldMetadata.name === userKeyFieldName) {\n const { model, ...fieldData } = affectedField;\n userKeyField = fieldData;\n }\n }\n\n // Now that we have created fields & model update the model to stamp the userKeyField. \n if (userKeyField) {\n modelMetaDataWithoutFields['userKeyField'] = userKeyField;\n await this.modelMetadataService.upsert(modelMetaDataWithoutFields);\n }\n }\n }\n\n async seedSettings(createDto: CreateSettingDto) {\n const settingsArray: any[] = await this.settingsRepo.find();\n if (!settingsArray || settingsArray.length === 0) {\n this.seetingService.create(createDto);\n }\n }\n\n async seedSecurityRules(rulesDto: CreateSecurityRuleDto[]) {\n if (!rulesDto || rulesDto.length === 0) {\n this.logger.debug(`No security rules found to seed`);\n return;\n }\n for (const dto of rulesDto) {\n await this.securityRuleRepo.upsertWithDto({ ...dto, securityRuleConfig: JSON.stringify(dto.securityRuleConfig) });\n }\n }\n\n async seedListOfValues(listOfValuesDto: CreateListOfValuesDto[]) {\n if (!listOfValuesDto || listOfValuesDto.length === 0) {\n this.logger.debug(`No List Of Values found to seed`);\n return;\n }\n for (let j = 0; j < listOfValuesDto.length; j++) {\n await this.listOfValuesService.upsert(listOfValuesDto[j]);\n }\n }\n\n async seedDashboards(dashboardDtos: CreateDashboardDto[]) {\n if (!dashboardDtos || dashboardDtos.length === 0) {\n this.logger.debug(`No dashboards found to seed`);\n return;\n }\n for (const dto of dashboardDtos) {\n await this.dashboardRepo.upsertWithDto(dto);\n }\n }\n\n async seedScheduledJobs(createScheduledJobDto: CreateScheduledJobDto[]) {\n if (!createScheduledJobDto || createScheduledJobDto.length === 0) {\n this.logger.debug(`No scheduled jobs found to seed`);\n return;\n }\n for (const dto of createScheduledJobDto) {\n await this.scheduledJobRepository.upsertWithDto(dto);\n }\n }\n\n}"]}
|