mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-18 16:02:10 +00:00
fix: read latest db draft for scripts/flows in global mode read tool (#9441)
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -647,7 +647,7 @@ function itemMatches(
|
||||
)
|
||||
}
|
||||
|
||||
function scriptToItem(script: Script, includeValue: boolean): WorkspaceItem {
|
||||
function scriptToItem(script: Script | NewScript, includeValue: boolean): WorkspaceItem {
|
||||
return {
|
||||
type: 'script',
|
||||
path: script.path,
|
||||
@@ -1153,10 +1153,16 @@ async function readWorkspaceItem(
|
||||
triggerKind?: TriggerKind
|
||||
): Promise<WorkspaceItem> {
|
||||
switch (type) {
|
||||
case 'script':
|
||||
return scriptToItem(await ScriptService.getScriptByPath({ workspace, path }), true)
|
||||
case 'flow':
|
||||
return flowToItem(await FlowService.getFlowByPath({ workspace, path }), true)
|
||||
case 'script': {
|
||||
// Prefer the DB draft (newer than the deployed version) when one exists.
|
||||
const script = await ScriptService.getScriptByPathWithDraft({ workspace, path })
|
||||
return scriptToItem(script.draft ?? script, true)
|
||||
}
|
||||
case 'flow': {
|
||||
// Prefer the DB draft (newer than the deployed version) when one exists.
|
||||
const flow = await FlowService.getFlowByPathWithDraft({ workspace, path })
|
||||
return flowToItem(flow.draft ?? flow, true)
|
||||
}
|
||||
case 'schedule':
|
||||
return scheduleToItem(await ScheduleService.getSchedule({ workspace, path }), true)
|
||||
case 'trigger':
|
||||
|
||||
Reference in New Issue
Block a user