@stemy/backend 3.5.2 → 3.5.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.
@@ -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$z(thisArg, _arguments, P, generator) {
107
+ function __awaiter$A(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$y = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
394
+ var __awaiter$z = (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$y(this, void 0, void 0, function () {
442
+ return __awaiter$z(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$y(this, void 0, void 0, function () {
476
+ return __awaiter$z(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$y(this, void 0, void 0, function () {
523
+ return __awaiter$z(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$x = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
548
+ var __awaiter$y = (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$x(this, void 0, void 0, function () {
748
+ return __awaiter$y(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$x(this, void 0, void 0, function () {
909
+ return __awaiter$y(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$x(this, void 0, void 0, function () {
926
+ return __awaiter$y(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))];
@@ -1265,6 +1265,11 @@
1265
1265
  function replaceSpecialChars(str, to) {
1266
1266
  if (to === void 0) { to = "-"; }
1267
1267
  return ("" + str).replace(/[&\/\\#, +()$~%.@'":*?<>{}]/g, to);
1268
+ }
1269
+ function flatten(arr) {
1270
+ return arr.reduce(function (flat, toFlatten) {
1271
+ return flat.concat(isArray(toFlatten) ? flatten(toFlatten) : toFlatten);
1272
+ }, []);
1268
1273
  }
1269
1274
 
1270
1275
  var __decorate$A = (this && this.__decorate) || function (decorators, target, key, desc) {
@@ -1346,7 +1351,7 @@
1346
1351
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
1347
1352
  return Reflect.metadata(k, v);
1348
1353
  };
1349
- var __awaiter$w = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
1354
+ var __awaiter$x = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
1350
1355
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
1351
1356
  return new (P || (P = Promise))(function (resolve, reject) {
1352
1357
  function fulfilled(value) { try {
@@ -1394,7 +1399,7 @@
1394
1399
  configurable: true
1395
1400
  });
1396
1401
  MongoConnector.prototype.connect = function () {
1397
- return __awaiter$w(this, void 0, void 0, function () {
1402
+ return __awaiter$x(this, void 0, void 0, function () {
1398
1403
  var _a;
1399
1404
  return __generator(this, function (_b) {
1400
1405
  switch (_b.label) {
@@ -1424,7 +1429,7 @@
1424
1429
  __metadata$t("design:paramtypes", [exports.Configuration])
1425
1430
  ], exports.MongoConnector);
1426
1431
 
1427
- var __awaiter$v = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
1432
+ var __awaiter$w = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
1428
1433
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
1429
1434
  return new (P || (P = Promise))(function (resolve, reject) {
1430
1435
  function fulfilled(value) { try {
@@ -1460,7 +1465,7 @@
1460
1465
  return this.collection.updateOne({ _id: this.mId }, { $set: this.toJSON() });
1461
1466
  };
1462
1467
  BaseEntity.prototype.load = function () {
1463
- return __awaiter$v(this, void 0, void 0, function () {
1468
+ return __awaiter$w(this, void 0, void 0, function () {
1464
1469
  var res;
1465
1470
  return __generator(this, function (_a) {
1466
1471
  switch (_a.label) {
@@ -1483,7 +1488,7 @@
1483
1488
  return BaseEntity;
1484
1489
  }());
1485
1490
 
1486
- var __awaiter$u = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
1491
+ var __awaiter$v = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
1487
1492
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
1488
1493
  return new (P || (P = Promise))(function (resolve, reject) {
1489
1494
  function fulfilled(value) { try {
@@ -1538,7 +1543,7 @@
1538
1543
  configurable: true
1539
1544
  });
1540
1545
  Asset.prototype.unlink = function () {
1541
- return __awaiter$u(this, void 0, void 0, function () {
1546
+ return __awaiter$v(this, void 0, void 0, function () {
1542
1547
  return __generator(this, function (_a) {
1543
1548
  return [2 /*return*/, deleteFromBucket(this.bucket, this.mId)];
1544
1549
  });
@@ -1548,7 +1553,7 @@
1548
1553
  return streamToBuffer(this.stream);
1549
1554
  };
1550
1555
  Asset.prototype.download = function (metadata) {
1551
- return __awaiter$u(this, void 0, void 0, function () {
1556
+ return __awaiter$v(this, void 0, void 0, function () {
1552
1557
  return __generator(this, function (_a) {
1553
1558
  switch (_a.label) {
1554
1559
  case 0:
@@ -1568,14 +1573,14 @@
1568
1573
  };
1569
1574
  Asset.prototype.getImage = function (params) {
1570
1575
  if (params === void 0) { params = null; }
1571
- return __awaiter$u(this, void 0, void 0, function () {
1576
+ return __awaiter$v(this, void 0, void 0, function () {
1572
1577
  return __generator(this, function (_a) {
1573
1578
  return [2 /*return*/, toImage(this.stream, params, this.metadata)];
1574
1579
  });
1575
1580
  });
1576
1581
  };
1577
1582
  Asset.prototype.downloadImage = function (params, metadata) {
1578
- return __awaiter$u(this, void 0, void 0, function () {
1583
+ return __awaiter$v(this, void 0, void 0, function () {
1579
1584
  var _a;
1580
1585
  return __generator(this, function (_b) {
1581
1586
  switch (_b.label) {
@@ -1590,7 +1595,7 @@
1590
1595
  return Asset;
1591
1596
  }(BaseEntity));
1592
1597
 
1593
- var __awaiter$t = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
1598
+ var __awaiter$u = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
1594
1599
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
1595
1600
  return new (P || (P = Promise))(function (resolve, reject) {
1596
1601
  function fulfilled(value) { try {
@@ -1625,21 +1630,21 @@
1625
1630
  configurable: true
1626
1631
  });
1627
1632
  TempAsset.prototype.unlink = function () {
1628
- return __awaiter$t(this, void 0, void 0, function () {
1633
+ return __awaiter$u(this, void 0, void 0, function () {
1629
1634
  return __generator(this, function (_a) {
1630
1635
  throw new Error("Temp asset '" + this.id + "' can not be removed!");
1631
1636
  });
1632
1637
  });
1633
1638
  };
1634
1639
  TempAsset.prototype.getBuffer = function () {
1635
- return __awaiter$t(this, void 0, void 0, function () {
1640
+ return __awaiter$u(this, void 0, void 0, function () {
1636
1641
  return __generator(this, function (_a) {
1637
1642
  return [2 /*return*/, this.buffer];
1638
1643
  });
1639
1644
  });
1640
1645
  };
1641
1646
  TempAsset.prototype.download = function (metadata) {
1642
- return __awaiter$t(this, void 0, void 0, function () {
1647
+ return __awaiter$u(this, void 0, void 0, function () {
1643
1648
  return __generator(this, function (_a) {
1644
1649
  return [2 /*return*/, this.stream];
1645
1650
  });
@@ -1653,14 +1658,14 @@
1653
1658
  return this.downloadImage(params);
1654
1659
  };
1655
1660
  TempAsset.prototype.save = function () {
1656
- return __awaiter$t(this, void 0, void 0, function () {
1661
+ return __awaiter$u(this, void 0, void 0, function () {
1657
1662
  return __generator(this, function (_a) {
1658
1663
  return [2 /*return*/, this];
1659
1664
  });
1660
1665
  });
1661
1666
  };
1662
1667
  TempAsset.prototype.load = function () {
1663
- return __awaiter$t(this, void 0, void 0, function () {
1668
+ return __awaiter$u(this, void 0, void 0, function () {
1664
1669
  return __generator(this, function (_a) {
1665
1670
  return [2 /*return*/, this];
1666
1671
  });
@@ -1691,7 +1696,7 @@
1691
1696
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
1692
1697
  return Reflect.metadata(k, v);
1693
1698
  };
1694
- var __awaiter$s = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
1699
+ var __awaiter$t = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
1695
1700
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
1696
1701
  return new (P || (P = Promise))(function (resolve, reject) {
1697
1702
  function fulfilled(value) { try {
@@ -1721,7 +1726,7 @@
1721
1726
  Assets.prototype.write = function (stream, contentType, metadata) {
1722
1727
  if (contentType === void 0) { contentType = null; }
1723
1728
  if (metadata === void 0) { metadata = null; }
1724
- return __awaiter$s(this, void 0, void 0, function () {
1729
+ return __awaiter$t(this, void 0, void 0, function () {
1725
1730
  var uploadStream, buffer, fileType, e_1;
1726
1731
  return __generator(this, function (_b) {
1727
1732
  switch (_b.label) {
@@ -1755,7 +1760,7 @@
1755
1760
  Assets.prototype.writeBuffer = function (buffer, metadata, contentType) {
1756
1761
  if (metadata === void 0) { metadata = null; }
1757
1762
  if (contentType === void 0) { contentType = null; }
1758
- return __awaiter$s(this, void 0, void 0, function () {
1763
+ return __awaiter$t(this, void 0, void 0, function () {
1759
1764
  var fileType, e_2;
1760
1765
  return __generator(this, function (_b) {
1761
1766
  switch (_b.label) {
@@ -1787,7 +1792,7 @@
1787
1792
  };
1788
1793
  Assets.prototype.writeUrl = function (url, metadata) {
1789
1794
  if (metadata === void 0) { metadata = null; }
1790
- return __awaiter$s(this, void 0, void 0, function () {
1795
+ return __awaiter$t(this, void 0, void 0, function () {
1791
1796
  var oneWeek, asset, buffer;
1792
1797
  return __generator(this, function (_b) {
1793
1798
  switch (_b.label) {
@@ -1811,7 +1816,7 @@
1811
1816
  };
1812
1817
  Assets.prototype.download = function (url, contentType) {
1813
1818
  if (contentType === void 0) { contentType = null; }
1814
- return __awaiter$s(this, void 0, void 0, function () {
1819
+ return __awaiter$t(this, void 0, void 0, function () {
1815
1820
  var buffer, fileType, e_3, metadata;
1816
1821
  return __generator(this, function (_b) {
1817
1822
  switch (_b.label) {
@@ -1847,14 +1852,14 @@
1847
1852
  });
1848
1853
  };
1849
1854
  Assets.prototype.read = function (id) {
1850
- return __awaiter$s(this, void 0, void 0, function () {
1855
+ return __awaiter$t(this, void 0, void 0, function () {
1851
1856
  return __generator(this, function (_b) {
1852
1857
  return [2 /*return*/, !id ? null : this.find({ _id: new bson.ObjectId(id) })];
1853
1858
  });
1854
1859
  });
1855
1860
  };
1856
1861
  Assets.prototype.find = function (where) {
1857
- return __awaiter$s(this, void 0, void 0, function () {
1862
+ return __awaiter$t(this, void 0, void 0, function () {
1858
1863
  var data;
1859
1864
  return __generator(this, function (_b) {
1860
1865
  switch (_b.label) {
@@ -1867,7 +1872,7 @@
1867
1872
  });
1868
1873
  };
1869
1874
  Assets.prototype.findMany = function (where) {
1870
- return __awaiter$s(this, void 0, void 0, function () {
1875
+ return __awaiter$t(this, void 0, void 0, function () {
1871
1876
  var cursor, items, result, items_1, items_1_1, item;
1872
1877
  var e_4, _b;
1873
1878
  return __generator(this, function (_c) {
@@ -1899,7 +1904,7 @@
1899
1904
  });
1900
1905
  };
1901
1906
  Assets.prototype.deleteMany = function (where) {
1902
- return __awaiter$s(this, void 0, void 0, function () {
1907
+ return __awaiter$t(this, void 0, void 0, function () {
1903
1908
  var assets;
1904
1909
  return __generator(this, function (_b) {
1905
1910
  switch (_b.label) {
@@ -1912,7 +1917,7 @@
1912
1917
  });
1913
1918
  };
1914
1919
  Assets.prototype.unlink = function (id) {
1915
- return __awaiter$s(this, void 0, void 0, function () {
1920
+ return __awaiter$t(this, void 0, void 0, function () {
1916
1921
  var asset;
1917
1922
  return __generator(this, function (_b) {
1918
1923
  switch (_b.label) {
@@ -1927,7 +1932,7 @@
1927
1932
  });
1928
1933
  };
1929
1934
  Assets.prototype.upload = function (stream, fileType, metadata) {
1930
- return __awaiter$s(this, void 0, void 0, function () {
1935
+ return __awaiter$t(this, void 0, void 0, function () {
1931
1936
  var contentType;
1932
1937
  var _this = this;
1933
1938
  return __generator(this, function (_b) {
@@ -1969,7 +1974,7 @@
1969
1974
  __metadata$s("design:paramtypes", [exports.MongoConnector, exports.AssetProcessor])
1970
1975
  ], exports.Assets);
1971
1976
 
1972
- var __awaiter$r = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
1977
+ var __awaiter$s = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
1973
1978
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
1974
1979
  return new (P || (P = Promise))(function (resolve, reject) {
1975
1980
  function fulfilled(value) { try {
@@ -2033,7 +2038,7 @@
2033
2038
  configurable: true
2034
2039
  });
2035
2040
  LazyAsset.prototype.unlink = function () {
2036
- return __awaiter$r(this, void 0, void 0, function () {
2041
+ return __awaiter$s(this, void 0, void 0, function () {
2037
2042
  return __generator(this, function (_a) {
2038
2043
  switch (_a.label) {
2039
2044
  case 0: return [4 /*yield*/, this.load()];
@@ -2065,7 +2070,7 @@
2065
2070
  });
2066
2071
  };
2067
2072
  LazyAsset.prototype.loadAsset = function () {
2068
- return __awaiter$r(this, void 0, void 0, function () {
2073
+ return __awaiter$s(this, void 0, void 0, function () {
2069
2074
  return __generator(this, function (_a) {
2070
2075
  switch (_a.label) {
2071
2076
  case 0: return [4 /*yield*/, this.load()];
@@ -2090,7 +2095,7 @@
2090
2095
  });
2091
2096
  };
2092
2097
  LazyAsset.prototype.writeAsset = function (asset) {
2093
- return __awaiter$r(this, void 0, void 0, function () {
2098
+ return __awaiter$s(this, void 0, void 0, function () {
2094
2099
  return __generator(this, function (_a) {
2095
2100
  switch (_a.label) {
2096
2101
  case 0:
@@ -2104,7 +2109,7 @@
2104
2109
  });
2105
2110
  };
2106
2111
  LazyAsset.prototype.startWorkingOnAsset = function (fromLoad) {
2107
- return __awaiter$r(this, void 0, void 0, function () {
2112
+ return __awaiter$s(this, void 0, void 0, function () {
2108
2113
  var _a;
2109
2114
  return __generator(this, function (_b) {
2110
2115
  switch (_b.label) {
@@ -2181,7 +2186,7 @@
2181
2186
  var __param$8 = (this && this.__param) || function (paramIndex, decorator) {
2182
2187
  return function (target, key) { decorator(target, key, paramIndex); };
2183
2188
  };
2184
- var __awaiter$q = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2189
+ var __awaiter$r = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2185
2190
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
2186
2191
  return new (P || (P = Promise))(function (resolve, reject) {
2187
2192
  function fulfilled(value) { try {
@@ -2233,7 +2238,7 @@
2233
2238
  };
2234
2239
  JobManager.prototype.process = function (jobType, params) {
2235
2240
  if (params === void 0) { params = {}; }
2236
- return __awaiter$q(this, void 0, void 0, function () {
2241
+ return __awaiter$r(this, void 0, void 0, function () {
2237
2242
  var instance, jobName;
2238
2243
  return __generator(this, function (_a) {
2239
2244
  instance = null;
@@ -2250,7 +2255,7 @@
2250
2255
  };
2251
2256
  JobManager.prototype.enqueueWithName = function (name, params) {
2252
2257
  if (params === void 0) { params = {}; }
2253
- return __awaiter$q(this, void 0, void 0, function () {
2258
+ return __awaiter$r(this, void 0, void 0, function () {
2254
2259
  return __generator(this, function (_a) {
2255
2260
  return [2 /*return*/, this.sendToWorkers(this.tryResolveFromName(name, params), params)];
2256
2261
  });
@@ -2258,7 +2263,7 @@
2258
2263
  };
2259
2264
  JobManager.prototype.enqueue = function (jobType, params) {
2260
2265
  if (params === void 0) { params = {}; }
2261
- return __awaiter$q(this, void 0, void 0, function () {
2266
+ return __awaiter$r(this, void 0, void 0, function () {
2262
2267
  return __generator(this, function (_a) {
2263
2268
  return [2 /*return*/, this.sendToWorkers(this.tryResolveAndInit(jobType, params), params)];
2264
2269
  });
@@ -2289,7 +2294,7 @@
2289
2294
  });
2290
2295
  };
2291
2296
  JobManager.prototype.startProcessing = function () {
2292
- return __awaiter$q(this, void 0, void 0, function () {
2297
+ return __awaiter$r(this, void 0, void 0, function () {
2293
2298
  var host, pushHost, pullHost;
2294
2299
  var _this = this;
2295
2300
  return __generator(this, function (_a) {
@@ -2315,7 +2320,7 @@
2315
2320
  case 2:
2316
2321
  _a.sent();
2317
2322
  this.logger.log("job-manager", "Worker consumer connected to: " + pullHost);
2318
- this.workerPull.on("message", function (name, args, uniqId) { return __awaiter$q(_this, void 0, void 0, function () {
2323
+ this.workerPull.on("message", function (name, args, uniqId) { return __awaiter$r(_this, void 0, void 0, function () {
2319
2324
  var jobName, jobParams, uniqueId, e_1, e_2;
2320
2325
  return __generator(this, function (_a) {
2321
2326
  switch (_a.label) {
@@ -2413,7 +2418,7 @@
2413
2418
  return container.resolve(jobType);
2414
2419
  };
2415
2420
  JobManager.prototype.sendToWorkers = function (jobName, params) {
2416
- return __awaiter$q(this, void 0, void 0, function () {
2421
+ return __awaiter$r(this, void 0, void 0, function () {
2417
2422
  var publisher, uniqueId;
2418
2423
  return __generator(this, function (_a) {
2419
2424
  switch (_a.label) {
@@ -2440,7 +2445,7 @@
2440
2445
  exports["ɵa"], Object, Array])
2441
2446
  ], exports.JobManager);
2442
2447
 
2443
- var __awaiter$p = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2448
+ var __awaiter$q = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2444
2449
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
2445
2450
  return new (P || (P = Promise))(function (resolve, reject) {
2446
2451
  function fulfilled(value) { try {
@@ -2518,7 +2523,7 @@
2518
2523
  return this;
2519
2524
  };
2520
2525
  Progress.prototype.createSubProgress = function (progressValue, max, message) {
2521
- return __awaiter$p(this, void 0, void 0, function () {
2526
+ return __awaiter$q(this, void 0, void 0, function () {
2522
2527
  return __generator(this, function (_a) {
2523
2528
  switch (_a.label) {
2524
2529
  case 0:
@@ -2540,7 +2545,7 @@
2540
2545
  });
2541
2546
  };
2542
2547
  Progress.prototype.setMax = function (max) {
2543
- return __awaiter$p(this, void 0, void 0, function () {
2548
+ return __awaiter$q(this, void 0, void 0, function () {
2544
2549
  return __generator(this, function (_a) {
2545
2550
  switch (_a.label) {
2546
2551
  case 0:
@@ -2557,7 +2562,7 @@
2557
2562
  });
2558
2563
  };
2559
2564
  Progress.prototype.setMessage = function (message) {
2560
- return __awaiter$p(this, void 0, void 0, function () {
2565
+ return __awaiter$q(this, void 0, void 0, function () {
2561
2566
  return __generator(this, function (_a) {
2562
2567
  switch (_a.label) {
2563
2568
  case 0:
@@ -2571,7 +2576,7 @@
2571
2576
  });
2572
2577
  };
2573
2578
  Progress.prototype.setError = function (error) {
2574
- return __awaiter$p(this, void 0, void 0, function () {
2579
+ return __awaiter$q(this, void 0, void 0, function () {
2575
2580
  return __generator(this, function (_a) {
2576
2581
  switch (_a.label) {
2577
2582
  case 0:
@@ -2586,7 +2591,7 @@
2586
2591
  };
2587
2592
  Progress.prototype.advance = function (value) {
2588
2593
  if (value === void 0) { value = 1; }
2589
- return __awaiter$p(this, void 0, void 0, function () {
2594
+ return __awaiter$q(this, void 0, void 0, function () {
2590
2595
  return __generator(this, function (_a) {
2591
2596
  switch (_a.label) {
2592
2597
  case 0:
@@ -2608,7 +2613,7 @@
2608
2613
  });
2609
2614
  };
2610
2615
  Progress.prototype.cancel = function () {
2611
- return __awaiter$p(this, void 0, void 0, function () {
2616
+ return __awaiter$q(this, void 0, void 0, function () {
2612
2617
  return __generator(this, function (_a) {
2613
2618
  switch (_a.label) {
2614
2619
  case 0:
@@ -2707,7 +2712,7 @@
2707
2712
  return this;
2708
2713
  };
2709
2714
  SubProgress.prototype.createSubProgress = function (progressValue, max, message) {
2710
- return __awaiter$p(this, void 0, void 0, function () {
2715
+ return __awaiter$q(this, void 0, void 0, function () {
2711
2716
  return __generator(this, function (_a) {
2712
2717
  switch (_a.label) {
2713
2718
  case 0:
@@ -2728,7 +2733,7 @@
2728
2733
  });
2729
2734
  };
2730
2735
  SubProgress.prototype.setMax = function (max) {
2731
- return __awaiter$p(this, void 0, void 0, function () {
2736
+ return __awaiter$q(this, void 0, void 0, function () {
2732
2737
  return __generator(this, function (_a) {
2733
2738
  switch (_a.label) {
2734
2739
  case 0:
@@ -2745,7 +2750,7 @@
2745
2750
  });
2746
2751
  };
2747
2752
  SubProgress.prototype.setMessage = function (message) {
2748
- return __awaiter$p(this, void 0, void 0, function () {
2753
+ return __awaiter$q(this, void 0, void 0, function () {
2749
2754
  return __generator(this, function (_a) {
2750
2755
  switch (_a.label) {
2751
2756
  case 0:
@@ -2760,7 +2765,7 @@
2760
2765
  });
2761
2766
  };
2762
2767
  SubProgress.prototype.setError = function (error) {
2763
- return __awaiter$p(this, void 0, void 0, function () {
2768
+ return __awaiter$q(this, void 0, void 0, function () {
2764
2769
  return __generator(this, function (_a) {
2765
2770
  switch (_a.label) {
2766
2771
  case 0:
@@ -2776,7 +2781,7 @@
2776
2781
  };
2777
2782
  SubProgress.prototype.advance = function (value) {
2778
2783
  if (value === void 0) { value = 1; }
2779
- return __awaiter$p(this, void 0, void 0, function () {
2784
+ return __awaiter$q(this, void 0, void 0, function () {
2780
2785
  return __generator(this, function (_a) {
2781
2786
  switch (_a.label) {
2782
2787
  case 0:
@@ -2793,7 +2798,7 @@
2793
2798
  });
2794
2799
  };
2795
2800
  SubProgress.prototype.cancel = function () {
2796
- return __awaiter$p(this, void 0, void 0, function () {
2801
+ return __awaiter$q(this, void 0, void 0, function () {
2797
2802
  return __generator(this, function (_a) {
2798
2803
  switch (_a.label) {
2799
2804
  case 0:
@@ -2808,7 +2813,7 @@
2808
2813
  });
2809
2814
  };
2810
2815
  SubProgress.prototype.save = function () {
2811
- return __awaiter$p(this, void 0, void 0, function () {
2816
+ return __awaiter$q(this, void 0, void 0, function () {
2812
2817
  var ratio, newProgress, current;
2813
2818
  return __generator(this, function (_a) {
2814
2819
  switch (_a.label) {
@@ -2827,7 +2832,7 @@
2827
2832
  });
2828
2833
  };
2829
2834
  SubProgress.prototype.load = function () {
2830
- return __awaiter$p(this, void 0, void 0, function () {
2835
+ return __awaiter$q(this, void 0, void 0, function () {
2831
2836
  return __generator(this, function (_a) {
2832
2837
  return [2 /*return*/, null];
2833
2838
  });
@@ -2853,7 +2858,7 @@
2853
2858
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
2854
2859
  return Reflect.metadata(k, v);
2855
2860
  };
2856
- var __awaiter$o = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2861
+ var __awaiter$p = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2857
2862
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
2858
2863
  return new (P || (P = Promise))(function (resolve, reject) {
2859
2864
  function fulfilled(value) { try {
@@ -2885,11 +2890,11 @@
2885
2890
  });
2886
2891
  }
2887
2892
  Progresses.prototype.waitToFinish = function (id) {
2888
- return __awaiter$o(this, void 0, void 0, function () {
2893
+ return __awaiter$p(this, void 0, void 0, function () {
2889
2894
  var _this = this;
2890
2895
  return __generator(this, function (_a) {
2891
2896
  return [2 /*return*/, Promise.race([
2892
- this.waitForProgress(id, function () { return __awaiter$o(_this, void 0, void 0, function () {
2897
+ this.waitForProgress(id, function () { return __awaiter$p(_this, void 0, void 0, function () {
2893
2898
  var progress;
2894
2899
  return __generator(this, function (_a) {
2895
2900
  switch (_a.label) {
@@ -2908,7 +2913,7 @@
2908
2913
  }
2909
2914
  });
2910
2915
  }); }, 500),
2911
- this.waitForProgress(id, function () { return __awaiter$o(_this, void 0, void 0, function () {
2916
+ this.waitForProgress(id, function () { return __awaiter$p(_this, void 0, void 0, function () {
2912
2917
  return __generator(this, function (_a) {
2913
2918
  return [2 /*return*/, this.progresses[id] || null];
2914
2919
  });
@@ -2918,14 +2923,14 @@
2918
2923
  });
2919
2924
  };
2920
2925
  Progresses.prototype.get = function (id) {
2921
- return __awaiter$o(this, void 0, void 0, function () {
2926
+ return __awaiter$p(this, void 0, void 0, function () {
2922
2927
  return __generator(this, function (_a) {
2923
2928
  return [2 /*return*/, !id ? null : this.find({ _id: new bson.ObjectId(id) })];
2924
2929
  });
2925
2930
  });
2926
2931
  };
2927
2932
  Progresses.prototype.find = function (where) {
2928
- return __awaiter$o(this, void 0, void 0, function () {
2933
+ return __awaiter$p(this, void 0, void 0, function () {
2929
2934
  var data;
2930
2935
  return __generator(this, function (_a) {
2931
2936
  switch (_a.label) {
@@ -2939,7 +2944,7 @@
2939
2944
  };
2940
2945
  Progresses.prototype.create = function (max) {
2941
2946
  if (max === void 0) { max = 100; }
2942
- return __awaiter$o(this, void 0, void 0, function () {
2947
+ return __awaiter$p(this, void 0, void 0, function () {
2943
2948
  var data, res;
2944
2949
  return __generator(this, function (_a) {
2945
2950
  switch (_a.label) {
@@ -2963,7 +2968,7 @@
2963
2968
  });
2964
2969
  };
2965
2970
  Progresses.prototype.remove = function (id) {
2966
- return __awaiter$o(this, void 0, void 0, function () {
2971
+ return __awaiter$p(this, void 0, void 0, function () {
2967
2972
  return __generator(this, function (_a) {
2968
2973
  switch (_a.label) {
2969
2974
  case 0: return [4 /*yield*/, this.collection.deleteOne({ _id: new bson.ObjectId(id) })];
@@ -2975,7 +2980,7 @@
2975
2980
  });
2976
2981
  };
2977
2982
  Progresses.prototype.waitForProgress = function (id, cb, delay) {
2978
- return __awaiter$o(this, void 0, void 0, function () {
2983
+ return __awaiter$p(this, void 0, void 0, function () {
2979
2984
  var isFinished, progress, waitTime;
2980
2985
  return __generator(this, function (_a) {
2981
2986
  switch (_a.label) {
@@ -3032,7 +3037,7 @@
3032
3037
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
3033
3038
  return Reflect.metadata(k, v);
3034
3039
  };
3035
- var __awaiter$n = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3040
+ var __awaiter$o = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3036
3041
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3037
3042
  return new (P || (P = Promise))(function (resolve, reject) {
3038
3043
  function fulfilled(value) { try {
@@ -3063,7 +3068,7 @@
3063
3068
  LazyAssets.prototype.create = function (jobType, jobParams, jobQue) {
3064
3069
  if (jobParams === void 0) { jobParams = {}; }
3065
3070
  if (jobQue === void 0) { jobQue = "main"; }
3066
- return __awaiter$n(this, void 0, void 0, function () {
3071
+ return __awaiter$o(this, void 0, void 0, function () {
3067
3072
  var jobName, data, existingAsset, res;
3068
3073
  return __generator(this, function (_a) {
3069
3074
  switch (_a.label) {
@@ -3088,14 +3093,14 @@
3088
3093
  });
3089
3094
  };
3090
3095
  LazyAssets.prototype.read = function (id) {
3091
- return __awaiter$n(this, void 0, void 0, function () {
3096
+ return __awaiter$o(this, void 0, void 0, function () {
3092
3097
  return __generator(this, function (_a) {
3093
3098
  return [2 /*return*/, !id ? null : this.find({ _id: new bson.ObjectId(id) })];
3094
3099
  });
3095
3100
  });
3096
3101
  };
3097
3102
  LazyAssets.prototype.find = function (where) {
3098
- return __awaiter$n(this, void 0, void 0, function () {
3103
+ return __awaiter$o(this, void 0, void 0, function () {
3099
3104
  var data;
3100
3105
  return __generator(this, function (_a) {
3101
3106
  switch (_a.label) {
@@ -3110,7 +3115,7 @@
3110
3115
  });
3111
3116
  };
3112
3117
  LazyAssets.prototype.unlink = function (id) {
3113
- return __awaiter$n(this, void 0, void 0, function () {
3118
+ return __awaiter$o(this, void 0, void 0, function () {
3114
3119
  var asset;
3115
3120
  return __generator(this, function (_a) {
3116
3121
  switch (_a.label) {
@@ -3150,7 +3155,7 @@
3150
3155
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
3151
3156
  return Reflect.metadata(k, v);
3152
3157
  };
3153
- var __awaiter$m = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3158
+ var __awaiter$n = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3154
3159
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3155
3160
  return new (P || (P = Promise))(function (resolve, reject) {
3156
3161
  function fulfilled(value) { try {
@@ -3176,7 +3181,7 @@
3176
3181
  }
3177
3182
  AssetResolver.prototype.resolve = function (id, lazy) {
3178
3183
  if (lazy === void 0) { lazy = false; }
3179
- return __awaiter$m(this, void 0, void 0, function () {
3184
+ return __awaiter$n(this, void 0, void 0, function () {
3180
3185
  var asset, lazyAsset, lazyAsset;
3181
3186
  return __generator(this, function (_a) {
3182
3187
  switch (_a.label) {
@@ -3260,7 +3265,7 @@
3260
3265
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
3261
3266
  return c > 3 && r && Object.defineProperty(target, key, r), r;
3262
3267
  };
3263
- var __awaiter$l = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3268
+ var __awaiter$m = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3264
3269
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3265
3270
  return new (P || (P = Promise))(function (resolve, reject) {
3266
3271
  function fulfilled(value) { try {
@@ -3283,14 +3288,14 @@
3283
3288
  function CacheProcessor() {
3284
3289
  }
3285
3290
  CacheProcessor.prototype.serialize = function (data) {
3286
- return __awaiter$l(this, void 0, void 0, function () {
3291
+ return __awaiter$m(this, void 0, void 0, function () {
3287
3292
  return __generator(this, function (_a) {
3288
3293
  return [2 /*return*/, data];
3289
3294
  });
3290
3295
  });
3291
3296
  };
3292
3297
  CacheProcessor.prototype.deserialize = function (data) {
3293
- return __awaiter$l(this, void 0, void 0, function () {
3298
+ return __awaiter$m(this, void 0, void 0, function () {
3294
3299
  return __generator(this, function (_a) {
3295
3300
  return [2 /*return*/, data];
3296
3301
  });
@@ -3317,7 +3322,7 @@
3317
3322
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
3318
3323
  return Reflect.metadata(k, v);
3319
3324
  };
3320
- var __awaiter$k = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3325
+ var __awaiter$l = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3321
3326
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3322
3327
  return new (P || (P = Promise))(function (resolve, reject) {
3323
3328
  function fulfilled(value) { try {
@@ -3343,7 +3348,7 @@
3343
3348
  this.cacheProcessor = cacheProcessor;
3344
3349
  }
3345
3350
  Cache.prototype.prepare = function () {
3346
- return __awaiter$k(this, void 0, void 0, function () {
3351
+ return __awaiter$l(this, void 0, void 0, function () {
3347
3352
  return __generator(this, function (_a) {
3348
3353
  switch (_a.label) {
3349
3354
  case 0:
@@ -3364,7 +3369,7 @@
3364
3369
  Cache.prototype.set = function (key, value, ttl, expirationTimestamp, tags) {
3365
3370
  if (expirationTimestamp === void 0) { expirationTimestamp = null; }
3366
3371
  if (tags === void 0) { tags = {}; }
3367
- return __awaiter$k(this, void 0, void 0, function () {
3372
+ return __awaiter$l(this, void 0, void 0, function () {
3368
3373
  var item, _a, now;
3369
3374
  return __generator(this, function (_b) {
3370
3375
  switch (_b.label) {
@@ -3395,7 +3400,7 @@
3395
3400
  });
3396
3401
  };
3397
3402
  Cache.prototype.get = function (key) {
3398
- return __awaiter$k(this, void 0, void 0, function () {
3403
+ return __awaiter$l(this, void 0, void 0, function () {
3399
3404
  var item, now;
3400
3405
  return __generator(this, function (_a) {
3401
3406
  switch (_a.label) {
@@ -3421,7 +3426,7 @@
3421
3426
  Cache.prototype.getOrSet = function (key, valueCb, ttl, expirationTimestamp, tags) {
3422
3427
  if (expirationTimestamp === void 0) { expirationTimestamp = null; }
3423
3428
  if (tags === void 0) { tags = {}; }
3424
- return __awaiter$k(this, void 0, void 0, function () {
3429
+ return __awaiter$l(this, void 0, void 0, function () {
3425
3430
  var e_1, _a, _b;
3426
3431
  return __generator(this, function (_c) {
3427
3432
  switch (_c.label) {
@@ -3442,7 +3447,7 @@
3442
3447
  });
3443
3448
  };
3444
3449
  Cache.prototype.delete = function (key) {
3445
- return __awaiter$k(this, void 0, void 0, function () {
3450
+ return __awaiter$l(this, void 0, void 0, function () {
3446
3451
  return __generator(this, function (_a) {
3447
3452
  switch (_a.label) {
3448
3453
  case 0: return [4 /*yield*/, this.prepare()];
@@ -3474,7 +3479,7 @@
3474
3479
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
3475
3480
  return c > 3 && r && Object.defineProperty(target, key, r), r;
3476
3481
  };
3477
- var __awaiter$j = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3482
+ var __awaiter$k = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3478
3483
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3479
3484
  return new (P || (P = Promise))(function (resolve, reject) {
3480
3485
  function fulfilled(value) { try {
@@ -3497,7 +3502,7 @@
3497
3502
  function EndpointProvider() {
3498
3503
  }
3499
3504
  EndpointProvider.prototype.configure = function (app) {
3500
- return __awaiter$j(this, void 0, void 0, function () {
3505
+ return __awaiter$k(this, void 0, void 0, function () {
3501
3506
  return __generator(this, function (_a) {
3502
3507
  console.log("Express app is mounted to: " + app.mountpath);
3503
3508
  return [2 /*return*/];
@@ -3528,7 +3533,7 @@
3528
3533
  var __param$7 = (this && this.__param) || function (paramIndex, decorator) {
3529
3534
  return function (target, key) { decorator(target, key, paramIndex); };
3530
3535
  };
3531
- var __awaiter$i = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3536
+ var __awaiter$j = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3532
3537
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3533
3538
  return new (P || (P = Promise))(function (resolve, reject) {
3534
3539
  function fulfilled(value) { try {
@@ -3552,7 +3557,7 @@
3552
3557
  this.fixtures = fixtures;
3553
3558
  }
3554
3559
  Fixtures.prototype.load = function () {
3555
- return __awaiter$i(this, void 0, void 0, function () {
3560
+ return __awaiter$j(this, void 0, void 0, function () {
3556
3561
  var _a, _b, fixture, e_1_1;
3557
3562
  var e_1, _c;
3558
3563
  return __generator(this, function (_d) {
@@ -3600,7 +3605,7 @@
3600
3605
  __metadata$k("design:paramtypes", [Array])
3601
3606
  ], exports.Fixtures);
3602
3607
 
3603
- var __awaiter$h = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3608
+ var __awaiter$i = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3604
3609
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3605
3610
  return new (P || (P = Promise))(function (resolve, reject) {
3606
3611
  function fulfilled(value) { try {
@@ -3631,7 +3636,7 @@
3631
3636
  this.targetSize = !size ? { width: thumbSize, height: thumbSize } : size;
3632
3637
  }
3633
3638
  GalleryImage.prototype.serve = function (id) {
3634
- return __awaiter$h(this, void 0, void 0, function () {
3639
+ return __awaiter$i(this, void 0, void 0, function () {
3635
3640
  var isThumb, original, _a, meta, ratio, sizeRatio, size, targetHeight, targetWidth, resized, buffer;
3636
3641
  return __generator(this, function (_b) {
3637
3642
  switch (_b.label) {
@@ -3727,7 +3732,7 @@
3727
3732
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
3728
3733
  return Reflect.metadata(k, v);
3729
3734
  };
3730
- var __awaiter$g = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3735
+ var __awaiter$h = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3731
3736
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3732
3737
  return new (P || (P = Promise))(function (resolve, reject) {
3733
3738
  function fulfilled(value) { try {
@@ -3757,7 +3762,7 @@
3757
3762
  }
3758
3763
  Gallery.prototype.getFolder = function (folder, size) {
3759
3764
  if (size === void 0) { size = null; }
3760
- return __awaiter$g(this, void 0, void 0, function () {
3765
+ return __awaiter$h(this, void 0, void 0, function () {
3761
3766
  var _this = this;
3762
3767
  return __generator(this, function (_a) {
3763
3768
  this.cache[folder] = this.cache[folder] || new Promise(function (resolve) {
@@ -3782,7 +3787,7 @@
3782
3787
  return;
3783
3788
  }
3784
3789
  var promises = files.map(function (file) {
3785
- return new Promise(function (resolve) { return __awaiter$g(_this, void 0, void 0, function () {
3790
+ return new Promise(function (resolve) { return __awaiter$h(_this, void 0, void 0, function () {
3786
3791
  var filePath, absoluteFilePath;
3787
3792
  var _this = this;
3788
3793
  return __generator(this, function (_a) {
@@ -3818,7 +3823,7 @@
3818
3823
  });
3819
3824
  },
3820
3825
  writeResult: function (isThumb, buffer) {
3821
- return new Promise(function (res, rej) { return __awaiter$g(_this, void 0, void 0, function () {
3826
+ return new Promise(function (res, rej) { return __awaiter$h(_this, void 0, void 0, function () {
3822
3827
  var resultPath;
3823
3828
  return __generator(this, function (_a) {
3824
3829
  switch (_a.label) {
@@ -3892,7 +3897,7 @@
3892
3897
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
3893
3898
  return Reflect.metadata(k, v);
3894
3899
  };
3895
- var __awaiter$f = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3900
+ var __awaiter$g = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3896
3901
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3897
3902
  return new (P || (P = Promise))(function (resolve, reject) {
3898
3903
  function fulfilled(value) { try {
@@ -3920,7 +3925,7 @@
3920
3925
  this.parts = config.resolve("idParts");
3921
3926
  }
3922
3927
  IdGenerator.prototype.generate = function (checkCb) {
3923
- return __awaiter$f(this, void 0, void 0, function () {
3928
+ return __awaiter$g(this, void 0, void 0, function () {
3924
3929
  var id, tries, notGood;
3925
3930
  return __generator(this, function (_a) {
3926
3931
  switch (_a.label) {
@@ -4012,7 +4017,7 @@
4012
4017
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
4013
4018
  return Reflect.metadata(k, v);
4014
4019
  };
4015
- var __awaiter$e = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4020
+ var __awaiter$f = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4016
4021
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4017
4022
  return new (P || (P = Promise))(function (resolve, reject) {
4018
4023
  function fulfilled(value) { try {
@@ -4037,7 +4042,7 @@
4037
4042
  this.cache = {};
4038
4043
  }
4039
4044
  Translator.prototype.getDictionary = function (language) {
4040
- return __awaiter$e(this, void 0, void 0, function () {
4045
+ return __awaiter$f(this, void 0, void 0, function () {
4041
4046
  var dictionary;
4042
4047
  return __generator(this, function (_a) {
4043
4048
  switch (_a.label) {
@@ -4122,7 +4127,7 @@
4122
4127
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
4123
4128
  return Reflect.metadata(k, v);
4124
4129
  };
4125
- var __awaiter$d = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4130
+ var __awaiter$e = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4126
4131
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4127
4132
  return new (P || (P = Promise))(function (resolve, reject) {
4128
4133
  function fulfilled(value) { try {
@@ -4165,11 +4170,11 @@
4165
4170
  return this.initPromise;
4166
4171
  };
4167
4172
  TemplateRenderer.prototype.parseTemplates = function (dir, dirPath) {
4168
- return __awaiter$d(this, void 0, void 0, function () {
4173
+ return __awaiter$e(this, void 0, void 0, function () {
4169
4174
  var _this = this;
4170
4175
  return __generator(this, function (_a) {
4171
4176
  return [2 /*return*/, new Promise(function (resolve) {
4172
- fs.readdir(dir, function (err, files) { return __awaiter$d(_this, void 0, void 0, function () {
4177
+ fs.readdir(dir, function (err, files) { return __awaiter$e(_this, void 0, void 0, function () {
4173
4178
  var files_1, files_1_1, file, path$1, parts, name, fullName, content, e_1_1;
4174
4179
  var e_1, _a;
4175
4180
  return __generator(this, function (_b) {
@@ -4221,7 +4226,7 @@
4221
4226
  });
4222
4227
  };
4223
4228
  TemplateRenderer.prototype.render = function (template, language, context) {
4224
- return __awaiter$d(this, void 0, void 0, function () {
4229
+ return __awaiter$e(this, void 0, void 0, function () {
4225
4230
  var res, _a;
4226
4231
  return __generator(this, function (_b) {
4227
4232
  switch (_b.label) {
@@ -4271,7 +4276,7 @@
4271
4276
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
4272
4277
  return Reflect.metadata(k, v);
4273
4278
  };
4274
- var __awaiter$c = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4279
+ var __awaiter$d = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4275
4280
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4276
4281
  return new (P || (P = Promise))(function (resolve, reject) {
4277
4282
  function fulfilled(value) { try {
@@ -4311,7 +4316,7 @@
4311
4316
  configurable: true
4312
4317
  });
4313
4318
  MailSender.prototype.sendMail = function (language, options) {
4314
- return __awaiter$c(this, void 0, void 0, function () {
4319
+ return __awaiter$d(this, void 0, void 0, function () {
4315
4320
  var subject, html;
4316
4321
  return __generator(this, function (_a) {
4317
4322
  switch (_a.label) {
@@ -4354,7 +4359,7 @@
4354
4359
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
4355
4360
  return Reflect.metadata(k, v);
4356
4361
  };
4357
- var __awaiter$b = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4362
+ var __awaiter$c = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4358
4363
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4359
4364
  return new (P || (P = Promise))(function (resolve, reject) {
4360
4365
  function fulfilled(value) { try {
@@ -4381,7 +4386,7 @@
4381
4386
  MemoryCache.prototype.set = function (key, value, ttl, expirationTimestamp, tags) {
4382
4387
  if (expirationTimestamp === void 0) { expirationTimestamp = null; }
4383
4388
  if (tags === void 0) { tags = {}; }
4384
- return __awaiter$b(this, void 0, void 0, function () {
4389
+ return __awaiter$c(this, void 0, void 0, function () {
4385
4390
  var now, expTimestamp;
4386
4391
  return __generator(this, function (_a) {
4387
4392
  now = Math.round(new Date().getTime() / 1000);
@@ -4397,7 +4402,7 @@
4397
4402
  });
4398
4403
  };
4399
4404
  MemoryCache.prototype.get = function (key) {
4400
- return __awaiter$b(this, void 0, void 0, function () {
4405
+ return __awaiter$c(this, void 0, void 0, function () {
4401
4406
  var item, now, expTimestamp, value;
4402
4407
  return __generator(this, function (_a) {
4403
4408
  switch (_a.label) {
@@ -4428,7 +4433,7 @@
4428
4433
  MemoryCache.prototype.getOrSet = function (key, valueCb, ttl, expirationTimestamp, tags) {
4429
4434
  if (expirationTimestamp === void 0) { expirationTimestamp = null; }
4430
4435
  if (tags === void 0) { tags = {}; }
4431
- return __awaiter$b(this, void 0, void 0, function () {
4436
+ return __awaiter$c(this, void 0, void 0, function () {
4432
4437
  var e_1, _a, _b;
4433
4438
  return __generator(this, function (_c) {
4434
4439
  switch (_c.label) {
@@ -4449,7 +4454,7 @@
4449
4454
  });
4450
4455
  };
4451
4456
  MemoryCache.prototype.delete = function (key) {
4452
- return __awaiter$b(this, void 0, void 0, function () {
4457
+ return __awaiter$c(this, void 0, void 0, function () {
4453
4458
  return __generator(this, function (_a) {
4454
4459
  switch (_a.label) {
4455
4460
  case 0:
@@ -4544,9 +4549,28 @@
4544
4549
  var __param$6 = (this && this.__param) || function (paramIndex, decorator) {
4545
4550
  return function (target, key) { decorator(target, key, paramIndex); };
4546
4551
  };
4552
+ var __awaiter$b = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4553
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4554
+ return new (P || (P = Promise))(function (resolve, reject) {
4555
+ function fulfilled(value) { try {
4556
+ step(generator.next(value));
4557
+ }
4558
+ catch (e) {
4559
+ reject(e);
4560
+ } }
4561
+ function rejected(value) { try {
4562
+ step(generator["throw"](value));
4563
+ }
4564
+ catch (e) {
4565
+ reject(e);
4566
+ } }
4567
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
4568
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
4569
+ });
4570
+ };
4547
4571
  exports.OpenApi = /** @class */ (function () {
4548
- function OpenApi(customValidation) {
4549
- if (customValidation === void 0) { customValidation = null; }
4572
+ function OpenApi(container, customValidation) {
4573
+ this.container = container;
4550
4574
  this.customValidation = customValidation;
4551
4575
  this.docs = null;
4552
4576
  }
@@ -4568,16 +4592,88 @@
4568
4592
  enumerable: false,
4569
4593
  configurable: true
4570
4594
  });
4595
+ OpenApi.prototype.schemaToExample = function (src, req) {
4596
+ var _a, _b, _c;
4597
+ return __awaiter$b(this, void 0, void 0, function () {
4598
+ var schemas, schema, result_1;
4599
+ var _this = this;
4600
+ return __generator(this, function (_d) {
4601
+ switch (_d.label) {
4602
+ case 0:
4603
+ if (src.$ref) {
4604
+ schemas = this.apiDocs.components.schemas;
4605
+ return [2 /*return*/, this.schemaToExample(schemas[src.$ref.replace("#/components/schemas/", "")], req)];
4606
+ }
4607
+ schema = src;
4608
+ if (schema.oneOf) {
4609
+ schema = Object.assign({}, schema, schema.oneOf[0]);
4610
+ }
4611
+ if (!(schema.type === "object")) return [3 /*break*/, 2];
4612
+ result_1 = {};
4613
+ return [4 /*yield*/, Promise.all(Object.keys(schema.properties).map(function (key) { return __awaiter$b(_this, void 0, void 0, function () {
4614
+ var _d, _e;
4615
+ return __generator(this, function (_f) {
4616
+ switch (_f.label) {
4617
+ case 0:
4618
+ _d = result_1;
4619
+ _e = key;
4620
+ return [4 /*yield*/, this.schemaToExample(schema.properties[key], req)];
4621
+ case 1:
4622
+ _d[_e] = _f.sent();
4623
+ return [2 /*return*/];
4624
+ }
4625
+ });
4626
+ }); }))];
4627
+ case 1:
4628
+ _d.sent();
4629
+ return [2 /*return*/, result_1];
4630
+ case 2:
4631
+ if (!(schema.type === "array")) return [3 /*break*/, 4];
4632
+ return [4 /*yield*/, this.schemaToExample(schema.items, req)];
4633
+ case 3: return [2 /*return*/, [_d.sent()]];
4634
+ case 4:
4635
+ if (schema.type === "string") {
4636
+ if (isDefined(schema.default)) {
4637
+ if (isFunction(schema.default)) {
4638
+ return [2 /*return*/, schema.default(this.container)];
4639
+ }
4640
+ return [2 /*return*/, schema.default];
4641
+ }
4642
+ if (schema.format == "date") {
4643
+ return [2 /*return*/, new Date().toISOString().substr(0, 10)];
4644
+ }
4645
+ if (schema.format == "date-time") {
4646
+ return [2 /*return*/, new Date().toISOString()];
4647
+ }
4648
+ if (schema.enum) {
4649
+ return [2 /*return*/, schema.enum[0]];
4650
+ }
4651
+ return [2 /*return*/, "string"];
4652
+ }
4653
+ if (schema.type === "number") {
4654
+ return [2 /*return*/, (_a = schema.default) !== null && _a !== void 0 ? _a : 0];
4655
+ }
4656
+ else if (schema.type === "boolean") {
4657
+ return [2 /*return*/, (_b = schema.default) !== null && _b !== void 0 ? _b : false];
4658
+ }
4659
+ else {
4660
+ return [2 /*return*/, (_c = schema.default) !== null && _c !== void 0 ? _c : null];
4661
+ }
4662
+ return [2 /*return*/];
4663
+ }
4664
+ });
4665
+ });
4666
+ };
4571
4667
  OpenApi.prototype.createApiDocs = function () {
4572
- var _a;
4668
+ var _d;
4573
4669
  var _this = this;
4574
4670
  var storage$1 = routingControllers.getMetadataArgsStorage();
4575
4671
  var docs = routingControllersOpenapi.routingControllersToSpec(storage$1);
4576
4672
  docs.basePath = "/api/";
4577
4673
  docs.definitions = classValidatorJsonschema.validationMetadatasToSchemas({
4578
4674
  classTransformerMetadataStorage: storage.defaultMetadataStorage,
4579
- additionalConverters: (_a = {},
4580
- _a[classValidator.ValidationTypes.CUSTOM_VALIDATION] = function (meta, options) {
4675
+ additionalConverters: (_d = {},
4676
+ _d[classValidator.ValidationTypes.CUSTOM_VALIDATION] = function (meta, options) {
4581
4677
  var res = isFunction(_this.customValidation) ? _this.customValidation(meta, options) : _this.customValidation;
4582
4678
  if (isObject(res))
4583
4679
  return res;
@@ -4597,7 +4693,7 @@
4597
4693
  }
4598
4694
  return null;
4599
4695
  },
4600
- _a)
4696
+ _d)
4601
4697
  });
4602
4698
  docs.components.schemas = docs.definitions;
4603
4699
  return docs;
@@ -4606,8 +4702,9 @@
4606
4702
  }());
4607
4703
  exports.OpenApi = __decorate$e([
4608
4704
  tsyringe.singleton(),
4609
- __param$6(0, tsyringe.inject(OPENAPI_VALIDATION)),
4610
- __metadata$b("design:paramtypes", [Object])
4705
+ __param$6(0, tsyringe.inject(DI_CONTAINER)),
4706
+ __param$6(1, tsyringe.inject(OPENAPI_VALIDATION)),
4707
+ __metadata$b("design:paramtypes", [Object, Object])
4611
4708
  ], exports.OpenApi);
4612
4709
 
4613
4710
  var __decorate$d = (this && this.__decorate) || function (decorators, target, key, desc) {
@@ -5959,12 +6056,62 @@
5959
6056
  var PrimitiveArray = mongoose.Types.Array;
5960
6057
  var DocumentArray = mongoose.Types.DocumentArray;
5961
6058
 
5962
- function IsDocumented(summary) {
6059
+ function IsDocumented(summary, paramDescriptions) {
5963
6060
  if (summary === void 0) { summary = null; }
5964
- return routingControllersOpenapi.OpenAPI(function (operation) {
5965
- operation.summary = summary || operation.summary;
5966
- operation.tags = ["Documented"].concat(operation.tags || []);
5967
- return operation;
6061
+ if (paramDescriptions === void 0) { paramDescriptions = {}; }
6062
+ return routingControllersOpenapi.OpenAPI(function (op) {
6063
+ var _a;
6064
+ op.summary = summary || op.summary;
6065
+ op.tags = ["Documented"].concat(op.tags || []);
6066
+ (_a = op.parameters) === null || _a === void 0 ? void 0 : _a.forEach(function (p) {
6067
+ if (p.$ref)
6068
+ return;
6069
+ var schema = p;
6070
+ schema.description = paramDescriptions[schema.name]
6071
+ || schema.description
6072
+ || ("param." + op.operationId + "." + schema.name).toLowerCase();
6073
+ });
6074
+ return op;
6075
+ });
6076
+ }
6077
+ function JsonResponse(description, statusCode) {
6078
+ if (description === void 0) { description = "Success"; }
6079
+ if (statusCode === void 0) { statusCode = null; }
6080
+ return routingControllersOpenapi.OpenAPI(function (op, route) {
6081
+ var status = statusCode !== null && statusCode !== void 0 ? statusCode : routingControllersOpenapi.getStatusCode(route) + "";
6082
+ op.responses = op.responses || {};
6083
+ op.responses[status] = {
6084
+ description: description,
6085
+ content: {
6086
+ "application/json": {}
6087
+ }
6088
+ };
6089
+ return op;
6090
+ });
6091
+ }
6092
+ function ResponseType(type, options) {
6093
+ if (options === void 0) { options = {}; }
6094
+ return routingControllersOpenapi.OpenAPI(function (op, route) {
6095
+ var _b;
6096
+ var _a;
6097
+ var contentType = "application/json";
6098
+ var statusCode = (_a = options === null || options === void 0 ? void 0 : options.statusCode) !== null && _a !== void 0 ? _a : routingControllersOpenapi.getStatusCode(route) + "";
6099
+ var reference = {
6100
+ $ref: "#/components/schemas/" + type.name,
6101
+ };
6102
+ var schema = options.isArray
6103
+ ? { items: reference, type: "array" }
6104
+ : reference;
6105
+ op.responses = op.responses || {};
6106
+ op.responses[statusCode] = {
6107
+ description: options.description || "Success",
6108
+ content: (_b = {},
6109
+ _b[contentType] = {
6110
+ schema: schema
6111
+ },
6112
+ _b)
6113
+ };
6114
+ return op;
5968
6115
  });
5969
6116
  }
5970
6117
 
@@ -6679,12 +6826,14 @@
6679
6826
  exports.HTTP_SERVER = HTTP_SERVER;
6680
6827
  exports.IsDocumented = IsDocumented;
6681
6828
  exports.JOB = JOB;
6829
+ exports.JsonResponse = JsonResponse;
6682
6830
  exports.LazyAssetGenerator = LazyAssetGenerator;
6683
6831
  exports.OPENAPI_VALIDATION = OPENAPI_VALIDATION;
6684
6832
  exports.PARAMETER = PARAMETER;
6685
6833
  exports.Parameter = Parameter;
6686
6834
  exports.PrimitiveArray = PrimitiveArray;
6687
6835
  exports.ResolveEntity = ResolveEntity;
6836
+ exports.ResponseType = ResponseType;
6688
6837
  exports.SOCKET_SERVER = SOCKET_SERVER;
6689
6838
  exports.Type = Type;
6690
6839
  exports.assign = assign;
@@ -6701,6 +6850,7 @@
6701
6850
  exports.deleteFromBucket = deleteFromBucket;
6702
6851
  exports.filter = filter;
6703
6852
  exports.firstItem = firstItem;
6853
+ exports.flatten = flatten;
6704
6854
  exports.getConstructorName = getConstructorName;
6705
6855
  exports.getExtension = getExtension;
6706
6856
  exports.getFileName = getFileName;