Skip to content

Commit

Permalink
Merge branch 'master' of github.com:Squidex/squidex
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastianStehle committed Sep 3, 2024
2 parents 908d86d + bec6377 commit efd00e4
Show file tree
Hide file tree
Showing 55 changed files with 193 additions and 200 deletions.
10 changes: 5 additions & 5 deletions backend/extensions/Squidex.Extensions/Squidex.Extensions.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,22 @@
<ItemGroup>
<PackageReference Include="Algolia.Search" Version="6.17.0" />
<PackageReference Include="Azure.Monitor.OpenTelemetry.Exporter" Version="1.3.0" />
<PackageReference Include="Azure.Search.Documents" Version="11.5.1" />
<PackageReference Include="Confluent.SchemaRegistry.Serdes.Avro" Version="2.4.0" />
<PackageReference Include="Azure.Search.Documents" Version="11.6.0" />
<PackageReference Include="Confluent.SchemaRegistry.Serdes.Avro" Version="2.5.2" />
<PackageReference Include="CoreTweet" Version="1.0.0.483" />
<PackageReference Include="Elasticsearch.Net" Version="7.17.5" />
<PackageReference Include="Google.Cloud.Diagnostics.Common" Version="5.2.0" />
<PackageReference Include="Google.Cloud.Logging.V2" Version="4.4.0" />
<PackageReference Include="Google.Cloud.Monitoring.V3" Version="3.11.0" />
<PackageReference Include="Meziantou.Analyzer" Version="2.0.159">
<PackageReference Include="Meziantou.Analyzer" Version="2.0.163">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Azure.CognitiveServices.Vision.ComputerVision" Version="7.0.1" />
<PackageReference Include="Microsoft.Azure.SignalR.Management" Version="1.25.2" />
<PackageReference Include="Microsoft.Azure.SignalR.Management" Version="1.27.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
<PackageReference Include="Microsoft.OData.Core" Version="7.21.3" />
<PackageReference Include="Microsoft.OData.Core" Version="8.0.1" />
<PackageReference Include="NodaTime" Version="3.1.11" />
<PackageReference Include="OpenSearch.Net" Version="1.7.1" />
<PackageReference Include="OpenTelemetry.Exporter.Console" Version="1.9.0" />
Expand Down
2 changes: 1 addition & 1 deletion backend/src/Migrations/Migrations.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Meziantou.Analyzer" Version="2.0.159">
<PackageReference Include="Meziantou.Analyzer" Version="2.0.163">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<DebugSymbols>True</DebugSymbols>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Meziantou.Analyzer" Version="2.0.159">
<PackageReference Include="Meziantou.Analyzer" Version="2.0.163">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,26 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================

using Esprima.Ast;
using Acornima.Ast;
using Jint;
using Microsoft.Extensions.Caching.Memory;

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

internal sealed class Parser
internal sealed class CacheParser
{
private static readonly TimeSpan CacheDuration = TimeSpan.FromMinutes(10);

private readonly IMemoryCache cache;

public Parser(IMemoryCache cache)
public CacheParser(IMemoryCache cache)
{
this.cache = cache;
}

public Prepared<Script> Parse(string script)
{
var cacheKey = $"{typeof(Parser)}_Script_{script}";
var cacheKey = $"{typeof(CacheParser)}_Script_{script}";

return cache.GetOrCreate(cacheKey, entry =>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// ==========================================================================

using System.Diagnostics;
using Esprima;
using Acornima;
using Jint;
using Jint.Native;
using Jint.Runtime;
Expand All @@ -26,13 +26,13 @@ namespace Squidex.Domain.Apps.Core.Scripting;
public sealed class JintScriptEngine : IScriptEngine, IScriptDescriptor
{
private readonly IJintExtension[] extensions;
private readonly Parser parser;
private readonly CacheParser parser;
private readonly TimeSpan timeoutScript;
private readonly TimeSpan timeoutExecution;

public JintScriptEngine(IMemoryCache cache, IOptions<JintScriptOptions> options, IEnumerable<IJintExtension>? extensions = null)
{
parser = new Parser(cache);
parser = new CacheParser(cache);

timeoutScript = options.Value.TimeoutScript;
timeoutExecution = options.Value.TimeoutExecution;
Expand Down Expand Up @@ -203,7 +203,7 @@ static Exception BuildException(string errorKey, string message, Exception? inne
return BuildException("common.jsParseError", inner.Message);
case JavaScriptException:
return BuildException("common.jsError", inner.Message);
case ParserException:
case ParseErrorException:
return BuildException("common.jsError", inner.Message);
case DomainException:
return inner;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================

using Esprima.Ast;
using Acornima.Ast;
using Jint;
using Jint.Native;
using Squidex.Infrastructure.Tasks;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,18 @@
<ProjectReference Include="..\Squidex.Shared\Squidex.Shared.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Fluid.Core" Version="2.10.0" />
<PackageReference Include="GeoJSON.Net" Version="1.2.19" />
<PackageReference Include="Jint" Version="3.1.4" />
<PackageReference Include="Meziantou.Analyzer" Version="2.0.159">
<PackageReference Include="Fluid.Core" Version="2.11.1" />
<PackageReference Include="GeoJSON.Net" Version="1.4.1" />
<PackageReference Include="Jint" Version="4.0.2" />
<PackageReference Include="Meziantou.Analyzer" Version="2.0.163">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.0" />
<PackageReference Include="NJsonSchema" Version="11.0.1" />
<PackageReference Include="NJsonSchema" Version="11.0.2" />
<PackageReference Include="RefactoringEssentials" Version="5.6.0" PrivateAssets="all" />
<PackageReference Include="Squidex.AI" Version="6.18.0" />
<PackageReference Include="Squidex.Messaging.Subscriptions" Version="6.18.0" />
<PackageReference Include="Squidex.AI" Version="6.19.0" />
<PackageReference Include="Squidex.Messaging.Subscriptions" Version="6.19.0" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="all" />
<PackageReference Include="System.Collections.Immutable" Version="8.0.0" />
<PackageReference Include="System.Linq.Async" Version="6.0.1" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,13 @@ public override IEnumerable<FluidValue> Enumerate(TemplateContext context)
}
}

public override ValueTask WriteToAsync(TextWriter writer, TextEncoder encoder, CultureInfo cultureInfo)
{
writer.Write(value);
return default;
}

[Obsolete("Made obsolete in base library.")]
public override void WriteTo(TextWriter writer, TextEncoder encoder, CultureInfo cultureInfo)
{
writer.Write(value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ protected override string CollectionName()
protected override Task SetupCollectionAsync(IMongoCollection<MongoAppEntity> collection,
CancellationToken ct)
{
return collection.Indexes.CreateManyAsync(new[]
{
return collection.Indexes.CreateManyAsync(
[
new CreateIndexModel<MongoAppEntity>(
Index
.Ascending(x => x.IndexedName)),
Expand All @@ -39,7 +39,7 @@ protected override Task SetupCollectionAsync(IMongoCollection<MongoAppEntity> co
new CreateIndexModel<MongoAppEntity>(
Index
.Ascending(x => x.IndexedTeamId))
}, ct);
], ct);
}

Task IDeleter.DeleteAppAsync(App app,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ protected override string CollectionName()
protected override Task SetupCollectionAsync(IMongoCollection<MongoAssetFolderEntity> collection,
CancellationToken ct)
{
return collection.Indexes.CreateManyAsync(new[]
{
return collection.Indexes.CreateManyAsync(
[
new CreateIndexModel<MongoAssetFolderEntity>(
Index
.Ascending(x => x.IndexedAppId)
.Ascending(x => x.ParentId)
.Ascending(x => x.IsDeleted))
}, ct);
], ct);
}

public async Task<IResultList<AssetFolder>> QueryAsync(DomainId appId, DomainId? parentId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ protected override string CollectionName()
protected override Task SetupCollectionAsync(IMongoCollection<MongoAssetEntity> collection,
CancellationToken ct)
{
return collection.Indexes.CreateManyAsync(new[]
{
return collection.Indexes.CreateManyAsync(
[
new CreateIndexModel<MongoAssetEntity>(
Index
.Descending(x => x.LastModified)
Expand All @@ -71,7 +71,7 @@ protected override Task SetupCollectionAsync(IMongoCollection<MongoAssetEntity>
Index
.Ascending(x => x.Id)
.Ascending(x => x.IsDeleted))
}, ct);
], ct);
}

public async IAsyncEnumerable<Asset> StreamAll(DomainId appId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ public Task<IMongoCollection<MongoContentEntity>> GetCollectionAsync(DomainId ap
var schemaCollection = schemaDatabase.GetCollection<MongoContentEntity>($"{prefixCollection}_{schemaId}");
await schemaCollection.Indexes.CreateManyAsync(
new[]
{
[
new CreateIndexModel<MongoContentEntity>(Index
.Descending(x => x.LastModified)
.Ascending(x => x.Id)
Expand All @@ -56,7 +55,7 @@ await schemaCollection.Indexes.CreateManyAsync(
.Ascending(x => x.IndexedSchemaId)
.Ascending(x => x.IsDeleted)
.Descending(x => x.LastModified))
});
]);
return schemaCollection;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ protected override string CollectionName()
protected override Task SetupCollectionAsync(IMongoCollection<HistoryEvent> collection,
CancellationToken ct)
{
return collection.Indexes.CreateManyAsync(new[]
{
return collection.Indexes.CreateManyAsync(
[
new CreateIndexModel<HistoryEvent>(
Index
.Ascending(x => x.OwnerId)
Expand All @@ -57,7 +57,7 @@ protected override Task SetupCollectionAsync(IMongoCollection<HistoryEvent> coll
.Ascending(x => x.OwnerId)
.Descending(x => x.Created)
.Descending(x => x.Version))
}, ct);
], ct);
}

async Task IDeleter.DeleteAppAsync(App app,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ protected override string CollectionName()
protected override async Task SetupCollectionAsync(IMongoCollection<MongoRuleEventEntity> collection,
CancellationToken ct)
{
await collection.Indexes.CreateManyAsync(new[]
{
await collection.Indexes.CreateManyAsync(
[
new CreateIndexModel<MongoRuleEventEntity>(
Index.Ascending(x => x.NextAttempt)),

Expand All @@ -46,7 +46,7 @@ await collection.Indexes.CreateManyAsync(new[]
{
ExpireAfter = TimeSpan.Zero
})
}, ct);
], ct);
}

async Task IDeleter.DeleteAppAsync(App app,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ protected override string CollectionName()
protected override Task SetupCollectionAsync(IMongoCollection<MongoRuleEntity> collection,
CancellationToken ct)
{
return collection.Indexes.CreateManyAsync(new[]
{
return collection.Indexes.CreateManyAsync(
[
new CreateIndexModel<MongoRuleEntity>(
Index
.Ascending(x => x.IndexedAppId))
}, ct);
], ct);
}

Task IDeleter.DeleteAppAsync(App app,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ protected override string CollectionName()
protected override Task SetupCollectionAsync(IMongoCollection<MongoSchemaEntity> collection,
CancellationToken ct)
{
return collection.Indexes.CreateManyAsync(new[]
{
return collection.Indexes.CreateManyAsync(
[
new CreateIndexModel<MongoSchemaEntity>(
Index
.Ascending(x => x.IndexedAppId)
.Ascending(x => x.IndexedName))
}, ct);
], ct);
}

Task IDeleter.DeleteAppAsync(App app,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Lucene.Net.QueryParser" Version="4.8.0-beta00016" />
<PackageReference Include="Meziantou.Analyzer" Version="2.0.159">
<PackageReference Include="Meziantou.Analyzer" Version="2.0.163">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="MongoDB.Driver" Version="2.27.0" />
<PackageReference Include="MongoDB.Driver" Version="2.28.0" />
<PackageReference Include="RefactoringEssentials" Version="5.6.0" PrivateAssets="all" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="all" />
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ protected override string CollectionName()
protected override Task SetupCollectionAsync(IMongoCollection<MongoTeamEntity> collection,
CancellationToken ct)
{
return collection.Indexes.CreateManyAsync(new[]
{
return collection.Indexes.CreateManyAsync(
[
new CreateIndexModel<MongoTeamEntity>(
Index
.Ascending(x => x.IndexedUserIds))
}, ct);
], ct);
}

public async Task<List<Team>> QueryAllAsync(string contributorId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ protected MongoTextIndexBase(IMongoDatabase database, string shardKey, CommandFa
protected override Task SetupCollectionAsync(IMongoCollection<MongoTextIndexEntity<T>> collection,
CancellationToken ct)
{
return collection.Indexes.CreateManyAsync(new[]
{
return collection.Indexes.CreateManyAsync(
[
new CreateIndexModel<MongoTextIndexEntity<T>>(
Index
.Ascending(x => x.AppId)
Expand All @@ -59,7 +59,7 @@ protected override Task SetupCollectionAsync(IMongoCollection<MongoTextIndexEnti
.Ascending(x => x.SchemaId)
.Ascending(x => x.GeoField)
.Geo2DSphere(x => x.GeoObject))
}, ct);
], ct);
}

protected override string CollectionName()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================

using GraphQL;
using GraphQL.DataLoader;
using Microsoft.Extensions.Options;
using Squidex.Domain.Apps.Entities.Assets;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
using Squidex.Infrastructure.Json;
using Squidex.Infrastructure.Tasks;

#pragma warning disable MA0073 // Avoid comparison with bool constant

namespace Squidex.Domain.Apps.Entities.Contents.Queries.Steps;

public sealed class ConvertData : IContentEnricherStep
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="CsvHelper" Version="33.0.1" />
<PackageReference Include="GraphQL" Version="7.8.0" />
<PackageReference Include="GraphQL.DataLoader" Version="7.8.0" />
<PackageReference Include="Meziantou.Analyzer" Version="2.0.159">
<PackageReference Include="GraphQL" Version="8.0.2" />
<PackageReference Include="GraphQL.DataLoader" Version="8.0.2" />
<PackageReference Include="Meziantou.Analyzer" Version="2.0.163">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="8.0.0" />
<PackageReference Include="Notifo.SDK" Version="1.7.5" />
<PackageReference Include="RefactoringEssentials" Version="5.6.0" PrivateAssets="all" />
<PackageReference Include="Squidex.CLI.Core" Version="13.0.0" />
<PackageReference Include="Squidex.CLI.Core" Version="13.3.0" />
<PackageReference Include="Squidex.YDotNet.Extensions" Version="0.2.9" />
<PackageReference Include="Squidex.YDotNet.Server" Version="0.2.9" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="all" />
Expand Down
Loading

0 comments on commit efd00e4

Please sign in to comment.