@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
|
@@ -876,9 +876,11 @@ let Configuration = class Configuration {
|
|
|
876
876
|
}).replace(/\./gi, "_").replace(/^_/, "").toUpperCase();
|
|
877
877
|
const envValue = process.env[envName];
|
|
878
878
|
if (typeof envValue !== "undefined") {
|
|
879
|
-
|
|
879
|
+
const value = isFunction(param.resolver)
|
|
880
880
|
? param.resolver(envValue)
|
|
881
881
|
: convertValue(envValue, getType(param.defaultValue));
|
|
882
|
+
console.log(`Processing param value`, name, envName, envValue, value);
|
|
883
|
+
return value;
|
|
882
884
|
}
|
|
883
885
|
return param.defaultValue;
|
|
884
886
|
}
|
|
@@ -1229,7 +1231,7 @@ let Assets = class Assets {
|
|
|
1229
1231
|
}
|
|
1230
1232
|
read(id) {
|
|
1231
1233
|
return __awaiter$q(this, void 0, void 0, function* () {
|
|
1232
|
-
return this.find({ _id: new ObjectId(id) });
|
|
1234
|
+
return !id ? null : this.find({ _id: new ObjectId(id) });
|
|
1233
1235
|
});
|
|
1234
1236
|
}
|
|
1235
1237
|
find(where) {
|
|
@@ -1310,13 +1312,13 @@ class LazyAsset extends BaseEntity {
|
|
|
1310
1312
|
this.load().then(() => {
|
|
1311
1313
|
if (this.deleted)
|
|
1312
1314
|
return;
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
});
|
|
1315
|
+
this.progresses.get(this.progressId).then(p => {
|
|
1316
|
+
p === null || p === void 0 ? void 0 : p.cancel();
|
|
1317
|
+
});
|
|
1318
|
+
this.startWorkingOnAsset().then(() => {
|
|
1319
|
+
console.log(`Started working on lazy asset: ${this.id}`);
|
|
1320
|
+
}).catch(reason => {
|
|
1321
|
+
console.log(`Can't start working on lazy asset: ${this.id}\nReason: ${reason}`);
|
|
1320
1322
|
});
|
|
1321
1323
|
});
|
|
1322
1324
|
}
|
|
@@ -1345,8 +1347,8 @@ class LazyAsset extends BaseEntity {
|
|
|
1345
1347
|
}
|
|
1346
1348
|
startWorkingOnAsset() {
|
|
1347
1349
|
return __awaiter$p(this, void 0, void 0, function* () {
|
|
1348
|
-
|
|
1349
|
-
this.data.
|
|
1350
|
+
this.data.progressId = (yield this.progresses.create()).id;
|
|
1351
|
+
this.data.assetId = null;
|
|
1350
1352
|
yield this.save();
|
|
1351
1353
|
yield this.jobMan.enqueueWithName(this.data.jobName, Object.assign(Object.assign({}, this.data.jobParams), { lazyId: this.id }));
|
|
1352
1354
|
});
|
|
@@ -1795,7 +1797,7 @@ let Progresses = class Progresses {
|
|
|
1795
1797
|
}
|
|
1796
1798
|
get(id) {
|
|
1797
1799
|
return __awaiter$m(this, void 0, void 0, function* () {
|
|
1798
|
-
return this.find({ _id: new ObjectId(id) });
|
|
1800
|
+
return !id ? null : this.find({ _id: new ObjectId(id) });
|
|
1799
1801
|
});
|
|
1800
1802
|
}
|
|
1801
1803
|
find(where) {
|
|
@@ -1876,7 +1878,7 @@ let LazyAssets = class LazyAssets {
|
|
|
1876
1878
|
}
|
|
1877
1879
|
read(id) {
|
|
1878
1880
|
return __awaiter$l(this, void 0, void 0, function* () {
|
|
1879
|
-
return this.find({ _id: new ObjectId(id) });
|
|
1881
|
+
return !id ? null : this.find({ _id: new ObjectId(id) });
|
|
1880
1882
|
});
|
|
1881
1883
|
}
|
|
1882
1884
|
find(where) {
|
|
@@ -3354,8 +3356,9 @@ CompressionMiddleware = __decorate([
|
|
|
3354
3356
|
], CompressionMiddleware);
|
|
3355
3357
|
|
|
3356
3358
|
class Tree {
|
|
3357
|
-
constructor(container, path) {
|
|
3359
|
+
constructor(container, exists, path) {
|
|
3358
3360
|
this.container = container;
|
|
3361
|
+
this.exists = exists;
|
|
3359
3362
|
this.path = path;
|
|
3360
3363
|
this.map = new Map();
|
|
3361
3364
|
}
|
|
@@ -3363,7 +3366,7 @@ class Tree {
|
|
|
3363
3366
|
return this.container.parent.tree;
|
|
3364
3367
|
}
|
|
3365
3368
|
resolveService() {
|
|
3366
|
-
return this.container.resolve(this.path);
|
|
3369
|
+
return !this.exists ? null : this.container.resolve(this.path);
|
|
3367
3370
|
}
|
|
3368
3371
|
resolveLeaves() {
|
|
3369
3372
|
let map;
|
|
@@ -3404,7 +3407,7 @@ class Tree {
|
|
|
3404
3407
|
parentTree = parentTree.resolveAncestor(path);
|
|
3405
3408
|
}
|
|
3406
3409
|
catch (e) {
|
|
3407
|
-
parentTree = new Tree(this.container, "");
|
|
3410
|
+
parentTree = new Tree(this.container, false, "");
|
|
3408
3411
|
}
|
|
3409
3412
|
const pathParts = path.split(".");
|
|
3410
3413
|
let tree = this;
|
|
@@ -3427,7 +3430,7 @@ class Tree {
|
|
|
3427
3430
|
}
|
|
3428
3431
|
resolvePath(path, throwError = true) {
|
|
3429
3432
|
const absolutePath = !this.path ? path : `${this.path}.${path}`;
|
|
3430
|
-
let tree = new Tree(this.container, absolutePath);
|
|
3433
|
+
let tree = new Tree(this.container, false, absolutePath);
|
|
3431
3434
|
try {
|
|
3432
3435
|
tree = this.resolveAncestor(path);
|
|
3433
3436
|
}
|
|
@@ -3450,13 +3453,16 @@ class Tree {
|
|
|
3450
3453
|
return this;
|
|
3451
3454
|
}
|
|
3452
3455
|
const pathParts = path.split(".");
|
|
3456
|
+
const maxIx = pathParts.length - 1;
|
|
3453
3457
|
let tree = this;
|
|
3454
3458
|
path = this.path;
|
|
3455
|
-
for (let
|
|
3459
|
+
for (let ix = 0; ix <= maxIx; ix++) {
|
|
3460
|
+
const part = pathParts[ix];
|
|
3456
3461
|
if (!tree.map.has(part)) {
|
|
3457
|
-
tree.map.set(part, new Tree(this.container, !path ? part : `${path}.${part}`));
|
|
3462
|
+
tree.map.set(part, new Tree(this.container, false, !path ? part : `${path}.${part}`));
|
|
3458
3463
|
}
|
|
3459
3464
|
tree = tree.map.get(part);
|
|
3465
|
+
tree.exists = tree.exists || ix == maxIx;
|
|
3460
3466
|
path = tree.path;
|
|
3461
3467
|
}
|
|
3462
3468
|
return this;
|
|
@@ -3470,14 +3476,14 @@ class DiContainer {
|
|
|
3470
3476
|
container["wrapperContainer"] = this;
|
|
3471
3477
|
this.tokens = [];
|
|
3472
3478
|
this.tokenSet = new Set();
|
|
3473
|
-
this.
|
|
3479
|
+
this.root = new Tree(this, false, "");
|
|
3474
3480
|
}
|
|
3475
3481
|
get registeredTokens() {
|
|
3476
3482
|
var _a;
|
|
3477
3483
|
return (((_a = this.parent) === null || _a === void 0 ? void 0 : _a.registeredTokens) || []).concat(this.tokens);
|
|
3478
3484
|
}
|
|
3479
3485
|
get tree() {
|
|
3480
|
-
return this.
|
|
3486
|
+
return this.root;
|
|
3481
3487
|
}
|
|
3482
3488
|
beforeResolution(token, callback, options) {
|
|
3483
3489
|
this.container.beforeResolution(token, callback, options);
|
|
@@ -3538,7 +3544,7 @@ class DiContainer {
|
|
|
3538
3544
|
this.tokenSet.add(token);
|
|
3539
3545
|
this.tokens.push(token);
|
|
3540
3546
|
if (isString(token)) {
|
|
3541
|
-
this.
|
|
3547
|
+
this.root.addPath(token);
|
|
3542
3548
|
}
|
|
3543
3549
|
return this;
|
|
3544
3550
|
}
|