Skip to content

Commit 912719e

Browse files
committed
Remove Packages with Questionable licenses. Update SEmantic Kernel due to security issues.
1 parent 5eae157 commit 912719e

File tree

6 files changed

+50
-65
lines changed

6 files changed

+50
-65
lines changed

Bellatrix.LLM/Bellatrix.LLM.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
<ItemGroup>
1616
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="10.0.1" />
17-
<PackageReference Include="Microsoft.SemanticKernel" Version="1.68.0" />
17+
<PackageReference Include="Microsoft.SemanticKernel" Version="1.70.0" />
1818
<!-- DO NOT update Microsoft.KernelMemory unless we move to .NET 9 -->
1919
<PackageReference Include="Microsoft.KernelMemory" Version="0.98.250508.3" />
2020
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="10.0.0" />

src/Bellatrix.Api/Bellatrix.API.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<ItemGroup>
88

9-
<PackageReference Include="Newtonsoft.Json.Schema" Version="4.0.1" />
9+
<PackageReference Include="JsonSchema.Net" Version="9.1.0" />
1010

1111
<PackageReference Include="NUnit" Version="4.4.0" />
1212
<PackageReference Include="Polly" Version="8.6.5" />

src/Bellatrix.Api/assertions/AssertExtensions.cs

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
using System.Linq;
1818
using System.Net;
1919
using System.Text;
20+
using System.Text.Json;
2021
using System.Xml;
2122
using System.Xml.Schema;
22-
using Newtonsoft.Json.Linq;
23-
using Newtonsoft.Json.Schema;
23+
using Json.Schema;
2424
using RestSharp;
2525

2626
namespace Bellatrix.Api;
@@ -212,20 +212,17 @@ public static void AssertSchema(this MeasuredResponse response, Uri schemaUri)
212212
AssertXmlSchema(response, schemaUri);
213213
}
214214
}
215-
216215
private static void AssertJsonSchema(MeasuredResponse response, string schemaContent)
217216
{
218-
JSchema jsonSchema;
219-
217+
JsonSchema jsonSchema;
220218
try
221219
{
222-
jsonSchema = JSchema.Parse(schemaContent);
220+
jsonSchema = JsonSchema.FromText(schemaContent);
223221
}
224222
catch (Exception ex)
225223
{
226224
throw new ArgumentException("Schema is not valid schema", ex);
227225
}
228-
229226
AssertJsonSchema(response, jsonSchema);
230227
}
231228

@@ -237,26 +234,24 @@ private static void AssertJsonSchema(MeasuredResponse response, Uri schemaUri)
237234
AssertJsonSchema(response, schemaResponse.Content);
238235
}
239236

240-
private static void AssertJsonSchema(MeasuredResponse response, JSchema jsonSchema)
237+
private static void AssertJsonSchema(MeasuredResponse response, JsonSchema jsonSchema)
241238
{
242-
IList<string> messages;
243-
244-
var trimmedContent = response.Content.TrimStart();
245-
246-
bool isSchemaValid =
247-
trimmedContent.StartsWith("{", StringComparison.Ordinal)
248-
? JObject.Parse(response.Content).IsValid(jsonSchema, out messages)
249-
: JArray.Parse(response.Content).IsValid(jsonSchema, out messages);
250-
251-
if (!isSchemaValid)
239+
var jsonDocument = JsonDocument.Parse(response.Content);
240+
var result = jsonSchema.Evaluate(jsonDocument.RootElement);
241+
if (!result.IsValid)
252242
{
253243
var sb = new StringBuilder();
254244
sb.AppendLine("JSON Schema is not valid. Error Messages:");
255-
foreach (var errorMessage in messages)
245+
foreach (var detail in result.Details)
256246
{
257-
sb.AppendLine(errorMessage);
247+
if (detail.Errors != null)
248+
{
249+
foreach (var error in detail.Errors)
250+
{
251+
sb.AppendLine($"{detail.InstanceLocation}: {error.Value}");
252+
}
253+
}
258254
}
259-
260255
throw new ApiAssertException(sb.ToString());
261256
}
262257
}

src/Bellatrix.Playwright/Bellatrix.Playwright.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<Import Project="..\..\shared\SharedAssemblyInfo.targets" />
88

99
<ItemGroup>
10-
<PackageReference Include="AutoMapper" Version="16.0.0" />
10+
<PackageReference Include="Mapster" Version="10.0.0-pre01" />
1111
<PackageReference Include="Microsoft.Playwright" Version="1.57.0" />
1212
<PackageReference Include="Microsoft.Playwright.NUnit" Version="1.57.0" />
1313
<PackageReference Include="MSTest" Version="4.0.2" />

src/Bellatrix.Playwright/services/CookiesService.cs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// <author>Miriam Kyoseva</author>
1313
// <site>https://bellatrix.solutions/</site>
1414

15-
using AutoMapper;
15+
using Mapster;
1616
using Bellatrix.Playwright.Services.Browser;
1717
using Bellatrix.Playwright.Services;
1818

@@ -34,9 +34,7 @@ public void AddCookie(string cookieName, string cookieValue, string path = "/")
3434

3535
public void AddCookie(System.Net.Cookie cookieToAdd)
3636
{
37-
var config = ServicesCollection.Current.Resolve<MapperConfiguration>();
38-
var mapper = config.CreateMapper();
39-
Cookie cookie = mapper.Map<Cookie>(cookieToAdd);
37+
Cookie cookie = cookieToAdd.Adapt<Cookie>();
4038

4139
AddCookie(cookie);
4240
}
@@ -58,15 +56,11 @@ public void DeleteCookie(string cookieName)
5856

5957
Cookie[] updatedCookies = new Cookie[cookies.Count];
6058

61-
var config = ServicesCollection.Current.Resolve<MapperConfiguration>();
62-
var mapper = config.CreateMapper();
63-
6459
for (int i = 0; i < updatedCookies.Length; i++)
6560
{
66-
updatedCookies[i] = mapper.Map<Cookie>(cookies.ElementAt(i));
61+
updatedCookies[i] = cookies.ElementAt(i).Adapt<Cookie>();
6762
}
6863

69-
7064
CurrentContext.AddCookies(updatedCookies);
7165
}
7266

src/Bellatrix.Playwright/syncplaywright/getbyoptions/MapperService.cs

Lines changed: 28 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -12,49 +12,45 @@
1212
// <author>Miriam Kyoseva</author>
1313
// <site>https://bellatrix.solutions/</site>
1414

15-
using AutoMapper;
15+
using Mapster;
1616

1717
namespace Bellatrix.Playwright.SyncPlaywright;
1818

1919
internal static class MapperService
2020
{
21-
private static MapperConfiguration Config;
22-
private static IMapper Mapper;
21+
private static readonly TypeAdapterConfig Config;
2322

2423
static MapperService()
2524
{
26-
Config = new MapperConfiguration(cfg =>
27-
{
28-
cfg.CreateMap<GetByAltTextOptions, LocatorGetByAltTextOptions>();
29-
cfg.CreateMap<GetByAltTextOptions, FrameLocatorGetByAltTextOptions>();
30-
cfg.CreateMap<GetByAltTextOptions, PageGetByAltTextOptions>();
31-
32-
cfg.CreateMap<GetByLabelOptions, LocatorGetByLabelOptions>();
33-
cfg.CreateMap<GetByLabelOptions, FrameLocatorGetByLabelOptions>();
34-
cfg.CreateMap<GetByLabelOptions, PageGetByLabelOptions>();
35-
36-
cfg.CreateMap<GetByPlaceholderOptions, LocatorGetByPlaceholderOptions>();
37-
cfg.CreateMap<GetByPlaceholderOptions, FrameLocatorGetByPlaceholderOptions>();
38-
cfg.CreateMap<GetByPlaceholderOptions, PageGetByPlaceholderOptions>();
39-
40-
cfg.CreateMap<GetByRoleOptions, LocatorGetByRoleOptions>();
41-
cfg.CreateMap<GetByRoleOptions, FrameLocatorGetByRoleOptions>();
42-
cfg.CreateMap<GetByRoleOptions, PageGetByRoleOptions>();
43-
44-
cfg.CreateMap<GetByTextOptions, LocatorGetByTextOptions>();
45-
cfg.CreateMap<GetByTextOptions, FrameLocatorGetByTextOptions>();
46-
cfg.CreateMap<GetByTextOptions, PageGetByTextOptions>();
47-
48-
cfg.CreateMap<GetByTitleOptions, LocatorGetByTitleOptions>();
49-
cfg.CreateMap<GetByTitleOptions, FrameLocatorGetByTitleOptions>();
50-
cfg.CreateMap<GetByTitleOptions, PageGetByTitleOptions>();
51-
}, null);
52-
53-
Mapper = Config.CreateMapper();
25+
Config = new TypeAdapterConfig();
26+
27+
Config.NewConfig<GetByAltTextOptions, LocatorGetByAltTextOptions>();
28+
Config.NewConfig<GetByAltTextOptions, FrameLocatorGetByAltTextOptions>();
29+
Config.NewConfig<GetByAltTextOptions, PageGetByAltTextOptions>();
30+
31+
Config.NewConfig<GetByLabelOptions, LocatorGetByLabelOptions>();
32+
Config.NewConfig<GetByLabelOptions, FrameLocatorGetByLabelOptions>();
33+
Config.NewConfig<GetByLabelOptions, PageGetByLabelOptions>();
34+
35+
Config.NewConfig<GetByPlaceholderOptions, LocatorGetByPlaceholderOptions>();
36+
Config.NewConfig<GetByPlaceholderOptions, FrameLocatorGetByPlaceholderOptions>();
37+
Config.NewConfig<GetByPlaceholderOptions, PageGetByPlaceholderOptions>();
38+
39+
Config.NewConfig<GetByRoleOptions, LocatorGetByRoleOptions>();
40+
Config.NewConfig<GetByRoleOptions, FrameLocatorGetByRoleOptions>();
41+
Config.NewConfig<GetByRoleOptions, PageGetByRoleOptions>();
42+
43+
Config.NewConfig<GetByTextOptions, LocatorGetByTextOptions>();
44+
Config.NewConfig<GetByTextOptions, FrameLocatorGetByTextOptions>();
45+
Config.NewConfig<GetByTextOptions, PageGetByTextOptions>();
46+
47+
Config.NewConfig<GetByTitleOptions, LocatorGetByTitleOptions>();
48+
Config.NewConfig<GetByTitleOptions, FrameLocatorGetByTitleOptions>();
49+
Config.NewConfig<GetByTitleOptions, PageGetByTitleOptions>();
5450
}
5551

5652
public static T ConvertTo<T>(this IOptions options)
5753
{
58-
return Mapper.Map<T>(options);
54+
return options.Adapt<T>(Config);
5955
}
6056
}

0 commit comments

Comments
 (0)