@stemy/backend 3.4.10 → 3.5.1
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.
- package/bundles/stemy-backend.umd.js +759 -632
- package/bundles/stemy-backend.umd.js.map +1 -1
- package/common-types.d.ts +3 -1
- package/esm2015/common-types.js +2 -1
- package/esm2015/public_api.js +20 -7
- package/esm2015/rest-middlewares/error-handler.middleware.js +5 -1
- package/esm2015/rest-middlewares/request-ended.middleware.js +12 -4
- package/esm2015/rest-middlewares/request-started.middleware.js +11 -3
- package/esm2015/services/configuration.js +19 -13
- package/esm2015/services/entities/lazy-asset.js +5 -4
- package/esm2015/services/job-manager.js +18 -14
- package/esm2015/services/lazy-assets.js +7 -4
- package/esm2015/services/logger.js +29 -0
- package/esm2015/services/open-api.js +76 -0
- package/esm2015/stemy-backend.js +2 -1
- package/esm2015/utilities/decorators.js +8 -0
- package/fesm2015/stemy-backend.js +564 -462
- package/fesm2015/stemy-backend.js.map +1 -1
- package/package.json +1 -1
- package/public_api.d.ts +3 -1
- package/rest-middlewares/request-ended.middleware.d.ts +3 -0
- package/rest-middlewares/request-started.middleware.d.ts +3 -0
- package/services/configuration.d.ts +4 -0
- package/services/entities/lazy-asset.d.ts +3 -1
- package/services/job-manager.d.ts +3 -1
- package/services/lazy-assets.d.ts +3 -1
- package/services/logger.d.ts +7 -0
- package/services/open-api.d.ts +11 -0
- package/stemy-backend.d.ts +1 -0
- package/stemy-backend.metadata.json +1 -1
- package/utilities/decorators.d.ts +1 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('path'), require('body-parser'), require('jsonwebtoken'), require('tsyringe'), require('routing-controllers'), require('socket-controllers'), require('
|
|
3
|
-
typeof define === 'function' && define.amd ? define('@stemy/backend', ['exports', 'path', 'body-parser', 'jsonwebtoken', 'tsyringe', 'routing-controllers', 'socket-controllers', '
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.stemy = global.stemy || {}, global.stemy.backend = {}), global.path, global["body-parser"], global.jsonwebtoken, global.tsyringe, global["routing-controllers"], global["socket-controllers"], global
|
|
5
|
-
})(this, (function (exports, path, bodyParser, jsonwebtoken, tsyringe, routingControllers, socketControllers,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('path'), require('body-parser'), require('jsonwebtoken'), require('tsyringe'), require('routing-controllers'), require('socket-controllers'), require('fontkit'), require('file-type'), require('sharp'), require('bson'), require('axios'), require('child_process'), require('crypto'), require('rxjs'), require('rxjs/internal/util/canReportError'), require('fs'), require('mongodb'), require('mongoose'), require('stream'), require('dotenv'), require('node-cron'), require('zeromq'), require('rxjs/operators'), require('http'), require('express'), require('socket.io'), require('uuid'), require('nodemailer'), require('handlebars'), require('routing-controllers-openapi'), require('class-validator-jsonschema'), require('class-transformer/storage'), require('class-validator'), require('bcrypt'), require('moment'), require('@typegoose/typegoose'), require('mongoose/lib/utils')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define('@stemy/backend', ['exports', 'path', 'body-parser', 'jsonwebtoken', 'tsyringe', 'routing-controllers', 'socket-controllers', 'fontkit', 'file-type', 'sharp', 'bson', 'axios', 'child_process', 'crypto', 'rxjs', 'rxjs/internal/util/canReportError', 'fs', 'mongodb', 'mongoose', 'stream', 'dotenv', 'node-cron', 'zeromq', 'rxjs/operators', 'http', 'express', 'socket.io', 'uuid', 'nodemailer', 'handlebars', 'routing-controllers-openapi', 'class-validator-jsonschema', 'class-transformer/storage', 'class-validator', 'bcrypt', 'moment', '@typegoose/typegoose', 'mongoose/lib/utils'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.stemy = global.stemy || {}, global.stemy.backend = {}), global.path, global["body-parser"], global.jsonwebtoken, global.tsyringe, global["routing-controllers"], global["socket-controllers"], global.fontkit, global["file-type"], global.sharp, global.bson, global.axios, global.child_process, global.crypto, global.rxjs, global.rxjs["internal/util/canReportError"], global.fs, global.mongodb, global.mongoose, global.stream, global.dotenv, global["node-cron"], global.zeromq, global.rxjs.operators, global.http, global.express, global.socket.io, global.uuid, global.nodemailer, global.handlebars, global["routing-controllers-openapi"], global["class-validator-jsonschema"], global["class-transformer/storage"], global["class-validator"], global.bcrypt, global.moment, global.typegoose, global["mongoose-lib-utils"]));
|
|
5
|
+
})(this, (function (exports, path, bodyParser, jsonwebtoken, tsyringe, routingControllers, socketControllers, fontKit_, fileType, sharp_, bson, axios, child_process, crypto, rxjs, canReportError, fs, mongodb, mongoose, stream, dotenv, nodeCron, zeromq, operators, http, express_, socket_io, uuid, nodemailer, Handlebars, routingControllersOpenapi, classValidatorJsonschema, storage, classValidator, bcrypt, moment, typegoose, utils) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
return Object.freeze(n);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
var sharp___default = /*#__PURE__*/_interopDefaultLegacy(sharp_);
|
|
28
27
|
var fontKit___default = /*#__PURE__*/_interopDefaultLegacy(fontKit_);
|
|
28
|
+
var sharp___default = /*#__PURE__*/_interopDefaultLegacy(sharp_);
|
|
29
29
|
var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
|
|
30
30
|
var dotenv__default = /*#__PURE__*/_interopDefaultLegacy(dotenv);
|
|
31
31
|
var express___default = /*#__PURE__*/_interopDefaultLegacy(express_);
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
}
|
|
88
88
|
return t;
|
|
89
89
|
}
|
|
90
|
-
function __decorate$
|
|
90
|
+
function __decorate$C(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);
|
|
@@ -97,10 +97,10 @@
|
|
|
97
97
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
98
98
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
99
99
|
}
|
|
100
|
-
function __param$
|
|
100
|
+
function __param$a(paramIndex, decorator) {
|
|
101
101
|
return function (target, key) { decorator(target, key, paramIndex); };
|
|
102
102
|
}
|
|
103
|
-
function __metadata$
|
|
103
|
+
function __metadata$v(metadataKey, metadataValue) {
|
|
104
104
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
105
105
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
106
106
|
}
|
|
@@ -360,6 +360,37 @@
|
|
|
360
360
|
return typeof state === "function" ? receiver === state : state.has(receiver);
|
|
361
361
|
}
|
|
362
362
|
|
|
363
|
+
// --- DI functions ---
|
|
364
|
+
var Type = Function;
|
|
365
|
+
// --- Injection tokens ---
|
|
366
|
+
var FIXTURE = Symbol.for("fixture-token");
|
|
367
|
+
var JOB = Symbol.for("job-token");
|
|
368
|
+
var EXPRESS = Symbol.for("express-token");
|
|
369
|
+
var HTTP_SERVER = Symbol.for("http-server-token");
|
|
370
|
+
var SOCKET_SERVER = Symbol.for("socket-server-token");
|
|
371
|
+
var PARAMETER = Symbol.for("parameter-token");
|
|
372
|
+
var DI_CONTAINER = Symbol.for("di-container-token");
|
|
373
|
+
var OPENAPI_VALIDATION = Symbol.for("openapi-validation-token");
|
|
374
|
+
var Parameter = /** @class */ (function () {
|
|
375
|
+
function Parameter(name, defaultValue, resolver) {
|
|
376
|
+
if (resolver === void 0) { resolver = null; }
|
|
377
|
+
this.name = name;
|
|
378
|
+
this.defaultValue = defaultValue;
|
|
379
|
+
this.resolver = resolver;
|
|
380
|
+
}
|
|
381
|
+
return Parameter;
|
|
382
|
+
}());
|
|
383
|
+
|
|
384
|
+
var __decorate$B = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
385
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
386
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
387
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
388
|
+
else
|
|
389
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
390
|
+
if (d = decorators[i])
|
|
391
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
392
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
393
|
+
};
|
|
363
394
|
var __awaiter$y = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
364
395
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
365
396
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -379,7 +410,161 @@
|
|
|
379
410
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
380
411
|
});
|
|
381
412
|
};
|
|
413
|
+
var AssetProcessor_1;
|
|
382
414
|
var sharp$3 = sharp___default["default"];
|
|
415
|
+
var fontKit = fontKit___default["default"];
|
|
416
|
+
var fontTypes = [
|
|
417
|
+
"application/font-woff", "application/font-woff2", "application/x-font-opentype", "application/x-font-truetype", "application/x-font-datafork",
|
|
418
|
+
"font/woff", "font/woff2", "font/otf", "font/ttf", "font/datafork"
|
|
419
|
+
];
|
|
420
|
+
var imageTypes = ["image/jpeg", "image/jpg", "image/png", "image/svg+xml"];
|
|
421
|
+
var fontProps = [
|
|
422
|
+
"postscriptName", "fullName", "familyName", "subfamilyName",
|
|
423
|
+
"copyright", "version", "unitsPerEm", "ascent", "descent", "lineGap",
|
|
424
|
+
"underlinePosition", "underlineThickness", "italicAngle", "capHeight",
|
|
425
|
+
"xHeight", "numGlyphs", "characterSet", "availableFeatures"
|
|
426
|
+
];
|
|
427
|
+
exports.AssetProcessor = AssetProcessor_1 = /** @class */ (function () {
|
|
428
|
+
function AssetProcessor() {
|
|
429
|
+
}
|
|
430
|
+
AssetProcessor.checkTextFileType = function (type) {
|
|
431
|
+
return type.mime.indexOf("text") >= 0 || type.mime.indexOf("xml") >= 0;
|
|
432
|
+
};
|
|
433
|
+
AssetProcessor.fixTextFileType = function (type, buffer) {
|
|
434
|
+
var text = buffer.toString("utf8");
|
|
435
|
+
if (text.indexOf("<svg") >= 0) {
|
|
436
|
+
return { ext: "svg", mime: "image/svg+xml" };
|
|
437
|
+
}
|
|
438
|
+
return type;
|
|
439
|
+
};
|
|
440
|
+
AssetProcessor.fileTypeFromBuffer = function (buffer) {
|
|
441
|
+
var _a;
|
|
442
|
+
return __awaiter$y(this, void 0, void 0, function () {
|
|
443
|
+
var type;
|
|
444
|
+
return __generator(this, function (_b) {
|
|
445
|
+
switch (_b.label) {
|
|
446
|
+
case 0: return [4 /*yield*/, fileType.fromBuffer(buffer)];
|
|
447
|
+
case 1:
|
|
448
|
+
type = ((_a = _b.sent()) !== null && _a !== void 0 ? _a : { ext: "txt", mime: "text/plain" });
|
|
449
|
+
if (AssetProcessor_1.checkTextFileType(type)) {
|
|
450
|
+
return [2 /*return*/, AssetProcessor_1.fixTextFileType(type, buffer)];
|
|
451
|
+
}
|
|
452
|
+
return [2 /*return*/, type];
|
|
453
|
+
}
|
|
454
|
+
});
|
|
455
|
+
});
|
|
456
|
+
};
|
|
457
|
+
AssetProcessor.extractFontFormat = function (font) {
|
|
458
|
+
var name = font.constructor.name;
|
|
459
|
+
var tag = font["directory"].tag;
|
|
460
|
+
switch (name) {
|
|
461
|
+
case "TTFFont":
|
|
462
|
+
return tag === "OTTO" ? "opentype" : "truetype";
|
|
463
|
+
case "WOFF2Font":
|
|
464
|
+
return "woff2";
|
|
465
|
+
case "WOFFFont":
|
|
466
|
+
return "woff";
|
|
467
|
+
case "DFont":
|
|
468
|
+
return "datafork";
|
|
469
|
+
}
|
|
470
|
+
return null;
|
|
471
|
+
};
|
|
472
|
+
AssetProcessor.isImage = function (contentType) {
|
|
473
|
+
return imageTypes.indexOf(contentType) >= 0;
|
|
474
|
+
};
|
|
475
|
+
AssetProcessor.copyImageMeta = function (buffer, metadata, fileType) {
|
|
476
|
+
return __awaiter$y(this, void 0, void 0, function () {
|
|
477
|
+
var match, attrs, parts, output;
|
|
478
|
+
return __generator(this, function (_b) {
|
|
479
|
+
switch (_b.label) {
|
|
480
|
+
case 0:
|
|
481
|
+
if (fileType.mime === "image/svg+xml") {
|
|
482
|
+
match = /<svg([^<>]+)>/gi.exec(buffer.toString("utf8"));
|
|
483
|
+
if (match && match.length > 1) {
|
|
484
|
+
attrs = match[1].match(/([a-z]+)="([^"]+)"/gi);
|
|
485
|
+
attrs.forEach(function (attr) {
|
|
486
|
+
if (attr.length < 5)
|
|
487
|
+
return;
|
|
488
|
+
var _b = __read(attr.split("="), 2), name = _b[0], value = _b[1];
|
|
489
|
+
var val = value.replace(/"/gi, "");
|
|
490
|
+
metadata[name] = isNaN(val) ? val : Number(val);
|
|
491
|
+
});
|
|
492
|
+
if (metadata.viewBox && (isNaN(metadata.width) || isNaN(metadata.height))) {
|
|
493
|
+
parts = metadata.viewBox.split(" ");
|
|
494
|
+
metadata.width = Number(parts[0]) + Number(parts[2]);
|
|
495
|
+
metadata.height = Number(parts[1]) + Number(parts[3]);
|
|
496
|
+
}
|
|
497
|
+
if (!isNaN(metadata.width) && !isNaN(metadata.height)) {
|
|
498
|
+
metadata.svgSize = { x: metadata.width, y: metadata.height };
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
return [2 /*return*/, buffer];
|
|
502
|
+
}
|
|
503
|
+
return [4 /*yield*/, sharp$3(buffer).rotate().toBuffer({ resolveWithObject: true })];
|
|
504
|
+
case 1:
|
|
505
|
+
output = _b.sent();
|
|
506
|
+
Object.assign(metadata, output.info);
|
|
507
|
+
return [2 /*return*/, output.data];
|
|
508
|
+
}
|
|
509
|
+
});
|
|
510
|
+
});
|
|
511
|
+
};
|
|
512
|
+
AssetProcessor.isFont = function (contentType) {
|
|
513
|
+
return fontTypes.indexOf(contentType) >= 0;
|
|
514
|
+
};
|
|
515
|
+
AssetProcessor.copyFontMeta = function (buffer, metadata) {
|
|
516
|
+
var font = fontKit.create(buffer);
|
|
517
|
+
metadata.format = AssetProcessor_1.extractFontFormat(font);
|
|
518
|
+
fontProps.forEach(function (prop) {
|
|
519
|
+
metadata[prop] = font[prop];
|
|
520
|
+
});
|
|
521
|
+
};
|
|
522
|
+
AssetProcessor.prototype.process = function (buffer, metadata, fileType) {
|
|
523
|
+
return __awaiter$y(this, void 0, void 0, function () {
|
|
524
|
+
return __generator(this, function (_b) {
|
|
525
|
+
switch (_b.label) {
|
|
526
|
+
case 0:
|
|
527
|
+
if (!AssetProcessor_1.isImage(fileType.mime)) return [3 /*break*/, 2];
|
|
528
|
+
return [4 /*yield*/, AssetProcessor_1.copyImageMeta(buffer, metadata, fileType)];
|
|
529
|
+
case 1:
|
|
530
|
+
buffer = _b.sent();
|
|
531
|
+
_b.label = 2;
|
|
532
|
+
case 2:
|
|
533
|
+
if (AssetProcessor_1.isFont(fileType.mime)) {
|
|
534
|
+
AssetProcessor_1.copyFontMeta(buffer, metadata);
|
|
535
|
+
}
|
|
536
|
+
return [2 /*return*/, buffer];
|
|
537
|
+
}
|
|
538
|
+
});
|
|
539
|
+
});
|
|
540
|
+
};
|
|
541
|
+
return AssetProcessor;
|
|
542
|
+
}());
|
|
543
|
+
exports.AssetProcessor = AssetProcessor_1 = __decorate$B([
|
|
544
|
+
tsyringe.injectable(),
|
|
545
|
+
tsyringe.scoped(tsyringe.Lifecycle.ContainerScoped)
|
|
546
|
+
], exports.AssetProcessor);
|
|
547
|
+
|
|
548
|
+
var __awaiter$x = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
549
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
550
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
551
|
+
function fulfilled(value) { try {
|
|
552
|
+
step(generator.next(value));
|
|
553
|
+
}
|
|
554
|
+
catch (e) {
|
|
555
|
+
reject(e);
|
|
556
|
+
} }
|
|
557
|
+
function rejected(value) { try {
|
|
558
|
+
step(generator["throw"](value));
|
|
559
|
+
}
|
|
560
|
+
catch (e) {
|
|
561
|
+
reject(e);
|
|
562
|
+
} }
|
|
563
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
564
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
565
|
+
});
|
|
566
|
+
};
|
|
567
|
+
var sharp$2 = sharp___default["default"];
|
|
383
568
|
var diContainers = {
|
|
384
569
|
appContainer: null
|
|
385
570
|
};
|
|
@@ -560,7 +745,7 @@
|
|
|
560
745
|
};
|
|
561
746
|
}
|
|
562
747
|
function toImage(src, params, meta) {
|
|
563
|
-
return __awaiter$
|
|
748
|
+
return __awaiter$x(this, void 0, void 0, function () {
|
|
564
749
|
var crop, buffer, _a, cropBefore, cropAfter, img, _b, width, height, canvasScaleX, canvasScaleY, e_2;
|
|
565
750
|
return __generator(this, function (_c) {
|
|
566
751
|
switch (_c.label) {
|
|
@@ -595,7 +780,7 @@
|
|
|
595
780
|
_c.trys.push([4, 9, , 10]);
|
|
596
781
|
cropBefore = toCropRegion(params.cropBefore || (params.crop ? meta.cropBefore : null));
|
|
597
782
|
cropAfter = toCropRegion(params.cropAfter || (params.crop ? meta.cropAfter : null));
|
|
598
|
-
img = sharp$
|
|
783
|
+
img = sharp$2(buffer);
|
|
599
784
|
return [4 /*yield*/, img.metadata()];
|
|
600
785
|
case 5:
|
|
601
786
|
_b = _c.sent(), width = _b.width, height = _b.height;
|
|
@@ -631,7 +816,7 @@
|
|
|
631
816
|
return [4 /*yield*/, img.toBuffer()];
|
|
632
817
|
case 6:
|
|
633
818
|
buffer = _c.sent();
|
|
634
|
-
img = sharp$
|
|
819
|
+
img = sharp$2(buffer).rotate(params.rotation);
|
|
635
820
|
_c.label = 7;
|
|
636
821
|
case 7: return [4 /*yield*/, img.toBuffer()];
|
|
637
822
|
case 8:
|
|
@@ -721,7 +906,7 @@
|
|
|
721
906
|
}
|
|
722
907
|
function readAndDeleteFile(path, timeout) {
|
|
723
908
|
if (timeout === void 0) { timeout = 5000; }
|
|
724
|
-
return __awaiter$
|
|
909
|
+
return __awaiter$x(this, void 0, void 0, function () {
|
|
725
910
|
var data;
|
|
726
911
|
return __generator(this, function (_a) {
|
|
727
912
|
switch (_a.label) {
|
|
@@ -738,7 +923,7 @@
|
|
|
738
923
|
});
|
|
739
924
|
}
|
|
740
925
|
function writeFile(path$1, data) {
|
|
741
|
-
return __awaiter$
|
|
926
|
+
return __awaiter$x(this, void 0, void 0, function () {
|
|
742
927
|
return __generator(this, function (_a) {
|
|
743
928
|
switch (_a.label) {
|
|
744
929
|
case 0: return [4 /*yield*/, mkdirRecursive(path.dirname(path$1))];
|
|
@@ -1002,366 +1187,87 @@
|
|
|
1002
1187
|
while (!line && lines.length > 0) {
|
|
1003
1188
|
line = lines.pop();
|
|
1004
1189
|
}
|
|
1005
|
-
resolve(line);
|
|
1006
|
-
});
|
|
1007
|
-
cp.stdout.on("data", function (data) {
|
|
1008
|
-
console.log(data.toString());
|
|
1009
|
-
});
|
|
1010
|
-
cp.stderr.on("data", function (data) {
|
|
1011
|
-
console.error(data.toString());
|
|
1012
|
-
});
|
|
1013
|
-
});
|
|
1014
|
-
}
|
|
1015
|
-
exports.ConsoleColor = void 0;
|
|
1016
|
-
(function (ConsoleColor) {
|
|
1017
|
-
ConsoleColor["Reset"] = "\u001B[0m";
|
|
1018
|
-
ConsoleColor["Bright"] = "\u001B[1m";
|
|
1019
|
-
ConsoleColor["Dim"] = "\u001B[2m";
|
|
1020
|
-
ConsoleColor["Underscore"] = "\u001B[4m";
|
|
1021
|
-
ConsoleColor["Blink"] = "\u001B[5m";
|
|
1022
|
-
ConsoleColor["Reverse"] = "\u001B[7m";
|
|
1023
|
-
ConsoleColor["Hidden"] = "\u001B[8m";
|
|
1024
|
-
ConsoleColor["FgBlack"] = "\u001B[30m";
|
|
1025
|
-
ConsoleColor["FgRed"] = "\u001B[31m";
|
|
1026
|
-
ConsoleColor["FgGreen"] = "\u001B[32m";
|
|
1027
|
-
ConsoleColor["FgYellow"] = "\u001B[33m";
|
|
1028
|
-
ConsoleColor["FgBlue"] = "\u001B[34m";
|
|
1029
|
-
ConsoleColor["FgMagenta"] = "\u001B[35m";
|
|
1030
|
-
ConsoleColor["FgCyan"] = "\u001B[36m";
|
|
1031
|
-
ConsoleColor["FgWhite"] = "\u001B[37m";
|
|
1032
|
-
ConsoleColor["FgDefault"] = "\u001B[38m";
|
|
1033
|
-
ConsoleColor["BgBlack"] = "\u001B[40m";
|
|
1034
|
-
ConsoleColor["BgRed"] = "\u001B[41m";
|
|
1035
|
-
ConsoleColor["BgGreen"] = "\u001B[42m";
|
|
1036
|
-
ConsoleColor["BgYellow"] = "\u001B[43m";
|
|
1037
|
-
ConsoleColor["BgBlue"] = "\u001B[44m";
|
|
1038
|
-
ConsoleColor["BgMagenta"] = "\u001B[45m";
|
|
1039
|
-
ConsoleColor["BgCyan"] = "\u001B[46m";
|
|
1040
|
-
ConsoleColor["BgWhite"] = "\u001B[47m";
|
|
1041
|
-
ConsoleColor["BgDefault"] = "\u001B[48m";
|
|
1042
|
-
})(exports.ConsoleColor || (exports.ConsoleColor = {}));
|
|
1043
|
-
var defaultColors = {
|
|
1044
|
-
keyColor: exports.ConsoleColor.FgWhite,
|
|
1045
|
-
numberColor: exports.ConsoleColor.FgBlue,
|
|
1046
|
-
stringColor: exports.ConsoleColor.FgYellow,
|
|
1047
|
-
trueColor: exports.ConsoleColor.FgGreen,
|
|
1048
|
-
falseColor: exports.ConsoleColor.FgRed,
|
|
1049
|
-
nullColor: exports.ConsoleColor.BgMagenta
|
|
1050
|
-
};
|
|
1051
|
-
function colorize(input, color) {
|
|
1052
|
-
return "" + color + input + exports.ConsoleColor.Reset;
|
|
1053
|
-
}
|
|
1054
|
-
function jsonHighlight(input, colorOptions) {
|
|
1055
|
-
var colors = Object.assign({}, defaultColors, colorOptions);
|
|
1056
|
-
var json = (isString(input) ? input : JSON.stringify(input, null, 2)).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
|
|
1057
|
-
return json.replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+]?\d+)?)/g, function (match) {
|
|
1058
|
-
var color = colors.numberColor;
|
|
1059
|
-
if (/^"/.test(match)) {
|
|
1060
|
-
if (/:$/.test(match)) {
|
|
1061
|
-
color = colors.keyColor;
|
|
1062
|
-
}
|
|
1063
|
-
else {
|
|
1064
|
-
color = colors.stringColor;
|
|
1065
|
-
match = '"' + match.substr(1, match.length - 2) + '"';
|
|
1066
|
-
}
|
|
1067
|
-
}
|
|
1068
|
-
else {
|
|
1069
|
-
color = /true/.test(match)
|
|
1070
|
-
? colors.trueColor
|
|
1071
|
-
: /false/.test(match)
|
|
1072
|
-
? colors.falseColor
|
|
1073
|
-
: /null/.test(match)
|
|
1074
|
-
? colors.nullColor
|
|
1075
|
-
: color;
|
|
1076
|
-
}
|
|
1077
|
-
return "" + color + match + exports.ConsoleColor.Reset;
|
|
1078
|
-
});
|
|
1079
|
-
}
|
|
1080
|
-
function replaceSpecialChars(str, to) {
|
|
1081
|
-
if (to === void 0) { to = "-"; }
|
|
1082
|
-
return ("" + str).replace(/[&\/\\#, +()$~%.@'":*?<>{}]/g, to);
|
|
1083
|
-
}
|
|
1084
|
-
|
|
1085
|
-
var __decorate$z = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
1086
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1087
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
1088
|
-
r = Reflect.decorate(decorators, target, key, desc);
|
|
1089
|
-
else
|
|
1090
|
-
for (var i = decorators.length - 1; i >= 0; i--)
|
|
1091
|
-
if (d = decorators[i])
|
|
1092
|
-
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1093
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1094
|
-
};
|
|
1095
|
-
function checkValue(multi, value) {
|
|
1096
|
-
if (multi) {
|
|
1097
|
-
return Array.isArray(value) && value.every(function (v) {
|
|
1098
|
-
try {
|
|
1099
|
-
var id = new bson.ObjectId(v);
|
|
1100
|
-
return id instanceof bson.ObjectId;
|
|
1101
|
-
}
|
|
1102
|
-
catch (e) {
|
|
1103
|
-
return false;
|
|
1104
|
-
}
|
|
1105
|
-
});
|
|
1106
|
-
}
|
|
1107
|
-
if (null === value)
|
|
1108
|
-
return true;
|
|
1109
|
-
try {
|
|
1110
|
-
var id = new bson.ObjectId(value);
|
|
1111
|
-
return id instanceof bson.ObjectId;
|
|
1112
|
-
}
|
|
1113
|
-
catch (e) {
|
|
1114
|
-
return false;
|
|
1115
|
-
}
|
|
1116
|
-
}
|
|
1117
|
-
exports.IsFile = /** @class */ (function () {
|
|
1118
|
-
function IsFile() {
|
|
1119
|
-
}
|
|
1120
|
-
IsFile.prototype.validate = function (value, validationArguments) {
|
|
1121
|
-
var _a = __read((validationArguments.constraints || []), 1), multi = _a[0];
|
|
1122
|
-
return checkValue(multi, value);
|
|
1123
|
-
};
|
|
1124
|
-
return IsFile;
|
|
1125
|
-
}());
|
|
1126
|
-
exports.IsFile = __decorate$z([
|
|
1127
|
-
classValidator.ValidatorConstraint()
|
|
1128
|
-
], exports.IsFile);
|
|
1129
|
-
exports.IsObjectId = /** @class */ (function () {
|
|
1130
|
-
function IsObjectId() {
|
|
1131
|
-
}
|
|
1132
|
-
IsObjectId.prototype.validate = function (value, validationArguments) {
|
|
1133
|
-
var _a = __read((validationArguments.constraints || []), 2), _ = _a[0], multi = _a[1];
|
|
1134
|
-
return checkValue(multi, value);
|
|
1135
|
-
};
|
|
1136
|
-
return IsObjectId;
|
|
1137
|
-
}());
|
|
1138
|
-
exports.IsObjectId = __decorate$z([
|
|
1139
|
-
classValidator.ValidatorConstraint()
|
|
1140
|
-
], exports.IsObjectId);
|
|
1141
|
-
|
|
1142
|
-
var apiDocs = null;
|
|
1143
|
-
function getApiDocs(customValidation) {
|
|
1144
|
-
var _a;
|
|
1145
|
-
if (apiDocs)
|
|
1146
|
-
return apiDocs;
|
|
1147
|
-
var storage$1 = routingControllers.getMetadataArgsStorage();
|
|
1148
|
-
var spec = routingControllersOpenapi.routingControllersToSpec(storage$1);
|
|
1149
|
-
spec.basePath = "/api/";
|
|
1150
|
-
spec.definitions = classValidatorJsonschema.validationMetadatasToSchemas({
|
|
1151
|
-
classTransformerMetadataStorage: storage.defaultMetadataStorage,
|
|
1152
|
-
additionalConverters: (_a = {},
|
|
1153
|
-
_a[classValidator.ValidationTypes.CUSTOM_VALIDATION] = function (meta, options) {
|
|
1154
|
-
var res = isFunction(customValidation) ? customValidation(meta, options) : customValidation;
|
|
1155
|
-
if (!!res)
|
|
1156
|
-
return res;
|
|
1157
|
-
var constraints = meta.constraints || [];
|
|
1158
|
-
if (meta.constraintCls === exports.IsFile) {
|
|
1159
|
-
return {
|
|
1160
|
-
multi: constraints[0] || false,
|
|
1161
|
-
type: "file"
|
|
1162
|
-
};
|
|
1163
|
-
}
|
|
1164
|
-
if (meta.constraintCls === exports.IsObjectId) {
|
|
1165
|
-
return {
|
|
1166
|
-
endpoint: constraints[0] || false,
|
|
1167
|
-
multi: constraints[1] || false,
|
|
1168
|
-
type: "list"
|
|
1169
|
-
};
|
|
1170
|
-
}
|
|
1171
|
-
return null;
|
|
1172
|
-
},
|
|
1173
|
-
_a)
|
|
1174
|
-
});
|
|
1175
|
-
spec.components.schemas = spec.definitions;
|
|
1176
|
-
apiDocs = JSON.stringify(spec);
|
|
1177
|
-
return apiDocs;
|
|
1178
|
-
}
|
|
1179
|
-
|
|
1180
|
-
// --- DI functions ---
|
|
1181
|
-
var Type = Function;
|
|
1182
|
-
// --- Injection tokens ---
|
|
1183
|
-
var FIXTURE = Symbol.for("fixture-token");
|
|
1184
|
-
var JOB = Symbol.for("job-token");
|
|
1185
|
-
var EXPRESS = Symbol.for("express-token");
|
|
1186
|
-
var HTTP_SERVER = Symbol.for("http-server-token");
|
|
1187
|
-
var SOCKET_SERVER = Symbol.for("socket-server-token");
|
|
1188
|
-
var PARAMETER = Symbol.for("parameter-token");
|
|
1189
|
-
var DI_CONTAINER = Symbol.for("di-container-token");
|
|
1190
|
-
var Parameter = /** @class */ (function () {
|
|
1191
|
-
function Parameter(name, defaultValue, resolver) {
|
|
1192
|
-
if (resolver === void 0) { resolver = null; }
|
|
1193
|
-
this.name = name;
|
|
1194
|
-
this.defaultValue = defaultValue;
|
|
1195
|
-
this.resolver = resolver;
|
|
1196
|
-
}
|
|
1197
|
-
return Parameter;
|
|
1198
|
-
}());
|
|
1199
|
-
|
|
1200
|
-
var __decorate$y = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
1201
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1202
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
1203
|
-
r = Reflect.decorate(decorators, target, key, desc);
|
|
1204
|
-
else
|
|
1205
|
-
for (var i = decorators.length - 1; i >= 0; i--)
|
|
1206
|
-
if (d = decorators[i])
|
|
1207
|
-
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1208
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1209
|
-
};
|
|
1210
|
-
var __awaiter$x = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
1211
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
1212
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
1213
|
-
function fulfilled(value) { try {
|
|
1214
|
-
step(generator.next(value));
|
|
1215
|
-
}
|
|
1216
|
-
catch (e) {
|
|
1217
|
-
reject(e);
|
|
1218
|
-
} }
|
|
1219
|
-
function rejected(value) { try {
|
|
1220
|
-
step(generator["throw"](value));
|
|
1221
|
-
}
|
|
1222
|
-
catch (e) {
|
|
1223
|
-
reject(e);
|
|
1224
|
-
} }
|
|
1225
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
1226
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
1227
|
-
});
|
|
1228
|
-
};
|
|
1229
|
-
var AssetProcessor_1;
|
|
1230
|
-
var sharp$2 = sharp___default["default"];
|
|
1231
|
-
var fontKit = fontKit___default["default"];
|
|
1232
|
-
var fontTypes = [
|
|
1233
|
-
"application/font-woff", "application/font-woff2", "application/x-font-opentype", "application/x-font-truetype", "application/x-font-datafork",
|
|
1234
|
-
"font/woff", "font/woff2", "font/otf", "font/ttf", "font/datafork"
|
|
1235
|
-
];
|
|
1236
|
-
var imageTypes = ["image/jpeg", "image/jpg", "image/png", "image/svg+xml"];
|
|
1237
|
-
var fontProps = [
|
|
1238
|
-
"postscriptName", "fullName", "familyName", "subfamilyName",
|
|
1239
|
-
"copyright", "version", "unitsPerEm", "ascent", "descent", "lineGap",
|
|
1240
|
-
"underlinePosition", "underlineThickness", "italicAngle", "capHeight",
|
|
1241
|
-
"xHeight", "numGlyphs", "characterSet", "availableFeatures"
|
|
1242
|
-
];
|
|
1243
|
-
exports.AssetProcessor = AssetProcessor_1 = /** @class */ (function () {
|
|
1244
|
-
function AssetProcessor() {
|
|
1245
|
-
}
|
|
1246
|
-
AssetProcessor.checkTextFileType = function (type) {
|
|
1247
|
-
return type.mime.indexOf("text") >= 0 || type.mime.indexOf("xml") >= 0;
|
|
1248
|
-
};
|
|
1249
|
-
AssetProcessor.fixTextFileType = function (type, buffer) {
|
|
1250
|
-
var text = buffer.toString("utf8");
|
|
1251
|
-
if (text.indexOf("<svg") >= 0) {
|
|
1252
|
-
return { ext: "svg", mime: "image/svg+xml" };
|
|
1253
|
-
}
|
|
1254
|
-
return type;
|
|
1255
|
-
};
|
|
1256
|
-
AssetProcessor.fileTypeFromBuffer = function (buffer) {
|
|
1257
|
-
var _a;
|
|
1258
|
-
return __awaiter$x(this, void 0, void 0, function () {
|
|
1259
|
-
var type;
|
|
1260
|
-
return __generator(this, function (_b) {
|
|
1261
|
-
switch (_b.label) {
|
|
1262
|
-
case 0: return [4 /*yield*/, fileType.fromBuffer(buffer)];
|
|
1263
|
-
case 1:
|
|
1264
|
-
type = ((_a = _b.sent()) !== null && _a !== void 0 ? _a : { ext: "txt", mime: "text/plain" });
|
|
1265
|
-
if (AssetProcessor_1.checkTextFileType(type)) {
|
|
1266
|
-
return [2 /*return*/, AssetProcessor_1.fixTextFileType(type, buffer)];
|
|
1267
|
-
}
|
|
1268
|
-
return [2 /*return*/, type];
|
|
1269
|
-
}
|
|
1270
|
-
});
|
|
1271
|
-
});
|
|
1272
|
-
};
|
|
1273
|
-
AssetProcessor.extractFontFormat = function (font) {
|
|
1274
|
-
var name = font.constructor.name;
|
|
1275
|
-
var tag = font["directory"].tag;
|
|
1276
|
-
switch (name) {
|
|
1277
|
-
case "TTFFont":
|
|
1278
|
-
return tag === "OTTO" ? "opentype" : "truetype";
|
|
1279
|
-
case "WOFF2Font":
|
|
1280
|
-
return "woff2";
|
|
1281
|
-
case "WOFFFont":
|
|
1282
|
-
return "woff";
|
|
1283
|
-
case "DFont":
|
|
1284
|
-
return "datafork";
|
|
1285
|
-
}
|
|
1286
|
-
return null;
|
|
1287
|
-
};
|
|
1288
|
-
AssetProcessor.isImage = function (contentType) {
|
|
1289
|
-
return imageTypes.indexOf(contentType) >= 0;
|
|
1290
|
-
};
|
|
1291
|
-
AssetProcessor.copyImageMeta = function (buffer, metadata, fileType) {
|
|
1292
|
-
return __awaiter$x(this, void 0, void 0, function () {
|
|
1293
|
-
var match, attrs, parts, output;
|
|
1294
|
-
return __generator(this, function (_b) {
|
|
1295
|
-
switch (_b.label) {
|
|
1296
|
-
case 0:
|
|
1297
|
-
if (fileType.mime === "image/svg+xml") {
|
|
1298
|
-
match = /<svg([^<>]+)>/gi.exec(buffer.toString("utf8"));
|
|
1299
|
-
if (match && match.length > 1) {
|
|
1300
|
-
attrs = match[1].match(/([a-z]+)="([^"]+)"/gi);
|
|
1301
|
-
attrs.forEach(function (attr) {
|
|
1302
|
-
if (attr.length < 5)
|
|
1303
|
-
return;
|
|
1304
|
-
var _b = __read(attr.split("="), 2), name = _b[0], value = _b[1];
|
|
1305
|
-
var val = value.replace(/"/gi, "");
|
|
1306
|
-
metadata[name] = isNaN(val) ? val : Number(val);
|
|
1307
|
-
});
|
|
1308
|
-
if (metadata.viewBox && (isNaN(metadata.width) || isNaN(metadata.height))) {
|
|
1309
|
-
parts = metadata.viewBox.split(" ");
|
|
1310
|
-
metadata.width = Number(parts[0]) + Number(parts[2]);
|
|
1311
|
-
metadata.height = Number(parts[1]) + Number(parts[3]);
|
|
1312
|
-
}
|
|
1313
|
-
if (!isNaN(metadata.width) && !isNaN(metadata.height)) {
|
|
1314
|
-
metadata.svgSize = { x: metadata.width, y: metadata.height };
|
|
1315
|
-
}
|
|
1316
|
-
}
|
|
1317
|
-
return [2 /*return*/, buffer];
|
|
1318
|
-
}
|
|
1319
|
-
return [4 /*yield*/, sharp$2(buffer).rotate().toBuffer({ resolveWithObject: true })];
|
|
1320
|
-
case 1:
|
|
1321
|
-
output = _b.sent();
|
|
1322
|
-
Object.assign(metadata, output.info);
|
|
1323
|
-
return [2 /*return*/, output.data];
|
|
1324
|
-
}
|
|
1325
|
-
});
|
|
1326
|
-
});
|
|
1327
|
-
};
|
|
1328
|
-
AssetProcessor.isFont = function (contentType) {
|
|
1329
|
-
return fontTypes.indexOf(contentType) >= 0;
|
|
1330
|
-
};
|
|
1331
|
-
AssetProcessor.copyFontMeta = function (buffer, metadata) {
|
|
1332
|
-
var font = fontKit.create(buffer);
|
|
1333
|
-
metadata.format = AssetProcessor_1.extractFontFormat(font);
|
|
1334
|
-
fontProps.forEach(function (prop) {
|
|
1335
|
-
metadata[prop] = font[prop];
|
|
1336
|
-
});
|
|
1337
|
-
};
|
|
1338
|
-
AssetProcessor.prototype.process = function (buffer, metadata, fileType) {
|
|
1339
|
-
return __awaiter$x(this, void 0, void 0, function () {
|
|
1340
|
-
return __generator(this, function (_b) {
|
|
1341
|
-
switch (_b.label) {
|
|
1342
|
-
case 0:
|
|
1343
|
-
if (!AssetProcessor_1.isImage(fileType.mime)) return [3 /*break*/, 2];
|
|
1344
|
-
return [4 /*yield*/, AssetProcessor_1.copyImageMeta(buffer, metadata, fileType)];
|
|
1345
|
-
case 1:
|
|
1346
|
-
buffer = _b.sent();
|
|
1347
|
-
_b.label = 2;
|
|
1348
|
-
case 2:
|
|
1349
|
-
if (AssetProcessor_1.isFont(fileType.mime)) {
|
|
1350
|
-
AssetProcessor_1.copyFontMeta(buffer, metadata);
|
|
1351
|
-
}
|
|
1352
|
-
return [2 /*return*/, buffer];
|
|
1353
|
-
}
|
|
1354
|
-
});
|
|
1190
|
+
resolve(line);
|
|
1355
1191
|
});
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1192
|
+
cp.stdout.on("data", function (data) {
|
|
1193
|
+
console.log(data.toString());
|
|
1194
|
+
});
|
|
1195
|
+
cp.stderr.on("data", function (data) {
|
|
1196
|
+
console.error(data.toString());
|
|
1197
|
+
});
|
|
1198
|
+
});
|
|
1199
|
+
}
|
|
1200
|
+
exports.ConsoleColor = void 0;
|
|
1201
|
+
(function (ConsoleColor) {
|
|
1202
|
+
ConsoleColor["Reset"] = "\u001B[0m";
|
|
1203
|
+
ConsoleColor["Bright"] = "\u001B[1m";
|
|
1204
|
+
ConsoleColor["Dim"] = "\u001B[2m";
|
|
1205
|
+
ConsoleColor["Underscore"] = "\u001B[4m";
|
|
1206
|
+
ConsoleColor["Blink"] = "\u001B[5m";
|
|
1207
|
+
ConsoleColor["Reverse"] = "\u001B[7m";
|
|
1208
|
+
ConsoleColor["Hidden"] = "\u001B[8m";
|
|
1209
|
+
ConsoleColor["FgBlack"] = "\u001B[30m";
|
|
1210
|
+
ConsoleColor["FgRed"] = "\u001B[31m";
|
|
1211
|
+
ConsoleColor["FgGreen"] = "\u001B[32m";
|
|
1212
|
+
ConsoleColor["FgYellow"] = "\u001B[33m";
|
|
1213
|
+
ConsoleColor["FgBlue"] = "\u001B[34m";
|
|
1214
|
+
ConsoleColor["FgMagenta"] = "\u001B[35m";
|
|
1215
|
+
ConsoleColor["FgCyan"] = "\u001B[36m";
|
|
1216
|
+
ConsoleColor["FgWhite"] = "\u001B[37m";
|
|
1217
|
+
ConsoleColor["FgDefault"] = "\u001B[38m";
|
|
1218
|
+
ConsoleColor["BgBlack"] = "\u001B[40m";
|
|
1219
|
+
ConsoleColor["BgRed"] = "\u001B[41m";
|
|
1220
|
+
ConsoleColor["BgGreen"] = "\u001B[42m";
|
|
1221
|
+
ConsoleColor["BgYellow"] = "\u001B[43m";
|
|
1222
|
+
ConsoleColor["BgBlue"] = "\u001B[44m";
|
|
1223
|
+
ConsoleColor["BgMagenta"] = "\u001B[45m";
|
|
1224
|
+
ConsoleColor["BgCyan"] = "\u001B[46m";
|
|
1225
|
+
ConsoleColor["BgWhite"] = "\u001B[47m";
|
|
1226
|
+
ConsoleColor["BgDefault"] = "\u001B[48m";
|
|
1227
|
+
})(exports.ConsoleColor || (exports.ConsoleColor = {}));
|
|
1228
|
+
var defaultColors = {
|
|
1229
|
+
keyColor: exports.ConsoleColor.FgWhite,
|
|
1230
|
+
numberColor: exports.ConsoleColor.FgBlue,
|
|
1231
|
+
stringColor: exports.ConsoleColor.FgYellow,
|
|
1232
|
+
trueColor: exports.ConsoleColor.FgGreen,
|
|
1233
|
+
falseColor: exports.ConsoleColor.FgRed,
|
|
1234
|
+
nullColor: exports.ConsoleColor.BgMagenta
|
|
1235
|
+
};
|
|
1236
|
+
function colorize(input, color) {
|
|
1237
|
+
return "" + color + input + exports.ConsoleColor.Reset;
|
|
1238
|
+
}
|
|
1239
|
+
function jsonHighlight(input, colorOptions) {
|
|
1240
|
+
var colors = Object.assign({}, defaultColors, colorOptions);
|
|
1241
|
+
var json = (isString(input) ? input : JSON.stringify(input, null, 2)).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
|
|
1242
|
+
return json.replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+]?\d+)?)/g, function (match) {
|
|
1243
|
+
var color = colors.numberColor;
|
|
1244
|
+
if (/^"/.test(match)) {
|
|
1245
|
+
if (/:$/.test(match)) {
|
|
1246
|
+
color = colors.keyColor;
|
|
1247
|
+
}
|
|
1248
|
+
else {
|
|
1249
|
+
color = colors.stringColor;
|
|
1250
|
+
match = '"' + match.substr(1, match.length - 2) + '"';
|
|
1251
|
+
}
|
|
1252
|
+
}
|
|
1253
|
+
else {
|
|
1254
|
+
color = /true/.test(match)
|
|
1255
|
+
? colors.trueColor
|
|
1256
|
+
: /false/.test(match)
|
|
1257
|
+
? colors.falseColor
|
|
1258
|
+
: /null/.test(match)
|
|
1259
|
+
? colors.nullColor
|
|
1260
|
+
: color;
|
|
1261
|
+
}
|
|
1262
|
+
return "" + color + match + exports.ConsoleColor.Reset;
|
|
1263
|
+
});
|
|
1264
|
+
}
|
|
1265
|
+
function replaceSpecialChars(str, to) {
|
|
1266
|
+
if (to === void 0) { to = "-"; }
|
|
1267
|
+
return ("" + str).replace(/[&\/\\#, +()$~%.@'":*?<>{}]/g, to);
|
|
1268
|
+
}
|
|
1363
1269
|
|
|
1364
|
-
var __decorate$
|
|
1270
|
+
var __decorate$A = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
1365
1271
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1366
1272
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
1367
1273
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -1371,11 +1277,11 @@
|
|
|
1371
1277
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1372
1278
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1373
1279
|
};
|
|
1374
|
-
var __metadata$
|
|
1280
|
+
var __metadata$u = (this && this.__metadata) || function (k, v) {
|
|
1375
1281
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
1376
1282
|
return Reflect.metadata(k, v);
|
|
1377
1283
|
};
|
|
1378
|
-
var __param$
|
|
1284
|
+
var __param$9 = (this && this.__param) || function (paramIndex, decorator) {
|
|
1379
1285
|
return function (target, key) { decorator(target, key, paramIndex); };
|
|
1380
1286
|
};
|
|
1381
1287
|
exports.Configuration = /** @class */ (function () {
|
|
@@ -1383,6 +1289,7 @@
|
|
|
1383
1289
|
var _this = this;
|
|
1384
1290
|
dotenv__default["default"].config();
|
|
1385
1291
|
this.paramMap = {};
|
|
1292
|
+
this.paramValues = {};
|
|
1386
1293
|
(params || []).forEach(function (param) { return _this.add(param); });
|
|
1387
1294
|
}
|
|
1388
1295
|
Configuration.prototype.add = function (param) {
|
|
@@ -1391,13 +1298,7 @@
|
|
|
1391
1298
|
existingParam.resolver = param.resolver || existingParam.resolver;
|
|
1392
1299
|
this.paramMap[param.name] = existingParam;
|
|
1393
1300
|
};
|
|
1394
|
-
Configuration.prototype.
|
|
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");
|
|
1301
|
+
Configuration.prototype.resolveValue = function (param) {
|
|
1401
1302
|
var envName = param.name.replace(/\.?([A-Z|0-9]+)/g, function (x, y) {
|
|
1402
1303
|
return "_" + y.toLowerCase();
|
|
1403
1304
|
}).replace(/\./gi, "_").replace(/^_/, "").toUpperCase();
|
|
@@ -1406,21 +1307,32 @@
|
|
|
1406
1307
|
var value = isFunction(param.resolver)
|
|
1407
1308
|
? param.resolver(envValue)
|
|
1408
1309
|
: convertValue(envValue, getType(param.defaultValue));
|
|
1409
|
-
console.log("Processing param value", name, envName, envValue, value);
|
|
1310
|
+
console.log("Processing param value", colorize(param.name, exports.ConsoleColor.FgGreen), colorize(envName, exports.ConsoleColor.FgBlue), "\"" + envValue + "\"", value);
|
|
1410
1311
|
return value;
|
|
1411
1312
|
}
|
|
1412
1313
|
return param.defaultValue;
|
|
1413
1314
|
};
|
|
1315
|
+
Configuration.prototype.hasParam = function (name) {
|
|
1316
|
+
return !!this.paramMap[name];
|
|
1317
|
+
};
|
|
1318
|
+
Configuration.prototype.resolve = function (name) {
|
|
1319
|
+
var param = this.paramMap[name];
|
|
1320
|
+
if (!param)
|
|
1321
|
+
throw new Error("Parameter with name: '" + name + "' does not exists in configuration");
|
|
1322
|
+
if (!(name in this.paramValues)) {
|
|
1323
|
+
this.paramValues[name] = this.resolveValue(param);
|
|
1324
|
+
}
|
|
1325
|
+
return this.paramValues[name];
|
|
1326
|
+
};
|
|
1414
1327
|
return Configuration;
|
|
1415
1328
|
}());
|
|
1416
|
-
exports.Configuration = __decorate$
|
|
1417
|
-
tsyringe.
|
|
1418
|
-
tsyringe.
|
|
1419
|
-
|
|
1420
|
-
__metadata$q("design:paramtypes", [Array])
|
|
1329
|
+
exports.Configuration = __decorate$A([
|
|
1330
|
+
tsyringe.singleton(),
|
|
1331
|
+
__param$9(0, tsyringe.injectAll(PARAMETER)),
|
|
1332
|
+
__metadata$u("design:paramtypes", [Array])
|
|
1421
1333
|
], exports.Configuration);
|
|
1422
1334
|
|
|
1423
|
-
var __decorate$
|
|
1335
|
+
var __decorate$z = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
1424
1336
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1425
1337
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
1426
1338
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -1430,7 +1342,7 @@
|
|
|
1430
1342
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1431
1343
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1432
1344
|
};
|
|
1433
|
-
var __metadata$
|
|
1345
|
+
var __metadata$t = (this && this.__metadata) || function (k, v) {
|
|
1434
1346
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
1435
1347
|
return Reflect.metadata(k, v);
|
|
1436
1348
|
};
|
|
@@ -1506,10 +1418,10 @@
|
|
|
1506
1418
|
};
|
|
1507
1419
|
return MongoConnector;
|
|
1508
1420
|
}());
|
|
1509
|
-
exports.MongoConnector = __decorate$
|
|
1421
|
+
exports.MongoConnector = __decorate$z([
|
|
1510
1422
|
tsyringe.injectable(),
|
|
1511
1423
|
tsyringe.singleton(),
|
|
1512
|
-
__metadata$
|
|
1424
|
+
__metadata$t("design:paramtypes", [exports.Configuration])
|
|
1513
1425
|
], exports.MongoConnector);
|
|
1514
1426
|
|
|
1515
1427
|
var __awaiter$v = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
@@ -1765,7 +1677,7 @@
|
|
|
1765
1677
|
return TempAsset;
|
|
1766
1678
|
}());
|
|
1767
1679
|
|
|
1768
|
-
var __decorate$
|
|
1680
|
+
var __decorate$y = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
1769
1681
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1770
1682
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
1771
1683
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -1775,7 +1687,7 @@
|
|
|
1775
1687
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1776
1688
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1777
1689
|
};
|
|
1778
|
-
var __metadata$
|
|
1690
|
+
var __metadata$s = (this && this.__metadata) || function (k, v) {
|
|
1779
1691
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
1780
1692
|
return Reflect.metadata(k, v);
|
|
1781
1693
|
};
|
|
@@ -2051,10 +1963,10 @@
|
|
|
2051
1963
|
};
|
|
2052
1964
|
return Assets;
|
|
2053
1965
|
}());
|
|
2054
|
-
exports.Assets = __decorate$
|
|
1966
|
+
exports.Assets = __decorate$y([
|
|
2055
1967
|
tsyringe.injectable(),
|
|
2056
1968
|
tsyringe.scoped(tsyringe.Lifecycle.ContainerScoped),
|
|
2057
|
-
__metadata$
|
|
1969
|
+
__metadata$s("design:paramtypes", [exports.MongoConnector, exports.AssetProcessor])
|
|
2058
1970
|
], exports.Assets);
|
|
2059
1971
|
|
|
2060
1972
|
var __awaiter$r = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
@@ -2078,8 +1990,9 @@
|
|
|
2078
1990
|
};
|
|
2079
1991
|
var LazyAsset = /** @class */ (function (_super) {
|
|
2080
1992
|
__extends(LazyAsset, _super);
|
|
2081
|
-
function LazyAsset(id, data, collection, assets, progresses) {
|
|
1993
|
+
function LazyAsset(id, data, collection, logger, assets, progresses) {
|
|
2082
1994
|
var _this = _super.call(this, id, data, collection) || this;
|
|
1995
|
+
_this.logger = logger;
|
|
2083
1996
|
_this.assets = assets;
|
|
2084
1997
|
_this.progresses = progresses;
|
|
2085
1998
|
return _this;
|
|
@@ -2145,9 +2058,9 @@
|
|
|
2145
2058
|
p === null || p === void 0 ? void 0 : p.cancel();
|
|
2146
2059
|
});
|
|
2147
2060
|
_this.startWorkingOnAsset(false).then(function () {
|
|
2148
|
-
|
|
2061
|
+
_this.logger.log("lazy-assets", "Started working on lazy asset: " + _this.id);
|
|
2149
2062
|
}).catch(function (reason) {
|
|
2150
|
-
|
|
2063
|
+
_this.logger.log("lazy-assets", "Can't start working on lazy asset: " + _this.id + "\nReason: " + reason);
|
|
2151
2064
|
});
|
|
2152
2065
|
});
|
|
2153
2066
|
};
|
|
@@ -2215,7 +2128,7 @@
|
|
|
2215
2128
|
return LazyAsset;
|
|
2216
2129
|
}(BaseEntity));
|
|
2217
2130
|
|
|
2218
|
-
var __decorate$
|
|
2131
|
+
var __decorate$x = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2219
2132
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2220
2133
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
2221
2134
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -2225,11 +2138,47 @@
|
|
|
2225
2138
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2226
2139
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2227
2140
|
};
|
|
2228
|
-
var __metadata$
|
|
2141
|
+
var __metadata$r = (this && this.__metadata) || function (k, v) {
|
|
2229
2142
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
2230
2143
|
return Reflect.metadata(k, v);
|
|
2231
2144
|
};
|
|
2232
|
-
|
|
2145
|
+
exports["ɵa"] = /** @class */ (function () {
|
|
2146
|
+
function Logger(config) {
|
|
2147
|
+
this.config = config;
|
|
2148
|
+
console.log("Logger created");
|
|
2149
|
+
this.tags = this.config.resolve("logTags");
|
|
2150
|
+
}
|
|
2151
|
+
Logger.prototype.log = function (tag) {
|
|
2152
|
+
var params = [];
|
|
2153
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
2154
|
+
params[_i - 1] = arguments[_i];
|
|
2155
|
+
}
|
|
2156
|
+
if (!this.tags.includes(tag)) {
|
|
2157
|
+
console.log.apply(console, __spreadArray(["[" + tag + "]"], __read(params)));
|
|
2158
|
+
}
|
|
2159
|
+
};
|
|
2160
|
+
return Logger;
|
|
2161
|
+
}());
|
|
2162
|
+
exports["ɵa"] = __decorate$x([
|
|
2163
|
+
tsyringe.singleton(),
|
|
2164
|
+
__metadata$r("design:paramtypes", [exports.Configuration])
|
|
2165
|
+
], exports["ɵa"]);
|
|
2166
|
+
|
|
2167
|
+
var __decorate$w = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2168
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2169
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
2170
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
2171
|
+
else
|
|
2172
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
2173
|
+
if (d = decorators[i])
|
|
2174
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2175
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2176
|
+
};
|
|
2177
|
+
var __metadata$q = (this && this.__metadata) || function (k, v) {
|
|
2178
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
2179
|
+
return Reflect.metadata(k, v);
|
|
2180
|
+
};
|
|
2181
|
+
var __param$8 = (this && this.__param) || function (paramIndex, decorator) {
|
|
2233
2182
|
return function (target, key) { decorator(target, key, paramIndex); };
|
|
2234
2183
|
};
|
|
2235
2184
|
var __awaiter$q = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
@@ -2252,9 +2201,10 @@
|
|
|
2252
2201
|
});
|
|
2253
2202
|
};
|
|
2254
2203
|
exports.JobManager = /** @class */ (function () {
|
|
2255
|
-
function JobManager(config, container, jobTypes) {
|
|
2204
|
+
function JobManager(config, logger, container, jobTypes) {
|
|
2256
2205
|
var _this = this;
|
|
2257
2206
|
this.config = config;
|
|
2207
|
+
this.logger = logger;
|
|
2258
2208
|
this.container = container;
|
|
2259
2209
|
this.jobTypes = jobTypes || [];
|
|
2260
2210
|
this.jobs = this.jobTypes.reduce(function (res, jobType) {
|
|
@@ -2292,7 +2242,7 @@
|
|
|
2292
2242
|
}
|
|
2293
2243
|
catch (e) {
|
|
2294
2244
|
jobName = getConstructorName(jobType);
|
|
2295
|
-
throw "Can't resolve params for job: " + jobName + ", with params: " + JSON.stringify(params) + ". Reason: " + e;
|
|
2245
|
+
throw new Error("Can't resolve params for job: " + jobName + ", with params: " + JSON.stringify(params) + ". Reason: " + e);
|
|
2296
2246
|
}
|
|
2297
2247
|
return [2 /*return*/, instance.process()];
|
|
2298
2248
|
});
|
|
@@ -2329,12 +2279,12 @@
|
|
|
2329
2279
|
}).join(" ");
|
|
2330
2280
|
var jobName = getConstructorName(jobType);
|
|
2331
2281
|
if (!nodeCron.validate(expression)) {
|
|
2332
|
-
|
|
2282
|
+
this.logger.log("job-manager", "Can't schedule the task: '" + jobName + "' because time expression is invalid.");
|
|
2333
2283
|
return null;
|
|
2334
2284
|
}
|
|
2335
2285
|
return nodeCron.schedule(expression, function () {
|
|
2336
2286
|
_this.enqueue(jobType, params).catch(function (e) {
|
|
2337
|
-
|
|
2287
|
+
_this.logger.log("job-manager", "Can't enqueue job: '" + jobName + "' because: " + e);
|
|
2338
2288
|
});
|
|
2339
2289
|
});
|
|
2340
2290
|
};
|
|
@@ -2349,7 +2299,7 @@
|
|
|
2349
2299
|
return [2 /*return*/, null];
|
|
2350
2300
|
this.processing = true;
|
|
2351
2301
|
if (!this.config.resolve("isWorker")) {
|
|
2352
|
-
|
|
2302
|
+
this.logger.log("job-manager", colorize("Processing can not be started because this is NOT a worker process!", exports.ConsoleColor.FgRed));
|
|
2353
2303
|
return [2 /*return*/, null];
|
|
2354
2304
|
}
|
|
2355
2305
|
host = this.config.resolve("zmqRemoteHost");
|
|
@@ -2358,13 +2308,13 @@
|
|
|
2358
2308
|
return [4 /*yield*/, this.workerPush.connect(pushHost)];
|
|
2359
2309
|
case 1:
|
|
2360
2310
|
_a.sent();
|
|
2361
|
-
|
|
2311
|
+
this.logger.log("job-manager", "Worker producer connected to: " + pushHost);
|
|
2362
2312
|
pullHost = host + ":" + this.config.resolve("zmqPort");
|
|
2363
2313
|
this.workerPull = zeromq.socket("pull");
|
|
2364
2314
|
return [4 /*yield*/, this.workerPull.connect(pullHost)];
|
|
2365
2315
|
case 2:
|
|
2366
2316
|
_a.sent();
|
|
2367
|
-
|
|
2317
|
+
this.logger.log("job-manager", "Worker consumer connected to: " + pullHost);
|
|
2368
2318
|
this.workerPull.on("message", function (name, args, uniqId) { return __awaiter$q(_this, void 0, void 0, function () {
|
|
2369
2319
|
var jobName, jobParams, uniqueId, e_1, e_2;
|
|
2370
2320
|
return __generator(this, function (_a) {
|
|
@@ -2393,7 +2343,7 @@
|
|
|
2393
2343
|
return [3 /*break*/, 6];
|
|
2394
2344
|
case 5:
|
|
2395
2345
|
e_2 = _a.sent();
|
|
2396
|
-
|
|
2346
|
+
this.logger.log("job-manager", "Failed to start job: " + e_2.message);
|
|
2397
2347
|
return [3 /*break*/, 6];
|
|
2398
2348
|
case 6: return [2 /*return*/];
|
|
2399
2349
|
}
|
|
@@ -2432,7 +2382,7 @@
|
|
|
2432
2382
|
var port = this.config.resolve("zmqPort");
|
|
2433
2383
|
this.apiPush = zeromq.socket("push");
|
|
2434
2384
|
this.apiPush.bind("tcp://0.0.0.0:" + port);
|
|
2435
|
-
|
|
2385
|
+
this.logger.log("job-manager", "API producer bound to port: " + port);
|
|
2436
2386
|
}
|
|
2437
2387
|
if (!this.apiPull) {
|
|
2438
2388
|
var backPort = this.config.resolve("zmqBackPort");
|
|
@@ -2445,10 +2395,10 @@
|
|
|
2445
2395
|
res[key] = getType(params[key]);
|
|
2446
2396
|
return res;
|
|
2447
2397
|
}, {});
|
|
2448
|
-
|
|
2398
|
+
_this.logger.log("job-manager", "Received a message from worker: \"" + colorize(message, exports.ConsoleColor.FgCyan) + "\" with args: " + jsonHighlight(paramTypes) + "\n\n");
|
|
2449
2399
|
_this.messages.next({ message: message, params: params });
|
|
2450
2400
|
});
|
|
2451
|
-
|
|
2401
|
+
this.logger.log("job-manager", "API consumer bound to port: " + backPort);
|
|
2452
2402
|
}
|
|
2453
2403
|
return this.tryResolve(jobType, params);
|
|
2454
2404
|
};
|
|
@@ -2481,11 +2431,13 @@
|
|
|
2481
2431
|
};
|
|
2482
2432
|
return JobManager;
|
|
2483
2433
|
}());
|
|
2484
|
-
exports.JobManager = __decorate$
|
|
2434
|
+
exports.JobManager = __decorate$w([
|
|
2485
2435
|
tsyringe.injectable(),
|
|
2486
2436
|
tsyringe.scoped(tsyringe.Lifecycle.ContainerScoped),
|
|
2487
|
-
__param$
|
|
2488
|
-
|
|
2437
|
+
__param$8(2, tsyringe.inject(DI_CONTAINER)),
|
|
2438
|
+
__param$8(3, tsyringe.injectAll(JOB)),
|
|
2439
|
+
__metadata$q("design:paramtypes", [exports.Configuration,
|
|
2440
|
+
exports["ɵa"], Object, Array])
|
|
2489
2441
|
], exports.JobManager);
|
|
2490
2442
|
|
|
2491
2443
|
var __awaiter$p = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
@@ -2887,7 +2839,7 @@
|
|
|
2887
2839
|
return SubProgress;
|
|
2888
2840
|
}());
|
|
2889
2841
|
|
|
2890
|
-
var __decorate$
|
|
2842
|
+
var __decorate$v = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2891
2843
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2892
2844
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
2893
2845
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -2897,7 +2849,7 @@
|
|
|
2897
2849
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2898
2850
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2899
2851
|
};
|
|
2900
|
-
var __metadata$
|
|
2852
|
+
var __metadata$p = (this && this.__metadata) || function (k, v) {
|
|
2901
2853
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
2902
2854
|
return Reflect.metadata(k, v);
|
|
2903
2855
|
};
|
|
@@ -3060,13 +3012,13 @@
|
|
|
3060
3012
|
};
|
|
3061
3013
|
return Progresses;
|
|
3062
3014
|
}());
|
|
3063
|
-
exports.Progresses = __decorate$
|
|
3015
|
+
exports.Progresses = __decorate$v([
|
|
3064
3016
|
tsyringe.injectable(),
|
|
3065
3017
|
tsyringe.singleton(),
|
|
3066
|
-
__metadata$
|
|
3018
|
+
__metadata$p("design:paramtypes", [exports.MongoConnector, exports.JobManager])
|
|
3067
3019
|
], exports.Progresses);
|
|
3068
3020
|
|
|
3069
|
-
var __decorate$
|
|
3021
|
+
var __decorate$u = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3070
3022
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3071
3023
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
3072
3024
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -3076,7 +3028,7 @@
|
|
|
3076
3028
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3077
3029
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3078
3030
|
};
|
|
3079
|
-
var __metadata$
|
|
3031
|
+
var __metadata$o = (this && this.__metadata) || function (k, v) {
|
|
3080
3032
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
3081
3033
|
return Reflect.metadata(k, v);
|
|
3082
3034
|
};
|
|
@@ -3100,10 +3052,11 @@
|
|
|
3100
3052
|
});
|
|
3101
3053
|
};
|
|
3102
3054
|
exports.LazyAssets = /** @class */ (function () {
|
|
3103
|
-
function LazyAssets(connector, assets, progresses, jobMan) {
|
|
3055
|
+
function LazyAssets(connector, assets, progresses, logger, jobMan) {
|
|
3104
3056
|
this.connector = connector;
|
|
3105
3057
|
this.assets = assets;
|
|
3106
3058
|
this.progresses = progresses;
|
|
3059
|
+
this.logger = logger;
|
|
3107
3060
|
this.jobMan = jobMan;
|
|
3108
3061
|
this.collection = connector.database.collection("lazyassets");
|
|
3109
3062
|
}
|
|
@@ -3129,7 +3082,7 @@
|
|
|
3129
3082
|
return [4 /*yield*/, this.collection.insertOne(data)];
|
|
3130
3083
|
case 2:
|
|
3131
3084
|
res = _a.sent();
|
|
3132
|
-
return [2 /*return*/, new LazyAsset(res.insertedId, data, this.collection, this.assets, this.progresses)];
|
|
3085
|
+
return [2 /*return*/, new LazyAsset(res.insertedId, data, this.collection, this.logger, this.assets, this.progresses)];
|
|
3133
3086
|
}
|
|
3134
3087
|
});
|
|
3135
3088
|
});
|
|
@@ -3151,7 +3104,7 @@
|
|
|
3151
3104
|
data = _a.sent();
|
|
3152
3105
|
return [2 /*return*/, !data
|
|
3153
3106
|
? null
|
|
3154
|
-
: new LazyAsset(data._id, data, this.collection, this.assets, this.progresses)];
|
|
3107
|
+
: new LazyAsset(data._id, data, this.collection, this.logger, this.assets, this.progresses)];
|
|
3155
3108
|
}
|
|
3156
3109
|
});
|
|
3157
3110
|
});
|
|
@@ -3173,16 +3126,17 @@
|
|
|
3173
3126
|
};
|
|
3174
3127
|
return LazyAssets;
|
|
3175
3128
|
}());
|
|
3176
|
-
exports.LazyAssets = __decorate$
|
|
3129
|
+
exports.LazyAssets = __decorate$u([
|
|
3177
3130
|
tsyringe.injectable(),
|
|
3178
3131
|
tsyringe.scoped(tsyringe.Lifecycle.ContainerScoped),
|
|
3179
|
-
__metadata$
|
|
3132
|
+
__metadata$o("design:paramtypes", [exports.MongoConnector,
|
|
3180
3133
|
exports.Assets,
|
|
3181
3134
|
exports.Progresses,
|
|
3135
|
+
exports["ɵa"],
|
|
3182
3136
|
exports.JobManager])
|
|
3183
3137
|
], exports.LazyAssets);
|
|
3184
3138
|
|
|
3185
|
-
var __decorate$
|
|
3139
|
+
var __decorate$t = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3186
3140
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3187
3141
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
3188
3142
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -3192,7 +3146,7 @@
|
|
|
3192
3146
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3193
3147
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3194
3148
|
};
|
|
3195
|
-
var __metadata$
|
|
3149
|
+
var __metadata$n = (this && this.__metadata) || function (k, v) {
|
|
3196
3150
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
3197
3151
|
return Reflect.metadata(k, v);
|
|
3198
3152
|
};
|
|
@@ -3252,13 +3206,13 @@
|
|
|
3252
3206
|
};
|
|
3253
3207
|
return AssetResolver;
|
|
3254
3208
|
}());
|
|
3255
|
-
exports.AssetResolver = __decorate$
|
|
3209
|
+
exports.AssetResolver = __decorate$t([
|
|
3256
3210
|
tsyringe.injectable(),
|
|
3257
3211
|
tsyringe.scoped(tsyringe.Lifecycle.ContainerScoped),
|
|
3258
|
-
__metadata$
|
|
3212
|
+
__metadata$n("design:paramtypes", [exports.Assets, exports.LazyAssets])
|
|
3259
3213
|
], exports.AssetResolver);
|
|
3260
3214
|
|
|
3261
|
-
var __decorate$
|
|
3215
|
+
var __decorate$s = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3262
3216
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3263
3217
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
3264
3218
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -3268,7 +3222,7 @@
|
|
|
3268
3222
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3269
3223
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3270
3224
|
};
|
|
3271
|
-
var __metadata$
|
|
3225
|
+
var __metadata$m = (this && this.__metadata) || function (k, v) {
|
|
3272
3226
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
3273
3227
|
return Reflect.metadata(k, v);
|
|
3274
3228
|
};
|
|
@@ -3290,13 +3244,13 @@
|
|
|
3290
3244
|
});
|
|
3291
3245
|
return BackendProvider;
|
|
3292
3246
|
}());
|
|
3293
|
-
exports.BackendProvider = __decorate$
|
|
3247
|
+
exports.BackendProvider = __decorate$s([
|
|
3294
3248
|
tsyringe.injectable(),
|
|
3295
3249
|
tsyringe.singleton(),
|
|
3296
|
-
__metadata$
|
|
3250
|
+
__metadata$m("design:paramtypes", [])
|
|
3297
3251
|
], exports.BackendProvider);
|
|
3298
3252
|
|
|
3299
|
-
var __decorate$
|
|
3253
|
+
var __decorate$r = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3300
3254
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3301
3255
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
3302
3256
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -3344,12 +3298,12 @@
|
|
|
3344
3298
|
};
|
|
3345
3299
|
return CacheProcessor;
|
|
3346
3300
|
}());
|
|
3347
|
-
exports.CacheProcessor = __decorate$
|
|
3301
|
+
exports.CacheProcessor = __decorate$r([
|
|
3348
3302
|
tsyringe.injectable(),
|
|
3349
3303
|
tsyringe.scoped(tsyringe.Lifecycle.ContainerScoped)
|
|
3350
3304
|
], exports.CacheProcessor);
|
|
3351
3305
|
|
|
3352
|
-
var __decorate$
|
|
3306
|
+
var __decorate$q = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3353
3307
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3354
3308
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
3355
3309
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -3359,7 +3313,7 @@
|
|
|
3359
3313
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3360
3314
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3361
3315
|
};
|
|
3362
|
-
var __metadata$
|
|
3316
|
+
var __metadata$l = (this && this.__metadata) || function (k, v) {
|
|
3363
3317
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
3364
3318
|
return Reflect.metadata(k, v);
|
|
3365
3319
|
};
|
|
@@ -3504,13 +3458,13 @@
|
|
|
3504
3458
|
};
|
|
3505
3459
|
return Cache;
|
|
3506
3460
|
}());
|
|
3507
|
-
exports.Cache = __decorate$
|
|
3461
|
+
exports.Cache = __decorate$q([
|
|
3508
3462
|
tsyringe.injectable(),
|
|
3509
3463
|
tsyringe.scoped(tsyringe.Lifecycle.ContainerScoped),
|
|
3510
|
-
__metadata$
|
|
3464
|
+
__metadata$l("design:paramtypes", [exports.MongoConnector, exports.Configuration, exports.CacheProcessor])
|
|
3511
3465
|
], exports.Cache);
|
|
3512
3466
|
|
|
3513
|
-
var __decorate$
|
|
3467
|
+
var __decorate$p = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3514
3468
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3515
3469
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
3516
3470
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -3552,12 +3506,12 @@
|
|
|
3552
3506
|
};
|
|
3553
3507
|
return EndpointProvider;
|
|
3554
3508
|
}());
|
|
3555
|
-
exports.EndpointProvider = __decorate$
|
|
3509
|
+
exports.EndpointProvider = __decorate$p([
|
|
3556
3510
|
tsyringe.injectable(),
|
|
3557
3511
|
tsyringe.scoped(tsyringe.Lifecycle.ContainerScoped)
|
|
3558
3512
|
], exports.EndpointProvider);
|
|
3559
3513
|
|
|
3560
|
-
var __decorate$
|
|
3514
|
+
var __decorate$o = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3561
3515
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3562
3516
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
3563
3517
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -3567,11 +3521,11 @@
|
|
|
3567
3521
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3568
3522
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3569
3523
|
};
|
|
3570
|
-
var __metadata$
|
|
3524
|
+
var __metadata$k = (this && this.__metadata) || function (k, v) {
|
|
3571
3525
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
3572
3526
|
return Reflect.metadata(k, v);
|
|
3573
3527
|
};
|
|
3574
|
-
var __param$
|
|
3528
|
+
var __param$7 = (this && this.__param) || function (paramIndex, decorator) {
|
|
3575
3529
|
return function (target, key) { decorator(target, key, paramIndex); };
|
|
3576
3530
|
};
|
|
3577
3531
|
var __awaiter$i = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
@@ -3639,11 +3593,11 @@
|
|
|
3639
3593
|
};
|
|
3640
3594
|
return Fixtures;
|
|
3641
3595
|
}());
|
|
3642
|
-
exports.Fixtures = __decorate$
|
|
3596
|
+
exports.Fixtures = __decorate$o([
|
|
3643
3597
|
tsyringe.injectable(),
|
|
3644
3598
|
tsyringe.scoped(tsyringe.Lifecycle.ContainerScoped),
|
|
3645
|
-
__param$
|
|
3646
|
-
__metadata$
|
|
3599
|
+
__param$7(0, tsyringe.injectAll(FIXTURE)),
|
|
3600
|
+
__metadata$k("design:paramtypes", [Array])
|
|
3647
3601
|
], exports.Fixtures);
|
|
3648
3602
|
|
|
3649
3603
|
var __awaiter$h = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
@@ -3720,7 +3674,7 @@
|
|
|
3720
3674
|
return GalleryImage;
|
|
3721
3675
|
}());
|
|
3722
3676
|
|
|
3723
|
-
var __decorate$
|
|
3677
|
+
var __decorate$n = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3724
3678
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3725
3679
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
3726
3680
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -3730,7 +3684,7 @@
|
|
|
3730
3684
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3731
3685
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3732
3686
|
};
|
|
3733
|
-
var __metadata$
|
|
3687
|
+
var __metadata$j = (this && this.__metadata) || function (k, v) {
|
|
3734
3688
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
3735
3689
|
return Reflect.metadata(k, v);
|
|
3736
3690
|
};
|
|
@@ -3753,13 +3707,13 @@
|
|
|
3753
3707
|
};
|
|
3754
3708
|
return GalleryCache;
|
|
3755
3709
|
}());
|
|
3756
|
-
exports.GalleryCache = __decorate$
|
|
3710
|
+
exports.GalleryCache = __decorate$n([
|
|
3757
3711
|
tsyringe.injectable(),
|
|
3758
3712
|
tsyringe.scoped(tsyringe.Lifecycle.ContainerScoped),
|
|
3759
|
-
__metadata$
|
|
3713
|
+
__metadata$j("design:paramtypes", [])
|
|
3760
3714
|
], exports.GalleryCache);
|
|
3761
3715
|
|
|
3762
|
-
var __decorate$
|
|
3716
|
+
var __decorate$m = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3763
3717
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3764
3718
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
3765
3719
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -3769,7 +3723,7 @@
|
|
|
3769
3723
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3770
3724
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3771
3725
|
};
|
|
3772
|
-
var __metadata$
|
|
3726
|
+
var __metadata$i = (this && this.__metadata) || function (k, v) {
|
|
3773
3727
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
3774
3728
|
return Reflect.metadata(k, v);
|
|
3775
3729
|
};
|
|
@@ -3918,13 +3872,13 @@
|
|
|
3918
3872
|
};
|
|
3919
3873
|
return Gallery;
|
|
3920
3874
|
}());
|
|
3921
|
-
exports.Gallery = __decorate$
|
|
3875
|
+
exports.Gallery = __decorate$m([
|
|
3922
3876
|
tsyringe.injectable(),
|
|
3923
3877
|
tsyringe.scoped(tsyringe.Lifecycle.ContainerScoped),
|
|
3924
|
-
__metadata$
|
|
3878
|
+
__metadata$i("design:paramtypes", [exports.Configuration, exports.GalleryCache])
|
|
3925
3879
|
], exports.Gallery);
|
|
3926
3880
|
|
|
3927
|
-
var __decorate$
|
|
3881
|
+
var __decorate$l = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3928
3882
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3929
3883
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
3930
3884
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -3934,7 +3888,7 @@
|
|
|
3934
3888
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3935
3889
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3936
3890
|
};
|
|
3937
|
-
var __metadata$
|
|
3891
|
+
var __metadata$h = (this && this.__metadata) || function (k, v) {
|
|
3938
3892
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
3939
3893
|
return Reflect.metadata(k, v);
|
|
3940
3894
|
};
|
|
@@ -4005,13 +3959,13 @@
|
|
|
4005
3959
|
};
|
|
4006
3960
|
return IdGenerator;
|
|
4007
3961
|
}());
|
|
4008
|
-
exports.IdGenerator = __decorate$
|
|
3962
|
+
exports.IdGenerator = __decorate$l([
|
|
4009
3963
|
tsyringe.injectable(),
|
|
4010
3964
|
tsyringe.scoped(tsyringe.Lifecycle.ContainerScoped),
|
|
4011
|
-
__metadata$
|
|
3965
|
+
__metadata$h("design:paramtypes", [exports.Configuration])
|
|
4012
3966
|
], exports.IdGenerator);
|
|
4013
3967
|
|
|
4014
|
-
var __decorate$
|
|
3968
|
+
var __decorate$k = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
4015
3969
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4016
3970
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
4017
3971
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -4021,7 +3975,7 @@
|
|
|
4021
3975
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4022
3976
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4023
3977
|
};
|
|
4024
|
-
var __metadata$
|
|
3978
|
+
var __metadata$g = (this && this.__metadata) || function (k, v) {
|
|
4025
3979
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
4026
3980
|
return Reflect.metadata(k, v);
|
|
4027
3981
|
};
|
|
@@ -4038,13 +3992,13 @@
|
|
|
4038
3992
|
};
|
|
4039
3993
|
return TranslationProvider;
|
|
4040
3994
|
}());
|
|
4041
|
-
exports.TranslationProvider = __decorate$
|
|
3995
|
+
exports.TranslationProvider = __decorate$k([
|
|
4042
3996
|
tsyringe.injectable(),
|
|
4043
3997
|
tsyringe.singleton(),
|
|
4044
|
-
__metadata$
|
|
3998
|
+
__metadata$g("design:paramtypes", [exports.Configuration])
|
|
4045
3999
|
], exports.TranslationProvider);
|
|
4046
4000
|
|
|
4047
|
-
var __decorate$
|
|
4001
|
+
var __decorate$j = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
4048
4002
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4049
4003
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
4050
4004
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -4054,7 +4008,7 @@
|
|
|
4054
4008
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4055
4009
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4056
4010
|
};
|
|
4057
|
-
var __metadata$
|
|
4011
|
+
var __metadata$f = (this && this.__metadata) || function (k, v) {
|
|
4058
4012
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
4059
4013
|
return Reflect.metadata(k, v);
|
|
4060
4014
|
};
|
|
@@ -4148,13 +4102,13 @@
|
|
|
4148
4102
|
};
|
|
4149
4103
|
return Translator;
|
|
4150
4104
|
}());
|
|
4151
|
-
exports.Translator = __decorate$
|
|
4105
|
+
exports.Translator = __decorate$j([
|
|
4152
4106
|
tsyringe.injectable(),
|
|
4153
4107
|
tsyringe.singleton(),
|
|
4154
|
-
__metadata$
|
|
4108
|
+
__metadata$f("design:paramtypes", [exports.TranslationProvider])
|
|
4155
4109
|
], exports.Translator);
|
|
4156
4110
|
|
|
4157
|
-
var __decorate$
|
|
4111
|
+
var __decorate$i = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
4158
4112
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4159
4113
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
4160
4114
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -4164,7 +4118,7 @@
|
|
|
4164
4118
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4165
4119
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4166
4120
|
};
|
|
4167
|
-
var __metadata$
|
|
4121
|
+
var __metadata$e = (this && this.__metadata) || function (k, v) {
|
|
4168
4122
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
4169
4123
|
return Reflect.metadata(k, v);
|
|
4170
4124
|
};
|
|
@@ -4297,13 +4251,13 @@
|
|
|
4297
4251
|
};
|
|
4298
4252
|
return TemplateRenderer;
|
|
4299
4253
|
}());
|
|
4300
|
-
exports.TemplateRenderer = __decorate$
|
|
4254
|
+
exports.TemplateRenderer = __decorate$i([
|
|
4301
4255
|
tsyringe.injectable(),
|
|
4302
4256
|
tsyringe.singleton(),
|
|
4303
|
-
__metadata$
|
|
4257
|
+
__metadata$e("design:paramtypes", [exports.Translator, exports.Configuration])
|
|
4304
4258
|
], exports.TemplateRenderer);
|
|
4305
4259
|
|
|
4306
|
-
var __decorate$
|
|
4260
|
+
var __decorate$h = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
4307
4261
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4308
4262
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
4309
4263
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -4313,7 +4267,7 @@
|
|
|
4313
4267
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4314
4268
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4315
4269
|
};
|
|
4316
|
-
var __metadata$
|
|
4270
|
+
var __metadata$d = (this && this.__metadata) || function (k, v) {
|
|
4317
4271
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
4318
4272
|
return Reflect.metadata(k, v);
|
|
4319
4273
|
};
|
|
@@ -4380,13 +4334,13 @@
|
|
|
4380
4334
|
};
|
|
4381
4335
|
return MailSender;
|
|
4382
4336
|
}());
|
|
4383
|
-
exports.MailSender = __decorate$
|
|
4337
|
+
exports.MailSender = __decorate$h([
|
|
4384
4338
|
tsyringe.injectable(),
|
|
4385
4339
|
tsyringe.singleton(),
|
|
4386
|
-
__metadata$
|
|
4340
|
+
__metadata$d("design:paramtypes", [exports.Configuration, exports.TemplateRenderer])
|
|
4387
4341
|
], exports.MailSender);
|
|
4388
4342
|
|
|
4389
|
-
var __decorate$
|
|
4343
|
+
var __decorate$g = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
4390
4344
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4391
4345
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
4392
4346
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -4396,7 +4350,7 @@
|
|
|
4396
4350
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4397
4351
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4398
4352
|
};
|
|
4399
|
-
var __metadata$
|
|
4353
|
+
var __metadata$c = (this && this.__metadata) || function (k, v) {
|
|
4400
4354
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
4401
4355
|
return Reflect.metadata(k, v);
|
|
4402
4356
|
};
|
|
@@ -4494,27 +4448,167 @@
|
|
|
4494
4448
|
});
|
|
4495
4449
|
});
|
|
4496
4450
|
};
|
|
4497
|
-
MemoryCache.prototype.delete = function (key) {
|
|
4498
|
-
return __awaiter$b(this, void 0, void 0, function () {
|
|
4499
|
-
return __generator(this, function (_a) {
|
|
4500
|
-
switch (_a.label) {
|
|
4501
|
-
case 0:
|
|
4502
|
-
this.cacheMap.delete(key);
|
|
4503
|
-
return [4 /*yield*/, this.cacheMap.delete(key)];
|
|
4504
|
-
case 1:
|
|
4505
|
-
_a.sent();
|
|
4506
|
-
return [2 /*return*/];
|
|
4507
|
-
}
|
|
4508
|
-
});
|
|
4451
|
+
MemoryCache.prototype.delete = function (key) {
|
|
4452
|
+
return __awaiter$b(this, void 0, void 0, function () {
|
|
4453
|
+
return __generator(this, function (_a) {
|
|
4454
|
+
switch (_a.label) {
|
|
4455
|
+
case 0:
|
|
4456
|
+
this.cacheMap.delete(key);
|
|
4457
|
+
return [4 /*yield*/, this.cacheMap.delete(key)];
|
|
4458
|
+
case 1:
|
|
4459
|
+
_a.sent();
|
|
4460
|
+
return [2 /*return*/];
|
|
4461
|
+
}
|
|
4462
|
+
});
|
|
4463
|
+
});
|
|
4464
|
+
};
|
|
4465
|
+
return MemoryCache;
|
|
4466
|
+
}());
|
|
4467
|
+
exports.MemoryCache = __decorate$g([
|
|
4468
|
+
tsyringe.injectable(),
|
|
4469
|
+
tsyringe.scoped(tsyringe.Lifecycle.ContainerScoped),
|
|
4470
|
+
__metadata$c("design:paramtypes", [exports.Cache])
|
|
4471
|
+
], exports.MemoryCache);
|
|
4472
|
+
|
|
4473
|
+
var __decorate$f = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
4474
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4475
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
4476
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
4477
|
+
else
|
|
4478
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
4479
|
+
if (d = decorators[i])
|
|
4480
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4481
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4482
|
+
};
|
|
4483
|
+
function checkValue(multi, value) {
|
|
4484
|
+
if (multi) {
|
|
4485
|
+
return Array.isArray(value) && value.every(function (v) {
|
|
4486
|
+
try {
|
|
4487
|
+
var id = new bson.ObjectId(v);
|
|
4488
|
+
return id instanceof bson.ObjectId;
|
|
4489
|
+
}
|
|
4490
|
+
catch (e) {
|
|
4491
|
+
return false;
|
|
4492
|
+
}
|
|
4493
|
+
});
|
|
4494
|
+
}
|
|
4495
|
+
if (null === value)
|
|
4496
|
+
return true;
|
|
4497
|
+
try {
|
|
4498
|
+
var id = new bson.ObjectId(value);
|
|
4499
|
+
return id instanceof bson.ObjectId;
|
|
4500
|
+
}
|
|
4501
|
+
catch (e) {
|
|
4502
|
+
return false;
|
|
4503
|
+
}
|
|
4504
|
+
}
|
|
4505
|
+
exports.IsFile = /** @class */ (function () {
|
|
4506
|
+
function IsFile() {
|
|
4507
|
+
}
|
|
4508
|
+
IsFile.prototype.validate = function (value, validationArguments) {
|
|
4509
|
+
var _a = __read((validationArguments.constraints || []), 1), multi = _a[0];
|
|
4510
|
+
return checkValue(multi, value);
|
|
4511
|
+
};
|
|
4512
|
+
return IsFile;
|
|
4513
|
+
}());
|
|
4514
|
+
exports.IsFile = __decorate$f([
|
|
4515
|
+
classValidator.ValidatorConstraint()
|
|
4516
|
+
], exports.IsFile);
|
|
4517
|
+
exports.IsObjectId = /** @class */ (function () {
|
|
4518
|
+
function IsObjectId() {
|
|
4519
|
+
}
|
|
4520
|
+
IsObjectId.prototype.validate = function (value, validationArguments) {
|
|
4521
|
+
var _a = __read((validationArguments.constraints || []), 2), _ = _a[0], multi = _a[1];
|
|
4522
|
+
return checkValue(multi, value);
|
|
4523
|
+
};
|
|
4524
|
+
return IsObjectId;
|
|
4525
|
+
}());
|
|
4526
|
+
exports.IsObjectId = __decorate$f([
|
|
4527
|
+
classValidator.ValidatorConstraint()
|
|
4528
|
+
], exports.IsObjectId);
|
|
4529
|
+
|
|
4530
|
+
var __decorate$e = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
4531
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4532
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
4533
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
4534
|
+
else
|
|
4535
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
4536
|
+
if (d = decorators[i])
|
|
4537
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4538
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4539
|
+
};
|
|
4540
|
+
var __metadata$b = (this && this.__metadata) || function (k, v) {
|
|
4541
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
4542
|
+
return Reflect.metadata(k, v);
|
|
4543
|
+
};
|
|
4544
|
+
var __param$6 = (this && this.__param) || function (paramIndex, decorator) {
|
|
4545
|
+
return function (target, key) { decorator(target, key, paramIndex); };
|
|
4546
|
+
};
|
|
4547
|
+
exports.OpenApi = /** @class */ (function () {
|
|
4548
|
+
function OpenApi(customValidation) {
|
|
4549
|
+
if (customValidation === void 0) { customValidation = null; }
|
|
4550
|
+
this.customValidation = customValidation;
|
|
4551
|
+
this.docs = null;
|
|
4552
|
+
}
|
|
4553
|
+
Object.defineProperty(OpenApi.prototype, "apiDocs", {
|
|
4554
|
+
get: function () {
|
|
4555
|
+
if (!this.docs)
|
|
4556
|
+
this.docs = this.createApiDocs();
|
|
4557
|
+
return this.docs;
|
|
4558
|
+
},
|
|
4559
|
+
enumerable: false,
|
|
4560
|
+
configurable: true
|
|
4561
|
+
});
|
|
4562
|
+
Object.defineProperty(OpenApi.prototype, "apiDocsStr", {
|
|
4563
|
+
get: function () {
|
|
4564
|
+
if (!this.docsStr)
|
|
4565
|
+
this.docsStr = JSON.stringify(this.apiDocs);
|
|
4566
|
+
return this.docsStr;
|
|
4567
|
+
},
|
|
4568
|
+
enumerable: false,
|
|
4569
|
+
configurable: true
|
|
4570
|
+
});
|
|
4571
|
+
OpenApi.prototype.createApiDocs = function () {
|
|
4572
|
+
var _a;
|
|
4573
|
+
var _this = this;
|
|
4574
|
+
var storage$1 = routingControllers.getMetadataArgsStorage();
|
|
4575
|
+
var docs = routingControllersOpenapi.routingControllersToSpec(storage$1);
|
|
4576
|
+
docs.basePath = "/api/";
|
|
4577
|
+
docs.definitions = classValidatorJsonschema.validationMetadatasToSchemas({
|
|
4578
|
+
classTransformerMetadataStorage: storage.defaultMetadataStorage,
|
|
4579
|
+
additionalConverters: (_a = {},
|
|
4580
|
+
_a[classValidator.ValidationTypes.CUSTOM_VALIDATION] = function (meta, options) {
|
|
4581
|
+
var res = isFunction(_this.customValidation) ? _this.customValidation(meta, options) : _this.customValidation;
|
|
4582
|
+
if (isObject(res))
|
|
4583
|
+
return res;
|
|
4584
|
+
var constraints = meta.constraints || [];
|
|
4585
|
+
if (meta.constraintCls === exports.IsFile) {
|
|
4586
|
+
return {
|
|
4587
|
+
multi: constraints[0] || false,
|
|
4588
|
+
type: "file"
|
|
4589
|
+
};
|
|
4590
|
+
}
|
|
4591
|
+
if (meta.constraintCls === exports.IsObjectId) {
|
|
4592
|
+
return {
|
|
4593
|
+
endpoint: constraints[0] || false,
|
|
4594
|
+
multi: constraints[1] || false,
|
|
4595
|
+
type: "list"
|
|
4596
|
+
};
|
|
4597
|
+
}
|
|
4598
|
+
return null;
|
|
4599
|
+
},
|
|
4600
|
+
_a)
|
|
4509
4601
|
});
|
|
4602
|
+
docs.components.schemas = docs.definitions;
|
|
4603
|
+
return docs;
|
|
4510
4604
|
};
|
|
4511
|
-
return
|
|
4605
|
+
return OpenApi;
|
|
4512
4606
|
}());
|
|
4513
|
-
exports.
|
|
4514
|
-
tsyringe.
|
|
4515
|
-
tsyringe.
|
|
4516
|
-
__metadata$
|
|
4517
|
-
], exports.
|
|
4607
|
+
exports.OpenApi = __decorate$e([
|
|
4608
|
+
tsyringe.singleton(),
|
|
4609
|
+
__param$6(0, tsyringe.inject(OPENAPI_VALIDATION)),
|
|
4610
|
+
__metadata$b("design:paramtypes", [Object])
|
|
4611
|
+
], exports.OpenApi);
|
|
4518
4612
|
|
|
4519
4613
|
var __decorate$d = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
4520
4614
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -4606,7 +4700,7 @@
|
|
|
4606
4700
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4607
4701
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4608
4702
|
};
|
|
4609
|
-
var __metadata$
|
|
4703
|
+
var __metadata$a = (this && this.__metadata) || function (k, v) {
|
|
4610
4704
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
4611
4705
|
return Reflect.metadata(k, v);
|
|
4612
4706
|
};
|
|
@@ -4628,47 +4722,47 @@
|
|
|
4628
4722
|
classValidator.Min(-360),
|
|
4629
4723
|
classValidator.Max(360),
|
|
4630
4724
|
classValidator.IsOptional(),
|
|
4631
|
-
__metadata$
|
|
4725
|
+
__metadata$a("design:type", Number)
|
|
4632
4726
|
], AssetImageParams.prototype, "rotation", void 0);
|
|
4633
4727
|
__decorate$c([
|
|
4634
4728
|
classValidator.Min(0.0001),
|
|
4635
4729
|
classValidator.IsOptional(),
|
|
4636
|
-
__metadata$
|
|
4730
|
+
__metadata$a("design:type", Number)
|
|
4637
4731
|
], AssetImageParams.prototype, "canvasScaleX", void 0);
|
|
4638
4732
|
__decorate$c([
|
|
4639
4733
|
classValidator.Min(0.0001),
|
|
4640
4734
|
classValidator.IsOptional(),
|
|
4641
|
-
__metadata$
|
|
4735
|
+
__metadata$a("design:type", Number)
|
|
4642
4736
|
], AssetImageParams.prototype, "canvasScaleY", void 0);
|
|
4643
4737
|
__decorate$c([
|
|
4644
4738
|
classValidator.Min(0.0001),
|
|
4645
4739
|
classValidator.IsOptional(),
|
|
4646
|
-
__metadata$
|
|
4740
|
+
__metadata$a("design:type", Number)
|
|
4647
4741
|
], AssetImageParams.prototype, "scaleX", void 0);
|
|
4648
4742
|
__decorate$c([
|
|
4649
4743
|
classValidator.Min(0.0001),
|
|
4650
4744
|
classValidator.IsOptional(),
|
|
4651
|
-
__metadata$
|
|
4745
|
+
__metadata$a("design:type", Number)
|
|
4652
4746
|
], AssetImageParams.prototype, "scaleY", void 0);
|
|
4653
4747
|
__decorate$c([
|
|
4654
4748
|
classValidator.IsBoolean(),
|
|
4655
4749
|
classValidator.IsOptional(),
|
|
4656
|
-
__metadata$
|
|
4750
|
+
__metadata$a("design:type", Boolean)
|
|
4657
4751
|
], AssetImageParams.prototype, "lazy", void 0);
|
|
4658
4752
|
__decorate$c([
|
|
4659
4753
|
classValidator.IsBoolean(),
|
|
4660
4754
|
classValidator.IsOptional(),
|
|
4661
|
-
__metadata$
|
|
4755
|
+
__metadata$a("design:type", Boolean)
|
|
4662
4756
|
], AssetImageParams.prototype, "crop", void 0);
|
|
4663
4757
|
__decorate$c([
|
|
4664
4758
|
classValidator.IsBoolean(),
|
|
4665
4759
|
classValidator.IsOptional(),
|
|
4666
|
-
__metadata$
|
|
4760
|
+
__metadata$a("design:type", Boolean)
|
|
4667
4761
|
], AssetImageParams.prototype, "cropBefore", void 0);
|
|
4668
4762
|
__decorate$c([
|
|
4669
4763
|
classValidator.IsBoolean(),
|
|
4670
4764
|
classValidator.IsOptional(),
|
|
4671
|
-
__metadata$
|
|
4765
|
+
__metadata$a("design:type", Boolean)
|
|
4672
4766
|
], AssetImageParams.prototype, "cropAfter", void 0);
|
|
4673
4767
|
|
|
4674
4768
|
var __decorate$b = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
@@ -4681,7 +4775,7 @@
|
|
|
4681
4775
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4682
4776
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4683
4777
|
};
|
|
4684
|
-
var __metadata$
|
|
4778
|
+
var __metadata$9 = (this && this.__metadata) || function (k, v) {
|
|
4685
4779
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
4686
4780
|
return Reflect.metadata(k, v);
|
|
4687
4781
|
};
|
|
@@ -4869,57 +4963,57 @@
|
|
|
4869
4963
|
routingControllers.Authorized(),
|
|
4870
4964
|
routingControllers.Post(""),
|
|
4871
4965
|
__param$5(0, routingControllers.UploadedFile("file")),
|
|
4872
|
-
__metadata$
|
|
4873
|
-
__metadata$
|
|
4874
|
-
__metadata$
|
|
4966
|
+
__metadata$9("design:type", Function),
|
|
4967
|
+
__metadata$9("design:paramtypes", [Object]),
|
|
4968
|
+
__metadata$9("design:returntype", Promise)
|
|
4875
4969
|
], AssetsController.prototype, "upload", null);
|
|
4876
4970
|
__decorate$b([
|
|
4877
4971
|
routingControllers.Authorized(),
|
|
4878
4972
|
routingControllers.Post("url"),
|
|
4879
4973
|
__param$5(0, routingControllers.Body()),
|
|
4880
|
-
__metadata$
|
|
4881
|
-
__metadata$
|
|
4882
|
-
__metadata$
|
|
4974
|
+
__metadata$9("design:type", Function),
|
|
4975
|
+
__metadata$9("design:paramtypes", [Object]),
|
|
4976
|
+
__metadata$9("design:returntype", Promise)
|
|
4883
4977
|
], AssetsController.prototype, "uploadUrl", null);
|
|
4884
4978
|
__decorate$b([
|
|
4885
4979
|
routingControllers.Get("/:id"),
|
|
4886
4980
|
__param$5(0, routingControllers.Param("id")), __param$5(1, routingControllers.QueryParam("lazy")), __param$5(2, routingControllers.Res()),
|
|
4887
|
-
__metadata$
|
|
4888
|
-
__metadata$
|
|
4889
|
-
__metadata$
|
|
4981
|
+
__metadata$9("design:type", Function),
|
|
4982
|
+
__metadata$9("design:paramtypes", [String, Boolean, Object]),
|
|
4983
|
+
__metadata$9("design:returntype", Promise)
|
|
4890
4984
|
], AssetsController.prototype, "getFile", null);
|
|
4891
4985
|
__decorate$b([
|
|
4892
4986
|
routingControllers.Get("/image/:id/:rotation"),
|
|
4893
4987
|
__param$5(0, routingControllers.Param("id")), __param$5(1, routingControllers.QueryParams()), __param$5(2, routingControllers.Res()), __param$5(3, routingControllers.Param("rotation")),
|
|
4894
|
-
__metadata$
|
|
4895
|
-
__metadata$
|
|
4896
|
-
__metadata$
|
|
4988
|
+
__metadata$9("design:type", Function),
|
|
4989
|
+
__metadata$9("design:paramtypes", [String, AssetImageParams, Object, Number]),
|
|
4990
|
+
__metadata$9("design:returntype", Promise)
|
|
4897
4991
|
], AssetsController.prototype, "getImageRotation", null);
|
|
4898
4992
|
__decorate$b([
|
|
4899
4993
|
routingControllers.Get("/image/:id"),
|
|
4900
4994
|
__param$5(0, routingControllers.Param("id")), __param$5(1, routingControllers.QueryParams()), __param$5(2, routingControllers.Res()),
|
|
4901
|
-
__metadata$
|
|
4902
|
-
__metadata$
|
|
4903
|
-
__metadata$
|
|
4995
|
+
__metadata$9("design:type", Function),
|
|
4996
|
+
__metadata$9("design:paramtypes", [String, AssetImageParams, Object]),
|
|
4997
|
+
__metadata$9("design:returntype", Promise)
|
|
4904
4998
|
], AssetsController.prototype, "getImage", null);
|
|
4905
4999
|
__decorate$b([
|
|
4906
5000
|
routingControllers.Get("/by-name/:name"),
|
|
4907
5001
|
__param$5(0, routingControllers.Param("name")), __param$5(1, routingControllers.Res()),
|
|
4908
|
-
__metadata$
|
|
4909
|
-
__metadata$
|
|
4910
|
-
__metadata$
|
|
5002
|
+
__metadata$9("design:type", Function),
|
|
5003
|
+
__metadata$9("design:paramtypes", [String, Object]),
|
|
5004
|
+
__metadata$9("design:returntype", Promise)
|
|
4911
5005
|
], AssetsController.prototype, "getFileByName", null);
|
|
4912
5006
|
__decorate$b([
|
|
4913
5007
|
routingControllers.Get("/by-name/image/:name"),
|
|
4914
5008
|
__param$5(0, routingControllers.Param("name")), __param$5(1, routingControllers.QueryParams()), __param$5(2, routingControllers.Res()),
|
|
4915
|
-
__metadata$
|
|
4916
|
-
__metadata$
|
|
4917
|
-
__metadata$
|
|
5009
|
+
__metadata$9("design:type", Function),
|
|
5010
|
+
__metadata$9("design:paramtypes", [String, AssetImageParams, Object]),
|
|
5011
|
+
__metadata$9("design:returntype", Promise)
|
|
4918
5012
|
], AssetsController.prototype, "getImageByName", null);
|
|
4919
5013
|
AssetsController = __decorate$b([
|
|
4920
5014
|
tsyringe.injectable(),
|
|
4921
5015
|
routingControllers.Controller("/assets"),
|
|
4922
|
-
__metadata$
|
|
5016
|
+
__metadata$9("design:paramtypes", [exports.Assets, exports.AssetResolver])
|
|
4923
5017
|
], AssetsController);
|
|
4924
5018
|
|
|
4925
5019
|
var __decorate$a = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
@@ -4932,7 +5026,7 @@
|
|
|
4932
5026
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4933
5027
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4934
5028
|
};
|
|
4935
|
-
var __metadata$
|
|
5029
|
+
var __metadata$8 = (this && this.__metadata) || function (k, v) {
|
|
4936
5030
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
4937
5031
|
return Reflect.metadata(k, v);
|
|
4938
5032
|
};
|
|
@@ -5010,22 +5104,22 @@
|
|
|
5010
5104
|
__decorate$a([
|
|
5011
5105
|
routingControllers.Post("/login"),
|
|
5012
5106
|
__param$4(0, routingControllers.Body()), __param$4(1, routingControllers.Res()),
|
|
5013
|
-
__metadata$
|
|
5014
|
-
__metadata$
|
|
5015
|
-
__metadata$
|
|
5107
|
+
__metadata$8("design:type", Function),
|
|
5108
|
+
__metadata$8("design:paramtypes", [Object, Object]),
|
|
5109
|
+
__metadata$8("design:returntype", Promise)
|
|
5016
5110
|
], exports.AuthController.prototype, "login", null);
|
|
5017
5111
|
__decorate$a([
|
|
5018
5112
|
routingControllers.Authorized(),
|
|
5019
5113
|
routingControllers.Get("/user"),
|
|
5020
5114
|
__param$4(0, routingControllers.CurrentUser()),
|
|
5021
|
-
__metadata$
|
|
5022
|
-
__metadata$
|
|
5023
|
-
__metadata$
|
|
5115
|
+
__metadata$8("design:type", Function),
|
|
5116
|
+
__metadata$8("design:paramtypes", [Object]),
|
|
5117
|
+
__metadata$8("design:returntype", void 0)
|
|
5024
5118
|
], exports.AuthController.prototype, "getProfile", null);
|
|
5025
5119
|
exports.AuthController = __decorate$a([
|
|
5026
5120
|
tsyringe.injectable(),
|
|
5027
5121
|
routingControllers.Controller(),
|
|
5028
|
-
__metadata$
|
|
5122
|
+
__metadata$8("design:paramtypes", [exports.Configuration, exports.UserManager])
|
|
5029
5123
|
], exports.AuthController);
|
|
5030
5124
|
|
|
5031
5125
|
var __decorate$9 = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
@@ -5038,7 +5132,7 @@
|
|
|
5038
5132
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5039
5133
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5040
5134
|
};
|
|
5041
|
-
var __metadata$
|
|
5135
|
+
var __metadata$7 = (this && this.__metadata) || function (k, v) {
|
|
5042
5136
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
5043
5137
|
return Reflect.metadata(k, v);
|
|
5044
5138
|
};
|
|
@@ -5057,14 +5151,14 @@
|
|
|
5057
5151
|
__decorate$9([
|
|
5058
5152
|
routingControllers.Get("/:id"),
|
|
5059
5153
|
__param$3(0, routingControllers.Param("id")),
|
|
5060
|
-
__metadata$
|
|
5061
|
-
__metadata$
|
|
5062
|
-
__metadata$
|
|
5154
|
+
__metadata$7("design:type", Function),
|
|
5155
|
+
__metadata$7("design:paramtypes", [String]),
|
|
5156
|
+
__metadata$7("design:returntype", void 0)
|
|
5063
5157
|
], exports.GalleryController.prototype, "getFile", null);
|
|
5064
5158
|
exports.GalleryController = __decorate$9([
|
|
5065
5159
|
tsyringe.injectable(),
|
|
5066
5160
|
routingControllers.Controller("/gallery"),
|
|
5067
|
-
__metadata$
|
|
5161
|
+
__metadata$7("design:paramtypes", [exports.GalleryCache])
|
|
5068
5162
|
], exports.GalleryController);
|
|
5069
5163
|
|
|
5070
5164
|
var __decorate$8 = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
@@ -5077,7 +5171,7 @@
|
|
|
5077
5171
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5078
5172
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5079
5173
|
};
|
|
5080
|
-
var __metadata$
|
|
5174
|
+
var __metadata$6 = (this && this.__metadata) || function (k, v) {
|
|
5081
5175
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
5082
5176
|
return Reflect.metadata(k, v);
|
|
5083
5177
|
};
|
|
@@ -5132,14 +5226,14 @@
|
|
|
5132
5226
|
__decorate$8([
|
|
5133
5227
|
routingControllers.Get("/:id"),
|
|
5134
5228
|
__param$2(0, routingControllers.Param("id")),
|
|
5135
|
-
__metadata$
|
|
5136
|
-
__metadata$
|
|
5137
|
-
__metadata$
|
|
5229
|
+
__metadata$6("design:type", Function),
|
|
5230
|
+
__metadata$6("design:paramtypes", [String]),
|
|
5231
|
+
__metadata$6("design:returntype", Promise)
|
|
5138
5232
|
], ProgressesController.prototype, "getProgress", null);
|
|
5139
5233
|
ProgressesController = __decorate$8([
|
|
5140
5234
|
tsyringe.injectable(),
|
|
5141
5235
|
routingControllers.Controller("/progresses"),
|
|
5142
|
-
__metadata$
|
|
5236
|
+
__metadata$6("design:paramtypes", [exports.Progresses, exports.Configuration])
|
|
5143
5237
|
], ProgressesController);
|
|
5144
5238
|
|
|
5145
5239
|
var __decorate$7 = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
@@ -5152,7 +5246,7 @@
|
|
|
5152
5246
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5153
5247
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5154
5248
|
};
|
|
5155
|
-
var __metadata$
|
|
5249
|
+
var __metadata$5 = (this && this.__metadata) || function (k, v) {
|
|
5156
5250
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
5157
5251
|
return Reflect.metadata(k, v);
|
|
5158
5252
|
};
|
|
@@ -5221,6 +5315,9 @@
|
|
|
5221
5315
|
result.param = error.message;
|
|
5222
5316
|
return [3 /*break*/, 5];
|
|
5223
5317
|
case 2:
|
|
5318
|
+
if (error instanceof axios.AxiosError) {
|
|
5319
|
+
console.log(error.response);
|
|
5320
|
+
}
|
|
5224
5321
|
_b = result;
|
|
5225
5322
|
_c = error.message;
|
|
5226
5323
|
if (_c) return [3 /*break*/, 4];
|
|
@@ -5262,7 +5359,7 @@
|
|
|
5262
5359
|
exports.ErrorHandlerMiddleware = __decorate$7([
|
|
5263
5360
|
tsyringe.injectable(),
|
|
5264
5361
|
routingControllers.Middleware({ type: "after" }),
|
|
5265
|
-
__metadata$
|
|
5362
|
+
__metadata$5("design:paramtypes", [exports.Configuration, exports.Translator])
|
|
5266
5363
|
], exports.ErrorHandlerMiddleware);
|
|
5267
5364
|
|
|
5268
5365
|
var __decorate$6 = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
@@ -5275,7 +5372,7 @@
|
|
|
5275
5372
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5276
5373
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5277
5374
|
};
|
|
5278
|
-
var __metadata$
|
|
5375
|
+
var __metadata$4 = (this && this.__metadata) || function (k, v) {
|
|
5279
5376
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
5280
5377
|
return Reflect.metadata(k, v);
|
|
5281
5378
|
};
|
|
@@ -5296,7 +5393,7 @@
|
|
|
5296
5393
|
tsyringe.injectable(),
|
|
5297
5394
|
routingControllers.Middleware({ type: "before" }),
|
|
5298
5395
|
__param$1(0, tsyringe.inject(DI_CONTAINER)),
|
|
5299
|
-
__metadata$
|
|
5396
|
+
__metadata$4("design:paramtypes", [Object])
|
|
5300
5397
|
], ContainerMiddleware);
|
|
5301
5398
|
|
|
5302
5399
|
var __decorate$5 = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
@@ -5309,7 +5406,7 @@
|
|
|
5309
5406
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5310
5407
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5311
5408
|
};
|
|
5312
|
-
var __metadata$
|
|
5409
|
+
var __metadata$3 = (this && this.__metadata) || function (k, v) {
|
|
5313
5410
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
5314
5411
|
return Reflect.metadata(k, v);
|
|
5315
5412
|
};
|
|
@@ -5326,7 +5423,7 @@
|
|
|
5326
5423
|
exports.LanguageMiddleware = __decorate$5([
|
|
5327
5424
|
tsyringe.injectable(),
|
|
5328
5425
|
routingControllers.Middleware({ type: "before" }),
|
|
5329
|
-
__metadata$
|
|
5426
|
+
__metadata$3("design:paramtypes", [exports.Configuration])
|
|
5330
5427
|
], exports.LanguageMiddleware);
|
|
5331
5428
|
|
|
5332
5429
|
var __decorate$4 = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
@@ -5339,22 +5436,28 @@
|
|
|
5339
5436
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5340
5437
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5341
5438
|
};
|
|
5439
|
+
var __metadata$2 = (this && this.__metadata) || function (k, v) {
|
|
5440
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
5441
|
+
return Reflect.metadata(k, v);
|
|
5442
|
+
};
|
|
5342
5443
|
var RequestEndedMiddleware = /** @class */ (function () {
|
|
5343
|
-
function RequestEndedMiddleware() {
|
|
5444
|
+
function RequestEndedMiddleware(logger) {
|
|
5445
|
+
this.logger = logger;
|
|
5344
5446
|
}
|
|
5345
5447
|
RequestEndedMiddleware.prototype.use = function (request, response, next) {
|
|
5346
5448
|
request.ended = moment__default["default"]();
|
|
5347
5449
|
var diff = request.ended.diff(request.started);
|
|
5348
5450
|
var duration = moment__default["default"].duration(diff);
|
|
5349
|
-
|
|
5350
|
-
|
|
5451
|
+
this.logger.log("request-time", "Request '" + request.id + "' ended at: " + request.ended.format("YYYY-MM-DD HH:mm:ss") + " [" + request.method + "] " + request.url);
|
|
5452
|
+
this.logger.log("request-time", "Request '" + request.id + "' lasted: " + duration.asMilliseconds() + "ms");
|
|
5351
5453
|
next(null);
|
|
5352
5454
|
};
|
|
5353
5455
|
return RequestEndedMiddleware;
|
|
5354
5456
|
}());
|
|
5355
5457
|
RequestEndedMiddleware = __decorate$4([
|
|
5356
5458
|
tsyringe.injectable(),
|
|
5357
|
-
routingControllers.Middleware({ type: "after" })
|
|
5459
|
+
routingControllers.Middleware({ type: "after" }),
|
|
5460
|
+
__metadata$2("design:paramtypes", [exports["ɵa"]])
|
|
5358
5461
|
], RequestEndedMiddleware);
|
|
5359
5462
|
|
|
5360
5463
|
var __decorate$3 = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
@@ -5367,20 +5470,26 @@
|
|
|
5367
5470
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5368
5471
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5369
5472
|
};
|
|
5473
|
+
var __metadata$1 = (this && this.__metadata) || function (k, v) {
|
|
5474
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
5475
|
+
return Reflect.metadata(k, v);
|
|
5476
|
+
};
|
|
5370
5477
|
var RequestStartedMiddleware = /** @class */ (function () {
|
|
5371
|
-
function RequestStartedMiddleware() {
|
|
5478
|
+
function RequestStartedMiddleware(logger) {
|
|
5479
|
+
this.logger = logger;
|
|
5372
5480
|
}
|
|
5373
5481
|
RequestStartedMiddleware.prototype.use = function (request, response, next) {
|
|
5374
5482
|
request.id = new bson.ObjectId().toHexString();
|
|
5375
5483
|
request.started = moment__default["default"]();
|
|
5376
|
-
|
|
5484
|
+
this.logger.log("request-time", "Request '" + request.id + "' started at: " + request.started.format("YYYY-MM-DD HH:mm:ss") + " [" + request.method + "] " + request.url);
|
|
5377
5485
|
next(null);
|
|
5378
5486
|
};
|
|
5379
5487
|
return RequestStartedMiddleware;
|
|
5380
5488
|
}());
|
|
5381
5489
|
RequestStartedMiddleware = __decorate$3([
|
|
5382
5490
|
tsyringe.injectable(),
|
|
5383
|
-
routingControllers.Middleware({ type: "before" })
|
|
5491
|
+
routingControllers.Middleware({ type: "before" }),
|
|
5492
|
+
__metadata$1("design:paramtypes", [exports["ɵa"]])
|
|
5384
5493
|
], RequestStartedMiddleware);
|
|
5385
5494
|
|
|
5386
5495
|
var __decorate$2 = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
@@ -5514,74 +5623,6 @@
|
|
|
5514
5623
|
socketControllers.Middleware()
|
|
5515
5624
|
], CompressionMiddleware);
|
|
5516
5625
|
|
|
5517
|
-
var __awaiter$4 = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
5518
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
5519
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5520
|
-
function fulfilled(value) { try {
|
|
5521
|
-
step(generator.next(value));
|
|
5522
|
-
}
|
|
5523
|
-
catch (e) {
|
|
5524
|
-
reject(e);
|
|
5525
|
-
} }
|
|
5526
|
-
function rejected(value) { try {
|
|
5527
|
-
step(generator["throw"](value));
|
|
5528
|
-
}
|
|
5529
|
-
catch (e) {
|
|
5530
|
-
reject(e);
|
|
5531
|
-
} }
|
|
5532
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
5533
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
5534
|
-
});
|
|
5535
|
-
};
|
|
5536
|
-
function setupStatic(rootFolder, container) {
|
|
5537
|
-
return __awaiter$4(this, void 0, void 0, function () {
|
|
5538
|
-
var browserFolder, app, ep;
|
|
5539
|
-
return __generator(this, function (_a) {
|
|
5540
|
-
switch (_a.label) {
|
|
5541
|
-
case 0:
|
|
5542
|
-
browserFolder = path.resolve(rootFolder || __dirname, "public_html");
|
|
5543
|
-
app = container.get(EXPRESS);
|
|
5544
|
-
ep = container.get(exports.EndpointProvider);
|
|
5545
|
-
console.log(browserFolder, fs.existsSync(browserFolder));
|
|
5546
|
-
if (fs.existsSync(browserFolder)) {
|
|
5547
|
-
console.log("public_html exists. setting up static files serving...");
|
|
5548
|
-
app.use(express_["static"](browserFolder, {
|
|
5549
|
-
maxAge: "1y"
|
|
5550
|
-
}));
|
|
5551
|
-
}
|
|
5552
|
-
else {
|
|
5553
|
-
console.log("public_html does not exist on path: \"" + browserFolder + "\"");
|
|
5554
|
-
}
|
|
5555
|
-
return [4 /*yield*/, ep.configure(app)];
|
|
5556
|
-
case 1:
|
|
5557
|
-
_a.sent();
|
|
5558
|
-
return [2 /*return*/];
|
|
5559
|
-
}
|
|
5560
|
-
});
|
|
5561
|
-
});
|
|
5562
|
-
}
|
|
5563
|
-
|
|
5564
|
-
var BaseDoc = /** @class */ (function () {
|
|
5565
|
-
function BaseDoc() {
|
|
5566
|
-
}
|
|
5567
|
-
/**
|
|
5568
|
-
* Casts this to DocumentType<this> to allow using document methods in get/set-s
|
|
5569
|
-
*/
|
|
5570
|
-
BaseDoc.prototype.cast = function () {
|
|
5571
|
-
return this;
|
|
5572
|
-
};
|
|
5573
|
-
/**
|
|
5574
|
-
* Gets a pre-compiled model from typegoose cache by its class type
|
|
5575
|
-
* @param type
|
|
5576
|
-
*/
|
|
5577
|
-
BaseDoc.prototype.model = function (type) {
|
|
5578
|
-
return typegoose.getModelForClass(type);
|
|
5579
|
-
};
|
|
5580
|
-
return BaseDoc;
|
|
5581
|
-
}());
|
|
5582
|
-
var PrimitiveArray = mongoose.Types.Array;
|
|
5583
|
-
var DocumentArray = mongoose.Types.DocumentArray;
|
|
5584
|
-
|
|
5585
5626
|
var Tree = /** @class */ (function () {
|
|
5586
5627
|
function Tree(container, exists, path) {
|
|
5587
5628
|
this.container = container;
|
|
@@ -5814,7 +5855,7 @@
|
|
|
5814
5855
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5815
5856
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5816
5857
|
};
|
|
5817
|
-
var __awaiter$
|
|
5858
|
+
var __awaiter$4 = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
5818
5859
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
5819
5860
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5820
5861
|
function fulfilled(value) { try {
|
|
@@ -5837,7 +5878,7 @@
|
|
|
5837
5878
|
function EmptyJob() {
|
|
5838
5879
|
}
|
|
5839
5880
|
EmptyJob.prototype.process = function () {
|
|
5840
|
-
return __awaiter$
|
|
5881
|
+
return __awaiter$4(this, void 0, void 0, function () {
|
|
5841
5882
|
return __generator(this, function (_a) {
|
|
5842
5883
|
return [2 /*return*/, null];
|
|
5843
5884
|
});
|
|
@@ -5850,6 +5891,81 @@
|
|
|
5850
5891
|
tsyringe.scoped(tsyringe.Lifecycle.ContainerScoped)
|
|
5851
5892
|
], EmptyJob);
|
|
5852
5893
|
|
|
5894
|
+
var __awaiter$3 = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
5895
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
5896
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5897
|
+
function fulfilled(value) { try {
|
|
5898
|
+
step(generator.next(value));
|
|
5899
|
+
}
|
|
5900
|
+
catch (e) {
|
|
5901
|
+
reject(e);
|
|
5902
|
+
} }
|
|
5903
|
+
function rejected(value) { try {
|
|
5904
|
+
step(generator["throw"](value));
|
|
5905
|
+
}
|
|
5906
|
+
catch (e) {
|
|
5907
|
+
reject(e);
|
|
5908
|
+
} }
|
|
5909
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
5910
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
5911
|
+
});
|
|
5912
|
+
};
|
|
5913
|
+
function setupStatic(rootFolder, container) {
|
|
5914
|
+
return __awaiter$3(this, void 0, void 0, function () {
|
|
5915
|
+
var browserFolder, app, ep;
|
|
5916
|
+
return __generator(this, function (_a) {
|
|
5917
|
+
switch (_a.label) {
|
|
5918
|
+
case 0:
|
|
5919
|
+
browserFolder = path.resolve(rootFolder || __dirname, "public_html");
|
|
5920
|
+
app = container.get(EXPRESS);
|
|
5921
|
+
ep = container.get(exports.EndpointProvider);
|
|
5922
|
+
console.log(browserFolder, fs.existsSync(browserFolder));
|
|
5923
|
+
if (fs.existsSync(browserFolder)) {
|
|
5924
|
+
console.log("public_html exists. setting up static files serving...");
|
|
5925
|
+
app.use(express_["static"](browserFolder, {
|
|
5926
|
+
maxAge: "1y"
|
|
5927
|
+
}));
|
|
5928
|
+
}
|
|
5929
|
+
else {
|
|
5930
|
+
console.log("public_html does not exist on path: \"" + browserFolder + "\"");
|
|
5931
|
+
}
|
|
5932
|
+
return [4 /*yield*/, ep.configure(app)];
|
|
5933
|
+
case 1:
|
|
5934
|
+
_a.sent();
|
|
5935
|
+
return [2 /*return*/];
|
|
5936
|
+
}
|
|
5937
|
+
});
|
|
5938
|
+
});
|
|
5939
|
+
}
|
|
5940
|
+
|
|
5941
|
+
var BaseDoc = /** @class */ (function () {
|
|
5942
|
+
function BaseDoc() {
|
|
5943
|
+
}
|
|
5944
|
+
/**
|
|
5945
|
+
* Casts this to DocumentType<this> to allow using document methods in get/set-s
|
|
5946
|
+
*/
|
|
5947
|
+
BaseDoc.prototype.cast = function () {
|
|
5948
|
+
return this;
|
|
5949
|
+
};
|
|
5950
|
+
/**
|
|
5951
|
+
* Gets a pre-compiled model from typegoose cache by its class type
|
|
5952
|
+
* @param type
|
|
5953
|
+
*/
|
|
5954
|
+
BaseDoc.prototype.model = function (type) {
|
|
5955
|
+
return typegoose.getModelForClass(type);
|
|
5956
|
+
};
|
|
5957
|
+
return BaseDoc;
|
|
5958
|
+
}());
|
|
5959
|
+
var PrimitiveArray = mongoose.Types.Array;
|
|
5960
|
+
var DocumentArray = mongoose.Types.DocumentArray;
|
|
5961
|
+
|
|
5962
|
+
function IsDocumented() {
|
|
5963
|
+
return routingControllersOpenapi.OpenAPI(function (operation) {
|
|
5964
|
+
operation.tags = ["Documented"].concat(operation.tags || []);
|
|
5965
|
+
return operation;
|
|
5966
|
+
});
|
|
5967
|
+
}
|
|
5968
|
+
|
|
5853
5969
|
var __awaiter$2 = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
5854
5970
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
5855
5971
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -6295,6 +6411,7 @@
|
|
|
6295
6411
|
new Parameter("jsonLimit", "250mb"),
|
|
6296
6412
|
new Parameter("jobTimeout", 5 * 60 * 1000),
|
|
6297
6413
|
new Parameter("cacheCollection", "cache"),
|
|
6414
|
+
new Parameter("logTags", []),
|
|
6298
6415
|
];
|
|
6299
6416
|
// Convert parameters to providers
|
|
6300
6417
|
var paramProviders = params.map(function (p) {
|
|
@@ -6319,9 +6436,11 @@
|
|
|
6319
6436
|
exports.IdGenerator,
|
|
6320
6437
|
exports.JobManager,
|
|
6321
6438
|
exports.LazyAssets,
|
|
6439
|
+
exports["ɵa"],
|
|
6322
6440
|
exports.MailSender,
|
|
6323
6441
|
exports.MemoryCache,
|
|
6324
6442
|
exports.MongoConnector,
|
|
6443
|
+
exports.OpenApi,
|
|
6325
6444
|
exports.Progresses,
|
|
6326
6445
|
exports.TemplateRenderer,
|
|
6327
6446
|
exports.TranslationProvider,
|
|
@@ -6341,7 +6460,7 @@
|
|
|
6341
6460
|
}
|
|
6342
6461
|
function setupBackend(config, providers, parent) {
|
|
6343
6462
|
return __awaiter(this, void 0, void 0, function () {
|
|
6344
|
-
var fixtureTypes, fixtureProviders, paramProviders, jobProviders, restOptions, socketOptions, allProviders, diContainer, configuration, bp, connector;
|
|
6463
|
+
var fixtureTypes, fixtureProviders, paramProviders, jobProviders, restOptions, socketOptions, allProviders, diContainer, configuration, bp, openApi_1, connector;
|
|
6345
6464
|
var _this = this;
|
|
6346
6465
|
return __generator(this, function (_a) {
|
|
6347
6466
|
switch (_a.label) {
|
|
@@ -6423,6 +6542,9 @@
|
|
|
6423
6542
|
diContainer.register(DI_CONTAINER, {
|
|
6424
6543
|
useValue: diContainer
|
|
6425
6544
|
});
|
|
6545
|
+
diContainer.register(OPENAPI_VALIDATION, {
|
|
6546
|
+
useValue: config.customValidation || (function () { return null; })
|
|
6547
|
+
});
|
|
6426
6548
|
diContainers.appContainer = diContainers.appContainer || diContainer;
|
|
6427
6549
|
// Authentication
|
|
6428
6550
|
restOptions.authorizationChecker = function (action, roles) { return __awaiter(_this, void 0, void 0, function () {
|
|
@@ -6513,9 +6635,12 @@
|
|
|
6513
6635
|
}));
|
|
6514
6636
|
routingControllers.useContainer(diContainer);
|
|
6515
6637
|
routingControllers.useExpressServer(bp.express, restOptions);
|
|
6516
|
-
|
|
6638
|
+
openApi_1 = null;
|
|
6517
6639
|
bp.express.get("/api-docs", function (req, res) {
|
|
6518
|
-
|
|
6640
|
+
openApi_1 = openApi_1 || diContainer.get(exports.OpenApi);
|
|
6641
|
+
res.header("Content-Type", "application/json")
|
|
6642
|
+
.status(200)
|
|
6643
|
+
.end(openApi_1.apiDocsStr);
|
|
6519
6644
|
});
|
|
6520
6645
|
}
|
|
6521
6646
|
if (config.socketOptions) {
|
|
@@ -6550,8 +6675,10 @@
|
|
|
6550
6675
|
exports.EXPRESS = EXPRESS;
|
|
6551
6676
|
exports.FIXTURE = FIXTURE;
|
|
6552
6677
|
exports.HTTP_SERVER = HTTP_SERVER;
|
|
6678
|
+
exports.IsDocumented = IsDocumented;
|
|
6553
6679
|
exports.JOB = JOB;
|
|
6554
6680
|
exports.LazyAssetGenerator = LazyAssetGenerator;
|
|
6681
|
+
exports.OPENAPI_VALIDATION = OPENAPI_VALIDATION;
|
|
6555
6682
|
exports.PARAMETER = PARAMETER;
|
|
6556
6683
|
exports.Parameter = Parameter;
|
|
6557
6684
|
exports.PrimitiveArray = PrimitiveArray;
|