mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-10-29 16:15:51 +00:00
* feat(frontend): wip * feat(frontend): s3 file working * feat(frontend): policy * feat(frontend): policy * feat(frontend): wip * feat(frontend): merge main * feat(frontend): update s3 upload logic * feat(frontend): wip * feat(frontend): wip * feat(frontend): path template * feat(frontend): done * feat(frontend): clean up * feat(frontend): fix dark mode * feat(frontend): fix outputs + add component control * feat(frontend): fix outputs + add component control * Update components.ts * Update components.ts --------- Co-authored-by: Ruben Fiszel <ruben@windmill.dev>
34 lines
927 B
TypeScript
34 lines
927 B
TypeScript
import { parseOutputs } from '$lib/infer'
|
|
import { deepEqual } from 'fast-equals'
|
|
import type { EvalV2AppInput, TemplateV2Input } from '../inputType'
|
|
import type { Writable } from 'svelte/store'
|
|
import type { App } from '../types'
|
|
|
|
export async function inferDeps(
|
|
code: string,
|
|
worldOutputs: Record<string, any>,
|
|
componentInput: EvalV2AppInput | TemplateV2Input,
|
|
app: Writable<App>
|
|
) {
|
|
const outputs = await parseOutputs(code, true)
|
|
if (outputs && componentInput) {
|
|
const noutputs = outputs
|
|
.filter(
|
|
([componentId, id]) =>
|
|
componentId == 'row' ||
|
|
componentId == 'iter' ||
|
|
componentId == 'group' ||
|
|
componentId == 'file' ||
|
|
id in (worldOutputs[componentId] ?? {})
|
|
)
|
|
.map(([componentId, id]) => ({
|
|
componentId: componentId,
|
|
id: id
|
|
}))
|
|
if (!deepEqual(noutputs, componentInput.connections)) {
|
|
componentInput.connections = noutputs
|
|
app.update((old) => old)
|
|
}
|
|
}
|
|
}
|