@duvdu-v1/duvdu 1.1.364 → 1.1.365

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.
@@ -9,6 +9,8 @@ declare class BucketWasabi {
9
9
  removeBucketFiles(...filePaths: string[]): Promise<void>;
10
10
  private getContentType;
11
11
  getPresignedUrl(fileKey: string): Promise<string>;
12
+ signKeys<T extends Record<string, any>>(obj: T, keys: (keyof T)[]): Promise<T>;
13
+ signList(keys: (string | null | undefined)[]): Promise<(string | null | undefined)[]>;
12
14
  private getImageBytes;
13
15
  validateFace(imageKey: string): Promise<{
14
16
  isValid: boolean;
@@ -204,7 +204,6 @@ class BucketWasabi {
204
204
  }
205
205
  getPresignedUrl(fileKey) {
206
206
  return __awaiter(this, void 0, void 0, function* () {
207
- console.log('[getPresignedUrl] fileKey:', fileKey, '| bucket:', this.bucketName);
208
207
  const redis = yield (0, redis_connection_1.getRedisClient)();
209
208
  const cacheKey = `wasabi:presigned:${fileKey}`;
210
209
  const cached = yield redis.get(cacheKey);
@@ -215,11 +214,28 @@ class BucketWasabi {
215
214
  Key: fileKey,
216
215
  Expires: 3600,
217
216
  });
218
- console.log('[getPresignedUrl] generated url:', url);
219
217
  yield redis.set(cacheKey, url, 'EX', 3000);
220
218
  return url;
221
219
  });
222
220
  }
221
+ signKeys(obj, keys) {
222
+ return __awaiter(this, void 0, void 0, function* () {
223
+ if (!obj)
224
+ return obj;
225
+ yield Promise.all(keys.map((k) => __awaiter(this, void 0, void 0, function* () {
226
+ if (obj[k])
227
+ obj[k] = yield this.getPresignedUrl(obj[k]);
228
+ })));
229
+ return obj;
230
+ });
231
+ }
232
+ signList(keys) {
233
+ return __awaiter(this, void 0, void 0, function* () {
234
+ if (!(keys === null || keys === void 0 ? void 0 : keys.length))
235
+ return keys;
236
+ return Promise.all(keys.map((k) => (k ? this.getPresignedUrl(k) : k)));
237
+ });
238
+ }
223
239
  // Fetches the image from Wasabi and returns it as bytes for Rekognition
224
240
  getImageBytes(imageKey) {
225
241
  return __awaiter(this, void 0, void 0, function* () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@duvdu-v1/duvdu",
3
- "version": "1.1.364",
3
+ "version": "1.1.365",
4
4
  "main": "./build/index.js",
5
5
  "types": "./build/index.d.ts",
6
6
  "files": [