@orion-js/file-manager 3.9.1 → 3.9.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.
package/lib/File/index.js CHANGED
@@ -11,6 +11,7 @@ const schema_1 = require("./schema");
11
11
  const typed_model_1 = require("@orion-js/typed-model");
12
12
  const isImage_1 = require("./resolvers/isImage");
13
13
  const credentials_1 = require("../credentials");
14
+ const lodash_1 = require("lodash");
14
15
  const schema = (0, typed_model_1.getModelForClass)(schema_1.FileSchema).getSchema();
15
16
  exports.default = (0, models_1.createModel)({
16
17
  name: 'File',
@@ -29,7 +30,9 @@ exports.default = (0, models_1.createModel)({
29
30
  if (!file.resizedData && options.getResizedImages) {
30
31
  try {
31
32
  file.resizedData = await options.getResizedImages(file);
32
- await Files_1.Files.updateOne(file, { $set: { resizedData: file.resizedData } });
33
+ if (!(0, lodash_1.isEmpty)(file.resizedData)) {
34
+ await Files_1.Files.updateOne(file, { $set: { resizedData: file.resizedData } });
35
+ }
33
36
  }
34
37
  catch (error) {
35
38
  console.error('Error getting resized images', error);
@@ -38,7 +41,9 @@ exports.default = (0, models_1.createModel)({
38
41
  if (!file.colorsData && options.getImageColors) {
39
42
  try {
40
43
  file.colorsData = await options.getImageColors(file);
41
- await Files_1.Files.updateOne(file, { $set: { colorsData: file.colorsData } });
44
+ if (!(0, lodash_1.isEmpty)(file.colorsData)) {
45
+ await Files_1.Files.updateOne(file, { $set: { colorsData: file.colorsData } });
46
+ }
42
47
  }
43
48
  catch (error) {
44
49
  console.error('Error getting image colors', error);
@@ -121,11 +121,11 @@ __decorate([
121
121
  __metadata("design:type", Date)
122
122
  ], FileSchema.prototype, "createdAt", void 0);
123
123
  __decorate([
124
- (0, typed_model_1.Prop)({ optional: true }),
124
+ (0, typed_model_1.Prop)({ optional: true, type: (0, typed_model_1.getModelForClass)(FileSchemaResizeData) }),
125
125
  __metadata("design:type", FileSchemaResizeData)
126
126
  ], FileSchema.prototype, "resizedData", void 0);
127
127
  __decorate([
128
- (0, typed_model_1.Prop)({ optional: true }),
128
+ (0, typed_model_1.Prop)({ optional: true, type: (0, typed_model_1.getModelForClass)(FileSchemaColorsData) }),
129
129
  __metadata("design:type", FileSchemaColorsData)
130
130
  ], FileSchema.prototype, "colorsData", void 0);
131
131
  FileSchema = __decorate([
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orion-js/file-manager",
3
- "version": "3.9.1",
3
+ "version": "3.9.3",
4
4
  "main": "lib/index.js",
5
5
  "author": "nicolaslopezj",
6
6
  "license": "MIT",
@@ -36,5 +36,5 @@
36
36
  "publishConfig": {
37
37
  "access": "public"
38
38
  },
39
- "gitHead": "def716136d1b1550a05665e541b55efe901cff9a"
39
+ "gitHead": "57a7323d78585ce1d823548d464709f46aed84b7"
40
40
  }