Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dev with changes from main #3654

Merged
merged 5 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public ServerAccountComponent()
: base(
"Account from Server/Token",
"AccST",
"Returns an account based on a Server URL and a token. URL can be a stream url too.\n TREAT EACH TOKEN AS A PASSWORD AND NEVER SHARE/SAVE IT IN THE FILE ITSELF",
"Returns an account based on a Server URL and a token. URL can be a stream url too.\n You'll need to raise a token with at least Profile:Read and Stream:Read to access your account data. Add Stream:Write to enable publishing.\n TREAT EACH TOKEN AS A PASSWORD AND NEVER SHARE/SAVE IT IN THE FILE ITSELF",
ComponentCategories.PRIMARY_RIBBON,
ComponentCategories.COMPUTE
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ public ComponentTracker(GH_Component parent)
Parent = parent;
}

private static void AppendHostAppInfoToProperties(Dictionary<string, object> properties)
private static void AppendHostAppInfoToProperties(Dictionary<string, object?> properties)
{
properties["hostAppVersion"] = Loader.GetGrasshopperHostAppVersion();
properties["hostApp"] = HostApplications.Grasshopper.Slug;
}

public void TrackEvent(Speckle.Core.Logging.Analytics.Events eventName, Dictionary<string, object> properties)
public void TrackEvent(Speckle.Core.Logging.Analytics.Events eventName, Dictionary<string, object?> properties)
{
AppendHostAppInfoToProperties(properties);
Speckle.Core.Logging.Analytics.TrackEvent(eventName, properties);
Expand All @@ -44,9 +44,9 @@ public void TrackNodeRun(string? name = null, string? node = null)
Speckle.Core.Logging.Analytics.TrackEvent(Speckle.Core.Logging.Analytics.Events.NodeRun, customProperties);
}

public void TrackNodeSend(Account acc, bool auto, bool sync = false)
public void TrackNodeSend(Account acc, bool auto, string? workspaceId, bool sync = false)
{
var customProperties = new Dictionary<string, object>();
var customProperties = new Dictionary<string, object>() { { "workspace_id", workspaceId } };
if (auto)
{
customProperties.Add("auto", auto);
Expand All @@ -61,14 +61,15 @@ public void TrackNodeSend(Account acc, bool auto, bool sync = false)
Speckle.Core.Logging.Analytics.TrackEvent(acc, Speckle.Core.Logging.Analytics.Events.Send, customProperties);
}

public void TrackNodeReceive(Account acc, bool auto, bool isMultiplayer, string sourceHostApp)
public void TrackNodeReceive(Account acc, bool auto, bool isMultiplayer, string sourceHostApp, string? workspaceId)
{
var properties = new Dictionary<string, object>
var properties = new Dictionary<string, object?>
{
{ "auto", auto },
{ "isMultiplayer", isMultiplayer },
{ "sourceHostApp", HostApplications.GetHostAppFromString(sourceHostApp).Slug },
{ "sourceHostAppVersion", sourceHostApp },
{ "workspace_id", workspaceId },
};
AppendHostAppInfoToProperties(properties);
Speckle.Core.Logging.Analytics.TrackEvent(acc, Speckle.Core.Logging.Analytics.Events.Receive, properties);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,8 @@ public override void DoWork(Action<string, double> ReportProgress, Action Done)
Done();
return;
}
receiveComponent.Tracker.TrackNodeSend(client.Account, receiveComponent.AutoReceive);

receiveComponent.Tracker.TrackNodeSend(client.Account, receiveComponent.AutoReceive, null);

var remoteTransport = new ServerTransport(InputWrapper?.GetAccount().Result, InputWrapper?.StreamId);
remoteTransport.TransportName = "R";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ public override void DoWork(Action<string, double> ReportProgress, Action Done)
continue;
}

sendComponent.Tracker.TrackNodeSend(acc, sendComponent.AutoSend);
sendComponent.Tracker.TrackNodeSend(acc, sendComponent.AutoSend, null);

var serverTransport = new ServerTransport(acc, sw.StreamId) { TransportName = $"T{t}" };
transportBranches.Add(serverTransport, sw.BranchName ?? "main");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ public override void DoWork(Action<string, double> ReportProgress, Action Done)
transportBranches.Add(serverTransport, sw.BranchName ?? "main");
Transports.Add(serverTransport);

sendComponent.Tracker.TrackNodeSend(acc, sendComponent.AutoSend);
sendComponent.Tracker.TrackNodeSend(acc, sendComponent.AutoSend, null);
}
else if (transport is ITransport otherTransport)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,15 @@ public override void SolveInstanceWithLogContext(IGH_DataAccess DA)
return null;
}

Tracker.TrackNodeReceive(acc, AutoReceive, myCommit.authorId != acc.userInfo.id, myCommit.sourceApplication);
var workspaceId = await client.GetWorkspaceId(StreamWrapper.StreamId).ConfigureAwait(false);

Tracker.TrackNodeReceive(
acc,
AutoReceive,
myCommit.authorId != acc.userInfo.id,
myCommit.sourceApplication,
workspaceId
);

var totalObjectCount = 1;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -720,11 +720,14 @@ public override void DoWork(Action<string, double> ReportProgress, Action Done)
}

ReceivedCommit = myCommit;
var workspaceId = await receiveComponent.ApiClient.GetWorkspaceId(InputWrapper.StreamId).ConfigureAwait(false);

receiveComponent.Tracker.TrackNodeReceive(
acc,
receiveComponent.AutoReceive,
myCommit.authorId != acc.userInfo.id,
myCommit.sourceApplication
myCommit.sourceApplication,
workspaceId
);

if (CancellationToken.IsCancellationRequested)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,10 @@ public override void DoWork(Action<string, double> ReportProgress, Action Done)
transportBranches.Add(serverTransport, sw.BranchName ?? "main");
Transports.Add(serverTransport);

sendComponent.Tracker.TrackNodeSend(acc, sendComponent.AutoSend);
using Client c = new(acc);
var workspaceId = c.GetWorkspaceId(sw.StreamId).Result;

sendComponent.Tracker.TrackNodeSend(acc, sendComponent.AutoSend, workspaceId);
}
else if (transport is ITransport otherTransport)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public StreamGetWithTokenComponent()
: base(
"Stream Get with Token",
"SGetWT",
"Returns a stream that will authenticate with a specific user by their Personal Access Token.\n TREAT EACH TOKEN AS A PASSWORD AND NEVER SHARE/SAVE IT IN THE FILE ITSELF",
"Returns a stream that will authenticate with a specific user by their Personal Access Token.\n You'll need to raise a token with at least Profile:Read and Stream:Read to access your account data. Add Stream:Write to enable publishing.\n TREAT EACH TOKEN AS A PASSWORD AND NEVER SHARE/SAVE IT IN THE FILE ITSELF",
ComponentCategories.PRIMARY_RIBBON,
ComponentCategories.COMPUTE
)
Expand Down
2 changes: 1 addition & 1 deletion Core/Core/Api/GraphQL/Inputs/ProjectInputs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public sealed record ProjectModelsFilter(
IReadOnlyList<string>? ids,
bool? onlyWithVersions,
string? search,
IReadOnlyList<string> sourceApps
IReadOnlyList<string>? sourceApps
);

public sealed record ProjectModelsTreeFilter(
Expand Down
1 change: 1 addition & 0 deletions Core/Core/Api/GraphQL/Models/ProjectCollaborator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ namespace Speckle.Core.Api.GraphQL.Models;

public sealed class ProjectCollaborator
{
public string id { get; init; }
public string role { get; init; }
public LimitedUser user { get; init; }
}
14 changes: 10 additions & 4 deletions Core/Core/Logging/SpeckleLog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,8 @@ SpeckleLogConfiguration logConfiguration
var serilogLogConfiguration = new LoggerConfiguration().MinimumLevel
.Is(logConfiguration.MinimumLevel)
.Enrich.FromLogContext()
.Enrich.WithProperty("version", fileVersionInfo.FileVersion)
.Enrich.WithProperty("productVersion", fileVersionInfo.ProductVersion)
.Enrich.WithProperty("version", fileVersionInfo?.FileVersion ?? "unknown")
.Enrich.WithProperty("productVersion", fileVersionInfo?.ProductVersion ?? "unknown")
.Enrich.WithProperty("hostOs", DetermineHostOsSlug())
.Enrich.WithProperty("hostOsVersion", Environment.OSVersion)
.Enrich.WithProperty("hostOsArchitecture", RuntimeInformation.ProcessArchitecture.ToString())
Expand Down Expand Up @@ -264,9 +264,15 @@ private static string GetUserIdFromDefaultAccount()
return id;
}

private static FileVersionInfo GetFileVersionInfo()
private static FileVersionInfo? GetFileVersionInfo()
{
var assembly = Assembly.GetExecutingAssembly().Location;
string assembly = Assembly.GetExecutingAssembly().Location;

if (string.IsNullOrEmpty(assembly))
{
return null;
}

return FileVersionInfo.GetVersionInfo(assembly);
}

Expand Down
44 changes: 10 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,46 +1,22 @@
<h1 align="center">
<img src="https://user-images.githubusercontent.com/2679513/131189167-18ea5fe1-c578-47f6-9785-3748178e4312.png" width="150px"/><br/>
Speckle | Sharp
Speckle | Sharp (Legacy)
</h1>
<h3 align="center">
.NET SDK, tooling, schema and Connectors
</h3>
<p align="center"><b>Speckle</b> is data infrastructure for the AEC industry.</p><br/>

<p align="center"><a href="https://twitter.com/SpeckleSystems"><img src="https://img.shields.io/twitter/follow/SpeckleSystems?style=social" alt="Twitter Follow"></a> <a href="https://speckle.community"><img src="https://img.shields.io/discourse/users?server=https%3A%2F%2Fspeckle.community&amp;style=flat-square&amp;logo=discourse&amp;logoColor=white" alt="Community forum users"></a> <a href="https://speckle.systems"><img src="https://img.shields.io/badge/https://-speckle.systems-royalblue?style=flat-square" alt="website"></a> <a href="https://speckle.guide/dev/"><img src="https://img.shields.io/badge/docs-speckle.guide-orange?style=flat-square&amp;logo=read-the-docs&amp;logoColor=white" alt="docs"></a></p>
<p align="center"><a href="https://circleci.com/gh/specklesystems/speckle-sharp"><img src="https://circleci.com/gh/specklesystems/speckle-sharp.svg?style=svg" alt=".NET Core"></a></p>

# About Speckle

What is Speckle? Check our ![YouTube Video Views](https://img.shields.io/youtube/views/B9humiSpHzM?label=Speckle%20in%201%20minute%20video&style=social)

### Features

- **Object-based:** say goodbye to files! Speckle is the first object based platform for the AEC industry
- **Version control:** Speckle is the Git & Hub for geometry and BIM data
- **Collaboration:** share your designs collaborate with others
- **3D Viewer:** see your CAD and BIM models online, share and embed them anywhere
- **Interoperability:** get your CAD and BIM models into other software without exporting or importing
- **Real time:** get real time updates and notifications and changes
- **GraphQL API:** get what you need anywhere you want it
- **Webhooks:** the base for a automation and next-gen pipelines
- **Built for developers:** we are building Speckle with developers in mind and got tools for every stack
- **Built for the AEC industry:** Speckle connectors are plugins for the most common software used in the industry such as Revit, Rhino, Grasshopper, AutoCAD, Civil 3D, Excel, Unreal Engine, Unity, QGIS, Blender and more!
> Speckle is the first AEC data hub that connects with your favorite AEC tools. Speckle exists to overcome the challenges of working in a fragmented industry where communication, creative workflows, and the exchange of data are often hindered by siloed software and processes. It is here to make the industry better.

### Try Speckle now!

Give Speckle a try in no time by:

- [![speckle](https://img.shields.io/badge/https://-app.speckle.systems-0069ff?style=flat-square&logo=hackthebox&logoColor=white)](https://app.speckle.systems) ⇒ creating an account
- [![create a droplet](https://img.shields.io/badge/Create%20a%20Droplet-0069ff?style=flat-square&logo=digitalocean&logoColor=white)](https://marketplace.digitalocean.com/apps/speckle-server?refcode=947a2b5d7dc1) ⇒ deploying an instance in 1 click

### Resources
<h3 align="center">
.NET SDK, tooling, schema and Connectors
</h3>

- [![Community forum users](https://img.shields.io/badge/community-forum-green?style=for-the-badge&logo=discourse&logoColor=white)](https://speckle.community) for help, feature requests or just to hang with other speckle enthusiasts, check out our community forum!
- [![website](https://img.shields.io/badge/tutorials-speckle.systems-royalblue?style=for-the-badge&logo=youtube)](https://speckle.systems) our tutorials portal is full of resources to get you started using Speckle
- [![docs](https://img.shields.io/badge/docs-speckle.guide-orange?style=for-the-badge&logo=read-the-docs&logoColor=white)](https://speckle.guide/dev/) reference on almost any end-user and developer functionality
<p align="center"><a href="https://circleci.com/gh/specklesystems/speckle-sharp"><img src="https://circleci.com/gh/specklesystems/speckle-sharp.svg?style=svg" alt=".NET Core"></a></p>

![Untitled](https://user-images.githubusercontent.com/2679513/132021739-15140299-624d-4410-98dc-b6ae6d9027ab.png)
> [!WARNING]
> This is our legacy .NET repo! Check out our active .NET repos here:
> [`speckle-sharp-connectors`](https://github.com/specklesystems/speckle-sharp-connectors): our .NET next generation connectors and desktop UI
> [`speckle-sharp-sdk`](https://github.com/specklesystems/speckle-sharp-sdk): our .NET SDK, Tests, and Objects

# Repo structure

Expand Down