Files
supabase/apps
Charis Lam edc030d38b refactor: add DI service layer for projects, orgs, profile, and permissions
Introduces service interfaces and live wiring for the four services that
back layout-level data dependencies, then migrates their hooks to read
from the registry instead of calling fetchers directly.

New files per service:
- *-service.ts       — typed interface (ProjectsService, OrganizationsService,
                       ProfileService, PermissionsService)
- *-service-live.ts  — live impl that delegates to the existing async fetcher
                       functions (getProjectDetail, getOrganizations, etc.),
                       which are themselves unchanged

Registry and live-registry updated to include all four services.

Hook migrations (no fallback — hooks always use the registry):
- useProjectDetailQuery     → useService('projects').getProjectDetail
- useOrganizationsQuery     → useService('organizations').getOrganizations
- useProfileQuery           → useService('profile').getProfile
- usePermissionsQuery       → useService('permissions').getPermissions

prefetchProjectDetail gains a required service parameter so prefetch paths
also go through the registry. Its single caller (usePrefetchProjectIndexPage)
supplies the service via useService('projects').

No behaviour change in production — live implementations delegate to the
same fetcher functions as before.
2026-03-03 13:45:04 -05:00
..