import * as yup from "yup"; import { KnownErrors, StackServerInterface } from "@stackframe/stack-shared"; import { Result } from "@stackframe/stack-shared/dist/utils/results"; import { InternalSession } from "@stackframe/stack-shared/dist/sessions"; import { TeamApiKeysCrud, UserApiKeysCrud, teamApiKeysCreateOutputSchema, userApiKeysCreateOutputSchema } from "@stackframe/stack-shared/dist/interface/crud/project-api-keys"; import { ConvexCtx, GetCurrentUserOptions } from "../../common"; import { AdminProjectPermissionDefinition, AdminTeamPermission, AdminTeamPermissionDefinition } from "../../permissions"; import { ContactChannelsCrud } from "@stackframe/stack-shared/dist/interface/crud/contact-channels"; import { ItemCrud } from "@stackframe/stack-shared/dist/interface/crud/items"; import { NotificationPreferenceCrud } from "@stackframe/stack-shared/dist/interface/crud/notification-preferences"; import { OAuthProviderCrud } from "@stackframe/stack-shared/dist/interface/crud/oauth-providers"; import { ProjectPermissionDefinitionsCrud, ProjectPermissionsCrud } from "@stackframe/stack-shared/dist/interface/crud/project-permissions"; import { TeamInvitationCrud } from "@stackframe/stack-shared/dist/interface/crud/team-invitation"; import { TeamMemberProfilesCrud } from "@stackframe/stack-shared/dist/interface/crud/team-member-profiles"; import { TeamPermissionDefinitionsCrud, TeamPermissionsCrud } from "@stackframe/stack-shared/dist/interface/crud/team-permissions"; import { TeamsCrud } from "@stackframe/stack-shared/dist/interface/crud/teams"; import { UsersCrud } from "@stackframe/stack-shared/dist/interface/crud/users"; import { ApiKey } from "../../api-keys"; import { OAuthConnection } from "../../connected-accounts"; import { ServerContactChannel } from "../../contact-channels"; import { Customer, CustomerProductsList, CustomerProductsRequestOptions, InlineProduct, ServerItem } from "../../customers"; import { NotificationCategory } from "../../notification-categories"; import { EditableTeamMemberProfile, ReceivedTeamInvitation, SentTeamInvitation, ServerListUsersOptions, ServerTeam, ServerTeamCreateOptions, ServerTeamUser } from "../../teams"; import { ProjectCurrentServerUser, ServerOAuthProvider, ServerUser, ServerUserCreateOptions } from "../../users"; import { _StackClientAppImplIncomplete } from "./client-app-impl"; import { DataVaultStore } from "../../data-vault"; import { EmailDeliveryInfo, SendEmailOptions } from "../../email"; import { StackServerAppConstructorOptions } from "../interfaces/server-app"; //#region src/lib/stack-app/apps/implementations/server-app-impl.d.ts declare class _StackServerAppImplIncomplete extends _StackClientAppImplIncomplete { protected _interface: StackServerInterface; private readonly _currentServerUserCache; private readonly _serverUsersCache; private readonly _serverUserCache; private readonly _serverTeamsCache; private readonly _serverUserTeamInvitationsCache; private readonly _serverTeamUserPermissionsCache; private readonly _serverUserProjectPermissionsCache; /** @deprecated Used by legacy getConnectedAccount(providerId) — uses old per-provider access token endpoint */ private readonly _serverUserOAuthConnectionAccessTokensCache; /** @deprecated Used by legacy getConnectedAccount(providerId) — combines token check + redirect */ private readonly _serverUserOAuthConnectionCache; private readonly _serverUserConnectedAccountsCache; private readonly _serverUserOAuthConnectionAccessTokensByAccountCache; private readonly _serverTeamMemberProfilesCache; private readonly _serverTeamInvitationsCache; private readonly _serverUserTeamProfileCache; private readonly _serverContactChannelsCache; private readonly _serverNotificationCategoriesCache; private readonly _serverDataVaultStoreValueCache; private readonly _emailDeliveryInfoCache; private readonly _serverUserApiKeysCache; private readonly _serverTeamApiKeysCache; private readonly _convexIdentitySubjectCache; private readonly _serverCheckApiKeyCache; private readonly _serverOAuthProvidersCache; private readonly _serverTeamItemsCache; private readonly _serverUserItemsCache; private readonly _serverCustomItemsCache; private readonly _serverUserProductsCache; private readonly _serverTeamProductsCache; private readonly _serverCustomProductsCache; protected _createServerCustomer(userIdOrTeamId: string, type: "user" | "team"): Omit, "id">; private _updateServerUser; protected _serverEditableTeamProfileFromCrud(crud: TeamMemberProfilesCrud['Client']['Read']): EditableTeamMemberProfile; protected _serverContactChannelFromCrud(userId: string, crud: ContactChannelsCrud['Server']['Read']): ServerContactChannel; protected _serverNotificationCategoryFromCrud(userId: string, crud: NotificationPreferenceCrud['Server']['Read']): NotificationCategory; protected _serverOAuthProviderFromCrud(crud: OAuthProviderCrud['Server']['Read']): { id: string; type: "x" | "google" | "github" | "microsoft" | "spotify" | "facebook" | "discord" | "gitlab" | "bitbucket" | "linkedin" | "apple" | "twitch"; userId: string; accountId: string; email: string | undefined; allowSignIn: boolean; allowConnectedAccounts: boolean; update(data: { accountId?: string; email?: string; allowSignIn?: boolean; allowConnectedAccounts?: boolean; }): Promise>>; delete(): Promise; }; constructor(options: StackServerAppConstructorOptions, extraOptions?: { uniqueIdentifier?: string; checkString?: string; interface?: StackServerInterface; }); protected _serverApiKeyFromCrud(crud: TeamApiKeysCrud['Client']['Read']): ApiKey<"team">; protected _serverApiKeyFromCrud(crud: UserApiKeysCrud['Client']['Read']): ApiKey<"user">; protected _serverApiKeyFromCrud(crud: yup.InferType): ApiKey<"team", true>; protected _serverApiKeyFromCrud(crud: yup.InferType): ApiKey<"user", true>; protected _createServerOAuthConnectionFromCrudItem(userId: string, item: { provider: string; provider_account_id: string; }): OAuthConnection; protected _serverUserFromCrud(crud: UsersCrud['Server']['Read']): ServerUser; protected _serverTeamUserFromCrud(crud: TeamMemberProfilesCrud["Server"]["Read"]): ServerTeamUser; protected _serverSentTeamInvitationFromCrud(crud: TeamInvitationCrud['Server']['Read']): SentTeamInvitation; protected _serverReceivedTeamInvitationFromCrud(userId: string, crud: TeamInvitationCrud['Client']['Read']): ReceivedTeamInvitation; protected _currentUserFromCrud(crud: UsersCrud['Server']['Read'], session: InternalSession): ProjectCurrentServerUser; protected _serverTeamFromCrud(crud: TeamsCrud['Server']['Read']): ServerTeam; protected _serverItemFromCrud(customer: { type: "user" | "team" | "custom"; id: string; }, crud: ItemCrud['Client']['Read']): ServerItem; protected _getUserApiKey(options: { apiKey: string; }): Promise | null>; protected _getTeamApiKey(options: { apiKey: string; }): Promise | null>; protected _useUserApiKey(options: { apiKey: string; }): ApiKey<"user"> | null; protected _useTeamApiKey(options: { apiKey: string; }): ApiKey<"team"> | null; protected _getUserByApiKey(apiKey: string): Promise; protected _getUserByConvex(ctx: ConvexCtx, includeAnonymous: boolean): Promise; protected _useUserByConvex(ctx: ConvexCtx, includeAnonymous: boolean): ServerUser | null; protected _useUserByApiKey(apiKey: string): ServerUser | null; protected _getTeamByApiKey(apiKey: string): Promise; protected _useTeamByApiKey(apiKey: string): ServerTeam | null; createUser(options: ServerUserCreateOptions): Promise; getUser(options: GetCurrentUserOptions & { or: 'redirect'; }): Promise>; getUser(options: GetCurrentUserOptions & { or: 'throw'; }): Promise>; getUser(options: GetCurrentUserOptions & { or: 'anonymous'; }): Promise>; getUser(options?: GetCurrentUserOptions): Promise | null>; getUser(id: string): Promise; getUser(options: { apiKey: string; }): Promise; getUser(options: { from: "convex"; ctx: ConvexCtx; or?: "return-null" | "anonymous"; }): Promise; getServerUser(): Promise | null>; getServerUserById(userId: string): Promise; useUser(options: GetCurrentUserOptions & { or: 'redirect'; }): ProjectCurrentServerUser; useUser(options: GetCurrentUserOptions & { or: 'throw'; }): ProjectCurrentServerUser; useUser(options: GetCurrentUserOptions & { or: 'anonymous'; }): ProjectCurrentServerUser; useUser(options?: GetCurrentUserOptions): ProjectCurrentServerUser | null; useUser(id: string): ServerUser | null; useUser(options: { apiKey: string; }): ServerUser | null; useUser(options: { from: "convex"; ctx: ConvexCtx; or?: "return-null" | "anonymous"; }): ServerUser | null; useUserById(userId: string): ServerUser | null; listUsers(options?: ServerListUsersOptions): Promise; useUsers(options?: ServerListUsersOptions): ServerUser[] & { nextCursor: string | null; }; _serverPermissionFromCrud(crud: TeamPermissionsCrud['Server']['Read'] | ProjectPermissionsCrud['Server']['Read']): AdminTeamPermission; _serverTeamPermissionDefinitionFromCrud(crud: TeamPermissionDefinitionsCrud['Admin']['Read']): AdminTeamPermissionDefinition; _serverProjectPermissionDefinitionFromCrud(crud: ProjectPermissionDefinitionsCrud['Admin']['Read']): AdminProjectPermissionDefinition; listTeams(): Promise; getItem(options: { itemId: string; userId: string; } | { itemId: string; teamId: string; } | { itemId: string; customCustomerId: string; }): Promise; listProducts(options: CustomerProductsRequestOptions): Promise; useItem(options: { itemId: string; userId: string; } | { itemId: string; teamId: string; } | { itemId: string; customCustomerId: string; }): ServerItem; grantProduct(options: (({ userId: string; } | { teamId: string; } | { customCustomerId: string; }) & ({ productId: string; } | { product: InlineProduct; }) & { quantity?: number; })): Promise; createTeam(data: ServerTeamCreateOptions): Promise; useTeams(): ServerTeam[]; getTeam(options: { apiKey: string; }): Promise; getTeam(teamId: string): Promise; useTeam(options: { apiKey: string; }): ServerTeam | null; useTeam(teamId: string): ServerTeam | null; protected _createServerDataVaultStore(id: string): DataVaultStore; getDataVaultStore(id: string): Promise; useDataVaultStore(id: string): DataVaultStore; sendEmail(options: SendEmailOptions): Promise; getEmailDeliveryStats(): Promise; useEmailDeliveryStats(): EmailDeliveryInfo; activateEmailCapacityBoost(): Promise; protected _refreshSession(session: InternalSession): Promise; protected _refreshUsers(): Promise; createOAuthProvider(options: { userId: string; providerConfigId: string; accountId: string; email: string; allowSignIn: boolean; allowConnectedAccounts: boolean; }): Promise>>; } //#endregion export { _StackServerAppImplIncomplete }; //# sourceMappingURL=server-app-impl.d.ts.map