-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Console v0.3.1 #1367
base: master
Are you sure you want to change the base?
Console v0.3.1 #1367
Conversation
* HLM service request, updated DataTypeEnum (#872) * Service request changelog 1.5 (#875) * Added changelog and upgraded the versions for household, individual and service request * Update core-services/service-request/CHANGELOG.md Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update health-services/individual/CHANGELOG.md Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * HLM fixed merge issues * HLM fixed merge issues * HCMPRE-413: updated the changelog as per code review comments * Update health-services/project/CHANGELOG.md Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --------- Co-authored-by: kavi_elrey@1993 <25226238+kavi-egov@users.noreply.github.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * HCMPRE-424: fixed hrms call from pgr-service * HCMPRE-424: updated as per code review comments * Create branch-name-validator (#960) * Create branch-name-validator * Update branch-name-validator * Update .github/workflows/branch-name-validator Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update .github/workflows/branch-name-validator Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update branch-name-validator * Rename branch-name-validator to branch-name-validator.yml * Added census-service in build-config (#990) * [HCMPRE-658] Refractor resource-estimation-service to resource-generator (#910) Co-authored-by: Priyanka-eGov <74049060+Priyanka-eGov@users.noreply.github.com> * Update package.json * Update tsconfig.json * Added configs and env dependencies * dockerfile update * Update tsconfig.json * Update tsconfig.json * refactored * HCM Admin Console v0.3 Release code changes (#1082) * kafka fix for large messages * Update genericUtils.ts * Update campaignValidators.ts * Fixed the mdms search path keys * fix of migration script * fix on repeated key * Update campaignApis.ts * Update campaignApis.ts * Update campaignUtils.ts * Update campaignUtils.ts * Update campaignUtils.ts * Fix project target mapping * refactored migration files fro project-factory (#867) * refactored migration files fro project-factory * updated logic for unique username generation * updated format and id name for user name * removed hash logic for username generation * added indexing on columns * updated idgen seq format for user name in index.ts * Update health-services/project-factory/src/server/api/campaignApis.ts Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * updated logic for regenerate if campaign type differs (#876) * id generation throw error update * Enhance generate template for user and facility in update ongoing campaign flow (#885) * commit for update-generate-template * updated campaign flow generate template enhancement * just if else changes * some reformatting * update index.ts * added additional valiadtion for parent campaign * updated logic for validating parent campaign * refcatored as per change requests * update index.ts * updated logic for same campaignnumber when paren is present * updated the campaign name logic along with handling isfailed status too (#888) * updating campaign name same as parent name and number too * updated target template for updating ongoing campaign (#893) * Microplan bulk user creation (#890) * Feat : initialised bulk user creation for microplan * Enhanced user bulk upload for microplan * Fixed configs * Merge fix with console * Feat : added columns in user sheet * Added userroles sheet for bulk user template in microplan * Added source microplan while resource creation * changed logic for isSourceMicroplan * Update campaignApis.ts * Update campaignValidators.ts * changes for campaign update flow * Update campaignUtils.ts * Integrated required error messages * added numeric check in microplan phone number * Implemented no data validation * added logic for creating projects , project facility and project staff on newly added boundaries (#917) * updated target template for updating ongoing campaign * update flow campaign mapping * updated flow campaign mapping * added logic for project, project facility and project staff creation on newly added boundaries * removed one useless func * removed await from a func * removed console.logs * added some minor enhancemnets * added one edge case scenario * changed request limit to 1 mb * Feat : added locksheet filter for user microplan creation * updated logic for regenerate if campaign type differs (#876) * Enhancement for microplan user creation (#940) * some modifications for edge cases (#930) * added commit for testing update campaign flow * some chenages related to type boundary in data create api * /* MODIFIED FOR LTS UPGRADE */ * Microplan user enhancement * Some changes regarding microplan user and boundary * added some null checks * /* Temporay fix for project creation of LLIN since the structure of delivery rules is getting changed */ * Revert "/* MODIFIED FOR LTS UPGRADE */" This reverts commit 52ed772. * added code to add lat long in the project-factory apis * Changed code based on comments * removed default campaignid * added code to add lat long in the project-factory apis (#951) * added code to add lat long in the project-factory apis * Changed code based on comments * removed default campaignid * Fixed code to manage create * fixed the build * added for field protection on sheet data * Facility microplan validation (#975) * Microplan facility validation * Enhancement in microplan validations * Microplan sheet lock * Enhanced for multiple sheetErrors in additionalDetails * Update campaignApis.ts * fixes for filestore and unfreezing boundary code mandatory columns (#984) * Update CODEOWNERS * Update campaignValidators.ts (#987) * some correction of error after changes from microplan code merge (#988) * some correction of error after changes from microplan code merge * added question mark * added localization fix (#993) Co-authored-by: ansh-egov <ansh.goyal@egovernments.org> * Update campaignApis.ts (#994) * Added some fixes for the project transformation * Update projectTypeUtils.ts * Update campaignUtils.ts * Removed date Update projectTypeUtils.ts #1006 * HCEMPRE-809-Boundary-geometry-codes (#1011) * added localization fix * added logic for boundaryGeometryManagement * fixed some things * fixed campaign search * update project facility and staff mappings of exisitng facilities and users (#998) * some correction of error after changes from microplan code merge * added logic for updating mapping of existing facilitie and users * resolved comments by jagan on the pr for delinking and linking project resources * fetchProjectsWithBoundaryCodeAndName fucntion update * Update campaignValidators.ts --------- Co-authored-by: Jagankumar <53823168+jagankumar-egov@users.noreply.github.com> * added code to add lat long in the project-factory apis (#1019) * Project staff mapping correction from uuid to userserviceuuid (#1022) * some correction of error after changes from microplan code merge * corrected for mapping of project staff * added changes for project-resource mapping (#1028) * added changes for project-resource mapping * changed the variable name to boundaryProjectMappingForProjectResourceCreation from newBoundaryProjectMapping * renamed the entity --------- Co-authored-by: Jagankumar <53823168+jagankumar-egov@users.noreply.github.com> * Added logic to retry in project campaign create (#1031) * not needed to update every resource in update flow (#1036) * not needed to update every resource in update flow * added changes for if boundaries present in update flow all resources are mandate * Some checks enhancement (#1042) * Update genericApis.ts (#1043) * Update campaignValidators.ts (#1046) * consolidate resources array in update campaign flow (#1051) * consolidate resources array in update campaign flow * spelling correct * Search criteria object corrected (#1052) * consolidate resources array in update campaign flow * data search criteria id has to be an array of strings * spelling * some more corrections regarding search criteria body * Boundaries consolidate after creating child campaign (#1056) * consolidate resources array in update campaign flow * boundaries consolidate after creating child campaign * Boundaries correction (#1058) * consolidate resources array in update campaign flow * boundaries consolidate after creating child campaign * changes in extracing boundaries from campaign object * Missing resources in chid campaign to be added from parent camaig logic refactored (#1059) * consolidate resources array in update campaign flow * boundaries consolidate after creating child campaign * refactored logic for adding missing resources from parent campaign * Correction datatocreate column from status to userservice uuids (#1061) * consolidate resources array in update campaign flow * boundaries consolidate after creating child campaign * changed data to create column from user sheet * Hide Boundary and Target Old Columns (#1062) * consolidate resources array in update campaign flow * boundaries consolidate after creating child campaign * hide boundary code old and target old * Corrected target update flow (#1065) * consolidate resources array in update campaign flow * boundaries consolidate after creating child campaign * corrected target mapping in update flow * Total count of Campaigns if only is active true (#1066) * consolidate resources array in update campaign flow * boundaries consolidate after creating child campaign * count will be only of active campaigns * HCMPRE-1212:: migrated to point only to MMDS v2 api * Update index.ts * User/facility inactive (#1070) * consolidate resources array in update campaign flow * boundaries consolidate after creating child campaign * added logic for making exiting user facility inactive --------- Co-authored-by: Jagankumar <53823168+jagankumar-egov@users.noreply.github.com> * Refactor facility mappings (#1072) * consolidate resources array in update campaign flow * boundaries consolidate after creating child campaign * refactored facility mappings * Created enity for boundary * updated the boundary relationship function * Update index.ts * fixed some localization issue (#1075) * fixed some localization issue * fixed * Target update while campaign update flow (#1078) * consolidate resources array in update campaign flow * boundaries consolidate after creating child campaign * logic for updating targets * some refactor for adding logs and index.ts * updated the boundary localisation name --------- Co-authored-by: Jagankumar <53823168+jagankumar-egov@users.noreply.github.com> * fixed some localization issue (#1079) * fixed some localization issue * fixed * fixed a issue * reverted failed campaign is active true from false (#1080) * reverted failed campaign is active true from false * took constants from index * refactor * Merge branch 'project-factory-kafka-fix' into console * Changed hierarchyFectch to v2 (#1077) * Changed hierarchyFectch to v2 * Changed messages * Merge branch 'project-factory-kafka-fix' into hierarchyFetchV2 --------- Co-authored-by: Jagankumar <53823168+jagankumar-egov@users.noreply.github.com> * calll generate when create completes for type boundary management * auto generate resource if there is no previous generated history * Fixed crashloop issue (#1084) * Fixed crashloop issue * Update dataManageService.ts --------- Co-authored-by: Jagankumar <53823168+jagankumar-egov@users.noreply.github.com> * changed the master from hierarchyConfig to HierarchySchema (#1086) * getting boundaries split on logic change (#1088) * fixed some localization issue (#1090) * fixed some localization issue * fixed * fixed a issue * integrated microplan with console * fixxed index * fixed crashloop (#1091) * added validation for boundary bulk upload (#1092) Co-authored-by: Jagankumar <53823168+jagankumar-egov@users.noreply.github.com> * refcatored diffferent tab separation (#1093) * added timeout (#1095) * Microplan integration :: set start date to tommorow (#1096) * set start date to tommorow * updated end date * Enhance PlanFacility object (#1099) * validation for update template in create flow (#1100) * removed await (#1103) * some correction (#1104) * logic for updating targets only when present in resources array in update flow (#1105) * updated (#1106) * updated * added fix for the redis error in logs --------- Co-authored-by: Jagankumar <53823168+jagankumar-egov@users.noreply.github.com> * added error responder (#1107) * refactored download api (#1108) * Cache issue fix(#1109) * refactored download api * refactor --------- Co-authored-by: Jagankumar <53823168+jagankumar-egov@users.noreply.github.com> * made disable of cache always during boundary generate (#1110) Co-authored-by: Jagankumar <53823168+jagankumar-egov@users.noreply.github.com> * Redis cache key deleted (#1113) * removed await * delete cache from boundary relationship search * updated redis delete func * Revert "removed await" This reverts commit a5acb54. * Update redisUtils.ts --------- Co-authored-by: Jagankumar <53823168+jagankumar-egov@users.noreply.github.com> * updated redis delete func (#1114) * removed cache from boundary relation create (#1115) * corrected params of auto generate after download api (#1116) * refactored consolidate (#1119) * fix on the fetch from microplan Update campaignUtils.ts (#1120) * Update microplanUtils.ts (#1123) * addded localization function (#1125) * Update SearchCriteria.ts * made createandtransfrom localization as await to upsert all localization in boundary management create flow (#1127) * added logs in handledropdownthings (#1128) * Fixed district missing issue (#1129) * Facility Village List For microplan and dropdown fix (#1130) * Facility Village List For microplan and dropdown fix * Optional chaining * Reverted recievedDropdown Changes * removed localization caceh in boundary generate flow for hierarchy module (#1133) * planFacility create Fix (#1132) * fixed the localisation cache on multiple data creates in boundary * Revert "fixed the localisation cache on multiple data creates in boundary" This reverts commit 94eb970. * Facility fix generation for microplan (#1134) * planFacility create Fix * Fixed Facility Generation for microplan * added the count info of the localisation upsert (#1144) Co-authored-by: Jagankumar <53823168+jagankumar-egov@users.noreply.github.com> * Microplan integrated with console for facility , user & target (#1151) * set start date to tommorow * updated end date * added code for target sheet * fixed * added mdms call * microplan integration changes added for target ,facility & user * undo changes * Update microplanIntergration.ts * saving all the progress on the integration * project facility mapping done * Update microplanIntergration.ts * Update microplanIntergration.ts * Update microplanIntergration.ts * target & facility integration completed statically * completed facility & target file created based on microplan * added static for user * Added user related changes * added the user integartion * added target and facility in resources array of campaign from microplan * added user in resources array in campaign object * Update microplanIntergration.ts * revert the others * Update index.ts * Cleaned up code --------- Co-authored-by: ansh-egov <ansh.goyal@egovernments.org> Co-authored-by: Jagankumar <53823168+jagankumar-egov@users.noreply.github.com> Co-authored-by: nitish-egov <nitish@egovernments.org> * added missing default tenantid (#1152) * Boundary locale fix (#1153) * planFacility create Fix * Fixed boundary validation for different locales --------- Co-authored-by: Jagankumar <53823168+jagankumar-egov@users.noreply.github.com> * removed duplicate key (#1154) * Logs for reordering added (#1161) * added missing default tenantid * added logs for reordering before project creation * Update index.ts --------- Co-authored-by: Jagankumar <53823168+jagankumar-egov@users.noreply.github.com> * Readme for microplans (#1160) * Readme for microplans * Fixed boolean type * Optimized isMicroplanRequest * Optimizing roles for microplan (#1164) * Improved some performance with huge campaign object (#1165) * Trying optimised code by chatgpt * added 4mb limit * Update app.ts * Updted the comments * Changes for pollutils and reorder * Update pollUtils.ts --------- Co-authored-by: Jagankumar <53823168+jagankumar-egov@users.noreply.github.com> Co-authored-by: ashish-egov <ashish.tiwari@egovernments.org> * Added fixes for error during processing (#1172) * added missing default tenantid * added try catch * Update index.ts --------- Co-authored-by: Jagankumar <53823168+jagankumar-egov@users.noreply.github.com> * fixed the hard codings in the code (#1170) * fixed the hard codings in the code * fixed * Added filter check for the fetch from microplan if it has already some resources * fixed hardcoding in target flow (#1175) * fixed hardcoding in target flow * fixed * fixed * Update campaignApis.ts (#1177) * Update campaignApis.ts * Update campaignApis.ts * Update campaignApis.ts * Update genericUtils.ts (#1178) * changed the campaig key to activity (#1180) * added missing default tenantid * Update campaignUtils.ts * Update index.ts --------- Co-authored-by: Jagankumar <53823168+jagankumar-egov@users.noreply.github.com> * handled failed generations in downlaod api (#1185) * Change for roles name change (#1187) * added search before update in fetch all datas (#1190) * added seacrh before update in fetch all datas * Change for roles name change (#1187) --------- Co-authored-by: ashish-egov <137176738+ashish-egov@users.noreply.github.com> Co-authored-by: Jagankumar <53823168+jagankumar-egov@users.noreply.github.com> * formatted and made promise all to do a promise all to make calls parallely * filtered the plan facility response to have only facility which has only service boundarires * added hierarchy filteration from mdms (#1188) * added hierarchy filteration from mdms * did some hardcoding * fixed fetching of headers * added some logs * added extra loggers for fetch from microplan activities (#1193) * added extra loggers for fetch from microplan activities * Update microplanIntergration.ts --------- Co-authored-by: Jagankumar <53823168+jagankumar-egov@users.noreply.github.com> * added retry in localization upsert (#1194) * Adding the additonal loggers to know more informs on microplan integration * Update health-services/project-factory/src/server/validators/campaignValidators.ts Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update health-services/project-factory/src/server/validators/campaignValidators.ts Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update health-services/project-factory/src/server/controllers/campaignManage/campaignManage.controller.ts Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * fixed integration (#1197) * Global handler (#1199) * Change for roles name change * Global exception handler integrated * String logger * Update app.ts * added heap memory log & created a env variable for incomingRequestPay… …loadLimit (#1201) * added heap memory log & created a env variable for incomingRequestPayloadLimit * Update index.ts --------- Co-authored-by: Jagankumar <53823168+jagankumar-egov@users.noreply.github.com> * Set memory limit and added log off avaiable, max limits (#1202) * added logs to check current value * Update app.ts * Update Dockerfile * Update Dockerfile * Update app.ts --------- Co-authored-by: Jagankumar <53823168+jagankumar-egov@users.noreply.github.com> * Handle for google sheet formulas (#1207) * Update microplanValidators.ts (#1213) * Update microplanValidators.ts * Update microplanValidators.ts * Update microplanValidators.ts * Localised roles (#1217) * added change log for admin console version 0.3 (#1224) * Pvar validation (#1225) * product variant validation added * Optimized validations * Refactored * Logger error fix * Refactor * Refactor * refactored project reosurce mapping logic (#1204) * refactored project reosurce mapping logic * added new function ot search project after campaign creation time * added reference id params in project search * added logic for adding resources only for newly created projects * refactored and code clean up for project resource mapppings in update and create flow * refactor getProjectMappingBody func * some condition check * correction * removed project departments * microplan save topic changes (#1231) * Update microplanUtils.ts * Update index.ts * Update campaignApis.ts (#1232) * Update campaignApis.ts * Update campaignApis.ts * Update campaignApis.ts * Update campaignValidators.ts * Revert boundaryProject Mapping * Cleaned up data configs (#1234) * Update index.ts * Update campaignUtils.ts * Update health-services/project-factory/src/server/utils/onGoingCampaignUpdateUtils.ts Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update app.ts * Update health-services/project-factory/src/server/utils/microplanUtils.ts Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * added changes for performance testing (#1236) * added changes for performance testing * microplan save topic changes (#1231) * Update microplanUtils.ts * Update index.ts * Update campaignApis.ts (#1232) * Update campaignApis.ts * Update campaignApis.ts * Update campaignApis.ts * Update campaignValidators.ts * Revert boundaryProject Mapping * Cleaned up data configs (#1234) * Update index.ts * Update campaignUtils.ts * try catch handling * Update health-services/project-factory/src/server/service/dataManageService.ts Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --------- Co-authored-by: ashish-egov <137176738+ashish-egov@users.noreply.github.com> Co-authored-by: ansh-egov <137172017+ansh-egov@users.noreply.github.com> Co-authored-by: Jagankumar <53823168+jagankumar-egov@users.noreply.github.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update health-services/project-factory/src/server/utils/onGoingCampaignUpdateUtils.ts Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update app.ts * Update health-services/project-factory/src/server/utils/microplanUtils.ts Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update campaignValidators.ts (#1244) * Update campaignValidators.ts * Update campaignValidators.ts * add * added new config values * Other configs (#1250) * add * added new config values * Update request.ts --------- Co-authored-by: Jagankumar <53823168+jagankumar-egov@users.noreply.github.com> * Updating debug function for error handeling (#1243) * Apply suggestions from code review Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update health-services/project-factory/src/server/service/dataManageService.ts Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update dataManageService.ts * Applied code rabbit changes * refactored sheet consolidate logic (#1254) * refactored sheet consolidate logic * Applied code rabbit changes --------- Co-authored-by: Jagankumar <53823168+jagankumar-egov@users.noreply.github.com> * refactor sheet consolidate for target (#1255) * Update package.json * Update health-services/project-factory/src/server/utils/onGoingCampaignUpdateUtils.ts Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * removed other ui workflows * Update publishProjectFactory.yml * Update publishProjectFactory.yml * Update publishProjectFactory.yml * Update publishProjectFactory.yml * Update publishProjectFactory.yml * Update publishProjectFactory.yml * consolidate sheet handle logic change (#1256) * Apply suggestions from code review Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --------- Co-authored-by: ashish-egov <ashish.tiwari@egovernments.org> Co-authored-by: ashish-egov <137176738+ashish-egov@users.noreply.github.com> Co-authored-by: nitish-egov <137176807+nitish-egov@users.noreply.github.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: nitish-egov <nitish@egovernments.org> Co-authored-by: ansh-egov <ansh.goyal@egovernments.org> Co-authored-by: ansh-egov <137172017+ansh-egov@users.noreply.github.com> Co-authored-by: ejagankumar <31833516+ejagankumar@users.noreply.github.com> * Changed docker file * package changes * dockerfile revert * changed package json * Update package.json * reverted other folders * reverted * Update settings.json --------- Co-authored-by: kanishq-egov <138671649+kanishq-egov@users.noreply.github.com> Co-authored-by: kavi_elrey@1993 <25226238+kavi-egov@users.noreply.github.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: kanishq-egov <kanishq.bhatnagar@egovernments.org> Co-authored-by: Sathish P <sathish.p@egovernments.org> Co-authored-by: tanishi-egov <tanishi.goyal@egovernments.org> Co-authored-by: Palak Garg <86659286+palak-egov@users.noreply.github.com> Co-authored-by: Priyanka-eGov <74049060+Priyanka-eGov@users.noreply.github.com> Co-authored-by: Jagankumar <53823168+jagankumar-egov@users.noreply.github.com> Co-authored-by: nitish-egov <137176807+nitish-egov@users.noreply.github.com> Co-authored-by: nitish-egov <nitish@egovernments.org> Co-authored-by: ansh-egov <ansh.goyal@egovernments.org> Co-authored-by: ansh-egov <137172017+ansh-egov@users.noreply.github.com> Co-authored-by: ejagankumar <31833516+ejagankumar@users.noreply.github.com>
* some boundary bulk and microplan user changes * Some refactoring
* localisation-cache-fix * Refactor * Refactor * logger added
* some boundary bulk and microplan user changes * Some refactoring * Fix for target * Facility fix * User Fix * Target valiodation for microplan
* Fix for boundary validation * Optional Chaning
* added gzip handler in middleware * added gzip handler specific to request middleware * refactored gzip handler
* enhanced target validation * Reverted index config * refactor target generate and validate for generic type * Target enrichment * Fix for null codesTargetMapping * MDMS integration for targetConfigs * enhanced target validation * Target enrichment * Fix for null codesTargetMapping * MDMS integration for targetConfigs * target fix --------- Co-authored-by: ashish-egov <ashish.tiwari@egovernments.org>
* Allow facility capacity to be 0 in sheet uploads for microplan * changed facility capacity validation message
#1310) * Optimized latitude and longitude validation logic for improved efficiency * facility capacity assignment to 0 for microplan * Facility capacity enrichment for microplan
* Implemented locale and campaign check * Optimised validation for metadata * Update health-services/project-factory/src/server/config/index.ts Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Validate metadata only during action validate --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
* added config * removed hardcoded retry limit
#1343) * feat: Implement facility list with inactive by default and toggle active/inactive from constant configs * Status lock fix * Updated flow status fix
* refactored dropdown * updated dropdown logic * refactored dropdown logic * refactor * added dropdown related changes * refactor * refactor
WalkthroughThis pull request introduces comprehensive changes across multiple files in the health-services/project-factory project, focusing on enhancing configuration, validation, and utility functions. The modifications span various aspects of the application, including debugging capabilities, localization, resource creation, and validation logic. Key changes include adding new configuration options, refactoring existing functions, improving error handling, and introducing more flexible validation mechanisms. Changes
Sequence DiagramsequenceDiagram
participant Client
participant Server
participant ConfigManager
participant ResourceCreator
participant Validator
Client->>Server: Send Request
Server->>ConfigManager: Load Configuration
ConfigManager-->>Server: Return Configuration
Server->>Validator: Validate Request
Validator-->>Server: Validation Result
alt Validation Successful
Server->>ResourceCreator: Process Resource
ResourceCreator-->>Server: Resource Created
Server->>Client: Success Response
else Validation Failed
Server->>Client: Error Response
end
Possibly related PRs
Suggested reviewers
Poem
✨ Finishing Touches
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Caution
Inline review comments failed to post. This is likely due to GitHub's limits when posting large numbers of comments.
Actionable comments posted: 42
🔭 Outside diff range comments (12)
health-services/project-factory/src/server/config/models/createRequestSchema.ts (1)
Line range hint
1-42
: Consider adding schema version and deprecation informationSince this schema is evolving with breaking changes, it would be helpful to:
- Add a version field to track schema changes
- Document the removed types in a "deprecated" section
export const createRequestSchema = { "$schema": "http://json-schema.org/draft-07/schema#", + "$version": "0.3.1", + "title": "Create Request Schema", + "description": "Schema for validating project factory create requests", "type": "object",health-services/project-factory/src/server/utils/onGoingCampaignUpdateUtils.ts (3)
Line range hint
451-452
: Extract HTTP request configuration to constants.The HTTP request URLs and paths are concatenated inline, which makes maintenance difficult and error-prone.
Consider extracting these into constants:
+const API_ENDPOINTS = { + PROJECT_FACILITY: { + DELETE: `${config.host.projectHost}${config.paths.projectFacilityDelete}`, + SEARCH: `${config.host.projectHost}${config.paths.projectFacilitySearch}` + }, + PROJECT_STAFF: { + DELETE: `${config.host.projectHost}${config.paths.projectStaffDelete}`, + SEARCH: `${config.host.projectHost}${config.paths.projectStaffSearch}` + } +} as const; -await httpRequest(config?.host?.projectHost + config?.paths?.projectFacilityDelete, projectFacilityDeleteBody); +await httpRequest(API_ENDPOINTS.PROJECT_FACILITY.DELETE, projectFacilityDeleteBody);Also applies to: 453-454, 455-456
Line range hint
592-614
: Add retry mechanism for file operations.The file operations could fail due to network issues or temporary service unavailability.
Consider implementing a retry mechanism:
async function getFileUrlWithRetry(fileStoreId: string, tenantId: string, maxRetries = 3): Promise<string> { for (let attempt = 1; attempt <= maxRetries; attempt++) { try { const fileResponse = await httpRequest( `${config.host.filestore}${config.paths.filestore}/url`, {}, { tenantId, fileStoreIds: fileStoreId }, "get" ); if (!fileResponse?.fileStoreIds?.[0]?.url) { throw new Error("Invalid file response"); } return fileResponse.fileStoreIds[0].url; } catch (error) { if (attempt === maxRetries) { throwError("FILE", 400, "INVALID_FILE"); } // Exponential backoff await new Promise(resolve => setTimeout(resolve, Math.pow(2, attempt) * 1000)); } } throwError("FILE", 400, "INVALID_FILE"); }
Line range hint
519-557
: Implement batch processing for large datasets.The
processResources
function processes resources sequentially, which could be inefficient for large datasets.Consider implementing batch processing:
async function processResourcesBatch( mappingObject: any, resources: any[], batchSize = 5 ): Promise<void> { const resourcesArrayFromParentCampaign = mappingObject?.parentCampaign?.resources; // Process resources in batches for (let i = 0; i < resources.length; i += batchSize) { const batch = resources.slice(i, i + batchSize); await Promise.all( batch.map(resource => processIndividualResource(mappingObject, resource, resourcesArrayFromParentCampaign) .catch(error => { logger.error(`Failed to process resource: ${resource.type}`, error); return null; }) ) ); } mergeParentResources(mappingObject, resources, resourcesArrayFromParentCampaign); }health-services/project-factory/src/server/utils/genericUtils.ts (3)
Line range hint
1251-1298
: Bulk creation logic.
- Watch usage of
var
on lines 1262–1263. Switch toconst
orlet
to avoid hoisting.- Insert concurrency controls or progress feedback if chunk creation is time-consuming.
- var activities: any[] = []; + const activities: any[] = [];
Line range hint
1300-1345
: Single facility creation.
Consider combining repeated error logic with the bulk approach. Also, watch for partial creation states if some lines fail.🧰 Tools
🪛 Biome (1.9.4)
[error] 1319-1319: This let declares a variable that is only assigned once.
'd' is never reassigned.
Safe fix: Use const instead.
(lint/style/useConst)
Line range hint
1582-1582
: Post-campaign search logic.
Consider caching the campaign object from earlier calls if multiple lookups happen frequently.health-services/project-factory/src/server/utils/microplanIntergration.ts (1)
Line range hint
512-512
: Replacevar
withlet
.Using
var
is not recommended as it's function-scoped and can lead to hoisting issues. Uselet
for block-scoped variables.- var retry: any = config?.retryUntilResourceCreationComplete; + let retry: any = config?.retryUntilResourceCreationComplete;health-services/project-factory/src/server/api/genericApis.ts (2)
Line range hint
434-474
: Enhance error handling in createAndUploadFile.Consider the following improvements:
- Use constants for retry configuration
- Include specific error details in the final error message
+const FILE_UPLOAD_MAX_RETRIES = 3; +const FILE_UPLOAD_RETRY_DELAY = 5000; async function createAndUploadFile( updatedWorkbook: any, request: any, tenantId?: any ) { - let retries: any = 3; + let retries = FILE_UPLOAD_MAX_RETRIES; // Enrich metadatas enrichTemplateMetaData(updatedWorkbook, request); while (retries--) { try { // ... existing code ... } catch (error: any) { console.error(`Attempt failed:`, error.message); - await new Promise((resolve) => setTimeout(resolve, 5000)); + await new Promise((resolve) => setTimeout(resolve, FILE_UPLOAD_RETRY_DELAY)); } } - throw new Error("Error while uploading excel file: INTERNAL_SERVER_ERROR"); + throw new Error(`Failed to upload excel file after ${FILE_UPLOAD_MAX_RETRIES} attempts: INTERNAL_SERVER_ERROR`); }
Line range hint
434-474
: Add file type validation for secure file uploads.The file upload functionality should validate:
- File type/extension
- File size limits
- Content type headers
async function createAndUploadFile( updatedWorkbook: any, request: any, tenantId?: any ) { + const MAX_FILE_SIZE = 5 * 1024 * 1024; // 5MB + const ALLOWED_MIME_TYPES = ['application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']; + let retries: any = 3; // Enrich metadatas enrichTemplateMetaData(updatedWorkbook, request); while (retries--) { try { // Write the updated workbook to a buffer const buffer = await updatedWorkbook.xlsx.writeBuffer(); + + // Validate file size + if (buffer.length > MAX_FILE_SIZE) { + throw new Error('File size exceeds maximum limit'); + } + + // Validate file type + const fileType = await import('file-type'); + const type = await fileType.fileTypeFromBuffer(buffer); + if (!type || !ALLOWED_MIME_TYPES.includes(type.mime)) { + throw new Error('Invalid file type'); + } // Create form data for file upload const formData = new FormData(); formData.append("file", buffer, "filename.xlsx");health-services/project-factory/src/server/utils/campaignMappingUtils.ts (2)
Line range hint
512-533
: Consider adding a maximum wait time for resource completion.The current implementation might wait indefinitely if
retry
is set to a very high value. Consider adding a maximum total wait time or implementing an exponential backoff strategy.+ const maxWaitTimeMs = 600000; // 10 minutes + const startTime = Date.now(); let retry: any = config?.retryUntilResourceCreationComplete; while (retry--) { + if (Date.now() - startTime > maxWaitTimeMs) { + logger.error(`Maximum wait time exceeded for resource ${resourceDetailId}`); + break; + } const response = await searchResourceDetailsById(resourceDetailId, messageObject);🧰 Tools
🪛 Biome (1.9.4)
[error] 509-509: Use let or const instead of var.
A variable declared with var is accessible in the whole body of the function. Thus, the variable can be accessed before its initialization and outside the block where it is declared.
See MDN web docs for more details.
Unsafe fix: Use 'const' instead.(lint/style/noVar)
[error] 510-510: Use let or const instead of var.
A variable declared with var is accessible in the whole body of the function. Thus, the variable can be accessed before its initialization and outside the block where it is declared.
See MDN web docs for more details.
Unsafe fix: Use 'const' instead.(lint/style/noVar)
[error] 512-512: Use let or const instead of var.
A variable declared with var is accessible in the whole body of the function. Thus, the variable can be accessed before its initialization and outside the block where it is declared.
See MDN web docs for more details.
Unsafe fix: Use 'let' instead.(lint/style/noVar)
Line range hint
595-672
: Consider implementing retry mechanism for batch processing.The
processResourceOrFacilityOrUserMappingsInBatches
function could benefit from a retry mechanism for failed batch operations, especially since it's handling critical resource mappings.async function processResourceOrFacilityOrUserMappingsInBatches(type: string, mappingArray: any, batchSize: number) { logger.info("Processing resource mappings in batches..."); let promises: Promise<void>[] = []; let totalCreated = 0; let batchCount = 0; + const maxRetries = 3; + // ... existing code ... if (promises.length >= batchSize) { batchCount++; logger.info(`Processing batch ${batchCount} with ${promises.length} promises.`); + let retryCount = 0; + while (retryCount < maxRetries) { try { await Promise.all(promises); + break; } catch (error) { logger.error(`Batch ${batchCount} failed:`, error); + retryCount++; + if (retryCount === maxRetries) { throw error; + } + logger.info(`Retrying batch ${batchCount}, attempt ${retryCount + 1}`); + await new Promise(resolve => setTimeout(resolve, 1000 * retryCount)); } + } promises = []; }
🛑 Comments failed to post (42)
health-services/project-factory/Dockerfile (1)
34-34: 🧹 Nitpick (assertive)
Remove redundant comment.
This comment is redundant as it's stating what's already implemented in the actual CMD instruction above it.
-# Replaced by CMD ["yarn", "prod"]
health-services/project-factory/package.json (2)
13-13:
⚠️ Potential issueSecurity: Restrict debug port binding
The debug port is currently bound to all network interfaces (0.0.0.0), which could expose the debugger in production environments. Consider binding to localhost instead for security.
- "serve": "if [ \"$DEBUG\" = \"true\" ]; then node --inspect=0.0.0.0:9229 dist/index.js; else node dist/index.js; fi", + "serve": "if [ \"$DEBUG\" = \"true\" ]; then node --inspect=127.0.0.1:9229 dist/index.js; else node dist/index.js; fi",📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements."serve": "if [ \"$DEBUG\" = \"true\" ]; then node --inspect=127.0.0.1:9229 dist/index.js; else node dist/index.js; fi",
17-17: 🛠️ Refactor suggestion
Avoid modifying tsconfig.json during build
Modifying tsconfig.json during the build process could lead to race conditions in concurrent builds and makes the build non-deterministic. Consider using the
--project
flag instead.- "prod": "if [ \"$DEBUG\" = \"true\" ]; then cp tsconfig.debug.json tsconfig.json; fi && yarn build && yarn serve", + "prod": "yarn build --project $([ \"$DEBUG\" = \"true\" ] && echo \"tsconfig.debug.json\" || echo \"tsconfig.json\") && yarn serve",📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements."prod": "yarn build --project $([ \"$DEBUG\" = \"true\" ] && echo \"tsconfig.debug.json\" || echo \"tsconfig.json\") && yarn serve",
health-services/project-factory/src/server/config/createAndSearch.ts (1)
100-102: 🧹 Nitpick (assertive)
Consider enhancing the facility creation configuration.
The new
createDetails
configuration is simpler compared to other resources (e.g., user). Consider adding:
- Rate limiting configuration
- Error handling configuration
- Batch size limits for bulk operations
Example enhancement:
createDetails: { url: config.host.facilityHost + config.paths.facilityCreate, - createPath: "Facility" + createPath: "Facility", + limit: 50, // Add batch size limit + retryConfig: { // Add error handling + maxRetries: 3, + backoffMs: 1000 + }, + rateLimit: { // Add rate limiting + requestsPerMinute: 100 + } },Committable suggestion skipped: line range outside the PR's diff.
health-services/project-factory/tsconfig.debug.json (4)
61-67: 🧹 Nitpick (assertive)
Enhance test file exclusion patterns.
The current test exclusion pattern might miss test files using different naming conventions.
"exclude": [ "node_modules", - "**/*.test.ts" + "**/*.test.ts", + "**/*.spec.ts", + "**/tests/**", + "**/__tests__/**" ]📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements."include": [ "./src/**/*" ], "exclude": [ "node_modules", "**/*.test.ts", "**/*.spec.ts", "**/tests/**", "**/__tests__/**" ]
🧰 Tools
🪛 Biome (1.9.4)
[error] 61-61: End of file expected
Use an array for a sequence of values:
[1, 2]
(parse)
[error] 61-61: End of file expected
Use an array for a sequence of values:
[1, 2]
(parse)
[error] 61-63: End of file expected
Use an array for a sequence of values:
[1, 2]
(parse)
[error] 63-63: End of file expected
Use an array for a sequence of values:
[1, 2]
(parse)
[error] 64-64: End of file expected
Use an array for a sequence of values:
[1, 2]
(parse)
[error] 64-64: End of file expected
Use an array for a sequence of values:
[1, 2]
(parse)
[error] 64-67: End of file expected
Use an array for a sequence of values:
[1, 2]
(parse)
52-59: 🧹 Nitpick (assertive)
Enhance source map configuration for better debugging.
Consider enabling additional source map options to improve the debugging experience.
"sourceMap": true, + "sourceRoot": "./src", + "inlineSourceMap": true, + "inlineSources": true,Committable suggestion skipped: line range outside the PR's diff.
🧰 Tools
🪛 Biome (1.9.4)
[error] 52-52: JSON standard does not allow comments.
(parse)
[error] 57-57: JSON standard does not allow comments.
(parse)
39-51: 🧹 Nitpick (assertive)
Consider adding path aliases for improved import readability.
While the module resolution configuration is solid, you could benefit from path aliases to avoid deep relative imports.
Add path mappings:
"baseUrl": "./", + "paths": { + "@/*": ["src/*"], + "@components/*": ["src/components/*"], + "@utils/*": ["src/utils/*"] + },📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements./* Module Resolution Options */ "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ "paths": { "@/*": ["src/*"], "@components/*": ["src/components/*"], "@utils/*": ["src/utils/*"] }, // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ "typeRoots": [ "./node_modules/@types" ], /* List of folders to include type definitions from. */ // "types": [], /* Type declaration files to be included in compilation. */ // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
🧰 Tools
🪛 Biome (1.9.4)
[error] 39-39: JSON standard does not allow comments.
(parse)
[error] 40-40: End of file expected
Use an array for a sequence of values:
[1, 2]
(parse)
[error] 40-40: End of file expected
Use an array for a sequence of values:
[1, 2]
(parse)
[error] 40-40: End of file expected
Use an array for a sequence of values:
[1, 2]
(parse)
[error] 40-40: End of file expected
Use an array for a sequence of values:
[1, 2]
(parse)
[error] 40-40: JSON standard does not allow comments.
(parse)
[error] 41-41: End of file expected
Use an array for a sequence of values:
[1, 2]
(parse)
[error] 41-41: End of file expected
Use an array for a sequence of values:
[1, 2]
(parse)
[error] 41-41: End of file expected
Use an array for a sequence of values:
[1, 2]
(parse)
[error] 41-43: End of file expected
Use an array for a sequence of values:
[1, 2]
(parse)
[error] 41-41: JSON standard does not allow comments.
(parse)
[error] 44-44: End of file expected
Use an array for a sequence of values:
[1, 2]
(parse)
[error] 44-44: End of file expected
Use an array for a sequence of values:
[1, 2]
(parse)
[error] 44-46: End of file expected
Use an array for a sequence of values:
[1, 2]
(parse)
[error] 46-48: End of file expected
Use an array for a sequence of values:
[1, 2]
(parse)
[error] 46-46: JSON standard does not allow comments.
(parse)
[error] 49-49: End of file expected
Use an array for a sequence of values:
[1, 2]
(parse)
[error] 49-49: End of file expected
Use an array for a sequence of values:
[1, 2]
(parse)
[error] 49-49: End of file expected
Use an array for a sequence of values:
[1, 2]
(parse)
[error] 49-49: JSON standard does not allow comments.
(parse)
3-24: 🧹 Nitpick (assertive)
Consider modernizing the TypeScript configuration.
The current configuration uses older settings that might limit performance and features:
- Target ES5 is quite old and limits modern JavaScript features
- CommonJS modules don't support tree-shaking as effectively as ESM
Consider updating to:
- "target": "es5", - "module": "commonjs", + "target": "es2020", + "module": "esnext",📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements."skipLibCheck": true, /* Basic Options */ // "incremental": true, /* Enable incremental compilation */ "target": "es2020", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */ "module": "esnext", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ // "lib": [], /* Specify library files to be included in the compilation. */ // "allowJs": true, /* Allow javascript files to be compiled. */ // "checkJs": true, /* Report errors in .js files. */ // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ // "declaration": true, /* Generates corresponding '.d.ts' file. */ // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ "sourceMap": true, /* Generates corresponding '.map' file. */ // "outFile": "./", /* Concatenate and emit output to single file. */ "outDir": "./dist/", /* Redirect output structure to the directory. */ // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ // "composite": true, /* Enable project compilation */ // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ // "removeComments": true, /* Do not emit comments to output. */ // "noEmit": true, /* Do not emit outputs. */ // "importHelpers": true, /* Import emit helpers from 'tslib'. */ // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
🧰 Tools
🪛 Biome (1.9.4)
[error] 4-4: JSON standard does not allow comments.
(parse)
[error] 6-6: End of file expected
Use an array for a sequence of values:
[1, 2]
(parse)
[error] 6-6: End of file expected
Use an array for a sequence of values:
[1, 2]
(parse)
[error] 6-6: End of file expected
Use an array for a sequence of values:
[1, 2]
(parse)
[error] 6-6: End of file expected
Use an array for a sequence of values:
[1, 2]
(parse)
[error] 6-6: JSON standard does not allow comments.
(parse)
[error] 7-7: End of file expected
Use an array for a sequence of values:
[1, 2]
(parse)
[error] 7-7: End of file expected
Use an array for a sequence of values:
[1, 2]
(parse)
[error] 7-7: End of file expected
Use an array for a sequence of values:
[1, 2]
(parse)
[error] 7-13: End of file expected
Use an array for a sequence of values:
[1, 2]
(parse)
[error] 7-7: JSON standard does not allow comments.
(parse)
[error] 14-14: End of file expected
Use an array for a sequence of values:
[1, 2]
(parse)
[error] 14-14: End of file expected
Use an array for a sequence of values:
[1, 2]
(parse)
[error] 14-14: End of file expected
Use an array for a sequence of values:
[1, 2]
(parse)
[error] 14-15: End of file expected
Use an array for a sequence of values:
[1, 2]
(parse)
[error] 14-14: JSON standard does not allow comments.
(parse)
[error] 16-16: End of file expected
Use an array for a sequence of values:
[1, 2]
(parse)
[error] 16-16: End of file expected
Use an array for a sequence of values:
[1, 2]
(parse)
[error] 16-16: End of file expected
Use an array for a sequence of values:
[1, 2]
(parse)
[error] 16-16: JSON standard does not allow comments.
(parse)
health-services/project-factory/src/server/utils/gzipHandler.ts (3)
1-2: 🧹 Nitpick (assertive)
Update Node.js import to use the node: protocol.
For better clarity and to follow Node.js best practices, update the zlib import to use the node: protocol.
-import * as zlib from "zlib"; +import * as zlib from "node:zlib";📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.import { Request } from "express"; import * as zlib from "node:zlib";
🧰 Tools
🪛 Biome (1.9.4)
[error] 2-2: A Node.js builtin module should be imported with the node: protocol.
Using the node: protocol is more explicit and signals that the imported module belongs to Node.js.
Unsafe fix: Add the node: protocol.(lint/style/useNodejsImportProtocol)
24-36: 🛠️ Refactor suggestion
Improve type safety and error handling in decompression.
The current implementation has several areas for improvement:
- Missing type information for the parsed JSON
- Generic error handling
- No validation of decompressed data size
Consider this enhanced implementation:
-const decompressGzip = (gzipBuffer: Buffer): Promise<any> => { +const decompressGzip = (gzipBuffer: Buffer): Promise<Record<string, unknown>> => { return new Promise((resolve, reject) => { + const MAX_DECOMPRESSED_SIZE = 50 * 1024 * 1024; // 50MB limit zlib.gunzip(gzipBuffer, (err, result) => { - if (err) return reject(err); + if (err) { + return reject(new Error(`Gzip decompression failed: ${err.message}`)); + } + if (result.length > MAX_DECOMPRESSED_SIZE) { + return reject(new Error("Decompressed data exceeds size limit")); + } try { - resolve(JSON.parse(result.toString())); + const parsed = JSON.parse(result.toString()); + if (typeof parsed !== "object" || parsed === null) { + throw new Error("Invalid JSON: expected an object"); + } + resolve(parsed as Record<string, unknown>); } catch (parseErr) { - reject(new Error("Invalid JSON format in decompressed data")); + reject(new Error(`Invalid JSON format: ${parseErr.message}`)); } }); }); };📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.// Helper function to decompress Gzip data const decompressGzip = (gzipBuffer: Buffer): Promise<Record<string, unknown>> => { return new Promise((resolve, reject) => { const MAX_DECOMPRESSED_SIZE = 50 * 1024 * 1024; // 50MB limit zlib.gunzip(gzipBuffer, (err, result) => { if (err) { return reject(new Error(`Gzip decompression failed: ${err.message}`)); } if (result.length > MAX_DECOMPRESSED_SIZE) { return reject(new Error("Decompressed data exceeds size limit")); } try { const parsed = JSON.parse(result.toString()); if (typeof parsed !== "object" || parsed === null) { throw new Error("Invalid JSON: expected an object"); } resolve(parsed as Record<string, unknown>); } catch (parseErr) { reject(new Error(`Invalid JSON format: ${parseErr.message}`)); } }); }); };
4-22: 🛠️ Refactor suggestion
Enhance error handling and memory management.
The current implementation has several areas for improvement:
- No maximum buffer size limit could lead to memory issues
- Generic error handling loses original error types
- Missing cleanup in error scenarios
Consider this enhanced implementation:
export const handleGzipRequest = async (req: Request): Promise<void> => { const buffers: Buffer[] = []; + let totalSize = 0; + const MAX_SIZE = 10 * 1024 * 1024; // 10MB limit // Collect data chunks from the request await new Promise<void>((resolve, reject) => { - req.on("data", (chunk: any) => buffers.push(chunk)); + req.on("data", (chunk: Buffer) => { + totalSize += chunk.length; + if (totalSize > MAX_SIZE) { + reject(new Error("Payload too large")); + return; + } + buffers.push(chunk); + }); req.on("end", resolve); req.on("error", reject); }); // Concatenate and decompress the data const gzipBuffer = Buffer.concat(buffers); try { const decompressedData = await decompressGzip(gzipBuffer); req.body = decompressedData; // Assign the parsed data to req.body } catch (err: any) { - throw new Error(`Failed to process Gzip data: ${err.message}`); + throw err; // Preserve original error } };📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.export const handleGzipRequest = async (req: Request): Promise<void> => { const buffers: Buffer[] = []; let totalSize = 0; const MAX_SIZE = 10 * 1024 * 1024; // 10MB limit // Collect data chunks from the request await new Promise<void>((resolve, reject) => { req.on("data", (chunk: Buffer) => { totalSize += chunk.length; if (totalSize > MAX_SIZE) { reject(new Error("Payload too large")); return; } buffers.push(chunk); }); req.on("end", resolve); req.on("error", reject); }); // Concatenate and decompress the data const gzipBuffer = Buffer.concat(buffers); try { const decompressedData = await decompressGzip(gzipBuffer); req.body = decompressedData; // Assign the parsed data to req.body } catch (err: any) { throw err; // Preserve original error } };
health-services/project-factory/src/server/utils/middlewares/requestMiddleware.ts (3)
44-48: 🧹 Nitpick (assertive)
Improve error handling type safety.
The catch block should include proper typing for the error object.
} - catch (error) { + catch (error: unknown) { // If an error occurs during validation process, handle the error using errorResponder function errorResponder(error, req, res); }📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.} catch (error: unknown) { // If an error occurs during validation process, handle the error using errorResponder function errorResponder(error, req, res); }
29-31: 🛠️ Refactor suggestion
Add error handling for gzip processing.
The gzip handling block should include proper error handling to maintain consistency with the middleware's error handling pattern.
if (contentType === 'application/gzip') { - await handleGzipRequest(req); + try { + await handleGzipRequest(req); + } catch (err: any) { + let e = Object.assign(err, { + status: err.status || 400, + code: err.code || "INVALID_GZIP_DATA" + }); + errorResponder(e, req, res, e.status); + return; + } }Committable suggestion skipped: line range outside the PR's diff.
22-24: 🧹 Nitpick (assertive)
Simplify content-type checking logic.
The current content-type checking logic is complex and hard to read. Consider using a more maintainable approach.
- if (!contentType || !contentType.split(';').map(part => part.trim()).includes('application/json') && !contentType.split(';').map(part => part.trim()).includes('application/gzip')) { - let e: any = new Error("Unsupported Media Type: Content-Type should be 'application/json' or 'application/gzip'"); + const supportedTypes = ['application/json', 'application/gzip']; + const requestType = contentType?.split(';')[0].trim(); + if (!contentType || !supportedTypes.includes(requestType)) { + let e: any = new Error(`Unsupported Media Type: Content-Type should be one of: ${supportedTypes.join(', ')}`); e = Object.assign(e, { status: 415, code: "UNSUPPORTED_MEDIA_TYPE" }); errorResponder(e, req, res, 415) return; }📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.const supportedTypes = ['application/json', 'application/gzip']; const requestType = contentType?.split(';')[0].trim(); if (!contentType || !supportedTypes.includes(requestType)) { let e: any = new Error(`Unsupported Media Type: Content-Type should be one of: ${supportedTypes.join(', ')}`); e = Object.assign(e, { status: 415, code: "UNSUPPORTED_MEDIA_TYPE" }); errorResponder(e, req, res, 415) return; }
health-services/project-factory/src/server/utils/onGoingCampaignUpdateUtils.ts (3)
82-82:
⚠️ Potential issueFix unsafe optional chaining that could lead to TypeError.
The current implementation has an unsafe optional chaining that could throw a TypeError if it short-circuits with 'undefined':
const originalHeaders = type === config?.facility?.facilityType ? [config?.facility?.facilityCodeColumn, ...schema?.columns] : schema?.columns;Apply this fix to safely handle undefined values:
-const originalHeaders = type === config?.facility?.facilityType ? [config?.facility?.facilityCodeColumn, ...schema?.columns] : schema?.columns; +const originalHeaders = type === config?.facility?.facilityType && config?.facility?.facilityCodeColumn + ? [config.facility.facilityCodeColumn, ...(schema?.columns ?? [])] + : (schema?.columns ?? []);🧰 Tools
🪛 Biome (1.9.4)
[error] 82-82: Unsafe usage of optional chaining.
If it short-circuits with 'undefined' the evaluation will throw TypeError here:
(lint/correctness/noUnsafeOptionalChaining)
79-81: 🛠️ Refactor suggestion
Add type annotations for better type safety.
The function parameters lack proper TypeScript type annotations, which could lead to runtime errors.
Apply this fix to add type safety:
-function modifyProcessedSheetData(type: any, sheetData: any, schema: any, localizationMap?: any) { +interface Schema { + columns: string[]; +} + +function modifyProcessedSheetData( + type: string, + sheetData: Record<string, unknown>[], + schema: Schema, + localizationMap?: Record<string, string> +) {📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.interface Schema { columns: string[]; } function modifyProcessedSheetData( type: string, sheetData: Record<string, unknown>[], schema: Schema, localizationMap?: Record<string, string> ) { if (!sheetData || sheetData.length === 0) return [];
36-38: 🛠️ Refactor suggestion
Improve error handling for array operations.
The function assumes that the resources array contains valid objects with type and createResourceId properties.
Apply this fix to add proper error handling:
- return resources - .filter((item: any) => item.type === processedType) - .map((item: any) => item.createResourceId); + return (resources ?? []) + .filter((item: any): item is { type: string; createResourceId: string } => + item && typeof item.type === 'string' && + item.type === processedType && + typeof item.createResourceId === 'string' + ) + .map(item => item.createResourceId);📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.return (resources ?? []) .filter((item: any): item is { type: string; createResourceId: string } => item && typeof item.type === 'string' && item.type === processedType && typeof item.createResourceId === 'string' ) .map(item => item.createResourceId);
health-services/project-factory/src/server/validators/microplanValidators.ts (1)
221-226: 🧹 Nitpick (assertive)
Potential refactor for lat-long validation.
This logic mirrorsvalidateLatLongForMicroplanCampaigns
. Consider extracting shared behavior into a helper function to avoid duplication and improve maintainability.health-services/project-factory/src/server/utils/genericUtils.ts (9)
464-476: 🧹 Nitpick (assertive)
Commented-out dropdown code.
If you plan to reactivate this logic soon, add a TODO note. Otherwise, removing dead code might simplify maintenance.
528-528: 🧹 Nitpick (assertive)
Check schema usage for facility generation.
Loading schema for facility columns is a good approach. Consider caching if repeated calls degrade performance.
730-738: 🧹 Nitpick (assertive)
Mixed approach to dropdown logic.
You have partially commented-out code forsetDropdownFromSchema
but actively callinghandledropdownthings
. Consider standardizing or removing the old references.
820-820: 🧹 Nitpick (assertive)
New debug log.
logger.info("hiddenColumns", hiddenColumns)
helps track usage of hidden columns. Confirm log verbosity is acceptable.
857-863: 🧹 Nitpick (assertive)
Consistent approach for user dropdown logic.
Similar to facility logic, consider removing commented-out code or unifying it under a single function call if needed.
1014-1014: 🧹 Nitpick (assertive)
Commented-out logic for schema.
If dropping partial code is safe, removing it may reduce confusion. Otherwise, mark as TODO.
1088-1088: 🧹 Nitpick (assertive)
Logging and rethrowing errors.
Capturing detail inhandleGenerateError
is valuable. Ensure no sensitive info is logged.
1319-1319: 🧹 Nitpick (assertive)
Use const for 'd'.
Static analysis flags you’re declaring variabled
once at line 1319. Change it toconst
to avoid confusion and adhere to best practices.- let d of data + const d of data📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.for (const d of data) {
🧰 Tools
🪛 Biome (1.9.4)
[error] 1319-1319: This let declares a variable that is only assigned once.
'd' is never reassigned.
Safe fix: Use const instead.
(lint/style/useConst)
854-855: 🛠️ Refactor suggestion
Use const instead of let.
receivedDropdowns
is never reassigned. This aligns with the static analysis hint.- let receivedDropdowns = request.body?.dropdowns; + const receivedDropdowns = request.body?.dropdowns;📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.const receivedDropdowns = request.body?.dropdowns; logger.info("started adding dropdowns in user", JSON.stringify(receivedDropdowns))
🧰 Tools
🪛 Biome (1.9.4)
[error] 854-854: This let declares a variable that is only assigned once.
'receivedDropdowns' is never reassigned.
Safe fix: Use const instead.
(lint/style/useConst)
health-services/project-factory/src/server/validators/campaignValidators.ts (3)
168-168: 🧹 Nitpick (assertive)
Typo fix suggested.
Change "genric" to "generic".- // validate target columns which are not required but has data present in those columns for genric camapign types + // validate target columns which are not required but has data present in those columns for generic campaign types📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.// validate target columns which are not required but has data present in those columns for generic campaign types
728-729: 🧹 Nitpick (assertive)
Replace
var
with block-scoped declaration.- var active = activeColumnName ? data?.[activeColumnName] : usageColumnStatus.active; + let active = activeColumnName ? data?.[activeColumnName] : usageColumnStatus.active;📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.let active = activeColumnName ? data?.[activeColumnName] : usageColumnStatus.active; if (active == usageColumnStatus.active) {
🧰 Tools
🪛 Biome (1.9.4)
[error] 728-728: Use let or const instead of var.
A variable declared with var is accessible in the whole body of the function. Thus, the variable can be accessed before its initialization and outside the block where it is declared.
See MDN web docs for more details.
Unsafe fix: Use 'const' instead.(lint/style/noVar)
98-100: 🛠️ Refactor suggestion
Avoid using
hasOwnProperty
from the target object.
Use theObject.hasOwn()
method or the'key' in object
operator for safer checks:- const targetColumnsToValidate = isGenericType ? localizedTargetColumnNames.filter((column: string) => - boundaryData.some((row: any) => row.hasOwnProperty(column) && row[column] !== null && row[column] !== undefined) - ) : localizedTargetColumnNames; + const targetColumnsToValidate = isGenericType ? localizedTargetColumnNames.filter((column: string) => + boundaryData.some((row: any) => Object.hasOwn(row, column) && row[column] !== null && row[column] !== undefined) + ) : localizedTargetColumnNames;📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.const targetColumnsToValidate = isGenericType ? localizedTargetColumnNames.filter((column: string) => boundaryData.some((row: any) => Object.hasOwn(row, column) && row[column] !== null && row[column] !== undefined) ) : localizedTargetColumnNames;
🧰 Tools
🪛 Biome (1.9.4)
[error] 99-99: Do not access Object.prototype method 'hasOwnProperty' from target object.
It's recommended using Object.hasOwn() instead of using Object.hasOwnProperty().
See MDN web docs for more details.(lint/suspicious/noPrototypeBuiltins)
health-services/project-factory/src/server/utils/campaignUtils.ts (6)
2369-2369: 🧹 Nitpick (assertive)
Use
Number.parseInt
instead of the globalparseInt
.- const targetNo = parseInt(codesTargetMapping[boundaryCode][beneficiaryType], 10); + const targetNo = Number.parseInt(codesTargetMapping[boundaryCode][beneficiaryType], 10);📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.const targetNo = Number.parseInt(codesTargetMapping[boundaryCode][beneficiaryType], 10); // Ensure numeric conversion
🧰 Tools
🪛 Biome (1.9.4)
[error] 2369-2369: Use Number.parseInt instead of the equivalent global.
ES2015 moved some globals into the Number namespace for consistency.
Safe fix: Use Number.parseInt instead.(lint/style/useNumberNamespace)
2364-2364: 🧹 Nitpick (assertive)
Use
const
fortargets
since it's never reassigned.- let targets: any[] = []; + const targets: any[] = [];📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.const targets: any[] = [];
🧰 Tools
🪛 Biome (1.9.4)
[error] 2364-2364: This let declares a variable that is only assigned once.
'targets' is never reassigned.
Safe fix: Use const instead.
(lint/style/useConst)
1709-1709: 🧹 Nitpick (assertive)
Use
const
instead oflet
for a never-reassigned variable.- let totalTargetValue: any = {}; + const totalTargetValue: any = {};📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.const totalTargetValue: any = {};
🧰 Tools
🪛 Biome (1.9.4)
[error] 1709-1709: This let declares a variable that is only assigned once.
'totalTargetValue' is never reassigned.
Safe fix: Use const instead.
(lint/style/useConst)
3049-3049: 🧹 Nitpick (assertive)
Use
const
forrowData
since it's never reassigned.- let rowData: any = { [codeColumnName]: row[codeColumnName] }; + const rowData: any = { [codeColumnName]: row[codeColumnName] };📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.const rowData: any = { [codeColumnName]: row[codeColumnName] };
🧰 Tools
🪛 Biome (1.9.4)
[error] 3049-3049: This let declares a variable that is only assigned once.
'rowData' is never reassigned.
Safe fix: Use const instead.
(lint/style/useConst)
2425-2425: 🧹 Nitpick (assertive)
Avoid using the
delete
operator for performance reasons.- delete request.body?.boundariesCombined; + request.body.boundariesCombined = undefined;📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.request.body.boundariesCombined = undefined;
🧰 Tools
🪛 Biome (1.9.4)
[error] 2425-2425: Avoid the delete operator which can impact performance.
(lint/performance/noDelete)
1717-1717: 🛠️ Refactor suggestion
Avoid using
hasOwnProperty
from the target object.- if (childTargetValue.hasOwnProperty(key)) { + if (Object.hasOwn(childTargetValue, key)) { totalTargetValue[key] = (totalTargetValue[key] || 0) + childTargetValue[key]; }📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.if (Object.hasOwn(childTargetValue, key)) {
🧰 Tools
🪛 Biome (1.9.4)
[error] 1717-1717: Do not access Object.prototype method 'hasOwnProperty' from target object.
It's recommended using Object.hasOwn() instead of using Object.hasOwnProperty().
See MDN web docs for more details.(lint/suspicious/noPrototypeBuiltins)
health-services/project-factory/src/server/controllers/localisationController/localisation.controller.ts (1)
88-98: 🛠️ Refactor suggestion
Add error handling to the cacheBurst method.
The method should include try-catch block to handle potential HTTP request failures.
Apply this diff to add error handling:
public cacheBurst = async () => { logger.info(`Calling localization cache burst api`); + try { const RequestInfo = defaultRequestInfo; const requestBody = { RequestInfo } await httpRequest( this.localizationHost + config.paths.cacheBurst, requestBody) + } catch (error: any) { + logger.error(`Error in cache burst: ${error.message}`); + throw new Error(`Failed to burst cache: ${error.message}`); + } };📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.public cacheBurst = async ( ) => { logger.info(`Calling localization cache burst api`); try { const RequestInfo = defaultRequestInfo; const requestBody = { RequestInfo } await httpRequest( this.localizationHost + config.paths.cacheBurst, requestBody) } catch (error: any) { logger.error(`Error in cache burst: ${error.message}`); throw new Error(`Failed to burst cache: ${error.message}`); } };
health-services/project-factory/src/server/config/index.ts (2)
22-22: 🛠️ Refactor suggestion
Add validation for retryUntilResourceCreationComplete.
The value should be validated to ensure it's a positive number.
Apply this diff:
- retryUntilResourceCreationComplete:process.env.RETRY_TILL_RESOURCE_CREATION_COMPLETES || 100, + retryUntilResourceCreationComplete: (() => { + const value = Number.parseInt(process.env.RETRY_TILL_RESOURCE_CREATION_COMPLETES || "100", 10); + if (isNaN(value) || value <= 0) { + console.warn("Invalid RETRY_TILL_RESOURCE_CREATION_COMPLETES value, using default: 100"); + return 100; + } + return value; + })(),📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.retryUntilResourceCreationComplete: (() => { const value = Number.parseInt(process.env.RETRY_TILL_RESOURCE_CREATION_COMPLETES || "100", 10); if (isNaN(value) || value <= 0) { console.warn("Invalid RETRY_TILL_RESOURCE_CREATION_COMPLETES value, using default: 100"); return 100; } return value; })(),
102-103: 🧹 Nitpick (assertive)
Use Number.parseInt instead of global parseInt.
For consistency with ES2015, use the Number namespace version.
Apply this diff:
- localizationWaitTimeInBoundaryCreation: parseInt(process.env.LOCALIZATION_WAIT_TIME_IN_BOUNDARY_CREATION || "30000"), - localizationChunkSizeForBoundaryCreation: parseInt(process.env.LOCALIZATION_CHUNK_SIZE_FOR_BOUNDARY_CREATION || "2000"), + localizationWaitTimeInBoundaryCreation: Number.parseInt(process.env.LOCALIZATION_WAIT_TIME_IN_BOUNDARY_CREATION || "30000", 10), + localizationChunkSizeForBoundaryCreation: Number.parseInt(process.env.LOCALIZATION_CHUNK_SIZE_FOR_BOUNDARY_CREATION || "2000", 10),📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.localizationWaitTimeInBoundaryCreation: Number.parseInt(process.env.LOCALIZATION_WAIT_TIME_IN_BOUNDARY_CREATION || "30000", 10), localizationChunkSizeForBoundaryCreation: Number.parseInt(process.env.LOCALIZATION_CHUNK_SIZE_FOR_BOUNDARY_CREATION || "2000", 10),
🧰 Tools
🪛 Biome (1.9.4)
[error] 102-102: Use Number.parseInt instead of the equivalent global.
ES2015 moved some globals into the Number namespace for consistency.
Safe fix: Use Number.parseInt instead.(lint/style/useNumberNamespace)
[error] 103-103: Use Number.parseInt instead of the equivalent global.
ES2015 moved some globals into the Number namespace for consistency.
Safe fix: Use Number.parseInt instead.(lint/style/useNumberNamespace)
health-services/project-factory/src/server/utils/excelUtils.ts (2)
127-131: 🛠️ Refactor suggestion
Add error handling for missing or invalid data.
Consider adding validation and error handling for:
- Missing or invalid request info
- Missing or invalid campaign ID
export function enrichTemplateMetaData(updatedWorkbook : any, request : any ){ + if (!updatedWorkbook) { + throwError("FILE", 400, "INVALID_WORKBOOK", "Workbook is required for metadata enrichment."); + } if(request?.body?.RequestInfo && request?.query?.campaignId){ updatedWorkbook.keywords = `${getLocaleFromRequestInfo(request?.body?.RequestInfo)}#${request?.query?.campaignId}` + } else { + throwError("FILE", 400, "INVALID_REQUEST", "Request info and campaign ID are required for metadata enrichment."); } }Committable suggestion skipped: line range outside the PR's diff.
377-393: 🛠️ Refactor suggestion
Add error handling for missing usage column.
Consider adding validation and error handling when the usage column is not found in the worksheet.
export function enrichUsageColumnForFacility(worksheet: any, localizationMap: any) { + if (!worksheet || !localizationMap) { + throwError("FILE", 400, "INVALID_INPUT", "Worksheet and localization map are required."); + } const configType = "facility"; const usageColumn = getLocalizedName(createAndSearch[configType]?.activeColumnName, localizationMap); if (usageColumn) { const usageColumnIndex = getColumnIndexByHeader(worksheet, usageColumn); + if (usageColumnIndex === -1) { + throwError("FILE", 400, "COLUMN_NOT_FOUND", `Usage column '${usageColumn}' not found in the worksheet.`); + } if (usageColumnIndex !== -1) { worksheet?.eachRow((row: any, rowNumber: number) => { if (rowNumber === 1) return; // Skip header row const cell = row.getCell(usageColumnIndex); // Only change the value if it is empty or null if (!cell.value) { cell.value = usageColumnStatus.inactive; } }); } } }Committable suggestion skipped: line range outside the PR's diff.
health-services/project-factory/src/server/utils/campaignMappingUtils.ts (1)
512-512:
⚠️ Potential issueReplace
var
withlet
for block-scoped variable declaration.Using
var
makes the variable accessible in the whole function body, which could lead to unexpected behavior. Uselet
instead to properly scope the variable.- var retry: any = config?.retryUntilResourceCreationComplete; + let retry: any = config?.retryUntilResourceCreationComplete;📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.let retry: any = config?.retryUntilResourceCreationComplete;
🧰 Tools
🪛 Biome (1.9.4)
[error] 512-512: Use let or const instead of var.
A variable declared with var is accessible in the whole body of the function. Thus, the variable can be accessed before its initialization and outside the block where it is declared.
See MDN web docs for more details.
Unsafe fix: Use 'let' instead.(lint/style/noVar)
Summary by CodeRabbit
Based on the comprehensive summary of changes, here are the release notes:
New Features
Configuration Updates
Performance Improvements
Bug Fixes
Debugging
DEBUG
environment variable