import { PaginationInput, User } from "../../types.mjs"; import { FieldsOf } from "../../define-plugin.mjs"; //#region src/plugins/organization/types.d.ts type OrganizationPermissions = Record; /** * The app's own columns on the plugin's models, declared with `fields()`. */ type OrganizationModelFields = { organization?: object; member?: object; invitation?: object; role?: object; }; type Organization = { id: string; name: string; slug: string; logo: string | null; metadata: Record | null; createdAt: string; updatedAt: string; } & FieldsOf; /** * Nested organization on a member or invitation. The fields the server embeds * are configurable, so every field beyond the identifier may be absent. */ type EmbeddedOrganization = Partial>; type EmbeddedUser = Partial> & { firstName?: string; lastName?: string; }; type Member = { id: string; roles?: string[]; permissions?: string[]; organization?: Organization; user?: EmbeddedUser; createdAt: string; updatedAt: string; } & FieldsOf; type InvitationStatus = "pending" | "accepted" | "rejected" | "canceled"; type Invitation = { id: string; email: string; status: InvitationStatus; roles?: string[]; expiresAt: string | null; isExpired: boolean; organization?: EmbeddedOrganization; inviter?: EmbeddedUser; createdAt: string; updatedAt: string; } & FieldsOf; type OrganizationRole = { id: string; name: string; description: string | null; permissions: OrganizationPermissions; createdAt: string; updatedAt: string; } & FieldsOf; type OrganizationPluginConfig = { /** * Mount the organization-defined role routes. Enable it when the server runs * with `WithCustomRoles(true)`; the routes are not registered otherwise. */ customRoles?: boolean; /** * The app's own columns on the organization models, declared with `fields()`. * Type-only — it is never read at runtime. */ fields?: OrganizationModelFields; }; type CreateOrganizationInput = { name: string; slug?: string; logo?: string; /** * Extra columns for the new organization, sent at the body root. The server * reads them through the schema's additional-fields function. */ additionalFields?: Record; }; type ListOrganizationsInput = (PaginationInput & { name?: string; }) | void; type UpdateOrganizationInput = { id: string; name?: string; slug?: string; logo?: string; metadata?: Record; additionalFields?: Record; }; type DeleteOrganizationInput = { id: string; }; type CheckSlugInput = { slug: string; }; type CheckSlugResult = { available: boolean; /** The slug as the server normalized it. */ slug: string; }; type SwitchOrganizationInput = { /** The organization to activate, or `null` to clear the active organization. */id: string | null; }; type LeaveOrganizationInput = { id: string; }; type ListMembersInput = PaginationInput | void; type MemberRoleInput = { memberId: string; role: string; }; type RemoveMemberInput = { memberId: string; }; type CreateInvitationInput = { email: string; role: string; /** Extend the pending invitation for this email instead of rejecting it. */ resend?: boolean; additionalFields?: Record; }; type InvitationTokenInput = { token: string; }; type CancelInvitationInput = { invitationId: string; }; type ListInvitationsInput = (PaginationInput & { statuses?: InvitationStatus[]; }) | void; type CreateOrganizationRoleInput = { name: string; description?: string; permissions: OrganizationPermissions; }; type UpdateOrganizationRoleInput = { roleId: string; description?: string; permissions?: OrganizationPermissions; }; type ListOrganizationRolesInput = PaginationInput | void; type DeleteOrganizationRoleInput = { roleId: string; }; //#endregion export { CancelInvitationInput, CheckSlugInput, CheckSlugResult, CreateInvitationInput, CreateOrganizationInput, CreateOrganizationRoleInput, DeleteOrganizationInput, DeleteOrganizationRoleInput, EmbeddedOrganization, EmbeddedUser, Invitation, InvitationStatus, InvitationTokenInput, LeaveOrganizationInput, ListInvitationsInput, ListMembersInput, ListOrganizationRolesInput, ListOrganizationsInput, Member, MemberRoleInput, Organization, OrganizationModelFields, OrganizationPermissions, OrganizationPluginConfig, OrganizationRole, RemoveMemberInput, SwitchOrganizationInput, UpdateOrganizationInput, UpdateOrganizationRoleInput };