import * as z from 'zod/mini'; import * as Db from '../../../db/Db.js'; import * as Email from '../../../internal/Email.js'; import * as Memberships from '../../../db/tables/memberships.js'; import type * as Metrics from '../../../Metrics.js'; import * as RateLimit from '../../../internal/RateLimit.js'; import * as Response from '../../../internal/Response.js'; import type { Environment } from '../App.js'; /** Zod schemas owned by the invitations resource. */ export declare namespace schema { /** One pending invitation. */ const Invitation: z.ZodMiniObject<{ createdAt: z.ZodMiniISODateTime; email: z.ZodMiniEmail; expiresAt: z.ZodMiniISODateTime; id: z.ZodMiniString; invitedBy: z.ZodMiniString; orgId: z.ZodMiniString; role: z.ZodMiniEnum<{ admin: "admin"; member: "member"; owner: "owner"; }>; }, z.core.$strip>; /** Path parameters addressing an organization's invitation collection. */ const Params: z.ZodMiniObject<{ orgId: z.ZodMiniString; }, z.core.$strip>; /** Path parameters addressing one org-scoped invitation. */ const InvitationParams: z.ZodMiniObject<{ invitationId: z.ZodMiniString; orgId: z.ZodMiniString; }, z.core.$strip>; /** Path parameters addressing one of the caller's invitations. */ const AcceptParams: z.ZodMiniObject<{ invitationId: z.ZodMiniString; }, z.core.$strip>; /** Request body creating an invitation. */ const CreateInvitationRequest: z.ZodMiniObject<{ email: z.ZodMiniEmail; role: z.ZodMiniEnum<{ admin: "admin"; member: "member"; owner: "owner"; }>; }, z.core.$strip>; /** Schemas for the listInvitations / listMyInvitations operations. */ namespace listInvitations { /** Non-paginated list of pending invitations. */ const Response: z.ZodMiniObject<{ data: z.ZodMiniArray; invitedBy: z.ZodMiniString; orgId: z.ZodMiniString; role: z.ZodMiniEnum<{ admin: "admin"; member: "member"; owner: "owner"; }>; }, z.core.$strip>>; }, z.core.$strip>; } /** Schemas for the listMyInvitations operation. */ namespace listMyInvitations { /** A pending invitation addressed to the caller, with the inviting org's name. */ const Item: z.ZodMiniObject<{ createdAt: z.ZodMiniISODateTime; email: z.ZodMiniEmail; expiresAt: z.ZodMiniISODateTime; id: z.ZodMiniString; invitedBy: z.ZodMiniString; orgId: z.ZodMiniString; role: z.ZodMiniEnum<{ admin: "admin"; member: "member"; owner: "owner"; }>; orgName: z.ZodMiniString; }, z.core.$strip>; /** Non-paginated list of the caller's pending invitations. */ const Response: z.ZodMiniObject<{ data: z.ZodMiniArray; invitedBy: z.ZodMiniString; orgId: z.ZodMiniString; role: z.ZodMiniEnum<{ admin: "admin"; member: "member"; owner: "owner"; }>; orgName: z.ZodMiniString; }, z.core.$strip>>; }, z.core.$strip>; } /** Schemas for the acceptInvitation operation. */ namespace acceptInvitation { /** The membership granted by accepting. */ const Response: z.ZodMiniObject<{ orgId: z.ZodMiniString; role: z.ZodMiniEnum<{ admin: "admin"; member: "member"; owner: "owner"; }>; userId: z.ZodMiniString; }, z.core.$strip>; } /** Schemas for the declineInvitation operation. */ namespace declineInvitation { /** Confirmation that the invitation was declined. */ const Response: z.ZodMiniObject<{ id: z.ZodMiniString; }, z.core.$strip>; } /** Schemas for the revokeInvitation operation. */ namespace revokeInvitation { /** Confirmation that the invitation was revoked. */ const Response: z.ZodMiniObject<{ id: z.ZodMiniString; }, z.core.$strip>; } } /** * Mounts the invitations surface: org-scoped management * (`/orgs/:orgId/invitations`) plus session-only invitee actions. Invitation * emails dispatch through the management group's sender, best-effort. */ export declare function invitations(): import("hono/hono-base").HonoBase; /** Consumes the shared quotas protecting invitation email dispatch. */ export declare function consumeEmailRateLimit(options: consumeEmailRateLimit.Options): Promise<{ result: RateLimit.Result; scope: string; } | undefined>; export declare namespace consumeEmailRateLimit { /** Fields used to protect one invitation email dispatch. */ type Options = { /** Stable identity for the initiating actor, when the caller has one. */ actor?: string | undefined; /** Intended invitation recipient. */ email: string; /** Whether this app has an email sender configured. */ enabled: boolean; /** Bounded operational metrics sink for fail-open degradation. */ metrics?: Metrics.Metrics | undefined; /** Shared counter store used by every invitation email entrypoint. */ rateLimit?: RateLimit.Store | undefined; }; } /** Records bounded invitation limiter degradation for operational alerting. */ export declare function recordEmailRateLimitDegradation(options: recordEmailRateLimitDegradation.Options): void; export declare namespace recordEmailRateLimitDegradation { /** Inputs for recording one invitation limiter degradation. */ type Options = { /** Bounded operational metrics sink. */ metrics?: Metrics.Metrics | undefined; /** Quota dimension whose counter degraded. */ scope: 'invitation-email-actor' | 'invitation-email-global' | 'invitation-email-recipient'; }; } /** Creates an organization invitation and dispatches its email. */ export declare function createInvitation(options: createInvitation.Options): Promise<{ acceptedAt: string | null; createdAt: string; email: string; expiresAt: string; grantsEarlyAccess: boolean; id: string; invitedBy: string; orgId: string; revokedAt: string | null; role: "admin" | "member" | "owner"; }>; export declare namespace createInvitation { /** Fields required to create and deliver an invitation. */ type Options = { /** Session user whose current organization role authorizes this write. */ callerUserId?: string | undefined; /** Database receiving the pending invitation. */ db: Db.Db; /** Invitee email. */ email: string; /** Invitation expiry timestamp. */ expiresAt?: string | undefined; /** Transactional email sender, when configured. */ invitationEmail?: Email.Sender | undefined; /** Identity attributed with creating the invitation. */ invitedBy: string; /** Organization receiving the invited member. */ org: { id: string; name: string; }; /** Role granted after acceptance. */ role: Memberships.Role; /** Keeps email delivery alive after the response. */ waitUntil?: ((promise: Promise) => void) | undefined; }; } //# sourceMappingURL=invitations.d.ts.map