7860c44f4e
* Dim/quack lets go (#1275) * Add model ingestion to sharp connectors * correct ingestion message * Progress * grasshopper * GH exception messages * fix GH * file names * revit file name * grasshopper file names * etabs file names * delete tests * tekla maybe * ingestion scope * bad boolean logic * Longer TimeSpan * wip upload pipe * 10s * passthrough ingestion id * happy hack time: prevent ingestion completion this is handled server-side in the processing logic. * add packfile send endpoint detection and routing Route to SendViaPackfile when the server supports the upload-signing endpoint (POST probe, 404 = unsupported) and a continuous traversal builder is registered. * Adds Continuous Traversal Builder Introduces a Continuous Traversal Builder to manage the conversion and processing of Revit elements within a Send Pipeline. --------- Co-authored-by: Jedd Morgan <45512892+JR-Morgan@users.noreply.github.com> * feat(api): DI Refactor for Duck DB + Gergo's API endpoint changes (#1282) * Di * undo accidental change * Feat (duck): dui ingestion updates post upload (#1295) * Pass optional ingestion id to DUI * Make ingestion id null for the SendViaIngestion, see the note :) * feat!: Duckdev progress reporitng (#1296) * Di * throwaway from laptop * Progress reporting * Use matching logger * Revit and revert rhino unpacker progress * more revertion * make pr even cleaner * and this one * fix build issues with other connectors * SDK nuget (#1299) * Bump to 3.14.0-alpha.2 * Feat(duck): grasshopper (#1297) * Duck x Grasshopper - who would win? * Fix registration for new builder * missing imports * return version id grasshopper * Align sync resource to sync --------- Co-authored-by: Jedd Morgan <45512892+JR-Morgan@users.noreply.github.com> * Bump SDK * feat(importer): rhino file importer changes for packfile (#1301) * rhino importer changes * correct deps * Bump SDK * Fix build issues * ditto * Fix build issue * Lower standards * Fix build * feat: duck for acad, civil, navis, tekla, etabs (#1300) * duck: acad, civil, etabs, tekla, navis and bump channels to 10.0.0 * notes * fix conflicts * more conflicts * Ready for testing * fix(duck): Fix send caching (#1302) * potential fix * undo-rhino chnages * fix xml comment * amended comment * revit * Fix build * Aligned converting message * fix: reoccurring object references * Bump sdk and resolve merge conflict issues * Merge pull request #1317 from specklesystems/jrm/importer-tracing feat(otel): Tracing and OTEL changes for Rhino importer * Fix revit linked model progress (#1312) * Revert otel packages * bump SDK * Trace unpacking groups * Align trace context nullability with app * Disable send caching in Navisworks * comments * Update FileimportPayload.cs * fix using directive --------- Co-authored-by: Jedd Morgan <45512892+JR-Morgan@users.noreply.github.com> * Fix merge conflicts --------- Co-authored-by: Dimitrie Stefanescu <didimitrie@gmail.com> Co-authored-by: Oğuzhan Koral <45078678+oguzhankoral@users.noreply.github.com> Co-authored-by: Björn Steinhagen <88777268+bjoernsteinhagen@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Sebastian Witt <sebastian.witt@rwth-aachen.de>
129 lines
3.8 KiB
C#
129 lines
3.8 KiB
C#
using Speckle.Newtonsoft.Json;
|
|
using Speckle.Sdk.Common;
|
|
using Speckle.Sdk.Models;
|
|
|
|
namespace Speckle.Connectors.Common.Conversion;
|
|
|
|
// Removing this for now, this was to faciliate us sending conversion results inside the commit object
|
|
// We may want this back in future, but need to spark a discussion first
|
|
// public sealed class Report : Base
|
|
// {
|
|
// public required IEnumerable<ConversionResult> ConversionResults { get; set; }
|
|
// }
|
|
|
|
public enum Status
|
|
{
|
|
NONE = 0, // Do not fucking use
|
|
SUCCESS = 1,
|
|
INFO = 2, // Not in use yet, maybe later as discussed
|
|
WARNING = 3, // Not in use yet, maybe later as discussed
|
|
ERROR = 4
|
|
}
|
|
|
|
public sealed class SendConversionResult : ConversionResult
|
|
{
|
|
public SendConversionResult(
|
|
Status status,
|
|
string sourceId,
|
|
string sourceType,
|
|
Base? result = null,
|
|
Exception? exception = null
|
|
)
|
|
{
|
|
Status = status;
|
|
SourceId = sourceId;
|
|
SourceType = sourceType;
|
|
ResultId = result?.id;
|
|
ResultType = result?.speckle_type;
|
|
Result = result;
|
|
Error = FormatError(exception);
|
|
}
|
|
|
|
[JsonIgnore]
|
|
public Base? Result { get; }
|
|
}
|
|
|
|
// HACK: I've unsealed this for Grasshopper, non-ideal. Should be discussed and a better pattern may be implemented.
|
|
public class ReceiveConversionResult : ConversionResult
|
|
{
|
|
public ReceiveConversionResult(
|
|
Status status,
|
|
Base source,
|
|
string? resultId = null,
|
|
string? resultType = null,
|
|
Exception? exception = null
|
|
)
|
|
{
|
|
Status = status;
|
|
SourceId = source.id.NotNull();
|
|
SourceType = source.speckle_type; // Note: we'll parse it nicely in FE
|
|
ResultId = resultId;
|
|
ResultType = resultType;
|
|
Error = FormatError(exception);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Base class for which we inherit send or receive conversion results. Note, the properties Source* and Result* swap meaning if they are a
|
|
/// send conversion result or a receive conversion result - but i do not believe this requires fully separate classes, especially
|
|
/// for what this is meant to be at its core: a list of green or red checkmarks in the UI. To make DX easier, the two classes above embody
|
|
/// this one and provided clean constructors for each case.
|
|
/// </summary>
|
|
public abstract class ConversionResult
|
|
{
|
|
public Status Status { get; protected init; }
|
|
|
|
/// <summary>
|
|
/// For receive conversion reports, this is the id of the speckle object. For send, it's the host app object id.
|
|
/// </summary>
|
|
public string SourceId { get; protected init; }
|
|
|
|
/// <summary>
|
|
/// For receive conversion reports, this is the type of the speckle object. For send, it's the host app object type.
|
|
/// </summary>
|
|
public string SourceType { get; protected init; }
|
|
|
|
/// <summary>
|
|
/// For receive conversion reports, this is the id of the host app object. For send, it's the speckle object id.
|
|
/// </summary>
|
|
public string? ResultId { get; protected init; }
|
|
|
|
/// <summary>
|
|
/// For receive conversion reports, this is the type of the host app object. For send, it's the speckle object type.
|
|
/// </summary>
|
|
public string? ResultType { get; protected init; }
|
|
|
|
/// <summary>
|
|
/// The exception, if any.
|
|
/// </summary>
|
|
public ErrorWrapper? Error { get; protected init; }
|
|
|
|
// /// <summary>
|
|
// /// Makes it easy for the FE to discriminate (against report types, not people).
|
|
// /// </summary>
|
|
// public string Type => this.GetType().ToString();
|
|
|
|
protected static ErrorWrapper? FormatError(Exception? exception)
|
|
{
|
|
if (exception is null)
|
|
{
|
|
return null;
|
|
}
|
|
|
|
return new ErrorWrapper()
|
|
{
|
|
Message = exception.Message,
|
|
StackTrace = $"{exception.Message}\n{exception.StackTrace}"
|
|
};
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Wraps around exceptions to make them nicely serializable for the ui.
|
|
/// </summary>
|
|
public class ErrorWrapper
|
|
{
|
|
public required string Message { get; set; }
|
|
public required string StackTrace { get; set; }
|
|
}
|