@stemy/backend 2.8.1 → 2.8.5
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 +39 -42
- package/bundles/stemy-backend.umd.js.map +1 -1
- package/bundles/stemy-backend.umd.min.js +1 -1
- package/bundles/stemy-backend.umd.min.js.map +1 -1
- package/common-types.d.ts +1 -0
- package/esm2015/common-types.js +1 -1
- package/esm2015/services/assets.js +2 -2
- package/esm2015/services/configuration.js +4 -2
- package/esm2015/services/entities/lazy-asset.js +10 -10
- package/esm2015/services/lazy-assets.js +2 -2
- package/esm2015/services/progresses.js +2 -2
- package/esm2015/utilities/di-container.js +4 -4
- package/esm2015/utilities/tree.js +11 -7
- package/fesm2015/stemy-backend.js +28 -22
- package/fesm2015/stemy-backend.js.map +1 -1
- package/package.json +1 -1
- package/utilities/di-container.d.ts +1 -1
- package/utilities/tree.d.ts +2 -1
|
@@ -1355,9 +1355,11 @@
|
|
|
1355
1355
|
}).replace(/\./gi, "_").replace(/^_/, "").toUpperCase();
|
|
1356
1356
|
var envValue = process.env[envName];
|
|
1357
1357
|
if (typeof envValue !== "undefined") {
|
|
1358
|
-
|
|
1358
|
+
var value = isFunction(param.resolver)
|
|
1359
1359
|
? param.resolver(envValue)
|
|
1360
1360
|
: convertValue(envValue, getType(param.defaultValue));
|
|
1361
|
+
console.log("Processing param value", name, envName, envValue, value);
|
|
1362
|
+
return value;
|
|
1361
1363
|
}
|
|
1362
1364
|
return param.defaultValue;
|
|
1363
1365
|
};
|
|
@@ -1887,7 +1889,7 @@
|
|
|
1887
1889
|
Assets.prototype.read = function (id) {
|
|
1888
1890
|
return __awaiter$q(this, void 0, void 0, function () {
|
|
1889
1891
|
return __generator(this, function (_b) {
|
|
1890
|
-
return [2 /*return*/, this.find({ _id: new bson.ObjectId(id) })];
|
|
1892
|
+
return [2 /*return*/, !id ? null : this.find({ _id: new bson.ObjectId(id) })];
|
|
1891
1893
|
});
|
|
1892
1894
|
});
|
|
1893
1895
|
};
|
|
@@ -2044,13 +2046,13 @@
|
|
|
2044
2046
|
this.load().then(function () {
|
|
2045
2047
|
if (_this.deleted)
|
|
2046
2048
|
return;
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2049
|
+
_this.progresses.get(_this.progressId).then(function (p) {
|
|
2050
|
+
p === null || p === void 0 ? void 0 : p.cancel();
|
|
2051
|
+
});
|
|
2052
|
+
_this.startWorkingOnAsset().then(function () {
|
|
2053
|
+
console.log("Started working on lazy asset: " + _this.id);
|
|
2054
|
+
}).catch(function (reason) {
|
|
2055
|
+
console.log("Can't start working on lazy asset: " + _this.id + "\nReason: " + reason);
|
|
2054
2056
|
});
|
|
2055
2057
|
});
|
|
2056
2058
|
};
|
|
@@ -2095,19 +2097,21 @@
|
|
|
2095
2097
|
};
|
|
2096
2098
|
LazyAsset.prototype.startWorkingOnAsset = function () {
|
|
2097
2099
|
return __awaiter$p(this, void 0, void 0, function () {
|
|
2098
|
-
var
|
|
2099
|
-
return __generator(this, function (
|
|
2100
|
-
switch (
|
|
2101
|
-
case 0:
|
|
2100
|
+
var _a;
|
|
2101
|
+
return __generator(this, function (_b) {
|
|
2102
|
+
switch (_b.label) {
|
|
2103
|
+
case 0:
|
|
2104
|
+
_a = this.data;
|
|
2105
|
+
return [4 /*yield*/, this.progresses.create()];
|
|
2102
2106
|
case 1:
|
|
2103
|
-
|
|
2104
|
-
this.data.
|
|
2107
|
+
_a.progressId = (_b.sent()).id;
|
|
2108
|
+
this.data.assetId = null;
|
|
2105
2109
|
return [4 /*yield*/, this.save()];
|
|
2106
2110
|
case 2:
|
|
2107
|
-
|
|
2111
|
+
_b.sent();
|
|
2108
2112
|
return [4 /*yield*/, this.jobMan.enqueueWithName(this.data.jobName, Object.assign(Object.assign({}, this.data.jobParams), { lazyId: this.id }))];
|
|
2109
2113
|
case 3:
|
|
2110
|
-
|
|
2114
|
+
_b.sent();
|
|
2111
2115
|
return [2 /*return*/];
|
|
2112
2116
|
}
|
|
2113
2117
|
});
|
|
@@ -2871,7 +2875,7 @@
|
|
|
2871
2875
|
Progresses.prototype.get = function (id) {
|
|
2872
2876
|
return __awaiter$m(this, void 0, void 0, function () {
|
|
2873
2877
|
return __generator(this, function (_a) {
|
|
2874
|
-
return [2 /*return*/, this.find({ _id: new bson.ObjectId(id) })];
|
|
2878
|
+
return [2 /*return*/, !id ? null : this.find({ _id: new bson.ObjectId(id) })];
|
|
2875
2879
|
});
|
|
2876
2880
|
});
|
|
2877
2881
|
};
|
|
@@ -3004,7 +3008,7 @@
|
|
|
3004
3008
|
LazyAssets.prototype.read = function (id) {
|
|
3005
3009
|
return __awaiter$l(this, void 0, void 0, function () {
|
|
3006
3010
|
return __generator(this, function (_a) {
|
|
3007
|
-
return [2 /*return*/, this.find({ _id: new bson.ObjectId(id) })];
|
|
3011
|
+
return [2 /*return*/, !id ? null : this.find({ _id: new bson.ObjectId(id) })];
|
|
3008
3012
|
});
|
|
3009
3013
|
});
|
|
3010
3014
|
};
|
|
@@ -5223,8 +5227,9 @@
|
|
|
5223
5227
|
], CompressionMiddleware);
|
|
5224
5228
|
|
|
5225
5229
|
var Tree = /** @class */ (function () {
|
|
5226
|
-
function Tree(container, path) {
|
|
5230
|
+
function Tree(container, exists, path) {
|
|
5227
5231
|
this.container = container;
|
|
5232
|
+
this.exists = exists;
|
|
5228
5233
|
this.path = path;
|
|
5229
5234
|
this.map = new Map();
|
|
5230
5235
|
}
|
|
@@ -5236,7 +5241,7 @@
|
|
|
5236
5241
|
configurable: true
|
|
5237
5242
|
});
|
|
5238
5243
|
Tree.prototype.resolveService = function () {
|
|
5239
|
-
return this.container.resolve(this.path);
|
|
5244
|
+
return !this.exists ? null : this.container.resolve(this.path);
|
|
5240
5245
|
};
|
|
5241
5246
|
Tree.prototype.resolveLeaves = function () {
|
|
5242
5247
|
var map;
|
|
@@ -5278,7 +5283,7 @@
|
|
|
5278
5283
|
parentTree = parentTree.resolveAncestor(path);
|
|
5279
5284
|
}
|
|
5280
5285
|
catch (e) {
|
|
5281
|
-
parentTree = new Tree(this.container, "");
|
|
5286
|
+
parentTree = new Tree(this.container, false, "");
|
|
5282
5287
|
}
|
|
5283
5288
|
var pathParts = path.split(".");
|
|
5284
5289
|
var tree = this;
|
|
@@ -5312,7 +5317,7 @@
|
|
|
5312
5317
|
Tree.prototype.resolvePath = function (path, throwError) {
|
|
5313
5318
|
if (throwError === void 0) { throwError = true; }
|
|
5314
5319
|
var absolutePath = !this.path ? path : this.path + "." + path;
|
|
5315
|
-
var tree = new Tree(this.container, absolutePath);
|
|
5320
|
+
var tree = new Tree(this.container, false, absolutePath);
|
|
5316
5321
|
try {
|
|
5317
5322
|
tree = this.resolveAncestor(path);
|
|
5318
5323
|
}
|
|
@@ -5331,29 +5336,21 @@
|
|
|
5331
5336
|
return tree;
|
|
5332
5337
|
};
|
|
5333
5338
|
Tree.prototype.addPath = function (path) {
|
|
5334
|
-
var e_2, _a;
|
|
5335
5339
|
if (!isString(path) || path.length == 0) {
|
|
5336
5340
|
return this;
|
|
5337
5341
|
}
|
|
5338
5342
|
var pathParts = path.split(".");
|
|
5343
|
+
var maxIx = pathParts.length - 1;
|
|
5339
5344
|
var tree = this;
|
|
5340
5345
|
path = this.path;
|
|
5341
|
-
|
|
5342
|
-
|
|
5343
|
-
|
|
5344
|
-
|
|
5345
|
-
tree.map.set(part, new Tree(this.container, !path ? part : path + "." + part));
|
|
5346
|
-
}
|
|
5347
|
-
tree = tree.map.get(part);
|
|
5348
|
-
path = tree.path;
|
|
5349
|
-
}
|
|
5350
|
-
}
|
|
5351
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
5352
|
-
finally {
|
|
5353
|
-
try {
|
|
5354
|
-
if (pathParts_2_1 && !pathParts_2_1.done && (_a = pathParts_2.return)) _a.call(pathParts_2);
|
|
5346
|
+
for (var ix = 0; ix <= maxIx; ix++) {
|
|
5347
|
+
var part = pathParts[ix];
|
|
5348
|
+
if (!tree.map.has(part)) {
|
|
5349
|
+
tree.map.set(part, new Tree(this.container, false, !path ? part : path + "." + part));
|
|
5355
5350
|
}
|
|
5356
|
-
|
|
5351
|
+
tree = tree.map.get(part);
|
|
5352
|
+
tree.exists = tree.exists || ix == maxIx;
|
|
5353
|
+
path = tree.path;
|
|
5357
5354
|
}
|
|
5358
5355
|
return this;
|
|
5359
5356
|
};
|
|
@@ -5368,7 +5365,7 @@
|
|
|
5368
5365
|
container["wrapperContainer"] = this;
|
|
5369
5366
|
this.tokens = [];
|
|
5370
5367
|
this.tokenSet = new Set();
|
|
5371
|
-
this.
|
|
5368
|
+
this.root = new Tree(this, false, "");
|
|
5372
5369
|
}
|
|
5373
5370
|
Object.defineProperty(DiContainer.prototype, "registeredTokens", {
|
|
5374
5371
|
get: function () {
|
|
@@ -5380,7 +5377,7 @@
|
|
|
5380
5377
|
});
|
|
5381
5378
|
Object.defineProperty(DiContainer.prototype, "tree", {
|
|
5382
5379
|
get: function () {
|
|
5383
|
-
return this.
|
|
5380
|
+
return this.root;
|
|
5384
5381
|
},
|
|
5385
5382
|
enumerable: false,
|
|
5386
5383
|
configurable: true
|
|
@@ -5444,7 +5441,7 @@
|
|
|
5444
5441
|
this.tokenSet.add(token);
|
|
5445
5442
|
this.tokens.push(token);
|
|
5446
5443
|
if (isString(token)) {
|
|
5447
|
-
this.
|
|
5444
|
+
this.root.addPath(token);
|
|
5448
5445
|
}
|
|
5449
5446
|
return this;
|
|
5450
5447
|
};
|