Preset organizations and keyset invite lists
org-create invites can fix the organization they found, a beforeOrgCreate hook stamps your own columns on it or refuses the redemption, and invite.list pages with a stable cursor.
Features
- create:
org-createinvites acceptorganization: { name, slug? }, oninvite.createandcreateSystemInvite. The founder then fills in only their account:invite.getreturns the preset asorganizationNameand drops the org fields fromrequiredFields, redemption ignores org fields in the body, andsendPrivateInvitation/sendPublicInvitationreceiveorganizationNameon create and resend. The slug is the preset one or derived from the name, with a short random suffix when it is taken at redemption, since the founder cannot pick another. See Preset organizations. - organizations:
organization.beforeOrgCreate({ invite, user, organization })runs just before anorg-createredemption writes the org. Fields it returns are stored on the new organization (your org pluginadditionalFields), and throwing anAPIErrorrefuses the redemption with that error while the invite stays pending. See Stamping your own fields. - list:
invite.listtakes an opaquecursorand returnsnextCursor(nullon the last page). Keyset paging oncreatedAtthenid, both descending, never skips or repeats a row, even across invites with the same timestamp.pagekeeps offset paging when no cursor is given. See Management.
Migration notes
Two new nullable columns on invite: presetOrganizationName and presetOrganizationSlug. Run npx auth generate (or your migration tool) before deploying. One new error code, INVALID_CURSOR. Nothing else changes: without organization an org-create invite behaves exactly as before (including ORG_SLUG_TAKEN), and invite.list responses only gain nextCursor.