Building 70 Projects ranging from beginner to advanced so anyone can — learn from, build upon, use as a reference, or even copy directly. Owned by my cybersecurity company 👇
Go aicertificationcloud-engineeringcybercybersecuritycybersecurity-analystcybersecurity-certificationcybersecurity-certificationscybersecurity-educationcybersecurity-jobscybersecurity-portfoliocybersecurity-projectscybersecurity-toolsgrchackinglearningpentestingproject-repositoryprojetcspython
feat(monitor/frontend): dashboard WS client with reconnect + init handshake (TDD, 6 tests)
CarterPerez-devf7f276df39cc
diff --git a/PROJECTS/advanced/monitor-the-situation-dashboard/frontend/package.json b/PROJECTS/advanced/monitor-the-situation-dashboard/frontend/package.jsonindex fc6e78c7..aa631e5f 100644--- a/PROJECTS/advanced/monitor-the-situation-dashboard/frontend/package.json+++ b/PROJECTS/advanced/monitor-the-situation-dashboard/frontend/package.json@@ -12,7 +12,9 @@"format": "biome format --write .","typecheck": "tsc -b","lint:scss": "stylelint '**/*.scss'",- "lint:scss:fix": "stylelint '**/*.scss' --fix"+ "lint:scss:fix": "stylelint '**/*.scss' --fix",+ "test": "vitest run",+ "test:watch": "vitest"},"dependencies": {"@tanstack/react-query": "^5.90.12",@@ -34,13 +36,16 @@"@types/react": "^19.2.7","@types/react-dom": "^19.2.3","@vitejs/plugin-react": "^5.1.1",+ "@vitest/ui": "^4.1.5",+ "happy-dom": "^20.9.0","sass": "^1.95.0","stylelint": "^16.26.1","stylelint-config-prettier-scss": "^1.0.0","stylelint-config-standard-scss": "^16.0.0","typescript": "~5.9.3","vite": "npm:[email protected]",- "vite-tsconfig-paths": "^5.1.0"+ "vite-tsconfig-paths": "^5.1.0",+ "vitest": "^4.1.5"},"pnpm": {"overrides": {diff --git a/PROJECTS/advanced/monitor-the-situation-dashboard/frontend/pnpm-lock.yaml b/PROJECTS/advanced/monitor-the-situation-dashboard/frontend/pnpm-lock.yamlindex d04a7163..51c9446a 100644--- a/PROJECTS/advanced/monitor-the-situation-dashboard/frontend/pnpm-lock.yaml+++ b/PROJECTS/advanced/monitor-the-situation-dashboard/frontend/pnpm-lock.yaml@@ -63,6 +63,12 @@ importers:'@vitejs/plugin-react':specifier: ^5.1.1+ '@vitest/ui':+ specifier: ^4.1.5+ version: 4.1.5([email protected])+ happy-dom:+ specifier: ^20.9.0+ version: 20.9.0sass:specifier: ^1.95.0version: 1.95.0@@ -84,6 +90,9 @@ importers:vite-tsconfig-paths:specifier: ^5.1.0+ vitest:+ specifier: ^4.1.5+ version: 4.1.5(@types/[email protected])(@vitest/[email protected])([email protected])([email protected](@types/[email protected])([email protected]))packages:@@ -196,24 +205,28 @@ packages:engines: {node: '>=14.21.3'}cpu: [arm64]os: [linux]+ libc: [musl]'@biomejs/[email protected]':resolution: {integrity: sha512-Uo1OJnIkJgSgF+USx970fsM/drtPcQ39I+JO+Fjsaa9ZdCN1oysQmy6oAGbyESlouz+rzEckLTF6DS7cWse95g==}engines: {node: '>=14.21.3'}cpu: [arm64]os: [linux]+ libc: [glibc]'@biomejs/[email protected]':resolution: {integrity: sha512-YGLkqU91r1276uwSjiUD/xaVikdxgV1QpsicT0bIA1TaieM6E5ibMZeSyjQ/izBn4tKQthUSsVZacmoJfa3pDA==}engines: {node: '>=14.21.3'}cpu: [x64]os: [linux]+ libc: [musl]'@biomejs/[email protected]':resolution: {integrity: sha512-QDPMD5bQz6qOVb3kiBui0zKZXASLo0NIQ9JVJio5RveBEFgDgsvJFUvZIbMbUZT3T00M/1wdzwWXk4GIh0KaAw==}engines: {node: '>=14.21.3'}cpu: [x64]os: [linux]+ libc: [glibc]'@biomejs/[email protected]':resolution: {integrity: sha512-H4IoCHvL1fXKDrTALeTKMiE7GGWFAraDwBYFquE/L/5r1927Te0mYIGseXi4F+lrrwhSWbSGt5qPFswNoBaCxg==}@@ -348,36 +361,42 @@ packages:engines: {node: '>= 10.0.0'}cpu: [arm]os: [linux]+ libc: [glibc]'@parcel/[email protected]':resolution: {integrity: sha512-6E+m/Mm1t1yhB8X412stiKFG3XykmgdIOqhjWj+VL8oHkKABfu/gjFj8DvLrYVHSBNC+/u5PeNrujiSQ1zwd1Q==}engines: {node: '>= 10.0.0'}cpu: [arm]os: [linux]+ libc: [musl]'@parcel/[email protected]':resolution: {integrity: sha512-LrGp+f02yU3BN9A+DGuY3v3bmnFUggAITBGriZHUREfNEzZh/GO06FF5u2kx8x+GBEUYfyTGamol4j3m9ANe8w==}engines: {node: '>= 10.0.0'}cpu: [arm64]os: [linux]+ libc: [glibc]'@parcel/[email protected]':resolution: {integrity: sha512-cFOjABi92pMYRXS7AcQv9/M1YuKRw8SZniCDw0ssQb/noPkRzA+HBDkwmyOJYp5wXcsTrhxO0zq1U11cK9jsFg==}engines: {node: '>= 10.0.0'}cpu: [arm64]os: [linux]+ libc: [musl]'@parcel/[email protected]':resolution: {integrity: sha512-GcESn8NZySmfwlTsIur+49yDqSny2IhPeZfXunQi48DMugKeZ7uy1FX83pO0X22sHntJ4Ub+9k34XQCX+oHt2A==}engines: {node: '>= 10.0.0'}cpu: [x64]os: [linux]+ libc: [glibc]'@parcel/[email protected]':resolution: {integrity: sha512-n0E2EQbatQ3bXhcH2D1XIAANAcTZkQICBPVaxMeaCVBtOpBZpWJuf7LwyWPSBDITb7In8mqQgJ7gH8CILCURXg==}engines: {node: '>= 10.0.0'}cpu: [x64]os: [linux]+ libc: [musl]'@parcel/[email protected]':resolution: {integrity: sha512-RFzklRvmc3PkjKjry3hLF9wD7ppR4AKcWNzH7kXR7GUe0Igb3Nz8fyPwtZCSquGrhU5HhUNDr/mKBqj7tqA2Vw==}@@ -401,6 +420,9 @@ packages:resolution: {integrity: sha512-dfUnCxiN9H4ap84DvD2ubjw+3vUNpstxa0TneY/Paat8a3R4uQZDLSvWjmznAY/DoahqTHl9V46HF/Zs3F29pg==}engines: {node: '>= 10.0.0'}+ '@polka/[email protected]':+ resolution: {integrity: sha512-wwQAWhWSuHaag8c4q/KN/vCoeOJYshAIvMQwD4GpSb3OiZklFfvAgmj0VCBBImRpuF/aFgIRzllXlVX93Jevww==}+'@rolldown/[email protected]':resolution: {integrity: sha512-XlEkrOIHLyGT3avOgzfTFSjG+f+dZMw+/qd+Y3HLN86wlndrB/gSimrJCk4gOhr1XtRtEKfszpadI3Md4Z4/Ag==}engines: {node: ^20.19.0 || >=22.12.0}@@ -436,24 +458,28 @@ packages:engines: {node: ^20.19.0 || >=22.12.0}cpu: [arm64]os: [linux]+ libc: [glibc]'@rolldown/[email protected]':resolution: {integrity: sha512-L0zRdH2oDPkmB+wvuTl+dJbXCsx62SkqcEqdM+79LOcB+PxbAxxjzHU14BuZIQdXcAVDzfpMfaHWzZuwhhBTcw==}engines: {node: ^20.19.0 || >=22.12.0}cpu: [arm64]os: [linux]+ libc: [musl]'@rolldown/[email protected]':resolution: {integrity: sha512-gyoI8o/TGpQd3OzkJnh1M2kxy1Bisg8qJ5Gci0sXm9yLFzEXIFdtc4EAzepxGvrT2ri99ar5rdsmNG0zP0SbIg==}engines: {node: ^20.19.0 || >=22.12.0}cpu: [x64]os: [linux]+ libc: [glibc]'@rolldown/[email protected]':resolution: {integrity: sha512-zti8A7M+xFDpKlghpcCAzyOi+e5nfUl3QhU023ce5NCgUxRG5zGP2GR9LTydQ1rnIPwZUVBWd4o7NjZDaQxaXA==}engines: {node: ^20.19.0 || >=22.12.0}cpu: [x64]os: [linux]+ libc: [musl]'@rolldown/[email protected]':resolution: {integrity: sha512-eZUssog7qljrrRU9Mi0eqYEPm3Ch0UwB+qlWPMKSUXHNqhm3TvDZarJQdTevGEfu3EHAXJvBIe0YFYr0TPVaMA==}@@ -490,6 +516,9 @@ packages:'@rolldown/[email protected]':resolution: {integrity: sha512-vENRlFU4YbrwVqNDZ7fLvy+JR1CRkyr01jhSiDpE1u6py3OMzQfztQU2jxykW3ALNxO4kSlqIDeYyD0Y9RcQeQ==}+ '@standard-schema/[email protected]':+ resolution: {integrity: sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==}+'@tanstack/[email protected]':resolution: {integrity: sha512-T1/8t5DhV/SisWjDnaiU2drl6ySvsHj1bHBCWNXd+/T+Hh1cf6JodyEYMd5sgwm+b/mETT4EV3H+zCVczCU5hg==}@@ -522,6 +551,15 @@ packages:'@types/[email protected]':resolution: {integrity: sha512-8PvcXf70gTDZBgt9ptxJ8elBeBjcLOAcOtoO/mPJjtji1+CdGbHgm77om1GrsPxsiE+uXIpNSK64UYaIwQXd4Q==}+ '@types/[email protected]':+ resolution: {integrity: sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==}++ '@types/[email protected]':+ resolution: {integrity: sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==}++ '@types/[email protected]':+ resolution: {integrity: sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==}+'@types/[email protected]':resolution: {integrity: sha512-WOhQTZ4G8xZ1tjJTvKOpyEVSGgOTvJAfDK3FNFgELyaTpzhdgHVHeqW8V+UJvzF5BT+/B54T/1S2K6gd9c7bbA==}@@ -533,12 +571,52 @@ packages:'@types/[email protected]':resolution: {integrity: sha512-MWtvHrGZLFttgeEj28VXHxpmwYbor/ATPYbBfSFZEIRK0ecCFLl2Qo55z52Hss+UV9CRN7trSeq1zbgx7YDWWg==}+ '@types/[email protected]':+ resolution: {integrity: sha512-c2AKvDT8ToxLIOUlN51gTiHXflsfIFisS4pO7pDPoKouJCESkhZnEy623gwP9laCy5lnLDAw1vAzu2vM2YLOrA==}++ '@types/[email protected]':+ resolution: {integrity: sha512-ThVF6DCVhA8kUGy+aazFQ4kXQ7E1Ty7A3ypFOe0IcJV8O/M511G99AW24irKrW56Wt44yG9+ij8FaqoBGkuBXg==}+'@vitejs/[email protected]':resolution: {integrity: sha512-EcA07pHJouywpzsoTUqNh5NwGayl2PPVEJKUSinGGSxFGYn+shYbqMGBg6FXDqgXum9Ou/ecb+411ssw8HImJQ==}engines: {node: ^20.19.0 || >=22.12.0}peerDependencies:vite: ^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0+ '@vitest/[email protected]':+ resolution: {integrity: sha512-PWBaRY5JoKuRnHlUHfpV/KohFylaDZTupcXN1H9vYryNLOnitSw60Mw9IAE2r67NbwwzBw/Cc/8q9BK3kIX8Kw==}++ '@vitest/[email protected]':+ resolution: {integrity: sha512-/x2EmFC4mT4NNzqvC3fmesuV97w5FC903KPmey4gsnJiMQ3Be1IlDKVaDaG8iqaLFHqJ2FVEkxZk5VmeLjIItw==}+ peerDependencies:+ msw: ^2.4.9+ vite: ^6.0.0 || ^7.0.0 || ^8.0.0+ peerDependenciesMeta:+ msw:+ optional: true+ vite:+ optional: true++ '@vitest/[email protected]':+ resolution: {integrity: sha512-7I3q6l5qr03dVfMX2wCo9FxwSJbPdwKjy2uu/YPpU3wfHvIL4QHwVRp57OfGrDFeUJ8/8QdfBKIV12FTtLn00g==}++ '@vitest/[email protected]':+ resolution: {integrity: sha512-2D+o7Pr82IEO46YPpoA/YU0neeyr6FTerQb5Ro7BUnBuv6NQtT/kmVnczngiMEBhzgqz2UZYl5gArejsyERDSQ==}++ '@vitest/[email protected]':+ resolution: {integrity: sha512-zypXEt4KH/XgKGPUz4eC2AvErYx0My5hfL8oDb1HzGFpEk1P62bxSohdyOmvz+d9UJwanI68MKwr2EquOaOgMQ==}++ '@vitest/[email protected]':+ resolution: {integrity: sha512-2lNOsh6+R2Idnf1TCZqSwYlKN2E/iDlD8sgU59kYVl+OMDmvldO1VDk39smRfpUNwYpNRVn3w4YfuC7KfbBnkQ==}++ '@vitest/[email protected]':+ resolution: {integrity: sha512-3Z9HNFiV0IF1fk0JPiK+7kE1GcaIPefQQIBYur6PM5yFIq6agys3uqP/0t966e1wXfmjbRCHDe7qW236Xjwnag==}+ peerDependencies:+ vitest: 4.1.5++ '@vitest/[email protected]':+ resolution: {integrity: sha512-76wdkrmfXfqGjueGgnb45ITPyUi1ycZ4IHgC2bhPDUfWHklY/q3MdLOAB+TF1e6xfl8NxNY0ZYaPCFNWSsw3Ug==}+resolution: {integrity: sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==}@@ -557,6 +635,10 @@ packages:resolution: {integrity: sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==}engines: {node: '>=8'}+ resolution: {integrity: sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==}+ engines: {node: '>=12'}+resolution: {integrity: sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==}engines: {node: '>=8'}@@ -600,6 +682,10 @@ packages:resolution: {integrity: sha512-Pzfx9fOKoKvevQf8oCXoyNRQ5QyxJj+3O0Rqx2V5oxT61KGx8+n6hV/IUyJeifUci2clnmmKVpvtiqRzgiWjSw==}+ resolution: {integrity: sha512-NUPRluOfOiTKBKvWPtSD4PhFvWCqOi0BGStNWs57X9js7XGTprSmFoz5F0tWhR4WPjNeR9jXqdC7/UpSJTnlRg==}+ engines: {node: '>=18'}+resolution: {integrity: sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==}engines: {node: '>= 14.16.0'}@@ -690,6 +776,10 @@ packages:resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==}+ resolution: {integrity: sha512-TWrgLOFUQTH994YUyl1yT4uyavY5nNB5muff+RtWaqNVCAK408b5ZnnbNAUEWLTCpum9w6arT70i1XdQ4UeOPA==}+ engines: {node: '>=0.12'}+resolution: {integrity: sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==}engines: {node: '>=6'}@@ -705,6 +795,9 @@ packages:resolution: {integrity: sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==}engines: {node: '>= 0.4'}+ resolution: {integrity: sha512-n27zTYMjYu1aj4MjCWzSP7G9r75utsaoc8m61weK+W8JMBGGQybd43GstCXZ3WNmSFtGT9wi59qQTW6mhTR5LQ==}+resolution: {integrity: sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==}engines: {node: '>= 0.4'}@@ -717,6 +810,13 @@ packages:resolution: {integrity: sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==}engines: {node: '>=6'}+ resolution: {integrity: sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==}++ resolution: {integrity: sha512-knvyeauYhqjOYvQ66MznSMs83wmHrCycNEN6Ao+2AeYEfxUIkuiVxdEa1qlGEPK+We3n0THiDciYSsCcgW/DoA==}+ engines: {node: '>=12.0.0'}+resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==}@@ -743,6 +843,9 @@ packages:picomatch:optional: true+ resolution: {integrity: sha512-cPJU47OaAoCbg0pBvzsgpTPhmhqI5eJjh/JIu8tPj5q+T7iLvW/JAYUqmE7KOB4R1ZyEhzBaIQpQpardBF5z8A==}+resolution: {integrity: sha512-TPVFSDE7q91Dlk1xpFLvFllf8r0HyOMOlnWy7Z2HBku5H3KhIeOGInexrIeg2D64DosVB/JXkrrk6N/7Wriq4A==}@@ -756,6 +859,9 @@ packages:resolution: {integrity: sha512-GX+ysw4PBCz0PzosHDepZGANEuFCMLrnRTiEy9McGjmkCQYwRq4A/X786G/fjM/+OjsWSU1ZrY5qyARZmO/uwg==}+ resolution: {integrity: sha512-PjDse7RzhcPkIJwy5t7KPWQSZ9cAbzQXcafsetQoD7sOJRQlGikNbx7yZp2OotDnJyrDcbyRq3Ttb18iYOqkxA==}+resolution: {integrity: sha512-deG2P0JfjrTxl50XGCDyfI97ZGVCxIpfKYmfyrQ54n5FO/0gfIES8C/Psl6kWVDolizcaaxZJnTS0QSMxvnsBQ==}engines: {node: '>=4.0'}@@ -815,6 +921,10 @@ packages:resolution: {integrity: sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==}engines: {node: '>= 0.4'}+ resolution: {integrity: sha512-GZZ9mKe8r646NUAf/zemnGbjYh4Bt8/MqASJY+pSm5ZDtc3YQox+4gsLI7yi1hba6o+eCsGxpHn5+iEVn31/FQ==}+ engines: {node: '>=20.0.0'}+resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==}engines: {node: '>=8'}@@ -958,24 +1068,28 @@ packages:engines: {node: '>= 12.0.0'}cpu: [arm64]os: [linux]+ libc: [glibc]resolution: {integrity: sha512-5Vh9dGeblpTxWHpOx8iauV02popZDsCYMPIgiuw97OJ5uaDsL86cnqSFs5LZkG3ghHoX5isLgWzMs+eD1YzrnA==}engines: {node: '>= 12.0.0'}cpu: [arm64]os: [linux]+ libc: [musl]resolution: {integrity: sha512-Cfd46gdmj1vQ+lR6VRTTadNHu6ALuw2pKR9lYq4FnhvgBc4zWY1EtZcAc6EffShbb1MFrIPfLDXD6Xprbnni4w==}engines: {node: '>= 12.0.0'}cpu: [x64]os: [linux]+ libc: [glibc]resolution: {integrity: sha512-XJaLUUFXb6/QG2lGIW6aIk6jKdtjtcffUT0NKvIqhSBY3hh9Ch+1LCeH80dR9q9LBjG3ewbDjnumefsLsP6aiA==}engines: {node: '>= 12.0.0'}cpu: [x64]os: [linux]+ libc: [musl]resolution: {integrity: sha512-FZn+vaj7zLv//D/192WFFVA0RgHawIcHqLX9xuWiQt7P0PtdFEVaxgF9rjM/IRYHQXNnk61/H/gb2Ei+kUQ4xQ==}@@ -1002,6 +1116,9 @@ packages:resolution: {integrity: sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==}+ resolution: {integrity: sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==}+resolution: {integrity: sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==}engines: {node: '>= 0.4'}@@ -1035,6 +1152,10 @@ packages:resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==}engines: {node: '>= 0.6'}+ resolution: {integrity: sha512-Y3wQdFg2Va6etvQ5I82yUhGdsKrcYox6p7FfL1LbK2J4V01F9TGlepTIhnK24t7koZibmg82KGglhA1XK5IsLQ==}+ engines: {node: '>=10'}+resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==}@@ -1053,6 +1174,9 @@ packages:resolution: {integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==}engines: {node: '>=0.10.0'}+ resolution: {integrity: sha512-uTqF9MuPraAQ+IsnPf366RG4cP9RtUi7MLO1N3KEc+wb0a6yKpeL0lmk2IB1jY5KHPAlTc6T/JRdC/YqxHNwkQ==}+resolution: {integrity: sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==}engines: {node: '>=6'}@@ -1065,6 +1189,9 @@ packages:resolution: {integrity: sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==}engines: {node: '>=8'}+ resolution: {integrity: sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==}+resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==}@@ -1244,10 +1371,17 @@ packages:resolution: {integrity: sha512-oeM1lpU/UvhTxw+g3cIfxXHyJRc/uidd3yK1P242gzHds0udQBYzs3y8j4gCCW+ZJ7ad0yctld8RYO+bdurlvw==}+ resolution: {integrity: sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==}+resolution: {integrity: sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==}engines: {node: '>=14'}+ resolution: {integrity: sha512-2wcC/oGxHis/BoHkkPwldgiPSYcpZK3JU28WoMVv55yHJgcZ8rlXvuG9iZggz+sU1d4bRgIGASwyWqjxu3FM0g==}+ engines: {node: '>=18'}+resolution: {integrity: sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==}engines: {node: '>=8'}@@ -1266,6 +1400,12 @@ packages:resolution: {integrity: sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==}engines: {node: '>=0.10.0'}+ resolution: {integrity: sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==}++ resolution: {integrity: sha512-Rq7ybcX2RuC55r9oaPVEW7/xu3tj8u4GeBYHBWCychFtzMIr86A7e3PPEBPT37sHStKX3+TiX/Fr/ACmJLVlLQ==}+resolution: {integrity: sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==}engines: {node: '>=8'}@@ -1339,14 +1479,29 @@ packages:resolution: {integrity: sha512-9kY+CygyYM6j02t5YFHbNz2FN5QmYGv9zAjVp4lCDjlCw7amdckXlEt/bjMhUIfj4ThGRE4gCUH5+yGnNuPo5A==}engines: {node: '>=10.0.0'}+ resolution: {integrity: sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==}++ resolution: {integrity: sha512-dAqSqE/RabpBKI8+h26GfLq6Vb3JVXs30XYQjdMjaj/c2tS8IYYMbIzP599KtRj7c57/wYApb3QjgRgXmrCukA==}+ engines: {node: '>=18'}+resolution: {integrity: sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==}engines: {node: '>=12.0.0'}+ resolution: {integrity: sha512-Bf+ILmBgretUrdJxzXM0SgXLZ3XfiaUuOj/IKQHuTXip+05Xn+uyEYdVg0kYDipTBcLrCVyUzAPz7QmArb0mmw==}+ engines: {node: '>=14.0.0'}+resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==}engines: {node: '>=8.0'}+ resolution: {integrity: sha512-sf4i37nQ2LBx4m3wB74y+ubopq6W/dIzXg0FDGjsYnZHVa1Da8FH853wlL2gtUhg+xJXjfk3kUZS3BRoQeoQBQ==}+ engines: {node: '>=6'}+resolution: {integrity: sha512-ks6Vjr/jEw0P1gmOVwutM3B7fWxoWBL2KRDb1JfqGVawBmO5UsvmWOQFGHBPl5yxYz4eERr19E6L7NMv+Fej4w==}engines: {node: ^18 || >=20}@@ -1385,14 +1540,76 @@ packages:vite:optional: true+ resolution: {integrity: sha512-9Xx1v3/ih3m9hN+SbfkUyy0JAs72ap3r7joc87XL6jwF0jGg6mFBvQ1SrwaX+h8BlkX6Hz9shdd1uo6AF+ZGpg==}+ engines: {node: ^20.0.0 || ^22.0.0 || >=24.0.0}+ hasBin: true+ peerDependencies:+ '@edge-runtime/vm': '*'+ '@opentelemetry/api': ^1.9.0+ '@types/node': ^20.0.0 || ^22.0.0 || >=24.0.0+ '@vitest/browser-playwright': 4.1.5+ '@vitest/browser-preview': 4.1.5+ '@vitest/browser-webdriverio': 4.1.5+ '@vitest/coverage-istanbul': 4.1.5+ '@vitest/coverage-v8': 4.1.5+ '@vitest/ui': 4.1.5+ happy-dom: '*'+ jsdom: '*'+ vite: ^6.0.0 || ^7.0.0 || ^8.0.0+ peerDependenciesMeta:+ '@edge-runtime/vm':+ optional: true+ '@opentelemetry/api':+ optional: true+ '@types/node':+ optional: true+ '@vitest/browser-playwright':+ optional: true+ '@vitest/browser-preview':+ optional: true+ '@vitest/browser-webdriverio':+ optional: true+ '@vitest/coverage-istanbul':+ optional: true+ '@vitest/coverage-v8':+ optional: true+ '@vitest/ui':+ optional: true+ happy-dom:+ optional: true+ jsdom:+ optional: true++ resolution: {integrity: sha512-nt+N2dzIutVRxARx1nghPKGv1xHikU7HKdfafKkLNLindmPU/ch3U31NOCGGA/dmPcmb1VlofO0vnKAcsm0o/Q==}+ engines: {node: '>=12'}+resolution: {integrity: sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==}hasBin: true+ resolution: {integrity: sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w==}+ engines: {node: '>=8'}+ hasBin: true+resolution: {integrity: sha512-+QU2zd6OTD8XWIJCbffaiQeH9U73qIqafo1x6V1snCWYGJf6cVE0cDR4D8xRzcEnfI21IFrUPzPGtcPf8AC+Rw==}engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0}+ resolution: {integrity: sha512-sAt8BhgNbzCtgGbt2OxmpuryO63ZoDk/sqaB/znQm94T4fCEsy/yV+7CdC1kJhOU9lboAEU7R3kquuycDoibVA==}+ engines: {node: '>=10.0.0'}+ peerDependencies:+ bufferutil: ^4.0.1+ utf-8-validate: '>=5.0.2'+ peerDependenciesMeta:+ bufferutil:+ optional: true+ utf-8-validate:+ optional: true+resolution: {integrity: sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==}@@ -1726,6 +1943,8 @@ snapshots:'@parcel/watcher-win32-x64': 2.5.1optional: true+ '@polka/[email protected]': {}+'@rolldown/[email protected]':optional: true@@ -1774,6 +1993,8 @@ snapshots:'@rolldown/[email protected]': {}+ '@standard-schema/[email protected]': {}+'@tanstack/[email protected]': {}'@tanstack/[email protected]': {}@@ -1815,6 +2036,15 @@ snapshots:dependencies:'@babel/types': 7.28.5+ '@types/[email protected]':+ dependencies:+ '@types/deep-eql': 4.0.2+ assertion-error: 2.0.1++ '@types/[email protected]': {}++ '@types/[email protected]': {}+'@types/[email protected]':dependencies:undici-types: 7.16.0@@ -1827,6 +2057,12 @@ snapshots:dependencies:csstype: 3.2.3+ '@types/[email protected]': {}++ '@types/[email protected]':+ dependencies:+ '@types/node': 24.10.2+dependencies:'@babel/core': 7.28.5@@ -1839,6 +2075,58 @@ snapshots:transitivePeerDependencies:- supports-color+ '@vitest/[email protected]':+ dependencies:+ '@standard-schema/spec': 1.1.0+ '@types/chai': 5.2.3+ '@vitest/spy': 4.1.5+ '@vitest/utils': 4.1.5+ chai: 6.2.2+ tinyrainbow: 3.1.0++ dependencies:+ '@vitest/spy': 4.1.5+ estree-walker: 3.0.3+ magic-string: 0.30.21+ optionalDependencies:++ '@vitest/[email protected]':+ dependencies:+ tinyrainbow: 3.1.0++ '@vitest/[email protected]':+ dependencies:+ '@vitest/utils': 4.1.5+ pathe: 2.0.3++ '@vitest/[email protected]':+ dependencies:+ '@vitest/pretty-format': 4.1.5+ '@vitest/utils': 4.1.5+ magic-string: 0.30.21+ pathe: 2.0.3++ '@vitest/[email protected]': {}++ '@vitest/[email protected]([email protected])':+ dependencies:+ '@vitest/utils': 4.1.5+ fflate: 0.8.2+ flatted: 3.4.2+ pathe: 2.0.3+ sirv: 3.0.2+ tinyglobby: 0.2.15+ tinyrainbow: 3.1.0+ vitest: 4.1.5(@types/[email protected])(@vitest/[email protected])([email protected])([email protected](@types/[email protected])([email protected]))++ '@vitest/[email protected]':+ dependencies:+ '@vitest/pretty-format': 4.1.5+ convert-source-map: 2.0.0+ tinyrainbow: 3.1.0+dependencies:fast-deep-equal: 3.1.3@@ -1856,6 +2144,8 @@ snapshots:+ [email protected]: {}+@@ -1905,6 +2195,8 @@ snapshots:+ [email protected]: {}+dependencies:readdirp: 4.1.2@@ -1972,6 +2264,8 @@ snapshots:+ [email protected]: {}+@@ -1982,6 +2276,8 @@ snapshots:+ [email protected]: {}+dependencies:es-errors: 1.3.0@@ -1995,6 +2291,12 @@ snapshots:+ dependencies:+ '@types/estree': 1.0.8++ [email protected]: {}+@@ -2017,6 +2319,8 @@ snapshots:optionalDependencies:picomatch: 4.0.3+ [email protected]: {}+dependencies:flat-cache: 6.1.19@@ -2033,6 +2337,8 @@ snapshots:+ [email protected]: {}+@@ -2097,6 +2403,18 @@ snapshots:+ dependencies:+ '@types/node': 24.10.2+ '@types/whatwg-mimetype': 3.0.2+ '@types/ws': 8.18.1+ entities: 7.0.1+ whatwg-mimetype: 3.0.0+ ws: 8.20.0+ transitivePeerDependencies:+ - bufferutil+ - utf-8-validate+@@ -2227,6 +2545,10 @@ snapshots:dependencies:yallist: 3.1.1+ dependencies:+ '@jridgewell/sourcemap-codec': 1.5.5+@@ -2250,6 +2572,8 @@ snapshots:dependencies:mime-db: 1.52.0+ [email protected]: {}+@@ -2261,6 +2585,8 @@ snapshots:+ [email protected]: {}+dependencies:callsites: 3.1.0@@ -2274,6 +2600,8 @@ snapshots:+ [email protected]: {}+@@ -2412,8 +2740,16 @@ snapshots:+ [email protected]: {}++ dependencies:+ '@polka/url': 1.0.0-next.29+ mrmime: 2.0.1+ totalist: 3.0.1+@@ -2429,6 +2765,10 @@ snapshots:+ [email protected]: {}++ [email protected]: {}+dependencies:emoji-regex: 8.0.0@@ -2545,15 +2885,23 @@ snapshots:string-width: 4.2.3strip-ansi: 6.0.1+ [email protected]: {}++ [email protected]: {}+dependencies:fdir: 6.5.0([email protected])picomatch: 4.0.3+ [email protected]: {}+dependencies:is-number: 7.0.0+ [email protected]: {}+optionalDependencies:typescript: 5.9.3@@ -2584,15 +2932,53 @@ snapshots:- supports-color- typescript+ [email protected](@types/[email protected])(@vitest/[email protected])([email protected])([email protected](@types/[email protected])([email protected])):+ dependencies:+ '@vitest/expect': 4.1.5+ '@vitest/pretty-format': 4.1.5+ '@vitest/runner': 4.1.5+ '@vitest/snapshot': 4.1.5+ '@vitest/spy': 4.1.5+ '@vitest/utils': 4.1.5+ es-module-lexer: 2.1.0+ expect-type: 1.3.0+ magic-string: 0.30.21+ obug: 2.1.1+ pathe: 2.0.3+ picomatch: 4.0.3+ std-env: 4.1.0+ tinybench: 2.9.0+ tinyexec: 1.1.2+ tinyglobby: 0.2.15+ tinyrainbow: 3.1.0+ why-is-node-running: 2.3.0+ optionalDependencies:+ '@types/node': 24.10.2+ '@vitest/ui': 4.1.5([email protected])+ happy-dom: 20.9.0+ transitivePeerDependencies:+ - msw++ [email protected]: {}+dependencies:isexe: 2.0.0+ dependencies:+ siginfo: 2.0.0+ stackback: 0.0.2+dependencies:imurmurhash: 0.1.4signal-exit: 4.1.0+ [email protected]: {}+diff --git a/PROJECTS/advanced/monitor-the-situation-dashboard/frontend/src/api/ws.test.ts b/PROJECTS/advanced/monitor-the-situation-dashboard/frontend/src/api/ws.test.tsnew file mode 100644index 00000000..bd43e1d8--- /dev/null+++ b/PROJECTS/advanced/monitor-the-situation-dashboard/frontend/src/api/ws.test.ts@@ -0,0 +1,141 @@+// ©AngelaMos | 2026+// ws.test.ts++import { describe, it, expect, vi } from 'vitest'+import { createDashboardWS, type WSDriver } from './ws'++class FakeDriver implements WSDriver {+ onOpen: (() => void) | null = null+ onMessage: ((data: string) => void) | null = null+ onClose: (() => void) | null = null+ sent: string[] = []+ closed = false++ send(s: string) {+ this.sent.push(s)+ }++ close() {+ if (this.closed) return+ this.closed = true+ this.onClose?.()+ }++ fire(data: string) {+ this.onMessage?.(data)+ }++ open() {+ this.onOpen?.()+ }+}++describe('dashboard WS', () => {+ it('does not send init until setReady() is called', () => {+ const drv = new FakeDriver()+ const ws = createDashboardWS({+ driver: () => drv,+ topics: ['heartbeat'],+ })+ ws.connect()+ drv.open()+ expect(drv.sent).toEqual([])+ ws.setReady()+ expect(drv.sent).toContain('{"op":"init"}')+ ws.disconnect()+ })++ it('buffers events received before ready, replays on setReady', () => {+ const drv = new FakeDriver()+ const events: unknown[] = []+ const ws = createDashboardWS({+ driver: () => drv,+ topics: ['heartbeat'],+ onEvent: (e) => events.push(e),+ })+ ws.connect()+ drv.open()+ drv.fire(JSON.stringify({ topic: 'heartbeat', payload: {} }))+ expect(events).toHaveLength(0)+ ws.setReady()+ expect(events).toHaveLength(1)+ ws.disconnect()+ })++ it('forwards events received after ready immediately', () => {+ const drv = new FakeDriver()+ const events: unknown[] = []+ const ws = createDashboardWS({+ driver: () => drv,+ topics: ['heartbeat'],+ onEvent: (e) => events.push(e),+ })+ ws.connect()+ drv.open()+ ws.setReady()+ drv.fire(JSON.stringify({ topic: 'heartbeat', payload: { v: 1 } }))+ expect(events).toHaveLength(1)+ ws.disconnect()+ })++ it('reconnects with backoff after drop and resends init when ready', async () => {+ const drivers: FakeDriver[] = []+ const ws = createDashboardWS({+ driver: () => {+ const d = new FakeDriver()+ drivers.push(d)+ return d+ },+ topics: ['heartbeat'],+ backoff: { initialMs: 5, maxMs: 20 },+ })+ ws.connect()+ drivers[0].open()+ ws.setReady()+ expect(drivers[0].sent).toContain('{"op":"init"}')++ drivers[0].close()+ await new Promise((r) => setTimeout(r, 50))++ expect(drivers.length).toBeGreaterThanOrEqual(2)+ drivers[1].open()+ expect(drivers[1].sent).toContain('{"op":"init"}')+ ws.disconnect()+ })++ it('does not reconnect after explicit disconnect', async () => {+ const drivers: FakeDriver[] = []+ const ws = createDashboardWS({+ driver: () => {+ const d = new FakeDriver()+ drivers.push(d)+ return d+ },+ topics: ['heartbeat'],+ backoff: { initialMs: 5, maxMs: 20 },+ })+ ws.connect()+ drivers[0].open()+ ws.disconnect()+ await new Promise((r) => setTimeout(r, 30))+ expect(drivers).toHaveLength(1)+ })++ it('ignores malformed JSON without crashing', () => {+ const drv = new FakeDriver()+ const events: unknown[] = []+ const errors = vi.spyOn(console, 'warn').mockImplementation(() => {})+ const ws = createDashboardWS({+ driver: () => drv,+ topics: ['heartbeat'],+ onEvent: (e) => events.push(e),+ })+ ws.connect()+ drv.open()+ ws.setReady()+ drv.fire('{not json')+ expect(events).toHaveLength(0)+ errors.mockRestore()+ ws.disconnect()+ })+})diff --git a/PROJECTS/advanced/monitor-the-situation-dashboard/frontend/src/api/ws.ts b/PROJECTS/advanced/monitor-the-situation-dashboard/frontend/src/api/ws.tsnew file mode 100644index 00000000..017968cc--- /dev/null+++ b/PROJECTS/advanced/monitor-the-situation-dashboard/frontend/src/api/ws.ts@@ -0,0 +1,134 @@+// ©AngelaMos | 2026+// ws.ts++export interface WSDriver {+ onOpen: (() => void) | null+ onMessage: ((data: string) => void) | null+ onClose: (() => void) | null+ send(s: string): void+ close(): void+}++export interface WSEvent {+ topic: string+ source?: string+ timestamp?: string+ payload?: unknown+}++export interface BackoffConfig {+ initialMs: number+ maxMs: number+}++export interface CreateDashboardWSOpts {+ driver: () => WSDriver+ topics: string[]+ onEvent?: (ev: WSEvent) => void+ backoff?: BackoffConfig+}++const DEFAULT_BACKOFF: BackoffConfig = {+ initialMs: 1_000,+ maxMs: 30_000,+}++interface DashboardWS {+ connect: () => void+ setReady: () => void+ disconnect: () => void+}++export function createDashboardWS(opts: CreateDashboardWSOpts): DashboardWS {+ const backoff = opts.backoff ?? DEFAULT_BACKOFF+ const onEvent = opts.onEvent ?? (() => undefined)++ let driver: WSDriver | null = null+ let ready = false+ let closed = false+ let buffer: WSEvent[] = []+ let nextDelay = backoff.initialMs+ let reconnectTimer: ReturnType<typeof setTimeout> | null = null++ function attach() {+ if (closed) return+ const d = opts.driver()+ driver = d+ d.onOpen = () => {+ // reset backoff on a successful open; init is sent only after setReady()+ nextDelay = backoff.initialMs+ if (ready) sendInit()+ }+ d.onMessage = (data) => {+ let parsed: WSEvent+ try {+ parsed = JSON.parse(data) as WSEvent+ } catch {+ console.warn('coinbase ws: malformed frame', data)+ return+ }+ if (ready) {+ onEvent(parsed)+ } else {+ buffer.push(parsed)+ }+ }+ d.onClose = () => {+ driver = null+ if (closed) return+ const delay = nextDelay+ nextDelay = Math.min(nextDelay * 2, backoff.maxMs)+ reconnectTimer = setTimeout(attach, delay)+ }+ }++ function sendInit() {+ driver?.send(JSON.stringify({ op: 'init' }))+ }++ return {+ connect() {+ attach()+ },+ setReady() {+ ready = true+ const flush = buffer+ buffer = []+ for (const ev of flush) onEvent(ev)+ sendInit()+ },+ disconnect() {+ closed = true+ ready = false+ if (reconnectTimer) {+ clearTimeout(reconnectTimer)+ reconnectTimer = null+ }+ driver?.close()+ driver = null+ buffer = []+ },+ }+}++export function browserDriver(url: string, topics: string[]): WSDriver {+ const u = new URL(url, window.location.origin.replace('http', 'ws'))+ if (topics.length > 0) u.searchParams.set('topics', topics.join(','))+ const sock = new WebSocket(u.toString())++ const driver: WSDriver = {+ onOpen: null,+ onMessage: null,+ onClose: null,+ send(s) {+ sock.send(s)+ },+ close() {+ sock.close()+ },+ }+ sock.addEventListener('open', () => driver.onOpen?.())+ sock.addEventListener('message', (e) => driver.onMessage?.(String(e.data)))+ sock.addEventListener('close', () => driver.onClose?.())+ return driver+}