返回 oh-my-ppt
history.ts
根目录 / src / shared / history.ts
1 export const HISTORY_VERSION_LIMIT = 20
2
3 export type HistoryOperationKind =
4 | 'generate'
5 | 'edit'
6 | 'addPage'
7 | 'retry'
8 | 'import'
9 | 'rollback'
10 | 'reorder'
11 | 'delete'
12
13 export type HistoryOperationScope = 'session' | 'deck' | 'page' | 'selector' | 'shell'
14
15 export type ChangedHistoryFile = {
16 path: string
17 changeType: 'added' | 'modified' | 'deleted'
18 pageId?: string
19 }
20
21 export type HistoryVersion = {
22 id: string
23 sessionId: string
24 operationId: string
25 commit: string
26 title: string
27 description: string
28 kind: HistoryOperationKind
29 scope: HistoryOperationScope
30 createdAt: number
31 changedFiles: ChangedHistoryFile[]
32 changedPages: string[]
33 isCurrent: boolean
34 isRestorable: boolean
35 }
36
37 export type RollbackHistoryResult = {
38 versionId: string
39 operationId: string
40 beforeCommit: string
41 targetCommit: string
42 afterCommit: string
43 changedFiles: ChangedHistoryFile[]
44 changedPages: string[]
45 }
46
46 lines TYPESCRIPT