manifest 4.11.1 → 4.11.3

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.
@@ -11,9 +11,6 @@ var __metadata = (this && this.__metadata) || function (k, v) {
11
11
  var __param = (this && this.__param) || function (paramIndex, decorator) {
12
12
  return function (target, key) { decorator(target, key, paramIndex); }
13
13
  };
14
- var __importDefault = (this && this.__importDefault) || function (mod) {
15
- return (mod && mod.__esModule) ? mod : { "default": mod };
16
- };
17
14
  Object.defineProperty(exports, "__esModule", { value: true });
18
15
  exports.RelationshipService = void 0;
19
16
  const faker_1 = require("@faker-js/faker");
@@ -22,7 +19,6 @@ const typeorm_1 = require("typeorm");
22
19
  const constants_1 = require("../../constants");
23
20
  const entity_service_1 = require("./entity.service");
24
21
  const common_2 = require("../../../../common/src");
25
- const pluralize_1 = __importDefault(require("pluralize"));
26
22
  const entity_manifest_service_1 = require("../../manifest/services/entity-manifest.service");
27
23
  let RelationshipService = class RelationshipService {
28
24
  constructor(entityManifestService, entityService) {
@@ -93,7 +89,7 @@ let RelationshipService = class RelationshipService {
93
89
  entityManifest.relationships
94
90
  .filter((relationship) => relationship.type === 'one-to-many')
95
91
  .forEach((oneToManyRelationship) => {
96
- const relationshipName = (0, pluralize_1.default)(oneToManyRelationship.name);
92
+ const relationshipName = oneToManyRelationship.name;
97
93
  relationOptions[relationshipName] = {
98
94
  target: oneToManyRelationship.entity,
99
95
  type: 'one-to-many',
@@ -69,9 +69,13 @@ let EntityManifestService = class EntityManifestService {
69
69
  slug: entitySchema.slug ||
70
70
  (0, slugify_1.default)((0, dasherize_1.default)(entitySchema.single
71
71
  ? entitySchema.className || className
72
- : pluralize_1.default.plural(entitySchema.className || className)).toLowerCase()),
72
+ : entitySchema.namePlural ||
73
+ pluralize_1.default.plural(entitySchema.className || className)).toLowerCase()),
73
74
  single: entitySchema.single || false,
74
- properties: (entitySchema.properties || []).map((propManifest) => this.transformProperty(propManifest, entitySchema)),
75
+ properties: (entitySchema.properties || [])
76
+ .filter((propSchema) => propSchema !== 'id' &&
77
+ propSchema.name !== 'id')
78
+ .map((propSchema) => this.transformProperty(propSchema, entitySchema)),
75
79
  hooks: this.transformHookObject(entitySchema.hooks),
76
80
  middlewares: entitySchema.middlewares || {}
77
81
  };
@@ -50,6 +50,7 @@ const common_1 = require("@nestjs/common");
50
50
  const common_2 = require("../../../../common/src");
51
51
  const constants_1 = require("../../constants");
52
52
  const fs = __importStar(require("fs"));
53
+ const path = __importStar(require("path"));
53
54
  const sharp_1 = __importDefault(require("sharp"));
54
55
  const mkdirp = __importStar(require("mkdirp"));
55
56
  const uniqid_1 = __importDefault(require("uniqid"));
@@ -90,7 +91,11 @@ let StorageService = class StorageService {
90
91
  return this.uploadToS3(filePath, file.buffer);
91
92
  }
92
93
  else {
93
- fs.writeFileSync(`${this.configService.get('paths.publicFolder')}/${constants_1.STORAGE_PATH}/${filePath}`, file.buffer);
94
+ const publicFolderPath = path.resolve(this.configService.get('paths.publicFolder'), constants_1.STORAGE_PATH, filePath);
95
+ if (!publicFolderPath.startsWith(path.resolve(this.configService.get('paths.publicFolder'), constants_1.STORAGE_PATH))) {
96
+ throw new Error('Invalid file path');
97
+ }
98
+ fs.writeFileSync(publicFolderPath, file.buffer);
94
99
  return Promise.resolve(this.prependStorageUrl(filePath));
95
100
  }
96
101
  }
@@ -110,7 +115,11 @@ let StorageService = class StorageService {
110
115
  imagePaths[sizeName] = await this.uploadToS3(imagePath, resizedImage);
111
116
  }
112
117
  else {
113
- fs.writeFileSync(`${this.configService.get('paths.publicFolder')}/${constants_1.STORAGE_PATH}/${imagePath}`, resizedImage);
118
+ const publicFolderPath = path.resolve(this.configService.get('paths.publicFolder'), constants_1.STORAGE_PATH, imagePath);
119
+ if (!publicFolderPath.startsWith(path.resolve(this.configService.get('paths.publicFolder'), constants_1.STORAGE_PATH))) {
120
+ throw new Error('Invalid image path');
121
+ }
122
+ fs.writeFileSync(publicFolderPath, resizedImage);
114
123
  imagePaths[sizeName] = this.prependStorageUrl(imagePath);
115
124
  }
116
125
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "manifest",
3
- "version": "4.11.1",
3
+ "version": "4.11.3",
4
4
  "description": "The 1-file micro-backend",
5
5
  "author": "Manifest",
6
6
  "license": "MIT",