@stemy/backend 3.5.6 → 3.5.8

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.
@@ -104,7 +104,7 @@
104
104
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
105
105
  return Reflect.metadata(metadataKey, metadataValue);
106
106
  }
107
- function __awaiter$B(thisArg, _arguments, P, generator) {
107
+ function __awaiter$C(thisArg, _arguments, P, generator) {
108
108
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
109
109
  return new (P || (P = Promise))(function (resolve, reject) {
110
110
  function fulfilled(value) { try {
@@ -391,7 +391,7 @@
391
391
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
392
392
  return c > 3 && r && Object.defineProperty(target, key, r), r;
393
393
  };
394
- var __awaiter$A = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
394
+ var __awaiter$B = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
395
395
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
396
396
  return new (P || (P = Promise))(function (resolve, reject) {
397
397
  function fulfilled(value) { try {
@@ -439,7 +439,7 @@
439
439
  };
440
440
  AssetProcessor.fileTypeFromBuffer = function (buffer) {
441
441
  var _a;
442
- return __awaiter$A(this, void 0, void 0, function () {
442
+ return __awaiter$B(this, void 0, void 0, function () {
443
443
  var type;
444
444
  return __generator(this, function (_b) {
445
445
  switch (_b.label) {
@@ -473,7 +473,7 @@
473
473
  return imageTypes.indexOf(contentType) >= 0;
474
474
  };
475
475
  AssetProcessor.copyImageMeta = function (buffer, metadata, fileType) {
476
- return __awaiter$A(this, void 0, void 0, function () {
476
+ return __awaiter$B(this, void 0, void 0, function () {
477
477
  var match, attrs, parts, output;
478
478
  return __generator(this, function (_b) {
479
479
  switch (_b.label) {
@@ -520,7 +520,7 @@
520
520
  });
521
521
  };
522
522
  AssetProcessor.prototype.process = function (buffer, metadata, fileType) {
523
- return __awaiter$A(this, void 0, void 0, function () {
523
+ return __awaiter$B(this, void 0, void 0, function () {
524
524
  return __generator(this, function (_b) {
525
525
  switch (_b.label) {
526
526
  case 0:
@@ -545,7 +545,7 @@
545
545
  tsyringe.scoped(tsyringe.Lifecycle.ContainerScoped)
546
546
  ], exports.AssetProcessor);
547
547
 
548
- var __awaiter$z = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
548
+ var __awaiter$A = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
549
549
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
550
550
  return new (P || (P = Promise))(function (resolve, reject) {
551
551
  function fulfilled(value) { try {
@@ -745,7 +745,7 @@
745
745
  };
746
746
  }
747
747
  function toImage(src, params, meta) {
748
- return __awaiter$z(this, void 0, void 0, function () {
748
+ return __awaiter$A(this, void 0, void 0, function () {
749
749
  var crop, buffer, _a, cropBefore, cropAfter, img, _b, width, height, canvasScaleX, canvasScaleY, e_2;
750
750
  return __generator(this, function (_c) {
751
751
  switch (_c.label) {
@@ -906,7 +906,7 @@
906
906
  }
907
907
  function readAndDeleteFile(path, timeout) {
908
908
  if (timeout === void 0) { timeout = 5000; }
909
- return __awaiter$z(this, void 0, void 0, function () {
909
+ return __awaiter$A(this, void 0, void 0, function () {
910
910
  var data;
911
911
  return __generator(this, function (_a) {
912
912
  switch (_a.label) {
@@ -923,7 +923,7 @@
923
923
  });
924
924
  }
925
925
  function writeFile(path$1, data) {
926
- return __awaiter$z(this, void 0, void 0, function () {
926
+ return __awaiter$A(this, void 0, void 0, function () {
927
927
  return __generator(this, function (_a) {
928
928
  switch (_a.label) {
929
929
  case 0: return [4 /*yield*/, mkdirRecursive(path.dirname(path$1))];
@@ -1351,7 +1351,7 @@
1351
1351
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
1352
1352
  return Reflect.metadata(k, v);
1353
1353
  };
1354
- var __awaiter$y = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
1354
+ var __awaiter$z = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
1355
1355
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
1356
1356
  return new (P || (P = Promise))(function (resolve, reject) {
1357
1357
  function fulfilled(value) { try {
@@ -1399,7 +1399,7 @@
1399
1399
  configurable: true
1400
1400
  });
1401
1401
  MongoConnector.prototype.connect = function () {
1402
- return __awaiter$y(this, void 0, void 0, function () {
1402
+ return __awaiter$z(this, void 0, void 0, function () {
1403
1403
  var _a;
1404
1404
  return __generator(this, function (_b) {
1405
1405
  switch (_b.label) {
@@ -1428,7 +1428,7 @@
1428
1428
  __metadata$u("design:paramtypes", [exports.Configuration])
1429
1429
  ], exports.MongoConnector);
1430
1430
 
1431
- var __awaiter$x = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
1431
+ var __awaiter$y = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
1432
1432
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
1433
1433
  return new (P || (P = Promise))(function (resolve, reject) {
1434
1434
  function fulfilled(value) { try {
@@ -1464,7 +1464,7 @@
1464
1464
  return this.collection.updateOne({ _id: this.mId }, { $set: this.toJSON() });
1465
1465
  };
1466
1466
  BaseEntity.prototype.load = function () {
1467
- return __awaiter$x(this, void 0, void 0, function () {
1467
+ return __awaiter$y(this, void 0, void 0, function () {
1468
1468
  var res;
1469
1469
  return __generator(this, function (_a) {
1470
1470
  switch (_a.label) {
@@ -1487,7 +1487,7 @@
1487
1487
  return BaseEntity;
1488
1488
  }());
1489
1489
 
1490
- var __awaiter$w = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
1490
+ var __awaiter$x = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
1491
1491
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
1492
1492
  return new (P || (P = Promise))(function (resolve, reject) {
1493
1493
  function fulfilled(value) { try {
@@ -1542,7 +1542,7 @@
1542
1542
  configurable: true
1543
1543
  });
1544
1544
  Asset.prototype.unlink = function () {
1545
- return __awaiter$w(this, void 0, void 0, function () {
1545
+ return __awaiter$x(this, void 0, void 0, function () {
1546
1546
  return __generator(this, function (_a) {
1547
1547
  return [2 /*return*/, deleteFromBucket(this.bucket, this.mId)];
1548
1548
  });
@@ -1552,7 +1552,7 @@
1552
1552
  return streamToBuffer(this.stream);
1553
1553
  };
1554
1554
  Asset.prototype.download = function (metadata) {
1555
- return __awaiter$w(this, void 0, void 0, function () {
1555
+ return __awaiter$x(this, void 0, void 0, function () {
1556
1556
  return __generator(this, function (_a) {
1557
1557
  switch (_a.label) {
1558
1558
  case 0:
@@ -1572,14 +1572,14 @@
1572
1572
  };
1573
1573
  Asset.prototype.getImage = function (params) {
1574
1574
  if (params === void 0) { params = null; }
1575
- return __awaiter$w(this, void 0, void 0, function () {
1575
+ return __awaiter$x(this, void 0, void 0, function () {
1576
1576
  return __generator(this, function (_a) {
1577
1577
  return [2 /*return*/, toImage(this.stream, params, this.metadata)];
1578
1578
  });
1579
1579
  });
1580
1580
  };
1581
1581
  Asset.prototype.downloadImage = function (params, metadata) {
1582
- return __awaiter$w(this, void 0, void 0, function () {
1582
+ return __awaiter$x(this, void 0, void 0, function () {
1583
1583
  var _a;
1584
1584
  return __generator(this, function (_b) {
1585
1585
  switch (_b.label) {
@@ -1594,7 +1594,7 @@
1594
1594
  return Asset;
1595
1595
  }(BaseEntity));
1596
1596
 
1597
- var __awaiter$v = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
1597
+ var __awaiter$w = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
1598
1598
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
1599
1599
  return new (P || (P = Promise))(function (resolve, reject) {
1600
1600
  function fulfilled(value) { try {
@@ -1629,21 +1629,21 @@
1629
1629
  configurable: true
1630
1630
  });
1631
1631
  TempAsset.prototype.unlink = function () {
1632
- return __awaiter$v(this, void 0, void 0, function () {
1632
+ return __awaiter$w(this, void 0, void 0, function () {
1633
1633
  return __generator(this, function (_a) {
1634
1634
  throw new Error("Temp asset '" + this.id + "' can not be removed!");
1635
1635
  });
1636
1636
  });
1637
1637
  };
1638
1638
  TempAsset.prototype.getBuffer = function () {
1639
- return __awaiter$v(this, void 0, void 0, function () {
1639
+ return __awaiter$w(this, void 0, void 0, function () {
1640
1640
  return __generator(this, function (_a) {
1641
1641
  return [2 /*return*/, this.buffer];
1642
1642
  });
1643
1643
  });
1644
1644
  };
1645
1645
  TempAsset.prototype.download = function (metadata) {
1646
- return __awaiter$v(this, void 0, void 0, function () {
1646
+ return __awaiter$w(this, void 0, void 0, function () {
1647
1647
  return __generator(this, function (_a) {
1648
1648
  return [2 /*return*/, this.stream];
1649
1649
  });
@@ -1657,14 +1657,14 @@
1657
1657
  return this.downloadImage(params);
1658
1658
  };
1659
1659
  TempAsset.prototype.save = function () {
1660
- return __awaiter$v(this, void 0, void 0, function () {
1660
+ return __awaiter$w(this, void 0, void 0, function () {
1661
1661
  return __generator(this, function (_a) {
1662
1662
  return [2 /*return*/, this];
1663
1663
  });
1664
1664
  });
1665
1665
  };
1666
1666
  TempAsset.prototype.load = function () {
1667
- return __awaiter$v(this, void 0, void 0, function () {
1667
+ return __awaiter$w(this, void 0, void 0, function () {
1668
1668
  return __generator(this, function (_a) {
1669
1669
  return [2 /*return*/, this];
1670
1670
  });
@@ -1695,7 +1695,7 @@
1695
1695
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
1696
1696
  return Reflect.metadata(k, v);
1697
1697
  };
1698
- var __awaiter$u = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
1698
+ var __awaiter$v = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
1699
1699
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
1700
1700
  return new (P || (P = Promise))(function (resolve, reject) {
1701
1701
  function fulfilled(value) { try {
@@ -1725,7 +1725,7 @@
1725
1725
  Assets.prototype.write = function (stream, contentType, metadata) {
1726
1726
  if (contentType === void 0) { contentType = null; }
1727
1727
  if (metadata === void 0) { metadata = null; }
1728
- return __awaiter$u(this, void 0, void 0, function () {
1728
+ return __awaiter$v(this, void 0, void 0, function () {
1729
1729
  var uploadStream, buffer, fileType, e_1;
1730
1730
  return __generator(this, function (_b) {
1731
1731
  switch (_b.label) {
@@ -1759,7 +1759,7 @@
1759
1759
  Assets.prototype.writeBuffer = function (buffer, metadata, contentType) {
1760
1760
  if (metadata === void 0) { metadata = null; }
1761
1761
  if (contentType === void 0) { contentType = null; }
1762
- return __awaiter$u(this, void 0, void 0, function () {
1762
+ return __awaiter$v(this, void 0, void 0, function () {
1763
1763
  var fileType, e_2;
1764
1764
  return __generator(this, function (_b) {
1765
1765
  switch (_b.label) {
@@ -1791,7 +1791,7 @@
1791
1791
  };
1792
1792
  Assets.prototype.writeUrl = function (url, metadata) {
1793
1793
  if (metadata === void 0) { metadata = null; }
1794
- return __awaiter$u(this, void 0, void 0, function () {
1794
+ return __awaiter$v(this, void 0, void 0, function () {
1795
1795
  var oneWeek, asset, buffer;
1796
1796
  return __generator(this, function (_b) {
1797
1797
  switch (_b.label) {
@@ -1815,7 +1815,7 @@
1815
1815
  };
1816
1816
  Assets.prototype.download = function (url, contentType) {
1817
1817
  if (contentType === void 0) { contentType = null; }
1818
- return __awaiter$u(this, void 0, void 0, function () {
1818
+ return __awaiter$v(this, void 0, void 0, function () {
1819
1819
  var buffer, fileType, e_3, metadata;
1820
1820
  return __generator(this, function (_b) {
1821
1821
  switch (_b.label) {
@@ -1851,14 +1851,14 @@
1851
1851
  });
1852
1852
  };
1853
1853
  Assets.prototype.read = function (id) {
1854
- return __awaiter$u(this, void 0, void 0, function () {
1854
+ return __awaiter$v(this, void 0, void 0, function () {
1855
1855
  return __generator(this, function (_b) {
1856
1856
  return [2 /*return*/, !id ? null : this.find({ _id: new bson.ObjectId(id) })];
1857
1857
  });
1858
1858
  });
1859
1859
  };
1860
1860
  Assets.prototype.find = function (where) {
1861
- return __awaiter$u(this, void 0, void 0, function () {
1861
+ return __awaiter$v(this, void 0, void 0, function () {
1862
1862
  var data;
1863
1863
  return __generator(this, function (_b) {
1864
1864
  switch (_b.label) {
@@ -1871,7 +1871,7 @@
1871
1871
  });
1872
1872
  };
1873
1873
  Assets.prototype.findMany = function (where) {
1874
- return __awaiter$u(this, void 0, void 0, function () {
1874
+ return __awaiter$v(this, void 0, void 0, function () {
1875
1875
  var cursor, items, result, items_1, items_1_1, item;
1876
1876
  var e_4, _b;
1877
1877
  return __generator(this, function (_c) {
@@ -1903,7 +1903,7 @@
1903
1903
  });
1904
1904
  };
1905
1905
  Assets.prototype.deleteMany = function (where) {
1906
- return __awaiter$u(this, void 0, void 0, function () {
1906
+ return __awaiter$v(this, void 0, void 0, function () {
1907
1907
  var assets;
1908
1908
  return __generator(this, function (_b) {
1909
1909
  switch (_b.label) {
@@ -1916,7 +1916,7 @@
1916
1916
  });
1917
1917
  };
1918
1918
  Assets.prototype.unlink = function (id) {
1919
- return __awaiter$u(this, void 0, void 0, function () {
1919
+ return __awaiter$v(this, void 0, void 0, function () {
1920
1920
  var asset;
1921
1921
  return __generator(this, function (_b) {
1922
1922
  switch (_b.label) {
@@ -1931,7 +1931,7 @@
1931
1931
  });
1932
1932
  };
1933
1933
  Assets.prototype.upload = function (stream, fileType, metadata) {
1934
- return __awaiter$u(this, void 0, void 0, function () {
1934
+ return __awaiter$v(this, void 0, void 0, function () {
1935
1935
  var contentType;
1936
1936
  var _this = this;
1937
1937
  return __generator(this, function (_b) {
@@ -1973,7 +1973,7 @@
1973
1973
  __metadata$t("design:paramtypes", [exports.MongoConnector, exports.AssetProcessor])
1974
1974
  ], exports.Assets);
1975
1975
 
1976
- var __awaiter$t = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
1976
+ var __awaiter$u = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
1977
1977
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
1978
1978
  return new (P || (P = Promise))(function (resolve, reject) {
1979
1979
  function fulfilled(value) { try {
@@ -2037,7 +2037,7 @@
2037
2037
  configurable: true
2038
2038
  });
2039
2039
  LazyAsset.prototype.unlink = function () {
2040
- return __awaiter$t(this, void 0, void 0, function () {
2040
+ return __awaiter$u(this, void 0, void 0, function () {
2041
2041
  return __generator(this, function (_a) {
2042
2042
  switch (_a.label) {
2043
2043
  case 0: return [4 /*yield*/, this.load()];
@@ -2069,7 +2069,7 @@
2069
2069
  });
2070
2070
  };
2071
2071
  LazyAsset.prototype.loadAsset = function () {
2072
- return __awaiter$t(this, void 0, void 0, function () {
2072
+ return __awaiter$u(this, void 0, void 0, function () {
2073
2073
  return __generator(this, function (_a) {
2074
2074
  switch (_a.label) {
2075
2075
  case 0: return [4 /*yield*/, this.load()];
@@ -2094,7 +2094,7 @@
2094
2094
  });
2095
2095
  };
2096
2096
  LazyAsset.prototype.writeAsset = function (asset) {
2097
- return __awaiter$t(this, void 0, void 0, function () {
2097
+ return __awaiter$u(this, void 0, void 0, function () {
2098
2098
  return __generator(this, function (_a) {
2099
2099
  switch (_a.label) {
2100
2100
  case 0:
@@ -2108,7 +2108,7 @@
2108
2108
  });
2109
2109
  };
2110
2110
  LazyAsset.prototype.startWorkingOnAsset = function (fromLoad) {
2111
- return __awaiter$t(this, void 0, void 0, function () {
2111
+ return __awaiter$u(this, void 0, void 0, function () {
2112
2112
  var _a;
2113
2113
  return __generator(this, function (_b) {
2114
2114
  switch (_b.label) {
@@ -2185,7 +2185,7 @@
2185
2185
  var __param$8 = (this && this.__param) || function (paramIndex, decorator) {
2186
2186
  return function (target, key) { decorator(target, key, paramIndex); };
2187
2187
  };
2188
- var __awaiter$s = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2188
+ var __awaiter$t = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2189
2189
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
2190
2190
  return new (P || (P = Promise))(function (resolve, reject) {
2191
2191
  function fulfilled(value) { try {
@@ -2237,7 +2237,7 @@
2237
2237
  };
2238
2238
  JobManager.prototype.process = function (jobType, params) {
2239
2239
  if (params === void 0) { params = {}; }
2240
- return __awaiter$s(this, void 0, void 0, function () {
2240
+ return __awaiter$t(this, void 0, void 0, function () {
2241
2241
  var instance, jobName;
2242
2242
  return __generator(this, function (_a) {
2243
2243
  instance = null;
@@ -2254,7 +2254,7 @@
2254
2254
  };
2255
2255
  JobManager.prototype.enqueueWithName = function (name, params) {
2256
2256
  if (params === void 0) { params = {}; }
2257
- return __awaiter$s(this, void 0, void 0, function () {
2257
+ return __awaiter$t(this, void 0, void 0, function () {
2258
2258
  return __generator(this, function (_a) {
2259
2259
  return [2 /*return*/, this.sendToWorkers(this.tryResolveFromName(name, params), params)];
2260
2260
  });
@@ -2262,7 +2262,7 @@
2262
2262
  };
2263
2263
  JobManager.prototype.enqueue = function (jobType, params) {
2264
2264
  if (params === void 0) { params = {}; }
2265
- return __awaiter$s(this, void 0, void 0, function () {
2265
+ return __awaiter$t(this, void 0, void 0, function () {
2266
2266
  return __generator(this, function (_a) {
2267
2267
  return [2 /*return*/, this.sendToWorkers(this.tryResolveAndInit(jobType, params), params)];
2268
2268
  });
@@ -2293,7 +2293,7 @@
2293
2293
  });
2294
2294
  };
2295
2295
  JobManager.prototype.startProcessing = function () {
2296
- return __awaiter$s(this, void 0, void 0, function () {
2296
+ return __awaiter$t(this, void 0, void 0, function () {
2297
2297
  var host, pushHost, pullHost;
2298
2298
  var _this = this;
2299
2299
  return __generator(this, function (_a) {
@@ -2319,7 +2319,7 @@
2319
2319
  case 2:
2320
2320
  _a.sent();
2321
2321
  this.logger.log("job-manager", "Worker consumer connected to: " + pullHost);
2322
- this.workerPull.on("message", function (name, args, uniqId) { return __awaiter$s(_this, void 0, void 0, function () {
2322
+ this.workerPull.on("message", function (name, args, uniqId) { return __awaiter$t(_this, void 0, void 0, function () {
2323
2323
  var jobName, jobParams, uniqueId, e_1, e_2;
2324
2324
  return __generator(this, function (_a) {
2325
2325
  switch (_a.label) {
@@ -2417,7 +2417,7 @@
2417
2417
  return container.resolve(jobType);
2418
2418
  };
2419
2419
  JobManager.prototype.sendToWorkers = function (jobName, params) {
2420
- return __awaiter$s(this, void 0, void 0, function () {
2420
+ return __awaiter$t(this, void 0, void 0, function () {
2421
2421
  var publisher, uniqueId;
2422
2422
  return __generator(this, function (_a) {
2423
2423
  switch (_a.label) {
@@ -2444,7 +2444,7 @@
2444
2444
  exports["ɵa"], Object, Array])
2445
2445
  ], exports.JobManager);
2446
2446
 
2447
- var __awaiter$r = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2447
+ var __awaiter$s = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2448
2448
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
2449
2449
  return new (P || (P = Promise))(function (resolve, reject) {
2450
2450
  function fulfilled(value) { try {
@@ -2522,7 +2522,7 @@
2522
2522
  return this;
2523
2523
  };
2524
2524
  Progress.prototype.createSubProgress = function (progressValue, max, message) {
2525
- return __awaiter$r(this, void 0, void 0, function () {
2525
+ return __awaiter$s(this, void 0, void 0, function () {
2526
2526
  return __generator(this, function (_a) {
2527
2527
  switch (_a.label) {
2528
2528
  case 0:
@@ -2544,7 +2544,7 @@
2544
2544
  });
2545
2545
  };
2546
2546
  Progress.prototype.setMax = function (max) {
2547
- return __awaiter$r(this, void 0, void 0, function () {
2547
+ return __awaiter$s(this, void 0, void 0, function () {
2548
2548
  return __generator(this, function (_a) {
2549
2549
  switch (_a.label) {
2550
2550
  case 0:
@@ -2561,7 +2561,7 @@
2561
2561
  });
2562
2562
  };
2563
2563
  Progress.prototype.setMessage = function (message) {
2564
- return __awaiter$r(this, void 0, void 0, function () {
2564
+ return __awaiter$s(this, void 0, void 0, function () {
2565
2565
  return __generator(this, function (_a) {
2566
2566
  switch (_a.label) {
2567
2567
  case 0:
@@ -2575,7 +2575,7 @@
2575
2575
  });
2576
2576
  };
2577
2577
  Progress.prototype.setError = function (error) {
2578
- return __awaiter$r(this, void 0, void 0, function () {
2578
+ return __awaiter$s(this, void 0, void 0, function () {
2579
2579
  return __generator(this, function (_a) {
2580
2580
  switch (_a.label) {
2581
2581
  case 0:
@@ -2590,7 +2590,7 @@
2590
2590
  };
2591
2591
  Progress.prototype.advance = function (value) {
2592
2592
  if (value === void 0) { value = 1; }
2593
- return __awaiter$r(this, void 0, void 0, function () {
2593
+ return __awaiter$s(this, void 0, void 0, function () {
2594
2594
  return __generator(this, function (_a) {
2595
2595
  switch (_a.label) {
2596
2596
  case 0:
@@ -2612,7 +2612,7 @@
2612
2612
  });
2613
2613
  };
2614
2614
  Progress.prototype.cancel = function () {
2615
- return __awaiter$r(this, void 0, void 0, function () {
2615
+ return __awaiter$s(this, void 0, void 0, function () {
2616
2616
  return __generator(this, function (_a) {
2617
2617
  switch (_a.label) {
2618
2618
  case 0:
@@ -2711,7 +2711,7 @@
2711
2711
  return this;
2712
2712
  };
2713
2713
  SubProgress.prototype.createSubProgress = function (progressValue, max, message) {
2714
- return __awaiter$r(this, void 0, void 0, function () {
2714
+ return __awaiter$s(this, void 0, void 0, function () {
2715
2715
  return __generator(this, function (_a) {
2716
2716
  switch (_a.label) {
2717
2717
  case 0:
@@ -2732,7 +2732,7 @@
2732
2732
  });
2733
2733
  };
2734
2734
  SubProgress.prototype.setMax = function (max) {
2735
- return __awaiter$r(this, void 0, void 0, function () {
2735
+ return __awaiter$s(this, void 0, void 0, function () {
2736
2736
  return __generator(this, function (_a) {
2737
2737
  switch (_a.label) {
2738
2738
  case 0:
@@ -2749,7 +2749,7 @@
2749
2749
  });
2750
2750
  };
2751
2751
  SubProgress.prototype.setMessage = function (message) {
2752
- return __awaiter$r(this, void 0, void 0, function () {
2752
+ return __awaiter$s(this, void 0, void 0, function () {
2753
2753
  return __generator(this, function (_a) {
2754
2754
  switch (_a.label) {
2755
2755
  case 0:
@@ -2764,7 +2764,7 @@
2764
2764
  });
2765
2765
  };
2766
2766
  SubProgress.prototype.setError = function (error) {
2767
- return __awaiter$r(this, void 0, void 0, function () {
2767
+ return __awaiter$s(this, void 0, void 0, function () {
2768
2768
  return __generator(this, function (_a) {
2769
2769
  switch (_a.label) {
2770
2770
  case 0:
@@ -2780,7 +2780,7 @@
2780
2780
  };
2781
2781
  SubProgress.prototype.advance = function (value) {
2782
2782
  if (value === void 0) { value = 1; }
2783
- return __awaiter$r(this, void 0, void 0, function () {
2783
+ return __awaiter$s(this, void 0, void 0, function () {
2784
2784
  return __generator(this, function (_a) {
2785
2785
  switch (_a.label) {
2786
2786
  case 0:
@@ -2797,7 +2797,7 @@
2797
2797
  });
2798
2798
  };
2799
2799
  SubProgress.prototype.cancel = function () {
2800
- return __awaiter$r(this, void 0, void 0, function () {
2800
+ return __awaiter$s(this, void 0, void 0, function () {
2801
2801
  return __generator(this, function (_a) {
2802
2802
  switch (_a.label) {
2803
2803
  case 0:
@@ -2812,7 +2812,7 @@
2812
2812
  });
2813
2813
  };
2814
2814
  SubProgress.prototype.save = function () {
2815
- return __awaiter$r(this, void 0, void 0, function () {
2815
+ return __awaiter$s(this, void 0, void 0, function () {
2816
2816
  var ratio, newProgress, current;
2817
2817
  return __generator(this, function (_a) {
2818
2818
  switch (_a.label) {
@@ -2831,7 +2831,7 @@
2831
2831
  });
2832
2832
  };
2833
2833
  SubProgress.prototype.load = function () {
2834
- return __awaiter$r(this, void 0, void 0, function () {
2834
+ return __awaiter$s(this, void 0, void 0, function () {
2835
2835
  return __generator(this, function (_a) {
2836
2836
  return [2 /*return*/, null];
2837
2837
  });
@@ -2857,7 +2857,7 @@
2857
2857
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
2858
2858
  return Reflect.metadata(k, v);
2859
2859
  };
2860
- var __awaiter$q = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2860
+ var __awaiter$r = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2861
2861
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
2862
2862
  return new (P || (P = Promise))(function (resolve, reject) {
2863
2863
  function fulfilled(value) { try {
@@ -2889,11 +2889,11 @@
2889
2889
  });
2890
2890
  }
2891
2891
  Progresses.prototype.waitToFinish = function (id) {
2892
- return __awaiter$q(this, void 0, void 0, function () {
2892
+ return __awaiter$r(this, void 0, void 0, function () {
2893
2893
  var _this = this;
2894
2894
  return __generator(this, function (_a) {
2895
2895
  return [2 /*return*/, Promise.race([
2896
- this.waitForProgress(id, function () { return __awaiter$q(_this, void 0, void 0, function () {
2896
+ this.waitForProgress(id, function () { return __awaiter$r(_this, void 0, void 0, function () {
2897
2897
  var progress;
2898
2898
  return __generator(this, function (_a) {
2899
2899
  switch (_a.label) {
@@ -2912,7 +2912,7 @@
2912
2912
  }
2913
2913
  });
2914
2914
  }); }, 500),
2915
- this.waitForProgress(id, function () { return __awaiter$q(_this, void 0, void 0, function () {
2915
+ this.waitForProgress(id, function () { return __awaiter$r(_this, void 0, void 0, function () {
2916
2916
  return __generator(this, function (_a) {
2917
2917
  return [2 /*return*/, this.progresses[id] || null];
2918
2918
  });
@@ -2922,14 +2922,14 @@
2922
2922
  });
2923
2923
  };
2924
2924
  Progresses.prototype.get = function (id) {
2925
- return __awaiter$q(this, void 0, void 0, function () {
2925
+ return __awaiter$r(this, void 0, void 0, function () {
2926
2926
  return __generator(this, function (_a) {
2927
2927
  return [2 /*return*/, !id ? null : this.find({ _id: new bson.ObjectId(id) })];
2928
2928
  });
2929
2929
  });
2930
2930
  };
2931
2931
  Progresses.prototype.find = function (where) {
2932
- return __awaiter$q(this, void 0, void 0, function () {
2932
+ return __awaiter$r(this, void 0, void 0, function () {
2933
2933
  var data;
2934
2934
  return __generator(this, function (_a) {
2935
2935
  switch (_a.label) {
@@ -2943,7 +2943,7 @@
2943
2943
  };
2944
2944
  Progresses.prototype.create = function (max) {
2945
2945
  if (max === void 0) { max = 100; }
2946
- return __awaiter$q(this, void 0, void 0, function () {
2946
+ return __awaiter$r(this, void 0, void 0, function () {
2947
2947
  var data, res;
2948
2948
  return __generator(this, function (_a) {
2949
2949
  switch (_a.label) {
@@ -2967,7 +2967,7 @@
2967
2967
  });
2968
2968
  };
2969
2969
  Progresses.prototype.remove = function (id) {
2970
- return __awaiter$q(this, void 0, void 0, function () {
2970
+ return __awaiter$r(this, void 0, void 0, function () {
2971
2971
  return __generator(this, function (_a) {
2972
2972
  switch (_a.label) {
2973
2973
  case 0: return [4 /*yield*/, this.collection.deleteOne({ _id: new bson.ObjectId(id) })];
@@ -2979,7 +2979,7 @@
2979
2979
  });
2980
2980
  };
2981
2981
  Progresses.prototype.waitForProgress = function (id, cb, delay) {
2982
- return __awaiter$q(this, void 0, void 0, function () {
2982
+ return __awaiter$r(this, void 0, void 0, function () {
2983
2983
  var isFinished, progress, waitTime;
2984
2984
  return __generator(this, function (_a) {
2985
2985
  switch (_a.label) {
@@ -3035,7 +3035,7 @@
3035
3035
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
3036
3036
  return Reflect.metadata(k, v);
3037
3037
  };
3038
- var __awaiter$p = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3038
+ var __awaiter$q = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3039
3039
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3040
3040
  return new (P || (P = Promise))(function (resolve, reject) {
3041
3041
  function fulfilled(value) { try {
@@ -3066,7 +3066,7 @@
3066
3066
  LazyAssets.prototype.create = function (jobType, jobParams, jobQue) {
3067
3067
  if (jobParams === void 0) { jobParams = {}; }
3068
3068
  if (jobQue === void 0) { jobQue = "main"; }
3069
- return __awaiter$p(this, void 0, void 0, function () {
3069
+ return __awaiter$q(this, void 0, void 0, function () {
3070
3070
  var jobName, data, existingAsset, res;
3071
3071
  return __generator(this, function (_a) {
3072
3072
  switch (_a.label) {
@@ -3091,14 +3091,14 @@
3091
3091
  });
3092
3092
  };
3093
3093
  LazyAssets.prototype.read = function (id) {
3094
- return __awaiter$p(this, void 0, void 0, function () {
3094
+ return __awaiter$q(this, void 0, void 0, function () {
3095
3095
  return __generator(this, function (_a) {
3096
3096
  return [2 /*return*/, !id ? null : this.find({ _id: new bson.ObjectId(id) })];
3097
3097
  });
3098
3098
  });
3099
3099
  };
3100
3100
  LazyAssets.prototype.find = function (where) {
3101
- return __awaiter$p(this, void 0, void 0, function () {
3101
+ return __awaiter$q(this, void 0, void 0, function () {
3102
3102
  var data;
3103
3103
  return __generator(this, function (_a) {
3104
3104
  switch (_a.label) {
@@ -3113,7 +3113,7 @@
3113
3113
  });
3114
3114
  };
3115
3115
  LazyAssets.prototype.unlink = function (id) {
3116
- return __awaiter$p(this, void 0, void 0, function () {
3116
+ return __awaiter$q(this, void 0, void 0, function () {
3117
3117
  var asset;
3118
3118
  return __generator(this, function (_a) {
3119
3119
  switch (_a.label) {
@@ -3153,7 +3153,7 @@
3153
3153
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
3154
3154
  return Reflect.metadata(k, v);
3155
3155
  };
3156
- var __awaiter$o = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3156
+ var __awaiter$p = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3157
3157
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3158
3158
  return new (P || (P = Promise))(function (resolve, reject) {
3159
3159
  function fulfilled(value) { try {
@@ -3179,7 +3179,7 @@
3179
3179
  }
3180
3180
  AssetResolver.prototype.resolve = function (id, lazy) {
3181
3181
  if (lazy === void 0) { lazy = false; }
3182
- return __awaiter$o(this, void 0, void 0, function () {
3182
+ return __awaiter$p(this, void 0, void 0, function () {
3183
3183
  var asset, lazyAsset, lazyAsset;
3184
3184
  return __generator(this, function (_a) {
3185
3185
  switch (_a.label) {
@@ -3262,7 +3262,7 @@
3262
3262
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
3263
3263
  return c > 3 && r && Object.defineProperty(target, key, r), r;
3264
3264
  };
3265
- var __awaiter$n = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3265
+ var __awaiter$o = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3266
3266
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3267
3267
  return new (P || (P = Promise))(function (resolve, reject) {
3268
3268
  function fulfilled(value) { try {
@@ -3285,14 +3285,14 @@
3285
3285
  function CacheProcessor() {
3286
3286
  }
3287
3287
  CacheProcessor.prototype.serialize = function (data) {
3288
- return __awaiter$n(this, void 0, void 0, function () {
3288
+ return __awaiter$o(this, void 0, void 0, function () {
3289
3289
  return __generator(this, function (_a) {
3290
3290
  return [2 /*return*/, data];
3291
3291
  });
3292
3292
  });
3293
3293
  };
3294
3294
  CacheProcessor.prototype.deserialize = function (data) {
3295
- return __awaiter$n(this, void 0, void 0, function () {
3295
+ return __awaiter$o(this, void 0, void 0, function () {
3296
3296
  return __generator(this, function (_a) {
3297
3297
  return [2 /*return*/, data];
3298
3298
  });
@@ -3319,7 +3319,7 @@
3319
3319
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
3320
3320
  return Reflect.metadata(k, v);
3321
3321
  };
3322
- var __awaiter$m = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3322
+ var __awaiter$n = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3323
3323
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3324
3324
  return new (P || (P = Promise))(function (resolve, reject) {
3325
3325
  function fulfilled(value) { try {
@@ -3345,7 +3345,7 @@
3345
3345
  this.cacheProcessor = cacheProcessor;
3346
3346
  }
3347
3347
  Cache.prototype.prepare = function () {
3348
- return __awaiter$m(this, void 0, void 0, function () {
3348
+ return __awaiter$n(this, void 0, void 0, function () {
3349
3349
  return __generator(this, function (_a) {
3350
3350
  switch (_a.label) {
3351
3351
  case 0:
@@ -3366,7 +3366,7 @@
3366
3366
  Cache.prototype.set = function (key, value, ttl, expirationTimestamp, tags) {
3367
3367
  if (expirationTimestamp === void 0) { expirationTimestamp = null; }
3368
3368
  if (tags === void 0) { tags = {}; }
3369
- return __awaiter$m(this, void 0, void 0, function () {
3369
+ return __awaiter$n(this, void 0, void 0, function () {
3370
3370
  var item, _a, now;
3371
3371
  return __generator(this, function (_b) {
3372
3372
  switch (_b.label) {
@@ -3397,7 +3397,7 @@
3397
3397
  });
3398
3398
  };
3399
3399
  Cache.prototype.get = function (key) {
3400
- return __awaiter$m(this, void 0, void 0, function () {
3400
+ return __awaiter$n(this, void 0, void 0, function () {
3401
3401
  var item, now;
3402
3402
  return __generator(this, function (_a) {
3403
3403
  switch (_a.label) {
@@ -3423,7 +3423,7 @@
3423
3423
  Cache.prototype.getOrSet = function (key, valueCb, ttl, expirationTimestamp, tags) {
3424
3424
  if (expirationTimestamp === void 0) { expirationTimestamp = null; }
3425
3425
  if (tags === void 0) { tags = {}; }
3426
- return __awaiter$m(this, void 0, void 0, function () {
3426
+ return __awaiter$n(this, void 0, void 0, function () {
3427
3427
  var e_1, _a, _b;
3428
3428
  return __generator(this, function (_c) {
3429
3429
  switch (_c.label) {
@@ -3444,7 +3444,7 @@
3444
3444
  });
3445
3445
  };
3446
3446
  Cache.prototype.delete = function (key) {
3447
- return __awaiter$m(this, void 0, void 0, function () {
3447
+ return __awaiter$n(this, void 0, void 0, function () {
3448
3448
  return __generator(this, function (_a) {
3449
3449
  switch (_a.label) {
3450
3450
  case 0: return [4 /*yield*/, this.prepare()];
@@ -3461,8 +3461,7 @@
3461
3461
  return Cache;
3462
3462
  }());
3463
3463
  exports.Cache = __decorate$r([
3464
- tsyringe.injectable(),
3465
- tsyringe.scoped(tsyringe.Lifecycle.ContainerScoped),
3464
+ tsyringe.singleton(),
3466
3465
  __metadata$m("design:paramtypes", [exports.MongoConnector, exports.Configuration, exports.CacheProcessor])
3467
3466
  ], exports.Cache);
3468
3467
 
@@ -3476,7 +3475,7 @@
3476
3475
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
3477
3476
  return c > 3 && r && Object.defineProperty(target, key, r), r;
3478
3477
  };
3479
- var __awaiter$l = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3478
+ var __awaiter$m = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3480
3479
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3481
3480
  return new (P || (P = Promise))(function (resolve, reject) {
3482
3481
  function fulfilled(value) { try {
@@ -3499,7 +3498,7 @@
3499
3498
  function EndpointProvider() {
3500
3499
  }
3501
3500
  EndpointProvider.prototype.configure = function (app) {
3502
- return __awaiter$l(this, void 0, void 0, function () {
3501
+ return __awaiter$m(this, void 0, void 0, function () {
3503
3502
  return __generator(this, function (_a) {
3504
3503
  console.log("Express app is mounted to: " + app.mountpath);
3505
3504
  return [2 /*return*/];
@@ -3530,7 +3529,7 @@
3530
3529
  var __param$7 = (this && this.__param) || function (paramIndex, decorator) {
3531
3530
  return function (target, key) { decorator(target, key, paramIndex); };
3532
3531
  };
3533
- var __awaiter$k = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3532
+ var __awaiter$l = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3534
3533
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3535
3534
  return new (P || (P = Promise))(function (resolve, reject) {
3536
3535
  function fulfilled(value) { try {
@@ -3554,7 +3553,7 @@
3554
3553
  this.fixtures = fixtures;
3555
3554
  }
3556
3555
  Fixtures.prototype.load = function () {
3557
- return __awaiter$k(this, void 0, void 0, function () {
3556
+ return __awaiter$l(this, void 0, void 0, function () {
3558
3557
  var _a, _b, fixture, e_1_1;
3559
3558
  var e_1, _c;
3560
3559
  return __generator(this, function (_d) {
@@ -3602,7 +3601,7 @@
3602
3601
  __metadata$l("design:paramtypes", [Array])
3603
3602
  ], exports.Fixtures);
3604
3603
 
3605
- var __awaiter$j = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3604
+ var __awaiter$k = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3606
3605
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3607
3606
  return new (P || (P = Promise))(function (resolve, reject) {
3608
3607
  function fulfilled(value) { try {
@@ -3633,7 +3632,7 @@
3633
3632
  this.targetSize = !size ? { width: thumbSize, height: thumbSize } : size;
3634
3633
  }
3635
3634
  GalleryImage.prototype.serve = function (id) {
3636
- return __awaiter$j(this, void 0, void 0, function () {
3635
+ return __awaiter$k(this, void 0, void 0, function () {
3637
3636
  var isThumb, original, _a, meta, ratio, sizeRatio, size, targetHeight, targetWidth, resized, buffer;
3638
3637
  return __generator(this, function (_b) {
3639
3638
  switch (_b.label) {
@@ -3729,7 +3728,7 @@
3729
3728
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
3730
3729
  return Reflect.metadata(k, v);
3731
3730
  };
3732
- var __awaiter$i = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3731
+ var __awaiter$j = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3733
3732
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3734
3733
  return new (P || (P = Promise))(function (resolve, reject) {
3735
3734
  function fulfilled(value) { try {
@@ -3759,7 +3758,7 @@
3759
3758
  }
3760
3759
  Gallery.prototype.getFolder = function (folder, size) {
3761
3760
  if (size === void 0) { size = null; }
3762
- return __awaiter$i(this, void 0, void 0, function () {
3761
+ return __awaiter$j(this, void 0, void 0, function () {
3763
3762
  var _this = this;
3764
3763
  return __generator(this, function (_a) {
3765
3764
  this.cache[folder] = this.cache[folder] || new Promise(function (resolve) {
@@ -3784,7 +3783,7 @@
3784
3783
  return;
3785
3784
  }
3786
3785
  var promises = files.map(function (file) {
3787
- return new Promise(function (resolve) { return __awaiter$i(_this, void 0, void 0, function () {
3786
+ return new Promise(function (resolve) { return __awaiter$j(_this, void 0, void 0, function () {
3788
3787
  var filePath, absoluteFilePath;
3789
3788
  var _this = this;
3790
3789
  return __generator(this, function (_a) {
@@ -3820,7 +3819,7 @@
3820
3819
  });
3821
3820
  },
3822
3821
  writeResult: function (isThumb, buffer) {
3823
- return new Promise(function (res, rej) { return __awaiter$i(_this, void 0, void 0, function () {
3822
+ return new Promise(function (res, rej) { return __awaiter$j(_this, void 0, void 0, function () {
3824
3823
  var resultPath;
3825
3824
  return __generator(this, function (_a) {
3826
3825
  switch (_a.label) {
@@ -3894,7 +3893,7 @@
3894
3893
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
3895
3894
  return Reflect.metadata(k, v);
3896
3895
  };
3897
- var __awaiter$h = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3896
+ var __awaiter$i = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3898
3897
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3899
3898
  return new (P || (P = Promise))(function (resolve, reject) {
3900
3899
  function fulfilled(value) { try {
@@ -3922,7 +3921,7 @@
3922
3921
  this.parts = config.resolve("idParts");
3923
3922
  }
3924
3923
  IdGenerator.prototype.generate = function (checkCb) {
3925
- return __awaiter$h(this, void 0, void 0, function () {
3924
+ return __awaiter$i(this, void 0, void 0, function () {
3926
3925
  var id, tries, notGood;
3927
3926
  return __generator(this, function (_a) {
3928
3927
  switch (_a.label) {
@@ -3981,22 +3980,63 @@
3981
3980
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
3982
3981
  return Reflect.metadata(k, v);
3983
3982
  };
3983
+ var __awaiter$h = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3984
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3985
+ return new (P || (P = Promise))(function (resolve, reject) {
3986
+ function fulfilled(value) { try {
3987
+ step(generator.next(value));
3988
+ }
3989
+ catch (e) {
3990
+ reject(e);
3991
+ } }
3992
+ function rejected(value) { try {
3993
+ step(generator["throw"](value));
3994
+ }
3995
+ catch (e) {
3996
+ reject(e);
3997
+ } }
3998
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
3999
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
4000
+ });
4001
+ };
3984
4002
  exports.TranslationProvider = /** @class */ (function () {
3985
- function TranslationProvider(config) {
4003
+ function TranslationProvider(config, cache) {
3986
4004
  this.config = config;
3987
- this.cache = {};
4005
+ this.cache = cache;
3988
4006
  }
3989
4007
  TranslationProvider.prototype.getDictionary = function (language) {
3990
- this.cache[language] = this.cache[language] || axios__default["default"].get(this.config.resolve("translationsTemplate").replace("[lang]", language)).then(function (r) { return r.data; }, function (reason) { return ({
3991
- message: reason
3992
- }); });
3993
- return this.cache[language];
4008
+ var _this = this;
4009
+ return this.cache.getOrSet("translations-" + language, function () { return __awaiter$h(_this, void 0, void 0, function () {
4010
+ var url, data, e_1;
4011
+ return __generator(this, function (_a) {
4012
+ switch (_a.label) {
4013
+ case 0:
4014
+ _a.trys.push([0, 2, , 3]);
4015
+ url = this.config.resolve("translationsTemplate")
4016
+ .replace("__lang__", language)
4017
+ .replace("[lang]", language);
4018
+ return [4 /*yield*/, axios__default["default"].get(url).then(function (t) { return t.data; })];
4019
+ case 1:
4020
+ data = _a.sent();
4021
+ if (isObject(data[language])) {
4022
+ return [2 /*return*/, data[language]];
4023
+ }
4024
+ return [2 /*return*/, data];
4025
+ case 2:
4026
+ e_1 = _a.sent();
4027
+ return [2 /*return*/, {
4028
+ message: "" + e_1
4029
+ }];
4030
+ case 3: return [2 /*return*/];
4031
+ }
4032
+ });
4033
+ }); }, 5 * 60);
3994
4034
  };
3995
4035
  return TranslationProvider;
3996
4036
  }());
3997
4037
  exports.TranslationProvider = __decorate$l([
3998
4038
  tsyringe.singleton(),
3999
- __metadata$h("design:paramtypes", [exports.Configuration])
4039
+ __metadata$h("design:paramtypes", [exports.Configuration, exports.Cache])
4000
4040
  ], exports.TranslationProvider);
4001
4041
 
4002
4042
  var __decorate$k = (this && this.__decorate) || function (decorators, target, key, desc) {
@@ -4035,18 +4075,20 @@
4035
4075
  exports.Translator = /** @class */ (function () {
4036
4076
  function Translator(translationProvider) {
4037
4077
  this.translationProvider = translationProvider;
4038
- this.cache = {};
4078
+ this.dictionaries = {};
4039
4079
  }
4040
4080
  Translator.prototype.getDictionary = function (language) {
4041
4081
  return __awaiter$g(this, void 0, void 0, function () {
4042
- var dictionary;
4043
- return __generator(this, function (_a) {
4044
- switch (_a.label) {
4045
- case 0: return [4 /*yield*/, this.translationProvider.getDictionary(language)];
4082
+ var _a, _b;
4083
+ return __generator(this, function (_c) {
4084
+ switch (_c.label) {
4085
+ case 0:
4086
+ _a = this.dictionaries;
4087
+ _b = language;
4088
+ return [4 /*yield*/, this.translationProvider.getDictionary(language)];
4046
4089
  case 1:
4047
- dictionary = _a.sent();
4048
- this.cache[language] = dictionary;
4049
- return [2 /*return*/, dictionary];
4090
+ _a[_b] = _c.sent();
4091
+ return [2 /*return*/, this.dictionaries[language]];
4050
4092
  }
4051
4093
  });
4052
4094
  });
@@ -4055,7 +4097,7 @@
4055
4097
  if (!isString(key) || !key.length) {
4056
4098
  throw new Error("Parameter \"key\" required");
4057
4099
  }
4058
- var dictionary = this.cache[language];
4100
+ var dictionary = this.dictionaries[language];
4059
4101
  var translation = getValue(dictionary, key, key) || key;
4060
4102
  return this.interpolate(translation, params);
4061
4103
  };