支持自部署需求管理、交付流程与飞书集成

This commit is contained in:
xyt committed 2026-11-25 12:40:33 +08:00
1 parent 4556a5b483
commit e22b66d9dd
148 files changed
+8300 -6393

No files matched your search

+18
View File
@@ -0,0 +1,18 @@
import type { Demand } from './demand';
export type SavedDemandWrite = { version: number; demand: Demand };
/** Retain writes acknowledged after a GET began without dropping its other records. */
export function mergeDemandSnapshot(
snapshot: Demand[],
writes: Iterable<SavedDemandWrite>,
startedAtVersion: number,
): Demand[] {
const records = new Map(snapshot.map(demand => [demand.id, demand]));
for (const { version, demand } of writes) {
if (version <= startedAtVersion) continue;
const serverRecord = records.get(demand.id);
if (!serverRecord || serverRecord.revision <= demand.revision) records.set(demand.id, demand);
}
return [...records.values()].sort((a, b) => b.updatedAt.localeCompare(a.updatedAt));
}