* Materialize workspace files (already uses listWorkspaceFiles). * Returns a summary for WORKSPACE.md generation.
(workspaceId: string)
| 1531 | * Returns a summary for WORKSPACE.md generation. |
| 1532 | */ |
| 1533 | private async materializeFiles(workspaceId: string): Promise<WorkspaceMdData['files']> { |
| 1534 | try { |
| 1535 | const workflowArtifactsEnabled = this._betaEnabled |
| 1536 | const folders = await listWorkspaceFileFolders(workspaceId, { |
| 1537 | includeReservedSystemFolders: true, |
| 1538 | }) |
| 1539 | const files = await listWorkspaceFiles(workspaceId, { |
| 1540 | folders, |
| 1541 | includeReservedSystemFiles: true, |
| 1542 | }) |
| 1543 | for (const folder of folders) { |
| 1544 | if ( |
| 1545 | !workflowArtifactsEnabled && |
| 1546 | isWorkflowAliasBackingPath(`files/${encodeVfsPathSegments(folder.path.split('/'))}`) |
| 1547 | ) { |
| 1548 | continue |
| 1549 | } |
| 1550 | this.files.set(`files/${encodeVfsPathSegments(folder.path.split('/'))}/.folder`, '') |
| 1551 | } |
| 1552 | |
| 1553 | for (const file of files) { |
| 1554 | const filePath = canonicalWorkspaceFilePath({ |
| 1555 | folderPath: file.folderPath, |
| 1556 | name: file.name, |
| 1557 | }) |
| 1558 | if (!workflowArtifactsEnabled && isWorkflowAliasBackingPath(filePath)) { |
| 1559 | continue |
| 1560 | } |
| 1561 | this.files.set( |
| 1562 | filePath, |
| 1563 | serializeFileMeta({ |
| 1564 | id: file.id, |
| 1565 | name: file.name, |
| 1566 | folderId: file.folderId, |
| 1567 | folderPath: file.folderPath, |
| 1568 | vfsPath: filePath, |
| 1569 | contentType: file.type, |
| 1570 | size: file.size, |
| 1571 | uploadedAt: file.uploadedAt, |
| 1572 | }) |
| 1573 | ) |
| 1574 | } |
| 1575 | |
| 1576 | if (workflowArtifactsEnabled) { |
| 1577 | this.files.set(`${WORKFLOW_PLANS_ALIAS_DIR}/.folder`, '') |
| 1578 | const workspacePlanFiles = files.filter((file) => { |
| 1579 | if (!file.folderPath) return false |
| 1580 | return ( |
| 1581 | file.folderPath === |
| 1582 | `${WORKFLOW_PLANS_BACKING_FOLDER}/${WORKSPACE_PLANS_BACKING_FOLDER}` || |
| 1583 | file.folderPath.startsWith( |
| 1584 | `${WORKFLOW_PLANS_BACKING_FOLDER}/${WORKSPACE_PLANS_BACKING_FOLDER}/` |
| 1585 | ) |
| 1586 | ) |
| 1587 | }) |
| 1588 | const workspacePlanLinks = [] |
| 1589 | for (const planFile of workspacePlanFiles) { |
| 1590 | const relativeFolder = planFile.folderPath |
no test coverage detected