spine-framework 0.3.123 → 0.3.124
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -62,7 +62,7 @@ export async function updateFileStatus(ctx: any, fileItem: any, status: FileStat
|
|
|
62
62
|
/**
|
|
63
63
|
* Build a nested file tree from a flat list of discovered files.
|
|
64
64
|
*/
|
|
65
|
-
export function buildFileTree(fileRecords: { file_path: string; id
|
|
65
|
+
export function buildFileTree(fileRecords: { file_path: string; id?: string; language: string; status?: FileStatus; extension: string }[]): FileTreeNode {
|
|
66
66
|
const root: FileTreeNode = { name: 'root', path: '', type: 'directory', children: [] }
|
|
67
67
|
|
|
68
68
|
for (const record of fileRecords) {
|
|
@@ -112,6 +112,23 @@ export function updateTreeNodeStatus(tree: FileTreeNode, fileId: string, status:
|
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
+
/**
|
|
116
|
+
* Update a file node in the persisted tree by its file path.
|
|
117
|
+
* Used when the tree is built before file records exist (Pass 1).
|
|
118
|
+
*/
|
|
119
|
+
export function updateTreeNodeByPath(tree: FileTreeNode, filePath: string, updates: { id?: string; status?: FileStatus }): void {
|
|
120
|
+
if (tree.type === 'file' && tree.path === filePath) {
|
|
121
|
+
if (updates.id !== undefined) tree.id = updates.id
|
|
122
|
+
if (updates.status !== undefined) tree.status = updates.status
|
|
123
|
+
return
|
|
124
|
+
}
|
|
125
|
+
if (tree.children) {
|
|
126
|
+
for (const child of tree.children) {
|
|
127
|
+
updateTreeNodeByPath(child, filePath, updates)
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
115
132
|
/**
|
|
116
133
|
* Persist the updated tree back to the project item.
|
|
117
134
|
*/
|