Skip to content

Commit

Permalink
Deploying to gh-pages from @ 9f94983 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
CeEv committed Jul 26, 2024
1 parent f5c4a45 commit afb3c74
Show file tree
Hide file tree
Showing 130 changed files with 4,476 additions and 3,838 deletions.
4 changes: 2 additions & 2 deletions classes/EtherpadResponseMapper.html
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,7 @@ <h3 id="methods">

static mapEtherpadSessionsToSessions(etherpadSessions: unknown): Session[] {
try {
const isObject &#x3D; TypeGuard.isObject(etherpadSessions);
const isObject &#x3D; TypeGuard.isDefinedObject(etherpadSessions);
if (!isObject) return [];

const sessions &#x3D; Object.entries(etherpadSessions)
Expand All @@ -792,7 +792,7 @@ <h3 id="methods">

static mapEtherpadSessionToSession([etherpadId, etherpadSession]: [string, unknown | undefined]): Session {
if (
!TypeGuard.isObject(etherpadSession) ||
!TypeGuard.isDefinedObject(etherpadSession) ||
!(&#x27;groupID&#x27; in etherpadSession) ||
!(&#x27;authorID&#x27; in etherpadSession) ||
!(&#x27;validUntil&#x27; in etherpadSession)
Expand Down
791 changes: 675 additions & 116 deletions classes/TypeGuard.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions coverage.html
Original file line number Diff line number Diff line change
Expand Up @@ -12967,7 +12967,7 @@
<td>DeleteFilesUc</td>
<td align="right" data-sort="0">
<span class="coverage-percent">0 %</span>
<span class="coverage-count">(0/8)</span>
<span class="coverage-count">(0/9)</span>
</td>
</tr>
<tr class="low">
Expand Down Expand Up @@ -27031,7 +27031,7 @@
<td>TypeGuard</td>
<td align="right" data-sort="0">
<span class="coverage-percent">0 %</span>
<span class="coverage-count">(0/11)</span>
<span class="coverage-count">(0/18)</span>
</td>
</tr>
<tr class="medium">
Expand Down
2 changes: 1 addition & 1 deletion dependencies.html
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
</ol>
<ul class="dependencies-list">
<li>
<b>@aws-sdk/lib-storage</b> : ^3.100.0</li>
<b>@aws-sdk/lib-storage</b> : ^3.617.0</li>
<li>
<b>@feathersjs/adapter-commons</b> : ^5.0.12</li>
<li>
Expand Down
134 changes: 106 additions & 28 deletions injectables/DeleteFilesUc.html
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,10 @@ <h6><b>Methods</b></h6>
<span class="modifier">Async</span>
<a href="#deleteMarkedFiles" >deleteMarkedFiles</a>
</li>
<li>
<span class="modifier">Private</span>
<a href="#getClientForFile" >getClientForFile</a>
</li>
<li>
<span class="modifier">Private</span>
<span class="modifier">Async</span>
Expand Down Expand Up @@ -197,7 +201,7 @@ <h3 id="constructor">Constructor</h3>
</tr>
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="12" class="link-to-prism">apps/server/src/modules/files/uc/delete-files.uc.ts:12</a></div>
<div class="io-line">Defined in <a href="" data-line="13" class="link-to-prism">apps/server/src/modules/files/uc/delete-files.uc.ts:13</a></div>
</td>
</tr>

Expand Down Expand Up @@ -286,8 +290,8 @@ <h3 id="methods">

<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="76"
class="link-to-prism">apps/server/src/modules/files/uc/delete-files.uc.ts:76</a></div>
<div class="io-line">Defined in <a href="" data-line="77"
class="link-to-prism">apps/server/src/modules/files/uc/delete-files.uc.ts:77</a></div>
</td>
</tr>

Expand Down Expand Up @@ -356,8 +360,8 @@ <h3 id="methods">

<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="91"
class="link-to-prism">apps/server/src/modules/files/uc/delete-files.uc.ts:91</a></div>
<div class="io-line">Defined in <a href="" data-line="92"
class="link-to-prism">apps/server/src/modules/files/uc/delete-files.uc.ts:92</a></div>
</td>
</tr>

Expand Down Expand Up @@ -426,8 +430,8 @@ <h3 id="methods">

<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="106"
class="link-to-prism">apps/server/src/modules/files/uc/delete-files.uc.ts:106</a></div>
<div class="io-line">Defined in <a href="" data-line="119"
class="link-to-prism">apps/server/src/modules/files/uc/delete-files.uc.ts:119</a></div>
</td>
</tr>

Expand Down Expand Up @@ -463,7 +467,7 @@ <h3 id="methods">
</table>
</div>
<div class="io-description">
<b>Returns : </b> <code><a href="https://www.typescriptlang.org/docs/handbook/basic-types.html" target="_blank" >any</a></code>
<b>Returns : </b> <code>Promise&lt;void&gt;</code>

</div>
<div class="io-description">
Expand Down Expand Up @@ -496,8 +500,8 @@ <h3 id="methods">

<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="22"
class="link-to-prism">apps/server/src/modules/files/uc/delete-files.uc.ts:22</a></div>
<div class="io-line">Defined in <a href="" data-line="23"
class="link-to-prism">apps/server/src/modules/files/uc/delete-files.uc.ts:23</a></div>
</td>
</tr>

Expand Down Expand Up @@ -555,6 +559,75 @@ <h3 id="methods">
</tr>
</tbody>
</table>
<table class="table table-sm table-bordered">
<tbody>
<tr>
<td class="col-md-4">
<a name="getClientForFile"></a>
<span class="name">
<span class="modifier">Private</span>
<span ><b>getClientForFile</b></span>
<a href="#getClientForFile"><span class="icon ion-ios-link"></span></a>
</span>
</td>
</tr>
<tr>
<td class="col-md-4">
<span class="modifier-icon icon ion-ios-reset"></span>
<code>getClientForFile(file: <a href="../classes/FileEntity.html" target="_self">FileEntity</a>)</code>
</td>
</tr>


<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="107"
class="link-to-prism">apps/server/src/modules/files/uc/delete-files.uc.ts:107</a></div>
</td>
</tr>


<tr>
<td class="col-md-4">

<div class="io-description">
<b>Parameters :</b>

<table class="params">
<thead>
<tr>
<td>Name</td>
<td>Type</td>
<td>Optional</td>
</tr>
</thead>
<tbody>
<tr>
<td>file</td>
<td>
<code><a href="../classes/FileEntity.html" target="_self" >FileEntity</a></code>
</td>

<td>
No
</td>


</tr>
</tbody>
</table>
</div>
<div class="io-description">
<b>Returns : </b> <code>S3Client</code>

</div>
<div class="io-description">

</div>
</td>
</tr>
</tbody>
</table>
<table class="table table-sm table-bordered">
<tbody>
<tr>
Expand All @@ -578,8 +651,8 @@ <h3 id="methods">

<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="66"
class="link-to-prism">apps/server/src/modules/files/uc/delete-files.uc.ts:66</a></div>
<div class="io-line">Defined in <a href="" data-line="67"
class="link-to-prism">apps/server/src/modules/files/uc/delete-files.uc.ts:67</a></div>
</td>
</tr>

Expand All @@ -588,7 +661,7 @@ <h3 id="methods">
<td class="col-md-4">

<div class="io-description">
<b>Returns : </b> <code><a href="https://www.typescriptlang.org/docs/handbook/basic-types.html" target="_blank" >any</a></code>
<b>Returns : </b> <code>Promise&lt;void&gt;</code>

</div>
</td>
Expand All @@ -615,18 +688,12 @@ <h3 id="inputs">
</tr>
<tr>
<td class="col-md-4">
<i>Type : </i> <code>Map&lt;string | S3Client&gt;</code>

</td>
</tr>
<tr>
<td class="col-md-4">
<i>Default value : </i><code>new Map()</code>
<i>Default value : </i><code>new Map&lt;string, S3Client&gt;()</code>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="12" class="link-to-prism">apps/server/src/modules/files/uc/delete-files.uc.ts:12</a></div>
<div class="io-line">Defined in <a href="" data-line="13" class="link-to-prism">apps/server/src/modules/files/uc/delete-files.uc.ts:13</a></div>
</td>
</tr>

Expand All @@ -644,12 +711,13 @@ <h3 id="inputs">
import { StorageProviderEntity } from &#x27;@shared/domain/entity&#x27;;
import { StorageProviderRepo } from &#x27;@shared/repo/storageprovider&#x27;;
import { LegacyLogger } from &#x27;@src/core/logger&#x27;;
import { TypeGuard } from &#x27;@shared/common&#x27;;
import { FileEntity } from &#x27;../entity&#x27;;
import { FilesRepo } from &#x27;../repo&#x27;;

@Injectable()
export class DeleteFilesUc {
private s3ClientMap: Map&lt;string, S3Client&gt; &#x3D; new Map();
private s3ClientMap &#x3D; new Map&lt;string, S3Client&gt;();

constructor(
private readonly filesRepo: FilesRepo,
Expand Down Expand Up @@ -703,7 +771,7 @@ <h3 id="inputs">
}
}

private async initializeS3ClientMap() {
private async initializeS3ClientMap(): Promise&lt;void&gt; {
const providers &#x3D; await this.storageProviderRepo.findAll();

providers.forEach((provider) &#x3D;&gt; {
Expand Down Expand Up @@ -743,13 +811,23 @@ <h3 id="inputs">
}
}

private async deleteFileInStorage(file: FileEntity) {
const bucket &#x3D; file.bucket as string;
const storageFileName &#x3D; file.storageFileName as string;
private getClientForFile(file: FileEntity): S3Client {
const storageProvider &#x3D; TypeGuard.checkNotNullOrUndefined(
file.storageProvider,
new Error(&#x60;File ${file.id} has no provider.&#x60;)
);

const client &#x3D; this.s3ClientMap.get(storageProvider.id);
const clientWithProvider &#x3D; TypeGuard.checkNotNullOrUndefined(client, new Error(&#x27;Provider is invalid.&#x27;));

return clientWithProvider;
}

private async deleteFileInStorage(file: FileEntity): Promise&lt;void&gt; {
const { bucket, storageFileName } &#x3D; file;
const deletionCommand &#x3D; new DeleteObjectCommand({ Bucket: bucket, Key: storageFileName });

const storageProvider &#x3D; file.storageProvider as StorageProviderEntity;
const client &#x3D; this.s3ClientMap.get(storageProvider.id) as S3Client;
const client &#x3D; this.getClientForFile(file);

await client.send(deletionCommand);
}
Expand Down
4 changes: 2 additions & 2 deletions injectables/EtherpadClientAdapter.html
Original file line number Diff line number Diff line change
Expand Up @@ -2584,7 +2584,7 @@ <h3 id="methods">
const response &#x3D; await this.tryGetPadsOfAuthor(authorId);
const pads &#x3D; this.handleEtherpadResponse&lt;ListPadsUsingGET200Response&gt;(response, { authorId });

if (!TypeGuard.isObject(pads)) {
if (!TypeGuard.isDefinedObject(pads)) {
throw new InternalServerErrorException(&#x27;Etherpad listPadsOfAuthor response is not an object&#x27;);
}

Expand Down Expand Up @@ -2800,7 +2800,7 @@ <h3 id="methods">
const response &#x3D; await this.tryGetAuthorsOfPad(padId);
const authors &#x3D; this.handleEtherpadResponse&lt;ListAuthorsOfPadUsingGET200Response&gt;(response, { padId });

if (!TypeGuard.isObject(authors)) {
if (!TypeGuard.isDefinedObject(authors)) {
throw new InternalServerErrorException(&#x27;Etherpad listAuthorsOfPad response is not an object&#x27;);
}

Expand Down
Loading

0 comments on commit afb3c74

Please sign in to comment.