@stemy/backend 2.8.2 → 2.8.6

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.
@@ -1355,9 +1355,11 @@
1355
1355
  }).replace(/\./gi, "_").replace(/^_/, "").toUpperCase();
1356
1356
  var envValue = process.env[envName];
1357
1357
  if (typeof envValue !== "undefined") {
1358
- return isFunction(param.resolver)
1358
+ var value = isFunction(param.resolver)
1359
1359
  ? param.resolver(envValue)
1360
1360
  : convertValue(envValue, getType(param.defaultValue));
1361
+ console.log("Processing param value", name, envName, envValue, value);
1362
+ return value;
1361
1363
  }
1362
1364
  return param.defaultValue;
1363
1365
  };
@@ -1887,7 +1889,7 @@
1887
1889
  Assets.prototype.read = function (id) {
1888
1890
  return __awaiter$q(this, void 0, void 0, function () {
1889
1891
  return __generator(this, function (_b) {
1890
- return [2 /*return*/, this.find({ _id: new bson.ObjectId(id) })];
1892
+ return [2 /*return*/, !id ? null : this.find({ _id: new bson.ObjectId(id) })];
1891
1893
  });
1892
1894
  });
1893
1895
  };
@@ -2044,13 +2046,13 @@
2044
2046
  this.load().then(function () {
2045
2047
  if (_this.deleted)
2046
2048
  return;
2047
- var progressPromise = !_this.progressId ? Promise.resolve(null) : _this.progresses.get(_this.progressId).then(function (p) { return p.cancel(); });
2048
- progressPromise.then(function () {
2049
- _this.startWorkingOnAsset().then(function () {
2050
- console.log("Started working on lazy asset: " + _this.id);
2051
- }).catch(function (reason) {
2052
- console.log("Can't start working on lazy asset: " + _this.id + "\nReason: " + reason);
2053
- });
2049
+ _this.progresses.get(_this.progressId).then(function (p) {
2050
+ p === null || p === void 0 ? void 0 : p.cancel();
2051
+ });
2052
+ _this.startWorkingOnAsset().then(function () {
2053
+ console.log("Started working on lazy asset: " + _this.id);
2054
+ }).catch(function (reason) {
2055
+ console.log("Can't start working on lazy asset: " + _this.id + "\nReason: " + reason);
2054
2056
  });
2055
2057
  });
2056
2058
  };
@@ -2095,19 +2097,21 @@
2095
2097
  };
2096
2098
  LazyAsset.prototype.startWorkingOnAsset = function () {
2097
2099
  return __awaiter$p(this, void 0, void 0, function () {
2098
- var id;
2099
- return __generator(this, function (_a) {
2100
- switch (_a.label) {
2101
- case 0: return [4 /*yield*/, this.progresses.create()];
2100
+ var _a;
2101
+ return __generator(this, function (_b) {
2102
+ switch (_b.label) {
2103
+ case 0:
2104
+ _a = this.data;
2105
+ return [4 /*yield*/, this.progresses.create()];
2102
2106
  case 1:
2103
- id = (_a.sent()).id;
2104
- this.data.progressId = id;
2107
+ _a.progressId = (_b.sent()).id;
2108
+ this.data.assetId = null;
2105
2109
  return [4 /*yield*/, this.save()];
2106
2110
  case 2:
2107
- _a.sent();
2111
+ _b.sent();
2108
2112
  return [4 /*yield*/, this.jobMan.enqueueWithName(this.data.jobName, Object.assign(Object.assign({}, this.data.jobParams), { lazyId: this.id }))];
2109
2113
  case 3:
2110
- _a.sent();
2114
+ _b.sent();
2111
2115
  return [2 /*return*/];
2112
2116
  }
2113
2117
  });
@@ -2871,7 +2875,7 @@
2871
2875
  Progresses.prototype.get = function (id) {
2872
2876
  return __awaiter$m(this, void 0, void 0, function () {
2873
2877
  return __generator(this, function (_a) {
2874
- return [2 /*return*/, this.find({ _id: new bson.ObjectId(id) })];
2878
+ return [2 /*return*/, !id ? null : this.find({ _id: new bson.ObjectId(id) })];
2875
2879
  });
2876
2880
  });
2877
2881
  };
@@ -3004,7 +3008,7 @@
3004
3008
  LazyAssets.prototype.read = function (id) {
3005
3009
  return __awaiter$l(this, void 0, void 0, function () {
3006
3010
  return __generator(this, function (_a) {
3007
- return [2 /*return*/, this.find({ _id: new bson.ObjectId(id) })];
3011
+ return [2 /*return*/, !id ? null : this.find({ _id: new bson.ObjectId(id) })];
3008
3012
  });
3009
3013
  });
3010
3014
  };