diff --git a/README.md b/README.md index 7a077caef..1cb976685 100644 --- a/README.md +++ b/README.md @@ -54,10 +54,9 @@ Nous utilisons [Commit-lint](https://commitlint.js.org/#/) avec [conventional-co #### Prérequis -Le projet nécessite node > 18 et redis installé pour être lancé en local. +Le projet nécessite node > 18 installé pour être lancé en local. - [Installer Node](https://nodejs.org/en/download/package-manager) -- [Installer Redis](https://redis.io/docs/getting-started/installation/) ```bash # Installation diff --git a/clients/_test/clientAllEtablissementsInsee/index.test.ts b/clients/_test/clientAllEtablissementsInsee/index.test.ts index b2bf322e8..701336ee1 100644 --- a/clients/_test/clientAllEtablissementsInsee/index.test.ts +++ b/clients/_test/clientAllEtablissementsInsee/index.test.ts @@ -20,14 +20,7 @@ function expectClientToMatchSnapshotWithSiren(siren: string, page = 1) { await expectClientToMatchSnapshot({ __dirname, client: clientAllEtablissementsInsee, - args: [ - siren, - page, - { - useFallback: false, - useCache: false, - }, - ], + args: [siren, page, false], snaphotFile: `siren-${siren}${page !== 1 ? '-page-' + page : ''}.json`, simplifyParams, }); diff --git a/clients/_test/clientUniteLegaleInsee/index.test.ts b/clients/_test/clientUniteLegaleInsee/index.test.ts index 581ab53df..2d3d26c28 100644 --- a/clients/_test/clientUniteLegaleInsee/index.test.ts +++ b/clients/_test/clientUniteLegaleInsee/index.test.ts @@ -14,14 +14,7 @@ function expectClientToMatchSnapshotWithSiren(siren: Siren) { await expectClientToMatchSnapshot({ client: clientUniteLegaleInsee, __dirname, - args: [ - siren, - 1, - { - useFallback: false, - useCache: false, - }, - ], + args: [siren, 1, false], snaphotFile: `siren-${siren}.json`, postProcessResult: (result) => { result.dateDerniereMiseAJour = '2023-10-5'; diff --git a/clients/api-entreprise/client.ts b/clients/api-entreprise/client.ts index 4ca1d7b40..33515eac4 100644 --- a/clients/api-entreprise/client.ts +++ b/clients/api-entreprise/client.ts @@ -44,9 +44,6 @@ export default async function clientAPIEntreprise( throw new HttpUnauthorizedError('Missing API Entreprise credentials'); } - // never cache any API Entreprise request - const useCache = false; - const response = await httpGet(route, { headers: { Authorization: `Bearer ${process.env.API_ENTREPRISE_TOKEN}`, @@ -57,7 +54,6 @@ export default async function clientAPIEntreprise( context: options?.useCase ? options.useCase : 'annuaire-entreprises', recipient: callerInfos.siret || '13002526500013', }, - useCache, }); return mapToDomainObject(response); diff --git a/clients/api-proxy/association/index.ts b/clients/api-proxy/association/index.ts index 3e92ee894..b8eccb233 100644 --- a/clients/api-proxy/association/index.ts +++ b/clients/api-proxy/association/index.ts @@ -15,12 +15,11 @@ import { IAssociationResponse } from './types'; */ const clientAssociation = async ( rnaOrSiren: IdRna | Siren, - siretSiege: string, - useCache = true + siretSiege: string ) => { const response = await clientAPIProxy( routes.proxy.association + rnaOrSiren, - { timeout: constants.timeout.XL, useCache } + { timeout: constants.timeout.XL } ); if (response.identite && Object.keys(response.identite).length === 1) { diff --git a/clients/api-proxy/eori/index.ts b/clients/api-proxy/eori/index.ts index ba0e88565..44574754a 100644 --- a/clients/api-proxy/eori/index.ts +++ b/clients/api-proxy/eori/index.ts @@ -12,7 +12,6 @@ import { clientAPIProxy } from '../client'; const clientEORI = async (siret: Siret): Promise => { return await clientAPIProxy(routes.proxy.eori + siret, { timeout: constants.timeout.XXL, - useCache: true, }); }; diff --git a/clients/api-proxy/greffe/index.ts b/clients/api-proxy/greffe/index.ts index 580ee6801..c19e0cd75 100644 --- a/clients/api-proxy/greffe/index.ts +++ b/clients/api-proxy/greffe/index.ts @@ -42,7 +42,6 @@ type IIGResponse = { const clientUniteLegaleIG = async (siren: Siren): Promise => { return mapToDomainObject( await clientAPIProxy(routes.proxy.ig + siren, { - useCache: false, timeout: constants.timeout.XL, }), siren diff --git a/clients/api-proxy/rne/documents.ts b/clients/api-proxy/rne/documents.ts index 22d5b9c51..82aaf8ada 100644 --- a/clients/api-proxy/rne/documents.ts +++ b/clients/api-proxy/rne/documents.ts @@ -11,7 +11,7 @@ import { clientAPIProxy } from '../client'; * RNE through the API proxy * @param siren */ -const fetchDocumentsFromRNE = async (siren: Siren, useCache = true) => { +const fetchDocumentsFromRNE = async (siren: Siren) => { const route = routes.proxy.rne.documents.list + siren; const callerInfos = await sensitiveRequestCallerInfos(); @@ -19,7 +19,6 @@ const fetchDocumentsFromRNE = async (siren: Siren, useCache = true) => { return await clientAPIProxy(route, { timeout: constants.timeout.XXXXL, - useCache, }); }; diff --git a/clients/api-proxy/rne/index.ts b/clients/api-proxy/rne/index.ts index 35ac5609d..579eb3e48 100644 --- a/clients/api-proxy/rne/index.ts +++ b/clients/api-proxy/rne/index.ts @@ -28,12 +28,11 @@ type IRNEProxyResponse = { * RNE through the API proxy - API RNE * @param siren */ -const clientRNEImmatriculation = async (siren: Siren, useCache = true) => { +const clientRNEImmatriculation = async (siren: Siren) => { const response = await clientAPIProxy( routes.proxy.rne.immatriculation.default + siren, { timeout: constants.timeout.XS, - useCache, } ); return mapToDomainObject(response); @@ -43,15 +42,11 @@ const clientRNEImmatriculation = async (siren: Siren, useCache = true) => { * RNE through the API proxy - scrapping site as fallback * @param siren */ -const clientRNEImmatriculationFallback = async ( - siren: Siren, - useCache = true -) => { +const clientRNEImmatriculationFallback = async (siren: Siren) => { const response = await clientAPIProxy( routes.proxy.rne.immatriculation.fallback + siren, { timeout: constants.timeout.XXXL, - useCache, } ); return mapToDomainObject(response); diff --git a/clients/api-proxy/tva/index.ts b/clients/api-proxy/tva/index.ts index d56fe9d57..4272f3030 100644 --- a/clients/api-proxy/tva/index.ts +++ b/clients/api-proxy/tva/index.ts @@ -43,14 +43,10 @@ export class TVAUserException extends Error { * @param tva * @returns TVA number if valid else null */ -const clientTVA = async ( - tva: TVANumber, - useCache = true -): Promise => { +const clientTVA = async (tva: TVANumber): Promise => { const url = `${routes.proxy.tva}${tva}`; const data = await clientAPIProxy(url, { - useCache, timeout: constants.timeout.XXL, }); diff --git a/clients/open-data-soft/clients/annuaire-service-public/index.ts b/clients/open-data-soft/clients/annuaire-service-public/index.ts index ef718f11c..6c5243637 100644 --- a/clients/open-data-soft/clients/annuaire-service-public/index.ts +++ b/clients/open-data-soft/clients/annuaire-service-public/index.ts @@ -50,7 +50,6 @@ function queryAnnuaireServicePublic(whereQuery: string) { url: routes.annuaireServicePublic.ods.search, config: { params: { where: whereQuery }, - useCache: true, timeout: constants.timeout.XXXL, }, }, diff --git a/clients/ping-api-clients.ts b/clients/ping-api-clients.ts index 53dce1961..e2a8fa511 100644 --- a/clients/ping-api-clients.ts +++ b/clients/ping-api-clients.ts @@ -27,28 +27,23 @@ const ping = async (slug: string | string[]) => { const sirenDanone = verifySiren('552032534'); const sirenInclusion = verifySiren('419437629'); - const useCache = false; - switch (slug) { case 'api-proxy-ig': return await clientUniteLegaleIG(sirenDanone); case 'api-proxy-rne': // fetch IRM and disable cache - return await clientRNEImmatriculation(sirenDanone, useCache); + return await clientRNEImmatriculation(sirenDanone); case 'api-sirene-insee': - return await clientUniteLegaleInsee(sirenGanymede, 1, { - useCache, - useFallback: false, - }); + return await clientUniteLegaleInsee(sirenGanymede, 1, false); case 'api-sirene-donnees-ouvertes': return await clientUniteLegaleRechercheEntreprise(sirenGanymede, 1); case 'api-association': - return await clientAssociation(verifyIdRna('W551000280'), '', useCache); + return await clientAssociation(verifyIdRna('W551000280'), ''); case 'api-marche-inclusion': return await clientMarcheInclusion(sirenInclusion); case 'api-tva': const tva = verifyTVANumber(tvaNumber(sirenDanone)); - return await clientTVA(tva, useCache); + return await clientTVA(tva); case 'api-eori': return await clientEORI(siretGanymede); case 'api-recherche': @@ -56,7 +51,6 @@ const ping = async (slug: string | string[]) => { searchTerms: 'test', pageResultatsRecherche: 1, searchFilterParams: undefined, - useCache, inclureEtablissements: false, }); default: diff --git a/clients/recherche-entreprise/dirigeants.ts b/clients/recherche-entreprise/dirigeants.ts index d49ab18cb..aee7ca9e4 100644 --- a/clients/recherche-entreprise/dirigeants.ts +++ b/clients/recherche-entreprise/dirigeants.ts @@ -11,7 +11,6 @@ export const clientDirigeantsRechercheEntreprise = async ( inclureEtablissements: false, inclureImmatriculation: false, pageEtablissements: 1, - useCache: false, }); if (!results.length || !results[0]) { diff --git a/clients/recherche-entreprise/idcc.ts b/clients/recherche-entreprise/idcc.ts index dccda3ff3..5350bdf2a 100644 --- a/clients/recherche-entreprise/idcc.ts +++ b/clients/recherche-entreprise/idcc.ts @@ -4,13 +4,10 @@ import { Siren } from '#utils/helpers'; import { httpGet } from '#utils/network'; export const clientIdccRechercheEntreprise = async ( - siren: Siren, - useCache = false + siren: Siren ): Promise => { const url = `${routes.rechercheEntreprise.idcc.siren}/${siren}`; - const data = await httpGet(url, { - useCache, - }); + const data = await httpGet(url, {}); return data; }; diff --git a/clients/recherche-entreprise/index.ts b/clients/recherche-entreprise/index.ts index a53787f5c..b6504ca5c 100644 --- a/clients/recherche-entreprise/index.ts +++ b/clients/recherche-entreprise/index.ts @@ -34,7 +34,6 @@ type ClientSearchRechercheEntreprise = { searchTerms: string; pageResultatsRecherche: number; searchFilterParams?: SearchFilterParams; - useCache?: boolean; inclureEtablissements?: boolean; inclureImmatriculation?: boolean; pageEtablissements?: number; @@ -46,7 +45,6 @@ type ClientSearchRechercheEntreprise = { const clientSearchRechercheEntreprise = async ({ searchTerms, searchFilterParams, - useCache = false, inclureEtablissements = false, inclureImmatriculation = false, pageResultatsRecherche = 1, @@ -90,7 +88,6 @@ const clientSearchRechercheEntreprise = async ({ const results = await httpGet(url, { timeout, headers: { referer: 'annuaire-entreprises-site' }, - useCache, }); if (!results.results || results.results.length === 0) { diff --git a/clients/recherche-entreprise/siren.ts b/clients/recherche-entreprise/siren.ts index e42a93d76..223f77f99 100644 --- a/clients/recherche-entreprise/siren.ts +++ b/clients/recherche-entreprise/siren.ts @@ -5,8 +5,7 @@ import clientSearchRechercheEntreprise from '.'; export const clientUniteLegaleRechercheEntreprise = async ( siren: Siren, - pageEtablissements: number, - useCache = false + pageEtablissements: number ): Promise => { const { results } = await clientSearchRechercheEntreprise({ searchTerms: siren, @@ -14,7 +13,6 @@ export const clientUniteLegaleRechercheEntreprise = async ( inclureEtablissements: true, inclureImmatriculation: true, pageEtablissements, - useCache, }); if (!results.length || !results[0]) { diff --git a/clients/recherche-entreprise/siret.ts b/clients/recherche-entreprise/siret.ts index bc816a997..469ed9544 100644 --- a/clients/recherche-entreprise/siret.ts +++ b/clients/recherche-entreprise/siret.ts @@ -3,15 +3,13 @@ import { IEtablissement } from '#models/core/types'; import clientSearchRechercheEntreprise from '.'; export const clientEtablissementRechercheEntreprise = async ( - siret: string, - useCache = false + siret: string ): Promise => { const { results } = await clientSearchRechercheEntreprise({ searchTerms: siret, pageResultatsRecherche: 1, inclureEtablissements: false, inclureImmatriculation: false, - useCache, }); if ( diff --git a/clients/sirene-insee/index.ts b/clients/sirene-insee/index.ts index 3cf2b9700..72a698bc7 100644 --- a/clients/sirene-insee/index.ts +++ b/clients/sirene-insee/index.ts @@ -3,11 +3,6 @@ import constants from '#models/constants'; import { IDefaultRequestConfig } from '#utils/network'; import { httpClientOAuth } from '#utils/network/backend/0auth'; -export type InseeClientOptions = { - useFallback: boolean; - useCache: boolean; -}; - /** * Insee client * diff --git a/clients/sirene-insee/siren.ts b/clients/sirene-insee/siren.ts index 74f1a492c..e5327cb94 100644 --- a/clients/sirene-insee/siren.ts +++ b/clients/sirene-insee/siren.ts @@ -21,7 +21,7 @@ import { libelleFromCategoriesJuridiques, libelleFromCodeNAF, } from '#utils/helpers/formatting/labels'; -import { inseeClientGet, InseeClientOptions } from '.'; +import { inseeClientGet } from '.'; import { etatFromEtatAdministratifInsee, parseDateCreationInsee, @@ -84,23 +84,23 @@ type TmpUniteLegale = { const clientUniteLegaleInsee = async ( siren: Siren, page = 1, - options: InseeClientOptions + useFallback: boolean ): Promise => { const { uniteLegale, tmpUniteLegale } = await clientTmpUniteLegale( siren, - options + useFallback ); const siretSiege = uniteLegale.siege.siret; const [realSiege, allEtablissements] = await Promise.all([ - clientEtablissementInsee(siretSiege, options).catch((e) => { + clientEtablissementInsee(siretSiege, useFallback).catch((e) => { if (e instanceof HttpForbiddenError) { return createNonDiffusibleEtablissement(uniteLegale.siege.siret); } return null; }), // better empty etablissement list than failing UL - clientAllEtablissementsInsee(siren, page, options).catch(() => null), + clientAllEtablissementsInsee(siren, page, useFallback).catch(() => null), ]); const siege = realSiege || uniteLegale.siege; @@ -132,14 +132,10 @@ const clientUniteLegaleInsee = async ( }; }; -const clientTmpUniteLegale = async ( - siren: Siren, - options: InseeClientOptions -) => { - const { useCache, useFallback } = options; +const clientTmpUniteLegale = async (siren: Siren, useFallback: boolean) => { const dataUniteLegale = await inseeClientGet( routes.sireneInsee.siren + siren, - { useCache }, + {}, useFallback ); diff --git a/clients/sirene-insee/siret.ts b/clients/sirene-insee/siret.ts index 5319723a0..cc76e3cdb 100644 --- a/clients/sirene-insee/siret.ts +++ b/clients/sirene-insee/siret.ts @@ -11,7 +11,7 @@ import { formatAdresse, } from '#utils/helpers'; import { libelleFromCodeNAF } from '#utils/helpers/formatting/labels'; -import { InseeClientOptions, inseeClientGet } from '.'; +import { inseeClientGet } from '.'; import { etatFromEtatAdministratifInsee, parseDateCreationInsee, @@ -92,7 +92,7 @@ interface IInseeetablissementUniteLegale { const clientAllEtablissementsInsee = async ( siren: string, page = 1, - options: InseeClientOptions + useFallback: boolean ): Promise<{ list: IEtablissement[]; page: number; @@ -101,7 +101,6 @@ const clientAllEtablissementsInsee = async ( const etablissementsPerPage = constants.resultsPerPage.etablissements; const cursor = Math.max(page - 1, 0) * etablissementsPerPage; - const { useCache, useFallback } = options; const { header, etablissements } = await inseeClientGet( routes.sireneInsee.siret, @@ -111,7 +110,6 @@ const clientAllEtablissementsInsee = async ( nombre: etablissementsPerPage, debut: cursor, }, - useCache, }, useFallback ); @@ -127,14 +125,12 @@ const clientAllEtablissementsInsee = async ( }; }; -const clientEtablissementInsee = async ( - siret: Siret, - options: InseeClientOptions -) => { +const clientEtablissementInsee = async (siret: Siret, useFallback: boolean) => { const { etablissement, etablissements } = await inseeClientGet( routes.sireneInsee.siret + siret, - options + {}, + useFallback ); if (!etablissement && etablissements) { diff --git a/models/conventions-collectives/index.ts b/models/conventions-collectives/index.ts index 55d91ced8..dff903c57 100644 --- a/models/conventions-collectives/index.ts +++ b/models/conventions-collectives/index.ts @@ -30,7 +30,7 @@ export const getAllIdccWithMetadata = async ( siren: Siren ): Promise => { try { - const allIdcc = await clientIdccRechercheEntreprise(siren, true); + const allIdcc = await clientIdccRechercheEntreprise(siren); const metadata = [] as ICCWithMetadata[]; diff --git a/models/core/etablissement.ts b/models/core/etablissement.ts index d0f6cc274..8e3b5892a 100644 --- a/models/core/etablissement.ts +++ b/models/core/etablissement.ts @@ -4,7 +4,6 @@ import { HttpServerError, } from '#clients/exceptions'; import { clientEtablissementRechercheEntreprise } from '#clients/recherche-entreprise/siret'; -import { InseeClientOptions } from '#clients/sirene-insee'; import { clientEtablissementInsee } from '#clients/sirene-insee/siret'; import { getUniteLegaleFromSlug } from '#models/core/unite-legale'; import { getGeoLoc } from '#models/geo-loc'; @@ -72,10 +71,9 @@ const fetchFromClients = async ( isBot = false ): Promise => { // no cache for bot as they scrap so they tend not to call the same siren twice - const useCache = !isBot; const etablissementRechercheEntreprise = - await fetchEtablissementFromRechercheEntreprise(siret, useCache); + await fetchEtablissementFromRechercheEntreprise(siret); const useInsee = shouldUseInsee( etablissementRechercheEntreprise, @@ -94,10 +92,7 @@ const fetchFromClients = async ( return etablissementRechercheEntreprise; } - const etablissementInsee = await fetchEtablissmentFromInsee(siret, { - useFallback: false, - useCache, - }); + const etablissementInsee = await fetchEtablissmentFromInsee(siret, false); /** * Nowhere to be found @@ -154,10 +149,10 @@ const fetchFromClients = async ( const fetchEtablissmentFromInsee = async ( siret: Siret, - options: InseeClientOptions + useFallback: boolean ): Promise => { try { - return await clientEtablissementInsee(siret, options); + return await clientEtablissementInsee(siret, useFallback); } catch (e: any) { if (e instanceof HttpForbiddenError) { return createNonDiffusibleEtablissement(siret); @@ -166,11 +161,8 @@ const fetchEtablissmentFromInsee = async ( throw new SiretNotFoundError(siret); } - if (!options.useFallback) { - return await fetchEtablissmentFromInsee(siret, { - ...options, - useFallback: true, - }); + if (!useFallback) { + return await fetchEtablissmentFromInsee(siret, true); } logErrorInSentry( @@ -189,21 +181,16 @@ const fetchEtablissmentFromInsee = async ( const fetchEtablissementFromRechercheEntreprise = async ( siret: Siret, - useCache = false, useFallback = false ): Promise => { try { - return await clientEtablissementRechercheEntreprise(siret, useCache); + return await clientEtablissementRechercheEntreprise(siret); } catch (e: any) { if (e instanceof HttpNotFound) { return APINotRespondingFactory(EAdministration.DINUM, 404); } if (!useFallback) { - return await fetchEtablissementFromRechercheEntreprise( - siret, - useCache, - true - ); + return await fetchEtablissementFromRechercheEntreprise(siret, true); } logFatalErrorInSentry( diff --git a/models/core/unite-legale.ts b/models/core/unite-legale.ts index 853de8f07..24087e0a6 100644 --- a/models/core/unite-legale.ts +++ b/models/core/unite-legale.ts @@ -6,7 +6,6 @@ import { HttpServerError, } from '#clients/exceptions'; import { clientUniteLegaleRechercheEntreprise } from '#clients/recherche-entreprise/siren'; -import { InseeClientOptions } from '#clients/sirene-insee'; import { clientUniteLegaleInsee } from '#clients/sirene-insee/siren'; import { createEtablissementsList } from '#models/core/etablissements-list'; import { IETATADMINSTRATIF, estActif } from '#models/core/etat-administratif'; @@ -106,15 +105,11 @@ class UniteLegaleBuilder { }; fetchFromClients = async (): Promise => { - // no cache for bot as they scrap so they tend not to call the same siren twice - const useCache = !this._isBot; - const shouldRetry = true; const uniteLegaleRechercheEntreprise = await fetchUniteLegaleFromRechercheEntreprise( this._siren, this._page, - useCache, shouldRetry ); @@ -144,10 +139,7 @@ class UniteLegaleBuilder { const uniteLegaleInsee = await fetchUniteLegaleFromInsee( this._siren, this._page, - { - useFallback: false, - useCache, - } + false ); /** @@ -263,14 +255,12 @@ class UniteLegaleBuilder { const fetchUniteLegaleFromRechercheEntreprise = async ( siren: Siren, pageEtablissements: number, - useCache: boolean, shouldRetry: boolean ): Promise => { try { return await clientUniteLegaleRechercheEntreprise( siren, - pageEtablissements, - useCache + pageEtablissements ); } catch (e: any) { if (e instanceof HttpNotFound) { @@ -281,7 +271,6 @@ const fetchUniteLegaleFromRechercheEntreprise = async ( return await fetchUniteLegaleFromRechercheEntreprise( siren, pageEtablissements, - useCache, shouldRetryAgain ); } @@ -306,10 +295,10 @@ const fetchUniteLegaleFromRechercheEntreprise = async ( const fetchUniteLegaleFromInsee = async ( siren: Siren, page = 1, - inseeOptions: InseeClientOptions + useFallback: boolean ): Promise => { try { - return await clientUniteLegaleInsee(siren, page, inseeOptions); + return await clientUniteLegaleInsee(siren, page, useFallback); } catch (e: any) { if (e instanceof HttpForbiddenError) { const uniteLegale = createDefaultUniteLegale(siren); @@ -322,11 +311,8 @@ const fetchUniteLegaleFromInsee = async ( return APINotRespondingFactory(EAdministration.INSEE, 404); } - if (!inseeOptions.useFallback) { - return await fetchUniteLegaleFromInsee(siren, page, { - ...inseeOptions, - useFallback: true, - }); + if (!useFallback) { + return await fetchUniteLegaleFromInsee(siren, page, true); } logWarningInSentry( @@ -334,7 +320,7 @@ const fetchUniteLegaleFromInsee = async ( ressource: 'UniteLegaleInsee', administration: EAdministration.INSEE, message: `Fail to fetch from INSEE ${ - inseeOptions.useFallback ? 'fallback' : '' + useFallback ? 'fallback' : '' } API`, cause: e, context: { diff --git a/package-lock.json b/package-lock.json index 1c22dce33..db80f4718 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,6 @@ "@sentry/nextjs": "^8.35.0", "@vcarl/remark-headings": "^0.1.0", "axios": "^1.6.5", - "axios-cache-interceptor": "^1.5.1", "canvas": "^2.11.2", "chart.js": "^4.4.5", "crawler-user-agents": "^1.0.153", @@ -34,7 +33,6 @@ "react-chartjs-2": "^5.2.0", "react-dom": "^18.3.1", "react-select": "^5.8.1", - "redis": "^4.7.0", "rehype-autolink-headings": "^7.1.0", "rehype-stringify": "^10.0.1", "remark-heading-id": "^1.0.1", @@ -3033,111 +3031,6 @@ "node": ">= 10" } }, - "node_modules/@next/swc-darwin-x64": { - "version": "15.0.1", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-15.0.1.tgz", - "integrity": "sha512-uHl13HXOuq1G7ovWFxCACDJHTSDVbn/sbLv8V1p+7KIvTrYQ5HNoSmKBdYeEKRRCbEmd+OohOgg9YOp8Ux3MBg==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@next/swc-linux-arm64-gnu": { - "version": "15.0.1", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-15.0.1.tgz", - "integrity": "sha512-LvyhvxHOihFTEIbb35KxOc3q8w8G4xAAAH/AQnsYDEnOvwawjL2eawsB59AX02ki6LJdgDaHoTEnC54Gw+82xw==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@next/swc-linux-arm64-musl": { - "version": "15.0.1", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-15.0.1.tgz", - "integrity": "sha512-vFmCGUFNyk/A5/BYcQNhAQqPIw01RJaK6dRO+ZEhz0DncoW+hJW1kZ8aH2UvTX27zPq3m85zN5waMSbZEmANcQ==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@next/swc-linux-x64-gnu": { - "version": "15.0.1", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-15.0.1.tgz", - "integrity": "sha512-5by7IYq0NCF8rouz6Qg9T97jYU68kaClHPfGpQG2lCZpSYHtSPQF1kjnqBTd34RIqPKMbCa4DqCufirgr8HM5w==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@next/swc-linux-x64-musl": { - "version": "15.0.1", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-15.0.1.tgz", - "integrity": "sha512-lmYr6H3JyDNBJLzklGXLfbehU3ay78a+b6UmBGlHls4xhDXBNZfgb0aI67sflrX+cGBnv1LgmWzFlYrAYxS1Qw==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@next/swc-win32-arm64-msvc": { - "version": "15.0.1", - "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-15.0.1.tgz", - "integrity": "sha512-DS8wQtl6diAj0eZTdH0sefykm4iXMbHT4MOvLwqZiIkeezKpkgPFcEdFlz3vKvXa2R/2UEgMh48z1nEpNhjeOQ==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@next/swc-win32-x64-msvc": { - "version": "15.0.1", - "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-15.0.1.tgz", - "integrity": "sha512-4Ho2ggvDdMKlZ/0e9HNdZ9ngeaBwtc+2VS5oCeqrbXqOgutX6I4U2X/42VBw0o+M5evn4/7v3zKgGHo+9v/VjA==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">= 10" - } - }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -3790,64 +3683,6 @@ "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0" } }, - "node_modules/@redis/bloom": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@redis/bloom/-/bloom-1.2.0.tgz", - "integrity": "sha512-HG2DFjYKbpNmVXsa0keLHp/3leGJz1mjh09f2RLGGLQZzSHpkmZWuwJbAvo3QcRY8p80m5+ZdXZdYOSBLlp7Cg==", - "peerDependencies": { - "@redis/client": "^1.0.0" - } - }, - "node_modules/@redis/client": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@redis/client/-/client-1.6.0.tgz", - "integrity": "sha512-aR0uffYI700OEEH4gYnitAnv3vzVGXCFvYfdpu/CJKvk4pHfLPEy/JSZyrpQ+15WhXe1yJRXLtfQ84s4mEXnPg==", - "dependencies": { - "cluster-key-slot": "1.1.2", - "generic-pool": "3.9.0", - "yallist": "4.0.0" - }, - "engines": { - "node": ">=14" - } - }, - "node_modules/@redis/client/node_modules/yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" - }, - "node_modules/@redis/graph": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@redis/graph/-/graph-1.1.1.tgz", - "integrity": "sha512-FEMTcTHZozZciLRl6GiiIB4zGm5z5F3F6a6FZCyrfxdKOhFlGkiAqlexWMBzCi4DcRoyiOsuLfW+cjlGWyExOw==", - "peerDependencies": { - "@redis/client": "^1.0.0" - } - }, - "node_modules/@redis/json": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/@redis/json/-/json-1.0.7.tgz", - "integrity": "sha512-6UyXfjVaTBTJtKNG4/9Z8PSpKE6XgSyEb8iwaqDcy+uKrd/DGYHTWkUdnQDyzm727V7p21WUMhsqz5oy65kPcQ==", - "peerDependencies": { - "@redis/client": "^1.0.0" - } - }, - "node_modules/@redis/search": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@redis/search/-/search-1.2.0.tgz", - "integrity": "sha512-tYoDBbtqOVigEDMAcTGsRlMycIIjwMCgD8eR2t0NANeQmgK/lvxNAvYyb6bZDD4frHRhIHkJu2TBRvB0ERkOmw==", - "peerDependencies": { - "@redis/client": "^1.0.0" - } - }, - "node_modules/@redis/time-series": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@redis/time-series/-/time-series-1.1.0.tgz", - "integrity": "sha512-c1Q99M5ljsIuc4YdaCwfUEXsofakb9c8+Zse2qxTadu8TalLXuAESzLvFAvNVbkmSlvlzIQOLpBCmWI9wTOt+g==", - "peerDependencies": { - "@redis/client": "^1.0.0" - } - }, "node_modules/@rollup/plugin-commonjs": { "version": "26.0.1", "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-26.0.1.tgz", @@ -4502,9 +4337,9 @@ } }, "node_modules/@swc/core-linux-x64-gnu": { - "version": "1.7.40", - "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.7.40.tgz", - "integrity": "sha512-4LZdY1MBSnXyTpW5fpBU/+JGAhkuHT+VnFTDNegRboN5nSPh7y0Yvn4LmIioESV+sWzjKkEXujJPGjrp+oSp5w==", + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.8.0.tgz", + "integrity": "sha512-14StQBifCs/AMsySdU95OmwNJr9LOVqo6rcTFt2b7XaWpe/AyeuMJFxcndLgUewksJHpfepzCTwNdbcYmuNo6A==", "cpu": [ "x64" ], @@ -5968,25 +5803,6 @@ "proxy-from-env": "^1.1.0" } }, - "node_modules/axios-cache-interceptor": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/axios-cache-interceptor/-/axios-cache-interceptor-1.6.1.tgz", - "integrity": "sha512-bRzjABzkQ5JOsCrJNhwpabfQ9fV7LykgCKm0AcftXKFrxMhbruXCxak8iCBrxercv4Yb6Hkt2qBMMEWc66vMEw==", - "dependencies": { - "cache-parser": "1.2.5", - "fast-defer": "1.1.8", - "object-code": "1.3.3" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/arthurfiorette/axios-cache-interceptor?sponsor=1" - }, - "peerDependencies": { - "axios": "^1" - } - }, "node_modules/axobject-query": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-3.2.1.tgz", @@ -6339,11 +6155,6 @@ "node": ">=10.16.0" } }, - "node_modules/cache-parser": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/cache-parser/-/cache-parser-1.2.5.tgz", - "integrity": "sha512-Md/4VhAHByQ9frQ15WD6LrMNiVw9AEl/J7vWIXw+sxT6fSOpbtt6LHTp76vy8+bOESPBO94117Hm2bIjlI7XjA==" - }, "node_modules/cachedir": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/cachedir/-/cachedir-2.4.0.tgz", @@ -6685,14 +6496,6 @@ "node": ">=12" } }, - "node_modules/cluster-key-slot": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/cluster-key-slot/-/cluster-key-slot-1.1.2.tgz", - "integrity": "sha512-RMr0FhtfXemyinomL4hrWcYJxmX6deFdCxpJzhDttxgO1+bcCnkk+9drydLVDmAMG7NE6aN/fl4F7ucU/90gAA==", - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/co": { "version": "4.6.0", "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", @@ -8726,11 +8529,6 @@ "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" }, - "node_modules/fast-defer": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/fast-defer/-/fast-defer-1.1.8.tgz", - "integrity": "sha512-lEJeOH5VL5R09j6AA0D4Uvq7AgsHw0dAImQQ+F3iSyHZuAxyQfWobsagGpTcOPvJr3urmKRHrs+Gs9hV+/Qm/Q==" - }, "node_modules/fast-glob": { "version": "3.3.2", "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.2.tgz", @@ -9125,14 +8923,6 @@ "node": ">=10" } }, - "node_modules/generic-pool": { - "version": "3.9.0", - "resolved": "https://registry.npmjs.org/generic-pool/-/generic-pool-3.9.0.tgz", - "integrity": "sha512-hymDOu5B53XvN4QT9dBmZxPX4CWhBPPLguTZ9MMFeFa/Kg0xWVfylOVNlJji/E7yTZWFd/q9GO5TxDLq156D7g==", - "engines": { - "node": ">= 4" - } - }, "node_modules/gensync": { "version": "1.0.0-beta.2", "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", @@ -13309,11 +13099,6 @@ "node": ">=0.10.0" } }, - "node_modules/object-code": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/object-code/-/object-code-1.3.3.tgz", - "integrity": "sha512-/Ds4Xd5xzrtUOJ+xJQ57iAy0BZsZltOHssnDgcZ8DOhgh41q1YJCnTPnWdWSLkNGNnxYzhYChjc5dgC9mEERCA==" - }, "node_modules/object-hash": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/object-hash/-/object-hash-2.2.0.tgz", @@ -15587,22 +15372,6 @@ "node": ">=8" } }, - "node_modules/redis": { - "version": "4.7.0", - "resolved": "https://registry.npmjs.org/redis/-/redis-4.7.0.tgz", - "integrity": "sha512-zvmkHEAdGMn+hMRXuMBtu4Vo5P6rHQjLoHftu+lBqq8ZTA3RCVC/WzD790bkKKiNFp7d5/9PcSD19fJyyRvOdQ==", - "workspaces": [ - "./packages/*" - ], - "dependencies": { - "@redis/bloom": "1.2.0", - "@redis/client": "1.6.0", - "@redis/graph": "1.1.1", - "@redis/json": "1.0.7", - "@redis/search": "1.2.0", - "@redis/time-series": "1.1.0" - } - }, "node_modules/reflect.getprototypeof": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/reflect.getprototypeof/-/reflect.getprototypeof-1.0.6.tgz", diff --git a/package.json b/package.json index abe7524e2..05ea6ce9c 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,6 @@ }, "scripts": { "prepare": "npx simple-git-hooks; npm run script:fetch-protected-siren", - "start:dev:redis": "redis-server --daemonize yes", "start:dev:next": "NODE_ENV=development next dev", "dev": "run-p start:dev:*", "build": "NODE_ENV=production next build || NODE_ENV=production SENTRY_DISABLE_SOURCEMAP_UPLOAD=true next build", @@ -29,7 +28,6 @@ "@sentry/nextjs": "^8.35.0", "@vcarl/remark-headings": "^0.1.0", "axios": "^1.6.5", - "axios-cache-interceptor": "^1.5.1", "canvas": "^2.11.2", "chart.js": "^4.4.5", "crawler-user-agents": "^1.0.153", @@ -50,7 +48,6 @@ "react-chartjs-2": "^5.2.0", "react-dom": "^18.3.1", "react-select": "^5.8.1", - "redis": "^4.7.0", "rehype-autolink-headings": "^7.1.0", "rehype-stringify": "^10.0.1", "remark-heading-id": "^1.0.1", diff --git a/utils/network/backend/0auth.ts b/utils/network/backend/0auth.ts index a55e3eb05..68ee1eb26 100644 --- a/utils/network/backend/0auth.ts +++ b/utils/network/backend/0auth.ts @@ -43,7 +43,6 @@ export class httpClientOAuth { grant_type: 'client_credentials', validity_period: 604800, }, - useCache: false, }); this._token = { data, @@ -87,7 +86,6 @@ export class httpClientOAuth { ...config.headers, Authorization: `Bearer ${token.data.access_token}`, }, - useCache: config.useCache || false, }); }; } diff --git a/utils/network/backend/cache-config.ts b/utils/network/backend/cache-config.ts deleted file mode 100644 index 6ffd58170..000000000 --- a/utils/network/backend/cache-config.ts +++ /dev/null @@ -1,21 +0,0 @@ -export const CACHE_TIMEOUT = 1000 * 60 * 15; - -export const defaultCacheConfig = { - // 15 minutes lifespan as average session is ~ 3 min. - ttl: CACHE_TIMEOUT, - - // only cache 200 - cachePredicate: { - statusCheck: (status: number) => { - return status >= 200 && status < 300; - }, - responseMatch: ({ data }: { data: any }) => { - // only caches if the response is not fallback - const isFallback = !!data?.metadata?.isFallback; - return !isFallback; - }, - }, - // If we should return a old (possibly expired) cache when the current request failed - // to get a valid response because of a network error, invalid status or etc. - staleIfError: false, -}; diff --git a/utils/network/backend/error-interceptor.ts b/utils/network/backend/error-interceptor.ts index 2c043d567..d24ccdc52 100644 --- a/utils/network/backend/error-interceptor.ts +++ b/utils/network/backend/error-interceptor.ts @@ -27,7 +27,6 @@ const errorInterceptor = (error: AxiosError) => { formatLog( url, status, - false, startTime ? endTime - startTime : undefined, error.request?.method ) diff --git a/utils/network/backend/index.ts b/utils/network/backend/index.ts index 817eae67f..64f36da76 100644 --- a/utils/network/backend/index.ts +++ b/utils/network/backend/index.ts @@ -1,17 +1,10 @@ +import constants from '#models/constants'; +import Axios, { AxiosInstance } from 'axios'; import http from 'http'; import https from 'https'; -import Axios from 'axios'; -import { - AxiosCacheInstance, - buildStorage, - setupCache, -} from 'axios-cache-interceptor'; -import constants from '#models/constants'; import { IDefaultRequestConfig } from '..'; -import { CACHE_TIMEOUT, defaultCacheConfig } from './cache-config'; import errorInterceptor from './error-interceptor'; import { addStartTimeInterceptor, logInterceptor } from './log-interceptor'; -import { RedisStorage } from './redis/redis-storage'; /** * Limit the number of sockets allocated per distant hosts and to reuse sockets @@ -23,29 +16,17 @@ const agentOptions = { maxFreeSockets: 128, // Maximum number of sockets to leave open in a free state. Only relevant if keepAlive is set to true. Defaults to 256. }; -const redisStorage = RedisStorage.isRedisEnabled - ? new RedisStorage(CACHE_TIMEOUT) - : undefined; - /** * Returns a cache-enabled axios instance */ -export const axiosInstanceFactory = ( - timeout = constants.timeout.L -): AxiosCacheInstance => { +const axiosInstanceFactory = (timeout = constants.timeout.L): AxiosInstance => { const axiosOptions = { timeout, httpsAgent: new https.Agent(agentOptions), httpAgent: new http.Agent(agentOptions), }; - const axiosInstance = setupCache(Axios.create(axiosOptions), { - storage: redisStorage ? buildStorage(redisStorage) : undefined, - // ignore cache-control headers as some API like sirene return 'no-cache' headers - headerInterpreter: () => CACHE_TIMEOUT, - // eslint-disable-next-line no-console - debug: console.info, - }); + const axiosInstance = Axios.create(axiosOptions); //@ts-ignore axiosInstance.interceptors.request.use(addStartTimeInterceptor, (err) => @@ -58,12 +39,11 @@ export const axiosInstanceFactory = ( return axiosInstance; }; -const axiosInstanceWithCache = axiosInstanceFactory(); +const axiosInstance = axiosInstanceFactory(); async function httpBackClient(config: IDefaultRequestConfig): Promise { - const response = await axiosInstanceWithCache({ + const response = await axiosInstance({ timeout: constants.timeout.L, - cache: config.useCache ? defaultCacheConfig : false, ...config, headers: { 'User-Agent': 'annuaire-entreprises-site', diff --git a/utils/network/backend/log-interceptor.ts b/utils/network/backend/log-interceptor.ts index 194eed4f5..8d03189dd 100644 --- a/utils/network/backend/log-interceptor.ts +++ b/utils/network/backend/log-interceptor.ts @@ -28,7 +28,6 @@ export const logInterceptor = (response: AxiosResponse) => { response?.config?.url || '', response?.status, //@ts-ignore - response?.cached, startTime ? endTime - startTime : undefined, (response?.config?.method || '').toUpperCase() ) diff --git a/utils/network/backend/redis/promise-timeout.ts b/utils/network/backend/redis/promise-timeout.ts deleted file mode 100644 index 4a48ab668..000000000 --- a/utils/network/backend/redis/promise-timeout.ts +++ /dev/null @@ -1,46 +0,0 @@ -/** - * Custom implementation of timeout for promise - * - * Always prefer the built-in alternative if it exists - */ - -export class PromiseTimeoutError extends Error { - constructor(public message: string) { - super(message); - } -} - -/** - * Rejects a promise with a {@link PromiseTimeoutError} if it does not settle within - * the specified timeout. - * - * @param {Promise} promise The promise. - * @param {number} timeoutMillis Number of milliseconds to wait on settling. - * @returns {Promise} Either resolves/rejects with `promise`, or rejects with - * `TimeoutError`, whichever settles first. - */ - -export const promiseTimeout = ( - promise: Promise, - timeoutMillis: number -) => { - let timeout: NodeJS.Timeout; - - return Promise.race([ - promise, - new Promise(function (resolve, reject) { - timeout = setTimeout(function () { - reject(new PromiseTimeoutError('Redis client timeout')); - }, timeoutMillis); - }), - ]).then( - function (v) { - clearTimeout(timeout); - return v; - }, - function (err) { - clearTimeout(timeout); - throw err; - } - ); -}; diff --git a/utils/network/backend/redis/redis-storage.ts b/utils/network/backend/redis/redis-storage.ts deleted file mode 100644 index a6c5cca34..000000000 --- a/utils/network/backend/redis/redis-storage.ts +++ /dev/null @@ -1,90 +0,0 @@ -import { BuildStorage } from 'axios-cache-interceptor'; -import { createClient } from 'redis'; -import { Exception } from '#models/exceptions'; -import { logWarningInSentry } from '#utils/sentry'; -import { promiseTimeout } from './promise-timeout'; - -export class RedisStorage implements BuildStorage { - static isRedisEnabled = process.env.REDIS_ENABLED === 'enabled'; - private _client; - - constructor(private cache_timeout: number) { - if (!RedisStorage.isRedisEnabled) { - throw new Error('Redis is disabled'); - } - - this._client = createClient({ - url: process.env.REDIS_URL, - pingInterval: 1000, - }); - - this._client.on('error', (err) => { - logWarningInSentry( - new RedisStorageException({ - message: err.message || 'Redis client error', - cause: err, - }) - ); - }); - } - - private async connect() { - if (!this._client.isOpen) { - try { - return this._client.connect(); - } catch (e) { - logWarningInSentry( - new RedisStorageException({ - message: 'Could not connect to redis client', - cause: e, - }) - ); - } - } - } - - find = async (key: string) => { - await this.connect(); - const result = await promiseTimeout(this._client.get(key), 100).catch( - (err) => { - logWarningInSentry( - new RedisStorageException({ - message: err.message || 'Could not get key', - cause: err, - }) - ); - return null; - } - ); - - return result ? JSON.parse(result) : result; - }; - - set = async (key: string, value: any) => { - await this.connect(); - await promiseTimeout( - this._client.set(key, JSON.stringify(value), { - PX: this.cache_timeout, - }), - 200 - ).catch((err) => { - logWarningInSentry( - new RedisStorageException({ - message: err.message || 'Could not set key', - cause: err, - }) - ); - }); - }; - - remove = async (key: string) => { - await this.connect(); - await this._client.del(key); - }; -} - -class RedisStorageException extends Exception { - constructor(args: { message?: string; cause?: any }) { - super({ ...args, name: 'RedisStorageException' }); - } -} diff --git a/utils/network/index.ts b/utils/network/index.ts index 7a33da65f..fabe20a15 100644 --- a/utils/network/index.ts +++ b/utils/network/index.ts @@ -1,7 +1,6 @@ export type IDefaultRequestConfig = { url?: string; timeout?: number; - useCache?: boolean; params?: any; headers?: any; method?: 'POST' | 'GET' | 'PATCH'; diff --git a/utils/network/utils/format-log.ts b/utils/network/utils/format-log.ts index fd56d762d..d4d6b5341 100644 --- a/utils/network/utils/format-log.ts +++ b/utils/network/utils/format-log.ts @@ -1,9 +1,8 @@ export const formatLog = ( url: string, status: number, - isFromCached = false, time = -1, method: string ) => { - return `status=${status} time=${time} isFromCached=${isFromCached} request=${url} method=${method}`; + return `status=${status} time=${time} request=${url} method=${method}`; };