Repository navigation
refactor(measure): encapsulate infrastructure exports behind factories - #1469
marcuscastelo merged 3 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Co-authored-by: marcuscastelo <27441558+marcuscastelo@users.noreply.github.com> Agent-Logs-Url: https://github.com/marcuscastelo/macroflows/sessions/7fde155e-0dd3-4a73-83c1-cf7b5e6b7899
There was a problem hiding this comment.
Pull request overview
Refactors the measure module’s infrastructure layer to narrow its public API surface so consumers use factory functions only, while internal helpers/DTOs/constants remain private.
Changes:
- Converted measure repository, Supabase gateway, and Supabase mapper to export only factory functions (helpers made file-local).
- Simplified realtime module exports to a single public initializer and localized the table name constant where used.
- Added an infrastructure-level test to assert the public export surface of measure infra modules.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/modules/measure/infrastructure/tests/measureInfrastructureExports.test.ts | Adds a focused test asserting the infra modules export only the intended factory/initializer APIs. |
| src/modules/measure/infrastructure/supabase/supabaseMeasureMapper.ts | Encapsulates Supabase DTO types and replaces exported singleton mapper with a factory. |
| src/modules/measure/infrastructure/supabase/supabaseBodyMeasureGateway.ts | Stops importing exported constants/singletons; uses internal table name and internal mapper instance. |
| src/modules/measure/infrastructure/supabase/realtime.ts | Limits exports to initializeMeasureRealtime and makes subscription helper file-local. |
| src/modules/measure/infrastructure/supabase/constants.ts | Removes the exported table-name constant module. |
| src/modules/measure/infrastructure/measureRepository.ts | Exports only createMeasureRepository; makes CRUD helpers file-local. |
|
Encontrei um ponto que ainda ficou fora do padrao combinado do epico: o arquivo src/modules/measure/infrastructure/supabase/realtime.ts continua exportando initializeMeasureRealtime diretamente. Como esta PR ja toca o arquivo de realtime, vale encapsular tambem esse entrypoint atras de uma factory, por exemplo createMeasureRealtimeService retornando initializeMeasureRealtime, para manter a regra de a camada de infrastructure expor apenas factories. Hoje a PR fecha repository, gateway e mapper, mas deixa esse arquivo com um formato publico diferente do restante da migracao. |
The
measureinfrastructure was exposing implementation details beyond its intended public surface. This refactor narrows the module API so callers consume factories only, while internal helpers, DTOs, and constants remain private to the infrastructure layer.Repository surface
measureRepositorynow exports onlycreateMeasureRepository.Supabase gateway + mapper encapsulation
createSupabaseBodyMeasureMapper().Realtime cleanup
initializeMeasureRealtimeas the only public realtime entrypoint.Internal constant removal
constants.tsexport and localized the table name where it is used.Export contract coverage
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
test.supabase.co/opt/hostedtoolcache/node/24.14.0/x64/bin/node /opt/hostedtoolcache/node/24.14.0/x64/bin/node --conditions node --conditions development /home/REDACTED/work/macroflows/macroflows/node_modules/.pnpm/tinypool@1.1.1/node_modules/tinypool/dist/entry/process.js(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.