Files
Agent-System/web/src/data/demoSeedIds.ts
T
weichenandCursor 855363fd60 fix(web): gate demo seeds and reclaim mock deliverables
Stop shipping hard-coded demo docs/projects into production builds,
drop local mock items on authoritative empty server lists, and purge
stale demo seed residue from localStorage on boot.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-16 02:50:34 +00:00

40 lines
1.5 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* Demo / legacy mock 标识(纯 ID 规则,无演示文案,可安全进入生产包)。
* 用于对账回收、UI 语义防线;不得用这些 ID 请求服务端正文/版本账本。
*/
/** 已知会与 DB 自增或 goose 种子撞车的演示 projectId。 */
export function isDemoSeedProjectId(projectId: number): boolean {
if (!Number.isFinite(projectId)) return false;
if (projectId === 1 || projectId === 2 || projectId === 3 || projectId === 5201) return true;
if (projectId >= 6001 && projectId <= 6010) return true;
return false;
}
/** ten-projects 前端种子文档 ID:doc-proj6001-urs 等。 */
export function isTenProjectsSeedDocId(docId: string): boolean {
const id = (docId || '').trim();
return /^doc-proj600[1-9]-/.test(id) || /^doc-proj6010-/.test(id);
}
/**
* 本地演示/幻影文档 ID(从未入 document_records)。
* 覆盖原 isLegacyLocalMockDocId + neuropulse + ten-projects。
*/
export function isDemoSeedDocId(docId: string): boolean {
const id = (docId || '').trim();
if (!id) return true;
if (/^doc-\d{3}$/.test(id)) return true;
if (/^doc-shared-\d+$/.test(id)) return true;
if (/^doc-private-\d{1,3}$/.test(id)) return true;
if (id.startsWith('doc-cusa-')) return true;
if (id.startsWith('doc-neuropulse-')) return true;
if (isTenProjectsSeedDocId(id)) return true;
return false;
}
/** @deprecated 使用 isDemoSeedDocId;保留别名以免外部测试断裂。 */
export function isLegacyLocalMockDocId(docId: string): boolean {
return isDemoSeedDocId(docId);
}