import { n as Result } from "./results-DP3BzoL6.js"; import { n as ReadonlyJson } from "./json-a1QIXu5z.js"; import { a as KnownErrors } from "./known-errors-C-1Klj6h.js"; import { Z as inlineProductSchema } from "./schema-fields-Din3rFg5.js"; import { i as RefreshToken, r as InternalSession, t as AccessToken } from "./sessions-DofA-1Lc.js"; import { n as ProjectPermissionsCrud } from "./project-permissions-kdi675F-.js"; import { n as ClientProjectsCrud, t as AdminUserProjectsCrud } from "./projects-BMqpwc-l.js"; import { n as TeamPermissionsCrud } from "./team-permissions-DqOpaOWh.js"; import { a as RegistrationResponseJSON, i as PublicKeyCredentialRequestOptionsJSON, r as PublicKeyCredentialCreationOptionsJSON, t as AuthenticationResponseJSON } from "./passkey-CKg87UH-.js"; import { n as ConnectedAccountCrud, t as ConnectedAccountAccessTokenCrud } from "./connected-accounts-D5CKe50A.js"; import { t as ContactChannelsCrud } from "./contact-channels-DW8yQxlc.js"; import { t as CurrentUserCrud } from "./current-user-CflrSNFF.js"; import { n as CustomerInvoicesListResponse, r as ListCustomerInvoicesOptions } from "./invoices-VJ0aTfQQ.js"; import { t as ItemCrud } from "./items-DlLSlVUD.js"; import { t as NotificationPreferenceCrud } from "./notification-preferences-Bmzr_EOY.js"; import { t as OAuthProviderCrud } from "./oauth-providers-BMkKSSlA.js"; import { n as CustomerProductsListResponse, r as ListCustomerProductsOptions } from "./products-Bu1bLA3G.js"; import { i as teamApiKeysCreateOutputSchema, n as UserApiKeysCrud, o as userApiKeysCreateInputSchema, r as teamApiKeysCreateInputSchema, s as userApiKeysCreateOutputSchema, t as TeamApiKeysCrud } from "./project-api-keys-C9H1c6rL.js"; import { t as SessionsCrud } from "./sessions-B7Ko2Ldr.js"; import { t as TeamInvitationCrud } from "./team-invitation-Cyqt9oWw.js"; import { t as TeamMemberProfilesCrud } from "./team-member-profiles-DQ17j6Hg.js"; import { t as TeamsCrud } from "./teams-CQMcBnjM.js"; import * as yup$1 from "yup"; //#region src/interface/client-interface.d.ts type ApiUrlFailure = { url: string; error: Error; }; declare class ApiUrlsFailedError extends AggregateError { readonly urlFailures: readonly ApiUrlFailure[]; readonly digest?: unknown; constructor(urlFailures: readonly ApiUrlFailure[]); } type RequestLogEntry = { path: string; method: string; status?: number; duration: number; error?: string; }; type RequestListener = (entry: RequestLogEntry) => void; type ClientInterfaceOptions = { clientVersion: string; getBaseUrl: () => string; getAnalyticsBaseUrl?: () => string; /** * Ordered list of base URLs for request routing with fallback. * Index 0 = primary, index 1..N = fallbacks in priority order. * A single-element array means no fallback occurs. */ getApiUrls: () => string[]; extraRequestHeaders: Record; projectId: string; prepareRequest?: () => Promise; } & ({ publishableClientKey?: string; } | { projectOwnerSession: InternalSession | (() => Promise); }); type BotChallengeInput = { token?: string; phase?: "invisible" | "visible"; unavailable?: true; }; declare class HexclaveClientInterface { readonly options: ClientInterfaceOptions; private pendingNetworkDiagnostics?; private _requestListeners; /** * Last API URL that succeeded for this client. Requests start here and only * move to the next URL in the ring when the current host looks like an outage. * Null means we have never succeeded yet — start at the primary (index 0). */ private _currentTargetApiUrl; constructor(options: ClientInterfaceOptions); addRequestListener(listener: RequestListener): () => void; get projectId(): string; getApiUrl(): string; getApiUrls(): string[]; /** * Returns the current target API URL for browser-navigated URLs (e.g. OAuth * authorize) where `_withFallback` can't iterate hosts. Falls back to the * primary if the remembered URL is no longer in the list. */ getCurrentTargetApiUrl(): string; /** * @deprecated Use {@link getCurrentTargetApiUrl} instead. */ getBestApiUrl(): string; /** * Routes a request through an ordered URL ring with automatic failover. * * Starts at `_currentTargetApiUrl` (or primary if unset). On an outage-like * failure, walks `(start + k) % n` for two full laps. On success, remembers * that URL as the new current target. KnownErrors and smart-wrapped 4xx * responses are never retried on another host (application-level errors). * * Single-URL lists skip the ring and use 5-retry behavior directly. */ protected _withFallback(cb: (apiUrl: string, retryOptions: { maxAttempts: number; skipDiagnostics: boolean; }) => Promise): Promise; /** * Returns true when the error is an application-level response that should * not hop to another host. Outages (network TypeError, 5xx, non-smart 4xx) * return false so the ring walk continues. */ private _shouldSkipFallback; private _isSmartWrappedResponse; private _getApiResponseFromError; getAnalyticsApiUrl(): string; runNetworkDiagnostics(session?: InternalSession | null, requestType?: "client" | "server" | "admin"): Promise<{ "navigator?.onLine": any; cfTrace: string; baseUrlBackend: string; prodDashboard: string; prodBackend: string; }>; private _runNetworkDiagnosticsInner; protected _createNetworkError(cause: Error, session?: InternalSession | null, requestType?: "client" | "server" | "admin"): Promise; protected _networkRetry(cb: () => Promise>, session?: InternalSession | null, requestType?: "client" | "server" | "admin", options?: { maxAttempts?: number; skipDiagnostics?: boolean; }): Promise; protected _networkRetryException(cb: () => Promise, session?: InternalSession | null, requestType?: "client" | "server" | "admin", options?: { maxAttempts?: number; skipDiagnostics?: boolean; }): Promise; fetchNewAccessToken(refreshToken: RefreshToken): Promise; private _fetchNewAccessTokenInner; sendClientRequest(path: string, requestOptions: RequestInit, session: InternalSession | null, requestType?: "client" | "server" | "admin", apiUrlOverride?: string, retryOptions?: { maxAttempts?: number; skipDiagnostics?: boolean; }): Promise; createSession(options: Omit[0], "refreshAccessTokenCallback">): InternalSession; sendSessionReplayBatch(body: string, session: InternalSession | null, options: { keepalive: boolean; }): Promise>; sendAnalyticsEventBatch(body: string, session: InternalSession | null, options: { keepalive: boolean; }): Promise>; protected sendClientRequestAndCatchKnownError(path: string, requestOptions: RequestInit, tokenStoreOrNull: InternalSession | null, errorsToCatch: readonly E[]): Promise>>; private sendClientRequestInner; private _preprocessResponse; private _processResponse; checkFeatureSupport(options: { featureName?: string; } & ReadonlyJson): Promise; consumeBrowserAction(actionId: string, session?: InternalSession | null): Promise<{ javascript: string; }>; sendForgotPasswordEmail(email: string, callbackUrl: string): Promise>; sendVerificationEmail(email: string, callbackUrl: string, session: InternalSession): Promise; sendMagicLinkEmail(email: string, callbackUrl: string, botChallenge?: BotChallengeInput): Promise>; resetPassword(options: { code: string; } & ({ password: string; } | { onlyVerifyCode: true; })): Promise>; updatePassword(options: { oldPassword: string; newPassword: string; }, session: InternalSession): Promise; setPassword(options: { password: string; }, session: InternalSession): Promise; verifyPasswordResetCode(code: string): Promise>; verifyEmail(code: string): Promise>; initiatePasskeyRegistration(options: {}, session: InternalSession): Promise>; registerPasskey(options: { credential: RegistrationResponseJSON; code: string; }, session: InternalSession): Promise>; initiatePasskeyAuthentication(options: {}, session: InternalSession): Promise>; sendTeamInvitation(options: { email: string; teamId: string; callbackUrl: string; session: InternalSession; }): Promise; acceptTeamInvitation(options: { code: string; session: InternalSession; type: T; }): Promise>; totpMfa(attemptCode: string, totp: string, session: InternalSession): Promise<{ accessToken: any; refreshToken: any; newUser: any; }>; signInWithCredential(email: string, password: string, session: InternalSession): Promise>; signUpWithCredential(email: string, password: string, emailVerificationRedirectUrl: string | undefined, session: InternalSession, botChallenge?: BotChallengeInput): Promise>; signUpAnonymously(session: InternalSession): Promise>; signInWithMagicLink(code: string, session: InternalSession): Promise>; signInWithMfa(totp: string, code: string, session: InternalSession): Promise>; signInWithPasskey(body: { authentication_response: AuthenticationResponseJSON; code: string; }, session: InternalSession): Promise>; getOAuthUrl(options: { provider: string; redirectUrl: string; errorRedirectUrl: string; afterCallbackRedirectUrl?: string; codeChallenge: string; state: string; type: "authenticate" | "link"; providerScope?: string; botChallenge?: BotChallengeInput; session: InternalSession; }): Promise; authorizeOAuth(options: { provider: string; redirectUrl: string; errorRedirectUrl: string; afterCallbackRedirectUrl?: string; codeChallenge: string; state: string; type: "authenticate" | "link"; providerScope?: string; botChallenge?: BotChallengeInput; session: InternalSession; }): Promise>; callOAuthCallback(options: { oauthParams: URLSearchParams; redirectUri: string; codeVerifier: string; state: string; }): Promise<{ newUser: boolean; afterCallbackRedirectUrl?: string; accessToken: string; refreshToken: string; }>; private _callOAuthCallbackInner; signOut(session: InternalSession): Promise; getClientUserByToken(session: InternalSession): Promise; listTeamInvitations(options: { teamId: string; }, session: InternalSession): Promise; listCurrentUserTeamInvitations(session: InternalSession): Promise; acceptTeamInvitationById(invitationId: string, session: InternalSession): Promise; revokeTeamInvitation(invitationId: string, teamId: string, session: InternalSession): Promise; listTeamMemberProfiles(options: { teamId?: string; userId?: string; }, session: InternalSession): Promise; getTeamMemberProfile(options: { teamId: string; userId: string; }, session: InternalSession): Promise; leaveTeam(teamId: string, session: InternalSession): Promise; removeUserFromTeam(teamId: string, userId: string, session: InternalSession): Promise; updateTeamMemberProfile(options: { teamId: string; userId: string; profile: TeamMemberProfilesCrud['Client']['Update']; }, session: InternalSession): Promise; updateTeam(options: { teamId: string; data: TeamsCrud['Client']['Update']; }, session: InternalSession): Promise; listCurrentUserTeamPermissions(options: { teamId: string; recursive: boolean; }, session: InternalSession): Promise; listCurrentUserProjectPermissions(options: { recursive: boolean; }, session: InternalSession): Promise; listCurrentUserTeams(session: InternalSession): Promise; getClientProject(): Promise>; updateClientUser(update: CurrentUserCrud["Client"]["Update"], session: InternalSession): Promise; listProjects(session: InternalSession): Promise; createProject(project: AdminUserProjectsCrud['Client']['Create'], session: InternalSession): Promise; createProviderAccessToken(provider: string, scope: string, session: InternalSession): 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. */ createProviderAccessTokenByAccount(providerId: string, providerAccountId: string, scope: string, session: InternalSession): Promise; /** * List all connected accounts for the current user. */ listConnectedAccounts(session: InternalSession): Promise; createClientTeam(data: TeamsCrud['Client']['Create'], session: InternalSession): Promise; deleteTeam(teamId: string, session: InternalSession): Promise; deleteCurrentUser(session: InternalSession): Promise; createClientContactChannel(data: ContactChannelsCrud['Client']['Create'], session: InternalSession): Promise; updateClientContactChannel(id: string, data: ContactChannelsCrud['Client']['Update'], session: InternalSession): Promise; deleteClientContactChannel(id: string, session: InternalSession): Promise; deleteSession(sessionId: string, session: InternalSession): Promise; listSessions(session: InternalSession): Promise; listClientContactChannels(session: InternalSession): Promise; sendCurrentUserContactChannelVerificationEmail(contactChannelId: string, callbackUrl: string, session: InternalSession): Promise>; cliLogin(loginCode: string, refreshToken: string, session: InternalSession): Promise>; private _getApiKeyRequestInfo; listProjectApiKeys(options: { user_id: string; }, session: InternalSession | null, requestType: "client" | "server" | "admin"): Promise; listProjectApiKeys(options: { team_id: string; }, session: InternalSession | null, requestType: "client" | "server" | "admin"): Promise; listProjectApiKeys(options: { user_id: string; } | { team_id: string; }, session: InternalSession | null, requestType: "client" | "server" | "admin"): Promise<(UserApiKeysCrud['Client']['Read'] | TeamApiKeysCrud['Client']['Read'])[]>; createProjectApiKey(data: yup$1.InferType, session: InternalSession | null, requestType: "client" | "server" | "admin"): Promise>; createProjectApiKey(data: yup$1.InferType, session: InternalSession | null, requestType: "client" | "server" | "admin"): Promise>; createProjectApiKey(data: yup$1.InferType | yup$1.InferType, session: InternalSession | null, requestType: "client" | "server" | "admin"): Promise | yup$1.InferType>; getProjectApiKey(options: { user_id: string | null; }, keyId: string, session: InternalSession | null, requestType: "client" | "server" | "admin"): Promise; getProjectApiKey(options: { team_id: string; }, keyId: string, session: InternalSession | null, requestType: "client" | "server" | "admin"): Promise; getProjectApiKey(options: { user_id: string | null; } | { team_id: string; }, keyId: string, session: InternalSession | null, requestType: "client" | "server" | "admin"): Promise; updateProjectApiKey(options: { user_id: string; }, keyId: string, data: UserApiKeysCrud['Client']['Update'], session: InternalSession | null, requestType: "client" | "server" | "admin"): Promise; updateProjectApiKey(options: { team_id: string; }, keyId: string, data: TeamApiKeysCrud['Client']['Update'], session: InternalSession | null, requestType: "client" | "server" | "admin"): Promise; updateProjectApiKey(options: { user_id: string; } | { team_id: string; }, keyId: string, data: UserApiKeysCrud['Client']['Update'] | TeamApiKeysCrud['Client']['Update'], session: InternalSession | null, requestType: "client" | "server" | "admin"): Promise; checkProjectApiKey(type: "user", apiKey: string, session: InternalSession | null, requestType: "client" | "server" | "admin"): Promise; checkProjectApiKey(type: "team", apiKey: string, session: InternalSession | null, requestType: "client" | "server" | "admin"): Promise; checkProjectApiKey(type: "user" | "team", apiKey: string, session: InternalSession | null, requestType: "client" | "server" | "admin"): Promise; listNotificationCategories(session: InternalSession): Promise; setNotificationsEnabled(notificationCategoryId: string, enabled: boolean, session: InternalSession): Promise; getOAuthProvider(userId: string, providerId: string, session: InternalSession): Promise; updateOAuthProvider(userId: string, providerId: string, data: OAuthProviderCrud['Client']['Update'], session: InternalSession): Promise; listOAuthProviders(options: { user_id?: string; } | undefined, session: InternalSession): Promise; deleteOAuthProvider(userId: string, providerId: string, session: InternalSession): Promise; getItem(options: ({ itemId: string; userId: string; } | { itemId: string; teamId: string; } | { itemId: string; customCustomerId: string; }), session: InternalSession | null, requestType?: "client" | "server" | "admin"): Promise; listProducts(options: ListCustomerProductsOptions, session: InternalSession | null, requestType?: "client" | "server" | "admin"): Promise; listInvoices(options: ListCustomerInvoicesOptions, session: InternalSession | null): Promise; cancelSubscription(options: { customer_type: "user" | "team" | "custom"; customer_id: string; product_id: string; subscription_id?: string; }, session: InternalSession | null): Promise; switchSubscription(options: { customer_type: "user" | "team"; customer_id: string; from_product_id: string; to_product_id: string; price_id?: string; quantity?: number; }, session: InternalSession | null): Promise; createCheckoutUrl(customer_type: "user" | "team" | "custom", customer_id: string, productIdOrInline: string | yup$1.InferType, session: InternalSession | null, returnUrl?: string, requestType?: "client" | "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; }; }>; transferProject(internalProjectSession: InternalSession, projectIdToTransfer: string, newTeamId: string): Promise; } //#endregion export { RequestListener as a, HexclaveClientInterface as i, ApiUrlsFailedError as n, RequestLogEntry as o, ClientInterfaceOptions as r, ApiUrlFailure as t }; //# sourceMappingURL=client-interface-DntDnV5l.d.ts.map