@stemy/backend 3.4.0 → 3.4.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 +493 -429
- package/bundles/stemy-backend.umd.js.map +1 -1
- package/common-types.d.ts +1 -0
- package/esm2015/common-types.js +1 -1
- package/esm2015/public_api.js +4 -3
- package/esm2015/utilities/base-doc.js +11 -2
- package/esm2015/utilities/mongoose.js +225 -0
- package/esm2015/utils.js +2 -181
- package/fesm2015/stemy-backend.js +409 -356
- package/fesm2015/stemy-backend.js.map +1 -1
- package/package.json +1 -1
- package/public_api.d.ts +3 -2
- package/stemy-backend.metadata.json +1 -1
- package/utilities/base-doc.d.ts +10 -4
- package/utilities/mongoose.d.ts +36 -0
- package/utils.d.ts +3 -19
|
@@ -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('routing-controllers-openapi'), require('class-transformer/storage'), require('class-validator'), require('class-validator-jsonschema'), require('child_process'), require('crypto'), require('rxjs'), require('rxjs/internal/util/canReportError'), require('fs'), require('mongodb'), require('mongoose'), require('
|
|
3
|
-
typeof define === 'function' && define.amd ? define('@stemy/backend', ['exports', 'path', 'body-parser', 'jsonwebtoken', 'tsyringe', 'routing-controllers', 'socket-controllers', 'routing-controllers-openapi', 'class-transformer/storage', 'class-validator', 'class-validator-jsonschema', 'child_process', 'crypto', 'rxjs', 'rxjs/internal/util/canReportError', 'fs', 'mongodb', 'mongoose', '
|
|
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["routing-controllers-openapi"], global["class-transformer/storage"], global["class-validator"], global["class-validator-jsonschema"], global.child_process, global.crypto, global.rxjs, global.rxjs["internal/util/canReportError"], global.fs, global.mongodb, global.mongoose, global
|
|
5
|
-
})(this, (function (exports, path, bodyParser, jsonwebtoken, tsyringe, routingControllers, socketControllers, routingControllersOpenapi, storage, classValidator, classValidatorJsonschema, child_process, crypto, rxjs, canReportError, fs, mongodb, mongoose,
|
|
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('routing-controllers-openapi'), require('class-transformer/storage'), require('class-validator'), require('class-validator-jsonschema'), require('child_process'), require('crypto'), require('rxjs'), require('rxjs/internal/util/canReportError'), require('fs'), require('mongodb'), require('mongoose'), require('stream'), require('sharp'), require('bson'), require('fontkit'), require('file-type'), require('axios'), require('dotenv'), require('node-cron'), require('zeromq'), require('rxjs/operators'), require('http'), require('express'), require('socket.io'), require('uuid'), require('nodemailer'), require('handlebars'), 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', 'routing-controllers-openapi', 'class-transformer/storage', 'class-validator', 'class-validator-jsonschema', 'child_process', 'crypto', 'rxjs', 'rxjs/internal/util/canReportError', 'fs', 'mongodb', 'mongoose', 'stream', 'sharp', 'bson', 'fontkit', 'file-type', 'axios', 'dotenv', 'node-cron', 'zeromq', 'rxjs/operators', 'http', 'express', 'socket.io', 'uuid', 'nodemailer', 'handlebars', '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["routing-controllers-openapi"], global["class-transformer/storage"], global["class-validator"], global["class-validator-jsonschema"], global.child_process, global.crypto, global.rxjs, global.rxjs["internal/util/canReportError"], global.fs, global.mongodb, global.mongoose, global.stream, global.sharp, global.bson, global.fontkit, global["file-type"], global.axios, global.dotenv, global["node-cron"], global.zeromq, global.rxjs.operators, global.http, global.express, global.socket.io, global.uuid, global.nodemailer, global.handlebars, global.bcrypt, global.moment, global.typegoose, global["mongoose-lib-utils"]));
|
|
5
|
+
})(this, (function (exports, path, bodyParser, jsonwebtoken, tsyringe, routingControllers, socketControllers, routingControllersOpenapi, storage, classValidator, classValidatorJsonschema, child_process, crypto, rxjs, canReportError, fs, mongodb, mongoose, stream, sharp_, bson, fontKit_, fileType, axios, dotenv, nodeCron, zeromq, operators, http, express_, socket_io, uuid, nodemailer, Handlebars, 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
|
|
|
@@ -104,7 +104,7 @@
|
|
|
104
104
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
105
105
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
106
106
|
}
|
|
107
|
-
function __awaiter$
|
|
107
|
+
function __awaiter$y(thisArg, _arguments, P, generator) {
|
|
108
108
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
109
109
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
110
110
|
function fulfilled(value) { try {
|
|
@@ -360,7 +360,7 @@
|
|
|
360
360
|
return typeof state === "function" ? receiver === state : state.has(receiver);
|
|
361
361
|
}
|
|
362
362
|
|
|
363
|
-
var __awaiter$
|
|
363
|
+
var __awaiter$x = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
364
364
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
365
365
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
366
366
|
function fulfilled(value) { try {
|
|
@@ -534,177 +534,6 @@
|
|
|
534
534
|
}
|
|
535
535
|
return value;
|
|
536
536
|
}
|
|
537
|
-
function injectServices(schema, services) {
|
|
538
|
-
var serviceMap = {};
|
|
539
|
-
Object.keys(services).forEach(function (prop) {
|
|
540
|
-
schema
|
|
541
|
-
.virtual(prop)
|
|
542
|
-
.get(function () {
|
|
543
|
-
var diContainer = diContainers.appContainer;
|
|
544
|
-
serviceMap[prop] = serviceMap[prop] || (!diContainer ? {} : diContainer.resolve(services[prop]));
|
|
545
|
-
return serviceMap[prop];
|
|
546
|
-
});
|
|
547
|
-
});
|
|
548
|
-
}
|
|
549
|
-
function paginate(model, where, params) {
|
|
550
|
-
return model.countDocuments(where).then(function (count) {
|
|
551
|
-
var query = model.find(where);
|
|
552
|
-
if (isString(params.sort)) {
|
|
553
|
-
query = query.sort(params.sort);
|
|
554
|
-
}
|
|
555
|
-
if (isArray(params.populate)) {
|
|
556
|
-
params.populate.forEach(function (field) {
|
|
557
|
-
query = query.populate(field);
|
|
558
|
-
});
|
|
559
|
-
}
|
|
560
|
-
return (params.limit > 0 ? query.skip(params.page * params.limit).limit(params.limit) : query).then(function (items) {
|
|
561
|
-
var meta = { total: count };
|
|
562
|
-
return { count: count, items: items, meta: meta };
|
|
563
|
-
});
|
|
564
|
-
});
|
|
565
|
-
}
|
|
566
|
-
function lookupStages(from, localField, as, foreignField, shouldUnwind) {
|
|
567
|
-
if (as === void 0) { as = null; }
|
|
568
|
-
if (foreignField === void 0) { foreignField = "_id"; }
|
|
569
|
-
if (shouldUnwind === void 0) { shouldUnwind = true; }
|
|
570
|
-
as = as || localField.replace("Id", "");
|
|
571
|
-
var stages = [
|
|
572
|
-
{
|
|
573
|
-
$lookup: {
|
|
574
|
-
from: from,
|
|
575
|
-
localField: localField,
|
|
576
|
-
foreignField: foreignField,
|
|
577
|
-
as: as
|
|
578
|
-
}
|
|
579
|
-
},
|
|
580
|
-
{
|
|
581
|
-
$unwind: {
|
|
582
|
-
path: "$" + as,
|
|
583
|
-
preserveNullAndEmptyArrays: true
|
|
584
|
-
}
|
|
585
|
-
}
|
|
586
|
-
];
|
|
587
|
-
if (!shouldUnwind) {
|
|
588
|
-
stages.splice(1, 1);
|
|
589
|
-
}
|
|
590
|
-
return stages;
|
|
591
|
-
}
|
|
592
|
-
function letsLookupStage(from, pipeline, as, letFields) {
|
|
593
|
-
if (as === void 0) { as = null; }
|
|
594
|
-
if (letFields === void 0) { letFields = null; }
|
|
595
|
-
as = as || from;
|
|
596
|
-
letFields = letFields || { id: "$_id" };
|
|
597
|
-
return {
|
|
598
|
-
$lookup: {
|
|
599
|
-
from: from,
|
|
600
|
-
let: letFields,
|
|
601
|
-
pipeline: pipeline,
|
|
602
|
-
as: as
|
|
603
|
-
}
|
|
604
|
-
};
|
|
605
|
-
}
|
|
606
|
-
function matchStage(match) {
|
|
607
|
-
return { $match: match };
|
|
608
|
-
}
|
|
609
|
-
function matchField(field, filter, when) {
|
|
610
|
-
return { field: field, filter: filter, when: when };
|
|
611
|
-
}
|
|
612
|
-
function matchFieldStages() {
|
|
613
|
-
var fields = [];
|
|
614
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
615
|
-
fields[_i] = arguments[_i];
|
|
616
|
-
}
|
|
617
|
-
var match = {};
|
|
618
|
-
fields.forEach(function (field) {
|
|
619
|
-
if (field.when) {
|
|
620
|
-
match[field.field] = field.filter;
|
|
621
|
-
}
|
|
622
|
-
});
|
|
623
|
-
return Object.keys(match).length > 0 ? [matchStage(match)] : [];
|
|
624
|
-
}
|
|
625
|
-
function projectStage(fields) {
|
|
626
|
-
return { $project: fields };
|
|
627
|
-
}
|
|
628
|
-
function unwindStage(fieldOrOpts) {
|
|
629
|
-
return { $unwind: fieldOrOpts };
|
|
630
|
-
}
|
|
631
|
-
function hydratePopulated(modelType, json) {
|
|
632
|
-
var e_2, _a;
|
|
633
|
-
var object = modelType.hydrate(json);
|
|
634
|
-
var _loop_1 = function (path, obj) {
|
|
635
|
-
var ref = obj.ref, type = obj.type;
|
|
636
|
-
if (Array.isArray(type) && type.length > 0) {
|
|
637
|
-
ref = type[0].ref;
|
|
638
|
-
}
|
|
639
|
-
if (!ref)
|
|
640
|
-
return "continue";
|
|
641
|
-
var value = utils.getValue(path, json);
|
|
642
|
-
var hydrateVal = function (val) {
|
|
643
|
-
if (val == null || val instanceof mongoose.Types.ObjectId)
|
|
644
|
-
return val;
|
|
645
|
-
return hydratePopulated(mongoose.model(ref), val);
|
|
646
|
-
};
|
|
647
|
-
if (Array.isArray(value)) {
|
|
648
|
-
utils.setValue(path, value.map(hydrateVal), object);
|
|
649
|
-
return "continue";
|
|
650
|
-
}
|
|
651
|
-
utils.setValue(path, hydrateVal(value), object);
|
|
652
|
-
};
|
|
653
|
-
try {
|
|
654
|
-
for (var _b = __values(Object.entries(modelType.schema.obj)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
655
|
-
var _d = __read(_c.value, 2), path = _d[0], obj = _d[1];
|
|
656
|
-
_loop_1(path, obj);
|
|
657
|
-
}
|
|
658
|
-
}
|
|
659
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
660
|
-
finally {
|
|
661
|
-
try {
|
|
662
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
663
|
-
}
|
|
664
|
-
finally { if (e_2) throw e_2.error; }
|
|
665
|
-
}
|
|
666
|
-
return object;
|
|
667
|
-
}
|
|
668
|
-
function paginateAggregations(model, aggregations, params, metaProjection) {
|
|
669
|
-
if (metaProjection === void 0) { metaProjection = {}; }
|
|
670
|
-
return __awaiter$w(this, void 0, void 0, function () {
|
|
671
|
-
var sortField, sortAggregation, result, pagination;
|
|
672
|
-
var _a;
|
|
673
|
-
return __generator(this, function (_b) {
|
|
674
|
-
switch (_b.label) {
|
|
675
|
-
case 0:
|
|
676
|
-
sortField = !isString(params.sort) || !params.sort ? null : (params.sort.startsWith("-") ? params.sort.substr(1) : params.sort);
|
|
677
|
-
sortAggregation = !sortField ? [] : [{
|
|
678
|
-
$sort: (_a = {}, _a[sortField] = sortField == params.sort ? 1 : -1, _a)
|
|
679
|
-
}];
|
|
680
|
-
return [4 /*yield*/, model.aggregate(__spreadArray(__spreadArray(__spreadArray([], __read(aggregations)), __read(sortAggregation)), [
|
|
681
|
-
{
|
|
682
|
-
$group: {
|
|
683
|
-
_id: "results",
|
|
684
|
-
result: { $push: "$$CURRENT" }
|
|
685
|
-
}
|
|
686
|
-
},
|
|
687
|
-
{
|
|
688
|
-
$project: {
|
|
689
|
-
_id: 0,
|
|
690
|
-
items: params.limit > 0 ? { $slice: ["$result", params.page * params.limit, params.limit] } : "$result",
|
|
691
|
-
count: { $size: "$result" },
|
|
692
|
-
meta: Object.assign({ total: { $size: "$result" } }, metaProjection)
|
|
693
|
-
}
|
|
694
|
-
}
|
|
695
|
-
]))];
|
|
696
|
-
case 1:
|
|
697
|
-
result = _b.sent();
|
|
698
|
-
pagination = result[0];
|
|
699
|
-
if (!pagination) {
|
|
700
|
-
return [2 /*return*/, { items: [], count: 0, meta: { total: 0 } }];
|
|
701
|
-
}
|
|
702
|
-
pagination.items = pagination.items.map(function (i) { return hydratePopulated(model, i); });
|
|
703
|
-
return [2 /*return*/, pagination];
|
|
704
|
-
}
|
|
705
|
-
});
|
|
706
|
-
});
|
|
707
|
-
}
|
|
708
537
|
var cropInterface = {
|
|
709
538
|
x: "number",
|
|
710
539
|
y: "number",
|
|
@@ -731,8 +560,8 @@
|
|
|
731
560
|
};
|
|
732
561
|
}
|
|
733
562
|
function toImage(src, params, meta) {
|
|
734
|
-
return __awaiter$
|
|
735
|
-
var crop, buffer, _a, cropBefore, cropAfter, img, _b, width, height, canvasScaleX, canvasScaleY,
|
|
563
|
+
return __awaiter$x(this, void 0, void 0, function () {
|
|
564
|
+
var crop, buffer, _a, cropBefore, cropAfter, img, _b, width, height, canvasScaleX, canvasScaleY, e_2;
|
|
736
565
|
return __generator(this, function (_c) {
|
|
737
566
|
switch (_c.label) {
|
|
738
567
|
case 0:
|
|
@@ -810,8 +639,8 @@
|
|
|
810
639
|
src = src instanceof stream.Readable ? bufferToStream(buffer) : buffer;
|
|
811
640
|
return [2 /*return*/, src];
|
|
812
641
|
case 9:
|
|
813
|
-
|
|
814
|
-
console.log("Image conversion error",
|
|
642
|
+
e_2 = _c.sent();
|
|
643
|
+
console.log("Image conversion error", e_2);
|
|
815
644
|
src = src instanceof stream.Readable ? bufferToStream(buffer) : buffer;
|
|
816
645
|
return [2 /*return*/, src];
|
|
817
646
|
case 10: return [2 /*return*/];
|
|
@@ -892,7 +721,7 @@
|
|
|
892
721
|
}
|
|
893
722
|
function readAndDeleteFile(path, timeout) {
|
|
894
723
|
if (timeout === void 0) { timeout = 5000; }
|
|
895
|
-
return __awaiter$
|
|
724
|
+
return __awaiter$x(this, void 0, void 0, function () {
|
|
896
725
|
var data;
|
|
897
726
|
return __generator(this, function (_a) {
|
|
898
727
|
switch (_a.label) {
|
|
@@ -909,7 +738,7 @@
|
|
|
909
738
|
});
|
|
910
739
|
}
|
|
911
740
|
function writeFile(path$1, data) {
|
|
912
|
-
return __awaiter$
|
|
741
|
+
return __awaiter$x(this, void 0, void 0, function () {
|
|
913
742
|
return __generator(this, function (_a) {
|
|
914
743
|
switch (_a.label) {
|
|
915
744
|
case 0: return [4 /*yield*/, mkdirRecursive(path.dirname(path$1))];
|
|
@@ -972,56 +801,6 @@
|
|
|
972
801
|
});
|
|
973
802
|
return params;
|
|
974
803
|
}
|
|
975
|
-
function ResolveEntity(model, extraCheck) {
|
|
976
|
-
var _this = this;
|
|
977
|
-
var modelName = model.modelName;
|
|
978
|
-
var paramName = modelName.toLowerCase();
|
|
979
|
-
return routingControllers.createParamDecorator({
|
|
980
|
-
required: false,
|
|
981
|
-
value: function (action) { return __awaiter$w(_this, void 0, void 0, function () {
|
|
982
|
-
var req, token, id, query, doc, e_4;
|
|
983
|
-
return __generator(this, function (_a) {
|
|
984
|
-
switch (_a.label) {
|
|
985
|
-
case 0:
|
|
986
|
-
req = action.request;
|
|
987
|
-
token = req.header("x-" + paramName + "-token");
|
|
988
|
-
id = req.params[paramName + "Id"];
|
|
989
|
-
if (!id && !token) {
|
|
990
|
-
throw new routingControllers.BadRequestError(modelName + " id or token should be defined!");
|
|
991
|
-
}
|
|
992
|
-
query = !token
|
|
993
|
-
? model.findById(id)
|
|
994
|
-
: model.findOne({ token: token });
|
|
995
|
-
doc = null;
|
|
996
|
-
if (!isFunction(extraCheck)) return [3 /*break*/, 5];
|
|
997
|
-
_a.label = 1;
|
|
998
|
-
case 1:
|
|
999
|
-
_a.trys.push([1, 3, , 4]);
|
|
1000
|
-
return [4 /*yield*/, valueToPromise(extraCheck(query, action))];
|
|
1001
|
-
case 2:
|
|
1002
|
-
doc = _a.sent();
|
|
1003
|
-
return [3 /*break*/, 4];
|
|
1004
|
-
case 3:
|
|
1005
|
-
e_4 = _a.sent();
|
|
1006
|
-
throw new routingControllers.BadRequestError(modelName + " check error: " + (e_4.message || e_4));
|
|
1007
|
-
case 4: return [3 /*break*/, 7];
|
|
1008
|
-
case 5: return [4 /*yield*/, query];
|
|
1009
|
-
case 6:
|
|
1010
|
-
doc = _a.sent();
|
|
1011
|
-
_a.label = 7;
|
|
1012
|
-
case 7:
|
|
1013
|
-
if (!doc) {
|
|
1014
|
-
throw new routingControllers.HttpError(404, !token
|
|
1015
|
-
? modelName + " could not be found with id: " + id
|
|
1016
|
-
: modelName + " could not be found with token: " + token);
|
|
1017
|
-
}
|
|
1018
|
-
action.request[paramName] = doc;
|
|
1019
|
-
return [2 /*return*/, doc];
|
|
1020
|
-
}
|
|
1021
|
-
});
|
|
1022
|
-
}); }
|
|
1023
|
-
});
|
|
1024
|
-
}
|
|
1025
804
|
function getFileName(path$1, withExtension) {
|
|
1026
805
|
if (withExtension === void 0) { withExtension = false; }
|
|
1027
806
|
var name = path.basename(path$1 || "");
|
|
@@ -1118,7 +897,7 @@
|
|
|
1118
897
|
var defaultPredicate = function () { return true; };
|
|
1119
898
|
var ɵ0 = defaultPredicate;
|
|
1120
899
|
function copyRecursive(target, source, predicate) {
|
|
1121
|
-
var
|
|
900
|
+
var e_3, _a;
|
|
1122
901
|
predicate = predicate || defaultPredicate;
|
|
1123
902
|
if (isPrimitive(source) || isDate(source) || isFunction(source))
|
|
1124
903
|
return source;
|
|
@@ -1162,12 +941,12 @@
|
|
|
1162
941
|
target.set(key, !shouldCopy(key, value) ? value : copyRecursive(target.get(key), value, predicate));
|
|
1163
942
|
}
|
|
1164
943
|
}
|
|
1165
|
-
catch (
|
|
944
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
1166
945
|
finally {
|
|
1167
946
|
try {
|
|
1168
947
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
1169
948
|
}
|
|
1170
|
-
finally { if (
|
|
949
|
+
finally { if (e_3) throw e_3.error; }
|
|
1171
950
|
}
|
|
1172
951
|
}
|
|
1173
952
|
return target;
|
|
@@ -1425,7 +1204,7 @@
|
|
|
1425
1204
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1426
1205
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1427
1206
|
};
|
|
1428
|
-
var __awaiter$
|
|
1207
|
+
var __awaiter$w = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
1429
1208
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
1430
1209
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
1431
1210
|
function fulfilled(value) { try {
|
|
@@ -1473,7 +1252,7 @@
|
|
|
1473
1252
|
};
|
|
1474
1253
|
AssetProcessor.fileTypeFromBuffer = function (buffer) {
|
|
1475
1254
|
var _a;
|
|
1476
|
-
return __awaiter$
|
|
1255
|
+
return __awaiter$w(this, void 0, void 0, function () {
|
|
1477
1256
|
var type;
|
|
1478
1257
|
return __generator(this, function (_b) {
|
|
1479
1258
|
switch (_b.label) {
|
|
@@ -1507,7 +1286,7 @@
|
|
|
1507
1286
|
return imageTypes.indexOf(contentType) >= 0;
|
|
1508
1287
|
};
|
|
1509
1288
|
AssetProcessor.copyImageMeta = function (buffer, metadata, fileType) {
|
|
1510
|
-
return __awaiter$
|
|
1289
|
+
return __awaiter$w(this, void 0, void 0, function () {
|
|
1511
1290
|
var match, attrs, parts, output;
|
|
1512
1291
|
return __generator(this, function (_b) {
|
|
1513
1292
|
switch (_b.label) {
|
|
@@ -1554,7 +1333,7 @@
|
|
|
1554
1333
|
});
|
|
1555
1334
|
};
|
|
1556
1335
|
AssetProcessor.prototype.process = function (buffer, metadata, fileType) {
|
|
1557
|
-
return __awaiter$
|
|
1336
|
+
return __awaiter$w(this, void 0, void 0, function () {
|
|
1558
1337
|
return __generator(this, function (_b) {
|
|
1559
1338
|
switch (_b.label) {
|
|
1560
1339
|
case 0:
|
|
@@ -1652,7 +1431,7 @@
|
|
|
1652
1431
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
1653
1432
|
return Reflect.metadata(k, v);
|
|
1654
1433
|
};
|
|
1655
|
-
var __awaiter$
|
|
1434
|
+
var __awaiter$v = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
1656
1435
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
1657
1436
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
1658
1437
|
function fulfilled(value) { try {
|
|
@@ -1700,7 +1479,7 @@
|
|
|
1700
1479
|
configurable: true
|
|
1701
1480
|
});
|
|
1702
1481
|
MongoConnector.prototype.connect = function () {
|
|
1703
|
-
return __awaiter$
|
|
1482
|
+
return __awaiter$v(this, void 0, void 0, function () {
|
|
1704
1483
|
var _a;
|
|
1705
1484
|
return __generator(this, function (_b) {
|
|
1706
1485
|
switch (_b.label) {
|
|
@@ -1731,7 +1510,7 @@
|
|
|
1731
1510
|
__metadata$p("design:paramtypes", [exports.Configuration])
|
|
1732
1511
|
], exports.MongoConnector);
|
|
1733
1512
|
|
|
1734
|
-
var __awaiter$
|
|
1513
|
+
var __awaiter$u = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
1735
1514
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
1736
1515
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
1737
1516
|
function fulfilled(value) { try {
|
|
@@ -1767,7 +1546,7 @@
|
|
|
1767
1546
|
return this.collection.updateOne({ _id: this.mId }, { $set: this.toJSON() });
|
|
1768
1547
|
};
|
|
1769
1548
|
BaseEntity.prototype.load = function () {
|
|
1770
|
-
return __awaiter$
|
|
1549
|
+
return __awaiter$u(this, void 0, void 0, function () {
|
|
1771
1550
|
var res;
|
|
1772
1551
|
return __generator(this, function (_a) {
|
|
1773
1552
|
switch (_a.label) {
|
|
@@ -1790,7 +1569,7 @@
|
|
|
1790
1569
|
return BaseEntity;
|
|
1791
1570
|
}());
|
|
1792
1571
|
|
|
1793
|
-
var __awaiter$
|
|
1572
|
+
var __awaiter$t = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
1794
1573
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
1795
1574
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
1796
1575
|
function fulfilled(value) { try {
|
|
@@ -1845,7 +1624,7 @@
|
|
|
1845
1624
|
configurable: true
|
|
1846
1625
|
});
|
|
1847
1626
|
Asset.prototype.unlink = function () {
|
|
1848
|
-
return __awaiter$
|
|
1627
|
+
return __awaiter$t(this, void 0, void 0, function () {
|
|
1849
1628
|
return __generator(this, function (_a) {
|
|
1850
1629
|
return [2 /*return*/, deleteFromBucket(this.bucket, this.mId)];
|
|
1851
1630
|
});
|
|
@@ -1855,7 +1634,7 @@
|
|
|
1855
1634
|
return streamToBuffer(this.stream);
|
|
1856
1635
|
};
|
|
1857
1636
|
Asset.prototype.download = function (metadata) {
|
|
1858
|
-
return __awaiter$
|
|
1637
|
+
return __awaiter$t(this, void 0, void 0, function () {
|
|
1859
1638
|
return __generator(this, function (_a) {
|
|
1860
1639
|
switch (_a.label) {
|
|
1861
1640
|
case 0:
|
|
@@ -1875,14 +1654,14 @@
|
|
|
1875
1654
|
};
|
|
1876
1655
|
Asset.prototype.getImage = function (params) {
|
|
1877
1656
|
if (params === void 0) { params = null; }
|
|
1878
|
-
return __awaiter$
|
|
1657
|
+
return __awaiter$t(this, void 0, void 0, function () {
|
|
1879
1658
|
return __generator(this, function (_a) {
|
|
1880
1659
|
return [2 /*return*/, toImage(this.stream, params, this.metadata)];
|
|
1881
1660
|
});
|
|
1882
1661
|
});
|
|
1883
1662
|
};
|
|
1884
1663
|
Asset.prototype.downloadImage = function (params, metadata) {
|
|
1885
|
-
return __awaiter$
|
|
1664
|
+
return __awaiter$t(this, void 0, void 0, function () {
|
|
1886
1665
|
var _a;
|
|
1887
1666
|
return __generator(this, function (_b) {
|
|
1888
1667
|
switch (_b.label) {
|
|
@@ -1897,7 +1676,7 @@
|
|
|
1897
1676
|
return Asset;
|
|
1898
1677
|
}(BaseEntity));
|
|
1899
1678
|
|
|
1900
|
-
var __awaiter$
|
|
1679
|
+
var __awaiter$s = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
1901
1680
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
1902
1681
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
1903
1682
|
function fulfilled(value) { try {
|
|
@@ -1932,21 +1711,21 @@
|
|
|
1932
1711
|
configurable: true
|
|
1933
1712
|
});
|
|
1934
1713
|
TempAsset.prototype.unlink = function () {
|
|
1935
|
-
return __awaiter$
|
|
1714
|
+
return __awaiter$s(this, void 0, void 0, function () {
|
|
1936
1715
|
return __generator(this, function (_a) {
|
|
1937
1716
|
throw new Error("Temp asset '" + this.id + "' can not be removed!");
|
|
1938
1717
|
});
|
|
1939
1718
|
});
|
|
1940
1719
|
};
|
|
1941
1720
|
TempAsset.prototype.getBuffer = function () {
|
|
1942
|
-
return __awaiter$
|
|
1721
|
+
return __awaiter$s(this, void 0, void 0, function () {
|
|
1943
1722
|
return __generator(this, function (_a) {
|
|
1944
1723
|
return [2 /*return*/, this.buffer];
|
|
1945
1724
|
});
|
|
1946
1725
|
});
|
|
1947
1726
|
};
|
|
1948
1727
|
TempAsset.prototype.download = function (metadata) {
|
|
1949
|
-
return __awaiter$
|
|
1728
|
+
return __awaiter$s(this, void 0, void 0, function () {
|
|
1950
1729
|
return __generator(this, function (_a) {
|
|
1951
1730
|
return [2 /*return*/, this.stream];
|
|
1952
1731
|
});
|
|
@@ -1960,14 +1739,14 @@
|
|
|
1960
1739
|
return this.downloadImage(params);
|
|
1961
1740
|
};
|
|
1962
1741
|
TempAsset.prototype.save = function () {
|
|
1963
|
-
return __awaiter$
|
|
1742
|
+
return __awaiter$s(this, void 0, void 0, function () {
|
|
1964
1743
|
return __generator(this, function (_a) {
|
|
1965
1744
|
return [2 /*return*/, this];
|
|
1966
1745
|
});
|
|
1967
1746
|
});
|
|
1968
1747
|
};
|
|
1969
1748
|
TempAsset.prototype.load = function () {
|
|
1970
|
-
return __awaiter$
|
|
1749
|
+
return __awaiter$s(this, void 0, void 0, function () {
|
|
1971
1750
|
return __generator(this, function (_a) {
|
|
1972
1751
|
return [2 /*return*/, this];
|
|
1973
1752
|
});
|
|
@@ -1998,7 +1777,7 @@
|
|
|
1998
1777
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
1999
1778
|
return Reflect.metadata(k, v);
|
|
2000
1779
|
};
|
|
2001
|
-
var __awaiter$
|
|
1780
|
+
var __awaiter$r = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2002
1781
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
2003
1782
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
2004
1783
|
function fulfilled(value) { try {
|
|
@@ -2028,7 +1807,7 @@
|
|
|
2028
1807
|
Assets.prototype.write = function (stream, contentType, metadata) {
|
|
2029
1808
|
if (contentType === void 0) { contentType = null; }
|
|
2030
1809
|
if (metadata === void 0) { metadata = null; }
|
|
2031
|
-
return __awaiter$
|
|
1810
|
+
return __awaiter$r(this, void 0, void 0, function () {
|
|
2032
1811
|
var uploadStream, buffer, fileType, e_1;
|
|
2033
1812
|
return __generator(this, function (_b) {
|
|
2034
1813
|
switch (_b.label) {
|
|
@@ -2062,7 +1841,7 @@
|
|
|
2062
1841
|
Assets.prototype.writeBuffer = function (buffer, metadata, contentType) {
|
|
2063
1842
|
if (metadata === void 0) { metadata = null; }
|
|
2064
1843
|
if (contentType === void 0) { contentType = null; }
|
|
2065
|
-
return __awaiter$
|
|
1844
|
+
return __awaiter$r(this, void 0, void 0, function () {
|
|
2066
1845
|
var fileType, e_2;
|
|
2067
1846
|
return __generator(this, function (_b) {
|
|
2068
1847
|
switch (_b.label) {
|
|
@@ -2094,7 +1873,7 @@
|
|
|
2094
1873
|
};
|
|
2095
1874
|
Assets.prototype.writeUrl = function (url, metadata) {
|
|
2096
1875
|
if (metadata === void 0) { metadata = null; }
|
|
2097
|
-
return __awaiter$
|
|
1876
|
+
return __awaiter$r(this, void 0, void 0, function () {
|
|
2098
1877
|
var buffer;
|
|
2099
1878
|
return __generator(this, function (_b) {
|
|
2100
1879
|
switch (_b.label) {
|
|
@@ -2108,7 +1887,7 @@
|
|
|
2108
1887
|
};
|
|
2109
1888
|
Assets.prototype.download = function (url, contentType) {
|
|
2110
1889
|
if (contentType === void 0) { contentType = null; }
|
|
2111
|
-
return __awaiter$
|
|
1890
|
+
return __awaiter$r(this, void 0, void 0, function () {
|
|
2112
1891
|
var buffer, fileType, e_3, metadata;
|
|
2113
1892
|
return __generator(this, function (_b) {
|
|
2114
1893
|
switch (_b.label) {
|
|
@@ -2144,14 +1923,14 @@
|
|
|
2144
1923
|
});
|
|
2145
1924
|
};
|
|
2146
1925
|
Assets.prototype.read = function (id) {
|
|
2147
|
-
return __awaiter$
|
|
1926
|
+
return __awaiter$r(this, void 0, void 0, function () {
|
|
2148
1927
|
return __generator(this, function (_b) {
|
|
2149
1928
|
return [2 /*return*/, !id ? null : this.find({ _id: new bson.ObjectId(id) })];
|
|
2150
1929
|
});
|
|
2151
1930
|
});
|
|
2152
1931
|
};
|
|
2153
1932
|
Assets.prototype.find = function (where) {
|
|
2154
|
-
return __awaiter$
|
|
1933
|
+
return __awaiter$r(this, void 0, void 0, function () {
|
|
2155
1934
|
var data;
|
|
2156
1935
|
return __generator(this, function (_b) {
|
|
2157
1936
|
switch (_b.label) {
|
|
@@ -2164,7 +1943,7 @@
|
|
|
2164
1943
|
});
|
|
2165
1944
|
};
|
|
2166
1945
|
Assets.prototype.findMany = function (where) {
|
|
2167
|
-
return __awaiter$
|
|
1946
|
+
return __awaiter$r(this, void 0, void 0, function () {
|
|
2168
1947
|
var cursor, items, result, items_1, items_1_1, item;
|
|
2169
1948
|
var e_4, _b;
|
|
2170
1949
|
return __generator(this, function (_c) {
|
|
@@ -2196,7 +1975,7 @@
|
|
|
2196
1975
|
});
|
|
2197
1976
|
};
|
|
2198
1977
|
Assets.prototype.deleteMany = function (where) {
|
|
2199
|
-
return __awaiter$
|
|
1978
|
+
return __awaiter$r(this, void 0, void 0, function () {
|
|
2200
1979
|
var assets;
|
|
2201
1980
|
return __generator(this, function (_b) {
|
|
2202
1981
|
switch (_b.label) {
|
|
@@ -2209,7 +1988,7 @@
|
|
|
2209
1988
|
});
|
|
2210
1989
|
};
|
|
2211
1990
|
Assets.prototype.unlink = function (id) {
|
|
2212
|
-
return __awaiter$
|
|
1991
|
+
return __awaiter$r(this, void 0, void 0, function () {
|
|
2213
1992
|
var asset;
|
|
2214
1993
|
return __generator(this, function (_b) {
|
|
2215
1994
|
switch (_b.label) {
|
|
@@ -2224,7 +2003,7 @@
|
|
|
2224
2003
|
});
|
|
2225
2004
|
};
|
|
2226
2005
|
Assets.prototype.upload = function (stream, fileType, metadata) {
|
|
2227
|
-
return __awaiter$
|
|
2006
|
+
return __awaiter$r(this, void 0, void 0, function () {
|
|
2228
2007
|
var contentType;
|
|
2229
2008
|
var _this = this;
|
|
2230
2009
|
return __generator(this, function (_b) {
|
|
@@ -2266,7 +2045,7 @@
|
|
|
2266
2045
|
__metadata$o("design:paramtypes", [exports.MongoConnector, exports.AssetProcessor])
|
|
2267
2046
|
], exports.Assets);
|
|
2268
2047
|
|
|
2269
|
-
var __awaiter$
|
|
2048
|
+
var __awaiter$q = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2270
2049
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
2271
2050
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
2272
2051
|
function fulfilled(value) { try {
|
|
@@ -2329,7 +2108,7 @@
|
|
|
2329
2108
|
configurable: true
|
|
2330
2109
|
});
|
|
2331
2110
|
LazyAsset.prototype.unlink = function () {
|
|
2332
|
-
return __awaiter$
|
|
2111
|
+
return __awaiter$q(this, void 0, void 0, function () {
|
|
2333
2112
|
return __generator(this, function (_a) {
|
|
2334
2113
|
switch (_a.label) {
|
|
2335
2114
|
case 0: return [4 /*yield*/, this.load()];
|
|
@@ -2361,7 +2140,7 @@
|
|
|
2361
2140
|
});
|
|
2362
2141
|
};
|
|
2363
2142
|
LazyAsset.prototype.loadAsset = function () {
|
|
2364
|
-
return __awaiter$
|
|
2143
|
+
return __awaiter$q(this, void 0, void 0, function () {
|
|
2365
2144
|
return __generator(this, function (_a) {
|
|
2366
2145
|
switch (_a.label) {
|
|
2367
2146
|
case 0: return [4 /*yield*/, this.load()];
|
|
@@ -2386,7 +2165,7 @@
|
|
|
2386
2165
|
});
|
|
2387
2166
|
};
|
|
2388
2167
|
LazyAsset.prototype.writeAsset = function (asset) {
|
|
2389
|
-
return __awaiter$
|
|
2168
|
+
return __awaiter$q(this, void 0, void 0, function () {
|
|
2390
2169
|
return __generator(this, function (_a) {
|
|
2391
2170
|
switch (_a.label) {
|
|
2392
2171
|
case 0:
|
|
@@ -2400,7 +2179,7 @@
|
|
|
2400
2179
|
});
|
|
2401
2180
|
};
|
|
2402
2181
|
LazyAsset.prototype.startWorkingOnAsset = function (fromLoad) {
|
|
2403
|
-
return __awaiter$
|
|
2182
|
+
return __awaiter$q(this, void 0, void 0, function () {
|
|
2404
2183
|
var _a;
|
|
2405
2184
|
return __generator(this, function (_b) {
|
|
2406
2185
|
switch (_b.label) {
|
|
@@ -2441,7 +2220,7 @@
|
|
|
2441
2220
|
var __param$7 = (this && this.__param) || function (paramIndex, decorator) {
|
|
2442
2221
|
return function (target, key) { decorator(target, key, paramIndex); };
|
|
2443
2222
|
};
|
|
2444
|
-
var __awaiter$
|
|
2223
|
+
var __awaiter$p = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2445
2224
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
2446
2225
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
2447
2226
|
function fulfilled(value) { try {
|
|
@@ -2492,7 +2271,7 @@
|
|
|
2492
2271
|
};
|
|
2493
2272
|
JobManager.prototype.process = function (jobType, params) {
|
|
2494
2273
|
if (params === void 0) { params = {}; }
|
|
2495
|
-
return __awaiter$
|
|
2274
|
+
return __awaiter$p(this, void 0, void 0, function () {
|
|
2496
2275
|
var instance, jobName;
|
|
2497
2276
|
return __generator(this, function (_a) {
|
|
2498
2277
|
instance = null;
|
|
@@ -2509,7 +2288,7 @@
|
|
|
2509
2288
|
};
|
|
2510
2289
|
JobManager.prototype.enqueueWithName = function (name, params) {
|
|
2511
2290
|
if (params === void 0) { params = {}; }
|
|
2512
|
-
return __awaiter$
|
|
2291
|
+
return __awaiter$p(this, void 0, void 0, function () {
|
|
2513
2292
|
return __generator(this, function (_a) {
|
|
2514
2293
|
return [2 /*return*/, this.sendToWorkers(this.tryResolveFromName(name, params), params)];
|
|
2515
2294
|
});
|
|
@@ -2517,7 +2296,7 @@
|
|
|
2517
2296
|
};
|
|
2518
2297
|
JobManager.prototype.enqueue = function (jobType, params) {
|
|
2519
2298
|
if (params === void 0) { params = {}; }
|
|
2520
|
-
return __awaiter$
|
|
2299
|
+
return __awaiter$p(this, void 0, void 0, function () {
|
|
2521
2300
|
return __generator(this, function (_a) {
|
|
2522
2301
|
return [2 /*return*/, this.sendToWorkers(this.tryResolveAndInit(jobType, params), params)];
|
|
2523
2302
|
});
|
|
@@ -2548,7 +2327,7 @@
|
|
|
2548
2327
|
});
|
|
2549
2328
|
};
|
|
2550
2329
|
JobManager.prototype.startProcessing = function () {
|
|
2551
|
-
return __awaiter$
|
|
2330
|
+
return __awaiter$p(this, void 0, void 0, function () {
|
|
2552
2331
|
var host, pushHost, pullHost;
|
|
2553
2332
|
var _this = this;
|
|
2554
2333
|
return __generator(this, function (_a) {
|
|
@@ -2574,7 +2353,7 @@
|
|
|
2574
2353
|
case 2:
|
|
2575
2354
|
_a.sent();
|
|
2576
2355
|
console.log("Worker consumer connected to: " + pullHost);
|
|
2577
|
-
this.workerPull.on("message", function (name, args, uniqId) { return __awaiter$
|
|
2356
|
+
this.workerPull.on("message", function (name, args, uniqId) { return __awaiter$p(_this, void 0, void 0, function () {
|
|
2578
2357
|
var jobName, jobParams, uniqueId, e_1, e_2;
|
|
2579
2358
|
return __generator(this, function (_a) {
|
|
2580
2359
|
switch (_a.label) {
|
|
@@ -2672,7 +2451,7 @@
|
|
|
2672
2451
|
return container.resolve(jobType);
|
|
2673
2452
|
};
|
|
2674
2453
|
JobManager.prototype.sendToWorkers = function (jobName, params) {
|
|
2675
|
-
return __awaiter$
|
|
2454
|
+
return __awaiter$p(this, void 0, void 0, function () {
|
|
2676
2455
|
var publisher, uniqueId;
|
|
2677
2456
|
return __generator(this, function (_a) {
|
|
2678
2457
|
switch (_a.label) {
|
|
@@ -2697,7 +2476,7 @@
|
|
|
2697
2476
|
__metadata$n("design:paramtypes", [exports.Configuration, Object, Array])
|
|
2698
2477
|
], exports.JobManager);
|
|
2699
2478
|
|
|
2700
|
-
var __awaiter$
|
|
2479
|
+
var __awaiter$o = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2701
2480
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
2702
2481
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
2703
2482
|
function fulfilled(value) { try {
|
|
@@ -2775,7 +2554,7 @@
|
|
|
2775
2554
|
return this;
|
|
2776
2555
|
};
|
|
2777
2556
|
Progress.prototype.createSubProgress = function (progressValue, max, message) {
|
|
2778
|
-
return __awaiter$
|
|
2557
|
+
return __awaiter$o(this, void 0, void 0, function () {
|
|
2779
2558
|
return __generator(this, function (_a) {
|
|
2780
2559
|
switch (_a.label) {
|
|
2781
2560
|
case 0:
|
|
@@ -2797,7 +2576,7 @@
|
|
|
2797
2576
|
});
|
|
2798
2577
|
};
|
|
2799
2578
|
Progress.prototype.setMax = function (max) {
|
|
2800
|
-
return __awaiter$
|
|
2579
|
+
return __awaiter$o(this, void 0, void 0, function () {
|
|
2801
2580
|
return __generator(this, function (_a) {
|
|
2802
2581
|
switch (_a.label) {
|
|
2803
2582
|
case 0:
|
|
@@ -2814,7 +2593,7 @@
|
|
|
2814
2593
|
});
|
|
2815
2594
|
};
|
|
2816
2595
|
Progress.prototype.setMessage = function (message) {
|
|
2817
|
-
return __awaiter$
|
|
2596
|
+
return __awaiter$o(this, void 0, void 0, function () {
|
|
2818
2597
|
return __generator(this, function (_a) {
|
|
2819
2598
|
switch (_a.label) {
|
|
2820
2599
|
case 0:
|
|
@@ -2828,7 +2607,7 @@
|
|
|
2828
2607
|
});
|
|
2829
2608
|
};
|
|
2830
2609
|
Progress.prototype.setError = function (error) {
|
|
2831
|
-
return __awaiter$
|
|
2610
|
+
return __awaiter$o(this, void 0, void 0, function () {
|
|
2832
2611
|
return __generator(this, function (_a) {
|
|
2833
2612
|
switch (_a.label) {
|
|
2834
2613
|
case 0:
|
|
@@ -2843,7 +2622,7 @@
|
|
|
2843
2622
|
};
|
|
2844
2623
|
Progress.prototype.advance = function (value) {
|
|
2845
2624
|
if (value === void 0) { value = 1; }
|
|
2846
|
-
return __awaiter$
|
|
2625
|
+
return __awaiter$o(this, void 0, void 0, function () {
|
|
2847
2626
|
return __generator(this, function (_a) {
|
|
2848
2627
|
switch (_a.label) {
|
|
2849
2628
|
case 0:
|
|
@@ -2865,7 +2644,7 @@
|
|
|
2865
2644
|
});
|
|
2866
2645
|
};
|
|
2867
2646
|
Progress.prototype.cancel = function () {
|
|
2868
|
-
return __awaiter$
|
|
2647
|
+
return __awaiter$o(this, void 0, void 0, function () {
|
|
2869
2648
|
return __generator(this, function (_a) {
|
|
2870
2649
|
switch (_a.label) {
|
|
2871
2650
|
case 0:
|
|
@@ -2964,7 +2743,7 @@
|
|
|
2964
2743
|
return this;
|
|
2965
2744
|
};
|
|
2966
2745
|
SubProgress.prototype.createSubProgress = function (progressValue, max, message) {
|
|
2967
|
-
return __awaiter$
|
|
2746
|
+
return __awaiter$o(this, void 0, void 0, function () {
|
|
2968
2747
|
return __generator(this, function (_a) {
|
|
2969
2748
|
switch (_a.label) {
|
|
2970
2749
|
case 0:
|
|
@@ -2985,7 +2764,7 @@
|
|
|
2985
2764
|
});
|
|
2986
2765
|
};
|
|
2987
2766
|
SubProgress.prototype.setMax = function (max) {
|
|
2988
|
-
return __awaiter$
|
|
2767
|
+
return __awaiter$o(this, void 0, void 0, function () {
|
|
2989
2768
|
return __generator(this, function (_a) {
|
|
2990
2769
|
switch (_a.label) {
|
|
2991
2770
|
case 0:
|
|
@@ -3002,7 +2781,7 @@
|
|
|
3002
2781
|
});
|
|
3003
2782
|
};
|
|
3004
2783
|
SubProgress.prototype.setMessage = function (message) {
|
|
3005
|
-
return __awaiter$
|
|
2784
|
+
return __awaiter$o(this, void 0, void 0, function () {
|
|
3006
2785
|
return __generator(this, function (_a) {
|
|
3007
2786
|
switch (_a.label) {
|
|
3008
2787
|
case 0:
|
|
@@ -3017,7 +2796,7 @@
|
|
|
3017
2796
|
});
|
|
3018
2797
|
};
|
|
3019
2798
|
SubProgress.prototype.setError = function (error) {
|
|
3020
|
-
return __awaiter$
|
|
2799
|
+
return __awaiter$o(this, void 0, void 0, function () {
|
|
3021
2800
|
return __generator(this, function (_a) {
|
|
3022
2801
|
switch (_a.label) {
|
|
3023
2802
|
case 0:
|
|
@@ -3033,7 +2812,7 @@
|
|
|
3033
2812
|
};
|
|
3034
2813
|
SubProgress.prototype.advance = function (value) {
|
|
3035
2814
|
if (value === void 0) { value = 1; }
|
|
3036
|
-
return __awaiter$
|
|
2815
|
+
return __awaiter$o(this, void 0, void 0, function () {
|
|
3037
2816
|
return __generator(this, function (_a) {
|
|
3038
2817
|
switch (_a.label) {
|
|
3039
2818
|
case 0:
|
|
@@ -3050,7 +2829,7 @@
|
|
|
3050
2829
|
});
|
|
3051
2830
|
};
|
|
3052
2831
|
SubProgress.prototype.cancel = function () {
|
|
3053
|
-
return __awaiter$
|
|
2832
|
+
return __awaiter$o(this, void 0, void 0, function () {
|
|
3054
2833
|
return __generator(this, function (_a) {
|
|
3055
2834
|
switch (_a.label) {
|
|
3056
2835
|
case 0:
|
|
@@ -3065,7 +2844,7 @@
|
|
|
3065
2844
|
});
|
|
3066
2845
|
};
|
|
3067
2846
|
SubProgress.prototype.save = function () {
|
|
3068
|
-
return __awaiter$
|
|
2847
|
+
return __awaiter$o(this, void 0, void 0, function () {
|
|
3069
2848
|
var ratio, newProgress, current;
|
|
3070
2849
|
return __generator(this, function (_a) {
|
|
3071
2850
|
switch (_a.label) {
|
|
@@ -3084,7 +2863,7 @@
|
|
|
3084
2863
|
});
|
|
3085
2864
|
};
|
|
3086
2865
|
SubProgress.prototype.load = function () {
|
|
3087
|
-
return __awaiter$
|
|
2866
|
+
return __awaiter$o(this, void 0, void 0, function () {
|
|
3088
2867
|
return __generator(this, function (_a) {
|
|
3089
2868
|
return [2 /*return*/, null];
|
|
3090
2869
|
});
|
|
@@ -3110,7 +2889,7 @@
|
|
|
3110
2889
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
3111
2890
|
return Reflect.metadata(k, v);
|
|
3112
2891
|
};
|
|
3113
|
-
var __awaiter$
|
|
2892
|
+
var __awaiter$n = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3114
2893
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3115
2894
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
3116
2895
|
function fulfilled(value) { try {
|
|
@@ -3142,11 +2921,11 @@
|
|
|
3142
2921
|
});
|
|
3143
2922
|
}
|
|
3144
2923
|
Progresses.prototype.waitToFinish = function (id) {
|
|
3145
|
-
return __awaiter$
|
|
2924
|
+
return __awaiter$n(this, void 0, void 0, function () {
|
|
3146
2925
|
var _this = this;
|
|
3147
2926
|
return __generator(this, function (_a) {
|
|
3148
2927
|
return [2 /*return*/, Promise.race([
|
|
3149
|
-
this.waitForProgress(id, function () { return __awaiter$
|
|
2928
|
+
this.waitForProgress(id, function () { return __awaiter$n(_this, void 0, void 0, function () {
|
|
3150
2929
|
var progress;
|
|
3151
2930
|
return __generator(this, function (_a) {
|
|
3152
2931
|
switch (_a.label) {
|
|
@@ -3165,7 +2944,7 @@
|
|
|
3165
2944
|
}
|
|
3166
2945
|
});
|
|
3167
2946
|
}); }, 500),
|
|
3168
|
-
this.waitForProgress(id, function () { return __awaiter$
|
|
2947
|
+
this.waitForProgress(id, function () { return __awaiter$n(_this, void 0, void 0, function () {
|
|
3169
2948
|
return __generator(this, function (_a) {
|
|
3170
2949
|
return [2 /*return*/, this.progresses[id] || null];
|
|
3171
2950
|
});
|
|
@@ -3175,14 +2954,14 @@
|
|
|
3175
2954
|
});
|
|
3176
2955
|
};
|
|
3177
2956
|
Progresses.prototype.get = function (id) {
|
|
3178
|
-
return __awaiter$
|
|
2957
|
+
return __awaiter$n(this, void 0, void 0, function () {
|
|
3179
2958
|
return __generator(this, function (_a) {
|
|
3180
2959
|
return [2 /*return*/, !id ? null : this.find({ _id: new bson.ObjectId(id) })];
|
|
3181
2960
|
});
|
|
3182
2961
|
});
|
|
3183
2962
|
};
|
|
3184
2963
|
Progresses.prototype.find = function (where) {
|
|
3185
|
-
return __awaiter$
|
|
2964
|
+
return __awaiter$n(this, void 0, void 0, function () {
|
|
3186
2965
|
var data;
|
|
3187
2966
|
return __generator(this, function (_a) {
|
|
3188
2967
|
switch (_a.label) {
|
|
@@ -3196,7 +2975,7 @@
|
|
|
3196
2975
|
};
|
|
3197
2976
|
Progresses.prototype.create = function (max) {
|
|
3198
2977
|
if (max === void 0) { max = 100; }
|
|
3199
|
-
return __awaiter$
|
|
2978
|
+
return __awaiter$n(this, void 0, void 0, function () {
|
|
3200
2979
|
var data, res;
|
|
3201
2980
|
return __generator(this, function (_a) {
|
|
3202
2981
|
switch (_a.label) {
|
|
@@ -3220,7 +2999,7 @@
|
|
|
3220
2999
|
});
|
|
3221
3000
|
};
|
|
3222
3001
|
Progresses.prototype.remove = function (id) {
|
|
3223
|
-
return __awaiter$
|
|
3002
|
+
return __awaiter$n(this, void 0, void 0, function () {
|
|
3224
3003
|
return __generator(this, function (_a) {
|
|
3225
3004
|
switch (_a.label) {
|
|
3226
3005
|
case 0: return [4 /*yield*/, this.collection.deleteOne({ _id: new bson.ObjectId(id) })];
|
|
@@ -3232,7 +3011,7 @@
|
|
|
3232
3011
|
});
|
|
3233
3012
|
};
|
|
3234
3013
|
Progresses.prototype.waitForProgress = function (id, cb, delay) {
|
|
3235
|
-
return __awaiter$
|
|
3014
|
+
return __awaiter$n(this, void 0, void 0, function () {
|
|
3236
3015
|
var isFinished, progress, waitTime;
|
|
3237
3016
|
return __generator(this, function (_a) {
|
|
3238
3017
|
switch (_a.label) {
|
|
@@ -3289,7 +3068,7 @@
|
|
|
3289
3068
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
3290
3069
|
return Reflect.metadata(k, v);
|
|
3291
3070
|
};
|
|
3292
|
-
var __awaiter$
|
|
3071
|
+
var __awaiter$m = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3293
3072
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3294
3073
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
3295
3074
|
function fulfilled(value) { try {
|
|
@@ -3319,7 +3098,7 @@
|
|
|
3319
3098
|
LazyAssets.prototype.create = function (jobType, jobParams, jobQue) {
|
|
3320
3099
|
if (jobParams === void 0) { jobParams = {}; }
|
|
3321
3100
|
if (jobQue === void 0) { jobQue = "main"; }
|
|
3322
|
-
return __awaiter$
|
|
3101
|
+
return __awaiter$m(this, void 0, void 0, function () {
|
|
3323
3102
|
var jobName, data, existingAsset, res;
|
|
3324
3103
|
return __generator(this, function (_a) {
|
|
3325
3104
|
switch (_a.label) {
|
|
@@ -3344,14 +3123,14 @@
|
|
|
3344
3123
|
});
|
|
3345
3124
|
};
|
|
3346
3125
|
LazyAssets.prototype.read = function (id) {
|
|
3347
|
-
return __awaiter$
|
|
3126
|
+
return __awaiter$m(this, void 0, void 0, function () {
|
|
3348
3127
|
return __generator(this, function (_a) {
|
|
3349
3128
|
return [2 /*return*/, !id ? null : this.find({ _id: new bson.ObjectId(id) })];
|
|
3350
3129
|
});
|
|
3351
3130
|
});
|
|
3352
3131
|
};
|
|
3353
3132
|
LazyAssets.prototype.find = function (where) {
|
|
3354
|
-
return __awaiter$
|
|
3133
|
+
return __awaiter$m(this, void 0, void 0, function () {
|
|
3355
3134
|
var data;
|
|
3356
3135
|
return __generator(this, function (_a) {
|
|
3357
3136
|
switch (_a.label) {
|
|
@@ -3366,7 +3145,7 @@
|
|
|
3366
3145
|
});
|
|
3367
3146
|
};
|
|
3368
3147
|
LazyAssets.prototype.unlink = function (id) {
|
|
3369
|
-
return __awaiter$
|
|
3148
|
+
return __awaiter$m(this, void 0, void 0, function () {
|
|
3370
3149
|
var asset;
|
|
3371
3150
|
return __generator(this, function (_a) {
|
|
3372
3151
|
switch (_a.label) {
|
|
@@ -3405,7 +3184,7 @@
|
|
|
3405
3184
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
3406
3185
|
return Reflect.metadata(k, v);
|
|
3407
3186
|
};
|
|
3408
|
-
var __awaiter$
|
|
3187
|
+
var __awaiter$l = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3409
3188
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3410
3189
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
3411
3190
|
function fulfilled(value) { try {
|
|
@@ -3431,7 +3210,7 @@
|
|
|
3431
3210
|
}
|
|
3432
3211
|
AssetResolver.prototype.resolve = function (id, lazy) {
|
|
3433
3212
|
if (lazy === void 0) { lazy = false; }
|
|
3434
|
-
return __awaiter$
|
|
3213
|
+
return __awaiter$l(this, void 0, void 0, function () {
|
|
3435
3214
|
var asset, lazyAsset, lazyAsset;
|
|
3436
3215
|
return __generator(this, function (_a) {
|
|
3437
3216
|
switch (_a.label) {
|
|
@@ -3514,7 +3293,7 @@
|
|
|
3514
3293
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3515
3294
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3516
3295
|
};
|
|
3517
|
-
var __awaiter$
|
|
3296
|
+
var __awaiter$k = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3518
3297
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3519
3298
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
3520
3299
|
function fulfilled(value) { try {
|
|
@@ -3537,14 +3316,14 @@
|
|
|
3537
3316
|
function CacheProcessor() {
|
|
3538
3317
|
}
|
|
3539
3318
|
CacheProcessor.prototype.serialize = function (data) {
|
|
3540
|
-
return __awaiter$
|
|
3319
|
+
return __awaiter$k(this, void 0, void 0, function () {
|
|
3541
3320
|
return __generator(this, function (_a) {
|
|
3542
3321
|
return [2 /*return*/, data];
|
|
3543
3322
|
});
|
|
3544
3323
|
});
|
|
3545
3324
|
};
|
|
3546
3325
|
CacheProcessor.prototype.deserialize = function (data) {
|
|
3547
|
-
return __awaiter$
|
|
3326
|
+
return __awaiter$k(this, void 0, void 0, function () {
|
|
3548
3327
|
return __generator(this, function (_a) {
|
|
3549
3328
|
return [2 /*return*/, data];
|
|
3550
3329
|
});
|
|
@@ -3571,7 +3350,7 @@
|
|
|
3571
3350
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
3572
3351
|
return Reflect.metadata(k, v);
|
|
3573
3352
|
};
|
|
3574
|
-
var __awaiter$
|
|
3353
|
+
var __awaiter$j = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3575
3354
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3576
3355
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
3577
3356
|
function fulfilled(value) { try {
|
|
@@ -3597,7 +3376,7 @@
|
|
|
3597
3376
|
this.cacheProcessor = cacheProcessor;
|
|
3598
3377
|
}
|
|
3599
3378
|
Cache.prototype.prepare = function () {
|
|
3600
|
-
return __awaiter$
|
|
3379
|
+
return __awaiter$j(this, void 0, void 0, function () {
|
|
3601
3380
|
return __generator(this, function (_a) {
|
|
3602
3381
|
switch (_a.label) {
|
|
3603
3382
|
case 0:
|
|
@@ -3618,7 +3397,7 @@
|
|
|
3618
3397
|
Cache.prototype.set = function (key, value, ttl, expirationTimestamp, tags) {
|
|
3619
3398
|
if (expirationTimestamp === void 0) { expirationTimestamp = null; }
|
|
3620
3399
|
if (tags === void 0) { tags = {}; }
|
|
3621
|
-
return __awaiter$
|
|
3400
|
+
return __awaiter$j(this, void 0, void 0, function () {
|
|
3622
3401
|
var item, _a, now;
|
|
3623
3402
|
return __generator(this, function (_b) {
|
|
3624
3403
|
switch (_b.label) {
|
|
@@ -3649,7 +3428,7 @@
|
|
|
3649
3428
|
});
|
|
3650
3429
|
};
|
|
3651
3430
|
Cache.prototype.get = function (key) {
|
|
3652
|
-
return __awaiter$
|
|
3431
|
+
return __awaiter$j(this, void 0, void 0, function () {
|
|
3653
3432
|
var item, now;
|
|
3654
3433
|
return __generator(this, function (_a) {
|
|
3655
3434
|
switch (_a.label) {
|
|
@@ -3675,7 +3454,7 @@
|
|
|
3675
3454
|
Cache.prototype.getOrSet = function (key, valueCb, ttl, expirationTimestamp, tags) {
|
|
3676
3455
|
if (expirationTimestamp === void 0) { expirationTimestamp = null; }
|
|
3677
3456
|
if (tags === void 0) { tags = {}; }
|
|
3678
|
-
return __awaiter$
|
|
3457
|
+
return __awaiter$j(this, void 0, void 0, function () {
|
|
3679
3458
|
var e_1, _a, _b;
|
|
3680
3459
|
return __generator(this, function (_c) {
|
|
3681
3460
|
switch (_c.label) {
|
|
@@ -3696,7 +3475,7 @@
|
|
|
3696
3475
|
});
|
|
3697
3476
|
};
|
|
3698
3477
|
Cache.prototype.delete = function (key) {
|
|
3699
|
-
return __awaiter$
|
|
3478
|
+
return __awaiter$j(this, void 0, void 0, function () {
|
|
3700
3479
|
return __generator(this, function (_a) {
|
|
3701
3480
|
switch (_a.label) {
|
|
3702
3481
|
case 0: return [4 /*yield*/, this.prepare()];
|
|
@@ -3728,7 +3507,7 @@
|
|
|
3728
3507
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3729
3508
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3730
3509
|
};
|
|
3731
|
-
var __awaiter$
|
|
3510
|
+
var __awaiter$i = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3732
3511
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3733
3512
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
3734
3513
|
function fulfilled(value) { try {
|
|
@@ -3751,7 +3530,7 @@
|
|
|
3751
3530
|
function EndpointProvider() {
|
|
3752
3531
|
}
|
|
3753
3532
|
EndpointProvider.prototype.configure = function (app) {
|
|
3754
|
-
return __awaiter$
|
|
3533
|
+
return __awaiter$i(this, void 0, void 0, function () {
|
|
3755
3534
|
return __generator(this, function (_a) {
|
|
3756
3535
|
console.log("Express app is mounted to: " + app.mountpath);
|
|
3757
3536
|
return [2 /*return*/];
|
|
@@ -3782,7 +3561,7 @@
|
|
|
3782
3561
|
var __param$6 = (this && this.__param) || function (paramIndex, decorator) {
|
|
3783
3562
|
return function (target, key) { decorator(target, key, paramIndex); };
|
|
3784
3563
|
};
|
|
3785
|
-
var __awaiter$
|
|
3564
|
+
var __awaiter$h = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3786
3565
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3787
3566
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
3788
3567
|
function fulfilled(value) { try {
|
|
@@ -3806,7 +3585,7 @@
|
|
|
3806
3585
|
this.fixtures = fixtures;
|
|
3807
3586
|
}
|
|
3808
3587
|
Fixtures.prototype.load = function () {
|
|
3809
|
-
return __awaiter$
|
|
3588
|
+
return __awaiter$h(this, void 0, void 0, function () {
|
|
3810
3589
|
var _a, _b, fixture, e_1_1;
|
|
3811
3590
|
var e_1, _c;
|
|
3812
3591
|
return __generator(this, function (_d) {
|
|
@@ -3854,7 +3633,7 @@
|
|
|
3854
3633
|
__metadata$h("design:paramtypes", [Array])
|
|
3855
3634
|
], exports.Fixtures);
|
|
3856
3635
|
|
|
3857
|
-
var __awaiter$
|
|
3636
|
+
var __awaiter$g = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3858
3637
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3859
3638
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
3860
3639
|
function fulfilled(value) { try {
|
|
@@ -3885,7 +3664,7 @@
|
|
|
3885
3664
|
this.targetSize = !size ? { width: thumbSize, height: thumbSize } : size;
|
|
3886
3665
|
}
|
|
3887
3666
|
GalleryImage.prototype.serve = function (id) {
|
|
3888
|
-
return __awaiter$
|
|
3667
|
+
return __awaiter$g(this, void 0, void 0, function () {
|
|
3889
3668
|
var isThumb, original, _a, meta, ratio, sizeRatio, size, targetHeight, targetWidth, resized, buffer;
|
|
3890
3669
|
return __generator(this, function (_b) {
|
|
3891
3670
|
switch (_b.label) {
|
|
@@ -3981,7 +3760,7 @@
|
|
|
3981
3760
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
3982
3761
|
return Reflect.metadata(k, v);
|
|
3983
3762
|
};
|
|
3984
|
-
var __awaiter$
|
|
3763
|
+
var __awaiter$f = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3985
3764
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3986
3765
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
3987
3766
|
function fulfilled(value) { try {
|
|
@@ -4011,7 +3790,7 @@
|
|
|
4011
3790
|
}
|
|
4012
3791
|
Gallery.prototype.getFolder = function (folder, size) {
|
|
4013
3792
|
if (size === void 0) { size = null; }
|
|
4014
|
-
return __awaiter$
|
|
3793
|
+
return __awaiter$f(this, void 0, void 0, function () {
|
|
4015
3794
|
var _this = this;
|
|
4016
3795
|
return __generator(this, function (_a) {
|
|
4017
3796
|
this.cache[folder] = this.cache[folder] || new Promise(function (resolve) {
|
|
@@ -4036,7 +3815,7 @@
|
|
|
4036
3815
|
return;
|
|
4037
3816
|
}
|
|
4038
3817
|
var promises = files.map(function (file) {
|
|
4039
|
-
return new Promise(function (resolve) { return __awaiter$
|
|
3818
|
+
return new Promise(function (resolve) { return __awaiter$f(_this, void 0, void 0, function () {
|
|
4040
3819
|
var filePath, absoluteFilePath;
|
|
4041
3820
|
var _this = this;
|
|
4042
3821
|
return __generator(this, function (_a) {
|
|
@@ -4072,7 +3851,7 @@
|
|
|
4072
3851
|
});
|
|
4073
3852
|
},
|
|
4074
3853
|
writeResult: function (isThumb, buffer) {
|
|
4075
|
-
return new Promise(function (res, rej) { return __awaiter$
|
|
3854
|
+
return new Promise(function (res, rej) { return __awaiter$f(_this, void 0, void 0, function () {
|
|
4076
3855
|
var resultPath;
|
|
4077
3856
|
return __generator(this, function (_a) {
|
|
4078
3857
|
switch (_a.label) {
|
|
@@ -4146,7 +3925,7 @@
|
|
|
4146
3925
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
4147
3926
|
return Reflect.metadata(k, v);
|
|
4148
3927
|
};
|
|
4149
|
-
var __awaiter$
|
|
3928
|
+
var __awaiter$e = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
4150
3929
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4151
3930
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4152
3931
|
function fulfilled(value) { try {
|
|
@@ -4174,7 +3953,7 @@
|
|
|
4174
3953
|
this.parts = config.resolve("idParts");
|
|
4175
3954
|
}
|
|
4176
3955
|
IdGenerator.prototype.generate = function (checkCb) {
|
|
4177
|
-
return __awaiter$
|
|
3956
|
+
return __awaiter$e(this, void 0, void 0, function () {
|
|
4178
3957
|
var id, tries, notGood;
|
|
4179
3958
|
return __generator(this, function (_a) {
|
|
4180
3959
|
switch (_a.label) {
|
|
@@ -4266,7 +4045,7 @@
|
|
|
4266
4045
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
4267
4046
|
return Reflect.metadata(k, v);
|
|
4268
4047
|
};
|
|
4269
|
-
var __awaiter$
|
|
4048
|
+
var __awaiter$d = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
4270
4049
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4271
4050
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4272
4051
|
function fulfilled(value) { try {
|
|
@@ -4291,7 +4070,7 @@
|
|
|
4291
4070
|
this.cache = {};
|
|
4292
4071
|
}
|
|
4293
4072
|
Translator.prototype.getDictionary = function (language) {
|
|
4294
|
-
return __awaiter$
|
|
4073
|
+
return __awaiter$d(this, void 0, void 0, function () {
|
|
4295
4074
|
var dictionary;
|
|
4296
4075
|
return __generator(this, function (_a) {
|
|
4297
4076
|
switch (_a.label) {
|
|
@@ -4376,7 +4155,7 @@
|
|
|
4376
4155
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
4377
4156
|
return Reflect.metadata(k, v);
|
|
4378
4157
|
};
|
|
4379
|
-
var __awaiter$
|
|
4158
|
+
var __awaiter$c = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
4380
4159
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4381
4160
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4382
4161
|
function fulfilled(value) { try {
|
|
@@ -4419,11 +4198,11 @@
|
|
|
4419
4198
|
return this.initPromise;
|
|
4420
4199
|
};
|
|
4421
4200
|
TemplateRenderer.prototype.parseTemplates = function (dir, dirPath) {
|
|
4422
|
-
return __awaiter$
|
|
4201
|
+
return __awaiter$c(this, void 0, void 0, function () {
|
|
4423
4202
|
var _this = this;
|
|
4424
4203
|
return __generator(this, function (_a) {
|
|
4425
4204
|
return [2 /*return*/, new Promise(function (resolve) {
|
|
4426
|
-
fs.readdir(dir, function (err, files) { return __awaiter$
|
|
4205
|
+
fs.readdir(dir, function (err, files) { return __awaiter$c(_this, void 0, void 0, function () {
|
|
4427
4206
|
var files_1, files_1_1, file, path$1, parts, name, fullName, content, e_1_1;
|
|
4428
4207
|
var e_1, _a;
|
|
4429
4208
|
return __generator(this, function (_b) {
|
|
@@ -4475,7 +4254,7 @@
|
|
|
4475
4254
|
});
|
|
4476
4255
|
};
|
|
4477
4256
|
TemplateRenderer.prototype.render = function (template, language, context) {
|
|
4478
|
-
return __awaiter$
|
|
4257
|
+
return __awaiter$c(this, void 0, void 0, function () {
|
|
4479
4258
|
var res, _a;
|
|
4480
4259
|
return __generator(this, function (_b) {
|
|
4481
4260
|
switch (_b.label) {
|
|
@@ -4525,7 +4304,7 @@
|
|
|
4525
4304
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
4526
4305
|
return Reflect.metadata(k, v);
|
|
4527
4306
|
};
|
|
4528
|
-
var __awaiter$
|
|
4307
|
+
var __awaiter$b = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
4529
4308
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4530
4309
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4531
4310
|
function fulfilled(value) { try {
|
|
@@ -4565,7 +4344,7 @@
|
|
|
4565
4344
|
configurable: true
|
|
4566
4345
|
});
|
|
4567
4346
|
MailSender.prototype.sendMail = function (language, options) {
|
|
4568
|
-
return __awaiter$
|
|
4347
|
+
return __awaiter$b(this, void 0, void 0, function () {
|
|
4569
4348
|
var subject, html;
|
|
4570
4349
|
return __generator(this, function (_a) {
|
|
4571
4350
|
switch (_a.label) {
|
|
@@ -4608,7 +4387,7 @@
|
|
|
4608
4387
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
4609
4388
|
return Reflect.metadata(k, v);
|
|
4610
4389
|
};
|
|
4611
|
-
var __awaiter$
|
|
4390
|
+
var __awaiter$a = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
4612
4391
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4613
4392
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4614
4393
|
function fulfilled(value) { try {
|
|
@@ -4635,7 +4414,7 @@
|
|
|
4635
4414
|
MemoryCache.prototype.set = function (key, value, ttl, expirationTimestamp, tags) {
|
|
4636
4415
|
if (expirationTimestamp === void 0) { expirationTimestamp = null; }
|
|
4637
4416
|
if (tags === void 0) { tags = {}; }
|
|
4638
|
-
return __awaiter$
|
|
4417
|
+
return __awaiter$a(this, void 0, void 0, function () {
|
|
4639
4418
|
var now, expTimestamp;
|
|
4640
4419
|
return __generator(this, function (_a) {
|
|
4641
4420
|
now = Math.round(new Date().getTime() / 1000);
|
|
@@ -4651,7 +4430,7 @@
|
|
|
4651
4430
|
});
|
|
4652
4431
|
};
|
|
4653
4432
|
MemoryCache.prototype.get = function (key) {
|
|
4654
|
-
return __awaiter$
|
|
4433
|
+
return __awaiter$a(this, void 0, void 0, function () {
|
|
4655
4434
|
var item, now, expTimestamp, value;
|
|
4656
4435
|
return __generator(this, function (_a) {
|
|
4657
4436
|
switch (_a.label) {
|
|
@@ -4682,7 +4461,7 @@
|
|
|
4682
4461
|
MemoryCache.prototype.getOrSet = function (key, valueCb, ttl, expirationTimestamp, tags) {
|
|
4683
4462
|
if (expirationTimestamp === void 0) { expirationTimestamp = null; }
|
|
4684
4463
|
if (tags === void 0) { tags = {}; }
|
|
4685
|
-
return __awaiter$
|
|
4464
|
+
return __awaiter$a(this, void 0, void 0, function () {
|
|
4686
4465
|
var e_1, _a, _b;
|
|
4687
4466
|
return __generator(this, function (_c) {
|
|
4688
4467
|
switch (_c.label) {
|
|
@@ -4703,7 +4482,7 @@
|
|
|
4703
4482
|
});
|
|
4704
4483
|
};
|
|
4705
4484
|
MemoryCache.prototype.delete = function (key) {
|
|
4706
|
-
return __awaiter$
|
|
4485
|
+
return __awaiter$a(this, void 0, void 0, function () {
|
|
4707
4486
|
return __generator(this, function (_a) {
|
|
4708
4487
|
switch (_a.label) {
|
|
4709
4488
|
case 0:
|
|
@@ -4734,7 +4513,7 @@
|
|
|
4734
4513
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4735
4514
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4736
4515
|
};
|
|
4737
|
-
var __awaiter$
|
|
4516
|
+
var __awaiter$9 = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
4738
4517
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4739
4518
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4740
4519
|
function fulfilled(value) { try {
|
|
@@ -4763,7 +4542,7 @@
|
|
|
4763
4542
|
function UserManager() {
|
|
4764
4543
|
}
|
|
4765
4544
|
UserManager.prototype.getByCredentials = function (credentials) {
|
|
4766
|
-
return __awaiter$
|
|
4545
|
+
return __awaiter$9(this, void 0, void 0, function () {
|
|
4767
4546
|
var _a;
|
|
4768
4547
|
return __generator(this, function (_b) {
|
|
4769
4548
|
switch (_b.label) {
|
|
@@ -4781,14 +4560,14 @@
|
|
|
4781
4560
|
});
|
|
4782
4561
|
};
|
|
4783
4562
|
UserManager.prototype.getById = function (id) {
|
|
4784
|
-
return __awaiter$
|
|
4563
|
+
return __awaiter$9(this, void 0, void 0, function () {
|
|
4785
4564
|
return __generator(this, function (_a) {
|
|
4786
4565
|
return [2 /*return*/, (sampleUser.id == id) ? sampleUser : null];
|
|
4787
4566
|
});
|
|
4788
4567
|
});
|
|
4789
4568
|
};
|
|
4790
4569
|
UserManager.prototype.serialize = function (user) {
|
|
4791
|
-
return __awaiter$
|
|
4570
|
+
return __awaiter$9(this, void 0, void 0, function () {
|
|
4792
4571
|
var res;
|
|
4793
4572
|
return __generator(this, function (_a) {
|
|
4794
4573
|
res = Object.assign({}, user);
|
|
@@ -4896,7 +4675,7 @@
|
|
|
4896
4675
|
var __param$5 = (this && this.__param) || function (paramIndex, decorator) {
|
|
4897
4676
|
return function (target, key) { decorator(target, key, paramIndex); };
|
|
4898
4677
|
};
|
|
4899
|
-
var __awaiter$
|
|
4678
|
+
var __awaiter$8 = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
4900
4679
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4901
4680
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4902
4681
|
function fulfilled(value) { try {
|
|
@@ -4921,7 +4700,7 @@
|
|
|
4921
4700
|
this.assetResolver = assetResolver;
|
|
4922
4701
|
}
|
|
4923
4702
|
AssetsController.prototype.upload = function (file) {
|
|
4924
|
-
return __awaiter$
|
|
4703
|
+
return __awaiter$8(this, void 0, void 0, function () {
|
|
4925
4704
|
var contentType, asset, e_1, msg;
|
|
4926
4705
|
return __generator(this, function (_c) {
|
|
4927
4706
|
switch (_c.label) {
|
|
@@ -4942,7 +4721,7 @@
|
|
|
4942
4721
|
});
|
|
4943
4722
|
};
|
|
4944
4723
|
AssetsController.prototype.uploadUrl = function (body) {
|
|
4945
|
-
return __awaiter$
|
|
4724
|
+
return __awaiter$8(this, void 0, void 0, function () {
|
|
4946
4725
|
var asset, e_2, msg;
|
|
4947
4726
|
return __generator(this, function (_c) {
|
|
4948
4727
|
switch (_c.label) {
|
|
@@ -4962,7 +4741,7 @@
|
|
|
4962
4741
|
});
|
|
4963
4742
|
};
|
|
4964
4743
|
AssetsController.prototype.getFile = function (id, lazy, res) {
|
|
4965
|
-
return __awaiter$
|
|
4744
|
+
return __awaiter$8(this, void 0, void 0, function () {
|
|
4966
4745
|
var asset;
|
|
4967
4746
|
return __generator(this, function (_c) {
|
|
4968
4747
|
switch (_c.label) {
|
|
@@ -4976,7 +4755,7 @@
|
|
|
4976
4755
|
};
|
|
4977
4756
|
AssetsController.prototype.getImageRotation = function (id, params, res, rotation) {
|
|
4978
4757
|
if (rotation === void 0) { rotation = 0; }
|
|
4979
|
-
return __awaiter$
|
|
4758
|
+
return __awaiter$8(this, void 0, void 0, function () {
|
|
4980
4759
|
var asset;
|
|
4981
4760
|
return __generator(this, function (_c) {
|
|
4982
4761
|
switch (_c.label) {
|
|
@@ -4992,14 +4771,14 @@
|
|
|
4992
4771
|
});
|
|
4993
4772
|
};
|
|
4994
4773
|
AssetsController.prototype.getImage = function (id, params, res) {
|
|
4995
|
-
return __awaiter$
|
|
4774
|
+
return __awaiter$8(this, void 0, void 0, function () {
|
|
4996
4775
|
return __generator(this, function (_c) {
|
|
4997
4776
|
return [2 /*return*/, this.getImageRotation(id, params, res)];
|
|
4998
4777
|
});
|
|
4999
4778
|
});
|
|
5000
4779
|
};
|
|
5001
4780
|
AssetsController.prototype.getFileByName = function (name, res) {
|
|
5002
|
-
return __awaiter$
|
|
4781
|
+
return __awaiter$8(this, void 0, void 0, function () {
|
|
5003
4782
|
var asset;
|
|
5004
4783
|
return __generator(this, function (_c) {
|
|
5005
4784
|
switch (_c.label) {
|
|
@@ -5012,7 +4791,7 @@
|
|
|
5012
4791
|
});
|
|
5013
4792
|
};
|
|
5014
4793
|
AssetsController.prototype.getImageByName = function (name, params, res) {
|
|
5015
|
-
return __awaiter$
|
|
4794
|
+
return __awaiter$8(this, void 0, void 0, function () {
|
|
5016
4795
|
var asset;
|
|
5017
4796
|
return __generator(this, function (_c) {
|
|
5018
4797
|
switch (_c.label) {
|
|
@@ -5038,7 +4817,7 @@
|
|
|
5038
4817
|
}
|
|
5039
4818
|
};
|
|
5040
4819
|
AssetsController.prototype.getAsset = function (type, id, lazy, res) {
|
|
5041
|
-
return __awaiter$
|
|
4820
|
+
return __awaiter$8(this, void 0, void 0, function () {
|
|
5042
4821
|
var asset;
|
|
5043
4822
|
return __generator(this, function (_c) {
|
|
5044
4823
|
switch (_c.label) {
|
|
@@ -5055,7 +4834,7 @@
|
|
|
5055
4834
|
});
|
|
5056
4835
|
};
|
|
5057
4836
|
AssetsController.prototype.getAssetByName = function (type, filename, res) {
|
|
5058
|
-
return __awaiter$
|
|
4837
|
+
return __awaiter$8(this, void 0, void 0, function () {
|
|
5059
4838
|
var asset;
|
|
5060
4839
|
return __generator(this, function (_c) {
|
|
5061
4840
|
switch (_c.label) {
|
|
@@ -5147,7 +4926,7 @@
|
|
|
5147
4926
|
var __param$4 = (this && this.__param) || function (paramIndex, decorator) {
|
|
5148
4927
|
return function (target, key) { decorator(target, key, paramIndex); };
|
|
5149
4928
|
};
|
|
5150
|
-
var __awaiter$
|
|
4929
|
+
var __awaiter$7 = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
5151
4930
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
5152
4931
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5153
4932
|
function fulfilled(value) { try {
|
|
@@ -5172,7 +4951,7 @@
|
|
|
5172
4951
|
this.userManager = userManager;
|
|
5173
4952
|
}
|
|
5174
4953
|
AuthController.prototype.login = function (credentials, res) {
|
|
5175
|
-
return __awaiter$
|
|
4954
|
+
return __awaiter$7(this, void 0, void 0, function () {
|
|
5176
4955
|
var user, reason_1, valid, _a, _b;
|
|
5177
4956
|
return __generator(this, function (_c) {
|
|
5178
4957
|
switch (_c.label) {
|
|
@@ -5292,7 +5071,7 @@
|
|
|
5292
5071
|
var __param$2 = (this && this.__param) || function (paramIndex, decorator) {
|
|
5293
5072
|
return function (target, key) { decorator(target, key, paramIndex); };
|
|
5294
5073
|
};
|
|
5295
|
-
var __awaiter$
|
|
5074
|
+
var __awaiter$6 = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
5296
5075
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
5297
5076
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5298
5077
|
function fulfilled(value) { try {
|
|
@@ -5319,7 +5098,7 @@
|
|
|
5319
5098
|
this.connectionType = !mainEndpoint ? "polling" : "socket";
|
|
5320
5099
|
}
|
|
5321
5100
|
ProgressesController.prototype.getProgress = function (id) {
|
|
5322
|
-
return __awaiter$
|
|
5101
|
+
return __awaiter$6(this, void 0, void 0, function () {
|
|
5323
5102
|
var progress, json;
|
|
5324
5103
|
return __generator(this, function (_a) {
|
|
5325
5104
|
switch (_a.label) {
|
|
@@ -5364,7 +5143,7 @@
|
|
|
5364
5143
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
5365
5144
|
return Reflect.metadata(k, v);
|
|
5366
5145
|
};
|
|
5367
|
-
var __awaiter$
|
|
5146
|
+
var __awaiter$5 = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
5368
5147
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
5369
5148
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5370
5149
|
function fulfilled(value) { try {
|
|
@@ -5396,7 +5175,7 @@
|
|
|
5396
5175
|
configurable: true
|
|
5397
5176
|
});
|
|
5398
5177
|
ErrorHandlerMiddleware.prototype.error = function (error, req, res, next) {
|
|
5399
|
-
return __awaiter$
|
|
5178
|
+
return __awaiter$5(this, void 0, void 0, function () {
|
|
5400
5179
|
var result;
|
|
5401
5180
|
return __generator(this, function (_a) {
|
|
5402
5181
|
switch (_a.label) {
|
|
@@ -5413,7 +5192,7 @@
|
|
|
5413
5192
|
});
|
|
5414
5193
|
};
|
|
5415
5194
|
ErrorHandlerMiddleware.prototype.getResult = function (error, req, res) {
|
|
5416
|
-
return __awaiter$
|
|
5195
|
+
return __awaiter$5(this, void 0, void 0, function () {
|
|
5417
5196
|
var result, _a, _b, _c;
|
|
5418
5197
|
return __generator(this, function (_d) {
|
|
5419
5198
|
switch (_d.label) {
|
|
@@ -5608,7 +5387,7 @@
|
|
|
5608
5387
|
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
5609
5388
|
return function (target, key) { decorator(target, key, paramIndex); };
|
|
5610
5389
|
};
|
|
5611
|
-
var __awaiter$
|
|
5390
|
+
var __awaiter$4 = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
5612
5391
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
5613
5392
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5614
5393
|
function fulfilled(value) { try {
|
|
@@ -5633,7 +5412,7 @@
|
|
|
5633
5412
|
this.socketServer = socketServer;
|
|
5634
5413
|
}
|
|
5635
5414
|
ProgressController.prototype.advanceProgress = function (client, progressId) {
|
|
5636
|
-
return __awaiter$
|
|
5415
|
+
return __awaiter$4(this, void 0, void 0, function () {
|
|
5637
5416
|
var progress, json;
|
|
5638
5417
|
return __generator(this, function (_a) {
|
|
5639
5418
|
switch (_a.label) {
|
|
@@ -5655,7 +5434,7 @@
|
|
|
5655
5434
|
});
|
|
5656
5435
|
};
|
|
5657
5436
|
ProgressController.prototype.setProgressInterest = function (client, progressId) {
|
|
5658
|
-
return __awaiter$
|
|
5437
|
+
return __awaiter$4(this, void 0, void 0, function () {
|
|
5659
5438
|
var progress, json;
|
|
5660
5439
|
return __generator(this, function (_a) {
|
|
5661
5440
|
switch (_a.label) {
|
|
@@ -5722,6 +5501,75 @@
|
|
|
5722
5501
|
socketControllers.Middleware()
|
|
5723
5502
|
], CompressionMiddleware);
|
|
5724
5503
|
|
|
5504
|
+
var __awaiter$3 = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
5505
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
5506
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5507
|
+
function fulfilled(value) { try {
|
|
5508
|
+
step(generator.next(value));
|
|
5509
|
+
}
|
|
5510
|
+
catch (e) {
|
|
5511
|
+
reject(e);
|
|
5512
|
+
} }
|
|
5513
|
+
function rejected(value) { try {
|
|
5514
|
+
step(generator["throw"](value));
|
|
5515
|
+
}
|
|
5516
|
+
catch (e) {
|
|
5517
|
+
reject(e);
|
|
5518
|
+
} }
|
|
5519
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
5520
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
5521
|
+
});
|
|
5522
|
+
};
|
|
5523
|
+
function setupStatic(rootFolder, container) {
|
|
5524
|
+
return __awaiter$3(this, void 0, void 0, function () {
|
|
5525
|
+
var browserFolder, app, ep;
|
|
5526
|
+
return __generator(this, function (_a) {
|
|
5527
|
+
switch (_a.label) {
|
|
5528
|
+
case 0:
|
|
5529
|
+
browserFolder = path.resolve(rootFolder || __dirname, "public_html");
|
|
5530
|
+
app = container.get(EXPRESS);
|
|
5531
|
+
ep = container.get(exports.EndpointProvider);
|
|
5532
|
+
console.log(browserFolder, fs.existsSync(browserFolder));
|
|
5533
|
+
if (fs.existsSync(browserFolder)) {
|
|
5534
|
+
console.log("public_html exists. setting up static files serving...");
|
|
5535
|
+
app.use(express_["static"](browserFolder, {
|
|
5536
|
+
maxAge: "1y"
|
|
5537
|
+
}));
|
|
5538
|
+
}
|
|
5539
|
+
else {
|
|
5540
|
+
console.log("public_html does not exist on path: \"" + browserFolder + "\"");
|
|
5541
|
+
}
|
|
5542
|
+
return [4 /*yield*/, ep.configure(app)];
|
|
5543
|
+
case 1:
|
|
5544
|
+
_a.sent();
|
|
5545
|
+
return [2 /*return*/];
|
|
5546
|
+
}
|
|
5547
|
+
});
|
|
5548
|
+
});
|
|
5549
|
+
}
|
|
5550
|
+
|
|
5551
|
+
var BaseDoc = /** @class */ (function () {
|
|
5552
|
+
function BaseDoc() {
|
|
5553
|
+
}
|
|
5554
|
+
/**
|
|
5555
|
+
* Casts this to DocumentType<this> to allow using document methods in get/set-s
|
|
5556
|
+
*/
|
|
5557
|
+
BaseDoc.prototype.cast = function () {
|
|
5558
|
+
return this;
|
|
5559
|
+
};
|
|
5560
|
+
/**
|
|
5561
|
+
* Gets a pre-compiled model from typegoose cache by its class type
|
|
5562
|
+
* @param type
|
|
5563
|
+
*/
|
|
5564
|
+
BaseDoc.prototype.model = function (type) {
|
|
5565
|
+
return typegoose.getModelForClass(type);
|
|
5566
|
+
};
|
|
5567
|
+
return BaseDoc;
|
|
5568
|
+
}());
|
|
5569
|
+
// @ts-ignore
|
|
5570
|
+
var PrimitiveArray = mongoose.Types.Array;
|
|
5571
|
+
var DocumentArray = mongoose.Types.DocumentArray;
|
|
5572
|
+
|
|
5725
5573
|
var Tree = /** @class */ (function () {
|
|
5726
5574
|
function Tree(container, exists, path) {
|
|
5727
5575
|
this.container = container;
|
|
@@ -5963,67 +5811,6 @@
|
|
|
5963
5811
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
5964
5812
|
});
|
|
5965
5813
|
};
|
|
5966
|
-
function setupStatic(rootFolder, container) {
|
|
5967
|
-
return __awaiter$2(this, void 0, void 0, function () {
|
|
5968
|
-
var browserFolder, app, ep;
|
|
5969
|
-
return __generator(this, function (_a) {
|
|
5970
|
-
switch (_a.label) {
|
|
5971
|
-
case 0:
|
|
5972
|
-
browserFolder = path.resolve(rootFolder || __dirname, "public_html");
|
|
5973
|
-
app = container.get(EXPRESS);
|
|
5974
|
-
ep = container.get(exports.EndpointProvider);
|
|
5975
|
-
console.log(browserFolder, fs.existsSync(browserFolder));
|
|
5976
|
-
if (fs.existsSync(browserFolder)) {
|
|
5977
|
-
console.log("public_html exists. setting up static files serving...");
|
|
5978
|
-
app.use(express_["static"](browserFolder, {
|
|
5979
|
-
maxAge: "1y"
|
|
5980
|
-
}));
|
|
5981
|
-
}
|
|
5982
|
-
else {
|
|
5983
|
-
console.log("public_html does not exist on path: \"" + browserFolder + "\"");
|
|
5984
|
-
}
|
|
5985
|
-
return [4 /*yield*/, ep.configure(app)];
|
|
5986
|
-
case 1:
|
|
5987
|
-
_a.sent();
|
|
5988
|
-
return [2 /*return*/];
|
|
5989
|
-
}
|
|
5990
|
-
});
|
|
5991
|
-
});
|
|
5992
|
-
}
|
|
5993
|
-
|
|
5994
|
-
var BaseDoc = /** @class */ (function () {
|
|
5995
|
-
function BaseDoc() {
|
|
5996
|
-
}
|
|
5997
|
-
/**
|
|
5998
|
-
* Casts this to DocumentType<this> to allow using document methods in get/set-s
|
|
5999
|
-
*/
|
|
6000
|
-
BaseDoc.prototype.cast = function () {
|
|
6001
|
-
return this;
|
|
6002
|
-
};
|
|
6003
|
-
return BaseDoc;
|
|
6004
|
-
}());
|
|
6005
|
-
var DocumentArray = mongoose.Types.DocumentArray;
|
|
6006
|
-
var PrimitiveArray = mongoose.Types.Array;
|
|
6007
|
-
|
|
6008
|
-
var __awaiter$1 = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
6009
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
6010
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
6011
|
-
function fulfilled(value) { try {
|
|
6012
|
-
step(generator.next(value));
|
|
6013
|
-
}
|
|
6014
|
-
catch (e) {
|
|
6015
|
-
reject(e);
|
|
6016
|
-
} }
|
|
6017
|
-
function rejected(value) { try {
|
|
6018
|
-
step(generator["throw"](value));
|
|
6019
|
-
}
|
|
6020
|
-
catch (e) {
|
|
6021
|
-
reject(e);
|
|
6022
|
-
} }
|
|
6023
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
6024
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
6025
|
-
});
|
|
6026
|
-
};
|
|
6027
5814
|
var LazyAssetGenerator = /** @class */ (function () {
|
|
6028
5815
|
function LazyAssetGenerator(assetResolver, progresses, lazyId) {
|
|
6029
5816
|
this.assetResolver = assetResolver;
|
|
@@ -6045,7 +5832,7 @@
|
|
|
6045
5832
|
configurable: true
|
|
6046
5833
|
});
|
|
6047
5834
|
LazyAssetGenerator.prototype.process = function (messaging) {
|
|
6048
|
-
return __awaiter$
|
|
5835
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
6049
5836
|
var lazyAsset, progress, asset, e_1;
|
|
6050
5837
|
return __generator(this, function (_a) {
|
|
6051
5838
|
switch (_a.label) {
|
|
@@ -6093,6 +5880,282 @@
|
|
|
6093
5880
|
return LazyAssetGenerator;
|
|
6094
5881
|
}());
|
|
6095
5882
|
|
|
5883
|
+
var __awaiter$1 = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
5884
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
5885
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5886
|
+
function fulfilled(value) { try {
|
|
5887
|
+
step(generator.next(value));
|
|
5888
|
+
}
|
|
5889
|
+
catch (e) {
|
|
5890
|
+
reject(e);
|
|
5891
|
+
} }
|
|
5892
|
+
function rejected(value) { try {
|
|
5893
|
+
step(generator["throw"](value));
|
|
5894
|
+
}
|
|
5895
|
+
catch (e) {
|
|
5896
|
+
reject(e);
|
|
5897
|
+
} }
|
|
5898
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
5899
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
5900
|
+
});
|
|
5901
|
+
};
|
|
5902
|
+
var pluginsKey = "typegoose:plugins";
|
|
5903
|
+
/**
|
|
5904
|
+
* A mongoose/typegoose plugin to inject services from the main di container to a schema as virtuals
|
|
5905
|
+
* @param schema
|
|
5906
|
+
* @param services
|
|
5907
|
+
*/
|
|
5908
|
+
function injectServices(schema, services) {
|
|
5909
|
+
var serviceMap = {};
|
|
5910
|
+
if (!isObject(services)) {
|
|
5911
|
+
throw new Error("services object should be defined to inject services to schema!");
|
|
5912
|
+
}
|
|
5913
|
+
Object.keys(services).forEach(function (prop) {
|
|
5914
|
+
schema
|
|
5915
|
+
.virtual(prop)
|
|
5916
|
+
.get(function () {
|
|
5917
|
+
var diContainer = diContainers.appContainer;
|
|
5918
|
+
serviceMap[prop] = serviceMap[prop] || (!diContainer ? {} : diContainer.resolve(services[prop]));
|
|
5919
|
+
return serviceMap[prop];
|
|
5920
|
+
});
|
|
5921
|
+
});
|
|
5922
|
+
}
|
|
5923
|
+
/**
|
|
5924
|
+
* Decorates a property to inject a service with the help of the injectServices mongoose/typegoose plugin
|
|
5925
|
+
* @param token optional InjectionToken to use
|
|
5926
|
+
* @return PropertyDecorator
|
|
5927
|
+
*/
|
|
5928
|
+
function service(token) {
|
|
5929
|
+
return function (target, propertyKey) {
|
|
5930
|
+
var _b;
|
|
5931
|
+
var _a;
|
|
5932
|
+
var propertyType = Reflect.getOwnMetadata("design:type", target, propertyKey);
|
|
5933
|
+
var plugins = Array.from((_a = Reflect.getMetadata(pluginsKey, target.constructor)) !== null && _a !== void 0 ? _a : []);
|
|
5934
|
+
var plugin = plugins.find(function (t) { return t.mongoosePlugin === injectServices; });
|
|
5935
|
+
if (!plugin) {
|
|
5936
|
+
plugin = { mongoosePlugin: injectServices, options: {} };
|
|
5937
|
+
plugins.push(plugin);
|
|
5938
|
+
}
|
|
5939
|
+
plugin.options = Object.assign(plugin.options || {}, (_b = {}, _b[propertyKey] = token !== null && token !== void 0 ? token : propertyType, _b));
|
|
5940
|
+
Reflect.defineMetadata(pluginsKey, plugins, target.constructor);
|
|
5941
|
+
};
|
|
5942
|
+
}
|
|
5943
|
+
/**
|
|
5944
|
+
* Paginate using a typegoose model using a simple where query and pagination params
|
|
5945
|
+
* @param model Typegoose model
|
|
5946
|
+
* @param where Simple query to filter the results
|
|
5947
|
+
* @param params Pagination params
|
|
5948
|
+
*/
|
|
5949
|
+
function paginate(model, where, params) {
|
|
5950
|
+
return model.countDocuments(where).then(function (count) {
|
|
5951
|
+
var query = model.find(where);
|
|
5952
|
+
if (isString(params.sort)) {
|
|
5953
|
+
query = query.sort(params.sort);
|
|
5954
|
+
}
|
|
5955
|
+
if (isArray(params.populate)) {
|
|
5956
|
+
params.populate.forEach(function (field) {
|
|
5957
|
+
query = query.populate(field);
|
|
5958
|
+
});
|
|
5959
|
+
}
|
|
5960
|
+
return (params.limit > 0 ? query.skip(params.page * params.limit).limit(params.limit) : query).then(function (items) {
|
|
5961
|
+
var meta = { total: count };
|
|
5962
|
+
return { count: count, items: items, meta: meta };
|
|
5963
|
+
});
|
|
5964
|
+
});
|
|
5965
|
+
}
|
|
5966
|
+
function lookupStages(from, localField, as, foreignField, shouldUnwind) {
|
|
5967
|
+
if (as === void 0) { as = null; }
|
|
5968
|
+
if (foreignField === void 0) { foreignField = "_id"; }
|
|
5969
|
+
if (shouldUnwind === void 0) { shouldUnwind = true; }
|
|
5970
|
+
as = as || localField.replace("Id", "");
|
|
5971
|
+
var stages = [
|
|
5972
|
+
{
|
|
5973
|
+
$lookup: {
|
|
5974
|
+
from: from,
|
|
5975
|
+
localField: localField,
|
|
5976
|
+
foreignField: foreignField,
|
|
5977
|
+
as: as
|
|
5978
|
+
}
|
|
5979
|
+
},
|
|
5980
|
+
{
|
|
5981
|
+
$unwind: {
|
|
5982
|
+
path: "$" + as,
|
|
5983
|
+
preserveNullAndEmptyArrays: true
|
|
5984
|
+
}
|
|
5985
|
+
}
|
|
5986
|
+
];
|
|
5987
|
+
if (!shouldUnwind) {
|
|
5988
|
+
stages.splice(1, 1);
|
|
5989
|
+
}
|
|
5990
|
+
return stages;
|
|
5991
|
+
}
|
|
5992
|
+
function letsLookupStage(from, pipeline, as, letFields) {
|
|
5993
|
+
if (as === void 0) { as = null; }
|
|
5994
|
+
if (letFields === void 0) { letFields = null; }
|
|
5995
|
+
as = as || from;
|
|
5996
|
+
letFields = letFields || { id: "$_id" };
|
|
5997
|
+
return {
|
|
5998
|
+
$lookup: {
|
|
5999
|
+
from: from,
|
|
6000
|
+
let: letFields,
|
|
6001
|
+
pipeline: pipeline,
|
|
6002
|
+
as: as
|
|
6003
|
+
}
|
|
6004
|
+
};
|
|
6005
|
+
}
|
|
6006
|
+
function matchStage(match) {
|
|
6007
|
+
return { $match: match };
|
|
6008
|
+
}
|
|
6009
|
+
function matchField(field, filter, when) {
|
|
6010
|
+
return { field: field, filter: filter, when: when };
|
|
6011
|
+
}
|
|
6012
|
+
function matchFieldStages() {
|
|
6013
|
+
var fields = [];
|
|
6014
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
6015
|
+
fields[_i] = arguments[_i];
|
|
6016
|
+
}
|
|
6017
|
+
var match = {};
|
|
6018
|
+
fields.forEach(function (field) {
|
|
6019
|
+
if (field.when) {
|
|
6020
|
+
match[field.field] = field.filter;
|
|
6021
|
+
}
|
|
6022
|
+
});
|
|
6023
|
+
return Object.keys(match).length > 0 ? [matchStage(match)] : [];
|
|
6024
|
+
}
|
|
6025
|
+
function projectStage(fields) {
|
|
6026
|
+
return { $project: fields };
|
|
6027
|
+
}
|
|
6028
|
+
function unwindStage(fieldOrOpts) {
|
|
6029
|
+
return { $unwind: fieldOrOpts };
|
|
6030
|
+
}
|
|
6031
|
+
function hydratePopulated(modelType, json) {
|
|
6032
|
+
var e_1, _b;
|
|
6033
|
+
var object = modelType.hydrate(json);
|
|
6034
|
+
var _loop_1 = function (path, obj) {
|
|
6035
|
+
var ref = obj.ref, type = obj.type;
|
|
6036
|
+
if (Array.isArray(type) && type.length > 0) {
|
|
6037
|
+
ref = type[0].ref;
|
|
6038
|
+
}
|
|
6039
|
+
if (!ref)
|
|
6040
|
+
return "continue";
|
|
6041
|
+
var value = utils.getValue(path, json);
|
|
6042
|
+
var hydrateVal = function (val) {
|
|
6043
|
+
if (val == null || val instanceof mongoose.Types.ObjectId)
|
|
6044
|
+
return val;
|
|
6045
|
+
return hydratePopulated(mongoose.model(ref), val);
|
|
6046
|
+
};
|
|
6047
|
+
if (Array.isArray(value)) {
|
|
6048
|
+
utils.setValue(path, value.map(hydrateVal), object);
|
|
6049
|
+
return "continue";
|
|
6050
|
+
}
|
|
6051
|
+
utils.setValue(path, hydrateVal(value), object);
|
|
6052
|
+
};
|
|
6053
|
+
try {
|
|
6054
|
+
for (var _c = __values(Object.entries(modelType.schema.obj)), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
6055
|
+
var _e = __read(_d.value, 2), path = _e[0], obj = _e[1];
|
|
6056
|
+
_loop_1(path, obj);
|
|
6057
|
+
}
|
|
6058
|
+
}
|
|
6059
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
6060
|
+
finally {
|
|
6061
|
+
try {
|
|
6062
|
+
if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
|
|
6063
|
+
}
|
|
6064
|
+
finally { if (e_1) throw e_1.error; }
|
|
6065
|
+
}
|
|
6066
|
+
return object;
|
|
6067
|
+
}
|
|
6068
|
+
function paginateAggregations(model, aggregations, params, metaProjection) {
|
|
6069
|
+
if (metaProjection === void 0) { metaProjection = {}; }
|
|
6070
|
+
return __awaiter$1(this, void 0, void 0, function () {
|
|
6071
|
+
var sortField, sortAggregation, result, pagination;
|
|
6072
|
+
var _b;
|
|
6073
|
+
return __generator(this, function (_c) {
|
|
6074
|
+
switch (_c.label) {
|
|
6075
|
+
case 0:
|
|
6076
|
+
sortField = !isString(params.sort) || !params.sort ? null : (params.sort.startsWith("-") ? params.sort.substr(1) : params.sort);
|
|
6077
|
+
sortAggregation = !sortField ? [] : [{
|
|
6078
|
+
$sort: (_b = {}, _b[sortField] = sortField == params.sort ? 1 : -1, _b)
|
|
6079
|
+
}];
|
|
6080
|
+
return [4 /*yield*/, model.aggregate(__spreadArray(__spreadArray(__spreadArray([], __read(aggregations)), __read(sortAggregation)), [
|
|
6081
|
+
{
|
|
6082
|
+
$group: {
|
|
6083
|
+
_id: "results",
|
|
6084
|
+
result: { $push: "$$CURRENT" }
|
|
6085
|
+
}
|
|
6086
|
+
},
|
|
6087
|
+
{
|
|
6088
|
+
$project: {
|
|
6089
|
+
_id: 0,
|
|
6090
|
+
items: params.limit > 0 ? { $slice: ["$result", params.page * params.limit, params.limit] } : "$result",
|
|
6091
|
+
count: { $size: "$result" },
|
|
6092
|
+
meta: Object.assign({ total: { $size: "$result" } }, metaProjection)
|
|
6093
|
+
}
|
|
6094
|
+
}
|
|
6095
|
+
]))];
|
|
6096
|
+
case 1:
|
|
6097
|
+
result = _c.sent();
|
|
6098
|
+
pagination = result[0];
|
|
6099
|
+
if (!pagination) {
|
|
6100
|
+
return [2 /*return*/, { items: [], count: 0, meta: { total: 0 } }];
|
|
6101
|
+
}
|
|
6102
|
+
pagination.items = pagination.items.map(function (i) { return hydratePopulated(model, i); });
|
|
6103
|
+
return [2 /*return*/, pagination];
|
|
6104
|
+
}
|
|
6105
|
+
});
|
|
6106
|
+
});
|
|
6107
|
+
}
|
|
6108
|
+
function ResolveEntity(model, extraCheck) {
|
|
6109
|
+
var _this = this;
|
|
6110
|
+
var modelName = model.modelName;
|
|
6111
|
+
var paramName = modelName.toLowerCase();
|
|
6112
|
+
return routingControllers.createParamDecorator({
|
|
6113
|
+
required: false,
|
|
6114
|
+
value: function (action) { return __awaiter$1(_this, void 0, void 0, function () {
|
|
6115
|
+
var req, token, id, query, doc, e_2;
|
|
6116
|
+
return __generator(this, function (_b) {
|
|
6117
|
+
switch (_b.label) {
|
|
6118
|
+
case 0:
|
|
6119
|
+
req = action.request;
|
|
6120
|
+
token = req.header("x-" + paramName + "-token");
|
|
6121
|
+
id = req.params[paramName + "Id"];
|
|
6122
|
+
if (!id && !token) {
|
|
6123
|
+
throw new routingControllers.BadRequestError(modelName + " id or token should be defined!");
|
|
6124
|
+
}
|
|
6125
|
+
query = !token
|
|
6126
|
+
? model.findById(id)
|
|
6127
|
+
: model.findOne({ token: token });
|
|
6128
|
+
doc = null;
|
|
6129
|
+
if (!isFunction(extraCheck)) return [3 /*break*/, 5];
|
|
6130
|
+
_b.label = 1;
|
|
6131
|
+
case 1:
|
|
6132
|
+
_b.trys.push([1, 3, , 4]);
|
|
6133
|
+
return [4 /*yield*/, valueToPromise(extraCheck(query, action))];
|
|
6134
|
+
case 2:
|
|
6135
|
+
doc = _b.sent();
|
|
6136
|
+
return [3 /*break*/, 4];
|
|
6137
|
+
case 3:
|
|
6138
|
+
e_2 = _b.sent();
|
|
6139
|
+
throw new routingControllers.BadRequestError(modelName + " check error: " + (e_2.message || e_2));
|
|
6140
|
+
case 4: return [3 /*break*/, 7];
|
|
6141
|
+
case 5: return [4 /*yield*/, query];
|
|
6142
|
+
case 6:
|
|
6143
|
+
doc = _b.sent();
|
|
6144
|
+
_b.label = 7;
|
|
6145
|
+
case 7:
|
|
6146
|
+
if (!doc) {
|
|
6147
|
+
throw new routingControllers.HttpError(404, !token
|
|
6148
|
+
? modelName + " could not be found with id: " + id
|
|
6149
|
+
: modelName + " could not be found with token: " + token);
|
|
6150
|
+
}
|
|
6151
|
+
action.request[paramName] = doc;
|
|
6152
|
+
return [2 /*return*/, doc];
|
|
6153
|
+
}
|
|
6154
|
+
});
|
|
6155
|
+
}); }
|
|
6156
|
+
});
|
|
6157
|
+
}
|
|
6158
|
+
|
|
6096
6159
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
6097
6160
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
6098
6161
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -6487,6 +6550,7 @@
|
|
|
6487
6550
|
exports.regroup = regroup;
|
|
6488
6551
|
exports.replaceSpecialChars = replaceSpecialChars;
|
|
6489
6552
|
exports.runCommand = runCommand;
|
|
6553
|
+
exports.service = service;
|
|
6490
6554
|
exports.setupBackend = setupBackend;
|
|
6491
6555
|
exports.streamToBuffer = streamToBuffer;
|
|
6492
6556
|
exports.toImage = toImage;
|