import { Result } from "../utils/results.js"; import { KnownErrors } from "../known-errors.js"; import { inlineProductSchema } from "../schema-fields.js"; import { AccessToken, InternalSession, RefreshToken } from "../sessions.js"; import { ProjectPermissionsCrud } from "./crud/project-permissions.js"; import { TeamPermissionsCrud } from "./crud/team-permissions.js"; import { ConnectedAccountAccessTokenCrud, ConnectedAccountCrud } from "./crud/connected-accounts.js"; import { ContactChannelsCrud } from "./crud/contact-channels.js"; import { CurrentUserCrud } from "./crud/current-user.js"; import { ItemCrud } from "./crud/items.js"; import { NotificationPreferenceCrud } from "./crud/notification-preferences.js"; import { OAuthProviderCrud } from "./crud/oauth-providers.js"; import { SessionsCrud } from "./crud/sessions.js"; import { TeamInvitationCrud } from "./crud/team-invitation.js"; import { TeamMemberProfilesCrud } from "./crud/team-member-profiles.js"; import { TeamsCrud } from "./crud/teams.js"; import { ClientInterfaceOptions, StackClientInterface } from "./client-interface.js"; import { TeamMembershipsCrud } from "./crud/team-memberships.js"; import { UsersCrud } from "./crud/users.js"; import * as yup from "yup"; //#region src/interface/server-interface.d.ts type ServerAuthApplicationOptions = (ClientInterfaceOptions & ({ readonly secretServerKey: string; } | { readonly projectOwnerSession: InternalSession | (() => Promise); })); declare class StackServerInterface extends StackClientInterface { options: ServerAuthApplicationOptions; constructor(options: ServerAuthApplicationOptions); protected sendServerRequest(path: string, options: RequestInit, session: InternalSession | null, requestType?: "server" | "admin"): Promise; getCustomerBilling(customerType: "user" | "team", customerId: string, session: InternalSession | null): Promise<{ has_customer: boolean; default_payment_method: { id: string; brand: string | null; last4: string | null; exp_month: number | null; exp_year: number | null; } | null; }>; createCustomerPaymentMethodSetupIntent(customerType: "user" | "team", customerId: string, session: InternalSession | null): Promise<{ client_secret: string; stripe_account_id: string; }>; setDefaultCustomerPaymentMethodFromSetupIntent(customerType: "user" | "team", customerId: string, setupIntentId: string, session: InternalSession | null): Promise<{ default_payment_method: { id: string; brand: string | null; last4: string | null; exp_month: number | null; exp_year: number | null; }; }>; protected sendServerRequestAndCatchKnownError(path: string, requestOptions: RequestInit, tokenStoreOrNull: InternalSession | null, errorsToCatch: readonly E[]): Promise>>; createServerUser(data: UsersCrud['Server']['Create']): Promise; getServerUserByToken(session: InternalSession): Promise; getServerUserById(userId: string): Promise>; listServerTeamInvitations(options: { teamId: string; }): Promise; revokeServerTeamInvitation(invitationId: string, teamId: string): Promise; listServerTeamMemberProfiles(options: { teamId: string; }): Promise; getServerTeamMemberProfile(options: { teamId: string; userId: string; }): Promise; listServerTeamPermissions(options: { userId?: string; teamId?: string; recursive: boolean; }, session: InternalSession | null): Promise; listServerProjectPermissions(options: { userId?: string; recursive: boolean; }, session: InternalSession | null): Promise; listServerUsers(options: ({ cursor?: string; limit?: number; orderBy?: 'signedUpAt'; desc?: boolean; query?: string; includeRestricted?: boolean; } & ({ includeAnonymous?: boolean; onlyAnonymous?: false; } | { includeAnonymous: true; onlyAnonymous: true; }))): Promise; listServerTeams(options?: { userId?: string; }): Promise; getServerTeam(teamId: string): Promise; listServerTeamUsers(teamId: string): Promise; createServerTeam(data: TeamsCrud['Server']['Create']): Promise; updateServerTeam(teamId: string, data: TeamsCrud['Server']['Update']): Promise; deleteServerTeam(teamId: string): Promise; addServerUserToTeam(options: { userId: string; teamId: string; }): Promise; removeServerUserFromTeam(options: { userId: string; teamId: string; }): Promise; listServerUserTeamInvitations(userId: string): Promise; acceptServerTeamInvitationById(invitationId: string, userId: string): Promise; updateServerUser(userId: string, update: UsersCrud['Server']['Update']): Promise; createServerProviderAccessToken(userId: string, provider: string, scope: string): Promise; /** * Get access token for a specific connected account by provider ID and provider account ID. * This is the preferred method when dealing with multiple accounts of the same provider. */ createServerProviderAccessTokenByAccount(userId: string, providerId: string, providerAccountId: string, scope: string): Promise; /** * List all connected accounts for a user. */ listServerConnectedAccounts(userId: string): Promise; createServerUserSession(userId: string, expiresInMillis: number, isImpersonation: boolean): Promise<{ accessToken: string; refreshToken: string; }>; leaveServerTeam(options: { teamId: string; userId: string; }): Promise; updateServerTeamMemberProfile(options: { teamId: string; userId: string; profile: TeamMemberProfilesCrud['Server']['Update']; }): Promise; grantServerTeamUserPermission(teamId: string, userId: string, permissionId: string): Promise; grantServerProjectPermission(userId: string, permissionId: string): Promise; revokeServerTeamUserPermission(teamId: string, userId: string, permissionId: string): Promise; revokeServerProjectPermission(userId: string, permissionId: string): Promise; deleteServerUser(userId: string): Promise; createServerContactChannel(data: ContactChannelsCrud['Server']['Create']): Promise; updateServerContactChannel(userId: string, contactChannelId: string, data: ContactChannelsCrud['Server']['Update']): Promise; deleteServerContactChannel(userId: string, contactChannelId: string): Promise; listServerContactChannels(userId: string): Promise; listServerNotificationCategories(userId: string): Promise; setServerNotificationsEnabled(userId: string, notificationCategoryId: string, enabled: boolean): Promise; sendServerContactChannelVerificationEmail(userId: string, contactChannelId: string, callbackUrl: string): Promise; listServerSessions(userId: string): Promise; deleteServerSession(sessionId: string): Promise; sendServerTeamInvitation(options: { email: string; teamId: string; callbackUrl: string; }): Promise; updatePassword(options: { oldPassword: string; newPassword: string; }): Promise; createServerOAuthProvider(data: OAuthProviderCrud['Server']['Create']): Promise; listServerOAuthProviders(options?: { user_id?: string; }): Promise; updateServerOAuthProvider(userId: string, providerId: string, data: OAuthProviderCrud['Server']['Update']): Promise; deleteServerOAuthProvider(userId: string, providerId: string): Promise; sendEmail(options: { userIds?: string[]; allUsers?: true; themeId?: string | null | false; html?: string; subject?: string; notificationCategoryName?: string; templateId?: string; variables?: Record; draftId?: string; scheduledAt?: Date; }): Promise>; getEmailDeliveryInfo(): Promise<{ stats: { hour: { sent: number; bounced: number; marked_as_spam: number; }; day: { sent: number; bounced: number; marked_as_spam: number; }; week: { sent: number; bounced: number; marked_as_spam: number; }; month: { sent: number; bounced: number; marked_as_spam: number; }; }; capacity: { rate_per_second: number; boost_multiplier: number; penalty_factor: number; is_boost_active: boolean; boost_expires_at: string | null; }; }>; activateEmailCapacityBoost(): Promise<{ expires_at: string; }>; updateItemQuantity(options: ({ itemId: string; userId: string; } | { itemId: string; teamId: string; } | { itemId: string; customCustomerId: string; }), data: ItemCrud['Server']['Update']): Promise; grantProduct(options: { customerType: "user" | "team" | "custom"; customerId: string; productId?: string; product?: yup.InferType; quantity?: number; }): Promise; getDataVaultStoreValue(secret: string, storeId: string, key: string): Promise; setDataVaultStoreValue(secret: string, storeId: string, key: string, value: string): Promise; initiateServerPasskeyRegistration(userId: string): Promise>; } //#endregion export { ServerAuthApplicationOptions, StackServerInterface }; //# sourceMappingURL=server-interface.d.ts.map