@resolveio/server-lib 1.1.9 → 1.1.10
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/methods/aws.js +37 -0
- package/package.json +1 -1
package/methods/aws.js
CHANGED
|
@@ -193,6 +193,43 @@ function loadAWSMethods(methodManager) {
|
|
|
193
193
|
}); });
|
|
194
194
|
}
|
|
195
195
|
},
|
|
196
|
+
getSignedUrlsAndFilesWithId: {
|
|
197
|
+
skipQueue: true,
|
|
198
|
+
check: new simpl_schema_1.default({
|
|
199
|
+
ids: {
|
|
200
|
+
type: Array
|
|
201
|
+
},
|
|
202
|
+
'ids.$': {
|
|
203
|
+
type: String
|
|
204
|
+
},
|
|
205
|
+
expires: {
|
|
206
|
+
type: Number
|
|
207
|
+
}
|
|
208
|
+
}),
|
|
209
|
+
function: function (ids, expires) {
|
|
210
|
+
var _this = this;
|
|
211
|
+
return new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
|
|
212
|
+
var res, fileArray, files;
|
|
213
|
+
var _this = this;
|
|
214
|
+
return __generator(this, function (_a) {
|
|
215
|
+
switch (_a.label) {
|
|
216
|
+
case 0:
|
|
217
|
+
res = [];
|
|
218
|
+
fileArray = [];
|
|
219
|
+
return [4 /*yield*/, file_collection_1.Files.find({ _id: { $in: ids } })];
|
|
220
|
+
case 1:
|
|
221
|
+
files = _a.sent();
|
|
222
|
+
files.forEach(function (file) {
|
|
223
|
+
var params = { Bucket: _this.serverConfig.AWSBUCKET, Key: file.key, Expires: expires };
|
|
224
|
+
res.push(_this.getAWS().getSignedUrl('getObject', params));
|
|
225
|
+
});
|
|
226
|
+
resolve({ res: res, fileArray: files.map(function (a) { return a.name; }) });
|
|
227
|
+
return [2 /*return*/];
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
}); });
|
|
231
|
+
}
|
|
232
|
+
},
|
|
196
233
|
getSignedUrlWithId: {
|
|
197
234
|
skipQueue: true,
|
|
198
235
|
check: new simpl_schema_1.default({
|