@stemy/backend 3.4.4 → 3.4.7
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.
|
@@ -1876,11 +1876,21 @@
|
|
|
1876
1876
|
Assets.prototype.writeUrl = function (url, metadata) {
|
|
1877
1877
|
if (metadata === void 0) { metadata = null; }
|
|
1878
1878
|
return __awaiter$r(this, void 0, void 0, function () {
|
|
1879
|
-
var buffer;
|
|
1879
|
+
var oneWeek, asset, buffer;
|
|
1880
1880
|
return __generator(this, function (_b) {
|
|
1881
1881
|
switch (_b.label) {
|
|
1882
|
-
case 0:
|
|
1882
|
+
case 0:
|
|
1883
|
+
metadata = metadata || {};
|
|
1884
|
+
metadata.filename = metadata.filename || url;
|
|
1885
|
+
metadata.uploadTime = new Date().getTime();
|
|
1886
|
+
oneWeek = 1000 * 3600 * 24 * 7;
|
|
1887
|
+
return [4 /*yield*/, this.find({ filename: url, "metadata.uploadTime": { $gt: metadata.uploadTime - oneWeek } })];
|
|
1883
1888
|
case 1:
|
|
1889
|
+
asset = _b.sent();
|
|
1890
|
+
if (asset)
|
|
1891
|
+
return [2 /*return*/, asset];
|
|
1892
|
+
return [4 /*yield*/, axios__default["default"]({ url: url, responseType: "arraybuffer" })];
|
|
1893
|
+
case 2:
|
|
1884
1894
|
buffer = (_b.sent()).data;
|
|
1885
1895
|
return [2 /*return*/, this.writeBuffer(buffer, metadata)];
|
|
1886
1896
|
}
|
|
@@ -6433,8 +6443,18 @@
|
|
|
6433
6443
|
});
|
|
6434
6444
|
}); };
|
|
6435
6445
|
restOptions.currentUserChecker = function (action) { return __awaiter(_this, void 0, void 0, function () {
|
|
6446
|
+
var e_3;
|
|
6436
6447
|
return __generator(this, function (_a) {
|
|
6437
|
-
|
|
6448
|
+
switch (_a.label) {
|
|
6449
|
+
case 0:
|
|
6450
|
+
_a.trys.push([0, 2, , 3]);
|
|
6451
|
+
return [4 /*yield*/, resolveUser(diContainer, action.request)];
|
|
6452
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
6453
|
+
case 2:
|
|
6454
|
+
e_3 = _a.sent();
|
|
6455
|
+
return [2 /*return*/, null];
|
|
6456
|
+
case 3: return [2 /*return*/];
|
|
6457
|
+
}
|
|
6438
6458
|
});
|
|
6439
6459
|
}); };
|
|
6440
6460
|
configuration = diContainer.resolve(exports.Configuration);
|