Skip to content

Commit 0a22ecf

Browse files
Improved mongo config. (#1272)
* Improved mongo config. * Update dependencies. * Disable test in CI for now.
1 parent 1fb76e4 commit 0a22ecf

File tree

20 files changed

+118
-57
lines changed

20 files changed

+118
-57
lines changed

backend/src/Squidex.Data.EntityFramework/Squidex.Data.EntityFramework.csproj

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@
4040
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql.Json.Microsoft" Version="8.0.3" />
4141
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql.NetTopologySuite" Version="8.0.3" />
4242
<PackageReference Include="RefactoringEssentials" Version="5.6.0" PrivateAssets="all" />
43-
<PackageReference Include="Squidex.AI.EntityFramework" Version="7.34.0" />
44-
<PackageReference Include="Squidex.Assets.EntityFramework" Version="7.34.0" />
45-
<PackageReference Include="Squidex.Assets.TusAdapter" Version="7.34.0" />
46-
<PackageReference Include="Squidex.Events.EntityFramework" Version="7.34.0" />
47-
<PackageReference Include="Squidex.Flows.EntityFramework" Version="7.34.0" />
48-
<PackageReference Include="Squidex.Hosting" Version="7.34.0" />
49-
<PackageReference Include="Squidex.Messaging.EntityFramework" Version="7.34.0" />
43+
<PackageReference Include="Squidex.AI.EntityFramework" Version="7.37.0" />
44+
<PackageReference Include="Squidex.Assets.EntityFramework" Version="7.37.0" />
45+
<PackageReference Include="Squidex.Assets.TusAdapter" Version="7.37.0" />
46+
<PackageReference Include="Squidex.Events.EntityFramework" Version="7.37.0" />
47+
<PackageReference Include="Squidex.Flows.EntityFramework" Version="7.37.0" />
48+
<PackageReference Include="Squidex.Hosting" Version="7.37.0" />
49+
<PackageReference Include="Squidex.Messaging.EntityFramework" Version="7.37.0" />
5050
<PackageReference Include="Squidex.OpenIdDict.EntityFramework" Version="5.8.4" />
5151
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="all" />
5252
<PackageReference Include="System.ValueTuple" Version="4.5.0" />

backend/src/Squidex.Data.MongoDb/ServiceExtensions.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,9 @@ public static void AddSquidexMongoStore(this IServiceCollection services, IConfi
202202
shardKey => ActivatorUtilities.CreateInstance<MongoContentRepository>(c, shardKey, contentDatabase));
203203
}).As<IContentRepository>().As<ISnapshotStore<WriteContent>>().As<IDeleter>();
204204

205-
var atlasOptions = config.GetSection("store:mongoDb:atlas").Get<AtlasOptions>() ?? new ();
205+
var derivate = config.GetValue<MongoDerivate>("store:mongoDb:derivate");
206206

207+
var atlasOptions = config.GetSection("store:mongoDb:atlas").Get<AtlasOptions>() ?? new ();
207208
if (atlasOptions.IsConfigured() && atlasOptions.FullTextEnabled)
208209
{
209210
services.Configure<AtlasOptions>(config.GetSection("store:mongoDb:atlas"));
@@ -226,7 +227,7 @@ public static void AddSquidexMongoStore(this IServiceCollection services, IConfi
226227
shardKey => ActivatorUtilities.CreateInstance<AtlasTextIndex>(c, shardKey));
227228
}).AsOptional<ITextIndex>().As<IDeleter>();
228229
}
229-
else if (config.GetValue<bool>("store:mongoDb:documentDb"))
230+
else if (config.GetValue<MongoDerivate>("store:mongoDb:derivate") == MongoDerivate.DocumentDB)
230231
{
231232
services.AddSingletonAs(c =>
232233
{

backend/src/Squidex.Data.MongoDb/Squidex.Data.MongoDb.csproj

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@
2525
<PackageReference Include="MongoDB.Driver.GridFS" Version="2.30.0" />
2626
<PackageReference Include="NodaTime.Serialization.SystemTextJson" Version="1.3.0" />
2727
<PackageReference Include="RefactoringEssentials" Version="5.6.0" PrivateAssets="all" />
28-
<PackageReference Include="Squidex.AI.Mongo" Version="7.34.0" />
29-
<PackageReference Include="Squidex.Assets.Mongo" Version="7.34.0" />
30-
<PackageReference Include="Squidex.Events.Mongo" Version="7.34.0" />
31-
<PackageReference Include="Squidex.Flows.Mongo" Version="7.34.0" />
32-
<PackageReference Include="Squidex.Hosting" Version="7.34.0" />
33-
<PackageReference Include="Squidex.Messaging.Mongo" Version="7.34.0" />
28+
<PackageReference Include="Squidex.AI.Mongo" Version="7.37.0" />
29+
<PackageReference Include="Squidex.Assets.Mongo" Version="7.37.0" />
30+
<PackageReference Include="Squidex.Events.Mongo" Version="7.37.0" />
31+
<PackageReference Include="Squidex.Flows.Mongo" Version="7.37.0" />
32+
<PackageReference Include="Squidex.Hosting" Version="7.37.0" />
33+
<PackageReference Include="Squidex.Messaging.Mongo" Version="7.37.0" />
3434
<PackageReference Include="Squidex.OpenIddict.MongoDb" Version="5.8.5" />
3535
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="all" />
3636
<PackageReference Include="System.ValueTuple" Version="4.5.0" />

backend/src/Squidex.Domain.Apps.Core.Model/Squidex.Domain.Apps.Core.Model.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<PackageReference Include="NetTopologySuite" Version="2.5.0" />
2121
<PackageReference Include="NodaTime.Serialization.SystemTextJson" Version="1.3.0" />
2222
<PackageReference Include="RefactoringEssentials" Version="5.6.0" PrivateAssets="all" />
23-
<PackageReference Include="Squidex.Flows" Version="7.34.0" />
23+
<PackageReference Include="Squidex.Flows" Version="7.37.0" />
2424
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="all" />
2525
<PackageReference Include="System.Collections.Immutable" Version="8.0.0" />
2626
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />

backend/src/Squidex.Domain.Apps.Core.Operations/Scripting/AssetScriptVars.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
// ==========================================================================
77

88
using System.Security.Claims;
9-
using NodaTime;
109
using Squidex.Infrastructure;
1110

1211
namespace Squidex.Domain.Apps.Core.Scripting;

backend/src/Squidex.Domain.Apps.Core.Operations/Scripting/Internal/JintObjectConverter.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ public bool TryConvert(Engine engine, object value, [MaybeNullWhen(false)] out J
4545
case ClaimsPrincipal principal:
4646
result = JintUser.Create(engine, principal);
4747
return true;
48+
case ScriptVars vars:
49+
result = ObjectWrapper.Create(engine, vars);
50+
return true;
4851
case JsonValue jsonValue:
4952
result = JsonMapper.Map(jsonValue, engine);
5053
return true;

backend/src/Squidex.Domain.Apps.Core.Operations/Scripting/ScriptVars.cs

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
namespace Squidex.Domain.Apps.Core.Scripting;
1515

16-
public class ScriptVars : IReadOnlyDictionary<string, object?>
16+
public class ScriptVars : IDictionary<string, object?>
1717
{
1818
private readonly Dictionary<string, object?> values = new Dictionary<string, object?>(StringComparer.OrdinalIgnoreCase);
1919
private readonly HashSet<string> lockedKeys = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
@@ -33,6 +33,18 @@ public int Count
3333
get => values.Count;
3434
}
3535

36+
ICollection<string> IDictionary<string, object?>.Keys
37+
{
38+
get => values.Keys;
39+
}
40+
41+
ICollection<object?> IDictionary<string, object?>.Values
42+
{
43+
get => values.Values;
44+
}
45+
46+
public bool IsReadOnly => throw new NotImplementedException();
47+
3648
public object? this[string key]
3749
{
3850
get
@@ -46,6 +58,12 @@ public object? this[string key]
4658
}
4759
}
4860

61+
public void CopyTo(KeyValuePair<string, object?>[] array, int arrayIndex)
62+
{
63+
Guard.NotNull(array);
64+
((IDictionary)values).CopyTo(array, arrayIndex);
65+
}
66+
4967
public void CopyFrom(ScriptVars vars)
5068
{
5169
Guard.NotNull(vars);
@@ -129,6 +147,11 @@ public bool ContainsKey(string key)
129147
return values.ContainsKey(key);
130148
}
131149

150+
public bool Contains(KeyValuePair<string, object?> item)
151+
{
152+
return values.Contains(item);
153+
}
154+
132155
IEnumerator<KeyValuePair<string, object?>> IEnumerable<KeyValuePair<string, object?>>.GetEnumerator()
133156
{
134157
return values.GetEnumerator();
@@ -138,4 +161,29 @@ IEnumerator IEnumerable.GetEnumerator()
138161
{
139162
return values.GetEnumerator();
140163
}
164+
165+
public void Add(string key, object? value)
166+
{
167+
throw new NotSupportedException();
168+
}
169+
170+
public void Add(KeyValuePair<string, object?> item)
171+
{
172+
throw new NotSupportedException();
173+
}
174+
175+
public bool Remove(string key)
176+
{
177+
throw new NotSupportedException();
178+
}
179+
180+
public bool Remove(KeyValuePair<string, object?> item)
181+
{
182+
throw new NotSupportedException();
183+
}
184+
185+
public void Clear()
186+
{
187+
throw new NotSupportedException();
188+
}
141189
}

backend/src/Squidex.Domain.Apps.Core.Operations/Squidex.Domain.Apps.Core.Operations.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<ItemGroup>
2121
<PackageReference Include="Fluid.Core" Version="2.12.0" />
2222
<PackageReference Include="GeoJSON.Net" Version="1.4.1" />
23-
<PackageReference Include="Jint" Version="4.4.1" />
23+
<PackageReference Include="Jint" Version="4.4.2" />
2424
<PackageReference Include="Meziantou.Analyzer" Version="2.0.179">
2525
<PrivateAssets>all</PrivateAssets>
2626
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
@@ -29,8 +29,8 @@
2929
<PackageReference Include="NJsonSchema" Version="11.0.2" />
3030
<PackageReference Include="NodaTime.Serialization.SystemTextJson" Version="1.3.0" />
3131
<PackageReference Include="RefactoringEssentials" Version="5.6.0" PrivateAssets="all" />
32-
<PackageReference Include="Squidex.AI" Version="7.34.0" />
33-
<PackageReference Include="Squidex.Messaging.Subscriptions" Version="7.34.0" />
32+
<PackageReference Include="Squidex.AI" Version="7.37.0" />
33+
<PackageReference Include="Squidex.Messaging.Subscriptions" Version="7.37.0" />
3434
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="all" />
3535
<PackageReference Include="System.Collections.Immutable" Version="8.0.0" />
3636
<PackageReference Include="System.Linq.Async" Version="6.0.1" />

backend/src/Squidex.Infrastructure/Squidex.Infrastructure.csproj

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@
2424
<PackageReference Include="NodaTime" Version="3.2.0" />
2525
<PackageReference Include="OpenTelemetry.Api" Version="1.9.0" />
2626
<PackageReference Include="RefactoringEssentials" Version="5.6.0" PrivateAssets="all" />
27-
<PackageReference Include="Squidex.Assets" Version="7.34.0" />
28-
<PackageReference Include="Squidex.Caching" Version="7.34.0" />
29-
<PackageReference Include="Squidex.Events" Version="7.34.0" />
30-
<PackageReference Include="Squidex.Hosting.Abstractions" Version="7.34.0" />
31-
<PackageReference Include="Squidex.Log" Version="7.34.0" />
32-
<PackageReference Include="Squidex.Messaging" Version="7.34.0" />
33-
<PackageReference Include="Squidex.Text" Version="7.34.0" />
27+
<PackageReference Include="Squidex.Assets" Version="7.37.0" />
28+
<PackageReference Include="Squidex.Caching" Version="7.37.0" />
29+
<PackageReference Include="Squidex.Events" Version="7.37.0" />
30+
<PackageReference Include="Squidex.Hosting.Abstractions" Version="7.37.0" />
31+
<PackageReference Include="Squidex.Log" Version="7.37.0" />
32+
<PackageReference Include="Squidex.Messaging" Version="7.37.0" />
33+
<PackageReference Include="Squidex.Text" Version="7.37.0" />
3434
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="all" />
3535
<PackageReference Include="System.Collections.Immutable" Version="8.0.0" />
3636
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />

backend/src/Squidex.Infrastructure/States/Persistence.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,6 @@ private async Task ReadEventsAsync(
137137
foreach (var @event in events)
138138
{
139139
var newVersion = versionEvents + 1;
140-
141140
if (@event.EventStreamNumber != newVersion)
142141
{
143142
ThrowHelper.InvalidOperationException("Events must follow the snapshot version in consecutive order with no gaps.");
@@ -146,7 +145,6 @@ private async Task ReadEventsAsync(
146145
if (!isStopped)
147146
{
148147
var parsedEvent = eventFormatter.ParseIfKnown(@event);
149-
150148
if (applyEvent != null && parsedEvent != null)
151149
{
152150
isStopped = !applyEvent(parsedEvent);
@@ -161,14 +159,12 @@ public async Task WriteSnapshotAsync(T state,
161159
CancellationToken ct = default)
162160
{
163161
var oldVersion = versionSnapshot;
164-
165162
if (oldVersion == EtagVersion.Empty && UseEventSourcing)
166163
{
167164
oldVersion = versionEvents - 1;
168165
}
169166

170167
var newVersion = UseEventSourcing ? versionEvents : oldVersion + 1;
171-
172168
if (newVersion == versionSnapshot)
173169
{
174170
return;

0 commit comments

Comments
 (0)