• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

safe-global / safe-client-gateway / 11340871916

15 Oct 2024 06:58AM UTC coverage: 46.83% (-45.0%) from 91.836%
11340871916

push

github

web-flow
Bump typescript from 5.6.2 to 5.6.3 (#2015)

Bumps [typescript](https://github.com/microsoft/TypeScript) from 5.6.2 to 5.6.3.
- [Release notes](https://github.com/microsoft/TypeScript/releases)
- [Changelog](https://github.com/microsoft/TypeScript/blob/main/azure-pipelines.release.yml)
- [Commits](https://github.com/microsoft/TypeScript/compare/v5.6.2...v5.6.3)

---
updated-dependencies:
- dependency-name: typescript
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

500 of 3096 branches covered (16.15%)

Branch coverage included in aggregate %.

5092 of 8845 relevant lines covered (57.57%)

12.16 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

80.0
/src/datasources/network/network.module.ts
1
import { Global, Module } from '@nestjs/common';
18✔
2
import { IConfigurationService } from '@/config/configuration.service.interface';
18✔
3
import { FetchNetworkService } from '@/datasources/network/fetch.network.service';
18✔
4
import { NetworkService } from '@/datasources/network/network.service.interface';
18✔
5
import { NetworkResponse } from '@/datasources/network/entities/network.response.entity';
6
import {
18✔
7
  NetworkRequestError,
8
  NetworkResponseError,
9
} from '@/datasources/network/entities/network.error.entity';
10

11
export type FetchClient = <T>(
12
  url: string,
13
  options: RequestInit,
14
) => Promise<NetworkResponse<T>>;
15

16
/**
17
 * Use this factory to create a {@link FetchClient} instance
18
 * that can be used to make HTTP requests.
19
 */
20
function fetchClientFactory(
21
  configurationService: IConfigurationService,
22
): FetchClient {
23
  const requestTimeout = configurationService.getOrThrow<number>(
18✔
24
    'httpClient.requestTimeout',
25
  );
26

27
  return async <T>(
18✔
28
    url: string,
29
    options: RequestInit,
30
  ): Promise<NetworkResponse<T>> => {
31
    let urlObject: URL | null = null;
22✔
32
    let response: Response | null = null;
22✔
33

34
    try {
22✔
35
      urlObject = new URL(url);
22✔
36
      response = await fetch(url, {
22✔
37
        ...options,
38
        signal: AbortSignal.timeout(requestTimeout),
39
        keepalive: true,
40
      });
41
    } catch (error) {
42
      throw new NetworkRequestError(urlObject, error);
×
43
    }
44

45
    // We validate data so don't need worry about casting `null` response
46
    const data = (await response.json().catch(() => null)) as T;
22✔
47

48
    if (!response.ok) {
22!
49
      throw new NetworkResponseError(urlObject, response, data);
×
50
    }
51

52
    return {
22✔
53
      status: response.status,
54
      data,
55
    };
56
  };
57
}
58

59
/**
60
 * A {@link Global} Module which provides HTTP support via {@link NetworkService}
61
 * Feature Modules don't need to import this module directly in order to inject
62
 * the {@link NetworkService}.
63
 *
64
 * This module should be included in the "root" application module
65
 */
66
@Global()
67
@Module({
68
  providers: [
69
    {
70
      provide: 'FetchClient',
71
      useFactory: fetchClientFactory,
72
      inject: [IConfigurationService],
73
    },
74
    { provide: NetworkService, useClass: FetchNetworkService },
75
  ],
76
  exports: [NetworkService],
77
})
78
export class NetworkModule {}
18✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc