refactor: 拆分大文件(contracts 端点、整理服务、浏览器纯函数、整理弹窗来源)
- contracts/src/api.ts 2733 行 → api/*.ts 13 个领域文件 + shared.ts;api.ts 按原顺序合并 Api。 新旧对比:354 个端点内容与顺序一致,分组键与对外导出一致 - acquisition-organize/services/organize.ts 2645 行 → organize-types / -plan / -exec / -finalize / -records, organize.ts 保留为汇总入口,外部引用不变 - browser/service.ts 类外的纯函数(视图映射、原因文案、坐标换算、图片尺寸、出口代理)移到 session-view.ts, service.ts 照旧转出 - organize-wizard:来源解析 useResolvedSource 移到 source.ts,FormSelect 移到 form-select.tsx 只挪位置不改逻辑;typecheck、lint、test:all、web build、server 编译与编译产物自检通过。 Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
c9e8120fc6
commit
8bec4bad5d
26 files changed
+5906
-5696
No files matched your search
@@ -0,0 +1,95 @@
|
||||
import { CursorQuery, cursorPage, Id, IdParam } from "../common.ts";
|
||||
import * as ops from "../ops.ts";
|
||||
import { crud, del, ep, R } from "./shared.ts";
|
||||
|
||||
export const opsApi = {
|
||||
// ── 运维 ──
|
||||
reconcileRuns: crud(
|
||||
"/reconcile-runs",
|
||||
"校验运行",
|
||||
{
|
||||
row: ops.ReconcileRun,
|
||||
filters: { kind: ops.ReconcileKind.optional(), status: ops.ReconcileStatus.optional() },
|
||||
},
|
||||
R,
|
||||
),
|
||||
serverMappings: crud(
|
||||
"/server-mappings",
|
||||
"库存映射",
|
||||
{
|
||||
row: ops.ServerMapping,
|
||||
filters: {
|
||||
mediaServerInstanceId: Id.optional(),
|
||||
mediaEntityId: Id.optional(),
|
||||
matchStatus: ops.ServerMatchStatus.optional(),
|
||||
},
|
||||
},
|
||||
R,
|
||||
),
|
||||
apiKeys: {
|
||||
list: ep({
|
||||
method: "get",
|
||||
path: "/api-keys",
|
||||
scope: "admin",
|
||||
summary: "API Key 列表",
|
||||
query: CursorQuery,
|
||||
response: cursorPage(ops.ApiKey),
|
||||
}),
|
||||
create: ep({
|
||||
method: "post",
|
||||
path: "/api-keys",
|
||||
scope: "admin",
|
||||
summary: "新建 API Key(明文只返回一次)",
|
||||
body: ops.ApiKeyCreate,
|
||||
response: ops.ApiKeyCreated,
|
||||
}),
|
||||
update: ep({
|
||||
method: "patch",
|
||||
path: "/api-keys/{id}",
|
||||
scope: "admin",
|
||||
summary: "修改/撤销 API Key",
|
||||
params: IdParam,
|
||||
body: ops.ApiKeyUpdate,
|
||||
response: ops.ApiKey,
|
||||
}),
|
||||
revoke: del("/api-keys/{id}", "撤销 API Key"),
|
||||
},
|
||||
auditEvents: {
|
||||
list: ep({
|
||||
method: "get",
|
||||
path: "/audit-events",
|
||||
scope: "admin",
|
||||
summary: "审计事件(按 actor/action/target 过滤,新→旧)",
|
||||
query: ops.AuditEventQuery,
|
||||
response: cursorPage(ops.AuditEvent),
|
||||
}),
|
||||
},
|
||||
secrets: {
|
||||
list: ep({
|
||||
method: "get",
|
||||
path: "/secrets",
|
||||
scope: "admin",
|
||||
summary: "凭证元数据列表",
|
||||
query: CursorQuery,
|
||||
response: cursorPage(ops.Secret),
|
||||
}),
|
||||
create: ep({
|
||||
method: "post",
|
||||
path: "/secrets",
|
||||
scope: "admin",
|
||||
summary: "新建凭证(只写)",
|
||||
body: ops.SecretCreate,
|
||||
response: ops.Secret,
|
||||
}),
|
||||
update: ep({
|
||||
method: "patch",
|
||||
path: "/secrets/{id}",
|
||||
scope: "admin",
|
||||
summary: "轮换凭证",
|
||||
params: IdParam,
|
||||
body: ops.SecretUpdate,
|
||||
response: ops.Secret,
|
||||
}),
|
||||
remove: del("/secrets/{id}", "删除凭证(被引用时 409)"),
|
||||
},
|
||||
} as const;
|
||||
Reference in new issue
Block a user