import { type ConsoleMemberRole, type CreateAdditionalOrganizationResponse as CreateAdditionalOrganizationResponseType, type CreateOrganizationResponse as CreateOrganizationResponseType, type OrganizationAdministrationMember as OrganizationAdministrationMemberType, type OrganizationAdministrationOverview as OrganizationAdministrationOverviewType, type OrganizationInvitation as OrganizationInvitationType, type OrganizationMember as OrganizationMemberType, type OrganizationMemberName as OrganizationMemberNameType, type OrganizationPrivateSessionSettings as OrganizationPrivateSessionSettingsType, type OrganizationMembershipRole, type OrganizationRetentionDeletionClaim as OrganizationRetentionDeletionClaimType, type OrganizationRetentionDatabaseFinalization as OrganizationRetentionDatabaseFinalizationType, type OrganizationRetentionDeletionObject as OrganizationRetentionDeletionObjectType, type OrganizationRetentionDeletionPreview as OrganizationRetentionDeletionPreviewType, type OrganizationRetentionDeletionResult as OrganizationRetentionDeletionResultType, type OrganizationRetentionPolicy as OrganizationRetentionPolicyType, type OrganizationSummary as OrganizationSummaryType, type OrganizationWorkspaceAccess as OrganizationWorkspaceAccessType, type PutOrganizationWorkspaceMemberRequest, type RevokeOrganizationWorkspaceMemberResponse as RevokeOrganizationWorkspaceMemberResponseType, type UpdateOrganizationMemberRequest } from "@opengeni/contracts"; import type { Database } from "./database.js"; import { type SignupMailSignal, type SignupNetworkSource } from "./managed-user-setup.js"; export declare function createManagedOrganization(db: Database, input: { subjectId: string; subjectLabel: string; name: string; operationId: string; trialCreditsEnabled?: boolean; trialCreditModelIds?: string[] | undefined; }): Promise; /** * {@link createManagedOrganization} that also hands the setup receipt * trigger the signup network (migration 1354), exactly like organization * onboarding: this legacy route writes the same self-serve setup receipt and * Free eligibility, so it must be recorded, rate limited (SQLSTATE OG429) * and evaluated the same way. `evaluateAccountIds` lists the accounts to * evaluate after commit. */ export declare function createManagedOrganizationWithSignupNetwork(db: Database, input: { subjectId: string; subjectLabel: string; name: string; operationId: string; trialCreditsEnabled?: boolean; trialCreditModelIds?: string[] | undefined; signupNetwork?: SignupNetworkSource | null; signupMailSignal?: SignupMailSignal | null; }): Promise<{ organization: CreateOrganizationResponseType; evaluateAccountIds: string[]; }>; /** * Create one more organization for a person who already has one. Like a * first organization's setup (migration 1484), it records the signup network * passed here and may be refused with SQLSTATE OG429 by the network rate * limit; `evaluateAccountIds` lists the accounts to evaluate after commit. * A person who owns or administers a held or denied organization gets the new * one held. */ export declare function createAdditionalManagedOrganizationWithSignupNetwork(db: Database, input: { subjectId: string; subjectLabel: string; name: string; workspaceName: string; operationId: string; signupNetwork?: SignupNetworkSource | null; signupMailSignal?: SignupMailSignal | null; }): Promise<{ organization: CreateAdditionalOrganizationResponseType; evaluateAccountIds: string[]; }>; export declare function createAdditionalManagedOrganization(db: Database, input: { subjectId: string; subjectLabel: string; name: string; workspaceName: string; operationId: string; }): Promise; type CommandBase = { organizationId: string; actorSubjectId: string; operationId: string; }; /** * Remove one workspace membership through the fenced SECURITY DEFINER * teardown (migration 0278): the same prepare/settle/command protocol as * organization offboarding, scoped to exactly one workspace and one subject. * Cancels the removed member's queued/live turns in the workspace, interrupts * live attempts, ends their realtime modes, advances their private sessions' * authority epochs, registers workflow wakes, deletes their per-workspace * personal rows, and deletes the membership - in one transaction. Returns * false when no membership row exists (idempotent retry). */ export declare function removeWorkspaceMember(db: Database, input: { accountId: string; workspaceId: string; actorSubjectId: string; targetSubjectId: string; requireOrganizationSharedWorkspaceAdministration?: boolean; operationId?: string; }): Promise; export declare function createOrganizationWorkspace(db: Database, input: { organizationId: string; actorSubjectId: string; name: string; operationId: string; }): Promise; export declare function updateOrganizationWorkspace(db: Database, input: { organizationId: string; actorSubjectId: string; workspaceId: string; name: string; expectedUpdatedAt: string; operationId: string; }): Promise; export declare function putOrganizationWorkspaceMember(db: Database, input: { organizationId: string; actorSubjectId: string; workspaceId: string; targetOrganizationMembershipId: string; access: PutOrganizationWorkspaceMemberRequest; }): Promise<{ membershipId: string; organizationMembershipId: string | null; subjectId: string; name: string | null; email: string | null; subjectLabel: string | null; principalKind: "human" | "service"; organizationRole: "admin" | "member" | "owner" | null; role: "admin" | "custom" | "member" | "viewer"; permissions: string[]; createdAt: string; updatedAt: string; }>; /** * Revoke one managed human's shared-workspace access. The existing fenced * prepare/settle/removal protocol remains the teardown authority. This outer * transaction enters the canonical organization -> session-tenancy -> * personal-state prefix before any row lock, then adds caller-owned * idempotency, CAS, and immutable organization audit evidence. */ export declare function revokeOrganizationWorkspaceMember(db: Database, input: { organizationId: string; actorSubjectId: string; workspaceId: string; targetOrganizationMembershipId: string; expectedUpdatedAt: string; operationId: string; }): Promise; export declare function assertActiveManagedHumanOrganizationMembership(db: Database, input: { accountId: string; subjectId: string; }): Promise; export declare function listSelfOrganizationMemberships(db: Database, subjectId: string): Promise; export declare function listSelfOrganizationInvitations(db: Database, input: { subjectId: string; cursor?: string; limit: number; }): Promise<{ invitations: OrganizationInvitationType[]; nextCursor: string | null; }>; export declare function getSelfOrganizationInvitation(db: Database, input: { subjectId: string; invitationId: string; }): Promise; export declare function listOrganizationMembers(db: Database, input: { organizationId: string; actorSubjectId: string; }): Promise; export declare function listOrganizationAdministrationMembers(db: Database, input: { organizationId: string; actorSubjectId: string; }): Promise; /** * The names of the active people in the actor's organization, for any of its * members (owner, admin or member), or null while the deployment's database * still withholds the names list from the runtime (1211 creates it withheld; * a later migration grants it). The database refuses an actor who is not an * active member of exactly this organization (42501). Product users, * services and keys are never listed, and no email, role or status is * returned. */ export declare function listOrganizationMemberNames(db: Database, input: { organizationId: string; actorSubjectId: string; }): Promise; export declare function getOrganizationAdministrationOverview(db: Database, input: { organizationId: string; actorSubjectId: string; }): Promise; export declare function updateOrganizationName(db: Database, input: { organizationId: string; actorSubjectId: string; name: string; expectedUpdatedAt: string; operationId: string; }): Promise; export declare function getOrganizationPrivateSessionSettings(db: Database, input: { organizationId: string; actorSubjectId: string; }): Promise; export declare function updateOrganizationPrivateSessionSettings(db: Database, input: { organizationId: string; actorSubjectId: string; enabled: boolean; expectedVersion: number; operationId: string; }): Promise; export declare function listOrganizationInvitations(db: Database, input: { organizationId: string; actorSubjectId: string; cursor?: string; limit: number; }): Promise<{ invitations: OrganizationInvitationType[]; nextCursor: string | null; }>; export declare function getOrganizationInvitationForAdministration(db: Database, input: { organizationId: string; actorSubjectId: string; invitationId: string; }): Promise; export declare function createOrganizationInvitation(db: Database, input: CommandBase & { targetSubjectId: string | null; targetEmail: string; targetName?: string; initialWorkspaceIds?: string[]; role: OrganizationMembershipRole; expiresAt: string; /** * The Console role the person gets when they accept (members only; the * caller checked that the actor may set it). Written in the invitation's * own transaction, so the invitation never exists without it. */ consoleRole?: Exclude; }): Promise; export declare function bindPendingOrganizationInvitationsForVerifiedEmail(db: Database, input: { subjectId: string; email: string; }): Promise; export declare function acceptOrganizationInvitation(db: Database, input: CommandBase & { invitationId: string; expectedRevision: number; }): Promise<{ invitation: OrganizationInvitationType; membership: OrganizationMemberType; }>; export declare function revokeOrganizationInvitation(db: Database, input: CommandBase & { invitationId: string; expectedRevision: number; }): Promise; export declare function updateOrganizationMember(db: Database, input: CommandBase & { membershipId: string; transition: UpdateOrganizationMemberRequest; }): Promise; export declare function getOrganizationRetentionPolicy(db: Database, input: { organizationId: string; actorSubjectId: string; }): Promise; export declare function updateOrganizationRetentionPolicy(db: Database, input: CommandBase & { mode: "retain" | "delete_after"; retentionDays: number | null; expectedVersion: number; }): Promise; export declare function previewOrganizationRetentionDeletions(db: Database, input: { organizationId: string; limit?: number; }): Promise; export declare function claimOrganizationRetentionDeletion(db: Database, input: { organizationId: string; operationId: string; excludedMembershipIds?: string[]; }): Promise; export declare function listOrganizationRetentionDeletionObjects(db: Database, input: { organizationId: string; membershipId: string; operationId: string; objectBucket: string; limit?: number; }): Promise; export declare function recordOrganizationRetentionObjectDeleted(db: Database, input: { organizationId: string; membershipId: string; operationId: string; objectKind: OrganizationRetentionDeletionObjectType["objectKind"]; sourceId: string; objectBucket: string; objectKey: string; }): Promise; export declare function failOrganizationRetentionDeletion(db: Database, input: { organizationId: string; membershipId: string; operationId: string; reasonCode: string; }): Promise; export declare function finalizeOrganizationRetentionDeletion(db: Database, input: { organizationId: string; membershipId: string; operationId: string; objectBucket: string; }): Promise; export declare function completeOrganizationRetentionDeletion(db: Database, input: { organizationId: string; membershipId: string; operationId: string; objectBucket: string; }): Promise; export {};