diff --git a/DUI3-DX/Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/Bindings/ArcGISReceiveBinding.cs b/DUI3-DX/Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/Bindings/ArcGISReceiveBinding.cs index 489e7296bd..00cb224d99 100644 --- a/DUI3-DX/Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/Bindings/ArcGISReceiveBinding.cs +++ b/DUI3-DX/Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/Bindings/ArcGISReceiveBinding.cs @@ -53,6 +53,7 @@ public async Task Receive(string modelCardId) var receiveOperationResults = await unitOfWork.Service .Execute( modelCard.AccountId.NotNull(), // POC: I hear -you are saying why we're passing them separately. Not sure pass the DUI3-> Connectors.DUI project dependency to the SDK-> Connector.Utils + new Uri(modelCard.ServerUrl.NotNull()), modelCard.ProjectId.NotNull(), modelCard.ProjectName.NotNull(), modelCard.ModelName.NotNull(), diff --git a/DUI3-DX/Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/Bindings/ArcGISSendBinding.cs b/DUI3-DX/Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/Bindings/ArcGISSendBinding.cs index 9ef113e74d..c96fd5817a 100644 --- a/DUI3-DX/Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/Bindings/ArcGISSendBinding.cs +++ b/DUI3-DX/Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/Bindings/ArcGISSendBinding.cs @@ -323,6 +323,7 @@ public async Task Send(string modelCardId) var sendInfo = new SendInfo( modelCard.AccountId.NotNull(), + new Uri(modelCard.ServerUrl.NotNull()), modelCard.ProjectId.NotNull(), modelCard.ModelId.NotNull(), "ArcGIS" diff --git a/DUI3-DX/Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/packages.lock.json b/DUI3-DX/Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/packages.lock.json index b975016a9b..4c0b79a041 100644 --- a/DUI3-DX/Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/packages.lock.json +++ b/DUI3-DX/Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/packages.lock.json @@ -383,7 +383,7 @@ "Microsoft.Extensions.Logging.Abstractions": "[7.0.0, )", "Speckle.Autofac": "[2.0.999-local, )", "Speckle.Connectors.Utils": "[2.0.999-local, )", - "Speckle.Core": "[3.0.1-alpha.14, )", + "Speckle.Core": "[3.0.1-alpha.15, )", "System.Threading.Tasks.Dataflow": "[6.0.0, )" } }, @@ -399,7 +399,7 @@ "dependencies": { "Serilog.Extensions.Logging": "[7.0.0, )", "Speckle.Autofac": "[2.0.999-local, )", - "Speckle.Core": "[3.0.1-alpha.14, )" + "Speckle.Core": "[3.0.1-alpha.15, )" } }, "speckle.converters.arcgis3": { @@ -456,8 +456,8 @@ "Speckle.Core": { "type": "CentralTransitive", "requested": "[3.0.1-alpha.14, )", - "resolved": "3.0.1-alpha.14", - "contentHash": "RzQPVIGFFkKvG56YLr8ACtiwdWJE6IJ9vCQ4qHa0PIsUEpfzAIAi59jnzqtByOFC0FiFrFPow9bkfzylaZorAA==", + "resolved": "3.0.1-alpha.15", + "contentHash": "khv7uLeMMZ5JKJi3NZtz2nti7YPFGQiqllIDqVuNAl8hbqJ52t6OWyOJ87n0sthvGtAO2SpaLik3f+Fh5G/7ww==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.CSharp": "4.7.0", diff --git a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.Autocad2023/packages.lock.json b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.Autocad2023/packages.lock.json index 0fff9ad56a..a8748902a7 100644 --- a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.Autocad2023/packages.lock.json +++ b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.Autocad2023/packages.lock.json @@ -436,7 +436,7 @@ "Microsoft.Extensions.Logging.Abstractions": "[7.0.0, )", "Speckle.Autofac": "[2.0.999-local, )", "Speckle.Connectors.Utils": "[2.0.999-local, )", - "Speckle.Core": "[3.0.1-alpha.14, )", + "Speckle.Core": "[3.0.1-alpha.15, )", "System.Threading.Tasks.Dataflow": "[6.0.0, )" } }, @@ -452,7 +452,7 @@ "dependencies": { "Serilog.Extensions.Logging": "[7.0.0, )", "Speckle.Autofac": "[2.0.999-local, )", - "Speckle.Core": "[3.0.1-alpha.14, )" + "Speckle.Core": "[3.0.1-alpha.15, )" } }, "speckle.converters.autocad2023": { @@ -512,8 +512,8 @@ "Speckle.Core": { "type": "CentralTransitive", "requested": "[3.0.1-alpha.14, )", - "resolved": "3.0.1-alpha.14", - "contentHash": "RzQPVIGFFkKvG56YLr8ACtiwdWJE6IJ9vCQ4qHa0PIsUEpfzAIAi59jnzqtByOFC0FiFrFPow9bkfzylaZorAA==", + "resolved": "3.0.1-alpha.15", + "contentHash": "khv7uLeMMZ5JKJi3NZtz2nti7YPFGQiqllIDqVuNAl8hbqJ52t6OWyOJ87n0sthvGtAO2SpaLik3f+Fh5G/7ww==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.CSharp": "4.7.0", diff --git a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Bindings/AutocadReceiveBinding.cs b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Bindings/AutocadReceiveBinding.cs index b1973d331d..86c43cb093 100644 --- a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Bindings/AutocadReceiveBinding.cs +++ b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Bindings/AutocadReceiveBinding.cs @@ -60,6 +60,7 @@ public async Task Receive(string modelCardId) var operationResults = await unitOfWork.Service .Execute( modelCard.AccountId.NotNull(), // POC: I hear -you are saying why we're passing them separately. Not sure pass the DUI3-> Connectors.DUI project dependency to the SDK-> Connector.Utils + new Uri(modelCard.ServerUrl.NotNull()), modelCard.ProjectId.NotNull(), modelCard.ProjectName.NotNull(), modelCard.ModelName.NotNull(), diff --git a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Bindings/AutocadSendBinding.cs b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Bindings/AutocadSendBinding.cs index 820fb90097..86bff41ddc 100644 --- a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Bindings/AutocadSendBinding.cs +++ b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Bindings/AutocadSendBinding.cs @@ -158,6 +158,7 @@ private async Task SendInternal(string modelCardId) var sendInfo = new SendInfo( modelCard.AccountId.NotNull(), + new Uri(modelCard.ServerUrl.NotNull()), modelCard.ProjectId.NotNull(), modelCard.ModelId.NotNull(), _autocadSettings.HostAppInfo.Name diff --git a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.Civil3d2024/packages.lock.json b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.Civil3d2024/packages.lock.json index 71a6fee082..18077646e3 100644 --- a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.Civil3d2024/packages.lock.json +++ b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.Civil3d2024/packages.lock.json @@ -439,7 +439,7 @@ "Microsoft.Extensions.Logging.Abstractions": "[7.0.0, )", "Speckle.Autofac": "[2.0.999-local, )", "Speckle.Connectors.Utils": "[2.0.999-local, )", - "Speckle.Core": "[3.0.1-alpha.14, )", + "Speckle.Core": "[3.0.1-alpha.15, )", "System.Threading.Tasks.Dataflow": "[6.0.0, )" } }, @@ -455,7 +455,7 @@ "dependencies": { "Serilog.Extensions.Logging": "[7.0.0, )", "Speckle.Autofac": "[2.0.999-local, )", - "Speckle.Core": "[3.0.1-alpha.14, )" + "Speckle.Core": "[3.0.1-alpha.15, )" } }, "speckle.converters.autocad2024": { @@ -521,8 +521,8 @@ "Speckle.Core": { "type": "CentralTransitive", "requested": "[3.0.1-alpha.14, )", - "resolved": "3.0.1-alpha.14", - "contentHash": "RzQPVIGFFkKvG56YLr8ACtiwdWJE6IJ9vCQ4qHa0PIsUEpfzAIAi59jnzqtByOFC0FiFrFPow9bkfzylaZorAA==", + "resolved": "3.0.1-alpha.15", + "contentHash": "khv7uLeMMZ5JKJi3NZtz2nti7YPFGQiqllIDqVuNAl8hbqJ52t6OWyOJ87n0sthvGtAO2SpaLik3f+Fh5G/7ww==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.CSharp": "4.7.0", diff --git a/DUI3-DX/Connectors/Revit/Speckle.Connectors.Revit2023/packages.lock.json b/DUI3-DX/Connectors/Revit/Speckle.Connectors.Revit2023/packages.lock.json index 503e92ef50..3cfefec341 100644 --- a/DUI3-DX/Connectors/Revit/Speckle.Connectors.Revit2023/packages.lock.json +++ b/DUI3-DX/Connectors/Revit/Speckle.Connectors.Revit2023/packages.lock.json @@ -454,7 +454,7 @@ "Microsoft.Extensions.Logging.Abstractions": "[7.0.0, )", "Speckle.Autofac": "[2.0.999-local, )", "Speckle.Connectors.Utils": "[2.0.999-local, )", - "Speckle.Core": "[3.0.1-alpha.14, )", + "Speckle.Core": "[3.0.1-alpha.15, )", "System.Threading.Tasks.Dataflow": "[6.0.0, )" } }, @@ -463,7 +463,7 @@ "dependencies": { "Serilog.Extensions.Logging": "[7.0.0, )", "Speckle.Autofac": "[2.0.999-local, )", - "Speckle.Core": "[3.0.1-alpha.14, )" + "Speckle.Core": "[3.0.1-alpha.15, )" } }, "speckle.converters.common": { @@ -518,8 +518,8 @@ "Speckle.Core": { "type": "CentralTransitive", "requested": "[3.0.1-alpha.14, )", - "resolved": "3.0.1-alpha.14", - "contentHash": "RzQPVIGFFkKvG56YLr8ACtiwdWJE6IJ9vCQ4qHa0PIsUEpfzAIAi59jnzqtByOFC0FiFrFPow9bkfzylaZorAA==", + "resolved": "3.0.1-alpha.15", + "contentHash": "khv7uLeMMZ5JKJi3NZtz2nti7YPFGQiqllIDqVuNAl8hbqJ52t6OWyOJ87n0sthvGtAO2SpaLik3f+Fh5G/7ww==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.CSharp": "4.7.0", diff --git a/DUI3-DX/Connectors/Revit/Speckle.Connectors.RevitShared/Bindings/RevitSendBinding.cs b/DUI3-DX/Connectors/Revit/Speckle.Connectors.RevitShared/Bindings/RevitSendBinding.cs index ee437aeea2..6cdaf9b255 100644 --- a/DUI3-DX/Connectors/Revit/Speckle.Connectors.RevitShared/Bindings/RevitSendBinding.cs +++ b/DUI3-DX/Connectors/Revit/Speckle.Connectors.RevitShared/Bindings/RevitSendBinding.cs @@ -103,6 +103,7 @@ public async Task Send(string modelCardId) var sendInfo = new SendInfo( modelCard.AccountId.NotNull(), + new Uri(modelCard.ServerUrl.NotNull()), modelCard.ProjectId.NotNull(), modelCard.ModelId.NotNull(), _revitSettings.HostSlug.NotNull() diff --git a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Bindings/RhinoReceiveBinding.cs b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Bindings/RhinoReceiveBinding.cs index 6c78f254df..85fc91c4b0 100644 --- a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Bindings/RhinoReceiveBinding.cs +++ b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Bindings/RhinoReceiveBinding.cs @@ -55,6 +55,7 @@ public async Task Receive(string modelCardId) HostObjectBuilderResult conversionResults = await unitOfWork.Service .Execute( modelCard.AccountId.NotNull(), // POC: I hear -you are saying why we're passing them separately. Not sure pass the DUI3-> Connectors.DUI project dependency to the SDK-> Connector.Utils + new Uri(modelCard.ServerUrl.NotNull()), modelCard.ProjectId.NotNull(), modelCard.ProjectName.NotNull(), modelCard.ModelName.NotNull(), diff --git a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Bindings/RhinoSendBinding.cs b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Bindings/RhinoSendBinding.cs index 9005692407..60d15e7eaf 100644 --- a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Bindings/RhinoSendBinding.cs +++ b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Bindings/RhinoSendBinding.cs @@ -14,6 +14,7 @@ using Speckle.Connectors.DUI.Settings; using Speckle.Connectors.Utils; using Speckle.Connectors.Utils.Caching; +using Speckle.Core.Transports; namespace Speckle.Connectors.Rhino7.Bindings; @@ -165,6 +166,7 @@ public async Task Send(string modelCardId) var sendInfo = new SendInfo( modelCard.AccountId.NotNull(), + new Uri(modelCard.ServerUrl.NotNull()), modelCard.ProjectId.NotNull(), modelCard.ModelId.NotNull(), _rhinoSettings.HostAppInfo.Name @@ -187,6 +189,10 @@ public async Task Send(string modelCardId) { Commands.SetModelError(modelCardId, e); } + catch (TransportException e) + { + Commands.SetModelError(modelCardId, e.InnerException); + } catch (OperationCanceledException) { // SWALLOW -> UI handles it immediately, so we do not need to handle anything diff --git a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/packages.lock.json b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/packages.lock.json index 53de68cb60..69d8825825 100644 --- a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/packages.lock.json +++ b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/packages.lock.json @@ -444,7 +444,7 @@ "Microsoft.Extensions.Logging.Abstractions": "[7.0.0, )", "Speckle.Autofac": "[2.0.999-local, )", "Speckle.Connectors.Utils": "[2.0.999-local, )", - "Speckle.Core": "[3.0.1-alpha.14, )", + "Speckle.Core": "[3.0.1-alpha.15, )", "System.Threading.Tasks.Dataflow": "[6.0.0, )" } }, @@ -460,7 +460,7 @@ "dependencies": { "Serilog.Extensions.Logging": "[7.0.0, )", "Speckle.Autofac": "[2.0.999-local, )", - "Speckle.Core": "[3.0.1-alpha.14, )" + "Speckle.Core": "[3.0.1-alpha.15, )" } }, "speckle.converters.common": { @@ -512,8 +512,8 @@ "Speckle.Core": { "type": "CentralTransitive", "requested": "[3.0.1-alpha.14, )", - "resolved": "3.0.1-alpha.14", - "contentHash": "RzQPVIGFFkKvG56YLr8ACtiwdWJE6IJ9vCQ4qHa0PIsUEpfzAIAi59jnzqtByOFC0FiFrFPow9bkfzylaZorAA==", + "resolved": "3.0.1-alpha.15", + "contentHash": "khv7uLeMMZ5JKJi3NZtz2nti7YPFGQiqllIDqVuNAl8hbqJ52t6OWyOJ87n0sthvGtAO2SpaLik3f+Fh5G/7ww==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.CSharp": "4.7.0", diff --git a/DUI3-DX/DUI3/Speckle.Connectors.DUI.WebView/packages.lock.json b/DUI3-DX/DUI3/Speckle.Connectors.DUI.WebView/packages.lock.json index ff084cdbee..7df233e9b3 100644 --- a/DUI3-DX/DUI3/Speckle.Connectors.DUI.WebView/packages.lock.json +++ b/DUI3-DX/DUI3/Speckle.Connectors.DUI.WebView/packages.lock.json @@ -426,7 +426,7 @@ "Microsoft.Extensions.Logging.Abstractions": "[7.0.0, )", "Speckle.Autofac": "[2.0.999-local, )", "Speckle.Connectors.Utils": "[2.0.999-local, )", - "Speckle.Core": "[3.0.1-alpha.14, )", + "Speckle.Core": "[3.0.1-alpha.15, )", "System.Threading.Tasks.Dataflow": "[6.0.0, )" } }, @@ -435,7 +435,7 @@ "dependencies": { "Serilog.Extensions.Logging": "[7.0.0, )", "Speckle.Autofac": "[2.0.999-local, )", - "Speckle.Core": "[3.0.1-alpha.14, )" + "Speckle.Core": "[3.0.1-alpha.15, )" } }, "Microsoft.Extensions.Logging.Abstractions": { @@ -461,8 +461,8 @@ "Speckle.Core": { "type": "CentralTransitive", "requested": "[3.0.1-alpha.14, )", - "resolved": "3.0.1-alpha.14", - "contentHash": "RzQPVIGFFkKvG56YLr8ACtiwdWJE6IJ9vCQ4qHa0PIsUEpfzAIAi59jnzqtByOFC0FiFrFPow9bkfzylaZorAA==", + "resolved": "3.0.1-alpha.15", + "contentHash": "khv7uLeMMZ5JKJi3NZtz2nti7YPFGQiqllIDqVuNAl8hbqJ52t6OWyOJ87n0sthvGtAO2SpaLik3f+Fh5G/7ww==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.CSharp": "4.7.0", @@ -865,7 +865,7 @@ "Microsoft.Extensions.Logging.Abstractions": "[7.0.0, )", "Speckle.Autofac": "[2.0.999-local, )", "Speckle.Connectors.Utils": "[2.0.999-local, )", - "Speckle.Core": "[3.0.1-alpha.14, )", + "Speckle.Core": "[3.0.1-alpha.15, )", "System.Threading.Tasks.Dataflow": "[6.0.0, )" } }, @@ -874,7 +874,7 @@ "dependencies": { "Serilog.Extensions.Logging": "[7.0.0, )", "Speckle.Autofac": "[2.0.999-local, )", - "Speckle.Core": "[3.0.1-alpha.14, )" + "Speckle.Core": "[3.0.1-alpha.15, )" } }, "Microsoft.Extensions.Logging.Abstractions": { @@ -896,8 +896,8 @@ "Speckle.Core": { "type": "CentralTransitive", "requested": "[3.0.1-alpha.14, )", - "resolved": "3.0.1-alpha.14", - "contentHash": "RzQPVIGFFkKvG56YLr8ACtiwdWJE6IJ9vCQ4qHa0PIsUEpfzAIAi59jnzqtByOFC0FiFrFPow9bkfzylaZorAA==", + "resolved": "3.0.1-alpha.15", + "contentHash": "khv7uLeMMZ5JKJi3NZtz2nti7YPFGQiqllIDqVuNAl8hbqJ52t6OWyOJ87n0sthvGtAO2SpaLik3f+Fh5G/7ww==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.CSharp": "4.7.0", diff --git a/DUI3-DX/DUI3/Speckle.Connectors.DUI/Models/Card/ModelCard.cs b/DUI3-DX/DUI3/Speckle.Connectors.DUI/Models/Card/ModelCard.cs index 51aae18fb2..6dbd4753e6 100644 --- a/DUI3-DX/DUI3/Speckle.Connectors.DUI/Models/Card/ModelCard.cs +++ b/DUI3-DX/DUI3/Speckle.Connectors.DUI/Models/Card/ModelCard.cs @@ -20,7 +20,16 @@ public class ModelCard : DiscriminatedObject /// Project id. FKA stream id. /// public string? ProjectId { get; set; } + + /// + /// Account id that model card created with it initially. + /// public string? AccountId { get; set; } + /// + /// Server that model card created on it initially. + /// + public string? ServerUrl { get; set; } + public List? Settings { get; set; } } diff --git a/DUI3-DX/DUI3/Speckle.Connectors.DUI/packages.lock.json b/DUI3-DX/DUI3/Speckle.Connectors.DUI/packages.lock.json index 9f44602e71..d332a17f5f 100644 --- a/DUI3-DX/DUI3/Speckle.Connectors.DUI/packages.lock.json +++ b/DUI3-DX/DUI3/Speckle.Connectors.DUI/packages.lock.json @@ -39,9 +39,9 @@ }, "Speckle.Core": { "type": "Direct", - "requested": "[3.0.1-alpha.14, )", - "resolved": "3.0.1-alpha.14", - "contentHash": "RzQPVIGFFkKvG56YLr8ACtiwdWJE6IJ9vCQ4qHa0PIsUEpfzAIAi59jnzqtByOFC0FiFrFPow9bkfzylaZorAA==", + "requested": "[3.0.1-alpha.15, )", + "resolved": "3.0.1-alpha.15", + "contentHash": "khv7uLeMMZ5JKJi3NZtz2nti7YPFGQiqllIDqVuNAl8hbqJ52t6OWyOJ87n0sthvGtAO2SpaLik3f+Fh5G/7ww==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.CSharp": "4.7.0", @@ -538,7 +538,7 @@ "dependencies": { "Serilog.Extensions.Logging": "[7.0.0, )", "Speckle.Autofac": "[2.0.999-local, )", - "Speckle.Core": "[3.0.1-alpha.14, )" + "Speckle.Core": "[3.0.1-alpha.15, )" } }, "Serilog.Extensions.Logging": { diff --git a/DUI3-DX/Directory.Packages.props b/DUI3-DX/Directory.Packages.props index 217c4a191b..4bb9d6fb7d 100644 --- a/DUI3-DX/Directory.Packages.props +++ b/DUI3-DX/Directory.Packages.props @@ -4,25 +4,25 @@ - + - + - + - - - + + + - - - + + + - + \ No newline at end of file diff --git a/DUI3-DX/Sdk/Speckle.Connectors.Utils/ContainerRegistration.cs b/DUI3-DX/Sdk/Speckle.Connectors.Utils/ContainerRegistration.cs index 93a7c326dd..4c44fa6231 100644 --- a/DUI3-DX/Sdk/Speckle.Connectors.Utils/ContainerRegistration.cs +++ b/DUI3-DX/Sdk/Speckle.Connectors.Utils/ContainerRegistration.cs @@ -15,6 +15,7 @@ public static void AddConnectorUtils(this SpeckleContainerBuilder builder) // send operation and dependencies builder.AddSingleton(); builder.AddScoped(); + builder.AddScoped(); //TODO: Logger will likely be removed from Core, we'll plan to figure out the config later... var serilogLogger = SpeckleLog.Logger; diff --git a/DUI3-DX/Sdk/Speckle.Connectors.Utils/Operations/AccountService.cs b/DUI3-DX/Sdk/Speckle.Connectors.Utils/Operations/AccountService.cs new file mode 100644 index 0000000000..520c60e856 --- /dev/null +++ b/DUI3-DX/Sdk/Speckle.Connectors.Utils/Operations/AccountService.cs @@ -0,0 +1,27 @@ +using Speckle.Core.Credentials; + +namespace Speckle.Connectors.Utils.Operations; + +public class AccountService +{ + /// + /// Account to retrieve with its id, if not exist try to retrieve from matching serverUrl. + /// + /// Id of the account. + /// Server url to search matching account. + /// + /// Throws if server url doesn't match with any account. + public Account GetAccountWithServerUrlFallback(string accountId, Uri serverUrl) + { + try + { + return AccountManager.GetAccount(accountId); + } + catch (SpeckleAccountManagerException) + { + var accounts = AccountManager.GetAccounts(serverUrl); + return accounts.First() + ?? throw new SpeckleAccountManagerException($"No any account found that matches with server {serverUrl}"); + } + } +} diff --git a/DUI3-DX/Sdk/Speckle.Connectors.Utils/Operations/ReceiveOperation.cs b/DUI3-DX/Sdk/Speckle.Connectors.Utils/Operations/ReceiveOperation.cs index a93a2c61f7..436ade7c43 100644 --- a/DUI3-DX/Sdk/Speckle.Connectors.Utils/Operations/ReceiveOperation.cs +++ b/DUI3-DX/Sdk/Speckle.Connectors.Utils/Operations/ReceiveOperation.cs @@ -10,15 +10,22 @@ public sealed class ReceiveOperation { private readonly IHostObjectBuilder _hostObjectBuilder; private readonly ISyncToThread _syncToThread; + private readonly AccountService _accountService; - public ReceiveOperation(IHostObjectBuilder hostObjectBuilder, ISyncToThread syncToThread) + public ReceiveOperation( + IHostObjectBuilder hostObjectBuilder, + ISyncToThread syncToThread, + AccountService accountService + ) { _hostObjectBuilder = hostObjectBuilder; _syncToThread = syncToThread; + _accountService = accountService; } public async Task Execute( string accountId, // POC: all these string arguments exists in ModelCard but not sure to pass this dependency here, TBD! + Uri serverUrl, string projectId, string projectName, string modelName, @@ -28,7 +35,7 @@ public async Task Execute( ) { // 2 - Check account exist - Account account = AccountManager.GetAccount(accountId); + Account account = _accountService.GetAccountWithServerUrlFallback(accountId, serverUrl); // 3 - Get commit object from server using Client apiClient = new(account); diff --git a/DUI3-DX/Sdk/Speckle.Connectors.Utils/Operations/RootObjectSender.cs b/DUI3-DX/Sdk/Speckle.Connectors.Utils/Operations/RootObjectSender.cs index 0234361f66..7b7972ebc3 100644 --- a/DUI3-DX/Sdk/Speckle.Connectors.Utils/Operations/RootObjectSender.cs +++ b/DUI3-DX/Sdk/Speckle.Connectors.Utils/Operations/RootObjectSender.cs @@ -17,11 +17,17 @@ public sealed class RootObjectSender : IRootObjectSender // POC: Revisit this factory pattern, I think we could solve this higher up by injecting a scoped factory for `SendOperation` in the SendBinding private readonly ServerTransport.Factory _transportFactory; private readonly ISendConversionCache _sendConversionCache; + private readonly AccountService _accountService; - public RootObjectSender(ServerTransport.Factory transportFactory, ISendConversionCache sendConversionCache) + public RootObjectSender( + ServerTransport.Factory transportFactory, + ISendConversionCache sendConversionCache, + AccountService accountService + ) { _transportFactory = transportFactory; _sendConversionCache = sendConversionCache; + _accountService = accountService; } public async Task<(string rootObjId, Dictionary convertedReferences)> Send( @@ -35,7 +41,7 @@ public RootObjectSender(ServerTransport.Factory transportFactory, ISendConversio onOperationProgressed?.Invoke("Uploading...", null); - Account account = AccountManager.GetAccount(sendInfo.AccountId); + Account account = _accountService.GetAccountWithServerUrlFallback(sendInfo.AccountId, sendInfo.ServerUrl); ITransport transport = _transportFactory(account, sendInfo.ProjectId, 60, null); var sendResult = await SendHelper.Send(commitObject, transport, true, null, ct).ConfigureAwait(false); diff --git a/DUI3-DX/Sdk/Speckle.Connectors.Utils/Operations/SendInfo.cs b/DUI3-DX/Sdk/Speckle.Connectors.Utils/Operations/SendInfo.cs index 0b45d1161f..7400bc2cdf 100644 --- a/DUI3-DX/Sdk/Speckle.Connectors.Utils/Operations/SendInfo.cs +++ b/DUI3-DX/Sdk/Speckle.Connectors.Utils/Operations/SendInfo.cs @@ -1,17 +1,3 @@ namespace Speckle.Connectors.Utils.Operations; -public readonly struct SendInfo -{ - public SendInfo(string accountId, string projectId, string modelId, string sourceApplication) - { - AccountId = accountId; - ProjectId = projectId; - ModelId = modelId; - SourceApplication = sourceApplication; - } - - public string AccountId { get; } - public string ProjectId { get; } - public string ModelId { get; } - public string SourceApplication { get; } -} +public record SendInfo(string AccountId, Uri ServerUrl, string ProjectId, string ModelId, string SourceApplication); diff --git a/DUI3-DX/Sdk/Speckle.Connectors.Utils/packages.lock.json b/DUI3-DX/Sdk/Speckle.Connectors.Utils/packages.lock.json index 990763d412..6760bf7a0c 100644 --- a/DUI3-DX/Sdk/Speckle.Connectors.Utils/packages.lock.json +++ b/DUI3-DX/Sdk/Speckle.Connectors.Utils/packages.lock.json @@ -48,9 +48,9 @@ }, "Speckle.Core": { "type": "Direct", - "requested": "[3.0.1-alpha.14, )", - "resolved": "3.0.1-alpha.14", - "contentHash": "RzQPVIGFFkKvG56YLr8ACtiwdWJE6IJ9vCQ4qHa0PIsUEpfzAIAi59jnzqtByOFC0FiFrFPow9bkfzylaZorAA==", + "requested": "[3.0.1-alpha.15, )", + "resolved": "3.0.1-alpha.15", + "contentHash": "khv7uLeMMZ5JKJi3NZtz2nti7YPFGQiqllIDqVuNAl8hbqJ52t6OWyOJ87n0sthvGtAO2SpaLik3f+Fh5G/7ww==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.CSharp": "4.7.0",