You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Second file of the Phase 3 API-module TypeScript migration, and the first "real" module (~40 methods, heavy enrichment). Rename to .ts, drop .js from imports, add client.get<T>() generics and domain-typed signatures from @/types. Load-bearing specifics for this file:
Union return — getTeam hits /:teamId and /slug/:teamSlug; type as Team | TeamSummary and let the union flow out (caller narrows).
Polymorphic param — getTeam(team) takes string | { slug: string }; narrow with typeof team === 'object'. Don't change the callsite contract.
View-model intersections — many methods splice derived fields onto res.data before returning (link, roleName, lastSeenSince, status, createdSince, updatedSince, flowLastUpdatedSince, expires, device instance). Type each as Base & { ... }; keep the enrichment inline, don't refactor it out.
team.js → team.ts. Spec kept as .js — matches the utils-phase precedent (util sources are .ts, their specs stayed .js). Renaming the spec makes vue-tsc deep-check it and fail on vitest globals + loose mock typing not set up project-wide; separate concern, not this PR.
.js dropped from the 6 imports (product, daysSince, elapsedTime, paginateUrl, roles, ./client)
npx vue-tsc --noEmit from frontend/ — no new errors (still only the 2 pre-existing, unrelated)
npx vitest run test/unit/frontend/api/team.spec.js — 16/16 pass (spec unchanged from HEAD)
team.js → team.ts — Test Plan
Second file of the Phase 3 API-module TypeScript migration, and the first "real" module (~40 methods, heavy enrichment). Rename to
.ts, drop.jsfrom imports, addclient.get<T>()generics and domain-typed signatures from@/types. Load-bearing specifics for this file:getTeamhits/:teamIdand/slug/:teamSlug; type asTeam | TeamSummaryand let the union flow out (caller narrows).getTeam(team)takesstring | { slug: string }; narrow withtypeof team === 'object'. Don't change the callsite contract.res.databefore returning (link,roleName,lastSeenSince,status,createdSince,updatedSince,flowLastUpdatedSince,expires, deviceinstance). Type each asBase & { ... }; keep the enrichment inline, don't refactor it out.product.capture/groupUpdateside effects don't affect return types — leave them.Static
team.js → team.ts. Spec kept as.js— matches the utils-phase precedent (util sources are.ts, their specs stayed.js). Renaming the spec makesvue-tscdeep-check it and fail on vitest globals + loose mock typing not set up project-wide; separate concern, not this PR..jsdropped from the 6 imports (product,daysSince,elapsedTime,paginateUrl,roles,./client)npx vue-tsc --noEmitfromfrontend/— no new errors (still only the 2 pre-existing, unrelated)npx vitest run test/unit/frontend/api/team.spec.js— 16/16 pass (spec unchanged from HEAD)getTeamtypedTeam | TeamSummary+ polymorphicstring | { slug }param; enriched methods carry view-model fields (TeamListItem,InvitationView,DeviceView)Runtime (smoke — team api is app-wide)
getTeams→roleName/link)getTeamobject + string paths)getInstances)getTeamDevices→lastSeenSince)getTeamInvitations→expires)