import type { ComputedRef, Ref, ToRefs } from 'vue' import type { WritableComputedRef } from '@vue/reactivity' import type { JwtPayload } from 'jwt-decode' import type { ProjectRoles } from 'nocodb-sdk' import type { Language, NcProjectType, User, useCounter } from '#imports' export interface AppInfo { ncSiteUrl: string authType: 'jwt' | 'none' connectToExternalDB: boolean defaultLimit: number defaultGroupByLimit: { limitGroup: number limitRecord: number } firstUser: boolean githubAuthEnabled: boolean googleAuthEnabled: boolean oidcAuthEnabled: boolean oidcProviderName: string | null ncMin: boolean oneClick: boolean baseHasAdmin: boolean teleEnabled: boolean auditEnabled: boolean type: string version: string ee?: boolean ncAttachmentFieldSize: number ncMaxAttachmentsAllowed: number isCloud: boolean automationLogLevel: 'OFF' | 'ERROR' | 'ALL' baseHostName?: string disableEmailAuth: boolean mainSubDomain?: string dashboardPath: string inviteOnlySignup: boolean samlAuthEnabled: boolean samlProviderName: string | null } export interface StoredState { token: string | null lang: keyof typeof Language darkMode: boolean filterAutoSave: boolean previewAs: ProjectRoles | null includeM2M: boolean showNull: boolean currentVersion: string | null latestRelease: string | null hiddenRelease: string | null isMobileMode: boolean | null lastOpenedWorkspaceId: string | null } export type State = ToRefs> & { storage: Ref user: Ref token: WritableComputedRef jwtPayload: ComputedRef<(JwtPayload & User) | null> timestamp: Ref runningRequests: ReturnType error: Ref appInfo: Ref } export interface Getters { signedIn: ComputedRef isLoading: WritableComputedRef } export interface Actions { signOut: (skipRedirect?: boolean) => void signIn: (token: string, keepProps?: boolean) => void refreshToken: () => void loadAppInfo: () => void setIsMobileMode: (isMobileMode: boolean) => void navigateToProject: (params: { workspaceId?: string; baseId?: string; type?: NcProjectType; query?: any }) => void ncNavigateTo: (params: { workspaceId?: string baseId?: string type?: NcProjectType query?: any tableId?: string viewId?: string }) => void getBaseUrl: (workspaceId: string) => string | undefined getMainUrl: (workspaceId: string) => string | undefined } export type ReadonlyState = Readonly> & Omit export type UseGlobalReturn = Getters & Actions & ReadonlyState