From 2d34c39b460154d7ac564b9669333d9c58f55a7b Mon Sep 17 00:00:00 2001 From: Victor Bustamante Date: Tue, 28 Nov 2023 13:21:12 -0800 Subject: [PATCH] Fix(dal): Make secrets work on workspace import --- lib/dal/src/pkg/import.rs | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/lib/dal/src/pkg/import.rs b/lib/dal/src/pkg/import.rs index b1d249307a..ef0eb88d90 100644 --- a/lib/dal/src/pkg/import.rs +++ b/lib/dal/src/pkg/import.rs @@ -481,6 +481,7 @@ async fn import_component( skips.push(skip); } } + for attribute in component_spec.output_sockets()? { if let Some(skip) = import_component_attribute( ctx, @@ -864,13 +865,27 @@ async fn update_prototype( ))?; if let Some(ip_id) = get_ip_for_input(ctx, schema_variant_id, input).await? { - AttributePrototypeArgument::new_for_intra_component( - ctx, - *prototype.id(), - *func_arg.id(), - ip_id, - ) - .await?; + match AttributePrototypeArgument::list_for_attribute_prototype(ctx, *prototype.id()) + .await? + .iter() + .find(|apa| apa.func_argument_id() == *func_arg.id()) + { + Some(apa) => { + if apa.internal_provider_id() != ip_id { + let mut apa = apa.to_owned(); + apa.set_internal_provider_id(ctx, ip_id).await?; + } + } + None => { + AttributePrototypeArgument::new_for_intra_component( + ctx, + *prototype.id(), + *func_arg.id(), + ip_id, + ) + .await?; + } + } } } }