@stemy/backend 2.8.1 → 2.8.2

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.
@@ -5223,8 +5223,9 @@
5223
5223
  ], CompressionMiddleware);
5224
5224
 
5225
5225
  var Tree = /** @class */ (function () {
5226
- function Tree(container, path) {
5226
+ function Tree(container, exists, path) {
5227
5227
  this.container = container;
5228
+ this.exists = exists;
5228
5229
  this.path = path;
5229
5230
  this.map = new Map();
5230
5231
  }
@@ -5236,7 +5237,7 @@
5236
5237
  configurable: true
5237
5238
  });
5238
5239
  Tree.prototype.resolveService = function () {
5239
- return this.container.resolve(this.path);
5240
+ return !this.exists ? null : this.container.resolve(this.path);
5240
5241
  };
5241
5242
  Tree.prototype.resolveLeaves = function () {
5242
5243
  var map;
@@ -5278,7 +5279,7 @@
5278
5279
  parentTree = parentTree.resolveAncestor(path);
5279
5280
  }
5280
5281
  catch (e) {
5281
- parentTree = new Tree(this.container, "");
5282
+ parentTree = new Tree(this.container, false, "");
5282
5283
  }
5283
5284
  var pathParts = path.split(".");
5284
5285
  var tree = this;
@@ -5312,7 +5313,7 @@
5312
5313
  Tree.prototype.resolvePath = function (path, throwError) {
5313
5314
  if (throwError === void 0) { throwError = true; }
5314
5315
  var absolutePath = !this.path ? path : this.path + "." + path;
5315
- var tree = new Tree(this.container, absolutePath);
5316
+ var tree = new Tree(this.container, false, absolutePath);
5316
5317
  try {
5317
5318
  tree = this.resolveAncestor(path);
5318
5319
  }
@@ -5331,29 +5332,21 @@
5331
5332
  return tree;
5332
5333
  };
5333
5334
  Tree.prototype.addPath = function (path) {
5334
- var e_2, _a;
5335
5335
  if (!isString(path) || path.length == 0) {
5336
5336
  return this;
5337
5337
  }
5338
5338
  var pathParts = path.split(".");
5339
+ var maxIx = pathParts.length - 1;
5339
5340
  var tree = this;
5340
5341
  path = this.path;
5341
- try {
5342
- for (var pathParts_2 = __values(pathParts), pathParts_2_1 = pathParts_2.next(); !pathParts_2_1.done; pathParts_2_1 = pathParts_2.next()) {
5343
- var part = pathParts_2_1.value;
5344
- if (!tree.map.has(part)) {
5345
- tree.map.set(part, new Tree(this.container, !path ? part : path + "." + part));
5346
- }
5347
- tree = tree.map.get(part);
5348
- path = tree.path;
5349
- }
5350
- }
5351
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
5352
- finally {
5353
- try {
5354
- if (pathParts_2_1 && !pathParts_2_1.done && (_a = pathParts_2.return)) _a.call(pathParts_2);
5342
+ for (var ix = 0; ix <= maxIx; ix++) {
5343
+ var part = pathParts[ix];
5344
+ if (!tree.map.has(part)) {
5345
+ tree.map.set(part, new Tree(this.container, false, !path ? part : path + "." + part));
5355
5346
  }
5356
- finally { if (e_2) throw e_2.error; }
5347
+ tree = tree.map.get(part);
5348
+ tree.exists = tree.exists || ix == maxIx;
5349
+ path = tree.path;
5357
5350
  }
5358
5351
  return this;
5359
5352
  };
@@ -5368,7 +5361,7 @@
5368
5361
  container["wrapperContainer"] = this;
5369
5362
  this.tokens = [];
5370
5363
  this.tokenSet = new Set();
5371
- this.myTree = new Tree(this, "");
5364
+ this.root = new Tree(this, false, "");
5372
5365
  }
5373
5366
  Object.defineProperty(DiContainer.prototype, "registeredTokens", {
5374
5367
  get: function () {
@@ -5380,7 +5373,7 @@
5380
5373
  });
5381
5374
  Object.defineProperty(DiContainer.prototype, "tree", {
5382
5375
  get: function () {
5383
- return this.myTree;
5376
+ return this.root;
5384
5377
  },
5385
5378
  enumerable: false,
5386
5379
  configurable: true
@@ -5444,7 +5437,7 @@
5444
5437
  this.tokenSet.add(token);
5445
5438
  this.tokens.push(token);
5446
5439
  if (isString(token)) {
5447
- this.myTree.addPath(token);
5440
+ this.root.addPath(token);
5448
5441
  }
5449
5442
  return this;
5450
5443
  };