From af25d63ab2e694c95fed5fb189b190363311e341 Mon Sep 17 00:00:00 2001 From: Marcos Candeia Date: Thu, 3 Oct 2024 21:11:32 -0300 Subject: [PATCH] Fix s3 typings Signed-off-by: Marcos Candeia --- src/actors/storage/denoKv.ts | 1 - src/actors/storage/s3.ts | 10 ++++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/actors/storage/denoKv.ts b/src/actors/storage/denoKv.ts index b3c3af2..ae74ff5 100644 --- a/src/actors/storage/denoKv.ts +++ b/src/actors/storage/denoKv.ts @@ -181,7 +181,6 @@ export class DenoKvActorStorage implements ActorStorage { ); for await (const entry of iter) { - console.log(entry); result.push([(entry.key as string[]).slice(-2), entry.value]); } diff --git a/src/actors/storage/s3.ts b/src/actors/storage/s3.ts index 616e0a0..da43b01 100644 --- a/src/actors/storage/s3.ts +++ b/src/actors/storage/s3.ts @@ -128,6 +128,10 @@ export class S3ActorStorage implements ActorStorage { } // Overloaded delete methods + async delete( + key: string, + options?: ActorStoragePutOptions, + ): Promise; async delete( key: string[], options?: ActorStoragePutOptions, @@ -137,7 +141,7 @@ export class S3ActorStorage implements ActorStorage { options?: ActorStoragePutOptions, ): Promise; async delete( - keyOrKeys: string[] | string[][], + keyOrKeys: string | string[] | string[][], _options?: ActorStoragePutOptions, ): Promise { if (Array.isArray(keyOrKeys[0])) { @@ -155,7 +159,9 @@ export class S3ActorStorage implements ActorStorage { return deletedCount; } else { // key: string[] - const keyParts = keyOrKeys as string[]; + const keyParts = typeof keyOrKeys === "string" + ? [keyOrKeys] + : keyOrKeys as string[]; const key = this.buildKey(keyParts); const response = await this.deleteObject(key); await response.body?.cancel();