数据目录闭环(前端):类型、接口、文案和纯函数——起草任务的逐段落盘、块进度字段和清单的 blank_columns_from;审阅队列、成批审阅、审阅进度、用过这张表的运行;导出导入(下载文件、预览、导入);表助手的事件流(按行读 data: <JSON>,开流前被拒带状态码和机读码,能停止);表助手的对话怎么截(最多 40 条、每条 4000 字、从用户的话开始)、待保存的修改怎么累积(同一路径以最后一次提案为准、保存带最早那条提案的版本、409 后按预览重算);审阅视图的地址参数、成批结果和表详情改过之后的状态同步;文案进 lib/terms.ts

This commit is contained in:
ThearchyHelios
2026-10-14 08:44:14 +08:00
parent a87b935ebf
commit a9ffbcfa86
6 changed files with 959 additions and 9 deletions
+6 -1
View File
@@ -65,10 +65,15 @@ function changeOf(x: unknown): CatalogPatchChange | null {
}
}
/** 提案里的各项(catalog_patch、表助手的 proposal 事件同一个形状):认不出的项跳过 */
export function patchChangesOf(raw: unknown): CatalogPatchChange[] {
return (Array.isArray(raw) ? raw : []).map(changeOf).filter((c): c is CatalogPatchChange => !!c)
}
/** catalog_patch 操作 → 提案。认不出的形状返回 null */
export function catalogPatchOf(op: Record<string, any>, key = ''): CatalogPatch | null {
if (typeof op.source !== 'string' || typeof op.source_id !== 'string' || typeof op.table !== 'string') return null
const changes = (Array.isArray(op.changes) ? op.changes : []).map(changeOf).filter((c): c is CatalogPatchChange => !!c)
const changes = patchChangesOf(op.changes)
if (!changes.length) return null
const version = typeof op.version === 'number' && Number.isFinite(op.version) ? op.version : 0
return {