diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2024-07-25 16:31:15 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2024-07-25 16:34:59 -0300 |
commit | 91fb34c3ec48483d6f451ff74b266799ce0e5e42 (patch) | |
tree | 976e278ea1739eb67c1df8a9d7669a04509b82c7 /src | |
parent | d669d0e8c7c4bc98f4c93de6cf29bb570e0f75e2 (diff) |
composite: expose used default{Dependency,Value} at instantiate
There used to be a cool description here, but then vim ate it.
Diffstat (limited to 'src')
-rw-r--r-- | src/data/composite.js | 41 | ||||
-rw-r--r-- | src/data/composite/control-flow/raiseOutputWithoutDependency.js | 2 | ||||
-rw-r--r-- | src/data/composite/control-flow/raiseOutputWithoutUpdateValue.js | 2 |
3 files changed, 23 insertions, 22 deletions
diff --git a/src/data/composite.js b/src/data/composite.js index ea7a3480..5af1becf 100644 --- a/src/data/composite.js +++ b/src/data/composite.js @@ -342,7 +342,27 @@ export function templateCompositeFrom(description) { } }); - const inputMetadata = getStaticInputMetadata(inputOptions); + const inputMapping = {}; + if ('inputs' in description) { + for (const [name, token] of Object.entries(description.inputs)) { + const tokenValue = getInputTokenValue(token); + if (name in inputOptions) { + if (typeof inputOptions[name] === 'string') { + inputMapping[name] = input.dependency(inputOptions[name]); + } else { + inputMapping[name] = inputOptions[name]; + } + } else if (tokenValue.defaultValue) { + inputMapping[name] = input.value(tokenValue.defaultValue); + } else if (tokenValue.defaultDependency) { + inputMapping[name] = input.dependency(tokenValue.defaultDependency); + } else { + inputMapping[name] = input.value(null); + } + } + } + + const inputMetadata = getStaticInputMetadata(inputMapping); const expectedOutputNames = (Array.isArray(description.outputs) @@ -414,25 +434,6 @@ export function templateCompositeFrom(description) { } if ('inputs' in description) { - const inputMapping = {}; - - for (const [name, token] of Object.entries(description.inputs)) { - const tokenValue = getInputTokenValue(token); - if (name in inputOptions) { - if (typeof inputOptions[name] === 'string') { - inputMapping[name] = input.dependency(inputOptions[name]); - } else { - inputMapping[name] = inputOptions[name]; - } - } else if (tokenValue.defaultValue) { - inputMapping[name] = input.value(tokenValue.defaultValue); - } else if (tokenValue.defaultDependency) { - inputMapping[name] = input.dependency(tokenValue.defaultDependency); - } else { - inputMapping[name] = input.value(null); - } - } - finalDescription.inputMapping = inputMapping; finalDescription.inputDescriptions = description.inputs; } diff --git a/src/data/composite/control-flow/raiseOutputWithoutDependency.js b/src/data/composite/control-flow/raiseOutputWithoutDependency.js index 3d04f8a9..03d8036a 100644 --- a/src/data/composite/control-flow/raiseOutputWithoutDependency.js +++ b/src/data/composite/control-flow/raiseOutputWithoutDependency.js @@ -17,7 +17,7 @@ export default templateCompositeFrom({ outputs: ({ [input.staticValue('output')]: output, - }) => Object.keys(output ?? {}), + }) => Object.keys(output), steps: () => [ withResultOfAvailabilityCheck({ diff --git a/src/data/composite/control-flow/raiseOutputWithoutUpdateValue.js b/src/data/composite/control-flow/raiseOutputWithoutUpdateValue.js index ffa83a94..3c39f5ba 100644 --- a/src/data/composite/control-flow/raiseOutputWithoutUpdateValue.js +++ b/src/data/composite/control-flow/raiseOutputWithoutUpdateValue.js @@ -16,7 +16,7 @@ export default templateCompositeFrom({ outputs: ({ [input.staticValue('output')]: output, - }) => Object.keys(output ?? {}), + }) => Object.keys(output), steps: () => [ withResultOfAvailabilityCheck({ |