refactor(core/http): 7大通信底座客户端语义化全量重构与合思开放文档客户端纳管
- 彻底移除旧内部狭隘命名与垫片包袱,一步到位全仓整体重命名: * session-client.ts ➔ hose-web-session-client.ts (合思 Web 主站会话客户端) * script-engine-client.ts ➔ piper-workflow-client.ts (Piper 工作流引擎客户端) * unity-client.ts ➔ unity-easo-client.ts (Unity / EASO 运营中台与动态集群客户端) * sso-client.ts ➔ sso-auth-client.ts (SSO 与扫码鉴权客户端) - 新增 hose-docs-client.ts 纳为第 7 大通信底座客户端,收口 docs.ekuaibao.com 文档站点通信 - 端正 Piper 工作流引擎定位,完整覆盖工作流创建、保存、发布、108 类节点编排与 Job 流转 - 彻底整体替换全仓 import 引用与测试套件,新增 clients-semantics.test.ts 自动化校验 - 全量自动化测试 150 files 1155 tests 全部通过,类型检查零错误
This commit is contained in:
1 parent
62b47f5ad7
commit
42bf0bfb0b
44 files changed
+400
-171
No files matched your search
+9
-11
@@ -1,12 +1,15 @@
|
||||
import ky from "ky";
|
||||
import { EkbApiError } from "../../core/errors.js";
|
||||
import {
|
||||
createHoseDocsClient,
|
||||
DEFAULT_HOSE_DOCS_BASE_URL,
|
||||
} from "../../core/http/hose-docs-client.js";
|
||||
import {
|
||||
DocCatalogSchema,
|
||||
type DocCatalog,
|
||||
type OpenApiDocItem,
|
||||
} from "./types.js";
|
||||
|
||||
export const DEFAULT_DOCS_BASE_URL = "https://docs.ekuaibao.com";
|
||||
export const DEFAULT_DOCS_BASE_URL = DEFAULT_HOSE_DOCS_BASE_URL;
|
||||
|
||||
interface RawSearchDoc {
|
||||
i: number;
|
||||
@@ -142,16 +145,11 @@ export async function fetchLiveDocsCatalog(options?: {
|
||||
}): Promise<DocCatalog> {
|
||||
const baseUrl = options?.baseUrl || DEFAULT_DOCS_BASE_URL;
|
||||
const timeoutMs = options?.timeoutMs ?? 15000;
|
||||
const targetUrl = `${baseUrl.replace(/\/+$/, "")}/search-index.json`;
|
||||
const client = createHoseDocsClient({ baseUrl, timeout: timeoutMs });
|
||||
|
||||
try {
|
||||
const response = await ky.get(targetUrl, {
|
||||
timeout: timeoutMs,
|
||||
headers: {
|
||||
Accept: "application/json",
|
||||
"User-Agent": "hose-use/docs-client",
|
||||
},
|
||||
});
|
||||
const response = await client.get("search-index.json");
|
||||
|
||||
|
||||
if (!response.ok) {
|
||||
throw new EkbApiError(
|
||||
@@ -173,7 +171,7 @@ export async function fetchLiveDocsCatalog(options?: {
|
||||
} catch (error: any) {
|
||||
if (error instanceof EkbApiError) throw error;
|
||||
throw new EkbApiError(
|
||||
`请求开放平台文档站点 (${targetUrl}) 失败: ${error?.message || String(error)}`,
|
||||
`请求开放平台文档站点 (${baseUrl}/search-index.json) 失败: ${error?.message || String(error)}`,
|
||||
"DOCS_NETWORK_ERROR",
|
||||
502
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user