//=========================================== // THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY UNLESS YOU ALSO EDIT THE CORRESPONDING FILE IN packages/template //=========================================== import { KnownErrors } from "@hexclave/shared"; import { Result } from "@hexclave/shared/dist/utils/results"; import type { GenericQueryCtx } from "convex/server"; import type { AnalyticsQueryOptions, AnalyticsQueryResponse } from "@hexclave/shared/dist/interface/crud/analytics"; import { AsyncStoreProperty, GetCurrentPartialUserOptions, GetCurrentUserOptions } from "../../common"; import { CustomerProductsList, CustomerProductsRequestOptions, InlineProduct, ServerItem } from "../../customers"; import { DataVaultStore } from "../../data-vault"; import { EmailDeliveryInfo, SendEmailOptions } from "../../email"; import { ServerListTeamsOptions, ServerListUsersOptions, ServerTeam, ServerTeamCreateOptions } from "../../teams"; import { ProjectCurrentServerUser, ServerOAuthProvider, ServerUser, ServerUserCreateOptions, SyncedPartialServerUser, TokenPartialUser } from "../../users"; import { _HexclaveServerAppImpl } from "../implementations"; import { StackClientApp, StackClientAppConstructorOptions } from "./client-app"; /** @deprecated Use `HexclaveServerAppConstructorOptions` from the `@hexclave/*` package instead — same symbol, new brand name. See https://docs.hexclave.com/migration. */ export type StackServerAppConstructorOptions = StackClientAppConstructorOptions & { secretServerKey?: string, }; /** @deprecated Use `HexclaveServerApp` from the `@hexclave/*` package instead — same symbol, new brand name. See https://docs.hexclave.com/migration. */ export type StackServerApp = ( & { createTeam(data: ServerTeamCreateOptions): Promise, /** * @deprecated use `getUser()` instead */ getServerUser(): Promise | null>, createUser(options: ServerUserCreateOptions): Promise, 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, 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, or?: "return-null" | "anonymous" }): Promise, getUser(options: { from: "convex", ctx: GenericQueryCtx, or?: "return-null" | "anonymous" }): Promise, // note: we don't special-case 'anonymous' here to return non-null, see GetPartialUserOptions for more details getPartialUser(options: GetCurrentPartialUserOptions & { from: 'token' }): Promise, getPartialUser(options: GetCurrentPartialUserOptions & { from: 'convex' }): Promise, getPartialUser(options: GetCurrentPartialUserOptions): Promise, getTeam(id: string): Promise, getTeam(options: { apiKey: string }): Promise, listUsers(options?: ServerListUsersOptions): Promise, /** * Returns every direct (or recursive) team permission grant for every * member of the given team in one request. Use this instead of calling * `user.listPermissions(team)` per row when rendering a roster — that * pattern produces an N+1 over the team-member endpoint. */ listTeamMemberPermissions(teamId: string, options?: { recursive?: boolean }): Promise<{ userId: string, permissionId: string }[]>, // TODO this should actually be on ServerUser createOAuthProvider(options: { userId: string, accountId: string, providerConfigId: string, email: string, allowSignIn: boolean, allowConnectedAccounts: boolean, }): Promise>>, sendEmail(options: SendEmailOptions): Promise, getEmailDeliveryStats(): Promise, activateEmailCapacityBoost(): Promise, queryAnalytics(options: AnalyticsQueryOptions): Promise, } & AsyncStoreProperty<"user", [id: string], ServerUser | null, false> & Omit, "listUsers" | "useUsers"> & AsyncStoreProperty<"teams", [options?: ServerListTeamsOptions], ServerTeam[] & { nextCursor: string | null }, true> & AsyncStoreProperty<"dataVaultStore", [id: string], DataVaultStore, false> & AsyncStoreProperty< "item", [{ itemId: string, userId: string } | { itemId: string, teamId: string } | { itemId: string, customCustomerId: string }], ServerItem, false > & AsyncStoreProperty< "products", [options: CustomerProductsRequestOptions], CustomerProductsList, true > & StackClientApp ); /** @deprecated Use `HexclaveServerAppConstructor` from the `@hexclave/*` package instead — same symbol, new brand name. See https://docs.hexclave.com/migration. */ export type StackServerAppConstructor = { new < TokenStoreType extends string, HasTokenStore extends (TokenStoreType extends {} ? true : boolean), ProjectId extends string >(options: StackServerAppConstructorOptions): StackServerApp, new (options: StackServerAppConstructorOptions): StackServerApp, }; export type HexclaveServerAppConstructorOptions = StackServerAppConstructorOptions; export type HexclaveServerApp = StackServerApp; export type HexclaveServerAppConstructor = StackServerAppConstructor; export const HexclaveServerApp: HexclaveServerAppConstructor = _HexclaveServerAppImpl; /** @deprecated Use `HexclaveServerApp` from the `@hexclave/*` package instead — same symbol, new brand name. See https://docs.hexclave.com/migration. */ export const StackServerApp: StackServerAppConstructor = HexclaveServerApp;