Skip to content

Commit

Permalink
Merge pull request #50 from veselin-angelov/feature/delete-objects-re…
Browse files Browse the repository at this point in the history
…cursively

feat: added deletion helper service
  • Loading branch information
MartinAndreev authored Oct 31, 2023
2 parents 65a196f + 7584291 commit 1af3da6
Show file tree
Hide file tree
Showing 21 changed files with 973 additions and 429 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"@nestjs/platform-express": "^9.2.1",
"@nestjs/testing": "^9.2.1",
"@types/express": "4.17.15",
"@types/jest": "^29.2.4",
"@types/jest": "^29.5.7",
"@types/node": "^18.11.15",
"@types/supertest": "2.0.12",
"@typescript-eslint/eslint-plugin": "^5.46.1",
Expand All @@ -64,7 +64,7 @@
"eslint": "^8.29.0",
"eslint-config-prettier": "^8.5.0",
"husky": "^8.0.2",
"jest": "^29.3.1",
"jest": "^29.7.0",
"lint-staged": "^13.1.0",
"prettier": "^2.8.1",
"reflect-metadata": "^0.1.13",
Expand Down
22 changes: 11 additions & 11 deletions site/docs/api/classes/BucketsService.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ custom_edit_url: null

#### Defined in

[services/buckers.service.ts:34](https://github.com/LabO8/nestjs-s3/blob/5ca27ba/src/services/buckers.service.ts#L34)
[services/buckers.service.ts:34](https://github.com/LabO8/nestjs-s3/blob/65a196f/src/services/buckers.service.ts#L34)

## Methods

Expand All @@ -41,7 +41,7 @@ custom_edit_url: null

#### Defined in

[services/buckers.service.ts:36](https://github.com/LabO8/nestjs-s3/blob/5ca27ba/src/services/buckers.service.ts#L36)
[services/buckers.service.ts:36](https://github.com/LabO8/nestjs-s3/blob/65a196f/src/services/buckers.service.ts#L36)

___

Expand All @@ -61,7 +61,7 @@ ___

#### Defined in

[services/buckers.service.ts:48](https://github.com/LabO8/nestjs-s3/blob/5ca27ba/src/services/buckers.service.ts#L48)
[services/buckers.service.ts:48](https://github.com/LabO8/nestjs-s3/blob/65a196f/src/services/buckers.service.ts#L48)

___

Expand All @@ -81,7 +81,7 @@ ___

#### Defined in

[services/buckers.service.ts:60](https://github.com/LabO8/nestjs-s3/blob/5ca27ba/src/services/buckers.service.ts#L60)
[services/buckers.service.ts:60](https://github.com/LabO8/nestjs-s3/blob/65a196f/src/services/buckers.service.ts#L60)

___

Expand All @@ -95,7 +95,7 @@ ___

#### Defined in

[services/buckers.service.ts:56](https://github.com/LabO8/nestjs-s3/blob/5ca27ba/src/services/buckers.service.ts#L56)
[services/buckers.service.ts:56](https://github.com/LabO8/nestjs-s3/blob/65a196f/src/services/buckers.service.ts#L56)

___

Expand All @@ -115,7 +115,7 @@ ___

#### Defined in

[services/buckers.service.ts:66](https://github.com/LabO8/nestjs-s3/blob/5ca27ba/src/services/buckers.service.ts#L66)
[services/buckers.service.ts:66](https://github.com/LabO8/nestjs-s3/blob/65a196f/src/services/buckers.service.ts#L66)

___

Expand All @@ -136,7 +136,7 @@ ___

#### Defined in

[services/buckers.service.ts:119](https://github.com/LabO8/nestjs-s3/blob/5ca27ba/src/services/buckers.service.ts#L119)
[services/buckers.service.ts:119](https://github.com/LabO8/nestjs-s3/blob/65a196f/src/services/buckers.service.ts#L119)

___

Expand All @@ -157,7 +157,7 @@ ___

#### Defined in

[services/buckers.service.ts:83](https://github.com/LabO8/nestjs-s3/blob/5ca27ba/src/services/buckers.service.ts#L83)
[services/buckers.service.ts:83](https://github.com/LabO8/nestjs-s3/blob/65a196f/src/services/buckers.service.ts#L83)

___

Expand All @@ -178,7 +178,7 @@ ___

#### Defined in

[services/buckers.service.ts:74](https://github.com/LabO8/nestjs-s3/blob/5ca27ba/src/services/buckers.service.ts#L74)
[services/buckers.service.ts:74](https://github.com/LabO8/nestjs-s3/blob/65a196f/src/services/buckers.service.ts#L74)

___

Expand All @@ -199,7 +199,7 @@ ___

#### Defined in

[services/buckers.service.ts:107](https://github.com/LabO8/nestjs-s3/blob/5ca27ba/src/services/buckers.service.ts#L107)
[services/buckers.service.ts:107](https://github.com/LabO8/nestjs-s3/blob/65a196f/src/services/buckers.service.ts#L107)

___

Expand All @@ -220,4 +220,4 @@ ___

#### Defined in

[services/buckers.service.ts:95](https://github.com/LabO8/nestjs-s3/blob/5ca27ba/src/services/buckers.service.ts#L95)
[services/buckers.service.ts:95](https://github.com/LabO8/nestjs-s3/blob/65a196f/src/services/buckers.service.ts#L95)
53 changes: 53 additions & 0 deletions site/docs/api/classes/DeletionService.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
id: "DeletionService"
title: "Class: DeletionService"
sidebar_label: "DeletionService"
sidebar_position: 0
custom_edit_url: null
---

## Constructors

### constructor

**new DeletionService**(`client`, `objectsService`, `prefixService`)

#### Parameters

| Name | Type |
| :------ | :------ |
| `client` | `S3Client` |
| `objectsService` | [`ObjectsService`](ObjectsService) |
| `prefixService` | [`PrefixService`](PrefixService) |

#### Defined in

utils/deletion.service.ts:10

## Methods

### deleteObjectsByPrefix

**deleteObjectsByPrefix**(`bucket`, `prefix`, `logDeletedObjects?`, `deleteOptions?`, `listOptions?`): `Promise`<`boolean` \| `DeleteObjectOutput`[]\>

Deletes all objects by prefix.

#### Parameters

| Name | Type | Default value |
| :------ | :------ | :------ |
| `bucket` | `string` | `undefined` |
| `prefix` | `string` | `undefined` |
| `logDeletedObjects` | `boolean` | `false` |
| `deleteOptions?` | [`DeleteObjectsOptions`](../modules#deleteobjectsoptions) | `undefined` |
| `listOptions?` | `Omit`<[`ListObjectsV2Options`](../modules#listobjectsv2options), ``"Prefix"`` \| ``"ContinuationToken"``\> | `undefined` |

#### Returns

`Promise`<`boolean` \| `DeleteObjectOutput`[]\>

Returns true if all objects were deleted.

#### Defined in

utils/deletion.service.ts:20
4 changes: 2 additions & 2 deletions site/docs/api/classes/DownloadService.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ custom_edit_url: null

#### Defined in

[utils/download.service.ts:12](https://github.com/LabO8/nestjs-s3/blob/5ca27ba/src/utils/download.service.ts#L12)
[utils/download.service.ts:12](https://github.com/LabO8/nestjs-s3/blob/65a196f/src/utils/download.service.ts#L12)

## Methods

Expand All @@ -46,4 +46,4 @@ custom_edit_url: null

#### Defined in

[utils/download.service.ts:18](https://github.com/LabO8/nestjs-s3/blob/5ca27ba/src/utils/download.service.ts#L18)
[utils/download.service.ts:18](https://github.com/LabO8/nestjs-s3/blob/65a196f/src/utils/download.service.ts#L18)
37 changes: 29 additions & 8 deletions site/docs/api/classes/ObjectsService.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ custom_edit_url: null

#### Defined in

[services/objects.service.ts:28](https://github.com/LabO8/nestjs-s3/blob/5ca27ba/src/services/objects.service.ts#L28)
[services/objects.service.ts:32](https://github.com/LabO8/nestjs-s3/blob/65a196f/src/services/objects.service.ts#L32)

## Methods

Expand All @@ -43,7 +43,7 @@ custom_edit_url: null

#### Defined in

[services/objects.service.ts:60](https://github.com/LabO8/nestjs-s3/blob/5ca27ba/src/services/objects.service.ts#L60)
[services/objects.service.ts:66](https://github.com/LabO8/nestjs-s3/blob/65a196f/src/services/objects.service.ts#L66)

___

Expand All @@ -65,7 +65,7 @@ ___

#### Defined in

[services/objects.service.ts:74](https://github.com/LabO8/nestjs-s3/blob/5ca27ba/src/services/objects.service.ts#L74)
[services/objects.service.ts:82](https://github.com/LabO8/nestjs-s3/blob/65a196f/src/services/objects.service.ts#L82)

___

Expand All @@ -87,7 +87,7 @@ ___

#### Defined in

[services/objects.service.ts:90](https://github.com/LabO8/nestjs-s3/blob/5ca27ba/src/services/objects.service.ts#L90)
[services/objects.service.ts:100](https://github.com/LabO8/nestjs-s3/blob/65a196f/src/services/objects.service.ts#L100)

___

Expand All @@ -100,15 +100,36 @@ ___
| Name | Type |
| :------ | :------ |
| `bucket` | `string` |
| `options?` | [`ListObjectOptions`](../modules#listobjectoptions) |
| `options?` | [`ListObjectsOptions`](../modules#listobjectsoptions) |

#### Returns

`Promise`<`ListObjectsOutput`\>

#### Defined in

[services/objects.service.ts:100](https://github.com/LabO8/nestjs-s3/blob/5ca27ba/src/services/objects.service.ts#L100)
[services/objects.service.ts:112](https://github.com/LabO8/nestjs-s3/blob/65a196f/src/services/objects.service.ts#L112)

___

### listObjectsV2

**listObjectsV2**(`bucket`, `options?`): `Promise`<`ListObjectsV2Output`\>

#### Parameters

| Name | Type |
| :------ | :------ |
| `bucket` | `string` |
| `options?` | [`ListObjectsV2Options`](../modules#listobjectsv2options) |

#### Returns

`Promise`<`ListObjectsV2Output`\>

#### Defined in

[services/objects.service.ts:121](https://github.com/LabO8/nestjs-s3/blob/65a196f/src/services/objects.service.ts#L121)

___

Expand All @@ -131,7 +152,7 @@ ___

#### Defined in

[services/objects.service.ts:33](https://github.com/LabO8/nestjs-s3/blob/5ca27ba/src/services/objects.service.ts#L33)
[services/objects.service.ts:37](https://github.com/LabO8/nestjs-s3/blob/65a196f/src/services/objects.service.ts#L37)

___

Expand All @@ -154,4 +175,4 @@ ___

#### Defined in

[services/objects.service.ts:49](https://github.com/LabO8/nestjs-s3/blob/5ca27ba/src/services/objects.service.ts#L49)
[services/objects.service.ts:55](https://github.com/LabO8/nestjs-s3/blob/65a196f/src/services/objects.service.ts#L55)
4 changes: 2 additions & 2 deletions site/docs/api/classes/PrefixService.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ custom_edit_url: null

#### Defined in

[services/prefix.service.ts:7](https://github.com/LabO8/nestjs-s3/blob/5ca27ba/src/services/prefix.service.ts#L7)
[services/prefix.service.ts:7](https://github.com/LabO8/nestjs-s3/blob/65a196f/src/services/prefix.service.ts#L7)

## Methods

Expand All @@ -40,4 +40,4 @@ custom_edit_url: null

#### Defined in

[services/prefix.service.ts:9](https://github.com/LabO8/nestjs-s3/blob/5ca27ba/src/services/prefix.service.ts#L9)
[services/prefix.service.ts:9](https://github.com/LabO8/nestjs-s3/blob/65a196f/src/services/prefix.service.ts#L9)
4 changes: 2 additions & 2 deletions site/docs/api/classes/S3Module.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ custom_edit_url: null

#### Defined in

[s3.module.ts:40](https://github.com/LabO8/nestjs-s3/blob/5ca27ba/src/s3.module.ts#L40)
[s3.module.ts:41](https://github.com/LabO8/nestjs-s3/blob/65a196f/src/s3.module.ts#L41)

___

Expand All @@ -50,4 +50,4 @@ ___

#### Defined in

[s3.module.ts:50](https://github.com/LabO8/nestjs-s3/blob/5ca27ba/src/s3.module.ts#L50)
[s3.module.ts:51](https://github.com/LabO8/nestjs-s3/blob/65a196f/src/s3.module.ts#L51)
10 changes: 5 additions & 5 deletions site/docs/api/classes/SignedUrlService.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ custom_edit_url: null

#### Defined in

[services/signed-url.service.ts:16](https://github.com/LabO8/nestjs-s3/blob/5ca27ba/src/services/signed-url.service.ts#L16)
[services/signed-url.service.ts:16](https://github.com/LabO8/nestjs-s3/blob/65a196f/src/services/signed-url.service.ts#L16)

## Methods

Expand All @@ -44,7 +44,7 @@ custom_edit_url: null

#### Defined in

[services/signed-url.service.ts:87](https://github.com/LabO8/nestjs-s3/blob/5ca27ba/src/services/signed-url.service.ts#L87)
[services/signed-url.service.ts:87](https://github.com/LabO8/nestjs-s3/blob/65a196f/src/services/signed-url.service.ts#L87)

___

Expand All @@ -67,7 +67,7 @@ ___

#### Defined in

[services/signed-url.service.ts:66](https://github.com/LabO8/nestjs-s3/blob/5ca27ba/src/services/signed-url.service.ts#L66)
[services/signed-url.service.ts:66](https://github.com/LabO8/nestjs-s3/blob/65a196f/src/services/signed-url.service.ts#L66)

___

Expand All @@ -90,7 +90,7 @@ ___

#### Defined in

[services/signed-url.service.ts:21](https://github.com/LabO8/nestjs-s3/blob/5ca27ba/src/services/signed-url.service.ts#L21)
[services/signed-url.service.ts:21](https://github.com/LabO8/nestjs-s3/blob/65a196f/src/services/signed-url.service.ts#L21)

___

Expand All @@ -113,4 +113,4 @@ ___

#### Defined in

[services/signed-url.service.ts:45](https://github.com/LabO8/nestjs-s3/blob/5ca27ba/src/services/signed-url.service.ts#L45)
[services/signed-url.service.ts:45](https://github.com/LabO8/nestjs-s3/blob/65a196f/src/services/signed-url.service.ts#L45)
Loading

0 comments on commit 1af3da6

Please sign in to comment.