import { _ as ResolvedHandlerUrls, a as EmailConfig, f as HandlerUrls, g as RequestLike, h as RedirectToOptions, m as RedirectMethod, o as GetCurrentPartialUserOptions, p as OAuthScopesOnSignIn, r as ConvexCtx, s as GetCurrentUserOptions, u as HandlerUrlOptions, v as TokenStoreInit, y as hexclaveAppInternalsSymbol } from "./common-BDyEKSM6.js"; import { c as CustomerInvoicesRequestOptions, d as CustomerProductsList, g as ServerItem, h as Item, m as InlineProduct, n as CustomerBilling, o as CustomerInvoicesList, p as CustomerProductsRequestOptions, t as Customer } from "./index-ZiEXZJBF.js"; import { D as SendEmailOptions, S as AdminSentEmail, t as AdminEmailOutbox, w as EmailDeliveryInfo } from "./index-CBDR4cNg.js"; import { a as InternalApiKeyFirstView, i as InternalApiKeyCreateOptions, n as InternalApiKeyBase, r as InternalApiKeyBaseCrudRead, t as InternalApiKey } from "./index-TUtJOdMm.js"; import { a as AdminTeamPermission, c as AdminTeamPermissionDefinitionUpdateOptions, i as AdminProjectPermissionDefinitionUpdateOptions, n as AdminProjectPermissionDefinition, o as AdminTeamPermissionDefinition, r as AdminProjectPermissionDefinitionCreateOptions, s as AdminTeamPermissionDefinitionCreateOptions, t as AdminProjectPermission, u as TeamPermission } from "./index-DSzMf-rS.js"; import { t as PlanUsage } from "./index-B594jg4e.js"; import { d as AdminWorkflowUpgradeResult, f as AdminWorkflowVersion, i as AdminWorkflowRunDetails, l as AdminWorkflowSyncResult, o as AdminWorkflowRunsFilter, r as AdminWorkflowRun, t as AdminWorkflow } from "./workflows-2-MBWbGl.js"; import { t as DataVaultStore } from "./index-DLPccxVU.js"; import { t as ApiKey } from "./index-fOYcs4NH.js"; import { n as DeprecatedOAuthConnection, r as OAuthConnection } from "./index-ClBTM-St.js"; import { i as ServerContactChannel, t as ContactChannel } from "./index-DN04TjLM.js"; import { t as NotificationCategory } from "./index-O3hJsHSl.js"; import { A as ManagedEmailProviderListItem, At as UserUpdateOptions, Ct as ServerUserCreateOptions, Dt as TokenPartialUser, E as EmailOutboxUpdateOptions, F as StackAdminAppConstructorOptions, G as ServerListTeamsOptions, H as EditableTeamMemberProfile, J as ServerTeamCreateOptions, K as ServerListUsersOptions, M as ManagedEmailProviderStatus, N as StackAdminApp, Q as Team, St as ServerUser, U as ReceivedTeamInvitation, V as StackServerAppConstructorOptions, W as SentTeamInvitation, Z as ServerTeamUser, _t as OAuthProvider, a as StackClientApp, c as StackClientAppJson, dt as BaseUser, gt as InternalUserExtra, h as AdminProject, it as TeamUser, j as ManagedEmailProviderSetupResult, kt as UserExtra, lt as ActiveSession, m as AdminOwnedProject, q as ServerTeam, s as StackClientAppConstructorOptions, ut as Auth, v as AdminProjectUpdateOptions, vt as ProjectCurrentServerUser, xt as ServerOAuthProvider, y as Project, yt as ProjectCurrentUser } from "./client-app-CdAaCL3p.js"; import { a as ListSessionReplaysOptions, i as ListSessionReplayChunksResult, o as ListSessionReplaysResult, r as ListSessionReplayChunksOptions, s as SessionReplayAllEventsResult, t as AdminSessionReplay } from "./index-Cf1wOohp.js"; import { t as AnalyticsOptions } from "./session-replay-8_3WCrsZ.js"; import { t as CookieHelper } from "./cookie-DTOQvCYn.js"; import { t as AdminEmailTemplate } from "./index-Bo5DpPFH.js"; import { t as TokenObject } from "./common-CRu2FsO9.js"; import { t as CrossDomainHandoffParams } from "./redirect-page-urls-Cu5BRQwm.js"; import { HexclaveAdminInterface, HexclaveClientInterface, HexclaveServerInterface, KnownError, KnownErrors } from "@hexclave/shared"; import { RequestListener } from "@hexclave/shared/dist/interface/client-interface"; import { CurrentUserCrud } from "@hexclave/shared/dist/interface/crud/current-user"; import { Result } from "@hexclave/shared/dist/utils/results"; import { ProviderType } from "@hexclave/shared/dist/utils/oauth"; import { RestrictedReason } from "@hexclave/shared/dist/schema-fields"; import * as yup from "yup"; import { ClientProjectsCrud, ProjectsCrud } from "@hexclave/shared/dist/interface/crud/projects"; import { CompleteConfig } from "@hexclave/shared/dist/config/schema"; import { InternalApiKeyCreateCrudResponse } from "@hexclave/shared/dist/interface/admin-interface"; import { AnalyticsClickmapOptions, AnalyticsClickmapResponse, AnalyticsClickmapTokenResponse } from "@hexclave/shared/dist/interface/admin-metrics"; import { AdminGetSessionReplayChunkEventsResponse } from "@hexclave/shared/dist/interface/crud/session-replays"; import { Transaction, TransactionType } from "@hexclave/shared/dist/interface/crud/transactions"; import { InternalSession } from "@hexclave/shared/dist/sessions"; import { MoneyAmount } from "@hexclave/shared/dist/utils/currency-constants"; import { InternalApiKeysCrud } from "@hexclave/shared/dist/interface/crud/internal-api-keys"; import { ProjectPermissionDefinitionsCrud, ProjectPermissionsCrud } from "@hexclave/shared/dist/interface/crud/project-permissions"; import { TeamPermissionDefinitionsCrud, TeamPermissionsCrud } from "@hexclave/shared/dist/interface/crud/team-permissions"; import { AnalyticsQueryOptions, AnalyticsQueryResponse } from "@hexclave/shared/dist/interface/crud/analytics"; import { TeamsCrud } from "@hexclave/shared/dist/interface/crud/teams"; import { TeamApiKeysCrud, UserApiKeysCrud, teamApiKeysCreateOutputSchema, userApiKeysCreateOutputSchema } from "@hexclave/shared/dist/interface/crud/project-api-keys"; import { UsersCrud } from "@hexclave/shared/dist/interface/crud/users"; import { ContactChannelsCrud } from "@hexclave/shared/dist/interface/crud/contact-channels"; import { EmailTemplateCrud } from "@hexclave/shared/dist/interface/crud/email-templates"; import { ItemCrud } from "@hexclave/shared/dist/interface/crud/items"; import { NotificationPreferenceCrud } from "@hexclave/shared/dist/interface/crud/notification-preferences"; import { OAuthProviderCrud } from "@hexclave/shared/dist/interface/crud/oauth-providers"; import { TeamInvitationCrud } from "@hexclave/shared/dist/interface/crud/team-invitation"; import { TeamMemberProfilesCrud } from "@hexclave/shared/dist/interface/crud/team-member-profiles"; import { CustomerInvoicesListResponse } from "@hexclave/shared/dist/interface/crud/invoices"; import { CustomerProductsListResponse } from "@hexclave/shared/dist/interface/crud/products"; import { SessionsCrud } from "@hexclave/shared/dist/interface/crud/sessions"; import { Store } from "@hexclave/shared/dist/utils/stores"; import * as cookie from "cookie"; //#region src/lib/hexclave-app/apps/implementations/client-app-impl.d.ts declare function stripBrowserActionQueryParam(): void; type HexclaveClientAppImplConstructorOptionsResolved = StackClientAppConstructorOptions & { inheritsFrom?: undefined; }; declare class _HexclaveClientAppImplIncomplete implements StackClientApp { /** * There is a circular dependency between the admin app and the client app, as the former inherits from the latter and * the latter needs to use the former when creating a new instance of an internal project. * * To break it, we set the admin app here lazily instead of importing it directly. This variable is set by ./index.ts, * which imports both this file and ./admin-app-impl.ts. */ static readonly LazyStackAdminAppImpl: { value: typeof _HexclaveAdminAppImplIncomplete | undefined; }; protected readonly _options: HexclaveClientAppImplConstructorOptionsResolved; protected readonly _extraOptions: { uniqueIdentifier?: string; checkString?: string; interface?: HexclaveClientInterface; } | undefined; protected _uniqueIdentifier: string | undefined; protected _interface: HexclaveClientInterface; protected readonly _tokenStoreInit: TokenStoreInit; protected readonly _redirectMethod: RedirectMethod | undefined; protected readonly _urlOptions: HandlerUrlOptions; protected readonly _oauthScopesOnSignIn: Partial; private readonly _analyticsOptions; private _sessionRecorder; private _eventTracker; private _pendingSignOut; private __DEMO_ENABLE_SLIGHT_FETCH_DELAY; private readonly _ownedAdminApps; private readonly _currentUserCache; private readonly _currentProjectCache; private readonly _ownedProjectsCache; private readonly _currentUserPermissionsCache; private readonly _currentUserProjectPermissionsCache; private readonly _currentUserTeamsCache; /** @deprecated Used by legacy getConnectedAccount(providerId) — uses old per-provider access token endpoint */ private readonly _currentUserOAuthConnectionAccessTokensCache; /** @deprecated Used by legacy getConnectedAccount(providerId) — combines token check + redirect */ private readonly _currentUserOAuthConnectionCache; private readonly _currentUserConnectedAccountsCache; private readonly _currentUserOAuthConnectionAccessTokensByAccountCache; private readonly _currentUserValidConnectedAccountForProviderCache; private readonly _teamMemberProfilesCache; private readonly _teamInvitationsCache; private readonly _currentUserTeamProfileCache; private readonly _currentUserTeamInvitationsCache; private readonly _clientContactChannelsCache; private readonly _userApiKeysCache; private readonly _teamApiKeysCache; private readonly _notificationCategoriesCache; private readonly _currentUserOAuthProvidersCache; private readonly _userItemCache; private readonly _teamItemCache; private readonly _customItemCache; private readonly _userProductsCache; private readonly _teamProductsCache; private readonly _customProductsCache; private readonly _userInvoicesCache; private readonly _teamInvoicesCache; private readonly _customerBillingCache; private readonly _convexPartialUserCache; private readonly _trustedParentDomainCache; private _anonymousSignUpInProgress; private _prefetchedCrossDomainHandoffParams; private _prefetchedCrossDomainHandoffParamsFetchedAt; private _isPrefetchingCrossDomainHandoffParams; private _pendingAuthResolutionPromises; protected _createCookieHelper(overrideTokenStoreInit?: TokenStoreInit): Promise; /** @deprecated Used by legacy getConnectedAccount(providerId) — combines user check + token check + redirect into one cache */ protected _getUserOAuthConnectionCacheFn(options: { getUser: () => Promise; getOrWaitOAuthToken: () => Promise<{ accessToken: string; } | null>; providerId: ProviderType; scope: string | null; } & ({ redirect: true; session: InternalSession | null; } | { redirect: false; })): Promise; protected _createOAuthConnectionFromCrudItem(item: { provider: string; provider_account_id: string; }, session: InternalSession): OAuthConnection; constructor(options: StackClientAppConstructorOptions, extraOptions?: { uniqueIdentifier?: string; checkString?: string; interface?: HexclaveClientInterface; }); private _initializeAutomaticSideEffects; protected _initUniqueIdentifier(): void; protected _trackPendingAuthResolution(callback: () => Promise): void; protected _awaitPendingAuthResolutions(overrideTokenStoreInit?: TokenStoreInit, options?: { awaitPendingAuthResolutions?: boolean; }): Promise; protected _isOAuthCallbackUrlHosted(): boolean; protected _currentUrlLooksLikeOAuthCallback(): boolean; protected _currentUrlLooksLikeOAuthCallbackError(): boolean; protected _currentUrlLooksLikeHexclaveOAuthCallback(): boolean; protected _currentUrlLooksLikeNestedCrossDomainOAuthCallback(): boolean; protected _getOAuthCallbackRedirectUri(): string; protected _redirectToOAuthCallbackError(error: KnownError): Promise; protected _handleHostedOAuthCallbackDuringStartup(): Promise; protected _fetchCurrentRefreshTokenIdIfSignedIn(options?: { awaitPendingAuthResolutions?: boolean; overrideTokenStoreInit?: TokenStoreInit; }): Promise; protected _addNestedCrossDomainAuthParamsToRedirectUrl(options: { url: string; currentUrl: URL; awaitPendingAuthResolutions?: boolean; overrideTokenStoreInit?: TokenStoreInit; }): Promise; protected _maybeHandleNestedCrossDomainAuth(urlAtConstructionTime?: URL): Promise; /** * Cloudflare workers does not allow use of randomness on the global scope (on which the Stack app is probably * initialized). For that reason, we generate the unique identifier lazily when it is first needed instead of in the * constructor. */ protected _getUniqueIdentifier(): string; protected _checkFeatureSupport(name: string, options: any): Promise; protected _useCheckFeatureSupport(name: string, options: any): never; protected _memoryTokenStore: Store; protected _nextServerCookiesTokenStores: WeakMap>; protected _requestTokenStores: WeakMap>; protected _storedBrowserCookieTokenStore: Store | null; private _mostRecentQueuedCookieRefreshIndex; protected get _legacyRefreshTokenCookieName(): string; protected get _refreshTokenCookieName(): string; private _getRefreshTokenDefaultCookieNameForSecure; private _getCustomRefreshCookieName; private _getDomainFromCustomRefreshCookieName; private _formatRefreshCookieValue; private _formatAccessCookieValue; private _parseStructuredRefreshCookie; private _extractRefreshTokenFromCookieMap; protected _getTokensFromCookies(cookies: cookie.Cookies): TokenObject; private _getCurrentBrowserCookieTokenStoreValue; protected get _accessTokenCookieName(): string; protected get _legacyAccessTokenCookieName(): string; private _getAllBrowserCookies; private _getRefreshTokenCookieNamePatterns; private _collectRefreshTokenCookieNames; private _prepareRefreshCookieUpdate; private _ensureCrossSubdomainCookieExists; private _queueCustomRefreshCookieUpdate; private _getTrustedRedirectConfig; private _getTrustedParentDomain; protected _getBrowserCookieTokenStore(): Store; protected _getOrCreateTokenStore(cookieHelper: CookieHelper, overrideTokenStoreInit?: TokenStoreInit): Store; /** * A map from token stores and session keys to sessions. * * This isn't just a map from session keys to sessions for two reasons: * * - So we can garbage-collect Session objects when the token store is garbage-collected * - So different token stores are separated and don't leak information between each other, eg. if the same user sends two requests to the same server they should get a different session object */ private _sessionsByTokenStoreAndSessionKey; /** * @param overrideTokenObj The tokens to build the session for, if they haven't been written to the token store yet * (so we can warm a sign-in's session before the token store publishes it). */ protected _getSessionFromTokenStore(tokenStore: Store, overrideTokenObj?: TokenObject): InternalSession; protected _getSession(overrideTokenStoreInit?: TokenStoreInit, options?: { awaitPendingAuthResolutions?: boolean; }): Promise; private _signInAttemptCounter; protected _signInToAccountWithTokens(tokens: { accessToken: string | null; refreshToken: string; }): Promise; protected _getTokenStoreInitForFreshTokens(tokens: { accessToken: string | null; refreshToken: string; }): TokenStoreInit | undefined; protected _hasPersistentTokenStore(overrideTokenStoreInit?: TokenStoreInit): this is StackClientApp; protected _ensurePersistentTokenStore(overrideTokenStoreInit?: TokenStoreInit): asserts this is StackClientApp; protected _isInternalProject(): this is { projectId: "internal"; }; protected _ensureInternalProject(): asserts this is { projectId: "internal"; }; protected _clientProjectFromCrud(crud: ClientProjectsCrud['Client']['Read']): Project; protected _clientPermissionFromCrud(crud: TeamPermissionsCrud['Client']['Read'] | ProjectPermissionsCrud['Client']['Read']): TeamPermission; protected _clientTeamUserFromCrud(crud: TeamMemberProfilesCrud['Client']['Read']): TeamUser; protected _clientSentTeamInvitationFromCrud(session: InternalSession, crud: TeamInvitationCrud['Client']['Read']): SentTeamInvitation; protected _clientReceivedTeamInvitationFromCrud(session: InternalSession, crud: TeamInvitationCrud['Client']['Read']): ReceivedTeamInvitation; protected _baseApiKeyFromCrud(crud: TeamApiKeysCrud['Client']['Read'] | UserApiKeysCrud['Client']['Read'] | yup.InferType | yup.InferType): Omit, "revoke" | "update"> | Omit, "revoke" | "update">; protected _clientApiKeyFromCrud(session: InternalSession, crud: TeamApiKeysCrud['Client']['Read']): ApiKey<"team">; protected _clientApiKeyFromCrud(session: InternalSession, crud: UserApiKeysCrud['Client']['Read']): ApiKey<"user">; protected _clientApiKeyFromCrud(session: InternalSession, crud: yup.InferType): ApiKey<"team", true>; protected _clientApiKeyFromCrud(session: InternalSession, crud: yup.InferType): ApiKey<"user", true>; protected _clientTeamFromCrud(crud: TeamsCrud['Client']['Read'], session: InternalSession): Team; protected _clientContactChannelFromCrud(crud: ContactChannelsCrud['Client']['Read'], session: InternalSession): ContactChannel; protected _clientNotificationCategoryFromCrud(crud: NotificationPreferenceCrud['Client']['Read'], session: InternalSession): NotificationCategory; protected _clientOAuthProviderFromCrud(crud: OAuthProviderCrud['Client']['Read'], session: InternalSession): OAuthProvider; protected _clientItemFromCrud(crud: ItemCrud['Client']['Read']): Item; protected _customerProductsFromResponse(response: CustomerProductsListResponse): CustomerProductsList; protected _customerInvoicesFromResponse(response: CustomerInvoicesListResponse): CustomerInvoicesList; protected _customerBillingFromResponse(response: { has_customer: boolean; default_payment_method: { id: string; brand: string | null; last4: string | null; exp_month: number | null; exp_year: number | null; } | null; }): CustomerBilling; protected _createAuth(session: InternalSession): Auth; protected _editableTeamProfileFromCrud(crud: TeamMemberProfilesCrud['Client']['Read'], session: InternalSession): EditableTeamMemberProfile; protected _createBaseUser(crud: NonNullable | UsersCrud['Server']['Read']): BaseUser; protected _createUserExtraFromCurrent(crud: NonNullable, session: InternalSession): UserExtra; protected _createInternalUserExtra(session: InternalSession): InternalUserExtra; protected _createCustomer(userIdOrTeamId: string, type: "user" | "team", session: InternalSession | null): Omit; getItem(options: { itemId: string; userId: string; } | { itemId: string; teamId: string; } | { itemId: string; customCustomerId: string; }): Promise; listProducts(options: CustomerProductsRequestOptions): Promise; listInvoices(options: CustomerInvoicesRequestOptions): Promise; cancelSubscription(options: { productId: string; subscriptionId?: string; } | { productId: string; subscriptionId?: string; teamId: string; }): Promise; protected _currentUserFromCrud(crud: NonNullable, session: InternalSession): ProjectCurrentUser; protected _clientSessionFromCrud(crud: SessionsCrud['Client']['Read']): ActiveSession; protected _getOwnedAdminApp(forProjectId: string, session: InternalSession): _HexclaveAdminAppImplIncomplete; get projectId(): ProjectId; get version(): string; private _getBotChallengeSiteKeys; private _getBotChallengeFlowFailure; private _normalizeBotChallengeResult; private _toInterfaceBotChallengeInput; private _executeResultWithBotChallengeFlow; protected _isTrusted(url: string): Promise; get urls(): Readonly; protected _getUrls(): Readonly; protected _prefetchCrossDomainHandoffParamsIfNeeded(): void; protected _getCrossDomainHandoffParamsForUrlsGetter(currentUrl: URL): CrossDomainHandoffParams | null; protected _getCrossDomainHandoffParamsForRedirect(currentUrl: URL): Promise; protected _getLocalOAuthCallbackHandlerUrl(): string; protected _createCrossDomainAuthRedirectUrl(options: { redirectUri: string; state: string; codeChallenge: string; afterCallbackRedirectUrl: string; awaitPendingAuthResolutions?: boolean; overrideTokenStoreInit?: TokenStoreInit; }): Promise; protected _getFreshPrefetchedCrossDomainHandoffParams(): CrossDomainHandoffParams | null; protected _getCurrentUrl(): Promise; protected _redirectTo(options: { url: URL | string; replace?: boolean; }): Promise; protected _redirectIfTrusted(url: string, options?: RedirectToOptions): Promise; protected _redirectToHandler(handlerName: keyof HandlerUrls, options?: RedirectToOptions, internalOptions?: { awaitPendingAuthResolutions?: boolean; overrideTokenStoreInit?: TokenStoreInit; }): Promise; protected _getRedirectToHandlerUrl(handlerName: keyof HandlerUrls, options?: RedirectToOptions, internalOptions?: { awaitPendingAuthResolutions?: boolean; overrideTokenStoreInit?: TokenStoreInit; }): Promise; protected _redirectToHandlerDuringRender(handlerName: keyof HandlerUrls, options?: RedirectToOptions): boolean; redirectToSignIn(options?: RedirectToOptions): Promise; redirectToSignUp(options?: RedirectToOptions): Promise; redirectToSignOut(options?: RedirectToOptions): Promise; redirectToEmailVerification(options?: RedirectToOptions): Promise; redirectToPasswordReset(options?: RedirectToOptions): Promise; redirectToForgotPassword(options?: RedirectToOptions): Promise; redirectToHome(options?: RedirectToOptions): Promise; redirectToOAuthCallback(options?: RedirectToOptions): Promise; redirectToMagicLinkCallback(options?: RedirectToOptions): Promise; redirectToAfterSignIn(options?: RedirectToOptions): Promise; redirectToAfterSignUp(options?: RedirectToOptions): Promise; redirectToOnboarding(options?: RedirectToOptions): Promise; redirectToAfterSignOut(options?: RedirectToOptions): Promise; redirectToAccountSettings(options?: RedirectToOptions): Promise; redirectToError(options?: RedirectToOptions): Promise; redirectToTeamInvitation(options?: RedirectToOptions): Promise; redirectToCliAuthConfirm(options?: RedirectToOptions): Promise; redirectToMfa(options?: RedirectToOptions): Promise; sendForgotPasswordEmail(email: string, options?: { callbackUrl?: string; }): Promise>; sendMagicLinkEmail(email: string, options?: { callbackUrl?: string; }): Promise>; resetPassword(options: { password: string; code: string; }): Promise>; verifyPasswordResetCode(code: string): Promise>; verifyTeamInvitationCode(code: string): Promise>; acceptTeamInvitation(code: string): Promise>; getTeamInvitationDetails(code: string): Promise>; verifyEmail(code: string): Promise>; getUser(options: GetCurrentUserOptions & { or: 'redirect'; }): Promise>; getUser(options: GetCurrentUserOptions & { or: 'throw'; }): Promise>; getUser(options: GetCurrentUserOptions & { or: 'anonymous'; }): Promise>; getUser(options?: GetCurrentUserOptions): Promise | null>; _getTokenPartialUserFromSession(session: InternalSession, options: GetCurrentPartialUserOptions): TokenPartialUser | null; _getPartialUserFromConvex(ctx: ConvexCtx): Promise; getPartialUser(options: GetCurrentPartialUserOptions & { from: 'token'; }): Promise; getPartialUser(options: GetCurrentPartialUserOptions & { from: 'convex'; }): Promise; getConvexClientAuth(options: { tokenStore: TokenStoreInit; }): (args: { forceRefreshToken: boolean; }) => Promise; getConvexHttpClientAuth(options: { tokenStore: TokenStoreInit; }): Promise; protected _updateClientUser(update: UserUpdateOptions, session: InternalSession): Promise; signInWithOAuth(provider: ProviderType, options?: { returnTo?: string; }): Promise; /** * Handles MFA verification by redirecting to the OTP page */ protected _experimentalMfa(error: KnownErrors['MultiFactorAuthenticationRequired'], session: InternalSession): Promise; /** * @deprecated * TODO remove */ protected _catchMfaRequiredError(callback: () => Promise>): Promise>; signInWithCredential(options: { email: string; password: string; noRedirect?: boolean; }): Promise>; signUpWithCredential(options: { email: string; password: string; noRedirect?: boolean; noVerificationCallback?: boolean; verificationCallbackUrl?: string; }): Promise>; _signUpAnonymously(): Promise<{ accessToken: string; refreshToken: string; }>; signInWithMagicLink(code: string, options?: { noRedirect?: boolean; }): Promise>; /** * Initiates a CLI authentication process that allows a command line application * to get a refresh token for a user's account. * * This process works as follows: * 1. The CLI app calls this method, which initiates the auth process with the server * 2. The server returns a polling code and a login code * 3. The CLI app opens a browser window to the appUrl with the login code as a parameter * 4. The user logs in through the browser and confirms the authorization * 5. The CLI app polls for the refresh token using the polling code * * @param options Options for the CLI login * @param options.appUrl The URL of the app that will handle the CLI auth confirmation * @param options.expiresInMillis Optional duration in milliseconds before the auth attempt expires (default: 2 hours) * @param options.maxAttempts Optional maximum number of polling attempts (default: Infinity) * @param options.waitTimeMillis Optional time to wait between polling attempts (default: 2 seconds) * @param options.promptLink Optional function to call with the login URL and code to prompt the user to open the browser * @param options.anonRefreshToken Optional anonymous refresh token from the CLI's token store to associate with this login attempt * @returns Result containing either the refresh token or an error */ promptCliLogin(options: { appUrl: string; expiresInMillis?: number; maxAttempts?: number; waitTimeMillis?: number; promptLink?: (url: string, loginCode: string) => void; anonRefreshToken?: string; }): Promise>; signInWithMfa(totp: string, code: string, options?: { noRedirect?: boolean; }): Promise>; signInWithPasskey(): Promise>; callOAuthCallback(options?: { dontWarnAboutMissingQueryParams?: boolean; }): Promise; protected _signOut(session: InternalSession, options?: { redirectUrl?: URL | string; }): Promise; protected _redirectToDefaultAfterSignOut(): Promise; signOut(options?: { redirectUrl?: URL | string; tokenStore?: TokenStoreInit; }): Promise; getAccessToken(options?: { tokenStore?: TokenStoreInit; }): Promise; getRefreshToken(options?: { tokenStore?: TokenStoreInit; }): Promise; getAuthorizationHeader(options?: { tokenStore?: TokenStoreInit; }): Promise; getAuthHeaders(options?: { tokenStore?: TokenStoreInit; }): Promise<{ "x-stack-auth": string; }>; getAuthJson(options?: { tokenStore?: TokenStoreInit; }): Promise<{ accessToken: string | null; refreshToken: string | null; }>; getProject(): Promise; protected _listOwnedProjects(session: InternalSession): Promise; protected _createProject(session: InternalSession, newProject: AdminProjectUpdateOptions & { displayName: string; teamId: string; }): Promise; protected _refreshUser(session: InternalSession): Promise; protected _refreshSession(session: InternalSession): Promise; protected _refreshUsers(): Promise; protected _refreshProject(): Promise; protected _refreshOwnedProjects(session: InternalSession): Promise; static get [hexclaveAppInternalsSymbol](): { fromClientJson: (json: StackClientAppJson) => StackClientApp; }; get [hexclaveAppInternalsSymbol](): { toClientJson: () => StackClientAppJson; setCurrentUser: (userJsonPromise: Promise) => void; getConstructorOptions: () => { baseUrl?: string | { browser: string; server: string; }; extraRequestHeaders?: Record; projectId?: ProjectId | undefined; publishableClientKey?: string; urls?: HandlerUrlOptions; oauthScopesOnSignIn?: Partial; tokenStore?: TokenStoreInit | undefined; redirectMethod?: RedirectMethod; inheritsFrom?: StackClientApp; devTool?: boolean | "auto"; noAutomaticPrefetch?: boolean; automaticSideEffects?: boolean; analytics?: AnalyticsOptions; } & { tokenStore: TokenStoreInit; } & (string extends ProjectId ? unknown : { projectId: ProjectId; } | { inheritsFrom: StackClientApp; }) & { inheritsFrom?: undefined; }; sendSessionReplayBatch: (body: string, options: { keepalive: boolean; }) => Promise>; sendAnalyticsEventBatch: (body: string, options: { keepalive: boolean; }) => Promise>; addRequestListener: (listener: RequestListener) => () => void; sendRequest: (path: string, requestOptions: RequestInit, requestType?: "client" | "server" | "admin") => Promise; getUrls: () => Readonly; getRedirectMethod: () => RedirectMethod; redirectToUrl: (url: string | URL, options?: { replace?: boolean; }) => Promise; getRedirectToHandlerUrl: (handlerName: keyof HandlerUrls, options?: RedirectToOptions) => Promise; redirectToHandler: (handlerName: keyof HandlerUrls, options?: RedirectToOptions) => Promise; getRawAfterAuthReturnTo: () => string | null; refreshOwnedProjects: () => Promise; signInWithTokens: (tokens: { accessToken: string; refreshToken: string; }) => Promise; awaitPendingAuthResolutions: () => Promise; isTrustedRedirectUrl: (url: string) => Promise; }; } //#endregion //#region src/lib/hexclave-app/apps/implementations/server-app-impl.d.ts declare class _HexclaveServerAppImplIncomplete extends _HexclaveClientAppImplIncomplete { protected _interface: HexclaveServerInterface; private readonly _currentServerUserCache; private readonly _serverUsersCache; private readonly _serverUserCache; private readonly _serverTeamsCache; private readonly _serverTeamCache; protected _refreshTeamMembership(teamId: string, userId: string): Promise; private readonly _serverUserTeamInvitationsCache; private readonly _serverTeamUserPermissionsCache; private readonly _serverAllTeamMemberPermissionsCache; 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: "google" | "github" | "microsoft" | "spotify" | "facebook" | "discord" | "gitlab" | "bitbucket" | "linkedin" | "apple" | "x" | "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?: HexclaveServerInterface; }); 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 _getUserByApiKey(apiKey: string): Promise; protected _getUserByConvex(ctx: ConvexCtx, includeAnonymous: boolean): Promise; protected _getTeamByApiKey(apiKey: string): Promise; 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; listUsers(options?: ServerListUsersOptions): Promise; _serverPermissionFromCrud(crud: TeamPermissionsCrud['Server']['Read'] | ProjectPermissionsCrud['Server']['Read']): AdminTeamPermission; _serverTeamPermissionDefinitionFromCrud(crud: TeamPermissionDefinitionsCrud['Admin']['Read']): AdminTeamPermissionDefinition; _serverProjectPermissionDefinitionFromCrud(crud: ProjectPermissionDefinitionsCrud['Admin']['Read']): AdminProjectPermissionDefinition; getItem(options: { itemId: string; userId: string; } | { itemId: string; teamId: string; } | { itemId: string; customCustomerId: string; }): Promise; protected _refreshItemCache(customerType: "user" | "team" | "custom", customerId: string, itemId: string): Promise; listProducts(options: CustomerProductsRequestOptions): Promise; private _resolveCustomer; grantProduct(options: (({ userId: string; } | { teamId: string; } | { customCustomerId: string; }) & ({ productId: string; } | { product: InlineProduct; }) & { quantity?: number; })): Promise; createCheckoutUrl(options: (({ userId: string; } | { teamId: string; } | { customCustomerId: string; }) & ({ productId: string; } | { product: InlineProduct; }) & { returnUrl?: string; })): Promise; createTeam(data: ServerTeamCreateOptions): Promise; listTeams(options?: ServerListTeamsOptions): Promise; listTeamMemberPermissions(teamId: string, options?: { recursive?: boolean; }): Promise<{ userId: string; permissionId: string; }[]>; getTeam(options: { apiKey: string; }): Promise; getTeam(teamId: string): Promise; protected _createServerDataVaultStore(id: string): DataVaultStore; getDataVaultStore(id: string): Promise; sendEmail(options: SendEmailOptions): Promise; getEmailDeliveryStats(): Promise; activateEmailCapacityBoost(): Promise; queryAnalytics(options: AnalyticsQueryOptions): 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 //#region src/lib/hexclave-app/apps/implementations/admin-app-impl.d.ts type PlanUsageResponse = Awaited>; declare class _HexclaveAdminAppImplIncomplete extends _HexclaveServerAppImplIncomplete implements StackAdminApp { protected _interface: HexclaveAdminInterface; private readonly _adminProjectCache; private readonly _planUsageCache; private readonly _internalApiKeysCache; private readonly _adminEmailThemeCache; private readonly _adminEmailThemesCache; private readonly _adminEmailTemplatesCache; private readonly _adminEmailDraftsCache; private readonly _adminWorkflowsCache; private readonly _adminTeamPermissionDefinitionsCache; private readonly _adminProjectPermissionDefinitionsCache; private readonly _svixTokenCache; private readonly _metricsCache; private readonly _userActivityCache; private readonly _metricsUserCountsCache; private readonly _emailPreviewCache; private readonly _emailPreviewWithEditableMarkersCache; private readonly _configOverridesCache; private readonly _stripeAccountInfoCache; private readonly _transactionsCache; constructor(options: StackAdminAppConstructorOptions, extraOptions?: { uniqueIdentifier?: string; checkString?: string; interface?: HexclaveAdminInterface; }); _adminConfigFromCrud(data: { config_string: string; }): CompleteConfig; _adminOwnedProjectFromCrud(data: ProjectsCrud['Admin']['Read'], onRefresh: () => Promise): AdminOwnedProject; _adminProjectFromCrud(data: ProjectsCrud['Admin']['Read'], onRefresh: () => Promise): AdminProject; _adminEmailTemplateFromCrud(data: EmailTemplateCrud['Admin']['Read']): AdminEmailTemplate; _planUsageFromCrud(data: PlanUsageResponse): PlanUsage; getProject(): Promise; getPlanUsage(): Promise; protected _createInternalApiKeyBaseFromCrud(data: InternalApiKeyBaseCrudRead): InternalApiKeyBase; protected _createInternalApiKeyFromCrud(data: InternalApiKeysCrud["Admin"]["Read"]): InternalApiKey; protected _createInternalApiKeyFirstViewFromCrud(data: InternalApiKeyCreateCrudResponse): InternalApiKeyFirstView; listInternalApiKeys(): Promise; createInternalApiKey(options: InternalApiKeyCreateOptions): Promise; listEmailThemes(): Promise<{ id: string; displayName: string; }[]>; listEmailTemplates(): Promise<{ id: string; displayName: string; themeId?: string; tsxSource: string; }[]>; listWorkflows(): Promise; createWorkflow(options: { id: string; displayName?: string; source: string; }): Promise; updateWorkflowSource(workflowId: string, source: string): Promise; deleteWorkflow(workflowId: string): Promise; setWorkflowPaused(workflowId: string, isPaused: boolean): Promise; listWorkflowVersions(workflowId: string): Promise; listWorkflowRuns(workflowId: string, filter: AdminWorkflowRunsFilter & { includeState: true; }): Promise<{ runs: AdminWorkflowRunDetails[]; nextCursor: string | null; }>; listWorkflowRuns(workflowId: string, filter?: AdminWorkflowRunsFilter): Promise<{ runs: AdminWorkflowRun[]; nextCursor: string | null; }>; getWorkflowRun(runId: string): Promise; cancelWorkflowRuns(workflowId: string, filter?: { runKey?: string; runId?: string; state?: "queued" | "running" | "sleeping"; version?: number; }): Promise<{ canceledCount: number; }>; upgradeWorkflowRuns(workflowId: string, options: { toVersion: number; runKey?: string; fromVersion?: number; }): Promise; retryWorkflowRun(runId: string): Promise; sendWorkflowEvent(name: string, data?: unknown): Promise<{ eventId: string; }>; listEmailDrafts(): Promise<{ id: string; displayName: string; themeId: string | undefined | false; tsxSource: string; sentAt: Date | null; }[]>; createTeamPermissionDefinition(data: AdminTeamPermissionDefinitionCreateOptions): Promise; updateTeamPermissionDefinition(permissionId: string, data: AdminTeamPermissionDefinitionUpdateOptions): Promise; deleteTeamPermissionDefinition(permissionId: string): Promise; listTeamPermissionDefinitions(): Promise; listTeamPermissionDefinitionsPaginated(options: { limit: number; cursor?: string; query?: string; }): Promise<{ items: AdminTeamPermissionDefinition[]; nextCursor: string | null; }>; createProjectPermissionDefinition(data: AdminProjectPermissionDefinitionCreateOptions): Promise; updateProjectPermissionDefinition(permissionId: string, data: AdminProjectPermissionDefinitionUpdateOptions): Promise; deleteProjectPermissionDefinition(permissionId: string): Promise; listProjectPermissionDefinitions(): Promise; protected _refreshProject(): Promise; protected _refreshProjectConfig(): Promise; protected _refreshInternalApiKeys(): Promise; protected _refreshUsers(): Promise; get [hexclaveAppInternalsSymbol](): { toClientJson: () => { baseUrl?: string | { browser: string; server: string; }; extraRequestHeaders?: Record; projectId?: ProjectId | undefined; publishableClientKey?: string; urls?: import("@hexclave/shared/dist/handler-urls-BHt3v8Ai").i; oauthScopesOnSignIn?: Partial; tokenStore?: TokenStoreInit | undefined; redirectMethod?: RedirectMethod; inheritsFrom?: StackClientApp; devTool?: boolean | "auto"; noAutomaticPrefetch?: boolean; automaticSideEffects?: boolean; analytics?: AnalyticsOptions; } & { tokenStore: TokenStoreInit; } & (string extends ProjectId ? unknown : { projectId: ProjectId; } | { inheritsFrom: StackClientApp; }) & { inheritsFrom?: undefined; } & { uniqueIdentifier: string; }; setCurrentUser: (userJsonPromise: Promise) => void; getConstructorOptions: () => { baseUrl?: string | { browser: string; server: string; }; extraRequestHeaders?: Record; projectId?: ProjectId | undefined; publishableClientKey?: string; urls?: import("@hexclave/shared/dist/handler-urls-BHt3v8Ai").i; oauthScopesOnSignIn?: Partial; tokenStore?: TokenStoreInit | undefined; redirectMethod?: RedirectMethod; inheritsFrom?: StackClientApp; devTool?: boolean | "auto"; noAutomaticPrefetch?: boolean; automaticSideEffects?: boolean; analytics?: AnalyticsOptions; } & { tokenStore: TokenStoreInit; } & (string extends ProjectId ? unknown : { projectId: ProjectId; } | { inheritsFrom: StackClientApp; }) & { inheritsFrom?: undefined; }; sendSessionReplayBatch: (body: string, options: { keepalive: boolean; }) => Promise>; sendAnalyticsEventBatch: (body: string, options: { keepalive: boolean; }) => Promise>; addRequestListener: (listener: import("@hexclave/shared/dist/client-interface-BoIICu7a").a) => () => void; sendRequest: (path: string, requestOptions: RequestInit, requestType?: "client" | "server" | "admin") => Promise; getUrls: () => Readonly; getRedirectMethod: () => RedirectMethod; redirectToUrl: (url: string | URL, options?: { replace?: boolean; } | undefined) => Promise; getRedirectToHandlerUrl: (handlerName: keyof import("@hexclave/shared/dist/handler-urls-BHt3v8Ai").o, options?: RedirectToOptions) => Promise; redirectToHandler: (handlerName: keyof import("@hexclave/shared/dist/handler-urls-BHt3v8Ai").o, options?: RedirectToOptions) => Promise; getRawAfterAuthReturnTo: () => string | null; refreshOwnedProjects: () => Promise; signInWithTokens: (tokens: { accessToken: string; refreshToken: string; }) => Promise; awaitPendingAuthResolutions: () => Promise; isTrustedRedirectUrl: (url: string) => Promise; }; sendTestEmail(options: { recipientEmail: string; emailConfig: EmailConfig; }): Promise>; sendTestWebhook(options: { endpointId: string; }): Promise>; listSentEmails(): Promise; setupManagedEmailProvider(options: { subdomain: string; senderLocalPart: string; }): Promise; checkManagedEmailStatus(options: { domainId: string; subdomain: string; senderLocalPart: string; }): Promise; listManagedEmailDomains(): Promise; applyManagedEmailProvider(options: { domainId: string; }): Promise<{ status: "applied"; }>; deleteManagedEmailDomain(options: { resendDomainId: string; }): Promise<{ status: "deleted"; }>; sendSignInInvitationEmail(email: string, callbackUrl: string): Promise; createEmailTemplate(displayName: string): Promise<{ id: string; }>; deleteEmailTemplate(id: string): Promise; createEmailDraft(options: { displayName: string; themeId?: string | false; tsxSource?: string; }): Promise<{ id: string; }>; updateEmailDraft(id: string, data: { displayName?: string; themeId?: string | undefined | false; tsxSource?: string; }): Promise; deleteEmailDraft(id: string): Promise; refreshEmailDrafts(): Promise; saveChatMessage(threadId: string, message: any): Promise; listChatMessages(threadId: string): Promise<{ messages: Array; }>; rewriteTemplateSourceWithAI(templateTsxSource: string): Promise<{ tsxSource: string; }>; createEmailTheme(displayName: string): Promise<{ id: string; }>; getEmailPreview(options: { themeId?: string | null | false; themeTsxSource?: string; templateId?: string; templateTsxSource?: string; }): Promise; getEmailPreviewWithEditableMarkers(options: { themeId?: string | null | false; themeTsxSource?: string; templateId?: string; templateTsxSource?: string; editableSource?: 'template' | 'theme' | 'both'; }): Promise<{ html: string; editableRegions?: Record; }>; updateEmailTheme(id: string, tsxSource: string): Promise; deleteEmailTheme(id: string): Promise; updateEmailTemplate(id: string, tsxSource: string, themeId: string | null | false): Promise<{ renderedHtml: string; }>; setupPayments(): Promise<{ url: string; }>; createStripeWidgetAccountSession(): Promise<{ client_secret: string; }>; getPaymentMethodConfigs(): Promise<{ configId: string; methods: Array<{ id: string; name: string; enabled: boolean; available: boolean; overridable: boolean; }>; } | null>; updatePaymentMethodConfigs(configId: string, updates: Record): Promise; createItemQuantityChange(options: ({ userId: string; itemId: string; quantity: number; expiresAt?: string; description?: string; } | { teamId: string; itemId: string; quantity: number; expiresAt?: string; description?: string; } | { customCustomerId: string; itemId: string; quantity: number; expiresAt?: string; description?: string; })): Promise; refundTransaction(options: { type: "subscription" | "one-time-purchase"; id: string; invoiceId?: string; amountUsd: MoneyAmount; endAction?: "now" | "at-period-end"; }): Promise<{ refundTransactionId: string; }>; listTransactions(params: { cursor?: string; limit?: number; type?: TransactionType; customerType?: 'user' | 'team' | 'custom'; customerId?: string; }): Promise<{ transactions: Transaction[]; nextCursor: string | null; }>; private _emailOutboxCrudToAdmin; listOutboxEmails(options?: { status?: string; simpleStatus?: string; userId?: string; limit?: number; cursor?: string; }): Promise<{ items: AdminEmailOutbox[]; nextCursor: string | null; }>; getOutboxEmail(id: string): Promise; updateOutboxEmail(id: string, options: EmailOutboxUpdateOptions): Promise; pauseOutboxEmail(id: string): Promise; unpauseOutboxEmail(id: string): Promise; cancelOutboxEmail(id: string): Promise; getStripeAccountInfo(): Promise; getAnalyticsClickmap(options: AnalyticsClickmapOptions): Promise; createAnalyticsClickmapToken(options: { origin: string; }): Promise; listSessionReplays(options?: ListSessionReplaysOptions): Promise; getSessionReplay(sessionReplayId: string): Promise; listSessionReplayChunks(sessionReplayId: string, options?: ListSessionReplayChunksOptions): Promise; getSessionReplayChunkEvents(sessionReplayId: string, chunkId: string): Promise; getSessionReplayEvents(sessionReplayId: string, options?: { offset?: number; limit?: number; }): Promise; previewAffectedUsersByOnboardingChange(onboarding: { requireEmailVerification?: boolean; }, limit?: number): Promise<{ affectedUsers: Array<{ id: string; displayName: string | null; primaryEmail: string | null; restrictedReason: RestrictedReason; }>; totalAffectedCount: number; }>; } //#endregion export { stripBrowserActionQueryParam as i, _HexclaveServerAppImplIncomplete as n, _HexclaveClientAppImplIncomplete as r, _HexclaveAdminAppImplIncomplete as t }; //# sourceMappingURL=admin-app-impl-B5Q290nf.d.ts.map