import Request from 'ff-request'; import { AxiosStatic } from 'axios'; import MockAdapter from 'axios-mock-adapter'; import React from 'react'; declare const _default$3: any; // ===== 用户数据结构(复用类型,JSDoc 无法跨文件引用,放 .d.ts) ===== interface UserRoleBinding { user_uuid: string role_uuid: string created_at: string updated_at: string created_user: string owned_user: string } interface UserInfo { uuid: string username: string nickname: string email: string last_login_ip: string is_active: 0 | 1 UserRole: UserRoleBinding[] [key: string]: unknown } // ===== http — Proxy 模式产生交叉类型,JSDoc 无法表达 ===== /** 每次请求自动附加的请求头 */ interface HttpHeaders { /** 客户端平台标识,固定为 'web' */ Platform: string /** SaaS 租户标识,单租户时为 null */ SaaS: string | null /** JWT Bearer token,未登录时为 undefined */ Authorization: string | undefined } // ===== func — ff-worker-pipe 无类型文件,显式声明 ===== /** * 基于 Worker 的表达式执行引擎单例; * exec 在独立 Worker 上下文中求值一段 JS 表达式/源码 */ interface WorkerPipeInstance { /** * 在 Worker 上下文中执行一段 JS 表达式 * @param expression 要执行的表达式字符串 * @param args 传给表达式的参数(可在表达式内作为第一个参数使用) * @param fns 注入到表达式执行作用域的额外可调用函数 * @param session 会话标识;相同 session 共享 Worker 侧工作区(this) */ exec: ( expression: string, args?: Record, fns?: Record, session?: string ) => Promise /** 清除指定 session 的 Worker 侧工作区 */ clear: (session: string) => void } declare const _default$2: Http & Request; /** * 应用统一的 HTTP 客户端单例;自身只实现 init/driver/headers/mock/unmock, * 其余属性通过 Proxy 代理到内部的 ff-request 实例(HttpRequest), * 所以 get/post/del 等请求方法可以直接在这个单例上调用 */ declare class Http { static "__#private@#instance": any; static "__#private@#core": any; /** @returns {Http & Request} 单例实例 */ static getInstance: () => Http & Request; appUrl: string; /** * 初始化(设置请求 baseURL/超时,并初始化内部 ff-request 实例) * @param {string} appKey * @param {string} appSecret * @param {string} appUrl 接口请求的 baseURL */ init(appKey: string, appSecret: string, appUrl: string): void; /** @returns {AxiosStatic} */ get driver(): AxiosStatic; /** @returns {HttpHeaders} */ get headers(): HttpHeaders; /** * 开启请求 mock(基于 axios-mock-adapter),未匹配的请求会透传到真实接口 * @param {Object} [opt] 传给 MockAdapter 的选项 * @returns {MockAdapter} mock 适配器实例,用于注册具体的 mock 规则 */ mock(opt?: any): MockAdapter; /** 关闭并清除 mock */ unmock(): void; #private; } declare class Cache { constructor(target: any, fn: any); get: (...args: any[]) => Promise; #private; } declare const _default$1: any; /** @type {WorkerPipeInstance} */ declare const pipe: WorkerPipeInstance; declare const _default: any; /** @type {React.Context<{ user: UserInfo, initUser: () => void, initUserComplete: boolean }>} */ declare const AppContext: React.Context<{ user: UserInfo; initUser: () => void; initUserComplete: boolean; }>; /** @type {React.Context<{ set: (...args: unknown[]) => unknown, get: (...args: unknown[]) => unknown, assign: (...args: unknown[]) => unknown, currentRoute: (...args: unknown[]) => unknown }>} */ declare const AppGlobalParamsContext: React.Context<{ set: (...args: unknown[]) => unknown; get: (...args: unknown[]) => unknown; assign: (...args: unknown[]) => unknown; currentRoute: (...args: unknown[]) => unknown; }>; /** * 判断是否是 React 组件(大写字母开头的函数 / forwardRef / memo 等) * @param {unknown} component 要判断的值 * @returns {boolean} */ declare function isReactComponent(component: unknown): boolean; /** * 向 document.head 注入一段 CSS;id 相同时更新已有 style 标签 * @param {string} css 要注入的 CSS 字符串 * @param {string} id style 标签的唯一标识 * @returns {string | undefined} 注入的 CSS 字符串,无法注入时返回 undefined */ declare function insertStyle(css: string, id: string): string | undefined; export { AppContext, AppGlobalParamsContext, Cache as cache, _default$1 as configure, _default$3 as default, pipe as func, _default$2 as http, insertStyle, isReactComponent, _default as route };