@stemy/backend 2.8.0 → 2.8.4

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
  };
@@ -1904,6 +1906,38 @@
1904
1906
  });
1905
1907
  });
1906
1908
  };
1909
+ Assets.prototype.findMany = function (where) {
1910
+ return __awaiter$q(this, void 0, void 0, function () {
1911
+ var cursor, items, result, items_1, items_1_1, item;
1912
+ var e_2, _b;
1913
+ return __generator(this, function (_c) {
1914
+ switch (_c.label) {
1915
+ case 0:
1916
+ cursor = this.collection.find(where);
1917
+ return [4 /*yield*/, cursor.toArray()];
1918
+ case 1:
1919
+ items = (_c.sent()) || [];
1920
+ result = [];
1921
+ try {
1922
+ for (items_1 = __values(items), items_1_1 = items_1.next(); !items_1_1.done; items_1_1 = items_1.next()) {
1923
+ item = items_1_1.value;
1924
+ if (!item)
1925
+ continue;
1926
+ result.push(new Asset(item._id, item, this.collection, this.bucket));
1927
+ }
1928
+ }
1929
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
1930
+ finally {
1931
+ try {
1932
+ if (items_1_1 && !items_1_1.done && (_b = items_1.return)) _b.call(items_1);
1933
+ }
1934
+ finally { if (e_2) throw e_2.error; }
1935
+ }
1936
+ return [2 /*return*/, result];
1937
+ }
1938
+ });
1939
+ });
1940
+ };
1907
1941
  Assets.prototype.unlink = function (id) {
1908
1942
  return __awaiter$q(this, void 0, void 0, function () {
1909
1943
  var asset;
@@ -2063,19 +2097,21 @@
2063
2097
  };
2064
2098
  LazyAsset.prototype.startWorkingOnAsset = function () {
2065
2099
  return __awaiter$p(this, void 0, void 0, function () {
2066
- var id;
2067
- return __generator(this, function (_a) {
2068
- switch (_a.label) {
2069
- 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()];
2070
2106
  case 1:
2071
- id = (_a.sent()).id;
2072
- this.data.progressId = id;
2107
+ _a.progressId = (_b.sent()).id;
2108
+ this.data.assetId = null;
2073
2109
  return [4 /*yield*/, this.save()];
2074
2110
  case 2:
2075
- _a.sent();
2111
+ _b.sent();
2076
2112
  return [4 /*yield*/, this.jobMan.enqueueWithName(this.data.jobName, Object.assign(Object.assign({}, this.data.jobParams), { lazyId: this.id }))];
2077
2113
  case 3:
2078
- _a.sent();
2114
+ _b.sent();
2079
2115
  return [2 /*return*/];
2080
2116
  }
2081
2117
  });
@@ -5191,8 +5227,9 @@
5191
5227
  ], CompressionMiddleware);
5192
5228
 
5193
5229
  var Tree = /** @class */ (function () {
5194
- function Tree(container, path) {
5230
+ function Tree(container, exists, path) {
5195
5231
  this.container = container;
5232
+ this.exists = exists;
5196
5233
  this.path = path;
5197
5234
  this.map = new Map();
5198
5235
  }
@@ -5204,7 +5241,7 @@
5204
5241
  configurable: true
5205
5242
  });
5206
5243
  Tree.prototype.resolveService = function () {
5207
- return this.container.resolve(this.path);
5244
+ return !this.exists ? null : this.container.resolve(this.path);
5208
5245
  };
5209
5246
  Tree.prototype.resolveLeaves = function () {
5210
5247
  var map;
@@ -5246,7 +5283,7 @@
5246
5283
  parentTree = parentTree.resolveAncestor(path);
5247
5284
  }
5248
5285
  catch (e) {
5249
- parentTree = new Tree(this.container, "");
5286
+ parentTree = new Tree(this.container, false, "");
5250
5287
  }
5251
5288
  var pathParts = path.split(".");
5252
5289
  var tree = this;
@@ -5280,7 +5317,7 @@
5280
5317
  Tree.prototype.resolvePath = function (path, throwError) {
5281
5318
  if (throwError === void 0) { throwError = true; }
5282
5319
  var absolutePath = !this.path ? path : this.path + "." + path;
5283
- var tree = new Tree(this.container, absolutePath);
5320
+ var tree = new Tree(this.container, false, absolutePath);
5284
5321
  try {
5285
5322
  tree = this.resolveAncestor(path);
5286
5323
  }
@@ -5299,29 +5336,21 @@
5299
5336
  return tree;
5300
5337
  };
5301
5338
  Tree.prototype.addPath = function (path) {
5302
- var e_2, _a;
5303
5339
  if (!isString(path) || path.length == 0) {
5304
5340
  return this;
5305
5341
  }
5306
5342
  var pathParts = path.split(".");
5343
+ var maxIx = pathParts.length - 1;
5307
5344
  var tree = this;
5308
5345
  path = this.path;
5309
- try {
5310
- for (var pathParts_2 = __values(pathParts), pathParts_2_1 = pathParts_2.next(); !pathParts_2_1.done; pathParts_2_1 = pathParts_2.next()) {
5311
- var part = pathParts_2_1.value;
5312
- if (!tree.map.has(part)) {
5313
- tree.map.set(part, new Tree(this.container, !path ? part : path + "." + part));
5314
- }
5315
- tree = tree.map.get(part);
5316
- path = tree.path;
5317
- }
5318
- }
5319
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
5320
- finally {
5321
- try {
5322
- if (pathParts_2_1 && !pathParts_2_1.done && (_a = pathParts_2.return)) _a.call(pathParts_2);
5346
+ for (var ix = 0; ix <= maxIx; ix++) {
5347
+ var part = pathParts[ix];
5348
+ if (!tree.map.has(part)) {
5349
+ tree.map.set(part, new Tree(this.container, false, !path ? part : path + "." + part));
5323
5350
  }
5324
- finally { if (e_2) throw e_2.error; }
5351
+ tree = tree.map.get(part);
5352
+ tree.exists = tree.exists || ix == maxIx;
5353
+ path = tree.path;
5325
5354
  }
5326
5355
  return this;
5327
5356
  };
@@ -5336,7 +5365,7 @@
5336
5365
  container["wrapperContainer"] = this;
5337
5366
  this.tokens = [];
5338
5367
  this.tokenSet = new Set();
5339
- this.myTree = new Tree(this, "");
5368
+ this.root = new Tree(this, false, "");
5340
5369
  }
5341
5370
  Object.defineProperty(DiContainer.prototype, "registeredTokens", {
5342
5371
  get: function () {
@@ -5348,7 +5377,7 @@
5348
5377
  });
5349
5378
  Object.defineProperty(DiContainer.prototype, "tree", {
5350
5379
  get: function () {
5351
- return this.myTree;
5380
+ return this.root;
5352
5381
  },
5353
5382
  enumerable: false,
5354
5383
  configurable: true
@@ -5412,7 +5441,7 @@
5412
5441
  this.tokenSet.add(token);
5413
5442
  this.tokens.push(token);
5414
5443
  if (isString(token)) {
5415
- this.myTree.addPath(token);
5444
+ this.root.addPath(token);
5416
5445
  }
5417
5446
  return this;
5418
5447
  };