Skip to content

Commit 7be0163

Browse files
[TECH] 🚚 Déplace http-agent vers `src/shared/'
#11516
2 parents 43ed802 + eca4291 commit 7be0163

File tree

11 files changed

+13
-13
lines changed

11 files changed

+13
-13
lines changed

api/src/identity-access-management/infrastructure/repositories/audit-logger-repository.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { httpAgent } from '../../../../lib/infrastructure/http/http-agent.js';
21
import { config } from '../../../shared/config.js';
32
import { AuditLoggerApiError } from '../../../shared/domain/errors.js';
3+
import { httpAgent } from '../../../shared/infrastructure/http-agent.js';
44

55
const { auditLogger } = config;
66
const basicAuthorizationToken = btoa(`pix-api:${auditLogger.clientSecret}`);

api/src/prescription/campaign-participation/domain/usecases/send-completed-participation-results-to-pole-emploi.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as httpErrorsHelper from '../../../../../lib/infrastructure/http/errors-helper.js';
2-
import { httpAgent } from '../../../../../lib/infrastructure/http/http-agent.js';
2+
import { httpAgent } from '../../../../shared/infrastructure/http-agent.js';
33
import { logger } from '../../../../shared/infrastructure/utils/logger.js';
44
import { PoleEmploiPayload } from '../../infrastructure/externals/pole-emploi/PoleEmploiPayload.js';
55
import { PoleEmploiSending } from '../models/PoleEmploiSending.js';

api/src/prescription/campaign-participation/domain/usecases/send-shared-participation-results-to-pole-emploi.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as httpErrorsHelper from '../../../../../lib/infrastructure/http/errors-helper.js';
2-
import { httpAgent } from '../../../../../lib/infrastructure/http/http-agent.js';
2+
import { httpAgent } from '../../../../shared/infrastructure/http-agent.js';
33
import { logger } from '../../../../shared/infrastructure/utils/logger.js';
44
import { PoleEmploiPayload } from '../../infrastructure/externals/pole-emploi/PoleEmploiPayload.js';
55
import { PoleEmploiSending } from '../models/PoleEmploiSending.js';

api/src/prescription/campaign-participation/domain/usecases/send-started-participation-results-to-pole-emploi.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as httpErrorsHelper from '../../../../../lib/infrastructure/http/errors-helper.js';
2-
import { httpAgent } from '../../../../../lib/infrastructure/http/http-agent.js';
2+
import { httpAgent } from '../../../../shared/infrastructure/http-agent.js';
33
import { logger } from '../../../../shared/infrastructure/utils/logger.js';
44
import { PoleEmploiPayload } from '../../infrastructure/externals/pole-emploi/PoleEmploiPayload.js';
55
import { PoleEmploiSending } from '../models/PoleEmploiSending.js';

api/src/shared/infrastructure/datasources/ApiData.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import jsonwebtoken from 'jsonwebtoken';
22

3-
import { httpAgent } from '../../../../lib/infrastructure/http/http-agent.js';
43
import { config } from '../../config.js';
4+
import { httpAgent } from '../http-agent.js';
55

66
export const STATUS = {
77
SUCCESS: 'success',

api/src/shared/infrastructure/lcms-client.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { httpAgent } from '../../../lib/infrastructure/http/http-agent.js';
21
import { config } from '../config.js';
2+
import { httpAgent } from './http-agent.js';
33
import { logger } from './utils/logger.js';
44

55
const { lcms: lcmsConfig } = config;

api/src/shared/infrastructure/repositories/challenge-repository.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { httpAgent } from '../../../../lib/infrastructure/http/http-agent.js';
1+
import { httpAgent } from '../../../../src/shared/infrastructure/http-agent.js';
22
import * as skillRepository from '../../../shared/infrastructure/repositories/skill-repository.js';
33
import { config } from '../../config.js';
44
import { NotFoundError } from '../../domain/errors.js';

api/tests/identity-access-management/integration/infrastructure/repositories/audit-logger-repository_test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { httpAgent } from '../../../../../lib/infrastructure/http/http-agent.js';
21
import { auditLoggerRepository } from '../../../../../src/identity-access-management/infrastructure/repositories/audit-logger-repository.js';
32
import { config } from '../../../../../src/shared/config.js';
43
import { AuditLoggerApiError } from '../../../../../src/shared/domain/errors.js';
4+
import { httpAgent } from '../../../../../src/shared/infrastructure/http-agent.js';
55
import { catchErr, expect, sinon } from '../../../../test-helper.js';
66

77
const { auditLogger } = config;

api/tests/unit/infrastructure/http/http-agent_test.js api/tests/shared/unit/infrastructure/http-agent_test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import axios from 'axios';
22

3-
import { httpAgent } from '../../../../lib/infrastructure/http/http-agent.js';
3+
import { httpAgent } from '../../../../src/shared/infrastructure/http-agent.js';
44
import { monitoringTools } from '../../../../src/shared/infrastructure/monitoring-tools.js';
55
import { expect, sinon } from '../../../test-helper.js';
66

77
const { post, get } = httpAgent;
88

9-
describe('Unit | Infrastructure | http | http-agent', function () {
9+
describe('Shared | Unit | Infrastructure | http-agent', function () {
1010
describe('#post', function () {
1111
it('should return the response status and success from the http call when successful', async function () {
1212
// given

docs/adr/0024-encapsuler-appel-http.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Date : 2020-04-22
55
## État
66
Adopté
77

8-
## Contexte
8+
## Contexte
99
L'API effectue des appels http:
1010
- vers des services Pix (ex: LCMS);
1111
- vers des API externes à Pix (ex: Pole Emploi).
@@ -28,7 +28,7 @@ Cette encapsulation a déjà été réalisée sur le logging avec [logger](./../
2828

2929
### Solution n°1 : Encapsuler les appels à la librairie http dans un composant
3030

31-
Un composant, [http-agent](../../api/lib/infrastructure/http/http-agent.js), appelle la librairie (ex: `axios`).
31+
Un composant, [http-agent](../../api/src/shared/infrastructure/http-agent.js), appelle la librairie (ex: `axios`).
3232

3333
Le code de production fait appel à ce composant uniquement pour tout appel http.
3434

@@ -53,7 +53,7 @@ Inconvénients :
5353
La solution n°1 est adoptée
5454

5555
## Conséquences
56-
En dehors des API externes proposant une librairie dédiée (ex: [mailjet](https://github.com/mailjet/mailjet-apiv3-nodejs)),
56+
En dehors des API externes proposant une librairie dédiée (ex: [mailjet](https://github.com/mailjet/mailjet-apiv3-nodejs)),
5757
appeler le composant `http-agent` à la place de la librairie (ex: `axios`).
5858

5959
Ajouter une règle de lint pour empêcher l'usage direct et non-intentionnel de la librairie (ex: `axios`).

0 commit comments

Comments
 (0)