@stemy/backend 3.4.9 → 3.5.0

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.
@@ -87,7 +87,7 @@
87
87
  }
88
88
  return t;
89
89
  }
90
- function __decorate$A(decorators, target, key, desc) {
90
+ function __decorate$B(decorators, target, key, desc) {
91
91
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
92
92
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
93
93
  r = Reflect.decorate(decorators, target, key, desc);
@@ -100,7 +100,7 @@
100
100
  function __param$9(paramIndex, decorator) {
101
101
  return function (target, key) { decorator(target, key, paramIndex); };
102
102
  }
103
- function __metadata$r(metadataKey, metadataValue) {
103
+ function __metadata$u(metadataKey, metadataValue) {
104
104
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
105
105
  return Reflect.metadata(metadataKey, metadataValue);
106
106
  }
@@ -1082,7 +1082,7 @@
1082
1082
  return ("" + str).replace(/[&\/\\#, +()$~%.@'":*?<>{}]/g, to);
1083
1083
  }
1084
1084
 
1085
- var __decorate$z = (this && this.__decorate) || function (decorators, target, key, desc) {
1085
+ var __decorate$A = (this && this.__decorate) || function (decorators, target, key, desc) {
1086
1086
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1087
1087
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
1088
1088
  r = Reflect.decorate(decorators, target, key, desc);
@@ -1123,7 +1123,7 @@
1123
1123
  };
1124
1124
  return IsFile;
1125
1125
  }());
1126
- exports.IsFile = __decorate$z([
1126
+ exports.IsFile = __decorate$A([
1127
1127
  classValidator.ValidatorConstraint()
1128
1128
  ], exports.IsFile);
1129
1129
  exports.IsObjectId = /** @class */ (function () {
@@ -1135,7 +1135,7 @@
1135
1135
  };
1136
1136
  return IsObjectId;
1137
1137
  }());
1138
- exports.IsObjectId = __decorate$z([
1138
+ exports.IsObjectId = __decorate$A([
1139
1139
  classValidator.ValidatorConstraint()
1140
1140
  ], exports.IsObjectId);
1141
1141
 
@@ -1197,7 +1197,7 @@
1197
1197
  return Parameter;
1198
1198
  }());
1199
1199
 
1200
- var __decorate$y = (this && this.__decorate) || function (decorators, target, key, desc) {
1200
+ var __decorate$z = (this && this.__decorate) || function (decorators, target, key, desc) {
1201
1201
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1202
1202
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
1203
1203
  r = Reflect.decorate(decorators, target, key, desc);
@@ -1356,12 +1356,12 @@
1356
1356
  };
1357
1357
  return AssetProcessor;
1358
1358
  }());
1359
- exports.AssetProcessor = AssetProcessor_1 = __decorate$y([
1359
+ exports.AssetProcessor = AssetProcessor_1 = __decorate$z([
1360
1360
  tsyringe.injectable(),
1361
1361
  tsyringe.scoped(tsyringe.Lifecycle.ContainerScoped)
1362
1362
  ], exports.AssetProcessor);
1363
1363
 
1364
- var __decorate$x = (this && this.__decorate) || function (decorators, target, key, desc) {
1364
+ var __decorate$y = (this && this.__decorate) || function (decorators, target, key, desc) {
1365
1365
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1366
1366
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
1367
1367
  r = Reflect.decorate(decorators, target, key, desc);
@@ -1371,7 +1371,7 @@
1371
1371
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1372
1372
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1373
1373
  };
1374
- var __metadata$q = (this && this.__metadata) || function (k, v) {
1374
+ var __metadata$t = (this && this.__metadata) || function (k, v) {
1375
1375
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
1376
1376
  return Reflect.metadata(k, v);
1377
1377
  };
@@ -1383,6 +1383,7 @@
1383
1383
  var _this = this;
1384
1384
  dotenv__default["default"].config();
1385
1385
  this.paramMap = {};
1386
+ this.paramValues = {};
1386
1387
  (params || []).forEach(function (param) { return _this.add(param); });
1387
1388
  }
1388
1389
  Configuration.prototype.add = function (param) {
@@ -1391,13 +1392,7 @@
1391
1392
  existingParam.resolver = param.resolver || existingParam.resolver;
1392
1393
  this.paramMap[param.name] = existingParam;
1393
1394
  };
1394
- Configuration.prototype.hasParam = function (name) {
1395
- return !!this.paramMap[name];
1396
- };
1397
- Configuration.prototype.resolve = function (name) {
1398
- var param = this.paramMap[name];
1399
- if (!param)
1400
- throw new Error("Parameter with name: '" + name + "' does not exists in configuration");
1395
+ Configuration.prototype.resolveValue = function (param) {
1401
1396
  var envName = param.name.replace(/\.?([A-Z|0-9]+)/g, function (x, y) {
1402
1397
  return "_" + y.toLowerCase();
1403
1398
  }).replace(/\./gi, "_").replace(/^_/, "").toUpperCase();
@@ -1406,21 +1401,32 @@
1406
1401
  var value = isFunction(param.resolver)
1407
1402
  ? param.resolver(envValue)
1408
1403
  : convertValue(envValue, getType(param.defaultValue));
1409
- console.log("Processing param value", name, envName, envValue, value);
1404
+ console.log("Processing param value", colorize(param.name, exports.ConsoleColor.FgGreen), colorize(envName, exports.ConsoleColor.FgBlue), "\"" + envValue + "\"", value);
1410
1405
  return value;
1411
1406
  }
1412
1407
  return param.defaultValue;
1413
1408
  };
1409
+ Configuration.prototype.hasParam = function (name) {
1410
+ return !!this.paramMap[name];
1411
+ };
1412
+ Configuration.prototype.resolve = function (name) {
1413
+ var param = this.paramMap[name];
1414
+ if (!param)
1415
+ throw new Error("Parameter with name: '" + name + "' does not exists in configuration");
1416
+ if (!(name in this.paramValues)) {
1417
+ this.paramValues[name] = this.resolveValue(param);
1418
+ }
1419
+ return this.paramValues[name];
1420
+ };
1414
1421
  return Configuration;
1415
1422
  }());
1416
- exports.Configuration = __decorate$x([
1417
- tsyringe.injectable(),
1418
- tsyringe.scoped(tsyringe.Lifecycle.ContainerScoped),
1423
+ exports.Configuration = __decorate$y([
1424
+ tsyringe.singleton(),
1419
1425
  __param$8(0, tsyringe.injectAll(PARAMETER)),
1420
- __metadata$q("design:paramtypes", [Array])
1426
+ __metadata$t("design:paramtypes", [Array])
1421
1427
  ], exports.Configuration);
1422
1428
 
1423
- var __decorate$w = (this && this.__decorate) || function (decorators, target, key, desc) {
1429
+ var __decorate$x = (this && this.__decorate) || function (decorators, target, key, desc) {
1424
1430
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1425
1431
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
1426
1432
  r = Reflect.decorate(decorators, target, key, desc);
@@ -1430,7 +1436,7 @@
1430
1436
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1431
1437
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1432
1438
  };
1433
- var __metadata$p = (this && this.__metadata) || function (k, v) {
1439
+ var __metadata$s = (this && this.__metadata) || function (k, v) {
1434
1440
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
1435
1441
  return Reflect.metadata(k, v);
1436
1442
  };
@@ -1506,10 +1512,10 @@
1506
1512
  };
1507
1513
  return MongoConnector;
1508
1514
  }());
1509
- exports.MongoConnector = __decorate$w([
1515
+ exports.MongoConnector = __decorate$x([
1510
1516
  tsyringe.injectable(),
1511
1517
  tsyringe.singleton(),
1512
- __metadata$p("design:paramtypes", [exports.Configuration])
1518
+ __metadata$s("design:paramtypes", [exports.Configuration])
1513
1519
  ], exports.MongoConnector);
1514
1520
 
1515
1521
  var __awaiter$v = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
@@ -1765,7 +1771,7 @@
1765
1771
  return TempAsset;
1766
1772
  }());
1767
1773
 
1768
- var __decorate$v = (this && this.__decorate) || function (decorators, target, key, desc) {
1774
+ var __decorate$w = (this && this.__decorate) || function (decorators, target, key, desc) {
1769
1775
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1770
1776
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
1771
1777
  r = Reflect.decorate(decorators, target, key, desc);
@@ -1775,7 +1781,7 @@
1775
1781
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1776
1782
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1777
1783
  };
1778
- var __metadata$o = (this && this.__metadata) || function (k, v) {
1784
+ var __metadata$r = (this && this.__metadata) || function (k, v) {
1779
1785
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
1780
1786
  return Reflect.metadata(k, v);
1781
1787
  };
@@ -2051,10 +2057,10 @@
2051
2057
  };
2052
2058
  return Assets;
2053
2059
  }());
2054
- exports.Assets = __decorate$v([
2060
+ exports.Assets = __decorate$w([
2055
2061
  tsyringe.injectable(),
2056
2062
  tsyringe.scoped(tsyringe.Lifecycle.ContainerScoped),
2057
- __metadata$o("design:paramtypes", [exports.MongoConnector, exports.AssetProcessor])
2063
+ __metadata$r("design:paramtypes", [exports.MongoConnector, exports.AssetProcessor])
2058
2064
  ], exports.Assets);
2059
2065
 
2060
2066
  var __awaiter$r = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
@@ -2078,8 +2084,9 @@
2078
2084
  };
2079
2085
  var LazyAsset = /** @class */ (function (_super) {
2080
2086
  __extends(LazyAsset, _super);
2081
- function LazyAsset(id, data, collection, assets, progresses) {
2087
+ function LazyAsset(id, data, collection, logger, assets, progresses) {
2082
2088
  var _this = _super.call(this, id, data, collection) || this;
2089
+ _this.logger = logger;
2083
2090
  _this.assets = assets;
2084
2091
  _this.progresses = progresses;
2085
2092
  return _this;
@@ -2145,9 +2152,9 @@
2145
2152
  p === null || p === void 0 ? void 0 : p.cancel();
2146
2153
  });
2147
2154
  _this.startWorkingOnAsset(false).then(function () {
2148
- console.log("Started working on lazy asset: " + _this.id);
2155
+ _this.logger.log("lazy-assets", "Started working on lazy asset: " + _this.id);
2149
2156
  }).catch(function (reason) {
2150
- console.log("Can't start working on lazy asset: " + _this.id + "\nReason: " + reason);
2157
+ _this.logger.log("lazy-assets", "Can't start working on lazy asset: " + _this.id + "\nReason: " + reason);
2151
2158
  });
2152
2159
  });
2153
2160
  };
@@ -2215,6 +2222,42 @@
2215
2222
  return LazyAsset;
2216
2223
  }(BaseEntity));
2217
2224
 
2225
+ var __decorate$v = (this && this.__decorate) || function (decorators, target, key, desc) {
2226
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2227
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
2228
+ r = Reflect.decorate(decorators, target, key, desc);
2229
+ else
2230
+ for (var i = decorators.length - 1; i >= 0; i--)
2231
+ if (d = decorators[i])
2232
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
2233
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
2234
+ };
2235
+ var __metadata$q = (this && this.__metadata) || function (k, v) {
2236
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
2237
+ return Reflect.metadata(k, v);
2238
+ };
2239
+ exports["ɵa"] = /** @class */ (function () {
2240
+ function Logger(config) {
2241
+ this.config = config;
2242
+ console.log("Logger created");
2243
+ this.tags = this.config.resolve("logTags");
2244
+ }
2245
+ Logger.prototype.log = function (tag) {
2246
+ var params = [];
2247
+ for (var _i = 1; _i < arguments.length; _i++) {
2248
+ params[_i - 1] = arguments[_i];
2249
+ }
2250
+ if (!this.tags.includes(tag)) {
2251
+ console.log.apply(console, __spreadArray(["[" + tag + "]"], __read(params)));
2252
+ }
2253
+ };
2254
+ return Logger;
2255
+ }());
2256
+ exports["ɵa"] = __decorate$v([
2257
+ tsyringe.singleton(),
2258
+ __metadata$q("design:paramtypes", [exports.Configuration])
2259
+ ], exports["ɵa"]);
2260
+
2218
2261
  var __decorate$u = (this && this.__decorate) || function (decorators, target, key, desc) {
2219
2262
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2220
2263
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
@@ -2225,7 +2268,7 @@
2225
2268
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
2226
2269
  return c > 3 && r && Object.defineProperty(target, key, r), r;
2227
2270
  };
2228
- var __metadata$n = (this && this.__metadata) || function (k, v) {
2271
+ var __metadata$p = (this && this.__metadata) || function (k, v) {
2229
2272
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
2230
2273
  return Reflect.metadata(k, v);
2231
2274
  };
@@ -2252,9 +2295,10 @@
2252
2295
  });
2253
2296
  };
2254
2297
  exports.JobManager = /** @class */ (function () {
2255
- function JobManager(config, container, jobTypes) {
2298
+ function JobManager(config, logger, container, jobTypes) {
2256
2299
  var _this = this;
2257
2300
  this.config = config;
2301
+ this.logger = logger;
2258
2302
  this.container = container;
2259
2303
  this.jobTypes = jobTypes || [];
2260
2304
  this.jobs = this.jobTypes.reduce(function (res, jobType) {
@@ -2292,7 +2336,7 @@
2292
2336
  }
2293
2337
  catch (e) {
2294
2338
  jobName = getConstructorName(jobType);
2295
- throw "Can't resolve params for job: " + jobName + ", with params: " + JSON.stringify(params) + ". Reason: " + e;
2339
+ throw new Error("Can't resolve params for job: " + jobName + ", with params: " + JSON.stringify(params) + ". Reason: " + e);
2296
2340
  }
2297
2341
  return [2 /*return*/, instance.process()];
2298
2342
  });
@@ -2329,12 +2373,12 @@
2329
2373
  }).join(" ");
2330
2374
  var jobName = getConstructorName(jobType);
2331
2375
  if (!nodeCron.validate(expression)) {
2332
- console.log("Can't schedule the task: '" + jobName + "' because time expression is invalid.");
2376
+ this.logger.log("job-manager", "Can't schedule the task: '" + jobName + "' because time expression is invalid.");
2333
2377
  return null;
2334
2378
  }
2335
2379
  return nodeCron.schedule(expression, function () {
2336
2380
  _this.enqueue(jobType, params).catch(function (e) {
2337
- console.log("Can't enqueue job: '" + jobName + "' because: " + e);
2381
+ _this.logger.log("job-manager", "Can't enqueue job: '" + jobName + "' because: " + e);
2338
2382
  });
2339
2383
  });
2340
2384
  };
@@ -2349,7 +2393,7 @@
2349
2393
  return [2 /*return*/, null];
2350
2394
  this.processing = true;
2351
2395
  if (!this.config.resolve("isWorker")) {
2352
- console.log(colorize("Processing can not be started because this is NOT a worker process!", exports.ConsoleColor.FgRed));
2396
+ this.logger.log("job-manager", colorize("Processing can not be started because this is NOT a worker process!", exports.ConsoleColor.FgRed));
2353
2397
  return [2 /*return*/, null];
2354
2398
  }
2355
2399
  host = this.config.resolve("zmqRemoteHost");
@@ -2358,13 +2402,13 @@
2358
2402
  return [4 /*yield*/, this.workerPush.connect(pushHost)];
2359
2403
  case 1:
2360
2404
  _a.sent();
2361
- console.log("Worker producer connected to: " + pushHost);
2405
+ this.logger.log("job-manager", "Worker producer connected to: " + pushHost);
2362
2406
  pullHost = host + ":" + this.config.resolve("zmqPort");
2363
2407
  this.workerPull = zeromq.socket("pull");
2364
2408
  return [4 /*yield*/, this.workerPull.connect(pullHost)];
2365
2409
  case 2:
2366
2410
  _a.sent();
2367
- console.log("Worker consumer connected to: " + pullHost);
2411
+ this.logger.log("job-manager", "Worker consumer connected to: " + pullHost);
2368
2412
  this.workerPull.on("message", function (name, args, uniqId) { return __awaiter$q(_this, void 0, void 0, function () {
2369
2413
  var jobName, jobParams, uniqueId, e_1, e_2;
2370
2414
  return __generator(this, function (_a) {
@@ -2393,7 +2437,7 @@
2393
2437
  return [3 /*break*/, 6];
2394
2438
  case 5:
2395
2439
  e_2 = _a.sent();
2396
- console.log("Failed to start job: " + e_2.message);
2440
+ this.logger.log("job-manager", "Failed to start job: " + e_2.message);
2397
2441
  return [3 /*break*/, 6];
2398
2442
  case 6: return [2 /*return*/];
2399
2443
  }
@@ -2432,7 +2476,7 @@
2432
2476
  var port = this.config.resolve("zmqPort");
2433
2477
  this.apiPush = zeromq.socket("push");
2434
2478
  this.apiPush.bind("tcp://0.0.0.0:" + port);
2435
- console.log("API producer bound to port: " + port);
2479
+ this.logger.log("job-manager", "API producer bound to port: " + port);
2436
2480
  }
2437
2481
  if (!this.apiPull) {
2438
2482
  var backPort = this.config.resolve("zmqBackPort");
@@ -2445,10 +2489,10 @@
2445
2489
  res[key] = getType(params[key]);
2446
2490
  return res;
2447
2491
  }, {});
2448
- console.log("Received a message from worker: \"" + colorize(message, exports.ConsoleColor.FgCyan) + "\" with args: " + jsonHighlight(paramTypes) + "\n\n");
2492
+ _this.logger.log("job-manager", "Received a message from worker: \"" + colorize(message, exports.ConsoleColor.FgCyan) + "\" with args: " + jsonHighlight(paramTypes) + "\n\n");
2449
2493
  _this.messages.next({ message: message, params: params });
2450
2494
  });
2451
- console.log("API consumer bound to port: " + backPort);
2495
+ this.logger.log("job-manager", "API consumer bound to port: " + backPort);
2452
2496
  }
2453
2497
  return this.tryResolve(jobType, params);
2454
2498
  };
@@ -2484,8 +2528,10 @@
2484
2528
  exports.JobManager = __decorate$u([
2485
2529
  tsyringe.injectable(),
2486
2530
  tsyringe.scoped(tsyringe.Lifecycle.ContainerScoped),
2487
- __param$7(1, tsyringe.inject(DI_CONTAINER)), __param$7(2, tsyringe.injectAll(JOB)),
2488
- __metadata$n("design:paramtypes", [exports.Configuration, Object, Array])
2531
+ __param$7(2, tsyringe.inject(DI_CONTAINER)),
2532
+ __param$7(3, tsyringe.injectAll(JOB)),
2533
+ __metadata$p("design:paramtypes", [exports.Configuration,
2534
+ exports["ɵa"], Object, Array])
2489
2535
  ], exports.JobManager);
2490
2536
 
2491
2537
  var __awaiter$p = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
@@ -2897,7 +2943,7 @@
2897
2943
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
2898
2944
  return c > 3 && r && Object.defineProperty(target, key, r), r;
2899
2945
  };
2900
- var __metadata$m = (this && this.__metadata) || function (k, v) {
2946
+ var __metadata$o = (this && this.__metadata) || function (k, v) {
2901
2947
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
2902
2948
  return Reflect.metadata(k, v);
2903
2949
  };
@@ -3063,7 +3109,7 @@
3063
3109
  exports.Progresses = __decorate$t([
3064
3110
  tsyringe.injectable(),
3065
3111
  tsyringe.singleton(),
3066
- __metadata$m("design:paramtypes", [exports.MongoConnector, exports.JobManager])
3112
+ __metadata$o("design:paramtypes", [exports.MongoConnector, exports.JobManager])
3067
3113
  ], exports.Progresses);
3068
3114
 
3069
3115
  var __decorate$s = (this && this.__decorate) || function (decorators, target, key, desc) {
@@ -3076,7 +3122,7 @@
3076
3122
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
3077
3123
  return c > 3 && r && Object.defineProperty(target, key, r), r;
3078
3124
  };
3079
- var __metadata$l = (this && this.__metadata) || function (k, v) {
3125
+ var __metadata$n = (this && this.__metadata) || function (k, v) {
3080
3126
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
3081
3127
  return Reflect.metadata(k, v);
3082
3128
  };
@@ -3100,10 +3146,11 @@
3100
3146
  });
3101
3147
  };
3102
3148
  exports.LazyAssets = /** @class */ (function () {
3103
- function LazyAssets(connector, assets, progresses, jobMan) {
3149
+ function LazyAssets(connector, assets, progresses, logger, jobMan) {
3104
3150
  this.connector = connector;
3105
3151
  this.assets = assets;
3106
3152
  this.progresses = progresses;
3153
+ this.logger = logger;
3107
3154
  this.jobMan = jobMan;
3108
3155
  this.collection = connector.database.collection("lazyassets");
3109
3156
  }
@@ -3129,7 +3176,7 @@
3129
3176
  return [4 /*yield*/, this.collection.insertOne(data)];
3130
3177
  case 2:
3131
3178
  res = _a.sent();
3132
- return [2 /*return*/, new LazyAsset(res.insertedId, data, this.collection, this.assets, this.progresses)];
3179
+ return [2 /*return*/, new LazyAsset(res.insertedId, data, this.collection, this.logger, this.assets, this.progresses)];
3133
3180
  }
3134
3181
  });
3135
3182
  });
@@ -3151,7 +3198,7 @@
3151
3198
  data = _a.sent();
3152
3199
  return [2 /*return*/, !data
3153
3200
  ? null
3154
- : new LazyAsset(data._id, data, this.collection, this.assets, this.progresses)];
3201
+ : new LazyAsset(data._id, data, this.collection, this.logger, this.assets, this.progresses)];
3155
3202
  }
3156
3203
  });
3157
3204
  });
@@ -3176,9 +3223,10 @@
3176
3223
  exports.LazyAssets = __decorate$s([
3177
3224
  tsyringe.injectable(),
3178
3225
  tsyringe.scoped(tsyringe.Lifecycle.ContainerScoped),
3179
- __metadata$l("design:paramtypes", [exports.MongoConnector,
3226
+ __metadata$n("design:paramtypes", [exports.MongoConnector,
3180
3227
  exports.Assets,
3181
3228
  exports.Progresses,
3229
+ exports["ɵa"],
3182
3230
  exports.JobManager])
3183
3231
  ], exports.LazyAssets);
3184
3232
 
@@ -3192,7 +3240,7 @@
3192
3240
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
3193
3241
  return c > 3 && r && Object.defineProperty(target, key, r), r;
3194
3242
  };
3195
- var __metadata$k = (this && this.__metadata) || function (k, v) {
3243
+ var __metadata$m = (this && this.__metadata) || function (k, v) {
3196
3244
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
3197
3245
  return Reflect.metadata(k, v);
3198
3246
  };
@@ -3255,7 +3303,7 @@
3255
3303
  exports.AssetResolver = __decorate$r([
3256
3304
  tsyringe.injectable(),
3257
3305
  tsyringe.scoped(tsyringe.Lifecycle.ContainerScoped),
3258
- __metadata$k("design:paramtypes", [exports.Assets, exports.LazyAssets])
3306
+ __metadata$m("design:paramtypes", [exports.Assets, exports.LazyAssets])
3259
3307
  ], exports.AssetResolver);
3260
3308
 
3261
3309
  var __decorate$q = (this && this.__decorate) || function (decorators, target, key, desc) {
@@ -3268,7 +3316,7 @@
3268
3316
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
3269
3317
  return c > 3 && r && Object.defineProperty(target, key, r), r;
3270
3318
  };
3271
- var __metadata$j = (this && this.__metadata) || function (k, v) {
3319
+ var __metadata$l = (this && this.__metadata) || function (k, v) {
3272
3320
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
3273
3321
  return Reflect.metadata(k, v);
3274
3322
  };
@@ -3293,7 +3341,7 @@
3293
3341
  exports.BackendProvider = __decorate$q([
3294
3342
  tsyringe.injectable(),
3295
3343
  tsyringe.singleton(),
3296
- __metadata$j("design:paramtypes", [])
3344
+ __metadata$l("design:paramtypes", [])
3297
3345
  ], exports.BackendProvider);
3298
3346
 
3299
3347
  var __decorate$p = (this && this.__decorate) || function (decorators, target, key, desc) {
@@ -3359,7 +3407,7 @@
3359
3407
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
3360
3408
  return c > 3 && r && Object.defineProperty(target, key, r), r;
3361
3409
  };
3362
- var __metadata$i = (this && this.__metadata) || function (k, v) {
3410
+ var __metadata$k = (this && this.__metadata) || function (k, v) {
3363
3411
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
3364
3412
  return Reflect.metadata(k, v);
3365
3413
  };
@@ -3507,7 +3555,7 @@
3507
3555
  exports.Cache = __decorate$o([
3508
3556
  tsyringe.injectable(),
3509
3557
  tsyringe.scoped(tsyringe.Lifecycle.ContainerScoped),
3510
- __metadata$i("design:paramtypes", [exports.MongoConnector, exports.Configuration, exports.CacheProcessor])
3558
+ __metadata$k("design:paramtypes", [exports.MongoConnector, exports.Configuration, exports.CacheProcessor])
3511
3559
  ], exports.Cache);
3512
3560
 
3513
3561
  var __decorate$n = (this && this.__decorate) || function (decorators, target, key, desc) {
@@ -3567,7 +3615,7 @@
3567
3615
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
3568
3616
  return c > 3 && r && Object.defineProperty(target, key, r), r;
3569
3617
  };
3570
- var __metadata$h = (this && this.__metadata) || function (k, v) {
3618
+ var __metadata$j = (this && this.__metadata) || function (k, v) {
3571
3619
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
3572
3620
  return Reflect.metadata(k, v);
3573
3621
  };
@@ -3643,7 +3691,7 @@
3643
3691
  tsyringe.injectable(),
3644
3692
  tsyringe.scoped(tsyringe.Lifecycle.ContainerScoped),
3645
3693
  __param$6(0, tsyringe.injectAll(FIXTURE)),
3646
- __metadata$h("design:paramtypes", [Array])
3694
+ __metadata$j("design:paramtypes", [Array])
3647
3695
  ], exports.Fixtures);
3648
3696
 
3649
3697
  var __awaiter$h = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
@@ -3730,7 +3778,7 @@
3730
3778
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
3731
3779
  return c > 3 && r && Object.defineProperty(target, key, r), r;
3732
3780
  };
3733
- var __metadata$g = (this && this.__metadata) || function (k, v) {
3781
+ var __metadata$i = (this && this.__metadata) || function (k, v) {
3734
3782
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
3735
3783
  return Reflect.metadata(k, v);
3736
3784
  };
@@ -3756,7 +3804,7 @@
3756
3804
  exports.GalleryCache = __decorate$l([
3757
3805
  tsyringe.injectable(),
3758
3806
  tsyringe.scoped(tsyringe.Lifecycle.ContainerScoped),
3759
- __metadata$g("design:paramtypes", [])
3807
+ __metadata$i("design:paramtypes", [])
3760
3808
  ], exports.GalleryCache);
3761
3809
 
3762
3810
  var __decorate$k = (this && this.__decorate) || function (decorators, target, key, desc) {
@@ -3769,7 +3817,7 @@
3769
3817
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
3770
3818
  return c > 3 && r && Object.defineProperty(target, key, r), r;
3771
3819
  };
3772
- var __metadata$f = (this && this.__metadata) || function (k, v) {
3820
+ var __metadata$h = (this && this.__metadata) || function (k, v) {
3773
3821
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
3774
3822
  return Reflect.metadata(k, v);
3775
3823
  };
@@ -3921,7 +3969,7 @@
3921
3969
  exports.Gallery = __decorate$k([
3922
3970
  tsyringe.injectable(),
3923
3971
  tsyringe.scoped(tsyringe.Lifecycle.ContainerScoped),
3924
- __metadata$f("design:paramtypes", [exports.Configuration, exports.GalleryCache])
3972
+ __metadata$h("design:paramtypes", [exports.Configuration, exports.GalleryCache])
3925
3973
  ], exports.Gallery);
3926
3974
 
3927
3975
  var __decorate$j = (this && this.__decorate) || function (decorators, target, key, desc) {
@@ -3934,7 +3982,7 @@
3934
3982
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
3935
3983
  return c > 3 && r && Object.defineProperty(target, key, r), r;
3936
3984
  };
3937
- var __metadata$e = (this && this.__metadata) || function (k, v) {
3985
+ var __metadata$g = (this && this.__metadata) || function (k, v) {
3938
3986
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
3939
3987
  return Reflect.metadata(k, v);
3940
3988
  };
@@ -4008,7 +4056,7 @@
4008
4056
  exports.IdGenerator = __decorate$j([
4009
4057
  tsyringe.injectable(),
4010
4058
  tsyringe.scoped(tsyringe.Lifecycle.ContainerScoped),
4011
- __metadata$e("design:paramtypes", [exports.Configuration])
4059
+ __metadata$g("design:paramtypes", [exports.Configuration])
4012
4060
  ], exports.IdGenerator);
4013
4061
 
4014
4062
  var __decorate$i = (this && this.__decorate) || function (decorators, target, key, desc) {
@@ -4021,7 +4069,7 @@
4021
4069
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
4022
4070
  return c > 3 && r && Object.defineProperty(target, key, r), r;
4023
4071
  };
4024
- var __metadata$d = (this && this.__metadata) || function (k, v) {
4072
+ var __metadata$f = (this && this.__metadata) || function (k, v) {
4025
4073
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
4026
4074
  return Reflect.metadata(k, v);
4027
4075
  };
@@ -4041,7 +4089,7 @@
4041
4089
  exports.TranslationProvider = __decorate$i([
4042
4090
  tsyringe.injectable(),
4043
4091
  tsyringe.singleton(),
4044
- __metadata$d("design:paramtypes", [exports.Configuration])
4092
+ __metadata$f("design:paramtypes", [exports.Configuration])
4045
4093
  ], exports.TranslationProvider);
4046
4094
 
4047
4095
  var __decorate$h = (this && this.__decorate) || function (decorators, target, key, desc) {
@@ -4054,7 +4102,7 @@
4054
4102
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
4055
4103
  return c > 3 && r && Object.defineProperty(target, key, r), r;
4056
4104
  };
4057
- var __metadata$c = (this && this.__metadata) || function (k, v) {
4105
+ var __metadata$e = (this && this.__metadata) || function (k, v) {
4058
4106
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
4059
4107
  return Reflect.metadata(k, v);
4060
4108
  };
@@ -4151,7 +4199,7 @@
4151
4199
  exports.Translator = __decorate$h([
4152
4200
  tsyringe.injectable(),
4153
4201
  tsyringe.singleton(),
4154
- __metadata$c("design:paramtypes", [exports.TranslationProvider])
4202
+ __metadata$e("design:paramtypes", [exports.TranslationProvider])
4155
4203
  ], exports.Translator);
4156
4204
 
4157
4205
  var __decorate$g = (this && this.__decorate) || function (decorators, target, key, desc) {
@@ -4164,7 +4212,7 @@
4164
4212
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
4165
4213
  return c > 3 && r && Object.defineProperty(target, key, r), r;
4166
4214
  };
4167
- var __metadata$b = (this && this.__metadata) || function (k, v) {
4215
+ var __metadata$d = (this && this.__metadata) || function (k, v) {
4168
4216
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
4169
4217
  return Reflect.metadata(k, v);
4170
4218
  };
@@ -4300,7 +4348,7 @@
4300
4348
  exports.TemplateRenderer = __decorate$g([
4301
4349
  tsyringe.injectable(),
4302
4350
  tsyringe.singleton(),
4303
- __metadata$b("design:paramtypes", [exports.Translator, exports.Configuration])
4351
+ __metadata$d("design:paramtypes", [exports.Translator, exports.Configuration])
4304
4352
  ], exports.TemplateRenderer);
4305
4353
 
4306
4354
  var __decorate$f = (this && this.__decorate) || function (decorators, target, key, desc) {
@@ -4313,7 +4361,7 @@
4313
4361
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
4314
4362
  return c > 3 && r && Object.defineProperty(target, key, r), r;
4315
4363
  };
4316
- var __metadata$a = (this && this.__metadata) || function (k, v) {
4364
+ var __metadata$c = (this && this.__metadata) || function (k, v) {
4317
4365
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
4318
4366
  return Reflect.metadata(k, v);
4319
4367
  };
@@ -4383,7 +4431,7 @@
4383
4431
  exports.MailSender = __decorate$f([
4384
4432
  tsyringe.injectable(),
4385
4433
  tsyringe.singleton(),
4386
- __metadata$a("design:paramtypes", [exports.Configuration, exports.TemplateRenderer])
4434
+ __metadata$c("design:paramtypes", [exports.Configuration, exports.TemplateRenderer])
4387
4435
  ], exports.MailSender);
4388
4436
 
4389
4437
  var __decorate$e = (this && this.__decorate) || function (decorators, target, key, desc) {
@@ -4396,7 +4444,7 @@
4396
4444
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
4397
4445
  return c > 3 && r && Object.defineProperty(target, key, r), r;
4398
4446
  };
4399
- var __metadata$9 = (this && this.__metadata) || function (k, v) {
4447
+ var __metadata$b = (this && this.__metadata) || function (k, v) {
4400
4448
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
4401
4449
  return Reflect.metadata(k, v);
4402
4450
  };
@@ -4513,7 +4561,7 @@
4513
4561
  exports.MemoryCache = __decorate$e([
4514
4562
  tsyringe.injectable(),
4515
4563
  tsyringe.scoped(tsyringe.Lifecycle.ContainerScoped),
4516
- __metadata$9("design:paramtypes", [exports.Cache])
4564
+ __metadata$b("design:paramtypes", [exports.Cache])
4517
4565
  ], exports.MemoryCache);
4518
4566
 
4519
4567
  var __decorate$d = (this && this.__decorate) || function (decorators, target, key, desc) {
@@ -4606,7 +4654,7 @@
4606
4654
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
4607
4655
  return c > 3 && r && Object.defineProperty(target, key, r), r;
4608
4656
  };
4609
- var __metadata$8 = (this && this.__metadata) || function (k, v) {
4657
+ var __metadata$a = (this && this.__metadata) || function (k, v) {
4610
4658
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
4611
4659
  return Reflect.metadata(k, v);
4612
4660
  };
@@ -4628,47 +4676,47 @@
4628
4676
  classValidator.Min(-360),
4629
4677
  classValidator.Max(360),
4630
4678
  classValidator.IsOptional(),
4631
- __metadata$8("design:type", Number)
4679
+ __metadata$a("design:type", Number)
4632
4680
  ], AssetImageParams.prototype, "rotation", void 0);
4633
4681
  __decorate$c([
4634
4682
  classValidator.Min(0.0001),
4635
4683
  classValidator.IsOptional(),
4636
- __metadata$8("design:type", Number)
4684
+ __metadata$a("design:type", Number)
4637
4685
  ], AssetImageParams.prototype, "canvasScaleX", void 0);
4638
4686
  __decorate$c([
4639
4687
  classValidator.Min(0.0001),
4640
4688
  classValidator.IsOptional(),
4641
- __metadata$8("design:type", Number)
4689
+ __metadata$a("design:type", Number)
4642
4690
  ], AssetImageParams.prototype, "canvasScaleY", void 0);
4643
4691
  __decorate$c([
4644
4692
  classValidator.Min(0.0001),
4645
4693
  classValidator.IsOptional(),
4646
- __metadata$8("design:type", Number)
4694
+ __metadata$a("design:type", Number)
4647
4695
  ], AssetImageParams.prototype, "scaleX", void 0);
4648
4696
  __decorate$c([
4649
4697
  classValidator.Min(0.0001),
4650
4698
  classValidator.IsOptional(),
4651
- __metadata$8("design:type", Number)
4699
+ __metadata$a("design:type", Number)
4652
4700
  ], AssetImageParams.prototype, "scaleY", void 0);
4653
4701
  __decorate$c([
4654
4702
  classValidator.IsBoolean(),
4655
4703
  classValidator.IsOptional(),
4656
- __metadata$8("design:type", Boolean)
4704
+ __metadata$a("design:type", Boolean)
4657
4705
  ], AssetImageParams.prototype, "lazy", void 0);
4658
4706
  __decorate$c([
4659
4707
  classValidator.IsBoolean(),
4660
4708
  classValidator.IsOptional(),
4661
- __metadata$8("design:type", Boolean)
4709
+ __metadata$a("design:type", Boolean)
4662
4710
  ], AssetImageParams.prototype, "crop", void 0);
4663
4711
  __decorate$c([
4664
4712
  classValidator.IsBoolean(),
4665
4713
  classValidator.IsOptional(),
4666
- __metadata$8("design:type", Boolean)
4714
+ __metadata$a("design:type", Boolean)
4667
4715
  ], AssetImageParams.prototype, "cropBefore", void 0);
4668
4716
  __decorate$c([
4669
4717
  classValidator.IsBoolean(),
4670
4718
  classValidator.IsOptional(),
4671
- __metadata$8("design:type", Boolean)
4719
+ __metadata$a("design:type", Boolean)
4672
4720
  ], AssetImageParams.prototype, "cropAfter", void 0);
4673
4721
 
4674
4722
  var __decorate$b = (this && this.__decorate) || function (decorators, target, key, desc) {
@@ -4681,7 +4729,7 @@
4681
4729
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
4682
4730
  return c > 3 && r && Object.defineProperty(target, key, r), r;
4683
4731
  };
4684
- var __metadata$7 = (this && this.__metadata) || function (k, v) {
4732
+ var __metadata$9 = (this && this.__metadata) || function (k, v) {
4685
4733
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
4686
4734
  return Reflect.metadata(k, v);
4687
4735
  };
@@ -4869,57 +4917,57 @@
4869
4917
  routingControllers.Authorized(),
4870
4918
  routingControllers.Post(""),
4871
4919
  __param$5(0, routingControllers.UploadedFile("file")),
4872
- __metadata$7("design:type", Function),
4873
- __metadata$7("design:paramtypes", [Object]),
4874
- __metadata$7("design:returntype", Promise)
4920
+ __metadata$9("design:type", Function),
4921
+ __metadata$9("design:paramtypes", [Object]),
4922
+ __metadata$9("design:returntype", Promise)
4875
4923
  ], AssetsController.prototype, "upload", null);
4876
4924
  __decorate$b([
4877
4925
  routingControllers.Authorized(),
4878
4926
  routingControllers.Post("url"),
4879
4927
  __param$5(0, routingControllers.Body()),
4880
- __metadata$7("design:type", Function),
4881
- __metadata$7("design:paramtypes", [Object]),
4882
- __metadata$7("design:returntype", Promise)
4928
+ __metadata$9("design:type", Function),
4929
+ __metadata$9("design:paramtypes", [Object]),
4930
+ __metadata$9("design:returntype", Promise)
4883
4931
  ], AssetsController.prototype, "uploadUrl", null);
4884
4932
  __decorate$b([
4885
4933
  routingControllers.Get("/:id"),
4886
4934
  __param$5(0, routingControllers.Param("id")), __param$5(1, routingControllers.QueryParam("lazy")), __param$5(2, routingControllers.Res()),
4887
- __metadata$7("design:type", Function),
4888
- __metadata$7("design:paramtypes", [String, Boolean, Object]),
4889
- __metadata$7("design:returntype", Promise)
4935
+ __metadata$9("design:type", Function),
4936
+ __metadata$9("design:paramtypes", [String, Boolean, Object]),
4937
+ __metadata$9("design:returntype", Promise)
4890
4938
  ], AssetsController.prototype, "getFile", null);
4891
4939
  __decorate$b([
4892
4940
  routingControllers.Get("/image/:id/:rotation"),
4893
4941
  __param$5(0, routingControllers.Param("id")), __param$5(1, routingControllers.QueryParams()), __param$5(2, routingControllers.Res()), __param$5(3, routingControllers.Param("rotation")),
4894
- __metadata$7("design:type", Function),
4895
- __metadata$7("design:paramtypes", [String, AssetImageParams, Object, Number]),
4896
- __metadata$7("design:returntype", Promise)
4942
+ __metadata$9("design:type", Function),
4943
+ __metadata$9("design:paramtypes", [String, AssetImageParams, Object, Number]),
4944
+ __metadata$9("design:returntype", Promise)
4897
4945
  ], AssetsController.prototype, "getImageRotation", null);
4898
4946
  __decorate$b([
4899
4947
  routingControllers.Get("/image/:id"),
4900
4948
  __param$5(0, routingControllers.Param("id")), __param$5(1, routingControllers.QueryParams()), __param$5(2, routingControllers.Res()),
4901
- __metadata$7("design:type", Function),
4902
- __metadata$7("design:paramtypes", [String, AssetImageParams, Object]),
4903
- __metadata$7("design:returntype", Promise)
4949
+ __metadata$9("design:type", Function),
4950
+ __metadata$9("design:paramtypes", [String, AssetImageParams, Object]),
4951
+ __metadata$9("design:returntype", Promise)
4904
4952
  ], AssetsController.prototype, "getImage", null);
4905
4953
  __decorate$b([
4906
4954
  routingControllers.Get("/by-name/:name"),
4907
4955
  __param$5(0, routingControllers.Param("name")), __param$5(1, routingControllers.Res()),
4908
- __metadata$7("design:type", Function),
4909
- __metadata$7("design:paramtypes", [String, Object]),
4910
- __metadata$7("design:returntype", Promise)
4956
+ __metadata$9("design:type", Function),
4957
+ __metadata$9("design:paramtypes", [String, Object]),
4958
+ __metadata$9("design:returntype", Promise)
4911
4959
  ], AssetsController.prototype, "getFileByName", null);
4912
4960
  __decorate$b([
4913
4961
  routingControllers.Get("/by-name/image/:name"),
4914
4962
  __param$5(0, routingControllers.Param("name")), __param$5(1, routingControllers.QueryParams()), __param$5(2, routingControllers.Res()),
4915
- __metadata$7("design:type", Function),
4916
- __metadata$7("design:paramtypes", [String, AssetImageParams, Object]),
4917
- __metadata$7("design:returntype", Promise)
4963
+ __metadata$9("design:type", Function),
4964
+ __metadata$9("design:paramtypes", [String, AssetImageParams, Object]),
4965
+ __metadata$9("design:returntype", Promise)
4918
4966
  ], AssetsController.prototype, "getImageByName", null);
4919
4967
  AssetsController = __decorate$b([
4920
4968
  tsyringe.injectable(),
4921
4969
  routingControllers.Controller("/assets"),
4922
- __metadata$7("design:paramtypes", [exports.Assets, exports.AssetResolver])
4970
+ __metadata$9("design:paramtypes", [exports.Assets, exports.AssetResolver])
4923
4971
  ], AssetsController);
4924
4972
 
4925
4973
  var __decorate$a = (this && this.__decorate) || function (decorators, target, key, desc) {
@@ -4932,7 +4980,7 @@
4932
4980
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
4933
4981
  return c > 3 && r && Object.defineProperty(target, key, r), r;
4934
4982
  };
4935
- var __metadata$6 = (this && this.__metadata) || function (k, v) {
4983
+ var __metadata$8 = (this && this.__metadata) || function (k, v) {
4936
4984
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
4937
4985
  return Reflect.metadata(k, v);
4938
4986
  };
@@ -5010,22 +5058,22 @@
5010
5058
  __decorate$a([
5011
5059
  routingControllers.Post("/login"),
5012
5060
  __param$4(0, routingControllers.Body()), __param$4(1, routingControllers.Res()),
5013
- __metadata$6("design:type", Function),
5014
- __metadata$6("design:paramtypes", [Object, Object]),
5015
- __metadata$6("design:returntype", Promise)
5061
+ __metadata$8("design:type", Function),
5062
+ __metadata$8("design:paramtypes", [Object, Object]),
5063
+ __metadata$8("design:returntype", Promise)
5016
5064
  ], exports.AuthController.prototype, "login", null);
5017
5065
  __decorate$a([
5018
5066
  routingControllers.Authorized(),
5019
5067
  routingControllers.Get("/user"),
5020
5068
  __param$4(0, routingControllers.CurrentUser()),
5021
- __metadata$6("design:type", Function),
5022
- __metadata$6("design:paramtypes", [Object]),
5023
- __metadata$6("design:returntype", void 0)
5069
+ __metadata$8("design:type", Function),
5070
+ __metadata$8("design:paramtypes", [Object]),
5071
+ __metadata$8("design:returntype", void 0)
5024
5072
  ], exports.AuthController.prototype, "getProfile", null);
5025
5073
  exports.AuthController = __decorate$a([
5026
5074
  tsyringe.injectable(),
5027
5075
  routingControllers.Controller(),
5028
- __metadata$6("design:paramtypes", [exports.Configuration, exports.UserManager])
5076
+ __metadata$8("design:paramtypes", [exports.Configuration, exports.UserManager])
5029
5077
  ], exports.AuthController);
5030
5078
 
5031
5079
  var __decorate$9 = (this && this.__decorate) || function (decorators, target, key, desc) {
@@ -5038,7 +5086,7 @@
5038
5086
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5039
5087
  return c > 3 && r && Object.defineProperty(target, key, r), r;
5040
5088
  };
5041
- var __metadata$5 = (this && this.__metadata) || function (k, v) {
5089
+ var __metadata$7 = (this && this.__metadata) || function (k, v) {
5042
5090
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
5043
5091
  return Reflect.metadata(k, v);
5044
5092
  };
@@ -5057,14 +5105,14 @@
5057
5105
  __decorate$9([
5058
5106
  routingControllers.Get("/:id"),
5059
5107
  __param$3(0, routingControllers.Param("id")),
5060
- __metadata$5("design:type", Function),
5061
- __metadata$5("design:paramtypes", [String]),
5062
- __metadata$5("design:returntype", void 0)
5108
+ __metadata$7("design:type", Function),
5109
+ __metadata$7("design:paramtypes", [String]),
5110
+ __metadata$7("design:returntype", void 0)
5063
5111
  ], exports.GalleryController.prototype, "getFile", null);
5064
5112
  exports.GalleryController = __decorate$9([
5065
5113
  tsyringe.injectable(),
5066
5114
  routingControllers.Controller("/gallery"),
5067
- __metadata$5("design:paramtypes", [exports.GalleryCache])
5115
+ __metadata$7("design:paramtypes", [exports.GalleryCache])
5068
5116
  ], exports.GalleryController);
5069
5117
 
5070
5118
  var __decorate$8 = (this && this.__decorate) || function (decorators, target, key, desc) {
@@ -5077,7 +5125,7 @@
5077
5125
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5078
5126
  return c > 3 && r && Object.defineProperty(target, key, r), r;
5079
5127
  };
5080
- var __metadata$4 = (this && this.__metadata) || function (k, v) {
5128
+ var __metadata$6 = (this && this.__metadata) || function (k, v) {
5081
5129
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
5082
5130
  return Reflect.metadata(k, v);
5083
5131
  };
@@ -5132,14 +5180,14 @@
5132
5180
  __decorate$8([
5133
5181
  routingControllers.Get("/:id"),
5134
5182
  __param$2(0, routingControllers.Param("id")),
5135
- __metadata$4("design:type", Function),
5136
- __metadata$4("design:paramtypes", [String]),
5137
- __metadata$4("design:returntype", Promise)
5183
+ __metadata$6("design:type", Function),
5184
+ __metadata$6("design:paramtypes", [String]),
5185
+ __metadata$6("design:returntype", Promise)
5138
5186
  ], ProgressesController.prototype, "getProgress", null);
5139
5187
  ProgressesController = __decorate$8([
5140
5188
  tsyringe.injectable(),
5141
5189
  routingControllers.Controller("/progresses"),
5142
- __metadata$4("design:paramtypes", [exports.Progresses, exports.Configuration])
5190
+ __metadata$6("design:paramtypes", [exports.Progresses, exports.Configuration])
5143
5191
  ], ProgressesController);
5144
5192
 
5145
5193
  var __decorate$7 = (this && this.__decorate) || function (decorators, target, key, desc) {
@@ -5152,7 +5200,7 @@
5152
5200
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5153
5201
  return c > 3 && r && Object.defineProperty(target, key, r), r;
5154
5202
  };
5155
- var __metadata$3 = (this && this.__metadata) || function (k, v) {
5203
+ var __metadata$5 = (this && this.__metadata) || function (k, v) {
5156
5204
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
5157
5205
  return Reflect.metadata(k, v);
5158
5206
  };
@@ -5262,7 +5310,7 @@
5262
5310
  exports.ErrorHandlerMiddleware = __decorate$7([
5263
5311
  tsyringe.injectable(),
5264
5312
  routingControllers.Middleware({ type: "after" }),
5265
- __metadata$3("design:paramtypes", [exports.Configuration, exports.Translator])
5313
+ __metadata$5("design:paramtypes", [exports.Configuration, exports.Translator])
5266
5314
  ], exports.ErrorHandlerMiddleware);
5267
5315
 
5268
5316
  var __decorate$6 = (this && this.__decorate) || function (decorators, target, key, desc) {
@@ -5275,7 +5323,7 @@
5275
5323
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5276
5324
  return c > 3 && r && Object.defineProperty(target, key, r), r;
5277
5325
  };
5278
- var __metadata$2 = (this && this.__metadata) || function (k, v) {
5326
+ var __metadata$4 = (this && this.__metadata) || function (k, v) {
5279
5327
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
5280
5328
  return Reflect.metadata(k, v);
5281
5329
  };
@@ -5296,7 +5344,7 @@
5296
5344
  tsyringe.injectable(),
5297
5345
  routingControllers.Middleware({ type: "before" }),
5298
5346
  __param$1(0, tsyringe.inject(DI_CONTAINER)),
5299
- __metadata$2("design:paramtypes", [Object])
5347
+ __metadata$4("design:paramtypes", [Object])
5300
5348
  ], ContainerMiddleware);
5301
5349
 
5302
5350
  var __decorate$5 = (this && this.__decorate) || function (decorators, target, key, desc) {
@@ -5309,7 +5357,7 @@
5309
5357
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5310
5358
  return c > 3 && r && Object.defineProperty(target, key, r), r;
5311
5359
  };
5312
- var __metadata$1 = (this && this.__metadata) || function (k, v) {
5360
+ var __metadata$3 = (this && this.__metadata) || function (k, v) {
5313
5361
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
5314
5362
  return Reflect.metadata(k, v);
5315
5363
  };
@@ -5326,7 +5374,7 @@
5326
5374
  exports.LanguageMiddleware = __decorate$5([
5327
5375
  tsyringe.injectable(),
5328
5376
  routingControllers.Middleware({ type: "before" }),
5329
- __metadata$1("design:paramtypes", [exports.Configuration])
5377
+ __metadata$3("design:paramtypes", [exports.Configuration])
5330
5378
  ], exports.LanguageMiddleware);
5331
5379
 
5332
5380
  var __decorate$4 = (this && this.__decorate) || function (decorators, target, key, desc) {
@@ -5339,22 +5387,28 @@
5339
5387
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5340
5388
  return c > 3 && r && Object.defineProperty(target, key, r), r;
5341
5389
  };
5390
+ var __metadata$2 = (this && this.__metadata) || function (k, v) {
5391
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
5392
+ return Reflect.metadata(k, v);
5393
+ };
5342
5394
  var RequestEndedMiddleware = /** @class */ (function () {
5343
- function RequestEndedMiddleware() {
5395
+ function RequestEndedMiddleware(logger) {
5396
+ this.logger = logger;
5344
5397
  }
5345
5398
  RequestEndedMiddleware.prototype.use = function (request, response, next) {
5346
5399
  request.ended = moment__default["default"]();
5347
5400
  var diff = request.ended.diff(request.started);
5348
5401
  var duration = moment__default["default"].duration(diff);
5349
- console.log("Request '" + request.id + "' ended at: " + request.ended.format("YYYY-MM-DD HH:mm:ss") + " [" + request.method + "] " + request.url);
5350
- console.log("Request '" + request.id + "' lasted: " + duration.asMilliseconds() + "ms");
5402
+ this.logger.log("request-time", "Request '" + request.id + "' ended at: " + request.ended.format("YYYY-MM-DD HH:mm:ss") + " [" + request.method + "] " + request.url);
5403
+ this.logger.log("request-time", "Request '" + request.id + "' lasted: " + duration.asMilliseconds() + "ms");
5351
5404
  next(null);
5352
5405
  };
5353
5406
  return RequestEndedMiddleware;
5354
5407
  }());
5355
5408
  RequestEndedMiddleware = __decorate$4([
5356
5409
  tsyringe.injectable(),
5357
- routingControllers.Middleware({ type: "after" })
5410
+ routingControllers.Middleware({ type: "after" }),
5411
+ __metadata$2("design:paramtypes", [exports["ɵa"]])
5358
5412
  ], RequestEndedMiddleware);
5359
5413
 
5360
5414
  var __decorate$3 = (this && this.__decorate) || function (decorators, target, key, desc) {
@@ -5367,20 +5421,26 @@
5367
5421
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5368
5422
  return c > 3 && r && Object.defineProperty(target, key, r), r;
5369
5423
  };
5424
+ var __metadata$1 = (this && this.__metadata) || function (k, v) {
5425
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
5426
+ return Reflect.metadata(k, v);
5427
+ };
5370
5428
  var RequestStartedMiddleware = /** @class */ (function () {
5371
- function RequestStartedMiddleware() {
5429
+ function RequestStartedMiddleware(logger) {
5430
+ this.logger = logger;
5372
5431
  }
5373
5432
  RequestStartedMiddleware.prototype.use = function (request, response, next) {
5374
5433
  request.id = new bson.ObjectId().toHexString();
5375
5434
  request.started = moment__default["default"]();
5376
- console.log("Request '" + request.id + "' started at: " + request.started.format("YYYY-MM-DD HH:mm:ss") + " [" + request.method + "] " + request.url);
5435
+ this.logger.log("request-time", "Request '" + request.id + "' started at: " + request.started.format("YYYY-MM-DD HH:mm:ss") + " [" + request.method + "] " + request.url);
5377
5436
  next(null);
5378
5437
  };
5379
5438
  return RequestStartedMiddleware;
5380
5439
  }());
5381
5440
  RequestStartedMiddleware = __decorate$3([
5382
5441
  tsyringe.injectable(),
5383
- routingControllers.Middleware({ type: "before" })
5442
+ routingControllers.Middleware({ type: "before" }),
5443
+ __metadata$1("design:paramtypes", [exports["ɵa"]])
5384
5444
  ], RequestStartedMiddleware);
5385
5445
 
5386
5446
  var __decorate$2 = (this && this.__decorate) || function (decorators, target, key, desc) {
@@ -5579,7 +5639,6 @@
5579
5639
  };
5580
5640
  return BaseDoc;
5581
5641
  }());
5582
- // @ts-ignore
5583
5642
  var PrimitiveArray = mongoose.Types.Array;
5584
5643
  var DocumentArray = mongoose.Types.DocumentArray;
5585
5644
 
@@ -6296,6 +6355,7 @@
6296
6355
  new Parameter("jsonLimit", "250mb"),
6297
6356
  new Parameter("jobTimeout", 5 * 60 * 1000),
6298
6357
  new Parameter("cacheCollection", "cache"),
6358
+ new Parameter("logTags", []),
6299
6359
  ];
6300
6360
  // Convert parameters to providers
6301
6361
  var paramProviders = params.map(function (p) {
@@ -6320,6 +6380,7 @@
6320
6380
  exports.IdGenerator,
6321
6381
  exports.JobManager,
6322
6382
  exports.LazyAssets,
6383
+ exports["ɵa"],
6323
6384
  exports.MailSender,
6324
6385
  exports.MemoryCache,
6325
6386
  exports.MongoConnector,