Use custom value provider from parent when token key doesn't have one (#49)
This commit is contained in:
@@ -129,21 +129,20 @@ async function getValues(
|
|||||||
|
|
||||||
const existingValues = getExistingValues(token, parent);
|
const existingValues = getExistingValues(token, parent);
|
||||||
|
|
||||||
if (keyToken?.definition?.key) {
|
// Use the value providers from the parent if the current key is null
|
||||||
const customValues = await valueProviderConfig?.[keyToken.definition.key]?.get(workflowContext);
|
const valueProviderToken = keyToken || parent;
|
||||||
|
|
||||||
|
const customValueProvider = valueProviderToken?.definition?.key && valueProviderConfig?.[valueProviderToken.definition.key]
|
||||||
|
if (customValueProvider) {
|
||||||
|
const customValues = await customValueProvider.get(workflowContext);
|
||||||
if (customValues) {
|
if (customValues) {
|
||||||
return filterAndSortCompletionOptions(customValues, existingValues);
|
return filterAndSortCompletionOptions(customValues, existingValues);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use the value provider from the parent if we don't have a value provider for the current key
|
const defaultValueProvider = valueProviderToken?.definition?.key && defaultValueProviders[valueProviderToken.definition.key]
|
||||||
const valueProvider =
|
if (defaultValueProvider) {
|
||||||
(keyToken?.definition?.key && defaultValueProviders[keyToken.definition.key]) ||
|
const values = await defaultValueProvider.get(workflowContext);
|
||||||
(parent.definition?.key && defaultValueProviders[parent.definition.key]);
|
|
||||||
|
|
||||||
if (valueProvider) {
|
|
||||||
const values = await valueProvider.get(workflowContext);
|
|
||||||
return filterAndSortCompletionOptions(values, existingValues);
|
return filterAndSortCompletionOptions(values, existingValues);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user