Skip to content

Commit

Permalink
Update CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastianStehle committed Mar 1, 2023
1 parent 2cce330 commit 758905e
Show file tree
Hide file tree
Showing 17 changed files with 41 additions and 14 deletions.
2 changes: 1 addition & 1 deletion cli/Squidex.CLI/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
<PackageTags>Squidex HeadlessCMS</PackageTags>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<Version>9.5</Version>
<Version>9.6</Version>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// ==========================================================================

using System.Security.Cryptography;
using Squidex.CLI.Commands.Implementation.Utils;

namespace Squidex.CLI.Commands.Implementation.FileSystem;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

using LibGit2Sharp;
using Squidex.CLI.Commands.Implementation.FileSystem.Default;
using Squidex.CLI.Commands.Implementation.Utils;
using Squidex.Text;

namespace Squidex.CLI.Commands.Implementation.FileSystem.Git;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using CsvHelper.Configuration;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Squidex.CLI.Commands.Implementation.Utils;
using Squidex.ClientLibrary;
using Squidex.ClientLibrary.Management;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace Squidex.CLI.Commands.Implementation;

public static class LogExtensions
internal static class LogExtensions
{
private static readonly SemaphoreSlim LockObject = new SemaphoreSlim(1);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// ==========================================================================

using Squidex.CLI.Commands.Implementation.FileSystem;
using Squidex.CLI.Commands.Implementation.Utils;
using Squidex.ClientLibrary.Management;

namespace Squidex.CLI.Commands.Implementation.Sync.App;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// ==========================================================================

using Squidex.CLI.Commands.Implementation.FileSystem;
using Squidex.CLI.Commands.Implementation.Utils;
using Squidex.ClientLibrary;
using Squidex.ClientLibrary.Management;

Expand Down Expand Up @@ -189,9 +190,10 @@ private async Task MapSchemaIdsToNamesAsync(ISession session, ExtendableRules cu

foreach (var rule in current.Items)
{
if (rule.Trigger is ContentChangedRuleTriggerDto contentTrigger && contentTrigger.Schemas != null)
if (rule.Trigger is ContentChangedRuleTriggerDto contentTrigger)
{
MapSchemas(contentTrigger, map);
MapSchemas(contentTrigger.Schemas, map);
MapSchemas(contentTrigger.ReferencedSchemas, map);
}
}
}
Expand All @@ -204,16 +206,22 @@ private async Task MapSchemaNamesToIdsAsync(ISession session, List<RuleModel> mo

foreach (var newRule in models)
{
if (newRule.Trigger is ContentChangedRuleTriggerDto contentTrigger && contentTrigger.Schemas != null)
if (newRule.Trigger is ContentChangedRuleTriggerDto contentTrigger)
{
MapSchemas(contentTrigger, map);
MapSchemas(contentTrigger.Schemas, map);
MapSchemas(contentTrigger.ReferencedSchemas, map);
}
}
}

private void MapSchemas(ContentChangedRuleTriggerDto dto, Dictionary<string, string> schemaMap)
private void MapSchemas(List<SchemaCondition>? schemas, Dictionary<string, string> schemaMap)
{
foreach (var schema in dto.Schemas)
if (schemas == null)
{
return;
}

foreach (var schema in schemas)
{
if (!schemaMap.TryGetValue(schema.SchemaId!, out var found))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// ==========================================================================

using Squidex.CLI.Commands.Implementation.FileSystem;
using Squidex.CLI.Commands.Implementation.Utils;
using Squidex.ClientLibrary.Management;

#pragma warning disable CS0618 // Type or member is obsolete
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// ==========================================================================

using Squidex.CLI.Commands.Implementation.FileSystem;
using Squidex.CLI.Commands.Implementation.Utils;

namespace Squidex.CLI.Commands.Implementation.Sync;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// ==========================================================================

using Squidex.CLI.Commands.Implementation.FileSystem;
using Squidex.CLI.Commands.Implementation.Utils;
using Squidex.ClientLibrary.Management;

namespace Squidex.CLI.Commands.Implementation.Sync.Workflows;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
using System.Text.RegularExpressions;
using Newtonsoft.Json;

namespace Squidex.CLI.Commands.Implementation;
namespace Squidex.CLI.Commands.Implementation.Utils;

public static class Extensions
internal static class Extensions
{
private static readonly Regex QueryRegex = new Regex(@"[?&](\w[\w.]*)=([^?&]+)");

Expand Down Expand Up @@ -57,7 +57,7 @@ public static async Task Foreach<T>(this IEnumerable<T> source, Func<T, int, Tas

public static string Sha256Base64(this string value)
{
return Sha256Base64(Encoding.UTF8.GetBytes(value));
return Encoding.UTF8.GetBytes(value).Sha256Base64();
}

public static string Sha256Base64(this byte[] bytes)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

namespace Squidex.CLI.Commands.Implementation.Utils;

public static class SimpleMapper
internal static class SimpleMapper
{
private sealed class StringConversionPropertyMapper : PropertyMapper
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace Squidex.CLI.Commands.Implementation.Utils;

public static class TaskExtensions
internal static class TaskExtensions
{
#pragma warning disable RECS0165 // Asynchronous methods should return a Task instead of void
public static async void BidirectionalLinkTo<T>(this ISourceBlock<T> source, ITargetBlock<T> target)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

using Newtonsoft.Json;
using Squidex.CLI.Commands.Implementation;
using Squidex.CLI.Commands.Implementation.Utils;
using Squidex.ClientLibrary;
using Squidex.ClientLibrary.Configuration;

Expand Down
2 changes: 1 addition & 1 deletion cli/Squidex.CLI/Squidex.CLI.Core/Helper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace Squidex.CLI;

public static class Helper
internal static class Helper
{
private static readonly JsonSerializerSettings SerializerSettings = new JsonSerializerSettings();
private static readonly JsonSerializer Serializer;
Expand Down
10 changes: 10 additions & 0 deletions cli/Squidex.CLI/Squidex.CLI.Core/Properties/Properties.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// ==========================================================================
// Squidex Headless CMS
// ==========================================================================
// Copyright (c) Squidex UG (haftungsbeschraenkt)
// All rights reserved. Licensed under the MIT license.
// ==========================================================================

using System.Runtime.CompilerServices;

[assembly: InternalsVisibleTo("sq")]
1 change: 1 addition & 0 deletions cli/Squidex.CLI/Squidex.CLI/Commands/App_Content.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
using Squidex.CLI.Commands.Implementation;
using Squidex.CLI.Commands.Implementation.ImExport;
using Squidex.CLI.Commands.Implementation.TestData;
using Squidex.CLI.Commands.Implementation.Utils;
using Squidex.CLI.Configuration;
using Squidex.ClientLibrary;

Expand Down

0 comments on commit 758905e

Please sign in to comment.