(args: {
workflowPath: string
workflowId: string
changelog?: WorkspaceFileRecord | null
planFiles?: WorkspaceFileRecord[]
})
| 321 | } |
| 322 | |
| 323 | export function buildWorkflowAliasLinks(args: { |
| 324 | workflowPath: string |
| 325 | workflowId: string |
| 326 | changelog?: WorkspaceFileRecord | null |
| 327 | planFiles?: WorkspaceFileRecord[] |
| 328 | }): WorkflowAliasLink[] { |
| 329 | const links: WorkflowAliasLink[] = [ |
| 330 | { |
| 331 | kind: 'changelog', |
| 332 | aliasPath: `${args.workflowPath}/${WORKFLOW_CHANGELOG_ALIAS_NAME}`, |
| 333 | backingPath: workflowChangelogBackingPath(args.workflowId), |
| 334 | backingFileId: args.changelog?.id, |
| 335 | }, |
| 336 | { |
| 337 | kind: 'plans_dir', |
| 338 | aliasPath: `${args.workflowPath}/${WORKFLOW_PLANS_ALIAS_DIR}`, |
| 339 | backingPath: workflowPlansBackingFolderPath(args.workflowId), |
| 340 | }, |
| 341 | ] |
| 342 | |
| 343 | for (const file of args.planFiles ?? []) { |
| 344 | const relativePath = file.folderPath |
| 345 | ?.replace(`${WORKFLOW_PLANS_BACKING_FOLDER}/${args.workflowId}`, '') |
| 346 | .replace(/^\/+/, '') |
| 347 | const aliasRelativePath = encodeVfsPathSegments( |
| 348 | [relativePath, file.name].filter(Boolean).join('/').split('/') |
| 349 | ) |
| 350 | const aliasPath = [args.workflowPath, WORKFLOW_PLANS_ALIAS_DIR, aliasRelativePath].join('/') |
| 351 | links.push({ |
| 352 | kind: 'plan_file', |
| 353 | aliasPath, |
| 354 | backingPath: canonicalWorkspaceFilePath({ folderPath: file.folderPath, name: file.name }), |
| 355 | backingFileId: file.id, |
| 356 | }) |
| 357 | } |
| 358 | |
| 359 | return links |
| 360 | } |
no test coverage detected