convex-teams

Client reference

TeamsClient methods in the current development API.

Import TeamsClient from @clipin/convex-teams and pass the generated components.teams reference. These methods run inside host Convex functions.

The API targets the first stable version, 1.0.0. See the typed client source for exact argument types.

Queries

MethodArguments after ctxPurpose
listTeamsuserId, paginationOptsPage through accessible teams.
getTeamStateteamPublicIdTrusted host lookup of live metadata. Does not grant resource access.
getTeamBySluguserId, teamSlugRead an accessible team.
getActiveTeamuserIdResolve the active preference.
getDefaultTeamuserIdResolve the default preference.
listMembersuserId, teamSlug, paginationOptsPage through team members.
listPendingInvitesuserId, teamSlug, paginationOptsPage through pending invitations. Requires owner or admin.

Trusted migration mutations

These methods are for internal migration jobs. They do not authenticate a caller. Keep them behind trusted host functions and freeze membership writes until cutover. See Host responsibilities.

MethodPurpose
importTeam(ctx, args)Preserve a public ID and create the owner. Returns the component team ID and open or complete.
importMembers(ctx, args)Import 1 to 100 memberships per batch. Reject role conflicts.
finishImport(ctx, teamPublicId)Verify ownership and the expected count, then close the import.

Workspace mutations

MethodPurpose
createTeam(ctx, userId, teamName)Create a workspace with the actor as owner.
prepareMembershipCount(ctx, userId, teamSlug)Prepare older records in bounded batches. Owner-only. Returns counting or ready.
ensurePersonalTeam(ctx, args)Find or create the actor's personal workspace.
setActiveTeam(ctx, userId, teamSlug)Select an accessible workspace.
setDefaultTeam(ctx, userId, teamId)Set the default preference.
updateTeamProfile(ctx, args)Update the workspace profile.
updateMemberRole(ctx, args)Explicitly change a non-owner role.
transferOwnership(ctx, args)Atomically transfer ownership to an existing member.
addMember(ctx, args)Grant membership through trusted provisioning.
removeMember(ctx, args)Remove a non-owner member.
leaveTeam(ctx, userId, teamSlug)Leave as a non-owner member.
deleteTeam(ctx, userId, teamPublicId)Deny access and schedule bounded cleanup.

Invitation methods

MethodPurpose
createInvite(ctx, args)Issue an invitation scoped to the team.
resendInvite(ctx, userId, inviteId)Rotate a token and return the current invitation ID.
revokeInvite(ctx, userId, inviteId)Revoke an invitation.
acceptInvite(ctx, args)Accept and grant membership in one transaction.
recordDeliveryAttempt(ctx, args)Record safe delivery metadata.
pruneInvitations(ctx, limit?)Run bounded retention maintenance.

Package exports

ExportPurpose
@clipin/convex-teamsClient and public types.
@clipin/convex-teams/convex.config.jsComponent configuration to mount in the host.
@clipin/convex-teams/typesPublic result types.
@clipin/convex-teams/testRegister teams and its invite child with convex-test.

The scoped package includes these exports. See the installation guide and current release status.

On this page