From 6c7494090b8ecfc3f17377f66cdbef6a78aaba43 Mon Sep 17 00:00:00 2001 From: "Yassine R." Date: Thu, 26 Oct 2023 10:47:44 +0200 Subject: [PATCH] fix: delete useless packages --- packages/backend/nodemon.json | 2 +- packages/backend/package.json | 4 +- ...1697659880952-import-passages-migration.ts | 5 +- ...697704071500-import-courriers-migration.ts | 4 +- .../_postgres/PG_CONNECT_OPTIONS.const.ts | 1 + .../custom-docs/buildCustomDoc.service.ts | 2 +- yarn.lock | 100 +++--------------- 7 files changed, 20 insertions(+), 98 deletions(-) diff --git a/packages/backend/nodemon.json b/packages/backend/nodemon.json index 6278cd0275..a8fdce52f0 100644 --- a/packages/backend/nodemon.json +++ b/packages/backend/nodemon.json @@ -2,5 +2,5 @@ "watch": ["src", ".env"], "ext": "ts", "ignore": ["src/**/*.spec.ts"], - "exec": "NODE_OPTIONS='--max-old-space-size=4096' ts-node -r tsconfig-paths/register src/run-app.ts | pino-pretty --singleLine" + "exec": "ts-node -r tsconfig-paths/register src/run-app.ts | pino-pretty --singleLine" } diff --git a/packages/backend/package.json b/packages/backend/package.json index fd448e7392..d6da78c4cc 100644 --- a/packages/backend/package.json +++ b/packages/backend/package.json @@ -23,7 +23,7 @@ "postbuild": "cp -r src/excel/_templates dist/excel && cp -r src/_static dist/", "prebuild": "rimraf dist", "start:check": "npx ts-node-dev -r tsconfig-paths/register src/run-app.ts | pino-pretty --singleLine", - "start:dev": "nodemon --max-old-space-size=4096", + "start:dev": "nodemon", "start:tests-local": "ENV_FILE=tests-local nodemon", "start": "ts-node -r tsconfig-paths/register src/run-app.ts | pino-pretty --singleLine", "test:cov": "jest --coverage", @@ -60,7 +60,6 @@ "@sentry/opentelemetry-node": "^7.72.0", "@socialgouv/streaming-file-encryption": "^1.1.0", "@types/source-map-support": "^0.5.4", - "@wmfs/xml2csv": "^1.32.0", "axios": "^1.4.0", "bcryptjs": "^2.4.3", "class-transformer": "0.5.1", @@ -104,7 +103,6 @@ "typeorm": "^0.3.17", "uuid": "^9.0.1", "xlsx": "^0.18.5", - "xml2csv": "^1.0.1", "yup": "^0.32.9", "yup-phone": "^1.3.2" }, diff --git a/packages/backend/src/_migrations/1697659880952-import-passages-migration.ts b/packages/backend/src/_migrations/1697659880952-import-passages-migration.ts index db17bd5449..2cef69a5f8 100644 --- a/packages/backend/src/_migrations/1697659880952-import-passages-migration.ts +++ b/packages/backend/src/_migrations/1697659880952-import-passages-migration.ts @@ -32,7 +32,7 @@ export class ManualMigration1697659880952 implements MigrationInterface { let cpt = 0; while ((await usagerRepository.countMigratedUsagers()) > 0) { - let usagerIdsToUpdate = []; + const usagerIdsToUpdate = []; const usagers = await usagerRepository.find({ where: { structureId: TOULOUSE_STRUCTURE_ID, migrated: false }, take: 500, @@ -75,7 +75,6 @@ export class ManualMigration1697659880952 implements MigrationInterface { { migrated: true } ); - usagerIdsToUpdate = []; console.log( `${cpt}/${total} dossiers sont les passages sont importés ${format( new Date(), @@ -84,7 +83,7 @@ export class ManualMigration1697659880952 implements MigrationInterface { ); await queryRunner.commitTransaction(); } - + await queryRunner.commitTransaction(); await queryRunner.release(); } diff --git a/packages/backend/src/_migrations/1697704071500-import-courriers-migration.ts b/packages/backend/src/_migrations/1697704071500-import-courriers-migration.ts index fe671f678e..03c0aca40d 100644 --- a/packages/backend/src/_migrations/1697704071500-import-courriers-migration.ts +++ b/packages/backend/src/_migrations/1697704071500-import-courriers-migration.ts @@ -69,7 +69,7 @@ export class ManualMigration1697704071500 implements MigrationInterface { take: 400, }); - let usagerIdsToUpdate = []; + const usagerIdsToUpdate = []; for (const usager of usagers) { cpt++; @@ -128,7 +128,6 @@ export class ManualMigration1697704071500 implements MigrationInterface { { migrated: true } ); - usagerIdsToUpdate = []; console.log( `${cpt}/${total} dossiers sont les courriers sont importés ${format( new Date(), @@ -137,6 +136,7 @@ export class ManualMigration1697704071500 implements MigrationInterface { ); await queryRunner.commitTransaction(); } + await queryRunner.commitTransaction(); await queryRunner.release(); } diff --git a/packages/backend/src/database/services/_postgres/PG_CONNECT_OPTIONS.const.ts b/packages/backend/src/database/services/_postgres/PG_CONNECT_OPTIONS.const.ts index 2c17fbdf35..ff98fe95ff 100644 --- a/packages/backend/src/database/services/_postgres/PG_CONNECT_OPTIONS.const.ts +++ b/packages/backend/src/database/services/_postgres/PG_CONNECT_OPTIONS.const.ts @@ -28,6 +28,7 @@ if (isTypescriptMode) { export const PG_CONNECT_OPTIONS: PostgresConnectionOptions = { applicationName: "domifa-api", + url: "", poolErrorHandler: (err: Error) => { appLogger.error("PG pool error:", { error: err, sentry: true }); }, diff --git a/packages/backend/src/usagers/services/custom-docs/buildCustomDoc.service.ts b/packages/backend/src/usagers/services/custom-docs/buildCustomDoc.service.ts index 04d1cd4e09..d7292715ec 100644 --- a/packages/backend/src/usagers/services/custom-docs/buildCustomDoc.service.ts +++ b/packages/backend/src/usagers/services/custom-docs/buildCustomDoc.service.ts @@ -280,7 +280,7 @@ export function buildCustomDoc({ } export const ucFirst = (value: string) => { - return value === undefined || value === null || value === "" + return !value || value === "" ? "" : value.charAt(0).toUpperCase() + value.slice(1); }; diff --git a/yarn.lock b/yarn.lock index e07aa5341f..ef0089ad77 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2315,7 +2315,6 @@ __metadata: "@types/uuid": ^9.0.4 "@typescript-eslint/eslint-plugin": ^6.0.0 "@typescript-eslint/parser": ^6.0.0 - "@wmfs/xml2csv": ^1.32.0 axios: ^1.4.0 bcryptjs: ^2.4.3 class-transformer: 0.5.1 @@ -2375,7 +2374,6 @@ __metadata: typescript: 4.9.5 uuid: ^9.0.1 xlsx: ^0.18.5 - xml2csv: ^1.0.1 yup: ^0.32.9 yup-phone: ^1.3.2 languageName: unknown @@ -7498,19 +7496,6 @@ __metadata: languageName: node linkType: hard -"@wmfs/xml2csv@npm:^1.32.0": - version: 1.32.0 - resolution: "@wmfs/xml2csv@npm:1.32.0" - dependencies: - debug: 4.3.4 - dottie: 2.0.6 - fs-extra: 11.1.1 - lodash: 4.17.21 - sax: 1.2.4 - checksum: 4e9055f149d0b546344c9bd05fc0a2380c0a72da17561f73b1a4cf5d9cf0c55f9513f716d0a4d891963f949167650cf7edb33d8e547e3f57f84ec6593f1d06ad - languageName: node - linkType: hard - "@xmldom/xmldom@npm:^0.8.6, @xmldom/xmldom@npm:^0.8.8": version: 0.8.9 resolution: "@xmldom/xmldom@npm:0.8.9" @@ -10465,15 +10450,6 @@ __metadata: languageName: node linkType: hard -"debug@npm:3.1.0": - version: 3.1.0 - resolution: "debug@npm:3.1.0" - dependencies: - ms: 2.0.0 - checksum: 0b52718ab957254a5b3ca07fc34543bc778f358620c206a08452251eb7fc193c3ea3505072acbf4350219c14e2d71ceb7bdaa0d3370aa630b50da790458d08b3 - languageName: node - linkType: hard - "debug@npm:4, debug@npm:4.3.4, debug@npm:^4.0.1, debug@npm:^4.1.0, debug@npm:^4.1.1, debug@npm:^4.3.1, debug@npm:^4.3.2, debug@npm:^4.3.3, debug@npm:^4.3.4": version: 4.3.4 resolution: "debug@npm:4.3.4" @@ -10978,20 +10954,6 @@ __metadata: languageName: node linkType: hard -"dottie@npm:2.0.0": - version: 2.0.0 - resolution: "dottie@npm:2.0.0" - checksum: c05ad2f4b63db537f43a291ba7d84d374a304ae26841497c4da5368ead5cf42d16419c06c2a71b6b1771c8f85180d32434c8e3da09610cec6e63173903d408f0 - languageName: node - linkType: hard - -"dottie@npm:2.0.6": - version: 2.0.6 - resolution: "dottie@npm:2.0.6" - checksum: 4c778df9dc631a1108a32ef390916836814999a7411d10883f4151bd49c9c6934dc329b3f50fc7692849aa75ba87dba880fd54be501a3b39a6b9c23d6f772a09 - languageName: node - linkType: hard - "duck@npm:^0.1.12": version: 0.1.12 resolution: "duck@npm:0.1.12" @@ -12817,17 +12779,6 @@ __metadata: languageName: node linkType: hard -"fs-extra@npm:11.1.1, fs-extra@npm:^11.0.0, fs-extra@npm:^11.1.0, fs-extra@npm:^11.1.1": - version: 11.1.1 - resolution: "fs-extra@npm:11.1.1" - dependencies: - graceful-fs: ^4.2.0 - jsonfile: ^6.0.1 - universalify: ^2.0.0 - checksum: fb883c68245b2d777fbc1f2082c9efb084eaa2bbf9fddaa366130d196c03608eebef7fb490541276429ee1ca99f317e2d73e96f5ca0999eefedf5a624ae1edfd - languageName: node - linkType: hard - "fs-extra@npm:9.1.0, fs-extra@npm:^9.1.0": version: 9.1.0 resolution: "fs-extra@npm:9.1.0" @@ -12851,6 +12802,17 @@ __metadata: languageName: node linkType: hard +"fs-extra@npm:^11.0.0, fs-extra@npm:^11.1.0, fs-extra@npm:^11.1.1": + version: 11.1.1 + resolution: "fs-extra@npm:11.1.1" + dependencies: + graceful-fs: ^4.2.0 + jsonfile: ^6.0.1 + universalify: ^2.0.0 + checksum: fb883c68245b2d777fbc1f2082c9efb084eaa2bbf9fddaa366130d196c03608eebef7fb490541276429ee1ca99f317e2d73e96f5ca0999eefedf5a624ae1edfd + languageName: node + linkType: hard + "fs-extra@npm:^8.1.0": version: 8.1.0 resolution: "fs-extra@npm:8.1.0" @@ -16440,13 +16402,6 @@ __metadata: languageName: node linkType: hard -"lodash@npm:4.17.5": - version: 4.17.5 - resolution: "lodash@npm:4.17.5" - checksum: 9ae12b708f68c54f2701daae072c5e3f648ed7cbe78b9308ce12209cd41053de9856d59df11464d8a3f35c3828a8d9add11051e3efc8bb75672271bb7c9da393 - languageName: node - linkType: hard - "log-symbols@npm:^4.0.0, log-symbols@npm:^4.1.0": version: 4.1.0 resolution: "log-symbols@npm:4.1.0" @@ -17020,13 +16975,6 @@ __metadata: languageName: node linkType: hard -"minimist@npm:0.0.8": - version: 0.0.8 - resolution: "minimist@npm:0.0.8" - checksum: 042f8b626b1fa44dffc23bac55771425ac4ee9d267b56f9064c07713e516e1799f3ba933bb628d2475a210caf7dcdb98161611baa1f0daf49309a944cb4bc48f - languageName: node - linkType: hard - "minimist@npm:^1.1.0, minimist@npm:^1.2.0, minimist@npm:^1.2.3, minimist@npm:^1.2.5, minimist@npm:^1.2.6, minimist@npm:^1.2.8": version: 1.2.8 resolution: "minimist@npm:1.2.8" @@ -17190,17 +17138,6 @@ __metadata: languageName: node linkType: hard -"mkdirp@npm:0.5.1": - version: 0.5.1 - resolution: "mkdirp@npm:0.5.1" - dependencies: - minimist: 0.0.8 - bin: - mkdirp: bin/cmd.js - checksum: ed1ab49bb1d06c88dba7cfe930a3186f2605b5465aab7c8f24119baaba6e38f9ab4ac1695c68f476c65a48df2a69a8495049cd6e26c360ea082151a0771343d2 - languageName: node - linkType: hard - "mkdirp@npm:>=0.5 0, mkdirp@npm:^0.5.1, mkdirp@npm:^0.5.4": version: 0.5.6 resolution: "mkdirp@npm:0.5.6" @@ -20979,7 +20916,7 @@ __metadata: languageName: node linkType: hard -"sax@npm:1.2.4, sax@npm:^1.2.4": +"sax@npm:^1.2.4": version: 1.2.4 resolution: "sax@npm:1.2.4" checksum: d3df7d32b897a2c2f28e941f732c71ba90e27c24f62ee918bd4d9a8cfb3553f2f81e5493c7f0be94a11c1911b643a9108f231dd6f60df3fa9586b5d2e3e9e1fe @@ -24341,19 +24278,6 @@ __metadata: languageName: node linkType: hard -"xml2csv@npm:^1.0.1": - version: 1.0.1 - resolution: "xml2csv@npm:1.0.1" - dependencies: - debug: 3.1.0 - dottie: 2.0.0 - lodash: 4.17.5 - mkdirp: 0.5.1 - sax: 1.2.4 - checksum: 59e833fdce6aaba04a50d97c80cf50d071c11bbff5c42e5e22cb6e7a594eb1eed493fdc00e53a3ff76f1472d6d6373f990d702f6ded13cb50f45e525db5c751e - languageName: node - linkType: hard - "xmlbuilder@npm:^10.0.0": version: 10.1.1 resolution: "xmlbuilder@npm:10.1.1"